stock changes 04-04-2025

This commit is contained in:
vadivelJ96 2025-04-04 17:19:25 +05:30
parent 0b35bb343d
commit 87fc519aa9
4 changed files with 88 additions and 23 deletions

View File

@ -1390,36 +1390,99 @@ $builder = $this->db->table('t_igr_history')
//Mcat -materialCategory
public function getIgrDetailsListByMcatGas($gasMaterialCodes,$gas_status){
$builder = $this->db->table('t_igr_details as t_igrd')
->select("
t_igrd.IGRNO as IGRNO-,
(t_igrd.QuantityAsPerInvoice) as gasCylinderCount,
t_sd.SupplierName,
t_igrm.*,
t_mm.MaterialName,
t_gsd.*
")
->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO')
->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left')
->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID')
->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrd.IGRNO', 'left')
->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left')
->whereIn('t_igrd.MaterialCode', $gasMaterialCodes)
->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ");
switch ($gas_status) {
case "gas_entered":
$builder->where('t_gsd.gas_cylinder_status IS NULL');
$builder = $this->db->table('t_igr_details as t_igrd')
->select("
t_igrd.IGRNO as IGRNO-,
(t_igrd.QuantityAsPerInvoice) as gasCylinderCount,
t_sd.SupplierName,
t_igrm.*,
t_mm.MaterialName,
t_gsd.*
")
->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO')
->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left')
->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID')
->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left')
->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left')
->whereIn('t_igrd.MaterialCode', $gasMaterialCodes)
->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ")
->where('t_gsd.gas_cylinder_status IS NULL');
break;
case "gas_pending":
$builder->where('t_gsd.gas_cylinder_status','gas_pending');
$builder = $this->db->table('t_igr_details as t_igrd')
->select("
t_igrd.IGRNO as IGRNO-,
(t_igrd.QuantityAsPerInvoice) as gasCylinderCount,
t_sd.SupplierName,
t_igrm.*,
t_mm.MaterialName,
t_gsd.*
")
->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO')
->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left')
->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID')
->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left')
->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left')
->whereIn('t_igrd.MaterialCode', $gasMaterialCodes)
->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ")
->where('t_gsd.gas_cylinder_status','gas_pending');
break;
case "gas_returned":
$builder->where('t_gsd.gas_cylinder_status','gas_returned');
$builder = $this->db->table('t_igr_details as t_igrd')
->select("
t_igrd.IGRNO as IGRNO-,
(t_igrd.QuantityAsPerInvoice) as gasCylinderCount,
t_sd.SupplierName,
t_igrm.*,
t_mm.MaterialName,
t_gsd.*,
SUM(t_gsd.grossWeight) as grossWeight,
SUM(t_gsd.tareWeight) as tareWeight,
SUM(t_gsd.netWeight) as netWeight,
SUM(t_gsd.actualWeight) as actualWeight,
SUM(t_gsd.shortage) as shortage,
Count(t_gsd.gas_cylinder_status) as gasCylinderCompletedCount,
(t_igrd.QuantityAsPerInvoice - Count(t_gsd.gas_cylinder_status)) as gasCylinderPendingCount
")
->join('t_igr_master t_igrm', 't_igrm.IGRNO = t_igrd.IGRNO')
->join('t_purchaseorder_master t_pom', 't_igrm.PONO = t_pom.PONO', 'left')
->join('t_supplierdetailsn t_sd', 't_sd.SupplierID = t_pom.SupplierID')
->join('t_gasshortagedetails t_gsd', 't_gsd.IGRNO = t_igrm.IGRNO', 'left')
->join('t_materialmaster t_mm','t_mm.MaterialCode = t_igrd.MaterialCode','left')
->whereIn('t_igrd.MaterialCode', $gasMaterialCodes)
->where("DATE(t_igrd.CreatedDate) >= '2025-04-01' ")
->where('t_gsd.gas_cylinder_status','gas_returned')
->groupBy('t_igrd.IGRNO');
break;
default:
$builder->where('t_gsd.gas_cylinder_status IS NULL');
}

View File

@ -711,6 +711,7 @@ $(document).ready(function () {
if (response.status === "success") {
alert("Gas Shortage Data Saved Successfully!");
$('#gasEnteredDetails').modal('hide'); // Close modal
window.location.reload();
} else {
alert("Error: " + response.message);
}

View File

@ -777,6 +777,7 @@ $(document).ready(function () {
if (response.status === "success") {
alert("Gas Shortage Data Updated Successfully!");
$('#gasPendingDetails').modal('hide'); // Close modal
window.location.reload();
} else {
alert("Error: " + response.message);
}

View File

@ -212,13 +212,13 @@
<!-- cylinderdetails -->
<th>Cylinder No</th>
<th>Gross Weight</th>
<th>Empty Cylinder Date</th>
<th>Tare Weight</th>
<th>Net Weight</th>
<th>Actual Weight</th>
<th>Shortage</th>
<th>Cylinder Pending</th>
<!-- least details -->
@ -249,13 +249,13 @@
<td><?=$gasCylinder['MaterialName']?></td>
<!-- cylinderdetails -->
<td><?=$gasCylinder['cylinderNo']?></td>
<td><?=$gasCylinder['grossWeight']?></td>
<td><?=$gasCylinder['emptyCylinderDate']?></td>
<td><?=$gasCylinder['tareWeight']?></td>
<td><?=$gasCylinder['netWeight']?></td>
<td><?=$gasCylinder['actualWeight']?></td>
<td><?=$gasCylinder['shortage']?></td>
<td><?=$gasCylinder['gasCylinderPendingCount']?></td>