stock module latest today vadivel J 11-1-2025
This commit is contained in:
parent
e71b471c56
commit
5cafb0256a
@ -489,6 +489,8 @@ class StockController extends BaseController
|
||||
$this->global['pageTitle'] = 'Bag Stock Details';
|
||||
|
||||
|
||||
// Get the previous month's last date bag stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
@ -503,6 +505,7 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
// checking in database if the data is available for the month
|
||||
|
||||
$startDate = "$month-01";
|
||||
$endDate = date("Y-m-t", strtotime($startDate));
|
||||
@ -529,6 +532,19 @@ class StockController extends BaseController
|
||||
$groupedByDate[$date] = [];
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************************************
|
||||
creating an sub array (inner array) for date wise and append the detail into an array as sub-array
|
||||
|
||||
$groupedByDate[] outer array
|
||||
|
||||
$groupedByDate[$date]
|
||||
will look like [[bag1],[bag2],[bag3],[bag4],[bag5]] inner array
|
||||
|
||||
the above process is done for single row (date wise) and the same process is repeated for all the rows
|
||||
*******************************************************************************************************************/
|
||||
|
||||
|
||||
// Append the detail to the sub-array for this date
|
||||
$groupedByDate[$date][] = $detail;
|
||||
}
|
||||
@ -539,13 +555,14 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
// getting bag material for creating table headers
|
||||
// checking already existing stock if yes then get the material code from the existing bag
|
||||
// if not get all the material codes from the raw material details table
|
||||
|
||||
if (!empty($data['groupedBagStockDetails'])) {
|
||||
|
||||
$result = $this->bagStockDetails_model
|
||||
->select('materialCode') // Specify the column you want to select
|
||||
->distinct() // Use distinct
|
||||
->orderBy('materialCode', 'asc')
|
||||
->findAll();
|
||||
$result = $groupedByDate[$date];
|
||||
|
||||
$distinctMaterialCodes = [];
|
||||
foreach ($result as $index => $eachResult) {
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
@ -558,6 +575,11 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
// getting customer for creating table headers
|
||||
// checking already existing stock if yes then get customer from the existing stock
|
||||
// if not set customer as '' empty string
|
||||
|
||||
foreach ($bagMaterials as $key => $bagMaterial) {
|
||||
$materialCode = $bagMaterial['MaterialCode'];
|
||||
$bagMaterials[$key]['customers'] = $this->bagStockDetails_model
|
||||
@ -760,6 +782,8 @@ class StockController extends BaseController
|
||||
$this->global['pageTitle'] = 'Resin Stock Details';
|
||||
|
||||
|
||||
// Get the previous month's last date resin stock details for next month updation
|
||||
|
||||
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
$previousMonthEndDate = date("Y-m-t", strtotime($previousMonthStartDate));
|
||||
@ -773,6 +797,9 @@ class StockController extends BaseController
|
||||
->findAll();
|
||||
|
||||
|
||||
|
||||
// checking in database if the data is available for the month
|
||||
|
||||
$startDate = "$month-01";
|
||||
$endDate = date("Y-m-t", strtotime($startDate));
|
||||
$data['resinStockDetails'] = $this->resinStockDetails_model
|
||||
@ -793,12 +820,22 @@ class StockController extends BaseController
|
||||
foreach ($data['resinStockDetails'] as $detail) {
|
||||
$date = $detail['date'];
|
||||
|
||||
// Initialize the array for this date if it doesn't exist
|
||||
// Initialize the outer array for this date if it doesn't exist
|
||||
if (!isset($groupedByDate[$date])) {
|
||||
$groupedByDate[$date] = [];
|
||||
}
|
||||
|
||||
// Append the detail to the sub-array for this date
|
||||
/*******************************************************************************************************************
|
||||
creating an sub array (inner array) for date wise and append the detail into an array as sub-array
|
||||
|
||||
$groupedByDate[] outer array
|
||||
|
||||
$groupedByDate[$date]
|
||||
will look like [[material1],[material2],[material3],[material4],[material5]] inner array
|
||||
|
||||
the above process is done for single row (date wise) and the same process is repeated for all the rows
|
||||
*******************************************************************************************************************/
|
||||
|
||||
$groupedByDate[$date][] = $detail;
|
||||
}
|
||||
|
||||
@ -807,24 +844,33 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
if (!empty($data['groupedResinStockDetails'])) {
|
||||
// getting resin material for creating table headers
|
||||
// checking already existing stock if yes then get the material code from the existing stock
|
||||
// if not get all the material codes from the raw material details table
|
||||
|
||||
if (!empty($data['groupedResinStockDetails'])) {
|
||||
|
||||
$result = $groupedByDate[$date];
|
||||
|
||||
$result = $this->resinStockDetails_model
|
||||
->select('materialCode') // Specify the column you want to select
|
||||
->distinct() // Use distinct
|
||||
->orderBy('materialCode', 'asc')
|
||||
->findAll();
|
||||
$distinctMaterialCodes = [];
|
||||
|
||||
foreach ($result as $index => $eachResult) {
|
||||
$distinctMaterialCodes[] = $result[$index]['materialCode'];
|
||||
}
|
||||
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getSelectedResinMaterialCode($distinctMaterialCodes);
|
||||
|
||||
} else {
|
||||
|
||||
$resinMaterials = $this->rawmaterialdetails_model->getAllResinMaterialCode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// getting customer for creating table headers
|
||||
// checking already existing stock if yes then get customer from the existing stock
|
||||
// if not set customer as '' empty string
|
||||
|
||||
foreach ($resinMaterials as $key => $resinMaterial) {
|
||||
$materialCode = $resinMaterial['MaterialCode'];
|
||||
$resinMaterials[$key]['customers'] = $this->bagStockDetails_model
|
||||
@ -1356,10 +1402,8 @@ class StockController extends BaseController
|
||||
public function updateTrpProductionDetails($inserts) {
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$postData = $this->request->getJSON(true); // Converts JSON to an associative array
|
||||
|
||||
if(empty($postData)){
|
||||
if(empty($postData['updateTrpProductionDetails'])){
|
||||
if(empty($inserts)){
|
||||
return $this->response->setJSON(['error' => 'No data found to update']);
|
||||
}else{
|
||||
|
||||
@ -1204,32 +1204,32 @@ return totalHours;
|
||||
let tr = $(tdElement).closest('tr');
|
||||
|
||||
|
||||
let totalHours = tr.find('td:eq(3)').text().trim();
|
||||
let coldStart = tr.find('td:eq(4)').text().trim();
|
||||
let breakdownHours = tr.find('td:eq(5)').text().trim();
|
||||
let burnerFiringHours = tr.find('td:eq(6)').text().trim();
|
||||
let sandFeedingHours = tr.find('td:eq(7)').text().trim();
|
||||
let totalHours = tr.find('td:eq(3)').text().trim() ?? 0;
|
||||
let coldStart = tr.find('td:eq(4)').text().trim() ?? 0;
|
||||
let breakdownHours = tr.find('td:eq(5)').text().trim() ?? 0;
|
||||
let burnerFiringHours = tr.find('td:eq(6)').text().trim() ?? 0;
|
||||
let sandFeedingHours = tr.find('td:eq(7)').text().trim() ?? 0;
|
||||
|
||||
|
||||
let gasReceiptBg = tr.find('td:eq(8)').text().trim();
|
||||
let gasReceiptPg = tr.find('td:eq(9)').text().trim();
|
||||
let physicalGasConsumption = tr.find('td:eq(10)').text().trim();
|
||||
let drierGasConsumption = tr.find('td:eq(11)').text().trim();
|
||||
let coatingGasConsumption = tr.find('td:eq(12)').text().trim();
|
||||
let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim();
|
||||
let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim();
|
||||
let panelGasConsumption = tr.find('td:eq(15)').text().trim();
|
||||
let panelGasPerTon = tr.find('td:eq(16)').text().trim();
|
||||
let gasReceiptBg = tr.find('td:eq(8)').text().trim() ?? 0;
|
||||
let gasReceiptPg = tr.find('td:eq(9)').text().trim() ?? 0;
|
||||
let physicalGasConsumption = tr.find('td:eq(10)').text().trim()?? 0;
|
||||
let drierGasConsumption = tr.find('td:eq(11)').text().trim()?? 0;
|
||||
let coatingGasConsumption = tr.find('td:eq(12)').text().trim()?? 0;
|
||||
let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim()?? 0;
|
||||
let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim()?? 0;
|
||||
let panelGasConsumption = tr.find('td:eq(15)').text().trim()?? 0;
|
||||
let panelGasPerTon = tr.find('td:eq(16)').text().trim()?? 0;
|
||||
|
||||
let edRunningHours = tr.find('td:eq(24)').text().trim();
|
||||
let edProduction = tr.find('td:eq(25)').text().trim();
|
||||
let edUsage = tr.find('td:eq(26)').text().trim();
|
||||
let trpProduction = tr.find('td:eq(27)').text().trim();
|
||||
let trpProductionPerHour = tr.find('td:eq(28)').text().trim();
|
||||
let coating = tr.find('td:eq(29)').text().trim();
|
||||
let edRunningHours = tr.find('td:eq(24)').text().trim()?? 0;
|
||||
let edProduction = tr.find('td:eq(25)').text().trim()?? 0;
|
||||
let edUsage = tr.find('td:eq(26)').text().trim()?? 0;
|
||||
let trpProduction = tr.find('td:eq(27)').text().trim()?? 0;
|
||||
let trpProductionPerHour = tr.find('td:eq(28)').text().trim()?? 0;
|
||||
let coating = tr.find('td:eq(29)').text().trim()?? 0;
|
||||
|
||||
let ebReading = tr.find('td:eq(37)').text().trim();
|
||||
let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim();
|
||||
let ebReading = tr.find('td:eq(37)').text().trim()?? 0;
|
||||
let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim()?? 0;
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user