From 577229bde99af14860cd294d865c1da795362570 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 24 May 2020 21:46:34 +0200 Subject: [PATCH] Task #1532 : detail payment --- include/class/acc_ledger_purchase.class.php | 22 +++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 5b6fe187e..4365cfdc3 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -48,10 +48,12 @@ require_once NOALYSS_INCLUDE.'/class/stock_goods.class.php'; */ class Acc_Ledger_Purchase extends Acc_Ledger { + private $payment_operation; /*ledger_type='ACH'; parent::__construct($p_cn,$p_init); + $this->payment_operation=-1; } /*!\brief verify that the data are correct before inserting or confirming *\param an array (usually $_POST) @@ -878,7 +880,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $acc_pay->grpt=$acseq; $acc_pay->jrn=$mp->get_parameter('ledger_target'); $acc_pay->periode=$tperiode; - $acc_pay->type=($famount>=0)?'c':'d'; + $acc_pay->type=($famount>=0)?'c':'d'; $acc_pay->insert_jrnx(); /* Insert supplier */ @@ -899,6 +901,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $acc_pay->desc=(!isset($e_comm_paiement) || strlen(trim($e_comm_paiement)) == 0) ?$e_comm:$e_comm_paiement; $mp_jr_id=$acc_pay->insert_jrn(); + $this->payment_operation=$mp_jr_id; $acjrn->grpt_id=$acseq; $acjrn->update_internal_code($acinternal); // add an automatic PJ if ODS @@ -1700,19 +1703,30 @@ EOF; */ if ( $e_mp!=0 && strlen (trim (${'e_mp_qcode_'.$e_mp})) != 0 ) { + $r.="

"; $r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp}); $r.=HtmlInput::hidden('acompte',$acompte); - $r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement); - $r.=HtmlInput::hidden('mp_date',$mp_date); + $r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement); + $r.=HtmlInput::hidden('mp_date',$mp_date); /* needed for generating a invoice */ $r.=HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp}); $fname = new Fiche($this->db); $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp}); + $detail_payment=""; + // payment operation + if ($this->payment_operation != 1) { + $pay_internal=$this->db->get_value("select jr_internal from jrn where jr_id=$1", + [$this->payment_operation]); + $detail_payment=HtmlInput::detail_op($this->payment_operation,$pay_internal); + } $r.='

' . _("Payé par")." " . ${'e_mp_qcode_' . $e_mp} . - " " . $fname->getName() . '

' . '

' . _('Déduction acompte ') . h($acompte) . '

' . + " " . $fname->getName() .$detail_payment. ' ' ; + $r.='

' . _('Déduction acompte ') . h($acompte) . '

' . _('Libellé :') . h($e_comm_paiement) ; $r.='
'; $r.='
'; + + $r.="

"; } // check for upload piece /*