Beispiel #1
0
    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>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right"></td>
    <td>&nbsp;</td>
    <td align="right"><H1>DAILY WAGE PAY</H1></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">' . strtoupper($office_page1) . '</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right"><strong>' . $period_page1 . '</strong></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</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%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</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>&nbsp;</td>
		<td>&nbsp;</td>
	  </tr>';
            $n++;
        }
        $page .= '<tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><strong>TOTAL</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%" border="1">
  <tr>
    <td><table width="100%" border="0">
      <tr>
        <td width="3%">&nbsp;</td>
        <td width="64%">CERTIFIED</td>
        <td width="4%">&nbsp;</td>
        <td width="6%">&nbsp;</td>
        <td width="4%">&nbsp;</td>
        <td width="16%">&nbsp;</td>
        <td width="3%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="6">Each person whose name appears on this roll had rendered services for the time stated</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">_______________________</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><strong>' . strtoupper($o->office_head) . '</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">Date</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="5" style="font-size:11px">' . $o->position . '</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>

<table width="100%" border="1">
  <tr>
    <td><table width="100%">
      <tr>
        <td width="3%">&nbsp;</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%">&nbsp;</td>
        <td width="4%">&nbsp;</td>
        <td width="16%">&nbsp;</td>
        <td width="3%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="6">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="center"><strong>' . $agency_accountant . '</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">_______________________</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="center">' . $agency_accountant_position . '</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">Date</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>

<pagebreak />
';
        $page2 = '<table width="100%" border="0">
  <tr>
    <td><H1>ROLL - JOB ORDER</H1></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right"></td>
    <td>&nbsp;</td>
    <td align="right"></td>
  </tr>
  <tr>
    <td></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td>' . strtoupper($office_page2) . '</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td><strong>' . $period_page2 . '</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="6">&nbsp;</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%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</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>&nbsp;</td>
	  </tr>';
            $n++;
        }
        $page2 .= '
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><strong>TOTAL</strong></td>
    <td align="right"><strong>' . number_format($grand_total_salary, 2) . '</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right"><strong>' . number_format($grand_total_amount_due, 2) . '</strong></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="100%" border="1">
  <tr>
    <td><table width="100%" border="0">
      <tr>
        <td width="3%">&nbsp;</td>
        <td colspan="2">APPROVED FOR PAYMENT</td>
        <td width="31%">&nbsp;</td>
        <td width="4%">&nbsp;</td>
        <td width="16%">&nbsp;</td>
        <td width="3%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="6">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td width="17%">&nbsp;</td>
        <td width="26%">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">_______________________</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center"><strong>' . $head_of_office . '</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">Date</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">' . $head_of_office_position . '</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="100%" border="1">
  <tr>
    <td><table width="100%" border="0">
      <tr>
        <td width="3%">&nbsp;</td>
        <td colspan="6">CERTIFIED: Each person whose name appears on the above rolls has been</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="6">paid the amount stated opposite his name after identifying himself</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td width="17%">&nbsp;</td>
        <td width="26%">&nbsp;</td>
        <td width="31%">&nbsp;</td>
        <td width="4%">&nbsp;</td>
        <td width="16%">&nbsp;</td>
        <td width="3%">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center"><strong>' . $disbursing_officer . '</strong></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">_______________________</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">Disbursing Officer</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="center">Date</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</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();
    }
Beispiel #2
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();
    ?>
    <?php 
    $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;