function getROE($rlf = NULL, $show_background = TRUE)
 {
     if (!is_object($rlf) and $this->getId() != '') {
         $rlf = new ROEListFactory();
         $rlf->getById($this->getId());
     }
     if (get_class($rlf) !== 'ROEListFactory') {
         return FALSE;
     }
     $border = 0;
     if ($rlf->getRecordCount() > 0) {
         $ppsf = new PayPeriodScheduleListFactory();
         $pay_period_type_options = $ppsf->getOptions('type');
         $pdf = new TTPDF();
         $pdf->setMargins(0, 0, 0, 0);
         $pdf->SetAutoPageBreak(FALSE);
         foreach ($rlf as $r_obj) {
             $pdf->SetFont('freesans', '', 12);
             //Get User information
             $ulf = new UserListFactory();
             $user_obj = $ulf->getById($r_obj->getUser())->getCurrent();
             $ulf = new UserListFactory();
             $created_user_obj = $ulf->getById($r_obj->getCreatedBy())->getCurrent();
             //Get company information
             $clf = new CompanyListFactory();
             $company_obj = $clf->getById($user_obj->getCompany())->getCurrent();
             $pdf->AddPage();
             if ($show_background == TRUE) {
                 $pdf->Image(Environment::getImagesPath() . 'roe-template.jpg', 0, 0, 210, 300);
             }
             //Serial
             $pdf->setXY(10, 17);
             $pdf->Cell(55, 10, $r_obj->getSerial(), $border, 0, 'L');
             //Employer Info
             $pdf->setXY(10, 30);
             $pdf->Cell(120, 10, $company_obj->getName(), $border, 0, 'L');
             $pdf->setXY(10, 40);
             $pdf->Cell(120, 10, $company_obj->getAddress1() . ' ' . $company_obj->getAddress2(), $border, 0, 'L');
             $pdf->setXY(10, 50);
             $pdf->Cell(90, 10, $company_obj->getCity() . ', ' . $company_obj->getProvince(), $border, 0, 'L');
             $postal_code_a = substr($company_obj->getPostalCode(), 0, 3);
             $postal_code_b = substr($company_obj->getPostalCode(), 3, 6);
             $pdf->setXY(110, 50);
             $pdf->Cell(10, 10, $postal_code_a, $border, 0, 'L');
             $pdf->setXY(122, 50);
             $pdf->Cell(10, 10, $postal_code_b, $border, 0, 'L');
             //Business Number
             $pdf->setXY(138, 28);
             $pdf->Cell(120, 10, $company_obj->getBusinessNumber(), $border, 0, 'L');
             //Pay Period Type
             $pdf->setXY(138, 40);
             $pdf->Cell(50, 10, $pay_period_type_options[$r_obj->getPayPeriodType()], $border, 0, 'L');
             //SIN
             $pdf->setXY(138, 50);
             $pdf->Cell(50, 10, $user_obj->getSIN(), $border, 0, 'L');
             //Employee info
             $pdf->SetFontSize(10);
             $pdf->setXY(10, 75);
             $pdf->Cell(90, 5, $user_obj->getFullName(), $border, 0, 'L');
             $pdf->setXY(10, 80);
             $pdf->Cell(90, 5, $user_obj->getAddress1() . ' ' . $user_obj->getAddress2(), $border, 0, 'L');
             $pdf->setXY(10, 85);
             $pdf->Cell(90, 5, $user_obj->getCity() . ', ' . $user_obj->getProvince() . ' ' . $user_obj->getPostalCode(), $border, 0, 'L');
             $pdf->SetFontSize(12);
             //Employee Title
             if (is_object($user_obj->getTitleObject())) {
                 $title = $user_obj->getTitleObject()->getName();
             } else {
                 $title = NULL;
             }
             $pdf->setXY(10, 100);
             $pdf->Cell(90, 10, $title, $border, 0, 'L');
             //First Day Worked
             $pdf->SetFontSize(10);
             $first_date = getdate($r_obj->getFirstDate());
             $pdf->setXY(175, 64);
             $pdf->Cell(8, 10, $first_date['mday'], $border, 0, 'C');
             $pdf->setXY(185, 64);
             $pdf->Cell(8, 10, $first_date['mon'], $border, 0, 'C');
             $pdf->setXY(196, 64);
             $pdf->Cell(10, 10, $first_date['year'], $border, 0, 'C');
             //Last day paid
             $last_date = getdate($r_obj->getLastDate());
             $pdf->setXY(175, 75);
             $pdf->Cell(8, 10, $last_date['mday'], $border, 0, 'C');
             $pdf->setXY(185, 75);
             $pdf->Cell(8, 10, $last_date['mon'], $border, 0, 'C');
             $pdf->setXY(196, 75);
             $pdf->Cell(10, 10, $last_date['year'], $border, 0, 'C');
             //Pay Period End Date
             $pay_period_end_date = getdate($r_obj->getPayPeriodEndDate());
             $pdf->setXY(175, 86);
             $pdf->Cell(8, 10, $pay_period_end_date['mday'], $border, 0, 'C');
             $pdf->setXY(185, 86);
             $pdf->Cell(8, 10, $pay_period_end_date['mon'], $border, 0, 'C');
             $pdf->setXY(196, 86);
             $pdf->Cell(10, 10, $pay_period_end_date['year'], $border, 0, 'C');
             //Insurable Hours
             $pdf->SetFontSize(10);
             $pdf->setXY(75, 113);
             $pdf->Cell(25, 10, Misc::getBeforeDecimal($r_obj->getInsurableHours()), $border, 0, 'R');
             $pdf->setXY(101, 113);
             $pdf->Cell(10, 10, Misc::getAfterDecimal(Misc::MoneyFormat($r_obj->getInsurableHours(), FALSE)), $border, 0, 'L');
             //Enter Code
             $pdf->setXY(185, 113);
             $pdf->Cell(10, 10, $r_obj->getCode(), $border, 0, 'C');
             //Further Information Contact Name
             $pdf->setXY(130, 126);
             $pdf->Cell(75, 5, $created_user_obj->getFullName(), $border, 0, 'R');
             $pdf->setXY(130, 132);
             $pdf->Cell(75, 10, $created_user_obj->getWorkPhone(), $border, 0, 'R');
             //Insurable Earnings
             $pdf->setXY(75, 131);
             $pdf->Cell(25, 10, Misc::getBeforeDecimal($r_obj->getInsurableEarnings()), $border, 0, 'R');
             $pdf->setXY(101, 131);
             $pdf->Cell(10, 10, Misc::getAfterDecimal(Misc::MoneyFormat($r_obj->getInsurableEarnings(), FALSE)), $border, 0, 'L');
             //Check to see if a pay period didn't have earnings.
             if ($r_obj->isPayPeriodWithNoEarnings() == TRUE) {
                 $pay_period_earnings = $r_obj->getInsurableEarningsByPayPeriod();
                 if (is_array($pay_period_earnings)) {
                     //Add additional entries for testing alignment purposes.
                     /*
                     for( $y=0; $y < 14; $y++ ) {
                     	$pay_period_earnings[] = array('amount' => rand(1,10) );
                     }
                     */
                     $top_left_x = $x = Misc::AdjustXY(30, 0);
                     $top_left_y = $y = Misc::AdjustXY(157, 0);
                     $col = 1;
                     $i = 1;
                     foreach ($pay_period_earnings as $pay_period_earning) {
                         Debug::Text('I: ' . $i . ' X: ' . $x . ' Y: ' . $y . ' Col: ' . $col . ' Amount: ' . (double) $pay_period_earning['amount'], __FILE__, __LINE__, __METHOD__, 10);
                         $pdf->setXY($x, $y);
                         $pdf->Cell(6, 6, Misc::MoneyFormat((double) $pay_period_earning['amount'], FALSE), $border, 0, 'R');
                         if ($i > 0 and $i % 3 == 0) {
                             $x = $top_left_x;
                             $y += 7;
                         } else {
                             $x += 35;
                         }
                         $i++;
                     }
                 }
             }
             //Box 17A, Vacation pay in last pay period.
             $vacation_pay = $r_obj->getLastPayPeriodVacationEarnings();
             if ($vacation_pay > 0) {
                 $pdf->setXY(132, 155);
                 $pdf->Cell(10, 10, Misc::getBeforeDecimal(Misc::MoneyFormat($vacation_pay, FALSE)), $border, 0, 'R');
                 $pdf->Cell(10, 10, Misc::getAfterDecimal(Misc::MoneyFormat($vacation_pay, FALSE)), $border, 0, 'L');
             }
             //Comments
             $pdf->setXY(115, 212);
             $pdf->MultiCell(85, 5, $r_obj->getComments(), $border, 'L');
             //English
             $pdf->setXY(8.5, 256.5);
             $pdf->Cell(10, 10, 'X', $border, 0, 'L');
             //ROE creator phone number
             $pdf->setXY(75, 258);
             $pdf->Cell(25, 10, $created_user_obj->getWorkPhone(), $border, 0, 'L');
             //ROE create name.
             $pdf->SetFontSize(12);
             $pdf->setXY(87, 273);
             $pdf->Cell(75, 10, $created_user_obj->getFullName(), $border, 0, 'C');
             //Create Date
             $created_date = getdate($r_obj->getCreatedDate());
             $pdf->SetFontSize(10);
             $pdf->setXY(175, 273);
             $pdf->Cell(8, 10, $created_date['mday'], $border, 0, 'C');
             $pdf->setXY(185, 273);
             $pdf->Cell(8, 10, $created_date['mon'], $border, 0, 'C');
             $pdf->setXY(195, 273);
             $pdf->Cell(10, 10, $created_date['year'], $border, 0, 'C');
         }
         $output = $pdf->Output('', 'S');
     }
     if (isset($output)) {
         return $output;
     }
     return FALSE;
 }
