diff --git a/application/controllers/report.php b/application/controllers/report.php index 54e1894f..babb4a3a 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -487,6 +487,65 @@ class report extends BaseController + } + public function consolidate_month() + { + + $this->global['pageTitle'] = 'Siddharth : Reports'; + //$this->input->post('btn_submit'); + $sid=$this->input->get('sid'); + $mid = $this->input->get('mid'); + $cname = $this->input->get('cname'); + $prod = $this->input->get('prod'); + //$mat = $this->input->get('mid'); + $m = $this->input->get('m'); + $ab=$this->input->get('ab'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + //print_r($prod); + $data['material']=$this->dahsboard_Model->material_name(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['spurchse']=$this->dahsboard_Model->consolidate_month($m,$cname,$mid,$fa,$aa); + // print_r( $data['spurchse']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate_m",$this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + + } + public function consolidate_year() + { + + $this->global['pageTitle'] = 'Siddharth : Reports'; + //$this->input->post('btn_submit'); + $sid=$this->input->get('sid'); + $mid = $this->input->get('mid'); + $cname = $this->input->get('cname'); + $prod = $this->input->get('prod'); + //$mat = $this->input->get('mid'); + $ab=$this->input->get('ab'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + //print_r($prod); + $data['material']=$this->dahsboard_Model->material_name(); + $data['cust']=$this->dahsboard_Model->customer_name(); + $data['finyear']=$this->dahsboard_Model->report_finyear(); + $data['spurchse']=$this->dahsboard_Model->consolidate_year($cname,$mid,$fa,$aa); + // print_r( $data['spurchse']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate_y",$this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } + } public function cumulative() { diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 80c1ac64..32b5d77b 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -304,9 +304,7 @@ function getTotalServicePoCount(){ $sql="SELECT count(cmast.PONO) as totalService FROM T_PurchaseOrder_Master cmast - left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - left join T_Requestion_Master req on req.ReqNo=line.ReqNo - where POType='SERVICE' and month(PODate) = $i + where POType='SERVICE' and Status != 'ST030' and month(PODate) = $i and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); @@ -334,9 +332,7 @@ function getTotalimportPoCount(){ $sql="SELECT count(cmast.PONO) as totalImport FROM T_PurchaseOrder_Master cmast - left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - left join T_Requestion_Master req on req.ReqNo=line.ReqNo - where POType='IMPORT' and month(PODate) = $i + where POType='IMPORT' and Status != 'ST030' and month(PODate) = $i and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); @@ -362,9 +358,7 @@ function getTotalcapitalPoCount(){ while($i<=12){ $sql="SELECT count(cmast.PONO) as totalcapital FROM T_PurchaseOrder_Master cmast - left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - left join T_Requestion_Master req on req.ReqNo=line.ReqNo - where POType='CAPITAL' and month(PODate) = $i + where POType='CAPITAL' and Status != 'ST030' and month(PODate) = $i and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); @@ -390,9 +384,7 @@ $i++; while($i<=12){ $sql="SELECT count(cmast.PONO) as totalrevenue FROM T_PurchaseOrder_Master cmast - left join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO - left join T_Requestion_Master req on req.ReqNo=line.ReqNo - where POType='REVENUE' and month(PODate) = $i + where POType='REVENUE' and Status != 'ST030' and month(PODate) = $i and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'"; $query = $this->db->query($sql); @@ -664,7 +656,7 @@ if ($fa and $aa != ''){ $sql="select ifnull(Dept_Details.DepartmentName,'-') As Dept_Name, - SUM(CASE WHEN Mast.Status = 'ST015' THEN 1 ELSE 0 END) AS PO_Created, + SUM(CASE WHEN Mast.Status = 'ST015' or Mast.Status = 'ST024' THEN 1 ELSE 0 END) AS PO_Created, SUM(CASE WHEN Mast.Status = 'ST025' THEN 1 ELSE 0 END) AS Approved, SUM(CASE WHEN Mast.Status = 'ST051' THEN 1 ELSE 0 END) AS Approver_Onhold, SUM(CASE WHEN Mast.Status = 'ST052' THEN 1 ELSE 0 END) AS Releaser_Onhold, @@ -1161,6 +1153,51 @@ if ($cname!= ''){ return $query->result(); } + function consolidate_month($m=null,$cname=null,$mid=null,$fa=null,$aa=null){ + + $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name, +sum(pl.Quantity) as quantity, +sum(pl.Quantity * pl.Rate) as total +FROM T_PurchaseOrder_Master pm +join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO +join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode +join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID +left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo +left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo +where pm.Status != 'ST030' and pm.Status != 'ST056' and +monthname(pm.PODate) = '".$m."' and sd.SupplierName = '".$cname."' and mm.MaterialCode = '".$mid."' "; +if ($fa and $aa != ''){ + + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; + + } + $sql.= "group by supplier_name,material_name"; + $query = $this->db->query($sql); + //echo $sql; + return $query->result(); + } + function consolidate_year($cname=null,$mid=null,$fa=null,$aa=null){ + + $sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name, +sum(pl.Quantity) as quantity, +sum(pl.Quantity * pl.Rate) as total +FROM T_PurchaseOrder_Master pm +join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO +join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode +join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID +left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo +left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo +where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName = '".$cname."' and mm.MaterialCode = '".$mid."' "; +if ($fa and $aa != ''){ + + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; + + } + $sql.= "group by supplier_name,material_name"; + $query = $this->db->query($sql); + //echo $sql; + return $query->result(); + } function report_cumulative(){ $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal diff --git a/application/views/Report_consolidate.php b/application/views/Report_consolidate.php index c9794025..b895e245 100755 --- a/application/views/Report_consolidate.php +++ b/application/views/Report_consolidate.php @@ -172,64 +172,76 @@ foreach ($spurchse as $result) { ?> - supplier_name;?> + supplier_name;?> material_name)) { echo $result->material_name ; } else {echo "-";} ?> April); - if(!empty($result->April)) { echo round($result->April); } else {echo "-";} - ?> + ?> + April);?> + May); - if(!empty($result->May)) { echo round($result->May); } else {echo "-";} - ?> + ?> + May);?> + June); - if(!empty($result->June)) { echo round($result->June); } else {echo "-";} - ?> + ?> + June);?> + July); - if(!empty($result->July)) { echo round($result->July); } else {echo "-";} - ?> + ?> + July);?> + August); - if(!empty($result->August)) { echo round($result->August); } else {echo "-";} - - ?> + ?> + August);?> + September; - if(!empty($result->September)) { echo round($result->September); } else {echo "-";} - ?> + $sep= $sep + round($result->September); + ?> + September);?> + October); - if(!empty($result->October)) { echo round($result->October); } else {echo "-";} - ?> + ?> + October);?> + November); - if(!empty($result->November)) { echo round($result->November); } else {echo "-";} - ?> + ?> + November);?> + December); - if(!empty($result->December)) { echo round($result->December); } else {echo "-";} - ?> + ?> + December);?> + January); - if(!empty($result->January)) { echo round($result->January); } else {echo "-";} - ?> + ?> + January);?> + February); - if(!empty($result->February)) { echo round($result->February); } else {echo "-";} - ?> + ?> + February);?> + March); - if(!empty($result->March)) { echo round($result->March); } else {echo "-";} - ?> + ?> + March);?> + qtotal); - if(!empty($result->qtotal)) { echo round($result->qtotal); } else {echo "-";} - ?> + ?> + qtotal);?> + - supplier_name;?> + + supplier_name;?> + material_name)) { echo $result->material_name ; } else {echo "-";} ?> vApril); - if(!empty($result->vApril)) { echo number_format($result->vApril,2,'.',''); } else {echo "-";} - ?> + $apr= $apr + number_format($result->vApril,2,'.',''); + ?> + vApril,2,'.','');?> + vMay); - if(!empty($result->vMay)) { echo number_format($result->vMay,2,'.',''); } else {echo "-";} - ?> + $may= $may + number_format($result->vMay,2,'.',''); + ?> + vMay,2,'.','');?> + vJune); - if(!empty($result->vJune)) { echo number_format($result->vJune,2,'.',''); } else {echo "-";} - ?> + $jun= $jun + number_format($result->vJune,2,'.',''); + ?> + vJune,2,'.','');?> + vJuly); - if(!empty($result->vJuly)) { echo number_format($result->vJuly,2,'.',''); } else {echo "-";} - ?> + $jul= $jul + number_format($result->vJuly,2,'.',''); + ?> + vJuly,2,'.','');?> + vAugust); - if(!empty($result->vAugust)) { echo number_format($result->vAugust,2,'.',''); } else {echo "-";} - - ?> + $aug= $aug + number_format($result->vAugust,2,'.',''); + ?> + vAugust,2,'.','');?> + vSeptember; - if(!empty($result->vSeptember)) { echo number_format($result->vSeptember,2,'.',''); } else {echo "-";} - ?> + $sep= $sep + number_format($result->vSeptember,2,'.',''); + ?> + vSeptember,2,'.','');?> + vOctober); - if(!empty($result->vOctober)) { echo number_format($result->vOctober,2,'.',''); } else {echo "-";} - ?> + $oct= $oct + number_format($result->vOctober,2,'.',''); + ?> + vOctober,2,'.','');?> + vNovember); - if(!empty($result->vNovember)) { echo number_format($result->vNovember,2,'.',''); } else {echo "-";} - ?> + $nov= $nov + number_format($result->vNovember,2,'.',''); + ?> + vNovember,2,'.','');?> + vDecember); - if(!empty($result->vDecember)) { echo number_format($result->vDecember,2,'.',''); } else {echo "-";} - ?> + $dec= $dec + number_format($result->vDecember,2,'.',''); + ?> + vDecember,2,'.','');?> + vJanuary); - if(!empty($result->vJanuary)) { echo number_format($result->vJanuary,2,'.',''); } else {echo "-";} - ?> + $jan= $jan + number_format($result->vJanuary,2,'.',''); + ?> + vJanuary,2,'.','');?> + vFebruary); - if(!empty($result->vFebruary)) { echo number_format($result->vFebruary,2,'.',''); } else {echo "-";} - ?> + $feb= $feb + number_format($result->vFebruary,2,'.',''); + ?> + vFebruary,2,'.','');?> + vMarch); - if(!empty($result->vMarch)) { echo number_format($result->vMarch,2,'.',''); } else {echo "-";} - ?> + $mar= $mar + number_format($result->vMarch,2,'.',''); + ?> + vMarch,2,'.','');?> + vtotal); - if(!empty($result->vtotal)) { echo number_format($result->vtotal,2,'.',''); } else {echo "-";} - ?> + $tot= $tot + number_format($result->vtotal,2,'.',''); + ?> + vtotal,2,'.','');?> + + + + +
+ +
+ +
+
+

Report - Consolidate(input->get('m'); + echo $m; + ?>)

+
+ + +
+
+ + + + + + + + + + + + + + + + input->get('ab'); + $month=date('F'); + $m = $this->input->get('m'); + //echo $month; + foreach($spurchse as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
Supplier NameMaterial Name
QuantityValue  ()
+ supplier_name;?> + material_name;?>quantity); + echo round($rel->quantity);?>total,2,'.',''); + echo number_format($rel->total,2,'.','');?>
Total + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate_month_inward.php b/application/views/Report_consolidate_month_inward.php index a9216c5f..38ce5258 100755 --- a/application/views/Report_consolidate_month_inward.php +++ b/application/views/Report_consolidate_month_inward.php @@ -172,7 +172,7 @@ $(document).ready(function() { extend: 'excelHtml5', footer: 'true', messageTop: $('h3').text(), - title: 'REPORT-Consolidate Category-Wise', + title: 'REPORT-Consolidate Inward', exportOptions: { columns: ':visible' diff --git a/application/views/Report_consolidate_y.php b/application/views/Report_consolidate_y.php new file mode 100644 index 00000000..8207e0dc --- /dev/null +++ b/application/views/Report_consolidate_y.php @@ -0,0 +1,200 @@ + + + + + + +
+ +
+ +
+
+

Report - Consolidate(input->get('ab'); + echo $m; + ?>)

+
+ + +
+
+ + + + + + + + + + + + + + + + input->get('ab'); + + $month=date('F'); + //echo $month; + foreach($spurchse as $rel) + { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + +
Supplier NameMaterial Name
QuantityValue  ()
+ supplier_name;?> + + material_name;?>quantity); + echo round($rel->quantity);?>total,2,'.',''); + echo number_format($rel->total,2,'.','');?>
Total + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/Report_consolidate_year_inward.php b/application/views/Report_consolidate_year_inward.php index 5ac5e416..441d881b 100755 --- a/application/views/Report_consolidate_year_inward.php +++ b/application/views/Report_consolidate_year_inward.php @@ -174,7 +174,7 @@ $(document).ready(function() { extend: 'excelHtml5', footer: 'true', messageTop: $('h3').text(), - title: 'REPORT-Consolidate Category-Wise', + title: 'REPORT-Consolidate Inward', exportOptions: { columns: ':visible'