Correct export CSV and PDF

This commit is contained in:
Dany De Bontridder 2015-08-27 02:51:44 +02:00
parent 0504475dca
commit 1852e038fd
6 changed files with 52 additions and 41 deletions

View file

@ -3376,9 +3376,9 @@ class Acc_Ledger extends jrn_def_sql
{
$r = array(
array('cat' => 'VEN', 'name' => _("Journaux de vente")),
array('cat' => 'ACH', 'name' => _("'Journaux d'achat")),
array('cat' => 'FIN', 'name' => _("'Journaux Financier")),
array('cat' => 'ODS', 'name' => _("'Journaux d'Opérations diverses"))
array('cat' => 'ACH', 'name' => _("Journaux d'achat")),
array('cat' => 'FIN', 'name' => _("Journaux Financier")),
array('cat' => 'ODS', 'name' => _("Journaux d'Opérations diverses"))
);
return $r;
}

View file

@ -72,7 +72,7 @@ class Print_Ledger {
($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0)
) {
$pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger);
$pdf->set_error('Ce journal ne peut être imprimé en mode simple');
$pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
return $pdf;
}
if ($own->MY_TVA_USE == 'Y') {

View file

@ -34,7 +34,7 @@ class Print_Ledger_Detail_Item extends PDFLand
parent::__construct($p_cn,'L', 'mm', 'A4');
$this->ledger=$p_jrn;
$this->show_col=true;
}
function setDossierInfo($dossier = "n/a")
@ -64,6 +64,7 @@ class Print_Ledger_Detail_Item extends PDFLand
$this->Cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
$this->Cell(20, $high, _('TVAC'), 0, 0, 'R', false);
$this->Ln(6);
$this->show_col=true;
}
/**
@ -115,6 +116,7 @@ class Print_Ledger_Detail_Item extends PDFLand
$high=4;
for ( $i=0;$i< $nb ;$i++)
{
$row=Database::fetch_array($ret_detail, $i);
if ($internal != $row['jr_internal'])
{
@ -132,19 +134,23 @@ class Print_Ledger_Detail_Item extends PDFLand
$this->Cell(20, $high, nbm($sum), 1, 0, 'R', true);
$internal=$row['jr_internal'];
$this->Ln(6);
//
// Header detail
$this->LongLine(30,$high,'QuickCode');
$this->Cell(30,$high,'Poste');
$this->LongLine(70,$high,'Libellé');
$this->Cell(20,$high,'Prix/Unit',0,0,'R');
$this->Cell(20,$high,'Quant.',0,0,'R');
$this->Cell(20,$high,'HTVA',0,0,'R');
$this->Cell(20,$high,'TVA NP',0,0,'R');
$this->Cell(20,$high,'Code TVA');
$this->Cell(20,$high,'TVA',0,0,'R');
$this->Cell(20,$high,'TVAC',0,0,'R');
$this->Ln(6);
// on the first line, the code for each column is displaid
if ( $this->show_col == true ) {
//
// Header detail
$this->LongLine(30,$high,'QuickCode');
$this->Cell(30,$high,'Poste');
$this->LongLine(70,$high,'Libellé');
$this->Cell(20,$high,'Prix/Unit',0,0,'R');
$this->Cell(20,$high,'Quant.',0,0,'R');
$this->Cell(20,$high,'HTVA',0,0,'R');
$this->Cell(20,$high,'TVA NP',0,0,'R');
$this->Cell(20,$high,'Code TVA');
$this->Cell(20,$high,'TVA',0,0,'R');
$this->Cell(20,$high,'TVAC',0,0,'R');
$this->Ln(6);
$this->show_col=false;
}
}
// Print detail sale / purchase
$this->LongLine(30,$high,$row['j_qcode']);

View file

@ -70,21 +70,26 @@ class Print_Ledger_Misc extends PDF
*/
function export()
{
$a_jrn=$this->ledger->get_operation($_GET['from_periode'],
$a_jrn=$this->ledger->get_rowSimple($_GET['from_periode'],
$_GET['to_periode']);
$this->SetFont('DejaVu', '', 6);
if ( $a_jrn == null ) return;
for ( $i=0;$i<count($a_jrn);$i++)
{
$row=$a_jrn[$i];
$this->LongLine(30,5,$row['pj']);
$this->Cell(10,5,$row['date_fmt']);
$this->Cell(20,5,$row['internal']);
$this->LongLine(30,5,$row['jr_pj_number']);
$this->Cell(10,5, smaller_date($row['date']));
$this->Cell(20,5,$row['jr_internal']);
$type=$this->cn->get_value("select jrn_def_type from jrn_def where jrn_def_id=$1",array($a_jrn[$i]['jr_def_id']));
$other=mb_substr($this->ledger->get_tiers($type,$a_jrn[$i]['id']),0,25);
$other=mb_substr($this->ledger->get_tiers($type,$a_jrn[$i]['jr_id']),0,25);
$this->LongLine(25,5,$other,0,'L');
$positive=$row['montant'];
$this->LongLine(80,5,$row['comment'],0,'L');
$this->Cell(15,5,nbm($row['montant']),0,0,'R');
if ( $type == 'FIN' ) {
$positive = $this->cn->get_value("select qf_amount from quant_fin ".
" where jr_id=".$row['jr_id']);
}
$this->Cell(15,5,nbm($positive),0,0,'R');
$this->Ln(5);
}

View file

@ -32,7 +32,7 @@ $gDossier=dossier::id();
require_once NOALYSS_INCLUDE.'/class_acc_ledger.php';
$cn=new Database($gDossier);
bcscale(2);
require_once NOALYSS_INCLUDE.'/class_user.php';
@ -71,8 +71,8 @@ $row=$bal->get_row($_GET['from_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 deb n-1;solde cred n-1;';
echo 'deb;cred;solde deb;solde cred';
if ($prev == 1 ) echo 'deb n-1;cred n-1;solde n-1;d/c;';
echo 'deb;cred;solde;d/c';
printf("\n");
foreach ($row as $r)
{
@ -80,15 +80,22 @@ foreach ($row as $r)
$r['label'].';';
if ( $prev == 1 )
{
echo nb($r['sum_deb_previous']).';'.
$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($r['solde_deb_previous']).';'.
nb($r['solde_cred_previous']).';';
nb(abs($delta)).';'.
"$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($r['solde_deb']).';'.
nb($r['solde_cred']);
nb(abs($delta)).';'.
"$sign";
printf("\n");
}

View file

@ -37,13 +37,6 @@ require_once NOALYSS_INCLUDE.'/class_database.php';
require_once NOALYSS_INCLUDE.'/class_ipopup.php';
global $g_user;
echo IPoste::ipopup('ipop_account');
echo ICard::ipopup('ipopcard');
$search_card=new IPopup('ipop_card');
$search_card->title=_('Recherche de fiche');
$search_card->value='';
echo $search_card->input();
//-----------------------------------------------------
// Form
//-----------------------------------------------------
@ -190,7 +183,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
if ( empty($Poste->row)) return;
$Poste->load();
echo '<table class="result" style="width:80%;margin-left:10%">';
echo '<table class="result" >';
echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="info">'. $_GET['poste_id'].' '.h($Poste->label).'</h2></td></tr>';
/* avoid duplicates */
$old=array();
@ -198,7 +191,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
{
if ( in_array($detail['jr_id'],$old) == TRUE ) continue;
$old[]=$detail['jr_id'];
echo '<tr><td class="mtitle" style="width:auto" colspan="6">'.$detail['j_date'].' '.$detail['jr_internal'].h($detail['description']).'</td></tr>';
echo '<tr><td style="text-align:center;background-color:lightgrey" colspan="6">'.$detail['j_date'].' '.$detail['jr_internal'].h($detail['description']).'</td></tr>';
$op=new Acc_Operation($cn);
$op->jr_id=$detail['jr_id'];