This commit is contained in:
Rodolphe Quiedeville 2005-03-23 15:38:33 +00:00
parent 48c29cb60d
commit 1f414d385b

View File

@ -82,47 +82,35 @@ class ComptaJournalVente {
$sql .= " WHERE f.rowid = l.fk_facture "; $sql .= " WHERE f.rowid = l.fk_facture ";
$sql .= " AND s.idp = f.fk_soc"; $sql .= " AND s.idp = f.fk_soc";
$sql .= " AND f.fk_statut = 1 "; $sql .= " AND f.fk_statut = 1 ";
$sql .= " AND l.fk_code_ventilation <> 0 "; $sql .= " AND l.fk_code_ventilation <> 0 ";
$sql .= " AND l.fk_export_compta <> 0"; $sql .= " AND l.fk_export_compta <> 0";
$sql .= " AND c.rowid = l.fk_code_ventilation"; $sql .= " AND c.rowid = l.fk_code_ventilation";
$sql .= " AND date_format(f.datef,'%Y%m') = '".$date."'"; $sql .= " AND date_format(f.datef,'%Y%m') = '".$date."'";
$sql .= " ORDER BY date_format(f.datef,'%Y%m%d') ASC"; $sql .= " ORDER BY date_format(f.datef,'%Y%m%d') ASC, f.rowid, l.rowid";
$oldate = ''; $oldate = '';
$oldfac = '';
if ($this->db->query($sql)) $resql = $this->db->query($sql);
if ($resql)
{ {
$num = $this->db->num_rows(); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
$var = True; $var = True;
$journ = 'VE'; $journ = 'VE';
$hligne = 5; $hligne = 5;
$wc = array(0,14,6,16,16,90,16,12,4,16);
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($resql);
if ($oldate <> strftime("%d%m%Y",$obj->dp)) if ($oldate <> strftime("%d%m%Y",$obj->dp))
{ {
if ($oldate <> '')
{
$pdf->SetFont('Arial','B',9);
$pdf->cell(143,$hligne,'');
$pdf->cell(16,$hligne,'Total : ',0,0,'R');
$pdf->cell(18,$hligne,$total_debit,0,0,'R');
$pdf->cell(18,$hligne,$total_credit,0,0,'R');
$pdf->ln();
}
$journal = "Journal $journ du ".strftime('%A, %e %B %G',$obj->dp); $journal = "Journal $journ du ".strftime('%A, %e %B %G',$obj->dp);
$total_credit = 0 ; $total_credit = 0 ;
$total_debit = 0 ; $total_debit = 0 ;
@ -133,19 +121,16 @@ class ComptaJournalVente {
$pdf->SetFont('Arial','',9); $pdf->SetFont('Arial','',9);
$pdf->cell(16,$hligne,'Date'); $pdf->cell($wc[1],$hligne,'Date');
$pdf->cell($wc[2],$hligne,'');
$pdf->cell($wc[3],$hligne,'Compte');
$pdf->cell($wc[4],$hligne,'Tiers');
$pdf->cell($wc[5],$hligne,'Libellé');
$pdf->cell($wc[6],$hligne,'Facture');
$pdf->cell($wc[7],$hligne,'Montant',0,0,'R');
$pdf->cell($wc[8],$hligne,'');
$pdf->cell($wc[9],$hligne,'Echeance',0,0,'R');
$pdf->cell(20,$hligne,'N Facture');
$pdf->cell(20,$hligne,'Tiers');
$pdf->cell(87,$hligne,'Libellé');
$pdf->cell(16,$hligne,'Echeance',0,0,'R');
$pdf->cell(18,$hligne,'Débit',0,0,'R');
$pdf->cell(18,$hligne,'Crédit',0,0,'R');
$pdf->ln(); $pdf->ln();
$oldate = strftime("%d%m%Y",$obj->dp); $oldate = strftime("%d%m%Y",$obj->dp);
@ -156,6 +141,9 @@ class ComptaJournalVente {
*/ */
$socnom = $obj->nom; $socnom = $obj->nom;
$libelle = "Facture"; $libelle = "Facture";
$amount = abs($obj->amount);
$price = abs(price($obj->price));
$tva = abs($obj->tva);
if (strlen($obj->nom) > 31) if (strlen($obj->nom) > 31)
{ {
@ -166,85 +154,56 @@ class ComptaJournalVente {
if ($obj->amount >= 0) if ($obj->amount >= 0)
{ {
$credit = ''; $d = "D";
$debit = abs($obj->amount); $c = "C";
$total_debit = $total_debit + $debit;
} }
else else
{ {
$credit = abs($obj->amount); $d = "C";
$debit = ''; $c = "D";
$total_credit = $total_credit + $credit;
$libelle = "Rejet Prélèvement";
} }
$pdf->cell(16,$hligne,strftime('%d%m%y',$obj->dp)); if ($oldfac <> $obj->facid)
$pdf->cell(20,$hligne,$obj->facnumber);
$pdf->cell(20,$hligne,'41100000');
$pdf->cell(87,$hligne,$socnom .' '.$libelle);
/* Echeance */
$pdf->cell(16,$hligne,strftime('%d%m%y',$obj->dp),0,0,'R');
$pdf->cell(18,$hligne,$credit,0,0,'R');
$pdf->cell(18,$hligne,$debit,0,0,'R');
$pdf->ln();
/*
*
*
*/
if ($obj->amount >= 0)
{ {
$credit = abs($obj->amount); $oldfac = $obj->facid;
$debit = '';
$total_credit = $total_credit + $credit; $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp));
} $pdf->cell($wc[2],$hligne,'VE');
else $pdf->cell($wc[3],$hligne,'4110000');
{ $pdf->cell($wc[4],$hligne,$obj->code_compta);
$credit = ''; $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$debit = abs($obj->amount); $pdf->cell($wc[6],$hligne,$obj->facnumber);
$total_debit = $total_debit + $debit; $pdf->cell($wc[7],$hligne,$amount,0,0,'R');
$pdf->cell($wc[8],$hligne,$d);
$pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R');
$pdf->ln();
$pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp));
$pdf->cell($wc[2],$hligne,'VE');
$pdf->cell($wc[3],$hligne,'4457119');
$pdf->cell($wc[4],$hligne,'');
$pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$pdf->cell($wc[6],$hligne,$obj->facnumber);
$pdf->cell($wc[7],$hligne,$tva,0,0,'R');
$pdf->cell($wc[8],$hligne,$c);
$pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R');
$pdf->ln();
} }
$pdf->cell(16,$hligne,strftime('%d%m%y',$obj->dp)); $pdf->cell($wc[1],$hligne,strftime('%d%m%y',$obj->dp));
$pdf->cell($wc[2],$hligne,'VE');
$pdf->cell(20,$hligne,$obj->facnumber); $pdf->cell($wc[3],$hligne,$obj->numero);
$pdf->cell($wc[4],$hligne,'');
$pdf->cell(20,$hligne,'5122000'); $pdf->cell($wc[5],$hligne,$socnom .' '.$libelle);
$pdf->cell($wc[6],$hligne,$obj->facnumber);
$pdf->cell(87,$hligne,$socnom . ' '.$libelle); $pdf->cell($wc[7],$hligne,$price,0,0,'R');
$pdf->cell($wc[8],$hligne,$c);
/* Echeance */ $pdf->cell($wc[9],$hligne,strftime('%d%m%y',$obj->dp),0,0,'R');
$pdf->cell(16,$hligne,strftime('%d%m%y',$obj->dp),0,0,'R');
$pdf->cell(18,$hligne,$credit,0,0,'R');
$pdf->cell(18,$hligne,$debit,0,0,'R');
$pdf->ln(); $pdf->ln();
$i++; $i++;
} }
$pdf->SetFont('Arial','B',9);
$pdf->cell(143,$hligne,'');
$pdf->cell(16,$hligne,'Total : ',0,0,'R');
$pdf->cell(18,$hligne,$total_debit,0,0,'R');
$pdf->cell(18,$hligne,$total_credit,0,0,'R');
$pdf->ln();
/* /*
* *
* *
@ -254,23 +213,22 @@ class ComptaJournalVente {
$pdf->Output($file); $pdf->Output($file);
$result = 0;
return 1;
} }
else else
{ {
$this->error=""; $result -1;
return 0;
} }
} }
else else
{ {
$this->error="Erreur: FAC_OUTPUTDIR non défini !"; $result = -2;
return 0;
} }
return $result;
} }
/* /*
*
* *
* *
*/ */