ria/app/Views/individualStockdetails.php
2024-09-11 08:54:25 +05:30

530 lines
13 KiB
PHP
Executable File

<?php
$seyear='';
$semonth='';
$sefdate='';
$setdate='';
$setopen='';
$setadd='';
$setreduce='';
$settotal='';
$setclose='';
//print_r($field_det);die();
if(!empty($field_det))
{
$seyear=$field_det['year'];
$semonth=$field_det['month'];
$sefdate=$field_det['fdate'];
if($field_det['tdate'] !='0')
{
$setdate=$field_det['tdate'];
}
$setopen=$field_det['open'];
$setadd=$field_det['addition'];
$setreduce=$field_det['reduce'];
$settotal=$setopen+$setadd;
$setclose=$settotal-$setreduce;
}
if($seyear == '-1')
{
$seyear ='';
}
//echo $seyear;die();
$material='';
$code='';
$product='';
foreach($getdata as $ge)
{
$material=$ge->MaterialName;
$code = $ge->ProductID;
$product = $ge->product_name;
}
//echo $seyear;die();
$monthname='';
if($semonth == '1')
{
$monthname='January';
}
if($semonth == '2')
{
$monthname='February';
}
if($semonth == '3')
{
$monthname='March';
}
if($semonth == '4')
{
$monthname='April';
}
if($semonth == '5')
{
$monthname='May';
}
if($semonth == '6')
{
$monthname='June';
}
if($semonth == '7')
{
$monthname='July';
}
if($semonth == '8')
{
$monthname='August';
}
if($semonth == '9')
{
$monthname='September';
}
if($semonth == '10')
{
$monthname='October';
}
if($semonth == '11')
{
$monthname='November';
}
if($semonth == '12')
{
$monthname='December';
}
?>
<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;
}
</style>
<script>
<script>
$(function() {
//Initialize Select2 Elements
$("#Finyear").select2();
// $("#fdate").datepicker({
// //maxDate : 'now',
// dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
// });
var year = (new Date).getFullYear();
$( "#fdate" ).datepicker({
minDate: new Date(year, 0, 1),
maxDate: new Date(year, 11, 31),
dateFormat: 'dd-mm-yy',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
$( "#tdate" ).datepicker({
minDate: new Date(year, 0, 1),
maxDate: new Date(year, 11, 31),
dateFormat: 'dd-mm-yy',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
// $("#tdate").datepicker({
// //maxDate : 'now',
// dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
// });
});
</script>
<style>
.content {
Padding:0% ! important;
}
.num{
text-align:right;
}
#receipt { margin-left: 2px; }
#total{margin-left: 2px;}
</style>
<div class="content-wrapper" style="min-height:537">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> Stock Abstract of (<?php echo $material.$product ." - ".$code; ?>)</center>
<?php if(!empty($seyear)){ if($seyear !='-1'){?><h4> <center>For the Year of <?php echo $seyear;?></center></h4> <?php } }?>
<?php if(!empty($semonth)){?><h4> <center> month of <?php echo $monthname;?></center></h4> <?php }?>
<?php if((empty($semonth))&&empty($seyear)){
if(($sefdate !='')&&($setdate !=''))
{
?><h4> <center> from <?php echo $sefdate;?> to <?php echo $setdate;?></center></h4> <?php } }?>
</h1>
</section>
</br>
</br>
<section class="content">
<div id="content"></div>
<?php
// $attributes = array('class' => 'form-label-left materialstockreport','name' => 'materialstockreport','id' => 'materialstockreport');
echo form_open(base_url().'batchcard/MaterailStockReport',$attributes);
?>
<div class="row" style="padding:0% 2%">
<div class="col-md-12" >
<div class="col-md-2">
<label>Year</label>
<?php
$data = array('name' => 'Finyear','value' => set_value('Finyear',$seyear),'id'=>'Finyear', 'class' => 'form-control','onkeypress'=>'return false;');
echo form_input($data);
?>
</div>
<div class="col-md-2">
<label>Month</label>
<div class="input-group">
<?php
$data = array('name' => 'month','value' => set_value('month',$monthname),'id'=>'month', 'class' => 'form-control' ,'onkeypress'=>'return false;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>From Date</label>
<div class="form-group">
<?php
$data = array('name' => 'fdate','value' => set_value('fdate',$sefdate),'id'=>'fdate', 'class' => 'form-control' , 'onkeypress'=>'return false;');
echo form_input($data);
?>
</div>
</div>
<div class="col-md-2">
<label>To Date</label>
<div class="form-group">
<?php
$data = array('name' => 'tdate','value' => set_value('tdate',$setdate),'id'=>'tdate', 'class' => 'form-control' ,'onkeypress'=>'return false;');
echo form_input($data);
?>
</div>
</div>
<!-- <div class="col-md-2">
<label style="color: #B0C4DE"></label>
<div class="form-group"><br/>
<a class="btn btn-success font getdetails" ID="getdetails" onclick="GetStockDetails();" > &nbsp;&nbsp;<span class="bold">Get Report</span></a>
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report">
</div>
</div> -->
</div>
<div class="row" style="padding:0% 2%">
<div><b>Abstract:</b></div>
</br>
<div>
<div class="col-md-2"><label>Opening Stock</label></br>
<div class="form-group">
<input type="text" name="openstock" id="openstock" size="8" value="<?php echo $setopen;?>">
</div>
</div>
<div class="col-md-2"><label>Receipt</label></br>
<div class="form-group">
<input type="text" name="receipt" id="receipt" size="8" value="<?php echo $setadd;?>">
</div>
</div>
<div class="col-md-2"><label>Total</label></br>
<div class="form-group">
<input type="text" name="total" id="total" size="8" value="<?php echo $settotal;?>">
</div>
</div>
<div class="col-md-2"><label>Issue</label></br>
<div class="form-group">
<input type="text" name="issue" id="issue" size="8" value="<?php echo $setreduce;?>">
</div>
</div>
<div class="col-md-2"><label>Closing Stock</label></br>
<div class="form-group">
<input type="text" name="closingstock" id="closingstock" size="8" value="<?php echo $setclose?>">
</div>
</div>
</div>
</div>
<!-- <div class="col-md-offset-8">
<a class="btn btn-success font getdetails" ID="getdetails" > &nbsp;&nbsp;<span class="bold">Get Report</span></a>
</div> -->
</br>
</br>
<div class="col-md-12">
<div class="box-body">
<div>
<table id="dataTableHistoriek" class="table table-bordered table-hover editableTable" style="font-size:12px;">
<thead>
<tr >
<th>SlNo</th>
<th>Date</th>
<th>Material Name</th>
<th>Receipt/Issue</th>
<th>Quantity</th>
<th>Total</th>
<th>Reference</th>
</tr>
</thead>
<tbody>
<?php
$index =0;
if(!empty($getdata))
{
foreach($getdata as $ge)
{
$index++;
// $beforestock= $ge->stock;
// $Openingstock = $beforestock-($ge->AvailableStock+$ge->Addition+$ge->Reduce);
?>
<tr>
<td><?php echo $index?></td>
<td><?php echo $ge->Cdate;?></td>
<td><?php echo $ge->MaterialName.$ge->product_name;?></td>
<td><?php echo $ge->Transaction_type?></td>
<td><?php echo $ge->Addition;
if($ge->Reduce != 0){ echo $ge->Reduce;}?></td>
<td><?php echo $ge->AvailableStock;?></td>
<?php if($ge->Ref_Type == 'Final Product'){?>
<!-- <td><?php echo "FP".$ge->Ref_No?></td> -->
<td> <a href="<?php echo base_url().'EditFinalProduct?FPId='.$ge->Ref_No.'&check='."1"; ?>"><?php echo "FP".$ge->Ref_No?></a></td>
<?php }?>
<?php if($ge->Ref_Type != 'Final Product'){?>
<td><?php echo $ge->Ref_No?></td>
<?php } ?>
</tr>
<?php } }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var month = <?php echo json_encode($semonth, JSON_PRETTY_PRINT)?>;
var year = <?php echo json_encode($seyear, JSON_PRETTY_PRINT)?>;
document.getElementById("Finyear").readOnly = true;
document.getElementById("month").readOnly = true;
document.getElementById("fdate").readOnly = true;
document.getElementById("tdate").readOnly = true;
//$('#month').val(month);
//$('#Finyear').val(year);
$('#fdate').datepicker('disable');
var OpeningStock = <?php echo json_encode($setopen, JSON_PRETTY_PRINT)?>;
var Addition = <?php echo json_encode($setadd, JSON_PRETTY_PRINT)?>;
var reduce = <?php echo json_encode($setreduce, JSON_PRETTY_PRINT)?>;
var total = parseFloat(Openingstock)+parseFloat(Addition);
var closingstock = parseFloat(total)-parseFloat(reduce);
//alert(total)
$('#openstock').val(OpeningStock);
$('#receipt').val(Addition);
$('#total').val(total);
$('#issue').val(reduce);
$('#closingstock').val(closingstock);
</script>
<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 src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script>
$(document).ready(function() {
$.fn.dataTable.moment( 'DD-MM-YYYY' );
table = $('#dataTableHistoriek').DataTable( {
"aaSorting": [[ 0, "asc" ]],
"dom": "<'row'<'col-md-6'l><'col-md-6'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: 'Report -Individual Material Stock Abstract',
exportOptions: {
columns: ':visible'
}
},
'colvis'
]
} );
} );
</script>