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 '