Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
4def67e27c
4
api_test.http
Normal file
4
api_test.http
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
// $routes->match(['GET', 'POST'], 'trpProductionDetails', 'StockController::trpProductionDetails');
|
||||||
|
GET http://localhost/ci4/ria/trpProductionDetails
|
||||||
@ -18,6 +18,9 @@ use App\Models\DustAndRoughModel;
|
|||||||
use App\Models\ResinStockModel;
|
use App\Models\ResinStockModel;
|
||||||
use App\Models\GasStockModel;
|
use App\Models\GasStockModel;
|
||||||
use App\Models\TrpSandUseStockModel;
|
use App\Models\TrpSandUseStockModel;
|
||||||
|
use App\Models\TrpProductionModel;
|
||||||
|
use App\Models\TrpProductionMaintenanceModel;
|
||||||
|
use App\Models\TrpProductionWasteModel;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DatePeriod;
|
use DatePeriod;
|
||||||
@ -45,6 +48,12 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
protected $TrpSandUseStock_model;
|
protected $TrpSandUseStock_model;
|
||||||
|
|
||||||
|
protected $TrpProduction_model;
|
||||||
|
|
||||||
|
protected $TrpProductionMaintenance_model;
|
||||||
|
|
||||||
|
protected $TrpProductionWaste_model;
|
||||||
|
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,6 +94,12 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$this->TrpSandUseStock_model = new TrpSandUseStockModel();
|
$this->TrpSandUseStock_model = new TrpSandUseStockModel();
|
||||||
|
|
||||||
|
$this->TrpProduction_model = new TrpProductionModel();
|
||||||
|
|
||||||
|
$this->TrpProductionMaintenance_model = new TrpProductionMaintenanceModel();
|
||||||
|
|
||||||
|
$this->TrpProductionWaste_model = new TrpProductionWasteModel();
|
||||||
|
|
||||||
|
|
||||||
$this->session = session();
|
$this->session = session();
|
||||||
helper('form');
|
helper('form');
|
||||||
@ -1210,6 +1225,7 @@ class StockController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function updateTrpSandUseStockDetails(){
|
public function updateTrpSandUseStockDetails(){
|
||||||
|
|
||||||
$postData = $this->request->getPost();
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
$updateTrpSandUseStockDetailsData = json_decode($postData['updateTrpSandUseStockDetails'], true);
|
$updateTrpSandUseStockDetailsData = json_decode($postData['updateTrpSandUseStockDetails'], true);
|
||||||
@ -1266,9 +1282,186 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function trpProductionDetails(){}
|
public function trpProductionDetails(){
|
||||||
|
|
||||||
|
|
||||||
|
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'] = 'Trp production Details';
|
||||||
|
|
||||||
|
$startDate = "$month-01";
|
||||||
|
$endDate = date("Y-m-t", strtotime($startDate));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$data['trpProductionDetails'] = $this->TrpProduction_model->trpProductionDetails($startDate,$endDate);
|
||||||
|
|
||||||
|
// dd($data['trpProductionDetails']);
|
||||||
|
|
||||||
|
// dd($this->db->getLastQuery());
|
||||||
|
|
||||||
|
|
||||||
|
$date = DateTime::createFromFormat('Y-m', $month);
|
||||||
|
|
||||||
|
$formattedDate = $date->format('M-Y');
|
||||||
|
|
||||||
|
$data['month'] = $formattedDate;
|
||||||
|
|
||||||
|
// return $this->response->setJSON($data);
|
||||||
|
|
||||||
|
return $this->loadViews("trpProductionStockDetails", $this->global, $data, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateTrpProductionDetails() {
|
||||||
|
|
||||||
|
$postData = $this->request->getPost();
|
||||||
|
|
||||||
|
$updateTrpProductionDetails = json_decode($postData['updateTrpProductionDetails'], true);
|
||||||
|
|
||||||
|
$updateProduction = [];
|
||||||
|
$updateMaintanence = [];
|
||||||
|
$updateWaste = [];
|
||||||
|
|
||||||
|
$insertProduction = [];
|
||||||
|
$insertMaintanence = [];
|
||||||
|
$insertWaste = [];
|
||||||
|
|
||||||
|
foreach ($updateTrpProductionDetails as $data) {
|
||||||
|
|
||||||
|
$data['date'] = $this->convertToDateWithFlexibleFormats($data['Date'], ["d-m-Y", "Y-m-d", "m/d/Y", "m-d-Y"], "Y-m-d");
|
||||||
|
|
||||||
|
$date = $data['date'];
|
||||||
|
|
||||||
|
$dbDataTrpMaintenance = [
|
||||||
|
'date' => $data['date'],
|
||||||
|
'openingTime' => $data['openingTime'],
|
||||||
|
'closingTime' => $data['closingTime'],
|
||||||
|
'totalHours' => $data['totalHours'],
|
||||||
|
'coldStart' => $data['coldStart'],
|
||||||
|
'breakdownHours' => $data['breakdownHours'],
|
||||||
|
'burnerFiringHours' => $data['burnerFiringHours'],
|
||||||
|
'sandFeedingHours' => $data['sandFeedingHours'],
|
||||||
|
'workingPersonEngineers' => $data['workingPersonEngineers'],
|
||||||
|
'workingPersonSupervisiors' => $data['workingPersonSupervisiors'],
|
||||||
|
'workingPersonOperators' => $data['workingPersonOperators'],
|
||||||
|
'rollerDrivers' => $data['rollerDrivers'],
|
||||||
|
'natureOfMaintenance' => $data['natureOfMaintenance'],
|
||||||
|
'location' => $data['location'],
|
||||||
|
'description' => $data['description']
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbDataTrpProduction = [
|
||||||
|
'date' => $data['date'],
|
||||||
|
'gasReceiptBg' => $data['gasReceiptBg'],
|
||||||
|
'gasReceiptPg' => $data['gasReceiptPg'],
|
||||||
|
'physicalGasConsumption'=> $data['physicalGasConsumption'],
|
||||||
|
'trpPlusDrierGasConsumption'=> $data['trpPlusDrierGasConsumption'],
|
||||||
|
'trpPhysicalGasPerTon' => $data['trpPhysicalGasPerTon'],
|
||||||
|
'panelGasConsumption' => $data['panelGasConsumption'],
|
||||||
|
'panelGasPerTon' => $data['panelGasPerTon'],
|
||||||
|
'edRunningHours' => $data['edRunningHours'],
|
||||||
|
'edProduction' => $data['edProduction'],
|
||||||
|
'edUsage' => $data['edUsage'],
|
||||||
|
'trpProduction' => $data['trpProduction'],
|
||||||
|
'trpProductionPerHour' => $data['trpProductionPerHour'],
|
||||||
|
'waterReceipt' => $data['waterReceipt'],
|
||||||
|
'waterConsumption' => $data['waterConsumption'],
|
||||||
|
'ebReading' => $data['ebReading'],
|
||||||
|
'ebReadingPerUnitTon' => $data['ebReadingPerUnitTon'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbDataTrpWaste = [
|
||||||
|
'date' => $data['date'],
|
||||||
|
'msSeperation' => $data['msSeperation'],
|
||||||
|
'edWaste' => $data['edWaste'],
|
||||||
|
'coolerBags' => $data['coolerBags'],
|
||||||
|
'edPlus20Waste' => $data['edPlus20Waste'],
|
||||||
|
'cycloneWaste' => $data['cycloneWaste'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$trpMaintenanceResultExists = $this->TrpProductionMaintenance_model
|
||||||
|
->where('date', $date)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$trpProductionResultExists = $this->TrpProduction_model
|
||||||
|
->where('date', $date)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$trpWasteResultExists = $this->TrpProductionWaste_model
|
||||||
|
->where('date', $date)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (empty($trpMaintenanceResultExists)) {
|
||||||
|
$insertMaintanence[] = $dbDataTrpMaintenance;
|
||||||
|
$insertProduction[] = $dbDataTrpProduction;
|
||||||
|
$insertWaste[] = $dbDataTrpWaste;
|
||||||
|
} else {
|
||||||
|
$dbDataTrpMaintenance['id'] = $trpMaintenanceResultExists['id'];
|
||||||
|
$dbDataTrpProduction['id'] = $trpProductionResultExists['id'];
|
||||||
|
$dbDataTrpWaste['id'] = $trpWasteResultExists['id'];
|
||||||
|
|
||||||
|
$updateMaintanence[] = $dbDataTrpMaintenance;
|
||||||
|
$updateProduction[] = $dbDataTrpProduction;
|
||||||
|
$updateWaste[] = $dbDataTrpWaste;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the transaction
|
||||||
|
$this->db->transBegin();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!empty($insertMaintanence)) {
|
||||||
|
$this->TrpProductionMaintenance_model->insertBatch($insertMaintanence);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($insertProduction)) {
|
||||||
|
$this->TrpProduction_model->insertBatch($insertProduction);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($insertWaste)) {
|
||||||
|
$this->TrpProductionWaste_model->insertBatch($insertWaste);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updateMaintanence)) {
|
||||||
|
$this->TrpProductionMaintenance_model->updateBatch($updateMaintanence, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updateProduction)) {
|
||||||
|
$this->TrpProduction_model->updateBatch($updateProduction, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updateWaste)) {
|
||||||
|
$this->TrpProductionWaste_model->updateBatch($updateWaste, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit the transaction if all operations are successful
|
||||||
|
$this->db->transCommit();
|
||||||
|
echo "Data Saved Successfully";
|
||||||
|
|
||||||
|
} catch (\Exception $error) {
|
||||||
|
// Rollback the transaction in case of any errors
|
||||||
|
$this->db->transRollback();
|
||||||
|
echo "An error occurred: " . $error->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function updateTrpProductionDetails(){}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
48
app/Models/TrpProductionMaintenanceModel.php
Normal file
48
app/Models/TrpProductionMaintenanceModel.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class TrpProductionMaintenanceModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 't_trpProductionMaintenanceDetails';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = ['date', 'openingTime', 'closingTime', 'totalHours', 'coldStart', 'breakdownHours', 'burnerFiringHours',
|
||||||
|
'sandFeedingHours', 'workingPersonEngineers', 'workingPersonSupervisiors', 'workingPersonOperators',
|
||||||
|
'rollerDrivers', 'natureOfMaintenance', 'location', 'description'];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
||||||
230
app/Models/TrpProductionModel.php
Normal file
230
app/Models/TrpProductionModel.php
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class TrpProductionModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 't_trpProductionDetails';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = ['date', 'gasReceiptBg', 'gasReceiptPg', 'physicalGasConsumption', 'trpPlusDrierGasConsumption',
|
||||||
|
'trpPhysicalGasPerTon', 'panelGasConsumption','panelGasPerTon','edRunningHours','edProduction','edUsage',
|
||||||
|
'trpProduction', 'trpProductionPerHour', 'waterReceipt', 'waterConsumption' ,'ebReading',
|
||||||
|
'ebReadingPerUnitTon'];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function trpProductionDetails($startDate,$endDate){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Subquery definition
|
||||||
|
$subquery = $this->db->table('t_materialmaster')
|
||||||
|
->select('materialCode')
|
||||||
|
->where('Category', 'waste core')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$materialCodes = array_column($subquery, 'materialCode'); // Extracts 'materialCode' values
|
||||||
|
|
||||||
|
// Convert the array of material codes to a comma-separated string
|
||||||
|
$materialCodesString = "'" . implode("','", $materialCodes) . "'";
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
|
||||||
|
tpmd.date,
|
||||||
|
tpmd.openingTime,
|
||||||
|
tpmd.closingTime,
|
||||||
|
tpmd.totalHours,
|
||||||
|
tpmd.coldStart,
|
||||||
|
tpmd.breakdownHours,
|
||||||
|
tpmd.burnerFiringHours,
|
||||||
|
tpmd.sandFeedingHours,
|
||||||
|
tpmd.workingPersonEngineers,
|
||||||
|
tpmd.workingPersonSupervisiors,
|
||||||
|
tpmd.workingPersonOperators,
|
||||||
|
tpmd.rollerDrivers,
|
||||||
|
tpmd.natureOfMaintenance,
|
||||||
|
tpmd.location,
|
||||||
|
tpmd.description,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tpd.gasReceiptBg,
|
||||||
|
tpd.gasReceiptPg,
|
||||||
|
tpd.physicalGasConsumption,
|
||||||
|
tpd.trpPlusDrierGasConsumption,
|
||||||
|
tpd.trpPhysicalGasPerTon,
|
||||||
|
tpd.panelGasConsumption,
|
||||||
|
tpd.panelGasPerTon,
|
||||||
|
tpd.edRunningHours,
|
||||||
|
tpd.edProduction,
|
||||||
|
tpd.edUsage,
|
||||||
|
tpd.trpProduction,
|
||||||
|
tpd.trpProductionPerHour,
|
||||||
|
tpd.waterReceipt,
|
||||||
|
tpd.waterConsumption,
|
||||||
|
tpd.ebReading,
|
||||||
|
tpd.ebReadingPerUnitTon,
|
||||||
|
|
||||||
|
|
||||||
|
tpwd.msSeperation,
|
||||||
|
tpwd.edWaste,
|
||||||
|
tpwd.coolerBags,
|
||||||
|
tpwd.edPlus20Waste,
|
||||||
|
tpwd.cycloneWaste,
|
||||||
|
|
||||||
|
|
||||||
|
tcmd.totalGasConsumption as coatingGasConsumption,
|
||||||
|
|
||||||
|
tdmd.total_gas_consumption as drierGasConsumption,
|
||||||
|
|
||||||
|
|
||||||
|
tsu.total_kgs as coating,
|
||||||
|
|
||||||
|
invItems.TotalRsQuantity,
|
||||||
|
|
||||||
|
tigrd.TotalQuantityAsPerInvoice
|
||||||
|
|
||||||
|
|
||||||
|
FROM
|
||||||
|
t_trpProductionMaintenanceDetails tpmd
|
||||||
|
JOIN
|
||||||
|
t_trpProductionDetails tpd ON tpd.date = tpmd.date
|
||||||
|
JOIN
|
||||||
|
t_trpProductionWasteDetails tpwd ON tpwd.date = tpmd.date
|
||||||
|
LEFT JOIN
|
||||||
|
t_coatingMachineDetails tcmd ON tcmd.date = tpmd.date
|
||||||
|
LEFT JOIN
|
||||||
|
t_drierMachineDetails tdmd ON tdmd.date = tpmd.date
|
||||||
|
LEFT JOIN
|
||||||
|
t_trp_sand_use tsu ON tsu.date = tpmd.date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
Select
|
||||||
|
clients.client_name,
|
||||||
|
invItems.item_date_added,
|
||||||
|
SUM(invItems.item_quantity) AS TotalRsQuantity
|
||||||
|
|
||||||
|
from ip_invoice_items invItems
|
||||||
|
|
||||||
|
-- All joins to get client name thats it
|
||||||
|
LEFT JOIN
|
||||||
|
ip_invoices inv
|
||||||
|
ON inv.invoice_id = invItems.invoice_id
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
ip_clients clients
|
||||||
|
ON clients.client_id = inv.client_id
|
||||||
|
|
||||||
|
-- getting core reclamation sand
|
||||||
|
Where invItems.item_name = 'Core Sand Reclaimed'
|
||||||
|
|
||||||
|
-- grouping Client who provides reclamation sand on a particular date with 1 or more invoices
|
||||||
|
Group By invItems.item_date_added , clients.client_name
|
||||||
|
|
||||||
|
) invItems
|
||||||
|
ON invItems.item_date_added = tpmd.date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
Select tigrd.CreatedDate ,tigrd.MaterialCode , tigrd.IGRNo , ts.SupplierName,
|
||||||
|
SUM(QuantityAsPerInvoice) AS TotalQuantityAsPerInvoice
|
||||||
|
|
||||||
|
from t_igr_details tigrd
|
||||||
|
|
||||||
|
-- All joins to get supplier name thats it
|
||||||
|
LEFT JOIN
|
||||||
|
t_igr_master tigm
|
||||||
|
ON tigm.IGRNo = tigrd.IGRNo
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
t_purchaseorder_master tpom
|
||||||
|
ON tpom.PONO = tigm.PONO
|
||||||
|
|
||||||
|
LEFT JOIN
|
||||||
|
t_supplierdetailsn ts
|
||||||
|
ON tpom.SupplierID = ts.SupplierID
|
||||||
|
|
||||||
|
-- getting waste core sands using three distinct material codes
|
||||||
|
Where tigrd.MaterialCode IN ($materialCodesString)
|
||||||
|
|
||||||
|
-- grouping supplier who provides waste core on a particular date with 1 or more IGRS
|
||||||
|
Group By Date(tigrd.CreatedDate) , ts.SupplierName
|
||||||
|
|
||||||
|
) tigrd
|
||||||
|
ON DATE(tigrd.CreatedDate) = tpmd.date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
tpmd.date >= ?
|
||||||
|
AND
|
||||||
|
tpmd.date <= ?
|
||||||
|
|
||||||
|
|
||||||
|
ORDER BY
|
||||||
|
tpmd.date ASC";
|
||||||
|
|
||||||
|
// Execute the query
|
||||||
|
$query = $this->db->query($sql, [ $startDate, $endDate]);
|
||||||
|
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
46
app/Models/TrpProductionWasteModel.php
Normal file
46
app/Models/TrpProductionWasteModel.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class TrpProductionWasteModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 't_trpProductionWasteDetails';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = ['date','msSeperation','edWaste','coolerBags','edPlus20Waste','cycloneWaste'];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
protected bool $updateOnlyChanged = true;
|
||||||
|
|
||||||
|
protected array $casts = [];
|
||||||
|
protected array $castHandlers = [];
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
}
|
||||||
1148
app/Views/trpProductionStockDetails.php
Normal file
1148
app/Views/trpProductionStockDetails.php
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user