FS#108 - Printing : lettering for impress->account and impress->card

This commit is contained in:
Dany De Bontridder 2010-07-11 19:32:37 +00:00
parent 5edc05af21
commit e8d2fe2f0d
4 changed files with 60 additions and 22 deletions

View file

@ -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 )

View file

@ -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='';

View file

@ -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 '<h2 class="info">'.$this->id." ".$name.'</h2>';
@ -1046,14 +1060,15 @@ av_text1=>'name'
else
$already_seen[]=$op['jr_internal'];
echo "<TR style=\"text-align:center;background-color:lightgrey\">".
"<td >".$op['jr_internal']."</td>".
"<td >".$op['j_date']."</td>".
"<td >".h($op['description'])."</td>".
"<td >"."</td>".
"<td >"."</td>".
"<td>".$op['jr_internal']."</td>".
"<td>".$op['j_date']."</td>".
"<td>".h($op['description'])."</td>".
"<td>"."</td>".
"<td>"."</td>".
"</TR>";
$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 )

View file

@ -105,7 +105,18 @@ $detail->disabled=false;
$detail->selected=(isset($_REQUEST['oper_detail']))?true:false;
echo $detail->input("oper_detail");
echo '</td></tr>';
$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 '</TABLE>';
$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 '</FORM>';
@ -153,14 +164,14 @@ if ( isset( $_REQUEST['bt_html'] ) ) {
echo '<div class="content">';
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 '<table class="result" style="width:80%;margin-left:10%">';
@ -190,7 +201,7 @@ if ( isset( $_REQUEST['bt_html'] ) ) {
if ( ! isset($_REQUEST['oper_detail']) ) {
echo '<div class="content">';
$fiche->HtmlTableHeader();
$fiche->HtmlTable();
$fiche->HtmlTable(null,$_GET['ople']);
$fiche->HtmlTableHeader();
echo "</div>";
} 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 "</div>";