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 167
| <?php
require('fpdf/fpdf.php');
include ("../connexion.php");
class PDF extends FPDF
{
//En-tête
function Header()
{
global $titre;
//Arial gras 15
$this->SetFont('Arial','B',8);
//Calcul de la largeur du titre et positionnement
$w=$this->GetStringWidth($titre)+6;
$this->SetX((100-$w)/2);
//Couleurs du cadre, du fond et du texte
$this->SetDrawColor(0,00,0);
$this->SetFillColor(250,250,250);
$this->SetTextColor(220,50,50);
//Epaisseur du cadre (1 mm)
$this->SetLineWidth(1);
//Titre centré
$this->Cell($w,9,$titre,1,1,'C',1);
//Saut de ligne
$this->Ln(10);
}
//Pied de page
function Footer()
{
//Positionnement à 1,5 cm du bas
$this->SetY(-15);
//Police Arial italique 8
$this->SetFont('Arial','I',8);
//Numéro de page
$this->Cell(0,10,"MJC L'Union",0,0,'C');
}
}
//Instanciation de la classe dérivée
$pdf=new PDF();
$titre='BORDEREAU DE REMISE DE CHEQUES';
//Open file
$pdf->Open();
//Disable automatic page break
$pdf->SetAutoPageBreak(true);
//Add first page
$pdf->AddPage();
//Select the Products you want to show in your PDF file
mysql_select_db($database_sql, $sql);
$query_remise = "SELECT * FROM factures WHERE factures.F_ptype = 'cheque' AND factures.F_remise = 0 ORDER BY F_date ASC LIMIT 30 ";
$remise = mysql_query($query_remise, $sql) or die(mysql_error());
$row_remise = mysql_fetch_assoc($remise);
//set initial y axis position per page
$y_axis_initial = 20;
//print column titles for the actual page
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',8);
$pdf->SetY($y_axis_initial);
$pdf->SetX(10);
$pdf->Cell(20,7,'Montant',1,0,'C',1);
$pdf->Cell(54,7,'Banque tirée',1,0,'C',1);
$pdf->Cell(54,7,'Tireur',1,0,'C',1);
$pdf->Cell(20,7,'N° du chéque',1,0,'C',1);
$pdf->Cell(20,7,'N°Facture',1,0,'C',1);
$pdf->Cell(20,7,'obs',1,0,'C',1);
//initialize counter
$i = 0;
//Set maximum rows per page
$max = 15;
//Set Row Height
$row_height = 7;
//If the current row is the last one, create new page and print column title
if ($i == $max)
{
$pdf->AddPage();
//print column titles for the current page
$pdf->SetY($y_axis_initial);
$pdf->SetX(10);
$pdf->Cell(20,7,'Montant',1,0,'C',1);
$pdf->Cell(54,7,'Banque tirée',1,0,'C',1);
$pdf->Cell(54,7,'Tireur',1,0,'C',1);
$pdf->Cell(20,7,'N° du chéque',1,0,'C',1);
$pdf->Cell(20,7,'N°Facture',1,0,'C',1);
$pdf->Cell(20,7,'obs',1,0,'C',1);
//Set $i variable to 0 (first row)
$i = 0;
}
$pdf->SetFillColor(255,255,255);
do {
$pdf->SetY($y_axis_initial+7+$i*7);
$pdf->SetX(10);
$pdf->Cell(8,7,$i+1,1,0,'C',1);
$pdf->Cell(12,7,$row_remise['F_montant'],1,0,'R',1);
$pdf->Cell(54,7,$row_remise['F_banque'],1,0,'L',1);
$pdf->Cell(54,7,$row_remise['F_tireur'],1,0,'L',1);
$pdf->Cell(20,7,$row_remise['F_ncheque'],1,0,'R',1);
$pdf->Cell(20,7,$row_remise['F_numfac'],1,0,'R',1);
$pdf->Cell(20,7,'',1,0,'R',1);
//Go to next row
$i++;
$sommeTotaux += $row_remise['F_montant'];
} while ($row_remise = mysql_fetch_assoc($remise));
$pdf->SetY($y_axis_initial+7+$i*7);
$pdf->SetX(10);
$pdf->Cell(8,10,Total,1,0,'C',1);
$pdf->Cell(12,10,$sommeTotaux,1,0,'R',1);
$i++;
$i++;
$pdf->SetY($y_axis_initial+231);
$pdf->SetX(20);
$pdf->Cell(50,30,'',1,0,'R',1);
$pdf->SetX(37);
$pdf->Write(5, "signature");
$pdf->SetX(95);
$pdf->Cell(80,30,'',1,0,'R',1);
$pdf->SetX(112);
$pdf->SetFont('Arial','B',6);
$pdf->Write(5, "RAISON SOCIALE DU REMETTANT ET RIB");
$pdf->SetY($y_axis_initial+253);
$pdf->SetX(116);
$pdf->Write(5, "MJC L'UNION MAISON POUR TOUS");
$pdf->SetY($y_axis_initial+259);
$pdf->SetX(118);
$pdf->Write(0, "xxxxx xxxxx xxxxxxxxx xxx");
//Create file
$array = array();
while ($row_remise = mysql_fetch_assoc($remise)) {
array_push ($array, $row_remise['F_id']);}
$date = date("Y-m-d");
foreach ($array as $k) {
$del = "UPDATE factures SET F_remise=1, F_date='$date' WHERE F_id='$k'";
$delete=mysql_query($del, $qsl) or die (mysql_error());
}
$pdf->Output("../factureaj/remise.pdf", "F");
?> |
Partager