<!doctype html>
<html><head>
<meta charset="UTF-8">
<title>Rappel</title>

	

	<link rel="stylesheet" href="textelettrefac.css" media="all" />
	<link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
	<script src="/js/jquery-2.1.0.min.js"></script>
	<script src="/js/moment.js"></script>
	<script src="/js/jquery.redirect.js"></script>
	<script src="js/jquery-ui.js"></script>
	<script src="js/jquery.ui.touch-punch.js"></script>
	
	</head>
<body onLoad="calculload()">


	<div class="gencont">
	
		<div id="logo" onclick="myFunction() "><img src= "logofac1.png" width="794"></div>	
		<div id="logo2" ><img src= "logofac3.png" width="487" height: "146"></div>
		<div id="logo3" ><img src= "logofac2.png" width="307" height: "26"></div>
	
	  <div id="company">
		<h2 class="name">Ypsoroof - Ipsotoit</h2>
        <h2 class="name2">135 rue montavaux, 7080, Frameries </h2>
        <h2 class="name2">065/793325. Entr.:BE0443870515</h2>
		  <h2 class="name2">Banque CPH IBAN:BBE75</h2>
		   <h2 class="name2">Compte: BE92 1262 1506 3723</h2>
      <!--  <div><a href="mailto:info@ypsoroof.com">info@ypsoroof.com</a></div> -->
      </div>
		 	
	
	
		<?php

		$NumeroIndexDevisP=$_POST['dnumdevis'];
		$NumeroIdxClient=$_POST['didxcli'];
	//	print "<br>".$NumeroIndexDevisP;	
	//	print "<br>".$NumeroIdxClient;	

// on se connecte à notre base pour devis

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "facture";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
	
				//	 $sql = "SELECT * FROM tete";
$sql = "SELECT * FROM tete WHERE idx=".$NumeroIndexDevisP." ";
//$sql = "SELECT * FROM tete WHERE idx=".intval($_POST['idxcli'])." ";
//print "<br>".$sql;	
			// print "<br>".$sql;	
			 
					// $sql = "UPDATE\n". "  `data`\n"." SET\n". " societe = \'testoooyeahhh\'\n". "WHERE\n". " id = 3";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
		
$NUM=$row["num"];
$IDX=$row["idx"];
$DATE=$row["date"];
$OBJETT=$row["objet"];
$IDXCLI=$row["idxcli"];
$MEMO=$row["memo"];
$ETATC=$row["etat"];		
$NumeroIdxClient=$row["idxcli"];;
$CHANTIER=$row["chantier"];
$TVA=$row["tva"];
$BANQUE=$row["banque"];
$REMARQUE=$row["remarque"];
$LETTRE=$row["lettre"];
$MONTANT=$row["montant"];

    } 
    
	
	} else {
   // echo "0 results";
}

//$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour)
//VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', //'$today')";


$conn->close();
        
        
        // on se connecte à notre base pour devis

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "devis";
   // Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}   
        $sql = "SELECT * FROM documents WHERE rappel <>'' ";
       $result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
		$LETTRE=$row["rappel"];

    } 
    
	
	} else {
   // echo "0 results";
}

//$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour)
//VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', //'$today')";


$conn->close(); 
		
		?>
	
		
<?php		
		
				
		// on se connecte aux client ******************************************
		
$SOC=" ";
$NOM1=" ";
$NOM2=" ";
$NOM3=" ";
$NOM4=" ";
$NOM5=" ";
$TITRE=" ";
$PUB=" ";
$AC1=" ";
$AC2=" ";
$O1=" ";
$O2=" ";
$O3=" ";
$MAIL=" ";
$GSM=" ";
$TEL=" ";
$SIDXCLI=" ";

// on se connecte à notre base pour client

$servername = "localhost:8889";
$username = "test";
$password = "test";
$dbname = "Clients";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
					 

$SIDXCLI = htmlentities($_POST['idxcli']);
	// print "dans la boite<br>";

    
	

					 $sql = "SELECT * FROM data";
$sql = "SELECT * FROM data WHERE id=".$NumeroIdxClient." ";
//$sql = "SELECT * FROM data WHERE id=".intval($_POST['idxcli'])." ";
//print "<br>".$sql;		
		
					// $sql = "UPDATE\n". "  `data`\n"." SET\n". " societe = \'testoooyeahhh\'\n". "WHERE\n". " id = 3";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
		
$SOC=$row["societe"];
$NOM1=$row["fac1"];
$NOM2=$row["fac2"];
$NOM3=$row["fac3"];
$NOM4=$row["fac4"];
$NOM5=$row["fac5"];
$TITRE=$row["titre"];
$PUB=$row["pub"];
$AC1=$row["ac1"];
$AC2=$row["ac2"];
$O1=$row["o1"];
$O2=$row["o2"];
$O3=$row["o3"];
$MAIL=$row["mail"];
$GSM=$row["gsm"];
$TEL=$row["tel"];
$SIDXCLI =$row["id"];
        //echo "Soc: " . $row["societe"]. " - Nom: " . $row["nom1"]. " - idx: " . $row["id"]. " " . $row["nom2"]. "<br>";
		//echo "Soc: " . $row["societe"]. " - Nom: " . $row["nom1"]. "  " . $row["nom2"]. "<br>";
    } 
    
	
	} else {
   // echo "0 results";
}

