Exemple #1
0
 public function print_brgy_leaders($voter_data = array(), $data = array())
 {
     $this->load->library('pdf');
     $pdf = new Pdf('L', 'mm', 'LETTER', true, 'UTF-8', false);
     $pdf->SetTitle('My Title');
     $pdf->SetHeaderMargin(30);
     $pdf->SetTopMargin(20);
     $pdf->setFooterMargin(10);
     $pdf->SetAutoPageBreak(true, 15);
     $pdf->SetAuthor('Author');
     $pdf->AddPage('L', 'LEGAL');
     $pdf->setY(30);
     $html = '';
     $html .= '<div style="text-align: center;"><b>Brgy Leaders</b> for<br/><b>' . $data['brgy'] . '</b></div>';
     $html .= '<br/>';
     $html .= '<br/>';
     $html .= '<table style="border: 1px solid #000;border-collapse: collapse;" border="1" cellspacing="0" cellpadding="1">';
     $html .= '<thead>';
     $html .= '<tr style="background-color: #a8a8a8;">';
     $html .= '<th align="center" width="5%"></th>';
     $html .= '<th align="center" width="45%"><b>Voter\'s Name</b></th>';
     $html .= '<th align="center" width="30%"><b>Precinct No</b></th>';
     $html .= '<th align="center" width="20%"><b>Type</b></th>';
     $html .= '</tr>';
     $html .= '</thead>';
     if (count($voter_data) > 0) {
         $x = 1;
         foreach ($voter_data as $type => $val) {
             for ($ctr = 0; $ctr < count($val); $ctr++) {
                 $html .= '<tr nobr="true">';
                 $html .= '<td align="center" width="5%">' . $x . '.</td>';
                 $html .= '<td width="45%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['full_name'] . '</td>';
                 $html .= '<td width="30%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['precinct_no'] . '</td>';
                 $html .= '<td width="20%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['type'] . '</td>';
                 $html .= '</tr>';
                 $x++;
             }
         }
     } else {
         $html .= '<tr>';
         $html .= '<td align="center" width="100%">No record found..</td>';
         $html .= '</tr>';
     }
     $html .= '</table>';
     $pdf->writeHTML($html, true, false, false, false, '');
     $pdf->Output('brgy_leaders_report.pdf', 'I');
 }
Exemple #2
0
 public function generate_letter_support_pdf($arrData, $pData)
 {
     $this->load->model('setup_model');
     $letter = $this->setup_model->get_by(array('name' => 'Letter'));
     $ward_letter = $this->setup_model->get_by(array('name' => 'Ward Leader Letter'));
     $support_letter = $this->setup_model->get_by(array('name' => 'Letter of Support'));
     $this->load->library('pdf');
     $pdf = new Pdf('L', 'mm', 'LETTER', true, 'ISO-8859-1', false);
     $pdf->SetTitle($pData['brgy'] . '-LETTER-' . date("YmdHis"));
     $pdf->SetHeaderMargin(0);
     $pdf->SetTopMargin(10);
     $pdf->SetLeftMargin(20);
     $pdf->SetRightMargin(20);
     $pdf->setFooterMargin(10);
     $pdf->SetAutoPageBreak(true, 10);
     $pdf->SetFontSize(10);
     $pdf->SetAuthor('Author');
     // set font
     $pdf->SetFont('freeserif', '', 10);
     $ctr = 0;
     foreach ($arrData as $result) {
         if ($ctr % 2 == 0) {
             $pdf->AddPage('P', 'LEGAL');
             $pdf->setY(15);
         } else {
             $pdf->setY(190);
         }
         $result = (object) $result;
         $voter_name = explode(",", htmlentities($result->full_name));
         $html = "";
         $html .= "<br/>";
         $html .= '<b>' . trim(htmlentities($result->full_name)) . '</b>';
         $html .= "<br/>";
         $html .= '<b>' . trim($result->brgy) . '</b>';
         $html .= "<br/>";
         $html .= '<b>' . trim($result->precinct) . '</b>';
         $html .= "<br/>";
         $html .= "<br/>";
         $html .= 'Minamahal na <b>' . (trim($result->gender) == 'M' ? 'G.' : 'Bb/Gng.') . " " . ucfirst(trim(strtolower(htmlentities($voter_name[0])))) . ":</b>";
         $html .= "<br/>";
         //            $html .= $is_ward ? $ward_letter['content'] : $letter['content'];
         $html .= $support_letter['content'];
         $html .= "<br/>";
         $html .= '<table>' . '<tr>' . '<td width="60%"></td>' . '<td>Gumagalang, </td>' . '</tr>' . '<tr>' . '<td width="60%"></td>' . '</tr>' . '<tr>' . '<td width="50%" align="center"><b> <img src="' . base_url('assets/images/alexander_pajarillo_sign.jpg') . '" height="55" width="150"/></b></td>' . '<td width="50%" align="center"><b> <img src="' . base_url('assets/images/edgardo_tallado_sign.jpg') . '" height="55" width="150"/></b></td>' . '</tr>' . '<tr>' . '<td width="50%" align="center"><i>Mayor</i></td>' . '<td width="50%" align="center"><i>Governor</i></td>' . '</tr>' . '<tr>' . '<td width="60%"></td>' . '</tr>' . '<tr>' . '<td width="100%" align="center"><u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>' . trim(htmlentities($result->full_name)) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u></td>' . '</tr>' . '<tr>' . '<td width="100%" align="center">Lagda</td>' . '</tr>' . '</table>';
         $pdf->writeHTML($html, true, false, false, false, '');
         $ctr++;
         //            if($ctr == 1){
         //                $pdf->setY(100);
         //                $ctr = 0;
         //            }
     }
     $pdf->Output('letter.pdf', 'I');
     exit;
     pe($letter);
 }
Exemple #3
0
 public function letters()
 {
     $this->load->library('pdf');
     $pdf = new Pdf('L', 'mm', 'LETTER', true, 'UTF-8', false);
     $pdf->SetTitle('Letter to vote');
     $pdf->SetHeaderMargin(30);
     $pdf->SetTopMargin(20);
     $pdf->setFooterMargin(10);
     $pdf->SetAutoPageBreak(true, 15);
     $pdf->SetAuthor('Author');
     $pdf->AddPage('P', 'LEGAL');
     $pdf->setY(30);
     $pdf->Output('letter.pdf', 'I');
 }