From 6c00cee4bec42e0c935e18dea0f0030909ef3bac Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 11 Jan 2018 16:52:26 +0100 Subject: [PATCH] =?UTF-8?q?Task=20#1457=20&=201281=20:=20operation=20ouver?= =?UTF-8?q?ture=20s=C3=A9par=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ajax/ajax_ledger.php | 5 +- include/balance.inc.php | 54 +++++++++++------ include/class/acc_account.class.php | 7 ++- include/class/acc_account_ledger.class.php | 7 ++- include/class/acc_balance.class.php | 68 +++++++++++++++++----- include/class/acc_ledger.class.php | 15 ++--- include/class/acc_operation.class.php | 37 ++++++++++-- include/class/acc_report.class.php | 2 +- include/class/fiche.class.php | 7 ++- include/export/export_gl_csv.php | 3 +- include/export/export_gl_pdf.php | 2 +- include/impress_gl_comptes.inc.php | 18 +++--- include/opening.inc.php | 7 +-- include/operation_ods_confirm.inc.php | 10 +++- include/operation_ods_new.inc.php | 2 +- include/template/ledger_detail_bottom.php | 12 ++++ sql/upgrade.sql | 8 ++- 17 files changed, 192 insertions(+), 72 deletions(-) diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php index 5560099cc..3d21ff52b 100644 --- a/include/ajax/ajax_ledger.php +++ b/include/ajax/ajax_ledger.php @@ -425,8 +425,8 @@ case 'save': } } - $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 jrn set jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY'),jr_optype=$5 where jr_id=$3", + array($_POST['lib'],$_POST['npj'],$jr_id,$_POST['p_date'],$_POST['jr_optype'])); $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)", array($_POST['p_date'],$jr_id)); $cn->exec_sql('update operation_analytique set oa_date=j_date from jrnx @@ -496,6 +496,7 @@ case 'save': ////////////////////////////////////////////////////////////////// $op->save_info($_POST['OTHER'],'OTHER'); $op->save_info($_POST['BON_COMMANDE'],'BON_COMMANDE'); + /////////////////////////////////////////////////////////////////// // Save related ////////////////////////////////////////////////////////////////// diff --git a/include/balance.inc.php b/include/balance.inc.php index 87760c96c..cba864e7a 100644 --- a/include/balance.inc.php +++ b/include/balance.inc.php @@ -286,10 +286,9 @@ if ( isset($_GET['view'] ) ) $bal->to_poste=$_GET['to_poste']; if ( isset($_GET['unsold'])) $bal->unsold=true; $previous=(isset($_GET['previous_exc']))?1:0; - - $row=$bal->get_row($_GET['from_periode'], - $_GET['to_periode'], - $previous); + $from_periode=$http->get("from_periode","number"); + $to_periode=$http->get("to_periode","number"); + $row=$bal->get_row($from_periode,$to_periode); $previous= (isset ($row[0]['sum_cred_previous']))?1:0; $periode=new Periode($cn); @@ -312,18 +311,18 @@ if ( isset($_GET['view'] ) ) echo 'Solde N-1'; } + echo ''._('Ouverture').''; echo 'Débit'; echo 'Crédit'; - echo 'Solde Débiteur '; - echo 'Solde Créditeur'; - if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) - echo 'Solde'; + echo 'Solde'; +// if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) +// echo 'Solde'; $i=0; if ( $previous == 1) { $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_cred_previous','sum_deb_previous','solde_deb_previous','solde_cred_previous'); } else { - $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred') ; + $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope') ; } foreach($a_sum as $a) { @@ -374,10 +373,21 @@ if ( isset($_GET['view'] ) ) echo td(nbm(abs($delta_previous))." $side_previous",'class="previous_year" style="text-align:right;font-weight:bold;" '); } - echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" '); - echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"'); - echo td(nbm(${'lvl'.$ind}['solde_deb']),'style="text-align:right;font-weight:bold;"'); - echo td(nbm(${'lvl'.$ind}['solde_cred']),'style="text-align:right;font-weight:bold;"'); + /*echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" '); + echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"');*/ + // Ouverture + $solde3=bcsub(${'lvl'.$ind}['sum_deb_ope'],${'lvl'.$ind}['sum_cred_ope']); + $side3=($solde3<0)?" C":" D"; + $side3=($solde3==0)?" ":$side3; + echo td(nbm(abs($solde3)).$side3); + + // Saldo debit + $solde_deb=bcsub(${'lvl'.$ind}['sum_deb'],${'lvl'.$ind}['sum_deb_ope']); + echo td(nbm($solde_deb),'style="text-align:right;font-weight:bold;"'); + + // Saldo cred + $solde_cred=bcsub(${'lvl'.$ind}['sum_cred'],${'lvl'.$ind}['sum_cred_ope']); + echo td(nbm($solde_cred),'style="text-align:right;font-weight:bold;"'); $delta=bcsub(${'lvl'.$ind}['solde_cred'],${'lvl'.$ind}['solde_deb']); $side=($delta > 0 ) ? "C":"D"; echo td(nbm(abs($delta))." $side",'style="text-align:right;font-weight:bold;" '); @@ -407,6 +417,7 @@ if ( isset($_GET['view'] ) ) echo ''; echo td($view_history); echo td(h($r['label'])); + if ($previous == 1 ) { echo td(nbm($r['sum_deb_previous']),' class="previous_year"'); echo td(nbm($r['sum_cred_previous']),' class="previous_year" '); @@ -423,10 +434,19 @@ if ( isset($_GET['view'] ) ) $r['sum_cred_previous']); } - echo td(nbm($r['sum_deb']),'style="text-align:right;"'); - echo td(nbm($r['sum_cred']),'style="text-align:right;"'); - echo td(nbm($r['solde_deb']),'style="text-align:right;"'); - echo td(nbm($r['solde_cred']),'style="text-align:right;"'); + $solde=bcsub($r['sum_deb_ope'],$r['sum_cred_ope']); + $side=($solde < 0)?" C":" D"; + $side=($solde==0)?"":$side; + echo td(nbm(abs($solde)).$side,'style="text-align:right;"'); + echo td(nbm(bcsub($r['sum_deb'],$r['sum_deb_ope'])),'style="text-align:right;"'); + echo td(nbm(bcsub($r['sum_cred'],$r['sum_cred_ope'])),'style="text-align:right;"'); + + $solde2=bcsub($r['sum_deb'],$r['sum_cred']); + $side=($solde2 < 0)?" C":" D"; + $side=($solde2==0)?"":$side; + + echo td(nbm(abs($solde2)).$side,'style="text-align:right;"'); + if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo ''; echo ''; diff --git a/include/class/acc_account.class.php b/include/class/acc_account.class.php index 1d1e15e25..68cb964a8 100644 --- a/include/class/acc_account.class.php +++ b/include/class/acc_account.class.php @@ -183,7 +183,12 @@ class Acc_Account $this->data_sql->delete(); } - + function find_by_value($p_pcm_val) + { + $id=$this->db->get_value("select id from tmp_pcmn where pcm_val=$1",[$p_pcm_val]); + $this->data_sql->setp("id",$id); + $this->data_sql->load(); + } function save() { try { $this->verify(); diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index 8f942fe24..4abcc13b1 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -172,6 +172,7 @@ class Acc_Account_Ledger j_debit, jr_internal,jr_pj_number ,(select distinct jl_id from sqlletter where sqlletter.j_id=j1.j_id ) as letter ,pcm_lib + ,jr_optype ,jr_tech_per ,p_exercice ,jrn_def_name @@ -394,6 +395,7 @@ class Acc_Account_Ledger ""._('Code interne')." ". ""._('Tiers')." ". ""._('Description')."". + ""._('Type')."". ""._('Débit')."". ""._("Crédit")."". th('Prog.','style="text-align:right"'). @@ -434,7 +436,7 @@ class Acc_Account_Ledger echo "". "$old_exercice". "".td().td().td(). - ""._("Totaux")."". + ""._("Totaux")."".td(""). "".nbm($sum_deb)."". "".nbm($sum_cred)."". td(nbm(abs($progress)).$side,'style="text-align:right"'). @@ -460,6 +462,7 @@ class Acc_Account_Ledger "".$vw_operation."". "".$tiers."". "".h($op['description'])."". + td($op['jr_optype']). "".nbm($op['deb_montant'])."". "".nbm($op['cred_montant'])."". td(nbm(abs($progress)).$side,'style="text-align:right"'). @@ -475,7 +478,7 @@ class Acc_Account_Ledger echo "". td($op['p_exercice']). td().td().td().td(). - "Totaux". + "Totaux".td(""). "".nbm($sum_deb)."". "".nbm($sum_cred)."". "".nbm(abs($diff)).$side."". diff --git a/include/class/acc_balance.class.php b/include/class/acc_balance.class.php index 684120606..92106e15a 100644 --- a/include/class/acc_balance.class.php +++ b/include/class/acc_balance.class.php @@ -105,13 +105,21 @@ class Acc_Balance { case 0: // build query - $sql="select j_poste as poste,sum(deb) as sum_deb, sum(cred) as sum_cred from + $sql="select j_poste as poste, + sum(deb) as sum_deb, + sum(cred) as sum_cred, + sum(deb_op) as sum_deb_ope , + sum(cred_op) as sum_cred_ope + from ( select j_poste, case when j_debit='t' then j_montant else 0 end as deb, - case when j_debit='f' then j_montant else 0 end as cred + case when j_debit='f' then j_montant else 0 end as cred, + case when j_debit='t' and jr_optype='OPE' then j_montant else 0 end as deb_op, + case when j_debit='f' and jr_optype='OPE' then j_montant else 0 end as cred_op from jrnx join tmp_pcmn on (j_poste=pcm_val) left join parm_periode on (j_tech_per = p_id) join jrn_def on (j_jrn_def=jrn_def_id) + join jrn on (j_grpt=jr_grpt_id) where $jrn $from_poste $to_poste $and $filter_sql @@ -143,11 +151,16 @@ class Acc_Balance $jrn $from_poste $to_poste $and $filter_sql and $per_sql ) as sub_m group by j_poste order by j_poste ) , - p as ( select j_poste,sum(deb) as sdeb,sum(cred) as scred + p as ( select j_poste,sum(deb) as sdeb, + sum(cred) as scred , + sum(deb_op) as sum_deb_ope , + sum(cred_op) as sum_cred_ope from (select j_poste, case when j_debit='t' then j_montant else 0 end as deb, - case when j_debit='f' then j_montant else 0 end as cred + case when j_debit='f' then j_montant else 0 end as cred , + case when j_debit='t' and jr_optype='OPE' then j_montant else 0 end as deb_op, + case when j_debit='f' and jr_optype='OPE' then j_montant else 0 end as cred_op from jrnx join tmp_pcmn on (j_poste=pcm_val) left join parm_periode on (j_tech_per = p_id) join jrn_def on (j_jrn_def=jrn_def_id) @@ -158,7 +171,10 @@ class Acc_Balance ,coalesce(m.sdeb,0) as sum_deb , coalesce(m.scred,0) as sum_cred ,coalesce(p.sdeb,0) as sum_deb_previous - , coalesce(p.scred,0) as sum_cred_previous from m full join p on (p.j_poste=m.j_poste) + , coalesce(p.scred,0) as sum_cred_previous + ,coalesce(sum_deb_ope) + ,coalesce(sum_cred_ope) + from m full join p on (p.j_poste=m.j_poste) order by poste"; } catch (Exception $exc) { @@ -166,13 +182,21 @@ class Acc_Balance /* * no previous exercice */ - $sql="select upper(j_poste::text) as poste,sum(deb) as sum_deb, sum(cred) as sum_cred from - ( select j_poste, - case when j_debit='t' then j_montant else 0 end as deb, - case when j_debit='f' then j_montant else 0 end as cred - from jrnx join tmp_pcmn on (j_poste=pcm_val) - left join parm_periode on (j_tech_per = p_id) - join jrn_def on (j_jrn_def=jrn_def_id) + $sql="select j_poste as poste, + sum(deb) as sum_deb, + sum(cred) as sum_cred, + sum(deb_op) as sum_deb_ope , + sum(cred_op) as sum_cred_ope + from + ( select j_poste, + case when j_debit='t' then j_montant else 0 end as deb, + case when j_debit='f' then j_montant else 0 end as cred, + case when j_debit='t' and jr_optype='OPE' then j_montant else 0 end as deb_op, + case when j_debit='f' and jr_optype='OPE' then j_montant else 0 end as cred_op + from jrnx join tmp_pcmn on (j_poste=pcm_val) + left join parm_periode on (j_tech_per = p_id) + join jrn_def on (j_jrn_def=jrn_def_id) + join jrn on (j_grpt=jr_grpt_id) where $jrn $from_poste $to_poste $and $filter_sql @@ -188,6 +212,10 @@ class Acc_Balance $tot_deb= 0.0; $tot_deb_saldo=0.0; $tot_cred_saldo=0.0; + $tot_cred_ope= 0.0; + $tot_deb_ope= 0.0; + $tot_deb_saldo_ope=0.0; + $tot_cred_saldo_ope=0.0; $tot_cred_previous= 0.0; $tot_deb_previous= 0.0; $tot_deb_saldo_previous=0.0; @@ -206,7 +234,11 @@ class Acc_Balance $a['sum_cred']=round($r['sum_cred'],2); $a['solde_deb']=round(( $a['sum_deb'] >= $a['sum_cred'] )? $a['sum_deb']- $a['sum_cred']:0,2); $a['solde_cred']=round(( $a['sum_deb'] <= $a['sum_cred'] )?$a['sum_cred']-$a['sum_deb']:0,2); - + // opening + $a['sum_deb_ope']=round($r['sum_deb_ope'],2); + $a['sum_cred_ope']=round($r['sum_cred_ope'],2); + $a['solde_deb_ope']=round(( $a['sum_deb_ope'] >= $a['sum_cred_ope'] )? $a['sum_deb_ope']- $a['sum_cred_ope']:0,2); + $a['solde_cred_ope']=round(( $a['sum_deb_ope'] <= $a['sum_cred_ope'] )?$a['sum_cred_ope']-$a['sum_deb_ope']:0,2); if ($p_previous_exc==1) @@ -223,10 +255,16 @@ class Acc_Balance if ($p_previous_exc==0 && $this->unsold==true && $a['solde_cred']==0 && $a['solde_deb']==0) continue; if ($p_previous_exc==1 && $this->unsold==true && $a['solde_cred']==0 && $a['solde_deb']==0 && $a['solde_cred_previous']==0 && $a['solde_deb_previous']==0) continue; $array[$i]=$a; + // Normal op $tot_cred= bcadd ($tot_cred,$a['sum_cred']); $tot_deb= bcadd($tot_deb, $a['sum_deb']); $tot_deb_saldo= bcadd($tot_deb_saldo, $a['solde_deb']); $tot_cred_saldo= bcadd($tot_cred_saldo,$a['solde_cred']); + // Opening op. + $tot_cred_ope= bcadd ($tot_cred_ope,$a['sum_cred_ope']); + $tot_deb_ope= bcadd($tot_deb_ope, $a['sum_deb_ope']); + $tot_deb_saldo_ope= bcadd($tot_deb_saldo_ope, $a['solde_deb_ope']); + $tot_cred_saldo_ope= bcadd($tot_cred_saldo_ope,$a['solde_cred_ope']); }//for i @@ -242,6 +280,10 @@ class Acc_Balance $a['sum_cred']=$tot_cred; $a['solde_deb']=$tot_deb_saldo; $a['solde_cred']=$tot_cred_saldo; + $a['sum_deb_ope']=$tot_deb_ope; + $a['sum_cred_ope']=$tot_cred_ope; + $a['solde_deb_ope']=$tot_deb_saldo_ope; + $a['solde_cred_ope']=$tot_cred_saldo_ope; if ($p_previous_exc==1) { $a['sum_deb_previous']=$tot_deb_previous; $a['sum_cred_previous']=$tot_cred_previous; diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 7a2333e17..25e95ccd3 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -995,7 +995,7 @@ class Acc_Ledger extends jrn_def_sql * @brief show the result of the array to confirm * before inserting * @param$p_array array from the form - * \return string + * @return HTML string */ function confirm($p_array, $p_readonly=false) { @@ -1005,7 +1005,7 @@ class Acc_Ledger extends jrn_def_sql $msg=$this->verify($p_array); $this->id=$p_array['p_jrn']; if (empty($p_array)) - return 'Aucun résultat'; + return _("Aucun résultat"); $anc=null; extract($p_array, EXTR_SKIP); $lPeriode=new Periode($this->db); @@ -1126,11 +1126,7 @@ class Acc_Ledger extends jrn_def_sql ${'amount'.$i}).""; $total_cred=bcadd($total_cred, ${"amount".$i}); } - /* $ret.=""; - $ret.=(isset(${"ck$i"})) ? HtmlInput::hidden('ck' . $i, ${'ck' . $i}) : ""; - $ret.=""; */ // CA - if ($g_parameter->MY_ANALYTIC!='nu') // use of AA { if (preg_match("/^[6,7]+/", $strPoste)==1) @@ -1306,9 +1302,6 @@ class Acc_Ledger extends jrn_def_sql $ret.=HtmlInput::hidden('nb_item', $nb_row); $ret.=dossier::hidden(); - - $ret.=dossier::hidden(); - $ret.=HtmlInput::hidden('jrn_type', $this->get_type()); $info=HtmlInput::infobulle(0); $info_poste=HtmlInput::infobulle(9); @@ -1370,8 +1363,7 @@ class Acc_Ledger extends jrn_def_sql if ($poste->value!='') { - $Poste=new Acc_Account($this->db); - $Poste->set_parameter('value', $poste->value); + $Poste=new Acc_Account($this->db,$poste->value); $label=$Poste->get_lib(); } @@ -1731,6 +1723,7 @@ class Acc_Ledger extends jrn_def_sql $acc_end->grpt=$seq; $acc_end->jrn=$this->id; $acc_end->mt=$mt; + $acc_end->jr_optype=$jr_optype; $jr_id=$acc_end->insert_jrn(); $this->jr_id=$jr_id; if ($jr_id==false) diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php index cc51756ef..014404941 100644 --- a/include/class/acc_operation.class.php +++ b/include/class/acc_operation.class.php @@ -46,6 +46,7 @@ class Acc_Operation var $amount; /*!< amount of the operatoin */ var $grpt; /*!< the group id */ var $date_paid; + var $jr_optype; /*!< type of operation :NOR,CLO,EXT,OPE /*! * \brief constructor set automatically the attributes user and periode * \param $p_cn the databse connection @@ -58,6 +59,7 @@ class Acc_Operation $this->user=$_SESSION['g_user']; $this->periode=$g_user->get_periode(); $this->jr_id=0; + $this->jr_optype="NOR"; } /** *@brief retrieve the grpt_id from jrn for a jr_id @@ -271,12 +273,12 @@ class Acc_Operation function insert_jrn() { $p_comment=$this->desc; - + $diff=$this->db->get_value("select check_balance ($1)",array($this->grpt)); if ( $diff != 0 ) { - echo "Erreur : balance incorrecte :diff = $diff"; + printf (_("Erreur : balance incorrecte :diff = %d"),$diff); return false; } @@ -288,11 +290,11 @@ class Acc_Operation // if amount == -1then the triggers will throw an error // $Res=$this->db->exec_sql("insert into jrn (jr_def_id,jr_montant,jr_comment,". - "jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt) values (". + "jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt,jr_optype) values (". "$1,$2,$3,". - "to_date($4,'DD.MM.YYYY'),to_date($5,'DD.MM.YYYY'),$6,$7,$8)", + "to_date($4,'DD.MM.YYYY'),to_date($5,'DD.MM.YYYY'),$6,$7,$8,$9)", array ($this->jrn, $this->amount,$p_comment, - $this->date,$echeance,$this->grpt,$this->periode,$this->mt) + $this->date,$echeance,$this->grpt,$this->periode,$this->mt,$this->jr_optype) ); if ( $Res == false) return false; $this->jr_id=$this->db->get_current_seq('s_jrn'); @@ -708,6 +710,29 @@ class Acc_Operation $b=$a->get_quant(); var_dump($b); } + /** + * Return a select object to choose the type of operation + * - NOR normal + * - EXT reverse operation + * - CLO closing periode + * - OPE opening periode + * @param string $p_status + * @return \ISelect + */ + static function select_operation_type($p_status) + { + $type_operation=new ISelect("jr_optype"); + $type_operation->value=array( + array(("label")=>_("Normal"), "value"=>"NOR"), + array(("label")=>_("Ouverture"), "value"=>"OPE"), + array(("label")=>_("Fermeture"), "value"=>"CLO"), + array(("label")=>_("Extourne"), "value"=>"EXT") + ); + + $type_operation->selected=$p_status; + return $type_operation; + } + } ///////////////////////////////////////////////////////////////////////////// class Acc_Detail extends Acc_Operation @@ -727,7 +752,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_date_paid + jr_pj_number, jr_mt,jr_rapt,jr_date_paid,jr_optype 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_report.class.php b/include/class/acc_report.class.php index a4ada52c1..0c15e17ce 100644 --- a/include/class/acc_report.class.php +++ b/include/class/acc_report.class.php @@ -112,7 +112,7 @@ class Acc_Report $r.= HtmlInput::hidden('line',$p_line); $r.= HtmlInput::hidden('fr_id',$this->id); $wForm=new IText(); - $r.="Nom du rapport : "; + $r.=_("Nom du rapport")." : "; $r.=$wForm->input('form_nom',$this->name); $r.= ''; diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index d39ddf9e9..b1c3122a7 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -1254,6 +1254,7 @@ class Fiche "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_poste,". " jr_pj_number,". + " jr_optype,". "j_debit, jr_internal,jr_id,(select distinct jl_id from sqlletter where sqlletter.j_id=j1.j_id ) as letter , ". " jr_tech_per,p_exercice,jrn_def_name, (with cred as (select jl_id, sum(j_montant) as amount_cred from letter_cred left join jrnx using (j_id) group by jl_id ), @@ -1457,6 +1458,7 @@ class Fiche "". "". "". + "". "". "". th('Prog.','style="text-align:right"'). @@ -1492,7 +1494,7 @@ class Fiche echo "". "". td(''). - "". + "".td("").td(""). "". td(). "". @@ -1520,6 +1522,7 @@ class Fiche "". td($tiers). "". + td($op['jr_optype']). "". "". td(nbm(abs($progress)).$side,'style="text-align:right"'). @@ -1537,7 +1540,7 @@ class Fiche td(). td(). td(_('Totaux')). - "". + "".td("").td(""). "". "". "". diff --git a/include/export/export_gl_csv.php b/include/export/export_gl_csv.php index bb3415b53..6a10e1e90 100644 --- a/include/export/export_gl_csv.php +++ b/include/export/export_gl_csv.php @@ -93,7 +93,7 @@ if ( count($a_poste) == 0 ) } // Header -$header = array( _("Date"), _("Référence"), _("Libellé"), _("Pièce"),_("Lettrage"), _("Débit"), _("Crédit"), _("Solde") ); +$header = array( _("Date"), _("Référence"), _("Libellé"), _("Pièce"),_("Lettrage"),_("Type"), _("Débit"), _("Crédit"), _("Solde") ); $l=(isset($_GET['letter']))?2:0; $s=(isset($_REQUEST['solded']))?1:0; @@ -195,6 +195,7 @@ foreach ($a_poste as $poste) $export->add($detail['jr_pj_number']); if ($detail['letter'] == -1) { $export->add(""); } else { $export->add($detail['letter']);} + $export->add($detail['jr_optype']); if ($detail['deb_montant'] > 0 ) $export->add($detail['deb_montant'],"number"); else diff --git a/include/export/export_gl_pdf.php b/include/export/export_gl_pdf.php index 8bb9f899d..72ae7b593 100644 --- a/include/export/export_gl_pdf.php +++ b/include/export/export_gl_pdf.php @@ -198,7 +198,7 @@ foreach ($a_poste as $poste) /* limit set to 40 for the substring */ $triple_point = (mb_strlen($detail['description']) > 40 ) ? '...':''; // $pdf->LongLine($width[$i], 6, mb_substr($detail['description'],0,40).$triple_point, 0,$lor[$i]); - $pdf->LongLine($width[$i], 6,$detail['description'], 0,$lor[$i]); + $pdf->LongLine($width[$i], 6,$detail['description'].'['.$detail['jr_optype'].']', 0,$lor[$i]); $i++; $pdf->write_cell($width[$i], 6, $detail['jr_pj_number'], 0, 0, $lor[$i]); $i++; diff --git a/include/impress_gl_comptes.inc.php b/include/impress_gl_comptes.inc.php index 8c80b2c7f..52c2a9ef7 100644 --- a/include/impress_gl_comptes.inc.php +++ b/include/impress_gl_comptes.inc.php @@ -146,7 +146,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) } if ( isDate($_REQUEST['from_periode'])==null || isDate($_REQUEST['to_periode'])==null) { - echo alert('Date malformée, désolée'); + echo alert(_('Date malformée, désolée')); return; } echo '
'; @@ -181,6 +181,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
+ @@ -205,15 +206,15 @@ if ( isset( $_REQUEST['bt_html'] ) ) echo ' - - - + + '.td(""). + ''. ''; @@ -241,7 +242,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) $side=" ".$Poste->get_amount_side($solde); $letter=""; $html_let=""; - if ($detail['letter']!=-1) { + if ($detail['letter'] > 0) { $letter=strtoupper(base_convert($detail['letter'],10,36)); $html_let = HtmlInput::show_reconcile("", $letter); } @@ -252,6 +253,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) + @@ -262,8 +264,8 @@ if ( isset( $_REQUEST['bt_html'] ) ) - - + '.td(""). + ' + + + +
"._('Code interne')." "._('Tiers')." "._('Description')." "._('Type')." "._('Débit')." "._('Crédit')."
$old_exerciceTotaux".nbm($sum_deb)."".$vw_operation."".h($op['description'])."".nbm($op['deb_montant'])."".nbm($op['cred_montant'])."".nbm($sum_deb)."".nbm($sum_cred)."".nbm($diff)."Référence Libellé PièceType Débit Crédit Solde
'.$current_exercice.' '.''.''.'Total du compte '.$poste_id['pcm_val'].''.''.''.($solde_d > 0 ? nbm( $solde_d) : '').''._("Total du compte").$poste_id['pcm_val'].''.''.''.($solde_d > 0 ? nbm( $solde_d) : '').' '.($solde_c > 0 ? nbm( $solde_c) : '').' '.nbm( abs($solde_c-$solde_d)).' '; if ($solde_c > $solde_d ) echo _("Crédit"); if ($solde_c < $solde_d ) echo _("Débit"); - if ($solde_c == $solde_d ) echo "="; + if ($solde_c == $solde_d ) echo " "; echo '
'.HtmlInput::detail_op($detail['jr_id'],$detail['jr_internal']).' '.$detail['description'].' '.$detail['jr_pj_number'].''.$detail['jr_optype'].' '.($detail['deb_montant'] > 0 ? nbm($detail['deb_montant']) : '').' '.($detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '').' '.nbm(abs($solde)).$side.''.$current_exercice.' '.''.' '.''.'Total du compte '.$poste_id['pcm_val'].''.''.''.''.''.($solde_d > 0 ? nbm( $solde_d) : '').''.''.''.''.''.($solde_d > 0 ? nbm( $solde_d) : '').''.' '.''.($solde_c > 0 ? nbm( $solde_c) : '').''.' '.''.nbm( abs($solde_c-$solde_d)).''.' '; diff --git a/include/opening.inc.php b/include/opening.inc.php index b37e053a8..033288844 100644 --- a/include/opening.inc.php +++ b/include/opening.inc.php @@ -163,13 +163,13 @@ if ($sa=='step2') $periode=$cn->make_array("select distinct p_exercice,p_exercice from parm_periode order by p_exercice"); $w=new ISelect(); $w->table=0; - $w->label='Periode'; + $w->label=_('Periode N-1'); $w->readonly=false; $w->value=$periode; $w->name="p_periode"; $w->selected=$g_user->get_exercice()-1; echo "

