|
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/MC/../MCPRO/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include_once 'code/init.php';
print_header ('', '', $BodyX );
$style="td_listing1";
$le_mois_dernier = sprintf("%04d%02d%02d", date('Y'), date('m')-1, date('d'));
$ce_mois_ci = sprintf("%04d%02d%02d", date('Y'), date('m'), date('d'));
$debut_de_ce_mois = sprintf("%04d%02d%02d", date('Y'), date('m'), 1);
$fin_de_ce_mois = sprintf("%04d%02d%02d", date('Y'), date('m'), date('t'));
$where1="";
$where2="";
$selected="";
if($_GET['id'] && !empty($_GET['id']) )
{
if($_GET['id']>0)
{
$id=$_GET['id'];
$tabbursel=dbi_fetch_row((dbi_query('select * from bureau where id_bureau='.$_GET['id'].' and agence_id='.$agence.''))) ;
$id_bureau=$tabbursel['id_bureau'];
$nom_bureau=$tabbursel['nom_agence'];
$where1=" AND ID_Bureau != $id_bureau ";
$where2=" AND client_bureau = $id_bureau ";
}
elseif($_GET['id']=="INDEFINI")
{
$id_bureau=$_GET['id'];
$where2=" AND client_bureau='0' ";
$selected='selected="selected"';
}
}
if(!empty($_POST))
{
$from = getPostDate('debut') ;
$to = getPostDate('fin') ;
} else {
$from = $debut_de_ce_mois ;
$to = $fin_de_ce_mois ;}
$debP = $datedebut = $from;
$finP = $datefin = $to;
$TotN = 0 ;
$TotS = 0 ;
// $from = date("d/m/Y", mktime(0,0,0,substr($from,4,2),substr($from,6,2),substr($from,0,4)));
// $to = date("d/m/Y", mktime(0,0,0,substr($to,4,2),substr($to,6,2),substr($to,0,4)));
?>
<script language="Javascript">
function GetIdBureau()
{
var id="";
id = document.bureau_form.client_bureau.value ;
if( id > 0 || id=="INDEFINI" )
window.location = "chantP2.php?id="+id;
else
window.location = "chantP2.php";
}
</script>
<table style="position:absolute; top:35px; right:20px;">
<form id="bureau_form" name="bureau_form" method="POST" action="">
<tr>
<td align="left" valign="top" class="td_listing0" >Bureau :</td>
<td align="left" valign="top" class="td_listing0">
<select id="client_bureau" name="client_bureau" onchange="GetIdBureau()";>
<option selected="selected" value=""> TOUS </option>
<?php if(isset($id_bureau) && isset($nom_bureau)) { ?>
<option selected="selected" value="<?=$id_bureau ?>"><?=$nom_bureau?></option>
<?php } ?>
<?php
$Reqbureau=dbi_query("select * from bureau where agence_id=$agence $where1") or die(mysql_error());
while($listbureau=dbi_fetch_row($Reqbureau)){ ?>
<option value="<?php echo $listbureau['id_bureau']?>"><?php echo $listbureau['nom_agence'] ?></option>
<?php } ?>
<option <?=$selected ?> value="INDEFINI">INDEFINI</option>
</select>
</td>
</tr>
</form>
</table>
<form action="" name="stat" method="post">
Du <?=date_selection_html("debut", $fact_du)?><br>
Au <?=date_selection_html("fin", $fact_au)?>
<input type="submit" value="Voir les chantiers " class="bigbutton">
</form><br>
<?php
// Initialisation au début du mois et fin du mois
$datedebut = date("Ymd", mktime(0, 0, 0, substr($datedebut,4,2), 01, substr($datedebut,0,4)) );
$datefin = date("Ymd", mktime(0, 0, 0, substr($datedebut,4,2), date("t",int2time($datedebut)), substr($datedebut,0,4)) );
// echo "$from ? $to ";
$chant=dbi_query("SELECT * FROM chantier c, fact_chantier fc,client cl WHERE c.agence_id=".$agence." AND cl.client_id=c.client_id AND c.Chantier_ID=fc.Chantier_ID AND Chantier_recur='1' $where2 ORDER BY client_nom ");
?>
<div id="tab" >
<TABLE width="90%" style="margin:0 auto;">
<caption style="font-weight:bold"><h2> CHANTIERS </h2> </caption>
<thead>
<TR>
<th width="13%">Nom du client</th>
<th width="10%">Montant du chantier HT</th>
<th width="10%">Date de debut</th>
<th width="10%">Date de fin</th>
<th width="20%">Designation</th>
<th width="10%">Num Fact </th>
<th width="10%">Montant de la facture </th>
<th width="10%">Date du paiement</th>
<th width="10%">Montant du paiement</th>
</TR>
<?php if(mysql_num_rows($chant) <=0 ) {?><TR ><TD style="text-align:center;" colspan="5">Aucun chantier</TD></TR><?php } ?>
</thead>
<tbody>
<?php while($c=dbi_fetch_row($chant)){
list($num)= dbi_fetch_row(dbi_query("SELECT num_fact FROM facture where agence_id=".$agence." and client_id = ".$c['Client_ID']." and date_debut <= ".$c['Chantier_fin']." and date_fin >= ".$c['Chantier_fin'])) ;
list($MontantF , $dateP ,$MontantP )= dbi_fetch_row(dbi_query("SELECT total ,date, montant FROM facture f , paiement p where p.fact_id = f.fact_id and f.agence_id=".$agence." and f.client_id = ".$c['Client_ID']." and date_debut <= ".$c['Chantier_fin']." and date_fin >= ".$c['Chantier_fin'])) ;
$tauxtva=$c['Chantier_forfaitmensuel']*($c['Chantier_TVA']/100);
$bureau['nom_agence']='';
if($c['client_bureau']>0)
$bureau=dbi_fetch_row((dbi_query('select * from bureau where id_bureau='.$c['client_bureau'].' and agence_id='.$agence.''))) ;
if($dateP <= $to and $dateP >=$from)
{
?>
<TR>
<?php if($client_id!=$c['client_id']) { ?>
<TD><?=strtoupper($c['client_nom']).' '.ucwords(strtolower($c['client_pnom']))?></TD>
<?php } else { ?>
<TD></TD>
<?php }
$TotN+=$c['Chantier_forfaitmensuel'];
?>
<TD align="center"><?=number_format($c['Chantier_forfaitmensuel'], 2, ",", " "); ?></TD>
<TD align="center"><?=int2date($c['Chantier_debut']); ?></TD>
<TD align="center"><?=int2date($c['Chantier_fin']); ?></TD>
<TD align="center"><?=$c['Chantier_designation']; ?></TD>
<TD align="center"><?=$num; ?></TD>
<TD align="center"><?=$MontantF; ?></TD>
<TD align="center"><?=int2date($dateP); ?></TD>
<TD align="center"><?=$MontantP ; ?></TD>
</TR>
<?php
}
// echo $client_id.' ! '.$c['client_id'].' == ';
} ?>
</tbody>
</TABLE>
</div>
<br/><br/>
</div>
