AnonSec Team
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/TEST/../TMCPRO/pages/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TEST/../TMCPRO/pages/somme_chantier.php
<?php
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;



// echo "<pre>" ;
// print_r($_GET) ;
// echo "<pre>" ;

   $resu = dbi_query("SELECT * FROM client where 1")  ;
   // $select = "SELECT * FROM `client`";
   // $resu ,= mysqli_query($conn,$select);
   while($cus = dbi_fetch_row($resu)) {
   $customerList[] = $cus['client_id'];
   }

   // print_r($customerList) ;


$query = dbi_query("SELECT * FROM `facture` WHERE date_fact BETWEEN 20240101 AND 20241231");



	// list($dataa) = dbi_fetch_row(dbi_query($query) ); 
	
		// list($data, $factures, $acompte, $attdata, $option) = unserialize($dataa) ;
	


?>




<!DOCTYPE html>
<html>

<head>

<?php include('header.php'); ?>


</head>
<body class="hold-transition sidebar-mini">



<!-- Site wrapper -->
<div class="wrapper">

<!-- TOP MENU -->





<!-- BARRE DE NAVIGATION -->


<?php include('menu.php'); ?>









 <!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
												<div class="content-header">
												  <div class="container-fluid">
													<div class="row mb-2">
																			<div  class="modal fade" id="myModal" 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="fetch" >
																					</div>

																					</div>
																				</div>
																			</div>
													</div><!-- /.row -->
												  </div>
												</div>
												<!-- /.content-header -->

    <!-- 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> Consommables sanitaires  </h3>
																	</div>
																</div>
															</div>
									<div class="card-body">



	



										<div class="onglet_dotted">
											<div style="width:100%; float:left; vertical-align:top" class="header_ray">
												<div id="tab">
													<div class="box-body">
														  <table id="example1" class="table table-bordered table-striped">
															<thead>
															<tr>
															 <th>ID chantier </th>
															 <th>Date facture </th>
															  <th>Client </th>

															  <th>DES</th>
                                                              <th>Somme</th>
															   <th>type</th>
														<!--	  <th>Quantit&#233; optimale</th>
															  <th>Différence</th>
															  <th>Commande</th>
                                <th>Cout</th>
-->

															</tr>
															</thead>
															<tbody>
														  <?php
														  $CAHT = 0 ; 
														   while ($q = dbi_fetch_row($query)) {
														// Désérialiser les données
														
													// echo "<b>Données brutes :</b><br>";
// echo "<pre>" . htmlspecialchars($q['data']) . "</pre>";

// Tentative 1 : unserialize direct
$data = @unserialize($q['data']);

if ($data === false && $q['data'] !== 'b:0;') {
    // echo "<b>Unserialize direct échoué</b><br>";

    // Tentative 2 : utf8_decode puis unserialize
    $decoded = utf8_decode($q['data']);
    $data = @unserialize($decoded);

    if ($data === false) {
        echo "<b>Unserialize après utf8_decode échoué</b><br>";

        // Tentative 3 : double unserialize ?
        $tmp = @unserialize($q['data']);
        if ($tmp !== false && is_string($tmp)) {
            $data = @unserialize($tmp);
        }
    }
}

// echo "<b>Données après unserialize :</b><br>";
// echo "<pre>";
// print_r($data);
// echo "</pre>";
 
														// Parcourir les éléments de data[0] (les lignes de facture)



$sommeeee = 0 ; 

foreach ($data as $group) {
	
	                                                        // echo "<pre>" ;
															 // print_r($group) ; 
															// echo "</pre>" ; 
	// echo "===>".int2date($q['date_fact'])."<br/>" ; 
    // if (!is_array($group)) continue;

    foreach ($group as $ligne) {
        if (!isset($ligne['id'], $ligne['des'])) continue;
        // if (trim($ligne['des']) === 'TOTAL') continue;

        $chantier_id = intval($ligne['id']);

        // Récupérer le chantier_type_id
        $reqChantier = dbi_query("
            SELECT chantier_type_id 
            FROM chantier 
            WHERE chantier_ID = $chantier_id
        ");

        if ($res = dbi_fetch_row($reqChantier)) {
            $type = '';
            switch ($res['chantier_type_id']) {
                case 1:
                    $type = 'Prestation';
                    break;
                case 2:
                    $type = 'Consommables sanitaires';
                    break;
                case 3:
                    $type = 'Frais de recouvrement';
                    break;
                default:
                    $type = 'Autre';
                    break;
            }
			
			if($res['chantier_type_id'] == 2){
				
				
			 if (trim($ligne['des']) === 'TOTAL') {
				 
            // echo "Ligne TOTAL ignorée<br>";
            continue;
        }
               list($client_nom)=dbi_fetch_row(dbi_query("SELECT client_nom FROM `client` where client_id =  ".$q['client_id']));
			   $sommeeee += $ligne['somme'];
            ?>
            <tr>
		         <td><?php echo htmlspecialchars($ligne['id']); ?></td>
                <td><?php echo htmlspecialchars($q['date_fact']); ?></td>
				<td><?php echo htmlspecialchars($client_nom); ?></td>
                <td><?php echo htmlspecialchars($ligne['des']); ?></td>
                <td><?php echo htmlspecialchars($ligne['somme']); ?></td>
                <td><?php echo htmlspecialchars($type); ?></td>
            </tr>
            <?php
			}
        }
    }
}




													}
															    
														?>


																


															 



											




															</tfoot>
														  </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>
          <!-- /.card -->
        








  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 3.0.1
    </div>
    <strong>Copyright &copy; 2019 MCPRO</strong>
  </footer>
<!-- FIN DU PIED DE PAGE -->

<!-- NE PAS TOUCHER CI-DESSOUS -->
  <!-- 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>
<!-- DataTables -->
<script src="../../plugins/datatables/jquery.dataTables.js"></script>
<script src="../../plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>






<script src="../../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="../../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="../../plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="../../plugins/jszip/jszip.min.js"></script>
<script src="../../plugins/pdfmake/pdfmake.min.js"></script>
<script src="../../plugins/pdfmake/vfs_fonts.js"></script>
<script src="../../plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="../../plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="../../plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- AdminLTE App -->
<script src="../../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../../dist/js/demo.js"></script>
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true, "lengthChange": false, "autoWidth": false, "paging": false,
      "buttons": ["copy", "csv", "excel", "pdf", "print"]
    }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
    $('#example2').DataTable({
      "paging": false,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</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>



<script src="../../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>

<script type="text/javascript">
$(document).ready(function () {
  bsCustomFileInput.init();
});
</script>

</body>
</html>

AnonSec - 2021