Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
VE10-Sanjeev 2025-03-15 10:17:44 +00:00
commit 6a970920fc
10 changed files with 214 additions and 116 deletions

View File

@ -116,7 +116,7 @@ class Configurationctrl extends BaseController
function updateconfig() function updateconfig()
{ {
// dd($this->request->getPost());
$ConfigId = $this->request->getPost('ConfigId'); $ConfigId = $this->request->getPost('ConfigId');
$ConfigName = $this->request->getPost('ConfigName'); $ConfigName = $this->request->getPost('ConfigName');
$Comments = $this->request->getPost('Remarks'); $Comments = $this->request->getPost('Remarks');

View File

@ -668,6 +668,8 @@ class Emergencypurchaseorder extends BaseController
$getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim((string)$MaterialCode)); $getAvailableqty = $this->mrir_model->getItemQuantityFromStock(trim((string)$MaterialCode));
$avlQty = 0;
if (count($getAvailableqty) > 0) { if (count($getAvailableqty) > 0) {
$avlQty = $getAvailableqty[0]['Quantity']; $avlQty = $getAvailableqty[0]['Quantity'];
} }

View File

@ -3119,43 +3119,67 @@ class StockController extends BaseController
public function updateTrpProductionDetails($inserts = null, $freshEntry = false) public function updateTrpProductionDetails($inserts = null, $freshEntry = false)
{ {
//getting values from post request
$postData['updateTrpProductionDetails'] = json_decode($this->request->getPost('updateTrpProductionDetails'),true); $postData['updateTrpProductionDetails'] = json_decode($this->request->getPost('updateTrpProductionDetails'),true);
//checking if post data is empty data ?
if (empty($postData['updateTrpProductionDetails'])) { if (empty($postData['updateTrpProductionDetails'])) {
//if empty data , we still check for inserts data is available or not
if (empty($inserts)) { if (empty($inserts)) {
//if both fails return "no data found"
return $this->response->setJSON(['error' => 'No data found to update']); return $this->response->setJSON(['error' => 'No data found to update']);
} else { } else {
//if inserts data is available , then assign to post data
$postData['updateTrpProductionDetails'] = $inserts; $postData['updateTrpProductionDetails'] = $inserts;
} }
} }
$updateTrpProductionDetails = $postData['updateTrpProductionDetails']; $updateTrpProductionDetails = $postData['updateTrpProductionDetails'];
// Extract all dates from input data // Extract all dates from post data
$dates = array_column($updateTrpProductionDetails, 'Date'); $dates = array_column($updateTrpProductionDetails, 'Date');
//format from "d-m-Y" to db "Y-m-d" format
$formattedDates = array_map(fn($date) => $this->convertToDateWithFlexibleFormats($date, ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"), $dates); $formattedDates = array_map(fn($date) => $this->convertToDateWithFlexibleFormats($date, ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"), $dates);
// Fetch all existing records in a single query per table
// Fetch all existing maintenance , production and waste records for the given formatted dates
$existingMaintenance = $this->TrpProductionMaintenance_model->whereIn('date', $formattedDates)->findAll(); $existingMaintenance = $this->TrpProductionMaintenance_model->whereIn('date', $formattedDates)->findAll();
$existingProduction = $this->TrpProduction_model->whereIn('date', $formattedDates)->findAll(); $existingProduction = $this->TrpProduction_model->whereIn('date', $formattedDates)->findAll();
$existingWaste = $this->TrpProductionWaste_model->whereIn('date', $formattedDates)->findAll(); $existingWaste = $this->TrpProductionWaste_model->whereIn('date', $formattedDates)->findAll();
// Map existing records by date for quick lookup
$existingMaintenanceMap = array_column($existingMaintenance, null, 'date');
$existingProductionMap = array_column($existingProduction, null, 'date');
$existingWasteMap = array_column($existingWaste, null, 'date');
$insertMaintenance = []; //getting list of existing dates of maintenance , production and waste records
$existingMaintenanceDateList = array_column($existingMaintenance, null, 'date');
$existingProductionDateList = array_column($existingProduction, null, 'date');
$existingWasteDateList = array_column($existingWaste, null, 'date');
$updateMaintenance = []; $updateMaintenance = [];
$insertProduction = [];
$updateProduction = []; $updateProduction = [];
$insertWaste = [];
$updateWaste = []; $updateWaste = [];
$insertMaintenance = [];
$insertProduction = [];
$insertWaste = [];
foreach ($updateTrpProductionDetails as $data) { foreach ($updateTrpProductionDetails as $data) {
$date = $this->convertToDateWithFlexibleFormats($data['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d"); $date = $this->convertToDateWithFlexibleFormats($data['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d");
// Data arrays // Data arrays
@ -3207,23 +3231,31 @@ class StockController extends BaseController
]; ];
// Check if data already exists // Check if data already exists
if (isset($existingMaintenanceMap[$date])) { if (isset($existingMaintenanceDateList[$date])) {
$dbDataTrpMaintenance['id'] = $existingMaintenanceMap[$date]['id'];
$dbDataTrpMaintenance['id'] = $existingMaintenanceDateList[$date]['id'];
$updateMaintenance[] = $dbDataTrpMaintenance; $updateMaintenance[] = $dbDataTrpMaintenance;
} else { } else {
$insertMaintenance[] = $dbDataTrpMaintenance; $insertMaintenance[] = $dbDataTrpMaintenance;
} }
if (isset($existingProductionMap[$date])) { if (isset($existingProductionDateList[$date])) {
$dbDataTrpProduction['id'] = $existingProductionMap[$date]['id'];
$dbDataTrpProduction['id'] = $existingProductionDateList[$date]['id'];
$updateProduction[] = $dbDataTrpProduction; $updateProduction[] = $dbDataTrpProduction;
} else { } else {
$insertProduction[] = $dbDataTrpProduction; $insertProduction[] = $dbDataTrpProduction;
} }
if (isset($existingWasteMap[$date])) { if (isset($existingWasteDateList[$date])) {
$dbDataTrpWaste['id'] = $existingWasteMap[$date]['id'];
$dbDataTrpWaste['id'] = $existingWasteDateList[$date]['id'];
$updateWaste[] = $dbDataTrpWaste; $updateWaste[] = $dbDataTrpWaste;
} else { } else {
$insertWaste[] = $dbDataTrpWaste; $insertWaste[] = $dbDataTrpWaste;
} }
@ -3233,6 +3265,15 @@ class StockController extends BaseController
$this->db->transBegin(); $this->db->transBegin();
try { try {
// dd($updateMaintenance);
// dd($updateProduction);
// dd($updateWaste);
// dd($insertMaintenance);
// dd($insertProduction);
// dd($insertWaste);
// Insert new records in batch // Insert new records in batch
if (!empty($insertMaintenance)) { if (!empty($insertMaintenance)) {
$this->TrpProductionMaintenance_model->insertBatch($insertMaintenance); $this->TrpProductionMaintenance_model->insertBatch($insertMaintenance);
@ -3272,6 +3313,7 @@ class StockController extends BaseController
public function updateAbstractDetails() { public function updateAbstractDetails() {
$updateAbstractDetails = json_decode($this->request->getPost('updateAbstractDetails'), true); $updateAbstractDetails = json_decode($this->request->getPost('updateAbstractDetails'), true);
if (empty($updateAbstractDetails)) { if (empty($updateAbstractDetails)) {

View File

@ -7511,8 +7511,8 @@ if (!empty($INRSYMBOL)) {
return false; return false;
} else { } else {
// Submit the form using AJAX // Submit the form using AJAX
$('#loader').show(); $('#loader').show();
// disableButtons();
$.ajax({ $.ajax({
url: "<?php echo base_url() ?>emergencypurchaseorder/addNewRevenuePurchaseOrder", url: "<?php echo base_url() ?>emergencypurchaseorder/addNewRevenuePurchaseOrder",
type: "POST", type: "POST",
@ -7531,8 +7531,12 @@ if (!empty($INRSYMBOL)) {
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
// Handle errors // Handle errors
alert("Error: " + error); alert("Error in ajax route - emergencypurchaseorder/addNewRevenuePurchaseOrder: " + error);
// setTimeout(function() { enableButtons(); }, 2000); // setTimeout(function() { enableButtons(); }, 2000);
},
complete: function () {
console.log("Ajax request completed for route -post - emergencypurchaseorder/addNewRevenuePurchaseOrder .");
$('#loader').hide();
} }
}); });
} }

View File

@ -533,7 +533,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Select Supplier</label> <label>Select Supplier</label><span class="text-danger"> * </span>
<?php <?php
if (!empty($Suplist)) { if (!empty($Suplist)) {
foreach ($Suplist as $SID): foreach ($Suplist as $SID):
@ -578,7 +578,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<b><u>Select Delivery By</u></b> <b><u>Select Delivery By</u></b><span class="text-danger"> * </span>
<div style="display:inline-flex;"> <div style="display:inline-flex;">
<div class="centered"> <div class="centered">
<div id="dispatchinternational" style="display:none;"> <div id="dispatchinternational" style="display:none;">
@ -594,7 +594,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
</div> </div>
<div class="form-group col-md-3" id="Schedulediv" style="display:none;"> <div class="form-group col-md-3" id="Schedulediv" style="display:none;">
<label>Schedule By </label> <label>Schedule By </label><span class="text-danger"> * </span>
<input type="hidden" name="beforeSchedule" value="<?php echo $DeliverSchedule; ?>"> <input type="hidden" name="beforeSchedule" value="<?php echo $DeliverSchedule; ?>">
<?php <?php
$data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby', $DeliverSchedule), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110'); $data = array('name' => 'Scheduleby', 'value' => set_value('Scheduleby', $DeliverSchedule), 'id' => 'Scheduleby', 'class' => 'form-control', 'required' => 'true', 'rows' => '3', 'cols' => '40', 'maxlength' => '110');
@ -647,7 +647,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
target="_blank"><u>(Click here)</u></a> target="_blank"><u>(Click here)</u></a>
</div> </div>
<div class="form-group col-md-3" id="ExchangeRateOnDiv" style="display:none;"> <div class="form-group col-md-3" id="ExchangeRateOnDiv" style="display:none;">
<label>Exchange Rate On</label> <label>Exchange Rate On</label><span class="text-danger"> * </span>
<?php <?php
$data = array('type' => 'date', 'name' => 'Exchangerateon', 'value' => set_value('Exchangerateon', $ExchangeRateOn), 'id' => 'Exchangerateon', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;'); $data = array('type' => 'date', 'name' => 'Exchangerateon', 'value' => set_value('Exchangerateon', $ExchangeRateOn), 'id' => 'Exchangerateon', 'class' => 'form-control num', 'required' => 'true', 'onkeypress' => 'return false;');
@ -656,7 +656,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="form-group col-md-3" id="ExchangeRateDiv" style="display:none;"> <div class="form-group col-md-3" id="ExchangeRateDiv" style="display:none;">
<label id="CurrencySymbol">Exchange Rate </label> <label id="CurrencySymbol">Exchange Rate </label><span class="text-danger"> * </span>
<?php <?php
$data = array('name' => 'ExchangeRt', 'value' => set_value('ExchangeRt', $exchangeRate), 'id' => 'ExchangeRt', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'style' => 'text-align:right'); $data = array('name' => 'ExchangeRt', 'value' => set_value('ExchangeRt', $exchangeRate), 'id' => 'ExchangeRt', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'style' => 'text-align:right');
@ -666,7 +666,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="form-group col-md-3" id="placeoforgin"> <div class="form-group col-md-3" id="placeoforgin">
<label>Place of Origin</label> <label>Place of Origin</label><span class="text-danger"> * </span>
<?php <?php
// $data = array('name' => 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); // $data = array('name' => 'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
@ -755,7 +755,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="form-group col-md-3"><input type="hidden" name="beforePaymentmethod" <div class="form-group col-md-3"><input type="hidden" name="beforePaymentmethod"
id="beforePaymentmethod" value="<?php echo $PaymentTerms; ?>"> id="beforePaymentmethod" value="<?php echo $PaymentTerms; ?>">
<label for="payablefrom">Payable Terms</label> <label for="payablefrom">Payable Terms</label><span class="text-danger"> * </span>
<?php <?php
foreach ($Payment as $rl): foreach ($Payment as $rl):

View File

@ -394,10 +394,8 @@ if (!empty($master)) {
<!-- script_sec_starts --> <!-- script_sec_starts -->
<!-- prevent duplicate entries made in the config by checking it during on change event of the config value in add or edit -->
<script> <script>
//prevent duplicate entries made in the config by checking it during on change event of the config value in add or edit
$('#AddConfigValue,#configValue').on('change', function() { $('#AddConfigValue,#configValue').on('change', function() {
let configValue = $(this).val().trim(); // let configValue = $(this).val().trim(); //
@ -446,6 +444,7 @@ if (!empty($master)) {
</script> </script>
<!-- add or update config value -->
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@ -553,7 +552,7 @@ if (!empty($master)) {
//this click function is used for showing material codes in modal window , MC created using a particular configuration value //this click function is used for showing material codes in modal window , MC created using a particular configuration value
$(".config-category").click(function () { $(document).on("click", ".config-category", function () {
@ -664,9 +663,6 @@ if (!empty($master)) {
//final update button for master config add / update action made in the editConfig page //final update button for master config add / update action made in the editConfig page
$('#updateConfigBtnId').click(function() { $('#updateConfigBtnId').click(function() {
alert("final config update..!!");
return;
if($('#ConfigName').val().trim() == ''){ if($('#ConfigName').val().trim() == ''){

View File

@ -1297,7 +1297,7 @@ if (!empty($getlogpodtl)) {
</div> <!-- ends box-body --> </div> <!-- ends box-body -->
<div class="form-row px-4"> <div class="form-row px-1">
<label>Select Purchase Order File</label> <label>Select Purchase Order File</label>
<div class="form-group col-md-12" align="left"> <div class="form-group col-md-12" align="left">
<input type="file" class="" name="POFile" id="POFile"> <input type="file" class="" name="POFile" id="POFile">
@ -1372,7 +1372,7 @@ if (!empty($getlogpodtl)) {
</div> </div>
<div class="form-row px-4 "> <div class="form-row px-1 ">
<div class="form-group col-md-12" align="left"> <div class="form-group col-md-12" align="left">
<label>Request On :</label><?php echo $Reqon; ?><br /> <label>Request On :</label><?php echo $Reqon; ?><br />

View File

@ -17,6 +17,19 @@
text-align: center; text-align: center;
} }
.grab {
cursor: grab; /* Default open-hand cursor */
}
.grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */
}
/* .fht-table td[contenteditable="true"] {
background-color: lightyellow;
color:rgb(13, 7, 7);
} */
.fht-table td:hover { .fht-table td:hover {
background-color: #50bbd9; background-color: #50bbd9;
color: #ffffff; color: #ffffff;
@ -151,7 +164,7 @@
} }
.celda_encabezado_total { .celda_encabezado_total {
background-color:#ffffff !important; background-color: #ffffff !important;
border: 1px solid #ffffff; border: 1px solid #ffffff;
color: #ffffff !important; color: #ffffff !important;
font-weight: bold; font-weight: bold;
@ -219,19 +232,15 @@
} }
td { td {
min-width: 150px; min-width: 100px;
max-width: 150px; max-width: 100px;
}
th {
min-width: 150px;
max-width: 150px;
} }
tfoot tr { tfoot tr {
background-color:rgb(235, 236, 203); background-color:rgb(235, 236, 203);
} }
</style> </style>

View File

@ -151,14 +151,6 @@
text-align: center; text-align: center;
} }
.celda_encabezado_total {
background-color:#ffffff !important;
border: 1px solid #ffffff;
color: #ffffff !important;
font-weight: bold;
padding: 6px 10px;
text-align: center;
}
.celda_normal { .celda_normal {
/*background-color: #fff;*/ /*background-color: #fff;*/
@ -349,6 +341,7 @@ $timeOtions[] = "12:00 AM";
<div class="table-responsive"> <div class="table-responsive">
<table id="trpProductionStockDetailsTableId" class="fht-table table-striped"> <table id="trpProductionStockDetailsTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;"> <thead class="celda_encabezado_general" style="padding: 10px;">
@ -443,7 +436,7 @@ $timeOtions[] = "12:00 AM";
<?php foreach($wcsSupplierList as $supplier){ ?> <?php foreach($wcsSupplierList as $supplier){ ?>
<th class="celda_encabezado_general"><?=$supplier?> </th> <th class="celda_encabezado_general" style="min-width:200px !important;" ><?=$supplier?> </th>
<?php } ?> <?php } ?>
@ -465,7 +458,7 @@ $timeOtions[] = "12:00 AM";
<?php foreach($crsClientList as $client){ ?> <?php foreach($crsClientList as $client){ ?>
<th class="celda_encabezado_general"><?=$client?> </th> <th class="celda_encabezado_general" style="min-width:200px !important;"><?=$client?> </th>
<?php } ?> <?php } ?>
@ -1277,7 +1270,7 @@ $timeOtions[] = "12:00 AM";
</tr> </tr>
</tfoot> </tfoot>
<br><br><br>
<?php } ?> <?php } ?>
@ -1303,7 +1296,7 @@ $timeOtions[] = "12:00 AM";
</div> </div>
<br><br><br>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">

View File

@ -661,6 +661,11 @@
<div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);"> <div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="gasShortageListLabel" align="center">List of Gas Shortages</h5> <h5 class="modal-title" id="gasShortageListLabel" align="center">List of Gas Shortages</h5>
<button type="button" class="btn btn-primary btn-sm" id="exportGasShortage" style="margin-left: 10px;">
Export &nbsp;
<i class="fa fa-download" style="color:white;"></i>
</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
@ -1276,8 +1281,8 @@
if(regex.test(item.MaterialCategory) ){ if(regex.test(item.MaterialCategory) ){
$('#gasShortageHeader').show(); $('#gasShortageHeader').show();
$('#gasShortageListHeader').show(); $('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>'; trIGRHTML +='</tr>';
}else{ }else{
@ -1329,8 +1334,8 @@
if(regex.test(item.MaterialCategory) ){ if(regex.test(item.MaterialCategory) ){
$('#gasShortageHeader').show(); $('#gasShortageHeader').show();
$('#gasShortageListHeader').show(); $('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>'; trIGRHTML +='</tr>';
}else{ }else{
@ -1375,8 +1380,8 @@
if(regex.test(item.MaterialCategory) ){ if(regex.test(item.MaterialCategory) ){
$('#gasShortageHeader').show(); $('#gasShortageHeader').show();
$('#gasShortageListHeader').show(); $('#gasShortageListHeader').show();
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageCalculator" title="gas Shortage Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-gas-pump" style="text-align: center;"></i></a> </td>' ;
trIGRHTML += '<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ; trIGRHTML += '<td style="width: 25px; cursor:pointer;"><a target="_blank" data-toggle="modal" data-target="#gasShortageList" title="gas Shortage List" ><i class="fa fa-solid fa-list" style="text-align: center;"></i></a> </td>' ;
trIGRHTML +='</tr>'; trIGRHTML +='</tr>';
}else{ }else{
@ -2588,18 +2593,19 @@
success: function (response) { success: function (response) {
if (response.status === "success") { if (response.status === "success") {
console.log(response.data);
let data = response.data ; let data = response.data ;
console.log("gas shortage list");
console.log(data);
let tableData = ''; let tableData = '';
data.forEach((val) => { data.forEach((val) => {
let fullCylinderDate = val.fullCylinderDate.split("-").reverse().join("-");
let emptyCylinderDate = val.emptyCylinderDate.split("-").reverse().join('-');
tableData += ` tableData += `
<tr> <tr>
<td>${val.fullCylinderDate}</td> <td>${fullCylinderDate}</td>
<td>${val.emptyCylinderDate}</td> <td>${emptyCylinderDate}</td>
<td>${val.invoiceNo}</td> <td>${val.invoiceNo}</td>
<td>${val.cylinderNo}</td> <td>${val.cylinderNo}</td>
<td>${val.grossWeight}</td> <td>${val.grossWeight}</td>
@ -2608,7 +2614,7 @@
<td>${val.actualWeight}</td> <td>${val.actualWeight}</td>
<td>${val.shortage}</td> <td>${val.shortage}</td>
<td style="display:none">${val.id}</td> <td style="display:none">${val.id}</td>
<td style="width: 25px;"> <td style="width: 25px; cursor: pointer;">
<i class="fa fa-solid fa-edit btnEditGasShortageCalculator" <i class="fa fa-solid fa-edit btnEditGasShortageCalculator"
style="text-align: center;" style="text-align: center;"
data-toggle="modal" data-toggle="modal"
@ -2802,5 +2808,51 @@ $("#gasShortageCalculator, #editGasShortageCalculator").submit(function (event)
}); });
</script>
<script>
$(document).ready(function(){
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function () {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function () {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
let tableId = 'gasShortageTable';
document.getElementById('exportGasShortage').addEventListener('click',function(){
exportTableToExcel(tableId, 'gas_shortage_<?= $date->format('d-m-Y') ?>.xlsx');
})
})
</script> </script>