1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
| <?php
require_once('../tcpdf/config/lang/eng.php');
require_once('../tcpdf/tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Amine');
$pdf->SetTitle('TCPDF Example');
$pdf->SetSubject('EXEMPLE D\'UTILISATION');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
//set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' ', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language dependent data:
$lg = Array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page';
//set some language-dependent strings
$pdf->setLanguageArray($lg);
// set font
$pdf->SetFont('aealarabiya', '', 13);
// add a page
$pdf->AddPage();
// récupérer la valeur de la variable nom du formulaire.
$imp = $_GET['imp'];
require"../core.php";
$result_ligne = mysql_query("SELECT * FROM facture WHERE id ='$imp' ");
$row_ligne = mysql_fetch_array($result_ligne);
$date = $row_ligne['date_facture'];
$type_operation =$row_ligne['type_operation'];
$client =$row_ligne['benficiaire'];
$adresse = $row_ligne['adresse'];
$total = $row_ligne['total'];
$result = mysql_query("SELECT * FROM ligne_facture WHERE facture_id ='$imp' ");
$chaine = "";
while($row = mysql_fetch_array($result)) {
$titre= $row['titre_id'];
$qte_titre =$row['qte_titre'];
$prix_unitaire_titre =$row['prix_unitaire_titre'];
$prix_total_titre =$row['prix_total_titre'];
$sql_titre = mysql_query("select * from titre where id ='$titre' " );
$row_titre = mysql_fetch_array($sql_titre);
$nom_ouvrage = $row_titre['titre_ouvrage'];
$chaine = $chaine.'
<tr>
<th>'.$nom_ouvrage.'</th>
<th >'.$qte_titre.'</th>
<th >'.$prix_unitaire_titre.'</th>
<th >'.$prix_total_titre.'</th>
</tr>
';
}
$html = '<p></p>
<p></p>
<table width="80%" height="542" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td>table width="95%" border="0" align="center" cellpadding="2" cellspacing="0" dir="rtl">
<tr><td width="19%" align="right"><strong>فاتورة رقم</strong></td>
<td width="30%">'.$imp.'</td>
<td height="13" align="center">'.$client.'</td>
</tr>
<tr>
<td height="13" align="right"><strong>الصادرة في</strong></td>
<td width="30%" height="13">'.$date.'</td>
<td height="13" align="center">'.$adresse.'</td>
</tr>
<tr>
<td height="28" align="right"><strong>نوع العملية</strong></td>
<td height="28">'.$type_operation.'</td>
<td height="28" align="center"> </td>
</tr>
</table>
<p> </p>
<table width="95%" border="1" align="center" bordercolor="#000000" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th bgcolor="#999999" scope="col"><strong>الثمن الجملي</strong></th>
<th bgcolor="#999999" scope="col"><strong>الثمن الفردي</strong></th>
<th bgcolor="#999999" scope="col"><strong>الكمية</strong></th>
<th bgcolor="#999999" scope="col"><strong>العنوان</strong></th>
</tr>
</thead>
<tbody>
<tr>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
<table width="95%" border="0" align="center" cellpadding="2">
<tr>
<td width="78%" align="right"> </td>
<td width="22%" align="right" bgcolor="#999999"><strong>المبلغ الجملي للفاتورة</strong></td>
</tr>
</table>
<p> </p>
<p> </p>
<table width="95%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td colspan="3"><hr /></td>
</tr>
<tr>
<td width="37%" align="left"><span dir="ltr">(216) 71 848 300 الهاتف </span><br />
<span dir="ltr">(216) 71 788 194 الفاكس<br />
<a href="http://info@ena.nat.tn">info</a></span><a href="http://info@ena.nat.tn">@ena.nat.tn</a></td>
<td width="38%" align="right"> </td>
<td width="25%" align="right"><pre>المدرسة الوطنية للإدارة
24 ، شارع الدكتور كلمات
</pre></td>
</tr>
</table>
<p> </p></td>
</tr>
</table>
';
// output the HTML content
$pdf->writeHTML($html, true, 0, true, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example.pdf', 'I');
//============================================================+
// END OF FILE
//==============================================
?> |
Partager