view igr live changes : GWM

This commit is contained in:
Smart 2024-10-15 16:38:01 +05:30
parent 801d891c61
commit 58e199de2f
3 changed files with 174 additions and 78 deletions

View File

@ -50,14 +50,14 @@ class Inwardgateregister extends BaseController
function viewIGR()
{
$this->global['pageTitle'] = 'View Inward Gate Register';
$data['IGR'] = $this->inwardgateregister_model->ViewigrListing();
$result = $this->inwardgateregister_model->ViewigrListing();
$data['IGR'] = $result[0];
$data['IGRDownload'] = $result[1];
$data['userRole'] = $this->session->get('role');
$data['transporter'] = $this->inwardgateregister_model->transporter();
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL);
// $this->global['pageTitle'] = 'Inward Gate Register Details';
// $data['IGR'] = $this->inwardgateregister_model->igrListing();
// $this->loadViews("viewIGRDetails", $this->global, $data, NULL);
}
function addIGR()

View File

@ -339,7 +339,7 @@ class Inwardgateregister_model extends Model
$result = $query->getResult();
return $result;
}
function ViewigrListing()
function ViewigrListing_old()
{
// $builder = $this->db->table('t_igr_master igr')
@ -368,6 +368,37 @@ class Inwardgateregister_model extends Model
return $result;
}
function ViewigrListing()
{
$builder = $this->db->table('t_igr_master igr')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName , SUM(IGRD.QuantityAsPerInvoice) as ReceivedQuantity, SUM(IGRD.NetWeight) as NetWeight , count(IGRD.IGRNo) as itemCount')
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_igr_details IGRD', 'igr.IGRNo = IGRD.IGRNo')
->where('igr.IGRStatus !=', MRIR_CREATED)
->groupBy('igr.IGRNo')
->orderBy('igr.CreatedDate', 'desc');
$query = $builder->get();
$result = $query->getResult();
$builder2 = $this->db->table('t_igr_details igr_details')
->select('igr.*,PO.IsOpenOrder,PO.DeliveryDate,sup.SupplierName,PO.POType,trans.name as TransporterName,item.MaterialName, igr_details.QuantityAsPerInvoice as ReceivedQuantity , igr_details.NetWeight as NetWeight')
->join('t_igr_master igr', 'igr_details.IGRNo = igr.IGRNo')
->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO')
->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID')
->join('t_transporter trans', 'igr.TransporterId = trans.id' , 'left')
->join('t_materialmaster` item', 'igr_details.MaterialCode = item.MaterialCode' , 'left')
->where('igr.IGRStatus !=', MRIR_CREATED)
->orderBy('igr.CreatedDate', 'desc');
$query2 = $builder2->get();
$result2 = $query2->getResult();
// echo $this->db->getLastQuery()->getQuery();die;
return [$result,$result2];
}
function viewigr($IGRNO)
{

View File

@ -163,34 +163,41 @@
</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;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<div class="row">
<div class="col-md-8">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 47px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<div class="col-md-4">
<button id="downloadExcel" class="btn btn-primary" style="margin-top: 14px;margin-bottom: -11px;margin-right: 25px;float: right;">Download Excel</button>
</div>
</div>
<div class="card-body">
<table id="view_inward_gate_register" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Create Date</th>
<th>Create time</th>
<th>IGR No</th>
<th>PO No</th>
<th>PO No</th>
<th>Supplier Name</th>
<th>Invoice No</th>
<th>Invoice Date </th>
<th>Item</th>
<th>Invoice No</th>
<th>Invoice Date </th>
<th>Item Count</th>
<th>Rec Qty</th>
<th>Net Weight</th>
<th>Vechicle No</th>
@ -201,62 +208,115 @@
</tr>
</thead>
<tbody>
<?php
if (!empty($IGR)) {
$index = 0;
foreach ($IGR as $record) {
$index = $index + 1;
<?php
if(!empty($IGR))
{ $index = 0;
foreach($IGR as $record)
{ $index = $index +1;
$createddate = new DateTime($record->CreatedDate);
$datewithtime = $createddate->format('d-m-Y h:i A');
$date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A');
?>
<tr id="<?php echo $index ?>">
<td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index; ?>" data-inx="<?php echo $index; ?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td>
<td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index; ?>" data-igno="<?php echo $record->IGRNO; ?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <u><?php echo $record->PONO ?></u></a></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
$date = new DateTime($record->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo $record->NetWeight ?></td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
<td>
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
<i class="fa fa-download" style="text-align: center;"></i>
</a>
&nbsp;
<?php if (!empty($record->FilePath)) { ?>
<tr id="<?php echo $index ?>" >
<td align="right"><?php echo $date; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <?php echo $record->IGRNO ?></a></td>
<td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <?php echo $record->PONO ?></a></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
$date = new DateTime($record->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
<td><?php echo $record->itemCount ?></td>
<td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo $record->NetWeight ?></td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
<td>
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
<i class="fa fa-download" style="text-align: center;"></i>
</a>
&nbsp;
<?php if (!empty($record->FilePath)) { ?>
<!-- <a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a> -->
<?php } else if (!empty($record->file)) { ?>
<?php } else if (!empty($record->file)) { ?>
<!-- <a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a> -->
<?php } else { ?>
<?php } else { ?>
<!-- <a target="_blank" data-toggle="modal" data-target="#Fileshow" data-id="<%=index%>" title="Files" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><i class="fa fa-clone" style="text-align: center;"></i></a> -->
<?php } ?>
&nbsp;
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fa fa-history" style="text-align: center;color:#02a8b5"></i>
</a>
&nbsp;
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url() . 'MRIRcontroller/igrdatavalues?IGRNO=' . $record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
</td>
</tr>
<?php } ?>
&nbsp;
<a target="_blank" data-toggle="modal" data-target="#Historyshow" data-id="<%=index%>" title="IGR History" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>">
<i class="fa fa-history" style="text-align: center;"></i>
</a>
&nbsp;
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<table id="InwardgateregistertableForDownload" class="table table-bordered table-hover" style="display: none;">
<thead style="background-color: #ddd;">
<tr>
<th>Create Date</th>
<th>IGR No</th>
<th>PO No</th>
<th>Supplier Name</th>
<th>Invoice No</th>
<th>Invoice Date </th>
<th>Item</th>
<th>Rec Qty</th>
<th>Net Weight</th>
<th>Vechicle No</th>
<th>Driver</th>
<th>Transporter</th>
<th>IGR Status</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($IGRDownload))
{ $index = 0;
foreach($IGRDownload as $record)
{ $index = $index +1;
$createddate = new DateTime($record->CreatedDate);
$date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A');
?>
<tr id="<?php echo $index ?>" >
<td align="right"><?php echo $date; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td>
<td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <u><?php echo $record->PONO ?></u></a></td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
$date = new DateTime($record->DeliveryChellanDate);
echo $date->format('d-m-Y'); ?></td>
<td><?php echo $record->MaterialName ?></td>
<td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo $record->NetWeight ?></td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -415,6 +475,7 @@
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
@ -1612,25 +1673,15 @@
}
$(document).ready(function() {
$('#view_inward_gate_register').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
table = $('#view_inward_gate_register').DataTable({
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
// Default ordering (column index 0, ascending)
// order: [
// [0, 'desc']
// ],
],
responsive: true,
ordering:false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -1700,4 +1751,18 @@
}
});
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadExcel').addEventListener('click', function() {
// Get the HTML table element
var table = document.getElementById('InwardgateregistertableForDownload');
// Convert the HTML table to a worksheet
var wb = XLSX.utils.table_to_book(table, { sheet: "Inward Gate Register" });
// Generate Excel file and trigger the download
XLSX.writeFile(wb, 'InwardGateRegister.xlsx');
});
</script>