Export CSV print ledger , add the qcode for ODS and FIN
This commit is contained in:
parent
9eb2a676e9
commit
56d655b352
3 changed files with 35 additions and 17 deletions
|
|
@ -385,7 +385,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste,jr_montant , " .
|
||||
j_debit as debit,j_poste as poste,j_qcode,jr_montant , " .
|
||||
"case when j_text='' or j_text is null then pcm_lib else j_text end as description,j_grpt as grp,
|
||||
jr_comment||' ('||jr_internal||')' as jr_comment,
|
||||
jr_pj_number,
|
||||
|
|
@ -404,7 +404,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste," .
|
||||
j_debit as debit,j_poste as poste,j_qcode," .
|
||||
"case when j_text='' or j_text is null then pcm_lib else j_text end as description,j_grpt as grp,
|
||||
jr_comment||' ('||jr_internal||')' as jr_comment,
|
||||
jr_pj_number,
|
||||
|
|
@ -3381,17 +3381,14 @@ class Acc_Ledger extends jrn_def_sql
|
|||
);
|
||||
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)
|
||||
//---------------------------------------------------------------------
|
||||
/// Return the f_id of the tiers , called by get_tiers
|
||||
//!\param $p_jrn_type type of the ledger FIN, VEN ACH or ODS
|
||||
//!\param $jr_id jrn.jr_id
|
||||
//---------------------------------------------------------------------
|
||||
function get_tiers_id($p_jrn_type, $jr_id)
|
||||
{
|
||||
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));
|
||||
|
|
@ -3405,7 +3402,21 @@ class Acc_Ledger extends jrn_def_sql
|
|||
break;
|
||||
}
|
||||
if ($this->db->count() == 0)
|
||||
return '';
|
||||
return 0;
|
||||
return $tiers;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
* @param $jr_id jrn.jr_id
|
||||
*/
|
||||
function get_tiers($p_jrn_type, $jr_id)
|
||||
{
|
||||
if ($p_jrn_type == 'ODS')
|
||||
return ' ';
|
||||
$tiers = $this->get_tiers_id($p_jrn_type, $jr_id);
|
||||
if ( $tiers == 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;
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
* * It generates the document if gen_invoice is set and save the middle of payment if any ($e_mp)
|
||||
*
|
||||
* \param $p_array is usually $_POST or a predefined operation
|
||||
* \return string
|
||||
* \return string : internal number
|
||||
* \note throw an Exception
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ if ( $get_option == 0 )
|
|||
$title[]=_("Interne");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("Poste");
|
||||
$title[]=_("QuickCode");
|
||||
$title[]=_("Libellé");
|
||||
$title[]=_("Débit");
|
||||
$title[]=_("Crédit");
|
||||
|
|
@ -159,6 +160,7 @@ if ( $get_option == 0 )
|
|||
$export->add($op['internal']);
|
||||
$export->add($op['j_date']);
|
||||
$export->add($op['poste']);
|
||||
$export->add($op['j_qcode']);
|
||||
$export->add($desc);
|
||||
$export->add($op['deb_montant'],"number");
|
||||
$export->add($op['cred_montant'],"number");
|
||||
|
|
@ -184,6 +186,7 @@ if ($get_option == 1)
|
|||
$title[]=_("operation");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("N° Pièce");
|
||||
$title[]=_("QuickCode");
|
||||
$title[]=_("Tiers");
|
||||
$title[]=_("commentaire");
|
||||
$title[]=_("internal");
|
||||
|
|
@ -191,11 +194,15 @@ if ($get_option == 1)
|
|||
$export->write_header($title);
|
||||
foreach ($Row as $line)
|
||||
{
|
||||
|
||||
$tiers_id=$Jrn->get_tiers_id($line['jrn_def_type'],$line['jr_id']);
|
||||
$fiche_tiers=new Fiche($cn,$tiers_id);
|
||||
$tiers=$fiche_tiers->strAttribut(ATTR_DEF_NAME,0)." ".$fiche_tiers->strAttribut(ATTR_DEF_FIRST_NAME,0);
|
||||
|
||||
$export->add( $line['num']);
|
||||
$export->add($line['date']);
|
||||
$export->add($line['jr_pj_number']);
|
||||
$export->add($Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']));
|
||||
$export->add($fiche_tiers->get_quick_code());
|
||||
$export->add($tiers);
|
||||
$export->add($line['comment']);
|
||||
$export->add($line['jr_internal']);
|
||||
// echo "<TD>".$line['pj'].";";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue