diff --git a/html/enc_jrn.php b/html/enc_jrn.php index e3157c809..a014de449 100644 --- a/html/enc_jrn.php +++ b/html/enc_jrn.php @@ -144,34 +144,42 @@ if ( isset($_POST['add_record']) ) { // Sauve les données dans des variables ${"p_$name"}=$element; } + $userPref=GetUserPeriode($cn,$g_user); + list ($l_date_start,$l_date_end)=GetPeriode($cn,$userPref); - - $result=VerifData($cn,$HTTP_POST_VARS,$g_user); - - // Parse result - AnalyzeError($result); - + $p_op_date=$p_op_date.substr($l_date_start,2,8); + echo_debug("p_op_date is $p_op_date"); + $aHttp=$HTTP_POST_VARS; + $aHttp['op_date']=$p_op_date; + // Verifie data + // $result=VerifData($cn,$HTTP_POST_VARS,$g_user); + $result=VerifData($cn,$aHttp,$g_user); if ($result != NOERROR) { + // Parse result + AnalyzeError($result); + echo ""; CorrectRecord($g_dossier,$g_user,$g_jrn,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS); return; } $Res=StartSql($cn); - $userPref=GetUserPeriode($cn,$g_user); $seq=GetNextId($cn,'j_grpt')+1; $s_op=GetNextId($cn,'j_id')+1; $tot_cred=0; $tot_deb=0; + //debit for ( $i = 0; $i < $p_MaxDeb; $i++) { $montant=${"p_mont_deb$i"}; $l_class=${"p_class_deb$i"}; if ( strlen(trim($montant)) != 0 && $montant != 0) { - $p_text=(FormatString(${"p_text_deb$i"})==null)?FormatString(GetPosteLibelle($g_dossier,$l_class)):FormatString(${"p_text_deb$i"}); - $Sql="insert into jrnx(j_id,j_date,j_montant,j_text,j_poste,j_grpt, + ${"p_text_deb$i"}=FormatString(GetPosteLibelle($g_dossier,$l_class)); + // $p_text=(FormatString(${"p_text_deb$i"})==null)?:FormatString(${"p_text_deb$i"}); + $Sql="insert into jrnx(j_id,j_date,j_montant,j_poste,j_grpt, j_jrn_def,j_debit,j_tech_user,j_tech_per) - values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), ".$montant.",'$p_text', + values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), " + .$montant.", $l_class,$seq, $g_jrn,true,'$g_user',$userPref)"; echo_debug("sql $Sql"); @@ -185,11 +193,11 @@ if ( isset($_POST['add_record']) ) { $montant=${"p_mont_cred$i"}; $l_class=${"p_class_cred$i"}; if ( strlen(trim($montant)) != 0 && $montant != 0) { - $p_text=(FormatString(${"p_text_cred$i"})==null)?FormatString(GetPosteLibelle($g_dossier,$l_class)):FormatString(${"p_text_cred$i"}); - - $Sql="insert into jrnx(j_id,j_date,j_montant,j_text,j_poste,j_grpt, + //$p_text=(FormatString(${"p_text_cred$i"})==null)?FormatString(GetPosteLibelle($g_dossier,$l_class)):FormatString(${"p_text_cred$i"}); + ${"p_text_cred$i"}=FormatString(GetPosteLibelle($g_dossier,$l_class)); + $Sql="insert into jrnx(j_id,j_date,j_montant,j_poste,j_grpt, j_jrn_def,j_debit,j_tech_user,j_tech_per) - values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), $montant,'$p_text', + values ( $s_op,to_date('$p_op_date','DD.MM.YYYY'), $montant, $l_class,$seq, $g_jrn,false,'$g_user',$userPref)"; echo_debug("sql $Sql"); @@ -266,9 +274,11 @@ if ( isset($_POST['add_record']) ) { // AlterSequence($cn,"s_grpt",$seq+1); //AlterSequence($cn,"s_jrn_op",$s_op); - ViewRecord($g_dossier,$g_jrn,$seq,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS); - echo_debug("ViewRecord($g_dossier,$g_jrn,$seq,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);"); - + // Add the p_text to the array + + ViewRecord($g_dossier,$g_jrn,$seq,$p_MaxDeb,$p_MaxCred,$aHttp); + // echo_debug("ViewRecord($g_dossier,$g_jrn,$seq,$p_MaxDeb,$p_MaxCred,$HTTP_POST_VARS);"); + echo_debug("ViewRecord($g_dossier,$g_jrn,$seq,$p_MaxDeb,$p_MaxCred,$aHttp);"); } else { Rollback($cn); @@ -318,10 +328,11 @@ if ( isset($_POST['update_record']) ) { $tot_montant+=$montant; $l_class=${"p_class_deb$i"}; if ( strlen(trim($montant)) == 0) $montant=0; - $p_text=(FormatString(${"p_text_deb$i"})==null)?GetPosteLibelle($g_dossier,$l_class):FormatString(${"p_text_deb$i"}); - $Sql=sprintf("update jrnx set j_montant=%f, j_poste=%d,j_tech_user='%s',j_date=to_date('%s','DD.MM.YYYY'),j_text='%s' where j_id=%d", - $montant,$l_class,$g_user,$p_op_date,$p_text,$j_id); + $Sql=sprintf("update jrnx set j_montant=%f, j_poste=%d,j_tech_user='%s',j_date=to_date('%s','DD.MM.YYYY'),j_tech_per=%d where j_id=%d", + $montant,$l_class,$g_user,$p_op_date, + $userPref, + $j_id); echo_debug("sql $Sql"); $Res=ExecSql($cn,$Sql); if ( $Res == false ) { Rollback($cn); EndSql($cn); return;} @@ -334,12 +345,12 @@ if ( isset($_POST['update_record']) ) { $montant=${"p_mont_cred$i"}; $l_class=${"p_class_cred$i"}; if ( strlen(trim($montant)) == 0 ) $montant=0; - $p_text=(FormatString(${"p_text_cred$i"})==null)?GetPosteLibelle($g_dossier,$l_class):FormatString(${"p_text_cred$i"}); - $Sql=sprintf("update jrnx set j_montant=%f,j_poste=%d,j_tech_user='%s', j_date=to_date('%s','DD.MM.YYYY'),j_text='%s' where j_id=%d", - $montant,$l_class,$g_user,$p_op_date,$p_text,$j_id); + $Sql=sprintf("update jrnx set j_montant=%f,j_poste=%d,j_tech_user='%s', j_date=to_date('%s','DD.MM.YYYY'),j_tech_per=%d where j_id=%d", + $montant,$l_class,$g_user,$p_op_date, + $userPref,$j_id); echo_debug("sql $Sql"); - // $s_op++; + $Res=ExecSql($cn,$Sql); if ( $Res == false ) { Rollback($cn); EndSql($cn); return;} diff --git a/html/send_jrn_pdf.php b/html/send_jrn_pdf.php index 890f7885b..0a754fa9c 100644 --- a/html/send_jrn_pdf.php +++ b/html/send_jrn_pdf.php @@ -46,7 +46,7 @@ if ( $_POST["filter"] == YES) { $pdf=& new Cezpdf("A4"); $pdf->selectFont('./addon/fonts/Helvetica.afm'); -$offset=0;$limit=35;$step=35; +$offset=0;$limit=25;$step=25; $rap_deb=0;$rap_cred=0; while (1) { $a=0; diff --git a/html/send_poste_pdf.php b/html/send_poste_pdf.php index 837a6aaf8..495a035e1 100644 --- a/html/send_poste_pdf.php +++ b/html/send_poste_pdf.php @@ -43,7 +43,7 @@ $cond=CreatePeriodeCond($periode); for ( $i =0;$i'; echo ""; } -/* function +/* function Imp * Purpose : * * parm : @@ -86,15 +88,17 @@ function Imp($p_array,$p_cn) { } echo_error ("IMP no action specified"); return; } -/* function - * Purpose : +/* function ImpHtml + * Purpose : Show the html result * * parm : - * - + * - array (type,periode, + * - connection * gen : - * - - * return: - * - + * - none + * return: + * - error if something goes wrong or + * the page result * */ function ImpHtml($p_array,$p_cn) @@ -214,15 +218,17 @@ function ImpHtml($p_array,$p_cn) }//jrn } -/* function - * Purpose : +/* function GetDataPoste + * Purpose : Get dat for poste * * parm : - * - + * - connection + * - condition + * -. position * gen : - * - + * - none * return: - * - + * - none * */ function GetDataPoste($p_cn,$p_poste,$p_condition) @@ -251,15 +257,18 @@ function GetDataPoste($p_cn,$p_poste,$p_condition) } return array($array,$tot_deb,$tot_cred); } -/* function - * Purpose : +/* function GetDataJrn + * Purpose : Get data from the jrn table * * parm : - * - + * - connection + * - array periode + * - filter (default = YES) * gen : - * - + * - none * return: - * - + * - error code if something code wrong + * otherwise the result * */ function GetDataJrn($p_cn,$p_array,$filter=YES) @@ -301,15 +310,16 @@ function GetDataJrn($p_cn,$p_array,$filter=YES) } return $array; } -/* function - * Purpose : +/* function CreatePeriodeCond + * Purpose : Create the sql query for the periode * * parm : - * - + * - p_periode + * - p_field (default = j_tech_per) * gen : - * - + * - none * return: - * - + * - a string containing the query * */ function CreatePeriodeCond($p_periode,$p_field=" j_tech_per") { @@ -321,17 +331,21 @@ function CreatePeriodeCond($p_periode,$p_field=" j_tech_per") { } $cond_periode=substr($cond_periode,0,strlen($cond_periode)-1); $cond_periode.=")"; -return $cond_periode; + return $cond_periode; } -/* function - * Purpose : +/* function GetDataJrnPdf + * Purpose : Get The data for the pdf printing * * parm : - * - + * - connection + * - array + * - p_limit starting line + * - p_offset number of lines + * * gen : - * - + * - none * return: - * - + * - Array with the asked data * */ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) @@ -344,10 +358,12 @@ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) jr_internal, case j_debit when 't' then j_montant::text else ' ' end as deb_montant, case j_debit when 'f' then j_montant::text else ' ' end as cred_montant, - j_debit as debit,j_poste as poste,". - "j_text as description,j_grpt as grp,jr_comment as comment, - j_rapt as oc, j_tech_per as periode from jrnx left join jrn on ". - "jr_grpt_id=j_grpt where j_jrn_def=".$p_array['p_id']. + j_debit as debit,j_poste as poste,jr_montant , ". + "pcm_lib as description,j_grpt as grp,jr_comment , + 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=".$p_array['p_id']. " and ".$cond." order by j_id,j_date::date,j_grpt,j_debit desc". " limit ".$p_limit." offset ".$p_offset); } else { @@ -358,9 +374,10 @@ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) case j_debit when 't' then j_montant::text else ' ' end as deb_montant, case j_debit when 'f' then j_montant::text else ' ' end as cred_montant, j_debit as debit,j_poste as poste,". - "j_text as description,j_grpt as grp,jr_comment as comment, - j_rapt as oc, j_tech_per as periode from jrnx left join jrn on ". - "jr_grpt_id=j_grpt where ". + "pcm_lib as description,j_grpt as grp,jr_comment as jr_comment, + jr_montant, + 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 ". " ".$cond." order by j_date::date,j_grpt,j_debit desc". " limit ".$p_limit." offset ".$p_offset); @@ -373,14 +390,16 @@ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) case c_debit when 't' then c_montant::text else ' ' end as deb_montant, case c_debit when 'f' then c_montant::text else ' ' end as cred_montant, c_debit as j_debit, - c_poste as j_poste, - c_description as description, + c_poste as poste, + pcm_lib as description, + jr_comment, + jr_montant, c_grp as grp, c_comment as comment, c_rapt as oc, c_periode as periode from centralized left join jrn on ". - "jr_grpt_id=c_grp where ". + "jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where ". $cond." order by c_id "; $Res=ExecSql($p_cn,$Sql." limit ".$p_limit." offset ".$p_offset); } // Grand Livre @@ -397,14 +416,25 @@ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) $line=pg_fetch_array($Res,$i); $mont_deb=($line['deb_montant']!=0)?sprintf("% 8.2f",$line['deb_montant']):""; $mont_cred=($line['cred_montant']!=0)?sprintf("% 8.2f",$line['cred_montant']):""; + $jr_montant=($line['jr_montant']!=0)?sprintf("% 8.2f",$line['jr_montant']):""; $tot_deb+=$line['deb_montant']; $tot_cred+=$line['cred_montant']; if ( $case != $line['grp'] ) { $case=$line['grp']; $array[]=array ( - 'j_id'=>$line['j_id'], + 'j_id'=>$line['j_id'], 'j_date' => $line['j_date'], 'internal'=>$line['jr_internal'], + 'deb_montant'=>'', + 'cred_montant'=>$jr_montant, + 'description'=>$line['jr_comment'], + 'poste' => $line['oc'], + 'periode' =>$line['periode'] ); + + $array[]=array ( + 'j_id'=>$line['j_id'], + 'j_date' => '', + 'internal'=>'', 'deb_montant'=>$mont_deb, 'cred_montant'=>$mont_cred, 'description'=>$line['description'], @@ -431,6 +461,17 @@ function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset) $a=array($array,$tot_deb,$tot_cred); return $a; } +/* function + * Purpose : + * + * parm : + * - + * gen : + * - + * return: + */ + + function GetDataGrpt($p_cn,$p_array) { if ( !isset ($p_array['periode']) ) return NO_PERIOD_SELECTED; diff --git a/include/jrn.php b/include/jrn.php index c3cd294aa..7dc370859 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -42,22 +42,20 @@ function RecordJrn($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array = nul for ( $i = 0; $i < $p_MaxDeb; $i++) { ${"e_class_deb$i"}=0; ${"e_mont_deb$i"}=0; - ${"e_text_deb$i"}=""; } for ( $i = 0; $i < $p_MaxCred; $i++) { ${"e_class_cred$i"}=0; ${"e_mont_cred$i"}=0; - ${"e_text_cred$i"}=""; - } $l_dossier=sprintf("dossier%d",$p_dossier); $cn=DbConnect($l_dossier); - - if ( $p_array == null ) { // userPref contient la periode par default $userPref=GetUserPeriode($cn,$p_user); list ($l_date_start,$l_date_end)=GetPeriode($cn,$userPref); - $e_op_date=$l_date_start; + $e_op_rem=substr($l_date_start,2,8); + + if ( $p_array == null ) { + $e_op_date="01"; $e_comment=""; $e_rapt=""; $e_ech=""; @@ -71,20 +69,17 @@ function RecordJrn($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array = nul /* Get Jrn's properties */ $l_line=GetJrnProp($p_dossier,$p_jrn); if ( $l_line == null ) return; + echo '
'; - echo '
'; printf ('

%s %s

',$l_line['jrn_def_name'],$l_line['jrn_def_code']); echo '
'; echo ""; echo ""; - // Date echeance - paiement - if ( $l_line['jrn_def_ech'] == 't' ) { - echo $l_line['jrn_def_ech_lib'].''; - } - echo '
'; - echo 'Date : '; - echo '

débit

'; + echo 'Date : '. + $e_op_rem; + // Chargement comptes disponibles if ( strlen(trim ($l_line['jrn_def_class_deb']) ) > 0 ) { $valid_deb=split(" ",$l_line['jrn_def_class_deb']); @@ -119,6 +114,7 @@ function RecordJrn($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array = nul } echo ""; + echo ''; for ( $i=0;$i < $p_MaxDeb;$i++) { echo ""; echo "'); - printf('', - $i, - ${"e_text_deb$i"}); printf('', $i,$i,${"e_mont_deb$i"},$i); echo ""; } + // Total debit + echo ''; if ( $p_update == 0 ) echo ""; - echo "

débit

"; @@ -131,28 +127,28 @@ function RecordJrn($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array = nul $selected, $key, $value); - //echo_debug(" option = $a"); echo $a; } - - // echo $poste_deb; echo ""; printf (' Montant :
'; + echo 'Total '; + echo ''; + echo ''; + echo '
"; - echo '
'; - echo '
'; - echo '

crédit

'; + + + + echo '

crédit

'; // Chargement comptes disponibles if ( strlen(trim ($l_line['jrn_def_class_cred']) ) > 0 ) { $valid_cred=split(" ",$l_line['jrn_def_class_cred']); @@ -180,7 +176,7 @@ if ( $p_update == 0 ) echo " "; + for ( $i=0;$i<$Count;$i++) { $l2_line=pg_fetch_array($Res,$i); $lib=substr($l2_line['pcm_lib'],0,35); @@ -198,22 +194,23 @@ if ( $p_update == 0 ) echo " "; echo ""; - printf('', - $i, - ${"e_text_cred$i"}); printf (' Montant :', $i,$i,${"e_mont_cred$i"}); echo ""; } - + // Total Credit + echo ''; + echo 'Total'; + echo ''; + echo ''; + echo ''; echo " "; if ( isset ($_GET["PHPSESSID"]) ) { $sessid=$_GET["PHPSESSID"]; @@ -229,13 +226,15 @@ if ( $p_update == 0 ) echo " rapprochement : '.$search.''; + echo ' + rapprochement : '.$search.''; echo ""; - echo '
'; + // To avoid problem with unknown variable if ( ! isset ($e_comment) ) { $e_comment=""; } + echo ''; echo $e_comment; echo ""; @@ -247,7 +246,6 @@ if ( $p_update == 0 ) echo " '; } echo ''; - // echo ''; // To avoid problem with unknown variable if ( ! isset ($e_sum_deb) ) { @@ -258,22 +256,26 @@ if ( $p_update == 0 ) echo " '; - echo ''; + + echo ''; echo ""; echo '
'; } -/* function - * Purpose : - * +/* function UpdateJrn + * Purpose : Display the form to UPDATE account operation + * * parm : - * - + * - p_dossier + * - p_jrn + * - p_MaxDeb number of debit line + * - p_MaxCred " " credit " + *" - p_array array containing the others datas * gen : - * - + * - none * return: - * - + * - none * */ @@ -298,13 +300,9 @@ function UpdateJrn($p_dossier,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array) echo ""; echo ""; echo ""; - // Date echeance - paiement - if ( $l_line['jrn_def_ech'] == 't' ) { - echo $l_line['jrn_def_ech_lib'].''; - } - echo '
'; + echo 'Date : '; + - echo '

débit

'; // Chargement comptes disponibles if ( strlen(trim ($l_line['jrn_def_class_deb']) ) > 0 ) { $valid_deb=split(" ",$l_line['jrn_def_class_deb']); @@ -339,7 +337,8 @@ function UpdateJrn($p_dossier,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array) } echo ""; -echo ''; for ( $i=0;$i < $p_MaxDeb;$i++) { echo ""; @@ -364,20 +363,17 @@ echo '"; - printf('', + /* printf('', $i, ${"e_text_deb$i"}); - + */ printf ('', $i,$i,${"e_mont_deb$i"},$i); echo ""; } - echo "
Date : '; + //echo '
Date : '; + echo '

débit

Date : ' // echo $poste_deb; echo ""; echo " Montant :
"; - echo '
'; - echo '
'; - echo '

crédit

'; + echo '

crédit

'; // Chargement comptes disponibles if ( strlen(trim ($l_line['jrn_def_class_cred']) ) > 0 ) { $valid_cred=split(" ",$l_line['jrn_def_class_cred']); @@ -405,7 +401,7 @@ echo ' Date : ' $Res=ExecSql($cn,$SqlCred); $Count=pg_NumRows($Res); - echo ""; + for ( $i=0;$i<$Count;$i++) { $l2_line=pg_fetch_array($Res,$i); $lib=substr($l2_line['pcm_lib'],0,35); @@ -433,12 +429,6 @@ echo '"; - if ( ! isset ( ${"e_text_cred$i"} ) ) { - ${"e_text_cred$i"}=""; - } - printf('', - $i, - ${"e_text_cred$i"}); printf ('', $i,$i,${"e_mont_cred$i"}); @@ -454,9 +444,10 @@ echo ''; + echo ''; echo "
Date : ' echo ""; echo " Montant :
Date : ' $search='"; - echo '
rapprochement : '.$search.'

