stock module latest today vadivel J 15-02-2025
This commit is contained in:
parent
cbf9c4e42e
commit
cc39f48ae5
@ -54,19 +54,20 @@ class TrpProductionModel extends Model
|
|||||||
public function trpProductionDetails($startDate,$endDate){
|
public function trpProductionDetails($startDate,$endDate){
|
||||||
|
|
||||||
|
|
||||||
|
$data =[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Subquery definition
|
// Subquery definition
|
||||||
$subquery = $this->db->table('t_materialmaster')
|
$subquery = $this->db->table('t_materialmaster')
|
||||||
->select('materialCode')
|
->select('materialCode')
|
||||||
->where('Category', 'waste core')
|
->where('Category = 328')
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
$materialCodes = array_column($subquery, 'materialCode'); // Extracts 'materialCode' values
|
$materialCodes = array_column($subquery, 'materialCode'); // Extracts 'materialCode' values
|
||||||
|
|
||||||
|
// dd($this->db->getLastQuery());
|
||||||
|
|
||||||
// Convert the array of material codes to a comma-separated string
|
// Convert the array of material codes to a comma-separated string
|
||||||
// $materialCodesString = "'" . implode("','", $materialCodes) . "'";
|
// $materialCodesString = "'" . implode("','", $materialCodes) . "'";
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ class TrpProductionModel extends Model
|
|||||||
|
|
||||||
$subquery3 = $this->db->table('ip_invoice_items invItems')
|
$subquery3 = $this->db->table('ip_invoice_items invItems')
|
||||||
->select([
|
->select([
|
||||||
'invItems.*',
|
'invItems.item_date_added',
|
||||||
$caseSQL
|
$caseSQL
|
||||||
])
|
])
|
||||||
->join('ip_invoices inv', 'inv.invoice_id = invItems.invoice_id', 'left')
|
->join('ip_invoices inv', 'inv.invoice_id = invItems.invoice_id', 'left')
|
||||||
@ -205,6 +206,7 @@ class TrpProductionModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$materialCodes = ! empty($materialCodes) ? $materialCodes : [''] ;
|
||||||
|
|
||||||
// Subquery: Waste Core Sand Suppliers
|
// Subquery: Waste Core Sand Suppliers
|
||||||
$subquery4 = $this->db->table('t_igr_details tigrd')
|
$subquery4 = $this->db->table('t_igr_details tigrd')
|
||||||
@ -221,7 +223,7 @@ class TrpProductionModel extends Model
|
|||||||
->join('t_igr_master tigm', 'tigm.IGRNo = tigrd.IGRNo', 'left')
|
->join('t_igr_master tigm', 'tigm.IGRNo = tigrd.IGRNo', 'left')
|
||||||
->join('t_purchaseorder_master tpom', 'tpom.PONO = tigm.PONO', 'left')
|
->join('t_purchaseorder_master tpom', 'tpom.PONO = tigm.PONO', 'left')
|
||||||
->join('t_supplierdetailsn ts', 'tpom.SupplierID = ts.SupplierID', 'left')
|
->join('t_supplierdetailsn ts', 'tpom.SupplierID = ts.SupplierID', 'left')
|
||||||
->whereIn('tigrd.MaterialCode', $materialCodes) // FIXED: Now correctly formatted
|
->whereIn('tigrd.MaterialCode', $materialCodes)
|
||||||
->where('tigrd.CreatedDate >=', $startDate)
|
->where('tigrd.CreatedDate >=', $startDate)
|
||||||
->where('tigrd.CreatedDate <=', $endDate)
|
->where('tigrd.CreatedDate <=', $endDate)
|
||||||
->groupBy('DATE(tigrd.CreatedDate)')
|
->groupBy('DATE(tigrd.CreatedDate)')
|
||||||
@ -237,9 +239,13 @@ class TrpProductionModel extends Model
|
|||||||
$builder->where('tpmd.date >=', $startDate);
|
$builder->where('tpmd.date >=', $startDate);
|
||||||
$builder->where('tpmd.date <=', $endDate);
|
$builder->where('tpmd.date <=', $endDate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Order by date
|
// Order by date
|
||||||
$builder->orderBy('tpmd.date', 'ASC');
|
$builder->orderBy('tpmd.date', 'ASC');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Execute the query
|
// Execute the query
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
$result = $query->getResultArray();
|
$result = $query->getResultArray();
|
||||||
|
|||||||
@ -485,8 +485,8 @@ $timeOtions[] = "12:00 AM";
|
|||||||
|
|
||||||
<?php if (!empty($trpProductionDetails)) {
|
<?php if (!empty($trpProductionDetails)) {
|
||||||
|
|
||||||
dd(array_keys($trpProductionDetails[0]));
|
// dd(array_keys($trpProductionDetails[0]));
|
||||||
dd($trpProductionDetails);
|
// dd($trpProductionDetails);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user