From 01101cdea1cc1825a8f8d52c682db4cda3d1f9ee Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 20 Oct 2013 19:13:26 +0000 Subject: [PATCH] task #0000900: Ajout d'une date de paiement --- html/ajax_ledger.php | 18 + include/class_acc_ledger.php | 24 +- include/class_acc_operation.php | 3 +- include/class_acc_reconciliation.php | 22 +- include/export_histo_csv.php | 2 + include/export_ledger_csv.php | 3 +- include/template/ledger_detail_ach.php | 569 ++++++++++++----------- include/template/ledger_detail_ven.php | 567 +++++++++++----------- include/template/print_ledger_simple.php | 4 +- 9 files changed, 648 insertions(+), 564 deletions(-) diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php index 7e336dd30..3e9d836ca 100644 --- a/html/ajax_ledger.php +++ b/html/ajax_ledger.php @@ -405,6 +405,24 @@ case 'save': } } + + if (isset($_POST['p_date_paid']) ) + { + $ech=$_POST['p_date_paid']; + if ( trim($ech) != '' && isDate($ech) != null) + { + $cn->exec_sql("update jrn set jr_date_paid=to_date($1,'DD.MM.YYYY') where jr_id=$2", + array($ech,$jr_id)); + + } + else + { + $cn->exec_sql("update jrn set jr_date_paid=null where jr_id=$1", + array($jr_id)); + + } + } + $cn->exec_sql("update jrn set jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY') where jr_id=$3", array($_POST['lib'],$_POST['npj'],$jr_id,$_POST['p_date'])); $cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY') where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)", diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 4feb32d55..097b78876 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -538,6 +538,7 @@ class Acc_Ledger extends jrn_def_sql jrn.jr_montant as montant, substr(jrn.jr_comment,1,35) as comment, to_char(jrn.jr_date,'DD-MM-YYYY') as date, + to_char(jrn.jr_date_paid,'DD-MM-YYYY') as date_paid, jr_pj_number, jr_internal, jrn.jr_grpt_id as grpt_id, @@ -815,6 +816,7 @@ class Acc_Ledger extends jrn_def_sql $str_dossier = dossier::get(); $table->add("Date", $url, 'order by jr_date asc,substring(jr_pj_number,\'[0-9]+$\')::numeric asc', 'order by jr_date desc,substring(jr_pj_number,\'[0-9]+$\')::numeric desc', "da", "dd"); $table->add('Echeance', $url, " order by jr_ech asc", " order by jr_ech desc", 'ea', 'ed'); + $table->add('Paiement', $url, " order by jr_date_paid asc", " order by jr_date_paid desc", 'eap', 'edp'); $table->add('PJ', $url, ' order by substring(jr_pj_number,\'[0-9]+$\')::numeric asc ', ' order by substring(jr_pj_number,\'[0-9]+$\')::numeric desc ', "pja", "pjd"); $table->add('Tiers', $url, " order by name asc", " order by name desc", 'na', 'nd'); $table->add('Montant', $url, " order by jr_montant asc", " order by jr_montant desc", "ma", "md"); @@ -854,9 +856,10 @@ class Acc_Ledger extends jrn_def_sql $r.='' . $table->get_header(1) . ''; $r.='' . $table->get_header(2) . ''; $r.='' . $table->get_header(3) . ''; - $r.='' . $table->get_header(5) . ''; - $r.=th('Notes', ' style="width:15%"'); $r.='' . $table->get_header(4) . ''; + $r.='' . $table->get_header(6) . ''; + $r.=th('Notes', ' style="width:15%"'); + $r.='' . $table->get_header(5) . ''; // if $p_paid is not equal to 0 then we have a paid column if ($p_paid != 0) { @@ -894,11 +897,14 @@ class Acc_Ledger extends jrn_def_sql $r.=td($row['jrn_def_name']); // date $r.=""; - $r.=smaller_date($row['str_jr_date']); + $r.=$row['str_jr_date']; $r.=""; // echeance $r.=""; - $r.=smaller_date($row['str_jr_ech']); + $r.=$row['str_jr_ech']; + $r.=""; + $r.=""; + $r.=$row['str_jr_date_paid']; $r.=""; // pj @@ -2544,8 +2550,8 @@ class Acc_Ledger extends jrn_def_sql $sql = "select jr_id , jr_montant, substr(jr_comment,1,60) as jr_comment, - to_char(jr_ech,'DD.MM.YYYY') as str_jr_ech, - to_char(jr_date,'DD.MM.YYYY') as str_jr_date, + to_char(jr_ech,'DD.MM.YY') as str_jr_ech, + to_char(jr_date,'DD.MM.YY') as str_jr_date, jr_date as jr_date_order, jr_grpt_id, jr_rapt, @@ -2593,9 +2599,9 @@ class Acc_Ledger extends jrn_def_sql (select qp_internal,qp_price,qp_nd_tva,qp_nd_tva_recup,case when qp_vat_sided<>0 then 0 else qp_vat end as vat from quant_purchase where qp_internal=X.jr_internal) as invoice_purchase ) else null - end as total_invoice - - + end as total_invoice, + jr_date_paid, + to_char(jr_date_paid,'DD.MM.YY') as str_jr_date_paid from jrn as X left join jrn_note using(jr_id) join jrn_def on jrn_def_id=jr_def_id diff --git a/include/class_acc_operation.php b/include/class_acc_operation.php index 06cca852b..60361dcae 100644 --- a/include/class_acc_operation.php +++ b/include/class_acc_operation.php @@ -44,6 +44,7 @@ class Acc_Operation var $periode; /*!< periode to use */ var $amount; /*!< amount of the operatoin */ var $grpt; /*!< the group id */ + var $date_paid; /*! * \brief constructor set automatically the attributes user and periode * \param $p_cn the databse connection @@ -591,7 +592,7 @@ class Acc_Detail extends Acc_Operation $sql="SELECT jr_id, jr_def_id, jr_montant, jr_comment, jr_date, jr_grpt_id, jr_internal, jr_tech_date, jr_tech_per, jrn_ech, jr_ech, jr_rapt,jr_ech, jr_valid, jr_opid, jr_c_opid, jr_pj, jr_pj_name, jr_pj_type, - jr_pj_number, jr_mt,jr_rapt + jr_pj_number, jr_mt,jr_rapt,jr_date_paid FROM jrn where jr_id=$1"; $array=$this->db->get_array($sql,array($this->jr_id)); if ( count($array) == 0 ) throw new Exception('Aucune ligne trouvée'); diff --git a/include/class_acc_reconciliation.php b/include/class_acc_reconciliation.php index 7faf7b97d..d6a2bbf01 100644 --- a/include/class_acc_reconciliation.php +++ b/include/class_acc_reconciliation.php @@ -125,8 +125,26 @@ class Acc_Reconciliation // Ok we can insert $Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ". "(".$this->jr_id.",$jr_id2)"); - // try to letter automatically same account from both operation - $this->auto_letter($jr_id2); + // try to letter automatically same account from both operation + $this->auto_letter($jr_id2); + + // update date of paiement ----------------------------------------------------------------------- + $source_type=$this->db->get_value("select substr(jr_internal,1,1) from jrn where jr_id=$1",array($this->jr_id)); + $dest_type=$this->db->get_value("select substr(jr_internal,1,1) from jrn where jr_id=$1",array($jr_id2)); + if (($source_type =='A' || $source_type=='V') && ($dest_type != 'A' && $dest_type != 'V')) + { + // set the date on source + $date=$this->db->get_value('select jr_date from jrn where jr_id=$1',array($jr_id2)); + if ( trim ($date) == '') $date=null; + $this->db->exec_sql('update jrn set jr_date_paid=$1 where jr_id=$2 and jr_date_paid is null ',array($date,$this->jr_id)); + } + if (($source_type !='A' && $source_type !='V') && ($dest_type == 'A' || $dest_type == 'V')) + { + // set the date on dest + $date=$this->db->get_value('select jr_date from jrn where jr_id=$1',array($this->jr_id)); + if (trim($date) == '') $date=null; + $this->db->exec_sql('update jrn set jr_date_paid=$1 where jr_id=$2 and jr_date_paid is null ',array($date,$jr_id2)); + } } return true; } diff --git a/include/export_histo_csv.php b/include/export_histo_csv.php index 7e91db7fb..d2229cdc6 100644 --- a/include/export_histo_csv.php +++ b/include/export_histo_csv.php @@ -39,6 +39,7 @@ printf('"%s";',"Internal"); printf('"%s";',"Journal"); printf('"%s";',"Date"); printf('"%s";',"Echeance"); +printf('"%s";',"Paiement"); printf('"%s";',"Piece"); printf('"%s";',"Tiers"); printf('"%s";',"Description"); @@ -52,6 +53,7 @@ for ($i=0;$iget_tiers($line['jrn_def_type'],$line['jr_id']), $line['comment'], diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index 8babb3e6c..4b8ce7f4a 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -1,297 +1,316 @@
- + - -
- + + + - - -
- - - - -
- value=format_date($obj->det->jr_date); - echo td('Date').td($date->input()); + + + + + +
+ + + value = format_date($obj->det->jr_date); + echo td('Date') . td($date->input()); + ?> + + + value = format_date($obj->det->jr_ech); + echo td('Echeance') . td($date_ech->input()); + ?> + + + + + + - ?> - - - - + $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" '); + echo td($view_card_detail); + ?> + + + + + + + + + + + + -
+ Date paiement + + value = format_date($obj->det->jr_date_paid); + echo $date_paid->input(); + ?> +
- value=format_date($obj->det->jr_ech); - echo td('Echeance').td($date_ech->input()); +
+ det->array[0]['qp_supplier']); + echo td(_('Fournisseur')); - ?> -
+ value = strip_tags($obj->det->jr_pj_number); + echo td(_('Pièce')) . td($itext->input()); + ?> +
+ value = strip_tags($obj->det->jr_comment); + $itext->size = 40; + echo td(_('Libellé')) . td($itext->input(), ' colspan="2" '); + ?> +
Payé + selected = ($obj->det->jr_rapt == 'paid'); + echo $ipaid->input(); + ?> +
- det->array[0]['qp_supplier']); - echo td(_('Fournisseur')); +
+
+ + + + + - - - - - + +
+ Note +
+ width = 25; + $inote->heigh = 5; + $inote->value = strip_tags($obj->det->note); + echo $inote->input(); + ?> - $view_card_detail=HtmlInput::card_detail($bk->get_quick_code(),h($bk->getName()), ' class="line" '); - echo td($view_card_detail); - ?> -
- value=strip_tags($obj->det->jr_pj_number); - echo td(_('Pièce')).td($itext->input()); - ?> -
- value=strip_tags($obj->det->jr_comment); - $itext->size=40; - echo td(_('Libellé')).td($itext->input(),' colspan="2" '); +
+
+
+

