Esempio n. 1
0
 function createMealPolicy($company_id)
 {
     $mpf = new MealPolicyFactory();
     $mpf->setCompany($company_id);
     $mpf->setName('One Hour Min.');
     $mpf->setType(20);
     $mpf->setTriggerTime(3600 * 5);
     $mpf->setAmount(3600);
     $mpf->setStartWindow(3600 * 4);
     $mpf->setWindowLength(3600 * 2);
     if ($mpf->isValid()) {
         $insert_id = $mpf->Save();
         Debug::Text('Meal Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Meal Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Esempio n. 2
0
 function createMealPolicy($company_id, $type)
 {
     $mpf = new MealPolicyFactory();
     $mpf->setCompany($company_id);
     switch ($type) {
         case 100:
             //Normal 1hr lunch
             $mpf->setName('Normal');
             $mpf->setType(20);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setIncludeLunchPunchTime(FALSE);
             break;
         case 110:
             //AutoAdd 1hr
             $mpf->setName('AutoAdd 1hr');
             $mpf->setType(15);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setIncludeLunchPunchTime(FALSE);
             break;
         case 115:
             //AutoAdd 1hr
             $mpf->setName('AutoAdd 1hr');
             $mpf->setType(15);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setIncludeLunchPunchTime(TRUE);
             break;
         case 120:
             //AutoDeduct 1hr
             $mpf->setName('AutoDeduct 1hr');
             $mpf->setType(10);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setIncludeLunchPunchTime(FALSE);
             break;
     }
     if ($mpf->isValid()) {
         $insert_id = $mpf->Save();
         Debug::Text('Meal Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Meal Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Esempio n. 3
0
 function createMealPolicy($company_id, $type)
 {
     $mpf = new MealPolicyFactory();
     $mpf->setCompany($company_id);
     switch ($type) {
         case 100:
             //Normal 1hr lunch: Detect by Time Window
             $mpf->setName('Normal - Time Window');
             $mpf->setType(20);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setAutoDetectType(10);
             $mpf->setStartWindow(3 * 3600);
             $mpf->setWindowLength(2 * 3600);
             $mpf->setIncludeLunchPunchTime(FALSE);
             break;
         case 110:
             //Normal 1hr lunch: Detect by Punch Time
             $mpf->setName('Normal - Punch Time');
             $mpf->setType(20);
             $mpf->setTriggerTime(3600 * 6);
             $mpf->setAmount(3600);
             $mpf->setAutoDetectType(20);
             $mpf->setMinimumPunchTime(60 * 30);
             ///0.5hr
             $mpf->setMaximumPunchTime(60 * 75);
             //1.25hr
             $mpf->setIncludeLunchPunchTime(FALSE);
             break;
     }
     if ($mpf->isValid()) {
         $insert_id = $mpf->Save();
         Debug::Text('Meal Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Meal Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Esempio n. 4
0
     $mpf->setName($data['name']);
     $mpf->setType($data['type_id']);
     $mpf->setTriggerTime($data['trigger_time']);
     $mpf->setAmount($data['amount']);
     $mpf->setAutoDetectType($data['auto_detect_type_id']);
     $mpf->setStartWindow($data['start_window']);
     $mpf->setWindowLength($data['window_length']);
     $mpf->setMinimumPunchTime($data['minimum_punch_time']);
     $mpf->setMaximumPunchTime($data['maximum_punch_time']);
     if (isset($data['include_lunch_punch_time'])) {
         $mpf->setIncludeLunchPunchTime(TRUE);
     } else {
         $mpf->setIncludeLunchPunchTime(FALSE);
     }
     if ($mpf->isValid()) {
         $mpf->Save();
         Redirect::Page(URLBuilder::getURL(NULL, 'MealPolicyList.php'));
         break;
     }
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $mplf = new MealPolicyListFactory();
         $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_lunch_punch_time' => $mp_obj->getIncludeLunchPunchTime(), '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 * 5, 'amount' => 3600, 'auto_detect_type_id' => 10, 'start_window' => 3600 * 4, 'window_length' => 3600 * 2, 'minimum_punch_time' => 60 * 30, 'maximum_punch_time' => 60 * 60);
     }