From 13b851d4be301652960e9ab49d7595d340066bf7 Mon Sep 17 00:00:00 2001 From: vadivel J Date: Mon, 21 Oct 2024 17:52:38 +0530 Subject: [PATCH] incoming silica sand details 70% comp --- app/Controllers/StockController.php | 30 +++- ...php => IncomingSilicaSandDetailsModel.php} | 0 app/Models/Inwardgateregister_model.php | 33 +++- app/Models/Rawmaterialdetails_model.php | 13 ++ app/Views/includes/new_header.php | 4 +- ...ails.php => incomingSilicaSandDetails.php} | 156 ++++++++++++------ 6 files changed, 180 insertions(+), 56 deletions(-) rename app/Models/{incomingSilicaSanddetails_model.php => IncomingSilicaSandDetailsModel.php} (100%) rename app/Views/{incomingSilicaSanddetails.php => incomingSilicaSandDetails.php} (72%) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 4a149c74..b37fe08b 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -5,6 +5,9 @@ namespace App\Controllers; use App\Controllers\BaseController; use App\Models\CoatingMachineDetailsModel; use App\Models\DrierMachineDetailsModel; +use App\Models\IncomingSilicaSandDetailsModel; +use App\Models\Inwardgateregister_model; +use App\Models\Rawmaterialdetails_model; use CodeIgniter\HTTP\ResponseInterface; use DateTime; @@ -13,7 +16,10 @@ class StockController extends BaseController protected $coatingMachineDetails_model; protected $drierMachineDetails_model; - protected $session; + protected $incomingSilicaSandDetails_model; + protected $inwardGateRegister_model; + protected $rawmaterialdetails_model; + protected $session; /** * This is default constructor of the class @@ -23,6 +29,9 @@ class StockController extends BaseController parent::__construct(); $this->coatingMachineDetails_model = new CoatingMachineDetailsModel(); $this->drierMachineDetails_model = new DrierMachineDetailsModel(); + $this->rawmaterialdetails_model = new Rawmaterialdetails_model(); + $this->incomingSilicaSandDetails_model = new IncomingSilicaSandDetailsModel(); + $this->inwardGateRegister_model = new Inwardgateregister_model(); $this->session = session(); helper('form'); @@ -48,7 +57,6 @@ class StockController extends BaseController } else{ $month = date('Y-m'); - // dd($month); } $this->global['pageTitle'] = 'Coating Machine Details '; @@ -127,6 +135,24 @@ class StockController extends BaseController public function loadView_incomingSilicaSandDetails(){ + $month='2024-09'; + $data['month']=$month; + + $this->global['pageTitle']='Incoming Silica Sand Details'; + + $materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode(); + + if (!empty($materialCodes)) { // Proceed if there are matching MaterialCodes + $data['igrDetails'] = $this->inwardGateRegister_model->findIgrForSilicaSand($materialCodes,$month); + + } else { + $data['igrDetails'] = []; // If no materials found, return an empty array + } + + //$data['incomingSilicaSandDetails']=$this->incomingSilicaSandDetails_model-> + + return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL); + } public function updateIncomingSilicaSandDetails(){ diff --git a/app/Models/incomingSilicaSanddetails_model.php b/app/Models/IncomingSilicaSandDetailsModel.php similarity index 100% rename from app/Models/incomingSilicaSanddetails_model.php rename to app/Models/IncomingSilicaSandDetailsModel.php diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index b01167e6..2bb3b31e 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1030,5 +1030,36 @@ class Inwardgateregister_model extends Model $result = $query->getResult(); return $result; } + + public function findIgrForSilicaSand($materialCodes, $month) + { + $builder = $this->db->table('t_igr_details') + ->select('t_igr_details.IGRNO, + t_igr_details.MaterialCode, + igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, + igrMast.DeliveryChellanDate as invoiceDate, + igrMast.MaterialRcvdDate as materialRecievedDate, + supplierDetails.SupplierName, + igrMast.VehicleNo, + t_igr_details.Remarks, + SUM(t_igr_details.QuantityAsPerInvoice) as Qty, + issd.* ') + ->whereIn('t_igr_details.MaterialCode', $materialCodes) + ->like('t_igr_details.CreatedDate', $month, 'after') + ->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode') + ->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO') + ->join('t_incomingSilicaSandDetails issd', + 'issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode','left') + ->join('t_purchaseorder_master poMaster', 'poMaster.PONO = igrMast.PONO', 'left') + ->join('t_supplierdetailsn supplierDetails', 'supplierDetails.SupplierID = poMaster.SupplierID', 'left') + + ->orderBy('t_igr_details.CreatedDate', 'DESC'); -} \ No newline at end of file + $query = $builder->get(); + $result = $query->getResultArray(); + return $result; + } + + + +} \ No newline at end of file diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index c13d89d6..f5d792f3 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -123,6 +123,19 @@ class Rawmaterialdetails_model extends Model return $query->getResult(); } + function getAllSilicaRawMaterialCode(){ + + $builder = $this->db->table('t_materialmaster') + ->select('MaterialCode') + ->where('IsActive', 1) + ->like('LOWER(MaterialName)', 'silica sand') + ->orderBy('CreatedDate', 'desc'); + $query = $builder->get(); + $materialResults = $query->getResultArray(); + + return $materialCodes = array_column($materialResults, 'MaterialCode'); + } + function getMaterialstock($MaterialCode, $currentdate) diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index c3dcb318..75b91194 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -767,8 +767,8 @@ 10 TON Drier Details Coating Machine Details - - incoming silica sand Details + + incoming silica sand Details diff --git a/app/Views/incomingSilicaSanddetails.php b/app/Views/incomingSilicaSandDetails.php similarity index 72% rename from app/Views/incomingSilicaSanddetails.php rename to app/Views/incomingSilicaSandDetails.php index 4071fe74..347441e8 100644 --- a/app/Views/incomingSilicaSanddetails.php +++ b/app/Views/incomingSilicaSandDetails.php @@ -1,8 +1,4 @@ - -