• Home
  • Outdoor Adventure
    • Hiking
    • Backpacking
    • Camping
    • Caving
  • Travel
  • Life Style
    • Diploma Life
    • Degree Life
    • Work and Part Time
  • Code Test and Project
  • FYP

Jack Hau Story

facebook twitter instagram

FPDF is a PHP class which allows to generate PDF files with pure PHP.

Design and generate PDF. Reservation statement


Sample code : 

<?php 

require('fpdf.php');
include("../connection.php");

$reservation_id = $_REQUEST['reservation_id'];
$member_id = $_REQUEST['member_id'];

$sql = "select member_name from member where member_id = $member_id";
$result_member = mysql_query($sql);
$row_member = mysql_fetch_assoc($result_member);
$member_name = $row_member['member_name'];

$sql = "select * from reservation join homestay on reservation.homestay_id = homestay.homestay_id ".
        "join member on homestay.member_id = member.member_id where reservation.reservation_id = $reservation_id";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

$start = $row['checkIn_date'];
$end = $row['checkOut_date'];
$reservation_date = $row['reservation_date'];
$night = (strtotime($end)- strtotime($start))/24/3600; 

class PDF extends FPDF
{
// Page header
function Header()
{
    // Logo
    $this->Image('../images/homestay-logo.png',10,10,50);   
    // Move to the right
    $this->Cell(100);
    // Arial bold 15
    $this->SetFont('Arial','B',20);
    // Title
    $this->Cell(0,20,'Statement of Reservation','C');
    // Line break
    $this->Ln(20);
}

// Page footer
function Footer()
{
    // Position at 1.5 cm from bottom
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}


// Instanciation of inherited class
$pdf = new PDF();
$pdf->AddPage();

$pdf->SetFont('Times','B',18);
$pdf->Cell(80,10,'MyHomestay');
$pdf->Ln();
$pdf->SetFont('Times','',11);
$pdf->Cell(80,0,'1234 ST.');
$pdf->Ln();
$pdf->SetFont('Times','',11);
$pdf->Cell(80,7.5,'Denver, CO 80202');
$pdf->Ln();
$pdf->SetFont('Times','',11);
$pdf->Cell(80,0,'Phone:(60)123-4567');
$pdf->Ln();
$pdf->SetFont('Times','',11);
$pdf->Cell(80,7.5,'myhomestaymmu@gmail.com');
$pdf->Ln();
$pdf->SetFont('Times','',11);
$pdf->Cell(80,0,'www.homestay.com');
$pdf->Ln();
$pdf->Cell(130);
$pdf->SetFont('Arial','',12);
$reservation_date = date("Y-m-d",strtotime($reservation_date));
$pdf->Cell(0,-40,'Reservation Date :  '.$reservation_date,'C');
$pdf->Cell(0,-40,'','C');

$date = date("Y-m-d");
$pdf->Cell(-53.5,-25,'Generate Date :  '.$date,0,1,'C');

$pdf->Cell(0,40,'',0,1,'R');



$word = "To,".
        "\n$member_name".
        "\nDear Sir/Madam,".
        "\nThank you for your reservation. We confirm with pleasure your accommodation.".
        "\nPlease note the information below for accuracy".
        "\nPlease review it and report any discrepancies.";
$pdf->Multicell(160,6,$word);

$pdf->Cell(0,10,'',0,1,'R');

$pdf->SetFillColor(169, 169, 169);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(255, 255, 255);
$pdf->Cell(18,7,'Res.Id',0,0,'L',true);
$pdf->Cell(35,7,'Guest Name',0,0,'L',true);
$pdf->Cell(35,7,'Homestay Name',0,0,'L',true);
$pdf->Cell(28,7,'Check In',0,0,'C',true);
$pdf->Cell(28,7,'Check Out',0,0,'C',true);
$pdf->Cell(18,7,'Nights',0,0,'C',true);
$pdf->Cell(26,7,'Amount',0,1,'C',true);

$pdf->Cell(0,0,'',0,1,'R');
$pdf->Cell(15,7,$row['reservation_id'],1,0,'C',0);
$pdf->Cell(28,7,$member_name,1,0,'C',0);
$pdf->Cell(44,7,$row['homestay_name'],1,0,'C',0);
$pdf->Cell(28,7,$row['checkIn_date'],1,0,'C',0);
$pdf->Cell(30,7,$row['checkOut_date'],1,0,'C',0);
$pdf->Cell(17,7,$night,1,0,'C',0);
$pdf->Cell(25,7,$row['reservation_total_price'],1,0,'C',0);

// Linienfarbe auf Blau einstellen 
$pdf->SetDrawColor(0, 0, 0);

// Linienbreite einstellen, 0.5 mm
$pdf->SetLineWidth(0.5);

// Linie zeichnen
$pdf->Line(10,132,198,132);

$pdf->SetFont('Arial','B',12);

$reservation_total_price = $row['reservation_total_price'];

$pdf->Cell(0,18,'',0,1,'R');
$pdf->Cell(182,3,'Total:  RM'.$reservation_total_price,0,1,'R');
$pdf->Cell(0,3,'',0,1,'R');


$pdf->Output();

?>
Share
Tweet
Pin
Share
No comments

Bear Hill Starting Point Jalan Teratai 3 Taman Bunga Raya Malacca
(Behind Majlis Bandaraya Melaka Bersejarah)
Early morning 7am hiking mountain bukit beruang again before Diploma FYP part 1 presentation. Have a break.






Share
Tweet
Pin
Share
No comments
Busy on final exam assignment, come have a game CDP RUSHING STUDENT – A blessed event! It was a great success! playing games like korean run man. challenge some program.
Students from each courses of CDP will take part in this competition to have an Intellectual challenge among the course mates.





Share
Tweet
Pin
Share
No comments

MMU CDP Director's Awards event wish is give the certificate of Distinction student.

A quality student is not only a student who excels in tests and exams but also enable to think creatively and posses high innovation skills. This is where the Director’s Award and Best Intellectual Creativity Competition (BICC) takes place. All the Director’s List students will be given certificates to certify their excellency in academic performance. Furthermore, best student will be receiving Director’s Award trophy based on their ability and strength in academic and good comments from all the lecturers. For BICC, all final year students are required to complete a project that will be given to them. Final Year Project (FYP) Competition is a competition between Diploma students in Information Technology (DIT) and Telecommunication Engineering (DTE). Only the best group selected by their advisor and supervisor will compete in this competiton. For students from Diploma in Business Administration (DBA) they will participate in business plan category. 
Share
Tweet
Pin
Share
No comments
After graduated from high-school, I selected a study by Gartner and MSC Malaysia also found MMU in the top five universities preferred by local ICT players to offer employment. 
 
Second week in MMU Melaka, rented a car from MMU staff kancil. On the way going Melaka town cari makan with friend Nicoles Chong and I am siting beside the driver. The trunk suddenly opens have fun.

