AnonSec Team
Server IP : 10.128.40.6  /  Your IP : 216.73.216.180
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/../MC/temp/12650/../1322/../../../mcg/.github/../pages/python/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TEST/../MC/temp/12650/../1322/../../../mcg/.github/../pages/python/../stat.php
<?php 

include('tete.php');


// if(!empty($_POST))
// {
// echo "<pre>" ; 
// print_r($_POST) ; 
// echo "</pre>" ; 

// exit();
	
// }

if(empty($_POST['from']) and empty($_POST['to'])){
$_POST['annee'] = date('Y') ; 
$_POST['mois'] = date('m') ; 



$_POST['from'] =  $_POST['annee'].'-'.$_POST['mois'].'-01';
$_POST['to']  =  date('Y-m-t', strtotime($_POST['from']));
				

}
// echo "==>".$_POST['annee']."--".$_POST['mois']."<br/>" ; 
$req =dbi_query("SELECT * FROM client WHERE client_statut = '1'") ; 

while( $a= dbi_fetch_row($req)){
	$_POST['client_ids'][] = $a['client_id'] ; 
}

 ?>
<!DOCTYPE html>
<html>
<?php include('hader_stat.php'); ?>
<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-->

                 </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'); ?>

  <!-- 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"> Statistique par bureau </h3>
						</div>
						<!-- form start -->
						<form role="form" method='POST' action=''>
							<!-- /.card-header -->
							<div class="card-body" >
								<div class="row">
									

								
									<div class="col-sm-3">
									  <div class="form-group">
											<label>Du :</label>
											<input type="date" class="form-control" data-inputmask-alias="datetime" data-inputmask-inputformat="dd/mm/yyyy" data-mask name="from" placeholder="jj/mm/aaaa"  >
									  </div>
									</div>
									<div class="col-sm-3">
										<div class="form-group">
											<label>Au : </label>
										<input type="date" class="form-control" data-inputmask-alias="datetime" data-inputmask-inputformat="dd/mm/yyyy" data-mask name="to" placeholder="jj/mm/aaaa"  >
										</div>
									</div>
									
									
									
									<div class="col-sm-3">
									  <div class="form-group"><label></label>
										<button type="submit" class="btn btn-block bg-gradient-primary">Valider</button>
									  </div>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div> <!-- /.col -->
			</div><!-- /.row -->

			<?php
			
				$tot_BOULOGNE_TTC = 
							$tot_BOULOGNE_HT =  0 ;
							$tot_Marseille_TTC =  0 ; 
							$tot_Marseille_HT =  0 ; 
							$tot_Six_Fours_TTC =  0 ; 
							$tot_Six_Fours_HT =  0 ; 
			if(isset($_POST['from']) && isset($_POST['to']) && isset($_POST['client_ids'] ))
			{

				$facts =array();
				$from =  $_POST['from'] ; 
				// $_POST['annee'].'-'.$_POST['mois'].'-01';
				$to =  $_POST['to'] ; 
				// date('Y-m-t', strtotime($from));
				
				
				// echo "  oooooooo ".$from." ---- ".$to." <br/>" ; 
				
				// $from= "2024-04-01" ;
				// $to= "2024-04-10" ;
				$CLIENTIN = ' IN ( ';
				foreach ($_POST['client_ids'] as $client_id)
				{
					$CLIENTIN .= "$client_id ,";
					$client_s[] = $client_id  ;
				}
				$CLIENTIN .= ' 0 ) ';

				$pre=get_prest_sem( $CLIENTIN,$from,$to);

				$too   = dateformaint($to) ;
				$fromm  = dateformaint($from);


				$annee = $_POST['annee'];
				$mois = $_POST['mois'];
				$CATTC  = 0;
				$CAHT  = 0;
				


				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;
					$inter=array();
				
				
					$ch  = dbi_fetch_row(dbi_query("SELECT client_id,client_nom nom FROM client WHERE client_id = $client_id  "));



								$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++)
								{
									if($pre[$j]['idclient']== $client_id)
										// if( 2 == 2 )
									{
									// echo "<pre>"  ; 
									// print_r($pre) ; 
									// echo "</pre>"  ; 
									$inter[]=$pre[$j]['inter'] ;
									
									
									$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;
									$sommeht = number_format( $sommeht, 2, '.', ' ') ;
									// echo "==>".$sommeht."<br/>" ;  aaa 
									$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)) ; 
														$taux_ht = $pre[$j]['taux']/ $beta ; 
														// echo "$beta ==>".$sommeht."<br>" ; 
														$somme=(1+($chantier_TVA/100))*$sommeht;
														$somme =  number_format( $somme, 2, '.', ' ') ; 
														$sommetva=$somme-$sommeht;
														
														
														 $TOTAL+=$somme;
													// echo "$somme ==>".$j."==".$TOTAL." -- duree ".$nbh_duree."<br/>" ;
													$TOTALHT+=$sommeht;
													$TOTALTVA+=$sommetva;

													$sommepre=0;

													$HTPNE=0;
													$TAUXPNE=0;
													$TTCPNE=0;
														
													}
													
													
													
													if( $pre[$j]['type']=='ded' and $pre[$j]['deduire'] == 'non')
													{
														$beta = (1+($chantier_TVA/100)) ; 
														// echo "$beta ==>".$sommeht."<br>" ; 
														$taux_ht = $pre[$j]['taux']/ $beta ; 
														$somme=(1+($chantier_TVA/100))*$sommeht;
														$sommetva=$somme-$sommeht;
													?>
													
														<?php
													}
													
													

												
                                                            
																if( $pre[$j]['type']=='e2' and $pre[$j]['facture']=='1' )
													{

															
																$nbH = $pre[$j]['duree'] / 60 ;
																$taux = $pre[$j]['taux'] ;
																$HTPNETMP= ($nbH*$taux)/1.1;    
																$TTCPNETMP=(1+($chantier_TVA/100))*$HTPNETMP;
																$TAUXPNETMP=$TTCPNETMP-$HTPNETMP;

																$HTPNE += $HTPNETMP;
																$TTCPNE += $TTCPNETMP;
																$TAUXPNE += $TAUXPNETMP;

																$TOTAL+=$TTCPNETMP;
																$TOTALHT+=$HTPNETMP;
																$TOTALTVA+=$TAUXPNETMP;

																
													}
													
											
													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')
													{

															
												
													}
													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.' +++++++++++  <br/>';
													if($mhtded>0)
													{
														$totded=(1+($chantier_TVA/100))*$mhtded;
														$tvaded=$totded-$mhtded;
	// j'ai commenté ce code pour ne pas afficher les détailles dans la factur pdf 		// $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($TAUXPNE !=0 AND  $pre[$j]['facture']== 1)
													{
														
														$taux_ht = $pre[$j]['taux']/ $beta ; 
														
													}

             $chantier_reg = 1  ;
											
											
				              }  // fin if 
 
							}////////////////////
									

				
				
				
							$CA+=$TOTALHT;
							$CAC+=$TOTAL;
							
							list($etablissement_id) = dbi_fetch_row(dbi_query("SELECT etablissement_id FROM `client` WHERE `client_id` = ".$client_id)) ;
                            
						
							
                           if($etablissement_id == 1 ){						
							$tot_BOULOGNE_TTC  +=    $TOTAL ;
							$tot_BOULOGNE_HT  +=   $TOTALHT ; 
						   }
							
							if($etablissement_id == 2 ){
								// echo "==== ".$client_id."==== <br/>" ; 
							$tot_Marseille_TTC +=    $TOTAL ; 
							$tot_Marseille_HT +=   $TOTALHT ; 
							}
							
							if($etablissement_id == 3  ){
							$tot_Six_Fours_TTC  +=    $TOTAL ;  
							$tot_Six_Fours_HT +=   $TOTALHT ;
							}							
							
                            // echo "==>".$TOTAL."-->".$client_id."<br/>" ; 
							// echo "==>".$TOTALHT."-->".$client_id."<br/>" ; 
							$CATTC +=$TOTAL;
							$CAHT  +=$TOTALHT;
							
							
							
									
							


				}
				
				
							?>
			<div class="row">
			  <div class="col-md-12">
			   <div class="card card-outline  card-success">
					<div class="card-body">
								<div class="col-md-12">
								
									

						
			
			

			<div class="container">
    <div class="row">
        <div class="col-md-4">
            <div class="card bg-primary text-white">
                <div class="card-body">
                    <h5 class="card-title">Boulogne</h5>
                    <p class="card-text">CA TTC <?php echo $tot_BOULOGNE_TTC; ?></p>
                    <p class="card-text">CA HT <?php echo $tot_BOULOGNE_HT; ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="card bg-success text-white">
                <div class="card-body">
                    <h5 class="card-title">Marseille</h5>
                    <p class="card-text">CA TTC <?php echo $tot_Marseille_TTC; ?></p>
                    <p class="card-text">CA HT <?php echo $tot_Marseille_HT; ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="card bg-warning text-white">
                <div class="card-body">
                    <h5 class="card-title">Six Fours</h5>
                    <p class="card-text">CA TTC <?php echo $tot_Six_Fours_TTC; ?></p>
                    <p class="card-text">CA HT <?php echo $tot_Six_Fours_HT; ?></p>
                </div>
            </div>
        </div>
    </div>
</div>


	
					
										
								
							</div>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
	

			</div>
			<?php	}	?>

		
	
		
		
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  



</body>
<?php include('foter_stat.php'); ?>
</html>

AnonSec - 2021