function calcBreakPolicyTotalTime($break_policy_ids = NULL)
 {
     //Debug::arr($meal_policy_obj, 'MealPolicyObject param:', __FILE__, __LINE__, __METHOD__, 10);
     //Get total worked time for the day.
     $udtlf = new UserDateTotalListFactory();
     $daily_total_time = $udtlf->getWorkedTimeSumByUserDateID($this->getUserDateID());
     Debug::text('Daily Total Time: ' . $daily_total_time, __FILE__, __LINE__, __METHOD__, 10);
     $bplf = new BreakPolicyListFactory();
     if (is_array($break_policy_ids)) {
         $bplf->getByIdAndCompanyId($break_policy_ids, $this->getUserDateObject()->getUserObject()->getCompany());
     } else {
         //Lookup break policy
         $bplf->getByPolicyGroupUserIdAndDayTotalTime($this->getUserDateObject()->getUser(), $daily_total_time);
     }
     $break_policy_total_time = 0;
     if ($bplf->getRecordCount() > 0) {
         Debug::text('Found Break Policy(ies) to apply: ' . $bplf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
         $break_total_time = array();
         $break_overall_total_time = 0;
         $plf = new PunchListFactory();
         $plf->getByUserDateIdAndTypeId($this->getUserDateId(), 30);
         //Only Break punches
         if ($plf->getRecordCount() > 0) {
             $pair = 0;
             $x = 0;
             $out_for_break = FALSE;
             foreach ($plf as $p_obj) {
                 if ($p_obj->getStatus() == 20 and $p_obj->getType() == 30) {
                     $break_out_timestamp = $p_obj->getTimeStamp();
                     $out_for_break = TRUE;
                 } elseif ($out_for_break == TRUE and $p_obj->getStatus() == 10 and $p_obj->getType() == 30) {
                     $break_punch_arr[$pair][20] = $break_out_timestamp;
                     $break_punch_arr[$pair][10] = $p_obj->getTimeStamp();
                     $out_for_break = FALSE;
                     $pair++;
                     unset($break_out_timestamp);
                 } else {
                     $out_for_break = FALSE;
                 }
                 $x++;
             }
             if (isset($break_punch_arr)) {
                 foreach ($break_punch_arr as $punch_control_id => $time_stamp_arr) {
                     if (isset($time_stamp_arr[10]) and isset($time_stamp_arr[20])) {
                         $break_overall_total_time = bcadd($break_overall_total_time, bcsub($time_stamp_arr[10], $time_stamp_arr[20]));
                         $break_total_time[] = bcsub($time_stamp_arr[10], $time_stamp_arr[20]);
                     } else {
                         Debug::text(' Break Punches not paired... Skipping!', __FILE__, __LINE__, __METHOD__, 10);
                     }
                 }
             } else {
                 Debug::text(' No Break Punches found, or none are paired.', __FILE__, __LINE__, __METHOD__, 10);
             }
         }
         //Debug::Arr($break_punch_arr, ' Break Punch Arr: ', __FILE__, __LINE__, __METHOD__, 10);
         //Debug::Arr($break_total_time, ' Break Total Time Arr: ', __FILE__, __LINE__, __METHOD__, 10);
         Debug::text(' Break Overall Total Time: ' . $break_overall_total_time, __FILE__, __LINE__, __METHOD__, 10);
         $i = 0;
         foreach ($bplf as $break_policy_obj) {
             Debug::text('Break Policy ID: ' . $break_policy_obj->getId() . ' Type ID: ' . $break_policy_obj->getType() . ' Amount: ' . $break_policy_obj->getAmount() . ' Daily Total Time: ' . $daily_total_time, __FILE__, __LINE__, __METHOD__, 10);
             /*
             				//If we skip this, then we can't force a break auto-deduct even when the employee doesn't punch in/out for breaks.
             				//However the opposite is true if we want to auto-add break time only when the employee does take a break, this will always add it.
             				if ( !isset( $break_total_time[$i] ) ) {
             					Debug::text(' No Break Total Time for this break policy...Skipping...: ', __FILE__, __LINE__, __METHOD__, 10);
             					continue;
             				}
             */
             $break_policy_time = 0;
             switch ($break_policy_obj->getType()) {
                 case 10:
                     //Auto-Deduct
                     Debug::text(' Break AutoDeduct.', __FILE__, __LINE__, __METHOD__, 10);
                     if ($break_policy_obj->getIncludeBreakPunchTime() == TRUE) {
                         $break_policy_time = bcsub($break_policy_obj->getAmount(), $break_total_time[$i]) * -1;
                         //If they take more then their alloted break, zero it out so time isn't added.
                         if ($break_policy_time > 0) {
                             $break_policy_time = 0;
                         }
                     } else {
                         $break_policy_time = $break_policy_obj->getAmount() * -1;
                     }
                     break;
                 case 15:
                     //Auto-Include
                     Debug::text(' Break AutoInclude... Break Total Time: ' . $break_total_time[$i] . ' Break Policy Amount: ' . $break_policy_obj->getAmount(), __FILE__, __LINE__, __METHOD__, 10);
                     if ($break_policy_obj->getIncludeBreakPunchTime() == TRUE) {
                         if ($break_total_time[$i] > $break_policy_obj->getAmount()) {
                             $break_policy_time = $break_policy_obj->getAmount();
                         } else {
                             $break_policy_time = $break_total_time[$i];
                         }
                     } else {
                         $break_policy_time = $break_policy_obj->getAmount();
                     }
                     break;
             }
             Debug::text(' Break Policy Total Time: ' . $break_policy_time . ' Break Policy ID: ' . $break_policy_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
             if ($break_policy_time != 0) {
                 $break_policy_total_time = bcadd($break_policy_total_time, $break_policy_time);
                 $udtf = new UserDateTotalFactory();
                 $udtf->setUserDateID($this->getUserDateID());
                 $udtf->setStatus(10);
                 //System
                 $udtf->setType(110);
                 //Break
                 $udtf->setBreakPolicyId($break_policy_obj->getId());
                 $udtf->setBranch($this->getUserDateObject()->getUserObject()->getDefaultBranch());
                 $udtf->setDepartment($this->getUserDateObject()->getUserObject()->getDefaultDepartment());
                 $udtf->setTotalTime($break_policy_time);
                 $udtf->setEnableCalcSystemTotalTime(FALSE);
                 if ($udtf->isValid() == TRUE) {
                     $udtf->Save();
                 }
                 unset($udtf);
             }
             $i++;
         }
     } else {
         Debug::text(' No Break Policy found, or not after break policy trigger time yet...', __FILE__, __LINE__, __METHOD__, 10);
     }
     Debug::text(' Final Break Policy Total Time: ' . $break_policy_total_time, __FILE__, __LINE__, __METHOD__, 10);
     return $break_policy_total_time;
 }