diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 91c52fad..301e81c8 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -1282,10 +1282,14 @@ class batchcard extends BaseController $data['consumable_material']= $this->batchcard_model->get_consumablematerials(); $data['Raw_material'] = $this->batchcard_model->get_rawmaterials(); $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); - $data['supplier'] = $this->batchcard_model->getSupplierlist(); + $data['rawsupplier'] = $this->batchcard_model->Rawsupplier(); + $data['consusupplier'] = $this->batchcard_model->Consupplier(); + $data['packsupplier'] = $this->batchcard_model->Pacsupplier(); $data['stock_value'] = $this->batchcard_model->getStockValue(); $data['Records'] = $this->rawmaterialdetails_model->reOrderListing(); + //echo count($data['rawsupplier']);die(); + $this->global['pageTitle'] = 'Siddharth : Finished Product Batch Card'; $this->loadViews("FinalProduct", $this->global,$data,NULL); } @@ -1308,6 +1312,10 @@ class batchcard extends BaseController $data['stock_value'] = $this->batchcard_model->getStockValue(); $data['Records'] = $this->rawmaterialdetails_model->reOrderListing(); + + $data['rawsupplier'] = $this->batchcard_model->Rawsupplier(); + $data['consusupplier'] = $this->batchcard_model->Consupplier(); + $data['packsupplier'] = $this->batchcard_model->Pacsupplier(); $this->global['pageTitle'] = 'Siddharth : Finished Product Batch Card'; diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 066ceeea..1399e16a 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -27,6 +27,58 @@ class batchcard_model extends CI_Model } + + function Rawsupplier() + { + + $this->db->select('mas.SupplierID,sup.SupplierName'); + $this->db->from('T_PurchaseOrder_Master mas'); + $this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID'); + $this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO'); + $this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode'); + $this->db->where('Category','Raw Material'); + $this->db->group_by('SupplierID'); + $supp = $this->db->get(); + + + // print_r($this->db->last_query());die(); + return $supp->result(); + + + } + + + + function Consupplier() + { + $this->db->select('mas.SupplierID,sup.SupplierName'); + $this->db->from('T_PurchaseOrder_Master mas'); + $this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID'); + $this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO'); + $this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode'); + $this->db->where('Category','Consumables'); + $this->db->group_by('SupplierID'); + $supp = $this->db->get(); + return $supp->result(); + } + + + + function Pacsupplier() + { + $this->db->select('mas.SupplierID,sup.SupplierName'); + $this->db->from('T_PurchaseOrder_Master mas'); + $this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID'); + $this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO'); + $this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode'); + $this->db->where('Category','Packing material'); + $this->db->group_by('SupplierID'); + $supp = $this->db->get(); + return $supp->result(); + + } + + function getStockValue() { $this->db->select('MaterialCode,stock,stockdate'); diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php index faa01f62..ccdb0212 100644 --- a/application/views/FinalProduct.php +++ b/application/views/FinalProduct.php @@ -243,9 +243,9 @@ $(function() { $options = array("0"=>'Select Supplier'); - if(!empty($supplier)) + if(!empty($rawsupplier)) { - foreach ($supplier as $mat): + foreach ($rawsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -355,9 +355,9 @@ $(function() { $options = array("0"=>'Select Material Code'); - if(!empty($supplier)) + if(!empty($rawsupplier)) { - foreach ($supplier as $mat): + foreach ($rawsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -510,9 +510,9 @@ $(function() { $options = array("0"=>'Select Supplier'); - if(!empty($supplier)) + if(!empty($consusupplier)) { - foreach ($supplier as $mat): + foreach ($consusupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -619,9 +619,9 @@ $(function() { $options = array("0"=>'Select Material Code'); - if(!empty($supplier)) + if(!empty($consusupplier)) { - foreach ($supplier as $mat): + foreach ($consusupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -780,9 +780,9 @@ $(function() { $options = array("0"=>'Select Material Code'); - if(!empty($supplier)) + if(!empty($packsupplier)) { - foreach ($supplier as $mat): + foreach ($packsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -889,9 +889,9 @@ $(function() { $options = array("0"=>'Select Material Code'); - if(!empty($supplier)) + if(!empty($packsupplier)) { - foreach ($supplier as $mat): + foreach ($packsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; diff --git a/application/views/editFinalProduct.php b/application/views/editFinalProduct.php index e5b8332f..b096470b 100644 --- a/application/views/editFinalProduct.php +++ b/application/views/editFinalProduct.php @@ -251,9 +251,9 @@ $(function() { $options = array("0"=>'Select Supplier'); - if(!empty($supplier)) + if(!empty($rawsupplier)) { - foreach ($supplier as $mat): + foreach ($rawsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -548,9 +548,9 @@ $(function() { $options = array("0"=>'Select Supplier'); - if(!empty($supplier)) + if(!empty($consusupplier)) { - foreach ($supplier as $mat): + foreach ($consusupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName; @@ -837,9 +837,9 @@ $(function() { $options = array("0"=>'Select Material Code'); - if(!empty($supplier)) + if(!empty($packsupplier)) { - foreach ($supplier as $mat): + foreach ($packsupplier as $mat): $options[$mat->SupplierID] =$mat->SupplierID.' '.' - '.' '.$mat->SupplierName;