Task #1231 - Cohérence listes CSV Journaux
#1231 Rewrite code for export CSV for ACC , Stock and follow up
This commit is contained in:
parent
5d6a2f8b87
commit
90d21428b3
17 changed files with 640 additions and 510 deletions
|
|
@ -98,10 +98,10 @@ class Acc_Account_Ledger
|
|||
/*!
|
||||
* \brief Get data for accounting entry between 2 date
|
||||
*
|
||||
* \param $p_from date from
|
||||
* \param $p_to end date
|
||||
*\param $p_from date from
|
||||
*\param $p_to end date
|
||||
*\param $let 0 means all rows, 1 only lettered, 2 only unlettered
|
||||
* \param $solded 0 means all account, 1 means only accounts with a saldo <> 0
|
||||
*\param $solded 0 means all account, 1 means only accounts with a saldo <> 0
|
||||
*\note the data are filtered by the access of the current user
|
||||
* \return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
|
||||
* (tot_deb,tot_credit
|
||||
|
|
|
|||
|
|
@ -434,6 +434,10 @@ j1.j_poste as poste
|
|||
*/
|
||||
function export_csv($p_choice)
|
||||
{
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
$export=new Noalyss_Csv(_('rapprochement'));
|
||||
$export->send_header();
|
||||
|
||||
$array = $this->get_data($p_choice);
|
||||
for ($i = 0; $i < count($array); $i++)
|
||||
{
|
||||
|
|
@ -443,14 +447,30 @@ j1.j_poste as poste
|
|||
|
||||
$first = $array[$i]['first'];
|
||||
$a_depend = array();
|
||||
$title=array();
|
||||
if (isset($array[$i]['depend']))
|
||||
{
|
||||
$a_depend = $array[$i]['depend'];
|
||||
//----- HEADER ----
|
||||
if ($i == 0)
|
||||
{
|
||||
printf('"n°";"Date";"internal";"libellé";"n° pièce";"nom journal";"type journal";"montant"');
|
||||
printf(';"<->";"Date";"internal";"libellé";"n° pièce";"nom journal";"type journal";"montant"' . "\n\r");
|
||||
$title[]=_('n°');
|
||||
$title[]=_('Date');
|
||||
$title[]=_('internal');
|
||||
$title[]=_('libellé');
|
||||
$title[]=_('pièce');
|
||||
$title[]=_('journal');
|
||||
$title[]=_('type journal');
|
||||
$title[]=_('montant');
|
||||
$title[]=_('<->');
|
||||
$title[]=_('Date');
|
||||
$title[]=_('Interne');
|
||||
$title[]=_('libell');
|
||||
$title[]=_('pièce');
|
||||
$title[]=_('nom journal');
|
||||
$title[]=_('type journal');
|
||||
$title[]=_('montant');
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -458,34 +478,73 @@ j1.j_poste as poste
|
|||
//----- HEADER ----
|
||||
if ($i == 0)
|
||||
{
|
||||
printf('"n°";"Date";"internal";"libellé";"n° pièce";"nom journal";"type journal";"montant"' . "\n\r");
|
||||
$title[]=_('n°');
|
||||
$title[]=_('Date');
|
||||
$title[]=_('interne');
|
||||
$title[]=_('libellé');
|
||||
$title[]=_('pièce');
|
||||
$title[]=_('journal');
|
||||
$title[]=_('type journal');
|
||||
$title[]=_('montant');
|
||||
|
||||
}
|
||||
}
|
||||
$export->write_header($title);
|
||||
// --------------------------
|
||||
// Print First
|
||||
// --------------------------
|
||||
printf('%d;"%s";"%s";"%s";"%s";"%s";"%s";%f',$i, $first['jr_date'], $first['jr_internal'], $first['jr_comment'], $first['jr_pj_number'], $first['jrn_def_name'], $first['jrn_def_type'], $first['jr_montant']);
|
||||
$export->add($i,"number");
|
||||
$export->add($first['jr_date']);
|
||||
$export->add($first['jr_internal']);
|
||||
$export->add($first['jr_comment']);
|
||||
$export->add($first['jr_pj_number']);
|
||||
$export->add($first['jrn_def_name']);
|
||||
$export->add($first['jrn_def_type']);
|
||||
$export->add($first['jr_montant'],"number");
|
||||
if (count($a_depend) > 0)
|
||||
{
|
||||
// --------------------------------------
|
||||
// Print first depending operation
|
||||
// --------------------------------------
|
||||
$depend = $a_depend[0];
|
||||
printf(';"<->";"%s";"%s";"%s";"%s";"%s";"%s";%f' . "\n\r", $depend['jr_date'], $depend['jr_internal'], $depend['jr_comment'], $depend['jr_pj_number'], $depend['jrn_def_name'], $depend['jrn_def_type'], $depend['jr_montant']);
|
||||
|
||||
$export->add("<->");
|
||||
|
||||
$export->add($depend['jr_date']);
|
||||
$export->add($depend['jr_internal']);
|
||||
$export->add($depend['jr_comment']);
|
||||
$export->add($depend['jr_pj_number']);
|
||||
$export->add($depend['jrn_def_name']);
|
||||
$export->add($depend['jrn_def_type']);
|
||||
$export->add($depend['jr_montant'],"number");
|
||||
$export->write();
|
||||
// --------------------------------------
|
||||
// print other depending operation if any
|
||||
// --------------------------------------
|
||||
for ($e = 1; $e < count($a_depend); $e++)
|
||||
{
|
||||
$depend = $a_depend[$e];
|
||||
printf(';;;;;;;"<->";');
|
||||
printf('"%s";"%s";"%s";"%s";"%s";"%s";%f' . "\n\r", $depend['jr_date'], $depend['jr_internal'], $depend['jr_comment'], $depend['jr_pj_number'], $depend['jrn_def_name'], $depend['jrn_def_type'], $depend['jr_montant']);
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("<->");
|
||||
$export->add($depend['jr_date']);
|
||||
$export->add($depend['jr_internal']);
|
||||
$export->add($depend['jr_comment']);
|
||||
$export->add($depend['jr_pj_number']);
|
||||
$export->add($depend['jrn_def_name']);
|
||||
$export->add($depend['jrn_def_type']);
|
||||
$export->add($depend['jr_montant'],"number");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n\r");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,23 +131,33 @@ class Balance_Age
|
|||
$nb_fiche=count($a_fiche);
|
||||
require NOALYSS_TEMPLATE.'/balance_aged_result.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Export Aged Balance to CSV
|
||||
* @param $p_date_start date DD.MM.YYYY
|
||||
* @param type $p_let unlet for unlettered operations
|
||||
*/
|
||||
function export_csv($p_date_start, $p_let)
|
||||
{
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
bcscale(2);
|
||||
$export=new Noalyss_Csv('aged_balance');
|
||||
$header = array(_('QuickCode') ,
|
||||
_('Nom'),
|
||||
_('Prénom'),
|
||||
_('Date'),
|
||||
_('N° pièce'),
|
||||
_('Interne'),
|
||||
_('Fin'),
|
||||
_('<30 jours'),
|
||||
_('entre 30 et 60 jours'),
|
||||
_('entre 60 et 90 jours'),
|
||||
_('> 90 jours') );
|
||||
$export->send_header();
|
||||
$export->write_header($header);
|
||||
|
||||
|
||||
$nb_fiche=count($this->afiche);
|
||||
$title=sprintf('"%s";', _('QuickCode'));
|
||||
$title.=sprintf('"%s";', _('Nom'));
|
||||
$title.=sprintf('"%s";', _('Prénom'));
|
||||
$title.=sprintf('"%s";', _('Date'));
|
||||
$title.=sprintf('"%s";', _('N° pièce'));
|
||||
$title.=sprintf('"%s";', _('Interne'));
|
||||
$title.=sprintf('"%s";', _('Fin'));
|
||||
$title.=sprintf('"%s";', _('<30 jours'));
|
||||
$title.=sprintf('"%s";', _('entre 30 et 60 jours'));
|
||||
$title.=sprintf('"%s";', _('entre 60 et 90 jours'));
|
||||
$title.=sprintf('"%s";', _('> 90 jours'));
|
||||
$title.=sprintf("\n\r");
|
||||
$flag_title=false;
|
||||
|
||||
for ($i=0; $i<$nb_fiche; $i++)
|
||||
{
|
||||
$card=new Lettering_Card($this->cn, $this->afiche[$i]['quick_code']);
|
||||
|
|
@ -155,7 +165,6 @@ class Balance_Age
|
|||
$card->get_balance_ageing($p_let);
|
||||
if (empty($card->content))
|
||||
continue;
|
||||
if ( ! $flag_title ) { echo $title;$flag_title=true;}
|
||||
$nb_row=count($card->content);
|
||||
$sum_lt_30=0;
|
||||
$sum_gt_30_lt_60=0;
|
||||
|
|
@ -165,75 +174,77 @@ class Balance_Age
|
|||
for ($j=0; $j<$nb_row; $j++)
|
||||
{
|
||||
$show=true;
|
||||
printf('"%s";', str_replace('"', '', $this->afiche[$i]['quick_code']));
|
||||
printf('"%s";', str_replace('"', '', $this->afiche[$i]['name']));
|
||||
printf('"%s";', str_replace('"', '', $this->afiche[$i]['first_name']));
|
||||
printf('"%s";', $card->content[$j]['j_date_fmt']);
|
||||
printf('"%s";', $card->content[$j]['jr_pj_number']);
|
||||
printf('"%s";', $card->content[$j]['jr_internal']);
|
||||
$export->add($this->afiche[$i]['quick_code']);
|
||||
$export->add($this->afiche[$i]['name']);
|
||||
$export->add($this->afiche[$i]['first_name']);
|
||||
$export->add($card->content[$j]['j_date_fmt']);
|
||||
$export->add($card->content[$j]['jr_pj_number']);
|
||||
$export->add($card->content[$j]['jr_internal']);
|
||||
if ($card->content[$j]['jrn_def_type']=='FIN'||$card->content[$j]['jrn_def_type']=='ODS')
|
||||
{
|
||||
printf("%s;", nb($card->content[$j]['j_montant']));
|
||||
$export->add($card->content[$j]['j_montant'],"number");
|
||||
$sum_fin=bcadd($sum_fin, $card->content[$j]['j_montant']);
|
||||
$show=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('0;');
|
||||
$export->add(0,'number');
|
||||
}
|
||||
if ($show&&$card->content[$j]['day_paid']<=30)
|
||||
{
|
||||
printf("%s;", nb($card->content[$j]['j_montant']));
|
||||
$export->add($card->content[$j]['j_montant'],"number");
|
||||
$sum_lt_30=bcadd($sum_lt_30, $card->content[$j]['j_montant']);
|
||||
$show=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('0;');
|
||||
$export->add(0,'number');
|
||||
}
|
||||
|
||||
if ($show&&$card->content[$j]['day_paid']>30&&$card->content[$j]['day_paid']<=60)
|
||||
{
|
||||
printf("%s;", nb($card->content[$j]['j_montant']));
|
||||
$export->add($card->content[$j]['j_montant'],"number");
|
||||
$sum_gt_30_lt_60=bcadd($sum_gt_30_lt_60, $card->content[$j]['j_montant']);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('0;');
|
||||
$export->add(0,'number');
|
||||
}
|
||||
|
||||
if ($show&&$card->content[$j]['day_paid']>60&&$card->content[$j]['day_paid']<=90)
|
||||
{
|
||||
printf("%s;", nb($card->content[$j]['j_montant']));
|
||||
$export->add($card->content[$j]['j_montant'],"number");
|
||||
$sum_gt_60_lt_90=bcadd($sum_gt_60_lt_90, $card->content[$j]['j_montant']);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('0;');
|
||||
$export->add(0,'number');
|
||||
}
|
||||
if ($show&&$card->content[$j]['day_paid']>90)
|
||||
{
|
||||
printf("%s", nb($card->content[$j]['j_montant']));
|
||||
$export->add($card->content[$j]['j_montant'],"number");
|
||||
$sum_gt_90=bcadd($sum_gt_90, $card->content[$j]['j_montant']);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('0;');
|
||||
$export->add(0,'number');
|
||||
}
|
||||
printf("\n\r");
|
||||
$export->write();
|
||||
}
|
||||
printf('"%s";', _('Totaux'));
|
||||
printf('"";');
|
||||
printf('"";');
|
||||
printf('"";');
|
||||
printf('"";');
|
||||
printf('"";');
|
||||
printf('%s;', nb($sum_fin));
|
||||
printf('%s;', nb($sum_lt_30));
|
||||
printf('%s;', nb($sum_gt_30_lt_60));
|
||||
printf('%s;', nb($sum_gt_60_lt_90));
|
||||
printf('%s', nb($sum_gt_90));
|
||||
printf("\n\r");
|
||||
$export->add(_('Totaux'));
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add($sum_fin,"number");
|
||||
$export->add($sum_lt_30,"number");
|
||||
$export->add($sum_gt_30_lt_60,"number");
|
||||
$export->add($sum_gt_60_lt_90,"number");
|
||||
$export->add($sum_gt_90,"number");
|
||||
$export->write();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,8 +204,8 @@ class Document_Export
|
|||
{
|
||||
try
|
||||
{
|
||||
if (CONVERT_GIF_PDF == 'NO') throw new Exception(_("CONVERT_GIF_PDF n'est pas installé"));
|
||||
if (PDFTK == 'NO') throw new Exception(_("TKPDF n'est pas installé"));
|
||||
if (CONVERT_GIF_PDF == 'NOT') throw new Exception(_("CONVERT_GIF_PDF n'est pas installé"));
|
||||
if (PDFTK == 'NOT') throw new Exception(_("TKPDF n'est pas installé"));
|
||||
} catch (Exception $ex)
|
||||
{
|
||||
throw ($ex);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@
|
|||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
require 'class/class_balance_age.php';
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="balance_age.csv"',FALSE);
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Export an ageing balance
|
||||
|
|
|
|||
|
|
@ -21,9 +21,8 @@
|
|||
* \brief Return the balance in CSV format
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="balance.csv"',FALSE);
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
include_once ("lib/ac_common.php");
|
||||
include_once("class/class_acc_balance.php");
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
|
|
@ -35,7 +34,7 @@ $cn=Dossier::connect();
|
|||
bcscale(2);
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
||||
|
||||
$export=new Noalyss_Csv('balance');
|
||||
$bal=new Acc_Balance($cn);
|
||||
$bal->jrn=null;
|
||||
switch( $_GET['p_filter'])
|
||||
|
|
@ -70,33 +69,36 @@ $row=$bal->get_row($_GET['from_periode'],
|
|||
$_GET['to_periode'],
|
||||
$prev);
|
||||
$prev = ( isset ($row[0]['sum_cred_previous'])) ?1:0;
|
||||
echo 'poste;libelle;';
|
||||
if ($prev == 1 ) echo 'deb n-1;cred n-1;solde n-1;d/c;';
|
||||
echo 'deb;cred;solde;d/c';
|
||||
printf("\n");
|
||||
$title=array('poste','libelle');
|
||||
if ($prev == 1 ) $title=array_merge($title,array('deb n-1','cred n-1','solde n-1','d/c;'));
|
||||
$title=array_merge($title,array('deb','cred','solde','d/c'));
|
||||
|
||||
$export->send_header();
|
||||
$export->write_header($title);
|
||||
foreach ($row as $r)
|
||||
{
|
||||
echo $r['poste'].';'.
|
||||
$r['label'].';';
|
||||
$export->add($r['poste']);
|
||||
$export->add($r['label']);
|
||||
|
||||
if ( $prev == 1 )
|
||||
{
|
||||
$delta=bcsub($r['solde_deb_previous'],$r['solde_cred_previous']);
|
||||
$sign=($delta<0)?'C':'D';
|
||||
$sign=($delta == 0)?'=':$sign;
|
||||
echo nb($r['sum_deb_previous']).';'.
|
||||
nb($r['sum_cred_previous']).';'.
|
||||
nb(abs($delta)).';'.
|
||||
"$sign".';';
|
||||
$export->add($r['sum_deb_previous'],"number");
|
||||
$export->add($r['sum_cred_previous'],"number");
|
||||
$export->add(abs($delta),"number");
|
||||
$export->add($sign);
|
||||
|
||||
}
|
||||
$delta=bcsub($r['solde_deb'],$r['solde_cred']);
|
||||
$sign=($delta<0)?'C':'D';
|
||||
$sign=($delta == 0)?'=':$sign;
|
||||
echo nb($r['sum_deb']).';'.
|
||||
nb($r['sum_cred']).';'.
|
||||
nb(abs($delta)).';'.
|
||||
"$sign";
|
||||
printf("\n");
|
||||
$export->add($r['sum_deb'],"number");
|
||||
$export->add($r['sum_cred'],"number");
|
||||
$export->add(abs($delta),"number");
|
||||
$export->add($sign);
|
||||
$export->write();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,16 +24,17 @@
|
|||
* of card
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="bal-fiche.csv"',FALSE);
|
||||
|
||||
|
||||
// Security we check if user does exist and his privilege
|
||||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$allcard=(isset($_GET['allcard']))?1:0;
|
||||
$export=new Noalyss_Csv(_('fiche-balance'));
|
||||
|
||||
/* balance */
|
||||
if ( $_GET['histo'] == 4 || $_GET['histo'] == 5)
|
||||
|
|
@ -52,9 +53,12 @@ if ( $_GET['histo'] == 4 || $_GET['histo'] == 5)
|
|||
{
|
||||
$afiche[0]=array('fd_id'=>$_REQUEST['cat']);
|
||||
}
|
||||
printf('"Quick code";"Nom";"poste comptable";"debit";"credit";"solde";"D/C";');
|
||||
printf("\n");
|
||||
for ($e = 0; $e < count($afiche); $e++)
|
||||
|
||||
$title=array("Quick code",_("Nom"),_("poste comptable"),_("debit"),_("credit"),_("solde"),"D/C");
|
||||
$export->send_header();
|
||||
$export->write_header($title);
|
||||
|
||||
for ($e = 0; $e < count($afiche); $e++)
|
||||
{
|
||||
$aCard = $cn->get_array("select f_id,ad_value from fiche join fiche_Detail using (f_id) where ad_id=1 and fd_id=$1 order by 2 ", array($afiche[$e]['fd_id']));
|
||||
|
||||
|
|
@ -82,8 +86,14 @@ if ( $_GET['histo'] == 4 || $_GET['histo'] == 5)
|
|||
if (bcsub($solde['credit'], $solde['debit']) > 0)
|
||||
$side = 'Cred.';
|
||||
|
||||
printf('"%s";"%s";"%s";%s;%s;%s;"%s"', $oCard->strAttribut(ATTR_DEF_QUICKCODE), $oCard->strAttribut(ATTR_DEF_NAME), $oCard->strAttribut(ATTR_DEF_ACCOUNT),nb($solde['debit']), nb($solde['credit']), nb(abs($solde['solde'])), $side);
|
||||
printf("\n");
|
||||
$export->add($oCard->strAttribut(ATTR_DEF_QUICKCODE));
|
||||
$export->add($oCard->strAttribut(ATTR_DEF_NAME));
|
||||
$export->add($oCard->strAttribut(ATTR_DEF_ACCOUNT));
|
||||
$export->add($solde['debit'],"number");
|
||||
$export->add($solde['credit'],"number");
|
||||
$export->add(abs($solde['solde']),"number");
|
||||
$export->add($side);
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -133,20 +143,24 @@ else
|
|||
/* skip if nothing to display */
|
||||
if (count($letter->content) == 0)
|
||||
continue;
|
||||
printf('"%s";"%s";"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME),$row->strAttribut(ATTR_DEF_ACCOUNT));
|
||||
$export->add($row->strAttribut(ATTR_DEF_QUICKCODE));
|
||||
$export->add( $row->strAttribut(ATTR_DEF_NAME));
|
||||
$export->add($row->strAttribut(ATTR_DEF_ACCOUNT));
|
||||
$export->write();
|
||||
|
||||
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s"',
|
||||
_('Date'),
|
||||
_('ref'),
|
||||
_('Interne'),
|
||||
_('Comm'),
|
||||
_('Débit'),
|
||||
_('Crébit'),
|
||||
_('Prog.'),
|
||||
_('D/C'),
|
||||
_('Let.'),
|
||||
_("Diff Let."));
|
||||
printf("\n");
|
||||
|
||||
$export->add(_('Date'));
|
||||
$export->add(_('ref'));
|
||||
$export->add(_('Interne'));
|
||||
$export->add(_('Comm'));
|
||||
$export->add(_('Débit'));
|
||||
$export->add(_('Crébit'));
|
||||
$export->add(_('Prog.'));
|
||||
$export->add(_('D/C'));
|
||||
$export->add(_('Let.'));
|
||||
$export->add(_("Diff Let."));
|
||||
$export->write();
|
||||
|
||||
$amount_deb = 0;
|
||||
$amount_cred = 0;
|
||||
$prog = 0;
|
||||
|
|
@ -154,33 +168,32 @@ else
|
|||
for ($i = 0; $i < count($letter->content); $i++)
|
||||
{
|
||||
$row = $letter->content[$i];
|
||||
printf ('"%s";',$row['j_date_fmt']);
|
||||
printf ('"%s";',$row['jr_pj_number']);
|
||||
printf ('"%s";',$row['jr_internal']);
|
||||
printf ('"%s";',$row['jr_comment']);
|
||||
$export->add($row['j_date_fmt']);
|
||||
$export->add($row['jr_pj_number']);
|
||||
$export->add($row['jr_internal']);
|
||||
$export->add($row['jr_comment']);
|
||||
if ($row['j_debit'] == 't')
|
||||
{
|
||||
printf("%s;",nb($row['j_montant']));
|
||||
$export->add($row['j_montant'],"number");
|
||||
$amount_deb=bcadd($amount_deb,$row['j_montant']);
|
||||
$prog = bcadd($prog, $row['j_montant']);
|
||||
printf (";");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(";");
|
||||
printf("%s;",nb($row['j_montant']));
|
||||
$export->add($row['j_montant'],"number");
|
||||
$amount_cred=bcadd($amount_cred,$row['j_montant']);
|
||||
$prog = bcsub($prog, $row['j_montant']);
|
||||
}
|
||||
printf ("%s;\"%s\";",abs(nb($prog)),$fic->get_amount_side($prog));
|
||||
$export->add(abs($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog),"number");
|
||||
if ($row['letter'] != -1)
|
||||
{
|
||||
printf('"%s";', strtoupper(base_convert($row['letter'],10,36)));
|
||||
printf("%s",nb($row['letter_diff']));
|
||||
$export->add(strtoupper(base_convert($row['letter'],10,36)));
|
||||
$export->add($row['letter_diff'],"number");
|
||||
}
|
||||
else
|
||||
printf(";");
|
||||
printf("\n");
|
||||
$export->add("");
|
||||
$export->write();
|
||||
}
|
||||
if ($prog < 0 )
|
||||
$msg="Solde Debit";
|
||||
|
|
@ -188,10 +201,16 @@ else
|
|||
$msg="Solde Credit";
|
||||
else
|
||||
$msg="soldé";
|
||||
|
||||
printf(';;;"%s";%s;%s;%s;"%s"',
|
||||
$msg,nb($amount_deb),nb($amount_cred),nb(abs($prog)),$fic->get_amount_side($prog));
|
||||
printf("\n");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
|
||||
$export->add($msg);
|
||||
$export->add($amount_deb,"number");
|
||||
$export->add($amount_cred,"number");
|
||||
$export->add(abs($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog),"number");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,19 +21,21 @@
|
|||
* \brief Send a CSV file with card
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="fiche.csv"',FALSE);
|
||||
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
|
||||
include_once NOALYSS_INCLUDE.'/class/class_fiche.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$gDossier=dossier::id();
|
||||
|
||||
$cn=Dossier::connect();
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
||||
|
||||
$export=new Noalyss_Csv(_('fiche'));
|
||||
$export->send_header();
|
||||
|
||||
|
||||
|
||||
if ( isset ($_GET['fd_id']))
|
||||
|
|
@ -44,20 +46,13 @@ if ( isset ($_GET['fd_id']))
|
|||
$o=0;
|
||||
// Heading
|
||||
$fiche_def->GetAttribut();
|
||||
$title=array();
|
||||
foreach ($fiche_def->attribut as $attribut)
|
||||
{
|
||||
if ( $o == 0 )
|
||||
{
|
||||
printf("\"%s\"",$attribut->ad_text);
|
||||
$o=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(";\"%s\"",$attribut->ad_text);
|
||||
}
|
||||
$title[]=$attribut->ad_text;
|
||||
}
|
||||
printf("\n");
|
||||
$o=0;
|
||||
$export->write_header($title);
|
||||
|
||||
// Details
|
||||
|
||||
foreach ($e as $fiche)
|
||||
|
|
@ -68,21 +63,13 @@ if ( isset ($_GET['fd_id']))
|
|||
|
||||
foreach ( $detail->attribut as $dattribut )
|
||||
{
|
||||
$export=str_replace("\n"," ", $dattribut->av_text);
|
||||
$export=str_replace("\r"," ", $export);
|
||||
if ( $o == 0 )
|
||||
{
|
||||
printf("\"%s\"",$export);
|
||||
$o=1;
|
||||
}
|
||||
if ( $dattribut->ad_type=="numeric")
|
||||
$export->add($dattribut->av_text,"number");
|
||||
else
|
||||
{
|
||||
printf (";\"%s\"",$export);
|
||||
|
||||
}
|
||||
$export->add($dattribut->av_text);
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
$o=0;
|
||||
$export->write();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
|||
include_once("lib/ac_common.php");
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_fiche.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$f_id=HtmlInput::default_value_request("f_id", "-");
|
||||
if ( $f_id == "-") {
|
||||
throw new Exception ('Invalid parameter');
|
||||
|
|
@ -35,13 +37,13 @@ $gDossier=dossier::id();
|
|||
$cn=Dossier::connect();
|
||||
|
||||
|
||||
|
||||
$Fiche=new Fiche($cn,$f_id);
|
||||
$qcode=$Fiche->get_quick_code();
|
||||
|
||||
header('Content-type: application/csv');
|
||||
$export=new Noalyss_Csv(_('fiche_').$qcode);
|
||||
$export->send_header();
|
||||
|
||||
header('Pragma: public');
|
||||
header('Content-Disposition: attachment;filename="fiche-'.$qcode.'.csv"',FALSE);
|
||||
$Fiche->getName();
|
||||
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date(
|
||||
$_GET['from_periode'],
|
||||
|
|
@ -50,25 +52,26 @@ list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date(
|
|||
);
|
||||
if ( count($Fiche->row ) == 0 )
|
||||
{
|
||||
echo "Aucune donnée";
|
||||
echo _("Aucune donnée");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( ! isset ($_REQUEST['oper_detail']))
|
||||
{
|
||||
echo '"Qcode";'.
|
||||
"\"Date\";".
|
||||
"\"n° pièce\";".
|
||||
"\"Code interne\";".
|
||||
'"Code journal";'.
|
||||
'"Nom journal";'.
|
||||
"\"Description\";".
|
||||
"\"Débit\";".
|
||||
"\"Crédit\";".
|
||||
"\"Prog.\";".
|
||||
"\"Let.\"" ;
|
||||
printf("\n");
|
||||
$title=array();
|
||||
$title=array("Qcode",
|
||||
"Date",
|
||||
"n° pièce",
|
||||
"Code interne",
|
||||
"Code journal",
|
||||
"Nom journal",
|
||||
"Description",
|
||||
"Débit",
|
||||
"Crédit",
|
||||
"Prog.",
|
||||
"Let." );
|
||||
$export->write_header($title);
|
||||
$progress=0;
|
||||
$current_exercice="";
|
||||
$tot_deb=0;$tot_cred=0;
|
||||
|
|
@ -83,14 +86,15 @@ if ( ! isset ($_REQUEST['oper_detail']))
|
|||
if ( $current_exercice != $op['p_exercice']) {
|
||||
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
||||
$diff=abs($tot_deb-$tot_cred);
|
||||
printf(
|
||||
";;;".
|
||||
'"'._('total').'";'.
|
||||
'"'.$current_exercice.'";;'.
|
||||
'"'."$solde_type".'"'.";".
|
||||
nb($tot_deb).";".
|
||||
nb($tot_cred).";".
|
||||
nb($diff).";"."\n");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add(_('total'));
|
||||
$export->add($current_exercice);
|
||||
$export->add($solde_type);
|
||||
$export->add($tot_deb,"number");
|
||||
$export->add($tot_cred,"number");
|
||||
$export->add($diff,"number");
|
||||
/*
|
||||
* reset total and current_exercice
|
||||
*/
|
||||
|
|
@ -102,29 +106,32 @@ if ( ! isset ($_REQUEST['oper_detail']))
|
|||
$progress=bcadd($progress,$diff);
|
||||
$tot_deb=bcadd($tot_deb,$op['deb_montant']);
|
||||
$tot_cred=bcadd($tot_cred,$op['cred_montant']);
|
||||
echo '"'.$op['j_qcode'].'";'.
|
||||
'"'.$op['j_date_fmt'].'"'.";".
|
||||
'"'.$op['jr_pj_number'].'"'.";".
|
||||
'"'.$op['jr_internal'].'"'.";".
|
||||
'"'.$op['jrn_def_code'].'"'.";".
|
||||
'"'.$op['jrn_def_name'].'"'.";".
|
||||
'"'.$op['description'].'"'.";".
|
||||
nb($op['deb_montant']).";".
|
||||
nb($op['cred_montant']).";".
|
||||
nb(abs($progress)).';'.
|
||||
'"'.(($op['letter']==-1)?'':strtoupper(base_convert($op['letter'],10,36))).'"';
|
||||
printf("\n");
|
||||
$export->add($op['j_qcode']);
|
||||
$export->add($op['j_date_fmt']);
|
||||
$export->add($op['jr_pj_number']);
|
||||
$export->add($op['jr_internal']);
|
||||
$export->add($op['jrn_def_code']);
|
||||
$export->add($op['jrn_def_name']);
|
||||
$export->add($op['description']);
|
||||
$export->add($op['deb_montant'],"number");
|
||||
$export->add($op['cred_montant'],"number");
|
||||
$export->add(abs($progress),"number");
|
||||
if ($op['letter'] !=-1){
|
||||
$export->add(strtoupper(base_convert($op['letter'],10,36)));
|
||||
} else {
|
||||
$export->add("");
|
||||
}
|
||||
|
||||
$export->write();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '"Poste";"Qcode";"date";"ref";"internal";';
|
||||
echo "\"Description\";".
|
||||
"\"Montant\";".
|
||||
"\"D/C\"";
|
||||
$title=array("Poste","Qcode","date","ref","internal",
|
||||
"Description","Montant","D/C");
|
||||
|
||||
printf("\r\n");
|
||||
$export->write_header($title);
|
||||
|
||||
foreach ( $Fiche->row as $op )
|
||||
{
|
||||
|
|
@ -134,16 +141,15 @@ else
|
|||
|
||||
foreach ( $result as $r)
|
||||
{
|
||||
printf('"%s";"%s";"%s";"%s";"%s";%s;%s;"%s"',
|
||||
$r['j_poste'],
|
||||
$r['j_qcode'],
|
||||
$r['jr_date'],
|
||||
$op['jr_pj_number'],
|
||||
$r['jr_internal'],
|
||||
$r['description'],
|
||||
nb($r['j_montant']),
|
||||
$r['debit']);
|
||||
printf("\r\n");
|
||||
$export->add($r['j_poste']);
|
||||
$export->add($r['j_qcode']);
|
||||
$export->add($r['jr_date']);
|
||||
$export->add($op['jr_pj_number']);
|
||||
$export->add($r['jr_internal']);
|
||||
$export->add($r['description']);
|
||||
$export->add($r['j_montant'],"number");
|
||||
$export->add($r['debit']);
|
||||
$export->write();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -152,12 +158,16 @@ else
|
|||
}
|
||||
}
|
||||
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
||||
$solde_type=($tot_cred == $tot_deb)?" solde = ":$solde_type;
|
||||
$diff=abs($tot_deb-$tot_cred);
|
||||
printf(
|
||||
'"'."$solde_type".'"'.";".
|
||||
nb($diff).";".
|
||||
nb($tot_deb).";".
|
||||
nb($tot_cred)."\n");
|
||||
$export->add(_("totaux"));
|
||||
$export->add("D");
|
||||
$export->add($tot_deb,"number");
|
||||
|
||||
$export->add("C");
|
||||
$export->add($tot_cred,"number");
|
||||
$export->add($solde_type);
|
||||
$export->add($diff,"number");
|
||||
$export->write();
|
||||
exit;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
|||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_report.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_impress.php';
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="rapport.csv"',FALSE);
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$gDossier=dossier::id();
|
||||
|
||||
/* Admin. Dossier */
|
||||
|
|
@ -38,6 +36,9 @@ $cn=Dossier::connect();
|
|||
|
||||
$Form=new Acc_Report($cn,$_GET['form_id']);
|
||||
$Form->get_name();
|
||||
|
||||
$export=new Noalyss_Csv('report');
|
||||
$export->send_header();
|
||||
// Step ?
|
||||
//--
|
||||
$step=HtmlInput::default_value_get("p_step", 0);
|
||||
|
|
@ -52,17 +53,16 @@ if ( $step == 0 )
|
|||
if ( count($Form->row ) == 0 )
|
||||
exit;
|
||||
|
||||
echo "\"Description\";".
|
||||
"\"Montant\"\n";
|
||||
|
||||
$title=array(_("Description"),
|
||||
_("Montant"));
|
||||
|
||||
$export->write_header($title);
|
||||
|
||||
foreach ( $Form->row as $op )
|
||||
{
|
||||
echo '"'.$op['desc'].'"'.";".
|
||||
nb($op['montant']).
|
||||
"\n";
|
||||
|
||||
$export->add($op['desc']);
|
||||
$export->add($op['montant'],"number");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
elseif ($step == 1)
|
||||
|
|
@ -78,27 +78,27 @@ elseif ($step == 1)
|
|||
}
|
||||
// Display column heading
|
||||
//--
|
||||
$x="";
|
||||
printf ("Mois;");
|
||||
$title=array();
|
||||
$title[0]=_("Mois");
|
||||
$i=1;
|
||||
foreach ($array[0] as $e)
|
||||
{
|
||||
printf("%s%s",$x,$e['desc']);
|
||||
$x=";";
|
||||
|
||||
$title[$i]=$e['desc'];
|
||||
$i++;
|
||||
}
|
||||
printf("\n");
|
||||
$export->write_header($title);
|
||||
// Display value for each line
|
||||
//--
|
||||
$a=0;
|
||||
foreach ($array as $e )
|
||||
{
|
||||
print $periode_name[$a];
|
||||
$export->add( $periode_name[$a]);
|
||||
$a++;
|
||||
foreach ($e as $elt)
|
||||
{
|
||||
printf(";%s",nb($elt['montant']));
|
||||
$export->add($elt['montant'],"number");
|
||||
}
|
||||
printf("\n");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -23,27 +23,22 @@
|
|||
* \brief create GL comptes as PDF
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
include_once('class/class_acc_account_ledger.php');
|
||||
include_once('lib/ac_common.php');
|
||||
include_once NOALYSS_INCLUDE.'/class/class_acc_account_ledger.php';
|
||||
include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
include_once('lib/class_impress.php');
|
||||
include_once NOALYSS_INCLUDE.'/lib/class_impress.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_own.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
||||
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="gl_comptes.csv"',FALSE);
|
||||
header('Pragma: public');
|
||||
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
$gDossier=dossier::id();
|
||||
|
||||
/* Security */
|
||||
$cn=Dossier::connect();
|
||||
|
||||
|
||||
$export=new Noalyss_Csv(_('grandlivre'));
|
||||
extract($_GET);
|
||||
|
||||
$export->send_header();
|
||||
if ( isset($poste_id) && strlen(trim($poste_id)) != 0 && isNumber($poste_id) )
|
||||
{
|
||||
if ( isset ($poste_fille) )
|
||||
|
|
@ -119,16 +114,14 @@ foreach ($a_poste as $poste)
|
|||
continue;
|
||||
}
|
||||
|
||||
echo sprintf("%s - %s ",$Poste->id,$Poste->get_name());
|
||||
printf("\n");
|
||||
|
||||
for($i=0;$i<count($header);$i++)
|
||||
echo $header[$i].";";
|
||||
printf("\n");
|
||||
$export->add(sprintf("%s - %s ",$Poste->id,$Poste->get_name()));
|
||||
$export->write();
|
||||
$export->write_header($header);
|
||||
|
||||
$solde = 0.0;
|
||||
$solde_d = 0.0;
|
||||
$solde_c = 0.0;
|
||||
bcscale(2);
|
||||
$current_exercice="";
|
||||
foreach ($Poste->row as $detail)
|
||||
{
|
||||
|
|
@ -151,17 +144,25 @@ foreach ($a_poste as $poste)
|
|||
if ( $current_exercice == "") $current_exercice=$detail['p_exercice'];
|
||||
|
||||
if ( $current_exercice != $detail['p_exercice']) {
|
||||
echo ";";
|
||||
echo '"'.$current_exercice.'";';
|
||||
echo ";";
|
||||
echo ";";
|
||||
echo _('Total').$Poste->id.";";
|
||||
echo ($solde_d > 0 ? nb($solde_d) : '').";";
|
||||
echo ($solde_c > 0 ? nb( $solde_c) : '').";";
|
||||
echo nb(abs($solde_c-$solde_d)).";";
|
||||
echo ($solde_c > $solde_d ? 'C' : 'D').";";
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
$export->add("");
|
||||
$export->add($current_exercice);
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add(_('Total')." ".$Poste->id);
|
||||
if ( $solde_d > 0 ) {
|
||||
$export->add($solde_d,"number");
|
||||
} else {
|
||||
$export->add("");
|
||||
}
|
||||
if ( $solde_c > 0 ) {
|
||||
$export->add($solde_c,"number");
|
||||
} else {
|
||||
$export->add("");
|
||||
}
|
||||
|
||||
$export->add(abs($solde_c-$solde_d),"number");
|
||||
$export->add(($solde_c > $solde_d ? 'C' : 'D'));
|
||||
$export->write();
|
||||
/*
|
||||
* reset total and current_exercice
|
||||
*/
|
||||
|
|
@ -173,40 +174,47 @@ foreach ($a_poste as $poste)
|
|||
}
|
||||
if ($detail['cred_montant'] > 0)
|
||||
{
|
||||
$solde -= $detail['cred_montant'];
|
||||
$solde_c += $detail['cred_montant'];
|
||||
$solde =bcsub($solde,$detail['cred_montant']);
|
||||
$solde_c =bcadd($solde_c, $detail['cred_montant']);
|
||||
}
|
||||
if ($detail['deb_montant'] > 0)
|
||||
{
|
||||
$solde += $detail['deb_montant'];
|
||||
$solde_d += $detail['deb_montant'];
|
||||
$solde =bcadd($solde, $detail['deb_montant']);
|
||||
$solde_d = bcadd($solde_d,$detail['deb_montant']);
|
||||
}
|
||||
|
||||
echo $detail['j_date_fmt'].";";
|
||||
echo $detail['jr_internal'].";";
|
||||
echo $detail['description'].";";
|
||||
echo $detail['jr_pj_number'].";";
|
||||
if ($detail['letter'] == -1) { echo ';'; } else { echo $detail['letter'].";";}
|
||||
echo ($detail['deb_montant'] > 0 ? nb($detail['deb_montant']) : '').";";
|
||||
echo ($detail['cred_montant'] > 0 ? nb($detail['cred_montant']) : '').";";
|
||||
echo nb(abs($solde)).";";
|
||||
echo $Poste->get_amount_side($solde);
|
||||
printf("\n");
|
||||
$export->add($detail['j_date_fmt']);
|
||||
$export->add($detail['jr_internal']);
|
||||
$export->add($detail['description']);
|
||||
$export->add($detail['jr_pj_number']);
|
||||
if ($detail['letter'] == -1) { $export->add(""); }
|
||||
else { $export->add($detail['letter']);}
|
||||
if ($detail['deb_montant'] > 0 )
|
||||
$export->add($detail['deb_montant'],"number");
|
||||
else
|
||||
$export->add("");
|
||||
|
||||
if ($detail['cred_montant'] > 0 )
|
||||
$export->add($detail['cred_montant'],"number");
|
||||
else
|
||||
$export->add("");
|
||||
$export->add(abs($solde),"number");
|
||||
$export->add($Poste->get_amount_side($solde),"text");
|
||||
$export->write();
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo ";";
|
||||
echo '"'.$current_exercice.'";';
|
||||
echo ";";
|
||||
echo ";";
|
||||
echo _('Total').$Poste->id.";";
|
||||
echo ($solde_d > 0 ? nb($solde_d) : '').";";
|
||||
echo ($solde_c > 0 ? nb( $solde_c) : '').";";
|
||||
echo nb(abs($solde_c-$solde_d)).";";
|
||||
echo ($solde_c > $solde_d ? 'C' : 'D').";";
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
$export->add("");
|
||||
$export->add($current_exercice);
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add(_('Total').$Poste->id);
|
||||
if ($solde_d > 0 ) $export->add($solde_d,"number"); else $export->add("");
|
||||
if ($solde_c > 0 ) $export->add($solde_c,"number"); else $export->add("");
|
||||
$export->add(abs($solde_c-$solde_d),"number");
|
||||
$export->add(($solde_c > $solde_d ? 'C' : 'D'));
|
||||
$export->write();
|
||||
}
|
||||
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@
|
|||
* \brief history of the accountancy exported in CSV
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="histo-export.csv"',FALSE);
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$ledger=new Acc_Ledger($cn,0);
|
||||
list($sql,$where)=$ledger->build_search_sql($_GET);
|
||||
|
|
@ -33,43 +31,45 @@ list($sql,$where)=$ledger->build_search_sql($_GET);
|
|||
$order=" order by jr_date_order asc,substring(jr_pj_number,'[0-9]+$')::numeric asc ";
|
||||
|
||||
$res=$cn->get_array($sql.$order);
|
||||
|
||||
printf('"%s";',"Internal");
|
||||
printf('"%s";',"Journal");
|
||||
printf('"%s";',"Date");
|
||||
printf('"%s";',"Echeance");
|
||||
printf('"%s";',"Paiement");
|
||||
printf('"%s";',"Piece");
|
||||
printf('"%s";"";',"Tiers");
|
||||
printf('"%s";',"Description");
|
||||
printf('"%s";',"Note");
|
||||
printf('"%s"',"Montant opération");
|
||||
printf("\r\n");
|
||||
$title=array();
|
||||
$title[]=_("Internal");
|
||||
$title[]=_("Journal");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("Echeance");
|
||||
$title[]=_("Paiement");
|
||||
$title[]=_("Piece");
|
||||
$title[]=_("Tiers");
|
||||
$title[]=_("Description");
|
||||
$title[]=_("Note");
|
||||
$title[]=_("Montant opération");
|
||||
$export=new Noalyss_Csv("histo");
|
||||
$export->send_header();
|
||||
$export->write_header($title);
|
||||
|
||||
for ($i=0;$i<count($res);$i++)
|
||||
{
|
||||
printf('"%s";',$res[$i]['jr_internal']);
|
||||
printf('"%s";',$res[$i]['jrn_def_name']);
|
||||
printf('"%s";',$res[$i]['str_jr_date']);
|
||||
printf('"%s";',$res[$i]['str_jr_ech']);
|
||||
printf('"%s";',$res[$i]['str_jr_date_paid']);
|
||||
printf('"%s";',$res[$i]['jr_pj_number']);
|
||||
printf('"%s";',$res[$i]['quick_code']);
|
||||
printf('"%s %s";',$res[$i]['name'],$res[$i]['first_name']);
|
||||
printf('"%s";',$res[$i]['jr_comment']);
|
||||
printf('"%s";',$res[$i]['n_text']);
|
||||
$export->add($res[$i]['jr_internal']);
|
||||
$export->add($res[$i]['jrn_def_name']);
|
||||
$export->add($res[$i]['str_jr_date']);
|
||||
$export->add($res[$i]['str_jr_ech']);
|
||||
$export->add($res[$i]['str_jr_date_paid']);
|
||||
$export->add($res[$i]['jr_pj_number']);
|
||||
$export->add($res[$i]['quick_code']);
|
||||
$export->add($res[$i]['name']." ".$res[$i]['first_name']);
|
||||
$export->add($res[$i]['jr_comment']);
|
||||
$export->add($res[$i]['n_text']);
|
||||
|
||||
$amount=$res[$i]['jr_montant'];
|
||||
|
||||
if ( $res[$i]['total_invoice']!=null && $res[$i]['jr_montant']!=$res[$i]['total_invoice'])
|
||||
if ( $res[$i]['total_invoice']!=null && $res[$i]['jr_montant']!=$res[$i]['total_invoice'])
|
||||
$amount=$res[$i]['total_invoice'];
|
||||
if ( $res[$i]['jrn_def_type'] == 'FIN')
|
||||
{
|
||||
$positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",array($res[$i]['jr_id']));
|
||||
if ( $positive !='' ) $amount=$positive;
|
||||
}
|
||||
printf('%s',nb($amount));
|
||||
$export->add($amount,"number");
|
||||
|
||||
printf("\r\n");
|
||||
$export->write();
|
||||
|
||||
}
|
||||
|
|
@ -21,11 +21,7 @@
|
|||
* \brief Send a ledger in CSV format
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
$fDate = date('dmy-Hi');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="jrn-'.$fDate.'.csv"',FALSE);
|
||||
include_once ("lib/ac_common.php");
|
||||
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
|
||||
require_once NOALYSS_INCLUDE.'/class/class_own.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_ledger_sold.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_ledger_purchase.php';
|
||||
|
|
@ -34,6 +30,11 @@ $gDossier=dossier::id();
|
|||
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_ledger.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
$export=new Noalyss_Csv(_('journal'));
|
||||
|
||||
$export->send_header();
|
||||
|
||||
|
||||
/*
|
||||
* Variable from $_GET
|
||||
|
|
@ -100,19 +101,23 @@ if ($get_option == 2)
|
|||
if ($ret_detail == null)
|
||||
return;
|
||||
$nb = Database::num_row($ret_detail);
|
||||
$output=fopen("php://output","w");
|
||||
|
||||
$title=array();
|
||||
foreach ($a_heading as $key=> $value)
|
||||
{
|
||||
$title[]=$value;
|
||||
}
|
||||
for ($i = 0;$i < $nb ; $i++) {
|
||||
$row=Database::fetch_array($ret_detail, $i);
|
||||
if ( $i == 0 ) {
|
||||
fputcsv($output,$a_heading,';');
|
||||
$export->write_header($title);
|
||||
}
|
||||
$a_row=array();
|
||||
$type="text";
|
||||
for ($j=0;$j < count($row) / 2;$j++) {
|
||||
$a_row[]=$row[$j];
|
||||
if ( $j > 18 ) $type="number";
|
||||
$export->add($row[$j],$type);
|
||||
}
|
||||
fputcsv($output,$a_row,';');
|
||||
unset($a_row);
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -123,9 +128,22 @@ if ($get_option == 2)
|
|||
if ( $get_option == 0 )
|
||||
{
|
||||
$Jrn->get_row( $get_from_periode, $get_to_periode );
|
||||
|
||||
$title=array();
|
||||
$title[]=_("operation");
|
||||
$title[]=_("N° Pièce");
|
||||
$title[]=_("Interne");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("Poste");
|
||||
$title[]=_("Libellé");
|
||||
$title[]=_("Débit");
|
||||
$title[]=_("Crédit");
|
||||
$export->write_header($title);
|
||||
if ( count($Jrn->row) == 0)
|
||||
exit;
|
||||
$old_id="";
|
||||
/**
|
||||
* @todo add table headers
|
||||
*/
|
||||
foreach ( $Jrn->row as $op )
|
||||
{
|
||||
// should clean description : remove <b><i> tag and '; char
|
||||
|
|
@ -134,20 +152,17 @@ if ( $get_option == 0 )
|
|||
$desc=str_replace("</b>","",$desc);
|
||||
$desc=str_replace("<i>","",$desc);
|
||||
$desc=str_replace("</i>","",$desc);
|
||||
$desc=str_replace('"',"'",$desc);
|
||||
$desc=str_replace(";",",",$desc);
|
||||
|
||||
printf("\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";\"%s\";%s;%s\n",
|
||||
$op['j_id'],
|
||||
$op['jr_pj_number'],
|
||||
$op['internal'],
|
||||
$op['j_date'],
|
||||
$op['poste'],
|
||||
$desc,
|
||||
nb($op['deb_montant']),
|
||||
nb($op['cred_montant'])
|
||||
);
|
||||
|
||||
if ( $op['j_id'] != "") $old_id=$op['j_id'];
|
||||
|
||||
$export->add($old_id,"text");
|
||||
$export->add($op['jr_pj_number']);
|
||||
$export->add($op['internal']);
|
||||
$export->add($op['j_date']);
|
||||
$export->add($op['poste']);
|
||||
$export->add($desc);
|
||||
$export->add($op['deb_montant'],"number");
|
||||
$export->add($op['cred_montant'],"number");
|
||||
$export->write();
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
|
@ -165,23 +180,24 @@ if ($get_option == 1)
|
|||
$Row=$Jrn->get_rowSimple($get_from_periode,
|
||||
$get_to_periode,
|
||||
0);
|
||||
printf ('" operation";'.
|
||||
'"Date";'.
|
||||
'"N° Pièce";'.
|
||||
'"Tiers";'.
|
||||
'"commentaire";'.
|
||||
'"internal";'.
|
||||
'"montant";'.
|
||||
"\r\n");
|
||||
$title=array();
|
||||
$title[]=_("operation");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("N° Pièce");
|
||||
$title[]=_("Tiers");
|
||||
$title[]=_("commentaire");
|
||||
$title[]=_("internal");
|
||||
$title[]=_("montant");
|
||||
$export->write_header($title);
|
||||
foreach ($Row as $line)
|
||||
{
|
||||
|
||||
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'].";";
|
||||
$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($line['comment']);
|
||||
$export->add($line['jr_internal']);
|
||||
// echo "<TD>".$line['pj'].";";
|
||||
// If the ledger is financial :
|
||||
// the credit must be negative and written in red
|
||||
|
|
@ -190,15 +206,15 @@ if ($get_option == 1)
|
|||
$positive = $cn->get_value("select qf_amount from quant_fin ".
|
||||
" where jr_id=".$line['jr_id']);
|
||||
|
||||
echo nb($positive);
|
||||
echo ";";
|
||||
$export->add($positive,"number");
|
||||
$export->add("");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo nb($line['montant']).";";
|
||||
$export->add($line['montant'],"number");
|
||||
}
|
||||
|
||||
printf("\r\n");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -217,33 +233,46 @@ if ($get_option == 1)
|
|||
. "jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)");
|
||||
|
||||
$own=new Own($cn);
|
||||
$col_tva="";
|
||||
$title=array();
|
||||
$title[]=_('Date');
|
||||
$title[]=_("Paiement");
|
||||
$title[]=_("operation");
|
||||
$title[]=_("Pièce");
|
||||
$title[]=_("Client/Fourn.");
|
||||
$title[]=_("Note");
|
||||
$title[]=_("interne");
|
||||
$title[]=_("HTVA");
|
||||
$title[]=_("privé");
|
||||
$title[]=_("DNA");
|
||||
$title[]=_("tva non ded.");
|
||||
$title[]=_("TVA NP");
|
||||
|
||||
if ( $own->MY_TVA_USE=='Y')
|
||||
{
|
||||
$a_Tva=$cn->get_array("select tva_id,tva_label from tva_rate order by tva_rate,tva_label,tva_id");
|
||||
foreach($a_Tva as $line_tva)
|
||||
{
|
||||
$col_tva.='"Tva '.$line_tva['tva_label'].'";';
|
||||
$title[]="Tva ".$line_tva['tva_label'];
|
||||
}
|
||||
}
|
||||
echo '"Date";"Paiement";"operation";"Pièce";"Client/Fourn.";"Commentaire";"inter.";"HTVA";"privé";"DNA";"tva non ded.";"TVA NP";'.$col_tva.'"TVAC";"opérations liées"'."\n\r";
|
||||
$title[]=_("TVAC");
|
||||
$title[]=_("opérations liées");
|
||||
$export->write_header($title);
|
||||
|
||||
foreach ($Row as $line)
|
||||
{
|
||||
printf('"%s";"%s";"%s";"%s";"%s";%s;%s;%s;%s;%s;%s;%s;',
|
||||
$line['date'],
|
||||
$line['date_paid'],
|
||||
$line['num'],
|
||||
$line['jr_pj_number'],
|
||||
$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']),
|
||||
$line['comment'],
|
||||
$line['jr_internal'],
|
||||
nb($line['HTVA']),
|
||||
nb($line['dep_priv']),
|
||||
nb($line['dna']),
|
||||
nb($line['tva_dna']),
|
||||
nb($line['tva_np'])
|
||||
);
|
||||
$export->add($line['date']);
|
||||
$export->add($line['date_paid']);
|
||||
$export->add($line['num']);
|
||||
$export->add($line['jr_pj_number']);
|
||||
$export->add($Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']));
|
||||
$export->add($line['comment']);
|
||||
$export->add($line['jr_internal']);
|
||||
$export->add($line['HTVA'],"number");
|
||||
$export->add($line['dep_priv'],"number");
|
||||
$export->add($line['dna'],"number");
|
||||
$export->add($line['tva_dna'],"number");
|
||||
$export->add($line['tva_np'],"number");
|
||||
$a_tva_amount=array();
|
||||
//- set all TVA to 0
|
||||
foreach ($a_Tva as $l) {
|
||||
|
|
@ -260,23 +289,23 @@ if ($get_option == 1)
|
|||
foreach ($a_Tva as $line_tva)
|
||||
{
|
||||
$a=$line_tva['tva_id'];
|
||||
echo nb($a_tva_amount[$a]).';';
|
||||
$export->add($a_tva_amount[$a],"number");
|
||||
}
|
||||
}
|
||||
echo nb ($line['TVAC']);
|
||||
$export->add($line['TVAC'],"number");
|
||||
/**
|
||||
* Retrieve payment if any
|
||||
*/
|
||||
$ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
|
||||
$max=Database::num_row($ret_reconcile);
|
||||
if ($max > 0) {
|
||||
$sep=";";
|
||||
for ($e=0;$e<$max;$e++) {
|
||||
$row=Database::fetch_array($ret_reconcile, $e);
|
||||
echo $sep.$row['str_date'].'; '. $row['jr_internal'];
|
||||
$export->add($row['str_date']);
|
||||
$export->add($row['jr_internal']);
|
||||
}
|
||||
}
|
||||
printf("\r\n");
|
||||
$export->write();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
|||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_account_ledger.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_operation.php';
|
||||
$fDate=date('dmy-Hi');
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="poste-'.$fDate.'-'.$_REQUEST['poste_id'].'.csv"',FALSE);
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
$r_poste=HtmlInput::default_value_request("poste_id", "error");
|
||||
|
||||
$export=new Noalyss_Csv(_('poste').'_'.$r_poste);
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
$gDossier=dossier::id();
|
||||
|
||||
|
|
@ -44,6 +46,7 @@ else
|
|||
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val = $1",array($_REQUEST['poste_id']));
|
||||
}
|
||||
bcscale(2);
|
||||
$export->send_header();
|
||||
if ( ! isset ($_REQUEST['oper_detail']))
|
||||
{
|
||||
if ( count($a_poste) == 0 )
|
||||
|
|
@ -59,20 +62,21 @@ if ( ! isset ($_REQUEST['oper_detail']))
|
|||
);
|
||||
if ( count($Poste->row ) == 0 )
|
||||
continue;
|
||||
|
||||
echo '"Poste";'.
|
||||
'"n° pièce";'.
|
||||
'"Code journal";'.
|
||||
'"Nom journal";'.
|
||||
'"Lib.";'.
|
||||
"\"Code interne\";".
|
||||
"\"Date\";".
|
||||
"\"Description\";".
|
||||
"\"Débit\";".
|
||||
"\"Crédit\";".
|
||||
"\"Prog.\";".
|
||||
"\"Let.\"";
|
||||
printf("\n");
|
||||
$title=array();
|
||||
|
||||
$title[]=_("Poste");
|
||||
$title[]=_("n° pièce");
|
||||
$title[]=_("Code journal");
|
||||
$title[]=_("Nom journal");
|
||||
$title[]=_("Lib.");
|
||||
$title[]=_("Interne");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("Description");
|
||||
$title[]=_("Débit");
|
||||
$title[]=_("Crédit");
|
||||
$title[]=_("Prog.");
|
||||
$title[]=_("Let.");
|
||||
$export->write_header($title);
|
||||
|
||||
$prog=0;
|
||||
$current_exercice="";
|
||||
|
|
@ -89,14 +93,19 @@ if ( ! isset ($_REQUEST['oper_detail']))
|
|||
if ( $current_exercice != $op['p_exercice']) {
|
||||
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
||||
$diff=abs($tot_deb-$tot_cred);
|
||||
printf(
|
||||
";;;".
|
||||
'"'._('total').'";'.
|
||||
'"'.$current_exercice.'";'.
|
||||
'"'."$solde_type".'"'.";".
|
||||
nb($tot_deb).";".
|
||||
nb($tot_cred).";".
|
||||
nb($diff).";"."\n");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add(_("total"));
|
||||
$export->add($current_exercice);
|
||||
$export->add($solde_type);
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
|
||||
$export->add($tot_deb,"number");
|
||||
$export->add($tot_cred,"number");
|
||||
$export->add($diff,"number");
|
||||
$export->write();
|
||||
/*
|
||||
* reset total and current_exercice
|
||||
*/
|
||||
|
|
@ -104,36 +113,42 @@ if ( ! isset ($_REQUEST['oper_detail']))
|
|||
$current_exercice=$op['p_exercice'];
|
||||
$tot_deb=0;$tot_cred=0;
|
||||
}
|
||||
$tot_deb=bcadd($tot_deb,$op['deb_montant']);
|
||||
$tot_cred=bcadd($tot_cred,$op['cred_montant']);
|
||||
$diff=bcsub($op['deb_montant'],$op['cred_montant']);
|
||||
$prog=bcadd($prog,$diff);
|
||||
echo '"'.$pos['pcm_val'].'";'.
|
||||
'"'.$op['jr_pj_number'].'"'.";".
|
||||
'"'.$op['jrn_def_code'].'"'.";".
|
||||
'"'.$op['jrn_def_name'].'"'.";".
|
||||
'"'.$name.'";'.
|
||||
'"'.$op['jr_internal'].'"'.";".
|
||||
'"'.$op['j_date_fmt'].'"'.";".
|
||||
'"'.$op['description'].'";'.
|
||||
nb($op['deb_montant']).";".
|
||||
nb($op['cred_montant']).";".
|
||||
nb(abs($prog)).";".
|
||||
(($op['letter']!=-1)?strtoupper(base_convert($op['letter'],10,36)):"");
|
||||
printf("\n");
|
||||
$tot_deb=bcadd($tot_deb,$op['deb_montant']);
|
||||
$tot_cred=bcadd($tot_cred,$op['cred_montant']);
|
||||
$diff=bcsub($op['deb_montant'],$op['cred_montant']);
|
||||
$prog=bcadd($prog,$diff);
|
||||
$export->add($pos['pcm_val']);
|
||||
$export->add($op['jr_pj_number']);
|
||||
$export->add($op['jrn_def_code']);
|
||||
$export->add($op['jrn_def_name']);
|
||||
$export->add($name);
|
||||
$export->add($op['jr_internal']);
|
||||
$export->add($op['j_date_fmt']);
|
||||
$export->add($op['description']);
|
||||
$export->add($op['deb_montant'],"number");
|
||||
$export->add($op['cred_montant'],"number");
|
||||
$export->add(abs($prog),"number");
|
||||
$export->add((($op['letter']!=-1)?strtoupper(base_convert($op['letter'],10,36)):""));
|
||||
|
||||
$export->write();
|
||||
|
||||
|
||||
}
|
||||
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
||||
$diff=abs($tot_deb-$tot_cred);
|
||||
printf(
|
||||
";;;".
|
||||
'"'._('total').'";'.
|
||||
'"'.$current_exercice.'";'.
|
||||
'"'."$solde_type".'"'.";".
|
||||
nb($tot_deb).";".
|
||||
nb($tot_cred).";".
|
||||
nb($diff).";"."\n");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
$export->add(_("total"));
|
||||
$export->add($current_exercice);
|
||||
$export->add($solde_type);
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
|
||||
$export->add($tot_deb,"number");
|
||||
$export->add($tot_cred,"number");
|
||||
$export->add($diff,"number");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -152,16 +167,17 @@ else
|
|||
);
|
||||
if ( count($Poste->row ) == 0 )
|
||||
continue;
|
||||
$title=array();
|
||||
$title[]=_("Poste");
|
||||
$title[]=_("Lib.");
|
||||
$title[]=_("QuickCode");
|
||||
$title[]=_("Interne");
|
||||
$title[]=_("Date");
|
||||
$title[]=_("Description");
|
||||
$title[]=_("Montant");
|
||||
$title[]=_("D/C");
|
||||
$export->write_header($title);
|
||||
|
||||
echo '"Poste";'.
|
||||
'"Lib.";'.
|
||||
'"QuickCode";'.
|
||||
"\"Code interne\";".
|
||||
"\"Date\";".
|
||||
"\"Description\";".
|
||||
"\"Montant\";".
|
||||
"\"D/C\"";
|
||||
printf("\n");
|
||||
|
||||
|
||||
foreach ( $Poste->row as $a )
|
||||
|
|
@ -171,17 +187,16 @@ else
|
|||
$result=$op->get_jrnx_detail();
|
||||
foreach ( $result as $r)
|
||||
{
|
||||
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";%12.2f;"%s"',
|
||||
$r['j_poste'],
|
||||
$r['pcm_lib'],
|
||||
$r['j_qcode'],
|
||||
$r['jr_internal'],
|
||||
$r['jr_date'],
|
||||
$a['description'],
|
||||
$a['jr_pj_number'],
|
||||
nb($r['j_montant']),
|
||||
$r['debit']);
|
||||
printf("\r\n");
|
||||
$export->add($r['j_poste']);
|
||||
$export->add($r['pcm_lib']);
|
||||
$export->add($r['j_qcode']);
|
||||
$export->add($r['jr_internal']);
|
||||
$export->add($r['jr_date']);
|
||||
$export->add($a['description']);
|
||||
$export->add($a['jr_pj_number']);
|
||||
$export->add($r['j_montant'],"number");
|
||||
$export->add($r['debit']);
|
||||
$export->write();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,13 @@
|
|||
* @see impress_rec.inc.php
|
||||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
$Date=date('Ymd');
|
||||
$filename="reconcialed_operation-".$Date;
|
||||
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="'.$filename.'.csv"',FALSE);
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/class/class_acc_reconciliation.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
|
||||
// --------------------------
|
||||
// Check if all mandatory arg are passed
|
||||
foreach (array('choice','p_end','p_start') as $arg)
|
||||
|
|
|
|||
|
|
@ -27,36 +27,36 @@
|
|||
*/
|
||||
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
|
||||
require_once NOALYSS_INCLUDE.'/class/class_stock.php';
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
$export=new Noalyss_Csv(_('historique-stock'));
|
||||
$stock=new Stock($cn);
|
||||
$sql = $stock->create_query_histo($_GET);
|
||||
$sql .= " order by real_date asc";
|
||||
|
||||
$res=$cn->exec_sql($sql);
|
||||
$max_row=Database::num_row($res);
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="histo-stock.csv"',FALSE);
|
||||
printf('"Date";');
|
||||
printf('"%s";','Code Stock');
|
||||
printf('"%s";','Depot');
|
||||
printf('"%s";','Fiche');
|
||||
printf('"%s";','Commentaire');
|
||||
printf('%s;','Quantité');
|
||||
printf('"%s";','IN/OUT');
|
||||
printf("\n\r");
|
||||
$export->send_header();
|
||||
|
||||
$export->write_header(array(_("Date"),
|
||||
_('Code Stock'),
|
||||
_('Depot'),
|
||||
_('Fiche'),
|
||||
_('Commentaire'),
|
||||
_('Quantité'),
|
||||
_('IN/OUT')));
|
||||
|
||||
for ($i=0;$i<$max_row;$i++)
|
||||
{
|
||||
$row=Database::fetch_array($res,$i);
|
||||
printf('"%s";',$row['cdate']);
|
||||
printf('"%s";',$row['sg_code']);
|
||||
printf('"%s";',$row['r_name']);
|
||||
printf('"%s";',$row['qcode']);
|
||||
$export->add($row['cdate']);
|
||||
$export->add($row['sg_code']);
|
||||
$export->add($row['r_name']);
|
||||
$export->add($row['qcode']);
|
||||
$row['ccomment']=str_replace('"','',$row['ccomment']);
|
||||
printf('"%s";',$row['ccomment']);
|
||||
printf('%s;',nbm($row['sg_quantity']));
|
||||
printf('"%s";',$row['direction']);
|
||||
printf("\n\r");
|
||||
$export->add($row['ccomment']);
|
||||
$export->add($row['sg_quantity'],"number");
|
||||
$export->add($row['direction']);
|
||||
$export->write();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,60 +32,56 @@ global $cn;
|
|||
$stock=new Stock($cn);
|
||||
$tmp_id = $stock->build_tmp_table($_GET);
|
||||
|
||||
header('Pragma: public');
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment;filename="stock-summary-list.csv"',FALSE);
|
||||
require_once NOALYSS_INCLUDE.'/lib/class_noalyss_csv.php';
|
||||
$export=new Noalyss_Csv(_('résumé-stock'));
|
||||
$export->send_header();
|
||||
$export->write_header(array(_("Depot"),_("Adresse"),_("Ville"),_("Pays"),_("Code Stock"),_("Fiches"),_("IN"),_("OUT"),_("Delta")));
|
||||
|
||||
?>
|
||||
"Depot";"Adresse";"Ville";"Pays";"Code Stock";"Fiches";"IN";"OUT";"DIFF"
|
||||
<?php
|
||||
$a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_city,r_country from stock_repository as s join tmp_stockgood_detail as t
|
||||
on (s.r_id=t.r_id)
|
||||
where
|
||||
s_id=$1
|
||||
order by 2
|
||||
",array($tmp_id));
|
||||
for ($r=0;$r<count($a_repo);$r++):
|
||||
for ($r=0;$r<count($a_repo);$r++) {
|
||||
|
||||
$a_stock=$cn->get_array(
|
||||
"
|
||||
select coalesce(sum(s_qin),0) as qin,coalesce(sum(s_qout),0) as qout,sg_code
|
||||
from tmp_stockgood_detail where r_id=$1 and s_id=$2
|
||||
group by sg_code
|
||||
order by sg_code
|
||||
$a_stock=$cn->get_array(
|
||||
"
|
||||
select coalesce(sum(s_qin),0) as qin,coalesce(sum(s_qout),0) as qout,sg_code
|
||||
from tmp_stockgood_detail where r_id=$1 and s_id=$2
|
||||
group by sg_code
|
||||
order by sg_code
|
||||
|
||||
",array($a_repo[$r]['r_id'],$tmp_id));
|
||||
for ($s=0;$s<count($a_stock);$s++):
|
||||
",array($a_repo[$r]['r_id'],$tmp_id));
|
||||
for ($s=0;$s<count($a_stock);$s++){
|
||||
|
||||
$a_card=$cn->get_array(
|
||||
"
|
||||
select f_id,vw_name,quick_code
|
||||
from vw_fiche_attr
|
||||
where
|
||||
f_id in (
|
||||
select distinct f_id from fiche_detail
|
||||
where
|
||||
ad_id=19 and
|
||||
ad_value=$1)
|
||||
order by vw_name,quick_code
|
||||
",array($a_stock[$s]['sg_code']));
|
||||
$a_card=$cn->get_array(
|
||||
"
|
||||
select f_id,vw_name,quick_code
|
||||
from vw_fiche_attr
|
||||
where
|
||||
f_id in (
|
||||
select distinct f_id from fiche_detail
|
||||
where
|
||||
ad_id=19 and
|
||||
ad_value=$1)
|
||||
order by vw_name,quick_code
|
||||
",array($a_stock[$s]['sg_code']));
|
||||
|
||||
printf ('"%s";',$a_repo[$r]['r_name']);
|
||||
printf ('"%s";',$a_repo[$r]['r_adress']);
|
||||
printf ('"%s";',$a_repo[$r]['r_city']);
|
||||
printf ('"%s";',$a_repo[$r]['r_country']);
|
||||
printf('"%s";',$a_stock[$s]['sg_code']);
|
||||
$sep="";
|
||||
for ( $c=0;$c<count($a_card);$c++):
|
||||
$a=sprintf('[%s] %s',$a_card[$c]['quick_code'], $a_card[$c]['vw_name']);
|
||||
$sep=" / ";
|
||||
endfor; // for C
|
||||
if ( count($a_card)== 0 ) $a= ' Erreur Code non utilisé';
|
||||
printf('"%s";',$a);
|
||||
printf('%s;',nbm($a_stock[$s]['qin']));
|
||||
printf('%s;',nbm($a_stock[$s]['qout']));
|
||||
printf ('%s',nbm(bcsub($a_stock[$s]['qin'],$a_stock[$s]['qout'])));
|
||||
printf("\r\n");
|
||||
endfor;
|
||||
endfor;
|
||||
$export->add($a_repo[$r]['r_name']);
|
||||
$export->add($a_repo[$r]['r_adress']);
|
||||
$export->add($a_repo[$r]['r_city']);
|
||||
$export->add($a_repo[$r]['r_country']);
|
||||
$export->add($a_stock[$s]['sg_code']);
|
||||
for ( $c=0;$c<count($a_card);$c++) {
|
||||
$a=sprintf('[%s] %s',$a_card[$c]['quick_code'], $a_card[$c]['vw_name']);
|
||||
}
|
||||
if ( count($a_card)== 0 ) $a= ' Erreur Code non utilisé';
|
||||
$export->add($a);
|
||||
$export->add($a_stock[$s]['qin'],"number");
|
||||
$export->add($a_stock[$s]['qout'],"number");
|
||||
$export->add(bcsub($a_stock[$s]['qin'],$a_stock[$s]['qout']),"number");
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue