From e8d2fe2f0dec1433c21bfc49db012065e4a58231 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 11 Jul 2010 19:32:37 +0000 Subject: [PATCH] FS#108 - Printing : lettering for impress->account and impress->card --- include/class_acc_account_ledger.php | 19 ++++++++++--- include/class_acc_operation.php | 2 +- include/class_fiche.php | 42 +++++++++++++++++++--------- include/impress_poste.inc.php | 19 ++++++++++--- 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/include/class_acc_account_ledger.php b/include/class_acc_account_ledger.php index c497a7022..5bd924c51 100644 --- a/include/class_acc_account_ledger.php +++ b/include/class_acc_account_ledger.php @@ -99,10 +99,21 @@ class Acc_Account_Ledger { * (tot_deb,tot_credit * */ - function get_row_date($p_from,$p_to) + function get_row_date($p_from,$p_to,$let=0) { $user=new User($this->db); $filter_sql=$user->get_ledger_sql('ALL',3); + $sql_let=''; + switch ($let) { + case 0: + break; + case 1: + $sql_let=' and j_id in (select j_id from letter_cred union select j_id from letter_deb)'; + break; + case '2': + $sql_let=' and j_id not in (select j_id from letter_cred union select j_id from letter_deb) '; + break; + } $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,". @@ -115,7 +126,7 @@ class Acc_Account_Ledger { " 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 ". + " and $filter_sql $sql_let ". " order by j_date",array($this->id,$p_from,$p_to)); return $this->get_row_sql($Res); } @@ -267,12 +278,12 @@ function get_solde_detail($p_cond="") { */ - function HtmlTable($p_array=null ) + function HtmlTable($p_array=null,$let=0 ) { if ( $p_array==null)$p_array=$_REQUEST; $this->get_name(); list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'], - $p_array['to_periode'] + $p_array['to_periode'],$let ); if ( count($this->row ) == 0 ) diff --git a/include/class_acc_operation.php b/include/class_acc_operation.php index 0e9fcfa5b..944af1a71 100644 --- a/include/class_acc_operation.php +++ b/include/class_acc_operation.php @@ -277,7 +277,7 @@ function get_internal() { $r_notable=''; $csv=""; foreach ($show as $l) { - if ( $l['j_poste'] == $this->poste) + if ( $l['j_poste'] == $this->poste || $l['j_qcode']==$this->qcode) $border=' style="border-bottom:1px solid red;"'; else $border=''; diff --git a/include/class_fiche.php b/include/class_fiche.php index 1e6e1c666..c4c8c09e8 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -948,12 +948,13 @@ av_text1=>'name' * \brief Get data for poste * * \param $p_from periode from - * \param $p_to end periode + * \param $p_to end periodeµ + *\param $op_let 0 all operation, 1 only lettered one, 2 only unlettered one * \return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) * (tot_deb,tot_credit * */ - function get_row_date($p_from,$p_to) + function get_row_date($p_from,$p_to,$op_let=0) { if ( $this->id == 0 ) { @@ -962,6 +963,17 @@ av_text1=>'name' } $user=new User($this->cn); $filter_sql=$user->get_ledger_sql('ALL',3); + $sql_let=''; + switch ($op_let) { + case 0: + break; + case 1: + $sql_let=' and j_id in (select j_id from letter_cred union select j_id from letter_deb)'; + break; + case '2': + $sql_let=' and j_id not in (select j_id from letter_cred union select j_id from letter_deb) '; + break; + } $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,". @@ -974,7 +986,7 @@ av_text1=>'name' " 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 ". + " and $filter_sql $sql_let ". " order by j_date",array($qcode,$p_from,$p_to)); return $this->get_row_result($Res); } @@ -1012,9 +1024,10 @@ av_text1=>'name' } /*! * \brief HtmlTable, display a HTML of a card for the asked period + *\param $op_let 0 all operation, 1 only lettered one, 2 only unlettered one * \return none */ - function HtmlTableDetail($p_array=null) + function HtmlTableDetail($p_array=null,$op_let=0) { if ( $p_array == null) $p_array=$_REQUEST; @@ -1022,12 +1035,13 @@ av_text1=>'name' $name=$this->getName(); list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'], - $p_array['to_periode'] + $p_array['to_periode'], + $op_let ); if ( count($this->row ) == 0 ) return; - + $qcode=$this->strAttribut(ATTR_DEF_QUICKCODE); $rep=""; $already_seen=array(); echo '

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

'; @@ -1046,14 +1060,15 @@ av_text1=>'name' else $already_seen[]=$op['jr_internal']; echo "". - "".$op['jr_internal']."". - "".$op['j_date']."". - "".h($op['description'])."". - ""."". - ""."". + "".$op['jr_internal']."". + "".$op['j_date']."". + "".h($op['description'])."". + ""."". + ""."". ""; $ac=new Acc_Operation($this->cn); $ac->jr_id=$op['jr_id']; + $ac->qcode=$qcode; echo $ac->display_jrnx_detail(1); } @@ -1075,7 +1090,7 @@ av_text1=>'name' * \brief HtmlTable, display a HTML of a card for the asked period * \param $p_array default = null keys = from_periode, to_periode */ - function HtmlTable($p_array=null) + function HtmlTable($p_array=null,$op_let=0) { if ( $p_array == null) $p_array=$_REQUEST; @@ -1083,7 +1098,8 @@ av_text1=>'name' $name=h($this->getName()).'['.$this->strAttribut(ATTR_DEF_QUICKCODE).']'; list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'], - $p_array['to_periode'] + $p_array['to_periode'], + $op_let ); if ( count($this->row ) == 0 ) diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php index 9096e1305..cd7c43d2c 100644 --- a/include/impress_poste.inc.php +++ b/include/impress_poste.inc.php @@ -105,7 +105,18 @@ $detail->disabled=false; $detail->selected=(isset($_REQUEST['oper_detail']))?true:false; echo $detail->input("oper_detail"); echo ''; +$a_let=array( + array('value'=>0,'label'=>'Toutes les opérations'), + array('value'=>1,'label'=>' Opérations lettrées'), + array('value'=>2,'label'=>' Opérations non lettrées') + ); echo ''; +$salet=new ISelect('ople'); +$salet->value=$a_let; +$salet->selected=(isset ($_GET['ople']))?$_GET['ople']:0; + +echo $salet->input(); + print HtmlInput::submit('bt_html','Visualisation'); echo ''; @@ -153,14 +164,14 @@ if ( isset( $_REQUEST['bt_html'] ) ) { echo '
'; if ( ! isset($_REQUEST['oper_detail']) ) { Acc_Account_Ledger::HtmlTableHeader(); - $Poste->HtmlTable(); + $Poste->HtmlTable(null,$_GET['ople']); echo Acc_Account_Ledger::HtmlTableHeader(); } else { //---------------------------------------------------------------------- // Detail //---------------------------------------------------------------------- Acc_Account_Ledger::HtmlTableHeader(); - $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode']); + $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']); if ( empty($Poste->row)) exit(); $Poste->load(); echo ''; @@ -190,7 +201,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) { if ( ! isset($_REQUEST['oper_detail']) ) { echo '
'; $fiche->HtmlTableHeader(); - $fiche->HtmlTable(); + $fiche->HtmlTable(null,$_GET['ople']); $fiche->HtmlTableHeader(); echo "
"; } else { @@ -220,7 +231,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) { foreach ($a_poste as $poste_id ) { $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']); - $Poste->HtmlTable(); + $Poste->HtmlTable(null,$_GET['ople']); } echo Acc_Account_Ledger::HtmlTableHeader(); echo "";