"; - echo _('Période').' : '.$w->input(); + echo _('Période N-1').' : '.$w->input(); echo "

"; echo HtmlInput::submit('ok', _('Continuer')); echo dossier::hidden(); @@ -237,7 +237,7 @@ if ($sa=='step4') $result["ac"]=$http->request("ac"); $result['p_periode']=$p_periode; $result['gDossier']=Dossier::id(); - + $result['jr_optype']="OPE"; // default date = first day of Exercice $periode=new Periode($cn,$g_user->get_periode()); list($periode_start,$periode_end)=$periode->get_limit($g_user->get_exercice()); @@ -260,7 +260,6 @@ if ($sa=='step4') $idx++; } $cn=Dossier::connect(); - $jrn=new Acc_Ledger($cn,$p_jrn); $_POST=$result; $_REQUEST=$result; diff --git a/include/operation_ods_confirm.inc.php b/include/operation_ods_confirm.inc.php index 1f9d941a9..8bb510c83 100644 --- a/include/operation_ods_confirm.inc.php +++ b/include/operation_ods_confirm.inc.php @@ -45,12 +45,13 @@ echo $ledger->confirm($_POST,false); ?>
@@ -73,6 +74,13 @@ echo $ledger->confirm($_POST,false); echo '

'; ?>
+
'.$p_msg.'

