Beispiel #1
0
 public function monthly($res, $id)
 {
     $dt = DateTime::createFromFormat('!m', $id);
     $fpdf = new Fpdf();
     $fpdf->AddPage('L');
     $fpdf->SetFont('Arial', 'B', 16);
     $fpdf->Cell(130);
     $fpdf->Cell(20, 10, Information::where('keyname', '=', 'name')->first()->value, 0, 1, 'C');
     $fpdf->Cell(130);
     $fpdf->SetFont('Arial', '', 14);
     $fpdf->Cell(20, 10, Information::where('keyname', '=', 'address')->first()->value, 0, 1, 'C');
     $header = array('ID', 'Date', 'Pax', 'Status', 'Amount', 'Payment Method', 'Duration');
     $fpdf->SetFont('Arial', 'B', 16);
     $fpdf->Cell(130);
     $fpdf->Cell(20, 10, 'Monthly Report for the Month of: ' . $dt->format('F'), 0, 1, 'C');
     // Colors, line width and bold font
     $fpdf->SetFillColor(255, 0, 0);
     $fpdf->SetTextColor(255);
     $fpdf->SetDrawColor(128, 0, 0);
     $fpdf->SetLineWidth(0.3);
     $fpdf->SetFont('', '');
     // Header
     $fpdf->Ln();
     $fpdf->Cell(10);
     $w = array(35, 25, 25, 45, 23, 50, 55);
     for ($i = 0; $i < count($header); $i++) {
         $fpdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true);
     }
     $fpdf->Ln();
     // Color and font restoration
     $fpdf->SetFillColor(224, 235, 255);
     $fpdf->SetTextColor(0);
     $fpdf->SetFont('Arial', '', 12);
     // Data
     $fill = false;
     $total = 0;
     foreach ($res as $row) {
         $fpdf->Cell(10);
         $fpdf->Cell($w[0], 6, $row->id, 'LR', 0, 'L', $fill);
         $fpdf->Cell($w[1], 6, $row->date_request, 'LR', 0, 'L', $fill);
         $fpdf->Cell($w[2], 6, $row->pax, 'LR', 0, 'R', $fill);
         $fpdf->Cell($w[3], 6, $row->status, 'LR', 0, 'R', $fill);
         $fpdf->Cell($w[4], 6, $row->net_total, 'LR', 0, 'R', $fill);
         if ($row->payment_mode != '') {
             $fpdf->Cell($w[5], 6, $row->payment_mode . " (" . $row->payment_method . ")", 'LR', 0, 'L', $fill);
         } else {
             $fpdf->Cell($w[5], 6, 'Payment Method not set', 'LR', 0, 'L', $fill);
         }
         $fpdf->Cell($w[6], 6, $row->reservation_start . ' to ' . $row->reservation_end, 'LR', 0, 'L', $fill);
         $fpdf->Ln();
         $fill = !$fill;
         $total = +$row->net_total;
     }
     // Closing line
     $fpdf->Cell(10);
     $fpdf->Cell(array_sum($w), 0, '', 'T');
     $fpdf->Ln();
     $fpdf->Cell(190);
     $fpdf->SetFont('Arial', 'B', 13);
     $fpdf->Cell(40, 7, 'Total:', '', 0, 'R');
     $fpdf->SetFont('Arial', '', 13);
     $fpdf->Cell(40, 7, "{$total}", 0);
     $fpdf->Output();
     exit;
 }
 public function getViewResultsPdf($id)
 {
     $result = Performance::find($id);
     $perf = Performance::find($id);
     $user = Performance::find($id);
     $rating = Performance::find($id);
     $u = $perf->utilities;
     $qow = $perf->workQuality;
     $pffp = $perf->potential;
     $overall = number_format(($u + $qow + $pffp) / 3, 2);
     $rating = ParRatingsRef::where('upper_limit', '>=', $overall)->where('lower_limit', '<=', $overall)->first();
     $overpercent = number_format($overall / 6 * 100, 2);
     $department = Department::where('id', $perf->dept_id)->first();
     Fpdf::AddPage();
     Fpdf::PageNo();
     Fpdf::AliasNbPages('{nb}');
     Fpdf::Image('img/dap.jpg', 40, 0, 150);
     Fpdf::Ln(30);
     Fpdf::SetFont('Arial', 'B', 11);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(300, 20, 'Date Generated: ' . date("F j, Y"), 0, 2, 'C', 0);
     Fpdf::SetFont('Arial', 'B', 15);
     Fpdf::Cell(0, 0, 'Performance Evaluation', 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::SetFont('Arial', 'B', 11);
     Fpdf::Cell(0, 0, 'Name: ' . $perf->user->formatName(':ln, :fn :mn'), 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::Cell(0, 0, 'Department: ' . $department->name, 0, 1, 'L', 0);
     Fpdf::Ln(8);
     Fpdf::Cell(0, 0, 'Semester: ' . $perf->semester, 0, 1, 'L', 0);
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Utilities', 1, 1, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Intra-group Involvements', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Inter-group Involvements', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Committee Work', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('util3')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->util_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('utilities')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('utilities')->description, 1, 1, 'C', 0);
     //Quality of work table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Quality of Work', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Relevance to Project/unit objectives', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Timeliness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Thoroughness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow3')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'High-Rate', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow4, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow4')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow4')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Accuracy', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow5, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow5')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow5')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Foresight', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow6, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow6')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow6')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Neatness and Presentability', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow7, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow7')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow7')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Cost-effectiveness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow8, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow8')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow8')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->qow_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow_overall')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('qow_overall')->description, 1, 1, 'C', 0);
     //Potential for Future Performance table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(110, 10, 'Potential for Future Performance', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(50, 10, 'Appropriate Expertise', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp1, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp1')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp1')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Professional Interest', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp2, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp2')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp2')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Ability to Learn', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp3, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp3')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp3')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Professional Integrity ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp4, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp4')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp4')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Work standards ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp5, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp5')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp5')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Innovativeness ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp6, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp6')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp6')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Maturity ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp7, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp7')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp7')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Collaboration ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp8, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp8')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp8')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Initiative', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp9, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp9')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp9')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Responsiveness', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp10, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp10')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp10')->description, 1, 1, 'C', 0);
     Fpdf::Cell(50, 10, 'Adaptability and Consistent track record ', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp11, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp11')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp11')->description, 1, 1, 'C', 0);
     Fpdf::SetTextColor(204, 0, 0);
     Fpdf::Cell(50, 10, 'Average Rating', 1, 0, 'C', true);
     Fpdf::Cell(20, 10, $result->pffp_overall, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp_overall')->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(20, 10, $perf->equivalent('pffp_overall')->description, 1, 1, 'C', 0);
     //Overall Rating table
     Fpdf::Ln(10);
     Fpdf::SetFont('Arial', '', 20);
     Fpdf::SetDrawColor(224, 224, 224);
     Fpdf::SetFillColor(51, 51, 225);
     Fpdf::SetTextColor(255, 255, 255);
     Fpdf::Cell(140, 10, 'Overall Rating', 1, 2, 'C', true);
     Fpdf::SetFont('Arial', 'B', 7);
     Fpdf::SetFillColor(204, 229, 225);
     Fpdf::SetTextColor(96, 96, 96);
     Fpdf::Cell(30, 10, 'Superior Remarks', 1, 0, 'C', true);
     Fpdf::Cell(110, 10, $perf->comments, 1, 1, 'C', 0);
     Fpdf::Cell(30, 10, 'Overall rating', 1, 0, 'C', true);
     Fpdf::Cell(30, 10, $result->overall, 1, 0, 'C', 0);
     Fpdf::Cell(30, 10, $rating->adjectival, 1, 0, 'C', 0);
     Fpdf::Cell(50, 10, $rating->description, 1, 0, 'C', 0);
     Fpdf::SetY(-35);
     Fpdf::AliasNbPages('{nb}');
     Fpdf::SetFont('Arial', 'I', 10);
     Fpdf::SetTextColor(0, 0, 0);
     Fpdf::Cell(0, 10, 'Page ' . Fpdf::PageNo() . '/{nb}', 0, 0, 'C');
     Fpdf::Output();
     exit;
 }