diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 3c886bdb..faab92de 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -293,6 +293,9 @@ class StockController extends BaseController { if ($this->request->getMethod() === 'POST') { + + $remark = $this->request->getPost('remark'); + $month = $this->request->getPost('month'); $date = DateTime::createFromFormat('M-Y', $month); @@ -301,6 +304,8 @@ class StockController extends BaseController $month = $formattedDate; } else { + $remark = $this->request->getVar('remark'); + $month = date('Y-m'); } @@ -311,9 +316,9 @@ class StockController extends BaseController $materialCodes = $this->rawmaterialdetails_model->getAllSilicaRawMaterialCode(); if (!empty($materialCodes)) { - $data['igrDetails'] = $this->inwardGateRegister_model->findIgrDetailsForIncomingSilicaSand($materialCodes, $month); + $data['igrDetails'] = $this->inwardGateRegister_model->findIgrDetailsForIncomingSilicaSand($materialCodes, $month,$remark); - } else { + } else { $data['igrDetails'] = []; } @@ -323,6 +328,8 @@ class StockController extends BaseController $data['month'] = $formattedDate; + $data['remark'] = $remark; + return $this->loadViews("incomingSilicaSandDetails", $this->global, $data, NULL); } @@ -338,7 +345,7 @@ class StockController extends BaseController $updates = []; foreach ($incomingSilicaSandDetailsData as $data) { - + $id = $data['id']; $dbData = [ @@ -370,7 +377,6 @@ class StockController extends BaseController 'salableQty' => $data['Salable Qty'], 'remark' => $data['Remark'] - ]; diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index d4b3bb56..49011109 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1031,12 +1031,11 @@ class Inwardgateregister_model extends Model return $result; } - public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month) - { + public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month ,$remark) + { $builder = $this->db->table('t_igr_details') ->select( - 't_igr_details.IGRNO, - t_igr_details.Remarks, + 't_igr_details.IGRNO, t_igr_details.MaterialCode, igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, igrMast.DeliveryChellanDate as invoiceDate, @@ -1046,17 +1045,24 @@ class Inwardgateregister_model extends Model 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') + ->like('t_igr_details.CreatedDate', $month, 'after'); + + // remark needed for those who selected any remark. + if ($remark != "noRemark") { + $builder->where('issd.remark', $remark); + } + + $builder->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode') ->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO') - ->join('t_incomingSilicaSandDetails issd', + ->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'); + ->orderBy('t_igr_details.CreatedDate', 'DESC'); $query = $builder->get(); - $result = $query->getResultArray(); + $result = $query->getResultArray(); + return $result; } diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index edae186c..f3a388f4 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -293,7 +293,11 @@ $('#MaterialName').change(function() { - var materialname = $('#MaterialName').val(); + var materialname = $('#MaterialName').val().trim(); + + if(materialname == ''){ + return; + } //material = material.replace(/\s*$/,""); var material = materialname.replace(/ /g, ''); @@ -307,8 +311,6 @@ url: "materialExist", success: function(data) { var count = data.length; - //alert(count); - console.log(data[0].IsActive); if (count >= 1) { $('#loader').hide(); if(data[0].IsActive == 1){ @@ -330,13 +332,16 @@ $("#MaterialName").focus(); } else { $('#loader').hide(); - // alert("empty data"); } }, error: function() { $('#loader').hide(); alert("Error Occur"); + }, + complete: function(){ + $('#loader').hide(); + console.log("Ajax completed..!!"); } }); }); diff --git a/app/Views/drierMachineDetails.php b/app/Views/drierMachineDetails.php index d59dc832..0327310a 100644 --- a/app/Views/drierMachineDetails.php +++ b/app/Views/drierMachineDetails.php @@ -291,7 +291,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');