Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<?php
include ('../test/fpdf/fpdf.php'); // make sure you include fpdf.php path properly
include "config.php";
// if(isset( $_SESSION['username']))
// $user = $_SESSION['username'];
// else
// header("location:index.php?msg=Login First to use service");
$id = $_REQUEST['id'];
class PDF extends FPDF{
function Header()
{
//$this->Image('152309_thumb.png',10,8,50,17);
$this->SetFont('Arial', 'B', 20); // SetFont(Font Family, style [B|I|U],Font size)
$this->Cell(50);
$this->Cell(85, 15, 'Water Control System and Discussion Portal for Farmer', 0, 0, 'C');
// Cell(width, height, txt, border, ln [0|1|2], align, fill)
// 0: to the right | 1: to the beginning of the next line | 2: below
$this->Ln(20); // Ln (height): Performs a line break
}
// function Footer()
// {
// $this->SetY(-20); // set current x position
// $this->SetX(180); // set current y position
// $this->SetFont('Arial', 'I', 9);
// $this->Cell(15, 10, 'Page # '. $this->PageNo() , 1, 1, 'R');
// }
}
$req = mysqli_query($var,'select users.username,users.email,users.user_address,users.monthly_consumption,bill.monthly_bill,bill.discount,bill.total_bill,bill.due_date,bill.billing_month from users INNER JOIN bill ON users.id = bill.bill_id');
$test_pdf = new PDF();
$test_pdf->AliasNbPages(); // define an alias for number of pages
$test_pdf->AddPage(); // AddPage( orientation , size , rotation)
$test_pdf->SetFont('Times', 'b', 12);
//$test_pdf->SetTextColor(233, 255, 48);
$test_pdf->SetTextColor(0, 0, 0);
$test_pdf->SetLeftMargin(15);
$user = $_SESSION['username'];
while($dnn = mysqli_fetch_array($req))
{
if($user === $dnn['username']) {
$test_pdf->Cell(22, 10, 'Name : ', 0, 0, 'C');
$test_pdf->Cell(20, 10, $dnn['username'] , 0, 0, 1);
$test_pdf->Ln();
$test_pdf->Cell(22, 10, 'Email : ', 0, 0, 'C');
$test_pdf->Cell(30, 10, $dnn['email'] , 0, 0, 1);
$test_pdf->Ln();
$test_pdf->Cell(22, 10, 'Address : ', 0, 0, 'C');
$test_pdf->Cell(100, 10, $dnn['user_address'] , 0, 0, 1);
$test_pdf->Ln();
$test_pdf->Cell(57, 10, 'BANK : XXXXXXXXXXXX ', 0, 0, 'C');
$test_pdf->Ln();
$test_pdf->Cell(57, 10, 'Account No: XXXXXXXXXXXX ', 0, 0, 'C');
$test_pdf->Ln();
$test_pdf->Cell(23, 10, 'Due Date: ', 0, 0, 'C');
$test_pdf->Cell(100, 10, $dnn['due_date'] , 0, 0, 1);
$test_pdf->Ln();
$test_pdf->Ln();
$test_pdf->Cell(80, 10, 'Billing Month', 1, 0, 'C');
$test_pdf->Cell(80, 10, $dnn['billing_month'] , 1, 0, 'C');
$test_pdf->Ln();
$test_pdf->Cell(80, 10, 'Monthly Usage (LTR)', 1, 0, 'C');
$test_pdf->Cell(80, 10, $dnn['monthly_consumption'] , 1, 0, 'C');
$test_pdf->Ln();
$test_pdf->Cell(80, 10, 'Bill', 1, 0, 'C');
$test_pdf->Cell(80, 10, $dnn['monthly_bill'] , 1, 0, 'C');
$test_pdf->Ln();
$test_pdf->Cell(80, 10, 'Discount', 1, 0, 'C');
$test_pdf->Cell(80, 10, $dnn['discount'] , 1, 0, 'C');
$test_pdf->Ln();
// $test_pdf->Cell(80, 10, 'Penalty', 1, 0, 'C');
// $test_pdf->Cell(80, 10, '0' , 1, 0, 'C');
// $test_pdf->Ln();
$test_pdf->Cell(80, 10, 'Total Bill Payable within Due Date', 1, 0, 'C');
$test_pdf->Cell(80, 10, $dnn['total_bill'] , 1, 0, 'C');
}}
$test_pdf->Output(); // finally create/output file to user
// }
?>