|
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/TEST/www/../../mcg/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// lllk
include 'includes/config_tmcpro2.php' ;
include 'includes/stable_functions_tmcpro.php' ;
function count_week_days($__date_from, $__date_to, $__holidays_between=array(), $__weekend_days=array()) {
$total_days_count = $__date_to > $__date_from ? round(($__date_to - $__date_from)/(24*3600)) : 0;
$full_weeks_count = floor($total_days_count/7);
$weekend_days_count = $full_weeks_count*count($__weekend_days);
$days_left_uncovered = $total_days_count - $full_weeks_count*7;
for($i = 0; $i < $days_left_uncovered; $i++) {
$date_to_check = $i ? strtotime("+{$i} day", $__date_from) : $__date_from;
if(in_array(date('N', $date_to_check), $__weekend_days)) {
$weekend_days_count++;
}
}
$week_days_count = $total_days_count - $weekend_days_count - count($__holidays_between);
return $week_days_count;
}
function daysfr ($value = 0)
{
$tab = array(0 => 'Dimanche', 1 => 'Lundi', 2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', 6 => 'Samedi');
return $tab[$value];
}
// exit() ;
function get_prest_sem( $IN,$from ,$to)
{
$end = dateformaint($to) ;
$date = dateformaint($from);
$p = array();
while ($date <= $end )
{
// $q = dbi_query("SELECT * FROM PRESTATIONS p where p.client_id ".$IN." AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) ");
$q = dbi_query("SELECT * FROM PRESTATIONS p where p.client_id ".$IN." AND presta_date_debut <= $date AND (p.presta_date_fin >= $date OR p.presta_date_fin IS NULL) AND ( p.presta_recur IS NULL OR p.presta_recur NOT IN ( SELECT presta_id FROM PRESTATIONS where client_id ".$IN." AND presta_date_fin < $date ) ) ");
while($prest = dbi_fetch_row($q))
{
$date_presta_sem = $prest['presta_date_debut'] ;
$q1 = dbi_query("SELECT * FROM PRESTATIONS_MODIF WHERE presta_id = ".$prest['presta_id']." AND start <= ".$date." order by start, modif_id ") ;
while ( $m = dbi_fetch_row($q1) )
{
if( $m['presta_sem'] != NULL ) $date_presta_sem = $m['start'];
$prest['presta_sem'] = $m['presta_sem'] === NULL ? $prest['presta_sem'] : $m['presta_sem'] ;
$prest['presta_jour'] = $m['presta_jour'] === NULL ? $prest['presta_jour'] : $m['presta_jour'] ;
$prest['presta_Hdeb'] = $m['presta_Hdeb'] === NULL ? $prest['presta_Hdeb'] : $m['presta_Hdeb'] ;
$prest['presta_Hduree'] = $m['presta_Hduree'] === NULL ? $prest['presta_Hduree'] : $m['presta_Hduree'] ;
$prest['salarie_id'] = $m['salarie_id'] === NULL ? $prest['salarie_id'] : $m['salarie_id'] ;
$prest['chantier_id'] = $m['chantier_id'] === NULL ? $prest['chantier_id'] : $m['chantier_id'] ;
$prest['presta_forfait'] = $m['presta_forfait'] === NULL ? $prest['presta_forfait'] : $m['presta_forfait'] ;
}
$day = date("w", strtotime( int2date_autre_format($date)));
if( $day == $prest['presta_jour'] OR ( $date == $prest['presta_date_debut'] && $prest['presta_date_debut'] == $prest['presta_date_fin'] ) ){
// echo "SELECT date_presta FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." ";
$EXP = dbi_fetch_row(dbi_query("SELECT * FROM EXCEPTIONS WHERE presta_id = ".$prest['presta_id']." AND date_presta = ".$date." " )) ; ;
if($EXP ){
$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
// echo $EXP." ^D^^^^";
if( $EXP['new_presta_id'] != NULL && $EXP['en_cours'] == '1')
{
// if($EXP['ad'] == '1')
// echo $EXP['presta_id']." +++++++++++ ";
// elseif($EXP['ded'] == '1')
// echo $EXP['presta_id']." ------- ";
// echo '<br>'.$date.' <> '.$EXP['facture']." ++++ ".$EXP['ad']."<br>";
// echo $EXP['facture']." ------- ".$EXP['des'];
if($EXP['ad'] == '1' && $EXP['facture'] == '1')
$p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'add','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;
elseif($EXP['ded'] == '1' && $EXP['facture'] == '1')
$p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'ded','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;
}
// elseif ( $EXP['new_presta_id'] == NULL && $EXP['facture'] != '1') j'ai(DSI) commenté ce code pour je puisse affiche les deux exceprtion (prstation) factuté et non facturé
elseif ( $EXP['new_presta_id'] == NULL)
{
// echo " $date >= $from && $date <= $to " ;
// if( $date >= $from && $date <= $to )
$p[] = array(
'id' => $prest['presta_id'],
'excpt_id' => $EXP['excpt_id'],
'idchantier' => $prest['chantier_id'],
'idclient' => $prest['client_id'],
'nbH' => '',
'taux' => $prest['presta_forfait'],
'tauxHT' => '',
'type' => 'e2',
'date' => $date,
'jour' => $prest['presta_jour'],
'deb' => $prest['presta_Hdeb'],
'duree' => $prest['presta_Hduree'],
'facture' => $EXP['facture'],
'fin' => $heurefin) ;
}
// elseif( $EXP['new_presta_id'] == NULL){
// $p[] = array('id' => $prest['presta_id'],'excpt_id' => $EXP['excpt_id'],'idchantier' => $prest['chantier_id'],'idclient' => $prest['client_id'],'nbH' => '','taux' => $prest['presta_forfait'],'tauxHT' => '','type' => 'e2','date' => $date,'jour' => $prest['presta_jour'],'deb' => $prest['presta_Hdeb'],'duree' => $EXP['Hduree'],'change' => 1,'fin' => $heurefin) ;
// }
} else {
if( $prest['presta_sem'] == 1 )
{
$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
$p[] = array(
'id' => $prest['presta_id'],
'idchantier' => $prest['chantier_id'],
'idclient' => $prest['client_id'],
'nbH' => '',
'taux' => $prest['presta_forfait'],
'tauxHT' => '',
'type' => 'p',
'date' => $date,
'jour' => $prest['presta_jour'],
'inter' => $prest['salarie_id'],
'deb' => $prest['presta_Hdeb'],
'duree' => $prest['presta_Hduree'],
'fin' => $heurefin) ;
} elseif( $prest['presta_sem'] >0 ) {
$nbre =count_week_days(strtotime(int2date_autre_format($date_presta_sem,'d.m.Y')), strtotime(int2date_autre_format($date,'d.m.Y')));
$modolo = $nbre % $prest['presta_sem'] ;
if( $modolo == 0)
$heurefin = addDuree($prest['presta_Hdeb'], $prest['presta_Hduree']);
$p[] = array(
'id' => $prest['presta_id'],
'idchantier' => $prest['chantier_id'],
'idclient' => $prest['client_id'],
'nbH' => '',
'taux' => $prest['presta_forfait'],
'tauxHT' => '',
'type' => 'p',
'date' => $date,
'jour' => $prest['presta_jour'],
'inter' => $prest['salarie_id'],
'deb' => $prest['presta_Hdeb'],
'duree' => $prest['presta_Hduree'],
'fin' => $heurefin) ;
}
}
}
}
$date = date("Ymd", strtotime("+1 day", strtotime($date)));
}
return $p;
}
// echo "<pre>";
// print_r($_POST);
// echo "</pre>";
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
if(isset($_POST['clients']) && !empty($_POST['clients']) && !empty($_POST['from']) && !empty($_POST['to']) && !empty($_POST['datefacture'])){
// echo ' <br/>'."$client_id ,eeeeeeeeeee";
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
include 'includes/fch.php' ;
// dateformaint($
$from=dateformaint($_POST['from']);
$to=dateformaint($_POST['to']);
$au=dateformaint($_POST['datefacture']);
$au1 = sprintf("%02d/%02d/%04d", substr($au, 6, 2), substr($au, 4, 2), substr($au, 0, 4)) ;
$prev=false;
$nb_prev=0;
foreach ($_POST['clients'] as $client_id)
{
// include 'includes/fch3.php' ;
echo ' <br/>'."$client_id ,";
$_POST['fact_format']='n';
$textf=NULL;
$somme=$_POST[$client_id.'total'];
$prev=false;
$nb_prev=0;
$facture = unserialize( base64_decode( $_POST[$client_id."facture"] ) );
$inter = unserialize( base64_decode( $_POST[$client_id."inter"] ) );
$numfact=dbi_query("SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id ") ;
// echo "SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id ";
// echo "SELECT * FROM ".TABLE_FACT." WHERE date_debut>=$from AND date_fin<=$to AND client_id=$client_id AND agence_id=$agence";
$row_cnt = mysqli_num_rows($numfact);
if($row_cnt)
{
}
else
{
$fact_id=creerFactureCh($client_id,0,$from,$to,$f,$au1, $_POST['fact_format'], $prev, $cumul, $nb_prev, $textf,$facture,$somme,$inter);
// echo ' ************** ';
}
}
// $IN .= ' 0 ) ';
// echo $client_id.'<br>';
// $id = 0;
// */
}
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
$where = '';
if(isset($_POST['mois']) && isset($_POST['annee'])){
// $where = " AND client_id NOT IN ( SELECT client_id FROM ".TABLE_FACT." WHERE date_debut>='".$_POST['annee'].''.$_POST['mois'].'01'."' AND date_fin<='".date('Ymt', strtotime($_POST['annee'].'-'.$_POST['mois'].'-01'))."' ) ";
}
if( !empty($_POST['from']) && !empty($_POST['to']) ){
// $where = " AND client_id NOT IN ( SELECT client_id FROM ".TABLE_FACT." WHERE date_debut>='".$_POST['from']."' AND date_fin<='".$_POST['to']."' ) ";
}
// ECHO $where;
// $where = '';
$date = date('Y-m-01');
$annee = $year = date('Y');
$mois = $month = date('m');
if(isset($_POST['datefacture']))
$datefacture = $_POST['datefacture'];
else
$datefacture = date('Y-m-d');
$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'
);
if(isset($_POST['mois']) && isset($_POST['annee'])){
$datecal = $_POST['annee'].'-'.$_POST['mois'].'-01';
$annee = $_POST['annee'];
$mois = $_POST['mois'];
}
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Edition des factures</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">
<!-- daterange picker -->
<link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="../plugins/icheck-bootstrap/icheck-bootstrap.min.css">
<!-- Bootstrap Color Picker -->
<link rel="stylesheet" href="../plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
<!-- Tempusdominus Bbootstrap 4 -->
<link rel="stylesheet" href="../plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.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">
<!-- Bootstrap4 Duallistbox -->
<link rel="stylesheet" href="../plugins/bootstrap4-duallistbox/bootstrap-duallistbox.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">
</head>
<body class="hold-transition sidebar-mini">
<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></a>
</li>
<!-- liens TOP MENU GAUCHE-->
<td>
<a href="facturemail.php"><button type="button" class="btn btn-block btn-secondary"></i> ENVOI PAR MAIL</button> </a>
</td>
<td>
  <a href="facturepdf.php"> <button type="button" class="btn btn-block btn-secondary" ></i> ENVOI PAR COURRIER</button></a>
