Add view for third in ACH/VEN/FIN (html+csv) pdf must be done

This commit is contained in:
Dany De Bontridder 2011-04-25 20:55:55 +00:00
parent e44fdac9a3
commit a5a538abf9
6 changed files with 36 additions and 1 deletions

View file

@ -2855,5 +2855,31 @@ class Acc_Ledger
);
return $r;
}
/**
*Retrieve the third : supplier for purchase, customer for sale, bank for fin,
*@param $p_jrn_type type of the ledger FIN, VEN ACH or ODS
*/
function get_tiers($p_jrn_type,$jr_id)
{
if ( $p_jrn_type == 'ODS') return ' ';
$tiers='';
switch ($p_jrn_type)
{
case 'VEN':
$tiers=$this->db->get_value('select max(qs_client) from quant_sold join jrnx using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1',array($jr_id));
break ;
case 'ACH':
$tiers=$this->db->get_value('select max(qp_supplier) from quant_purchase join jrnx using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1',array($jr_id));
break ;
case 'FIN':
$tiers=$this->db->get_value('select qf_bank from quant_fin where jr_id=$1',array($jr_id));
break ;
}
if ($this->db->count()==0) return '';
$name=$this->db->get_value('select ad_value from fiche_detail where ad_id=1 and f_id=$1',array($tiers));
$first_name=$this->db->get_value('select ad_value from fiche_detail where ad_id=32 and f_id=$1',array($tiers));
return $name.' '.$first_name;
}
}

View file

@ -22,6 +22,7 @@
/*!\file
* \brief print a listing of financial
*\todo Must add the third part
*/
require_once('class_pdf.php');
class Print_Ledger_Financial extends PDF

View file

@ -23,6 +23,7 @@
/*!\file
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*\todo Must add the third part
*/
require_once('class_pdf.php');

View file

@ -23,6 +23,7 @@
/*!\file
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
* *\todo Must add the third part
*/
require_once('class_pdf.php');

View file

@ -99,6 +99,7 @@ else
printf ('" operation";'.
'"Date";'.
'"N° Pièce";'.
'"Tiers";'.
'"commentaire";'.
'"internal";'.
'"montant";'.
@ -109,6 +110,7 @@ else
echo $line['num'].";";
echo $line['date'].";";
echo $line['jr_pj_number'].";";
echo $Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']).";";
echo $line['comment'].";";
echo $line['jr_internal'].";";
// echo "<TD>".$line['pj'].";";
@ -151,7 +153,7 @@ else
printf('"%s";"%s";"%s";"%s";"%s";%s;',
$line['date'],
$line['num'],
$line['client'],
$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']),
$line['comment'],
$line['jr_internal'],
nb($line['HTVA']));

View file

@ -238,6 +238,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
"<th>Date</th>".
"<th> n° de pièce </th>".
"<th>internal</th>".
th('Tiers').
"<th>Commentaire</th>".
"<th> montant</th>".
"</TR>";
@ -250,8 +251,11 @@ if ( isset( $_REQUEST['bt_html'] ) )
echo "<TD>".$line['date']."</TD>";
echo "<TD>".h($line['jr_pj_number'])."</TD>";
echo "<TD>".HtmlInput::detail_op($line['jr_id'],$line['jr_internal'])."</TD>";
$tiers=$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']);
echo td($tiers);
echo "<TD>".h($line['comment'])."</TD>";
// echo "<TD>".$line['pj']."</TD>";
// If the ledger is financial :
// the credit must be negative and written in red