本文整理汇总了PHP中TTDate::setTimeZone方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::setTimeZone方法的具体用法?PHP TTDate::setTimeZone怎么用?PHP TTDate::setTimeZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::setTimeZone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
global $db, $cache;
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$this->company_id = PRIMARY_COMPANY_ID;
TTDate::setTimeZone('PST');
}
示例2: __construct
public function __construct()
{
global $db, $cache;
$this->tax_table_file = dirname(__FILE__) . '/CAPayrollDeductionTest2009.csv';
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
TTDate::setTimeZone('PST');
}
示例3: setUp
public function setUp()
{
Debug::text('Running setUp(): ', __FILE__, __LINE__, __METHOD__, 10);
TTDate::setTimeZone('PST8PDT');
//$this->deleteAllSchedules();
return TRUE;
}
示例4: getTimeOffset
function getTimeOffset($client_epoch)
{
TTDate::setTimeZone('GMT');
$server_epoch = TTDate::getTime();
$offset = $client_epoch - $server_epoch;
Debug::Text('Client Time: ' . TTDate::getDate('DATE+TIME', $client_epoch) . ' Server Time: ' . TTDate::getDate('DATE+TIME', $server_epoch) . ' Offset: ' . $offset, __FILE__, __LINE__, __METHOD__, 10);
if ($offset == 0) {
$offset = 1;
}
return (int) $offset;
}
示例5: __construct
public function __construct()
{
global $db, $cache;
require_once '../includes/global.inc.php';
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$profiler = new Profiler(true);
Debug::setBufferOutput(FALSE);
Debug::setEnable(TRUE);
TTDate::setTimeZone('PST');
if (PRODUCTION != FALSE) {
echo "DO NOT RUN ON A PRODUCTION SERVER<br>\n";
exit;
}
}
示例6: setUp
public function setUp()
{
Debug::text('Running setUp(): ', __FILE__, __LINE__, __METHOD__, 10);
TTDate::setTimeZone('PST8PDT');
TTDate::setTimeUnitFormat(10);
//HH:MM
$dd = new DemoData();
$dd->setEnableQuickPunch(FALSE);
//Helps prevent duplicate punch IDs and validation failures.
$dd->setUserNamePostFix('_' . uniqid(NULL, TRUE));
//Needs to be super random to prevent conflicts and random failing tests.
$this->company_id = $dd->createCompany();
Debug::text('Company ID: ' . $this->company_id, __FILE__, __LINE__, __METHOD__, 10);
$this->assertGreaterThan(0, $this->company_id);
//$dd->createPermissionGroups( $this->company_id, 40 ); //Administrator only.
return TRUE;
}
示例7: setUp
public function setUp()
{
global $dd;
Debug::text('Running setUp(): ', __FILE__, __LINE__, __METHOD__, 10);
TTDate::setTimeZone('PST8PDT');
$dd = new DemoData();
$dd->setEnableQuickPunch(FALSE);
//Helps prevent duplicate punch IDs and validation failures.
$dd->setUserNamePostFix('_' . uniqid(NULL, TRUE));
//Needs to be super random to prevent conflicts and random failing tests.
$this->company_id = $dd->createCompany();
Debug::text('Company ID: ' . $this->company_id, __FILE__, __LINE__, __METHOD__, 10);
$dd->createCurrency($this->company_id, 10);
//$dd->createPermissionGroups( $this->company_id, 40 ); //Administrator only.
$dd->createPayStubAccount($this->company_id);
$this->createPayStubAccounts();
$this->createPayStubAccrualAccount();
$dd->createPayStubAccountLink($this->company_id);
$this->getPayStubAccountLinkArray();
//Company Deductions
$dd->createCompanyDeduction($this->company_id);
$this->createCompanyDeductions();
$dd->createUserWageGroups($this->company_id);
$this->user_id = $dd->createUser($this->company_id, 100);
$this->createPayPeriodSchedule();
$this->createPayPeriods();
$this->getAllPayPeriods();
//Create policies
$policy_ids['overtime'][] = $dd->createOverTimePolicy($this->company_id, 10);
//$policy_ids['overtime'][] = $dd->createOverTimePolicy( $this->company_id, 20, $policy_ids['accrual'][0] );
$policy_ids['overtime'][] = $dd->createOverTimePolicy($this->company_id, 20);
$policy_ids['premium'][] = $dd->createPremiumPolicy($this->company_id, 10);
$policy_ids['premium'][] = $dd->createPremiumPolicy($this->company_id, 20);
//Create Policy Group
$dd->createPolicyGroup($this->company_id, NULL, NULL, NULL, $policy_ids['overtime'], $policy_ids['premium'], NULL, array($this->user_id));
$this->createPunchData();
$this->addPayStubAmendments();
$this->createPayStub();
$this->assertGreaterThan(0, $this->company_id);
$this->assertGreaterThan(0, $this->user_id);
return TRUE;
}
示例8:
//Because if its a Monday, it will also recalculate the rest of the days in the week.
//Shouldn't be a big deal though.
//This isn't needed, since we now do it in AddRecurringScheduleShift, so dock time is
//applied at the beginning of the day.
//The problem is that AddRecurringScheduleShift does it, then for the entire day someone with
//a dock policy shows up as dock time. Some users have complained about this a few times.
//Reason for doing two days ago is that if someone starts a shift at 11pm, but doesn't end it in
//time, it still needs to be re-calculated a day later.
//Could maybe get around this by getting all punches of yesterday, and getting their date_ids
//and just recalculating those.
//Enable pre-mature exceptions if we're recalculating just one day ago.
//Problem is a late shift on say Monday: 2:00PM to 11:00PM won't trigger the exception at 1AM the next day,
//but by 1AM the following day (2days later) its too late and emails are disabled if enable_premature_exceptions are disabled.
$enable_premature_exceptions = FALSE;
//if ( $end_date == TTDate::getMiddleDayEpoch( $ud_obj->getDateStamp() ) ) {
if (TTDate::getMiddleDayEpoch($ud_obj->getDateStamp()) >= TTDate::getMiddleDayEpoch($execution_time) - 86400 * 2) {
$enable_premature_exceptions = TRUE;
}
Debug::text($x . '(' . $i . '). User: ' . $ud_obj->getUser() . ' Date: ' . TTDate::getDate('DATE+TIME', $ud_obj->getDateStamp()) . ' User Date ID: ' . $ud_obj->getId() . ' Enable PreMature Exceptions: ' . (int) $enable_premature_exceptions, __FILE__, __LINE__, __METHOD__, 5);
UserDateTotalFactory::reCalculateDay($ud_obj->getId(), TRUE, $enable_premature_exceptions);
TTDate::setTimeZone();
$i++;
$x++;
}
}
Debug::text('Company: ' . $c_obj->getName() . '(' . $c_obj->getId() . ') Finished In: ' . (microtime(TRUE) - $company_start_time) . 's', __FILE__, __LINE__, __METHOD__, 5);
}
}
}
Debug::writeToLog();
Debug::Display();
示例9: generateData
function generateData()
{
global $current_company, $current_user;
TTDate::setTimeZone('PST8PDT');
$current_epoch = time();
$cf = new CompanyFactory();
$cf->StartTransaction();
$company_id = $this->createCompany();
$clf = new CompanyListFactory();
$clf->getById($company_id);
$current_company = $clf->getCurrent();
if ($company_id !== FALSE) {
Debug::Text('Company Created Successfully!', __FILE__, __LINE__, __METHOD__, 10);
$this->createPermissionGroups($company_id);
//Create currency
$currency_ids[] = $this->createCurrency($company_id, 10);
//USD
$currency_ids[] = $this->createCurrency($company_id, 20);
//CAD
//Create branch
$branch_ids[] = $this->createBranch($company_id, 10);
//NY
$branch_ids[] = $this->createBranch($company_id, 20);
//WA
//Create departments
$department_ids[] = $this->createDepartment($company_id, 10);
$department_ids[] = $this->createDepartment($company_id, 20);
//Create stations
$station_id = $this->createStation($company_id);
//Create pay stub accounts.
$this->createPayStubAccount($company_id);
//Link pay stub accounts.
$this->createPayStubAccountLink($company_id);
//Company Deductions
$this->createCompanyDeduction($company_id);
//Wage Groups
$wage_group_ids[] = $this->createUserWageGroups($company_id);
//User Groups
$user_group_ids[] = $this->createUserGroup($company_id, 10, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 20, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 30, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 40, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 50, $user_group_ids[3]);
//Users
$user_ids[] = $this->createUser($company_id, 10, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 11, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 12, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 13, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0]);
$user_ids[] = $this->createUser($company_id, 14, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 15, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 16, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 17, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1]);
$user_ids[] = $this->createUser($company_id, 18, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 19, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 20, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[2]);
$user_ids[] = $this->createUser($company_id, 21, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 22, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 23, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 24, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3]);
$user_ids[] = $this->createUser($company_id, 25, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 26, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 27, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 28, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 29, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 30, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]);
$user_ids[] = $this->createUser($company_id, 40, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4]);
$current_user_id = $user_ids[] = $this->createUser($company_id, 100, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[1]);
//Create random users.
for ($i = 0; $i <= $this->getMaxRandomUsers(); $i++) {
$tmp_user_id = $this->createUser($company_id, 999, 0, $branch_ids[$i % 2], $department_ids[$i % 2], $currency_ids[0], $user_group_ids[$i % 5]);
if ($tmp_user_id != FALSE) {
$user_ids[] = $tmp_user_id;
}
}
Debug::Arr($user_ids, 'All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
$ulf = new UserListFactory();
$ulf->getById($current_user_id);
$current_user = $ulf->getCurrent();
unset($current_user_id);
//Create policies
$policy_ids['round'][] = $this->createRoundingPolicy($company_id, 10);
//In
$policy_ids['round'][] = $this->createRoundingPolicy($company_id, 20);
//Out
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 10);
//Bank Time
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 20);
//Vacaction
$policy_ids['accrual'][] = $this->createAccrualPolicy($company_id, 30);
//Sick
$policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 10);
$policy_ids['overtime'][] = $this->createOverTimePolicy($company_id, 20, $policy_ids['accrual'][0]);
$policy_ids['premium'][] = $this->createPremiumPolicy($company_id, 10);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 10, $policy_ids['accrual'][1]);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 20, $policy_ids['accrual'][0]);
$policy_ids['absence'][] = $this->createAbsencePolicy($company_id, 30, $policy_ids['accrual'][2]);
$policy_ids['meal_1'] = $this->createMealPolicy($company_id);
$policy_ids['schedule_1'] = $this->createSchedulePolicy($company_id, $policy_ids['meal_1']);
$policy_ids['exception_1'] = $this->createExceptionPolicy($company_id);
$hierarchy_user_ids = $user_ids;
//.........这里部分代码省略.........
示例10: runManualCommand
/**
* Run manual commands on timeclocks
* @param string $command command name
* @param array $data station IDs
* @return array
*/
function runManualCommand($command, $data)
{
if (is_numeric($data)) {
$data = array($data);
}
if (!is_array($data)) {
return $this->returnHandler(FALSE);
}
Debug::Text('Time Clock Command: ' . $command, __FILE__, __LINE__, __METHOD__, 10);
Debug::Text('Received data for: ' . count($data) . ' Stations', __FILE__, __LINE__, __METHOD__, 10);
Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10);
$src_rows = $this->stripReturnHandler($this->getStation(array('filter_data' => array('id' => $data)), TRUE));
if (is_array($src_rows) and count($src_rows) > 0) {
Debug::Arr($src_rows, 'SRC Rows: ', __FILE__, __LINE__, __METHOD__, 10);
foreach ($src_rows as $key => $row) {
//Skip any non-timeclock types.
if ($row['type_id'] < 100) {
continue;
}
Debug::Text(' Type: ' . $row['type_id'] . ' Source: ' . $row['source'] . ' Port: ' . $row['port'] . ' Password: ' . $row['password'], __FILE__, __LINE__, __METHOD__, 10);
$tc = new TimeClock($row['type_id']);
$tc->setIPAddress($row['source']);
$tc->setPort($row['port']);
//$tc->setUsername( $row['user_name'] );
$tc->setPassword($row['password']);
$slf = TTnew('StationListFactory');
$slf->getByIdAndCompanyId($row['id'], $this->getCurrentCompanyObject()->getId());
if ($slf->getRecordCount() == 1) {
$s_obj = $slf->getCurrent();
}
$s_obj->setLastPunchTimeStamp($s_obj->getLastPunchTimeStamp());
if ($s_obj->getTimeZone() != '' and !is_numeric($s_obj->getTimeZone())) {
Debug::text('Setting Station TimeZone To: ' . $s_obj->getTimeZone(), __FILE__, __LINE__, __METHOD__, 10);
TTDate::setTimeZone($s_obj->getTimeZone());
}
$result_str = NULL;
switch ($command) {
case 'test_connection':
if ($tc->testConnection() == TRUE) {
$result_str = TTi18n::gettext('Connection Succeeded!');
} else {
$result_str = TTi18n::gettext('Connection Failed!');
}
break;
case 'set_date':
TTDate::setTimeZone($row['time_zone_id'], $s_obj->getTimeZone());
if ($tc->setDate(time()) == TRUE) {
$result_str = TTi18n::gettext('Date Successfully Set To: ') . TTDate::getDate('DATE+TIME', time());
} else {
$result_str = TTi18n::gettext('Setting Date Failed!');
}
break;
case 'download':
if (isset($s_obj) and $tc->Poll($this->getCurrentCompanyObject(), $s_obj) == TRUE) {
$result_str = TTi18n::gettext('Download Data Succeeded!');
if ($s_obj->isValid()) {
$s_obj->Save(FALSE);
}
} else {
$result_str = TTi18n::gettext('Download Data Failed!');
}
break;
case 'upload':
if (isset($s_obj) and $tc->Push($this->getCurrentCompanyObject(), $s_obj) == TRUE) {
$result_str = TTi18n::gettext('Upload Data Succeeded!');
if ($s_obj->isValid()) {
$s_obj->Save(FALSE);
}
} else {
$result_str = TTi18n::gettext('Upload Data Failed!');
}
break;
case 'update_config':
if (isset($s_obj) and $tc->setModeFlag($s_obj->getModeFlag()) == TRUE) {
$result_str = TTi18n::gettext('Update Configuration Succeeded');
} else {
$result_str = TTi18n::gettext('Update Configuration Failed');
}
break;
case 'delete_data':
if (isset($s_obj) and $tc->DeleteAllData($s_obj) == TRUE) {
$result_str = TTi18n::gettext('Delete Data Succeeded!');
if ($s_obj->isValid()) {
$s_obj->Save(FALSE);
}
} else {
$result_str = TTi18n::gettext('Delete Data Failed!');
}
break;
case 'reset_last_punch_time_stamp':
$s_obj->setLastPunchTimeStamp(time());
if ($s_obj->isValid()) {
$s_obj->Save(FALSE);
}
//.........这里部分代码省略.........
示例11: setTimeZonePreferences
function setTimeZonePreferences()
{
return TTDate::setTimeZone($this->getTimeZone());
}
示例12: setPayPeriodTimeZone
function setPayPeriodTimeZone()
{
$this->original_time_zone = TTDate::getTimeZone();
return TTDate::setTimeZone($this->getTimeZone());
}
示例13: count
$help_output .= "\n";
$help_output .= " *NOTICE* Its a good idea to configure Admin -> Company -> New Hire Defaults BEFORE importing employee information.";
$help_output .= "\n";
$help_output .= " Options:\n";
$help_output .= " -u <unique column>\tUpdate already existing users based on unique column, ie: employee_number,user_name,sin,\n";
$help_output .= " -cb \t\t\t\tCreate branch if it doesn't exist\n";
$help_output .= " -cd \t\t\t\tCreate department if it doesn't exist\n";
$help_output .= " -ct \t\t\t\tCreate employee title if it doesn't exist\n";
$help_output .= " -cg \t\t\t\tCreate employee group if it doesn't exist\n";
$help_output .= " -fuzzy \t\t\tUse fuzzy matching when searching for branches,departments,titles and groups\n";
$help_output .= " -n \t\t\t\tDry-run, display the first two lines to confirm mapping is correct\n";
echo $help_output;
} else {
//FIXME: Use Pears Console_GetArgs package to handle these better.
//Set timezone to your system timezone, otherwise dates can be off by the difference.
TTDate::setTimeZone('GMT');
//Handle command line arguments
$last_arg = count($argv) - 1;
if (in_array('-n', $argv)) {
$dry_run = TRUE;
} else {
$dry_run = FALSE;
}
if (in_array('-u', $argv)) {
$update_column = strtolower(trim($argv[array_search('-u', $argv) + 1]));
if (!in_array($update_column, array('employee_number', 'sin', 'user_name'))) {
echo "Invalid Unique Column<br>\n";
exit;
}
} else {
$update_column = FALSE;
示例14: testTimeBasedPartialPremiumPolicyF3
function testTimeBasedPartialPremiumPolicyF3()
{
global $dd;
TTDate::setTimeZone('PST8PDT');
$policy_ids['premium'][] = $this->createPremiumPolicy($this->company_id, 125);
//Create Policy Group
$dd->createPolicyGroup($this->company_id, NULL, NULL, NULL, NULL, $policy_ids['premium'], NULL, array($this->user_id));
$date_epoch = $this->pay_period_objs[0]->getStartDate() + 86400 * 6;
$date_stamp = TTDate::getDate('DATE', $date_epoch);
//Test punching in before the premium start time, and out after the premium end time.
$dd->createPunchPair($this->user_id, strtotime($date_stamp . ' 5:00AM'), strtotime($date_stamp . ' 8:00PM'), array('in_type_id' => 10, 'out_type_id' => 10, 'branch_id' => 0, 'department_id' => 0, 'job_id' => 0, 'job_item_id' => 0), TRUE);
$udt_arr = $this->getUserDateTotalArray($date_epoch, $date_epoch);
//print_r($udt_arr);
//Total Time
$this->assertEquals($udt_arr[$date_epoch][0]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][0]['type_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][0]['total_time'], 15 * 3600);
//Regular Time
$this->assertEquals($udt_arr[$date_epoch][1]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][1]['type_id'], 20);
$this->assertEquals($udt_arr[$date_epoch][1]['total_time'], 15 * 3600);
//Premium Time1
$this->assertEquals($udt_arr[$date_epoch][2]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][2]['type_id'], 40);
$this->assertEquals($udt_arr[$date_epoch][2]['total_time'], 12 * 3600);
//Make sure no other hours
$this->assertEquals(count($udt_arr[$date_epoch]), 3);
$udlf = TTNew('UserDateListFactory');
$udlf->getByID($udt_arr[$date_epoch][0]['user_date_id']);
unset($udt_arr);
$user_date_id = $udlf->getCurrent()->getId();
TTDate::setTimeZone('EST5EDT');
$recalc_result = UserDateTotalFactory::reCalculateDay($user_date_id, TRUE);
TTDate::setTimeZone('PST8PDT');
$date_epoch = $this->pay_period_objs[0]->getStartDate() + 86400 * 6;
$udt_arr = $this->getUserDateTotalArray($date_epoch, $date_epoch);
//print_r($udt_arr);
//Total Time
$this->assertEquals($udt_arr[$date_epoch][0]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][0]['type_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][0]['total_time'], 15 * 3600);
//Regular Time
$this->assertEquals($udt_arr[$date_epoch][1]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][1]['type_id'], 20);
$this->assertEquals($udt_arr[$date_epoch][1]['total_time'], 15 * 3600);
//Premium Time1
$this->assertEquals($udt_arr[$date_epoch][2]['status_id'], 10);
$this->assertEquals($udt_arr[$date_epoch][2]['type_id'], 40);
$this->assertEquals($udt_arr[$date_epoch][2]['total_time'], 12 * 3600);
//Make sure no other hours
$this->assertEquals(count($udt_arr[$date_epoch]), 3);
return TRUE;
}
示例15: generateData
function generateData()
{
global $current_company, $current_user;
TTDate::setTimeZone('PST8PDT');
$current_epoch = time();
$cf = TTnew('CompanyFactory');
$cf->StartTransaction();
$company_id = $this->createCompany();
$clf = TTnew('CompanyListFactory');
$clf->getById($company_id);
$current_company = $clf->getCurrent();
if ($company_id !== FALSE) {
Debug::Text('Company Created Successfully!', __FILE__, __LINE__, __METHOD__, 10);
$this->createPermissionGroups($company_id);
//Create currency
$currency_ids[] = $this->createCurrency($company_id, 10);
//USD
$currency_ids[] = $this->createCurrency($company_id, 20);
//CAD
$currency_ids[] = $this->createCurrency($company_id, 30);
//EUR
//Create branch
$branch_ids[] = $this->createBranch($company_id, 10);
//NY
$branch_ids[] = $this->createBranch($company_id, 20);
//WA
//Create departments
$department_ids[] = $this->createDepartment($company_id, 10);
$department_ids[] = $this->createDepartment($company_id, 20);
$department_ids[] = $this->createDepartment($company_id, 30);
$department_ids[] = $this->createDepartment($company_id, 40);
//Create stations
$station_id = $this->createStation($company_id);
//Create pay stub accounts.
$this->createPayStubAccount($company_id);
//Link pay stub accounts.
$this->createPayStubAccountLink($company_id);
//Company Deductions
$this->createCompanyDeduction($company_id);
//Wage Groups
$wage_group_ids[] = $this->createUserWageGroups($company_id);
//User Groups
$user_group_ids[] = $this->createUserGroup($company_id, 10, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 20, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 30, $user_group_ids[0]);
$user_group_ids[] = $this->createUserGroup($company_id, 40, 0);
$user_group_ids[] = $this->createUserGroup($company_id, 50, $user_group_ids[3]);
//User Title
$user_title_ids[] = $this->createUserTitle($company_id, 10);
$user_title_ids[] = $this->createUserTitle($company_id, 20);
$user_title_ids[] = $this->createUserTitle($company_id, 30);
$user_title_ids[] = $this->createUserTitle($company_id, 40);
$user_title_ids[] = $this->createUserTitle($company_id, 50);
$user_title_ids[] = $this->createUserTitle($company_id, 60);
$user_title_ids[] = $this->createUserTitle($company_id, 70);
$user_title_ids[] = $this->createUserTitle($company_id, 80);
$user_title_ids[] = $this->createUserTitle($company_id, 90);
//Ethnic Group
$ethnic_group_ids[] = $this->createEthnicGroup($company_id, 10);
$ethnic_group_ids[] = $this->createEthnicGroup($company_id, 20);
$ethnic_group_ids[] = $this->createEthnicGroup($company_id, 30);
$ethnic_group_ids[] = $this->createEthnicGroup($company_id, 40);
$ethnic_group_ids[] = $this->createEthnicGroup($company_id, 50);
//Users
$user_ids[] = $this->createUser($company_id, 10, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[0], $user_title_ids[0], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 11, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0], $user_title_ids[0], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 12, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0], $user_title_ids[0], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 13, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[0], $user_title_ids[0], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 14, 0, $branch_ids[0], $department_ids[1], $currency_ids[1], $user_group_ids[1], $user_title_ids[1], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 15, 0, $branch_ids[0], $department_ids[0], $currency_ids[1], $user_group_ids[1], $user_title_ids[1], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 16, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1], $user_title_ids[1], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 17, 0, $branch_ids[0], $department_ids[1], $currency_ids[0], $user_group_ids[1], $user_title_ids[1], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 18, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[2], $user_title_ids[2], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 19, 0, $branch_ids[0], $department_ids[1], $currency_ids[2], $user_group_ids[2], $user_title_ids[2], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 20, 0, $branch_ids[0], $department_ids[1], $currency_ids[2], $user_group_ids[2], $user_title_ids[2], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 21, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3], $user_title_ids[3], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 22, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[3], $user_title_ids[3], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 23, 0, $branch_ids[1], $department_ids[2], $currency_ids[0], $user_group_ids[3], $user_title_ids[3], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 24, 0, $branch_ids[1], $department_ids[2], $currency_ids[0], $user_group_ids[3], $user_title_ids[3], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 25, 0, $branch_ids[1], $department_ids[2], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 26, 0, $branch_ids[1], $department_ids[1], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 27, 0, $branch_ids[1], $department_ids[3], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 28, 0, $branch_ids[1], $department_ids[3], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 29, 0, $branch_ids[1], $department_ids[3], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 30, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$user_ids[] = $this->createUser($company_id, 40, 0, $branch_ids[1], $department_ids[0], $currency_ids[0], $user_group_ids[4], $user_title_ids[4], $ethnic_group_ids);
$current_user_id = $user_ids[] = $this->createUser($company_id, 100, 0, $branch_ids[0], $department_ids[0], $currency_ids[0], $user_group_ids[4], $user_title_ids[0], $ethnic_group_ids);
//Create random users.
for ($i = 0; $i <= $this->getMaxRandomUsers(); $i++) {
$tmp_user_id = $this->createUser($company_id, 999, 0, $branch_ids[$i % 2], $department_ids[$i % 4], $currency_ids[0], $user_group_ids[$i % 5], $user_title_ids[$i % 9], $ethnic_group_ids);
if ($tmp_user_id != FALSE) {
$user_ids[] = $tmp_user_id;
}
}
Debug::Arr($user_ids, 'All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
$ulf = TTnew('UserListFactory');
$ulf->getById($current_user_id);
$current_user = $ulf->getCurrent();
if ($current_user_id === FALSE) {
Debug::Text('Administrator user wasn\'t created! Duplicate username perhaps? Are we appending a random number?', __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........