diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index b7e1fb70..c162bb3a 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1203,9 +1203,13 @@ class Inwardgateregister_model extends Model public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month, $remark) { + + $month = new \DateTime($month . "-01"); // Create DateTime for the first day of the month + + $builder = $this->db->table('t_igr_details'); - // 1. Select the necessary columns + $builder->select( 't_igr_details.IGRNO, t_igr_details.MaterialCode, @@ -1218,14 +1222,17 @@ class Inwardgateregister_model extends Model t_igr_details.QuantityAsPerInvoice as Qty, issd.*' ); + - // 2. Apply the most selective WHERE clause(s) first - in this case, the date range - $nowIST = new \DateTime('now', new \DateTimeZone('Asia/Kolkata')); + $builder->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO'); + $builder->join('t_incomingsilicasanddetails issd', 'issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode', 'left'); + $builder->join('t_materialmaster materialMaster', 'materialMaster.MaterialCode = t_igr_details.MaterialCode'); + $builder->join('t_configdetails cd', 'cd.key = materialMaster.Category', 'left'); + $builder->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left'); + $builder->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left'); - $builder->where('Date(t_igr_details.CreatedDate) >=', $nowIST->format('Y-m-01 00:00:00')); - $builder->where('Date(t_igr_details.CreatedDate) <=', $nowIST->format('Y-m-t 23:59:59')); - - // 3. Apply other WHERE clause conditions + $builder->where('Date(t_igr_details.CreatedDate) >=', $month->format('Y-m-01 00:00:00')); + $builder->where('Date(t_igr_details.CreatedDate) <=', $month->format('Y-m-t 23:59:59')); $builder->whereIn('t_igr_details.MaterialCode', $materialCodes); $builder->where('t_igr_details.QuantityAsPerInvoice <>', 0); @@ -1234,25 +1241,15 @@ class Inwardgateregister_model extends Model $builder->where('issd.remark', $remark); } - // 4. Apply JOIN clauses - $builder->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO'); - $builder->join('t_incomingsilicasanddetails issd', 'issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode', 'left'); - $builder->join('t_materialmaster materialMaster', 'materialMaster.MaterialCode = t_igr_details.MaterialCode'); - $builder->join('t_configdetails cd', 'cd.key = materialMaster.Category', 'left'); - $builder->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left'); - $builder->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left'); - - // 5. Apply GROUP BY clause + $builder->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode'); - - // 6. Apply ORDER BY clause + $builder->orderBy('t_igr_details.CreatedDate', 'asc '); - - // 7. Get the query results + $query = $builder->get(); - return $query->getResultArray(); + } public function getHistoryDetailsforEmail($igr) diff --git a/app/Views/stock/CoatingMachineDetail.php b/app/Views/stock/CoatingMachineDetail.php index bc775cee..60aff806 100644 --- a/app/Views/stock/CoatingMachineDetail.php +++ b/app/Views/stock/CoatingMachineDetail.php @@ -373,13 +373,13 @@ @@ -387,13 +387,13 @@ @@ -402,7 +402,7 @@ title="Add Entry" data-target="#coatingMachineDetailModal" data-toggle="modal" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" > @@ -438,11 +438,19 @@
+ modify('first day of this month')->format('Y-m-d'); ?> + modify('last day of this month')->format('Y-m-d'); ?> + format('Y-m-d'); ?> +
* - +
diff --git a/app/Views/stock/bagStockDetails.php b/app/Views/stock/bagStockDetails.php index 4fd3fc3f..13341b9f 100644 --- a/app/Views/stock/bagStockDetails.php +++ b/app/Views/stock/bagStockDetails.php @@ -349,7 +349,7 @@ foreach ($period as $day) { @@ -358,7 +358,7 @@ foreach ($period as $day) { if ($month == date('M-Y')) { ?> @@ -373,25 +373,25 @@ foreach ($period as $day) { title="Navigation" data-toggle="modal" data-target="#bs-example-modal-lg" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color: #bd0906"> diff --git a/app/Views/stock/dieselStockDetails.php b/app/Views/stock/dieselStockDetails.php index abefaa59..5adc25eb 100644 --- a/app/Views/stock/dieselStockDetails.php +++ b/app/Views/stock/dieselStockDetails.php @@ -337,8 +337,8 @@ foreach ($period as $day) { + style=" padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214); + border-radius: 5px;margin-right:15px;"> @@ -361,25 +361,26 @@ foreach ($period as $day) { title="Navigation" data-toggle="modal" data-target="#bs-example-modal-lg" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color: #bd0906"> + + style="font-size: x-large; cursor:pointer; color: #0b7cba" + id="bagStockExport"> diff --git a/app/Views/stock/drierMachineDetails.php b/app/Views/stock/drierMachineDetails.php index c48584fb..79ac5c1f 100644 --- a/app/Views/stock/drierMachineDetails.php +++ b/app/Views/stock/drierMachineDetails.php @@ -339,13 +339,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); + style="padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214); + border-radius: 5px;margin-right:15px; "> @@ -353,13 +353,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); @@ -368,7 +368,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); title="Add Entry" data-target="#additionalEntriesModalId" data-toggle="modal" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"> @@ -466,10 +466,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y'); modify('first day of this month')->format('Y-m-d'); ?> modify('last day of this month')->format('Y-m-d'); ?> + format('Y-m-d'); ?> +
-
diff --git a/app/Views/stock/dustAndRoughStockDetails.php b/app/Views/stock/dustAndRoughStockDetails.php index 5f545965..4f14fd9a 100644 --- a/app/Views/stock/dustAndRoughStockDetails.php +++ b/app/Views/stock/dustAndRoughStockDetails.php @@ -359,13 +359,13 @@ @@ -373,20 +373,20 @@ diff --git a/app/Views/stock/gasStockDetails.php b/app/Views/stock/gasStockDetails.php index e2253d7d..b4110044 100644 --- a/app/Views/stock/gasStockDetails.php +++ b/app/Views/stock/gasStockDetails.php @@ -335,13 +335,13 @@ @@ -349,20 +349,20 @@ diff --git a/app/Views/stock/incomingSilicaSandDetails.php b/app/Views/stock/incomingSilicaSandDetails.php index 9a22384a..e2afc565 100644 --- a/app/Views/stock/incomingSilicaSandDetails.php +++ b/app/Views/stock/incomingSilicaSandDetails.php @@ -340,27 +340,27 @@ @@ -1577,11 +1577,16 @@ if (i === 0 || i === 1) { newPlus20Loss += Number(result[i]['WEIGH OF SAND']); + + + newSieveLossQty = (parseFloat(qty) * newPlus20Loss) / 100; + + } if (i === 0 || i === 1 || i === 2) { newPlus30Loss += Number(result[i]['WEIGH OF SAND']); - newSieveLossQty = (parseFloat(qty) * newPlus20Loss) / 100; + } totalWeighOfSand += Number(result[i]['WEIGH OF SAND']); diff --git a/app/Views/stock/powerConsumptionDetails.php b/app/Views/stock/powerConsumptionDetails.php index 3db3d7d1..d51596cc 100644 --- a/app/Views/stock/powerConsumptionDetails.php +++ b/app/Views/stock/powerConsumptionDetails.php @@ -213,7 +213,7 @@ background-color: #50bbd9; /* Green background */ color: #ffffff; - border: 2px solid ; + border: 2px solid; padding: 10px; } @@ -262,10 +262,10 @@ margin-bottom: 5px; } - #powerStockDetailsTableId { /* Replace with your table's actual ID or selector */ - border-collapse: collapse; + #powerStockDetailsTableId { + /* Replace with your table's actual ID or selector */ + border-collapse: collapse; } - @@ -344,8 +344,8 @@ foreach ($period as $day) { + style=" padding: 8px;margin-bottom: 10px;width: 250px;border: 2px solid rgb(123, 11, 214); + border-radius: 5px;margin-right:15px;"> @@ -368,25 +368,25 @@ foreach ($period as $day) { title="Navigation" data-toggle="modal" data-target="#bs-example-modal-lg" - style="font-size: x-large; cursor:pointer;"> + style="font-size: x-large; cursor:pointer; color: #bd0906"> + style="font-size: x-large; cursor:pointer; color: #0b7cba" + id="bagStockExport"> @@ -405,7 +405,7 @@ foreach ($period as $day) { 2)choose which material/machines you want ------------------------------------------------------------> - +
-
+
@@ -671,126 +676,122 @@ foreach ($period as $day) { - - + + - - Total - + + Total + - + - - - - + + + + - - - - - - - - - - - $dateInMonth) { ?> - format('d-m-Y'); - if ($dateInMonthDmYFormat === $currentDate) { - echo 'style="background: #cef0ad ;"'; - } - ?>> - $resinMaterial) { ?> - - - - format('d-m-Y'); - ?> - - - - - - - - - - - - - - - - - - - - oninput="openingStockChange(this)" - contenteditable="true" - - > - - $previousMonthResinStockDetail) - { - if($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']){ - echo $previousMonthResinStockDetail['balanceStock'] ; - break; - } - - } - ?> - - - - - - - - - - $previousMonthResinStockDetail) - { - if($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']){ - echo $previousMonthResinStockDetail['balanceStock'] ; - break; - } - - } - ?> - - - - - + + + - + + + + + $dateInMonth) { ?> + format('d-m-Y'); + if ($dateInMonthDmYFormat === $currentDate) { + echo 'style="background: #cef0ad ;"'; + } + ?>> + $resinMaterial) { ?> + + + + format('d-m-Y'); + ?> + + + + + + + + + + + + + + + + + + + + oninput="openingStockChange(this)" + contenteditable="true" + + > + + $previousMonthResinStockDetail) { + if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) { + echo $previousMonthResinStockDetail['balanceStock']; + break; + } + } + ?> + + + + + + + + + + $previousMonthResinStockDetail) { + if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) { + echo $previousMonthResinStockDetail['balanceStock']; + break; + } + } + ?> + + + + + + + + +
@@ -812,7 +813,7 @@ foreach ($period as $day) { @@ -867,9 +868,9 @@ foreach ($period as $day) { targetColumnIndex = targetColumnIndex * 7; targetRow.cells[targetColumnIndex].scrollIntoView({ - behavior: 'smooth', - inline: 'center', - block: 'center' + behavior: 'smooth', + inline: 'center', + block: 'center' }); const highlightDuration = 10000; @@ -1099,24 +1100,24 @@ foreach ($period as $day) { $(document).ready(function() { function exportTableToExcel(tableID, filename = '') { - let table = document.getElementById(tableID); - + let table = document.getElementById(tableID); + let cloneTable = table.cloneNode(true); // Clone the table to modify - + // Remove hidden rows - $(cloneTable).find('tr').filter(function () { + $(cloneTable).find('tr').filter(function() { return $(this).css('display') === 'none'; }).remove(); - + // Remove hidden columns - $(cloneTable).find('th, td').each(function () { + $(cloneTable).find('th, td').each(function() { if ($(this).css('display') === 'none') { $(this).remove(); } }); $(cloneTable).find('tbody tr').each(function() { let firstTd = $(this).find('td').eq(0); // Get the first column (Date) - + // Convert Date Format (Assuming it's in YYYY-MM-DD format) let originalDate = firstTd.text().trim(); // Get the text value let parts = originalDate.split('-'); // Split into [YYYY, MM, DD] @@ -1189,72 +1190,77 @@ foreach ($period as $day) { - + \ No newline at end of file diff --git a/app/Views/stock/trpProductionStockDetails.php b/app/Views/stock/trpProductionStockDetails.php index f6e7ceac..2e3892e3 100644 --- a/app/Views/stock/trpProductionStockDetails.php +++ b/app/Views/stock/trpProductionStockDetails.php @@ -405,10 +405,7 @@ $timeOtions[] = "12:00 AM";
" - class="form-control " - data-provide="datepicker" - data-date-format="M-yyyy" - data-date-min-view-mode="1" readonly + class="form-control " readonly style="max-width: 175px;">
@@ -419,13 +416,13 @@ $timeOtions[] = "12:00 AM"; @@ -433,20 +430,20 @@ $timeOtions[] = "12:00 AM"; @@ -1504,16 +1501,18 @@ $timeOtions[] = "12:00 AM";
- - - - + + + + -
@@ -1709,36 +1708,36 @@ $timeOtions[] = "12:00 AM"; 'absRunningHrs' => "", 'absPerHour' => "", 'absOpeningStock' => '', - 'absReceipt' => $totalWcsReceived, - 'absTotal' => $totalWcsReceived, - 'absConsumption' => $summary['edProduction'], - 'absClosingStock' => ($totalWcsReceived) - $summary['edProduction'], + 'absReceipt' => $totalWcsReceived == 0 ? " " : $totalWcsReceived, + 'absTotal' => $totalWcsReceived == 0 ? " " : $totalWcsReceived, + 'absConsumption' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'] , + 'absClosingStock' => ($totalWcsReceived) - $summary['edProduction'] == 0 ? " " : $totalWcsReceived - $summary['edProduction'], 'absPhysicalStock' => '', 'absRemarks' => '', ], [ 'absParticulars' => "ED Details", - 'absRunningHrs' => $summary['edRunningHours'], - 'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2), + 'absRunningHrs' => $summary['edRunningHours'] == 0 ? " " : $summary['edRunningHours'], + 'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2) == 0 ? " " : number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2), 'absOpeningStock' => '', - 'absReceipt' => $summary['edProduction'], - 'absTotal' => $summary['edProduction'], - 'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), - 'absClosingStock' => $summary['edProduction'] - $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), + 'absReceipt' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'], + 'absTotal' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'], + 'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250), + 'absClosingStock' => $summary['edProduction'] - $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edProduction'] - ($summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250)), 'absPhysicalStock' => '', 'absRemarks' => '', ], [ 'absParticulars' => "TRP Total Sand", - 'absRunningHrs' => $summary['sandFeedingHours'], - 'absPerHour' => $summary['trpProductionPerHour'], + 'absRunningHrs' => $summary['sandFeedingHours'] == 0 ? " " : $summary['sandFeedingHours'], + 'absPerHour' => $summary['trpProductionPerHour'] == 0 ? " " : $summary['trpProductionPerHour'], 'absOpeningStock' => '', - 'absReceipt' => $summary['trpProduction'], - 'absTotal' => $summary['trpProduction'], - 'absConsumption' => $totalCrsReceived, - 'absClosingStock' => $summary['trpProduction'] - $totalCrsReceived, + 'absReceipt' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'], + 'absTotal' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'], + 'absConsumption' => $totalCrsReceived == 0 ? " " : $totalCrsReceived, + 'absClosingStock' => $summary['trpProduction'] - $totalCrsReceived == 0 ? " " : $summary['trpProduction'] - $totalCrsReceived, 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1746,12 +1745,12 @@ $timeOtions[] = "12:00 AM"; 'absParticulars' => "Trp Physical Gas Consumption", 'absRunningHrs' => "", - 'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''), + 'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', '') == 0 ? " " : number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''), 'absOpeningStock' => '', - 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absConsumption' => $summary['physicalGasConsumption'], - 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'], + 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absConsumption' => $summary['physicalGasConsumption'] == 0 ? " " : $summary['physicalGasConsumption'], + 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'], 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1759,12 +1758,12 @@ $timeOtions[] = "12:00 AM"; 'absParticulars' => "Trp Panel Gas Consumption", 'absRunningHrs' => "", - 'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2), + 'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2) == 0 ? " " : number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2), 'absOpeningStock' => '', - 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'], - 'absConsumption' => $summary['panelGasConsumption'], - 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'], + 'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'], + 'absConsumption' => $summary['panelGasConsumption'] == 0 ? " " : $summary['panelGasConsumption'] , + 'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'], 'absPhysicalStock' => '', 'absRemarks' => '', ], @@ -1774,9 +1773,9 @@ $timeOtions[] = "12:00 AM"; 'absRunningHrs' => "", 'absPerHour' => "", 'absOpeningStock' => '', - 'absReceipt' => $summary['waterReceipt'], - 'absTotal' => $summary['waterReceipt'], - 'absConsumption' => $summary['waterReceipt'] - $summary['waterConsumption'], + 'absReceipt' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'], + 'absTotal' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'], + 'absConsumption' => $summary['waterReceipt'] - $summary['waterConsumption'] == 0 ? " " : $summary['waterReceipt'] - $summary['waterConsumption'], 'absClosingStock' => '', 'absPhysicalStock' => '', 'absRemarks' => '', @@ -1784,12 +1783,12 @@ $timeOtions[] = "12:00 AM"; [ 'absParticulars' => "Power Consumption", - 'absRunningHrs' => $summary['ebReadingPerUnitTon'], + 'absRunningHrs' => $summary['ebReadingPerUnitTon'] == 0 ? " " : $summary['ebReadingPerUnitTon'], 'absPerHour' => "", 'absOpeningStock' => '', 'absReceipt' => '', 'absTotal' => '', - 'absConsumption' => $summary['ebReading'], + 'absConsumption' => $summary['ebReading'] == 0 ? " " : $summary['ebReading'], 'absClosingStock' => '', 'absPhysicalStock' => '', 'absRemarks' => '', @@ -2331,8 +2330,8 @@ $timeOtions[] = "12:00 AM"; // Convert to numbers for calculations let openingStock = validateInput(openingStockTd) || 0; - let receipt = validateInput(receiptTd) || 0; - let consumption = validateInput(consumptionTd) || 0; + let receipt = validateInput(receiptTd) || 0; + let consumption = validateInput(consumptionTd) || 0; // Calculate values let totalStock = parseFloat(openingStock) + parseFloat(receipt); @@ -2534,8 +2533,6 @@ $timeOtions[] = "12:00 AM"; }) - -