diff --git a/application/controllers/monthlypay.php b/application/controllers/monthlypay.php index fa8737bc..97e1f99a 100755 --- a/application/controllers/monthlypay.php +++ b/application/controllers/monthlypay.php @@ -780,44 +780,72 @@ function dateFunctionChangeVales() +// function salarycost() +// { + + +// $this->global['pageTitle'] = 'Siddharth : ProductionSalary'; +// // $da =$this->input->post('term'); +// $da=$this->input->post('datepi'); +// //$ab = date('Y-m-d',strtotime($da)); +// //echo $da; +// $da= '01-'.$da; +// //echo $d; + + +// $ab = date('Y-m-d',strtotime($da)); + +// //strtotime(str_replace('/', '-', '27/05/1990') +// //echo $ab; die; + + + +// $data['productionsalary'] = $this->monthlypay_model->cost($ab); + + + +// //print_r( $data['$productionsalary']); die; + + +// //echo json_encode($result); +// // $this->loadviews('salarycostforproduction',$this->$data,NULL); + +// $this->loadviews('salarycostforproduction',$this->global,$data,NULL); + +// } + function salarycost() { $this->global['pageTitle'] = 'Siddharth : ProductionSalary'; - // $da =$this->input->post('term'); + $da=$this->input->post('datepi'); - //$ab = date('Y-m-d',strtotime($da)); -//echo $da; - $da= '01-'.$da; - //echo $d; + if(!empty($da)){ + $da= '01-'.$da; + } + $from_date=$this->input->post('from_date'); + // echo $from_date; + $to_date=$this->input->post('to_date'); + //echo $to_date; - $ab = date('Y-m-d',strtotime($da)); - - //strtotime(str_replace('/', '-', '27/05/1990') - //echo $ab; die; - - - - $data['productionsalary'] = $this->monthlypay_model->cost($ab); - - - -//print_r( $data['$productionsalary']); die; -//echo json_encode($result); - // $this->loadviews('salarycostforproduction',$this->$data,NULL); + $ab = empty($da)?"":date('Y-m-d',strtotime($da)); + // echo $ab; + $from = empty($from_date)?"":date('Y-m-d',strtotime($from_date)); + //echo $from; + $to = empty($to_date)?"":date('Y-m-d',strtotime($to_date)); + //echo $to; + $data['productionsalary'] = $this->monthlypay_model->cost($ab,$from,$to); $this->loadviews('salarycostforproduction',$this->global,$data,NULL); } - - } ?> \ No newline at end of file diff --git a/application/models/monthlypay_model.php b/application/models/monthlypay_model.php index 53a161dd..7c277aca 100755 --- a/application/models/monthlypay_model.php +++ b/application/models/monthlypay_model.php @@ -469,18 +469,43 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;"; -function cost($ab) -{ +// function cost($ab) +// { - $sql = "select * from T_ProductionSalaryCost where month(date)=month('".$ab."')"; +// $sql = "select * from T_ProductionSalaryCost where month(date)=month('".$ab."')"; - //echo $sql;die; +// //echo $sql;die; - $query = $this->db->query($sql); +// $query = $this->db->query($sql); - return $query->result(); +// return $query->result(); +// } + + + +function cost($ab,$from,$to) +{ + // echo $ab;echo $from;echo $to; + // die; + $sql = "select * from T_ProductionSalaryCost where + month(date)= month('".$ab."')"; + + if ($from and $to != '') + { + $sql.="or date >= '".$from."' + and date <= '".$to."'"; + + } + + // echo $sql; + + $query = $this->db->query($sql); + return $query->result(); + + + } diff --git a/application/views/salarycostforproduction.php b/application/views/salarycostforproduction.php index 7ba6d78d..01c5465f 100644 --- a/application/views/salarycostforproduction.php +++ b/application/views/salarycostforproduction.php @@ -8,6 +8,18 @@ maxDate: +0, }); }); $(function() { +$('#from_date').datepicker({ +dateFormat: "dd-mm-yy", +maxDate: +0, +}); +}); +$(function() { +$('#to_date').datepicker({ +dateFormat: "dd-mm-yy", +maxDate: +0, +}); +}); +$(function() { $('#datepi').datepicker({ maxDate: +0, dateFormat: "mm-yy", @@ -55,6 +67,11 @@ of: $(this) background-color: #3c8dbc; border-color: #3c8dbc; } + + /*div.ui-datepicker{ + z-index:2; + } +*/ /*#datepick-datepicker-calendar { display: none; } */ @@ -149,10 +166,39 @@ th{
-

+
+
+
+ + + +
+ + + + +
+
+ +
+ + + +
+ + + + +
+ +

@@ -173,6 +219,11 @@ th{ echo 'Production Salary Cost'.'('.$monthName.'-'.$year.')'; + } + if($this->input->post('from_date') && $this->input->post('to_date')){ + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + echo 'Production Salary Cost '. $frm.' to '.$t; } ?> @@ -200,8 +251,6 @@ th{ - - - date !='0000-00-00'){ $date = date("d-m-Y",strtotime($ps->date)); @@ -232,7 +278,7 @@ th{ echo number_format($ps->totalsalary , 0, '.', ''); ?> salaryton);?> - + @@ -328,7 +374,7 @@ th{ } }); - +