403Webshell
Server IP : 167.99.254.82  /  Your IP : 216.73.216.231
Web Server : Apache
System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64
User : pawluxera ( 1011)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/factures/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/factures/public_html/Detail-Contrat.php
<?php
session_start();
if (!isset($_SESSION['compte_user']))
{
header('Location: erreur_surfing.html');
exit();
}
if (!isset($_SESSION['r_contrat']))
{
header('Location: Factures.php');
exit();
}
$link = mysqli_connect("localhost",  "advery", "EoM6IJlnirGIfcu","factures") or die("Impossible de se connecter : " . mysqli_error());
$reponse = "select * from comptes_user where id_clt = $_SESSION[compte_user] ;";
$exec =mysqli_query($link,$reponse);
$row = mysqli_fetch_assoc($exec);

if ($row['pic_user'] == 'Vide')
	$pic = 'images/user_male.png';
else
	$pic = $row['pic_user'];
?>
<!doctype html>
<html lang="fr">
<meta http-equiv="content-type" content="text/html;charset=windows-1251" />
<head>
    <meta charset="utf-8">
    <title> ADVERY | Detail Contrat</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     
    <meta name="author" content="YOSRY MLIKA">
    <meta name="description" content="ADVERY - Espace ADMIN">
    <link rel="shortcut icon" href="images/logo-xs.png" type="image/png">
	<link href="css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css">
    <link href="css/datatables/dataTables.colReorder.min.css" rel="stylesheet" type="text/css">
    <link href="css/overlay-effects/overlay-effects.css" rel="stylesheet" type="text/css">
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="css/dripicons.min.css" rel="stylesheet" type="text/css">
    <link href="css/animate/animate.css" rel="stylesheet" type="text/css">
    <link href="css/hover/hover-min.css" rel="stylesheet" type="text/css">
    <link href="css/styles.css" rel="stylesheet" type="text/css">
</head>

<body>

      
<?php 
unset($_SESSION['r_facture']);//Facture
//detail contrat
$repct = "select * from contrat where ref_contrat = '$_SESSION[r_contrat]';";
$exect = mysqli_query($link,$repct);
$numct = mysqli_fetch_assoc($exect);
$_SESSION['r_facture'] = $numct['refe_facture'];
//Selection facture
$repd = "select * from factures where ref_facture = '$_SESSION[r_facture]';";
$execd = mysqli_query($link,$repd);
$numd = mysqli_fetch_assoc($execd); 
//selection client
$reponsecl = "select * from comptes_user where id_clt = $numd[ref_client] ;";
$execl = mysqli_query($link,$reponsecl);
$rowcl = mysqli_fetch_assoc($execl); ?>
			
