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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
| Stock ID |
Supplier Name |
Material Name |
+ UpdatedON |
Transaction Type |
Ref Type |
Ref NO |
Quantity |
Item Value |
- CreatedON |
+
@@ -46,6 +166,8 @@
StockId;?> |
SupplierName;?> |
MaterialName;?> |
+ updatedOn;?> |
Transaction_type;?> |
Quantity;?> |
ItemValue;?> |
- CreatedOn;?> |
+
@@ -75,31 +196,107 @@
?>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file