From b19358945191f78c3831a0d02cd5f70413bd9a4a Mon Sep 17 00:00:00 2001 From: vadivel J Date: Mon, 11 Nov 2024 18:00:52 +0530 Subject: [PATCH] changes in stock module -vadivel j --- app/Config/Routes.php | 6 +- app/Controllers/StockController.php | 73 +++- app/Models/GasStockModel.php | 47 +++ app/Views/gasStockDetails.php | 500 ++++++++++++++++++++++++++++ app/Views/includes/new_header.php | 6 +- 5 files changed, 627 insertions(+), 5 deletions(-) create mode 100644 app/Models/GasStockModel.php create mode 100644 app/Views/gasStockDetails.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 7d0fdad4..e52666f5 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -454,4 +454,8 @@ $routes->post('updateDustAndRoughStockDetails', 'StockController::updateDustAndR //Resin stock details $routes->match(['GET','POST'],'resinStockDetails', 'StockController::loadView_resinStockDetails'); -$routes->post('updateResinStockDetails', 'StockController::updateResinStockDetails'); \ No newline at end of file +$routes->post('updateResinStockDetails', 'StockController::updateResinStockDetails'); + +//Gas stock details +$routes->match(['GET','POST'],'gasStockDetails', 'StockController::loadView_gasStockDetails'); +$routes->post('updateGasStockDetails', 'StockController::updateGasStockDetails'); \ No newline at end of file diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 961e5e66..e0ea480b 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -15,6 +15,7 @@ use App\Models\Rawmaterialdetails_model; use App\Models\BagStockDetailsModel; use App\Models\DustAndRoughModel; use App\Models\ResinStockModel; +use App\Models\GasStockModel; use CodeIgniter\HTTP\ResponseInterface; use DateTime; @@ -35,6 +36,7 @@ class StockController extends BaseController protected $Rawmaterialdetails_model; protected $dustAndRoughStockDetails_model; protected $resinStockDetails_model; + protected $gasStockDetails_model; /** * This is default constructor of the class @@ -67,6 +69,8 @@ class StockController extends BaseController $this->dustAndRoughStockDetails_model = new DustAndRoughModel(); $this->resinStockDetails_model = new ResinStockModel() ; + + $this->gasStockDetails_model = new GasStockModel() ; $this->session = session(); @@ -99,10 +103,14 @@ class StockController extends BaseController $this->global['pageTitle'] = 'Coating Machine Details '; + + $startDate = "$month-01"; + $endDate = date("Y-m-t", strtotime($startDate)); $data['coatingMachineDetails']= $this->coatingMachineDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) ->where('is_active', 1) - ->orderBy('created_at','DESC') - ->like('created_at', $month, 'after') + ->orderBy('date','asc') ->findAll(); $date = DateTime::createFromFormat('Y-m', $month); @@ -721,15 +729,76 @@ class StockController extends BaseController } + //Gas Stock Details + public function loadView_gasStockDetails(){ + if ($this->request->getMethod() === 'POST'){ + $month = $this->request->getPost('month'); + $date = DateTime::createFromFormat('M-Y', $month); + $formattedDate = $date->format('Y-m'); + $month=$formattedDate; + } + else{ + $month = date('Y-m'); + } + $data=[]; + $data['month']=$month; + $this->global['pageTitle'] = "Gas Stock Details"; + + $startDate = "$month-01"; + $endDate = date("Y-m-t", strtotime($startDate)); + + $data['gasStockDetails'] = $this->gasStockDetails_model + ->select('t_gasStockDetails.*, + t_drierMachineDetails.total_gas_consumption AS drierMachineGasConsumption, + t_drierMachineDetails.sand_dried_qty AS sandDried, + coating_summary.coatingMachineGasconsumption, + coating_summary.coatedSand' + ) + // Subquery with early date filtering + ->join( + '(SELECT date, + SUM(totalGasconsumption) AS coatingMachineGasconsumption, + SUM(totalCoatingSandInKg) / 1000 AS coatedSand + FROM t_coatingMachineDetails + WHERE is_active = 1 + AND date >= ' . $this->db->escape($startDate) . ' + AND date <= ' . $this->db->escape($endDate) . ' + GROUP BY date + ) AS coating_summary', + 'coating_summary.date = t_gasStockDetails.date', + 'left' + ) + ->join('t_drierMachineDetails', + 't_drierMachineDetails.date = t_gasStockDetails.date + AND t_drierMachineDetails.date >= ' . $this->db->escape($startDate) . ' + AND t_drierMachineDetails.date <= ' . $this->db->escape($endDate), + 'left' + ) + + ->where('t_gasStockDetails.date >=', $startDate) + ->where('t_gasStockDetails.date <=', $endDate) + ->groupBy('t_gasStockDetails.date') + ->findAll(); + + + + $data['month'] = DateTime::createFromFormat('Y-m', $month)->format('M-Y'); + + return $this->loadViews("gasStockDetails", $this->global, $data, NULL); + } + + public function updateGasStockDetails(){ + echo "welcome to update Gas Stock Details"; + } diff --git a/app/Models/GasStockModel.php b/app/Models/GasStockModel.php new file mode 100644 index 00000000..e809c7e8 --- /dev/null +++ b/app/Models/GasStockModel.php @@ -0,0 +1,47 @@ + + .num { + text-align: right; + } + + .fht-table, + .fht-table thead, + .fht-table tfoot, + .fht-table tbody, + .fht-table tr, + .fht-table th, + .fht-table td { + margin: 0; + } + + .fht-table td { + text-align: center; + } + + .fht-table td:hover { + background-color: #00a65a; + color: #ffffff; + } + + .fht-table { + border: 0 none; + height: auto; + width: auto; + border-collapse: collapse; + border-spacing: 0; + /*table-layout: fixed; Algoritmo de distribucion fijo */ + white-space: nowrap; + } + + .fht-table th, + .fht-table td { + overflow: hidden; + } + + .fht-table-wrapper, + .fht-table-wrapper .fht-thead, + .fht-table-wrapper .fht-tfoot, + .fht-table-wrapper .fht-fixed-column .fht-tbody, + .fht-table-wrapper .fht-fixed-body .fht-tbody, + .fht-table-wrapper .fht-tbody { + overflow: hidden; + position: relative; + } + + .fht-table-wrapper .fht-fixed-body .fht-tbody, + .fht-table-wrapper .fht-tbody { + overflow: auto; + } + + .fht-table-wrapper .fht-table .fht-cell { + overflow: hidden; + height: 1px; + } + + .fht-table-wrapper .fht-fixed-column, + .fht-table-wrapper .fht-fixed-body { + top: 0; + left: 0; + position: absolute; + } + + .fht-table-wrapper .fht-fixed-column { + z-index: 1; + } + + .fht-fixed-body .fht-thead table { + margin-right: 20px; + border: 0 none; + } + + /*For Examples*/ + + .ContenedorTabla { + height: 500px; + margin: 0 auto; + overflow: auto; + width: auto; + position: relative; + } + + .header, + .main { + display: inline-block; + height: auto; + width: 100%; + } + + .titulosHeader { + border-bottom: 1px solid #e8bb25; + height: auto; + margin-bottom: 10px; + padding-bottom: 8px; + padding-top: 8px; + width: 100%; + } + + + .celda_encabezado_general { + background-color: #00a65a; + border: 1px solid #ccc; + color: #ffffff; + font-weight: bold; + padding: 6px 10px;; + text-align: center; + } + + + ._Separador { + background-color: #fff; + height: 12px; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; + width: 7px; + } + + ._Separador div { + width: 4px; + } + + .celda_normal { + /*background-color: #fff;*/ + /* */ + text-align: center; + border: 1px solid #ccc; + padding: 2px 4px; + } + + /*style excel*/ + .excel_cell { + border: 1px solid #CCC; + color: #222; + text-align: center; + font-size: 13px; + font-weight: normal; + padding: 4px; + white-space: pre-line; + empty-cells: show; + } + + ._cell_header { + background-color: #EEE; + } + + ._cell_Default { + background-color: #FFF; + text-align: left; + } + + .excel_cell div { + width: 30px; + height: 20px; + } + + #bagStockDetailsTableId th:nth-child(1), + #bagStockDetailsTableId td:nth-child(1) { + position: sticky; + left: 0; + background-color: #00a65a; + z-index: 2; + border-right: 2px solid #ddd; + color: #ffffff; + } + + .modal { + padding-right: 30% ! important; + } + +
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ + + +
+
+
+
+ + +
+
+ +
+ " + class="form-control mt-2" data-provide="datepicker" + data-date-format="M-yyyy" data-date-min-view-mode="1"> +
+
+ +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RIPL
RIPL
Gas Stock 10 TonSand DriedCoating MachineSand CoatedTrp Machine Sand TRPRotary Drier
Date Opening StockPurchase(Bharath)Purchase(Indian)TotalConsumption Balance StockConsumption ton Consumptionton Consumptionton Consumption
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index d7651d78..722c4c32 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -773,16 +773,18 @@ Coating Machine Details + Gas Stock Details + Diesel - Factory Vehicle Power Consumption - Bag Stock Details - Dust And Rough Stock Details Resin Stock Details + Bag Stock Details +