'; echo '
'; echo dossier::hidden(); -echo HtmlInput::request_to_hidden(array('ac')); +echo HtmlInput::request_to_hidden(array('ac','jr_optype')); echo $ledger->input($p_post); diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php index 1431661a2..1ff8c4c40 100644 --- a/include/template/ledger_detail_bottom.php +++ b/include/template/ledger_detail_bottom.php @@ -145,6 +145,18 @@ endif;
: input();?>
+ + + det->jr_optype)->input(); + ?> +
diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 9811e0eab..ca1521a56 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -89,4 +89,10 @@ insert into user_active_security (us_login,us_ledger,us_action) select user_nam alter table jrn_def add jrn_enable int; alter table jrn_def alter jrn_enable set default 1; update jrn_def set jrn_enable=1; -comment on column jrn_def.jrn_enable is 'Set to 1 if the ledger is enable '; \ No newline at end of file +comment on column jrn_def.jrn_enable is 'Set to 1 if the ledger is enable '; + + +alter table jrn add jr_optype varchar(3); +alter table jrn alter jr_optype set default 'NOR'; +comment on column jrn.jr_optype is 'Type of operation , NOR = NORMAL , OPE opening , EXT extourne, CLO closing'; +update jrn set jr_optype='NOR'; \ No newline at end of file