Example #1
0
 /**
  * @param string $period
  *
  * @return Carbon
  */
 public function getStartDateForPeriod($period)
 {
     $start = new Carbon();
     switch ($period) {
         default:
         case 'month':
             $start->startOfDay();
             $start->subMonth();
             break;
         case 'year':
             $start->startOfMonth();
             $start->subYear();
             break;
     }
     return $start;
 }
Example #2
0
 function leave_apps_quezon($leave_apps_id = '')
 {
     $rows = $this->Leave_apps->get_leave_apps_info($leave_apps_id);
     $name = $this->Employee->get_employee_info($rows['employee_id']);
     $office_name = $this->Office->get_office_name($name['office_id']);
     $this->load->library('fpdf');
     define('FPDF_FONTPATH', $this->config->item('fonts_path'));
     $this->load->library('fpdi');
     // initiate FPDI
     $pdf = new FPDI('P', 'mm', 'A4');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/APPLICATION_FOR_LEAVE_QUEZON.pdf');
     // select the first page
     $tplIdx = $pdf->importPage(1);
     // use the page we imported
     $pdf->useTemplate($tplIdx);
     // set font, font style, font size.
     $pdf->SetFont('Arial', 'B', 12);
     // set initial placement
     $pdf->SetXY(158, 10.5);
     // line break
     //$pdf->Ln(40);
     $pdf->Write(0, 'Tracking no: ' . $leave_apps_id);
     $pdf->Ln(9);
     $pdf->SetX(158);
     //ID number
     $pdf->Write(0, ' ' . $rows['employee_id']);
     $pdf->Ln(14);
     // go to 25 X (indent)
     $pdf->SetX(25);
     $this->Office->fields = array('office_code', 'office_head', 'position');
     $office = $this->Office->get_office_info($name['office_id']);
     // write office
     //$pdf->Write(0, $office['office_code']);
     //$pdf->Write(0, $office_name);
     //$pdf->SetXY(158,10.5);
     $pdf->SetFont('Arial', '', 7);
     $pdf->MultiCell(60, 5, $office_name);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->SetXY(90, 40);
     //lname
     $pdf->SetX(90);
     $pdf->Write(0, utf8_decode($name['lname']));
     //fname
     $pdf->SetX(145);
     $pdf->Write(0, utf8_decode($name['fname']));
     $extension = '';
     if ($name['extension'] != '') {
         $extension = $name['extension'] . ' ';
         $pdf->SetX(186);
     } else {
         $pdf->SetX(192);
     }
     //mname
     $pdf->Write(0, utf8_decode($extension . $name['mname'][0] . '.'));
     $pdf->Ln(13);
     //date of file
     $pdf->SetX(25);
     $pdf->Write(0, date("F d, Y", strtotime($rows['date_encode'])));
     $pdf->SetFont('Arial', '', 9);
     //position
     $pdf->SetX(70);
     $pdf->Write(0, $name['position']);
     $pdf->SetFont('Arial', 'B', 12);
     // We need to check what salary grade the office use
     if ($office['salary_grade_type'] == 'hospital') {
         $this->Salary_grade->salary_grade_type = 'hospital';
     }
     //monthly salary
     $pdf->SetX(170);
     $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2));
     $pdf->Ln(14);
     $leave_name = $this->Leave_type->get_leave_name($rows['leave_type_id']);
     $leave_type_ids = array(1, 3, 4, 5, 6, 7, 9, 10, 12);
     if (in_array($rows['leave_type_id'], $leave_type_ids)) {
         $pdf->Ln(2);
         $pdf->SetX(28);
         $pdf->Write(0, 'X');
         $pdf->Ln(15);
         $pdf->SetX(34);
         if ($rows['leave_type_id'] == 1) {
             $leave_name = '';
         }
         $pdf->SetFont('Arial', 'B', 10);
         $pdf->Write(0, $leave_name);
         $pdf->SetFont('Arial', 'B', 12);
     }
     $leave_type_ids = array(2, 11, 20);
     if (in_array($rows['leave_type_id'], $leave_type_ids)) {
         $pdf->Ln(27);
         $pdf->SetX(28);
         $pdf->Write(0, 'X');
         $pdf->Ln(18);
         $pdf->SetX(32);
         if ($rows['leave_type_id'] == 2) {
             $leave_name = '';
         }
         $pdf->SetFont('Arial', 'B', 10);
         $pdf->Write(0, $leave_name);
         $pdf->SetFont('Arial', 'B', 12);
     }
     $pdf->Ln(35);
     $pdf->SetXY(35, 128);
     $days = 'day';
     if ($rows['days'] > 1) {
         $days = 'days';
     }
     $pdf->Write(0, $rows['days'] . ' ' . $days);
     $date_leave = $this->Helps->get_month_name($rows['month']) . ' ' . $rows['multiple'] . ', ' . $rows['year'];
     if ($rows['multiple5'] != '') {
         $date_leave .= ' - ' . $this->Helps->get_month_name($rows['month5']) . ' ' . $rows['multiple5'] . ', ' . $rows['year5'];
     }
     $pdf->Ln(4);
     $pdf->SetX(60);
     $pdf->Write(0, $date_leave);
     $last_earn = $this->Leave_card->get_last_earn($rows['employee_id']);
     //$last_earn = date('F d, Y', strtotime($last_earn));
     if ($last_earn != '') {
         $record_limit_date = $last_earn;
         $last_earn = date('F d, Y', strtotime($last_earn));
     } else {
         $dt = new Carbon();
         $dt->subMonth();
         //echo 'last day of '. $this->Helps->get_month_name($dt->month).' '.$dt->year;
         $date = new Carbon('last day of ' . $this->Helps->get_month_name($dt->month) . ' ' . $dt->year);
         //return;
         $last_earn = $this->Helps->get_month_name($date->month) . ' ' . $date->day . ', ' . $date->year;
         $record_limit_date = $date->year . '-' . $date->month . '-' . $date->day;
         //$last_earn = date('F d, Y');
     }
     $credits = $this->Leave_card->get_total_leave_credits($rows['employee_id'], $record_limit_date);
     $pdf->Ln(39);
     $pdf->SetX(35);
     $pdf->Write(0, $last_earn);
     //balances
     $pdf->Ln(18);
     $pdf->SetX(25);
     //$pdf->Write(0, $vbalance);
     $pdf->Write(0, number_format($credits['vacation'], 3));
     $pdf->SetX(54);
     //$pdf->Write(0, $sbalance);
     $pdf->Write(0, number_format($credits['sick'], 3));
     $total_leave_balance = $credits['vacation'] + $credits['sick'];
     $pdf->SetX(80);
     $pdf->Write(0, number_format($total_leave_balance, 3));
     // set font, font style, font size.
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Ln(9);
     $pdf->SetX(136);
     //credits
     //vaation
     $pdf->Ln(23);
     $pdf->SetX(52);
     //$pdf->Write(0, number_format($vacation_leave, 3));
     //sick
     //$pdf->Ln(9);
     $pdf->SetX(108);
     //$pdf->Write(0, number_format($sick_leave, 3));
     //total
     //$pdf->Ln(7);
     $pdf->SetX(160);
     //$pdf->Write(0, number_format($vacation_leave + $sick_leave, 3));
     //date for the day
     $pdf->Ln(21);
     $pdf->SetX(67);
     //day
     //$pdf->Write(0, date('jS'));
     $pdf->SetX(104);
     //$pdf->Write(0, date('F'));
     //year
     $pdf->SetX(138);
     //$pdf->Write(0, date('Y'));
     //MR or MS. request
     $pdf->Ln(7);
     //$pdf->Image('white.png',10,10,-300);
     $pdf->SetX(32);
     $statement_certified = Setting::getField('statement_certified');
     $statement_certified_position = Setting::getField('statement_certified_position');
     $pdf->SetXY(35, 205);
     $pdf->SetFillColor(255, 255, 255);
     $pdf->Cell(65, 5, strtoupper(utf8_decode($statement_certified)), '', 0, 'C', 1);
     $pdf->SetXY(35, 211);
     $pdf->SetFont('Arial', 'I', 11);
     $pdf->Cell(65, 5, $statement_certified_position, '', 0, 'C', 1);
     $pdf->SetXY(129, 139);
     $pdf->Cell(65, 5, utf8_decode($name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname']), '', 0, 'C', 1);
     //$pdf->SetXY(129, 200);
     //$pdf->Cell(65,5, $office['office_head'],'',0,'C',1);
     $pdf->SetXY(129, 206);
     //$pdf->Cell(65,5, utf8_decode($office['office_head']),'',0,'C',1);
     //$pdf->Cell(65,5, $office['position'],'',0,'C',1);
     //$pdf->Cell(65,5, $office['office_head'],'',0,'C',1);
     // For quezon province
     $final_approval_leave_application = Setting::getField('final_approval_leave_application');
     $final_approval_leave_application_designation = Setting::getField('final_approval_leave_application_designation');
     $pdf->SetXY(70, 255);
     $pdf->Cell(65, 5, utf8_decode($final_approval_leave_application), '', 0, 'C', 1);
     $pdf->SetXY(70, 260);
     $pdf->Cell(65, 5, $final_approval_leave_application_designation, '', 0, 'C', 1);
     //$pdf->Write(0, 'hahaha');
     header('Cache-Control: maxage=3600');
     //Adjust maxage appropriately
     header('Pragma: public');
     $pdf->Output('dtr/reports/leave-apps-' . $rows['employee_id'] . '.pdf', 'I');
 }
Example #3
0
 public function deactivateAbandonedLenders()
 {
     $thirteenMonthsAgo = new Carbon();
     $thirteenMonthsAgo->subMonths(13);
     $oneMonthAgo = new Carbon();
     $oneMonthAgo->subMonth();
     $lenders = LenderQuery::create()->useUserQuery()->filterAbandoned($thirteenMonthsAgo)->useNotificationQuery()->filterByType("abandoned")->filterByCreatedAt(['max' => $oneMonthAgo])->endUse()->endUse()->find();
     foreach ($lenders as $lender) {
         $this->deactivateLender($lender);
     }
 }
Example #4
0
 /**
  * Adjusts a date that has rolled over back to the previous month; setting the day
  * to the last day of the previous month; time values are maintained.
  *
  * @param Carbon $date
  * @param Carbon $original_date
  *
  * @return \DateTime
  */
 protected function refactorRolledOverDate(Carbon $date, Carbon $original_date)
 {
     return $date->subMonth()->endOfMonth()->setTime($original_date->hour, $original_date->minute, $original_date->second);
 }
 public function getOrderedBalancesByDate(Account $acc, Carbon $date)
 {
     $end = $date->copy();
     $start = $date->subMonth();
     return $this->createQueryBuilder('ab')->leftJoin('ab.account', 'acc')->where('acc = :account')->andWhere('ab.created_at >= :start')->andWhere('ab.created_at <= :end')->addOrderBy('ab.created_at', 'ASC')->setParameters(['account' => $acc, 'start' => $start, 'end' => $end])->getQuery()->getResult();
 }
Example #6
0
$e = new Employee_m();
if (!empty($rows)) {
    foreach ($rows as $row) {
        $id = $row['id'];
        $employee_id = $row['employee_id'];
        $lgu_code = Setting::getField('lgu_code');
        $dt = new Carbon();
        // Quezon Province
        if ($lgu_code == 'quezon_province') {
            $last_earn = $this->Leave_card->get_last_earn($rows['employee_id']);
            if ($last_earn != '') {
                $record_limit_date = $last_earn;
                $last_earn = date('F d, Y', strtotime($last_earn));
            } else {
                $dt = new Carbon();
                $dt->subMonth();
                $date = new Carbon('last day of ' . $this->Helps->get_month_name($dt->month) . ' ' . $dt->year);
                $last_earn = $this->Helps->get_month_name($date->month) . ' ' . $date->day . ', ' . $date->year;
                $record_limit_date = $date->year . '-' . $date->month . '-' . $date->day;
                $total_leave = $this->Leave_card->get_total_leave_credits($employee_id, $record_limit_date);
            }
            //$this->leave_certification_marinduque($vl, $sl, $employee_id);
            //return;
        } else {
            // total leave
            $total_leave = $this->Leave_card->get_total_leave_credits($employee_id);
        }
        $office_name = $this->Office->get_office_name($row['office_id']);
        $bg = $this->Helps->set_line_colors();
        ?>
  <tr bgcolor="<?php