diff --git a/contrib/document_test/facture-calc.ods b/contrib/document_test/facture-calc.ods index 97a96b0eb..2006f7da4 100644 Binary files a/contrib/document_test/facture-calc.ods and b/contrib/document_test/facture-calc.ods differ diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index b86937a7e..88e05ab2c 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -333,6 +333,12 @@ function quick_writing_add_row(){ new_tt.evalScripts(); } $("qc_"+nb.value).value=""; + $("amount"+nb.value).value=""; + $("poste"+nb.value).value=""; + $("ld"+nb.value).value=""; + + + nb.value++; } diff --git a/html/poste_csv.php b/html/poste_csv.php index 95f14fc5c..1c9f42fcb 100644 --- a/html/poste_csv.php +++ b/html/poste_csv.php @@ -108,6 +108,7 @@ if ( ! isset ($_REQUEST['oper_detail'])) { continue; echo '"Poste";'. + '"Lib.";'. '"QuickCode";'. "\"Code interne\";". "\"Date\";". @@ -122,8 +123,9 @@ if ( ! isset ($_REQUEST['oper_detail'])) { $op->jr_id=$a['jr_id']; $result=$op->get_jrnx_detail(); foreach ( $result as $r) { - printf('"%s";"%s";"%s";"%s";"%s";%12.2f;"%s %s"', + printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";%12.2f;"%s"', $r['j_poste'], + $r['pcm_lib'], $r['j_qcode'], $r['jr_internal'], $r['jr_date'], diff --git a/html/print_balance.php b/html/print_balance.php index 5592af846..625cae233 100644 --- a/html/print_balance.php +++ b/html/print_balance.php @@ -1,5 +1,4 @@ SetFont('DejaVuCond','B',8); $pdf->Cell(110,6,'Totaux'); $pdf->Cell(20,6,$tp_deb,'T',0,'R',0); $pdf->Cell(20,6,$tp_cred,'T',0,'R',0); -$pdf->Cell(20,6,$tp_solc,'T',0,'R',0); $pdf->Cell(20,6,$tp_sold,'T',0,'R',0); +$pdf->Cell(20,6,$tp_solc,'T',0,'R',0); $pdf->Ln(); diff --git a/include/class_acc_account_ledger.php b/include/class_acc_account_ledger.php index 490ba8643..f170b7ef5 100644 --- a/include/class_acc_account_ledger.php +++ b/include/class_acc_account_ledger.php @@ -105,8 +105,10 @@ class Acc_Account_Ledger { "case when j_debit='f' then j_montant else 0 end as cred_montant,". " jr_comment as description,jrn_def_name as jrn_name,". "j_debit, jr_internal,jr_pj_number,coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter ". - " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ". - " left join jrn on jr_grpt_id=j_grpt". + ",pcm_lib ". + " from jrnx left join jrn_def on (jrn_def_id=j_jrn_def )". + " left join jrn on (jr_grpt_id=j_grpt)". + " left join tmp_pcmn on (j_poste=pcm_val)". " where j_poste=$1 and ". " ( to_date($2,'DD.MM.YYYY') <= j_date and ". " to_date($3,'DD.MM.YYYY') >= j_date )". diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php index 8fc4542bc..d5e4b2988 100644 --- a/include/class_acc_ledger_fin.php +++ b/include/class_acc_ledger_fin.php @@ -706,7 +706,10 @@ class Acc_Ledger_Fin extends Acc_Ledger { $acc_operation->mt=$mt; $idx_operation++; - $acc_operation->pj=$e_pj.str_pad($idx_operation,3,0,STR_PAD_LEFT); + if ( trim($e_pj) != '') + $acc_operation->pj=$e_pj.str_pad($idx_operation,3,0,STR_PAD_LEFT); + else + $acc_operation->pj=''; $jr_id=$acc_operation->insert_jrn(); $acc_operation->set_pj(); diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index caa9ed53a..a6b6455b8 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -152,7 +152,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger { $owner=new Own($this->db); // Check if the given tva id is valid - if ( $owner->MY_TVA=='Y') { + if ( $owner->MY_TVA_USE=='Y') { if (${'e_march'.$i.'_tva_id'} == 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); $tva_rate=new Acc_Tva($this->db); @@ -887,13 +887,14 @@ array // Record the current number of article $Hid=new IHidden(); - $p_article= ( isset ($p_article))?$p_article:MAX_ARTICLE; + $p_article= ( isset ($nb_item))?$nb_item:MAX_ARTICLE; $r.=$Hid->input("nb_item",$p_article); $e_comment=(isset($e_comment))?$e_comment:""; + $max=($p_article < MAX_ARTICLE)?MAX_ARTICLE:$p_article; // For each article //-- - for ($i=0;$i< MAX_ARTICLE;$i++) { + for ($i=0;$i< $max ;$i++) { // Code id, price & vat code //-- $march=(isset(${"e_march$i"}))?${"e_march$i"}:""; diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 79160feef..ffe0f2389 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -154,12 +154,11 @@ class Acc_Ledger_Sold extends Acc_Ledger { // Check if the given tva id is valid $owner=new Own($this->db); - if ( $owner->MY_TVA=='Y') { + if ( $owner->MY_TVA_USE=='Y') { if ( isNumber(${'e_march'.$i.'_tva_id'}) == 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); $tva_rate=new Acc_Tva($this->db); $tva_rate->set_parameter('id',${'e_march'.$i.'_tva_id'}); - if ( $tva_rate->load() != 0 ) throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13); } @@ -997,14 +996,16 @@ class Acc_Ledger_Sold extends Acc_Ledger { // Record the current number of article $Hid=new IHidden(); - $p_article= ( isset ($p_article))?$p_article:MAX_ARTICLE; + $p_article= ( isset ($nb_item))?$nb_item:MAX_ARTICLE; $r.=$Hid->input("nb_item",$p_article); + $max=($p_article < MAX_ARTICLE)?MAX_ARTICLE:$p_article; + $f_legend_detail=_("Détail articles vendus"); // For each article //-- - for ($i=0;$i< MAX_ARTICLE;$i++) { + for ($i=0;$i< $max;$i++) { // Code id, price & vat code //-- $march=(isset(${"e_march$i"}))?${"e_march$i"}:""; diff --git a/include/class_database.php b/include/class_database.php index b007df078..b8e5365fa 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -482,6 +482,7 @@ de données"); $ret.=$f.$aArray[$i][$idx]; $f=','; } + $ret=trim($ret,','); return $ret; } /*! diff --git a/include/class_document.php b/include/class_document.php index cffc94359..a8e34313e 100644 --- a/include/class_document.php +++ b/include/class_document.php @@ -656,12 +656,12 @@ class Document extract ($_POST); $id='e_march'.$counter.'_tva_id'; if ( !isset (${$id}) ) return ""; - if ( ${$id} == -1 ) return ""; + if ( ${$id} == -1 || ${$id}=='' ) return ""; $march_id='e_march'.$counter.'_price' ; if ( ! isset (${$march_id})) return ''; $tva=new Acc_Tva($this->db); $tva->set_parameter("id",${$id}); - $tva->load(); + if ( $tva->load() == -1) return ''; return $tva->get_parameter("rate"); break; @@ -722,8 +722,8 @@ class Document || strlen(trim( $price )) ==0 || strlen(trim($qt)) ==0) return ""; - $oTva=new Acc_Tva($cn,${$tva}); - if ($oTva->load() == null) return ""; + $oTva=new Acc_Tva($this->db,${$tva}); + if ($oTva->load() == -1 ) return ""; $r=round(${$price},2)*$oTva->get_parameter('rate'); $r=round($r,2); break; @@ -739,8 +739,9 @@ class Document || strlen(trim( $price )) ==0 || strlen(trim($qt)) ==0) return ""; - $tva=new Acc_Tva($cn,${$id}); - if ($tva->load() == null) { + if ( ! isset (${$tva}) ) return ''; + $tva=new Acc_Tva($this->db,${$tva}); + if ($tva->load() == -1 ) { $r=round(${$price},2); }else { $r=round(${$price}*$tva->get_parameter('rate')+${$price},2); diff --git a/include/class_fiche.php b/include/class_fiche.php index 880c484f4..e667f3444 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -888,8 +888,7 @@ Array return; } $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); - - $Res=$this->cn->exec_sql("select j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_qcode,". + $Res=$this->cn->exec_sql("select distinct j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_qcode,". "case when j_debit='t' then j_montant else 0 end as deb_montant,". "case when j_debit='f' then j_montant else 0 end as cred_montant,". " jr_comment as description,jrn_def_name as jrn_name,". @@ -953,7 +952,7 @@ Array return; $rep=""; - + $already_seen=array(); echo '

'.$this->id." ".$name.'

'; echo ""; echo "". @@ -965,6 +964,10 @@ Array ""; foreach ( $this->row as $op ) { + if ( in_array($op['jr_internal'],$already_seen) ) + continue; + else + $already_seen[]=$op['jr_internal']; echo "". "". "".
".$op['jr_internal']."".$op['j_date']."