FPDF abd APPGINI

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
pasbonte
Veteran Member
Posts: 162
Joined: 2013-02-06 09:49

FPDF abd APPGINI

Post by pasbonte » 2018-06-12 17:55

An APPGINI user has already worked with fpdf?
can I have an example code?

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: FPDF abd APPGINI

Post by D Oliveira » 2018-06-12 20:28

Code: Select all

<?php
require('fpdf17/fpdf.php');

//db connection
$con = mysqli_connect('localhost','root','');
mysqli_select_db($con,'tigercon_invoicedb');




//get gwoids data

$getvariable = $_GET['gwoid'];

$query = mysqli_query($con,"select * from gutterwb where gwoid= '{$getvariable}'");
$query2 = mysqli_query($con,"select * from invoices where invoiceIDx= '{$getvariable}'");
$gwoid = mysqli_fetch_array($query);
$gwoid2 = mysqli_fetch_array($query2);
$query3 = mysqli_query($con,"select * from contactsct where companyname= '{$gwoid['gctname']}'");
$gwoid3 = mysqli_fetch_array($query3);

//A4 width : 219mm
//default margin : 10mm each side
//writable horizontal : 219-(10*2)=189mm

$pdf = new FPDF('P','mm','A4');

$pdf->AddPage();

$pdf->Image('i2.jpg', 0, 0, $pdf->w, $pdf->h);

//set font to arial, bold, 14pt
$pdf->SetFont('Arial','B',12);

//Cell(width , height , text , border , end line , [align] )
$pdf->SetFont('Arial','',8);
$pdf->SetY(50.8);
$pdf->SetX(130);
$pdf->Cell(90,5,$gwoid2['dateinvsent'],0,1);//end of line

$pdf->SetFont('Arial','B',8);
$pdf->SetY(55.4);
$pdf->SetX(135.2);
$pdf->Cell(90,5,$gwoid2['invoiceIDx'],0,1);//end of line

$pdf->SetFont('Arial','',8);
$pdf->SetY(68.95);
$pdf->SetX(128);
$pdf->Cell(90,5,$gwoid2['type'],0,1);//end of line

$pdf->SetFont('Arial','U',8);
$pdf->SetY(223.5);
$pdf->SetX(18.4);
$pdf->MultiCell(75 ,5,$gwoid2['jobdesc'],0,1);

//set font to arial, regular, 12pt
$pdf->SetFont('Arial','',8);
$pdf->SetY(75.9);
$pdf->SetX(44);
$pdf->Cell(90 ,5,$gwoid3['contactname'],0,1);

$pdf->SetY(80.8);
$pdf->SetX(44);
$pdf->Cell(90 ,5,$gwoid2['billaddy2'],0,1);

$pdf->SetY(85.6);
$pdf->SetX(42);
$pdf->Cell(90 ,5,$gwoid3['phone'],0,1);

$pdf->SetY(90.3);
$pdf->SetX(38.2);
$pdf->Cell(90 ,5,$gwoid3['fax'],0,1);

$pdf->SetY(95.1);
$pdf->SetX(41);
$pdf->Cell(90 ,5,$gwoid3['eemail'],0,1);

$pdf->SetFont('Arial','U',8);
$pdf->SetY(70.8);
$pdf->SetX(32.5);
$pdf->Cell(75 ,5,$gwoid['gctname'],0,1);

$pdf->SetFont('Arial','U',8);
$pdf->SetY(109.2);
$pdf->SetX(21.5);
$pdf->Cell(75 ,5,$gwoid['gctname'],0,1,'C');

$pdf->SetFont('Arial','B',7.5);
$pdf->SetY(117);
$pdf->SetX(19.5);
$pdf->MultiCell(80,5,$gwoid['geaddress'],0, 'C');

$pdf->SetFont('Arial','B',8);
$pdf->SetY(130);
$pdf->SetX(23);
$pdf->Cell(75 ,5,$gwoid['gcolor2'],0,1,'C');

$pdf->SetFont('Arial','B',8);
$pdf->SetY(153);
$pdf->SetX(106);
$pdf->MultiCell(75 ,5,$gwoid['gsinstl']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(153);
$pdf->SetX(124);
$pdf->MultiCell(75 ,5,$gwoid2['invratesf']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(153);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'$'.$gwoid2['sftotal'],0,1, 'C');

$pdf->SetFont('Arial','B',8);
$pdf->SetY(164.2);
$pdf->SetX(106);
$pdf->MultiCell(75 ,5,$gwoid['gfinstl']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(164.2);
$pdf->SetX(124);
$pdf->MultiCell(75 ,5,$gwoid2['invratefas']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(164.2);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'$'.$gwoid2['fastotal'],0,1,'C');

$pdf->SetFont('Arial','B',8);
$pdf->SetY(175.2);
$pdf->SetX(106);
$pdf->MultiCell(75 ,5,$gwoid['gcinstl']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(175.2);
$pdf->SetX(124);
$pdf->MultiCell(75 ,5,$gwoid2['invratecel']);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(175.2);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'$'.$gwoid2['celtotal'],0,1,'C');


$pdf->SetFont('Arial','B',8);
$pdf->SetY(236.6);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'$'.$gwoid2['indaddchargeam'],0,1, 'C');

$pdf->SetFont('Arial','I',8.5);
$pdf->SetY(236.6);
$pdf->SetX(18.4);
$pdf->Cell(90 ,5,'Additional Charge : '.$gwoid2['indaddcharge'],0,1);

$pdf->SetFont('Arial','I',8.5);
$pdf->SetY(242.5);
$pdf->SetX(18.4);
$pdf->Cell(90 ,5,'Discount : '.$gwoid2['discount'],0,1);

$pdf->SetFont('Arial','B',8);
$pdf->SetY(242.5);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'($'.$gwoid2['discountam'].')',0,1, 'C');

$pdf->SetFont('Arial','B',8);
$pdf->SetY(248);
$pdf->SetX(104);
$pdf->Cell(90 ,5,'$'.$gwoid2['totalcharge'],0,1, 'C');



$pdf->Output();
?>


rockettpc
Posts: 13
Joined: 2015-03-06 17:59
Location: USA
Contact:

Re: FPDF abd APPGINI

Post by rockettpc » 2018-07-12 14:30

Where would you place that code? Would you use that in place of the DVP template?

hubert
Veteran Member
Posts: 50
Joined: 2018-12-06 22:32

Re: FPDF abd APPGINI

Post by hubert » 2018-12-19 08:01

Check on Udemys course here to create a new button,then invoice part1 and insert require( ../fpdf.php) - well according your architecture - and play !
https://www.udemy.com/customizing-appgi ... ?start=750

Post Reply