diff --git a/api_test.http b/api_test.http new file mode 100644 index 00000000..771a4c36 --- /dev/null +++ b/api_test.http @@ -0,0 +1,4 @@ + + +//$routes->match(['GET', 'POST'], 'trpProductionDetails', 'StockController::trpProductionDetails'); +GET http://localhost/ci4/ria/trpProductionDetails diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index cba95223..1abcfdab 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -1305,13 +1305,20 @@ class StockController extends BaseController $startDate = "$month-01"; $endDate = date("Y-m-t", strtotime($startDate)); + $data['trpProductionDetails'] = $this->TrpProductionMaintenance_model - ->join('t_trpProduction', 't_trpProduction.date = t_trpProductionMaintenance.date') - ->join('t_trpProductionWaste', 't_trpProductionWaste.date = t_trpProductionMaintenance.date') - ->where('date >=', $startDate) - ->where('date <=', $endDate) - ->orderBy('date', 'asc') - ->findAll(); + ->select('tpmd.*, tpd.*, tpwd.*') + ->from('t_trpProductionMaintenanceDetails tpmd') + ->join('t_trpProductionDetails tpd', 'tpd.date = tpmd.date') + ->join('t_trpProductionWasteDetails tpwd', 'tpwd.date = tpmd.date') + // ->join('ip_invoice_items', 'ip_invoice_items.item_date_added = tpmd.date',' AND ip_invoice_items.item_name = "Core Sand Reclaimed"') + ->where('tpmd.date >=', $startDate) + ->where('tpmd.date <=', $endDate) + ->orderBy('tpmd.date', 'asc') + ->get() + ->getResultArray(); + + $date = DateTime::createFromFormat('Y-m', $month); @@ -1319,7 +1326,9 @@ class StockController extends BaseController $data['month'] = $formattedDate; - return $this->loadViews("trpSandUseStockDetails", $this->global, $data, NULL); + return $this->response->setJSON($data); + + // return $this->loadViews("trpSandUseStockDetails", $this->global, $data, NULL);