This commit is contained in:
Rodolphe Quiedeville 2005-03-31 12:10:36 +00:00
parent bbf8c1b53c
commit 6254d7031c
3 changed files with 37 additions and 18 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -31,6 +31,7 @@
require("./pre.inc.php"); require("./pre.inc.php");
require("./ComptaJournalPaiement.class.php"); require("./ComptaJournalPaiement.class.php");
require("./ComptaJournalVente.class.php");
if ($_GET["action"] == 'export') if ($_GET["action"] == 'export')
{ {
@ -41,12 +42,18 @@ if ($_GET["action"] == 'export')
print $exc->error_message; print $exc->error_message;
$jp= new ComptaJournalPaiement($db); /* Génération du journal des Paiements */
$jp->GeneratePdf();
$jp= new ComptaJournalPaiement($db);
$jp->GeneratePdf($user, $exc->id, $exc->ref);
/* Génération du journal des Ventes */
$jp= new ComptaJournalVente($db);
$jp->GeneratePdf($user, $exc->id, $exc->ref);
} }
llxHeader(); llxHeader('','Compta - Export');
print_titre("Export Comptable"); print_titre("Export Comptable");
@ -54,7 +61,7 @@ print '<table border="0" width="100%">';
print '<tr><td valign="top" width="30%">'; print '<tr><td valign="top" width="30%">';
print '<br><a href="index.php?action=export">Export</a><br>'; print '<br><a href="index.php?action=export">Nouvel Export</a><br>';
$dir = DOL_DATA_ROOT."/compta/export/"; $dir = DOL_DATA_ROOT."/compta/export/";
@ -78,7 +85,6 @@ while (($file = readdir($handle))!==false)
} }
} }
print "</table>"; print "</table>";
print '</td><td valign="top">'; print '</td><td valign="top">';

View File

@ -169,7 +169,15 @@ class ComptaExport
$this->linep[$i][4] = $obj->facnumber; $this->linep[$i][4] = $obj->facnumber;
$this->linep[$i][5] = $obj->amount; $this->linep[$i][5] = $obj->amount;
$this->linep[$i][6] = $obj->libelle; $this->linep[$i][6] = $obj->libelle;
if (strlen(trim( $obj->increment)) > 0)
{
$this->linep[$i][7] = $obj->increment; $this->linep[$i][7] = $obj->increment;
}
else
{
$this->linep[$i][7] = $obj->facnumber;
}
$i++; $i++;
} }

View File

@ -111,7 +111,8 @@ class ComptaExportPoivre
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$ecid = $this->db->last_insert_id(MAIN_DB_PREFIX."export_compta"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."export_compta");
$this->ref = $ref;
} }
else else
{ {
@ -125,8 +126,6 @@ class ComptaExportPoivre
{ {
dolibarr_syslog("ComptaExportPoivre::Export ref : $ref"); dolibarr_syslog("ComptaExportPoivre::Export ref : $ref");
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."export_compta");
$fxname = DOL_DATA_ROOT."/compta/export/".$ref.".xls"; $fxname = DOL_DATA_ROOT."/compta/export/".$ref.".xls";
$workbook = &new writeexcel_workbook($fxname); $workbook = &new writeexcel_workbook($fxname);
@ -203,7 +202,7 @@ class ComptaExportPoivre
$page->write_string($j, 4, $this->line_out[$i][3]." Facture"); $page->write_string($j, 4, $this->line_out[$i][3]." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de facture $page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de facture
$page->write_string($j, 6, strftime("%d%m%y",$this->line_out[$i][0])); $page->write_string($j, 6, strftime("%d%m%y",$this->line_out[$i][0]));
$page->write($j, 6, ereg_replace(",",".",round($this->line_out[$i][8], 2))); // Montant de la ligne $page->write($j, 7, ereg_replace(",",".",round($this->line_out[$i][8], 2))); // Montant de la ligne
$page->write_string($j, 8, 'C'); // C pour crédit $page->write_string($j, 8, 'C'); // C pour crédit
$page->write_string($j, 9, 'EUR'); // D pour débit $page->write_string($j, 9, 'EUR'); // D pour débit
@ -216,7 +215,7 @@ class ComptaExportPoivre
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet"; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_export_compta=".$ecid; $sql .= " SET fk_export_compta=".$this->id;
$sql .= " WHERE rowid = ".$linec[$i][10]; $sql .= " WHERE rowid = ".$linec[$i][10];
if (!$this->db->query($sql)) if (!$this->db->query($sql))
@ -274,8 +273,11 @@ class ComptaExportPoivre
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); // $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
$page->write_string($j,5, $linep[$i][7]); // Numéro de facture $page->write_string($j,5, $linep[$i][7]); // Numéro de facture
$page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,7,$debit); $page->write_string($j,6, strftime("%d%m%y",$linep[$i][0]));
$page->write($j,7, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,8,$debit);
$page->write_string($j,9,'EUR');
$j++; $j++;
@ -286,8 +288,11 @@ class ComptaExportPoivre
$page->write_string($j,3, $linep[$i][2]); $page->write_string($j,3, $linep[$i][2]);
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); // $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
$page->write_string($j,5, $linep[$i][7]); // Numéro de facture $page->write_string($j,5, $linep[$i][7]); // Numéro de facture
$page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,7, $credit); $page->write_string($j,6, strftime("%d%m%y",$linep[$i][0]));
$page->write($j,7, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne
$page->write_string($j,8, $credit);
$page->write_string($j,9, 'EUR');
$j++; $j++;
@ -300,7 +305,7 @@ class ComptaExportPoivre
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."paiement"; $sql = "UPDATE ".MAIN_DB_PREFIX."paiement";
$sql .= " SET fk_export_compta=".$ecid; $sql .= " SET fk_export_compta=".$this->id;
$sql .= " WHERE rowid = ".$linep[$i][1]; $sql .= " WHERE rowid = ".$linep[$i][1];
if (!$this->db->query($sql)) if (!$this->db->query($sql))