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 (0705) :  /home/logmcpe/www/MCPRO/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/MCPRO/facturation.php
<?php
include_once 'code/init.php';
print_header ( );

 // echo "test <br/>" ;
// exit() ;  
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';
// echo "tsto <br/>" ; 



?>
<script language="Javascript">
   function GetAnnee()
   {
		var idbursel="";
  	  annee = document.annee_form.fact_annee.value ;
	if( annee > 2000  )
	  window.location = "facturation.php?annee="+annee;
	  	else
	window.location = "facturation.php";
   }
</script>

<form id="annee_form" name="annee_form" method="POST" action="">
	<div style="float: right;" >Ann&eacute;e<select id="fact_annee" name="fact_annee" onchange="GetAnnee()";>
				<?php if(isset($annee) ) { ?>
						<option selected="selected" value="<?=$annee ?>"><?=$annee?></option>
				<?php } ?>

					<?php 
							$Reqanne=dbi_query("select  distinct YEAR(date_fact) as annee from facture ORDER BY annee DESC") or die(mysql_error());
							while($listannee=dbi_fetch_row($Reqanne)){ ?>
				<option  value="<?php echo $listannee['annee']?>"><?php echo $listannee['annee'] ?></option>
							<?php } ?>

				</select></div>
</form>


<form  name="etab_form" method="POST" action="">
	<div style="float: left;" >établissement &nbsp;&nbsp;<select  name="etab_annee" >
			
<option> Tous </option>
					<?php 
							$atab=dbi_query("SELECT * FROM `bureau` ") or die(mysql_error());
							
							while($nom_etab=dbi_fetch_row($atab)){ 
							
							?>
							
							
				
				<option  value="<?php echo $nom_etab['id_bureau']?>" <?php if($_POST['etab_annee']==$nom_etab['id_bureau']){ echo "SELECTED";} ?> ><?php echo $nom_etab['nom_agence']?></option>
							<?php } ?>

				</select></div>
				
				&nbsp;&nbsp;<input type="submit" name="valider" value="valider" >
</form>


	<div id="tab"  >
<TABLE width="95%" border="1px">
<thead>
<TR>
  <th >Nom Client</th>
  <th>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Janvier&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; </th>
  <th>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Fevrier &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</th>  
  <th>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Mar&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</th>  
  <th > &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;avril&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</th>  
  <th > &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Mai &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</th>  
  <th >&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Juin&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</th>
  <th >&nbsp; &nbsp;juillet&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</th >
  <th >&nbsp; &nbsp;Aout&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</th> 
  <th >&nbsp; &nbsp;September&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;</th> 
  <th >&nbsp; &nbsp;October&nbsp; &nbsp;</th> 
  <th >&nbsp; &nbsp;November&nbsp; &nbsp;</th>
<th >&nbsp; &nbsp;December&nbsp; &nbsp;</th>   
</TR>
</thead>
    <tbody>
<?php 
//  reqet des avoire 
if(isset($_GET['annee']) && $_GET['annee']>2000)
$YEAR_AVOIR='YEAR( date ) ='.$_GET['annee'];
else
$YEAR_AVOIR ='YEAR( date ) ='.'2017';

$avoirreq=dbi_query("SELECT * FROM `avoir` where ".$YEAR_AVOIR." and agence_id = $agence") ; 


$avoirJanvier = 0  ;  $avoirFevrier = 0 ; $avoirMars = 0 ; $avoirAvril = 0 ; $avoirMai = 0 ; $avoirJuin = 0 ; $avoirjuillet = 0 ; $avoirAout = 0 ; $avoirSeptember = 0 ; $avoirOctober = 0 ; $avoirNovember = 0 ; $avoirDecember= 0 ;

