| Current Path : /home/happyrenas/old/huissier-express.fr/administration/2020/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/huissier-express.fr/administration/2020/facture.php |
<?
/////////////////////////////////////
include("config.php");
include("includes/fonctions.php");
$page = "facture";
if ($_SESSION['admin_droit']==2) {$huissier_id = $_SESSION['admin_id'];$critere_huissier = " AND huissier_id=".$huissier_id;}
include("auth.php");
$annee_en_cours = date("Y");
$mois_en_cours = date("m");
/////////////////////////////////////
$zip = $db->escape($_GET['zip']);
$token = md5(mt_rand());
$filtre_type = $db->escape($_GET['filtre_type']);
$filtre_annee = $db->escape($_GET['filtre_annee']);
$filtre_limite = $db->escape($_GET['filtre_limite']);
if ($filtre_limite!='tous')
{
$critere_limite=" LIMIT 100";
}
if ($filtre_annee)
{
$critere_limite="";
}
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="fr" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title><?echo $titre_application;?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<link href="../assets/global/plugins/datatables/datatables.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="../assets/global/css/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="../assets/layouts/layout2/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/layouts/layout2/css/themes/grey.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="../assets/layouts/layout2/css/custom.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link href="<?echo $icone;?>" rel="shortcut icon" type="image/x-icon">
<style type="text/css" class="init">
#philippe{display:none;}
#philippe tbody tr:hover {background-color:<?echo $datatable_hover;?> !important;}
</style>
</head>
<!-- END HEAD -->
<body class="page-header-fixed page-sidebar-closed-hide-logo page-container-bg-solid">
<!-- BEGIN HEADER -->
<?include("header_top.php");?>
<!-- END HEADER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<?include("header_left.php");?>
</div>
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN PAGE HEADER-->
<?
if ($_SESSION['admin_droit']==2)
{
$exclusiona="2";
$exclusionb="3";
}
if ($filtre_type)
{
if ($filtre_type==1) {$critere_type = " AND constat_id!='' AND impaye_id='' AND urgence_id='' ";} //Constats
if ($filtre_type==2) {$critere_type = " AND constat_id='' AND impaye_id!='' AND urgence_id='' ";} //Impayes
if ($filtre_type==3) {$critere_type = " AND constat_id='' AND impaye_id='' AND urgence_id!='' ";} //Urgences
if ($filtre_type==4) {$critere_type = " AND constat_id='' AND impaye_id='' AND urgence_id='' ";} // Abonnements
}
if ($_SESSION['admin_droit']==2)
{
$critere_type=" AND impaye_id='' AND urgence_id='' ";
}
if ($filtre_annee)
{
$critere_annee = " AND year(date_creation)=".$filtre_annee;
}
$myquery = "SELECT * from facture where 1 ".$critere_huissier." ".$critere_type." ".$critere_annee." order by id desc ".$critere_limite;
$myquery_calls = $db->get_results($myquery);
$num = $db->num_rows;
$myquery = "SELECT DISTINCT( year(date_creation)) AS ANNEE from facture where 1 ".$critere_huissier." ".$critere_type." order by id desc ";
$myquery_calls1 = $db->get_results($myquery);
?>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.php">Accueil</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<b>Les factures</b>
</li>
</ul>
<div class="page-toolbar">
<div class="btn-group pull-right" style="padding-left:1px;">
<button type="button" class="btn btn-fit-height blue-madison"><?if ($filtre_annee) {?> <i class="fa fa-check"></i> <?}?> Année </button>
<button type="button" class="btn btn-fit-height dropdown-toggle blue-madison" data-toggle="dropdown"><i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="facture.php"> <?if ($filtre_annee=='tous') {echo "<b>";}?>Toutes</b></a></li>
<?
if (!empty($myquery_calls1))
{
foreach ( $myquery_calls1 as $annees )
{
?>
<li><a href="facture.php?filtre_annee=<?echo $annees->ANNEE;?>"> <?if ($filtre_annee==$annees->ANNEE) {echo "<b>";}?><?echo $annees->ANNEE;?></b></a></li>
<?
}
}
?>
</ul>
</div>
</div>
<div class="page-toolbar">
<div class="btn-group pull-right" style="padding-left:1px;">
<button type="button" class="btn btn-fit-height blue-madison"><?if ($filtre_limite) {?> <i class="fa fa-check"></i> <?}?> Aff </button>
<button type="button" class="btn btn-fit-height dropdown-toggle blue-madison" data-toggle="dropdown"><i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="facture.php?filtre_limite=tous"> <?if ($filtre_limite=='tous') {echo "<b>";}?>Toutes</b></a></li>
<li><a href="facture.php"> <?if (!$filtre_limite) {echo "<b>";}?>Les dernieres</b></a></li>
</ul>
</div>
</div>
<div class="page-toolbar">
<div class="btn-group pull-right" style="padding-left:1px;">
<button type="button" class="btn btn-fit-height blue"><?if ($filtre_type) {?> <i class="fa fa-check"></i> <?}?> Type </button>
<button type="button" class="btn btn-fit-height dropdown-toggle blue" data-toggle="dropdown"><i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu">
<li><a href="facture.php"> <?if (!$filtre_type) {echo "<b>";}?>Tous</b></a></li>
<?
foreach ( $tableau_facture_type as $key => $value )
{
if ($key!=$exclusiona && $key!=$exclusionb )
{
?>
<li><a href="facture.php?filtre_type=<?echo $key;?>"> <?if ($filtre_type==$key) {echo "<b>";}?><?echo $value;?></b></a></li>
<?
}}
?>
</ul>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<?
if ($zip==1)
{
echo "<div class='note note-success note-bordered'><a href='zip/facture".$token.".zip'>Téléchargement de votre archive ".$filtre_annee."</a></div>";
}
?>
<div class="row">
<div class="col-md-12">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box" style="background-color:<?echo $charte_couleur;?>;border: 1px solid <?echo $charte_couleur;?>;">
<div class="portlet-title">
<div class="caption"><i style="color:#00e5ff;" class="fa fa-database"></i>
Synthèse des <?echo $num;?> factures.<small> </small>
</div>
</div>
<div class="portlet-body">
<div id="loading" style="position: fixed;z-index: 999; height: 2em; width: 2em; overflow: show; margin: auto; top: 0; left: 0; bottom: 0; right: 0;" > <img src="img/ajax-loader1.gif" width="100" alt="" /></div>
<table class="table compact table-striped table-bordered" id="philippe">
<thead>
<tr>
<th style="font-size: 12px;" width="1px"> </th>
<th style="font-size: 12px;" class='text-center' width="10%">Type</th>
<th style="font-size: 12px;" width="10%">Facture</th>
<th style="font-size: 12px;" width="1px">Num.Commande</th>
<th style="font-size: 12px;" width="1px">Num.Huissier</th>
<th style="font-size: 12px;" width="1px">Paybox</th>
<th style="font-size: 12px;" class='text-right' width="10%">Montant</th>
<th style="font-size: 12px;" width="20%">Description</th>
<th style="font-size: 12px;" width="20%">Huissier</th>
<th style="font-size: 12px;" width="20%"></th>
<th style="font-size: 12px;" class='text-center' width="15%">Statut </th>
<th style="font-size: 12px;" class="text-right" width="10%">Date F</th>
<th style="font-size: 12px;" class="text-right" width="10%">Date C</th>
</tr>
</thead>
<tbody>
<?
if (!empty($myquery_calls))
{
foreach ( $myquery_calls as $factures )
{
$compteur = $compteur+1;
$huissier_nom = "";
$nom_prenom = "";
$facture_type = 0;
$fichier_facture = "";
$precision = "";
$reference = "";
$paybox_trans = "";
$date_commande ="";
$myquery = "SELECT * from huissier where id=".$factures->huissier_id;
$huissier = $db->get_row($myquery);
$huissier_nom = $huissier->huissier;
/////////
//CONSTAT
/////////
if ($factures->constat_id)
{
$facture_type = 1;
$fichier_facture = "facture.php";
$myquery = "SELECT * from constat where id=".$factures->constat_id;
$reponse = $db->get_row($myquery);
$nom_prenom = "<b>".ucfirst($reponse->nom)."</b> ".$reponse->prenom;
$reference = "HE/".date("Y", strtotime($reponse->date_creation))."/C/".$reponse->id;
$paybox_trans = substr($reponse->paybox_trans, -5);
$date_commande = date("d/m/Y", strtotime($reponse->date_creation));
}
/////////
//IMPAYE
/////////
if ($factures->impaye_id)
{
$facture_type = 2;
$fichier_facture = "facture_impaye.php";
$myquery = "SELECT * from impaye where id=".$factures->impaye_id;
$reponse = $db->get_row($myquery);
$nom_prenom = "<b>".ucfirst($reponse->client_nom)."</b> ".$reponse->client_prenom;
$reference = "HE/".date("Y", strtotime($reponse->date_creation))."/R/".$reponse->id;
$paybox_trans = substr($reponse->paybox_trans, -5);
$factures->facture_montant=21;
$date_commande = date("d/m/Y", strtotime($reponse->date_creation));
}
/////////
//URGENCE
/////////
if ($factures->urgence_id)
{
$facture_type = 3;
$fichier_facture = "facture_urgence.php";
$myquery = "SELECT * from urgence where id=".$factures->urgence_id;
$reponse = $db->get_row($myquery);
$nom_prenom = "<b>".ucfirst($reponse->client_nom)."</b> ".$reponse->client_prenom;
$reference = "HE/".date("Y", strtotime($reponse->date_creation))."/U/".$reponse->id;
$paybox_trans = substr($reponse->paybox_trans, -5);
$factures->facture_montant=24;
$date_commande = date("d/m/Y", strtotime($reponse->date_creation));
}
/////////
//ABONNEMENT
/////////
if (!$facture_type)
{
$facture_type = 4;
$fichier_facture = "facture.php";
$precision = "<span class='btn' style='cursor:default;color:".$tableau_abonnement_texte[$huissier->abonnement_is].";background-color:".$tableau_abonnement_fond[$huissier->abonnement_is]."'>".$tableau_abonnement[$huissier->abonnement_is]."</span>";
$paybox_trans = "";
}
//GENERATION DU ZIP
if ($zip==1)
{
include("fpdfi/".$fichier_facture);
}
/*
$annee_facture = date("Y", strtotime($factures->date_creation));
if ($annee_facture='2019')
{
$nouveau_numero=str_replace("-18-","-19-",$factures->facture_numero);
$requete = "UPDATE facture set facture_numero = '".$nouveau_numero."' where id=".$factures->id ;
//$db->query($requete);
echo $requete."<br>";
}
*/
?>
<tr>
<td></td>
<td style="font-size: 12px;" class='text-center'><span class="btn" style="cursor:default;color:<?echo $tableau_facture_type_texte[$facture_type];?>;background-color:<?echo $tableau_facture_type_fond[$facture_type];?>"><?echo $tableau_facture_type[$facture_type];?></span></td>
<td style="font-size: 12px;" class='text-left'><a class="btn btn-sm btn-default" target="_blank" href="fpdfi/<?echo $fichier_facture;?>?facture_id=<?echo $factures->id;?>&huissier_id=<?echo $huissier->id;?>&tva=&save=non"><?echo $factures->facture_numero;?></a></td>
<td style="font-size: 12px;" class='text-left'><?echo $reference;?></td>
<td style="font-size: 12px;" class='text-left'><?echo $huissier->id;?></td>
<td style="font-size: 12px;" class='text-left'><?echo $paybox_trans;?></td>
<td style="font-size: 12px;" class='text-right'><?echo number_format($factures->facture_montant, 2, '.', ' ');?> €</td>
<td style="font-size: 12px;" class='text-left'><i><?echo $factures->description;?></i></td>
<td style="font-size: 12px;" class='text-left'><?echo $huissier_nom;?></td>
<td style="font-size: 12px;" class='text-left'><?echo $nom_prenom;?><?echo $precision;?></td>
<td style="font-size: 12px;" class='text-center'><span class="btn" style="cursor:default;color:<?echo $tableau_facture_statut_texte[$factures->statut_paiement];?>;background-color:<?echo $tableau_facture_statut_fond[$factures->statut_paiement];?>"><?echo $tableau_facture_statut[$factures->statut_paiement];?></span></td>
<td style="font-size: 12px;" class="text-right"><?echo date("d/m/Y", strtotime($factures->date_creation));?></a></td>
<td style="font-size: 12px;" class="text-right"><?echo $date_commande;?></a></td>
</tr>
<?
}
}
if ($zip==1)
{
///////////////////////
//RECUPERATION ET TRAITEMENT
///////////////////////
$dossier = $dossier_de_base_pdf;
$destination = $dossier_de_base_zip."facture".$token.".zip";
zipper($dossier,$destination);
$files = glob($dossier_de_base_pdf.'*');
foreach($files as $file){
if(is_file($file)) {
unlink($file);
}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<!--Cooming Soon...-->
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<?
include("footer.php");
?>
</div>
<!--[if lt IE 9]>
<script src="../assets/global/plugins/respond.min.js"></script>
<script src="../assets/global/plugins/excanvas.min.js"></script>
<script src="../assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script src="../assets/global/plugins/jquery-notific8/jquery.notific8.min.js" type="text/javascript"></script>
<script src="../assets/global/scripts/datatable.js" type="text/javascript"></script>
<script src="../assets/global/plugins/datatables/datatables.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="../assets/global/scripts/app.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap-modal/js/bootstrap-modalmanager.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap-modal/js/bootstrap-modal.js" type="text/javascript"></script>
<script src="//cdn.datatables.net/plug-ins/1.10.21/sorting/date-euro.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../assets/pages/scripts/ui-notific8.min.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="../assets/layouts/layout2/scripts/layout.min.js" type="text/javascript"></script>
<script src="../assets/layouts/layout2/scripts/demo.min.js" type="text/javascript"></script>
<script src="../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="../assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.0.12/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.0.12/dist/js/select2.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready(function() {
var table = $('#philippe').DataTable( {
paging: true,
"pageLength": 50,
"columnDefs": [
{"targets": [0], "visible": false, "orderable": false},
{"targets": [3], "visible": false, "orderable": false},
{"targets": [4], "visible": false, "orderable": false},
{"targets": [10], "visible": true, "orderable": true,"type" : "date-euro"},
{"targets": [11], "visible": true, "orderable": true,"type" : "date-euro"},
],
dom:
"B<'row'<'col-sm-6'l><'col-sm-6'f>>" +
"i<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-4'i><'col-sm-4 text-center'><'col-sm-4'p>>",
buttons: [
{ extend: 'excel', text: 'Exporter XLS', titleAttr: '', exportOptions: {columns: [0,1,2,3,4,5,6,7,8,9,10,11,12]} },
<?if ($filtre_annee) {?>
{
text: 'Exporter ZIP',
titleAttr: 'Exporter ZIP',
action: function ( e, dt, node, config ) {
window.location.href='facture.php?filtre_annee=<?echo $filtre_annee;?>&zip=1'
}
}
<?}?>
],
orderable: false,
"orderClasses": true,
"bSort": true,
"searching": true,
"language": {
"zeroRecords": "Aucun enregistrement dans la base",
"info": "",
"sLengthMenu": "_MENU_ par page",
"infoEmpty": "Résultat vide",
"infoFiltered": "(Sur _MAX_ résultats)",
"sSearch": "Rechercher : "
},
} );
} );
$('#philippe').on('init.dt', function () {
$('#philippe').show();
$('#loading').hide();
})
</script>
</body>
</html>