diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index 49faab27..5edf611f 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -88,17 +88,23 @@ class monthlypay extends BaseController function attendanceLoad() { - $montharray = array(01=>"Jan",02=>"Feb",03=>"Mar",04=>"Apr",05=>"May",06=>"Jun",07=>"Jul",08=>"Aug",09=>"Sep",10=>"Oct",11=>"Nov",12=>"Dec"); + $month['month'] = ''; + $monthdays = 0; + $begin = 0; + $end =0; if($this->input->post('month')) { - //echo "post"; + $current = $this->input->post('month'); $month = substr($current,0,3); $year = substr($current,4); - $month=array_search($month,$montharray); - $current = $year."-".$month.'-01'; - //echo $current; + $month=date_parse($month); + $current = $year."-".$month['month'].'-01'; + $monthdays =cal_days_in_month(CAL_GREGORIAN,$month['month'],$year); + $begin = new DateTime($year.'-'.$month['month'].'-01'); + $end = new DateTime($year.'-'.$month['month'].'-'.$monthdays); + } if(empty($current)) { @@ -107,11 +113,10 @@ class monthlypay extends BaseController $year = date("Y"); $month = date("m"); $current = $current."-01"; - } - $monthdays =cal_days_in_month(CAL_GREGORIAN,$month,$year); $begin = new DateTime($year.'-'.$month.'-01'); $end = new DateTime($year.'-'.$month.'-'.$monthdays); + } $sundayarray =array(); while ($begin <= $end) {