frdate to todate add salary cost

This commit is contained in:
venbatechnologies 2018-03-14 13:58:04 +05:30
parent 8ef801e084
commit 0b6210d732
3 changed files with 134 additions and 37 deletions

View File

@ -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);
}
}
?>

View File

@ -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();
}

View File

@ -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{
<div class="row">
<form method="post" id="psc" action="<?php echo base_url() ?>monthlypay/salarycost" enctype="multipart/form-data">
<div class="col-md-2"><br>
<div class="col-md-2">
<label >Month-Year</label>
<input type="text" class="form-control monthPicker" style="z-index: 100" id="datepi" name="datepi" >
</div>
<div class="col-md-2">
<!-- <label for="from_date">
<?php echo 'From Date'; ?>
</label> -->
<label >From Date</label>
<div class="input-group">
<input name="from_date" style ="z-index: 0" id="from_date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<div class="col-md-2">
<!-- <label for="to_date">
<?php echo 'To Date'; ?>
</label> -->
<label >To Date</label>
<div class="input-group">
<input name="to_date" id="to_date" class="form-control datepicker">
<span class="input-group-addon">
<i class="fa fa-calendar fa-fw"></i>
</span>
</div>
</div>
<div class="col-md-2"><br>
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report" id= "btn">
@ -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{
</thead>
<tbody id="databaseAppend">
<?php
if(!empty($productionsalary))
{
//print_r($productionsalary);
@ -211,10 +260,7 @@ th{
?>
<tr>
<!-- <td id="sno<?php echo $key?>"><?php echo $ps->sno ?></td> -->
<td style="text-align:center;" id="sno<?php echo $key?>"><?php echo ++$i;?></td>
<td id="datepick<?php echo $key?>"><?php
if($ps->date !='0000-00-00'){
$date = date("d-m-Y",strtotime($ps->date));
@ -232,7 +278,7 @@ th{
echo number_format($ps->totalsalary , 0, '.', '');
?></td>
<td id="salary<?php echo $key?>"><?php echo number_format($ps->salaryton);?></td>
<td><button type="button" class="btn btn-default" aria-label="Left Align" id="edit<?php echo $key?>" onclick ="edit(<?php echo $ps->sno?>,<?php echo $key?>);" value=""><u>Save</u>
</button></td>
@ -328,7 +374,7 @@ th{
}
});
</script>
<script>
@ -361,9 +407,7 @@ th{
$("#calc").val(calc);
}
function edit(id,k){
//alert (id);
var sno =id;
var date =document.getElementById('datepick'+k).textContent;
var prod=parseFloat(document.getElementById('pton'+k).textContent);