+ + MY_TVA_USE == 'Y') + { + echo th(_('Taux TVA'), 'style="text-align:right"'); + } else + { + echo th(''); + } + echo th(_('Prix/Un.'), 'style="text-align:right"'); + echo th(_('Quantité'), 'style="text-align:right"'); + echo th(_('Non ded'), 'style="text-align:right"'); + + if ($owner->MY_TVA_USE == 'Y') + { + echo th(_('HTVA'), 'style="text-align:right"'); + echo th(_('TVA'), 'style="text-align:right"'); + echo th(_('TVAC'), 'style="text-align:right"'); + } else + echo th(_('Total'), 'style="text-align:right"'); + + if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup') + { + $anc = new Anc_Plan($cn); + $a_anc = $anc->get_list(' order by pa_id '); + $x = count($a_anc); + /* set the width of the col */ + echo ''; + + /* add hidden variables pa[] to hold the value of pa_id */ + echo Anc_Plan::hidden($a_anc); + } + echo ''; + for ($e = 0; $e < count($obj->det->array); $e++) + { + $row = ''; + $q = $obj->det->array[$e]; + $fiche = new Fiche($cn, $q['qp_fiche']); + $view_card_detail = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' class="line" '); + $row = td($view_card_detail); + $sym_tva = ''; + + if ($owner->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '') + { + /* retrieve TVA symbol */ + $tva = new Acc_Tva($cn, $q['qp_vat_code']); + $tva->load(); + $sym_tva = h($tva->get_parameter('label')); + } + if ($owner->MY_UPDLAB == 'Y') + { + $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text']; + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib); + $input->css_size = "100%"; + } else + { + $input = new ISpan("e_march" . $q['j_id'] . "_label"); + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + } + $row.=td($input->input() . $hidden); + $row.=td($sym_tva, 'style="text-align:center"'); + $pu = 0; + if ($q['qp_quantite'] != 0) + $pu = bcdiv($q['qp_price'], $q['qp_quantite']); + $row.=td(nbm($pu), 'class="num"'); + $row.=td(nbm($q['qp_quantite']), 'class="num"'); + + $no_ded = bcadd($q['qp_dep_priv'], $q['qp_nd_amount']); + $row.=td(nbm($no_ded), ' style="text-align:right"'); + $htva = $q['qp_price']; - ?> - - - - - - - -
' . _('Compt. Analytique') . '
Payé - selected=($obj->det->jr_rapt=='paid'); - echo $ipaid->input(); - ?> -
-
- - - - - - -
- Note -
- width=25; - $inote->heigh=5; - $inote->value=strip_tags($obj->det->note); - echo $inote->input(); - ?> - -
-
-
-