while($avoir=dbi_fetch_row($avoirreq))
{
// echo "---->".$avoir['montant']."<br/>" ; 
// echo "---->".$avoir['date']."<br/>" ; 
$moisavoir = substr($avoir['date'], 4, 2);
// echo "----> $moisavoir <br/>" ;
 
   $montantavoir = $avoir['montant']   ;
switch ($moisavoir)
{
  case  "01":
        $avoirJanvier= $avoirJanvier + $montantavoir ;
        break;
    case "02":
        $avoirFevrier= $avoirFevrier + $montantavoir ;
        break;
    case "03":
        $avoirMars= $avoirMars + $montantavoir ;
        break;
    case "04":
        $avoirAvril= $avoirAvril + $montantavoir ;
        break;
    case "05":
        $avoirMai= $avoirMai + $montantavoir ;
        break;
    case "06":
        $avoirJuin= $avoirJuin + $montantavoir ;
        break;
    case "07":
        $avoirjuillet= $avoirjuillet + $montantavoir ;
        break;
    case "08":
        $avoirAout= $avoirAout + $montantavoir ;
		// echo "ana hna <br/>" ; 
		// exit() ; 
         break;
		
    case "09":
        $avoirSeptember= $avoirSeptember + $montantavoir ;
		// echo "ana hna  9 <br/>" ; 
		
        break;
    case "10":
        $avoirOctober= $avoirOctober + $montantavoir  ;
        break;
    case "11":
        $avoirNovember= $avoirNovember + $montantavoir ;
        break;
    case "12":
        $avoirDecember= $avoirDecember + $montantavoir ;
		 // echo "  $avoirDecember <br/>" ; 
        break;
}

}




$wheroo=" " ; 
if(!empty($_POST['etab_annee']))
{
	$wheroo = " AND client_bureau = ".$_POST['etab_annee'] ; 
}
$Janvier=0 ; $Fevrier=0 ;$Mars=0;$avril=0 ;$Mai=0 ;$Juin=0 ; $juillet=0 ; $Aout=0;$September=0;$October=0;$November=0;$December=0 ; $sommeTotal=0 ; 
$client=dbi_query("select client_nom, client_id from client where agence_id=$agence ".( $_SESSION['client_actif']=='off' ? "" : "AND client_actif='0'")." AND client_prospect ='0'  $wheroo  ORDER BY client_nom ");
if(isset($_GET['annee']) && $_GET['annee']>2000)
$YEAR='AND  YEAR( date_debut ) ='.$_GET['annee'];
else
$YEAR='AND  YEAR( date_debut ) ='.'2017';

