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;
 }
 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;
 }
     $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);
             $data = array('id' => $mp_obj->getId(), 'name' => $mp_obj->getName(), 'type_id' => $mp_obj->getType(), 'trigger_time' => $mp_obj->getTriggerTime(), 'amount' => $mp_obj->getAmount(), 'auto_detect_type_id' => $mp_obj->getAutoDetectType(), 'start_window' => $mp_obj->getStartWindow(), 'window_length' => $mp_obj->getWindowLength(), 'minimum_punch_time' => $mp_obj->getMinimumPunchTime(), 'maximum_punch_time' => $mp_obj->getMaximumPunchTime(), 'include_break_punch_time' => $mp_obj->getIncludeBreakPunchTime(), 'created_date' => $mp_obj->getCreatedDate(), 'created_by' => $mp_obj->getCreatedBy(), 'updated_date' => $mp_obj->getUpdatedDate(), 'updated_by' => $mp_obj->getUpdatedBy(), 'deleted_date' => $mp_obj->getDeletedDate(), 'deleted_by' => $mp_obj->getDeletedBy());
         }
     } elseif ($action != 'submit') {
         $data = array('trigger_time' => 3600 * 1, 'amount' => 60 * 15, 'auto_detect_type_id' => 10, 'start_window' => 3600 * 1, 'window_length' => 3600 * 1, 'minimum_punch_time' => 60 * 5, 'maximum_punch_time' => 60 * 20);