|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 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/www/mcg/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
if(!empty($_POST))
{
// echo "<pre>" ;
// print_r($_FILES) ;
// echo "</pre>" ;
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
// exit() ;
}
// exit() ;
$target_dir = "files/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file) ;
function multi_attach_mail($to, $subject, $message, $senderEmail, $senderName, $files = array()){
$from = $senderName." <".$senderEmail.">";
$headers = "From: $from";
// Boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// Multipart boundary
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
// Preparing attachment
if(!empty($files)){
for($i=0;$i<count($files);$i++){
if(is_file($files[$i])){
$file_name = basename($files[$i]);
$file_size = filesize($files[$i]);
$message .= "--{$mime_boundary}\n";
$fp = @fopen($files[$i], "rb");
$data = @fread($fp, $file_size);
@fclose($fp);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: application/octet-stream; name=\"".$file_name."\"\n" .
"Content-Description: ".$file_name."\n" .
"Content-Disposition: attachment;\n" . " filename=\"".$file_name."\"; size=".$file_size.";\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
}
}
}
$message .= "--{$mime_boundary}--";
$returnpath = "-f" . $senderEmail;
// Send email
$mail = @mail($to, $subject, $message, $headers, $returnpath);
// Return true, if email sent, otherwise return false
if($mail){
return true;
}else{
return false;
}
}
// exit() ;
if(!empty($_POST))
{
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
// exit() ;
$num_fact=$_POST['num_fact'] ;
$date_relance = date("Ymd") ;
dbi_query("INSERT INTO relance_un (`id`, `num_fact`, `date_relance`, `test`) VALUES (NULL, '$num_fact', '$date_relance', '1')") ;
$to = $_POST['contact_email'];
// $from = 'info@menage-et-compagnie.com';
$from = 'comptabilite@mc-pro.fr';
$fromName = 'MC PRO';
$subject = $_POST['objet'];
// Attachment files
// echo "===>".$_file['file']['name']."<br/>" ;
// exit();
$files = array(
'files/'.$_FILES['file']['name'],
// 'files/codex-site.pdf'
);
$htmlContent = $_POST['contenu'];
// Call function and pass the required arguments
$sendEmail = multi_attach_mail($to, $subject, $htmlContent, $from, $fromName, $files);
// echo " testttt <br/>" ;
// Email sending status
// if($sendEmail){
// echo 'The email has sent successfully.';
// }else{
// echo 'Mail sending failed!';
// }
header('Location:rec_moin_vingt.php?msg=Mail bien envoyé&color=success');
}
$pagemenu = basename($_SERVER["PHP_SELF"]) ;
$TOTALREG = 0;
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
$now = time();
$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'
);
$annee = $year = date('Y');
$mois = $month = date('m');
$from = $annee.''.$mois.'01';
$to = $annee.''.$mois.'31';
if(isset($_POST['mois']) && isset($_POST['annee'])){
$from = $_POST['annee'].''.$_POST['mois'].'01';
$to = $_POST['annee'].''.$_POST['mois'].'31';
$annee = $_POST['annee'];
$mois = $_POST['mois'];
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../plugins/summernote/summernote-bs4.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Enregistrer le titre de la page --><title> LogMCPRO | Client</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">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<!-- DataTables -->
<link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.css">
<!-- overlayScrollbars -->
<link rel="stylesheet" href="../dist/css/adminlte.min.css">
<style>
.myCollapse {
display: none;
}
.myCollapse.in {
display: block;
}
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.modal-header {
background: #226faa;
background: -webkit-gradient(linear,left top,right top,from(#226faa),color-stop(37%,#2989d8),to(#72c0d3));
background: linear-gradient(to right,#226faa 0,#2989d8 37%,#72c0d3 100%);
border-radius: 6px;
color: #fff;
padding: 18px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-color: transparent;
}
.modal-header .close {
margin-top: -3px;
font-size: 24px;
font-weight: 400;
color: #fff;
opacity: .9;
width: 28px;
height: 28px;
padding-bottom: 0;
padding-left: 1px;
}
button.close {
padding: 0;
cursor: pointer;
background: 0 0;
border: 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
</style>
</head>
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Menu extensible -->
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a></li>
</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="myModal" 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="fetch" ></div>
</div>
</div>
</div>
<!-- Ne pas toucher au dessus / fin de la BARRE DE NAVIGATION-->
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark"></h1>
</div><!-- /.col -->
<div class="col-sm-6">
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- PAGE PRINCIPALE -->
<div class="content">
<div class="container-fluid">
<div class="row">
<!-- DEFINITION DES COLONNES -->
<div class="col-lg-3">
<!-- WIDGET AVEC LE NOM DU CLIENT -->
<div class="info-box mb-3 bg-info">
<div class="info-box-content">
<span class="info-box-text"><b> <h1><div id='TOTALREG'><?php echo number_format( $TOTALREG, 2, ',', ' ').'<sup style="font-size: 20px">€ </sup>';?></div></h1></b></span>
</div>
</div>
<!-- BARRE DE NAVIGATION DU CLIENT -->
<?php include('menu_recouvrement.php'); ?>
</div>
<div class="col-lg-9">
<div class="row">
<div class="col-lg-12">
<!-- CARD DE DROITE-->
<div class="card">
<div class="card-header"><h5 class="m-0"><i class="nav-icon far fas fa-chart-line"></i> <?php echo strtoupper ("ENCOURS EN RETARD -20") ; ?> </h5></div>
<?php
$clients = array();
$query2 = "SELECT f.num_fact,
f.fact_id, total,date_debut,date_fin,
total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
if(a.avoir is null, 0, a.avoir) avoir,
f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'Réglé', if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de règlement', 'Règlement partiel')) statut,
f.relance,client_nom nom,f.client_id,reglement_delai
FROM ".TABLE_FACT." f
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) paye, fact_id FROM ".TABLE_PAIEMENT." group by fact_id) p ON f.fact_id = p.fact_id
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) avoir, fact_id FROM ".TABLE_AVOIR." group by fact_id) a ON f.fact_id = a.fact_id
LEFT JOIN ".TABLE_CLIENT." c ON f.client_id = c.client_id
WHERE f.date_fin<=$to
GROUP BY date_fact, f.fact_id, total
order by num_fact DESC" ;
$date = date("Ymd");
// echo $query2 ;
$q2 = dbi_query(sprintf($query2, '<')) ;
$date1 = time();
while($f = dbi_fetch_row($q2))
{
if($f['statut'] !== 'Réglé'){
$date_fact = int2date($f['date_fact'],'Y-m-d') ;
$reglement_delai = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
$reglement_delai20 = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
$date2 = int2date($reglement_delai,'Y-m-d');
$date2 = strtotime($date2);
$datediff = $date1 - $date2;
$datediff2 = $date2 - $date1;
$nbre2 = round($datediff2 / (60 * 60 * 24)) ;
$nbre = round($datediff / (60 * 60 * 24)) ;
// if( $f['client_id'] == 7642 )
// echo $nbre2.'<br>';
$MM=$f['reglement_delai'] + $f['reglement_delai'] ;
if( $nbre > $MM OR $nbre2 > $MM)
{
if( $nbre > 20 OR $nbre2 > 20)
$clients[] = $f['client_id'];
}
// {}
// else
// {
// $clients[] = $f['client_id'];
// }
}
}
// echo '<pre>';
// print_r($clients);
// echo '<pre>';
if(isset($_GET["msg"])){
?>
<div class="alert alert-<?php echo $_GET["color"]; ?> alert-dismissible col-12" role="alert">
<strong><?php echo $_GET["color"].': '; ?></strong><?php echo $_GET["msg"]; ?>.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php
}
?>
<div class="card-body">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th style="text-align:center;">Numéro</th>
<th style="text-align:center;">client</th>
<th style="text-align:center;" >Échéance </th>
<th style="text-align:center;" >Date facture</th>
<th style="text-align:center;" >Montant</th>
<th style="text-align:center;" >Net à payer</th>
<th style="text-align:center;" >Relance</th>
</tr>
</thead>
<tbody>
<?php
$CA = 0 ;
$query2 = "SELECT f.num_fact,
f.fact_id, total,date_debut,date_fin,
total-if(p.paye is null, 0, p.paye)-if(a.avoir is null, 0, a.avoir) AS paye,
if(a.avoir is null, 0, a.avoir) avoir,
f.date_fact, if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) >= total, 'Réglé', if(if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) = 0, 'Pas de règlement', 'Règlement partiel')) statut,
f.relance,client_nom nom,f.client_id,reglement_delai
FROM ".TABLE_FACT." f
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) paye, fact_id FROM ".TABLE_PAIEMENT." group by fact_id) p ON f.fact_id = p.fact_id
LEFT JOIN (select if(sum(if(montant is null, 0, montant)) is null, 0, sum(if(montant is null, 0, montant))) avoir, fact_id FROM ".TABLE_AVOIR." group by fact_id) a ON f.fact_id = a.fact_id
LEFT JOIN ".TABLE_CLIENT." c ON f.client_id = c.client_id
WHERE f.date_fin<=$to
GROUP BY date_fact, f.fact_id, total
order by num_fact DESC" ;
// printf($query, '<');
$date = date("Ymd");
$q2 = dbi_query(sprintf($query2, '<')) ;
$date1 = time();
while($f = dbi_fetch_row($q2))
{
if($f['statut'] !== 'Réglé'){
if($f['reglement_delai'] > 0)
{}
else
$f['reglement_delai'] = 0;
$date_fact = int2date($f['date_fact'],'Y-m-d') ;
$reglement_delai = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
$reglement_delai20 = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
$date2 = int2date($reglement_delai,'Y-m-d');
$date2 = strtotime($date2);
$datediff = $date1 - $date2;
$nbre = round($datediff / (60 * 60 * 24)) ;
if( $nbre >= 0 && $nbre <= 20 )
{
if(!in_array($f['client_id'] , $clients))
{
$CA += $f['paye'];
?>
<tr>
<td style="text-align:center;vertical-align:middle;"><?=$f['num_fact'];?></td>
<td style="text-align:center;vertical-align:middle;"><?=$f['nom']?></td>
<td style="text-align:center;vertical-align:middle;"><?=int2date($reglement_delai,'Y/m/d')?></td>
<td style="text-align:center;vertical-align:middle;"><?=int2date($f['date_fact'],'Y/m/d') ?></td>
<td style="text-align:center;vertical-align:middle;"><span class="badge bg-success"><?=number_format($f['total'], 2, ', ', ' ').' €'?></span></td>
<td style="text-align:center;vertical-align:middle;"><span class="badge bg-info"><?=number_format($f['paye'], 2, ', ', ' ')?> € <?=($f['avoir'] > 0) ? '<br>(avoirrr de '.number_format($f['avoir'], 2, ', ', ' ').' €)' : ''?></span></td>
<?php
list( $date_relance) =dbi_fetch_row(dbi_query("SELECT date_relance FROM relance_un WHERE num_fact = ".$f['num_fact'])) ;
if($date_relance== "")
{
?>
<TD align="center" nowrap> <?php echo '<a class="btn btn-info btn-sm" href="#myModal" id="custId" data-toggle="modal" data-id="'.$f['num_fact'].'">Relance </a>';?> </a></TD>
<?php
}
else
{
?>
<TD align="center" nowrap> <?php echo "Déja relancé le( ".int2date($date_relance)." )" ; ?> </TD>
<?php
}
?>
</tr>
<?php
}
}
}
?>
<?php
}
?>
</tbody>
</table>
<br/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
<div class="p-3">
<h5>Title</h5>
<p>Sidebar content</p>
</div>
</aside>
<!-- /.control-sidebar -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.0.1
</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>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<script>
$(function () {
var TOTALREG ="<?php echo number_format( $CA, 2, ',', ' ').' € ';?>";
$('#TOTALREG').html(TOTALREG);
})
</script>
<script>
$(function () {
$("#example1").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myModal').on('show.bs.modal', function (e) {
var rowid = $(e.relatedTarget).data('id');
$.ajax({
type : 'post',
url : 'ajaxRelance.php', //Here you will fetch records
data : 'rowid='+ rowid, //Pass $id
success : function(data){
$('#fetch').html(data);//Show fetched data from database
}
});
});
});
</script>
</body>
</html>