- -MY_TVA_USE == 'Y') { - echo th(_('Taux TVA'), 'style="text-align:right"'); -} else { - echo th(''); -} -echo th(_('Prix/Un.'), 'style="text-align:right"'); -echo th(_('Quantité'), 'style="text-align:right"'); -echo th(_('Non ded'), 'style="text-align:right"'); - -if ( $owner->MY_TVA_USE == 'Y') { - echo th(_('HTVA'), 'style="text-align:right"'); - echo th(_('TVA'), 'style="text-align:right"'); - echo th(_('TVAC'), 'style="text-align:right"'); -}else - echo th(_('Total'), 'style="text-align:right"'); - - if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){ - $anc=new Anc_Plan($cn); - $a_anc=$anc->get_list(' order by pa_id '); - $x=count($a_anc); - /* set the width of the col */ - echo ''; - - /* add hidden variables pa[] to hold the value of pa_id */ - echo Anc_Plan::hidden($a_anc); - } -echo ''; - for ($e=0;$edet->array);$e++) { - $row=''; - $q=$obj->det->array[$e]; - $fiche=new Fiche($cn,$q['qp_fiche']); - $view_card_detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),"", ' class="line" '); - $row=td($view_card_detail); - $sym_tva=''; - - if ( $owner->MY_TVA_USE=='Y' && $q['qp_vat_code'] != '') { - /* retrieve TVA symbol */ - $tva=new Acc_Tva($cn,$q['qp_vat_code']); - $tva->load(); - $sym_tva=h($tva->get_parameter('label')); - } - if ($owner->MY_UPDLAB == 'Y') - { - $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text']; - $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); - $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib); - $input->css_size="100%"; - } - else - { - $input = new ISpan("e_march" . $q['j_id'] . "_label"); - $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); - $input->value = $fiche->strAttribut(ATTR_DEF_NAME); - } - $row.=td($input->input().$hidden); - $row.=td($sym_tva,'style="text-align:center"'); - $pu=0; - if ( $q['qp_quantite'] != 0 ) $pu=bcdiv($q['qp_price'],$q['qp_quantite']); - $row.=td(nbm($pu),'class="num"'); - $row.=td(nbm($q['qp_quantite']),'class="num"'); - - $no_ded=bcadd($q['qp_dep_priv'],$q['qp_nd_amount']); - $row.=td(nbm($no_ded),' style="text-align:right"'); - $htva=$q['qp_price']; + $row.=td(nbm($htva), 'class="num"'); + $tvac = bcadd($htva, $q['qp_vat']); + $tvac = bcadd($tvac, $q['qp_nd_tva']); + $tvac = bcadd($tvac, $q['qp_nd_tva_recup']); - $row.=td(nbm($htva),'class="num"'); - $tvac=bcadd($htva,$q['qp_vat']); - $tvac=bcadd($tvac,$q['qp_nd_tva']); - $tvac=bcadd($tvac,$q['qp_nd_tva_recup']); + if ($owner->MY_TVA_USE == 'Y') + { + $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']); + $tva_amount = bcadd($tva_amount, $q['qp_nd_tva_recup']); + $class = ""; + if ($q['qp_vat_sided'] <> 0) + { + $class = ' style="text-decoration:line-through"'; + $tvac = bcsub($tvac, $q['qp_vat']); + } + $row.=td(nbm($tva_amount), 'class="num" ' . $class); + $row.=td(nbm($tvac), 'class="num"'); + } + $total_tvac+=$tvac; + $total_htva+=$htva; + /* Analytic accountancy */ + if ($owner->MY_ANALYTIC != "nu" && $div == 'popup') + { + $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + if (preg_match('/^(6|7)/', $poste)) + { + $anc_op = new Anc_Operation($cn); + $anc_op->j_id = $q['j_id']; + echo HtmlInput::hidden('op[]', $anc_op->j_id); + /* compute total price */ + bcscale(2); + + $row.=$anc_op->display_table(1, $htva, $div); + } else + { + $row.=td(''); + } + } + echo tr($row); + } + if ($owner->MY_TVA_USE == 'Y') + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); + else + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); + $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"'); + if ($owner->MY_TVA_USE == 'Y') + $row.=td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"'); + echo tr($row); + ?> +
'._('Compt. Analytique').'
- if ($owner->MY_TVA_USE=='Y') - { - $tva_amount=bcadd($q['qp_vat'],$q['qp_nd_tva']); - $tva_amount=bcadd($tva_amount,$q['qp_nd_tva_recup']); - $class=""; - if ($q['qp_vat_sided']<>0) { - $class=' style="text-decoration:line-through"'; - $tvac=bcsub($tvac,$q['qp_vat']); - } - $row.=td(nbm($tva_amount),'class="num" '.$class); - $row.=td(nbm($tvac),'class="num"'); - } - $total_tvac+=$tvac; - $total_htva+=$htva; - /* Analytic accountancy */ - if ( $owner->MY_ANALYTIC != "nu" && $div == 'popup'){ - $poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT); - if ( preg_match('/^(6|7)/',$poste)) { - $anc_op=new Anc_Operation($cn); - $anc_op->j_id=$q['j_id']; - echo HtmlInput::hidden('op[]',$anc_op->j_id); - /* compute total price */ - bcscale(2); - - $row.=$anc_op->display_table(1,$htva,$div); - - } else { - $row.=td(''); - } - } - echo tr($row); - - } - if ($owner->MY_TVA_USE=='Y') - $row= td(_('Total'),' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); - else - $row= td(_('Total'),' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"'); -$row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: bolder;"'); -if ($owner->MY_TVA_USE=='Y') - $row.=td("").td(nbm($total_tvac),'class="num" style="font-style:italic;font-weight: bolder;"'); -echo tr($row); -?> -
+
+
+

-
-
-

+ label = 'Afficher'; + $ib->javascript = "g('detail_" . $div . "').style.display='block';g('a" . $div . "').style.display='none';"; + echo $ib->input(); + echo '
- diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index 31e0423f3..dd3527ce1 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -1,295 +1,312 @@
- + + + + + + + + + + +
+ + + + value = format_date($obj->det->jr_date); + echo td('Date') . td($date->input()); + ?> + + + value = format_date($obj->det->jr_ech); + echo td('Echeance') . td($date_ech->input()); + ?> + + + + + + + + + + + + + + + + + + + +
+ Date paiement + +value = format_date($obj->det->jr_date_paid); +echo $date_paid->input(); +?> +
+det->array[0]['qs_client']); +echo td(_('Client')); + +$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" '); +echo td($view_card_detail); +?> +
+value = strip_tags($obj->det->jr_pj_number); +echo td(_('Pièce')) . td($itext->input()); +?> +
+value = strip_tags($obj->det->jr_comment); +$itext->size = 40; +echo td(_('Libellé')) . td($itext->input(), ' colspan="2" '); +?> +
Payé +selected = ($obj->det->jr_rapt == 'paid'); +echo $ipaid->input(); +?> +
+
+ + + + + + +
+ Note +
+width = 25; +$inote->heigh = 5; +$inote->value = strip_tags($obj->det->note); +echo $inote->input(); ?> - - - +
+
+
+

