siddharth_application/application/views/batchcard_stockdetails.php
2018-05-09 13:04:53 +00:00

415 lines
9.3 KiB
PHP
Executable File

<?php
// print_r($data['previousmonthclosingstock']);
// print_r($previousmonthclosingstock);
// echo 'viewpage'.'<br>';
// $value = array_keys($data['previousmonthclosingstock']);
// echo $array[$value[0]];
if(!empty($previousmonthclosingstock))
{
//print_r($previousmonthclosingstock[0]);
//$value = array_keys($previousmonthclosingstock[0]);
//$premonopen = $previousmonthclosingstock[0]->$value[0];
foreach($previousmonthclosingstock[0] as $key=>$value){
//echo $value;
$premonopen = $value;
}
}
else
{
$premonopen = 0;
}
// if(!empty($data['previousmonthclosingstock']))
// {
// $premonopen = $data['previousmonthclosingstock'];
// }
// else
// {
// $premonopen = 0;
// }
?>
<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">
<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: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: #000;
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;
}
</style>
<?php
//print_r($allhourdata);
?>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Batch Card - Stock Details</center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<!--<center><h3 class="box-title">-->
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<form id="filter" name="filter" method="POST" action="<?php echo base_url().'batchcard/getStockDetails'?>">
<div class="col-md-2">
<input type="text" id="fromdate" class="form-control" name="fromdate">
</div>
<div class="col-md-2">
<select id="stockname" name="stockname" class="form-control select2">
<option value="-1">Select Stock Name</option>
<option value="1">ED Details</option>
<option value="2">Rotary Dryer</option>
<option value="3">Diesel/Ton-Rotary Dryer</option>
<option value="4">Diesel/bull</option>
<option value="5">TRP Rough sand </option>
<option value="6">TRP Fine sand</option>
<option value="7">Gas for Trip</option>
<option value="8">Water</option>
</select>
</div>
<div class="col-md-2">
<input type="button" id="click" class="btn btn-primary" value="click">
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<br/>
<main class="main">
<div class="ContenedorTabla">
<table id="batchcardlisting" class="table table-hover table-bordered ">
<thead style="background-color:#ddf">
<tr>
<th class="" style="width:35px;">Date</br></th> <th class="">Open Stock</th><th class="">Receipt</th><th class="">Total</th><th class="">Consumption</th><th class="">Closing Stock</th>
</tr>
</thead>
<tbody id="specAppend">
<?php
if(!empty($currentmonthstockdetails))
{
$currentclose = 0;
$pre = null;
foreach($currentmonthstockdetails as $key=>$data)
{
$total = 0;
if($key == 0){
//$total = $total + $data->ed_receipt;
$total = $total+$premonopen+$data->ed_receipt;
}
else
{
$total = $data->ed_receipt + $pre['preclose'];
}
$close = ($total - $data->ed_issues);
$currentclose = ($total - $data->ed_issues);
//if($pre){ //echo $key; print_r($pre);}
?>
<tr>
<td style="text-align:right;"><?= date_format(date_create($data->ddate),'d-m-Y');?></td>
<td style="text-align:right;"><?php if($key == 0){ /**echo $premonopen;*/ echo empty($premonopen)?'0':$premonopen; } else {echo $pre['preclose'];}?> </td>
<td style="text-align:right;"><?= $data->ed_receipt;?></td>
<td style="text-align:right;"><?= $total;?></td>
<td style="text-align:right;"><?= $data->ed_issues;?></td>
<td style="text-align:right;"><?php
echo $currentclose;
?></td>
</tr>
<?php
$pre = array('preclose'=>$currentclose);
}
}
?>
</div>
</main>
</tbody>
</table>
<p>&nbsp;</p>
<div class="row">
</div>
</div><!-- /.box-body -->
<!-- <div class="box-footer clearfix">
</div> -->
</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 () {
$('#batchcardlisting').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": false,
"aaSorting": [[ 0, "asc" ]],
"info": true,
"autoWidth": true,
});
var name = "Stock Report for" +
$("#stockname option:selected").text()+'-'+$('#fromdate').val();
$("#batchcardlisting").tableExport({
bootstrap: true,
separator: ",",
headings: true,
buttonContent: "Export",
addClass: "",
defaultClass: "btn",
defaultTheme: "btn-default",
type: "csv",
fileName: name,
position: "bottom",
stripQuotes: true
});
});
</script>
<script>
$(document).ready(function(){
$('#fromdate').val("<?php print_r($selmonth);?>");
//alert("<?php print_r($selstockvalue);?>");
$('#stockname').val("<?php echo $selstockvalue;?>");
$('#fromdate').datepicker({
minViewMode: 1,
//defaultdate:new Date(),
format: 'M-yyyy'
});
$('#todate').datepicker({
//minDate : 'year+16',
maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});
$('#stockname').select2();
//$('#batchcardlisting').CongelarFilaColumna({lboHoverTr:true});
});
$('#click').click(function(){
var fd = $('#fromdate').val() ;
var sn = $('#stockname').val();
if(fd != '' && sn != -1)
{
$('#filter').submit();
}
else
{
alert("Need Date and Stock Name");
}
});
</script>