This commit is contained in:
Rodolphe Quiedeville 2007-07-10 13:09:56 +00:00
parent a34053bdeb
commit 0ce28080b1
5 changed files with 22 additions and 114 deletions

View File

@ -116,6 +116,7 @@ if ($_GET["id"])
if (file_exists($file)) if (file_exists($file))
{ {
print '<img src="'.DOL_URL_ROOT.'/telephonie/showgraph.php?graph='.$file.'" alt="CA Mensuel">'; print '<img src="'.DOL_URL_ROOT.'/telephonie/showgraph.php?graph='.$file.'" alt="CA Mensuel">';
//print '<img src="'.DOL_URL_ROOT.'/viewimage.php?graph='.$file.'" alt="CA Mensuel">';
} }
else else
{ {
@ -142,7 +143,7 @@ if ($_GET["id"])
if (file_exists($file)) if (file_exists($file))
{ {
print '<img src="'.DOL_URL_ROOT.'/telephonie/showgraph.php?graph='.$file.'">'; print '<img src="'.DOL_URL_ROOT.'/telephonie/showgraph.php?graph='.$file.'" alt="dureemoyenne">';
} }
else else
{ {

View File

@ -40,8 +40,6 @@ require_once (DOL_DOCUMENT_ROOT."/societe.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php");
//require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie.tarif.class.php");
@ -435,8 +433,6 @@ $db->close();
dolibarr_syslog("Fin Batch ID ".$batch_id); dolibarr_syslog("Fin Batch ID ".$batch_id);
dolibarr_syslog("Conso mémoire ".memory_get_usage() );
// FIN // FIN
/****************************************************************************** /******************************************************************************
@ -455,9 +451,9 @@ function calcul($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente
$nbnat = 0; $nbnat = 0;
$duree = 0; $duree = 0;
$fournisseur_id = 1; $fournisseur_id = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID ;
$tarif_spec = 1 ; $tarif_spec = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID ;
$sql = "SELECT d.grille_tarif"; $sql = "SELECT d.grille_tarif";
@ -485,9 +481,8 @@ function calcul($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente
dolibarr_syslog("Utilisation du tarif ".$tarif_spec." pour la ligne ".$ligne->id); dolibarr_syslog("Utilisation du tarif ".$tarif_spec." pour la ligne ".$ligne->id);
$tarif_achat = new TelephonieTarif($db, $tarif_spec, "achat", $fournisseur_id);
$tarif_achat = new TelephonieTarif($db, $fournisseur_id, "achat"); $tarif_vente = new TelephonieTarif($db, $tarif_spec, "vente", $tarif_spec, $ligne->client_comm_id);
$tarif_vente = new TelephonieTarif($db, $fournisseur_id, "vente", $tarif_spec, $ligne->client_comm_id);
$comms = array(); $comms = array();

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -24,6 +24,8 @@
require ("../../master.inc.php"); require ("../../master.inc.php");
dolibarr_syslog("facturation-verif.php BEGIN");
require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); require_once (DOL_DOCUMENT_ROOT."/societe.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php");
@ -37,7 +39,7 @@ $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";
if ( $db->query($sql) ) if ( $db->query($sql) )
{ {
$row = $db->fetch_row(); $row = $db->fetch_row();
print $row[0]." lignes de communications\n"; dolibarr_syslog("facturation-verif.php ".$row[0]." lignes de communications a verifier");
} }
/******************************************************************************* /*******************************************************************************
@ -45,9 +47,11 @@ if ( $db->query($sql) )
* Verifie la présence des tarifs adequat * Verifie la présence des tarifs adequat
* *
*/ */
$grille_vente = TELEPHONIE_GRILLE_VENTE_DEFAUT_ID;
$tarif_achat = new TelephonieTarif($db, 1, "achat"); $tarif_vente = new TelephonieTarif($db, $grille_vente, "vente");
$tarif_vente = new TelephonieTarif($db, 1, "vente");
dolibarr_syslog("facturation-verif.php Grille : $grille contient ".$tarif_vente->num_tarifs." tarifs");
$sql = "SELECT distinct(num) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr"; $sql = "SELECT distinct(num) FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";
@ -57,12 +61,8 @@ if ( $resql )
{ {
$nums = $db->num_rows($resql); $nums = $db->num_rows($resql);
$i = 0; while($row = $db->fetch_row($resql) )
while($i < $nums)
{ {
$row = $db->fetch_row($resql);
$numero = $row[0]; $numero = $row[0];
/* Reformatage du numéro */ /* Reformatage du numéro */
@ -83,110 +83,23 @@ if ( $resql )
$numero = "0033".substr($numero, 1); $numero = "0033".substr($numero, 1);
} }
/* Recherche du tarif */
/* Numéros spéciaux */ /* Numéros spéciaux */
if (substr($numero,4,1) == 8) if (substr($numero,4,1) == 8)
{ {
} }
else else
{ {
if (! $tarif_achat->cout($numero, $x, $y, $z)) if ( $tarif_vente->cout($numero, $x, $y, $z) == 0)
{ {
print "\nTarif achat manquant pour $numero\n"; print "Tarif vente manquant pour $numero ($row[0]) $x $y dans la grille $grille\n";
print "\nPour les corrections utilisez facturation-correction-import.php\n";
exit(1);
}
if (! $tarif_vente->cout($numero, $x, $y, $z))
{
print "\nTarif vente manquant pour $numero\n";
print "\nPour les corrections utilisez facturation-correction-import.php\n";
exit(1);
} }
} }
print ".";
$i++;
}
$db->free();
}
print "\n";
/*
* Verification des contrats
*/
$contrats = array();
$sql = "SELECT rowid, fk_client_comm, fk_soc, fk_soc_facture";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat ";
$resql = $db->query($sql) ;
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$contrats[$i] = $objp;
$i++;
}
$db->free();
}
dolibarr_syslog(sizeof($contrats) ." contrats a vérifier");
$error = 0;
foreach ($contrats as $contrat)
{
$sql = "SELECT rowid, fk_client_comm, fk_soc, fk_soc_facture";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
$sql .= " WHERE fk_contrat = ".$contrat->rowid;
$resql = $db->query($sql) ;
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
if ($objp->fk_client_comm <> $contrat->fk_client_comm)
{
dolibarr_syslog("Erreur fk_client_comm contrat ".$contrat->rowid." ligne ".$objp->rowid);
$error++;
}
if ($objp->fk_soc <> $contrat->fk_soc)
{
dolibarr_syslog("Erreur fk_soc contrat ".$contrat->rowid." ligne ".$objp->rowid);
$error++;
}
if ($objp->fk_soc_facture <> $contrat->fk_soc_facture)
{
dolibarr_syslog("Erreur fk_soc_facture contrat ".$contrat->rowid." ligne ".$objp->rowid);
$error++;
}
$i++;
}
$db->free();
}
else
{
dolibarr_syslog("Erreur SQL");
} }
$db->free($resql);
} }
dolibarr_syslog($error ." erreurs trouvées"); dolibarr_syslog($error ." erreurs trouvées");
dolibarr_syslog("facturation-verif.php END");
?> ?>

View File

@ -1,5 +1,5 @@
-- ======================================================================== -- ========================================================================
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2005-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by -- it under the terms of the GNU General Public License as published by

View File

@ -68,7 +68,6 @@ class TelephonieTarif {
$this->_load_tarif($grille_id, $type); $this->_load_tarif($grille_id, $type);
} }
function CreateTarif($name, $type) function CreateTarif($name, $type)
{ {