function _outputPDFForm($format = NULL)
 {
     $show_background = TRUE;
     if ($format == 'pdf_form_print' or $format == 'pdf_form_print_government' or $format == 'efile') {
         $show_background = FALSE;
     }
     Debug::Text('Generating Form... Format: ' . $format, __FILE__, __LINE__, __METHOD__, 10);
     $setup_data = $this->getFormConfig();
     $filter_data = $this->getFilterConfig();
     //Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__,10);
     $current_company = $this->getUserObject()->getCompanyObject();
     if (!is_object($current_company)) {
         Debug::Text('Invalid company object...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     $current_user = $this->getUserObject();
     if (!is_object($current_user)) {
         Debug::Text('Invalid user object...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if ($format == 'efile_xml') {
         $return1040 = $this->getRETURN1040Object();
         // Ceate the all needed data for Return1040.xsd at here.
         $return1040->return_created_timestamp = TTDate::getDBTimeStamp(TTDate::getTime(), FALSE);
         $return1040->year = TTDate::getYear($filter_data['end_date']);
         $return1040->tax_period_begin_date = TTDate::getDate('Y-m-d', TTDate::getBeginDayEpoch($filter_data['start_date']));
         $return1040->tax_period_end__date = TTDate::getDate('Y-m-d', TTDate::getEndDayEpoch($filter_data['end_date']));
         $return1040->software_id = '';
         $return1040->originator_efin = '';
         $return1040->originator_type_code = '';
         $return1040->pin_type_code = '';
         $return1040->jurat_disclosure_code = '';
         $return1040->pin_entered_by = '';
         $return1040->signature_date = TTDate::getDate('Y-m-d', TTDate::getTime());
         $return1040->return_type = '';
         $return1040->ssn = '';
         $return1040->name = (isset($setup_data['company_name']) and $setup_data['company_name'] != '') ? $setup_data['company_name'] : $current_company->getName();
         $return1040->name_control = '';
         $return1040->address1 = (isset($setup_data['address1']) and $setup_data['address1'] != '') ? $setup_data['address1'] : $current_company->getAddress1() . ' ' . $current_company->getAddress2();
         $return1040->city = (isset($setup_data['city']) and $setup_data['city'] != '') ? $setup_data['city'] : $current_company->getCity();
         $return1040->state = (isset($setup_data['province']) and ($setup_data['province'] != '' and $setup_data['province'] != 0)) ? $setup_data['province'] : $current_company->getProvince();
         $return1040->zip_code = (isset($setup_data['postal_code']) and $setup_data['postal_code'] != '') ? $setup_data['postal_code'] : $current_company->getPostalCode();
         $return1040->ip_address = '';
         $return1040->ip_date = TTDate::getDate('Y-m-d', TTDate::getTime());
         $return1040->ip_time = TTDate::getDate('H:i:s', TTDate::getTime());
         $return1040->timezone = TTDate::getTimeZone();
         $this->getFormObject()->addForm($return1040);
     }
     $this->sortFormData();
     //Make sure forms are sorted.
     $fw2 = $this->getFW2Object();
     $fw2->setDebug(FALSE);
     //if ( $format == 'efile' ) {
     //	$fw2->setDebug(TRUE);
     //}
     $fw2->setShowBackground($show_background);
     if (stristr($format, 'government')) {
         $form_type = 'government';
     } else {
         $form_type = 'employee';
     }
     Debug::Text('Form Type: ' . $form_type, __FILE__, __LINE__, __METHOD__, 10);
     $fw2->setType($form_type);
     $fw2->year = TTDate::getYear($filter_data['end_date']);
     //Add support for the user to manually set this data in the setup_data. That way they can use multiple tax IDs for different employees, all beit manually.
     $fw2->ein = (isset($setup_data['ein']) and $setup_data['ein'] != '') ? $setup_data['ein'] : $current_company->getBusinessNumber();
     $fw2->name = (isset($setup_data['name']) and $setup_data['name'] != '') ? $setup_data['name'] : $this->getUserObject()->getFullName();
     $fw2->trade_name = (isset($setup_data['company_name']) and $setup_data['company_name'] != '') ? $setup_data['company_name'] : $current_company->getName();
     $fw2->company_address1 = (isset($setup_data['address1']) and $setup_data['address1'] != '') ? $setup_data['address1'] : $current_company->getAddress1() . ' ' . $current_company->getAddress2();
     $fw2->company_city = (isset($setup_data['city']) and $setup_data['city'] != '') ? $setup_data['city'] : $current_company->getCity();
     $fw2->company_state = (isset($setup_data['province']) and ($setup_data['province'] != '' and $setup_data['province'] != 0)) ? $setup_data['province'] : $current_company->getProvince();
     $fw2->company_zip_code = (isset($setup_data['postal_code']) and $setup_data['postal_code'] != '') ? $setup_data['postal_code'] : $current_company->getPostalCode();
     $fw2->efile_user_id = (isset($setup_data['efile_user_id']) and $setup_data['efile_user_id'] != '') ? $setup_data['efile_user_id'] : NULL;
     $fw2->efile_state = (isset($setup_data['efile_state']) and $setup_data['efile_state'] != '') ? $setup_data['efile_state'] : 0;
     $fw2->contact_name = $current_user->getFullName();
     $fw2->contact_phone = $current_user->getWorkPhone();
     $fw2->contact_phone_ext = $current_user->getWorkPhoneExt();
     $fw2->contact_email = $current_user->getWorkEmail();
     if (isset($this->form_data) and count($this->form_data) > 0) {
         $i = 0;
         $n = 1;
         foreach ((array) $this->form_data as $row) {
             if (!isset($row['user_id'])) {
                 Debug::Text('User ID not set!', __FILE__, __LINE__, __METHOD__, 10);
                 continue;
             }
             $ulf = TTnew('UserListFactory');
             $ulf->getById((int) $row['user_id']);
             if ($ulf->getRecordCount() == 1) {
                 $user_obj = $ulf->getCurrent();
                 $ee_data = array('control_number' => $n, 'first_name' => $user_obj->getFirstName(), 'middle_name' => $user_obj->getMiddleName(), 'last_name' => $user_obj->getLastName(), 'address1' => $user_obj->getAddress1(), 'address2' => $user_obj->getAddress2(), 'city' => $user_obj->getCity(), 'state' => $user_obj->getProvince(), 'employment_province' => $user_obj->getProvince(), 'zip_code' => $user_obj->getPostalCode(), 'ssn' => $user_obj->getSIN(), 'employee_number' => $user_obj->getEmployeeNumber(), 'l1' => $row['l1'], 'l2' => $row['l2'], 'l3' => $row['l3'], 'l4' => $row['l4'], 'l5' => $row['l5'], 'l6' => $row['l6'], 'l7' => $row['l7'], 'l8' => $row['l8'], 'l10' => $row['l10'], 'l11' => $row['l11'], 'l12a_code' => NULL, 'l12a' => NULL, 'l12b_code' => NULL, 'l12b' => NULL, 'l12c_code' => NULL, 'l12c' => NULL, 'l12d_code' => NULL, 'l12d' => NULL, 'l14a_name' => NULL, 'l14a' => NULL, 'l14b_name' => NULL, 'l14b' => NULL, 'l14c_name' => NULL, 'l14c' => NULL, 'l14d_name' => NULL, 'l14d' => NULL);
                 if ($row['l12a'] > 0 and isset($setup_data['l12a_code']) and $setup_data['l12a_code'] != '') {
                     $ee_data['l12a_code'] = $setup_data['l12a_code'];
                     $ee_data['l12a'] = $row['l12a'];
                 }
                 if ($row['l12b'] > 0 and isset($setup_data['l12b_code']) and $setup_data['l12b_code'] != '') {
                     $ee_data['l12b_code'] = $setup_data['l12b_code'];
                     $ee_data['l12b'] = $row['l12b'];
                 }
                 if ($row['l12c'] > 0 and isset($setup_data['l12c_code']) and $setup_data['l12c_code'] != '') {
                     $ee_data['l12c_code'] = $setup_data['l12c_code'];
                     $ee_data['l12c'] = $row['l12c'];
                 }
                 if ($row['l12d'] > 0 and isset($setup_data['l12d_code']) and $setup_data['l12d_code'] != '') {
                     $ee_data['l12d_code'] = $setup_data['l12d_code'];
                     $ee_data['l12d'] = $row['l12d'];
                 }
                 if ($row['l14a'] > 0 and isset($setup_data['l14a_name']) and $setup_data['l14a_name'] != '') {
                     $ee_data['l14a_name'] = $setup_data['l14a_name'];
                     $ee_data['l14a'] = $row['l14a'];
                 }
                 if ($row['l14b'] > 0 and isset($setup_data['l14b_name']) and $setup_data['l14b_name'] != '') {
                     $ee_data['l14b_name'] = $setup_data['l14b_name'];
                     $ee_data['l14b'] = $row['l14b'];
                 }
                 if ($row['l14c'] > 0 and isset($setup_data['l14c_name']) and $setup_data['l14c_name'] != '') {
                     $ee_data['l14c_name'] = $setup_data['l14c_name'];
                     $ee_data['l14c'] = $row['l14c'];
                 }
                 if ($row['l14d'] > 0 and isset($setup_data['l14d_name']) and $setup_data['l14d_name'] != '') {
                     $ee_data['l14d_name'] = $setup_data['l14d_name'];
                     $ee_data['l14d'] = $row['l14d'];
                 }
                 foreach (range('a', 'z') as $z) {
                     //State income tax
                     if (isset($row['l16' . $z])) {
                         if (isset($setup_data['state'][$row['l15' . $z . '_state']])) {
                             $ee_data['l15' . $z . '_state_id'] = $setup_data['state'][$row['l15' . $z . '_state']]['state_id'];
                         }
                         $ee_data['l15' . $z . '_state'] = $row['l15' . $z . '_state'];
                         $ee_data['l16' . $z] = $row['l16' . $z];
                         $ee_data['l17' . $z] = $row['l17' . $z];
                     } else {
                         $ee_data['l15' . $z . '_state_id'] = NULL;
                         $ee_data['l15' . $z . '_state'] = NULL;
                         $ee_data['l16' . $z] = NULL;
                         $ee_data['l17' . $z] = NULL;
                     }
                     //District income tax
                     if (isset($row['l18' . $z])) {
                         $ee_data['l18' . $z] = $row['l18' . $z];
                         $ee_data['l19' . $z] = $row['l19' . $z];
                         $ee_data['l20' . $z] = $row['l20' . $z];
                     } else {
                         $ee_data['l18' . $z] = NULL;
                         $ee_data['l19' . $z] = NULL;
                         $ee_data['l20' . $z] = NULL;
                     }
                 }
                 $fw2->addRecord($ee_data);
                 unset($ee_data);
                 $i++;
                 $n++;
             }
         }
     }
     $this->getFormObject()->addForm($fw2);
     if ($form_type == 'government') {
         //Handle W3
         $fw3 = $this->getFW3Object();
         $fw3->setShowBackground($show_background);
         $fw3->year = $fw2->year;
         $fw3->ein = $fw2->ein;
         $fw3->name = $fw2->name;
         $fw3->trade_name = $fw2->trade_name;
         $fw3->company_address1 = $fw2->company_address1;
         $fw3->company_address2 = $fw2->company_address2;
         $fw3->company_city = $fw2->company_city;
         $fw3->company_state = $fw2->company_state;
         $fw3->company_zip_code = $fw2->company_zip_code;
         $fw3->contact_name = $current_user->getFullName();
         $fw3->contact_phone = $current_user->getWorkPhoneExt() != '' ? $current_user->getWorkPhone() . 'x' . $current_user->getWorkPhoneExt() : $current_user->getWorkPhone();
         $fw3->contact_email = $current_user->getWorkEmail();
         $fw3->kind_of_payer = '941';
         $fw3->kind_of_employer = 'none';
         //$fw3->third_party_sick_pay = TRUE;
         if (isset($setup_data['state'][$fw2->company_state]) and isset($setup_data['state'][$fw2->company_state]['state_id']) and $setup_data['state'][$fw2->company_state]['state_id'] != '') {
             $fw3->state_id1 = $setup_data['state'][$fw2->company_state]['state_id'];
         }
         $fw3->lc = count($this->form_data);
         $fw3->control_number = $fw3->lc + 1;
         //$fw3->ld = '1234568';
         $total_row = Misc::ArrayAssocSum($this->form_data);
         //Debug::Arr($total_row, 'Total Row Data: ', __FILE__, __LINE__, __METHOD__,10);
         if (is_array($total_row)) {
             $fw3->l1 = $total_row['l1'];
             $fw3->l2 = $total_row['l2'];
             $fw3->l3 = $total_row['l3'];
             $fw3->l4 = $total_row['l4'];
             $fw3->l5 = $total_row['l5'];
             $fw3->l6 = $total_row['l6'];
             $fw3->l7 = $total_row['l7'];
             $fw3->l8 = $total_row['l8'];
             $fw3->l10 = $total_row['l10'];
             $fw3->l11 = $total_row['l11'];
             foreach (range('a', 'z') as $z) {
                 //State income tax
                 if (isset($total_row['l16' . $z])) {
                     $fw3->l16 += $total_row['l16' . $z];
                     $fw3->l17 += $total_row['l17' . $z];
                 }
                 //District income tax
                 if (isset($total_row['l18' . $z])) {
                     $fw3->l18 += $total_row['l18' . $z];
                     $fw3->l19 += $total_row['l19' . $z];
                 }
             }
         }
         $this->getFormObject()->addForm($fw3);
     }
     if ($format == 'efile') {
         $output_format = 'EFILE';
         if ($fw2->getDebug() == TRUE) {
             $file_name = 'w2_efile_' . date('Y_m_d') . '.csv';
         } else {
             $file_name = 'w2_efile_' . date('Y_m_d') . '.txt';
         }
         $mime_type = 'applications/octet-stream';
         //Force file to download.
     } elseif ($format == 'efile_xml') {
         $output_format = 'XML';
         $file_name = 'w2_efile_' . date('Y_m_d') . '.xml';
         $mime_type = 'applications/octet-stream';
         //Force file to download.
     } else {
         $output_format = 'PDF';
         $file_name = $this->file_name;
         $mime_type = $this->file_mime_type;
     }
     $output = $this->getFormObject()->output($output_format);
     return array('file_name' => $file_name, 'mime_type' => $mime_type, 'data' => $output);
 }
 function setTransactionDate($epoch)
 {
     $epoch = trim($epoch);
     if ($this->Validator->isDate('transaction_date', $epoch, TTi18n::gettext('Incorrect transaction date'))) {
         $this->data['transaction_date'] = TTDate::getDBTimeStamp($epoch, FALSE);
         return TRUE;
     }
     return FALSE;
 }
 function getPunchData()
 {
     if ($this->StationCheckAllowed() !== TRUE) {
         Debug::text('Station NOT allowed: ', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     $epoch = TTDate::getTime();
     $slf = new ScheduleListFactory();
     //Get last punch for this day, for this user.
     $plf = new PunchListFactory();
     $plf->getPreviousPunchByUserIDAndEpoch($this->getUserObject()->getId(), $epoch);
     if ($plf->getRecordCount() > 0) {
         $prev_punch_obj = $plf->getCurrent();
         Debug::Text(' Found Previous Punch within Continuous Time from now, ID: ' . $prev_punch_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
         $branch_id = $prev_punch_obj->getPunchControlObject()->getBranch();
         $department_id = $prev_punch_obj->getPunchControlObject()->getDepartment();
         $job_id = $prev_punch_obj->getPunchControlObject()->getJob();
         $job_item_id = $prev_punch_obj->getPunchControlObject()->getJobItem();
         //Don't enable transfer by default if the previous punch was any OUT punch.
         //Transfer does the OUT punch for them, so if the previous punch is an OUT punch
         //we don't gain anything anyways.
         if ($this->getPermissionObject()->Check('punch', 'default_transfer') and $prev_punch_obj->getStatus() == 10) {
             $transfer = TRUE;
         } else {
             $transfer = FALSE;
         }
         if ($branch_id == '' or empty($branch_id) or $department_id == '' or empty($department_id) or $job_id == '' or empty($job_id) or $job_item_id == '' or empty($job_item_id)) {
             Debug::Text(' Branch or department are null. ', __FILE__, __LINE__, __METHOD__, 10);
             $s_obj = $slf->getScheduleObjectByUserIdAndEpoch($this->getUserObject()->getId(), $epoch);
             if (is_object($s_obj)) {
                 Debug::Text(' Found Schedule!: ', __FILE__, __LINE__, __METHOD__, 10);
                 if ($branch_id == '' or empty($branch_id)) {
                     Debug::Text(' overrriding branch: ' . $s_obj->getBranch(), __FILE__, __LINE__, __METHOD__, 10);
                     $branch_id = $s_obj->getBranch();
                 }
                 if ($department_id == '' or empty($department_id)) {
                     Debug::Text(' overrriding department: ' . $s_obj->getDepartment(), __FILE__, __LINE__, __METHOD__, 10);
                     $department_id = $s_obj->getDepartment();
                 }
                 if ($job_id == '' or empty($job_id)) {
                     Debug::Text(' overrriding job: ' . $s_obj->getJob(), __FILE__, __LINE__, __METHOD__, 10);
                     $job_id = $s_obj->getJob();
                 }
                 if ($job_item_id == '' or empty($job_item_id)) {
                     Debug::Text(' overrriding job item: ' . $s_obj->getJobItem(), __FILE__, __LINE__, __METHOD__, 10);
                     $job_item_id = $s_obj->getJobItem();
                 }
             }
         }
         $next_type = $prev_punch_obj->getNextType();
         //Check for break policy window.
         if ($next_type != 30 and ($prev_punch_obj->getStatus() != 30 and $prev_punch_obj->getType() != 30)) {
             $prev_punch_obj->setUser($this->getUserObject()->getId());
             $prev_punch_obj->setScheduleID($prev_punch_obj->findScheduleID($epoch));
             if ($prev_punch_obj->inBreakPolicyWindow($epoch, $prev_punch_obj->getTimeStamp()) == TRUE) {
                 Debug::Text(' Setting Type to Break: ', __FILE__, __LINE__, __METHOD__, 10);
                 $next_type = 30;
             }
         }
         //Check for meal policy window.
         if ($next_type != 20 and ($prev_punch_obj->getStatus() != 20 and $prev_punch_obj->getType() != 20)) {
             $prev_punch_obj->setUser($this->getUserObject()->getId());
             $prev_punch_obj->setScheduleID($prev_punch_obj->findScheduleID($epoch));
             if ($prev_punch_obj->inMealPolicyWindow($epoch, $prev_punch_obj->getTimeStamp()) == TRUE) {
                 Debug::Text(' Setting Type to Lunch: ', __FILE__, __LINE__, __METHOD__, 10);
                 $next_type = 20;
             }
         }
         Debug::Text(' cJob Item ID: ' . $job_item_id, __FILE__, __LINE__, __METHOD__, 10);
         $note = '';
         if ((int) $prev_punch_obj->getNextStatus() == 20) {
             $note = $prev_punch_obj->getPunchControlObject()->getNote();
         }
         $data = array('user_id' => (int) $this->getUserObject()->getId(), 'user_full_name' => $this->getUserObject()->getFullName(), 'time_stamp' => TTDate::getDate('TIME', $epoch), 'date_stamp' => TTDate::getDate('DATE', $epoch), 'full_time_stamp' => $epoch, 'iso_time_stamp' => TTDate::getDBTimeStamp($epoch, FALSE), 'transfer' => $transfer, 'branch_id' => (int) $branch_id, 'department_id' => (int) $department_id, 'job_id' => $job_id, 'job_item_id' => $job_item_id, 'quantity' => $prev_punch_obj->getPunchControlObject()->getQuantity(), 'bad_quantity' => $prev_punch_obj->getPunchControlObject()->getBadQuantity(), 'note' => (string) $note, 'other_id1' => $prev_punch_obj->getPunchControlObject()->getOtherID1(), 'other_id2' => $prev_punch_obj->getPunchControlObject()->getOtherID2(), 'other_id3' => $prev_punch_obj->getPunchControlObject()->getOtherID3(), 'other_id4' => $prev_punch_obj->getPunchControlObject()->getOtherID4(), 'other_id5' => $prev_punch_obj->getPunchControlObject()->getOtherID5(), 'status_id' => (int) $prev_punch_obj->getNextStatus(), 'type_id' => (int) $next_type, 'punch_control_id' => (int) $prev_punch_obj->getNextPunchControlID());
         unset($note);
     } else {
         Debug::Text(' DID NOT Find Previous Punch within Continuous Time from now: ', __FILE__, __LINE__, __METHOD__, 10);
         //These used to be NULLs, but as of TT v3.0 they cause deserilizer errors with a Java client.
         $branch_id = '';
         $department_id = '';
         $job_id = '';
         $job_item_id = '';
         $s_obj = $slf->getScheduleObjectByUserIdAndEpoch($this->getUserObject()->getId(), $epoch);
         if (is_object($s_obj)) {
             Debug::Text(' Found Schedule! ID:' . $s_obj->getID() . ' Job ID: ' . $s_obj->getJob(), __FILE__, __LINE__, __METHOD__, 10);
             $branch_id = $s_obj->getBranch();
             $department_id = $s_obj->getDepartment();
             $job_id = $s_obj->getJob();
             $job_item_id = $s_obj->getJobItem();
         } else {
             //Check for defaults
             $branch_id = $this->getUserObject()->getDefaultBranch();
             $department_id = $this->getUserObject()->getDefaultDepartment();
             //Check station for default/forced settings.
             if (is_object($this->getStationObject())) {
                 if ($this->getStationObject()->getDefaultBranch() !== FALSE and $this->getStationObject()->getDefaultBranch() != 0) {
                     $branch_id = $this->getStationObject()->getDefaultBranch();
                 }
                 if ($this->getStationObject()->getDefaultDepartment() !== FALSE and $this->getStationObject()->getDefaultDepartment() != 0) {
                     $department_id = $this->getStationObject()->getDefaultDepartment();
                 }
                 if ($this->getStationObject()->getDefaultJob() !== FALSE and $this->getStationObject()->getDefaultJob() != 0) {
                     $job_id = $this->getStationObject()->getDefaultJob();
                 }
                 if ($this->getStationObject()->getDefaultJobItem() !== FALSE and $this->getStationObject()->getDefaultJobItem() != 0) {
                     $job_item_id = $this->getStationObject()->getDefaultJobItem();
                 }
             }
         }
         $data = array('user_id' => (int) $this->getUserObject()->getId(), 'user_full_name' => $this->getUserObject()->getFullName(), 'time_stamp' => TTDate::getDate('TIME', $epoch), 'date_stamp' => TTDate::getDate('DATE', $epoch), 'full_time_stamp' => $epoch, 'iso_time_stamp' => TTDate::getDBTimeStamp($epoch, FALSE), 'transfer' => FALSE, 'branch_id' => (int) $branch_id, 'department_id' => (int) $department_id, 'job_id' => $job_id, 'job_item_id' => $job_item_id, 'status_id' => 10, 'type_id' => 10);
     }
     //Get options.
     $blf = new BranchListFactory();
     $blf->getByCompanyId($this->getCompanyObject()->getId());
     $branch_options = $blf->getArrayByListFactory($blf, TRUE, FALSE);
     $dlf = new DepartmentListFactory();
     $dlf->getByCompanyId($this->getCompanyObject()->getId());
     $department_options = $dlf->getArrayByListFactory($dlf, TRUE, FALSE);
     $job_options = array();
     $job_item_options = array();
     if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) {
         $jlf = new JobListFactory();
         $job_options = $jlf->getByCompanyIdAndUserIdAndStatusArray($this->getCompanyObject()->getId(), $this->getUserObject()->getId(), array(10), TRUE);
         $jilf = new JobItemListFactory();
         $job_item_options = $jilf->getByCompanyIdArray($this->getCompanyObject()->getId(), TRUE);
     }
     $pf = new PunchFactory();
     //Select box options;
     $data['status_options'] = $pf->getOptions('status');
     $data['type_options'] = $pf->getOptions('type');
     $data['branch_options'] = $branch_options;
     $data['department_options'] = $department_options;
     $data['job_options'] = $job_options;
     $data['job_item_options'] = $job_item_options;
     //Hack for PHP v5.0.4 shotty SOAP.
     //If it can cast the first array key to a INT, it rekeys the entire array.
     //02-Nov-09: Using NULL values causes the Java client to throw a deserlizer error. Using '' causes blank entries.
     /*
     $data['status_options'] = Misc::prependArray( array('_' => FALSE ), $data['status_options'] );
     $data['type_options'] = Misc::prependArray( array('_' => FALSE ), $data['type_options'] );
     $data['branch_options'] = Misc::prependArray( array('_' => FALSE ), $data['branch_options'] );
     $data['department_options'] = Misc::prependArray( array('_' => FALSE ), $data['department_options'] );
     $data['job_options'] = Misc::prependArray( array('_' => FALSE ), $data['job_options'] );
     $data['job_item_options'] = Misc::prependArray( array('_' => FALSE ), $data['job_item_options'] );
     */
     $data['timeout'] = 5;
     $data['date_format_example'] = (string) $this->getUserObject()->getUserPreferenceObject()->getDateFormatExample();
     $data['time_format_example'] = (string) $this->getUserObject()->getUserPreferenceObject()->getTimeFormatExample();
     //Debug::Arr($data, 'punchDataArray', __FILE__, __LINE__, __METHOD__,10);
     if (!$this->getPermissionObject()->Check('job', 'enabled')) {
         unset($data['job_options']);
         unset($data['job_item_options']);
     }
     //Debug::Arr($data, 'Return Data: ', __FILE__, __LINE__, __METHOD__,10);
     return $data;
 }
Exemple #4
0
 function dateTest($test = 1)
 {
     switch ($test) {
         case 1:
             $retarr = array(strtotime('30-Oct-09 5:00PM') => TTDate::getDBTimeStamp(strtotime('30-Oct-09 5:00PM')), strtotime('31-Oct-09 5:00PM') => TTDate::getDBTimeStamp(strtotime('31-Oct-09 5:00PM')), strtotime('01-Nov-09 5:00PM') => TTDate::getDBTimeStamp(strtotime('01-Nov-09 5:00PM')), strtotime('02-Nov-09 5:00PM') => TTDate::getDBTimeStamp(strtotime('02-Nov-09 5:00PM')));
             break;
         case 2:
             $retarr = array(strtotime('30-Oct-09 5:00PM') => TTDate::getFlexTimeStamp(strtotime('30-Oct-09 5:00PM')), strtotime('31-Oct-09 5:00PM') => TTDate::getFlexTimeStamp(strtotime('31-Oct-09 5:00PM')), strtotime('01-Nov-09 5:00PM') => TTDate::getFlexTimeStamp(strtotime('01-Nov-09 5:00PM')), strtotime('02-Nov-09 5:00PM') => TTDate::getFlexTimeStamp(strtotime('02-Nov-09 5:00PM')));
             break;
     }
     return $retarr;
 }
 function setTransactionDate($epoch)
 {
     $epoch = trim($epoch);
     if ($epoch != '') {
         //Make sure all pay periods transact at noon.
         $epoch = TTDate::getTimeLockedDate(strtotime('12:00:00', $epoch), $epoch);
         //Unless they are on the same date as the end date, then it should match that.
         if ($this->getEndDate() != '' and $this->getEndDate() > $epoch) {
             $epoch = $this->getEndDate();
         }
     }
     if ($this->Validator->isDate('transaction_date', $epoch, TTi18n::gettext('Incorrect transaction date'))) {
         $this->data['transaction_date'] = TTDate::getDBTimeStamp($epoch, FALSE);
         return TRUE;
     }
     return FALSE;
 }