//$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour)
//VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', //'$today')";


$conn->close();
					 
		
		
		
	?>			
	
	 
        
		  <div id="client">
			
        <!--   <div class="to">CLIENT:</div> -->
            <h2 class="name"><?php echo $row["fac1"] ?></h2>
			<div class="address"><?php echo $NOM1 ?></div>
            <div class="address"><?php echo $NOM2 ?></div>
			<div class="address"><?php echo $NOM3 ?></div>
			<div class="address"><?php echo $NOM4?></div>
			<div class="address"><?php echo $NOM5?></div>
	
	
	
	
		
		   </div>
		
		 
				  
				  
						 
	<div style="clear:both"></div>
        
			 
			  <div id="invoice"><br>
                  RAPPEL de paiement
        
				 
          <div id="datestyle" class="date" style="border-bottom: 1px solid black; border-left: 4px  solid #EFD61E; max-width:300px" contenteditable="true" ><?php echo $DATE ?> </div>
		 
		</div>  
	<div style="clear:both"></div>
			
	
		
	<div style="clear:both"></div>

	
	
	
	
	
	
		<table id="table-2"  cellspacing="0" cellpadding="-1" width="794px" border="0" valign="top" style="border-collapse: collapse;" >
		
		 <tbody id="items_table">
			 
		
			 
	


		
	
	<br>
	<p></p>
  
		
</div>

		
		
		
	
	
	
	
<div id="mydiv">
  <div id="mydivheader">Outils</div>
  <p style="text-indent:0;">Memo</p>
  
	<div class='memo' contenteditable="true"><?php echo $MEMO ?> </div>
	<br>
<!--	<input type="checkbox" name="etat" value="4" ?php if ($ETATC==4) { print" checked "; }?> ></input> Brouillon<br>
	<input type="checkbox" name="efface">Efface la ligne au click<br> -->
	
	 
	
	
	 <button class="bld">B</button>
<button class="itl">I</button>
<button class="UpZ">+</button>	
<button class="SmZ">-</button>	
<button class="udr">S</button><br>

<button class="swp">Centrer</button>
	<button class="gauche">Gauche</button><br>
	<button class="juste">Justifer</button>
	<br>
	<button class="indente">Indente</button>
	<button class="outdente">outdente</button>
	
	 <p style="text-indent:0;">---</p>
		<form action="index.html">
               <input class="form-control"  type="submit" value="HOME" />
	            </form>
	
</div>

	
	
	
	
	
	</div>
	
	
		<script>
			
 $( function() {
    //$( "#mydiv" ).draggable({containment: "body"});
	     //$( "#mydiv" ).draggable({containment: "parent"});
	   //  $( "#mydiv" ).draggable();
	// $("#mydiv" ).draggable().css("position", "relative");
	 $("#mydiv" ).draggable().css("position", "fixed");
	 
	 $("#mydiv").draggable()
  .click(function() {
    $(this).draggable({ disabled: false });
}).dblclick(function() {
    $(this).draggable({ disabled: true });
});
	 
	 
  } );
	</script>	

  
	
<script type="text/javascript">   
	


			

			
 var fontSize = 3;
	 
	
	$(".UpZ").on('click',function(){
	  if (fontSize < 7){
      fontSize++;
    document.execCommand("fontSize", false, fontSize);
  var a = $(".MSE").html();
		  }

});
			$(".SmZ").on('click',function(){
	//document.execCommand('fontSize', false,  '2')
		 if (fontSize > 1) {
      fontSize--;
    document.execCommand("fontSize", false, fontSize);
  var a = $(".MSE").html();
		 					}
});
$(".bld").on('click',function(){
	document.execCommand('bold');
	
  var a = $(".MSE").html();

});

$(".itl").on('click',function(){
	document.execCommand('italic');
  var a = $(".MSE").html();
	
});
	$(".udr").on('click',function(){
	document.execCommand('underline');
  var a = $(".MSE").html();
	
});
	$(".pst").on('click',function(){
//alert( $("p:last").html() );	
		$.redirect('testpostlettrefac.php', {'dnum':<?php echo $NumeroIndexDevisP ?>,'didxcli':<?php echo $NumeroIdxClient ?>,'lettre':$("div.rest").html() });
		
	
	});
	
	
	
	
	$(".swp").on('click',function(){
	document.execCommand('justifyCenter');
  var a = $(".MSE").html();	
	});
	
	$(".gauche").on('click',function(){
	document.execCommand('justifyLeft');
  var a = $(".MSE").html();	
	});
	$(".juste").on('click',function(){
	document.execCommand('justifyFull');
  var a = $(".MSE").html();	
	});

