|
Server IP : 10.128.40.6 / Your IP : 216.73.216.111 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/../sms/../pages/uploads/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// 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>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>LogMCPRO | Facture</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">
<!-- Select2 -->
<link rel="stylesheet" href="../plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="../plugins/select2-bootstrap4-theme/select2-bootstrap4.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">
<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">
<div class="wrapper">
<!-- TOP MENU -->
<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>
<!-- liens TOP MENU GAUCHE-->
<li class="nav-item d-none d-sm-inline-block">
<a href="index.php" class="nav-link">Accueil</a>
</li>
<li class="nav-item d-none d-sm-inline-block">
<a href="#" class="nav-link">Lien 1</a>
</li>
<li class="nav-item d-none d-sm-inline-block">
<a href="#" class="nav-link">Lien 2</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="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) -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Facture non payée</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Facture</li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<!-- /.col -->
<div class="col-md-12">
<div class="card card-primary">
<div class="card-body p-20">
<table class="table table-bordered" >
<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>
</tr>
<?php
$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,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, '<');
// $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
// 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
// AND f.agence_id=$agence
// AND if(p.paye is null, 0, p.paye)+if(a.avoir is null, 0, a.avoir) %s total
// AND f.date_debut>=$from AND f.date_fin<=$to
// GROUP BY date_fact, f.fact_id, total
// order by num_fact DESC" ;
printf($query, '<');
$date = date("Ymd");
// echo sprintf($query2, '<');
// echo
// echo " $reglementDelai $date <br/>";
$q2 = dbi_query(sprintf($query2, '<')) ;
// while($f = dbi_fetch_row($q2))
// {
// echo '<pre>';
// print_r($f);
// echo '</pre>';
// }
$date= date("Ymd");
while($f = dbi_fetch_row($q2))
{
// echo "---> $f['fact_id']"
// $date2 = strtotime($f['date_fact']);
// $a = dateDiff($now, $date2) ;
// if($a['day']> $reglementDelai )
if($f['statut'] !== 'Réglé'){
if($f['reglement_delai'] > 0)
{}
else
$f['reglement_delai'] = 0;
// $date_fact = int2date($f['date_fact'],'Y-m-d') ;
// $date_fact_plus_reglement_delai = date("Ymd", strtotime("$date_fact +20 days"));
$date_fact = int2date($f['date_fact'],'Y-m-d') ;
$reglement_delai = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
$f['reglement_delai'] += 20;
$reglement_delai20 = date("Ymd", strtotime("$date_fact +".$f['reglement_delai']." days"));
// $reglement_delai = date("Ymd", strtotime("$date_fact +".$f['reglement_delai'] +20." days"));
// $reglement_delai_delai = date("Y-m-d", strtotime("$date_fact +".$f['reglement_delai']." days"));
// $date_fact_plus_reglement_delai = date("Ymd", strtotime("$date_fact +20 days"));
if( $reglement_delai20 >= $date)
{
// echo "==> <br/>" ;
?>
<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').' $$$ '." Échéance + 20 ==> $reglement_delai20 . date ===> $date<br/>" ;?></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
}
// if ($f['avoir'])
// {
// $qa = dbi_query("SELECT * FROM ".TABLE_AVOIR." WHERE fact_id = ".$f['fact_id']." AND agence_id = $agence") ;
// while($a = dbi_fetch_row($qa))
// printf('<br><a href="avoir.php?aid=%d" target="_blank">Avoir nº%d</a>', $a['avoir_id'], $a['num_avoir']);
}
?></td>
</tr>
<?php
// }
}
/*
while($f = dbi_fetch_row($q))
{
?>
<tr>
<td style="text-align:center;"><?=$f['num_fact']?></td>
<td style="text-align:center;"><?=int2date($f['date_fact'])?></td>
<td style="text-align:center;"><?=number_format($f['total'], 2, ', ', ' ').' €'?></td>
<td style="text-align:center;"><?=number_format($f['paye'], 2, ', ', ' ')?> € <?=($f['avoir'] > 0) ? '<br>(avoir de '.number_format($f['avoir'], 2, ', ', ' ').' €)' : ''?></td>
<td style="text-align:center;"><?=$f['statut']?></td>
<button type="submit" class="btn btn-block bg-gradient-info">Valider La Facture</button>
<td style="text-align:center;"><a href="fact.php?fid=<?=$f['fact_id']?>" target="_blank" class="btn btn-block bg-gradient-info">Voir la facture</a>
<?php
// if ($f['avoir'])
// {
// $qa = dbi_query("SELECT * FROM ".TABLE_AVOIR." WHERE fact_id = ".$f['fact_id']." AND agence_id = $agence") ;
// while($a = dbi_fetch_row($qa))
// printf('<br><a href="avoir.php?aid=%d" target="_blank">Avoir nº%d</a>', $a['avoir_id'], $a['num_avoir']);
// }
?></td>
</tr>
<?php
} */
echo '</table><br/>';
?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.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 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- jQuery UI -->
<script src="../plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- Select2 -->
<script src="../plugins/select2/js/select2.full.min.js"></script>
<!-- Page specific script -->
<!-- Page specific script -->
<script>
$(document).ready(function() {
$('#annee').on('change',function(){
$('form').submit();
});
$('#mois').on('change',function(){
$('form').submit();
});
});
</script>
<script>
$(function () {
$('.select2').select2()
$('.select2bs4').select2({
theme: 'bootstrap4'
})
})
</script>
</body>
</html>