</td>
<td>
  <a href="facture2.php"> <button type="button" class="btn btn-block btn-secondary" ></i> HISTORIQUE </button></a>
</td>
<td>
  <a href="consommables_livres.php"> <button type="button" class="btn btn-block btn-primary" ></i> CONSOMMABLES LIVRES </button></a>
</td>
</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) -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-6 col-6">
</div>
<div class="col-lg-3 col-6">
<div class="small-box bg-info">
<a href="#" class="small-box-footer">CA HT :
<h3><div id='TOTALCAHT'><?php echo number_format( $CAHT, 2, ',', ' ').'<sup style="font-size: 20px">€ </sup>';?></div></h3>
</a>
</div>
</div>
<div class="col-lg-3 col-6">
<div class="small-box bg-info">
<a href="#" class="small-box-footer">CA TTC :
<h3><div id='TOTALCA'><?php echo number_format( $CATTC, 2, ',', ' ').'<sup style="font-size: 20px">€ </sup>';?></div></h3>
</a>
</div>
</div>
</div>
<div class="row">
<!-- /.col -->
<div class="col-md-12">
<div class="card card-info" style='border:2px solid #17a2b8;'>
<div class="card-header">
<h3 class="card-title">CREATION DES FACTURES </h3>
</div>
<!-- form start -->
<form role="form" method='POST' action=''>
<!-- /.card-header -->
<div class="card-body" >
<div class="row">
<div class="col-12">
<div class="form-group">
<select class="duallistbox" multiple="multiple" style="height: 150px;" name="client_ids[]" id="client_ids[]">
<?php $req =dbi_query("SELECT * FROM client WHERE client_statut = '1' $where ORDER BY client_nom ASC") ;
while( $cli=dbi_fetch_row($req)) { ?>
<option value="<?php echo $cli['client_id'] ; ?>" <?php if(in_array($cli['client_id'] , $_POST['client_ids'])) echo 'selected';?>><?php echo utf8_encode($cli['client_nom']); ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Année</label>
<select name='annee' id='annee' class="form-control">
<?php
$earliest_year = 2018;
foreach (range($year+3, $earliest_year) as $x) {
print '<option value="'.$x.'"'.($x == $annee ? ' selected="selected"' : '').'>'.$x.'</option>';
}
?>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Mois</label>
<select name='mois' id='mois' class="form-control">
<?php
foreach ($months as $key => $value) {
$key = sprintf("%02d",$key );
print '<option value="'.$key.'"'.($key == $mois ? ' selected="selected"' : '').'>'.$value.'</option>';
}
?>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<label>Date de facturation</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
</div>
<input type="text" name='datefacture' id='datefacture' class="form-control" data-inputmask-alias="datetime" data-inputmask-inputformat="yyyy-mm-dd" value='<?php echo $datefacture;?>' data-mask>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group"><label><br/></label>
<button type="submit" class="btn btn-block bg-gradient-primary">Valider</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div> <!-- /.col -->
</div><!-- /.row -->
<form role="form" method='POST' action=''>
<?php
if(isset($_POST['mois']) && isset($_POST['annee']) && isset($_POST['client_ids'] )){
$facts =array();
$from = $_POST['annee'].'-'.$_POST['mois'].'-01';
$to = date('Y-m-t', strtotime($from));
$CLIENTIN = ' IN ( ';
foreach ($_POST['client_ids'] as $client_id)
{
$CLIENTIN .= "$client_id ,";
$client_s[] = $client_id ;
}
$CLIENTIN .= ' 0 ) ';
// echo $CLIENTIN.' ***** ';
$pre=get_prest_sem( $CLIENTIN,$from,$to);
// echo "<pre>";
// print_r($pre);
// echo "</pre>";
$too = dateformaint($to) ;
$fromm = dateformaint($from);
$ClientSql=array();
// echo "<pre>";
// print_r($pre);
// echo "</pre>";
// $sql1="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl
// WHERE c.client_id $CLIENTIN AND chantier_recur = '0'
// AND ( chantier_debut <= $fromm AND (chantier_fin =0 OR chantier_fin IS NULL OR chantier_fin >= $too ) )
// AND cl.client_id=c.client_id
// AND chantier_ID NOT IN
// (
// SELECT chantier_ID FROM chantier
// WHERE client_id $CLIENTIN
// AND chantier_recur = '0'
// AND ( (Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
// )
// ORDER BY client_nom
// ";
// echo '<br> $sql1 = '.$sql1;
// $sql2="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl WHERE c.client_id $CLIENTIN AND chantier_recur = '0'
// AND ( (Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
// AND cl.client_id=c.client_id ORDER BY client_nom";
// echo ' <br> $sql1 = '.$sql2;
// $sql3="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl WHERE c.client_id $CLIENTIN AND chantier_recur = '1'
// AND ((chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
// AND cl.Client_ID=c.client_id ORDER BY client_nom";
// echo ' <br> $sql1 = '.$sql3;
$TABSQL=array($sql1);
// echo "tssst <br/>" ;
$client_s0 = $client_s1 = $client_s2 = array();
// echo " SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( ( Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm) ) AND Chantier_debut != chantier_fin ";
// Nouveaux chantiers et chantiers arrêtés
$sql_cl1 = dbi_query(" SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( ( Chantier_debut <= $too AND chantier_debut >= $fromm ) OR (chantier_fin <= $too AND chantier_fin >= $fromm) ) AND Chantier_debut != chantier_fin ");
// echo " SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( ( Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm) ) AND Chantier_debut != chantier_fin <br/>" ; ;
//chantiers ponctuels
$sql_cl2 = dbi_query(" SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( Chantier_debut >= $fromm AND (chantier_fin <= $too ) ) AND chantier_recur = 0 ");
// echo " SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND chantier_recur = '0' AND ( (chantier_debut <= $too AND chantier_debut >= $fromm ) OR (chantier_fin <= $too AND chantier_fin >= $fromm) OR (chantier_debut <=$fromm AND chantier_fin = 0) OR (chantier_debut <=$fromm AND chantier_fin > $too) ) AND client_id NOT IN ( SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND chantier_recur = '1' AND ( (chantier_debut <= $too AND chantier_debut >= $fromm ) OR (chantier_fin <= $too AND chantier_fin >= $fromm) OR (chantier_debut <=$fromm AND chantier_fin = 0) OR (chantier_debut <=$fromm AND chantier_fin > $too))) " ;
// echo " SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( Chantier_debut <= $fromm AND (chantier_fin >= $too ) ) AND chantier_recur = 0 <br/>" ;
// echo "rrr=============eeeeeee===================rrr <br/> <br/> <br/>l" ;
// SELECT * FROM client WHERE client_statut = '1' AND client_id IN (select client_id from chantier) $where ORDER BY client_nom ASC
//chantiers réguliers
$sql_cl0 = dbi_query(" SELECT distinct c.client_id FROM chantier c, client cl WHERE c.client_id = cl.client_id AND c.client_id $CLIENTIN AND ( ( Chantier_debut <= $fromm AND (chantier_fin IS NULL OR chantier_fin = 0 OR chantier_fin >= $too ) ) ) ORDER BY cl.client_nom ASC");
// echo " SELECT distinct client_id FROM chantier WHERE client_id $CLIENTIN AND ( ( Chantier_debut <= $fromm AND (chantier_fin IS NULL OR chantier_fin = 0) ) OR (chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm)) <br/>";
while($Lsql_cl1 = dbi_fetch_row($sql_cl1))
{
// echo $Lsql_cl1['client_id'];
$client_s1[] = $Lsql_cl1['client_id'] ;
}
while($Lsql_cl2 = dbi_fetch_row($sql_cl2))
{
// echo ' $$$ '.$Lsql_cl2['client_id'];
if (!in_array($Lsql_cl2['client_id'], $client_s1) )
$client_s2[] = $Lsql_cl2['client_id'] ;
}
while($Lsql_cl0 = dbi_fetch_row($sql_cl0))
{
if (!in_array($Lsql_cl0['client_id'], $client_s1) && !in_array($Lsql_cl0['client_id'], $client_s2) )
$client_s0[] = $Lsql_cl0['client_id'] ;
}
$annee = $_POST['annee'];
$mois = $_POST['mois'];
$CATTC = 0;
$CAHT = 0;
$rf = dbi_query("SELECT * FROM facture WHERE date_debut>=$fromm AND date_fin<=$too") ;
while($fs = dbi_fetch_row($rf))
{
$facts[]=array($fs['client_id'],$fs['fact_id'],$fs['date_debut'],$fs['date_fin'],$fs['date_fact']);
}
?>
<div class="row">
<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 les Clients</span>
</div>
<div class="col-lg-6 col-6">
<br/>
</div>
<?php
for($s=0;$s<count($TABSQL);$s++)
{
?>
<div class="col-md-12">
<div class="card card-outline card-success">
<div class="card-header">
<h3 class="card-title">
<?php
// $client_s = array();
// if ($s==0)
// {
// echo "<b>chantiers réguliers</b>";
// $client_s = $client_s0 ;
// } elseif ($s==1) {
// echo "<b>Nouveaux chantiers et chantiers arrêtés</b>";
// $client_s = $client_s1 ;
// } elseif ($s==2) {
// echo "<b>chantiers ponctuels</b>";
// $client_s = $client_s2 ;
// }
// echo "=========================================== <br/>" ;
// print_r($client_s) ;
?>
</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i>
</button>
</div>
<!-- /.card-tools -->
</div>
<!-- /.card-header -->
<div class="card-body">
<?php
foreach ( $client_s as $client_id)
{
$border='border-left:2px solid #17a2b8;border-right:2px solid #17a2b8;border-bottom:2px solid #17a2b8;';
$fact_id=0;
$lien ='';
$pdf=false;
$inter=array();
$card ='card-info';
foreach($facts as $ft)
{
if($client_id == $ft[0] && $fromm <=$ft[2] && $too >=$ft[2])
{
$pdf=true;
$chemFact="factures/$client_id/";
$fact_id=$ft[1];
$border='border-left:2px solid #dc3545;border-right:2px solid #dc3545;border-bottom:2px solid #dc3545;';
$card ='card-danger';
}
}
$ch = dbi_fetch_row(dbi_query("SELECT client_id,client_nom nom FROM client WHERE client_id = $client_id "));
?>
<div class="col-md-12">
<div class="card <?php echo $card;?>" >
<div class="card-header">
<h3 class="card-title">
<div class="icheck-info d-inline ml-2">
<?php if($pdf == false ) { ?><input type="checkbox" value="<?php echo $ch['client_id'];?>" name="clients[]" id="<?php echo $ch['client_id'];?>"><label for="<?php echo $ch['client_id'];?>"></label><?php } ?>
</div>
<span class="text"><b><?php echo utf8_encode($ch['nom']) ;?></b></span>
<div class="d-inline" style=' position: absolute; right:20px;'>
<?php if($pdf == true ) { ?>
<a href="code/fact.php?fid=<?=$fact_id?>" target="_blank" >
<i class="fas fa-file"> </i> Voir la facture </a>
<?php } ?>
</div>
</h3>
</div>
<div class="card-body p-0" style='<?php echo $border;?>'>
<table class="table table-bordered" >
<thead>
<tr>
<th width="50%">prestation</th>
<th width="10%">Facturation</th>
<th width="10%">Montant HT</th>
<th width="10%">TVA</th>
<th width="10%">Taux TVA</th>
<th width="10%">TTC</th>
</tr>
</thead>
<tbody>
<?php
$TOTAL=0;
$TOTALHT=0;
$TOTALTVA=0;
$TOTALTTC=0;
$TVATOT=0;
$facture=array();
$RR = dbi_query(" SELECT * FROM client WHERE client_id = $client_id ");
// echo " SELECT * FROM chantier WHERE client_id = $client_id AND ( ( Chantier_debut <= $fromm AND (chantier_fin IS NULL OR chantier_fin = 0) ) OR ( Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm) OR ( chantier_debut between $fromm AND $too ) OR (chantier_fin between $fromm AND $too )) <br> ";
$chantier_TVA = 10 ;
for($j=0 ; $j<count($pre); $j++)
{
$REG=false;
$chantier_id = $ch2['chantier_ID'];
$id = $ch2['chantier_ID'];
$chantier_fm = $ch2['chantier_forfaitmensuel'];
// $chantier_TVA = $ch2['chantier_TVA'];
$chantier_desig =utf8_encode( stripslashes($ch2['chantier_designation']));
$chantierht=$chantier_fm /(1+($chantier_TVA/100));
$chantiertva=$chantier_fm-$chantierht;
$chantier_deb = $ch2['chantier_debut'];
$chantier_fin = $ch2['chantier_fin'];
$nbh_duree = $pre[$j]['duree']/60 ;
// echo "===>".$pre[$j]['taux']."----".$pre[$j]['duree']."-----".$nbh_duree."<br/>" ;
$sommeht= ($pre[$j]['taux']*$nbh_duree)/1.1;
$chantier_reg=false;
$chantier_pon=false;
$chantier_pon_fin=false;
$chantier_pon_pro=false;
$chantier_recur= $ch2['chantier_recur'];
$chantier_fact= $ch2['chantier_fact'];
if($chantier_deb == $chantier_fin)
{
$chantier_pon=true;
if($chantier_fact== '1')
$chantier_pon_fin=true;
else
$chantier_pon_pro=true;
}
else
$chantier_reg=true;
$mhtadd=0;
$totadd=0;
$tvaadd=0;
$mhtded=0;
$totded=0;
$tvaded=0;
if( ($chantier_pon == true && $chantier_fin<= $too) || ($chantier_reg==true && ( $chantier_fin>$from || $chantier_fin!=0 || $chantier_fin!=NULL) ))
$REG=true;
if( $pre[$j]['type']=='p')
{
$beta = (1+($chantier_TVA/100)) ;
// echo "$beta ==>".$sommeht."<br>" ;
$somme=(1+($chantier_TVA/100))*$sommeht;
$sommetva=$somme-$sommeht;
$facture[]= array(
'id' => $id ,
'des' => "prestations du ".int2date($pre[$j]['date']),
'type' => 'c',
'tauxtva' => $chantier_TVA,
'tva' => $sommetva,
'sommeht' => $sommeht,
'somme' => $somme) ;?>
<tr>
<td width="30%" align="left" ><b><?=int2date($pre[$j]['date']);?></b></td>
<td width="10%" align="left" ></td>
<td width="10%" align="left" ><span class="badge bg-success"><?=number_format( $sommeht, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-danger"><?=number_format( $sommetva, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td width="10%" align="left" ><span class="badge bg-info"><?=number_format( $somme, 2, ',', ' ');?></span></td>
</tr>
<?php
}
$TOTAL+=$somme;
$TOTALHT+=$sommeht;
$TOTALTVA+=$sommetva;
$sommepre=0;
$HTPNE=0;
$TAUXPNE=0;
$TTCPNE=0;
$mht=0;
$tot=0;
$ttva=0;
$sommep1=0;
$tothtp1=0;
$totttcp1=0;
$tauxtvap1=0;
// if( $pre[$j]['type']=='add' )
// echo " ££££££££££££ ".$pre[$j]['date'].' <= '.$too.' && '.$pre[$j]['date'].' >= '.$fromm.' && '.$pre[$j]['idchantier'].'== '.$id;
// if($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['type']=='e2')
// {
// echo "<pre>";
// print_r($pre[$j]);
// echo "<pre>";
// }
if( $pre[$j]['type']=='e2' and $pre[$j]['facture']=='1' )
{
// echo "<pre>";
// print_r($pre[$j])
// echo "</pre>";
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$HTPNETMP=$nbH*$taux;
$TTCPNETMP=(1+($chantier_TVA/100))*$HTPNETMP;
$TAUXPNETMP=$TTCPNETMP-$HTPNETMP;
$HTPNE += $HTPNETMP;
$TTCPNE += $TTCPNETMP;
$TAUXPNE += $TAUXPNETMP;
// $TOTAL-=$TTCPNETMP;
// $TOTALHT-=$HTPNETMP;
// $TOTALTVA-=$TAUXPNETMP;
?>
<tr>
<td align="left" ><?='Prestation Annulée du '.daysfr($pre[$j]['jour']).' ('.int2heure($pre[$j]['deb']).'-'.int2heure(addDuree($pre[$j]['deb'], $pre[$j]['duree'])).') '.'Intervention du '.int2date($pre[$j]['date'])." - <B>Prestation non déduite </B> ";?></td>
<td align="center" ><b>X</b></td>
<td align="left" ><span class="badge bg-success"><?php echo number_format( $HTPNETMP , 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?php echo number_format( $TAUXPNETMP , 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?php echo number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?php echo number_format( $TTCPNETMP, 2 , ',', ' ');?></span></td>
</tr>
<?php
}
elseif( $pre[$j]['type']=='e2' and $pre[$j]['facture']== "" )
{
// echo "<pre>";
// print_r($pre[$j])
// echo "</pre>";
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$HTPNETMP=$nbH*$taux;
$TTCPNETMP=(1+($chantier_TVA/100))*$HTPNETMP;
$TAUXPNETMP=$TTCPNETMP-$HTPNETMP;
$HTPNE += $HTPNETMP;
$TTCPNE += $TTCPNETMP;
$TAUXPNE += $TAUXPNETMP;
$TOTAL-=$TTCPNETMP;
$TOTALHT-=$HTPNETMP;
$TOTALTVA-=$TAUXPNETMP;
?>
<tr>
<td align="left" ><?='Prestation Annulée du '.daysfr($pre[$j]['jour']).' ('.int2heure($pre[$j]['deb']).'-'.int2heure(addDuree($pre[$j]['deb'], $pre[$j]['duree'])).') '.'Intervention du '.int2date($pre[$j]['date'])." - <B>Prestation déduite </B> ";?></td>
<td align="center" ><b></b></td>
<td align="left" ><span class="badge bg-success"><?php echo number_format( $HTPNETMP , 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?php echo number_format( $TAUXPNETMP , 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?php echo number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?php echo number_format( $TTCPNETMP, 2 , ',', ' ');?></span></td>
</tr>
<?php
}
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
if($pre[$j]['date'] < $chantier_deb && $pre[$j]['date'] > $chantier_fin )
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$sommepre += $nbH*$taux ;
}
if($pre[$j]['date'] >= $chantier_deb && ($pre[$j]['date'] <= $chantier_fin || $chantier_fin==0) && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
$inter[]=$pre[$j]['inter'] ;
}
}//if p
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='e1')
{
if($pre[$j]['date'] >= $chantier_deb && ($chantier_fin == NULL || $pre[$j]['date'] <= $chantier_fin || $chantier_fin == 0) )
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mht=$nbH*$taux;
$tot=(1+($chantier_TVA/100))*$mht;
$ttva=$tot-$mht;
}
} //if e1
elseif($pre[$j]['type']=='add')
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mhtadd += $nbH*$taux ;
}
elseif( $pre[$j]['type']=='ded')
{
// echo ' $$$$$$$$$$$$$$$ ' ;
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mhtded += $nbH*$taux ;
// echo " ????????????????????? $taux }} ".$nbH;
}
if($fromm<$chantier_deb && $chantier_reg==true)
{
if($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $chantier_deb && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$sommep1 += $nbH*$taux ;
$ajust=true;
// echo $pre[$j]['date']." ? $nbH ! $taux ! $sommep1 <br/>";
}
}
// echo $mhtded.' $$$$$$$$$$$ '.$mhtadd.' +++++++++++ ';
if($mhtded>0)
{
$totded=(1+($chantier_TVA/100))*$mhtded;
$tvaded=$totded-$mhtded;
$facture[]= array('id' => $id ,'des' => 'Durée de la prestation est inférieure à la durée de la prestation initiale','type' => 'ded','tauxtva' => $chantier_TVA,'tva' => $tvaded,'sommeht' => $mhtded, 'somme' => $totded) ;
$TOTALHT=$TOTALHT-$mhtded;
$TOTALTVA=$TOTALHT*($chantier_TVA/100);
$TOTAL=$TOTALHT+$TOTALTVA;
}
// if($mhtadd>0) j'ai commenté ce code pour ne pas afficher " Durée est supérieure à la durée de la prestatio ..." dans le tableau == ref de code XX1
// {
// $totadd=(1+($chantier_TVA/100))*$mhtadd;
// $tvaadd=$totadd-$mhtadd;
// $facture[]= array('id' => $id ,'des' => 'Durée est supérieure à la durée de la prestation initiale','type' => 'add','tauxtva' => $chantier_TVA,'tva' => $tvaadd,'sommeht' => $mhtadd, 'somme' => $totadd) ;
// $TOTALHT=$TOTALHT+$mhtadd;
// $TOTALTVA=$TOTALHT*($chantier_TVA/100);
// $TOTAL=$TOTALHT+$TOTALTVA;
// }
// echo "=== $j ====".$TAUXPNE."<br/>" ;
if($TAUXPNE !=0 AND $pre[$j]['facture']== "")
{
$facture[]= array(
'id' => $id ,
'des' => ' Prestation Annulée déduite '.int2date($pre[$j]['date']),
'type' => 'p',
'tauxtva' => $chantier_TVA,
'tva' => $TAUXPNE,
'sommeht' => $HTPNE,
'somme' => $TTCPNE) ;
}
if($TAUXPNE !=0 AND $pre[$j]['facture']== 1)
{
$facture[]= array(
'id' => $id ,
'des' => ' Prestation Annulée non déduite '.int2date($pre[$j]['date']),
'type' => 'p',
'tauxtva' => $chantier_TVA,
'tva' => $TAUXPNE,
'sommeht' => $HTPNE,
'somme' => $TTCPNE) ;
}
$chantier_reg = 1 ;
if($chantier_reg==true)
{
/* ce code fonction avec ref de code XX1 soit conté les deux soit décomenté les deux
if($mhtadd >0 ){ ?>
<tr>
<td width="30%" align="left" >Durée est supérieure à la durée de la prestation initiale</td>
<td width="10%" align="center" ><b>X</b></td>
<td width="10%" align="left" ><span class="badge bg-success"><?=number_format( $mhtadd, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-danger"><?=number_format( $tvaadd, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td width="10%" align="left" ><span class="badge bg-info"><?=number_format( $totadd, 2 , ',', ' ');?></span></td>
</tr>
<?php
} */
if($mhtded >0 ){ ?>
<tr>
<td align="left" >Durée est inférieure à la durée de la prestation initiale</td>
<td align="center" ><b>X</b></td>
<td align="left" ><span class="badge bg-success"><?=number_format( $mhtded, 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?=number_format( $tvaded, 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?=number_format( $totded, 2, ',', ' ');?></span></td>
</tr>
<?php
}
}
}////////////////////
// }
// }
// echo " ++++++++++++++++++++++++++++++++ ";
$facture[]= array(
'id' => $id ,
'des' => 'TOTAL',
'type' => 'f',
'tauxtva' => $chantier_TVA,
'tva' => $TOTALTVA,
'sommeht' => $TOTALHT,
'somme' => $TOTAL) ;
$CA+=$TOTALHT;
$CAC+=$TOTAL;
$CATTC +=$TOTAL;
$CAHT +=$TOTALHT;
?>
<input type = "hidden" name = "date_from" value = "<?=$fromm; ?>">
<input type = "hidden" name = "date_to" value = "<?=$too; ?>">
<input type = "hidden" name = "date_fact" value = "<?=$datefacture; ?>">
<input type = "hidden" name = "<?=$client_id; ?>total" value = "<?=number_format( $TOTAL, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>totalht" value = "<?=number_format( $TOTALHT, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>totaltva" value = "<?=number_format( $TOTALTVA, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>facture" value = "<?php echo base64_encode( serialize( $facture) ); ?>">
<input type = "hidden" name = "<?=$client_id; ?>inter" value = "<?php echo base64_encode( serialize( $inter) ); ?>">
<input type="hidden" name="au" value="<?=$au?>"><input type="hidden" name="from" value="<?=$from?>"><input type="hidden" name="to" value="<?=$to?>">
<tr>
<td style='background-color: #dee2e6;text-align:center;'><b>Total</b></td>
<td style='background-color: #dee2e6;text-align:center;'></td>
<td style='background-color: #dee2e6;'><span class="badge bg-success"><?php echo number_format( $TOTALHT, 2, ',', ' ');?></span></td>
<td style='background-color: #dee2e6;'><span class="badge bg-danger"><?php echo number_format( $TOTALTVA, 2, ',', ' ');?></span></td>
<td style='background-color: #dee2e6;'><span class="badge bg-warning"></td>
<td style='background-color: #dee2e6;'><span class="badge bg-info"><?php echo number_format( $TOTAL, 2, ',', ' ');?></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<?php
}
?>
<?php /*
$R=dbi_query($TABSQL[$s]);
while($ch = dbi_fetch_row($R))
{
$client_id = $ch['client_id'];
$sql11="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl
WHERE c.client_id = $client_id AND chantier_recur = '0'
AND ( chantier_debut <= $fromm AND (chantier_fin =0 OR chantier_fin IS NULL OR chantier_fin >= $too ) )
AND cl.client_id=c.client_id
AND chantier_ID NOT IN
(
SELECT chantier_ID FROM chantier
WHERE client_id = $client_id
AND chantier_recur = '0'
AND ( (Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
)
ORDER BY client_nom
";
$sql22="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl WHERE c.client_id = $client_id AND chantier_recur = '0'
AND ( (Chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
AND cl.client_id=c.client_id ORDER BY client_nom";
$sql33="SELECT c.client_id,client_nom nom,chantier_ID,chantier_forfaitmensuel,chantier_TVA,chantier_designation,chantier_debut,chantier_fin,chantier_recur,chantier_fact FROM chantier c , client cl WHERE c.client_id = $client_id AND chantier_recur = '1'
AND ((chantier_debut < $too AND chantier_debut > $fromm ) OR (chantier_fin < $too AND chantier_fin > $fromm))
AND cl.Client_ID=c.client_id ORDER BY client_nom";
$TABSQL11=array($sql11,$sql22,$sql33);
if (!in_array($client_id, $ClientSql) )
{
$ClientSql[] = $client_id ;
$border='border-left:2px solid #17a2b8;border-right:2px solid #17a2b8;border-bottom:2px solid #17a2b8;';
$fact_id=0;
$lien ='';
$pdf=false;
$inter=array();
$card ='card-info';
foreach($facts as $ft)
{
if($client_id == $ft[0] && $fromm <=$ft[2] && $too >=$ft[2])
{
$pdf=true;
$chemFact="factures/$client_id/";
$fact_id=$ft[1];
$border='border-left:2px solid #dc3545;border-right:2px solid #dc3545;border-bottom:2px solid #dc3545;';
$card ='card-danger';
}
}
?>
<div class="col-md-12">
<div class="card <?php echo $card;?>" >
<div class="card-header">
<h3 class="card-title">
<div class="icheck-info d-inline ml-2">
<?php if($pdf == false ) { ?><input type="checkbox" value="<?php echo $ch['client_id'];?>" name="clients[]" id="<?php echo $ch['client_id'];?>"><label for="<?php echo $ch['client_id'];?>"></label><?php } ?>
</div>
<span class="text"><b><?php echo utf8_encode($ch['nom']) ;?></b></span>
<div class="d-inline" style=' position: absolute; right:20px;'>
<?php if($pdf == true ) { ?>
<a href="code/fact.php?fid=<?=$fact_id?>" target="_blank" >
<i class="fas fa-file"> </i> Voir la facture </a>
<?php } ?>
</div>
</h3>
</div>
<div class="card-body p-0" style='<?php echo $border;?>'>
<table class="table table-bordered" >
<thead>
<tr>
<th width="50%">Chantier</th>
<th width="10%">Facturation</th>
<th width="10%">Montant HT</th>
<th width="10%">TVA</th>
<th width="10%">Taux TVA</th>
<th width="10%">TTC</th>
</tr>
</thead>
<tbody>
<?php
// foreach($facts as $ft)
// {
// if($client_id == $ft[0] && $fromm <=$ft[2] && $too >=$ft[2])
// {
// $green="border:3px solid green";
// $pdf=true;
// $chemFact="factures/$client_id/";
// $fact_id=$ft[1];
// }
// }
$TOTAL=0;
$TOTALHT=0;
$TOTALTVA=0;
$TOTALTTC=0;
$TVATOT=0;
$facture=array();
// echo $TABSQL[$s].'<br>';
$RR=dbi_query($TABSQL11[$s]);
while($ch2 = dbi_fetch_row($RR))
{
// echo '<pre>';
// print_r($ch2);
// echo '</pre>';
$REG=false;
// $chantier = dbi_fetch_row(dbi_query("SELECT * FROM chantier c WHERE client_id = $client_id "));
$chantier_id = $ch2['chantier_ID'];
// echo $chantier_id.' $$$$$$$$$$$$$$$$$$$$$ ';
// if($chantier) {
// echo "SELECT * FROM fact_chantier fc WHERE Chantier_ID = ".$chantier['chantier_ID']." AND ( Chantier_debut <= $fromm OR Chantier_debut between $fromm and $too) AND (Chantier_fin IS NULL OR Chantier_fin > $fromm OR Chantier_fin =0 )";
// $qch = dbi_query("SELECT * FROM chantier WHERE Chantier_ID = ".$chantier_id." ");
// if($qch){
// while($ch = dbi_fetch_row($qch))
// {
// echo '<pre>';
// print_r($ch);
// echo '</pre>';
$id = $ch2['chantier_ID'];
$chantier_fm = $ch2['chantier_forfaitmensuel'];
$chantier_TVA = $ch2['chantier_TVA'];
$chantier_desig =utf8_encode( stripslashes($ch2['chantier_designation']));
$chantierht=$chantier_fm /(1+($chantier_TVA/100));
$chantiertva=$chantier_fm-$chantierht;
$chantier_deb = $ch2['chantier_debut'];
$chantier_fin = $ch2['chantier_fin'];
$sommeht=$chantier_fm;
$chantier_reg=false;
$chantier_pon=false;
$chantier_pon_fin=false;
$chantier_pon_pro=false;
// echo " $chantier_deb ???????????????";
$chantier_recur= $ch2['chantier_recur'];
$chantier_fact= $ch2['chantier_fact'];
if($chantier_recur == '1')
{
if($chantier_fact== '1')
$chantier_pon_fin=true;
else
$chantier_pon_pro=true;
$chantier_pon=true;
}
else
$chantier_reg=true;
$mhtadd=0;
$totadd=0;
$tvaadd=0;
$mhtded=0;
$totded=0;
$tvaded=0;
if( ($chantier_pon == true && $chantier_fin<= $too) || ($chantier_reg==true && ( $chantier_fin>$from || $chantier_fin!=0 || $chantier_fin!=NULL) ))
$REG=true;
if( ($chantier_pon == true && $chantier_fin<= $too) || ($chantier_reg==true && ( $chantier_fin>$from || $chantier_fin!=0 || $chantier_fin!=NULL) ))
{
if($chantier_reg==true || $chantier_fin<= $too)
{
$somme=(1+($chantier_TVA/100))*$sommeht;
$sommetva=$somme-$sommeht;
$facture[]= array(
'id' => $id ,
'des' => $chantier_desig,
'type' => 'c',
'tauxtva' => $chantier_TVA,
'tva' => $sommetva,
'sommeht' => $sommeht,
'somme' => $somme) ;?>
<tr>
<td width="30%" align="left" ><b><?=$chantier_desig;?></b></td>
<td width="10%" align="left" ></td>
<td width="10%" align="left" ><span class="badge bg-success"><?=number_format( $sommeht, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-danger"><?=number_format( $sommetva, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td width="10%" align="left" ><span class="badge bg-info"><?=number_format( $somme, 2, ',', ' ');?></span></td>
</tr>
<?php
}
else
{
$sommeht=0;
for($j=0;$j<count($pre);$j++)
{
if($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $chantier_deb && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$sommeht += $nbH*$taux ;
}
}
$somme=(1+($chantier_TVA/100))*$sommeht;
$sommetva=$somme-$sommeht;
$facture[]= array(
'id' => $id ,
'des' => $chantier_desig,
'type' => 'c',
'tauxtva' => $chantier_TVA,
'tva' => $sommetva,
'sommeht' => $sommeht,
'somme' => $somme) ; ?>
<tr>
<td align="left" ><b><?=$chantier_desig;?></b></td>
<td align="left" ></td>
<td align="left" ><span class="badge bg-success"><?=number_format( $sommeht, 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?=number_format( $sommetva, 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?=number_format( $somme, 2, ',', ' ');?></span></td>
</tr>
<?php
}
$TOTAL+=$somme;
$TOTALHT+=$sommeht;
$TOTALTVA+=$sommetva;
$sommepre=0;
$HTPNE=0;
$TAUXPNE=0;
$TTCPNE=0;
$mht=0;
$tot=0;
$ttva=0;
$sommep1=0;
$tothtp1=0;
$totttcp1=0;
$tauxtvap1=0;
for($j=0;$j<count($pre);$j++)
{
// if( $pre[$j]['type']=='add' )
// echo " ££££££££££££ ".$pre[$j]['date'].' <= '.$too.' && '.$pre[$j]['date'].' >= '.$fromm.' && '.$pre[$j]['idchantier'].'== '.$id;
if($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='e2')
{
if($pre[$j]['date'] >= $chantier_deb && ($chantier_fin == NULL || $pre[$j]['date'] <= $chantier_fin || $chantier_fin == 0))
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$HTPNETMP=$nbH*$taux;
$TTCPNETMP=(1+($chantier_TVA/100))*$HTPNETMP;
$TAUXPNETMP=$TTCPNETMP-$HTPNETMP;
$HTPNE += $HTPNETMP;
$TTCPNE += $TTCPNETMP;
$TAUXPNE += $TAUXPNETMP;
$TOTAL-=$TTCPNETMP;
$TOTALHT-=$HTPNETMP;
$TOTALTVA-=$TAUXPNETMP;
?>
<tr>
<td align="left" ><?='Prestation Annulée du '.daysfr($pre[$j]['jour']).' ('.int2heure($pre[$j]['deb']).'-'.int2heure(addDuree($pre[$j]['deb'], $pre[$j]['duree'])).') '.'Intervention du '.int2date($pre[$j]['date']);?></td>
<td align="center" ><b>X</b></td>
<td align="left" ><span class="badge bg-success"><?php echo number_format( $HTPNE , 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?php echo number_format( $TAUXPNE , 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?php echo number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?php echo number_format( $TTCPNE, 2 , ',', ' ');?></span></td>
</tr>
<?php
}
}//if e2
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
if($pre[$j]['date'] < $chantier_deb && $pre[$j]['date'] > $chantier_fin )
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$sommepre += $nbH*$taux ;
}
if($pre[$j]['date'] >= $chantier_deb && ($pre[$j]['date'] <= $chantier_fin || $chantier_fin==0) && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
$inter[]=$pre[$j]['inter'] ;
}
}//if p
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='e1')
{
if($pre[$j]['date'] >= $chantier_deb && ($chantier_fin == NULL || $pre[$j]['date'] <= $chantier_fin || $chantier_fin == 0) )
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mht=$nbH*$taux;
$tot=(1+($chantier_TVA/100))*$mht;
$ttva=$tot-$mht;
}
} //if e1
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='add')
{
// echo ' ££££££££££££ +++++++++ --------' ;
if($pre[$j]['date'] >= $chantier_deb && ($chantier_fin == NULL || $pre[$j]['date'] <= $chantier_fin || $chantier_fin == 0))
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mhtadd += $nbH*$taux ;
}
// echo " ????????????????????? $taux }} ".$nbh;
}
elseif($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $fromm && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='ded')
{
if($pre[$j]['date'] >= $chantier_deb && ($chantier_fin == NULL || $pre[$j]['date'] <= $chantier_fin || $chantier_fin == 0))
{
// echo ' $$$$$$$$$$$$$$$ ' ;
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$mhtded += $nbH*$taux ;
}
// echo " ????????????????????? $taux }} ".$nbH;
}
if($fromm<$chantier_deb && $chantier_reg==true)
{
if($pre[$j]['date'] <= $too && $pre[$j]['date'] >= $chantier_deb && $pre[$j]['idchantier']== $id && $pre[$j]['type']=='p')
{
$nbH = $pre[$j]['duree'] / 60 ;
$taux = $pre[$j]['taux'] ;
$sommep1 += $nbH*$taux ;
$ajust=true;
// echo $pre[$j]['date']." ? $nbH ! $taux ! $sommep1 <br/>";
}
}
}// for pre
// echo $mhtded.' $$$$$$$$$$$ '.$mhtadd.' +++++++++++ ';
if($mhtded>0)
{
$totded=(1+($chantier_TVA/100))*$mhtded;
$tvaded=$totded-$mhtded;
$facture[]= array('id' => $id ,'des' => 'Durée de la prestation est inférieure à la durée de la prestation initiale','type' => 'ded','tauxtva' => $chantier_TVA,'tva' => $tvaded,'sommeht' => $mhtded, 'somme' => $totded) ;
$TOTALHT=$TOTALHT-$mhtded;
$TOTALTVA=$TOTALHT*($chantier_TVA/100);
$TOTAL=$TOTALHT+$TOTALTVA;
}
if($mhtadd>0)
{
$totadd=(1+($chantier_TVA/100))*$mhtadd;
$tvaadd=$totadd-$mhtadd;
$facture[]= array('id' => $id ,'des' => 'Durée est supérieure à la durée de la prestation initiale','type' => 'add','tauxtva' => $chantier_TVA,'tva' => $tvaadd,'sommeht' => $mhtadd, 'somme' => $totadd) ;
$TOTALHT=$TOTALHT+$mhtadd;
$TOTALTVA=$TOTALHT*($chantier_TVA/100);
$TOTAL=$TOTALHT+$TOTALTVA;
}
if($TAUXPNE !=0)
{
$facture[]= array(
'id' => $id ,
'des' => 'Prestation non effectuée',
'type' => 'p',
'tauxtva' => $chantier_TVA,
'tva' => $TAUXPNE,
'sommeht' => $HTPNE,
'somme' => $TTCPNE) ;
}
} // if facture chantier
if($chantier_reg==true)
{
if($ajust==true){
if(!empty($_SESSION['facture']['ajust'][$id ]))
$tothtp1= $_SESSION['facture']['ajust'][$id];
else
$tothtp1=$TOTALHT-$sommep1;
$tauxtvap1=$tothtp1*($chantier_TVA/100);
$totttcp1=$tothtp1+$tauxtvap1;
$TOTALHT=$TOTALHT-$tothtp1;
$TOTALTVA=$TOTALHT*($chantier_TVA/100);
$TOTAL=$TOTALHT+$TOTALTVA; $facture[]= array(
'id' => $id ,
'des' => 'Ajustement démarrage en cours de mois',
'type' => 'd',
'tauxtva' => $chantier_TVA,
'tva' => $tauxtvap1,
'sommeht' => $tothtp1,
'somme' => $totttcp1) ;?>
<tr>
<form action="" method="post" name="ajust">
<input type = "hidden" name = "ChId" value = "<?=$id ?>">
<input type = "hidden" name = "from" value = "<?=$fromm; ?>">
<input type = "hidden" name = "to" value = "<?=$too; ?>">
<input type = "hidden" name = "au" value = "<?=$au; ?>">
<td align="left" ><b>Ajustement démarrage en cours de mois</b></td>
<td align="center" ><b>X</b></td>
<td align="left" ><span class="badge bg-success"><input name="totoajut" size='8' value="<?=number_format( $tothtp1, 2, ',', ' ');?>"/></span></td>
<td align="left" ><span class="badge bg-danger"><?=number_format( $tauxtvap1, 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?=number_format( $totttcp1, 2 , ',', ' ');?></span></td>
</form>
</tr>
<?php
$ajust=false;
}
if($mhtadd >0 ){ ?>
<tr>
<td width="30%" align="left" >Durée est supérieure à la durée de la prestation initiale</td>
<td width="10%" align="center" ><b>X</b></td>
<td width="10%" align="left" ><span class="badge bg-success"><?=number_format( $mhtadd, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-danger"><?=number_format( $tvaadd, 2, ',', ' ');?></span></td>
<td width="10%" align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td width="10%" align="left" ><span class="badge bg-info"><?=number_format( $totadd, 2 , ',', ' ');?></span></td>
</tr>
<?php
}
if($mhtded >0 ){ ?>
<tr>
<td align="left" >Durée est inférieure à la durée de la prestation initiale</td>
<td align="center" ><b>X</b></td>
<td align="left" ><span class="badge bg-success"><?=number_format( $mhtded, 2 , ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-danger"><?=number_format( $tvaded, 2, ',', ' ');?></span></td>
<td align="left" ><span class="badge bg-warning"><?=number_format( $chantier_TVA, 2 , ',', ' ').' % ';?></span></td>
<td align="left" ><span class="badge bg-info"><?=number_format( $totded, 2, ',', ' ');?></span></td>
</tr>
<?php
}
}
}////////////////////
// }
// }
// echo " ++++++++++++++++++++++++++++++++ ";
$facture[]= array(
'id' => $id ,
'des' => 'TOTAL',
'type' => 'f',
'tauxtva' => $chantier_TVA,
'tva' => $TOTALTVA,
'sommeht' => $TOTALHT,
'somme' => $TOTAL) ;
$CA+=$TOTALHT;
$CAC+=$TOTAL;
$CATTC +=$TOTAL;
$CAHT +=$TOTALHT;
?>
<input type = "hidden" name = "date_from" value = "<?=$fromm; ?>">
<input type = "hidden" name = "date_to" value = "<?=$too; ?>">
<input type = "hidden" name = "date_fact" value = "<?=$datefacture; ?>">
<input type = "hidden" name = "<?=$client_id; ?>total" value = "<?=number_format( $TOTAL, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>totalht" value = "<?=number_format( $TOTALHT, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>totaltva" value = "<?=number_format( $TOTALTVA, 2, '.', ''); ?>">
<input type = "hidden" name = "<?=$client_id; ?>facture" value = "<?php echo base64_encode( serialize( $facture) ); ?>">
<input type = "hidden" name = "<?=$client_id; ?>inter" value = "<?php echo base64_encode( serialize( $inter) ); ?>">
<input type="hidden" name="au" value="<?=$au?>"><input type="hidden" name="from" value="<?=$from?>"><input type="hidden" name="to" value="<?=$to?>">
<tr>
<td style='background-color: #dee2e6;text-align:center;'><b>Total</b></td>
<td style='background-color: #dee2e6;text-align:center;'></td>
<td style='background-color: #dee2e6;'><span class="badge bg-success"><?php echo number_format( $TOTALHT, 2, ',', ' ');?></span></td>
<td style='background-color: #dee2e6;'><span class="badge bg-danger"><?php echo number_format( $TOTALTVA, 2, ',', ' ');?></span></td>
<td style='background-color: #dee2e6;'><span class="badge bg-warning"></td>
<td style='background-color: #dee2e6;'><span class="badge bg-info"><?php echo number_format( $TOTAL, 2, ',', ' ');?></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<?php
}
}*/
?>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<?php
}
// echo '<pre>';
// print_r($facture);
// echo '</pre>';
?>
<div class="col-sm-9">
<?php echo "<input type='hidden' name='from' value='". $from."' /> " ;?>
<?php echo "<input type='hidden' name='to' value='". $to."' /> " ;?>
<?php echo "<input type='hidden' name='datefacture' value='". $_POST['datefacture']."' /> " ;?>
<?php //echo "<input type='hidden' name='client_ids[]' value='". $_POST['client_ids']."' /> " ;
foreach ($_POST['client_ids'] as $client_id)
{
echo "<input type='hidden' name='client_ids[]' value='".$client_id."' /> " ;
// $CLIENTIN .= "$client_id ,";
}
?>
<?php echo "<input type='hidden' name='annee' value='". $_POST['annee']."' /> " ;?>
<?php echo "<input type='hidden' name='mois' value='". $_POST['mois']."' /> " ;?>
<?php //echo "<input type='hidden' name='client_ids[]' value='". $_POST['client_ids']."' /> " ;?>
</div>
<div class="col-sm-3">
<div class="form-group"><label><br/></label>
<button type="submit" class="btn btn-block bg-gradient-info">Valider La Facture</button>
</div>
</div>
</div>
<?php } ?>
</form>
<!-- /.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 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Select2 -->
<script src="../plugins/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="../plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.js"></script>
<!-- InputMask -->
<script src="../plugins/moment/moment.min.js"></script>
<script src="../plugins/inputmask/min/jquery.inputmask.bundle.min.js"></script>
<!-- date-range-picker -->
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap color picker -->
<script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Bootstrap Switch -->
<script src="../plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
<!-- Page script -->
<script>
$(function () {
$("#allcheck").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
var TOTALCA ="<?php echo number_format( $CATTC, 2, ',', ' ').'<sup> € </sup>';?>";
$('#TOTALCA').html(TOTALCA);
var TOTALCAHT ="<?php echo number_format( $CAHT, 2, ',', ' ').'<sup> € </sup>';?>";
$('#TOTALCAHT').html(TOTALCAHT);
//Initialize Select2 Elements
$('.select2').select2()
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
})
//Datemask dd/mm/yyyy
$('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
//Datemask2 mm/dd/yyyy
$('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
//Money Euro
$('[data-mask]').inputmask()
//Date range picker
$('#reservation').daterangepicker()
//Date range picker with time picker
$('#reservationtime').daterangepicker({
timePicker: true,
timePickerIncrement: 30,
locale: {
format: 'MM/DD/YYYY hh:mm A'
}
})
//Date range as a button
$('#daterange-btn').daterangepicker(
{
ranges : {
'Today' : [moment(), moment()],
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month' : [moment().startOf('month'), moment().endOf('month')],
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
},
startDate: moment().subtract(29, 'days'),
endDate : moment()
},
function (start, end) {
$('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
}
)
//Timepicker
$('#timepicker').datetimepicker({
format: 'LT'
})
//Bootstrap Duallistbox
$('.duallistbox').bootstrapDualListbox()
//Colorpicker
$('.my-colorpicker1').colorpicker()
//color picker with addon
$('.my-colorpicker2').colorpicker()
$('.my-colorpicker2').on('colorpickerChange', function(event) {
$('.my-colorpicker2 .fa-square').css('color', event.color.toString());
});
$("input[data-bootstrap-switch]").each(function(){
$(this).bootstrapSwitch('state', $(this).prop('checked'));
});
})
</script>
</body>
</html>
