本文整理汇总了PHP中Misc::MoneyFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::MoneyFormat方法的具体用法?PHP Misc::MoneyFormat怎么用?PHP Misc::MoneyFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::MoneyFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterAmount
function filterAmount($value)
{
if (isset($this->symbol)) {
$value = ' ' . $this->symbol;
}
if (isset($this->amount)) {
$value .= Misc::MoneyFormat($this->amount);
}
return $value;
}
示例2: getHourlyRate
function getHourlyRate($original_hourly_rate)
{
Debug::text(' Getting Premium Rate based off Hourly Rate: ' . $original_hourly_rate, __FILE__, __LINE__, __METHOD__, 10);
$rate = 0;
switch ($this->getPayType()) {
case 10:
//Pay Factor
//Since they are already paid for this time with regular or OT, minus 1 from the rate
$rate = $original_hourly_rate * ($this->getRate() - 1);
break;
case 20:
//Pay Plus Premium
$rate = $this->getRate();
break;
}
return Misc::MoneyFormat($rate, FALSE);
}
示例3: unset
}
if (isset($tmp_rows[$user_id][$pay_period_id]['actual_time'])) {
$tmp_rows[$user_id][$pay_period_id]['actual_time'] += (int) $udt_obj->getColumn('actual_total_time');
} else {
$tmp_rows[$user_id][$pay_period_id]['actual_time'] = (int) $udt_obj->getColumn('actual_total_time');
}
$actual_time_diff = $udt_obj->getColumn('actual_total_time') - $udt_obj->getColumn('total_time');
if (isset($tmp_rows[$user_id][$pay_period_id]['actual_time_diff'])) {
$tmp_rows[$user_id][$pay_period_id]['actual_time_diff'] += $actual_time_diff;
} else {
$tmp_rows[$user_id][$pay_period_id]['actual_time_diff'] = $actual_time_diff;
}
if (isset($user_wage[$user_id])) {
$tmp_rows[$user_id][$pay_period_id]['actual_time_diff_wage'] = Misc::MoneyFormat(TTDate::getHours($tmp_rows[$user_id][$pay_period_id]['actual_time_diff']) * $user_wage[$user_id], FALSE);
} else {
$tmp_rows[$user_id][$pay_period_id]['actual_time_diff_wage'] = Misc::MoneyFormat(0, FALSE);
}
unset($actual_time_diff);
} elseif ($column != NULL) {
if (isset($tmp_rows[$user_id][$pay_period_id][$column])) {
$tmp_rows[$user_id][$pay_period_id][$column] += $udt_obj->getColumn('total_time');
} else {
$tmp_rows[$user_id][$pay_period_id][$column] = $udt_obj->getColumn('total_time');
}
}
if (isset($schedule_rows[$user_id][$pay_period_id]['working'])) {
$tmp_rows[$user_id][$pay_period_id]['schedule_working'] = $schedule_rows[$user_id][$pay_period_id]['working'];
} else {
$tmp_rows[$user_id][$pay_period_id]['schedule_working'] = NULL;
}
if (isset($schedule_rows[$user_id][$pay_period_id]['absence'])) {
示例4: getScheduleArray
function getScheduleArray($filter_data, $permission_children_ids = NULL)
{
global $current_user, $current_user_prefs;
//Get all schedule data by general filter criteria.
//Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__, 10);
if (!isset($filter_data['start_date']) or $filter_data['start_date'] == '') {
return FALSE;
}
if (!isset($filter_data['end_date']) or $filter_data['end_date'] == '') {
return FALSE;
}
$filter_data['start_date'] = TTDate::getBeginDayEpoch($filter_data['start_date']);
$filter_data['end_date'] = TTDate::getEndDayEpoch($filter_data['end_date']);
$schedule_shifts_index = array();
$branch_options = array();
//No longer needed, use SQL instead.
$department_options = array();
//No longer needed, use SQL instead.
$apf = TTnew('AbsencePolicyFactory');
$absence_policy_paid_type_options = $apf->getOptions('paid_type');
$max_i = 0;
$slf = TTnew('ScheduleListFactory');
$slf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data);
Debug::text('Found Scheduled Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($absence_policy_paid_type_options, 'Paid Absences: ', __FILE__, __LINE__, __METHOD__, 10);
if ($slf->getRecordCount() > 0) {
$this->getProgressBarObject()->start($this->getAMFMessageID(), $slf->getRecordCount(), NULL, TTi18n::getText('Processing Committed Shifts...'));
$i = 0;
foreach ($slf as $s_obj) {
//Debug::text('Schedule ID: '. $s_obj->getId() .' User ID: '. $s_obj->getColumn('user_id') .' Start Time: '. $s_obj->getStartTime(), __FILE__, __LINE__, __METHOD__, 10);
if ($s_obj->getAbsencePolicyID() > 0) {
$absence_policy_name = $s_obj->getColumn('absence_policy');
} else {
$absence_policy_name = NULL;
//Must be NULL for it to appear as "N/A" in legacy interface.
}
$hourly_rate = Misc::MoneyFormat($s_obj->getColumn('user_wage_hourly_rate'), FALSE);
if ($s_obj->getAbsencePolicyID() > 0 and is_object($s_obj->getAbsencePolicyObject()) and in_array($s_obj->getAbsencePolicyObject()->getType(), $absence_policy_paid_type_options) == FALSE) {
//UnPaid Absence.
$total_time_wage = Misc::MoneyFormat(0);
} else {
$total_time_wage = Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), $hourly_rate), FALSE);
}
//$iso_date_stamp = TTDate::getISODateStamp($s_obj->getStartTime());
$iso_date_stamp = TTDate::getISODateStamp(strtotime($s_obj->getColumn('date_stamp')));
//$schedule_shifts[$iso_date_stamp][$s_obj->getColumn('user_id').$s_obj->getStartTime()] = array(
$schedule_shifts[$iso_date_stamp][$i] = array('id' => (int) $s_obj->getID(), 'pay_period_id' => (int) $s_obj->getColumn('pay_period_id'), 'user_id' => (int) $s_obj->getColumn('user_id'), 'user_created_by' => (int) $s_obj->getColumn('user_created_by'), 'user_full_name' => $s_obj->getColumn('user_id') > 0 ? Misc::getFullName($s_obj->getColumn('first_name'), NULL, $s_obj->getColumn('last_name'), FALSE, FALSE) : TTi18n::getText('OPEN'), 'first_name' => $s_obj->getColumn('user_id') > 0 ? $s_obj->getColumn('first_name') : TTi18n::getText('OPEN'), 'last_name' => $s_obj->getColumn('last_name'), 'title_id' => $s_obj->getColumn('title_id'), 'title' => $s_obj->getColumn('title'), 'group_id' => $s_obj->getColumn('group_id'), 'group' => $s_obj->getColumn('group'), 'default_branch_id' => $s_obj->getColumn('default_branch_id'), 'default_branch' => $s_obj->getColumn('default_branch'), 'default_department_id' => $s_obj->getColumn('default_department_id'), 'default_department' => $s_obj->getColumn('default_department'), 'job_id' => $s_obj->getColumn('job_id'), 'job' => $s_obj->getColumn('job'), 'job_status_id' => $s_obj->getColumn('job_status_id'), 'job_manual_id' => $s_obj->getColumn('job_manual_id'), 'job_branch_id' => $s_obj->getColumn('job_branch_id'), 'job_department_id' => $s_obj->getColumn('job_department_id'), 'job_group_id' => $s_obj->getColumn('job_group_id'), 'job_item_id' => $s_obj->getColumn('job_item_id'), 'job_item' => $s_obj->getColumn('job_item'), 'type_id' => 10, 'status_id' => (int) $s_obj->getStatus(), 'date_stamp' => TTDate::getAPIDate('DATE', strtotime($s_obj->getColumn('date_stamp'))), 'start_date_stamp' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'start_time_stamp' => $s_obj->getStartTime(), 'end_time_stamp' => $s_obj->getEndTime(), 'total_time' => $s_obj->getTotalTime(), 'hourly_rate' => $hourly_rate, 'total_time_wage' => $total_time_wage, 'note' => $s_obj->getColumn('note'), 'schedule_policy_id' => (int) $s_obj->getSchedulePolicyID(), 'absence_policy_id' => (int) $s_obj->getAbsencePolicyID(), 'absence_policy' => $absence_policy_name, 'branch_id' => (int) $s_obj->getBranch(), 'branch' => $s_obj->getColumn('branch'), 'department_id' => (int) $s_obj->getDepartment(), 'department' => $s_obj->getColumn('department'), 'created_by_id' => $s_obj->getCreatedBy(), 'created_date' => $s_obj->getCreatedDate(), 'updated_date' => $s_obj->getUpdatedDate());
//Make sure we add in permission columns.
$this->getPermissionColumns($schedule_shifts[$iso_date_stamp][$i], (int) $s_obj->getColumn('user_id'), $s_obj->getCreatedBy(), $permission_children_ids);
//$schedule_shifts_index[$iso_date_stamp][$s_obj->getColumn('user_id')][] = $s_obj->getColumn('user_id').$s_obj->getStartTime();
$schedule_shifts_index[$iso_date_stamp][$s_obj->getColumn('user_id')][] = $i;
unset($absence_policy_name);
$this->getProgressBarObject()->set($this->getAMFMessageID(), $slf->getCurrentRow());
$i++;
}
$max_i = $i;
unset($i);
$this->getProgressBarObject()->stop($this->getAMFMessageID());
//Debug::Arr($schedule_shifts, 'Committed Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($schedule_shifts_index, 'Committed Schedule Shifts Index: ', __FILE__, __LINE__, __METHOD__, 10);
} else {
$schedule_shifts = array();
}
unset($slf);
//Get holidays
//FIXME: What if there are two holiday policies, one that defaults to working, and another that defaults to not working, and they are assigned
//to two different groups of employees? For that matter what if the holiday policy isn't assigned to a specific user at all.
$holiday_data = array();
$hlf = TTnew('HolidayListFactory');
$hlf->getByCompanyIdAndStartDateAndEndDate($current_user->getCompany(), $filter_data['start_date'], $filter_data['end_date']);
Debug::text('Found Holiday Rows: ' . $hlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($hlf as $h_obj) {
if (is_object($h_obj->getHolidayPolicyObject()) and is_object($h_obj->getHolidayPolicyObject()->getAbsencePolicyObject())) {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => (int) $h_obj->getHolidayPolicyObject()->getDefaultScheduleStatus(), 'absence_policy_id' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyID(), 'type_id' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyObject()->getType(), 'absence_policy' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyObject()->getName());
} else {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => 10);
//Working
}
}
unset($hlf);
$recurring_schedule_shifts = array();
$open_shift_conflict_index = array();
$rstlf = TTnew('RecurringScheduleTemplateListFactory');
//Order for this is critcal to working with OPEN shifts. OPEN shifts (user_id=0) must come last, so it can find all conflicting shifts that will override it.
//Also order by start_time so earlier shifts come first and therefore are the first to be overridden.
$rstlf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data, NULL, NULL, NULL, array('c.start_date' => 'asc', 'cb.user_id' => 'desc', 'a.week' => 'asc', 'a.start_time' => 'asc'));
Debug::text('Found Recurring Schedule Template Rows: ' . $rstlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($rstlf->getRecordCount() > 0) {
$this->getProgressBarObject()->start($this->getAMFMessageID(), $rstlf->getRecordCount(), NULL, TTi18n::getText('Processing Recurring Shifts...'));
foreach ($rstlf as $rst_obj) {
//Debug::text('Recurring Schedule Template ID: '. $rst_obj->getID() , __FILE__, __LINE__, __METHOD__, 10);
$rst_obj->getShifts($filter_data['start_date'], $filter_data['end_date'], $holiday_data, $branch_options, $department_options, $max_i, $schedule_shifts, $schedule_shifts_index, $open_shift_conflict_index, $permission_children_ids);
$this->getProgressBarObject()->set($this->getAMFMessageID(), $rstlf->getCurrentRow());
}
$this->getProgressBarObject()->stop($this->getAMFMessageID());
} else {
Debug::text('DID NOT find Recurring Schedule for this time period: ', __FILE__, __LINE__, __METHOD__, 10);
}
unset($rstlf, $rst_obj, $open_shift_conflict_index);
//Debug::Arr($schedule_shifts, 'Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........
示例5: strlen
if (isset($ein[0]) and isset($ein[1])) {
$pdf->setXY(15, 236);
$pdf->Cell(13, 6, $ein[0], $border, 0, 'R');
$pdf->setXY(29, 236);
$pdf->Cell(40, 6, $ein[1], $border, 0, 'L');
}
$pdf->setXY(82, 244);
$pdf->Cell(75, 6, $current_company->getName(), $border, 0, 'L');
$pdf->setXY(82, 253);
$pdf->Cell(45, 6, $current_company->getAddress1() . ' ' . $current_company->getAddress2(), $border, 0, 'L');
$pdf->setXY(82, 261);
$pdf->Cell(45, 6, $current_company->getCity() . ', ' . $current_company->getProvince() . ' ' . $current_company->getPostalCode(), $border, 0, 'L');
$pdf->setXY(157, 234);
$pdf->Cell(35, 6, Misc::getBeforeDecimal(Misc::MoneyFormat($lines_arr['total']['p1_6'], FALSE)), $border, 0, 'R');
$pdf->setXY(193, 234);
$pdf->Cell(6, 6, Misc::getAfterDecimal(Misc::MoneyFormat($lines_arr['total']['p1_6'], FALSE)), $border, 0, 'L');
}
$output = $pdf->Output('', 'S');
if (Debug::getVerbosity() == 11) {
Debug::Display();
} else {
Misc::FileDownloadHeader('f940ez.pdf', 'application/pdf', strlen($output));
echo $output;
}
exit;
}
}
break;
case 'delete':
case 'save':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
示例6: array
if ($tax_deduction_arr['calculation_id'] == 200 and $tax_deduction_arr['province'] != '') {
//State Wages/Taxes
//Handle two states here, just check if $tmp_rows[$x]['state_1'] isset,
//if it is, move on to state 2.
$tmp_rows[$x]['state_1'] = $tax_deduction_arr['province'];
$tmp_rows[$x]['state_wage_1'] = Misc::MoneyFormat(Misc::sumMultipleColumns($raw_rows[$user_id], $tax_deduction_arr['include']), FALSE);
$tmp_rows[$x]['state_tax_1'] = Misc::MoneyFormat(Misc::sumMultipleColumns($raw_rows[$user_id], array($tax_deduction_arr['pay_stub_entry_account_id'])), FALSE);
} elseif ($tax_deduction_arr['calculation_id'] == 300 and ($tax_deduction_arr['district'] != '' or $tax_deduction_arr['company_value1'] != '')) {
//District Wages/Taxes
if ($tax_deduction_arr['district'] == '' and $tax_deduction_arr['company_value1'] != '') {
$tmp_rows[$x]['district_1'] = $tax_deduction_arr['company_value1'];
} else {
$tmp_rows[$x]['district_1'] = $tax_deduction_arr['district'];
}
$tmp_rows[$x]['district_wage_1'] = Misc::MoneyFormat(Misc::sumMultipleColumns($raw_rows[$user_id], $tax_deduction_arr['include']), FALSE);
$tmp_rows[$x]['district_tax_1'] = Misc::MoneyFormat(Misc::sumMultipleColumns($raw_rows[$user_id], array($tax_deduction_arr['pay_stub_entry_account_id'])), FALSE);
} else {
//Debug::Text('Not State or Local income tax: '. $tax_deduction_arr['id'] .' Calculation: '. $tax_deduction_arr['calculation_id'] .' District: '. $tax_deduction_arr['district'] .' UserValue5: '.$tax_deduction_arr['user_value5'] .' CompanyValue1: '. $tax_deduction_arr['company_value1'], __FILE__, __LINE__, __METHOD__,10);
}
} else {
Debug::Text('DID NOT Find user in Tax Deduction ID: ' . $tax_deduction_arr['id'], __FILE__, __LINE__, __METHOD__, 10);
}
}
} else {
Debug::Text('No Tax Deductions...', __FILE__, __LINE__, __METHOD__, 10);
}
$x++;
}
}
//print_r($tmp_rows);
if (isset($tmp_rows)) {
示例7: getShifts
//.........这里部分代码省略.........
if ($this->getColumn('user_id') > 0 and isset($shifts_index[$iso_date_stamp][$this->getColumn('user_id')])) {
//User has previous recurring schedule shifts, check for overlap.
//Loop over each employees shift for this day and check for conflicts
foreach ($shifts_index[$iso_date_stamp][$this->getColumn('user_id')] as $shift_key) {
if (isset($shifts[$iso_date_stamp][$shift_key])) {
//Must use parseDateTime() when called from the API due to date formats that strtotime() fails on.
if (TTDate::isTimeOverLap(defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['start_date']) : $shifts[$iso_date_stamp][$shift_key]['start_date'], defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['end_date']) : $shifts[$iso_date_stamp][$shift_key]['end_date'], $start_time, $end_time) == TRUE) {
//Debug::text(' Found overlapping recurring schedules! User ID: '. $this->getColumn('user_id') .' Start Time: '. $start_time,__FILE__, __LINE__, __METHOD__, 10);
continue 2;
}
}
}
unset($shift_key);
} elseif ($this->getColumn('user_id') == 0 and isset($shifts_index[$iso_date_stamp])) {
//Debug::text(' Checking OPEN shift conflicts... Date: '. $iso_date_stamp,__FILE__, __LINE__, __METHOD__, 10);
//Check all OPEN shifts for conflicts.
//This is special, since there can be multiple open shifts for the same branch,department,job,task, so we need to check if are conflicts with *any* employee.
//Do we allow conflicting shifts between committed and recurring OPEN shifts? For example what if there are two open shifts on the same day
//6AM-3PM (x2) and they want to override one of those shifts to 7AM-4PM? If we use this check:
// ( $shifts[$iso_date_stamp][$shift_key]['user_id'] > 0 OR ( isset($shifts[$iso_date_stamp][$shift_key]['id']) AND $shifts[$iso_date_stamp][$shift_key]['id'] > 0 ) )
//That allows committed OPEN shifts to override recurring open shifts, which is great, but it prevents adding additional open shifts that may
//also overlap unless they override all recurring shifts first. I think this is the trade-off we have to make as its more likely that they
//will adjust an open shift time rather than add/remove specific shifts. Removing recurring OPEN shifts can be done by making them ABSENT.
//This will also affect when recurring OPEN shifts are committed by preventing the shifts from doubling up.
foreach ($shifts_index[$iso_date_stamp] as $tmp_index_user_id => $tmp_index_arr) {
foreach ($tmp_index_arr as $shift_key) {
$tmp_start_date = defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['start_date']) : $shifts[$iso_date_stamp][$shift_key]['start_date'];
$tmp_end_date = defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['end_date']) : $shifts[$iso_date_stamp][$shift_key]['end_date'];
if (($shifts[$iso_date_stamp][$shift_key]['user_id'] > 0 or isset($shifts[$iso_date_stamp][$shift_key]['id']) and $shifts[$iso_date_stamp][$shift_key]['id'] > 0) and (!isset($open_shift_conflict_index['open'][$this->getID()][$shift_key]) and (isset($shifts[$iso_date_stamp][$shift_key]['id']) and !isset($open_shift_conflict_index['scheduled'][$shifts[$iso_date_stamp][$shift_key]['id']]))) and $this->getColumn('schedule_branch_id') == $shifts[$iso_date_stamp][$shift_key]['branch_id'] and $this->getColumn('schedule_department_id') == $shifts[$iso_date_stamp][$shift_key]['department_id'] and $this->getColumn('job_id') == $shifts[$iso_date_stamp][$shift_key]['job_id'] and $this->getColumn('job_item_id') == $shifts[$iso_date_stamp][$shift_key]['job_item_id'] and ($tmp_start_date == $start_time and $tmp_end_date == $end_time)) {
//Debug::text(' Found OPEN shift conflict... Skipping...! Shift Key: '. $shift_key,__FILE__, __LINE__, __METHOD__, 10);
//We need to track each shift_key that caused a conflict so it can't cause another conflict later on.
// Make sure we just track it on a per template basis though, otherwise the same $shift_key from a previous template can affect other templates.
// The above issue would show up as OPEN shifts not being overridden.
//We also need to track which scheduled shift that caused a conflict so it can't cause another one later on.
// This prevents a single scheduled shift from overriding multiple OPEN shifts of different times.
//However we need to be smarter about which shifts override which OPEN shifts...
// So if there are two open shifts, 10AM-4PM and 3:50PM-9PM, a 10AM-4PM scheduled shift overrides the OPEN shift that best fits it (10AM to 4PM, *not* 3:50-9PM)
// For now require an exact match to override an OPEN shift, if we start using partial schedules it gets much more complicated.
// Or we could introduce a hardcoded "fudge factor" setting (ie: 5 mins) that is always used instead.
$open_shift_conflict_index['open'][$this->getID()][$shift_key] = TRUE;
$open_shift_conflict_index['scheduled'][$shifts[$iso_date_stamp][$shift_key]['id']] = TRUE;
continue 3;
}
unset($tmp_start_date, $tmp_end_date);
}
}
unset($tmp_index_user_id, $tmp_index_arr);
}
//This check has to occurr after the committed schedule check, otherwise no committed schedules will appear.
if ($this->getColumn('recurring_schedule_control_start_date') != '' and $i < TTDate::strtotime($this->getColumn('recurring_schedule_control_start_date')) or $this->getColumn('recurring_schedule_control_end_date') != '' and $i > TTDate::strtotime($this->getColumn('recurring_schedule_control_end_date'))) {
//Debug::text('Skipping due to Recurring Schedule Start/End date: ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' I: '. $i .' Start Date: '. $this->getColumn('recurring_schedule_control_start_date') .' ('. TTDate::strtotime( $this->getColumn('recurring_schedule_control_start_date') ) .') End Date: '. $this->getColumn('recurring_schedule_control_end_date') ,__FILE__, __LINE__, __METHOD__, 10);
continue;
}
//Debug::text(' Start Date: '. TTDate::getDate('DATE+TIME', $start_time) .' End Date: '. TTDate::getDate('DATE+TIME', $end_time),__FILE__, __LINE__, __METHOD__, 10);
$status_id = $this->getColumn('status_id');
$absence_policy_id = $this->getColumn('absence_policy_id');
$absence_policy_type_id = $this->getColumn('absence_policy_type_id');
$absence_policy = $this->getColumn('absence_policy') != '' ? $this->getColumn('absence_policy') : NULL;
//Must be NULL to be converted to N/A
if (isset($holiday_data[$iso_date_stamp])) {
//We have to assume they are eligible, because we really won't know
//if they will have worked enough days or not. We could assume they
//work whatever their schedule is, but chances are they will be eligible then anyways.
//Debug::text(' Found Holiday on this day...',__FILE__, __LINE__, __METHOD__, 10);
$status_id = $holiday_data[$iso_date_stamp]['status_id'];
if (isset($holiday_data[$iso_date_stamp]['absence_policy_id'])) {
$absence_policy_id = $holiday_data[$iso_date_stamp]['absence_policy_id'];
$absence_policy_type_id = $holiday_data[$iso_date_stamp]['type_id'];
$absence_policy = $holiday_data[$iso_date_stamp]['absence_policy'];
}
}
$hourly_rate = Misc::MoneyFormat($this->getColumn('user_wage_hourly_rate'), FALSE);
if ($absence_policy_id > 0 and in_array($absence_policy_type_id, $absence_policy_paid_type_options) == FALSE) {
//UnPaid Absence.
$total_time_wage = Misc::MoneyFormat(0);
} else {
$total_time_wage = Misc::MoneyFormat(bcmul(TTDate::getHours($this->getTotalTime()), $hourly_rate), FALSE);
}
//Debug::text('I: '. $i .' N: '. $n .' User ID: '. $this->getColumn('user_id') .' Current Date: '. TTDate::getDate('DATE+TIME', $i) .' Current Week: '. $current_week .' Start Time: '. TTDate::getDate('DATE+TIME', $start_time ) .' Absence Policy: '. $absence_policy,__FILE__, __LINE__, __METHOD__, 10);
//$shifts[$iso_date_stamp][$this->getColumn('user_id').$start_time] = array(
$shifts[$iso_date_stamp][$n] = array('pay_period_id' => FALSE, 'user_id' => (int) $this->getColumn('user_id'), 'user_created_by' => $this->getColumn('user_created_by'), 'user_full_name' => $this->getColumn('user_id') > 0 ? Misc::getFullName($this->getColumn('first_name'), NULL, $this->getColumn('last_name'), FALSE, FALSE) : TTi18n::getText('OPEN'), 'first_name' => $this->getColumn('first_name'), 'last_name' => $this->getColumn('last_name'), 'title_id' => $this->getColumn('title_id'), 'title' => $this->getColumn('title'), 'group_id' => $this->getColumn('group_id'), 'group' => $this->getColumn('group'), 'default_branch_id' => $this->getColumn('default_branch_id'), 'default_branch' => $this->getColumn('default_branch'), 'default_department_id' => $this->getColumn('default_department_id'), 'default_department' => $this->getColumn('default_department'), 'job_id' => $this->getJob(), 'job' => $this->getColumn('job'), 'job_status_id' => $this->getColumn('job_status_id'), 'job_manual_id' => $this->getColumn('job_manual_id'), 'job_branch_id' => $this->getColumn('job_branch_id'), 'job_department_id' => $this->getColumn('job_department_id'), 'job_group_id' => $this->getColumn('job_group_id'), 'job_item_id' => $this->getJobItem(), 'job_item' => $this->getColumn('job_item'), 'type_id' => 20, 'status_id' => $status_id, 'date_stamp' => TTDate::getAPIDate('DATE', strtotime($iso_date_stamp)), 'start_date_stamp' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE', $start_time) : $start_time, 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $start_time) : $start_time, 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $end_time) : $end_time, 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $start_time) : $start_time, 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $end_time) : $end_time, 'start_time_stamp' => $start_time, 'end_time_stamp' => $end_time, 'total_time' => $this->getTotalTime(), 'hourly_rate' => $hourly_rate, 'total_time_wage' => $total_time_wage, 'note' => FALSE, 'schedule_policy_id' => $this->getSchedulePolicyID(), 'absence_policy_id' => $absence_policy_id, 'absence_policy' => $absence_policy, 'branch_id' => $this->getColumn('schedule_branch_id'), 'branch' => $this->getColumn('schedule_branch'), 'department_id' => $this->getColumn('schedule_department_id'), 'department' => $this->getColumn('schedule_department'), 'created_by_id' => $this->getColumn('recurring_schedule_control_created_by'), 'created_date' => $this->getCreatedDate(), 'updated_date' => $this->getUpdatedDate());
//Make sure we add in permission columns.
$this->getPermissionColumns($shifts[$iso_date_stamp][$n], (int) $this->getColumn('user_id'), $this->getColumn('recurring_schedule_control_created_by'), $permission_children_ids);
//$shifts_index[$iso_date_stamp][$this->getColumn('user_id')][] = $this->getColumn('user_id').$start_time;
$shifts_index[$iso_date_stamp][$this->getColumn('user_id')][] = $n;
$n++;
}
unset($open_shift_multiplier);
unset($start_time, $end_time);
} else {
//Debug::text(' NOT active shift on this day... ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' Start Time: '. TTDate::getDate('DATE+TIME', $i),__FILE__, __LINE__, __METHOD__, 10);
}
}
}
if (isset($shifts)) {
//Debug::Arr($shifts, 'Template Shifts: ',__FILE__, __LINE__, __METHOD__, 10);
return $shifts;
}
return FALSE;
}
示例8: TTnew
$aplf = TTnew('AbsencePolicyListFactory');
$aplf->getByCompanyId($current_company->getId());
if ($aplf->getRecordCount() > 0) {
foreach ($aplf as $ap_obj) {
$absence_policy_paid_options[$ap_obj->getID()] = $ap_obj->isPaid();
}
}
unset($aplf, $ap_obj);
$sf = TTnew('ScheduleFactory');
$raw_schedule_shifts = $sf->getScheduleArray($filter_data);
if (is_array($raw_schedule_shifts)) {
foreach ($raw_schedule_shifts as $iso_date => $data_a) {
foreach ($data_a as $shift_key => $data) {
//Hide wages if they don't have permission.
if ($permission->Check('wage', 'view') == FALSE and !in_array($data['user_id'], $wage_filter_data['permission_children_ids']) == TRUE) {
$data['hourly_rate'] = $data['total_time_wage'] = Misc::MoneyFormat(0);
}
$tmp_rows[$data['pay_period_id']][$data['user_id']][] = $data;
}
}
}
unset($raw_schedule_shifts);
//var_dump($tmp_rows);
$ulf = TTnew('UserListFactory');
$utlf = TTnew('UserTitleListFactory');
$title_options = $utlf->getByCompanyIdArray($current_company->getId());
$uglf = TTnew('UserGroupListFactory');
$group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'no_tree_text', TRUE));
$blf = TTnew('BranchListFactory');
$branch_options = $blf->getByCompanyIdArray($current_company->getId());
$dlf = TTnew('DepartmentListFactory');
示例9: _outputPDFForm
//.........这里部分代码省略.........
}
Debug::Text('Form Type: ' . $form_type, __FILE__, __LINE__, __METHOD__, 10);
$t4a->setType($form_type);
$t4a->setStatus($setup_data['status_id']);
$t4a->year = TTDate::getYear($filter_data['start_date']);
$t4a->payroll_account_number = (isset($setup_data['payroll_account_number']) and $setup_data['payroll_account_number'] != '') ? $setup_data['payroll_account_number'] : $current_company->getBusinessNumber();
$t4a->company_name = (isset($setup_data['company_name']) and $setup_data['company_name'] != '') ? $setup_data['company_name'] : $current_company->getName();
$i = 0;
foreach ($this->form_data as $row) {
//if ( $i == $last_row ) {
// continue;
//}
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('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(), 'province' => $user_obj->getProvince(), 'employment_province' => $user_obj->getProvince(), 'postal_code' => $user_obj->getPostalCode(), 'sin' => $user_obj->getSIN(), 'employee_number' => $user_obj->getEmployeeNumber(), 'l16' => $row['pension'], 'l22' => $row['income_tax'], 'l18' => $row['lump_sum_payment'], 'l20' => $row['self_employed_commission'], 'l24' => $row['annuities'], 'l48' => $row['service_fees'], 'other_box_0_code' => NULL, 'other_box_0' => NULL, 'other_box_1_code' => NULL, 'other_box_1' => NULL, 'other_box_2_code' => NULL, 'other_box_2' => NULL, 'other_box_3_code' => NULL, 'other_box_3' => NULL, 'other_box_4_code' => NULL, 'other_box_4' => NULL, 'other_box_5_code' => NULL, 'other_box_5' => NULL);
if ($row['other_box_0'] > 0 and isset($setup_data['other_box'][0]['box']) and $setup_data['other_box'][0]['box'] != '') {
$ee_data['other_box_0_code'] = $setup_data['other_box'][0]['box'];
$ee_data['other_box_0'] = $row['other_box_0'];
}
if ($row['other_box_1'] > 0 and isset($setup_data['other_box'][1]['box']) and $setup_data['other_box'][1]['box'] != '') {
$ee_data['other_box_1_code'] = $setup_data['other_box'][1]['box'];
$ee_data['other_box_1'] = $row['other_box_1'];
}
if ($row['other_box_2'] > 0 and isset($setup_data['other_box'][2]['box']) and $setup_data['other_box'][2]['box'] != '') {
$ee_data['other_box_2_code'] = $setup_data['other_box'][2]['box'];
$ee_data['other_box_2'] = $row['other_box_2'];
}
if ($row['other_box_3'] > 0 and isset($setup_data['other_box'][3]['box']) and $setup_data['other_box'][3]['box'] != '') {
$ee_data['other_box_3_code'] = $setup_data['other_box'][3]['box'];
$ee_data['other_box_3'] = $row['other_box_3'];
}
if ($row['other_box_4'] > 0 and isset($setup_data['other_box'][4]['box']) and $setup_data['other_box'][4]['box'] != '') {
$ee_data['other_box_4_code'] = $setup_data['other_box'][4]['box'];
$ee_data['other_box_4'] = $row['other_box_4'];
}
$t4a->addRecord($ee_data);
unset($ee_data);
$i++;
}
}
$this->getFormObject()->addForm($t4a);
//Handle T4ASummary
$t4as = $this->getT4ASumObject();
$t4as->setStatus($setup_data['status_id']);
$t4as->year = $t4a->year;
$t4as->payroll_account_number = $t4a->payroll_account_number;
$t4as->company_name = $t4a->company_name;
$t4as->company_address1 = (isset($setup_data['address1']) and $setup_data['address1'] != '') ? $setup_data['address1'] : $current_company->getAddress1();
$t4as->company_address2 = (isset($setup_data['address2']) and $setup_data['address2'] != '') ? $setup_data['address2'] : $current_company->getAddress2();
$t4as->company_city = (isset($setup_data['city']) and $setup_data['city'] != '') ? $setup_data['city'] : $current_company->getCity();
$t4as->company_province = (isset($setup_data['province']) and ($setup_data['province'] != '' and $setup_data['province'] != 0)) ? $setup_data['province'] : $current_company->getProvince();
$t4as->company_postal_code = (isset($setup_data['postal_code']) and $setup_data['postal_code'] != '') ? $setup_data['postal_code'] : $current_company->getPostalCode();
$t4as->l76 = $this->getUserObject()->getFullName();
//Contact name.
$t4as->l78 = $current_company->getWorkPhone();
$total_row = Misc::ArrayAssocSum($this->form_data);
$t4as->l88 = count($this->form_data);
$t4as->l16 = $total_row['pension'];
$t4as->l22 = $total_row['income_tax'];
$t4as->l18 = $total_row['lump_sum_payment'];
$t4as->l20 = $total_row['self_employed_commission'];
$t4as->l24 = $total_row['annuities'];
$t4as->l48 = $total_row['service_fees'];
if (isset($setup_data['other_box'])) {
foreach ($setup_data['other_box'] as $key => $other_box_data) {
//Debug::Text('zFound other box total for T4A Sum: '. $key .' Code: '. $other_box_data['box'], __FILE__, __LINE__, __METHOD__,10);
if (in_array((int) $other_box_data['box'], array(28, 30, 32, 34, 40, 42))) {
//Debug::Text('Found other box total for T4A Sum: '. $key .' Code: '. $other_box_data['box'], __FILE__, __LINE__, __METHOD__,10);
$object_var = 'l' . (int) $other_box_data['box'];
$t4as->{$object_var} = $total_row['other_box_' . $key];
unset($object_var);
}
}
}
unset($other_box_data, $key);
$total_other_deductions = Misc::MoneyFormat(Misc::sumMultipleColumns($total_row, array('other_box_0', 'other_box_1', 'other_box_2', 'other_box_3', 'other_box_4')), FALSE);
$t4as->l101 = $total_other_deductions;
//$total_deductions = Misc::MoneyFormat( Misc::sumMultipleColumns( $total_row, array('pension','income_tax','lump_sum_payment', 'self_employed_commission', 'annuities','service_fees') ), FALSE );
//$t4as->l82 = $total_deductions;
$t4as->l82 = $total_row['income_tax'];
$this->getFormObject()->addForm($t4as);
if ($format == 'efile_xml') {
$output_format = 'XML';
$file_name = 't4a_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);
}
示例10: calcHourlyRate
function calcHourlyRate($epoch = FALSE, $accurate_calculation = FALSE)
{
$hourly_wage = 0;
if ($this->getType() == 10) {
$hourly_wage = $this->getWage();
} else {
$hourly_wage = $this->getAnnualHourlyRate($this->getAnnualWage(), $epoch, $accurate_calculation);
}
return Misc::MoneyFormat($hourly_wage, FALSE);
}
示例11: createInvoice
function createInvoice($company_id, $client_id, $currency_id, $products, $status_id = 10, $payments = NULL, $user_ids = NULL, $shipping_policy_ids = NULL)
{
$if = TTnew('InvoiceFactory');
$ilf = TTnew('InvoiceListFactory');
$tf = TTnew('TransactionFactory');
$clf = TTnew('ClientListFactory');
$plf = TTnew('ProductListFactory');
if (isset($client_id) and $client_id != '') {
$clf->getByIdAndCompanyId($client_id, $company_id);
if ($clf->getRecordCount() > 0) {
$c_obj = $clf->getCurrent();
}
}
$client_billing_contact_obj = $c_obj->getClientContactObject($c_obj->getDefaultBillingContact());
if (is_object($client_billing_contact_obj)) {
$default_currency = $client_billing_contact_obj->getCurrency();
} else {
$default_currency = $currency_id;
}
unset($client_billing_contact_obj);
//--------------------------------------
$if->StartTransaction();
$if->setClient($client_id);
$if->setStatus($status_id);
$if->setBillingContact($c_obj->getDefaultBillingContact());
$if->setShippingContact($c_obj->getDefaultShippingContact());
$if->setOtherContact($c_obj->getDefaultOtherContact());
$if->setSalesContact($this->getRandomArrayValue((array) $user_ids));
$if->setCurrency($default_currency);
$if->setOrderDate(TTDate::getTime());
$if->setInvoiceDate(TTDate::getTime());
if ($shipping_policy_ids != NULL) {
$shipping_policy_id = $this->getRandomArrayValue((array) $shipping_policy_ids);
} else {
$shipping_policy_id = 0;
}
$combined_shipping_policy_arr = ShippingPolicyFactory::parseCombinedShippingPolicyServiceId($shipping_policy_id);
if (isset($combined_shipping_policy_arr['shipping_policy_id'])) {
$shipping_policy_id = $combined_shipping_policy_arr['shipping_policy_id'];
}
if (isset($combined_shipping_policy_arr['shipping_policy_service_id'])) {
$shipping_policy_service_id = $combined_shipping_policy_arr['shipping_policy_service_id'];
} else {
$shipping_policy_service_id = $this->getRandomArrayValue((array) $shipping_policy_ids);
}
$if->setShippingPolicy($shipping_policy_id);
$if->setShippingPolicyService($shipping_policy_service_id);
$if->setPublicNote('');
$if->setPrivateNote('');
if ($if->isValid()) {
$invoice_id = $if->Save(FALSE);
}
if (is_numeric($products)) {
$products = (array) $products;
}
foreach ($products as $key => $product_id) {
Debug::Text('Product Id: ' . $product_id, __FILE__, __LINE__, __METHOD__, 10);
$plf->getByIdAndCompanyId($product_id, $company_id);
if ($plf->getRecordCount() > 0) {
foreach ($plf as $pf) {
$transactions[$key]['counter'] = $key;
$transactions[$key]['type_id'] = 10;
$transactions[$key]['product_id'] = $product_id;
$transactions[$key]['product_type_id'] = $pf->getType();
$transactions[$key]['product_part_number'] = $pf->getPartNumber();
$transactions[$key]['product_name'] = $pf->getName();
$transactions[$key]['description'] = '';
$transactions[$key]['currency_id'] = $default_currency;
$transactions[$key]['unit_price'] = $pf->getUnitPrice();
$transactions[$key]['pro_rate_numerator'] = 1;
$transactions[$key]['pro_rate_denominator'] = 1;
$transactions[$key]['unit_cost'] = $pf->getUnitCost();
$transactions[$key]['quantity'] = rand(1, 10) * 10;
$transactions[$key]['amount'] = bcmul($transactions[$key]['unit_price'], $transactions[$key]['quantity']);
}
}
if (isset($payments)) {
$payments[$key]['counter'] = $key;
$payments[$key]['payment_type_id'] = 10;
$payments[$key]['currency_id'] = $default_currency;
$payments[$key]['amount'] = Misc::MoneyFormat($transactions[$key]['amount']);
$taxes_arr = $if->calcTaxes(array($transactions[$key]));
Debug::Arr($taxes_arr, 'Taxes...: ', __FILE__, __LINE__, __METHOD__, 10);
if (is_array($taxes_arr)) {
foreach ($taxes_arr as $ptp_data) {
$payments[$key]['amount'] = Misc::MoneyFormat(bcadd($payments[$key]['amount'], $ptp_data['amount']));
}
}
}
Debug::Arr($transactions[$key], 'Single Transaction...: ', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($payments[$key], 'Single Payment...: ', __FILE__, __LINE__, __METHOD__, 10);
}
Debug::Arr($transactions, 'Transaction...: ', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($payments, 'Payment...: ', __FILE__, __LINE__, __METHOD__, 10);
$is_credit_transaction_valid = TRUE;
$is_debit_transaction_valid = TRUE;
//Add each transaction now.
//Debug::Arr($transactions, 'Transactions: ', __FILE__, __LINE__, __METHOD__,10);
if (isset($transactions) and count($transactions) > 0) {
Debug::Text('Inserting Transactions: ' . count($transactions), __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........
示例12: foreach
$x = 0;
foreach ($raw_rows as $user_id => $raw_row) {
$user_obj = $ulf->getById($user_id)->getCurrent();
$tmp_rows[$x]['user_id'] = $user_id;
$tmp_rows[$x]['full_name'] = $user_obj->getFullName(TRUE);
//$tmp_rows[$x]['province'] = Option::getByKey($user_obj->getProvince(), $user_obj->getOptions('province') );
//$tmp_rows[$x]['province'] = $user_obj->getProvince();
$tmp_rows[$x]['province'] = $user_obj->getProvince();
$tmp_rows[$x]['country'] = $user_obj->getCountry();
$tmp_rows[$x]['title'] = Option::getByKey($user_obj->getTitle(), $title_options, NULL);
$tmp_rows[$x]['group'] = Option::getByKey($user_obj->getGroup(), $group_options);
$tmp_rows[$x]['default_branch'] = Option::getByKey($user_obj->getDefaultBranch(), $branch_options, NULL);
$tmp_rows[$x]['default_department'] = Option::getByKey($user_obj->getDefaultDepartment(), $department_options, NULL);
$tmp_rows[$x]['sin'] = $user_obj->getSIN();
foreach ($column_ps_entry_name_map as $column_key => $ps_entry_map) {
$tmp_rows[$x][$column_key] = Misc::MoneyFormat(Misc::sumMultipleColumns($raw_rows[$user_id], $ps_entry_map), FALSE);
}
$x++;
}
}
//var_dump($tmp_rows);
//Skip grouping if they are displaying T4's
if ($action != 'display_t4as' and isset($filter_data['primary_group_by']) and $filter_data['primary_group_by'] != '0') {
Debug::Text('Primary Grouping Data By: ' . $filter_data['primary_group_by'], __FILE__, __LINE__, __METHOD__, 10);
$ignore_elements = array_keys($static_columns);
$filter_data['column_ids'] = array_diff($filter_data['column_ids'], $ignore_elements);
//Add the group by element back in
if (isset($filter_data['secondary_group_by']) and $filter_data['secondary_group_by'] != 0) {
array_unshift($filter_data['column_ids'], $filter_data['primary_group_by'], $filter_data['secondary_group_by']);
} else {
array_unshift($filter_data['column_ids'], $filter_data['primary_group_by']);
示例13: setAmount
function setAmount($value)
{
$value = trim($value);
//Pull out only digits and periods.
$value = $this->Validator->stripNonFloat($value);
if ($this->Validator->isFloat('amount', $value, TTi18n::gettext('Invalid Amount, Must be a numeric value'))) {
$this->data['amount'] = Misc::MoneyFormat($value, FALSE);
return TRUE;
}
return FALSE;
}
示例14: array
$filter_data['job_item_ids'] = array(-1);
}
//$plf->getReportByStartDateAndEndDateAndUserIdListAndBranchIdAndDepartmentIdAndJobIdListAndJobItemIdList( $filter_data['start_date'], $filter_data['end_date'], $filter_data['user_ids'], $filter_data['punch_branch_ids'], $filter_data['punch_department_ids'], $filter_data['job_ids'], $filter_data['job_item_ids'] );
$plf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
foreach ($plf as $p_obj) {
//Debug::Text('User ID: '. $p_obj->getColumn('user_id') .' Status ID: '. $p_obj->getColumn('status_id') .' Time Stamp: '. TTDate::getDate('DATE+TIME', TTDate::strtotime( $p_obj->getColumn('punch_time_stamp') ) ), __FILE__, __LINE__, __METHOD__,10);
if (!isset($tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')])) {
$hourly_rate = 0;
if ($permission->Check('wage', 'view') == TRUE or in_array($p_obj->getColumn('user_id'), $wage_filter_data['permission_children_ids']) == TRUE) {
$uw_obj = getUserWageObject($p_obj->getColumn('user_wage_id'), $p_obj->getColumn('user_id'));
if (is_object($uw_obj)) {
$hourly_rate = $uw_obj->getHourlyRate();
}
}
$actual_time_diff = (int) $p_obj->getColumn('actual_total_time') - (int) $p_obj->getColumn('total_time');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')] = array('user_id' => $p_obj->getColumn('user_id'), 'group_id' => $p_obj->getColumn('group_id'), 'branch_id' => $p_obj->getColumn('branch_id'), 'department_id' => $p_obj->getColumn('department_id'), 'job_id' => $p_obj->getColumn('job_id'), 'job_name' => $p_obj->getColumn('job_name'), 'job_status_id' => $p_obj->getColumn('job_status_id'), 'job_manual_id' => $p_obj->getColumn('job_manual_id'), 'job_description' => $p_obj->getColumn('job_description'), 'job_branch_id' => $p_obj->getColumn('job_branch_id'), 'job_department_id' => $p_obj->getColumn('job_department_id'), 'job_group_id' => $p_obj->getColumn('job_group_id'), 'job_item_id' => $p_obj->getColumn('job_item_id'), 'quantity' => $p_obj->getColumn('quantity'), 'bad_quantity' => $p_obj->getColumn('bad_quantity'), 'note' => $p_obj->getColumn('note'), 'total_time' => $p_obj->getColumn('total_time'), 'total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('total_time')), $hourly_rate), FALSE), 'actual_total_time' => $p_obj->getColumn('actual_total_time'), 'actual_total_time_diff' => $actual_time_diff, 'actual_total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('actual_total_time')), $hourly_rate), FALSE), 'actual_total_time_diff_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($actual_time_diff), $hourly_rate)), 'other_id1' => $p_obj->getColumn('other_id1'), 'other_id2' => $p_obj->getColumn('other_id2'), 'other_id3' => $p_obj->getColumn('other_id3'), 'other_id4' => $p_obj->getColumn('other_id4'), 'other_id5' => $p_obj->getColumn('other_id5'), 'date_stamp' => TTDate::strtotime($p_obj->getColumn('date_stamp')), 'in_time_stamp' => NULL, 'in_actual_time_stamp' => NULL, 'in_type' => NULL, 'out_time_stamp' => NULL, 'out_actual_time_stamp' => NULL, 'out_type' => NULL, 'user_wage_id' => $p_obj->getColumn('user_wage_id'), 'hourly_rate' => Misc::MoneyFormat($hourly_rate, FALSE), 'in_station_type_id' => NULL, 'in_station_station_id' => NULL, 'in_station_source' => NULL, 'in_station_description' => NULL, 'out_station_type_id' => NULL, 'out_station_station_id' => NULL, 'out_station_source' => NULL, 'out_station_description' => NULL);
}
if ($p_obj->getColumn('status_id') == 10) {
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_time_stamp'] = TTDate::strtotime($p_obj->getColumn('time_stamp'));
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_type'] = $p_obj->getColumn('type_id');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_actual_time_stamp'] = TTDate::strtotime($p_obj->getColumn('actual_time_stamp'));
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_type_id'] = $p_obj->getColumn('station_type_id');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_station_id'] = $p_obj->getColumn('station_station_id');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_source'] = $p_obj->getColumn('station_source');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_description'] = $p_obj->getColumn('station_description');
} else {
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_time_stamp'] = TTDate::strtotime($p_obj->getColumn('time_stamp'));
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_type'] = $p_obj->getColumn('type_id');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_actual_time_stamp'] = TTDate::strtotime($p_obj->getColumn('actual_time_stamp'));
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_type_id'] = $p_obj->getColumn('station_type_id');
$tmp_rows[$p_obj->getColumn('pay_period_id')][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_station_id'] = $p_obj->getColumn('station_station_id');
示例15: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('schedule' => array(), 'user' => array(), 'total_shift' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE or $this->getPermissionObject()->Check('wage', 'view') == FALSE) {
$hlf = TTnew('HierarchyListFactory');
$permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
} else {
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$permission_children_ids = array();
$wage_permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('schedule', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('schedule', 'view_own')) {
$permission_children_ids[] = $this->getUserObject()->getID();
}
$filter_data['permission_children_ids'] = $permission_children_ids;
}
//Get Wage Permission Hierarchy Children first, as this can be used for viewing, or editing.
if ($this->getPermissionObject()->Check('wage', 'view') == TRUE) {
$wage_permission_children_ids = TRUE;
} elseif ($this->getPermissionObject()->Check('wage', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('wage', 'view_child') == FALSE) {
$wage_permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('wage', 'view_own')) {
$wage_permission_children_ids[] = $this->getUserObject()->getID();
}
}
//Debug::Text(' Permission Children: '. count($permission_children_ids) .' Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($permission_children_ids, 'Permission Children: '. count($permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($wage_permission_children_ids, 'Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
$jlf = TTnew('JobListFactory');
$job_status_options = $jlf->getOptions('status');
} else {
$job_status_options = array();
}
$pay_period_ids = array();
if (strpos($format, 'schedule') === FALSE) {
//Avoid running these queries when printing out the schedule.
$slf = TTnew('ScheduleListFactory');
$slf->getScheduleSummaryReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, NULL, NULL, NULL, array('last_name' => 'asc'));
//Sort by last name mainly for the PDF schedule for printing.
Debug::Text(' Total Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $slf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
if ($slf->getRecordCount() > 0) {
foreach ($slf as $key => $s_obj) {
$hourly_rate = 0;
if ($wage_permission_children_ids === TRUE or in_array($s_obj->getColumn('user_id'), $wage_permission_children_ids)) {
$hourly_rate = $s_obj->getColumn('user_wage_hourly_rate');
}
$date_stamp_epoch = TTDate::strtotime($s_obj->getColumn('date_stamp'));
$shift_arr = array('user_id' => $s_obj->getColumn('user_id'), 'status_id' => $s_obj->getColumn('status_id'), 'group' => $s_obj->getColumn('group'), 'default_branch' => $s_obj->getColumn('default_branch'), 'default_department' => $s_obj->getColumn('default_department'), 'branch' => $s_obj->getColumn('branch'), 'department' => $s_obj->getColumn('department'), 'job' => $s_obj->getColumn('job'), 'job_status_id' => Option::getByKey($s_obj->getColumn('job_status_id'), $job_status_options, NULL), 'job_manual_id' => $s_obj->getColumn('job_manual_id'), 'job_description' => $s_obj->getColumn('job_description'), 'job_branch' => $s_obj->getColumn('job_branch'), 'job_department' => $s_obj->getColumn('job_department'), 'job_group' => $s_obj->getColumn('job_group'), 'job_item' => $s_obj->getColumn('job_item'), 'quantity' => $s_obj->getColumn('quantity'), 'bad_quantity' => $s_obj->getColumn('bad_quantity'), 'total_time' => $s_obj->getColumn('total_time'), 'total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), $hourly_rate), FALSE), 'total_time_wage_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100))), FALSE), 'total_time_wage_with_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcadd(bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100), 1))), FALSE), 'other_id1' => $s_obj->getColumn('other_id1'), 'other_id2' => $s_obj->getColumn('other_id2'), 'other_id3' => $s_obj->getColumn('other_id3'), 'other_id4' => $s_obj->getColumn('other_id4'), 'other_id5' => $s_obj->getColumn('other_id5'), 'date_stamp' => $date_stamp_epoch, 'schedule_policy' => $s_obj->getColumn('schedule_policy'), 'absence_policy' => $s_obj->getColumn('absence_policy'), 'schedule_status' => Option::getByKey($s_obj->getStatus(), $s_obj->getOptions('status'), NULL), 'start_time' => TTDate::strtotime($s_obj->getColumn('start_time')), 'end_time' => TTDate::strtotime($s_obj->getColumn('end_time')), 'user_wage_id' => $s_obj->getColumn('user_wage_id'), 'hourly_rate' => Misc::MoneyFormat($hourly_rate, FALSE), 'pay_period_start_date' => strtotime($s_obj->getColumn('pay_period_start_date')), 'pay_period_end_date' => strtotime($s_obj->getColumn('pay_period_end_date')), 'pay_period_transaction_date' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period_id' => $s_obj->getColumn('pay_period_id'), 'schedule_note' => $s_obj->getColumn('note'), 'total_shift' => 1);
unset($hourly_rate);
$this->tmp_data['schedule'][$s_obj->getColumn('user_id')][] = $shift_arr;
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
}
//Debug::Arr($this->tmp_data['schedule'], 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($this->form_data, 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
}
unset($filter_data['status_id']);
//This is for schedule status, not user status.
//If we're printing the schedule, make sure we include the required columns.
if (in_array($format, $this->special_output_format)) {
$this->config['columns_data']['first_name'] = TRUE;
$this->config['columns_data']['last_name'] = TRUE;
}
//Get user data for joining.
$ulf = TTnew('UserListFactory');
$ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
Debug::Text(' User Total Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
foreach ($ulf as $key => $u_obj) {
$this->tmp_data['user'][$u_obj->getId()] = $this->form_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Add OPEN user to the list so it can printed on schedules.
$this->tmp_data['user'][0] = $this->form_data['user'][0] = array('first_name' => TTi18n::getText('OPEN'), 'last_name' => '');
//Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
return TRUE;
}