ria/app/Views/Report_attach_inward.php
2025-04-24 03:57:39 +00:00

606 lines
18 KiB
PHP
Executable File

<script>
$(document).ready(function() {
$("#client_name").select2();
$("#financialyear").select2();
$("#month").select2();
});
</script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style>
table {
width: auto;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Report</a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);"> Inward</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title"><b> Inward Summary
</b></h4>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<!-- <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> -->
<div class="card-body">
<form method="post" action="<?php echo base_url('Report_purchase_attach'); ?>">
<div class="row">
<div class="col-4">
<label for="client_name">
<?php echo 'Supplier'; ?>
</label>
<select class="form-control" id="client_name" name="client_name">
<option value="">Select Supplier</option>
<?php
foreach ($cust as $item): { ?>
<option
<?php if (isset($client_name) && ($client_name == $item->SupplierName)) {
echo 'selected';
} ?>
value="<?php echo $item->SupplierName; ?>"><?php echo $item->SupplierName; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-4">
<label for="to_date">
<?php echo 'Year'; ?>
</label>
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach ($finyear as $item): { ?>
<option value="<?php echo $item->financial_year; ?>" <?php if (isset($financialyear) && ($financialyear == $item->financial_year)) {
echo 'selected';
} ?>><?php echo $item->financial_year; ?></option>
<?php }
endforeach; ?>
</select>
</div>
<div class="col-4">
<label for="month">
<?php echo 'Month'; ?>
</label>
<select class="form-control" id="month" name="month">
<option value="">Select Month</option>
<option value="January" <?php if (isset($month) && ($month == "January")) {
echo 'selected';
} ?>>January</option>
<option value="February" <?php if (isset($month) && ($month == "February")) {
echo 'selected';
} ?>>February</option>
<option value="March" <?php if (isset($month) && ($month == "March")) {
echo 'selected';
} ?>>March</option>
<option value="April" <?php if (isset($month) && ($month == "April")) {
echo 'selected';
} ?>>April</option>
<option value="May" <?php if (isset($month) && ($month == "May")) {
echo 'selected';
} ?>>May</option>
<option value="June" <?php if (isset($month) && ($month == "June")) {
echo 'selected';
} ?>>June</option>
<option value="July" <?php if (isset($month) && ($month == "July")) {
echo 'selected';
} ?>>July</option>
<option value="August" <?php if (isset($month) && ($month == "August")) {
echo 'selected';
} ?>>August</option>
<option value="September" <?php if (isset($month) && ($month == "September")) {
echo 'selected';
} ?>>September</option>
<option value="October" <?php if (isset($month) && ($month == "October")) {
echo 'selected';
} ?>>October</option>
<option value="November" <?php if (isset($month) && ($month == "November")) {
echo 'selected';
} ?>>November</option>
<option value="December" <?php if (isset($month) && ($month == "December")) {
echo 'selected';
} ?>>December</option>
</select>
</div>
</div>
<div class="row mt-2">
<div class="col-md-2 ">
<label for="from_date">
<?php echo 'From Date'; ?>
</label>
<div class="input-group">
<input name="from_date" id="max-date" class="form-control datepicker" autocomplete="off" value="<?php if (isset($from_date)) {
echo $from_date;
} ?>">
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php echo 'To Date'; ?>
</label>
<div class="input-group">
<input name="to_date" id="min-date" class="form-control datepicker" autocomplete="off" value="<?php if (isset($to_date)) {
echo $to_date;
} ?>">
</div>
</div>
<div class="col-md-8 mt-2 text-right">
<input type="button" class="btn btn-danger" value="Reset" onclick="window.location.href='<?= base_url('Report_purchase_inward') ?>';">
<input type="submit" class="btn btn-success ml-2" name="btn_submit" value="View Report">
</div>
</div>
</form>
<div class="form-group has-feedback"></div>
<div class="modal fade" id="Fileshow" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<form>
<div class="modal-content" style="width:800px;">
<!-- Table to show the line item of po -->
<div id="content"> </div>
<table class="table table-bordered" id="Inwardgateregistertable1" style="font-size:12px;">
<thead style="background-color:#ffffff;">
<tr>
<th>SNo</th>
<th>BillNO</th>
<th>PONO</th>
<th>FileName</th>
</tr>
</thead>
<tbody id="tbleAppend1">
</tbody>
</table>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
<div class="table-responsive">
<table class="table table-bordered table-hover" id="cc">
<thead>
<tr>
<th style="text-align:center">PO No</th>
<th style="text-align:center">IGR Created Date</th>
<th style="text-align:center">Material Received Date</th>
<th style="text-align:center">Supplier Name</th>
<th style="text-align:center">Total &nbsp;(&#8377;)</th>
<th style="text-align:center">Attachments</th>
</tr>
</thead>
<tbody>
<?php if (!empty($purchase)) {
$tot_tot = 0;
//print_r($purchase); return false;
foreach ($purchase as $rel) {
// print_r($rel);
// $newArray = array();
// foreach($multi as $array) {
// foreach($array as $k=>$v) {
// $newArray[$k] = $v;
// }
// }
?>
<tr>
<td><span>
<a href="<?php echo base_url() . 'purchaseorder/CreatePOPrint?PONO=' . $rel['pono'], '&ReqType=' . $rel['potype']; ?>"><?php echo $rel['pono']; ?></a>
</span></td>
<td style="text-align:center"><span><?php echo $rel['created_date']; ?></span></td>
<td style="text-align:center"><span><?php echo $rel['materialrcvddate']; ?></span></td>
<td><span>
<a href="<?= base_url() ?>report/ilink_purchase?po=<?php echo $rel['pono']; ?>"><?php echo $rel['supplier_name']; ?> </a>
</span></td>
<td style="text-align:right">
<span><?php
$tot_tot = $tot_tot + round($rel['total'], 2);
echo $rel['total'];
?></span>
</td>
<!-- $record->IGRNO.'-'.$record->PONO -->
<td style="text-align:center"><span>
<?php
if (!empty($rel['file'])) { ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm splpofile" id="<?php echo $rel['igrn'] . '-' . $rel['pono']; ?>">Download</button></a>
<?php } elseif (!empty($rel['ifile'])) { ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel['igrn'] . '-' . $rel['pono']; ?>">Download</button></a>
<?php } elseif (!empty(sizeof($rel['Infiles'])) != 0) { ?>
<a target="_blank" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm IGRfile" id="<?php echo $rel['igrn'] . '-' . $rel['pono']; ?>">Download</button></a>
<?php } else {
echo "N/A";
}
?>
</span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td class="amount" style="text-align:right">
<strong><?php {
echo number_format($tot_tot, 2, '.', '');
}
?></strong>
</td>
<td><strong>&nbsp</strong></td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
<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>
// Bootstrap datepicker
// Set up your table
$('.IGRfile').click(function() {
var id = $(this).attr('id');
//alert(id);
var igr = id.substring(0, 9);
//alert(igr);
var po = id.substring(10, 33);
//alert(po);
$("#Fileshow").modal("show");
$.ajax({
data: {
id: igr,
id1: po
},
type: "POST",
//dataType: 'json',
url: "<?php echo base_url() ?>report/Viewnormaligrfiles",
success: function(data) {
//console.log((data));
// var trHTML = '';
// $.each($.parseJSON(data), function (i, item) {
var trHTML = '';
var trHTML = '';
var FilePath = '';
var Filename = '';
var PONO = '';
var BillNO = '';
$.each($.parseJSON(data), function(i, item) {
if (item.file == null) {
if (item.Remarks == null) {
//alert()
PONO = item.PONO;
BillNO = item.BillNo;
Filename = item.FilePath;
FilePath = "<?php echo base_url() ?>public/uploads/Igrfiles/" + item.FilePath;
} else {
Filename = "BillDetails";
PONO = item.PONO;
BillNO = item.BillNo;
FilePath = item.FilePath;
}
} else {
Filename = item.file;
PONO = item.pono;
BillNO = '-';
FilePath = item.file;
}
// i=i+1;
// trHTML += '<tr>' +
// '<td align="right">' + i + '</td>' +
// '<td>' + item.BillNo+ '</td>' +
// '<td>' + item.PONO+ '</td>' +
// '<td><a target="_blank" href = <?php echo base_url() ?>public/uploads/Igrfiles/'+item.FilePath+'>'+ item.FilePath +'</a></td>' +
// // '<td>' +item.FilePath+"<?php echo base_url() . 'public/uploads/BillFiles/' ?>"> +'</td>'
// '</tr>';
if (Filename != null) {
i = i + 1;
trHTML += '<tr id=' + i + '>' +
'<td align="right">' + i + '</td>' +
'<td id="billno' + i + '">' + BillNO + '</td>' +
'<td>' + PONO + '</td>' +
'<td id="file' + i + '"><a target="_blank" href = ' + FilePath + '>' + Filename + '</a></td>' +
// '<td name="filepathname" id="filepathname" onclick="openbillmodel('+i+');"><i class="fa fa-pencil"></i></td>' +
'</tr>';
}
});
$("#tbleAppend1").empty();
$('#Inwardgateregistertable1 > tbody').append(trHTML);
}
});
});
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
$('.splpofile').click(function() {
var id = $(this).attr('id');
$("#Fileshow").modal("show");
$.ajax({
data: {
id: id
},
type: "POST",
//dataType: 'json',
url: "<?php echo base_url() ?>report/Viewfiles",
success: function(data) {
//console.log((data));
var trHTML = '';
$.each($.parseJSON(data), function(i, item) {
i = i + 1;
trHTML += '<tr>' +
'<td align="right">' + i + '</td>' +
'<td>' + item.BillNo + '</td>' +
'<td>' + item.PONO + '</td>' +
'<td><a target="_blank" href = <?php echo base_url() ?>public/uploads/BillFiles/' + item.FilePath + '>' + item.FilePath + '</a></td>' +
// '<td>' +item.FilePath+"<?php echo base_url() . 'public/uploads/BillFiles/' ?>"> +'</td>'
'</tr>';
});
$("#tbleAppend1").empty();
$('#Inwardgateregistertable1 > tbody').append(trHTML);
}
});
});
$.fn.dataTable.moment('DD-MM-YYYY');
table = $('#cc').DataTable({
"language": {
"emptyTable": "<center> Data Not Found ! </center>"
},
"aaSorting": [
[2, "desc"]
],
"autoWidth": false,
orderCellsTop: true,
"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: 'Report Attachment-Inward',
title: $('h3').text(),
exportOptions: {
columns: ':visible'
}
},
'colvis'
],
"footerCallback": function(row, data, start, end, display) {
var api = this.api(),
data;
// Remove the formatting to get integer data for summation
var intVal = function(i) {
return typeof i === 'string' ?
parseFloat(i.replace(/[^0.00-9.00]+/g, "") * 1) :
typeof i === 'number' ?
parseFloat(i) : 0;
};
FinalTotal = api
.column(4, {
search: 'applied'
})
.data()
.reduce(function(a, b) {
return intVal(a) + intVal(b);
}, 0);
$(api.column(4).footer()).html(FinalTotal.toFixed(2).bold());
}
});
});
$(function() {
//var dateFormat = "mm/dd/yy",
from = $("#min-date")
.datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on("change", function() {
to.datepicker("option", "minDate", getDate(this));
}),
to = $("#max-date").datepicker({
dateFormat: "dd-mm-yy",
defaultDate: "+0d",
changeMonth: true,
//numberOfMonths: 1
})
.on("change", function() {
from.datepicker("option", "maxDate", getDate(this));
});
function getDate(element) {
var date;
try {
date = $.datepicker.parseDate(dateFormat, element.value);
} catch (error) {
date = null;
}
return date;
}
});
function Reset() {
$('#mySelect').val('');
}
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
$(document).ready(function() {
// Initialize the DataTable
var table = $('#cc').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'excel' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
ordering: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
},
emptyTable: '<div style="text-align:center;">Data Not Found!</div>'
}
});
});
</script>