diff --git a/ChangeLog b/ChangeLog
index 15db292de73..74522e7b7c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@ English Dolibarr ChangeLog
- Fix: [ bug #794 ] Lost filter on zipcode in prospect list
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
- Fix: [ bug #817 ] Purchases journal does not reflect localtaxes
+- Fix: [ bug #816 ] Sales journal does not reflect localtaxes
- Fix: Orderstoinvoice didn't act as expected when no order was checked
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 66d78e66b9a..32505622a85 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2789,7 +2789,7 @@ else if ($id > 0 || ! empty($ref))
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat')
{
print '
| ';
- print $form->textwithpicto($langs->trans("Escompte").':',$langs->trans("HelpEscompte"),-1);
+ print $form->textwithpicto($langs->trans("Discount").':',$langs->trans("HelpEscompte"),-1);
print ' | '.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' | |
';
$resteapayeraffiche=0;
}
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index 4ffed9fa53c..495db3b4c65 100755
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -4,6 +4,7 @@
* Copyright (C) 2011 Juanjo Menent
* Copyright (C) 2012 Regis Houssin
* Copyright (C) 2011-2012 Alexandre Spangaro
+ * Copyright (C) 2013 Marcos García
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +25,8 @@
* \ingroup societe, facture
* \brief Page with sells journal
*/
+global $mysoc;
+
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -42,10 +45,10 @@ $date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
-// Security check
-if ($user->societe_id > 0) $socid = $user->societe_id;
-if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
-if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
+// Security check
+if ($user->societe_id > 0) $socid = $user->societe_id;
+if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
+if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
/*
* Actions
@@ -96,15 +99,17 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
$idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
-$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
+$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
-$sql.= " ct.accountancy_code_sell as account_tva";
+$sql.= " ct.accountancy_code_sell as account_tva, ctl1.accountancy_code_sell as account_localtax1, ctl2.accountancy_code_sell as account_localtax2";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl1 ON fd.localtax1_tx = ctl1.localtax1 AND ctl1.fk_pays = '".$idpays."'";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl2 ON fd.localtax2_tx = ctl2.localtax2 AND ctl2.fk_pays = '".$idpays."'";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
@@ -119,6 +124,8 @@ if ($result)
$tabfac = array();
$tabht = array();
$tabtva = array();
+ $tablocaltax1 = array();
+ $tablocaltax2 = array();
$tabttc = array();
$tabcompany = array();
@@ -139,6 +146,8 @@ if ($result)
}
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
+ $compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
+ $compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
//la ligne facture
$tabfac[$obj->rowid]["date"] = $obj->datef;
@@ -147,9 +156,13 @@ if ($result)
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0;
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0;
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
+ if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1]=0;
+ if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2]=0;
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
+ $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
+ $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
$i++;
}
@@ -215,7 +228,6 @@ foreach ($tabfac as $key => $val)
}
}
// vat
- //var_dump($tabtva);
foreach ($tabtva[$key] as $k => $mt)
{
if ($mt)
@@ -228,6 +240,32 @@ foreach ($tabfac as $key => $val)
print "".$langs->trans("VAT")." | ".($mt<0?price(-$mt):'')." | ".($mt>=0?price($mt):'')." | ";
}
}
+ // localtax1
+ foreach ($tablocaltax1[$key] as $k => $mt)
+ {
+ if ($mt)
+ {
+ print "";
+ //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
+ print "".$k;
+ print " | ".$langs->transcountrynoentities("LT1",$mysoc->country_code)." | ".($mt<0?price(-$mt):'')." | ".($mt>=0?price($mt):'')." |
";
+ }
+ }
+ // localtax2
+ foreach ($tablocaltax2[$key] as $k => $mt)
+ {
+ if ($mt)
+ {
+ print "";
+ //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
+ print "".$k;
+ print " | ".$langs->transcountrynoentities("LT2",$mysoc->country_code)." | ".($mt<0?price(-$mt):'')." | ".($mt>=0?price($mt):'')." |
";
+ }
+ }
$var = !$var;
}
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 78179acd8c9..c6c4aabf708 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -189,6 +189,7 @@ Abandoned=Abandoned
RemainderToPay=Remainder to pay
RemainderToTake=Remainder to take
RemainderToPayBack=Remainder to pay back
+Rest=Pending
AmountExpected=Amount claimed
ExcessReceived=Excess received
EscompteOffered=Discount offered (payment before term)
diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang
index e72c4637fd4..2ac03e256db 100644
--- a/htdocs/langs/es_ES/bills.lang
+++ b/htdocs/langs/es_ES/bills.lang
@@ -103,17 +103,17 @@ BillStatusValidated=Validada (a pagar)
BillStatusStarted=Pagada parcialmente
BillStatusNotPaid=Pendiente de pago
BillStatusClosedUnpaid=Cerrada (pendiente de pago)
-BillStatusClosedPaidPartially=Pagada (parcialmente)
+BillStatusClosedPaidPartially=Cerrada (pagada parcialmente)
BillShortStatusDraft=Borrador
BillShortStatusPaid=Pagada
BillShortStatusPaidBackOrConverted=Procesada
BillShortStatusConverted=Tratada
BillShortStatusCanceled=Abandonada
BillShortStatusValidated=Validada
-BillShortStatusStarted=Empezada
-BillShortStatusNotPaid=Pendiente de cobro
-BillShortStatusClosedUnpaid=Cerrada
-BillShortStatusClosedPaidPartially=Pagada
+BillShortStatusStarted=Pago parcial
+BillShortStatusNotPaid=Pte. pago
+BillShortStatusClosedUnpaid=Cerrada (pte. pago)
+BillShortStatusClosedPaidPartially=Cerrada (pago parcial)
PaymentStatusToValidShort=A validar
ErrorVATIntraNotConfigured=Número de IVA intracomunitario aún no configurado
ErrorNoPaiementModeConfigured=No hay definido modo de pago por defecto. Corregir desde el módulo factura
@@ -184,6 +184,7 @@ Abandoned=Abandonada
RemainderToPay=Queda por pagar
RemainderToTake=Queda por cobrar
RemainderToPayBack=Queda por reembolsar
+Rest=Pendiente
AmountExpected=Importe reclamado
ExcessReceived=Recibido en exceso
EscompteOffered=Descuento (Pronto pago)
diff --git a/htdocs/langs/es_ES/compta.lang b/htdocs/langs/es_ES/compta.lang
index 2f72861a920..248a41a843d 100644
--- a/htdocs/langs/es_ES/compta.lang
+++ b/htdocs/langs/es_ES/compta.lang
@@ -29,8 +29,8 @@ PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ningu
PaymentsNotLinkedToUser=Pagos no vinculados a un usuario
Profit=Beneficio
Balance=Saldo
-Debit=Débito
-Credit=Crédito
+Debit=Debe
+Credit=Haber
Withdrawl=Domiciliación
Withdrawls=Domiciliaciones
AmountHTVATRealReceived=Total repercutido
diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang
index 237dcedda8b..02789aa3402 100644
--- a/htdocs/langs/fr_FR/bills.lang
+++ b/htdocs/langs/fr_FR/bills.lang
@@ -184,6 +184,7 @@ Abandoned=Abandonné
RemainderToPay=Reste à payer
RemainderToTake=Reste à encaisser
RemainderToPayBack=Reste à rembourser
+Rest=Créance
AmountExpected=Montant réclamé
ExcessReceived=Trop perçu
EscompteOffered=Escompte (règlement avant échéance)