From 2885d14239949cbc4f1dede5c4e43fc762cae6d6 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Fri, 21 Feb 2025 12:22:49 +0530 Subject: [PATCH] stock module latest today vadivel J 21-02-2025 --- app/Models/Rawmaterialdetails_model.php | 11 +- app/Views/stock/dieselStockDetails.php | 9 +- app/Views/stock/powerConsumptionDetails.php | 870 +++++++++----------- app/Views/stock/resinStockDetails.php | 1 + 4 files changed, 423 insertions(+), 468 deletions(-) diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 31db025e..cbd3a5fa 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -146,7 +146,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode') - ->where('Category', 'silica sand') + ->where('Category', '248') ->orderBy('CreatedDate', 'desc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -158,7 +158,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode') - ->where('Category', 'waste core') + ->where('Category', '328') ->orderBy('CreatedDate', 'desc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -171,7 +171,7 @@ class Rawmaterialdetails_model extends Model //when no data present for current month we are showing only active materials with filter option $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') - ->where('Category', 'Packing Material') + ->where('Category', '236') ->where('IsActive', 1) ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); @@ -184,7 +184,7 @@ class Rawmaterialdetails_model extends Model //when data present with whether material is active or not we have to show them with filter option $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') - ->where('Category', 'Packing Material') + ->where('Category', '236') ->whereIn('MaterialCode', $distinctMaterialCodes) ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); @@ -199,7 +199,7 @@ class Rawmaterialdetails_model extends Model $builder = $this->db->table('t_materialmaster') ->select('MaterialCode , MaterialName') ->where('IsActive', 1) - ->where('Category', 'Resin') + ->where('Category', '327') ->orderBy('MaterialCode', 'asc'); $query = $builder->get(); $materialResults = $query->getResultArray(); @@ -212,6 +212,7 @@ class Rawmaterialdetails_model extends Model { $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName') + ->where('Category', '327') ->whereIn('MaterialCode', $distinctMaterialCodes) // Matches MaterialCode with the array ->orderBy('MaterialCode', 'asc'); diff --git a/app/Views/stock/dieselStockDetails.php b/app/Views/stock/dieselStockDetails.php index 778e53c6..50b61eb4 100644 --- a/app/Views/stock/dieselStockDetails.php +++ b/app/Views/stock/dieselStockDetails.php @@ -704,6 +704,7 @@ foreach ($period as $day) { $dieselMachine) { ?> @@ -731,16 +732,18 @@ foreach ($period as $day) { - > + ?> + + diff --git a/app/Views/stock/powerConsumptionDetails.php b/app/Views/stock/powerConsumptionDetails.php index 1925e8ac..a8c272c8 100644 --- a/app/Views/stock/powerConsumptionDetails.php +++ b/app/Views/stock/powerConsumptionDetails.php @@ -156,14 +156,14 @@ } .celda_encabezado_total { - background-color:#ffffff !important; + background-color: #ffffff !important; border: 1px solid #ffffff; color: #ffffff !important; font-weight: bold; padding: 6px 10px; text-align: center; } - + .celda_normal { /*background-color: #fff;*/ /* */ @@ -177,12 +177,14 @@ .fht-table thead { position: sticky; top: 0; - z-index: 20; /* Ensure the entire header stays above table rows */ - background-color: #50bbd9; /* Header background color */ + z-index: 20; + /* Ensure the entire header stays above table rows */ + background-color: #50bbd9; + /* Header background color */ } - .dropdown-menu { - z-index :25 ; + .dropdown-menu { + z-index: 25; } @@ -191,8 +193,10 @@ .fht-table thead th { position: sticky; top: 0; - z-index: 11; /* Higher than table rows but lower than first column */ - background-color: #50bbd9; /* Green background */ + z-index: 11; + /* Higher than table rows but lower than first column */ + background-color: #50bbd9; + /* Green background */ color: #ffffff; border: 1px solid #ddd; padding: 10px; @@ -204,7 +208,8 @@ position: sticky; left: 0; background-color: #50bbd9; - z-index: 15; /* Ensures it stays above other cells */ + z-index: 15; + /* Ensures it stays above other cells */ border-right: 2px solid #ddd; color: #ffffff; } @@ -212,22 +217,16 @@ /* Table Wrapper for Scrolling */ .table-responsive { overflow-x: auto; - overflow-y: auto; - max-height: 500px; /* Adjust as needed */ + overflow-y: auto; + max-height: 500px; + /* Adjust as needed */ position: relative; } - td{ - min-width: 100px; - max-width: 100px; + td { + min-width: 100px; + max-width: 100px; } - - - - - - - @@ -328,13 +327,13 @@ foreach ($period as $day) { Machine - - 150 KW Power - + + 150 KW Power + - + @@ -346,15 +345,15 @@ foreach ($period as $day) { - Date - Opening Reading - Final Reading - Total Reading - Total Units - Average PF - Present PF - MD - MF *60 + Date + Opening Reading + Final Reading + Total Reading + Total Units + Average PF + Present PF + MD + MF *60 @@ -365,7 +364,7 @@ foreach ($period as $day) { Total Units - + @@ -374,13 +373,13 @@ foreach ($period as $day) { $powerStockDetails) { - - + + ?> > - format('d-m-Y'); - ?> + format('d-m-Y'); + ?> - - - + + + - - oninput="openingTPStockChange(this)" - contenteditable="true" - - - > + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + oninput="openingTPStockChange(this)" + contenteditable="true" + > - - - ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $powerStock) { ?> + ?> + + + + + $powerStock) { ?> @@ -518,7 +510,7 @@ foreach ($period as $day) { - + @@ -530,7 +522,7 @@ foreach ($period as $day) { oninput="openingUnitsChange(this)" contenteditable="true" > - + @@ -555,109 +547,102 @@ foreach ($period as $day) { - - - "-" , - 'closing_units' => 0 , - 'total_units' => 0 , - ]; - } + "-", + 'closing_units' => 0, + 'total_units' => 0, + ]; + } + + // Sum values for the material + + $summary["machineId_$machineId"]['opening_units'] = " "; + $summary["machineId_$machineId"]['closing_units'] = " "; + $summary["machineId_$machineId"]['total_units'] += is_numeric($powerStock['total_units']) ? $powerStock['total_units'] : 0; + } ?> - - - - - - } ?> -
- +
- - - - - - - - - - - - + - - - - - - - - + + + + + + + + + + - + + + + + + + + - - - + - + - + - - - - - - - - + - + - - - + + + + + + + + - + - - + + + - -
Date Opening Reading Final ReadingTotal ReadingTotal Units Average PFPresent PFMD MF *60
Opening UnitsFinal UnitsTotal Units
Date Opening Reading Final ReadingTotal ReadingTotal Units Average PFPresent PFMD MF *60
Opening UnitsFinal UnitsTotal Units
- Total -
+ Total +
-
+ + + + + + + + @@ -674,93 +659,81 @@ foreach ($period as $day) { if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"'; } - ?> > + ?>> + + format('d-m-Y'); + + ?> + + + + + + + + + oninput="openingTPStockChange(this)" + contenteditable="true" + + > + + + + + format('d-m-Y'); - - ?> + if (empty($previousMonthTotalPowerMachineStockDetails)) { + echo " "; + } else { + echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading']; + } - - - + ?> + - - + - oninput="openingTPStockChange(this)" - contenteditable="true" + + - + - > - - - - - - - - - - - - - - - - - - - - + $powerMachine) { - ?> + foreach ($electricMachines as $powerMachineIndex => $powerMachine) { + ?> - + @@ -772,37 +745,30 @@ foreach ($period as $day) { - - oninput="openingUnitsChange(this)" - contenteditable="true" - + oninput="openingUnitsChange(this)" + contenteditable="true" - - > + + data-id=" "> + - + + function tableToJson() { const table = $('#powerStockDetailsTableId'); - const summaryRowPart = [] ; + const summaryRowPart = []; const readingsRowPart = []; - const allRow = [] ; + const allRow = []; //this table to json is customized for powerStock not for all @@ -1023,67 +989,64 @@ foreach ($period as $day) { const formattedDate = `${date.split('-')[2]}-${date.split('-')[1]}-${date.split('-')[0]}`; - - const summaryRowData = { - date: formattedDate, - opening_reading: rowCells.eq(1).text().trim(), - final_reading : rowCells.eq(2).text().trim(), - total_reading : rowCells.eq(3).text().trim(), - total_units : rowCells.eq(4).text().trim(), - average_pf : rowCells.eq(5).text().trim(), - present_pf : rowCells.eq(6).text().trim(), - md : rowCells.eq(7).text().trim(), - mf : rowCells.eq(8).text().trim() - }; - summaryRowPart.push(summaryRowData); - + const summaryRowData = { + date: formattedDate, + opening_reading: rowCells.eq(1).text().trim(), + final_reading: rowCells.eq(2).text().trim(), + total_reading: rowCells.eq(3).text().trim(), + total_units: rowCells.eq(4).text().trim(), + average_pf: rowCells.eq(5).text().trim(), + present_pf: rowCells.eq(6).text().trim(), + md: rowCells.eq(7).text().trim(), + mf: rowCells.eq(8).text().trim() + }; + + summaryRowPart.push(summaryRowData); + /** we get eight entries against a machines so we loop from 1 to 8 and so on in a single row **/ - for (let i = 9 ; i < rowCells.length; i += 5 ) { + for (let i = 9; i < rowCells.length; i += 5) { const readingsRowData = { date: rowCells.eq(i).text().trim(), machine_id: rowCells.eq(i + 1).text().trim(), opening_units: rowCells.eq(i + 2).text().trim(), closing_units: rowCells.eq(i + 3).text().trim(), - total_units : rowCells.eq(i + 4).text().trim(), + total_units: rowCells.eq(i + 4).text().trim(), }; readingsRowPart.push(readingsRowData); } - + }); - allRow.push(summaryRowPart ,readingsRowPart ) + allRow.push(summaryRowPart, readingsRowPart) return JSON.stringify(allRow, null, 2); } + \ No newline at end of file diff --git a/app/Views/stock/resinStockDetails.php b/app/Views/stock/resinStockDetails.php index f39ae0ef..4e7013a6 100644 --- a/app/Views/stock/resinStockDetails.php +++ b/app/Views/stock/resinStockDetails.php @@ -511,6 +511,7 @@ foreach ($period as $day) { } ?>> $resinMaterial) { ?>