rapprochement

+ '.$search.'
"; - echo '
'; + echo "

Commentaire


"; echo ''; echo $e_comment; echo ""; @@ -473,8 +464,8 @@ echo ' Date : ' echo '
'; } -/* function - * Purpose : +/* function ViewRec + * Purpose : debug function to be dropped * * parm : * - @@ -495,15 +486,15 @@ function ViewRec($p_array = null) { } } -/* function - * Purpose : +/* function CorrectRecord + * Purpose : Call the RecordJrn. In fact does nothing * * parm : - * - + * - the same as RecordJrn * gen : - * - + * - none * return: - * - + * - none * */ function CorrectRecord($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array) @@ -511,15 +502,20 @@ function CorrectRecord($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array) RecordJrn($p_dossier,$p_user,$p_jrn,$p_MaxDeb,$p_MaxCred,$p_array); } -/* function - * Purpose : +/* function ViewRecord + * Purpose : View the added operation * * parm : - * - + * - p_dossier + * - p_jrn + * - p_id + * - p_MaxDeb + * - p_MaxCred + * - p_array * gen : - * - + * - none * return: - * - + * - none * */ function ViewRecord ($p_dossier,$p_jrn,$p_id,$p_MaxDeb,$p_MaxCred,$p_array) @@ -550,8 +546,8 @@ function ViewRecord ($p_dossier,$p_jrn,$p_id,$p_MaxDeb,$p_MaxCred,$p_array) for ($i = 0; $i < $p_MaxDeb;$i++) { //Deb if ( strlen(trim(${"e_mont_deb$i"})) > 0 && ${"e_mont_deb$i"} > 0 ) { - // $class=GetPosteLibelle($p_dossier,${"e_class_deb$i"}); - $class=${"e_text_deb$i"}; + $class=GetPosteLibelle($p_dossier,${"e_class_deb$i"}); + echo ''.${"e_class_deb$i"}."$col_vide $class ".${"e_mont_deb$i"}."$col_vide"; } } @@ -559,8 +555,8 @@ function ViewRecord ($p_dossier,$p_jrn,$p_id,$p_MaxDeb,$p_MaxCred,$p_array) // Cred for ($i = 0; $i < $p_MaxCred;$i++) { if ( strlen(trim(${"e_mont_cred$i"})) > 0 && ${"e_mont_cred$i"} > 0 ) { - //$class=GetPosteLibelle($p_dossier,${"e_class_cred$i"}); - $class=${"e_text_cred$i"}; + $class=GetPosteLibelle($p_dossier,${"e_class_cred$i"}); + echo ''.$col_vide.''.${"e_class_cred$i"}." $class $col_vide ".${"e_mont_cred$i"}.""; } } @@ -645,11 +641,14 @@ function GetNextJrnId($p_cn,$p_name) { $l_res=pg_fetch_array($Res,0); return $l_res['result']; } -/* function - * Purpose : +/* function ViewJrn + * Purpose : Vue des écritures comptables * * parm : - * - + * - p_dossier, + * - p_user, + * - p_jrn + * - array * gen : * - * return: @@ -665,8 +664,9 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { if ( $p_array == null) { include_once("preference.php"); $l_periode=GetUserPeriode($cn,$p_user); - $Res=ExecSql($cn,"select j_id,jr_internal,j_text,to_char(j_date,'DD.MM.YYYY') as j_date, - j_montant,j_poste,pcm_lib,j_grpt,j_rapt,j_debit,j_centralized,j_tech_per + $Res=ExecSql($cn,"select j_id,jr_internal,to_char(j_date,'DD.MM.YYYY') as j_date, + j_montant,j_poste,pcm_lib,j_grpt,j_rapt,j_debit,j_centralized,j_tech_per, + pcm_lib from jrnx inner join tmp_pcmn on j_poste=pcm_val inner join jrn on jr_grpt_id=j_grpt where @@ -678,7 +678,8 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { ${"l_$key"}=$element; echo_debug ("l_$key $element"); } - $sql="select j_id,j_text,to_char(j_date,'DD.MM.YYYY') as j_date,j_montant,j_poste,pcm_lib,j_grpt,j_rapt,j_debit,j_centralized,j_tech_per,jr_internal + $sql="select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,j_montant,j_poste, + pcm_lib,j_grpt,j_rapt,j_debit,j_centralized,j_tech_per,jr_internal from jrnx inner join tmp_pcmn on j_poste=pcm_val inner join jrn on jr_grpt_id=j_grpt where @@ -695,8 +696,7 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { } $l_s_comment=FormatString($l_s_comment); if ( $l_s_comment != null ) { - $sql.=$l_and." ( upper(jr_comment) like upper('%".$l_s_comment."%') or - upper(j_text) like upper('%".$l_s_comment."%'))"; + $sql.=$l_and." upper(jr_comment) like upper('%".$l_s_comment."%') "; } $sql.=" order by j_id,j_grpt,j_debit desc"; @@ -714,10 +714,10 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { echo ''; } else { - echo ''; + echo ''; } if ( $l_id == $l_line['j_grpt'] ) { - echo $col_vide.$col_vide.$col_vide.$col_vide; + echo $col_vide.$col_vide.$col_vide; } else { echo ""; echo $l_line['j_date']; @@ -727,21 +727,21 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { if ( $l_line['j_centralized'] == 'f' && isClosed($cn,$l_line['j_tech_per']) == false ) { echo ""; - list($z_type,$z_num,$num_op)=split("-",$l_line['jr_internal']); - echo $num_op; - echo ""; - echo ''; - echo ""; - echo "Modifier"; - echo ""; if ( isset ($_GET["PHPSESSID"]) ) { $sessid=$_GET["PHPSESSID"]; } else { $sessid=$_POST["PHPSESSID"]; } - echo ""; - echo '"; + + list($z_type,$z_num,$num_op)=split("-",$l_line['jr_internal']); + printf ('', + $num_op,$l_line['j_grpt'],$sessid); + // echo $num_op; echo ""; + echo ''; + echo ""; + echo "M"; + echo ""; }else { if ( isset ($_GET["PHPSESSID"]) ) { @@ -750,36 +750,28 @@ function ViewJrn($p_dossier,$p_user,$p_jrn,$p_array=null) { $sessid=$_POST["PHPSESSID"]; } - echo ""; - echo ""; echo ''; - echo $l_line['jr_internal']; - echo ""; - echo ""; - echo '"; + list($z_type,$z_num,$num_op)=split("-",$l_line['jr_internal']); + printf ('', + $num_op,$l_line['j_grpt'],$sessid); + echo ""; + echo $col_vide; } - - // echo ""; $l_id=$l_line['j_grpt']; } - if ( $l_line['j_debit']=='f') + if ($l_line['j_debit']=='f') echo $col_vide; - + echo ''; echo $l_line['j_poste']; echo ''; - if ( $l_line['j_debit']=='t') - echo $col_vide; - echo ''; - echo $l_line['j_text']; + echo $l_line['pcm_lib']; echo ''; - - if ( $l_line['j_debit']=='f') - echo $col_vide; + echo $col_vide; echo ''; echo $l_line['j_montant']; @@ -943,15 +935,18 @@ function GetAmount($p_cn,$p_id) { $l_line=pg_fetch_array($Res,0); return $l_line['jr_montant']; } -/* function - * Purpose : +/* function VerifData + * Purpose : Verify the data before inserting or + * updating * * parm : - * - + * - p_cn connection + * - p_array array with all the values + * - p_user * gen : - * - + * - none * return: - * - + * - errorcode or ok * */ function VerifData($p_cn,$p_array,$p_user) diff --git a/include/preference.php b/include/preference.php index 0ebe8c967..0edca8e33 100644 --- a/include/preference.php +++ b/include/preference.php @@ -61,6 +61,8 @@ function FormPeriodeMult($p_cn) * parm : * - $p_cn connexion * - $p_default default periode + * - $p_type the type of the periode + * - $p_suff the suffix of the name * gen : * - none * return: @@ -68,7 +70,7 @@ function FormPeriodeMult($p_cn) * form * */ -function FormPeriode($p_cn,$l_default=0,$p_type=OPEN) +function FormPeriode($p_cn,$l_default=0,$p_type=OPEN,$p_suff="") { if ($p_type==CLOSED) { @@ -98,7 +100,7 @@ function FormPeriode($p_cn,$l_default=0,$p_type=OPEN) $Res=ExecSql($p_cn,$sql); $Max=pg_NumRows($Res); if ( $Max == 0 ) return null; - $ret=''; for ( $i = 0; $i < $Max;$i++) { $l_line=pg_fetch_array($Res,$i); if ( $l_default == $l_line['p_id'] ) @@ -178,13 +180,14 @@ function GetUserPreferences ($p_cn,$p_user) } return $l_array; } -/* function - * Purpose : +/* function GetPeriode + * Purpose :Give the start & end date of a periode * * parm : - * - + * - connection + * - p_periode * gen : - * - + * - none * return: * - array containing the start date & the end date * @@ -241,7 +244,7 @@ function GetExercice($p_cn,$p_periode) $line=pg_fetch_array($Res,0); return $line['p_exercice']; } -/* function +/* function ShowDevise * Purpose : * * parm : @@ -282,7 +285,7 @@ echo ' '; echo ''; echo ''; } -/* function +/* function ShowPeriode * Purpose : * * parm : @@ -347,4 +350,5 @@ function ShowPeriode($p_cn) echo ''; } + ?> diff --git a/install.sh b/install.sh index e9f1c0d3a..767ad7b32 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ # # # $Revision$ +###################################################################### # This file is part of WCOMPTA. # WCOMPTA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by