Try a fix for #11852
This commit is contained in:
parent
421631f2be
commit
23860b15ee
@ -3914,17 +3914,17 @@ class Societe extends CommonObject
|
||||
while($obj=$this->db->fetch_object($resql)) {
|
||||
$tmpobject->id=$obj->rowid;
|
||||
|
||||
if ($obj->fk_statut != Facture::STATUS_DRAFT // Not a draft
|
||||
&& ! ($obj->fk_statut == Facture::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice
|
||||
if ($obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft
|
||||
&& ! ($obj->fk_statut == $tmpobject::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice
|
||||
)
|
||||
{
|
||||
$outstandingTotal+= $obj->total_ht;
|
||||
$outstandingTotalIncTax+= $obj->total_ttc;
|
||||
}
|
||||
if ($obj->paye == 0
|
||||
&& $obj->fk_statut != Facture::STATUS_DRAFT // Not a draft
|
||||
&& $obj->fk_statut != Facture::STATUS_ABANDONED // Not abandonned
|
||||
&& $obj->fk_statut != Facture::STATUS_CLOSED) // Not classified as paid
|
||||
&& $obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft
|
||||
&& $obj->fk_statut != $tmpobject::STATUS_ABANDONED // Not abandonned
|
||||
&& $obj->fk_statut != $tmpobject::STATUS_CLOSED) // Not classified as paid
|
||||
//$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason
|
||||
{
|
||||
$paiement = $tmpobject->getSommePaiement();
|
||||
@ -3935,7 +3935,11 @@ class Societe extends CommonObject
|
||||
}
|
||||
|
||||
//if credit note is converted but not used
|
||||
if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed())$outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed();
|
||||
// TODO Do this also for customer ?
|
||||
if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed())
|
||||
{
|
||||
$outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed();
|
||||
}
|
||||
}
|
||||
return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes'
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user