Beispiel #2
0
         $delete = TRUE;
     } else {
         $delete = FALSE;
     }
     $roelf = new ROEListFactory();
     foreach ($ids as $id) {
         $roelf->GetById($id);
         foreach ($roelf as $roe) {
             $roe->setDeleted($delete);
             $roe->Save();
         }
     }
     Redirect::Page(URLBuilder::getURL(array('user_id' => $user_id), 'ROEList.php'));
     break;
 default:
     $roelf = new ROEListFactory();
     /*
     if ( $permission->Check('company','view') ) {
     	//View all default_schedules
     	//$dsclf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
     	$ulf->GetAll( $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
     } else {
                 //$dsclf->GetByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, array($sort_column => $sort_order) );
     	//$dsclf->GetByUserId($current_user->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
     	$ulf->GetByCompanyID($current_company->getID(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array );
     }
     */
     $roelf->getByUserId($user_id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
     $pager = new Pager($roelf);
     $roe_code_options = $roelf->getOptions('code');
     foreach ($roelf as $roe) {
Beispiel #3
0
     BreadCrumb::setCrumb($title);
     $roelf = new ROEListFactory();
     $roelf->getById($id);
     foreach ($roelf as $roe) {
         //Debug::Arr($department,'Department', __FILE__, __LINE__, __METHOD__,10);
         $roe_data = array('id' => $roe->getId(), 'user_id' => $roe->getUser(), 'pay_period_type_id' => $roe->getPayPeriodType(), 'code_id' => $roe->getCode(), 'first_date' => $roe->getFirstDate(), 'last_date' => $roe->getLastDate(), 'pay_period_end_date' => $roe->getPayPeriodEndDate(), 'recall_date' => $roe->getRecallDate(), 'insurable_hours' => $roe->getInsurableHours(), 'insurable_earnings' => $roe->getInsurableEarnings(), 'vacation_pay' => $roe->getVacationPay(), 'serial' => $roe->getSerial(), 'comments' => $roe->getComments(), 'created_date' => $roe->getCreatedDate(), 'created_by' => $roe->getCreatedBy(), 'updated_date' => $roe->getUpdatedDate(), 'updated_by' => $roe->getUpdatedBy(), 'deleted_date' => $roe->getDeletedDate(), 'deleted_by' => $roe->getDeletedBy());
     }
 } elseif (!isset($action)) {
     //Get all the data we should need for this ROE in regards to pay period and such
     //Guess for end dates...
     //get User data for hire date
     $ulf = new UserListFactory();
     $user_obj = $ulf->getById($user_id)->getCurrent();
     $plf = new PunchListFactory();
     //Is there a previous ROE? If so, find first shift back since ROE was issued.
     $rlf = new ROEListFactory();
     $rlf->getLastROEByUserId($user_id);
     if ($rlf->getRecordCount() > 0) {
         $roe_obj = $rlf->getCurrent();
         Debug::Text('Previous ROE Last Date: ' . TTDate::getDate('DATE+TIME', $roe_obj->getLastDate()), __FILE__, __LINE__, __METHOD__, 10);
         //$plf->getFirstPunchByUserIDAndEpoch( $user_id, $roe_obj->getLastDate() );
         $plf->getNextPunchByUserIdAndEpoch($user_id, $roe_obj->getLastDate());
         if ($plf->getRecordCount() > 0) {
             $first_date = $plf->getCurrent()->getTimeStamp();
         }
     }
     if (!isset($first_date) or $first_date == '') {
         $first_date = $user_obj->getHireDate();
     }
     Debug::Text('First Date: ' . TTDate::getDate('DATE+TIME', $first_date), __FILE__, __LINE__, __METHOD__, 10);
     //Get last shift worked (not scheduled)