diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php index a6426b10b..e858501f9 100644 --- a/include/ajax/ajax_history.php +++ b/include/ajax/ajax_history.php @@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/class/acc_account.class.php'; require_once NOALYSS_INCLUDE.'/class/exercice.class.php'; $div=$_REQUEST['div']; mb_internal_encoding("UTF-8"); - +$http=new HttpInput(); /** *if $_SESSION['g_user'] is not set : echo a warning */ @@ -50,7 +50,8 @@ if ( isset($_GET['f_id'])) { $exercice=new Exercice($cn); $old=''; - $fiche=new Fiche($cn,$_GET['f_id']); + $f_id=$http->get('f_id',"number"); + $fiche=new Fiche($cn,$f_id); $year=$g_user->get_exercice(); if ( $year == 0 ) { @@ -64,8 +65,9 @@ if ( isset($_GET['f_id'])) $array['to_periode']=$limit_periode[1]->last_day(); if (isset($_GET['ex'])) { - $limit_periode=$per->get_limit($_GET['ex']); - if ( $_GET['ex'] < $year) + $ex=$http->get('ex','number'); + $limit_periode=$per->get_limit($ex); + if ( $ex < $year) $array['from_periode']=$limit_periode[0]->first_day(); else $array['to_periode']=$limit_periode[1]->last_day(); diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index 0ccb3de9d..77fb0e711 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -45,8 +45,9 @@ class Acc_Account_Ledger *@brief get the row thanks the resource *@return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) * (tot_deb,tot_credit) + * @deprecated since version 6920 */ - private function get_row_sql($Res) + private function get_row_sql_deprecated($Res) { $array=array(); $tot_cred=0.0; @@ -84,22 +85,38 @@ class Acc_Account_Ledger { $periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per'); - $Res=$this->db->exec_sql("select distinct j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,". + $this->row=$this->db->get_array("select distinct j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,". "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,". "j_debit, jr_internal,jr_pj_number ". " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ". " left join jrn on jr_grpt_id=j_grpt". - " where j_poste=".$this->id." and ".$periode. - " order by j_date"); - return $this->get_row_sql($Res); + " where j_poste=$1 and $periode ". + " order by j_date",array($this->id)); + $res_saldo = $this->db->exec_sql( + "select sum(deb_montant),sum(cred_montant) from + (select 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 + from jrnx + left join jrn_def + on jrn_def_id=j_jrn_def + left join jrn on jr_grpt_id=j_grpt + where j_poste=$1 and $periode ) as m + ",array($this->id)); + $this->tot_deb=$this->tot_cred=0; + + if ( Database::num_row($res_saldo) > 0 ) { + $this->tot_deb=Database::fetch_result($res_saldo, 0, 0); + $this->tot_cred=Database::fetch_result($res_saldo, 0, 1); + } + return array($this->row,$this->tot_deb,$this->tot_cred); } /*! * \brief Get data for accounting entry between 2 date * - *\param $p_from date from - *\param $p_to end date + *\param $p_from date from DD.MM.YYYY + *\param $p_to end date DD.MM.YYYY *\param $let 0 means all rows, 1 only lettered, 2 only unlettered *\param $solded 0 means all account, 1 means only accounts with a saldo <> 0 *\note the data are filtered by the access of the current user @@ -127,14 +144,15 @@ class Acc_Account_Ledger { $filter=str_replace('jrn_def_id','jr_def_id',$filter_sql); $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as s_cred, j_poste - from (select case when j_debit='t' then j_montant else 0 end as amount_deb, - case when j_debit='f' then j_montant else 0 end as amount_cred, - j_poste - from jrnx join jrn on (j_grpt = jr_grpt_id) - where - j_poste=$1 and - $filter and - ( to_date($2,'DD.MM.YYYY') <= j_date and + from + (select case when j_debit='t' then j_montant else 0 end as amount_deb, + case when j_debit='f' then j_montant else 0 end as amount_cred, + j_poste + from jrnx join jrn on (j_grpt = jr_grpt_id) + where + j_poste=$1 and + $filter and + ( to_date($2,'DD.MM.YYYY') <= j_date and to_date($3,'DD.MM.YYYY') >= j_date )) as signed_amount group by j_poste "; @@ -142,26 +160,49 @@ class Acc_Account_Ledger if ( $this->db->count() == 0 ) return array(); if ($r[0]['s_deb']==$r[0]['s_cred']) return array(); } - $Res=$this->db->exec_sql("select jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,". - "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,". - " case when j_text is null or j_text = '' then jr_comment + $this->row=$this->db->get_array("select j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date, + 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, + case when j_text is null or j_text = '' then jr_comment else jr_comment||' '||j_text end - 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 ". - ",pcm_lib ". - ",jr_tech_per,p_exercice,jrn_def_name,jrn_def_code". - " 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)". - " left join parm_periode on (p_id=jr_tech_per) ". - " where j_poste=$1 and ". - " ( 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,substring(jr_pj_number,'[0-9]+$') asc",array($this->id,$p_from,$p_to)); - return $this->get_row_sql($Res); + 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 + ,pcm_lib + ,jr_tech_per + ,p_exercice + ,jrn_def_name + ,jrn_def_code + from jrnx + join jrn_def on (jrn_def_id=j_jrn_def ) + join jrn on (jr_grpt_id=j_grpt) + join tmp_pcmn on (j_poste=pcm_val) + join parm_periode on (p_id=jr_tech_per) + where j_poste=$1 and + ( 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,substring(jr_pj_number,'[0-9]+$') asc",array($this->id,$p_from,$p_to)); + $res_saldo = $this->db->exec_sql("select sum(deb_montant),sum(cred_montant) from + (select 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 + from jrnx + join jrn_def on (jrn_def_id=j_jrn_def ) + join jrn on (jr_grpt_id=j_grpt) + join tmp_pcmn on (j_poste=pcm_val) + join parm_periode on (p_id=jr_tech_per) + where j_poste=$1 and + ( to_date($2,'DD.MM.YYYY') <= j_date and + to_date($3,'DD.MM.YYYY') >= j_date ) + and $filter_sql $sql_let ) as m",array($this->id,$p_from,$p_to)); + $this->tot_deb=$this->tot_cred=0; + + if ( Database::num_row($res_saldo) > 0 ) { + $this->tot_deb=Database::fetch_result($res_saldo, 0, 0); + $this->tot_cred=Database::fetch_result($res_saldo, 0, 1); + } + return array($this->row,$this->tot_deb,$this->tot_cred); } @@ -311,6 +352,7 @@ class Acc_Account_Ledger return 0; } + /*! * \brief HtmlTable, display a HTML of a poste for the asked period * \param $p_array array for filter @@ -337,12 +379,14 @@ class Acc_Account_Ledger echo "
| Date | ". - "n° de pièce | ". - "Code interne | ". - "Description | ". - "Débit | ". - "Crédit | ". + ""._('Date')." | ". + ""._('n° de pièce')." | ". + ""._('QuickCode')." | ". + ""._('Code interne')." | ". + ""._('Tiers')." | ". + ""._('Description')." | ". + ""._('Débit')." | ". + ""._("Crédit")." | ". th('Prog.','style="text-align:right"'). th('Let.','style="text-align:right"'); "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| $old_exercice | ". - td(''). - "". - " | Totaux | ". + "".td().td().td(). + " | "._("Totaux")." | ". "".nbm($sum_deb)." | ". "".nbm($sum_cred)." | ". td(nbm(abs($progress)).$side,'style="text-align:right"'). @@ -398,7 +446,9 @@ class Acc_Account_Ledger echo "|||||||
| ".smaller_date(format_date($op['j_date']))." | ". td(h($op['jr_pj_number'])). + "".h($op['j_qcode'])." | ". "".$vw_operation." | ". + "".$tiers." | ". "".h($op['description'])." | ". "".nbm($op['deb_montant'])." | ". "".nbm($op['cred_montant'])." | ". @@ -409,17 +459,17 @@ class Acc_Account_Ledger $old_exercice=$op['p_exercice']; } echo '|||||||
| Totaux | ". - " | ". - " | ". + td($op['p_exercice']). + td().td().td().td(). + " | Totaux | ". "".nbm($sum_deb)." | ". "".nbm($sum_cred)." | ". "".nbm(abs($diff)).$side." | ". - + td(). "||||||
| $solde_type | ". " | ".nbm(abs($diff))." | ". @@ -702,12 +752,5 @@ class Acc_Account_Ledger function filter_history($p_table_id) { return _('Filtre rapide').' '.HtmlInput::filter_table($p_table_id, '0,1,2,3,4,5,6,7', 1); } - static function test_me() - { - $cn=Dossier::connect(); - $a=new Acc_Account_Ledger($cn,550); - echo ' Journal 4 '.$a->belong_ledger(4); - return $a->belong_ledger(4);; - - } + } diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php index 344f340f5..cc51756ef 100644 --- a/include/class/acc_operation.class.php +++ b/include/class/acc_operation.class.php @@ -25,6 +25,7 @@ */ require_once NOALYSS_INCLUDE.'/class/user.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php'; +require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; /*! * \brief this file match the tables jrn & jrnx the purpose is to @@ -67,6 +68,89 @@ class Acc_Operation $ret=$this->db->get_value('select jr_grpt_id from jrn where jr_id=$1', array($this->jr_id)); return $ret; + } + /** + * \brief prepare the query for getting the qcode of the tiers, when + * executing this SQL , an array of (jrn.jr_id , jrnx.j_id) must be + * provided + */ + private function prepare_sql_tiers() + { + // prepare for getting the tiers + $this->db->prepare('prep_tiers',"select fiche_detail.f_id,ad_value from + fiche_detail + join (select qf_other as f_id + from quant_fin + where + quant_fin.jr_id = $1 + union all + select qp_supplier as f_id + from quant_purchase + where quant_purchase.j_id=$2 + union all + select qs_client as f_id + from quant_sold + where quant_sold.j_id=$2 ) as v_fiche on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 "); + } + /** + * \brief prepare the query for getting the qcode of the tiers, when + * executing this SQL , an array of (jrn.jr_id , jrnx.j_id) must be + * provided + */ + private function prepare_sql_counterpart() + { + // prepare for getting the tiers + $this->db->prepare('prep_counterpart',"select fiche_detail.f_id,ad_value from + fiche_detail + join (select qf_bank as f_id + from quant_fin + where + quant_fin.jr_id = $1 + union all + select qp_fiche as f_id + from quant_purchase + where quant_purchase.j_id=$2 + union all + select qs_fiche as f_id + from quant_sold + where quant_sold.j_id=$2 ) as v_fiche on (fiche_detail.f_id=v_fiche.f_id) where ad_id=23 "); + } + /** + * @brief Find the tiers of an operation , thanks the SQL prepared query + * prep_tiers and prep_counterpart. Return a string with the quick_code + * @param type $pn_jrn_id pk of the table jrn (jrn.jr_id) + * @param type $pn_jrnx_id pk of the table jrnx (jrnx.jr_id) + * @param type $p_code quickcode + * @return string + */ + function find_tiers($pn_jrn_id,$pn_jrnx_id,$p_code) + { + static $p=0; + if ( $p == 0 ){ + $this->prepare_sql_counterpart(); + $this->prepare_sql_tiers(); + $p=1; + } + $tiers=""; + $res_tiers=$this->db->execute('prep_tiers', + array($pn_jrn_id,$pn_jrnx_id)); + if ( Database::num_row($res_tiers) > 0) { + $atiers=Database::fetch_array($res_tiers); + $tiers=$atiers['ad_value']; + // If the found tiers has the same quickcode than the current + // card, it means it is a card of supplier or customer, + // so we must look for the countercard + if ($tiers == $p_code) { + $res_counterpart=$this->db->execute('prep_counterpart', + array($pn_jrn_id,$pn_jrnx_id)); + $tiers=""; + if ( Database::num_row($res_counterpart) > 0) { + $atiers=Database::fetch_array($res_counterpart); + $tiers=$atiers['ad_value']; + } + } + } + return $tiers; } /** *@brief Insert into the table Jrn diff --git a/include/class/acc_reconciliation.class.php b/include/class/acc_reconciliation.class.php index 0bed22e4a..9c4ff619b 100644 --- a/include/class/acc_reconciliation.class.php +++ b/include/class/acc_reconciliation.class.php @@ -619,7 +619,7 @@ j1.j_poste as poste * @param type $p_jrn_id jrn.jr_id * @param type $p_default_amount amount to return if not found in the view * v_quant_detail - * @return type + * @return number */ function get_amount_noautovat($p_jrn_id,$p_default_amount) { $retdb=$this->db->execute("detail_quant",array($p_jrn_id)); diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 4fe2b107b..5f0275b80 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -27,6 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/itext.class.php'; require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php'; require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php'; require_once NOALYSS_INCLUDE.'/lib/iposte.class.php'; +require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; /*! \file * \brief define Class fiche, this class are using @@ -1097,8 +1098,9 @@ class Fiche /** *@brief fetch and return and array *@see get_row get_row_date + * @deprecated since version 6920 */ - private function get_row_result($res) + private function get_row_result_deprecated($res) { $array=array(); $tot_cred=0.0; @@ -1119,6 +1121,8 @@ class Fiche } } $this->row=$array; + $this->tot_deb=$tot_deb; + $this->tot_cred=$tot_cred; return array($array,$tot_deb,$tot_cred); } /*! @@ -1154,10 +1158,10 @@ class Fiche } $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); - $Res=$this->cn->exec_sql("select distinct substring(jr_pj_number,'[0-9]+$'),j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_qcode,". + $this->row=$this->cn->get_array("select distinct substring(jr_pj_number,'[0-9]+$'),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_comment as description,jrn_def_name as jrn_name,j_poste,". " jr_pj_number,". "j_debit, jr_internal,jr_id,coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter, ". " jr_tech_per,p_exercice,jrn_def_name, @@ -1170,15 +1174,34 @@ class Fiche " to_date($3,'DD.MM.YYYY') >= j_date )". " and $filter_sql $sql_let ". " order by j_date,substring(jr_pj_number,'[0-9]+$')",array($qcode,$p_from,$p_to)); - - return $this->get_row_result($Res); + + $res_saldo = $this->cn->exec_sql("select sum(deb_montant),sum(cred_montant) from + (select 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 + from jrnx + join jrn_def on (jrn_def_id=j_jrn_def ) + join jrn on (jr_grpt_id=j_grpt) + join tmp_pcmn on (j_poste=pcm_val) + join parm_periode on (p_id=jr_tech_per) + where j_qcode=$1 and + ( to_date($2,'DD.MM.YYYY') <= j_date and + to_date($3,'DD.MM.YYYY') >= j_date ) + and $filter_sql $sql_let ) as m",array($this->id,$p_from,$p_to)); + $this->tot_deb=$this->tot_cred=0; + + if ( Database::num_row($res_saldo) > 0 ) { + $this->tot_deb=Database::fetch_result($res_saldo, 0, 0); + $this->tot_cred=Database::fetch_result($res_saldo, 0, 1); + } + + return [$this->row,$this->tot_deb,$this->tot_cred]; } /*! * \brief Get data for poste * - * \param $p_from periode from - * \param $p_to end periode + * \param $p_from periode periode.p_id + * \param $p_to end periode periode.p_id * \return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) * (tot_deb,tot_credit * @@ -1193,16 +1216,40 @@ class Fiche $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); $periode=sql_filter_per($this->cn,$p_from,$p_to,'p_id','jr_tech_per'); - $Res=$this->cn->exec_sql("select 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,". - "j_debit, jr_internal,jr_id ". - " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ". - " left join jrn on jr_grpt_id=j_grpt". - " where j_qcode='".$qcode."' and ".$periode. - " order by j_date::date"); - return $this->get_row_result($Res); + $this->row=$this->cn->get_array("select 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, + j_debit, + jr_internal, + jr_id + from jrnx + left join jrn_def on jrn_def_id=j_jrn_def + left join jrn on jr_grpt_id=j_grpt + where + j_qcode=$1 and {$periode} + order by j_date::date",array( + $qcode + )); + $res_saldo = $this->cn->exec_sql("select sum(deb_montant),sum(cred_montant) from + (select 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 + from jrnx + left join jrn_def on jrn_def_id=j_jrn_def + left join jrn on jr_grpt_id=j_grpt + where + j_qcode=$1 and {$periode} ) as m", + array($this->id)); + $this->tot_deb=$this->tot_cred=0; + + if ( Database::num_row($res_saldo) > 0 ) { + $this->tot_deb=Database::fetch_result($res_saldo, 0, 0); + $this->tot_cred=Database::fetch_result($res_saldo, 0, 1); + } + return array($this->row,$this->tot_deb,$this->tot_cred); } /*! @@ -1283,14 +1330,14 @@ class Fiche if ( $p_array == null) $p_array=$_REQUEST; $progress=0; - // if from_periode is greater than to periode then swap the values - if (cmpDate($p_array['from_periode'],$p_array['to_periode']) > 0) - { - $tmp=$p_array['from_periode']; - $p_array['from_periode']=$p_array['to_periode']; - $p_array['to_periode']=$tmp; + // if from_periode is greater than to periode then swap the values + if (cmpDate($p_array['from_periode'],$p_array['to_periode']) > 0) + { + $tmp=$p_array['from_periode']; + $p_array['from_periode']=$p_array['to_periode']; + $p_array['to_periode']=$tmp; - } + } list($array, $tot_deb, $tot_cred) = $this->get_row_date($p_array['from_periode'], $p_array['to_periode'], $op_let); if ( count($this->row ) == 0 ) @@ -1309,7 +1356,9 @@ class Fiche echo "|||||||||||
| "._('Date')." | ". ""._('n° pièce')." | ". + ""._('Poste')." | ". ""._('Code interne')." | ". + ""._('Tiers')." | ". ""._('Description')." | ". ""._('Débit')." | ". ""._('Crédit')." | ". @@ -1320,6 +1369,7 @@ class Fiche $old_exercice="";$sum_deb=0;$sum_cred=0; bcscale(2); $idx=0; + $operation=new Acc_Operation($this->cn); foreach ( $this->row as $op ) { $vw_operation = sprintf('%s', $op['jr_id'], dossier::id(), $op['jr_internal']); @@ -1346,6 +1396,7 @@ class Fiche td(''). "". " | Totaux | ". + td(). "".nbm($sum_deb)." | ". "".nbm($sum_cred)." | ". td(nbm(abs($progress)).$side,'style="text-align:right"'). @@ -1360,13 +1411,16 @@ class Fiche $side=" ".$this->get_amount_side($progress); $sum_cred=bcadd($sum_cred,$op['cred_montant']); $sum_deb=bcadd($sum_deb,$op['deb_montant']); - if ($idx%2 == 0) $class='class="odd"'; else $class=' class="even"'; - $idx++; - + if ($idx%2 == 0) $class='class="odd"'; else $class=' class="even"'; + $idx++; + + $tiers=$operation->find_tiers($op['jr_id'], $op['j_id'], $op['j_qcode']); echo "||
| ".smaller_date(format_date($op['j_date_fmt']))." | ". td(h($op['jr_pj_number'])). + td($op['j_poste']). "".$vw_operation." | ". + td($tiers). "".h($op['description'])." | ". "".nbm($op['deb_montant'])." | ". "".nbm($op['cred_montant'])." | ". @@ -1376,18 +1430,20 @@ class Fiche $old_exercice=$op['p_exercice']; } - $solde_type=($sum_deb>$sum_cred)?"solde débiteur":"solde créditeur"; + $solde_type=($sum_deb>$sum_cred)?_("solde débiteur"):_("solde créditeur"); + $solde_side=($sum_deb>$sum_cred)?"D":"C"; $diff=abs(bcsub($sum_deb,$sum_cred)); echo '|||||||||
| Totaux | ". - "". - " | ". + td($op['p_exercice']). + td(). + td(). + td(_('Totaux')). " | ". " | ".nbm($sum_deb)." | ". "".nbm($sum_cred)." | ". "".nbm($diff)." | ". - + td($solde_side). "|||||||
| $solde_type | ". diff --git a/include/export/export_fiche_detail_csv.php b/include/export/export_fiche_detail_csv.php index f4eaacb05..30061ac54 100644 --- a/include/export/export_fiche_detail_csv.php +++ b/include/export/export_fiche_detail_csv.php @@ -26,6 +26,8 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php'; require_once NOALYSS_INCLUDE.'/class/fiche.class.php'; require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; + $http=new HttpInput(); $f_id=$http->request("f_id", "number"); @@ -63,22 +65,26 @@ if ( count($Fiche->row ) == 0 ) if ( ! isset ($_REQUEST['oper_detail'])) { $title=array(); - $title=array("Qcode", - "Date", - "n° pièce", - "Code interne", - "Code journal", - "Nom journal", - "Description", - "Débit", - "Crédit", - "Prog.", - "Let." ); + $title=array(_("QCODE"), + _("Poste"), + _("Date"), + _("n° pièce"), + _("Code interne"), + _("Code journal"), + _("Nom journal"), + _("Tiers"), + _("Description"), + _("Débit"), + _("Crédit"), + _("Prog."), + _("Let.") + ); $export->write_header($title); $progress=0; $current_exercice=""; $tot_deb=0;$tot_cred=0; bcscale(2); + $operation=new Acc_Operation($cn); foreach ( $Fiche->row as $op ) { /* @@ -95,6 +101,9 @@ if ( ! isset ($_REQUEST['oper_detail'])) $export->add(_('total')); $export->add($current_exercice); $export->add($solde_type); + $export->add(""); + $export->add(""); + $export->add(""); $export->add($tot_deb,"number"); $export->add($tot_cred,"number"); $export->add($diff,"number"); @@ -106,16 +115,19 @@ if ( ! isset ($_REQUEST['oper_detail'])) $tot_deb=0;$tot_cred=0; $export->write(); } + $tiers=$operation->find_tiers($op['jr_id'], $op['j_id'], $op['j_qcode']); $diff=bcsub($op['deb_montant'],$op['cred_montant']); $progress=bcadd($progress,$diff); $tot_deb=bcadd($tot_deb,$op['deb_montant']); $tot_cred=bcadd($tot_cred,$op['cred_montant']); $export->add($op['j_qcode']); + $export->add($op['j_poste']); $export->add($op['j_date_fmt']); $export->add($op['jr_pj_number']); $export->add($op['jr_internal']); $export->add($op['jrn_def_code']); $export->add($op['jrn_def_name']); + $export->add($tiers); $export->add($op['description']); $export->add($op['deb_montant'],"number"); $export->add($op['cred_montant'],"number"); diff --git a/include/export/export_fiche_detail_pdf.php b/include/export/export_fiche_detail_pdf.php index 3cbc9b8f3..ff30dcadb 100644 --- a/include/export/export_fiche_detail_pdf.php +++ b/include/export/export_fiche_detail_pdf.php @@ -30,6 +30,7 @@ include_once("lib/impress.class.php"); require_once NOALYSS_INCLUDE.'/class/fiche.class.php'; require_once NOALYSS_INCLUDE.'/header_print.php'; require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; +require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; require_once NOALYSS_INCLUDE.'/lib/pdf.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; $http=new HttpInput(); @@ -53,7 +54,7 @@ $pdf->setTitle(_("Détail fiche"),true); $Fiche=new Fiche($cn,$f_id); - +$operation=new Acc_Operation($cn); list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date($from_periode,$to_periode,$_GET['ople']); // don't print empty account @@ -148,7 +149,10 @@ for ($e=0;$e