+ +

+ + MY_TVA_USE == 'Y') + echo th(_('Taux TVA'), 'style="text-align:right"'); + else + echo th(''); + if ($owner->MY_TVA_USE == 'Y') + { + echo th(_('HTVA'), 'style="text-align:right"'); + echo th(_('TVA'), 'style="text-align:right"'); + echo th(_('TVAC'), 'style="text-align:right"'); + } else + echo th(_('Total'), 'style="text-align:right"'); - -
- - - -
- - '; - ?> - - - - - - '; + for ($e = 0; $e < count($obj->det->array); $e++) + { + $row = ''; + $q = $obj->det->array[$e]; + $fiche = new Fiche($cn, $q['qs_fiche']); + $view_card_detail = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' class="line" '); + $row.=td($view_card_detail); + if ($owner->MY_UPDLAB == 'Y') + { + $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text']; + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib); + $input->css_size = "100%"; + } else + { + $input = new ISpan("e_march" . $q['j_id'] . "_label"); + $hidden = HtmlInput::hidden("j_id[]", $q['j_id']); + $input->value = $fiche->strAttribut(ATTR_DEF_NAME); + } - $view_card_detail=HtmlInput::card_detail($bk->get_quick_code(),h($bk->getName()), ' class="line" '); - echo td($view_card_detail); - ?> - - - - - - - - - - - - -
- value=format_date($obj->det->jr_date); - echo td('Date').td($date->input()); + if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup') + { + $anc = new Anc_Plan($cn); + $a_anc = $anc->get_list(" order by pa_id "); + $x = count($a_anc); + /* set the width of the col */ + echo '' . _('Compt. Analytique') . '
- value=format_date($obj->det->jr_ech); - echo td('Echeance').td($date_ech->input()); + /* add hidden variables pa[] to hold the value of pa_id */ + echo Anc_Plan::hidden($a_anc); + } - ?> -
- det->array[0]['qs_client']); - echo td(_('Client')); + echo '
- value=strip_tags($obj->det->jr_pj_number); - echo td(_('Pièce')).td($itext->input()); - ?> -
- value=strip_tags($obj->det->jr_comment); - $itext->size=40; - echo td(_('Libellé')).td($itext->input(),' colspan="2" '); + $row.=td($input->input() . $hidden); + $sym_tva = ''; + $pu = 0; + if ($q['qs_quantite'] != 0) + $pu = bcdiv($q['qs_price'], $q['qs_quantite']); + $row.=td(nbm($pu), 'class="num"'); + $row.=td(nbm($q['qs_quantite']), 'class="num"'); + $sym_tva = ''; + if ($owner->MY_TVA_USE == 'Y' && $q['qs_vat_code'] != '') + { + /* retrieve TVA symbol */ + $tva = new Acc_Tva($cn, $q['qs_vat_code']); + $tva->load(); + $sym_tva = (h($tva->get_parameter('label'))); + // $sym_tva=$sym + } + $row.=td($sym_tva, 'style="text-align:center"'); - ?> -
Payé - selected=($obj->det->jr_rapt=='paid'); - echo $ipaid->input(); - ?> -
-
- - - - - - -
- Note -
- width=25; - $inote->heigh=5; - $inote->value=strip_tags($obj->det->note); - echo $inote->input(); - ?> + $htva = $q['qs_price']; -
-
-
-

- -

- -MY_TVA_USE == 'Y') - echo th(_('Taux TVA'), 'style="text-align:right"'); -else - echo th(''); -if ( $owner->MY_TVA_USE == 'Y') { - echo th(_('HTVA'), 'style="text-align:right"'); - echo th(_('TVA'), 'style="text-align:right"'); - echo th(_('TVAC'), 'style="text-align:right"'); -} else - echo th(_('Total'), 'style="text-align:right"'); + $row.=td(nbm($htva), 'class="num"'); + $tvac = bcadd($htva, $q['qs_vat']); + if ($owner->MY_TVA_USE == 'Y') + { + $class = ""; + if ($q['qs_vat_sided'] != 0) + { + $class = ' style="text-decoration:line-through"'; + $tvac = bcsub($tvac, $q['qs_vat']); + } + $row.=td(nbm($q['qs_vat']), 'class="num"' . $class); + $row.=td(nbm($tvac), 'class="num"'); + } + $total_tvac = bcadd($total_tvac, $tvac); + $total_htva = bcadd($total_htva, $htva); + /* Analytic accountancy */ + if ($owner->MY_ANALYTIC != "nu" && $div == 'popup') + { + $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT); + if (preg_match('/^(6|7)/', $poste)) + { + $anc_op = new Anc_Operation($cn); + $anc_op->j_id = $q['j_id']; + echo HtmlInput::hidden('op[]', $anc_op->j_id); + /* compute total price */ + bcscale(2); - if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){ - $anc=new Anc_Plan($cn); - $a_anc=$anc->get_list(" order by pa_id "); - $x=count($a_anc); - /* set the width of the col */ - echo ''; + $row.=$anc_op->display_table(1, $htva, $div); + } else + { + $row.=td(''); + } + } + echo tr($row); + } + if ($owner->MY_TVA_USE == 'Y') + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"'); + else + $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"'); + $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"'); + if ($owner->MY_TVA_USE == 'Y') + $row.=td("") . td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"'); + echo tr($row); + ?> +
'._('Compt. Analytique').'
+ + + + + + +
+
+

+ +

+ label = 'Afficher'; + $ib->javascript = "g('detail_" . $div . "').style.display='block';g('a" . $div . "').style.display='none';"; + echo $ib->input(); + echo ' -
-

- -

- label='Afficher'; - $ib->javascript="g('detail_".$div."').style.display='block';g('a".$div."').style.display='none';"; - echo $ib->input(); - echo ' -
diff --git a/include/template/print_ledger_simple.php b/include/template/print_ledger_simple.php index 7c99f95f3..cdf6899c6 100644 --- a/include/template/print_ledger_simple.php +++ b/include/template/print_ledger_simple.php @@ -2,6 +2,7 @@ Pièce Date + Paiement Ref Client / Fournisseur Description @@ -38,8 +39,9 @@ foreach ($Row as $line) { $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" '; echo ""; - echo "" . smaller_date($line['date']) . ""; echo "" . h($line['jr_pj_number']) . ""; + echo "" . smaller_date($line['date']) . ""; + echo "" . smaller_date($line['date_paid']) . ""; echo "" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . ""; $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']); echo td($tiers);