$(".indente").on('click',function(){
	document.execCommand("indent", true, null);
  var a = $(".MSE").html();	
	});
	$(".outdente").on('click',function(){
	document.execCommand("outdent", true, null);
  var a = $(".MSE").html();	
	});
	   
	   
							
	$("div.date").dblclick(function()
 { 
 	var tempdate;
	var today = new Date();
	var dd = today.getDate();
	var mm = today.getMonth()+1; //January is 0!
	var yyyy = today.getFullYear();
	tempdate=$("div.date").html();
	//alert(tempdate);
	tempdate=tempdate.substring(17,tempdate.length);
	// set a variable
     var today = moment().format('DD/MM/YY');
	tempdate="Date: "+today+" "+tempdate;
	//alert(tempdate);
	$("div.date").html(tempdate);  
	//alert("ok");
	
  
 });
	

	function myFunction() {
    var x = document.getElementById("mydiv");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}
	
	
	</script>
	



<script>
		
		//alert("ok");

		//$( "div.rest" ).html('?php echo $REMARQUE ?>') ;	
	
	</script>	

<div class="rest" contenteditable="true">
	<style>
         .MSE1 p {
        text-align: justify;
        font-size: 20px;
        line-height: 30px;
        text-indent: 10%;
      
         }
    .MSE p {
        text-align: justify;
        font-size: 20px;
        line-height: 30px;
        text-indent: 20%;
      
         }
           .MSES p {
               margin-top: 50px;
        text-align: justify;
        font-size: 20px;
        line-height: 30px;
        text-indent: 55%;
      
         }
             .MSES2 p {
               margin-top: -65px;
        text-align: justify;
        font-size: 16px;
        line-height: 30px;
        text-indent: 55%;
      
         }
    </style>
	<?php 
	$final=" ".$NOM1.' ';
    $final2=" ".$NOM2." ".$NOM3." ".$NOM4.' ';
    $final3=" ".$AC1." ".$AC2." ";
    $final4=" ".substr($DATE, 14, 8);
    $final5=" facture N°".$NUM;
                
	$posclient = strpos($LETTRE, $final);
										 
	if ($posclient > 0) {
	$LETTRE=$LETTRE;								 
	} else { 
         $LETTRE=str_replace('/fnum/',' '.$final5,$LETTRE);
        $LETTRE=str_replace('/dte/',' '.$final4,$LETTRE);
        $LETTRE=str_replace('/cht/',' '.$final3,$LETTRE);
        $LETTRE=str_replace('/adr/',' '.$final2,$LETTRE);
        $LETTRE=str_replace('/cli/',' '.$final,$LETTRE);	
    } 
                $MONTANT=str_replace(' ','', $MONTANT);
                $MONTANT=str_replace(',','.',$MONTANT);
                $TVA=str_replace(' ','', $TVA);
                $pos = strpos($TVA, '%');
                
                $TVA = substr($TVA,$pos-4,$pos); // retourne pourcentage
                $TVA=preg_replace('/\D/', '', $TVA);
              
    $MONTANTCHIFFRE=floatval($MONTANT);
    $TVA=floatval($TVA);
                $MONTANTCHIFFRE=round($MONTANTCHIFFRE*(1+($TVA/100)),2);
             //   echo $MONTANTCHIFFRE."  ".$TVA;
    echo "<br><strong><p style='font-size:22px;margin-left:-15px;'>Concerne : facture N°".$NUM." du ".$final4.". Rappel de paiement.</p></strong><br><br>";
    echo "<div class='MSE1' style='margin-top:25px;'><P>".$TITRE." ".$final.',</p></div><br><br><br>';
    echo "<div class='MSE' ><P>Comme suite à notre facture du ".$final4.", d'un montant de total TVAC de ".number_format($MONTANTCHIFFRE, 2, ',', ' ')."€, il apparaît que la somme n'ait pas encore été créditée sur notre compte BE92 1262 1506 3723.<br><br></p>"; 
    echo"<p>Nous vous demandons de bien vouloir exécuter le paiement dans les plus brefs délais, en référence à nos conditions générales qui stipulent un paiement au grand comptant.
En vous remerciant de votre diligence, recevez nos meilleures salutations.<br></p></div>" ;
        echo"<div class='MSES' ><p>Fabbricatore F.<br></p></div>" ;
                echo "<img style='margin-left:260px;margin-top:-25px;' src='signaturerappel.png' height='250' width='400'>";
                 echo"<div class='MSES2' ><p>Resp.Compta. 0485/800300<br></p></div>" ;
                echo"<br><br><br><br><br><br><br><hr>"
	//echo $LETTRE 
    ?> 
	
	


	
	
	
	
<br>
	
</div>


</body>		

</html>
