$n = 1; ?> <?php $grand_total_salary = 0; ?> <?php $grand_total_amount_due = 0; ?> <?php $deduction = 0; ?> <?php $c = new Cos_status(); ?> <?php $j = new Jo_days(); ?> <?php $p = new Personal_m(); ?> <?php foreach ($rows as $row) { ?> <?php $p->get_by_employee_id($row['id']); ?> <?php $c->get_by_employee_id($row['employee_id']); ?>
$grand_total_salary = 0; ?> <?php $grand_total_amount_due = 0; ?> <?php $deduction = 0; ?> <?php $r = new Rates(); ?> <?php $p = new Personal_m(); ?> <?php $j = new Jo_days(); ?> <?php foreach ($rows as $row) { ?> <?php $r->get_by_employee_id($row['employee_id']); ?> <?php $p->get_by_employee_id($row['id']); ?> <?php $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get();
function jo_preview($office_id = '', $period = '') { $this->Employee->fields = array('id', 'employee_id', 'office_id', 'lname', 'fname', 'mname', 'tax_status', 'dependents'); $this->Employee->employment_type = 4; $rows = $this->Employee->get_employee_list($office_id, ''); $o = new Office_m(); $o->get_by_office_id($office_id); $disbursing_officer = $o->disbursing_officer; $str = $o->office_name; if (strlen($str) % 2 == 1) { $str .= ' '; } $length = strlen($str) / 2; $arr2 = str_split($str, $length); $office_page1 = $arr2[0]; $office_page2 = $arr2[1]; list($month, $day1, $day2, $year) = explode("-", $period); $month_name = $this->Helps->get_month_name($month); $period_text = 'For the Month of ' . $month_name . ' ' . $day1 . '-' . $day2 . ', ' . $year; if (strlen($period_text) % 2 == 1) { $period_text .= ' '; } $length = strlen($period_text) / 2; $period_text_arr = str_split($period_text, $length); $period_page1 = $period_text_arr[0]; $period_page2 = $period_text_arr[1]; $agency_accountant = Setting::getField('agency_accountant'); $agency_accountant_position = Setting::getField('agency_accountant_position'); $head_of_office = Setting::getField('head_of_office'); $head_of_office_position = Setting::getField('head_of_office_position'); $heading = '<table width="100%" border="0"> <tr> <td> </td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"><H1>DAILY WAGE PAY</H1></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right">' . strtoupper($office_page1) . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"><strong>' . $period_page1 . '</strong></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6" style="font-size:11px">We acknowledge receipt of the sum shown opposite our names as full compensation for the services rendered for the period stated.</td> </tr> </table>'; $page = ' <table width="100%" border="1"> <tr> <td width="3%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="45%" rowspan="3" align="center" valign="middle"><strong>NAME</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>TIN</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Tax Exemption</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Rate per Day</strong></td> <td width="6%" rowspan="3" align="center" valign="middle"><strong>Rate per Hour</strong></td> <td width="3%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $p = new Personal_m(); $r = new Rates(); $j = new Jo_days(); $n = 1; foreach ($rows as $row) { $p->get_by_employee_id($row['id']); $r->get_by_employee_id($row['employee_id']); $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $tax_status = $row['tax_status'] != 'Single' ? 'ME' . $row['dependents'] : 'S'; $page .= '<tr> <td>' . $n . '</td> <td>' . strtoupper($row['lname']) . ', ' . $row['fname'] . ' ' . $row['mname'] . '</td> <td>' . $p->tin . '</td> <td>' . $tax_status . '</td> <td align="right">' . number_format($r->rate_per_day, 2) . '</td> <td> </td> <td> </td> </tr>'; $n++; } $page .= '<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td width="64%">CERTIFIED</td> <td width="4%"> </td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6">Each person whose name appears on this roll had rendered services for the time stated</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td><strong>' . strtoupper($o->office_head) . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td colspan="5" style="font-size:11px">' . $o->position . '</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%"> <tr> <td width="3%"> </td> <td width="35%">CERTIFIED: Funds available in the amount of</td> <td width="33%">' . number_format($grand_total_amount_due, 2) . '</td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"><strong>' . $agency_accountant . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td align="center">' . $agency_accountant_position . '</td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <pagebreak /> '; $page2 = '<table width="100%" border="0"> <tr> <td><H1>ROLL - JOB ORDER</H1></td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"></td> </tr> <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td>' . strtoupper($office_page2) . '</td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td><strong>' . $period_page2 . '</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6"> </td> </tr> </table> <table width="100%" border="1"> <tr> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No of Hours</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>No. of Days with Pay</strong></td> <td width="15%" rowspan="3" align="center" valign="middle"><strong>Total Amount of Salary</strong></td> <td width="7%" rowspan="3" align="center" valign="middle"><strong>Pag-ibig Personal Contribution</strong></td> <td width="10%" rowspan="3" align="center" valign="middle"><strong>Total Deductions</strong></td> <td width="13%" rowspan="3" align="center" valign="middle"><strong>Total Amount Due</strong></td> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="20%" rowspan="3" align="center" valign="middle"><strong>SIGNATURE OR THUMBMARK</strong></td> <td width="6%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $n = 1; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $j = new Jo_days(); $r = new Rates(); foreach ($rows as $row) { $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $r->get_by_employee_id($row['employee_id']); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $deduction = $r->pagibig_amount; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $page2 .= ' <tr> <td></td> <td align="center">' . $j->days . '</td> <td align="right">' . number_format($total_salary, 2) . '</td> <td>' . $r->pagibig_amount . '</td> <td align="right">' . $deduction . '</td> <td align="right">' . number_format($total_amount_due, 2) . '</td> <td>' . $n . '</td> <td></td> <td> </td> </tr>'; $n++; } $page2 .= ' <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td align="right"><strong>' . number_format($grand_total_salary, 2) . '</strong></td> <td> </td> <td> </td> <td align="right"><strong>' . number_format($grand_total_amount_due, 2) . '</strong></td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="2">APPROVED FOR PAYMENT</td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $head_of_office . '</strong></td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">' . $head_of_office_position . '</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="6">CERTIFIED: Each person whose name appears on the above rolls has been</td> </tr> <tr> <td> </td> <td colspan="6">paid the amount stated opposite his name after identifying himself</td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $disbursing_officer . '</strong></td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">Disbursing Officer</td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> '; $html = $heading . $page . $page2; $params = array('format' => 'Legal'); $this->load->library('mpdf', $params); //$mpdf=new mPDF('c','Letter'); $this->mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no $this->mpdf->WriteHTML($html); $this->mpdf->Output(); }
function edit_place($mode = '') { if ($mode == 'rates') { $r = new Rates(); $r->where('id', Input::get('rowid')); $r->get(); if (Input::get('colid') == 'rate_per_day') { $r->rate_per_day = Input::get('new'); } if (Input::get('colid') == 'pagibig_amount') { $r->pagibig_amount = Input::get('new'); } $r->save(); exit; } if ($mode == 'jo_days') { $j = new Jo_days(); $j->where('id', Input::get('rowid')); $j->get(); if (Input::get('colid') == 'hours') { $j->hours = Input::get('new'); } if (Input::get('colid') == 'days') { $j->days = Input::get('new'); } $j->save(); exit; } if ($mode == 'status') { $c = new Cos_status(); $c->where('id', Input::get('rowid')); $c->get(); $c->status = Input::get('new'); $c->save(); exit; } }