siddharth_application/application/views/dailyBatchCardListing.php
2018-05-08 14:49:10 +05:30

1253 lines
46 KiB
PHP
Executable File

<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 src="<?php echo base_url()?>assets/js/jquery.CongelarFilaColumna.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<?php
//print_r($hourdata);
// die();
// echo "<br>";
// echo count($attendance);
// echo "<br>";
// print_r($emppay);
// echo "<br>";
// echo count($emppay);
//print_r($datefordropdown);
//print_r($noofpublicholidays);print_r($publicholidaysarray);
date_default_timezone_set('Asia/Kolkata');
$currentday = date('d');
// print_r($attendance);
// echo "<br>------------------------------<br>";
?>
<style type="text/css">
.num {
text-align:right;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
.fht-table tbody,
.fht-table tr,
.fht-table th,
.fht-table td {
margin: 0;
}
.fht-table td {
text-align:center;
}
.fht-table td:contenteditable {
text-align:center;
background-color:red;
}
.fht-table tr:hover {
background-color: #3c8dbc;
color:#ffffff;
}
.fht-table{
border: 0 none;
height: auto;
width: auto;
border-collapse: collapse;
border-spacing: 0;
/*table-layout: fixed; Algoritmo de distribucion fijo */
/*white-space:nowrap; Impide los saltos de línea automáticos */
}
.fht-table th,.fht-table td {
overflow: hidden;
}
.fht-table-wrapper,
.fht-table-wrapper .fht-thead,
.fht-table-wrapper .fht-tfoot,
.fht-table-wrapper .fht-fixed-column .fht-tbody,
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: hidden;
position: relative;
}
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: auto;
}
.fht-table-wrapper .fht-table .fht-cell {
overflow: hidden;
height: 1px;
}
.fht-table-wrapper .fht-fixed-column,
.fht-table-wrapper .fht-fixed-body {
top: 0;
left: 0;
position: absolute;
}
.fht-table-wrapper .fht-fixed-column {
z-index: 1;
}
.fht-fixed-body .fht-thead table {
margin-right: 20px;
border: 0 none;
}
/*For Examples*/
.ContenedorTabla {
height: 500px;
margin: 0 auto;
overflow: auto;
width: auto;
position: relative;
}
.header, .main {
display: inline-block;
height: auto;
width: 100%;
}
.titulosHeader {
border-bottom: 1px solid #e8bb25;
height: auto;
margin-bottom: 10px;
padding-bottom: 8px;
padding-top: 8px;
width: 100%;
}
.celda_encabezado_general {
background-color: #3c8dbc;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 2px 4px;
text-align: center;
}
._Separador{
background-color: #fff;
height: 12px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 7px;
}
._Separador div{
width: 4px;
}
.celda_normal {
/*background-color: #fff;*/
border: 1px solid #ccc;
padding: 2px 4px;
}
/*style excel*/
.excel_cell{
border: 1px solid #CCC;
color: #222;
text-align: center;
font-size: 13px
font-weight: normal;
padding: 4px;
white-space: pre-line;
empty-cells: show;
}
._cell_header{
background-color: #EEE;
}
._cell_Default{
background-color: #FFF;
text-align: left;
}
.excel_cell div{
width: 30px;
height: 20px;
}
.modal
{
padding-right:250px ! important;
}
.edit{
background-color:#c6ffb3;
}
.test{
color:#000 ! important;
text-decoration:underline;
}
table{
border:2px;
text-align:center;
}
td{ padding:3px;}
th{
background-color:#3c8dbc !important;
color:#000;
text-align:center;
border-color:#ebebe0;
}
/**/
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Daily Batch Card Lisiting - <?php echo $datefordisplay;?> </center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-md-2">
<?php
$attributes = array('id' => 'att');
echo form_open('dailyListing', $attributes);
$today = date('M-Y');
$data = array('type' => 'text','name' => 'month','id' => 'month','class' => 'form-control select2');
echo form_input($data);?>
</div>
<div class="col-md-1" style="margin-left:3.5%;">
<input type="button" value="Change Month" id="atten" class="btn btn-primary" title='click here for load Daily Bath Card Records for specified month'>
</div>
<?php echo form_close();?>
<div class="col-md-1"style="margin-left:3.0%;">
<input type="button" value="Abstract Report" id="abstract" class="btn btn-primary">
</div>
<div class="col-md-1" style="margin-left:3.5%;">
<a href="<?php echo base_url().'batchcard/loadDailyBatchCard';?>" class="btn btn-primary">Add New Daily Data</a>
</div>
</div>
</div><!-- /.box-header -->
<div class="box-body">
<!-- <main class="main">
<div class="ContenedorTabla"> -->
<table id="dailylisting" border="2" class="fht-table" style="width:700px;">
<thead>
<tr>
<th rowspan="2" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th rowspan="2">Auto Start</th>
<th rowspan="2">Auto Stop</th>
<th rowspan="2">Total Hrs</th>
<th rowspan="2">less up to feeding start</th>
<th rowspan="2">less maintenance</th>
<th rowspan="2">Less Break down hours</th>
<th rowspan="2">Total burner running time</th>
<th rowspan="2">Total Feeding Hours</th>
<th colspan="3">ED Details</th>
<th colspan="2">Rotary Dryer</th>
<th colspan="2">TRP Rough Sand</th>
<th colspan="2">TRP Fine Sand</th>
<th colspan="2">Gas for Trip</th>
<th colspan="2">Water</th>
<th colspan="3">Diesel for Bull</th>
<th colspan="3">Diesel for Rotary Dryer</th>
<th colspan="3">Power Consumption</th>
<th colspan="3">No Of Person Worked</th>
<th rowspan="2">Worked Done By</th>
<th style="width:25px;!important" rowspan="2">Approved By</th>
<th rowspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Remarks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
</tr>
<tr>
<th >Running Hrs</th>
<th >Receipt</th>
<th >Issues</th>
<th >Input</th>
<th >Output</th>
<th >Receipt</th>
<th >Issues</th>
<th >Receipt</th>
<th >Issues</th>
<th >Receipt</th>
<th >Consumption</th>
<th >Receipt</th>
<th >Consumption</th>
<th >Receipt</th>
<th >Consumption</th>
<th >Running Hrs</th>
<th >Receipt</th>
<th >Consumption</th>
<th >Running Hrs</th>
<th >Opening Reading</th>
<th >Close Reading</th>
<th >Total</th>
<th >Engineers</th>
<th >Operators</th>
<th >Helpers</th>
</tr>
</thead>
<tbody>
<?php
$total_running_hrs = 0.00;
$total_running_hrs_hrs = 0.00;
$total_running_hrs_min = 0.00;
$total_feeding_start = 0.00;
$total_less_maintenance = 0.00;
$total_less_break_down_hrs = 0.00;
$total_burner_running_time = 0.00;
$total_feeding_hrs = 0.00;
$total_gas_consumption = 0.00;
$total_ed_rhrs = 0.00;
$total_ed_receipt = 0.00;
$total_ed_issues = 0.00;
$total_rotary_input = 0.00;
$total_rotary_output = 0.00;
$total_rough_sand_r = 0.00;
$total_rough_sand_i = 0.00;
$total_fine_sand_r = 0.00;
$total_fine_sand_i = 0.00;
$total_gas_c = 0.00;
$total_gas_r = 0.00;
$total_water_r = 0.00;
$total_water_c = 0.00;
$total_diesel_bull_r = 0.00;
$total_diesel_bull_c = 0.00;
$total_diesel_bull_rh = 0.00;
$total_diesel_rotary_bull_r = 0.00;
$total_diesel_rotary_bull_c = 0.00;
$total_diesel_rotary_bull_rh = 0.00;
$total_power_total = 0.00;
$total_engineers = 0.00;
$total_operators = 0.00;
$total_helpers = 0.00;
$total_maintenance_thrs = 0.00;
$total_cost_material = 0.00;
$total_cost_labour = 0.00;
// for ($col = 1; $col <= $monthdays;$col++){
// $d = $col.'-'.$month;
//echo $d;
foreach($hourdata as $hdata)
{
$dailydate = date_format(date_create($hdata->ddate),'d-m-Y');
$id=$hdata->dailyid;
?>
<tr title="<?php echo $dailydate;?>">
<td><a class="test" href="<?php echo base_url()?>batchcard/editDailyData/<?php echo $id;?>" ><?php echo $dailydate;?></a></td>
<?php
//if($d == $dailydate){
$auto = explode('-',$hdata->description);
$start = explode(':',$auto[0]);
$stop = explode(':',$auto[1]);
$h = $stop[0] - $start[0];
$m = $stop[1] - $start[1];
if($m > 60)
{
$h+=1;
$m-=60;
}
else if($m < 0)
{
$h-=1;
if($h < 0 ){$h = 0;}
$m+=60;
}
//$less_mnt = explode('.',$hdata->less_maintenance);
$total_running_hrs_hrs = $total_running_hrs_hrs + $h;
$total_running_hrs_min = $total_running_hrs_min + $m;
// }
// else {$auto[0] = '-';$auto[1]="-" ;}
//echo $hdata->description;
?>
<td ><?php echo $auto[0];?></td>
<td ><?php echo $auto[1];?></td>
<td ><?php $tthrs = $h.':'.$m;echo $tthrs;?></td>
<td >
<?php echo $hdata->less_feeding_start;
//$total_feeding_start += $hdata->less_feeding_start;
$lfs_time = explode('.',$hdata->less_feeding_start);
$lfs_hrs += $lfs_time[0];
$lfs_min += $lfs_time[1];
if ($lfs_min >= 60)
{
$lfs_hours = floor($lfs_min/60);
$lfs_minutes = $lfs_min % 60;
}
if($lfs_minutes != ''){
$final_lfs_hrs = $lfs_hrs+$lfs_hours;
if($lfs_minutes == 60){$final_lfs_mins = 00;}
else{$final_lfs_mins = round($lfs_minutes);}
}
else{
$final_lfs_hrs = $lfs_hrs+$lfs_hours;
if($lfs_min == 60 || $lfs_minutes == ' '){$final_lfs_mins = 00;}
else{$final_lfs_mins = $lfs_min;}
}
$total_feeding_start = $final_lfs_hrs .'.'. $final_lfs_mins;
?></td>
<td ><a class="test" href="<?php echo base_url()?>batchcard/editDailyData/<?php echo $id;?>#Mnt_div" >
<?php echo $hdata->less_maintenance;
//$total_less_maintenance+= $hdata->less_maintenance;
$lm_time = explode('.',$hdata->less_maintenance);
$lm_hrs += $lm_time[0];
$lm_min += $lm_time[1];
if ($lm_min >= 60)
{
$lm_hours = floor($lm_min/60);
$lm_minutes = $lm_min % 60;
}
if($lm_minutes != ''){
$final_lm_hrs = $lm_hrs+$lm_hours;
//$final_lm_mins = round($lm_minutes);
if($lm_minutes == 60){$final_lm_mins = 00;}
else{$final_lm_mins = round($lm_minutes);}
}
else{
$final_lm_hrs = $lm_hrs+$lm_hours;
if($lm_min == 60 || $lm_minutes == ' '){$final_lm_mins = 00;}
else{$final_lm_mins = $lm_min;}
}
$total_less_maintenance = $final_lm_hrs .'.'. $final_lm_mins;
?></a></td>
<td ><a class="test" href="<?php echo base_url()?>batchcard/editDailyData/<?php echo $id;?>#Mnt_div" >
<?php echo $hdata->less_break_down_hrs;
//$total_less_break_down_hrs+=$hdata->less_break_down_hrs;
$lb_time = explode('.',$hdata->less_break_down_hrs);
$lb_hrs += $lb_time[0];
$lb_min += $lb_time[1];
if ($lb_min >= 60)
{
$lb_hours = floor($lb_min/60);
$lb_minutes = $lb_min % 60;
}
if($lb_minutes != ''){
$final_lb_hrs = $lb_hrs+$lb_hours;
//$final_lb_mins = round($lb_minutes);
if($lb_minutes == 60){$final_lb_mins = 00;}
else{$final_lb_mins = round($lb_minutes);}
}
else{
$final_lb_hrs = $lb_hrs+$lb_hours;
if($lb_min == 60 || $lb_minutes == ' '){$final_lb_mins = '00';}
else{$final_lb_mins = $lb_min;}
}
$total_less_break_down_hrs = $final_lb_hrs .'.'. $final_lb_mins;
?></a></td>
<td >
<?php echo $hdata->total_burner_running_time;
$tbr_time = explode('.',$hdata->total_burner_running_time);
$tbr_hrs += $tbr_time[0];
$tbr_min += $tbr_time[1];
if ($tbr_min >= 60)
{
$tbr_hours = floor($tbr_min/60);
$tbr_minutes = $tbr_min % 60;
}
if($tbr_minutes != ''){
$final_tbr_hrs = $tbr_hrs+$tbr_hours;
if($tbr_minutes == 60){$final_tbr_mins = 00;}
else{$final_tbr_mins = round($tbr_minutes);}
}
else{
$final_tbr_hrs = $tbr_hrs+$tbr_hours;
if($tbr_min == 60 || $tbr_minutes == ' '){$final_tbr_mins = 00;}
else{$final_tbr_mins = $tbr_min;}
}
$total_burner_running_time = $final_tbr_hrs .'.'. $final_tbr_mins;
//$total_burner_running_time+=$hdata->total_burner_running_time;
?></td>
<td >
<?php echo $hdata->total_feeding_hrs;
$tfh_time = explode('.',$hdata->total_feeding_hrs);
$tfh_hrs += $tfh_time[0];
$tfh_min += $tfh_time[1];
if ($tfh_min >= 60)
{
$tfh_hours = floor($tfh_min/60);
$tfh_minutes = $tfh_min % 60;
}
if($tfh_minutes != ''){
$final_tfh_hrs = $tfh_hrs+$tfh_hours;
//$final_tfh_mins = round($tfh_minutes);
if($tfh_minutes == 60){$final_tfh_mins = 00;}
else{$final_tfh_mins = round($tfh_minutes);}
}
else{
$final_tfh_hrs = $tfh_hrs+$tfh_hours;
if($tfh_min == 60 || $tfh_minutes == ' '){$final_tfh_mins = 00;}
else{$final_tfh_mins = $tfh_min;}
}
$total_feeding_hrs = $final_tfh_hrs .'.'. $final_tfh_mins;
//$total_feeding_hrs+=$hdata->total_feeding_hrs;
?></td>
<td >
<?php echo $hdata->ed_running_hrs;
$edrh_time = explode('.',$hdata->ed_running_hrs);
$edrh_hrs += $edrh_time[0];
$edrh_min += $edrh_time[1];
if ($edrh_min >= 60)
{
$edrh_hours = floor($edrh_min/60);
$edrh_minutes = $edrh_min % 60;
}
if($edrh_minutes != ''){
$final_edrh_hrs = $edrh_hrs+$edrh_hours;
//$final_edrh_mins = round($edrh_minutes);
if($edrh_minutes == 60){$final_edrh_mins = 00;}
else{$final_edrh_mins = round($edrh_minutes);}
}
else{
$final_edrh_hrs = $edrh_hrs+$edrh_hours;
//$final_edrh_mins = $edrh_min;
if($edrh_min == 60 || $edrh_minutes == ' '){$final_edrh_mins = 00;}
else{$final_edrh_mins = round($edrh_min);}
}
$total_ed_rhrs = $final_edrh_hrs .'.'. $final_edrh_mins;
//$total_ed_rhrs+=$hdata->ed_running_hrs;
?></td>
<td ><?php echo $hdata->ed_receipt;$total_ed_receipt+=$hdata->ed_receipt;?></td>
<td ><?php echo $hdata->ed_issues;$total_ed_issues+=$hdata->ed_issues;?></td>
<td ><?php echo $hdata->rotary_input;$total_rotary_input+=$hdata->rotary_input;?></td>
<td ><?php echo $hdata->rotary_output;$total_rotary_output+=$hdata->rotary_output;?></td>
<td ><?php echo $hdata->trp_roughsand_receipt;$total_rough_sand_r+=$hdata->trp_roughsand_receipt;?></td>
<td ><?php echo $hdata->trp_roughsand_issues;$total_rough_sand_i+=$hdata->trp_roughsand_issues;?></td>
<td ><?php echo $hdata->trp_finesand_receipt;$total_fine_sand_r+=$hdata->trp_finesand_receipt;?></td>
<td ><?php echo $hdata->trp_finesand_issues;$total_fine_sand_i+=$hdata->trp_finesand_issues;?></td>
<td ><?php echo $hdata->gas_for_trip_receipt;$total_gas_r+=$hdata->gas_for_trip_receipt;?></td>
<td ><?php echo $hdata->gas_for_trip_consumption;$total_gas_c+=$hdata->gas_for_trip_consumption;?></td>
<td ><?php echo $hdata->water_receipt;$total_water_r+=$hdata->water_receipt;?></td>
<td ><?php echo $hdata->water_consumption;$total_water_c+=$hdata->water_consumption;?></td>
<td ><?php echo $hdata->diesel_receipt;$total_diesel_bull_r+=$hdata->diesel_receipt;?></td>
<td ><?php echo $hdata->diesel_consumption;$total_diesel_bull_c+=$hdata->diesel_consumption;?></td>
<td >
<?php echo $hdata->diesel_runninig_hrs;
$drh_time = explode('.',$hdata->diesel_runninig_hrs);
$drh_hrs += $drh_time[0];
$drh_min += $drh_time[1];
//echo $drh_min;
if ($drh_min >= 60)
{
$drh_hours = floor($drh_min/60);
$drh_minutes = $drh_min % 60;
}
if($drh_minutes != ''){
//echo $drh_minutes;
$final_drh_hrs = $drh_hrs+$drh_hours;
//$final_drh_mins = round($drh_minutes);
if($drh_minutes == 60){$final_drh_mins = 00;}
else{$final_drh_mins = round($drh_minutes);}
}
else{
$final_drh_hrs = $drh_hrs+$drh_hours;
//$final_drh_mins = $drh_min;
if($drh_min == 60 || $drh_minutes == ' '){$final_drh_mins = 00;}
else{$final_drh_mins = $drh_min;}
}
$total_diesel_bull_rh = $final_drh_hrs .'.'. $final_drh_mins;
//$total_diesel_bull_rh+=$hdata->diesel_runninig_hrs;
?></td>
<td ><?php echo $hdata->diesel_dryer_receipt;$total_diesel_rotary_bull_r+=$hdata->diesel_dryer_receipt;?></td>
<td ><?php echo $hdata->diesel_dryer_consumption;$total_diesel_rotary_bull_c+=$hdata->diesel_dryer_consumption;?></td>
<td ><?php echo $hdata->diesel_dryer_runninig_hrs;
$ddrh_time = explode('.',$hdata->diesel_dryer_runninig_hrs);
$ddrh_hrs += $ddrh_time[0];
$ddrh_min += $ddrh_time[1];
if ($ddrh_min >= 60)
{
$ddrh_hours = floor($ddrh_min/60);
$ddrh_minutes = $ddrh_min % 60;
}
if($ddrh_minutes != ''){
$final_ddrh_hrs = $ddrh_hrs+$ddrh_hours;
//$final_ddrh_mins = round($ddrh_minutes);
if($ddrh_minutes == 60){$final_ddrh_mins = 00;}
else{$final_ddrh_mins = round($ddrh_minutes);}
}
else{
$final_ddrh_hrs = $ddrh_hrs+$ddrh_hours;
//$final_ddrh_mins = $ddrh_min;
if($ddrh_min == 60 || $ddrh_minutes == ' '){$final_ddrh_mins = 00;}
else{$final_ddrh_mins = $ddrh_min;}
}
$total_diesel_rotary_bull_rh = $final_ddrh_hrs .'.'. $final_ddrh_mins;
// $total_diesel_rotary_bull_rh = $drr_hr .'.'. $drr_min;
?></td>
<td ><?php echo $hdata->power_open_reading;?></td>
<td ><?php echo $hdata->power_close_reading;?></td>
<td ><?php $treading = ($hdata->power_close_reading - $hdata->power_open_reading);echo $treading;$total_power_total+=$treading;?></td>
<td ><?php echo $hdata->engineers;$total_engineers+=$hdata->engineers;?></td>
<td ><?php echo $hdata->operators;$total_operators+=$hdata->operators;?></td>
<td ><?php echo $hdata->helpers;$total_helpers+=$hdata->helpers;?></td>
<td ><?php echo $hdata->FirstName.'-'.$hdata->LastName;?></td>
<td style="width:25px;!important"><?php echo $hdata->approvedby;?></td>
<td ><?php echo $hdata->remarks;?></td>
<?php
}
?>
</tr>
<?php
// } ?>
</tbody>
<!-- this is table footer part starts here-->
<tr>
<td>Total</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td id="total_running_hrs"><?php
if($total_running_hrs_min >= 60)
{
$lh = $total_running_hrs_min / 60;
$lh = explode('.',$lh);
// echo $lh[0];
$total_running_hrs_hrs += $lh[0];
$lm = fmod($total_running_hrs_min , 60);
//echo $lm;
$total_running_hrs_min = $lm;
}
$total_running_hrs = $total_running_hrs_hrs.'.'.$total_running_hrs_min;
echo $total_running_hrs;?></td>
<td id="total_feeding_start"><?php echo $total_feeding_start;?></td>
<td id="total_less_maintenance"><?php echo $total_less_maintenance;?></td>
<td id="total_less_break_down_hrs"><?php echo $total_less_break_down_hrs;?></td>
<td id="total_burner_running_time"><?php echo $total_burner_running_time;?></td>
<td id="total_feeding_hrs"><?php echo $total_feeding_hrs;?></td>
<td id="total_ed_rhrs"><?php echo $total_ed_rhrs; ?></td>
<td id="total_ed_receipt"><?php echo $total_ed_receipt;?></td>
<td id="total_ed_issues"><?php echo $total_ed_issues;?></td>
<td id="total_rotary_input"><?php echo $total_rotary_input;?></td>
<td id="total_rotary_output"><?php echo $total_rotary_output;?></td>
<td id="total_rough_sand_r"><?php echo $total_rough_sand_r;?></td>
<td id="total_rough_sand_i"><?php echo $total_rough_sand_i;?></td>
<td id="total_fine_sand_r"><?php echo $total_fine_sand_r;?></td>
<td id="total_fine_sand_i"><?php echo $total_fine_sand_i;?></td>
<td id="total_gas_r"><?php echo $total_gas_r;?></td>
<td id="total_gas_c"><?php echo $total_gas_c;?></td>
<td id="total_water_r"><?php echo $total_water_r;?></td>
<td id="total_water_c"><?php echo $total_water_c;?></td>
<td id="total_diesel_bull_r"><?php echo $total_diesel_bull_r;?></td>
<td id="total_diesel_bull_c"><?php echo $total_diesel_bull_c;?></td>
<td id="total_diesel_bull_rh"><?php echo $total_diesel_bull_rh;?></td>
<!-- $dr_time = explode('.',$total_diesel_bull_rh);
if($dr_time[1] >= 60 ){
$dr_hr = $dr_time[0]+1;
$dr_min = $dr_time[1]-60;
if($dr_min < 10){
$dr_min = '0'.$dr_min;
if($dr_min == 00){
$dr_min = ' ';
}
}
}
else{
$dr_hr = $dr_time[0];
$dr_min = $dr_time[1];
if($dr_min == 00){
$dr_min = ' ';
}
}
if($dr_min == ' '){
echo $dr_hr;
}
else
{
echo $dr_hr .'.'. $dr_min;
} -->
<td id="total_diesel_rotary_bull_r"><?php echo $total_diesel_rotary_bull_r;?></td>
<td id="total_diesel_rotary_bull_c"><?php echo $total_diesel_rotary_bull_c;?></td>
<td id="total_diesel_rotary_bull_rh"><?php echo $total_diesel_rotary_bull_rh;?></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td id="total_power_total"><?php echo $total_power_total;?></td>
<td id="total_engineers"><?php echo $total_engineers;?></td>
<td id="total_operators"><?php echo $total_operators;?></td>
<td id="total_helpers"><?php echo $total_helpers;?></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td></tr>
</table>
<!-- </div>
</main> -->
</div><!-- /.box-body -->
<div class="box-footer ">
<!--*********************************************************************************************************** -->
<div id="specmodel" class="modal fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="width:900px;">
<div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"><center>Abstract Report for Month of - <span id="absdate"> </span><center></h4>
</div>
<div class="modal-body">
<center>
<form id="abstractform">
<table border="2" class="" id="abstracttable">
<thead style="text-align:center;">
<tr> <th class="">S.NO</th> <th class="">Particulars</th> <th class="">Running Hrs</th> <th class="">Per Hour</th> <th class="">Open Stock</th><th class="">Receipt</th><th class="">Total</th><th class="">Consumption</th><th class="">Closing Stock</th><th class="">Physical Stock</th><th class="">Difference</th></tr>
</thead>
<tbody id="modelid">
<tr><td>1</td><td>ED Details</td><td id="RHRS1"></td><td id="PH1"></td><td onkeyup="abstractCalculation(this.id);" class="edit" contenteditable="true" id="OS1"></td><td id="R1"></td><td id="T1"></td><td id="C1"></td><td id="CS1"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS1"></td><td id="D1"></td></tr>
<tr><td>2</td><td>Rotary Dryer</td><td id="RHRS2"></td><td id="PH2"></td><td onkeyup="abstractCalculation(this.id);" class="edit" contenteditable="true" id="OS2"></td><td id="R2"></td><td id="T2"></td><td id="C2"></td><td id="CS2"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" class="edit" id="PS2"></td><td id="D2"></td></tr>
<tr><td>3</td><td>Diesel/Ton-Rotary Dryer</td><td id="RHRS3"></td><td id="PH3"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="OS3"></td><td id="R3"></td><td id="T3"></td><td id="C3"></td><td id="CS3"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS3"></td><td id="D3"></td></tr>
<tr><td>4</td><td>Diesel/bull</td><td id="RHRS4"></td><td id="PH4"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="OS4"></td><td id="R4"></td><td id="T4"></td><td id="C4"></td><td id="CS4"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS4"></td><td id="D4"></td></tr>
<tr><td>5</td><td>TRP Rough sand </td><td id="RHRS5"></td><td id="PH5"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="OS5"></td><td id="R5"></td><td id="T5"></td><td id="C5"></td><td id="CS5"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS5"></td><td id="D5"></td></tr>
<tr><td>6</td><td>TRP Fine sand</td><td id="RHRS6"></td><td id="PH6"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="OS6"></td><td id="R6"></td><td id="T6"></td><td id="C6"></td><td id="CS6"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS6"></td><td id="D6"></td></tr>
<tr><td>7</td><td>TRP Total Sand</td><td id="RHRS7"></td><td id="PH7"></td><td class="" onkeyup="abstractCalculation(this.id);" contenteditable="false" id="OS7"></td><td id="R7"></td><td id="T7" ></td><td id="C7"></td><td id="CS7"></td><td class="" onkeyup="abstractCalculation(this.id);" contenteditable="false" id="PS7"></td><td id="D7"></td></tr>
<tr><td>8</td><td>Gas for Trip</td><td id="RHRS8">-</td><td id="PH8"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="OS8"></td><td id="R8"></td><td id="T8"></td><td id="C8"></td><td id="CS8"></td><td class="edit" onkeyup="abstractCalculation(this.id);" contenteditable="true" id="PS8"></td><td id="D8"></td></tr>
<tr><td>9</td><td>Water</td><td id="RHRS9">-</td><td id="PH9"></td><td class="edit" contenteditable="true" onkeyup="abstractCalculation(this.id);" id="OS9"></td><td id="R9"></td><td id="T9"></td><td id="C9"></td><td id="CS9"></td><td class="edit" contenteditable="true" onkeyup="abstractCalculation(this.id);" id="PS9"></td><td id="D9"></td></tr>
<tr><td>10</td><td>Power</td><td id="RHRS10">-</td><td id="PH10">-</td><td class="" onkeyup="abstractCalculation(this.id);" contenteditable="false" id="OS10">-</td><td id="R10">-</td><td id="T10">-</td><td id="C10"></td><td id="CS10">-</td><td class="" onkeyup="abstractCalculation(this.id);" contenteditable="false" id="PS10">-</td><td id="D10">-</td></tr>
<tr><td>11</td><td>Engineers</td><td id="engineers"></td></tr>
<tr><td>12</td><td>Operators</td><td id="operators"></td></tr>
<tr><td>13</td><td>Helpers</td><td id="helpers"></td></tr>
</tbody>
</table>
</center>
<input type="hidden" name="param1" id="jsonodata">
<input type="hidden" name="param2" id="monthhidden">
</div>
<div class="modal-footer">
<input type="button" class="btn btn-primary" onclick="saveToDB()" value="Save"/>
<input type="button" class="btn btn-primary" onclick="saveExcel()" value="Excel"/>
<input type="button" class="btn btn-primary" data-dismiss="modal" value="Cancel"/>
</form>
</div>
</div>
</div>
</div>
<!--*********************************************************************************************************** -->
</div> <!-- /.box footer -->
</div><!-- /.box -->
</div>
</div>
</section>
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/common.js" charset="utf-8"></script>
<script src="<?php echo base_url()?>assets/tabletoexport/jquery.tableexport.v2.js"></script>
<script type="text/javascript">
$(function(){
//alert($('#month').val());
var name = "Daily Batch Card Listing for" +'-'+ $('#month').val();
$("#dailylistings").tableExport({
bootstrap: true,
separator: ",",
headings: true,
buttonContent: "Export",
addClass: "",
defaultClass: "btn",
defaultTheme: "btn-default",
type: "csv",
fileName: name,
position: "bottom",
stripQuotes: true
});
});
$(document).ready(function(){
$('#dailylisting').DataTable( {
"scrollY": 500,
"scrollX": true,
"ordering": false,
"info": false,
"paging": true,
"searching": false
} );
$('.edit').bind('keypress', function(e)
{
if(((e.which || e.keyCode) == 8) || ((e.which || e.keyCode) == 9) || ((e.which || e.keyCode) == 46) || ((e.which || e.keyCode) == 37) || ((e.which || e.keyCode) == 39))
{
return true;
}
if(e.keyCode == 13)
{
return false;
}
if(((e.which || e.keyCode) < 48) || ((e.which || e.keyCode) > 57))
{
return false;
}
});
$("#month").val('<?php echo $datefordisplay;?>');
$("#month").datepicker({
minViewMode: 1,
//defaultdate:new Date(),
format: 'M-yyyy'
});
$('#abstract').click(function(){
var d = $('#month').val();
$('#absdate').text(d);
$('#specmodel').modal('show');
});
});
</script>
<script>
function saveExcel()
{
var alldata = $("#abstracttable").tableToJSON();
alldata = JSON.stringify(alldata);
// alert(alldata);
var excelpath = "<?php echo base_url().'batchcard/saveBatchCardtoExcel'?>";
var month = $("#month").val();
$('#jsonodata').val(alldata);
$('#monthhidden').val(month);
$('#abstractform').attr('method','POST');
$('#abstractform').attr('action',excelpath);
$('#abstractform').submit();
}
</script>
<script>
function whileModalShow()
{
var os1 = $('#OS1').text() == '' ? '0' : parseFloat($('#OS1').text());
document.getElementById('RHRS1').textContent = parseFloat($('#total_running_hrs').text());
document.getElementById('R1').textContent = parseFloat($('#total_ed_receipt').text());
document.getElementById('C1').textContent = parseFloat($('#total_ed_issues').text());
var PH1 = (parseFloat($('#total_ed_receipt').text()) / parseFloat($('#total_running_hrs').text())).toFixed(3);
if(isNaN(PH1)){PH1 = '0';}
document.getElementById('PH1').textContent = PH1;
document.getElementById('T1').textContent = (parseFloat($('#total_ed_receipt').text()) + parseFloat(os1));
document.getElementById('CS1').textContent = parseFloat($('#T1').text()) - parseFloat($('#C1').text());
if($('#PS1').text() != ''){
document.getElementById('D1').textContent = parseFloat($('#PS1').text()-$('#CS1').text());}
//Rotary Details diesel
var os2 = $('#OS2').text() == '' ? '0' : parseFloat($('#OS2').text());
document.getElementById('RHRS2').textContent = parseFloat($('#total_diesel_rotary_bull_rh').text());
document.getElementById('R2').textContent = parseFloat($('#total_rotary_input').text());
document.getElementById('C2').textContent = parseFloat($('#total_rotary_output').text());
var PH2 = (parseFloat($('#total_rotary_input').text()) / parseFloat($('#total_diesel_rotary_bull_rh').text())).toFixed(3);
if(isNaN(PH2)){PH2 = '0';}
document.getElementById('PH2').textContent = PH2;
document.getElementById('T2').textContent = (parseFloat($('#total_rotary_input').text()) + parseFloat(os2));
document.getElementById('CS2').textContent = parseFloat($('#T2').text()) - parseFloat($('#C2').text());
if($('#PS2').text() != ''){
document.getElementById('D2').textContent = parseFloat($('#PS2').text()-$('#CS2').text());}
//Rotary Details diesel/ton
var os3 = $('#OS3').text() == '' ? '0' : parseFloat($('#OS3').text());
document.getElementById('RHRS3').textContent = parseFloat($('#RHRS2').text());
document.getElementById('R3').textContent = parseFloat($('#total_diesel_rotary_bull_r').text());
document.getElementById('C3').textContent = parseFloat($('#total_diesel_rotary_bull_c').text());
var PH3 = (parseFloat($('#total_diesel_rotary_bull_c').text()) / (parseFloat($('#total_rotary_output').text())/1000)).toFixed(3);
if(isNaN(PH3)){PH3 = '0';}
document.getElementById('PH3').textContent = PH3;
document.getElementById('T3').textContent = (parseFloat($('#total_diesel_rotary_bull_r').text()) + parseFloat(os3));
document.getElementById('CS3').textContent = parseFloat($('#T3').text()) - parseFloat($('#C3').text());
if($('#PS3').text() != ''){
document.getElementById('D3').textContent = parseFloat($('#PS3').text()-$('#CS3').text());}
//Diesel/Bull
var os4 = $('#OS4').text() == '' ? '0' : parseFloat($('#OS4').text());
document.getElementById('RHRS4').textContent = parseFloat($('#total_diesel_bull_rh').text());
document.getElementById('R4').textContent = parseFloat($('#total_diesel_bull_r').text());
document.getElementById('C4').textContent = parseFloat($('#total_diesel_bull_c').text());
var PH4 = (parseFloat($('#total_diesel_bull_c').text()) / (parseFloat($('#total_diesel_bull_rh').text()))).toFixed(3);
if(isNaN(PH4)){PH4 = '0';}
document.getElementById('PH4').textContent = PH4;
document.getElementById('T4').textContent = (parseFloat($('#total_diesel_bull_r').text()) + parseFloat(os4));
document.getElementById('CS4').textContent = parseFloat($('#T4').text()) - parseFloat($('#C4').text());
if($('#PS4').text() != ''){
document.getElementById('D4').textContent = parseFloat($('#PS4').text()-$('#CS4').text());}
//Rough Sand
var os5 = $('#OS5').text() == '' ? '0' : parseFloat($('#OS5').text());
document.getElementById('RHRS5').textContent = parseFloat($('#total_feeding_hrs').text());
document.getElementById('R5').textContent = parseFloat($('#total_rough_sand_r').text());
document.getElementById('C5').textContent = parseFloat($('#total_rough_sand_i').text());
var PH5 = ((parseFloat($('#total_rough_sand_r').text()) + parseFloat($('#total_fine_sand_r').text())) / (parseFloat($('#total_feeding_hrs').text()))).toFixed(3);
if(isNaN(PH5)){PH5 = '0';}
document.getElementById('PH5').textContent = PH5;
document.getElementById('T5').textContent = (parseFloat($('#total_rough_sand_r').text()) + parseFloat(os5));
document.getElementById('CS5').textContent = parseFloat($('#T5').text()) - parseFloat($('#C5').text());
if($('#PS5').text() != ''){
document.getElementById('D5').textContent = parseFloat($('#PS5').text()-$('#CS5').text());}
//Fine Sand
var os6 = $('#OS6').text() == '' ? '0' : parseFloat($('#OS6').text());
document.getElementById('RHRS6').textContent = parseFloat($('#total_feeding_hrs').text());
document.getElementById('R6').textContent = parseFloat($('#total_fine_sand_r').text());
document.getElementById('C6').textContent = parseFloat($('#total_fine_sand_i').text());
var PH6 = ((parseFloat($('#total_rough_sand_r').text()) + parseFloat($('#total_fine_sand_r').text())) / (parseFloat($('#total_feeding_hrs').text()))).toFixed(3);
if(isNaN(PH6)){PH6 = '0';}
document.getElementById('PH6').textContent = PH6;
document.getElementById('T6').textContent = (parseFloat($('#total_fine_sand_r').text()) + parseFloat(os6));
document.getElementById('CS6').textContent = parseFloat($('#T6').text()) - parseFloat($('#C6').text());
if($('#PS6').text() != ''){
document.getElementById('D6').textContent = parseFloat($('#PS6').text()-$('#CS6').text());}
//TRP total Sand
document.getElementById('OS7').textContent = (os5 == ''?'0':parseFloat(os5)) + (os6 == ''?'0':parseFloat(os6));
document.getElementById('RHRS7').textContent = parseFloat($('#total_feeding_hrs').text());
document.getElementById('R7').textContent = parseFloat($('#R5').text()) + parseFloat($('#R6').text());
document.getElementById('C7').textContent = parseFloat($('#C5').text()) + parseFloat($('#C6').text());
var PH7 = ((parseFloat($('#total_rough_sand_r').text()) + parseFloat($('#total_fine_sand_r').text())) / (parseFloat($('#total_feeding_hrs').text()))).toFixed(3);
if(isNaN(PH7)){PH7 = '0';}
document.getElementById('PH7').textContent = PH7;
document.getElementById('T7').textContent = parseFloat($('#T5').text()) + parseFloat($('#T6').text());
document.getElementById('CS7').textContent = parseFloat($('#CS5').text()) + parseFloat($('#CS6').text());
document.getElementById('PS7').textContent = $('#PS5').text() == ''?'0':parseFloat($('#PS5').text()) + $('#PS6').text()==''?'0':parseFloat($('#PS6').text());
document.getElementById('D7').textContent = parseFloat($('#PS7').text()) + parseFloat($('#CS7').text());
//Gas for Trip
var os8 = $('#OS8').text() == '' ? '0' : parseFloat($('#OS8').text());
//document.getElementById('RHRS8').textContent = parseFloat($('#total_running_hrs').text());
document.getElementById('R8').textContent = parseFloat($('#total_gas_r').text());
document.getElementById('C8').textContent = parseFloat($('#total_gas_c').text());
var PH8 = (parseFloat($('#total_gas_c').text()) / (parseFloat($('#R7').text())/1000)).toFixed(3);
if(isNaN(PH8)){PH8 = '0';}
document.getElementById('PH8').textContent = PH8;
document.getElementById('T8').textContent = (parseFloat($('#total_gas_r').text()) + parseFloat(os8));
document.getElementById('CS8').textContent = parseFloat($('#T8').text()) - parseFloat($('#C8').text());
if($('#PS8').text() != ''){
document.getElementById('D8').textContent = parseFloat($('#PS8').text()-$('#CS8').text());}
//WATER
var os9 = $('#OS9').text() == '' ? '0' : parseFloat($('#OS9').text());
//document.getElementById('RHRS8').textContent = parseFloat($('#total_running_hrs').text());
document.getElementById('R9').textContent = parseFloat($('#total_water_r').text());
document.getElementById('C9').textContent = parseFloat($('#total_water_c').text());
var PH9 = (parseFloat($('#OS7').text()) / (parseFloat($('#total_water_c').text()))).toFixed(3);
//if((isNaN(PH9)) || (isFinite(PH9))){PH9 = '0';}
if((isNaN(PH9)) || (isFinite(PH9))){PH9 = PH9;}else{PH9='0';}
document.getElementById('PH9').textContent = PH9;
document.getElementById('T9').textContent = (parseFloat($('#total_water_r').text()) + parseFloat(os9));
document.getElementById('CS9').textContent = parseFloat($('#T9').text()) - parseFloat($('#C9').text());
if($('#PS9').text() != ''){
document.getElementById('D9').textContent = parseFloat($('#PS9').text()-$('#CS9').text());}
//POWER
document.getElementById('C10').textContent = parseFloat($('#total_power_total').text());
//Man POWER Details
document.getElementById('engineers').textContent = parseFloat($('#total_engineers').text());
document.getElementById('operators').textContent = parseFloat($('#total_operators').text());
document.getElementById('helpers').textContent = parseFloat($('#total_helpers').text());
}
$("#specmodel").on("shown.bs.modal", function(e) {
var currentmonth = $('#month').val();
currentmonth = currentmonth.split("-");
var monthnumber = new Date(Date.parse(currentmonth[0] +" 1, 2018")).getMonth()+1;
var currentyearmonth = currentmonth[1]+'-'+(monthnumber <= 9 ? '0'+monthnumber : monthnumber );
//alert(monthnumber);
//alert(currentmonth[1]);
//alert(currentyearmonth);
var currmonth = monthnumber;
var curryear = currentmonth[1];
if(monthnumber == 1)
{
monthnumber = 12;
currentmonth[1] -=1;
}
else{
monthnumber--;}
//alert(monthnumber);
//alert(currentmonth[1]);
$('.content').loader('show');
$.ajax({
data:{param1:monthnumber,param2:currentmonth[1],param3:currentyearmonth},
type:"POST",
url:"<?php echo base_url().'batchcard/getPreviousMonthAbstractDetails'?>",
success:function(data){
//alert(data);
var data = JSON.parse(data);
$('.content').loader('hide');
//alert(data.length);
if(data.length != 0){
$.each(data,function(index,value){
index++;
// if(index == 7)
// {
// alert(value.abstract_details);
// alert(value.close_stock);
// }
if(index < 10)
{
if(index != 7){
var id = 'OS'+index;
//document.getElementById(id).textContent = value.close_stock;
document.getElementById(id).textContent = value.Available;
var PSid = 'PS'+index;
document.getElementById(PSid).textContent = value.physical_stock;
}
}
});
}
else{alert('Open Stock Not Available..!');}
}
});
setTimeout(function(){ whileModalShow(); }, 4000);
//ED Details
});
function abstractCalculation(a)
{
var id = a;
// alert(id);
var num = id.substr(-1);
if(num == '0'){num == '10';}
var text = id.substr(0,2);
// console.log(num+'-'+text);
if( num == 5 || num == 6)
{
var os5 = $('#OS5').text() == ''?'0':parseFloat($('#OS5').text());
var os6 = $('#OS6').text() == ''?'0':parseFloat($('#OS6').text());
document.getElementById('OS7').textContent = parseFloat(os5) + parseFloat(os6);
var t5 = $('#T5').text() == ''?'0':parseFloat($('#T5').text());
var t6 = $('#T6').text() == ''?'0':parseFloat($('#T6').text());
document.getElementById('T7').textContent = parseFloat(t5) + parseFloat(t6);
var cs5 = $('#CS5').text() == ''?'0':parseFloat($('#CS5').text());
var cs6 = $('#CS6').text() == ''?'0':parseFloat($('#CS6').text());
document.getElementById('CS7').textContent = parseFloat(cs5) + parseFloat(cs6);
var ps5 = $('#PS5').text() == ''?'0':parseFloat($('#PS5').text());
var ps6 = $('#PS6').text() == ''?'0':parseFloat($('#PS6').text());
document.getElementById('PS7').textContent = parseFloat(ps5) + parseFloat(ps6);
document.getElementById('D7').textContent = parseFloat($('#PS7').text()) - parseFloat($('#CS7').text());
}
if(text == 'OS')
{
var r = '';
var os = '';
if($('#R'+ num).text() != ''){ r = parseFloat($('#R'+ num).text());} else { r = "0";}
if($('#'+id).text() != ''){ os = parseFloat($('#'+id).text());} else { os = '0';}
document.getElementById('T'+num).textContent = parseFloat(r) + parseFloat(os);
document.getElementById('CS'+num).textContent = parseFloat(parseFloat($('#T'+ num).text()) - parseFloat($('#C'+num).text()));
}
else if(text == 'PS')
{
var cs = '';var ps = '';
if($('#CS'+ num).text() != ''){ cs = parseFloat($('#CS'+ num).text());}else {cs = '0';}
if($('#PS'+ num).text() != ''){ ps = parseFloat($('#PS'+ num).text());}else {ps = '0';}
document.getElementById('D'+num).textContent = parseFloat(ps) - parseFloat(cs);
}
var os7 = $('#OS7').text() == ''?'0':parseFloat($('#OS7').text());
var c9 = $('#C9').text() == ''?'0':parseFloat($('#C9').text());
var PH9 = (parseFloat(os7)/parseFloat(c9)).toFixed(3);
if(isNaN(PH9)){ PH9 = '0';}
document.getElementById('PH9').textContent = PH9;
}
$('#atten').click(function(){
var mon = $('#month').val();
//alert(mon);
$('#att').attr('action','<?php echo base_url().'batchcard/dailyListing/'?>'+mon);
$('#att').submit();
});
function saveToDB()
{
var currentmonth = $('#month').val();
currentmonth = currentmonth.split("-");
var monthnumber = new Date(Date.parse(currentmonth[0] +" 1, 2018")).getMonth()+1;
//alert(monthnumber);
//alert(currentmonth[1]);
var date = new Date();
var d = date.getDate();
date = currentmonth[1]+'-'+monthnumber+'-'+d;
var jsondata = $('#abstracttable').tableToJSON();
jsondata = JSON.stringify(jsondata);
$('.content').loader('show');
$.ajax({
data:{param1:date,param2:jsondata},
type:'POST',
url:"<?php echo base_url().'batchcard/saveAbstractReport'?>",
success:function(data){
$('.content').loader('hide');
if(data){
alert(data)
}
}
});
}
</script>