New: Add link to third party into sells and purchase journal.
This commit is contained in:
parent
a23df4f407
commit
daad1877a8
@ -18,6 +18,7 @@ For users:
|
|||||||
- New: Can insert links into elements lines. Also reported into PDF.
|
- New: Can insert links into elements lines. Also reported into PDF.
|
||||||
- New: When a member is validated, we can subscribe to mailing-lists
|
- New: When a member is validated, we can subscribe to mailing-lists
|
||||||
according to its type.
|
according to its type.
|
||||||
|
- New: Add link to third party into sells and purchase journal.
|
||||||
- Fix: No images into product description lines as PDF generation does
|
- Fix: No images into product description lines as PDF generation does
|
||||||
not work with this.
|
not work with this.
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ require("../../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php");
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -38,20 +39,16 @@ if ($user->societe_id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*
|
||||||
* ACTIONS
|
* Actions
|
||||||
*
|
*/
|
||||||
* Put here all code to do according to value of "action" parameter
|
|
||||||
********************************************************************/
|
// None
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
/***************************************************
|
*/
|
||||||
* PAGE
|
|
||||||
*
|
|
||||||
* Put here all code to build page
|
|
||||||
****************************************************/
|
|
||||||
|
|
||||||
llxHeader('','','');
|
llxHeader('','','');
|
||||||
|
|
||||||
@ -86,7 +83,9 @@ $idpays = $p[0];
|
|||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
|
$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.= " 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.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||||
|
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||||
|
$sql.= " ct.accountancy_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
$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."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";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||||
@ -107,6 +106,7 @@ if ($result)
|
|||||||
$tabht = array();
|
$tabht = array();
|
||||||
$tabtva = array();
|
$tabtva = array();
|
||||||
$tabttc = array();
|
$tabttc = array();
|
||||||
|
$tabcompany = array();
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -129,6 +129,7 @@ if ($result)
|
|||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -154,6 +155,7 @@ $var=true;
|
|||||||
$r='';
|
$r='';
|
||||||
|
|
||||||
$invoicestatic=new FactureFournisseur($db);
|
$invoicestatic=new FactureFournisseur($db);
|
||||||
|
$companystatic=new Fournisseur($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val)
|
foreach ($tabfac as $key => $val)
|
||||||
{
|
{
|
||||||
@ -197,15 +199,21 @@ foreach ($tabfac as $key => $val)
|
|||||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||||
print "<td>".$val["date"]."</td>";
|
print "<td>".$val["date"]."</td>";
|
||||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||||
|
|
||||||
foreach ($tabttc[$key] as $k => $mt)
|
foreach ($tabttc[$key] as $k => $mt)
|
||||||
{
|
{
|
||||||
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td>";
|
$companystatic->id=$tabcompany[$key]['id'];
|
||||||
|
$companystatic->name=$tabcompany[$key]['name'];
|
||||||
|
|
||||||
|
print "<td>".$k;
|
||||||
|
print "</td><td>".$langs->trans("ThirdParty");
|
||||||
|
print ' ('.$companystatic->getNomUrl(0,'supplier',16).')';
|
||||||
|
print "</td>";
|
||||||
print '<td align="right">'.($mt<0?-price(-$mt):'')."</td>";
|
print '<td align="right">'.($mt<0?-price(-$mt):'')."</td>";
|
||||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ require("../../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/societe/class/client.class.php");
|
||||||
|
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@ -38,26 +39,22 @@ if ($user->societe_id > 0)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
/*******************************************************************
|
// None
|
||||||
* ACTIONS
|
|
||||||
*
|
|
||||||
* Put here all code to do according to value of "action" parameter
|
|
||||||
********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************
|
|
||||||
* PAGE
|
|
||||||
*
|
|
||||||
* Put here all code to build page
|
|
||||||
****************************************************/
|
|
||||||
|
|
||||||
llxHeader('','','');
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
// Put here content of your page
|
llxHeader('',$langs->trans("SellsJournal"),'');
|
||||||
// ...
|
|
||||||
|
|
||||||
$year_current = strftime("%Y",dol_now());
|
$year_current = strftime("%Y",dol_now());
|
||||||
$pastmonth = strftime("%m",dol_now()) - 1;
|
$pastmonth = strftime("%m",dol_now()) - 1;
|
||||||
@ -87,7 +84,9 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
|
|||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|
||||||
$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 = "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.= " 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";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
$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."facture f ON f.rowid = fd.fk_facture";
|
||||||
@ -95,7 +94,7 @@ $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 ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
||||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||||
$sql .= " order by f.rowid";
|
$sql.= " ORDER BY f.rowid";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -104,6 +103,7 @@ if ($result)
|
|||||||
$tabht = array();
|
$tabht = array();
|
||||||
$tabtva = array();
|
$tabtva = array();
|
||||||
$tabttc = array();
|
$tabttc = array();
|
||||||
|
$tabcompany = array();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -130,7 +130,7 @@ if ($result)
|
|||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name,'client'=>$obj->client);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,6 +157,7 @@ $var=true;
|
|||||||
$r='';
|
$r='';
|
||||||
|
|
||||||
$invoicestatic=new Facture($db);
|
$invoicestatic=new Facture($db);
|
||||||
|
$companystatic=new Client($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val)
|
foreach ($tabfac as $key => $val)
|
||||||
{
|
{
|
||||||
@ -171,7 +172,13 @@ foreach ($tabfac as $key => $val)
|
|||||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||||
foreach ($tabttc[$key] as $k => $mt)
|
foreach ($tabttc[$key] as $k => $mt)
|
||||||
{
|
{
|
||||||
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td align='right'>".($mt>=0?price($mt):'')."</td><td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
$companystatic->id=$tabcompany[$key]['id'];
|
||||||
|
$companystatic->name=$tabcompany[$key]['name'];
|
||||||
|
$companystatic->client=$tabcompany[$key]['client'];
|
||||||
|
print "<td>".$k;
|
||||||
|
print "</td><td>".$langs->trans("ThirdParty");
|
||||||
|
print ' ('.$companystatic->getNomUrl(0,'customer',16).')';
|
||||||
|
print "</td><td align='right'>".($mt>=0?price($mt):'')."</td><td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
// product
|
// product
|
||||||
@ -183,7 +190,8 @@ foreach ($tabfac as $key => $val)
|
|||||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||||
print "<td>".$val["date"]."</td>";
|
print "<td>".$val["date"]."</td>";
|
||||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||||
print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
print "<td>".$k;
|
||||||
|
print "</td><td>".$langs->trans("Products")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vat
|
// vat
|
||||||
@ -196,7 +204,8 @@ foreach ($tabfac as $key => $val)
|
|||||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||||
print "<td>".$val["date"]."</td>";
|
print "<td>".$val["date"]."</td>";
|
||||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||||
print "<td>".$k."</td><td>".$langs->trans("VAT")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
print "<td>".$k;
|
||||||
|
print "</td><td>".$langs->trans("VAT")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user