diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php
index 67b400856c9..d3ddffc5529 100755
--- a/htdocs/compta/journal/purchasesjournal.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -1,6 +1,5 @@
- * Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@@ -20,6 +19,7 @@
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
$langs->load("companies");
$langs->load("other");
@@ -39,6 +39,8 @@ if ($user->societe_id > 0)
********************************************************************/
+
+
/***************************************************
* PAGE
*
@@ -49,11 +51,6 @@ llxHeader('','','');
$html=new Form($db);
-
-// Put here content of your page
-// ...
-
-
$year_current = strftime("%Y",dol_now());
$pastmonth = strftime("%m",dol_now()) - 1;
if ($pastmonth == 0) $pastmonth = 12;
@@ -76,9 +73,9 @@ 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.datef, f.libelle, f.total_ttc, ";
-$sql .= "fd.tva_tx, fd.total_ht, fd.tva, fd.product_type ";
-$sql .= " ,s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code";
+$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 .= " 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."'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product ";
@@ -116,7 +113,7 @@ if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
- $tabfac[$obj->rowid]["piece"] = ''; // todo
+ $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;
@@ -137,8 +134,7 @@ print "
";
print "";
///print "| ".$langs->trans("JournalNum")." | ";
print "".$langs->trans("Date")." | ";
-print "".$langs->trans("InvoiceRef")." | ";
-print "".$langs->trans("Piece")." | ";
+print "".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").") | ";
print "".$langs->trans("Account")." | ";
print "".$langs->trans("Label")." | ".$langs->trans("Debit")." | ".$langs->trans("Credit")." | ";
print "
\n";
@@ -146,36 +142,42 @@ print "\n";
$var=true;
$r='';
+$invoicestatic=new FactureFournisseur($db);
+
foreach ($tabfac as $key => $val)
{
+ $invoicestatic->id=$key;
+ $invoicestatic->ref=$val["ref"];
+ $invoicestatic->type=$val["type"];
+
print "";
- //facture
+ // invoice
//print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
foreach ($tabttc[$key] as $k => $mt)
{
print "".$k." | ".$val["lib"]." | ".$mt." | | ";
}
print "
";
- // produit
+ // product
foreach ($tabht[$key] as $k => $mt)
{
print "";
//print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
- // tva
+ // vat
foreach ($tabtva[$key] as $k => $mt)
{
if ($mt)
{
print "";
//print "| ".$conf->global->COMPTA_JOURNAL_BUY." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
}
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index b4fea4d40af..2acf7d41e45 100755
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -1,6 +1,5 @@
- * Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@@ -20,6 +19,7 @@
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
$langs->load("companies");
@@ -75,8 +75,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.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx ";
-$sql .= " , fd.total_ttc,p.accountancy_code_sell, s.code_compta , ct.accountancy_code";
+$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
+$sql .= " p.accountancy_code_sell, s.code_compta , ct.accountancy_code";
$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 ";
@@ -115,7 +115,7 @@ if ($result)
//la ligne facture
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
- $tabfac[$obj->rowid]["piece"] = ''; // todo
+ $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;
@@ -138,44 +138,50 @@ $i = 0;
print "";
print "";
//print "| ".$langs->trans("JournalNum")." | ";
-print "".$langs->trans("Date")." | ".$langs->trans("InvoiceRef")." | ";
-print "".$langs->trans("Piece")." | ".$langs->trans("Account")." | ";
+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 "
\n";
$var=true;
$r='';
+$invoicestatic=new Facture($db);
+
foreach ($tabfac as $key => $val)
{
+ $invoicestatic->id=$key;
+ $invoicestatic->ref=$val["ref"];
+ $invoicestatic->type=$val["type"];
+
print "";
- //facture
+ // invoice
//print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
foreach ($tabttc[$key] as $k => $mt)
{
print "".$k." | ".$val["lib"]." | ".$mt." | | ";
}
print "
";
- // produit
+ // product
foreach ($tabht[$key] as $k => $mt)
{
print "";
//print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
- // tva
+ // vat
foreach ($tabtva[$key] as $k => $mt)
{
if ($mt)
{
print "";
//print "| ".$conf->global->COMPTA_JOURNAL_SELL." | ";
- print "".$val["date"]." | ".$val["ref"]." | ";
- print "".$val["piece"]." | ";
+ print "".$val["date"]." | ";
+ print "".$invoicestatic->getNomUrl(1)." | ";
print "".$k." | ".$val["lib"]." | | ".$mt." |
";
}
}