From 8649834808bb47bb3826792a8c888f186484a9a3 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 7 Apr 2005 15:53:24 +0000 Subject: [PATCH] Synchro --- htdocs/telephonie/communication.class.php | 96 +++++++++-------------- htdocs/telephonie/facture/liste.php | 5 +- 2 files changed, 42 insertions(+), 59 deletions(-) diff --git a/htdocs/telephonie/communication.class.php b/htdocs/telephonie/communication.class.php index 6559319d226..4b5d57325d3 100644 --- a/htdocs/telephonie/communication.class.php +++ b/htdocs/telephonie/communication.class.php @@ -30,63 +30,19 @@ class CommunicationTelephonique { var $numero; var $montant; - + /** + * Constructeur + * + */ function CommunicationTelephonique() { return 1; } - - - function loghtml($file) - { - $this->file_details = $file; - - - $this->_log( ''); - $this->_log( "$this->index"); - $this->_log( "$this->ligne"); - $this->_log( "".$this->dest); - $this->_log( "".$this->duree); - $this->_log( "".$this->montant); - $this->_log( "".$cout_calcul); - - if (round($cout_calcul,3) <> $objp->montant) - { - _log($file_details, "".round($cout_calcul,3)); - $err++; - } - else - { - _log($file_details, "".round($cout_calcul,3)); - } - _log($file_details, "$err"); - - } - - - function logxls() - { - - /* - $worksheet->write_string($i, 0, "$objp->ligne"); - $worksheet->write($i, 1, "$objp->client"); - $worksheet->write($i, 2, "$objp->num"); - $worksheet->write($i, 3, $objp->dest); - $worksheet->write($i, 4, $objp->duree); - $worksheet->write($i, 5, $objp->montant); - - $worksheet->write($i, 7, $cout_temp_achat, $num1_format); - $worksheet->write($i, 8, $cout_temp_vente, $num1_format); - $worksheet->write($i, 9, $cout_fixe_achat, $num1_format); - $worksheet->write($i, 10, $cout_fixe_vente, $num1_format); - - $j = $i+1; - - $worksheet->write($i, 11, "=(E$j * H$j / 60) + K$j ", $num1_format); - */ - } - + /** + * Calcul le coût de la communication + * + */ function cout($tarif_achat, $tarif_vente, $ligne) { $error = 0; @@ -129,6 +85,10 @@ class CommunicationTelephonique { $this->remise = $ligne->remise; } + /* + * + * + */ if (! $tarif_achat->cout($num, $this->cout_temp_achat, $this->cout_fixe_achat, $tarif_libelle_achat)) { @@ -143,10 +103,7 @@ class CommunicationTelephonique { dolibarr_syslog("CommunicationTelephonique::Cout Tarif vente manquant pour $num"); $error++; } - else - { - } $this->cout_achat = ( ($this->duree * $this->cout_temp_achat / 60) + $this->cout_fixe_achat); @@ -190,12 +147,13 @@ class CommunicationTelephonique { $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " (ligne, date, numero, duree"; + $sql .= " (fk_ligne,ligne, date, numero, duree"; $sql .= ", tarif_achat_temp, tarif_achat_fixe, tarif_vente_temp, tarif_vente_fixe"; $sql .= ", cout_achat, cout_vente, remise,dest, fourn_montant"; $sql .= " , fichier_cdr, fk_fournisseur, fk_telephonie_facture)"; $sql .= " VALUES ("; + $sql .= $this->fk_ligne.","; $sql .= "'$this->ligne','".$db->idate($this->dateheure)."','$this->numero','$this->duree'"; $sql .= ", '$this->cout_temp_achat','$this->cout_fixe_achat','$this->cout_temp_vente','$this->cout_fixe_vente'"; @@ -226,6 +184,30 @@ class CommunicationTelephonique { } } -} + function loghtml($file) + { + $this->file_details = $file; + + $this->_log( ''); + $this->_log( "$this->index"); + $this->_log( "$this->ligne"); + $this->_log( "".$this->dest); + $this->_log( "".$this->duree); + $this->_log( "".$this->montant); + $this->_log( "".$cout_calcul); + + if (round($cout_calcul,3) <> $objp->montant) + { + _log($file_details, "".round($cout_calcul,3)); + $err++; + } + else + { + _log($file_details, "".round($cout_calcul,3)); + } + _log($file_details, "$err"); + + } +} ?> diff --git a/htdocs/telephonie/facture/liste.php b/htdocs/telephonie/facture/liste.php index 9fd3e5aa9ed..021c0a429b2 100644 --- a/htdocs/telephonie/facture/liste.php +++ b/htdocs/telephonie/facture/liste.php @@ -97,8 +97,9 @@ if ($result) print_liste_field_titre("Ligne","liste.php","l.ligne"); print 'DateMontant HT'; - print 'Coût fournisseur HT'; - print 'GainFacture'; + print 'Coût fournisseur HT'; + print_liste_field_titre("Gain","liste.php","f.gain",'','','align="right"'); + print 'Facture'; print "\n"; print '';