From 6254d7031c2a3efe3f883a92e461a774a2d8c82d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 31 Mar 2005 12:10:36 +0000 Subject: [PATCH] Synchro --- htdocs/compta/export/index.php | 18 ++++++++----- .../export/modules/compta.export.class.php | 10 ++++++- .../modules/compta.export.poivre.class.php | 27 +++++++++++-------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/export/index.php b/htdocs/compta/export/index.php index abf2e59f2ab..36359516ea8 100644 --- a/htdocs/compta/export/index.php +++ b/htdocs/compta/export/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -31,6 +31,7 @@ require("./pre.inc.php"); require("./ComptaJournalPaiement.class.php"); +require("./ComptaJournalVente.class.php"); if ($_GET["action"] == 'export') { @@ -41,12 +42,18 @@ if ($_GET["action"] == 'export') print $exc->error_message; - $jp= new ComptaJournalPaiement($db); - $jp->GeneratePdf(); + /* Génération du journal des Paiements */ + $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"); @@ -54,7 +61,7 @@ print ''; print '
'; -print '
Export
'; +print '
Nouvel Export
'; $dir = DOL_DATA_ROOT."/compta/export/"; @@ -78,7 +85,6 @@ while (($file = readdir($handle))!==false) } } - print "
"; print ''; diff --git a/htdocs/compta/export/modules/compta.export.class.php b/htdocs/compta/export/modules/compta.export.class.php index a8fec9b2028..3fae7d76b02 100644 --- a/htdocs/compta/export/modules/compta.export.class.php +++ b/htdocs/compta/export/modules/compta.export.class.php @@ -169,7 +169,15 @@ class ComptaExport $this->linep[$i][4] = $obj->facnumber; $this->linep[$i][5] = $obj->amount; $this->linep[$i][6] = $obj->libelle; - $this->linep[$i][7] = $obj->increment; + + if (strlen(trim( $obj->increment)) > 0) + { + $this->linep[$i][7] = $obj->increment; + } + else + { + $this->linep[$i][7] = $obj->facnumber; + } $i++; } diff --git a/htdocs/compta/export/modules/compta.export.poivre.class.php b/htdocs/compta/export/modules/compta.export.poivre.class.php index 666770daa56..25c8ba0c1ae 100644 --- a/htdocs/compta/export/modules/compta.export.poivre.class.php +++ b/htdocs/compta/export/modules/compta.export.poivre.class.php @@ -111,7 +111,8 @@ class ComptaExportPoivre 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 { @@ -125,8 +126,6 @@ class ComptaExportPoivre { 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"; $workbook = &new writeexcel_workbook($fxname); @@ -201,9 +200,9 @@ class ComptaExportPoivre $page->write_string($j, 1, 'VE'); $page->write_string($j, 2, $this->line_out[$i][4]); // Code Comptable $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($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, 9, 'EUR'); // D pour débit @@ -216,7 +215,7 @@ class ComptaExportPoivre { $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]; 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,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++; @@ -286,8 +288,11 @@ class ComptaExportPoivre $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,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++; @@ -300,7 +305,7 @@ class ComptaExportPoivre { $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]; if (!$this->db->query($sql))