diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php
index 5da28670b90..1bd3b44af90 100755
--- a/htdocs/compta/journal/purchasesjournal.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -34,19 +34,19 @@ if ($user->societe_id > 0)
/*******************************************************************
-* ACTIONS
-*
-* Put here all code to do according to value of "action" parameter
-********************************************************************/
+ * ACTIONS
+ *
+ * Put here all code to do according to value of "action" parameter
+ ********************************************************************/
/***************************************************
-* PAGE
-*
-* Put here all code to build page
-****************************************************/
+ * PAGE
+ *
+ * Put here all code to build page
+ ****************************************************/
llxHeader('','','');
@@ -74,8 +74,8 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
$idpays = $p[0];
-$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle, f.total_ttc,";
-$sql .= " fd.tva_tx, fd.total_ht, fd.tva, fd.product_type,";
+$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
+$sql .= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
$sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd ";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
@@ -85,47 +85,47 @@ $sql .= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
$sql .= " WHERE f.fk_statut > 0 AND f.entity IN (0,".$conf->entity.")";
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
- $result = $db->query($sql);
- if ($result)
- {
- $num = $db->num_rows($result);
- // les variables
- $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER))?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef");
- $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows($result);
+ // les variables
+ $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER))?$conf->global->COMPTA_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef");
+ $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
- $tabfac = array();
- $tabht = array();
- $tabtva = array();
- $tabttc = array();
+ $tabfac = array();
+ $tabht = array();
+ $tabtva = array();
+ $tabttc = array();
- $i=0;
- while ($i < $num)
- {
- $obj = $db->fetch_object($result);
- // contrĂ´les
- $compta_soc = (! empty($obj->code_compta_fournisseur))?$obj->code_compta_fournisseur:$cptfour;
- $compta_prod = $obj->accountancy_code_buy;
- if (empty($compta_prod))
- {
- if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
- else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
- }
- $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
+ $i=0;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($result);
+ // contrĂ´les
+ $compta_soc = (! empty($obj->code_compta_fournisseur))?$obj->code_compta_fournisseur:$cptfour;
+ $compta_prod = $obj->accountancy_code_buy;
+ if (empty($compta_prod))
+ {
+ if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
+ else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
+ }
+ $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
- $tabfac[$obj->rowid]["date"] = $obj->datef;
- $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
- $tabfac[$obj->rowid]["type"] = $obj->type;
- $tabfac[$obj->rowid]["lib"] = $obj->libelle;
- $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
- $tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
- $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
+ $tabfac[$obj->rowid]["date"] = $obj->datef;
+ $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
+ $tabfac[$obj->rowid]["type"] = $obj->type;
+ $tabfac[$obj->rowid]["lib"] = $obj->libelle;
+ $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
+ $tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
+ $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
- $i++;
- }
- }
- else {
- dol_print_error($db);
- }
+ $i++;
+ }
+}
+else {
+ dol_print_error($db);
+}
/*
* Show result array
@@ -137,7 +137,7 @@ print "
";
print "| ".$langs->trans("Date")." | ";
print "".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").") | ";
print "".$langs->trans("Account")." | ";
-print "".$langs->trans("Label")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
+print "".$langs->trans("Type")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
print "
\n";
$var=true;
@@ -152,35 +152,40 @@ foreach ($tabfac as $key => $val)
$invoicestatic->type=$val["type"];
print "";
- // invoice
+ // third party
//print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
print "".$val["date"]." | ";
print "".$invoicestatic->getNomUrl(1)." | ";
+
foreach ($tabttc[$key] as $k => $mt)
{
- print "".$k." | ".$val["lib"]." | ".$mt." | | ";
+ print "".$k." | ".$langs->trans("ThirdParty")." | ".($mt>=0?$mt:'')." | ".($mt<0?-$mt:'')." | ";
}
print "
";
// product
foreach ($tabht[$key] as $k => $mt)
{
- print "";
- //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
- print "".$val["date"]." | ";
- print "".$invoicestatic->getNomUrl(1)." | ";
- print "".$k." | ".$val["lib"]." | | ".$mt." |
";
+ if ($mt)
+ {
+ print "";
+ //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
+ print "".$k." | ".$langs->trans("Products")." | ".($mt<0?-$mt:'')." | ".($mt>=0?$mt:'')." |
";
+ }
}
// vat
+ //var_dump($tabtva);
foreach ($tabtva[$key] as $k => $mt)
{
- if ($mt)
- {
- print "";
- //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
- print "".$val["date"]." | ";
- print "".$invoicestatic->getNomUrl(1)." | ";
- print "".$k." | ".$val["lib"]." | | ".$mt." |
";
- }
+ if ($mt)
+ {
+ print "";
+ //print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
+ print "".$k." | ".$langs->trans("VAT")." ".$key." | ".($mt<0?-$mt:'')." | ".($mt>=0?$mt:'')." |
";
+ }
}
$var = !$var;
@@ -188,23 +193,6 @@ foreach ($tabfac as $key => $val)
print "";
-/***************************************************
-* LINKED OBJECT BLOCK
-*
-* Put here code to view linked object
-****************************************************/
-/*
-
-$myobject->load_object_linked($myobject->id,$myobject->element);
-
-foreach($myobject->linked_object as $linked_object => $linked_objectid)
-{
- if ($conf->$linked_object->enabled)
- {
- $somethingshown=$myobject->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
- }
-}
-*/
// End of page
$db->close();
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index 9d056f267b4..b14dacb1aa2 100755
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -117,7 +117,6 @@ if ($result)
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
$tabfac[$obj->rowid]["type"] = $obj->type;
- $tabfac[$obj->rowid]["lib"] = $obj->ref_client;
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
@@ -141,7 +140,7 @@ print "";
//print "| ".$langs->trans("JournalNum")." | ";
print "".$langs->trans("Date")." | ".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").") | ";
print "".$langs->trans("Account")." | ";
-print "".$langs->trans("Label")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
+print "".$langs->trans("Type")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
print "
\n";
$var=true;
@@ -156,25 +155,29 @@ foreach ($tabfac as $key => $val)
$invoicestatic->type=$val["type"];
print "";
- // invoice
+ // third party
//print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
print "".$val["date"]." | ";
print "".$invoicestatic->getNomUrl(1)." | ";
foreach ($tabttc[$key] as $k => $mt)
{
- print "".$k." | ".$val["lib"]." | ".$mt." | | ";
+ print "".$k." | ".$langs->trans("ThirdParty")." | ".($mt>=0?$mt:'')." | ".($mt<0?-$mt:'')." | ";
}
print "
";
// product
foreach ($tabht[$key] as $k => $mt)
{
- print "";
- //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
- print "".$val["date"]." | ";
- print "".$invoicestatic->getNomUrl(1)." | ";
- print "".$k." | ".$val["lib"]." | | ".$mt." |
";
+ if ($mt)
+ {
+ print "";
+ //print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
+ print "".$k." | ".$langs->trans("Products")." | ".($mt<0?-$mt:'')." | ".($mt>=0?$mt:'')." |
";
+ }
}
// vat
+ //var_dump($tabtva);
foreach ($tabtva[$key] as $k => $mt)
{
if ($mt)
@@ -183,7 +186,7 @@ foreach ($tabfac as $key => $val)
//print "".$conf->global->COMPTA_JOURNAL_SELL." | ";
print "".$val["date"]." | ";
print "".$invoicestatic->getNomUrl(1)." | ";
- print "".$k." | ".$val["lib"]." | | ".$mt." | ";
+ print "".$k." | ".$langs->trans("VAT")." ".$key." | ".($mt<0?-$mt:'')." | ".($mt>=0?$mt:'')." | ";
}
}
@@ -192,23 +195,6 @@ foreach ($tabfac as $key => $val)
print "";
-/***************************************************
-* LINKED OBJECT BLOCK
-*
-* Put here code to view linked object
-****************************************************/
-/*
-
-$myobject->load_object_linked($myobject->id,$myobject->element);
-
-foreach($myobject->linked_object as $linked_object => $linked_objectid)
-{
- if ($conf->$linked_object->enabled)
- {
- $somethingshown=$myobject->showLinkedObjectBlock($linked_object,$linked_objectid,$somethingshown);
- }
-}
-*/
// End of page
$db->close();