 I moved in in-campus hostel
  


Hostel Block
  • Application is open to all new students; priority will be given to new undergraduates
  • Students will be selected based on school co-curricular & SPM results
  • Four hostel blocks (2 for male students, 2 for female students) that can accommodate up to 500 students; rooms are twin-sharing
  • Room rate:
    • Type A: RM210
    • Type B: RM230
    • Type C: RM250
    • Type D: RM270
    • H/CAPP: RM270
  • Deposit of RM400 and pre-payment of RM200. The deposit will be paid upon registration and the pre-payment will be made each trimester.
  • Room facilities:
    • Networking
    • Bed (double-decker)
    • Study tables
    • Closet
    • 24-hour security
    • Fan
    • Book rack
    • Shoe rack
  • Hostel facilities:
    • Common room with TV, air-conditioning, sofas and daily newspaper
    • Common washing room
    • Bathroom

Share
Tweet
Pin
Share
No comments
Older Posts

About me



Jack is a programmer, hiker who loves to take challages. Programming can be hard, but no pain no gain. Beside that, Jack like to use cooking for stress relief. “Cooking is a great destresser because it serves as a creative outlet”. During cooking the chef have to well handle of food ingredients. “Cooking is like giving birth because you are mixing things together to create something new and wonderful.”

Labels

Backpacking Camping car Caving Code Test and Project Degree Life Diploma Life Event FYP Hiking Mountain Internship MMU Cyberjaya MMU Melaka Outdoor Adventure Part Time and Work Penang Singapora Thailand Trip and Travel

recent posts

Follow Us

Blog Archive

  • ▼  2018 (2)
    • ▼  May (1)
      • Say hi to Pahang Maran Berkelah Waterfall Camping
    • ►  January (1)
  • ►  2017 (8)
    • ►  August (2)
    • ►  July (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2016 (22)
    • ►  December (3)
    • ►  November (1)
    • ►  October (2)
    • ►  September (3)
    • ►  July (1)
    • ►  May (2)
    • ►  April (6)
    • ►  March (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2015 (3)
    • ►  December (1)
    • ►  September (2)
  • ►  2014 (19)
    • ►  October (1)
    • ►  September (2)
    • ►  July (4)
    • ►  June (5)
    • ►  April (2)
    • ►  March (3)
    • ►  January (2)
  • ►  2013 (10)
    • ►  December (2)
    • ►  November (1)
    • ►  October (1)
    • ►  September (1)
    • ►  August (3)
    • ►  June (2)
  • ►  2012 (4)
    • ►  September (1)
    • ►  June (2)
    • ►  February (1)
  • ►  2011 (2)
    • ►  December (1)
    • ►  August (1)
Powered by Blogger.