433 lines
13 KiB
PHP
433 lines
13 KiB
PHP
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.js"></script>
|
|
<script src="<?php echo base_url()?>assets/lightswitch/lightswitch/lib/jquery.tabletojson.min.js"></script>
|
|
<script>
|
|
$(function() {
|
|
$('#datepick').datepicker({
|
|
dateFormat: "dd-mm-yy",
|
|
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",
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
showButtonPanel: false,
|
|
// dateFormat: 'mm-yy',
|
|
// onClose: function(dateText, inst) {
|
|
// $(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
|
|
onClose: function(dateText, inst) {
|
|
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
|
|
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
|
|
$(this).val($.datepicker.formatDate('mm-yy', new Date(year, month, 1)));
|
|
}
|
|
});
|
|
$(".monthPicker").focus(function () {
|
|
$(".ui-datepicker-calendar").hide();
|
|
$("#ui-datepicker-div").position({
|
|
my: "center top",
|
|
at: "center bottom",
|
|
of: $(this)
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
|
|
<style>
|
|
.dataTables_filter input {padding: 4px;}
|
|
.dataTables_filter {
|
|
width: 50%;
|
|
float: right;
|
|
text-align: right;
|
|
}
|
|
.dataTables_paginate {
|
|
width: 50%;
|
|
float: right;
|
|
text-align: right;
|
|
}
|
|
div.dt-buttons {
|
|
|
|
position: relative;
|
|
float: right;
|
|
}
|
|
.btn-success {
|
|
background-color: #3c8dbc;
|
|
border-color: #3c8dbc;
|
|
}
|
|
|
|
/*div.ui-datepicker{
|
|
z-index:2;
|
|
}
|
|
*/
|
|
/*#datepick-datepicker-calendar {
|
|
display: none;
|
|
} */
|
|
#datepi>.ui-datepi-calendar
|
|
{
|
|
display:none;
|
|
}
|
|
span .hights {
|
|
background-color: green;
|
|
}
|
|
.edit{
|
|
background-color:#eeffcc ! important;
|
|
}
|
|
th{
|
|
text-align:center !important;
|
|
}
|
|
|
|
</style>
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<section class="content-header">
|
|
<h1>
|
|
<center>Siddharth Industries - Production Salary Cost</center>
|
|
</h1>
|
|
</section>
|
|
</br>
|
|
</br>
|
|
<section class="content" id="loadingcontent">
|
|
|
|
<h4><span style="background-color: #FFFF00">Make sure attendance entry made before entering data in the screen</span></h4>
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
<div class="box">
|
|
<div class="box-header">
|
|
<!--<center><h3 class="box-title">-->
|
|
<div class="box-tools">
|
|
|
|
</div><!--</h3></center>-->
|
|
|
|
</div><!-- /.box-header -->
|
|
|
|
|
|
<div class="box-body">
|
|
|
|
|
|
|
|
<div class="row">
|
|
<form method="post" id="psc" action="<?php echo base_url() ?>monthlypay/addnew" enctype="multipart/form-data" onSubmit="return validate();" >
|
|
<div class="col-md-2">
|
|
<label>Date</label>
|
|
<div class="form-group"><b>
|
|
|
|
<input type="text" class="form-control " style="z-index: 100" id="datepick" name="datepick" >
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-2">
|
|
<label>Production/Ton</label>
|
|
<input type="text" id="pton" name="pton" class="form-control" onkeyup="cal();">
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<label>Employee Present</label>
|
|
<input type="text" id="today_abs" name="today_abs" class="form-control" readonly
|
|
value=<?php echo $today; ?> >
|
|
<!-- <input type="hidden" id="customerid" name="customerid" readonly> -->
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<label>Total Salary Cost</label>
|
|
|
|
<input type="text" class="form-control" name='today_salary' id="today_salary" style="font-size:bold" readonly value=<?php echo $employeeSalary;?> >
|
|
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label>Salary Cost Per Ton </label>
|
|
<input type="text" id="calc" name="calc" class="form-control" readonly
|
|
|
|
>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label> </label>
|
|
<div align="right">
|
|
<input type="submit" class="btn btn-primary" value="ADD" />
|
|
<!-- <input type="submit" onclick="validate();" class="btn btn-primary" value="EDIT" /> -->
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<hr>
|
|
<div class="row">
|
|
<form method="post" id="psc" action="<?php echo base_url() ?>monthlypay/salarycost" enctype="multipart/form-data">
|
|
|
|
<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">
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<hr>
|
|
<!-- <div id="table"> -->
|
|
<center ><h5>
|
|
<?php
|
|
if($this->input->post('datepi')){
|
|
$date = $this->input->post('datepi');
|
|
$a=substr($date,0,2);
|
|
$monthName = date('F', mktime(0, 0, 0, $a, 10));
|
|
|
|
$year=substr($date,3,6);
|
|
|
|
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;
|
|
}
|
|
?>
|
|
|
|
</h5>
|
|
</center>
|
|
|
|
<div class="table-responsive">
|
|
<div id="panel-recent-invoices" class="panel panel-default">
|
|
<body>
|
|
|
|
<table id="testreport" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align:center;">
|
|
<thead style="background-color:#ddf;">
|
|
<tr>
|
|
|
|
<th>SNo</th>
|
|
<th>Date</th>
|
|
<th>Production/Ton</th>
|
|
<th>EmployeePresent</th>
|
|
<th>TotalSalaryCost</th>
|
|
<th>SalaryCostPerTon</th>
|
|
<th id="act">Action</th>
|
|
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="databaseAppend">
|
|
<?php
|
|
if(!empty($productionsalary))
|
|
{
|
|
//print_r($productionsalary);
|
|
$i =0;
|
|
foreach($productionsalary as $key => $ps){
|
|
//print_r($ps);
|
|
?>
|
|
<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));
|
|
}else{
|
|
$date = '';
|
|
}
|
|
echo $date;
|
|
?>
|
|
</td>
|
|
|
|
<!-- <td id="datepick<?php echo $key?>"><?php echo $ps->date?></td> -->
|
|
<td contenteditable='true' onkeyup="changeInput(<?php echo $key?>)" id="pton<?php echo $key?>"><?php echo $ps->production ?></td>
|
|
<td id ="today_abs<?php echo $key?>"><?php echo $ps->emppresent ?></td>
|
|
<td id="today_salary<?php echo $key?>"><?php
|
|
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>
|
|
<!-- class ="glyphicon glyphicon-file" -->
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</div></div>
|
|
<p> </p>
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div></b></div></div>
|
|
</section>
|
|
</div>
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
table = $('#testreport').DataTable( {
|
|
|
|
"dom": "<'row'<'col-md-3'l><'col-md-9'Bf>>" +
|
|
"<'row'<'col-md-6'><'col-md-6'>>" +
|
|
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
|
|
buttons: [
|
|
|
|
{
|
|
extend: 'excelHtml5',
|
|
footer: 'true',
|
|
//messageTop: $('h3').text(),
|
|
title:$('h5').text(),
|
|
exportOptions: {
|
|
//columns: ':visible'
|
|
columns: ':lt(6)', orthogonal: 'export'
|
|
|
|
}
|
|
},
|
|
'colvis'
|
|
]
|
|
} );
|
|
} );
|
|
//
|
|
function changeInput(id)
|
|
{
|
|
|
|
//alert (id);
|
|
var first =parseFloat(document.getElementById('pton'+id).textContent);
|
|
//alert(first);
|
|
var second =parseInt(document.getElementById('today_salary'+id).textContent);
|
|
//alert(second);
|
|
var cal =second/first;
|
|
|
|
var cals =(cal).toFixed(0);
|
|
|
|
document.getElementById("salary"+id).innerHTML = cals;
|
|
}
|
|
$('#datepick').change(function() {
|
|
//var datepick = $('#emp').val();
|
|
var lastChoose = localStorage.getItem("lastChoose");
|
|
//if(lastChoose === $(this).val() ) {
|
|
// alert('Already Choosen')
|
|
//}else {
|
|
localStorage.setItem("lastChoose", $(this).val() );
|
|
var id = $(this).val();
|
|
//alert(id);
|
|
$.ajax({
|
|
data:{id:id},
|
|
dataType: 'json',
|
|
type:"POST",
|
|
url:"<?php echo base_url();?>monthlypay/dateFunctionChangeVales",
|
|
success:function(json) {
|
|
|
|
$("#today_abs").val(json.today);
|
|
|
|
$("#today_salary").val(json.employeeSalary);
|
|
|
|
}
|
|
});
|
|
//}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script>
|
|
// var index="1";
|
|
function validate()
|
|
{
|
|
// if(!empty('#datepick'))
|
|
// {
|
|
if($('#datepick').val().length < 1)
|
|
{
|
|
alert('Please Enter the Date');
|
|
$("#datepick").focus();
|
|
return false;
|
|
}
|
|
// }
|
|
if($('#pton').val().length < 1)
|
|
{
|
|
alert('Please Enter value in Ton');
|
|
$("#pton").focus();
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
function cal(){
|
|
var a= $("#pton").val();
|
|
var b= $("#today_salary").val();
|
|
var calc=Math.round(b/a);
|
|
//alert(calc);
|
|
$("#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);
|
|
var pra =parseFloat(document.getElementById('today_abs'+k).textContent);
|
|
var sal =parseFloat(document.getElementById('today_salary'+k).textContent);
|
|
var ast =parseInt(document.getElementById('salary'+k).textContent);
|
|
//alert(ast);
|
|
$.ajax({
|
|
data:{sno:sno,date:date,prod:prod,pra:pra,sal:sal,ast:ast},
|
|
type:"POST",
|
|
url:"<?php echo base_url() ?>monthlypay/edited",
|
|
|
|
success:function(data){
|
|
$('#loadingcontent').loader('hide');
|
|
alert(data);
|
|
// window.location.href="monthlypay/productionsalary";
|
|
window.location.reload();
|
|
}//success function closed
|
|
|
|
});//ajax function closed
|
|
|
|
}
|
|
</script>
|