*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationImportCdr.class.php';
require_once DOL_DOCUMENT_ROOT.'/telephonie/facturation/FacturationEmission.class.php';
require_once DOL_DOCUMENT_ROOT.'/telephonie/fournisseurtel.class.php';
if (!$user->rights->telephonie->facture->ecrire) accessforbidden();
if ( $_POST["sendit"] && $conf->upload != 0)
{
if ($_POST['fournisseur'] > 0)
{
$upload_dir = DOL_DATA_ROOT."/telephonie/cdr/atraiter/".$_POST['fournisseur'];
if (is_dir($upload_dir))
{
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1))
{
$mesg = "Le fichier est valide, et a été téléchargé avec succès.\n";
}
else
{
$mesg = "Le fichier n'a pas été téléchargé";
}
}
}
}
llxHeader('','Telephonie - Facturation');
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
/*
*
*/
$fourn = new FournisseurTelephonie($db);
$fourns = $fourn->getActives();
clearstatcache();
print '
';
print '';
$var = true;
print '';
print '| Facturation | ';
foreach ($fourns as $key => $value)
{
$dir = $conf->telephonie->dir_output."/cdr/atraiter/$key" ;
if (is_dir($dir))
{
$handle=opendir($dir);
$files = array();
while (($file = readdir($handle))!==false)
{
if (is_file($dir.'/'.$file))
array_push($files, $file);
}
closedir($handle);
$nb = sizeof($files);
}
else
{
$nb = 'Rep Inexistant';
}
print "";
print "| Fichiers a traiter pour $value | ";
print ''.$nb.' | ';
if (sizeof($files) > 0)
{
print 'Importer';
}
print ' | ';
$var =!$var;
}
$obj = new FacturationImportCdr($db);
$nbcdr = $obj->CountDataImport();
print "";
print '| Donnees a traiter | '.$nbcdr.' | ';
print 'Traiter | ';
$obj = new FacturationEmission($db,$user);
$act = $obj->NbFactureToGenerate();
$nb = $obj->nbfac;
$var =!$var;
print "";
print '| Lignes de facture | '.$nb.' | ';
print 'Emettre | ';
print ' ';
print '';
print '| Statistiques | ';
$var =!$var;
print "";
print '| Generation | Generer | ';
print ' ';
print ' | ';
print ' ';
print '';
print '| Autres actions | ';
if ($nbcdr > 0)
{
print "";
print '| Vider la table des CDR a traiter | Vider | ';
}
print ' ';
print ' |
';
print '
';
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
?>