From e11ac51e19cdfb777ee9e164054e569a00ddd096 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 12 Jun 2018 17:37:20 +0530 Subject: [PATCH] Filters added in material history --- application/controllers/batchcard.php | 9 +- application/models/batchcard_model.php | 28 ++- application/views/MaterialHistory.php | 283 +++++++++++++++++++++---- 3 files changed, 272 insertions(+), 48 deletions(-) diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 928a834e..6fe21c47 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -1823,8 +1823,13 @@ class batchcard extends BaseController function material_history() { $this->global['pageTitle'] = 'Siddharth : Material History'; - - $data['material']=$this->batchcard_model->getMaterial_history(); + if ($this->input->post('btn_submit')) { + $prod = $this->input->post('item_name'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + $data['material']=$this->batchcard_model->getMaterial_history($prod,$frm,$t); + } + $data['material_name']=$this->batchcard_model->material_name(); $this->loadviews("MaterialHistory",$this->global,$data,NULL); diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index cfde19d2..27840572 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -1052,11 +1052,33 @@ and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; $res = $this->db->get(); return $res->result(); } - function getMaterial_history() + function material_name(){ + $sql="SELECT distinct MaterialName FROM T_MaterialMaster;"; + $query = $this->db->query($sql); + return $query->result(); + } + function getMaterial_history($prod,$frm,$t) { - $sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,msh.CreatedOn FROM T_Material_stock_history as msh + $sql="SELECT msh.StockId,sd.SupplierName,mm.MaterialName,msh.Transaction_type,msh.Ref_Type,msh.Ref_No,msh.Quantity,msh.ItemValue,date_format(msh.UpdatedOn,'%d-%m-%Y') as updatedOn FROM T_Material_stock_history as msh left join T_SupplierDetailsN as sd on sd.SupplierID=msh.SupplierID - left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode"; + left join T_MaterialMaster as mm on mm.MaterialCode=msh.MaterialCode + where msh.StockId != 'null' "; + if ($prod!= ''){ + + $sql.=" and mm.MaterialName = '".$prod."' "; + + } + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + + $sql.="and date(msh.UpdatedOn) >= '".$fromd."' + and date(msh.UpdatedOn) <= '".$tod."'"; + + } + + $query =$this->db->query($sql); return $query->result(); diff --git a/application/views/MaterialHistory.php b/application/views/MaterialHistory.php index a965881f..94375abe 100644 --- a/application/views/MaterialHistory.php +++ b/application/views/MaterialHistory.php @@ -1,35 +1,155 @@ + + + + + +
+
+
+ +
+ +
+
+

Siddharth Industries - Material History

+ input->post('item_name')){ + $it=$this->input->post('item_name'); + echo $it; + echo ' '.' '; + } + + + if($this->input->post('from_date') && $this->input->post('to_date')){ + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + echo $frm.'-to-'.$t; + } + + ?>

+
+ + +
+ +
+ +
+
+ +
+ +
+
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + - -
- - - -
-
-
-
-
-

Siddharth Industries - Material History

- -
- + +
+
+ - + @@ -46,6 +166,8 @@ + - + @@ -75,31 +196,107 @@ ?>
Stock ID Supplier Name Material NameUpdatedON Transaction Type Ref Type Ref NO Quantity Item ValueCreatedON
StockId;?> SupplierName;?> MaterialName;?>updatedOn;?> Transaction_type;?> Quantity;?> ItemValue;?>CreatedOn;?>
- -
-
- -
- -
- - - - + + + + + + + + + \ No newline at end of file