本文整理匯總了PHP中Misc::calculateMultipleColumns方法的典型用法代碼示例。如果您正苦於以下問題:PHP Misc::calculateMultipleColumns方法的具體用法?PHP Misc::calculateMultipleColumns怎麽用?PHP Misc::calculateMultipleColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Misc
的用法示例。
在下文中一共展示了Misc::calculateMultipleColumns方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: TTnew
}
//Debug::Arr($tax_deductions, 'Tax Deductions: ', __FILE__, __LINE__, __METHOD__,10);
}
if (isset($raw_rows)) {
$ulf = TTnew('UserListFactory');
$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]['ssn'] = $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 );
$tmp_rows[$x][$column_key] = Misc::MoneyFormat(Misc::calculateMultipleColumns($raw_rows[$user_id], $ps_entry_map[0], $ps_entry_map[1]), FALSE);
}
//Handle state/district data here
//FIXME: Loop through each raw_row pay stub account IDs, and match them to tax deductions
//that way if a user is removed from a tax deduction half way through the year it will
//still match up, assuming it isn't deleted.
//If an employee has worked in more than 2 states or localities, issue multiple W2's.
//**Need to make sure we split up the earnings proper between states/localities when the employees switch between them.
// Adam from DiscipleM??? requested this feature.
if (isset($tax_deductions)) {
foreach ($tax_deductions as $tax_deduction_arr) {
if (isset($tax_deduction_arr['user_ids']) and is_array($tax_deduction_arr['user_ids']) and in_array($user_id, $tax_deduction_arr['user_ids'])) {
//Debug::Arr($tax_deduction_arr, 'Tax / Deduction Data: ', __FILE__, __LINE__, __METHOD__,10);
Debug::Text('Found User ID: ' . $user_id . ' in Tax Deduction ID: ' . $tax_deduction_arr['id'] . ' Pay Stub Entry Account ID: ' . $tax_deduction_arr['pay_stub_entry_account_id'], __FILE__, __LINE__, __METHOD__, 10);
//if ( $tax_deduction_arr['province'] != '' AND $tax_deduction_arr['district'] == '' AND $tax_deduction_arr['user_value5'] == '' ) {
if ($tax_deduction_arr['calculation_id'] == 200 and $tax_deduction_arr['province'] != '') {
示例2: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('pay_stub_entry' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
$pself = TTnew('PayStubEntryListFactory');
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
//$date_stamp = TTDate::strtotime( $pse_obj->getColumn('pay_stub_transaction_date') );
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id])) {
$this->tmp_data['pay_stub_entry'][$user_id] = array('date_stamp' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_b) {
$this->tmp_data['pay_stub_entry'][$user_id]['income'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['income']['include_pay_stub_entry_account'], $form_data['income']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['tax'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['tax']['include_pay_stub_entry_account'], $form_data['tax']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['employee_cpp'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['employee_cpp']['include_pay_stub_entry_account'], $form_data['employee_cpp']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['employer_cpp'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['employer_cpp']['include_pay_stub_entry_account'], $form_data['employer_cpp']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['employee_ei'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['employee_ei']['include_pay_stub_entry_account'], $form_data['employee_ei']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['employer_ei'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['employer_ei']['include_pay_stub_entry_account'], $form_data['employer_ei']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['ei_earnings'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['ei_earnings']['include_pay_stub_entry_account'], $form_data['ei_earnings']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['cpp_earnings'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['cpp_earnings']['include_pay_stub_entry_account'], $form_data['cpp_earnings']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['union_dues'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['union_dues']['include_pay_stub_entry_account'], $form_data['union_dues']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['rpp'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['rpp']['include_pay_stub_entry_account'], $form_data['rpp']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['charity'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['charity']['include_pay_stub_entry_account'], $form_data['charity']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['pension_adjustment'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['pension_adjustment']['include_pay_stub_entry_account'], $form_data['pension_adjustment']['exclude_pay_stub_entry_account']);
for ($n = 0; $n <= 5; $n++) {
$this->tmp_data['pay_stub_entry'][$user_id]['other_box_' . $n] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['other_box'][$n]['include_pay_stub_entry_account'], $form_data['other_box'][$n]['exclude_pay_stub_entry_account']);
}
}
}
}
$this->user_ids = array_unique($this->user_ids);
//Used to get the total number of employees.
//Debug::Arr($this->user_ids, 'User IDs: ', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($this->form_data, 'Form Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($this->tmp_data, 'Tmp Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
//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()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
return TRUE;
}
示例3: bcmul
if (isset($ps_entries)) {
$pp_lines_arr[$month_id][$pay_period_id]['2'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['2'][0], $column_ps_entry_name_map['2'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['3'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['3'][0], $column_ps_entry_name_map['3'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['5a'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['5a'][0], $column_ps_entry_name_map['5a'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['5a2'] = bcmul($pp_lines_arr[$month_id][$pay_period_id]['5a'], $f941->social_security_rate);
$pp_lines_arr[$month_id][$pay_period_id]['5b'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['5b'][0], $column_ps_entry_name_map['5b'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['5b2'] = bcmul($pp_lines_arr[$month_id][$pay_period_id]['5b'], $f941->social_security_rate);
$pp_lines_arr[$month_id][$pay_period_id]['5c'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['5c'][0], $column_ps_entry_name_map['5c'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['5c2'] = bcmul($pp_lines_arr[$month_id][$pay_period_id]['5c'], $f941->medicare_rate);
$pp_lines_arr[$month_id][$pay_period_id]['5d'] = bcadd(bcadd($pp_lines_arr[$month_id][$pay_period_id]['5a2'], $pp_lines_arr[$month_id][$pay_period_id]['5b2']), $pp_lines_arr[$month_id][$pay_period_id]['5c2']);
$pp_lines_arr[$month_id][$pay_period_id]['6e'] = bcadd($pp_lines_arr[$month_id][$pay_period_id]['3'], $pp_lines_arr[$month_id][$pay_period_id]['5d']);
$pp_lines_arr[$month_id][$pay_period_id]['7'] = bcsub(Misc::MoneyFormat($pp_lines_arr[$month_id][$pay_period_id]['5d'], FALSE), bcadd(bcadd($pp_lines_arr[$month_id][$pay_period_id]['5a2'], $pp_lines_arr[$month_id][$pay_period_id]['5b2']), $pp_lines_arr[$month_id][$pay_period_id]['5c2']));
//Was 7b
$pp_lines_arr[$month_id][$pay_period_id]['8'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['8'][0], $column_ps_entry_name_map['8'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['9'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['9'][0], $column_ps_entry_name_map['9'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['12a'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['12a'][0], $column_ps_entry_name_map['12a'][1]);
$pp_lines_arr[$month_id][$pay_period_id]['10'] = bcadd(bcadd(bcadd($pp_lines_arr[$month_id][$pay_period_id]['6e'], $pp_lines_arr[$month_id][$pay_period_id]['7']), $pp_lines_arr[$month_id][$pay_period_id]['8']), $pp_lines_arr[$month_id][$pay_period_id]['9']);
}
unset($ps_entries);
}
//Total all pay periods by month_id
if (isset($pp_lines_arr)) {
foreach ($pp_lines_arr as $month_id => $pp_data) {
$lines_arr[$month_id] = Misc::ArrayAssocSum($pp_data, NULL, 8);
}
}
}
unset($pay_period_ids, $ps_entries);
}
if (isset($lines_arr)) {
$lines_arr['total'] = Misc::ArrayAssocSum($lines_arr, NULL, 6);
示例4: bcadd
$user_quarter_ps_entries[$quarter_id][$user_id][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
if (isset($user_total_ps_entries[$user_id][$pay_stub_entry_name_id])) {
$user_total_ps_entries[$user_id][$pay_stub_entry_name_id] = bcadd($user_total_ps_entries[$user_id][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'), 2);
} else {
$user_total_ps_entries[$user_id][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
$lines_arr[$quarter_id]['p2_3'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['p2_3'][0], $column_ps_entry_name_map['p2_3'][1]);
$lines_arr[$quarter_id]['p2_4'] = Misc::calculateMultipleColumns($ps_entries, $column_ps_entry_name_map['p2_4'][0], $column_ps_entry_name_map['p2_4'][1]);
$lines_arr[$quarter_id]['p2_5'] = 0;
//Get over cutoff amounts for each user.
$i = 0;
foreach ($user_quarter_ps_entries[$quarter_id] as $user_id => $user_quarter_ps_entry_arr) {
$user_quarter_lines_arr[$user_id]['p2_3'] = Misc::calculateMultipleColumns($user_quarter_ps_entry_arr, $column_ps_entry_name_map['p2_3'][0], $column_ps_entry_name_map['p2_3'][1]);
$user_quarter_lines_arr[$user_id]['p2_4'] = Misc::calculateMultipleColumns($user_quarter_ps_entry_arr, $column_ps_entry_name_map['p2_4'][0], $column_ps_entry_name_map['p2_4'][1]);
$tmp_quarter_user_payment = $user_quarter_lines_arr[$user_id]['p2_3'] - $user_quarter_lines_arr[$user_id]['p2_4'];
if (!isset($user_total_lines_arr[$user_id]['p2_3'])) {
$user_total_lines_arr[$user_id]['p2_3'] = 0;
}
if (!isset($user_total_lines_arr[$user_id]['p2_4'])) {
$user_total_lines_arr[$user_id]['p2_4'] = 0;
}
if (!isset($user_total_lines_arr[$user_id]['p2_5'])) {
$user_total_lines_arr[$user_id]['p2_5'] = 0;
}
if (!isset($user_total_lines_arr[$user_id]['total_payment'])) {
$user_total_lines_arr[$user_id]['total_payment'] = 0;
}
$user_total_lines_arr[$user_id]['p2_3'] += $user_quarter_lines_arr[$user_id]['p2_3'];
$user_total_lines_arr[$user_id]['p2_4'] += $user_quarter_lines_arr[$user_id]['p2_4'];
示例5: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('pay_stub_entry' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
//
//Figure out state/locality wages/taxes.
//
$cdlf = TTnew('CompanyDeductionListFactory');
$cdlf->getByCompanyIdAndStatusIdAndTypeId($this->getUserObject()->getCompany(), $rcclf->getOptions('display_column_type_ids'), 10);
if ($cdlf->getRecordCount() > 0) {
foreach ($cdlf as $cd_obj) {
$tax_deductions[$cd_obj->getId()] = array('id' => $cd_obj->getId(), 'name' => $cd_obj->getName(), 'calculation_id' => $cd_obj->getCalculation(), 'province' => $cd_obj->getProvince(), 'district' => $cd_obj->getDistrictName(), 'pay_stub_entry_account_id' => $cd_obj->getPayStubEntryAccount(), 'include' => $cd_obj->getIncludePayStubEntryAccount(), 'exclude' => $cd_obj->getExcludePayStubEntryAccount(), 'user_ids' => $cd_obj->getUser(), 'company_value1' => $cd_obj->getCompanyValue1(), 'user_value1' => $cd_obj->getUserValue1(), 'user_value5' => $cd_obj->getUserValue5());
$tax_deduction_pay_stub_account_id_map[$cd_obj->getPayStubEntryAccount()][] = $cd_obj->getId();
}
Debug::Arr($tax_deductions, 'Tax Deductions: ', __FILE__, __LINE__, __METHOD__, 10);
}
$pself = TTnew('PayStubEntryListFactory');
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
//$date_stamp = TTDate::strtotime( $pse_obj->getColumn('pay_stub_transaction_date') );
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id])) {
$this->tmp_data['pay_stub_entry'][$user_id] = array('date_stamp' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_b) {
$this->tmp_data['pay_stub_entry'][$user_id]['l1'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l1']['include_pay_stub_entry_account'], $form_data['l1']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l2'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l2']['include_pay_stub_entry_account'], $form_data['l2']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l3'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l3']['include_pay_stub_entry_account'], $form_data['l3']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l4'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l4']['include_pay_stub_entry_account'], $form_data['l4']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l5'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l5']['include_pay_stub_entry_account'], $form_data['l5']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l6'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l6']['include_pay_stub_entry_account'], $form_data['l6']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l7'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l7']['include_pay_stub_entry_account'], $form_data['l7']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l8'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l8']['include_pay_stub_entry_account'], $form_data['l8']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l10'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l10']['include_pay_stub_entry_account'], $form_data['l10']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l11'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l11']['include_pay_stub_entry_account'], $form_data['l11']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l12a'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l12a']['include_pay_stub_entry_account'], $form_data['l12a']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l12b'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l12b']['include_pay_stub_entry_account'], $form_data['l12b']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l12c'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l12c']['include_pay_stub_entry_account'], $form_data['l12c']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l12d'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l12d']['include_pay_stub_entry_account'], $form_data['l12d']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l14a'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l14a']['include_pay_stub_entry_account'], $form_data['l14a']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l14b'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l14b']['include_pay_stub_entry_account'], $form_data['l14b']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l14c'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l14c']['include_pay_stub_entry_account'], $form_data['l14c']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id]['l14d'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['l14d']['include_pay_stub_entry_account'], $form_data['l14d']['exclude_pay_stub_entry_account']);
if (is_array($data_b['psen_ids'])) {
foreach ($data_b['psen_ids'] as $psen_id => $psen_amount) {
if (isset($tax_deduction_pay_stub_account_id_map[$psen_id])) {
//$tax_deduction_arr = $tax_deductions[$tax_deduction_pay_stub_account_id_map[$psen_id]];
//Support multiple tax/deductions that deposit to the same pay stub account.
foreach ($tax_deduction_pay_stub_account_id_map[$psen_id] as $tax_deduction_id) {
$tax_deduction_arr = $tax_deductions[$tax_deduction_id];
//determine how many district/states currently exist for this employee.
foreach (range('a', 'z') as $z) {
if (!isset($this->tmp_data['pay_stub_entry'][$user_id]['l16' . $z])) {
$state_id = $z;
break;
}
}
foreach (range('a', 'z') as $z) {
if (!isset($this->tmp_data['pay_stub_entry'][$user_id]['l18' . $z])) {
$district_id = $z;
break;
}
}
//Found Tax/Deduction associated with this pay stub account.
Debug::Text('Found User ID: ' . $user_id . ' in Tax Deduction Name: ' . $tax_deduction_arr['name'] . '(' . $tax_deduction_arr['id'] . ') Pay Stub Entry Account ID: ' . $psen_id . ' Calculation ID: ' . $tax_deduction_arr['calculation_id'], __FILE__, __LINE__, __METHOD__, 10);
if ($tax_deduction_arr['calculation_id'] == 200 and $tax_deduction_arr['province'] != '') {
//State Wages/Taxes
$this->tmp_data['pay_stub_entry'][$user_id]['l15' . $state_id . '_state'] = $tax_deduction_arr['province'];
$this->tmp_data['pay_stub_entry'][$user_id]['l16' . $state_id] = Misc::calculateMultipleColumns($data_b['psen_ids'], $tax_deduction_arr['include'], $tax_deduction_arr['exclude']);
$this->tmp_data['pay_stub_entry'][$user_id]['l17' . $state_id] = Misc::calculateMultipleColumns($data_b['psen_ids'], array($tax_deduction_arr['pay_stub_entry_account_id']));
} 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'] != '') {
$this->tmp_data['pay_stub_entry'][$user_id]['l20' . $district_id] = $tax_deduction_arr['company_value1'];
} else {
$this->tmp_data['pay_stub_entry'][$user_id]['l20' . $district_id] = $tax_deduction_arr['district'];
}
$this->tmp_data['pay_stub_entry'][$user_id]['l18' . $district_id] = Misc::calculateMultipleColumns($data_b['psen_ids'], $tax_deduction_arr['include'], $tax_deduction_arr['exclude']);
$this->tmp_data['pay_stub_entry'][$user_id]['l19' . $district_id] = Misc::calculateMultipleColumns($data_b['psen_ids'], array($tax_deduction_arr['pay_stub_entry_account_id']));
} 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);
}
unset($tax_deduction_arr);
}
}
}
unset($psen_id, $psen_amount, $state_id, $district_id);
//.........這裏部分代碼省略.........
示例6: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('pay_stub_entry' => array(), 'user_total' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
$setup_data = $this->getFormConfig();
$pself = TTnew('PayStubEntryListFactory');
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, NULL, NULL, NULL, array('user_id' => 'asc', 'pay_stub_transaction_date' => 'asc'));
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
$date_stamp = $this->date_stamps[] = TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date'));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
$payments_over_cutoff = $this->getF940Object()->payment_cutoff_amount;
//Need to get this from the government form.
$before_adjustment_tax_rate = $this->getF940Object()->futa_tax_before_adjustment_rate;
$tax_rate = $this->getF940Object()->futa_tax_rate;
if ($setup_data['line_10'] > 0) {
//Because they had to fill out a separate worksheet which we don't deal with,just average the excluded wages over each loop iteration.
$excluded_wage_divisor = 0;
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
$excluded_wage_divisor++;
}
}
$excluded_wage_avg = bcdiv($setup_data['line_10'], $excluded_wage_divisor);
Debug::Text(' Excluded Wage Avg: ' . $excluded_wage_avg . ' Divisor: ' . $excluded_wage_divisor, __FILE__, __LINE__, __METHOD__, 10);
unset($user_id, $data_a, $data_b, $date_stamp);
}
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
$quarter_month = TTDate::getYearQuarterMonth($date_stamp);
//Debug::Text(' Quarter Month: '. $quarter_month .' Date: '. TTDate::getDate('DATE+TIME', $date_stamp ), __FILE__, __LINE__, __METHOD__,10);
if (!isset($this->tmp_data['user_total'][$user_id])) {
$this->tmp_data['user_total'][$user_id]['net_payments'] = 0;
$this->tmp_data['user_total'][$user_id]['excess_payments'] = 0;
}
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total_payments'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['total_payments']['include_pay_stub_entry_account'], $form_data['total_payments']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['exempt_payments'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['exempt_payments']['include_pay_stub_entry_account'], $form_data['exempt_payments']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['net_payments'] = bcsub($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total_payments'], $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['exempt_payments']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'] = $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax'] = 0;
//Need to total up payments for each employee so we know when we exceed the limit.
$this->tmp_data['user_total'][$user_id]['net_payments'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['net_payments'];
if ($this->tmp_data['user_total'][$user_id]['excess_payments'] == 0) {
if ($this->tmp_data['user_total'][$user_id]['net_payments'] > $payments_over_cutoff) {
Debug::Text(' First time over cutoff for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'] = $this->tmp_data['user_total'][$user_id]['net_payments'] - $payments_over_cutoff;
$this->tmp_data['user_total'][$user_id]['excess_payments'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'];
}
} else {
Debug::Text(' Next time over cutoff for User: ' . $user_id . ' Date Stamp: ' . $date_stamp, __FILE__, __LINE__, __METHOD__, 10);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'], $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['net_payments']);
}
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['taxable_wages'] = bcsub($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total_payments'], bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['exempt_payments'], $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments']));
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['before_adjustment_tax'] = bcmul($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['taxable_wages'], $before_adjustment_tax_rate);
if ($setup_data['line_10'] > 0) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax'] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax'], $excluded_wage_avg);
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax'] = bcmul($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['taxable_wages'], $tax_rate);
}
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['after_adjustment_tax'] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['before_adjustment_tax'], $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax']);
//Separate data used for reporting, grouping, sorting, from data specific used for the Form.
if (!isset($this->form_data['pay_period'][$quarter_month][$date_stamp])) {
$this->form_data['pay_period'][$quarter_month][$date_stamp] = Misc::preSetArrayValues(array(), array('total_payments', 'exempt_payments', 'excess_payments', 'taxable_wages', 'before_adjustment_tax', 'adjustment_tax', 'after_adjustment_tax'), 0);
}
$this->form_data['pay_period'][$quarter_month][$date_stamp]['total_payments'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total_payments'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['exempt_payments'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['exempt_payments'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['excess_payments'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['excess_payments'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['taxable_wages'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['taxable_wages'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['before_adjustment_tax'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['before_adjustment_tax'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['adjustment_tax'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['adjustment_tax'];
$this->form_data['pay_period'][$quarter_month][$date_stamp]['after_adjustment_tax'] += $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['after_adjustment_tax'];
}
}
//Total all pay periods by quarter
if (isset($this->form_data['pay_period'])) {
foreach ($this->form_data['pay_period'] as $month_id => $pp_data) {
$this->form_data['quarter'][$month_id] = Misc::ArrayAssocSum($pp_data, NULL, 8);
}
//Total all quarters.
if (isset($this->form_data['quarter'])) {
$this->form_data['total'] = Misc::ArrayAssocSum($this->form_data['quarter'], NULL, 6);
}
}
}
}
$this->user_ids = array_unique($this->user_ids);
//.........這裏部分代碼省略.........
示例7: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('user' => array(), 'pay_stub_entry' => array(), 'pay_period' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
$pseallf = TTnew('PayStubEntryAccountLinkListFactory');
$pseallf->getByCompanyId($this->getUserObject()->getCompany());
if ($pseallf->getRecordCount() > 0) {
$pseal_obj = $pseallf->getCurrent();
}
$pself = TTnew('PayStubEntryListFactory');
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
$date_stamp = TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date'));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => TTDate::getMiddleDayEpoch(strtotime($pse_obj->getColumn('pay_stub_transaction_date'))), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
$this->form_data['pay_period'][] = strtotime($pse_obj->getColumn('pay_stub_transaction_date'));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['ei_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['ei']['include_pay_stub_entry_account'], $form_data['ei']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['cpp_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['cpp']['include_pay_stub_entry_account'], $form_data['cpp']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['tax_total'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['tax']['include_pay_stub_entry_account'], $form_data['tax']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['total'] = $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['ei_total'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['cpp_total'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['tax_total'];
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['gross_payroll'] = Misc::calculateMultipleColumns($data_b['psen_ids'], (array) $pseal_obj->getTotalGross(), array());
}
}
}
}
$this->user_ids = array_unique($this->user_ids);
//Used to get the total number of employees.
//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()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
return TRUE;
}
示例8: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('pay_stub_entry' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
$form_data = $this->formatFormConfig();
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$pd_obj = new PayrollDeduction('US', 'WA');
//State doesn't matter.
$pd_obj->setDate($filter_data['end_date']);
$social_security_wage_limit = $pd_obj->getSocialSecurityMaximumEarnings();
$medicare_additional_threshold_limit = $pd_obj->getMedicareAdditionalEmployerThreshold();
Debug::Text('Social Security Wage Limit: ' . $social_security_wage_limit . ' Medicare Threshold: ' . $medicare_additional_threshold_limit . ' Date: ' . TTDate::getDate('DATE', $filter_data['end_date']), __FILE__, __LINE__, __METHOD__, 10);
//Need to get totals up to the beginning of this quarter so we can determine if any employees have exceeded the social security limit.
$pself = TTnew('PayStubEntryListFactory');
$ytd_filter_data = $filter_data;
$ytd_filter_data['end_date'] = $ytd_filter_data['start_date'] - 1;
$ytd_filter_data['start_date'] = TTDate::getBeginYearEpoch($ytd_filter_data['start_date']);
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $ytd_filter_data);
//Debug::Arr($ytd_filter_data, 'YTD Filter Data: Row Count: '. $pself->getRecordCount(), __FILE__, __LINE__, __METHOD__,10);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $pse_obj->getColumn('user_id');
//Make sure we don't add this to the unique user_id list.
//Always use middle day epoch, otherwise multiple entries could exist for the same day.
$date_stamp = TTDate::getMiddleDayEpoch(TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = 0;
}
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
//Include tips in this amount as well.
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_tips']['include_pay_stub_entry_account'], $form_data['social_security_tips']['exclude_pay_stub_entry_account']);
//Handle additional medicare wages in excess of 200,000
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'] = 0;
}
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['medicare_wages'] += Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['medicare_wages']['include_pay_stub_entry_account'], $form_data['medicare_wages']['exclude_pay_stub_entry_account']);
}
}
}
//Debug::Arr($this->tmp_data['ytd_pay_stub_entry'], 'YTD Tmp Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
}
unset($pse_obj, $user_id, $date_stamp, $branch, $department, $pay_stub_entry_name_id, $this->tmp_data['pay_stub_entry']);
//Get just the data for the quarter now.
$pself->getAPIReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
if ($pself->getRecordCount() > 0) {
foreach ($pself as $pse_obj) {
$user_id = $this->user_ids[] = $pse_obj->getColumn('user_id');
//Always use middle day epoch, otherwise multiple entries could exist for the same day.
$date_stamp = TTDate::getMiddleDayEpoch(TTDate::strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
$branch = $pse_obj->getColumn('default_branch');
$department = $pse_obj->getColumn('default_department');
$pay_stub_entry_name_id = $pse_obj->getPayStubEntryNameId();
if (!isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp] = array('pay_period_start_date' => strtotime($pse_obj->getColumn('pay_stub_start_date')), 'pay_period_end_date' => strtotime($pse_obj->getColumn('pay_stub_end_date')), 'pay_period_transaction_date' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')), 'pay_period' => strtotime($pse_obj->getColumn('pay_stub_transaction_date')));
}
if (isset($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id])) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = bcadd($this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id], $pse_obj->getColumn('amount'));
} else {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['psen_ids'][$pay_stub_entry_name_id] = $pse_obj->getColumn('amount');
}
}
if (isset($this->tmp_data['pay_stub_entry']) and is_array($this->tmp_data['pay_stub_entry'])) {
foreach ($this->tmp_data['pay_stub_entry'] as $user_id => $data_a) {
foreach ($data_a as $date_stamp => $data_b) {
$quarter_month = TTDate::getYearQuarterMonthNumber($date_stamp);
//Debug::Text('Quarter Month: '. $quarter_month .' Epoch: '. TTDate::getDate('DATE', $date_stamp), __FILE__, __LINE__, __METHOD__,10);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['wages']['include_pay_stub_entry_account'], $form_data['wages']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['income_tax'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['income_tax']['include_pay_stub_entry_account'], $form_data['income_tax']['exclude_pay_stub_entry_account']);
//FIXME: If employees are excluded from Social Security, it will still include total wages
//resulting in the 941 form being incorrect in its calculation.
//Add Form Setup tab field to select the Social Security tax/deductions?
//However there can often be two of them, is just the employee one enough? We could use the employees and include/exclude accounts from that at least then.
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
//Handle social security wage limit.
if (!isset($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'])) {
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = 0;
}
if ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] < $social_security_wage_limit) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_wages']['include_pay_stub_entry_account'], $form_data['social_security_wages']['exclude_pay_stub_entry_account']);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] = Misc::calculateMultipleColumns($data_b['psen_ids'], $form_data['social_security_tips']['include_pay_stub_entry_account'], $form_data['social_security_tips']['exclude_pay_stub_entry_account']);
if ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] > $social_security_wage_limit) {
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] = $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] - ($this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_wages'] + $this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] - $social_security_wage_limit);
$this->tmp_data['pay_stub_entry'][$user_id][$date_stamp]['social_security_tips'] = 0;
$this->tmp_data['ytd_pay_stub_entry'][$user_id]['social_security_wages'] = $social_security_wage_limit;
//.........這裏部分代碼省略.........
示例9: array
if (in_array($user_id, $tax_deduction_arr['user_ids'])) {
Debug::Text('Found user in Tax Deduction ID: ' . $tax_deduction_arr['id'] . ' Pay Stub Entry Account ID: ' . $tax_deduction_arr['pay_stub_entry_account_id'], __FILE__, __LINE__, __METHOD__, 10);
if ($tax_deduction_arr['province'] != '' and $tax_deduction_arr['district'] == '') {
//State Wages/Taxes
//Handle two states here, just check if $tmp_rows[$x]['state_1'] isset,
//if it is, move on to state 2.
$lines_arr['state'][] = array('state' => $tax_deduction_arr['province'], 'wage' => Misc::MoneyFormat(Misc::sumMultipleColumns($raw_row, $tax_deduction_arr['include']), FALSE), 'tax' => Misc::MoneyFormat(Misc::sumMultipleColumns($raw_row, array($tax_deduction_arr['pay_stub_entry_account_id'])), FALSE));
}
} else {
Debug::Text('DID NOT Find user in Tax Deduction ID: ' . $tax_deduction_arr['id'], __FILE__, __LINE__, __METHOD__, 10);
}
}
}
$lines_arr['4'] = Misc::calculateMultipleColumns($raw_row, $column_ps_entry_name_map['4'][0], $column_ps_entry_name_map['4'][1]);
$lines_arr['6'] = Misc::calculateMultipleColumns($raw_row, $column_ps_entry_name_map['6'][0], $column_ps_entry_name_map['6'][1]);
$lines_arr['7'] = Misc::calculateMultipleColumns($raw_row, $column_ps_entry_name_map['7'][0], $column_ps_entry_name_map['7'][1]);
//print_r($lines_arr);
$pdf->setMargins(0, 0, 0, 0);
$pdf->SetAutoPageBreak(FALSE);
$pdf->SetFont('freeserif', '', 10);
$pages = array(1, 2, 4, 5);
foreach ($pages as $page) {
$pdf->AddPage();
if (isset($tplidx[$page])) {
$pdf->useTemplate($tplidx[$page], 0, 0);
}
if ($show_background == TRUE) {
$pdf->SetFont('freeserif', 'B', 24);
$pdf->setFillColor(255, 255, 255);
if ($page == 1) {
$pdf->setXY(Misc::AdjustXY(152, $adjust_x), Misc::AdjustXY(28, $adjust_y));