<!--Verif source facture -->
<?php if($numd['refe_devis'] == 'BLs') { // source = bl ?>
<div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            
							<!--Detail devis -->
							<div class="row">
								<div class="col-md-7 col-sm-8 col-xs-8"><img class="img-responsive" src="images/logo-xs.png" alt="Logo"></div>
                                <div class="col-md-5 col-sm-4 col-xs-4">
                                    <br><br><h3 class="margin-top-0">CONTRAT</h3>
                                    <ul class="list-unstyled">
                                        <li><strong>Date:</strong> <?php echo $numct['date_contrat']; ?></li>
                                    </ul>
                                </div>
								
                            </div>
							<div class="well">
                                <div class="row">
                                    <div class="col-xs-8">
                                        <h5>Advery the Ad Agency</h5>
                                        <address>
												<strong>Services Informatiques</strong><br>
												<strong>MF : 1834604S/A/M/000</strong><br>
												Rue Yasser aarafet IM MEHDI Sahloul<br>
											4054 Sousse<br>
												<abbr>Tel:</abbr> (+216) 25 667 034
											</address>
                                    </div>
                                    <div class="col-xs-4">
                                        <h5><?php echo $rowcl['nom']; ?></h5>
                                        <address>
												<strong><?php if ($rowcl['type_user'] == 'Client Pro') echo 'MF : '; else echo 'CIN : '; echo $rowcl['identificateur_client']; ?></strong><br>
												<?php echo $rowcl['adresse']; ?><br>
												<?php echo $rowcl['loclite']; ?> - <?php echo $rowcl['code_postal']; ?><br>
												<abbr>Tel:</abbr> <?php echo $rowcl['gsm']; ?>
											</address>
                                    </div>
                                </div>
                            </div>
							
							<!-- tableau -->
							<div class="table-responsive">
                                <table class="table table-striped table-horizontal-bordered">
                                    <thead>
                                        <tr>
                                            <th>&nbsp;</th>
                                            <th><strong>D&eacute;signation</strong></th>
                                            <th><strong>Quantit&eacute;</strong></th>
                                            <th><strong>TTVA %</strong></th>
                                            <th><strong>PRIX HT</strong></th>
                                            <th><strong>Remise %</strong></th>
                                            <th><strong>Total HT</strong></th>
                                        </tr>
                                    </thead>
                                    <tbody>
									<?php $cpt = 1;$assiette = 0; $total_tva = 0; $total_ht = 0; $total_ttc = 1000;
										$recfac = "select * from bl_facture where refe_facture = '$_SESSION[r_facture]' ";
										$execfac = mysqli_query($link,$recfac);
										while ($numfac = mysqli_fetch_assoc($execfac)) {
										$reasa = "select * from detail_bl where ref_bl = '$numfac[refe_bl]' order by (id_detail)";
										$exasa = mysqli_query($link,$reasa);
										
										while ($rowasa = mysqli_fetch_assoc($exasa)) { 
										$reasapp = "select * from article_service where id_art_serv = $rowasa[ref_as];";
										$exasapp = mysqli_query($link,$reasapp);
										$rowasapp = mysqli_fetch_assoc($exasapp); ?>
                                        <tr>
                                            <td><span class="circle-nums"><?php echo $cpt; ?></span></td>
                                            <td width="40%">
                                                <h5 class="margin-0"><?php echo $rowasapp['libelle_as'].' [ '.$numfac['refe_bl'].' ] '; ?> </h5>
                                                <small><?php echo $rowasapp['desc_as']; ?></small>
                                            </td>
                                            <td><?php echo $rowasa['qte']; ?></td>
                                            <td><?php echo $rowasapp['valeur_tva']; ?></td>
                                            <td><?php /*echo $rowasapp['prix_ht'];*/
												$affiche = $rowasa['prix_ht'];
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;
												 ?> 
											</td>
                                            <td><?php echo $rowasa['remise']; ?></td>
                                            <td><?php $remise = $rowasa['remise']; $prix = $rowasa['prix_ht'] ; $tva = $rowasapp['valeur_tva'] ; 
											$val_remise = round(( $remise * $prix ) / 100);  $val_tva = round(($tva*  ($prix - $val_remise ) )/100);
											$qte = $rowasa['qte'] ; $thtva_produits = ($prix - $val_remise )* $qte; $ttva_produits = $val_tva * $qte;
											$total_ht += $thtva_produits; $total_tva += $ttva_produits;
											$total_ttc = 1000 + $total_ht + $total_tva;
											if ( $tva != 0 )
												$assiette += $thtva_produits;;
											$affiche = $thtva_produits;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
										<?php $cpt ++; } ?>
										<?php } ?>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td class="noborders" colspan="3" rowspan="5">&nbsp;</td>
                                            <td colspan="2">Assiette</td>
                                            <td colspan="2" align="right"><?php  
											$affiche = $assiette;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">Total HT</td>
                                            <td colspan="2" align="right"><?php $affiche = $total_ht;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?>
												</td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">TVA</td>
                                            <td colspan="2" align="right"><?php  
											$affiche = $total_tva;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
										<tr>
                                            <td colspan="2">Timbre</td>
                                            <td colspan="2" align="right">1,000</td>
                                        </tr>
										<tr>
                                            <td colspan="2"><strong>Net &Agrave; Payer</strong></td>
                                            <td colspan="2" align="right"><strong><?php $affiche = $total_ttc;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?>
												</strong></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div><br><!-- Fin Tableau -->
							
<?php
function chifre_en_lettre($montant, $devise1='', $devise2='')
{
    if(empty($devise1)) $dev1=' ';
    else $dev1=$devise1;
    if(empty($devise2)) $dev2='Millimes';
    else $dev2=$devise2;
    $valeur_entiere=intval($montant);
    $valeur_decimal=intval(round($montant-intval($montant), 2)*100);
    $dix_c=intval($valeur_decimal%100/10);
    $cent_c=intval($valeur_decimal%1000/100);
    $unite[1]=$valeur_entiere%10;
    $dix[1]=intval($valeur_entiere%100/10);
    $cent[1]=intval($valeur_entiere%1000/100);
    $unite[2]=intval($valeur_entiere%10000/1000);
    $dix[2]=intval($valeur_entiere%100000/10000);
    $cent[2]=intval($valeur_entiere%1000000/100000);
    $unite[3]=intval($valeur_entiere%10000000/1000000);
    $dix[3]=intval($valeur_entiere%100000000/10000000);
    $cent[3]=intval($valeur_entiere%1000000000/100000000);
    $chif=array('', 'Un', 'Deux', 'Trois', 'Quatre', 'Cinq', 'Six', 'Sept', 'Huit', 'Neuf', 'Dix', 'Onze', 'Douze', 'Treize', 'Quatorze', 'Quinze', 'Seize', 'Dix sept', 'Dix huit', 'Dix neuf');
        $secon_c='';
        $trio_c='';
    for($i=1; $i<=3; $i++){
        $prim[$i]='';
        $secon[$i]='';
        $trio[$i]='';
        if($dix[$i]==0){
            $secon[$i]='';
            $prim[$i]=$chif[$unite[$i]];
        }
        else if($dix[$i]==1){
            $secon[$i]='';
            $prim[$i]=$chif[($unite[$i]+10)];
        }
        else if($dix[$i]==2){
            if($unite[$i]==1){
            $secon[$i]='Vingt et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Vingt';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==3){
            if($unite[$i]==1){
            $secon[$i]='Trente et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Trente';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==4){
            if($unite[$i]==1){
            $secon[$i]='Quarante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Quarante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==5){
            if($unite[$i]==1){
            $secon[$i]='Cinquante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Cinquante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==6){
            if($unite[$i]==1){
            $secon[$i]='Soixante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Soixante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==7){
            if($unite[$i]==1){
            $secon[$i]='Soixante et';
            $prim[$i]=$chif[$unite[$i]+10];
            }
            else {
            $secon[$i]='Soixante';
            $prim[$i]=$chif[$unite[$i]+10];
            }
        }
        else if($dix[$i]==8){
            if($unite[$i]==1){
            $secon[$i]='Quatre-vingts et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Quatre-vingt';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==9){
            if($unite[$i]==1){
            $secon[$i]='Quatre-vingts et';
            $prim[$i]=$chif[$unite[$i]+10];
            }
            else {
            $secon[$i]='Quatre-vingts';
            $prim[$i]=$chif[$unite[$i]+10];
            }
        }
        if($cent[$i]==1) $trio[$i]='Cent';
        else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' Cents';
    }
     
     
$chif2=array('', 'Dix', 'Vingt', 'Trente', 'Quarante', 'Cinquante', 'Soixante', 'Soixante-dix', 'Quatre-vingts', 'Quatre-vingts dix');
    $secon_c=$chif2[$dix_c];
    if($cent_c==1) $trio_c='Cent';
    else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' Cents';
     
    if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
        echo $trio[3]. '  ' .$secon[3]. ' ' . $prim[3]. ' Mille ';
    else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
        echo $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' Milles ';
    else
        echo $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
     
    if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
        echo ' mille ';
    else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
        echo $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' Dinars , ';
    else
        echo $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
     
    echo $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
     
    echo ' '. $dev1 .' ' ;
     
    if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
        echo ' ';
    else
        echo $trio_c. ' ' .$secon_c. ' ' . $dev2;
}

?>
							<h5>Arr&eacute;ter le pr&eacute;sent &agrave; la somme de : <?php echo chifre_en_lettre($total_ttc) ; if ( $aff2 != '000' ) echo 'Millimes';?></h5>
                            <h4>Merci pour votre confiance</h4>
							<?php $demi_ttc = round($total_ttc / 2);
							$affiche_demi = $demi_ttc;
							$laff_demi = strlen($affiche_demi); 
							if ( $laff_demi>=3 )
							{
								if ( $laff_demi == 3)
									$affiche_demi = '0,'.$affiche_demi;
								else
								{
									$diff_demi = $laff_demi - 3; 
									$aff1_demi = substr($affiche_demi,-$laff_demi,$diff_demi);
									$aff2_demi = substr($affiche_demi,-3);
									$affiche_demi = $aff1_demi.','.$aff2_demi;
								}
							}
							?>
							<hr><strong>YOSRY CODING</strong> percevra <strong><?php echo $affiche ;?> (<?php echo chifre_en_lettre($total_ttc) ; if ( $aff2 != '000' ) echo 'Millimes';?> ) </strong> &agrave; titre d&rsquo;honoraires des prestations ci dessus mentionn&eacute;es d&rsquo;o&ugrave; 50% <strong><?php echo $affiche_demi ;?> (<?php echo chifre_en_lettre($demi_ttc) ; if ( $aff2_demi != '000' ) echo 'Millimes';?> ) </strong> au signatures du pr&eacute;sent, et 50% <strong><?php echo $affiche_demi ;?> (<?php echo chifre_en_lettre($demi_ttc) ; if ( $aff2_demi != '000' ) echo 'Millimes';?> ) </strong> au J-1 du jour de la livraison / ach&egrave;vement des totalit&eacute;s des prestations.
							<!-- Fin detail devis -->
                        </div>
                    </div>
                </div>
            </div>
<?php } else { //Source = facture ou devis ?>
<div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        
                            
							<!--Detail devis -->
							<div class="row">
								<div class="col-md-7 col-sm-8 col-xs-8"><img class="img-responsive" src="images/logo-xs.png" alt="Logo"></div>
                                <div class="col-md-5 col-sm-4 col-xs-4">
                                    <br><br><h3 class="margin-top-0">CONTRAT</h3>
                                    <ul class="list-unstyled">
                                        <li><strong>Date:</strong> <?php echo $numct['date_contrat']; ?></li>
                                    </ul>
                                </div>
								
                            </div>
							<div class="well">
                                <div class="row">
                                    <div class="col-xs-8">
                                        <h5>Advery the Ad Agency</h5>
                                        <address>
												<strong>Services Informatiques</strong><br>
												<strong>MF : 1834604S/A/M/000</strong><br>
												Rue Yasser aarafet IM MEHDI Sahloul<br>
											4054 Sousse<br>
												<abbr>Tel:</abbr> (+216) 25 667 034
											</address>
                                    </div>
                                    <div class="col-xs-4">
                                        <h5><?php echo $rowcl['nom']; ?></h5>
                                        <address>
												<strong><?php if ($rowcl['type_user'] == 'Client Pro') echo 'MF : '; else echo 'CIN : '; echo $rowcl['identificateur_client']; ?></strong><br>
												<?php echo $rowcl['adresse']; ?><br>
												<?php echo $rowcl['loclite']; ?> - <?php echo $rowcl['code_postal']; ?><br>
												<abbr>Tel:</abbr> <?php echo $rowcl['gsm']; ?>
											</address>
                                    </div>
                                </div>
                            </div>
							<?php 
							if ($numd['refe_devis'] == '0')
								$redet = "select count(*) from detail_devis where ref_devis = '$_SESSION[r_facture]';";
							else
								$redet = "select count(*) from detail_devis where ref_devis = '$numd[refe_devis]';";
							$exedt = mysqli_query($link,$redet);
							$numdt = mysqli_fetch_row($exedt); 
							if ( $numdt['0'] != 0 ) {?>
							<!-- tableau -->
							<div class="table-responsive">
                                <table class="table table-striped table-horizontal-bordered">
                                    <thead>
                                        <tr>
                                            <th>&nbsp;</th>
                                            <th><strong>D&eacute;signation</strong></th>
                                            <th><strong>Quantit&eacute;</strong></th>
                                            <th><strong>TTVA %</strong></th>
                                            <th><strong>PRIX HT</strong></th>
                                            <th><strong>Remise %</strong></th>
                                            <th><strong>Total HT</strong></th>
                                        </tr>
                                    </thead>
                                    <tbody>
									<?php $cpt = 1;
										if ($numd['refe_devis'] == '0')
											$reasa = "select * from detail_devis where ref_devis = '$_SESSION[r_facture]' order by (id_detail)";
										else
											$reasa = "select * from detail_devis where ref_devis = '$numd[refe_devis]' order by (id_detail)";
										$exasa = mysqli_query($link,$reasa);
										$assiette = 0; $total_tva = 0; $total_ht = 0; $total_ttc = 1000;
										while ($rowasa = mysqli_fetch_assoc($exasa)) { 
										$reasapp = "select * from article_service where id_art_serv = $rowasa[ref_as];";
										$exasapp = mysqli_query($link,$reasapp);
										$rowasapp = mysqli_fetch_assoc($exasapp); ?>
                                        <tr>
                                            <td><span class="circle-nums"><?php echo $cpt; ?></span></td>
                                            <td width="40%">
                                                <h5 class="margin-0"><?php echo $rowasapp['libelle_as']; ?> </h5>
                                                <small><?php echo $rowasapp['desc_as']; ?></small>
                                            </td>
                                            <td><?php echo $rowasa['qte']; ?></td>
                                            <td><?php echo $rowasapp['valeur_tva']; ?></td>
                                            <td><?php /*echo $rowasapp['prix_ht'];*/
												$affiche = $rowasapp['prix_ht'];
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;
												 ?> 
											</td>
                                            <td><?php echo $rowasa['remise']; ?></td>
                                            <td><?php $remise = $rowasa['remise']; $prix = $rowasapp['prix_ht'] ; $tva = $rowasapp['valeur_tva'] ; 
											$val_remise = round(( $remise * $prix ) / 100);  $val_tva = round(($tva*  ($prix - $val_remise ) )/100);
											$qte = $rowasa['qte'] ; $thtva_produits = ($prix - $val_remise )* $qte; $ttva_produits = $val_tva * $qte;
											$total_ht += $thtva_produits; $total_tva += $ttva_produits;
											$total_ttc = 1000 + $total_ht + $total_tva;
											if ( $tva != 0 )
												$assiette += $thtva_produits;;
											$affiche = $thtva_produits;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
										<?php $cpt ++; } ?>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td class="noborders" colspan="3" rowspan="5">&nbsp;</td>
                                            <td colspan="2">Assiette</td>
                                            <td colspan="2" align="right"><?php  
											$affiche = $assiette;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">Total HT</td>
                                            <td colspan="2" align="right"><?php $affiche = $total_ht;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?>
												</td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">TVA</td>
                                            <td colspan="2" align="right"><?php  
											$affiche = $total_tva;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?></td>
                                        </tr>
										<tr>
                                            <td colspan="2">Timbre</td>
                                            <td colspan="2" align="right">1,000</td>
                                        </tr>
										<tr>
                                            <td colspan="2"><strong>Net &Agrave; Payer</strong></td>
                                            <td colspan="2" align="right"><strong><?php $affiche = $total_ttc;
												$laff = strlen($affiche); 
												if ( $laff>=3 )
												{
													if ( $laff == 3)
														$affiche = '0,'.$affiche;
													else
													{
														$diff = $laff - 3; 
														$aff1 = substr($affiche,-$laff,$diff);
														$aff2 = substr($affiche,-3);
														$affiche = $aff1.','.$aff2;
													}
												}
												echo $affiche;?>
												</strong></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div><br><!-- Fin Tableau -->
							
<?php
function chifre_en_lettre($montant, $devise1='', $devise2='')
{
    if(empty($devise1)) $dev1=' ';
    else $dev1=$devise1;
    if(empty($devise2)) $dev2='Millimes';
    else $dev2=$devise2;
    $valeur_entiere=intval($montant);
    $valeur_decimal=intval(round($montant-intval($montant), 2)*100);
    $dix_c=intval($valeur_decimal%100/10);
    $cent_c=intval($valeur_decimal%1000/100);
    $unite[1]=$valeur_entiere%10;
    $dix[1]=intval($valeur_entiere%100/10);
    $cent[1]=intval($valeur_entiere%1000/100);
    $unite[2]=intval($valeur_entiere%10000/1000);
    $dix[2]=intval($valeur_entiere%100000/10000);
    $cent[2]=intval($valeur_entiere%1000000/100000);
    $unite[3]=intval($valeur_entiere%10000000/1000000);
    $dix[3]=intval($valeur_entiere%100000000/10000000);
    $cent[3]=intval($valeur_entiere%1000000000/100000000);
    $chif=array('', 'Un', 'Deux', 'Trois', 'Quatre', 'Cinq', 'Six', 'Sept', 'Huit', 'Neuf', 'Dix', 'Onze', 'Douze', 'Treize', 'Quatorze', 'Quinze', 'Seize', 'Dix sept', 'Dix huit', 'Dix neuf');
        $secon_c='';
        $trio_c='';
    for($i=1; $i<=3; $i++){
        $prim[$i]='';
        $secon[$i]='';
        $trio[$i]='';
        if($dix[$i]==0){
            $secon[$i]='';
            $prim[$i]=$chif[$unite[$i]];
        }
        else if($dix[$i]==1){
            $secon[$i]='';
            $prim[$i]=$chif[($unite[$i]+10)];
        }
        else if($dix[$i]==2){
            if($unite[$i]==1){
            $secon[$i]='Vingt et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Vingt';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==3){
            if($unite[$i]==1){
            $secon[$i]='Trente et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Trente';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==4){
            if($unite[$i]==1){
            $secon[$i]='Quarante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Quarante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==5){
            if($unite[$i]==1){
            $secon[$i]='Cinquante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Cinquante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==6){
            if($unite[$i]==1){
            $secon[$i]='Soixante et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Soixante';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==7){
            if($unite[$i]==1){
            $secon[$i]='Soixante et';
            $prim[$i]=$chif[$unite[$i]+10];
            }
            else {
            $secon[$i]='Soixante';
            $prim[$i]=$chif[$unite[$i]+10];
            }
        }
        else if($dix[$i]==8){
            if($unite[$i]==1){
            $secon[$i]='Quatre-vingts et';
            $prim[$i]=$chif[$unite[$i]];
            }
            else {
            $secon[$i]='Quatre-vingt';
            $prim[$i]=$chif[$unite[$i]];
            }
        }
        else if($dix[$i]==9){
            if($unite[$i]==1){
            $secon[$i]='Quatre-vingts et';
            $prim[$i]=$chif[$unite[$i]+10];
            }
            else {
            $secon[$i]='Quatre-vingts';
            $prim[$i]=$chif[$unite[$i]+10];
            }
        }
        if($cent[$i]==1) $trio[$i]='Cent';
        else if($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' Cents';
    }
     
     
$chif2=array('', 'Dix', 'Vingt', 'Trente', 'Quarante', 'Cinquante', 'Soixante', 'Soixante-dix', 'Quatre-vingts', 'Quatre-vingts dix');
    $secon_c=$chif2[$dix_c];
    if($cent_c==1) $trio_c='Cent';
    else if($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' Cents';
     
    if(($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1))
        echo $trio[3]. '  ' .$secon[3]. ' ' . $prim[3]. ' Mille ';
    else if(($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!=''))
        echo $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' Milles ';
    else
        echo $trio[3]. ' ' .$secon[3]. ' ' . $prim[3];
     
    if(($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1))
        echo ' mille ';
    else if(($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!=''))
        echo $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' Dinars , ';
    else
        echo $trio[2]. ' ' .$secon[2]. ' ' . $prim[2];
     
    echo $trio[1]. ' ' .$secon[1]. ' ' . $prim[1];
     
    echo ' '. $dev1 .' ' ;
     
    if(($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c==''))
        echo ' ';
    else
        echo $trio_c. ' ' .$secon_c. ' ' . $dev2;
}

?>
							<h5>Arr&eacute;ter le pr&eacute;sent &agrave; la somme de : <?php echo chifre_en_lettre($total_ttc) ; if ( $aff2 != '000' ) echo 'Millimes';?></h5>
                            <h4>Merci pour votre confiance</h4>
							<?php $demi_ttc = round($total_ttc / 2);
							$affiche_demi = $demi_ttc;
							$laff_demi = strlen($affiche_demi); 
							if ( $laff_demi>=3 )
							{
								if ( $laff_demi == 3)
									$affiche_demi = '0,'.$affiche_demi;
								else
								{
									$diff_demi = $laff_demi - 3; 
									$aff1_demi = substr($affiche_demi,-$laff_demi,$diff_demi);
									$aff2_demi = substr($affiche_demi,-3);
									$affiche_demi = $aff1_demi.','.$aff2_demi;
								}
							}
							?>
							<hr><strong>YOSRY CODING</strong> percevra <strong><?php echo $affiche ;?> (<?php echo chifre_en_lettre($total_ttc) ; if ( $aff2 != '000' ) echo 'Millimes';?> ) </strong> &agrave; titre d&rsquo;honoraires des prestations ci dessus mentionn&eacute;es d&rsquo;o&ugrave; 50% <strong><?php echo $affiche_demi ;?> (<?php echo chifre_en_lettre($demi_ttc) ; if ( $aff2_demi != '000' ) echo 'Millimes';?> ) </strong> au signatures du pr&eacute;sent, et 50% <strong><?php echo $affiche_demi ;?> (<?php echo chifre_en_lettre($demi_ttc) ; if ( $aff2_demi != '000' ) echo 'Millimes';?> ) </strong> au J-1 du jour de la livraison / ach&egrave;vement des totalit&eacute;s des prestations.
                            <?php }
							else { ?>
								<h4 style="color:#CC3300">Aucun Article / Service Ajout&eacute; &agrave; cette Facture!</h4>
							<?php } ?>
							<!-- Fin detail devis -->
                        </div>
                </div>
            </div>
<?php } ?>




	
    <script type="text/javascript" src="js/vendors/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="js/vendors/jquery/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/vendors/bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/vendors/oakenwidgets/jquery.oakenwidgets.min.js"></script>
    <script type="text/javascript" src="js/vendors/metismenu/metisMenu.min.js"></script>
    <script type="text/javascript" src="js/vendors/sparkline/jquery.sparkline.min.js"></script>
    <script type="text/javascript" src="js/vendors/bootstrap-modal-animation/animation.js"></script>
    <script type="text/javascript" src="js/vendors/moment/moment.min.js"></script>

    <script type="text/javascript" src="js/vendors/vmap/jquery.vmap.min.js"></script>
    <script type="text/javascript" src="js/vendors/vmap/jquery.vmap.sampledata.js"></script>
    <script type="text/javascript" src="js/vendors/vmap/jquery.vmap.world.js"></script>
    <script type="text/javascript" src="js/vendors/vmap/vmap-samples.js"></script>

    <script type="text/javascript" src="js/vendors/flotchart/jquery.flot.min.js"></script>
    <script type="text/javascript" src="js/vendors/flotchart/jquery.flot.resize.min.js"></script>
    <script type="text/javascript" src="js/vendors/flotchart/jquery.flot-tooltip.js"></script>
    <script type="text/javascript" src="js/vendors/flotchart/flotchart-examples.js"></script>

    <script type="text/javascript" src="js/vendors/sparkline/sparklines-examples.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
    <script type="text/javascript" src="js/vendors/chartjs/Chart.min.js"></script>
    <script type="text/javascript" src="js/vendors/chartjs/chartjs-examples.js"></script>
	<script type="text/javascript" src="js/vendors/datatables/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="js/vendors/datatables/dataTables.bootstrap.js"></script>
    <script type="text/javascript" src="js/vendors/datatables/dataTables.colReorder.min.js"></script>
    <script type="text/javascript" src="js/vendors/datatables/datatables-examples.js"></script>
    
</body>


</html>

Youez - 2016 - github.com/yon3zu
LinuXploit