function exportPayStubAmendment($psalf = NULL, $export_type = NULL) { global $current_company; if (!is_object($psalf) and $this->getId() != '') { $psalf = TTnew('PayStubAmendmentListFactory'); $psalf->getById($this->getId()); } if (get_class($psalf) !== 'PayStubAmendmentListFactory') { return FALSE; } if ($export_type == '') { return FALSE; } if ($psalf->getRecordCount() > 0) { Debug::Text('aExporting...', __FILE__, __LINE__, __METHOD__, 10); switch (strtolower($export_type)) { case 'eft_hsbc': case 'eft_1464': case 'eft_105': case 'eft_ach': case 'eft_beanstream': //Get file creation number $ugdlf = TTnew('UserGenericDataListFactory'); $ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE); if ($ugdlf->getRecordCount() > 0) { $ugd_obj = $ugdlf->getCurrent(); $setup_data = $ugd_obj->getData(); } else { $ugd_obj = TTnew('UserGenericDataFactory'); } Debug::Text('bExporting...', __FILE__, __LINE__, __METHOD__, 10); //get User Bank account info $balf = TTnew('BankAccountListFactory'); $balf->getCompanyAccountByCompanyId($current_company->getID()); if ($balf->getRecordCount() > 0) { $company_bank_obj = $balf->getCurrent(); //Debug::Arr($company_bank_obj,'Company Bank Object', __FILE__, __LINE__, __METHOD__,10); } if (isset($setup_data['file_creation_number'])) { $setup_data['file_creation_number']++; } else { //Start at a high number, in attempt to eliminate conflicts. $setup_data['file_creation_number'] = 500; } Debug::Text('bFile Creation Number: ' . $setup_data['file_creation_number'], __FILE__, __LINE__, __METHOD__, 10); //Increment file creation number in DB if ($ugd_obj->getId() == '') { $ugd_obj->setID($ugd_obj->getId()); } $ugd_obj->setCompany($current_company->getId()); $ugd_obj->setScript('PayStubFactory'); $ugd_obj->setName('PayStubFactory'); $ugd_obj->setData($setup_data); $ugd_obj->setDefault(TRUE); if ($ugd_obj->isValid()) { $ugd_obj->Save(); } $eft = new EFT(); $eft->setFileFormat(str_replace('eft_', '', $export_type)); $eft->setBusinessNumber($current_company->getBusinessNumber()); //ACH $eft->setOriginatorID($current_company->getOriginatorID()); $eft->setFileCreationNumber($setup_data['file_creation_number']); $eft->setInitialEntryNumber($current_company->getOtherID5()); //ACH $eft->setDataCenter($current_company->getDataCenterID()); $eft->setDataCenterName($current_company->getOtherID4()); //ACH $eft->setOriginatorShortName($current_company->getShortName()); foreach ($psalf as $key => $psa_obj) { //Can only export fixed amount PS amendemnts? if ($psa_obj->getType() == 10) { Debug::Text('Looping over Pay Stub Amendment... ID: ' . $psa_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); //Get User information $ulf = TTnew('UserListFactory'); $user_obj = $ulf->getById($psa_obj->getUser())->getCurrent(); //Get company information $clf = TTnew('CompanyListFactory'); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); //get User Bank account info $balf = TTnew('BankAccountListFactory'); $user_bank_obj = $balf->getUserAccountByCompanyIdAndUserId($user_obj->getCompany(), $user_obj->getId()); if ($user_bank_obj->getRecordCount() > 0) { $user_bank_obj = $user_bank_obj->getCurrent(); } else { continue; } $amount = $psa_obj->getAmount(); if ($amount > 0) { $record = new EFT_Record(); $record->setType('C'); $record->setCPACode(200); $record->setAmount($amount); $record->setDueDate(TTDate::getBeginDayEpoch($psa_obj->getEffectiveDate())); $record->setInstitution($user_bank_obj->getInstitution()); $record->setTransit($user_bank_obj->getTransit()); $record->setAccount($user_bank_obj->getAccount()); $record->setName($user_obj->getFullName()); $record->setOriginatorShortName($company_obj->getShortName()); $record->setOriginatorLongName(substr($company_obj->getName(), 0, 30)); $record->setOriginatorReferenceNumber('PSA' . $psa_obj->getId()); if (isset($company_bank_obj) and is_object($company_bank_obj)) { $record->setReturnInstitution($company_bank_obj->getInstitution()); $record->setReturnTransit($company_bank_obj->getTransit()); $record->setReturnAccount($company_bank_obj->getAccount()); } $eft->setRecord($record); } unset($amount); $this->getProgressBarObject()->set(NULL, $key); } else { Debug::Text('Skipping percent PS amendment... ID: ' . $psa_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); } } $eft->compile(); $output = $eft->getCompiledData(); break; case 'cheque_9085': case 'cheque_9209p': case 'cheque_dlt103': case 'cheque_dlt104': case 'cheque_cr_standard_form_1': case 'cheque_cr_standard_form_2': //Wait until Cheque class is created first. $cheque_form_obj = $this->getChequeFormsObject(str_replace('cheque_', '', $export_type)); $psealf = TTnew('PayStubEntryAccountListFactory'); $i = 0; foreach ($psalf as $key => $psa_obj) { //Can only export fixed amount PS amendemnts? if ($psa_obj->getType() == 10) { //Get User information $ulf = TTnew('UserListFactory'); $user_obj = $ulf->getById($psa_obj->getUser())->getCurrent(); //Get company information $clf = TTnew('CompanyListFactory'); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); if ($user_obj->getCountry() == 'CA') { $date_format = 'd/m/Y'; } else { $date_format = 'm/d/Y'; } $pay_stub_amendment = array('id' => $psa_obj->getId(), 'display_id' => str_pad($psa_obj->getId(), 15, 0, STR_PAD_LEFT), 'user_id' => $psa_obj->getUser(), 'status' => $psa_obj->getStatus(), 'amount' => $psa_obj->getAmount(), 'date' => TTDate::getTime(), 'full_name' => $user_obj->getFullName(), 'address1' => $user_obj->getAddress1(), 'address2' => $user_obj->getAddress2(), 'city' => $user_obj->getCity(), 'province' => $user_obj->getProvince(), 'postal_code' => $user_obj->getPostalCode(), 'country' => $user_obj->getCountry(), 'company_name' => $company_obj->getName(), 'symbol' => $psa_obj->getUserObject()->getCurrencyObject()->getSymbol(), 'created_date' => $psa_obj->getCreatedDate(), 'created_by' => $psa_obj->getCreatedBy(), 'updated_date' => $psa_obj->getUpdatedDate(), 'updated_by' => $psa_obj->getUpdatedBy(), 'deleted_date' => $psa_obj->getDeletedDate(), 'deleted_by' => $psa_obj->getDeletedBy()); $cheque_form_obj->addRecord($pay_stub_amendment); $this->getFormObject()->addForm($cheque_form_obj); $this->getProgressBarObject()->set(NULL, $key); } else { Debug::Text('Skipping percent PS amendment... ID: ' . $psa_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); } $this->getProgressBarObject()->set(NULL, $i); $i++; } if (stristr($export_type, 'cheque')) { $output_format = 'PDF'; } $output = $this->getFormObject()->output($output_format); break; } } if (isset($output)) { return $output; } return FALSE; }
function exportPayStub($pslf = NULL, $export_type = NULL) { global $current_company; if (!is_object($pslf) and $this->getId() != '') { $pslf = new PayStubListFactory(); $pslf->getById($this->getId()); } if (get_class($pslf) !== 'PayStubListFactory') { return FALSE; } if ($export_type == '') { return FALSE; } if ($pslf->getRecordCount() > 0) { Debug::Text('aExporting...', __FILE__, __LINE__, __METHOD__, 10); switch (strtolower($export_type)) { case 'hsbc': case '1464': case '105': case 'ach': //Get file creation number $ugdlf = new UserGenericDataListFactory(); $ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE); if ($ugdlf->getRecordCount() > 0) { Debug::Text('Found Script Setup Data!', __FILE__, __LINE__, __METHOD__, 10); $ugd_obj = $ugdlf->getCurrent(); $setup_data = $ugd_obj->getData(); } else { $ugd_obj = new UserGenericDataFactory(); } Debug::Text('bExporting...', __FILE__, __LINE__, __METHOD__, 10); //get User Bank account info $balf = new BankAccountListFactory(); $balf->getCompanyAccountByCompanyId($current_company->getID()); if ($balf->getRecordCount() > 0) { $company_bank_obj = $balf->getCurrent(); //Debug::Arr($company_bank_obj,'Company Bank Object', __FILE__, __LINE__, __METHOD__,10); } if (isset($setup_data['file_creation_number'])) { $setup_data['file_creation_number']++; } else { //Start at a high number, in attempt to eliminate conflicts. $setup_data['file_creation_number'] = 500; } Debug::Text('bFile Creation Number: ' . $setup_data['file_creation_number'], __FILE__, __LINE__, __METHOD__, 10); //Increment file creation number in DB if ($ugd_obj->getId() == '') { $ugd_obj->setID($ugd_obj->getId()); } $ugd_obj->setCompany($current_company->getId()); $ugd_obj->setName('PayStubFactory'); $ugd_obj->setScript('PayStubFactory'); $ugd_obj->setData($setup_data); $ugd_obj->setDefault(TRUE); if ($ugd_obj->isValid()) { $ugd_obj->Save(); } $eft = new EFT(); $eft->setFileFormat($export_type); $eft->setOriginatorID($current_company->getOriginatorID()); $eft->setFileCreationNumber($setup_data['file_creation_number']); $eft->setDataCenter($current_company->getDataCenterID()); $eft->setOriginatorShortName($current_company->getShortName()); $psealf = new PayStubEntryAccountListFactory(); foreach ($pslf as $pay_stub_obj) { Debug::Text('Looping over Pay Stub... ID: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); //Get pay stub entries. $pself = new PayStubEntryListFactory(); $pself->getByPayStubId($pay_stub_obj->getId()); $prev_type = NULL; $description_subscript_counter = 1; foreach ($pself as $pay_stub_entry) { $description_subscript = NULL; //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent(); $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent(); if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) { $type = $pay_stub_entry_name_obj->getType(); } //var_dump( $pay_stub_entry->getDescription() ); if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) { $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription()); $description_subscript = $description_subscript_counter; $description_subscript_counter++; } if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) { $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy()); } $prev_type = $pay_stub_entry_name_obj->getType(); } if (isset($pay_stub_entries)) { $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 12, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy()); unset($pay_stub_entries); //Get User information $ulf = new UserListFactory(); $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent(); //Get company information $clf = new CompanyListFactory(); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); //get User Bank account info $balf = new BankAccountListFactory(); $user_bank_obj = $balf->getUserAccountByCompanyIdAndUserId($user_obj->getCompany(), $user_obj->getId()); if ($user_bank_obj->getRecordCount() > 0) { $user_bank_obj = $user_bank_obj->getCurrent(); } else { continue; } $record = new EFT_Record(); $record->setType('C'); $amount = $pay_stub['entries'][40][0]['amount']; $record->setCPACode(200); $record->setAmount($amount); unset($amount); $record->setDueDate(TTDate::getBeginDayEpoch($pay_stub_obj->getTransactionDate())); //$record->setDueDate( strtotime("24-Sep-99") ); $record->setInstitution($user_bank_obj->getInstitution()); $record->setTransit($user_bank_obj->getTransit()); $record->setAccount($user_bank_obj->getAccount()); $record->setName($user_obj->getFullName()); $record->setOriginatorShortName($company_obj->getShortName()); $record->setOriginatorLongName(substr($company_obj->getName(), 0, 30)); $record->setOriginatorReferenceNumber('TT' . $pay_stub_obj->getId()); if (isset($company_bank_obj) and is_object($company_bank_obj)) { $record->setReturnInstitution($company_bank_obj->getInstitution()); $record->setReturnTransit($company_bank_obj->getTransit()); $record->setReturnAccount($company_bank_obj->getAccount()); } $eft->setRecord($record); } } $eft->compile(); $output = $eft->getCompiledData(); break; case 'cheque_9085': case 'cheque_9209p': case 'cheque_dlt103': case 'cheque_dlt104': case 'cheque_cr_standard_form_1': case 'cheque_cr_standard_form_2': $border = 0; $show_background = 0; $pdf = new TTPDF(); $pdf->setMargins(0, 0, 0, 0); $pdf->SetAutoPageBreak(FALSE); $pdf->SetFont('freeserif', '', 10); $psealf = new PayStubEntryAccountListFactory(); $i = 0; foreach ($pslf as $pay_stub_obj) { //Get pay stub entries. $pself = new PayStubEntryListFactory(); $pself->getByPayStubId($pay_stub_obj->getId()); $pay_stub_entries = NULL; $prev_type = NULL; $description_subscript_counter = 1; foreach ($pself as $pay_stub_entry) { $description_subscript = NULL; //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent(); $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent(); //Use this to put the total for each type at the end of the array. if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) { $type = $pay_stub_entry_name_obj->getType(); } //Debug::text('Pay Stub Entry Name ID: '. $pay_stub_entry_name_obj->getId() .' Type ID: '. $pay_stub_entry_name_obj->getType() .' Type: '. $type, __FILE__, __LINE__, __METHOD__,10); //var_dump( $pay_stub_entry->getDescription() ); if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) { $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription()); $description_subscript = $description_subscript_counter; $description_subscript_counter++; } $amount_words = str_pad(ucwords(Numbers_Words::toWords(floor($pay_stub_entry->getAmount()), "en_US")) . ' ', 65, "-", STR_PAD_RIGHT); //echo "Amount: ". floor($pay_stub_entry->getAmount()) ." - Words: ". $amount_words ."<br>\n"; //var_dump($amount_words); if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) { $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'amount_padded' => str_pad($pay_stub_entry->getAmount(), 12, '*', STR_PAD_LEFT), 'amount_words' => $amount_words, 'amount_cents' => Misc::getAfterDecimal($pay_stub_entry->getAmount()), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy()); } unset($amount_words); //Only for net pay, make a total YTD of Advance plus Net. /* if ( $type == 40 ) { $pay_stub_entries[$type][0]['ytd_net_plus_advance'] = } */ $prev_type = $pay_stub_entry_name_obj->getType(); } //Get User information $ulf = new UserListFactory(); $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent(); //Get company information $clf = new CompanyListFactory(); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); if ($user_obj->getCountry() == 'CA') { $date_format = 'd/m/Y'; } else { $date_format = 'm/d/Y'; } $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 15, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'transaction_date_display' => date($date_format, $pay_stub_obj->getTransactionDate()), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'tainted' => $pay_stub_obj->getTainted(), 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy()); unset($pay_stub_entries); Debug::text($i . '. Pay Stub Transaction Date: ' . $pay_stub_obj->getTransactionDate(), __FILE__, __LINE__, __METHOD__, 10); //Get Pay Period information $pplf = new PayPeriodListFactory(); $pay_period_obj = $pplf->getById($pay_stub_obj->getPayPeriod())->getCurrent(); $pp_start_date = $pay_period_obj->getStartDate(); $pp_end_date = $pay_period_obj->getEndDate(); $pp_transaction_date = $pay_period_obj->getTransactionDate(); //Get pay period numbers $ppslf = new PayPeriodScheduleListFactory(); $pay_period_schedule_obj = $ppslf->getById($pay_period_obj->getPayPeriodSchedule())->getCurrent(); $pay_period_data = array('start_date' => TTDate::getDate('DATE', $pp_start_date), 'end_date' => TTDate::getDate('DATE', $pp_end_date), 'transaction_date' => TTDate::getDate('DATE', $pp_transaction_date), 'annual_pay_periods' => $pay_period_schedule_obj->getAnnualPayPeriods()); $pdf->AddPage(); switch ($export_type) { case 'cheque_9085': $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(42, $adjust_y)); $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L'); $pdf->Cell(15, 5, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(130, $adjust_x), Misc::AdjustXY(50, $adjust_y)); $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(175, $adjust_x), Misc::AdjustXY(50, $adjust_y)); $pdf->Cell(23, 5, ' ' . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(55, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(60, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getAddress1() . ' ' . $user_obj->getAddress2(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(17, $adjust_x), Misc::AdjustXY(65, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getCity() . ', ' . $user_obj->getProvince() . ' ' . $user_obj->getPostalCode(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 95; $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); //Earnings $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); break; case 'cheque_9209p': $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9209P.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(42, $adjust_y)); $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L'); $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(25, $adjust_y)); $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(25, $adjust_y)); $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(42, $adjust_y)); $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(57, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(62, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getAddress1() . ' ' . $user_obj->getAddress2(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(67, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getCity() . ', ' . $user_obj->getProvince() . ' ' . $user_obj->getPostalCode(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 100; $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); //Earnings $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); break; case 'cheque_dlt103': $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_dlt103.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(54, $adjust_y)); $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L'); $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(46, $adjust_y)); $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(46, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 100; $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); //Earnings $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); break; case 'cheque_dlt104': $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_dlt104.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(52, $adjust_y)); $pdf->Cell(100, 10, $pay_stub['entries'][40][0]['amount_words'], $border, 0, 'L'); $pdf->Cell(15, 10, $pay_stub['entries'][40][0]['amount_cents'] . '/100', $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(10, 10, TTi18n::gettext('Date:') . ' ', $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(182, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(25, 10, $pay_stub['transaction_date_display'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(172, $adjust_x), Misc::AdjustXY(43, $adjust_y)); $pdf->Cell(35, 10, $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(25, $adjust_x), Misc::AdjustXY(48, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 100; $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); //Earnings $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: ') . $pay_stub_obj->getCurrencyObject()->getSymbol() . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); break; case 'cheque_cr_standard_form_1': $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(41, $adjust_y)); $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'] . TTi18n::gettext(' and ') . $pay_stub['entries'][40][0]['amount_cents'] . '/100 *****', $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(100, $adjust_x), Misc::AdjustXY(23, $adjust_y)); $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(136, $adjust_x), Misc::AdjustXY(32, $adjust_y)); $pdf->Cell(24, 5, ' $' . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 95; $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, $user_obj->getFullName(), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Identification #:') . ' ' . $pay_stub['display_id'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay Start Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(115 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Pay End Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(160, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(50, 5, TTi18n::gettext('Payment Date:') . ' ' . TTDate::getDate('DATE', $pay_stub['transaction_date']), $border, 0, 'L'); //Earnings $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: $') . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(15, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->Cell(40, 5, TTi18n::gettext('Net Pay: $') . $pay_stub['entries'][40][0]['amount'], $border, 0, 'L'); //Signature lines $pdf->setXY(Misc::AdjustXY(7, $adjust_x), Misc::AdjustXY(250, $adjust_y)); $border = 0; $pdf->Cell(40, 5, TTi18n::gettext('Employee Signature:'), $border, 0, 'L'); $pdf->Cell(60, 5, '_____________________________', $border, 0, 'L'); $pdf->Cell(40, 5, TTi18n::gettext('Supervisor Signature:'), $border, 0, 'R'); $pdf->Cell(60, 5, '_____________________________', $border, 0, 'L'); $pdf->Ln(); $pdf->Cell(40, 5, '', $border, 0, 'R'); $pdf->Cell(60, 5, $user_obj->getFullName(), $border, 0, 'C'); $pdf->Ln(); $pdf->Cell(147, 5, '', $border, 0, 'R'); $pdf->Cell(60, 5, '_____________________________', $border, 0, 'C'); $pdf->Ln(); $pdf->Cell(140, 5, '', $border, 0, 'R'); $pdf->Cell(60, 5, TTi18n::gettext('(print name)'), $border, 0, 'C'); break; case 'cheque_cr_standard_form_2': $pdf_created_date = time(); $adjust_x = 0; $adjust_y = -5; if ($show_background == 1) { $pdf->Image(Environment::getBasePath() . 'interface/images/nebs_cheque_9085.jpg', 0, 0, 210, 300); } $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(41, $adjust_y)); $pdf->Cell(100, 5, $pay_stub['entries'][40][0]['amount_words'] . TTi18n::gettext(' and ') . $pay_stub['entries'][40][0]['amount_cents'] . '/100 *****', $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(100, $adjust_x), Misc::AdjustXY(23, $adjust_y)); $pdf->Cell(38, 5, $pay_stub['transaction_date_display'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(136, $adjust_x), Misc::AdjustXY(32, $adjust_y)); $pdf->Cell(24, 5, '$ ' . $pay_stub['entries'][40][0]['amount_padded'], $border, 0, 'L'); $pdf->setXY(Misc::AdjustXY(20, $adjust_x), Misc::AdjustXY(33, $adjust_y)); $pdf->Cell(100, 5, $user_obj->getFullName(), $border, 0, 'L'); //Cheque Stub $stub_2_offset = 110; $pdf->SetFont('', 'U', 14); $pdf->setXY(Misc::AdjustXY(65, $adjust_x), Misc::AdjustXY(100, $adjust_y)); $pdf->Cell(75, 5, TTi18n::gettext('Recipient Copy:'), $border, 0, 'C'); $pdf->SetFont('', '', 10); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(110, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Date of Issue:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(130, 5, TTDate::getDate('DATE+TIME', $pdf_created_date), $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(110 + $stub_2_offset, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Date of Issue:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(130, 5, TTDate::getDate('DATE+TIME', $pdf_created_date), $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(120, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Recipient:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(110, 5, $user_obj->getFullName(), $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(120 + $stub_2_offset, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Recipient:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(130, 5, $user_obj->getFullName(), $border, 0, 'J'); //Earnings $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(130, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Amount:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(100, 5, ' $' . $pay_stub['entries'][40][0]['amount'], $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(130 + $stub_2_offset, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Amount:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(100, 5, ' $' . $pay_stub['entries'][40][0]['amount'], $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(140, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Regarding:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(100, 5, TTi18n::gettext('Payment from') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']) . ' ' . TTi18n::gettext('to') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'J'); $pdf->setXY(Misc::AdjustXY(75, $adjust_x), Misc::AdjustXY(140 + $stub_2_offset, $adjust_y)); $pdf->SetFont('', 'B', 10); $pdf->Cell(30, 5, TTi18n::gettext('Regarding:'), $border, 0, 'J'); $pdf->SetFont('', '', 10); $pdf->Cell(100, 5, TTi18n::gettext('Payment from') . ' ' . TTDate::getDate('DATE', $pay_stub['start_date']) . ' ' . TTi18n::gettext('to') . ' ' . TTDate::getDate('DATE', $pay_stub['end_date']), $border, 0, 'J'); $pdf->SetFont('', 'U', 14); $pdf->setXY(Misc::AdjustXY(65, $adjust_x), Misc::AdjustXY(210, $adjust_y)); $pdf->Cell(75, 5, $company_obj->getName() . ' ' . TTi18n::gettext('Copy:'), $border, 0, 'C'); $pdf->setXY(Misc::AdjustXY(30, $adjust_x), Misc::AdjustXY(260, $adjust_y)); $column_widths = array('generated_by' => 25, 'signed_by' => 25, 'received_by' => 35, 'date' => 35, 'sin_ssn' => 35); $line_h = 4; $cell_h_min = $cell_h_max = $line_h * 4; $pdf->SetFont('', '', 8); $pdf->setFillColor(255, 255, 255); $pdf->MultiCell($column_widths['generated_by'], $line_h, TTi18n::gettext('Generated By') . "\n\n\n ", 1, 'C', 1, 0); $pdf->MultiCell($column_widths['signed_by'], $line_h, TTi18n::gettext('Signed By') . "\n\n\n ", 1, 'C', 1, 0); $pdf->MultiCell($column_widths['received_by'], $line_h, TTi18n::gettext('Received By') . "\n\n\n ", 'T,L,B', 'C', 1, 0); $pdf->MultiCell($column_widths['date'], $line_h, TTi18n::gettext('Date') . "\n\n\n ", 'T,B', 'C', 1, 0); $pdf->MultiCell($column_widths['sin_ssn'], $line_h, TTi18n::gettext('SIN / SSN') . "\n\n\n ", 'T,R,B', 'C', 1, 0); $pdf->Ln(); $pdf->SetFont('', '', 10); break; } $i++; } $output = $pdf->Output('', 'S'); break; } } if (isset($output)) { return $output; } return FALSE; }
function exportPayStub($pslf = NULL, $export_type = NULL, $company_obj = NULL) { if (is_object($company_obj)) { $current_company = $company_obj; } else { global $current_company; } if (!is_object($pslf) and $this->getId() != '') { $pslf = TTnew('PayStubListFactory'); $pslf->getById($this->getId()); } if (get_class($pslf) !== 'PayStubListFactory') { return FALSE; } if ($export_type == '') { return FALSE; } if ($pslf->getRecordCount() > 0) { Debug::Text('aExporting...', __FILE__, __LINE__, __METHOD__, 10); switch (strtolower($export_type)) { case 'eft_hsbc': case 'eft_1464': case 'eft_105': case 'eft_ach': case 'eft_beanstream': //Get file creation number $ugdlf = TTnew('UserGenericDataListFactory'); $ugdlf->getByCompanyIdAndScriptAndDefault($current_company->getId(), 'PayStubFactory', TRUE); if ($ugdlf->getRecordCount() > 0) { $ugd_obj = $ugdlf->getCurrent(); $setup_data = $ugd_obj->getData(); } else { $ugd_obj = TTnew('UserGenericDataFactory'); } Debug::Text('bExporting...', __FILE__, __LINE__, __METHOD__, 10); //get User Bank account info $balf = TTnew('BankAccountListFactory'); $balf->getCompanyAccountByCompanyId($current_company->getID()); if ($balf->getRecordCount() > 0) { $company_bank_obj = $balf->getCurrent(); //Debug::Arr($company_bank_obj,'Company Bank Object', __FILE__, __LINE__, __METHOD__,10); } if (isset($setup_data['file_creation_number'])) { $setup_data['file_creation_number']++; } else { //Start at a high number, in attempt to eliminate conflicts. $setup_data['file_creation_number'] = 500; } Debug::Text('bFile Creation Number: ' . $setup_data['file_creation_number'], __FILE__, __LINE__, __METHOD__, 10); //Increment file creation number in DB if ($ugd_obj->getId() == '') { $ugd_obj->setID($ugd_obj->getId()); } $ugd_obj->setCompany($current_company->getId()); $ugd_obj->setScript('PayStubFactory'); $ugd_obj->setName('PayStubFactory'); $ugd_obj->setData($setup_data); $ugd_obj->setDefault(TRUE); if ($ugd_obj->isValid()) { $ugd_obj->Save(); } $eft = new EFT(); $eft->setFileFormat(str_replace('eft_', '', $export_type)); $eft->setBusinessNumber($current_company->getBusinessNumber()); //ACH $eft->setOriginatorID($current_company->getOriginatorID()); $eft->setFileCreationNumber($setup_data['file_creation_number']); $eft->setInitialEntryNumber($current_company->getOtherID5()); //ACH $eft->setDataCenter($current_company->getDataCenterID()); $eft->setDataCenterName($current_company->getOtherID4()); //ACH $eft->setOriginatorShortName($current_company->getShortName()); $psealf = TTnew('PayStubEntryAccountListFactory'); foreach ($pslf as $key => $pay_stub_obj) { Debug::Text('Looping over Pay Stub... ID: ' . $pay_stub_obj->getId(), __FILE__, __LINE__, __METHOD__, 10); //Get pay stub entries. $pself = TTnew('PayStubEntryListFactory'); $pself->getByPayStubId($pay_stub_obj->getId()); $prev_type = NULL; $description_subscript_counter = 1; foreach ($pself as $pay_stub_entry) { $description_subscript = NULL; //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent(); $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent(); if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) { $type = $pay_stub_entry_name_obj->getType(); } //var_dump( $pay_stub_entry->getDescription() ); if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) { $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription()); $description_subscript = $description_subscript_counter; $description_subscript_counter++; } if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) { $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy()); } $prev_type = $pay_stub_entry_name_obj->getType(); } if (isset($pay_stub_entries)) { $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 12, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy()); unset($pay_stub_entries); //Get User information $ulf = TTnew('UserListFactory'); $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent(); //Get company information $clf = TTnew('CompanyListFactory'); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); //get User Bank account info $balf = TTnew('BankAccountListFactory'); $user_bank_obj = $balf->getUserAccountByCompanyIdAndUserId($user_obj->getCompany(), $user_obj->getId()); if ($user_bank_obj->getRecordCount() > 0) { $user_bank_obj = $user_bank_obj->getCurrent(); } else { continue; } if (isset($pay_stub['entries'][40][0]['amount'])) { $amount = $pay_stub['entries'][40][0]['amount']; } else { $amount = 0; } if ($amount > 0) { $record = new EFT_Record(); $record->setType('C'); $record->setCPACode(200); $record->setAmount($amount); $record->setDueDate(TTDate::getBeginDayEpoch($pay_stub_obj->getTransactionDate())); $record->setInstitution($user_bank_obj->getInstitution()); $record->setTransit($user_bank_obj->getTransit()); $record->setAccount($user_bank_obj->getAccount()); $record->setName($user_obj->getFullName()); $record->setOriginatorShortName($company_obj->getShortName()); $record->setOriginatorLongName(substr($company_obj->getName(), 0, 30)); $record->setOriginatorReferenceNumber('TT' . $pay_stub_obj->getId()); if (isset($company_bank_obj) and is_object($company_bank_obj)) { $record->setReturnInstitution($company_bank_obj->getInstitution()); $record->setReturnTransit($company_bank_obj->getTransit()); $record->setReturnAccount($company_bank_obj->getAccount()); } $eft->setRecord($record); } unset($amount); $this->getProgressBarObject()->set(NULL, $key); } } $eft->compile(); $output = $eft->getCompiledData(); break; case 'cheque_9085': case 'cheque_9209p': case 'cheque_dlt103': case 'cheque_dlt104': case 'cheque_cr_standard_form_1': case 'cheque_cr_standard_form_2': $cheque_form_obj = $this->getChequeFormsObject(str_replace('cheque_', '', $export_type)); $psealf = TTnew('PayStubEntryAccountListFactory'); $numbers_words = new Numbers_Words(); $i = 0; foreach ($pslf as $pay_stub_obj) { //Get pay stub entries. $pself = TTnew('PayStubEntryListFactory'); $pself->getByPayStubId($pay_stub_obj->getId()); $pay_stub_entries = NULL; $prev_type = NULL; $description_subscript_counter = 1; foreach ($pself as $pay_stub_entry) { $description_subscript = NULL; //$pay_stub_entry_name_obj = $psenlf->getById( $pay_stub_entry->getPayStubEntryNameId() ) ->getCurrent(); $pay_stub_entry_name_obj = $psealf->getById($pay_stub_entry->getPayStubEntryNameId())->getCurrent(); //Use this to put the total for each type at the end of the array. if ($prev_type == 40 or $pay_stub_entry_name_obj->getType() != 40) { $type = $pay_stub_entry_name_obj->getType(); } //Debug::text('Pay Stub Entry Name ID: '. $pay_stub_entry_name_obj->getId() .' Type ID: '. $pay_stub_entry_name_obj->getType() .' Type: '. $type, __FILE__, __LINE__, __METHOD__,10); //var_dump( $pay_stub_entry->getDescription() ); if ($pay_stub_entry->getDescription() !== NULL and $pay_stub_entry->getDescription() !== FALSE and strlen($pay_stub_entry->getDescription()) > 0) { $pay_stub_entry_descriptions[] = array('subscript' => $description_subscript_counter, 'description' => $pay_stub_entry->getDescription()); $description_subscript = $description_subscript_counter; $description_subscript_counter++; } $amount_words = str_pad(ucwords($numbers_words->toWords(floor($pay_stub_entry->getAmount()), "en_US")) . ' ', 65, "-", STR_PAD_RIGHT); //echo "Amount: ". floor($pay_stub_entry->getAmount()) ." - Words: ". $amount_words ."<br>\n"; //var_dump($amount_words); if ($type != 40 or $type == 40 and $pay_stub_entry->getAmount() != 0) { $pay_stub_entries[$type][] = array('id' => $pay_stub_entry->getId(), 'pay_stub_entry_name_id' => $pay_stub_entry->getPayStubEntryNameId(), 'type' => $pay_stub_entry_name_obj->getType(), 'name' => $pay_stub_entry_name_obj->getName(), 'display_name' => $pay_stub_entry_name_obj->getName(), 'rate' => $pay_stub_entry->getRate(), 'units' => $pay_stub_entry->getUnits(), 'ytd_units' => $pay_stub_entry->getYTDUnits(), 'amount' => $pay_stub_entry->getAmount(), 'amount_padded' => str_pad(TTi18n::formatNumber($pay_stub_entry->getAmount(), TRUE, $pay_stub_obj->getCurrencyObject()->getRoundDecimalPlaces()), 12, '*', STR_PAD_LEFT), 'amount_words' => $amount_words, 'amount_cents' => Misc::getAfterDecimal($pay_stub_entry->getAmount()), 'ytd_amount' => $pay_stub_entry->getYTDAmount(), 'description' => $pay_stub_entry->getDescription(), 'description_subscript' => $description_subscript, 'created_date' => $pay_stub_entry->getCreatedDate(), 'created_by' => $pay_stub_entry->getCreatedBy(), 'updated_date' => $pay_stub_entry->getUpdatedDate(), 'updated_by' => $pay_stub_entry->getUpdatedBy(), 'deleted_date' => $pay_stub_entry->getDeletedDate(), 'deleted_by' => $pay_stub_entry->getDeletedBy()); } unset($amount_words); //Only for net pay, make a total YTD of Advance plus Net. /* if ( $type == 40 ) { $pay_stub_entries[$type][0]['ytd_net_plus_advance'] = } */ $prev_type = $pay_stub_entry_name_obj->getType(); } //Get User information $ulf = TTnew('UserListFactory'); $user_obj = $ulf->getById($pay_stub_obj->getUser())->getCurrent(); //Get company information $clf = TTnew('CompanyListFactory'); $company_obj = $clf->getById($user_obj->getCompany())->getCurrent(); if ($user_obj->getCountry() == 'CA') { $date_format = 'd/m/Y'; } else { $date_format = 'm/d/Y'; } $pay_stub = array('id' => $pay_stub_obj->getId(), 'display_id' => str_pad($pay_stub_obj->getId(), 15, 0, STR_PAD_LEFT), 'user_id' => $pay_stub_obj->getUser(), 'pay_period_id' => $pay_stub_obj->getPayPeriod(), 'start_date' => $pay_stub_obj->getStartDate(), 'end_date' => $pay_stub_obj->getEndDate(), 'transaction_date' => $pay_stub_obj->getTransactionDate(), 'transaction_date_display' => date($date_format, $pay_stub_obj->getTransactionDate()), 'status' => $pay_stub_obj->getStatus(), 'entries' => $pay_stub_entries, 'tainted' => $pay_stub_obj->getTainted(), 'created_date' => $pay_stub_obj->getCreatedDate(), 'created_by' => $pay_stub_obj->getCreatedBy(), 'updated_date' => $pay_stub_obj->getUpdatedDate(), 'updated_by' => $pay_stub_obj->getUpdatedBy(), 'deleted_date' => $pay_stub_obj->getDeletedDate(), 'deleted_by' => $pay_stub_obj->getDeletedBy()); unset($pay_stub_entries); if (isset($pay_stub['entries'][40][0]['amount']) and $pay_stub['entries'][40][0]['amount'] > 0) { //Debug::text($i .'. Pay Stub Transaction Date: '. $pay_stub_obj->getTransactionDate(), __FILE__, __LINE__, __METHOD__,10); //Get Pay Period information $pplf = TTnew('PayPeriodListFactory'); $pay_period_obj = $pplf->getById($pay_stub_obj->getPayPeriod())->getCurrent(); $pp_start_date = $pay_period_obj->getStartDate(); $pp_end_date = $pay_period_obj->getEndDate(); $pp_transaction_date = $pay_period_obj->getTransactionDate(); //Get pay period numbers $ppslf = TTnew('PayPeriodScheduleListFactory'); $pay_period_schedule_obj = $ppslf->getById($pay_period_obj->getPayPeriodSchedule())->getCurrent(); $pay_period_data = array('start_date' => TTDate::getDate('DATE', $pp_start_date), 'end_date' => TTDate::getDate('DATE', $pp_end_date), 'transaction_date' => TTDate::getDate('DATE', $pp_transaction_date), 'annual_pay_periods' => $pay_period_schedule_obj->getAnnualPayPeriods()); $ps_data = array('date' => $pay_stub_obj->getTransactionDate(), 'amount' => $pay_stub['entries'][40][0]['amount'], 'stub_left_column' => $user_obj->getFullName() . "\n" . TTi18n::gettext("Identification #: ") . $pay_stub['display_id'] . "\n" . TTi18n::gettext("Net Pay: ") . $pay_stub_obj->getCurrencyObject()->getSymbol() . TTi18n::formatNumber($pay_stub['entries'][40][0]['amount'], TRUE, $pay_stub_obj->getCurrencyObject()->getRoundDecimalPlaces()), 'stub_right_column' => TTi18n::gettext('Pay Start Date: ') . TTDate::getDate('DATE', $pay_stub['start_date']) . "\n" . TTi18n::gettext('Pay End Date: ') . TTDate::getDate('DATE', $pay_stub['end_date']) . "\n" . TTi18n::gettext('Payment Date: ') . TTDate::getDate('DATE', $pay_stub['transaction_date']), 'start_date' => $pay_stub['start_date'], 'end_date' => $pay_stub['end_date'], 'full_name' => $user_obj->getFullName(), 'address1' => $user_obj->getAddress1(), 'address2' => $user_obj->getAddress2(), 'city' => $user_obj->getCity(), 'province' => $user_obj->getProvince(), 'postal_code' => $user_obj->getPostalCode(), 'country' => $user_obj->getCountry(), 'company_name' => $company_obj->getName(), 'symbol' => $pay_stub_obj->getCurrencyObject()->getSymbol()); $cheque_form_obj->addRecord($ps_data); $this->getFormObject()->addForm($cheque_form_obj); } $this->getProgressBarObject()->set(NULL, $i); $i++; } if (stristr($export_type, 'cheque')) { $output_format = 'PDF'; } $output = $this->getFormObject()->output($output_format); break; } } if (isset($output)) { return $output; } return FALSE; }