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() function viewIGR()
{ {
$this->global['pageTitle'] = 'View Inward Gate Register'; $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['userRole'] = $this->session->get('role');
$data['transporter'] = $this->inwardgateregister_model->transporter(); $data['transporter'] = $this->inwardgateregister_model->transporter();
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL); $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() function addIGR()

View File

@ -339,7 +339,7 @@ class Inwardgateregister_model extends Model
$result = $query->getResult(); $result = $query->getResult();
return $result; return $result;
} }
function ViewigrListing() function ViewigrListing_old()
{ {
// $builder = $this->db->table('t_igr_master igr') // $builder = $this->db->table('t_igr_master igr')
@ -368,6 +368,37 @@ class Inwardgateregister_model extends Model
return $result; 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) function viewigr($IGRNO)
{ {

View File

@ -163,34 +163,41 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <div class="row">
<input type="hidden" name="table" value="requisition"> <div class="col-md-8">
<label for="fromDate">From:</label> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 47px;">
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <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> <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> <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> <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> <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> <div class="error" id="error"></div>
</form> </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"> <div class="card-body">
<table id="view_inward_gate_register" class="table dt-responsive nowrap w-100"> <table id="view_inward_gate_register" class="table dt-responsive nowrap w-100">
<thead> <thead>
<tr> <tr>
<th>Create Date</th> <th>Create Date</th>
<th>Create time</th>
<th>IGR No</th> <th>IGR No</th>
<th>PO No</th> <th>PO No</th>
<th>Supplier Name</th> <th>Supplier Name</th>
<th>Invoice No</th> <th>Invoice No</th>
<th>Invoice Date </th> <th>Invoice Date </th>
<th>Item</th> <th>Item Count</th>
<th>Rec Qty</th> <th>Rec Qty</th>
<th>Net Weight</th> <th>Net Weight</th>
<th>Vechicle No</th> <th>Vechicle No</th>
@ -201,62 +208,115 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
if (!empty($IGR)) { if(!empty($IGR))
$index = 0; { $index = 0;
foreach ($IGR as $record) { foreach($IGR as $record)
{ $index = $index +1;
$index = $index + 1;
$createddate = new DateTime($record->CreatedDate); $createddate = new DateTime($record->CreatedDate);
$datewithtime = $createddate->format('d-m-Y h:i A');
$date = $createddate->format('d-m-Y'); $date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A'); $time = $createddate->format('h:i A');
?> ?>
<tr id="<?php echo $index ?>"> <tr id="<?php echo $index ?>" >
<td align="right"><?php echo $date; ?></td> <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 ?>"> <?php echo $record->IGRNO ?></a></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"> <?php echo $record->PONO ?></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->SupplierName ?></td> <td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td> <td align="right"><?php
<td align="right"><?php $date = new DateTime($record->DeliveryChellanDate);
$date = new DateTime($record->DeliveryChellanDate); echo $date->format('d-m-Y'); ?></td>
echo $date->format('d-m-Y'); ?></td> <td><?php echo $record->itemCount ?></td>
<td><?php echo $record->MaterialName ?></td> <td><?php echo $record->ReceivedQuantity ?></td>
<td><?php echo $record->ReceivedQuantity ?></td> <td><?php echo $record->NetWeight ?></td>
<td><?php echo $record->NetWeight ?></td> <td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->VehicleNo ?></td> <td><?php echo $record->DriverName ?></td>
<td><?php echo $record->DriverName ?></td> <td><?php echo $record->TransporterName ?></td>
<td><?php echo $record->TransporterName ?></td> <td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td>
<td><?php echo $record->IGRStatus == 'ST074' ? 'Draft' : 'Completed'; ?></td> <td>
<td> <a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>"> <i class="fa fa-download" style="text-align: center;"></i>
<i class="fa fa-download" style="text-align: center;"></i> </a>
</a> &nbsp;
&nbsp; <?php if (!empty($record->FilePath)) { ?>
<?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> --> <!-- <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> --> <!-- <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> --> <!-- <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 } ?> <?php } ?>
&nbsp; &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 ?>"> <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> <i class="fa fa-history" style="text-align: center;"></i>
</a> </a>
&nbsp; &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> --> <!-- <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> </td>
</tr> </tr>
<?php <?php
} }
} }
?> ?>
</tbody> </tbody>
</table> </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 body-->
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
@ -415,6 +475,7 @@
</tr> --> </tr> -->
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
@ -1612,25 +1673,15 @@
} }
$(document).ready(function() { $(document).ready(function() {
$('#view_inward_gate_register').DataTable({ table = $('#view_inward_gate_register').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [ pageLength: 10,
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [ lengthMenu: [
[10, 20, 30, 50, -1], [10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"] [10, 20, 30, 50, "All"]
], // Rows per page options ],
responsive: true, // Responsive table responsive: true,
// Default ordering (column index 0, ascending)
// order: [
// [0, 'desc']
// ],
ordering:false, ordering:false,
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon 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> </script>