diff --git a/html/jrn_csv.php b/html/jrn_csv.php index 0b6648d7c..27e189308 100644 --- a/html/jrn_csv.php +++ b/html/jrn_csv.php @@ -74,8 +74,9 @@ if ( $_GET['p_simple'] == 0 ) $desc=str_replace('"',"'",$desc); $desc=str_replace(";",",",$desc); - printf("\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";%s;%s\n", + printf("\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";%s;%s\n", $op['j_id'], + $op['jr_pj_number'], $op['internal'], $op['j_date'], $op['poste'], diff --git a/html/poste_csv.php b/html/poste_csv.php index 9737638b2..815441578 100644 --- a/html/poste_csv.php +++ b/html/poste_csv.php @@ -44,11 +44,11 @@ $User->can_request(IMPPOSTE,0); if ( isset ( $_REQUEST['poste_fille']) ) { //choisit de voir tous les postes - $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '".$_REQUEST["poste_id"]."%'"); + $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like $1||'%'",array($_REQUEST["poste_id"])); } else { - $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val = '".$_REQUEST['poste_id']."'"); + $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val = $1",array($_REQUEST['poste_id'])); } if ( ! isset ($_REQUEST['oper_detail'])) @@ -61,13 +61,15 @@ if ( ! isset ($_REQUEST['oper_detail'])) $Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']); $name=$Poste->get_name(); list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( $_REQUEST['from_periode'], - $_REQUEST['to_periode'], - $_GET['ople'] - ); + $_REQUEST['to_periode'], + $_GET['ople'] + ); if ( count($Poste->row ) == 0 ) continue; - echo '"Poste";'.'"Lib.";'. + echo '"Poste";'. + '"n° pièce";'. + '"Lib.";'. "\"Code interne\";". "\"Date\";". "\"Description\";". @@ -81,10 +83,11 @@ if ( ! isset ($_REQUEST['oper_detail'])) { $prog+=$op['deb_montant']-$op['cred_montant']; echo '"'.$pos['pcm_val'].'";'. + '"'.$op['jr_pj_number'].'"'.";". '"'.$name.'";'. '"'.$op['jr_internal'].'"'.";". '"'.$op['j_date_fmt'].'"'.";". - '"'.$op['description']." ".$op['jr_pj_number'].'"'.";". + '"'.$op['description'].'",'. nb($op['deb_montant']).";". nb($op['cred_montant']).";". nb(abs($prog)); diff --git a/html/poste_pdf.php b/html/poste_pdf.php index 69bdf77a4..369cb3d4f 100644 --- a/html/poste_pdf.php +++ b/html/poste_pdf.php @@ -111,7 +111,10 @@ foreach ($a_poste as $poste) $date=shrink_date($row['j_date_fmt']); $pdf->Cell($size[$l],6,$date,0,0,$align[$l]); $l++; - $pdf->Cell($size[$l],6,$row['jr_internal'],0,0,$align[$l]); + if ( $row['jr_pj_number'] == '') + $pdf->Cell($size[$l],6,$row['jr_internal'],0,0,$align[$l]); + else + $pdf->Cell($size[$l],6,$row['jr_pj_number'],0,0,$align[$l]); $l++; $pdf->Cell($size[$l],6,substr($row['jrn_name'],0,14),0,0,$align[$l]); $l++; diff --git a/html/quick_code_csv.php b/html/quick_code_csv.php index d02ef03a9..1780cf2e6 100644 --- a/html/quick_code_csv.php +++ b/html/quick_code_csv.php @@ -56,12 +56,14 @@ if ( count($Fiche->row ) == 0 ) if ( ! isset ($_REQUEST['oper_detail'])) { echo '"Qcode";'. - "\"Code interne\";". "\"Date\";". + "\"n° pièce\";". + "\"Code interne\";". "\"Description\";". "\"Débit\";". "\"Crédit\";". - "\"Prog.\""; + "\"Prog.\";". + "\"Let.\"" ; printf("\n"); $progress=0; foreach ( $Fiche->row as $op ) @@ -69,21 +71,22 @@ if ( ! isset ($_REQUEST['oper_detail'])) $progress+=$op['deb_montant']-$op['cred_montant']; echo '"'.$op['j_qcode'].'";'. - '"'.$op['jr_internal'].'"'.";". - '"'.$op['j_date_fmt'].'"'.";". - '"'.$op['description'].'"'.";". - nb($op['deb_montant']).";". - nb($op['cred_montant']).";". - nb(abs($progress)); + '"'.$op['j_date_fmt'].'"'.";". + '"'.$op['jr_pj_number'].'"'.";". + '"'.$op['jr_internal'].'"'.";". + '"'.$op['description'].'"'.";". + nb($op['deb_montant']).";". + nb($op['cred_montant']).";". + nb(abs($progress)).';'. + '"'.(($op['letter']==-1)?'':$op['letter']).'"'; printf("\n"); } } else { - echo '"Poste";"Qcode";"internal";'; - echo '"Date";'. - "\"Description\";". + echo '"Poste";"Qcode";"date";"ref";"internal";'; + echo "\"Description\";". "\"Montant\";". "\"D/C\""; @@ -99,8 +102,9 @@ else printf('"%s";"%s";"%s";"%s";"%s";%s;"%s"', $r['j_poste'], $r['j_qcode'], - $r['jr_internal'], $r['jr_date'], + $op['jr_pj_number'], + $r['jr_internal'], $r['description'], nb($r['j_montant']), $r['debit']); diff --git a/html/quick_code_pdf.php b/html/quick_code_pdf.php index 676daade5..8397a8178 100644 --- a/html/quick_code_pdf.php +++ b/html/quick_code_pdf.php @@ -94,11 +94,16 @@ for ($e=0;$eCell($size[$l],6,$date,0,0,$align[$l]); $l++; - $pdf->Cell($size[$l],6,$row['jr_internal'],0,0,$align[$l]); + if ( $row['jr_pj_number'] == '') + $pdf->Cell($size[$l],6,"",0,0,$align[$l]); + else + $pdf->Cell($size[$l],6,$row['jr_pj_number'],0,0,$align[$l]); + $l++; $pdf->Cell($size[$l],6,substr($row['jrn_name'],0,14),0,0,$align[$l]); $l++; - $pdf->Cell($size[$l],6,$row['description'],0,0,$align[$l]); + $pdf->Cell($size[$l],6,$row['description'].'('.$row['jr_internal'].')',0,0,$align[$l]); + $l++; $pdf->Cell($size[$l],6,(($row['letter']!=-1)?$row['letter']:''),0,0,$align[$l]); $l++; diff --git a/include/class_acc_account_ledger.php b/include/class_acc_account_ledger.php index 8dc121892..23fe4b8d1 100644 --- a/include/class_acc_account_ledger.php +++ b/include/class_acc_account_ledger.php @@ -135,7 +135,7 @@ class Acc_Account_Ledger " ( to_date($2,'DD.MM.YYYY') <= j_date and ". " to_date($3,'DD.MM.YYYY') >= j_date )". " and $filter_sql $sql_let ". - " order by j_date",array($this->id,$p_from,$p_to)); + " order by j_date,substring(jr_pj_number,'\\\\d+$') asc",array($this->id,$p_from,$p_to)); return $this->get_row_sql($Res); } @@ -311,8 +311,9 @@ class Acc_Account_Ledger echo ""; echo ''; echo "". - "". "". + "". + "". "". "". "". @@ -330,9 +331,10 @@ class Acc_Account_Ledger $progress+=$op['deb_montant']-$op['cred_montant']; echo "". - "". "". - "". + td(h($op['jr_pj_number'])). + "". + "". "". "". td(sprintf('%.2f',abs($progress)),'style="text-align:right"'). diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 340c3c5c7..68f526981 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -354,14 +354,15 @@ class Acc_Ledger case j_debit when 'f' then j_montant::text else ' ' end as cred_montant, j_debit as debit,j_poste as poste,jr_montant , ". "coalesce(j_text,pcm_lib) as description,j_grpt as grp, - jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then jr_pj_number else '' end as jr_comment, + jr_comment||' ('||jr_internal||')' as jr_comment, + jr_pj_number, j_qcode, jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on ". "jr_grpt_id=j_grpt ". " left join tmp_pcmn on pcm_val=j_poste ". " where j_jrn_def=".$this->id. - " and ".$periode." order by j_date::date asc,jr_internal,j_debit desc ". + " and ".$periode." order by j_date::date asc,substring(jr_pj_number,'\\\\d+$')::numeric asc,j_debit desc ". $cond_limite); } @@ -373,12 +374,13 @@ class Acc_Ledger case j_debit when 'f' then j_montant::text else ' ' end as cred_montant, j_debit as debit,j_poste as poste,". "coalesce(j_text,pcm_lib) as description,j_grpt as grp, - jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj_number !='' then 'pj:'||coalesce(jr_pj_number,'-') else '' end as jr_comment, + jr_comment||' ('||jr_internal||')' as jr_comment, + jr_pj_number, jr_montant, j_qcode, jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on ". "jr_grpt_id=j_grpt left join tmp_pcmn on pcm_val=j_poste where ". - " ".$periode." order by j_date::date,j_grpt,j_debit desc ". + " ".$periode." order by j_date::date,substring(jr_pj_number,'\\\\d+$') asc,j_grpt,j_debit desc ". $cond_limite); } @@ -437,7 +439,8 @@ class Acc_Ledger 'description'=>''.h($line['jr_comment']).' ['.$tot_op.'] ', 'poste' => $line['oc'], 'qcode' => $line['j_qcode'], - 'periode' =>$line['periode'] ); + 'periode' =>$line['periode'], + 'jr_pj_number' => $line ['jr_pj_number']); $array[]=array ( 'jr_id'=>'', @@ -450,7 +453,8 @@ class Acc_Ledger 'description'=>$line['description'], 'poste' => $line['poste'], 'qcode' => $line['j_qcode'], - 'periode' => $line['periode'] + 'periode' => $line['periode'], + 'jr_pj_number' => '' ); } @@ -467,7 +471,8 @@ class Acc_Ledger 'description'=>$line['description'], 'poste' => $line['poste'], 'qcode' => $line['j_qcode'], - 'periode' => $line['periode']); + 'periode' => $line['periode'], + 'jr_pj_number' => ''); } diff --git a/include/class_fiche.php b/include/class_fiche.php index 9c0c61174..4085370b9 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -1052,10 +1052,11 @@ class Fiche } $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); - $Res=$this->cn->exec_sql("select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_qcode,". + $Res=$this->cn->exec_sql("select distinct substring(jr_pj_number,'\\\\d+$'),j_id,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,". + " jr_pj_number,". "j_debit, jr_internal,jr_id,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". @@ -1063,7 +1064,7 @@ class Fiche " ( to_date($2,'DD.MM.YYYY') <= j_date and ". " to_date($3,'DD.MM.YYYY') >= j_date )". " and $filter_sql $sql_let ". - " order by j_date",array($qcode,$p_from,$p_to)); + " order by j_date,substring(jr_pj_number,'\\\\d+$')",array($qcode,$p_from,$p_to)); return $this->get_row_result($Res); } @@ -1125,7 +1126,7 @@ class Fiche echo '

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

'; echo "
Code interne Date n° de pièce Code interne Description Débit Crédit
".$vw_operation."".format_date($op['j_date'])."".h($op['description']).' '.h($op['jr_pj_number'])."".$vw_operation."".h($op['description'])."".sprintf("%.2f",$op['deb_montant'])."".sprintf("%.2f",$op['cred_montant'])."
"; echo "". - "". + "". "". "". "". @@ -1139,7 +1140,7 @@ class Fiche else $already_seen[]=$op['jr_internal']; echo "". - "". + "". "". "". "". @@ -1190,8 +1191,9 @@ class Fiche echo "
Code interne n° de pièce / Code interne Date Description Montant
".$op['jr_internal']."".$op['jr_pj_number']." / ".$op['jr_internal']."".$op['j_date']."".h($op['description']).""."
"; echo ''; echo "". - "". "". + "". + "". "". "". "". @@ -1208,8 +1210,9 @@ class Fiche if ( $op['letter'] !=-1) $let=$op['letter']; $progress+=$op['deb_montant']-$op['cred_montant']; echo "". - "". "". + td(h($op['jr_pj_number'])). + "". "". "". "". diff --git a/include/class_print_ledger_detail.php b/include/class_print_ledger_detail.php index ea343cb06..6a7f569f5 100644 --- a/include/class_print_ledger_detail.php +++ b/include/class_print_ledger_detail.php @@ -79,10 +79,10 @@ class Print_Ledger_Detail extends PDF $array=$Jrn->get_operation($_GET['from_periode'],$_GET['to_periode']); $this->SetFont('DejaVu','BI',7); - $this->Cell(145,7,'report Débit',0,0,'R'); + $this->Cell(215,7,'report Débit',0,0,'R'); $this->Cell(30,7,sprintf('%10.2f',$rap_deb),0,0,'R'); $this->Ln(4); - $this->Cell(145,7,'report Crédit',0,0,'R'); + $this->Cell(215,7,'report Crédit',0,0,'R'); $this->Cell(30,7,sprintf('%10.2f',$rap_cred),0,0,'R'); $this->Ln(4); @@ -95,7 +95,7 @@ class Print_Ledger_Detail extends PDF $this->Cell(20,7,$row['pj']); $this->Cell(15,7,$row['date_fmt']); $this->Cell(20,7,$row['internal']); - $this->Cell(100,7,$row['comment']); + $this->Cell(170,7,$row['comment']); $this->Cell(20,7,$row['montant'],0,0,'R'); $this->Ln(4); @@ -103,7 +103,7 @@ class Print_Ledger_Detail extends PDF $aEntry=$this->cn->get_array("select j_id,j_poste,j_qcode,j_montant,j_debit, ". " pcm_lib ". " from jrnx join tmp_pcmn on (j_poste=pcm_val) where j_grpt = $1". - " order by j_debit,j_id", + " order by j_debit desc,j_id", array($row['jr_grpt_id'])); for ($j=0;$jCell(80,6,$name,0,0,'L'); + $this->Cell(150,6,$name,0,0,'L'); // print amount $str_amount=sprintf('%10.2f',$entry['j_montant']); diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php index edbadaf05..2f099f5d2 100644 --- a/include/impress_jrn.inc.php +++ b/include/impress_jrn.inc.php @@ -186,9 +186,11 @@ if ( isset( $_REQUEST['bt_html'] ) ) //--- foreach ( $Jrn->row as $op ) { - /* var_dump($op);/*exit();*/ + echo ""; echo ""; + echo ""; + if ( $op['jr_id']!='') echo "";
"._('Code interne')." "._('Date').""._('n° pièce')." "._('Code interne')." "._('Description')." "._('Débit')." "._('Crédit')."
".$vw_operation."".format_date($op['j_date_fmt'])."".$vw_operation."".h($op['description'])."".sprintf("%.2f",$op['deb_montant'])."".sprintf("%.2f",$op['cred_montant'])."
".$op['j_date']."".$op['jr_pj_number']."".HtmlInput::detail_op($op['jr_id'],$op['internal'])."