Fixed: [ bug #1570 ] Negative supplier invoices do not appear in bank

planned transactions.
This commit is contained in:
Laurent Destailleur 2014-11-16 16:36:32 +01:00
parent 64a2cce7c0
commit 01279edfc8

View File

@ -164,7 +164,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sql.= " ORDER BY dlr ASC";
// Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
@ -260,12 +260,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($obj->family == 'invoice_supplier')
{
// TODO This code is to avoid to count suppliers credit note (ff.type = 2)
// Ajouter gestion des avoirs fournisseurs, champ
if (($obj->total_ttc < 0 && $obj->type != 2)
|| ($obj->total_ttc > 0 && $obj->type == 2))
$showline=1;
// Uncomment this line to avoid to count suppliers credit note (ff.type = 2)
//$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2))
if ($showline)
{
$facturefournstatic->ref=$obj->ref;
$ref=$obj->ref;
$facturefournstatic->ref=$ref;
$facturefournstatic->id=$obj->objid;
$facturefournstatic->type=$obj->type;
$ref = $facturefournstatic->getNomUrl(1,'');
@ -304,7 +305,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
$solde += $total_ttc;
// We discard with a remain to pay to 0
// We discard lines with a remainder to pay to 0
if (price2num($total_ttc) != 0)
{
$var=!$var;