while($c=dbi_fetch_row($client)){ 
// $chantierht=$listchantier['Chantier_forfaitmensuel'] /(1+($listchantier['Chantier_TVA']/100));
// $tauxtva=$listchantier['Chantier_forfaitmensuel']-$chantierht;


      
// print_r($listchantier);e
		echo '<TR>';
		 echo '<td>'.$c['client_nom'].'</td>';
			for($i=1;$i<=12;$i++)
			{
			$mois=dbi_query('SELECT  sum( total ) as somme
            FROM client, facture
            WHERE facture.client_id = client.client_id and client.client_id='.$c['client_id'].
            ' AND MONTH( date_debut ) ='.$i.' '.$YEAR.' GROUP BY client_nom ');
			$total=dbi_fetch_row($mois);
	// echo "--------->".$c['client_id']."<br/>" ; 		
// echo "<pre>" ; 
// print_r($total) ; 
// echo "</pre>" ; 
	
			
			// echo "--->".$total['somme']."<br/>" ; 
			// if($YEAR < 2015){
				// $totalht = $total['somme'] / (1+(19.6/100));			
			// }
			// else{
				                       $totalht = $total['somme'] / (1+(20/100));
			// }	
               // echo "--->".$total['somme']."<br/>" ; 			
			echo '<td>'.number_format($totalht, 2, ",", " ").'</td>';
			switch ($i) 
			{
    case 1:
        $Janvier= $Janvier + $totalht;
        break;
    case 2:
        $Fevrier= $Fevrier + $totalht;
        break;
    case 3:
        $Mars= $Mars + $totalht;
        break;
    case 4:
        $Avril= $Avril + $totalht;
        break;
    case 5:
        $Mai= $Mai + $totalht;
        break;
    case 6:
        $Juin= $Juin + $totalht;
        break;
    case 7:
        $juillet= $juillet + $totalht;
        break;
    case 8:
        $Aout= $Aout + $totalht;
        break;
    case 9:
        $September= $September + $totalht;
        break;
    case 10:
        $October= $October + $totalht;
        break;
    case 11:
        $November= $November + $totalht;
        break;
    case 12:
        $December= $December + $totalht;
        break;
}			
			}			
		echo '</TR>';
		$sommeTotal= $Janvier + $Fevrier + $Mars + $Avril + $Mai + $Juin + $juillet + $Aout + $September + $October + $November + $December; 
		
	
	 
$client_id=$c['client_id'];

} 

		echo '<tr>';
		echo '<td>' . 'Total' . '</td>';
		for ($i = 1; $i <= 12; $i++) 
		{
		switch ($i) 
			{
    case 1:
    echo '<td>' .number_format($Janvier, 2, ',', ' '). '</td>';  
        break;
    case 2:
   echo '<td>' .number_format($Fevrier, 2, ',', ' '). '</td>';     
        break;
    case 3:
    echo '<td>' .number_format($Mars, 2, ',', ' '). '</td>';  
        break;
    case 4:
    echo '<td>' .number_format($Avril, 2, ',', ' '). '</td>';  
        break;
    case 5:
    echo '<td>' .number_format($Mai, 2, ',', ' '). '</td>';  
        break;
    case 6:
   echo '<td>' .number_format($Juin, 2, ',', ' '). '</td>';   
        break;
    case 7:
    echo '<td>' .number_format($juillet, 2, ',', ' '). '</td>';    
        break;
    case 8:
     echo '<td>' .number_format($Aout, 2, ',', ' '). '</td>';   
        break;
    case 9:
      echo '<td>' .number_format($September, 2, ',', ' '). '</td>';  
        break;
    case 10:
       echo '<td>' .number_format($October, 2, ',', ' '). '</td>'; 
        break;
    case 11:
        echo '<td>' .number_format($November, 2, ',', ' '). '</td>'; 
        break;
    case 12:
         	echo '<td>' .number_format($December, 2, ',', ' '). '</td>';  
        break;
}							
		}		
		echo '</td>';
		// echo '<td><strong>'.number_format($sommeTotal, 2, ',', ' ').'</strong></td>';
		echo '</tr>';
		echo '<tr>'; 
		     echo '<td><strong> Somme des avoirs </strong></td>';
			 echo '<td><strong> '.number_format($avoirJanvier / 1.2 , 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirFevrier / 1.2 , 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirMars / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirAvril / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirMai / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirJuin / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirjuillet / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirAout / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirSeptember / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirOctober / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirNovember / 1.2, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($avoirDecember / 1.2, 2, ',', ' ').' </strong></td>';
		echo '</tr>' ; 

		 $totalreeljan = $Janvier - $avoirJanvier / 1.2 ; 
		 $totalreelfev = $Fevrier - $avoirFevrier / 1.2 ; 
		 $totalreelmars = $Mars - $avoirMars / 1.2 ; 
		 $totalreelavril = $Avril - $avoirAvril / 1.2 ;
		 $totalreelmai =  $Mai - $avoirMai / 1.2 ; 
		 $totalreeljuin =  $Juin -  $avoirJuin / 1.2 ; 
		 $totalreeljuillet  =  $juillet - $avoirjuillet / 1.2  ;
		 $totalreelAout =  $Aout - $avoirAout / 1.2 ;
		 $totalreelSeptember = $September - $avoirSeptember / 1.2 ;
		 $totalreelOctober = $October  - $avoirOctober / 1.2 ; 
		 $totalreelNovember = $November - $avoirNovember / 1.2 ; 
		 $totalreelDecember = $December - $avoirDecember / 1.2 ; 
				echo '<tr>'; 
		     echo '<td><strong>  CA reel du mois </strong></td>';
			 echo '<td size= 34 ><strong> '.number_format($totalreeljan, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelfev, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelmars, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelavril, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelmai, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreeljuin, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreeljuillet, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelAout, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelSeptember, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelOctober, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelNovember, 2, ',', ' ').' </strong></td>';
			 echo '<td><strong> '.number_format($totalreelDecember, 2, ',', ' ').' </strong></td>';
		echo '</tr>' ; 
		
		 echo '<tr>' ; 
		 ?>
		  <td colspan="13"  align="center" > <font color=red size=5> CA   <? echo number_format($sommeTotal, 2, ',', ' ') ?></font></td>;
		  <?
		echo '</tr>' ; 
// echo $client_id.' ! '.$c['client_id'].' == ';
?>		
	</tbody>
</TABLE>
</div>
	

	<div id="tab"  >


</div>
</div>

</body></html>

AnonSec - 2021