Suppression des accs la base de donnes depuis le fichier
This commit is contained in:
parent
05143aed0b
commit
710331b17f
@ -38,22 +38,19 @@ class BordereauChequeBlochet
|
||||
{
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db handler accès base de donnée
|
||||
*/
|
||||
function BordereauChequeBlochet($db=0)
|
||||
function BordereauChequeBlochet()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
|
||||
$this->db = $db;
|
||||
$this->description = $langs->transnoentities("CheckReceipt");
|
||||
|
||||
$this->tab_top = 30;
|
||||
$this->tab_top = 60;
|
||||
|
||||
$this->line_height = 5;
|
||||
$this->line_per_page = 25;
|
||||
$this->tab_height = 230; //$this->line_height * $this->line_per_page;
|
||||
|
||||
$this->tab_height = 200; //$this->line_height * $this->line_per_page;
|
||||
}
|
||||
/**
|
||||
\brief Generate Header
|
||||
@ -66,53 +63,49 @@ class BordereauChequeBlochet
|
||||
global $langs;
|
||||
|
||||
$title = $this->description;
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(11, 10, $title);
|
||||
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->Text(91, 10, $langs->transnoentities("Numero")." : ".$page);
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(91, 10, $langs->transnoentities("Numero")." : ".$this->number);
|
||||
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(11, 16, $langs->transnoentities("Date")." : ".dolibarr_print_date(time(),"%d %b %Y"));
|
||||
|
||||
$pdf->SetFont('Arial','',12);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(91, 16, $langs->transnoentities("Page")." : ".$page);
|
||||
|
||||
|
||||
$pdf->SetFont('Arial','',12);
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(11,$this->tab_top + 6,'Date');
|
||||
|
||||
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(42, $this->tab_top + 6, $langs->transnoentities("Bank"));
|
||||
|
||||
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(82, $this->tab_top + 6, $langs->transnoentities("Invoice"));
|
||||
$pdf->Text(82, $this->tab_top + 6, $langs->transnoentities("CheckTransmitter"));
|
||||
|
||||
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(122, $this->tab_top + 6, $langs->transnoentities("AmountInvoice"));
|
||||
$pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10);
|
||||
|
||||
|
||||
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->SetXY (180, $this->tab_top);
|
||||
$pdf->MultiCell(20, 10, $langs->transnoentities("Amount"), 0, 'R');
|
||||
|
||||
$pdf->SetXY (160, $this->tab_top);
|
||||
$pdf->MultiCell(40, 10, $langs->transnoentities("AmountPayment"), 0, 'R');
|
||||
|
||||
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
|
||||
$pdf->line(9, $this->tab_top + 10, 201, $this->tab_top + 10 );
|
||||
|
||||
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
|
||||
}
|
||||
|
||||
|
||||
function Body(&$pdf, $page, $lines)
|
||||
function Body(&$pdf, $page)
|
||||
{
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$oldprowid = 0;
|
||||
$pdf->SetFillColor(220,220,220);
|
||||
$yp = 0;
|
||||
for ($j = 0 ; $j < sizeof($lines) ; $j++)
|
||||
for ($j = 0 ; $j < sizeof($this->lines) ; $j++)
|
||||
{
|
||||
$i = $j;
|
||||
if ($oldprowid <> $lines[$j][7])
|
||||
if ($oldprowid <> $this->lines[$j][7])
|
||||
{
|
||||
if ($yp > 200)
|
||||
{
|
||||
@ -125,32 +118,32 @@ class BordereauChequeBlochet
|
||||
|
||||
|
||||
$pdf->SetXY (10, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(30, $this->line_height, $lines[$j][0], 0, 'J', 1);
|
||||
$pdf->MultiCell(30, $this->line_height, $this->lines[$j][0], 0, 'J', 1);
|
||||
|
||||
$pdf->SetXY (40, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(80, $this->line_height, $lines[$j][1].' '.$lines[$j][3], 0, 'J', 1);
|
||||
$pdf->MultiCell(80, $this->line_height, $this->lines[$j][1].' '.$this->lines[$j][3], 0, 'J', 1);
|
||||
|
||||
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1);
|
||||
|
||||
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1);
|
||||
$pdf->MultiCell(40, $this->line_height, $this->lines[$j][4], 0, 'R', 1);
|
||||
$yp = $yp + 5;
|
||||
}
|
||||
|
||||
$pdf->SetXY (80, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0);
|
||||
$pdf->MultiCell(40, $this->line_height, $this->lines[$j][0], 0, 'J', 0);
|
||||
|
||||
$pdf->SetXY (120, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0);
|
||||
$pdf->MultiCell(40, $this->line_height, $this->lines[$j][5], 0, 'J', 0);
|
||||
|
||||
$pdf->SetXY (160, $this->tab_top + 10 + $yp);
|
||||
$pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0);
|
||||
$pdf->MultiCell(40, $this->line_height, $this->lines[$j][2], 0, 'R', 0);
|
||||
$yp = $yp + 5;
|
||||
|
||||
if ($oldprowid <> $lines[$j][7])
|
||||
if ($oldprowid <> $this->lines[$j][7])
|
||||
{
|
||||
$oldprowid = $lines[$j][7];
|
||||
$oldprowid = $this->lines[$j][7];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,29 +177,6 @@ class BordereauChequeBlochet
|
||||
$pdf = new FPDF('P','mm','A4');
|
||||
$pdf->Open();
|
||||
|
||||
$sql = "SELECT b.banque, b.emetteur, b.amount ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba ";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql .= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid";
|
||||
$sql .= " AND bc.number = '$number'";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$lignes = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
|
||||
while ( $objp = $this->db->fetch_object($result) )
|
||||
{
|
||||
$lines[$i][0] = $objp->banque;
|
||||
$lines[$i][1] = $objp->emetteur;
|
||||
$lines[$i][2] = price($objp->amount);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$pages = intval($lignes / $this->line_per_page);
|
||||
|
||||
@ -225,7 +195,7 @@ class BordereauChequeBlochet
|
||||
|
||||
$this->Header($pdf, 1, $pages);
|
||||
|
||||
$this->Body($pdf, 1, $lines);
|
||||
$this->Body($pdf, 1);
|
||||
|
||||
$pdf->Output($_file);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user