From 10a4af5f37db703399465fae8639e681f1806b75 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 19:27:58 +0530 Subject: [PATCH] filters added --- application/controllers/report.php | 84 ++++++-- application/controllers/user.php | 2 +- application/models/dahsboard_model.php | 129 +++++++++--- .../Report_Material_Master_ReceiptValue.php | 113 ++++++++++- application/views/Report_POreleased.php | 184 +++++++++++++++--- application/views/Report_openorder.php | 181 ++++++++++++++--- application/views/report_pendingreqst.php | 165 +++++++++++++--- 7 files changed, 736 insertions(+), 122 deletions(-) diff --git a/application/controllers/report.php b/application/controllers/report.php index d168191f..ea80e54f 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -24,14 +24,29 @@ class report extends BaseController } public function pending_report() { - + $this->global['pageTitle'] = 'Siddharth : Reports'; + if ($this->input->post('btn_submit')) { $this->global['pageTitle'] = 'Siddharth : Reports'; - - - $data['pending_list']=$this->dahsboard_Model->req_list(); + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + $agf = $this->input->post('aging_from'); + $agt = $this->input->post('aging_to'); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['pending_list']=$this->dahsboard_Model->req_list($fa,$aa,$m,$frm,$t,$agf,$agt); //print_r($data); - + + + + } + $data['finyear']=$this->dahsboard_Model->report_finyear(); + + //print_r($data); + if($this->DEPCode == MANAGEMENT) { @@ -44,17 +59,30 @@ class report extends BaseController { $this->loadViews("access", $this->global, $data, NULL); } - - } public function releasedPO() { - + $this->global['pageTitle'] = 'Siddharth : Reports'; + if ($this->input->post('btn_submit')) { $this->global['pageTitle'] = 'Siddharth : Reports'; - + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + $agf = $this->input->post('total_order_value_From'); + $agt = $this->input->post('total_order_value_To'); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['rel_po']=$this->dahsboard_Model->report_relpo($fa,$aa,$m,$frm,$t,$agf,$agt); + //print_r($data); + + - $data['rel_po']=$this->dahsboard_Model->report_relpo(); + } + + $data['finyear']=$this->dahsboard_Model->report_finyear(); if($this->DEPCode == MANAGEMENT) { @@ -68,12 +96,28 @@ class report extends BaseController } public function openorderPO() { - + $this->global['pageTitle'] = 'Siddharth : Reports'; + if ($this->input->post('btn_submit')) { $this->global['pageTitle'] = 'Siddharth : Reports'; - + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $frm = $this->input->post('from_date'); + $t = $this->input->post('to_date'); + $agf = $this->input->post('total_order_value_From'); + $agt = $this->input->post('total_order_value_To'); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['open_po']=$this->dahsboard_Model->report_openpending($fa,$aa,$m,$frm,$t,$agf,$agt); + //print_r($data); + + - $data['open_po']=$this->dahsboard_Model->report_openpending(); + } + + $data['finyear']=$this->dahsboard_Model->report_finyear(); + if($this->DEPCode == MANAGEMENT) { @@ -189,11 +233,17 @@ class report extends BaseController { $this->global['pageTitle'] = 'Siddharth : Reports'; + if ($this->input->post('btn_submit')) { + $this->global['pageTitle'] = 'Siddharth : Reports'; - - - $data['mmr']=$this->dahsboard_Model->report_MMReceiptValue(); - + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['mmr']=$this->dahsboard_Model->report_MMReceiptValue($fa,$aa,$m); + } + $data['finyear']=$this->dahsboard_Model->report_finyear(); if($this->DEPCode == MANAGEMENT) { $this->loadviews("Report_Material_Master_ReceiptValue",$this->global,$data, NULL); diff --git a/application/controllers/user.php b/application/controllers/user.php index 4808da90..424055f8 100755 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -57,7 +57,7 @@ class user extends BaseController $data['details']=$this->dahsboard_Model->reqdetail(); $data['pending_details']=$this->dahsboard_Model->req_pending(); - $data['list']=$this->dahsboard_Model->req_list(); + // $data['list']=$this->dahsboard_Model->req_list(); $data['serviceprogress']=$this->dahsboard_Model->serviceprogress(); $data['revenueprogress']=$this->dahsboard_Model->revenueprogress(); diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index f96ed100..78966dc7 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -507,27 +507,44 @@ WHERE Cost_Center_Budget.BudgetType='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`, - function req_list(){ - - + function req_list($fa,$aa,$m,$frm,$t,$agf,$agt){ $sql="select date_format(mas.ReqDate,'%d-%m-%Y') as ReqDate,mas.ReqNo,emp.FirstName as Requestedby,dep.DepartmentName,mas.ReqType,DATEDIFF(CURDATE(),mas.ReqDate) AS Aging from T_Requestion_Master as mas join T_CostCenter_Master cos on cos.CostCenterCode = mas.CostCenterCode join T_Employee_Details emp on emp.EmpID = mas.Requestedby join T_DepartmentDetails dep on dep.DEPCode=emp.Departmentcode where mas.Status = 'ST002' "; + if ($fa and $aa != ''){ + + $sql.=" and (mas.ReqDate >= '".$fa."-04-01' and mas.ReqDate <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + $sql.="and monthname(mas.ReqDate) = '".$m."'"; + + } + + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + $sql.="and date(mas.ReqDate) >= '".$fromd."' + and date(mas.ReqDate) <= '".$tod."'"; + + } + if ($agf and $agt != ''){ + + $sql.="and DATEDIFF(CURDATE(),mas.ReqDate) >= '".$agf."' + and DATEDIFF(CURDATE(),mas.ReqDate) <= '".$agt."'"; + + } $query = $this->db->query($sql); //print_r($this->db->last_query()); return $query->result(); - - - + } - } - - function report_relpo(){ - - + function report_relpo($fa,$aa,$m,$frm,$t,$agf,$agt){ $sql="select Mast.PONO,Mast.POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ReleasedOn,'%d-%m-%Y') as ReleasedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue from T_PurchaseOrder_Master Mast JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO @@ -538,17 +555,38 @@ JOIN T_CostCenter_Master as Cost on Cost.CostCenterCode=Req.CostCenterCode JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode where Mast.Status='ST026' -group by Mast.PONO"; + "; +if ($fa and $aa != ''){ + + $sql.=" and (Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + $sql.="and monthname(Mast.PODate) = '".$m."'"; + + } + + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + $sql.="and date(Mast.PODate) >= '".$fromd."' + and date(Mast.PODate) <= '".$tod."'"; + + } + if ($agf and $agt != ''){ + + $sql.="and Mast.TotalOrderValue >= '".$agf."' + and Mast.TotalOrderValue <= '".$agt."'"; + + } + $sql.=" group by Mast.PONO"; $query = $this->db->query($sql); return $query->result(); - - - - } + } - function report_openpending(){ - - + function report_openpending($fa,$aa,$m,$frm,$t,$agf,$agt){ $sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ApprovedOn,'%d-%m-%Y') as ApprovedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue from T_PurchaseOrder_Master Mast JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO @@ -558,9 +596,36 @@ JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Emp_Det.Department JOIN T_CostCenter_Master as Cost on Cost.CostCenterCode=Req.CostCenterCode JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode -where Mast.Status='ST025' or Mast.Status='ST005' -group by PONO,POType,Dept_Name"; +where (Mast.Status='ST025' or Mast.Status='ST005') + "; +if ($fa and $aa != ''){ + + $sql.=" and (Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + $sql.="and monthname(Mast.PODate) = '".$m."'"; + + } + + if ($frm and $t != ''){ + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); + + $sql.="and date(Mast.PODate) >= '".$fromd."' + and date(Mast.PODate) <= '".$tod."'"; + + } + if ($agf and $agt != ''){ + + $sql.="and Mast.TotalOrderValue >= '".$agf."' + and Mast.TotalOrderValue <= '".$agt."'"; + + } + $sql.=" group by PONO,POType,Dept_Name"; $query = $this->db->query($sql); + //echo $sql; return $query->result(); @@ -666,16 +731,28 @@ group by po.SupplierID,pl.MaterialCode"; } - function report_MMReceiptValue(){ + function report_MMReceiptValue($fa,$aa,$m){ $sql="select -DATE_FORMAT(IF(matv.PODate = '0000-00-00', NOW(), matv.PODate), '%b-%Y') AS Month, +DATE_FORMAT(IF(pm.PODate = '0000-00-00', NOW(), pm.PODate), '%b-%Y') AS Month, matv.MaterialCode,mat.MaterialName,mat.UOM,ROUND(AVG(matv.Rate),2) as Average_Rate from T_MaterialItem_PO matv -join T_MaterialMaster mat on matv.MaterialCode=mat.MaterialCode -group by matv.MaterialCode -order by monthname(matv.PODate)"; +join T_PurchaseOrder_Master pm on pm.CreatedDate = matv.CreatedDate +join T_MaterialMaster mat on matv.MaterialCode=mat.MaterialCode +where pm.PODate != 0 "; +if ($fa and $aa != ''){ + + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + $sql.="and monthname(pm.PODate) = '".$m."'"; + + } + $sql.=" group by matv.MaterialCode"; + $sql.=" order by monthname(pm.PODate)"; $query = $this->db->query($sql); return $query->result(); diff --git a/application/views/Report_Material_Master_ReceiptValue.php b/application/views/Report_Material_Master_ReceiptValue.php index 5747f14d..8526ec5c 100755 --- a/application/views/Report_Material_Master_ReceiptValue.php +++ b/application/views/Report_Material_Master_ReceiptValue.php @@ -25,6 +25,10 @@ if(!empty($mmr)) float: right; } + .btn-success { + background-color: #3c8dbc; + border-color: #3c8dbc; + } @@ -34,11 +38,97 @@ if(!empty($mmr))
-

Report - Material Master - Receipt Value

+

Report - Material Master - Receipt Value +

+ input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } + if($this->input->post('month')){ + $m=$this->input->post('month'); + echo '('.$m.')'; + echo ' '; + } + + ?> +

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

+ + +
+
+
+ + + +
@@ -58,7 +148,9 @@ if(!empty($mmr)) - @@ -68,7 +160,9 @@ if(!empty($mmr)) MaterialCode?> MaterialName?> UOM?> - Average_Rate,2,'.','')?> + Average_Rate,2,'.',''); + echo number_format($rel->Average_Rate,2,'.','')?> @@ -79,6 +173,15 @@ if(!empty($mmr)) } ?> + + + + + + +
@@ -111,7 +214,7 @@ $(document).ready(function() { { extend: 'excelHtml5', footer: 'true', - //messageTop: $('h3').text(), + messageTop: $('h3').text(), title: 'Report - Material Master - ReceiptValue', exportOptions: { columns: ':visible' diff --git a/application/views/Report_POreleased.php b/application/views/Report_POreleased.php index 851b33d7..c52db1b5 100755 --- a/application/views/Report_POreleased.php +++ b/application/views/Report_POreleased.php @@ -25,6 +25,10 @@ if(!empty($rel_po)) float: right; } + .btn-success { + background-color: #3c8dbc; + border-color: #3c8dbc; + } @@ -34,30 +38,144 @@ if(!empty($rel_po))
-

Order Value - Released

+

Order Value - Released +

+ input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } + if($this->input->post('month')){ + $m=$this->input->post('month'); + echo '('.$m.')'; + 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; + } + if($this->input->post('total_order_value_From') && $this->input->post('total_order_value_To')){ + $tfrm = $this->input->post('total_order_value_From'); + $tt = $this->input->post('total_order_value_To'); + echo 'Total Order Value between'.' '.'RS.'.$tfrm.'-to-'.'RS.'.$tt; + } + ?> +

-
-
-
-
Total Order Value From:
- -
to
- - -
-
- -
-
-
Released Date From:
- -
to
- - -
-
-
+
+ +
+ +
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + + +
@@ -67,7 +185,7 @@ if(!empty($rel_po)) PO NO PO Type - Created Date + PO Date Released Date Requested Department Total Order Value  ( ) @@ -75,7 +193,9 @@ if(!empty($rel_po)) - @@ -85,7 +205,9 @@ if(!empty($rel_po)) PODate);echo $date->format('d-m-Y'); ?> ReleasedDate);echo $date->format('d-m-Y'); ?> Dept_Name?> - TotalOrderValue,2,'.','')?> + TotalOrderValue,2,'.',''); + echo number_format($rel->TotalOrderValue,2,'.','')?> @@ -95,6 +217,16 @@ if(!empty($rel_po)) } ?> + + + + + + + +
@@ -127,7 +259,7 @@ $(document).ready(function() { { extend: 'excelHtml5', footer: 'true', - //messageTop: $('h3').text(), + messageTop: $('h3').text(), title: 'Report - Released PO', exportOptions: { columns: ':visible' diff --git a/application/views/Report_openorder.php b/application/views/Report_openorder.php index 49555990..ff527f6c 100755 --- a/application/views/Report_openorder.php +++ b/application/views/Report_openorder.php @@ -25,6 +25,10 @@ if(!empty($open_po)) float: right; } + .btn-success { + background-color: #3c8dbc; + border-color: #3c8dbc; + } @@ -34,29 +38,144 @@ if(!empty($open_po))
-

Open Orders - Pending

+

Open Orders - Pending +

+ input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } + if($this->input->post('month')){ + $m=$this->input->post('month'); + echo '('.$m.')'; + 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; + } + if($this->input->post('total_order_value_From') && $this->input->post('total_order_value_To')){ + $tfrm = $this->input->post('total_order_value_From'); + $tt = $this->input->post('total_order_value_To'); + echo 'Total Order Value between'.' '.'RS.'.$tfrm.'-to-'.'RS.'.$tt; + } + ?> +

-
-
-
-
Total Order Value From:
- -
to
- - -
-
-
-
-
PO Date From:
- -
to
- - -
-
-
+
+ +
+ +
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + + +
@@ -74,7 +193,9 @@ if(!empty($open_po)) - @@ -84,7 +205,9 @@ if(!empty($open_po)) PODate?> ApprovedDate?> Dept_Name?> - TotalOrderValue,2,'.','')?> + TotalOrderValue,2,'.',''); + echo number_format($rel->TotalOrderValue,2,'.','')?> @@ -94,6 +217,16 @@ if(!empty($open_po)) } ?> + + + + + + + +
@@ -126,7 +259,7 @@ $(document).ready(function() { { extend: 'excelHtml5', footer: 'true', - //messageTop: $('h3').text(), + messageTop: $('h3').text(), title: 'Report - Open Order-Pending', exportOptions: { columns: ':visible' diff --git a/application/views/report_pendingreqst.php b/application/views/report_pendingreqst.php index 9e8cc8b7..c920b256 100755 --- a/application/views/report_pendingreqst.php +++ b/application/views/report_pendingreqst.php @@ -25,38 +25,157 @@ if(!empty($pending_list)) float: right; } - + .btn-success { + background-color: #3c8dbc; + border-color: #3c8dbc; + } +
-

Total Pending Requests

+

Total Pending Requests +

+ input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } + if($this->input->post('month')){ + $m=$this->input->post('month'); + echo '('.$m.')'; + 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; + } + if($this->input->post('aging_from') && $this->input->post('aging_to')){ + $tfrm = $this->input->post('aging_from'); + $tt = $this->input->post('aging_to'); + echo 'Aging between'.' '.$tfrm.'-to-'.$tt.' '.'days'; + } + ?> +

-
-
-
-
Aging From:
- -
To
- - -
-
-
-
-
Request Date From:
- -
To
- - -
-
-
+
+ +
+ +
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+ +
+

+ + +
+
+
+ + + +
@@ -125,7 +244,7 @@ $(document).ready(function() { { extend: 'excelHtml5', footer: 'true', - //messageTop: $('h3').text(), + messageTop: $('h3').text(), title: 'Report - Pending Request', exportOptions: { columns: ':visible'