From a9ee54d9cc78521f199fe58bf32e6adfc684ef3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Dec 2010 09:10:23 +0000 Subject: [PATCH] The accountancy "piece" is the invoice o we need only one column. --- htdocs/compta/journal/purchasesjournal.php | 44 +++++++++++----------- htdocs/compta/journal/sellsjournal.php | 36 ++++++++++-------- 2 files changed, 44 insertions(+), 36 deletions(-) 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 ""; print ""; -print ""; -print ""; +print ""; print ""; print ""; 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 ""; - print ""; - print ""; + print ""; + print ""; foreach ($tabttc[$key] as $k => $mt) { print ""; } print ""; - // produit + // product foreach ($tabht[$key] as $k => $mt) { print ""; //print ""; - print ""; - print ""; + print ""; + print ""; print ""; } - // tva + // vat foreach ($tabtva[$key] as $k => $mt) { if ($mt) { print ""; //print ""; - print ""; - print ""; + print ""; + print ""; print ""; } } 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 "
".$langs->trans("JournalNum")."".$langs->trans("Date")."".$langs->trans("InvoiceRef")."".$langs->trans("Piece")."".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")".$langs->trans("Account")."".$langs->trans("Label")."".$langs->trans("Debit")."".$langs->trans("Credit")."
".$conf->global->COMPTA_JOURNAL_BUY."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."
".$conf->global->COMPTA_JOURNAL_BUY."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."
".$conf->global->COMPTA_JOURNAL_BUY."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."
"; print ""; //print ""; -print ""; -print ""; +print ""; +print ""; print ""; 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 ""; - print ""; - print ""; + print ""; + print ""; foreach ($tabttc[$key] as $k => $mt) { print ""; } print ""; - // produit + // product foreach ($tabht[$key] as $k => $mt) { print ""; //print ""; - print ""; - print ""; + print ""; + print ""; print ""; } - // tva + // vat foreach ($tabtva[$key] as $k => $mt) { if ($mt) { print ""; //print ""; - print ""; - print ""; + print ""; + print ""; print ""; } }
".$langs->trans("JournalNum")."".$langs->trans("Date")."".$langs->trans("InvoiceRef")."".$langs->trans("Piece")."".$langs->trans("Account")."".$langs->trans("Date")."".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")".$langs->trans("Account")."".$langs->trans("Label")."".$langs->trans("Debit")."".$langs->trans("Credit")."
".$conf->global->COMPTA_JOURNAL_SELL."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."
".$conf->global->COMPTA_JOURNAL_SELL."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."
".$conf->global->COMPTA_JOURNAL_SELL."".$val["date"]."".$val["ref"]."".$val["piece"]."".$val["date"]."".$invoicestatic->getNomUrl(1)."".$k."".$val["lib"]."".$mt."