|
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
// echo "yassin <br/>" ;
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
function get_drop_down_reglement2 ($name='', $param = '', $value='')
{
$q = dbi_query("SELECT * FROM ".TABLE_REGLEMENT."") ;
$res = "<select class='form-control' name=\"$name\" $param>" ;
while($r = dbi_fetch_row($q))
$res .= "<option value=\"{$r['reglement_id']}\"".($r['reglement_id'] == $value ? ' selected' : (($value==''&&$r['reglement_id'] == 2) ? ' selected' : '')).">".utf8_encode($r['reglement_desc'])."</option>" ;
return "$res</select>" ;
}
$client_id =$_SESSION["client_id"] ;
$query = "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." where client_id = $client_id 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
WHERE f.client_id=$client_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
GROUP BY date_fact, f.fact_id, total
order by num_fact DESC" ;
$q = dbi_query(sprintf($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." where client_id = $client_id 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
WHERE f.client_id=$client_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
GROUP BY date_fact, f.fact_id, total
order by num_fact DESC" ;
if($_POST['rowid']>0)
{
$_GET['chantier_ID']=$_POST['rowid'] ;
}
// echo "==> ".$_GET['chantier_ID']."<br/>"
// $qm = dbi_query('select * from contact where contact_id='.$contact_id.'') ;
// $tabmod = dbi_fetch_row($qm);
// $contact_nom=$tabmod['contact_nom'];
// $contact_pnom=$tabmod['contact_pnom'];
// $contact_fonction=$tabmod['contact_fonction'];
// $contact_tele1=$tabmod['contact_tele1'];
// $contact_tele2=$tabmod['contact_tele2'];
// $contact_email=$tabmod['contact_email'];
?>
<div class="modal-header task-single-header" data-task-single-id="5" data-status="4">
<h4 class="modal-title">Nouveau reglementtt <?php echo $prestationid ;?></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form role="form" method='POST' action=''>
<!-- /.card-header -->
<div class="card-body" >
<div class="row">
<?php $client = $client_id ? dbi_fetch_row(dbi_query("SELECT * FROM ".TABLE_CLIENT." WHERE client_id = $client_id")) : array() ; ?>
<input type="hidden" name="client_id" value="<?=$client_id?>">
<input name="reg" type="hidden" />
<div class="col-sm-4">
<div class="form-row">
<label> Montant :</label>
<input type="text" class="form-control" name="montant" size="6" value="0,00" class="field required" />
</div>
</div>
<div class="col-sm-4">
<div class="form-row">
<label >Facture</label>
<select class="form-control" name="fact" style="width:100%" class="field required">
<?php $q = dbi_query(sprintf($query, '<')) ;
while($f = dbi_fetch_row($q))
echo '<option value="'.$f['fact_id'].'">Facture nº'.$f['num_fact'].'</option>' ;
?>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="form-row">
<label> Date :</label> <?php $dated = date('Y-m-d'); ?>
<input type="text" name='datefacture' id='datefacture' class="form-control" data-inputmask-alias="datetime" data-inputmask-inputformat="yyyy-mm-dd" value='<?php echo $dated;?>' data-mask>
</div>
</div>
<div class="col-sm-4">
<div class="form-row">
<label >Mode de règlement</label>
<?=get_drop_down_reglement2('mode', "style='width:100%;'", $client['reglement_id'])?>
</div>
</div>
<div class="col-sm-4">
<div class="form-row">
<label>Chèque N° </label>
<input class="form-control" type="text" name="chek" value="" class="field required" />
</div>
</div>
<div class="col-sm-4">
<div class="form-row">
<label>Banque </label>
<input class="form-control" type="text" name="bank" value="" class="field required" />
</div>
</div>
</div>
</div>
<input type="hidden" name="chantier_ID" value="<?=$red['chantier_ID'] ?>">
<div class="modal-footer justify-content-between">
<button name="valider" type="submit" value=" Enregistrer " class="btn btn-primary" >Enregistrer</button>
<button style="width=10px;" type="button" class="btn btn-danger" data-dismiss="modal">Fermer</button>
</div>
</form>
<script src="../../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<script src="../../plugins/summernote/summernote-bs4.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
bsCustomFileInput.init();
});
$(function () {
// Summernote
$('.textarea').summernote()
})
</script>
