示例#1
0
 function createBreakPolicy($company_id, $type)
 {
     $bpf = new BreakPolicyFactory();
     $bpf->setCompany($company_id);
     switch ($type) {
         case 100:
             //Normal 15min break
             $bpf->setName('Normal');
             $bpf->setType(20);
             $bpf->setTriggerTime(3600 * 6);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(FALSE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
         case 110:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 1);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(FALSE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
         case 115:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min (Include Punch Time)');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 1);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(TRUE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
         case 120:
             //AutoDeduct 15min
             $bpf->setName('AutoDeduct 15min');
             $bpf->setType(10);
             $bpf->setTriggerTime(3600 * 6);
             $bpf->setAmount(15 * 60);
             $bpf->setIncludeBreakPunchTime(FALSE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
         case 150:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min (Include Both)');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 1);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(TRUE);
             $bpf->setIncludeMultipleBreaks(TRUE);
             break;
         case 152:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min (Include Both) [2]');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 3);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(TRUE);
             $bpf->setIncludeMultipleBreaks(TRUE);
             break;
         case 154:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min (Include Both) [3]');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 5);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(TRUE);
             $bpf->setIncludeMultipleBreaks(TRUE);
             break;
         case 156:
             //AutoAdd 15min
             $bpf->setName('AutoAdd 15min (Include Both) [4]');
             $bpf->setType(15);
             $bpf->setTriggerTime(3600 * 10);
             $bpf->setAmount(60 * 15);
             $bpf->setIncludeBreakPunchTime(TRUE);
             $bpf->setIncludeMultipleBreaks(TRUE);
             break;
     }
     if ($bpf->isValid()) {
         $insert_id = $bpf->Save();
         Debug::Text('Break Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Break Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
示例#2
0
 function createBreakPolicy($company_id, $type)
 {
     $bpf = new BreakPolicyFactory();
     $bpf->setCompany($company_id);
     switch ($type) {
         case 100:
             //Normal 15min break: Detect by Time Window
             $bpf->setName('Normal');
             $bpf->setType(20);
             $bpf->setTriggerTime(3600 * 0.5);
             $bpf->setAmount(60 * 15);
             $bpf->setAutoDetectType(10);
             $bpf->setStartWindow(1 * 3600);
             $bpf->setWindowLength(1 * 3600);
             $bpf->setIncludeBreakPunchTime(FALSE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
         case 110:
             //Normal 15min break: Detect by Punch Time
             $bpf->setName('Normal');
             $bpf->setType(20);
             $bpf->setTriggerTime(3600 * 0.5);
             $bpf->setAmount(60 * 15);
             $bpf->setAutoDetectType(20);
             $bpf->setMinimumPunchTime(60 * 5);
             ///5min
             $bpf->setMaximumPunchTime(60 * 25);
             //25min
             $bpf->setIncludeBreakPunchTime(FALSE);
             $bpf->setIncludeMultipleBreaks(FALSE);
             break;
     }
     if ($bpf->isValid()) {
         $insert_id = $bpf->Save();
         Debug::Text('Break Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Break Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $bpf->setId($data['id']);
        $bpf->setCompany($current_company->getId());
        $bpf->setName($data['name']);
        $bpf->setType($data['type_id']);
        $bpf->setTriggerTime($data['trigger_time']);
        $bpf->setAmount($data['amount']);
        $bpf->setAutoDetectType($data['auto_detect_type_id']);
        $bpf->setStartWindow($data['start_window']);
        $bpf->setWindowLength($data['window_length']);
        $bpf->setMinimumPunchTime($data['minimum_punch_time']);
        $bpf->setMaximumPunchTime($data['maximum_punch_time']);
        if (isset($data['include_break_punch_time'])) {
            $bpf->setIncludeBreakPunchTime(TRUE);
        } else {
            $bpf->setIncludeBreakPunchTime(FALSE);
        }
        if ($bpf->isValid()) {
            $bpf->Save();
            Redirect::Page(URLBuilder::getURL(NULL, 'BreakPolicyList.php'));
            break;
        }
    default:
        if (isset($id)) {
            BreadCrumb::setCrumb($title);
            $mplf = new BreakPolicyListFactory();
            $mplf->getByIdAndCompanyID($id, $current_company->getId());
            foreach ($mplf as $mp_obj) {
                //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);