new reports added

This commit is contained in:
gandhimathi 2017-11-27 18:44:17 +05:30
parent c08db5c217
commit 946d594f52
13 changed files with 1954 additions and 48 deletions

View File

@ -222,6 +222,8 @@ $route['Report_Material_ReceiptValue'] = "report/MM_ReceiptValue";
$route['Report_purchase'] = "report/purchase";
$route['Report_year_wise'] = "report/year_wise";
$route['Report_supplier'] = "report/purchase_supplier";
$route['Report_consolidate'] = "report/consolidate";
$route['Report_cumulative'] = "report/cumulative";
// Company Information

View File

@ -25,10 +25,12 @@ class report extends BaseController
public function pending_report()
{
$this->global['pageTitle'] = 'Total Pending Requests Reports -';
$this->global['pageTitle'] = 'Siddharth : Reports';
$data['pending_list']=$this->dahsboard_Model->req_list();
//print_r($data);
$this->loadviews("report_pendingreqst",$this->global,$data, NULL);
@ -36,7 +38,7 @@ class report extends BaseController
public function releasedPO()
{
$this->global['pageTitle'] = 'Order Value - Released Reports - ';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -49,7 +51,7 @@ class report extends BaseController
public function openorderPO()
{
$this->global['pageTitle'] = 'Open Orders - Pending Reports - ';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -62,7 +64,7 @@ class report extends BaseController
public function TotalOrd()
{
$this->global['pageTitle'] = 'Total Orders Reports -';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -75,7 +77,7 @@ class report extends BaseController
public function ccr()
{
$this->global['pageTitle'] = 'Cost Center Reports -';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -83,12 +85,13 @@ class report extends BaseController
$this->loadviews("Report_costcenter",$this->global,$data, NULL);
//print_r($data);
}
public function MM_Supplier()
{
$this->global['pageTitle'] = 'Material Master - Supplier Wise Reports -';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -101,7 +104,7 @@ class report extends BaseController
public function MM_Item()
{
$this->global['pageTitle'] = 'Material Master - Item Wise Reports-';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -114,7 +117,7 @@ class report extends BaseController
public function MM_ReceiptValue()
{
$this->global['pageTitle'] = 'Material Master - Receipt Value Reports-';
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -124,9 +127,7 @@ class report extends BaseController
$this->loadviews("Report_Material_Master_ReceiptValue",$this->global,$data, NULL);
}
public function purchase()
public function purchase()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
@ -148,6 +149,52 @@ class report extends BaseController
$this->loadviews("Report_purchase",$this->global,$data, NULL);
}
public function link_purchase()
{
if ($this->input->post('btn_submit')) {
$this->global['pageTitle'] = 'Siddharth : Reports';
//$this->input->post('btn_submit');
$cname = $this->input->post('client_name');
$prod = $this->input->post('item_name');
$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');
//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['purchase']=$this->dahsboard_Model->report_purchase($cname,$prod,$fa,$aa,$m,$frm,$t);
} else{
$this->global['pageTitle'] = 'Siddharth : Reports';
//$this->input->post('btn_submit');
$cname = $this->input->get('cname');
$prod = $this->input->get('prod');
$ab=$this->input->get('ab');
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$m=$this->input->get('month');
$frm = $this->input->get('frm');
$t = $this->input->get('t');
$sid=$this->input->get('sid');
$mid = $this->input->get('mid');
$d = $this->input->get('d');
//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['purchase']=$this->dahsboard_Model->report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d);
}
$this->loadviews("Report_purchase",$this->global,$data, NULL);
}
public function year_wise()
{
@ -170,9 +217,9 @@ class report extends BaseController
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$last = $this->uri->total_segments();
$month=$this->uri->segment($last);
$month=$this->input->get('dat');
$mon= date("F",strtotime($month));
//print_r($month);
$data['mont']=$mon;
@ -217,11 +264,80 @@ class report extends BaseController
$this->loadviews("Report_supplier",$this->global,$data, NULL);
}
}
public function consolidate()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
//$this->input->post('btn_submit');
$cname = $this->input->post('client_name');
$ab=$this->input->post('financialyear');
$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->report_consolidate($cname,$fa,$aa);
$this->loadviews("Report_consolidate",$this->global,$data, NULL);
}
public function cumulative()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
//print_r($prod);
$data['cum']=$this->dahsboard_Model->report_cumulative();
$this->loadviews("Report_cumulative",$this->global,$data, NULL);
}
public function cum_month()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$last = $this->uri->segment_array();
$sup = $last[3];
$mat = $last[4];
//print_r($prod);
$data['cum_month']=$this->dahsboard_Model->report_cum_month($sup,$mat);
$this->loadviews("Report_cumulative_month",$this->global,$data, NULL);
}
public function cum_year()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$last = $this->uri->segment_array();
$sup = $last[3];
$mat = $last[4];
//print_r($sup);
$data['cum_year']=$this->dahsboard_Model->report_cum_year($sup,$mat);
$this->loadviews("Report_cumulative_year",$this->global,$data, NULL);
}
public function cum_day()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$last = $this->uri->segment_array();
$sup = $last[3];
$mat = $last[4];
//print_r($prod);
$data['cum_day']=$this->dahsboard_Model->report_cum_day($sup,$mat);
$this->loadviews("Report_cumulative_day",$this->global,$data, NULL);
}
}

View File

@ -215,13 +215,80 @@ function totalimportpo ()
$query = $this->db->query($sql);
return $query->result();
}
function totalcapitalpo ()
function importbudgt ()
{
$sql="SELECT count(cmast.PONO) as totalcapitalpo FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
where ReqType='CAPITAL'";
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalimportbudget FROM T_CostCenter_Budget where BudgetType ='IMPORT' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
function importbal ()
{
$sql="SELECT ROUND(sum(BudgetAmount)-(SELECT
ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
as Util_Amount
from T_CostCenter_Budget Cost_Center_Budget
join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.POType=Cost_Center_Budget.BudgetType
WHERE Cost_Center_Budget.BudgetType='IMPORT' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balimportbudget FROM T_CostCenter_Budget where BudgetType ='IMPORT' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW()) ";
$query = $this->db->query($sql);
return $query->result();
}
function capitalbud ()
{
$sql="SELECT sum(BudgetAmount) as totalcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW()) ";
$query = $this->db->query($sql);
return $query->result();
}
function capitalbal ()
{
$sql="SELECT ROUND(sum(BudgetAmount)-(SELECT
case po.CapitalRange
when '0'
then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
when '1'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
end
as Util_Amount
from T_CostCenter_Budget Cost_Center_Budget
join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
JOIN T_PurchaseOrder_Master po on po.PONO=PO_Line_Item.PONO and po.POType=Cost_Center_Budget.BudgetType
WHERE Cost_Center_Budget.BudgetType='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
function servicebudgt ()
{
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
function servicebal ()
{
$sql="SELECT ROUND(sum(BudgetAmount)-(SELECT
ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
as Util_Amount
from T_CostCenter_Budget Cost_Center_Budget
join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
WHERE Cost_Center_Budget.BudgetType='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
function revenuebudgt ()
{
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalrevenuebudget FROM T_CostCenter_Budget where BudgetType ='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
function revenuebal ()
{
$sql="SELECT ROUND(sum(BudgetAmount)-(SELECT
ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate) - sum(distinct T_Rev_Tax.AfterDiscount)),0)
as Util_Amount
from T_CostCenter_Budget Cost_Center_Budget
join T_PurchaseOrder_LineItem PO_Line_Item on Cost_Center_Budget.CostCenterCode=PO_Line_Item.CostCenterCode
JOIN T_Revenue_Tax T_Rev_Tax on PO_Line_Item.LineItemNo=T_Rev_Tax.LineItemNo
WHERE Cost_Center_Budget.BudgetType='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())),2) as balrevenuebudget FROM T_CostCenter_Budget where BudgetType ='REVENUE' and YEAR(STR_TO_DATE(`BudgetYear`,'%Y')) = YEAR(NOW())";
$query = $this->db->query($sql);
return $query->result();
}
@ -294,7 +361,7 @@ group by Mast.PONO";
function report_openpending(){
$sql="select Mast.PONO,Mast.POType,date_format(Mast.CreatedDate,'%d-%m-%Y') as CreatedDate,date_format(Mast.ApprovedOn,'%d-%m-%Y') as ApprovedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue
$sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.CreatedDate,'%d-%m-%Y') as CreatedDate,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
JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
@ -304,7 +371,7 @@ 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 Dept_Name";
group by PONO,POType,Dept_Name";
$query = $this->db->query($sql);
return $query->result();
@ -345,7 +412,7 @@ case Cost_Center_Budget.BudgetType
when 'IMPORT'
then ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0)
when 'CAPITAL'
then ifnull( sum(distinct( PO_Line_Item.Quantity * PO_Line_Item.Rate) * if (po.ExchangeRate is null or po.ExchangeRate = '',1,po.ExchangeRate) ),0)
then ifnull(sum(distinct if(CapitalRange=0,(( PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate),( PO_Line_Item.Quantity * PO_Line_Item.Rate) - st.Afterdiscountval)),0)
when 'SERVICE'
then ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0)
when 'REVENUE'
@ -356,8 +423,7 @@ case Cost_Center_Budget.BudgetType
when 'IMPORT'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct(PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate)),0))
when 'CAPITAL'
then (Cost_Center_Budget.BudgetAmount - ifnull( sum(distinct( PO_Line_Item.Quantity * PO_Line_Item.Rate) * if (po.ExchangeRate is null or po.ExchangeRate = '',1,po.ExchangeRate) ),0) )
then (Cost_Center_Budget.BudgetAmount - ifnull(sum(distinct if(CapitalRange=0,(( PO_Line_Item.Quantity * PO_Line_Item.Rate) * po.ExchangeRate),( PO_Line_Item.Quantity * PO_Line_Item.Rate) - st.Afterdiscountval)),0))
when 'SERVICE'
then (Cost_Center_Budget.BudgetAmount - ifnull((sum(distinct PO_Line_Item.Quantity * PO_Line_Item.Rate)),0))
when 'REVENUE'
@ -371,6 +437,7 @@ left JOIN T_Revenue_Tax T_Rev_Tax on PO_Line_Item.LineItemNo=T_Rev_Tax.LineItemN
JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode
JOIN T_Service_Tax st on st.LineItemNo = PO_Line_Item.LineItemNo
WHERE Cost_Center_Budget.BudgetType = po.POType and DATE(Cost_Center_Budget.CreatedDate) BETWEEN '2017-04-01' AND '2018-03-31'
group by
Cost_Center_Budget.BudgetYear,Cost_Center_Budget.CostCenterCode,Cost_Center_Budget.BudgetType
@ -426,11 +493,10 @@ order by monthname(matv.CreatedDate)";
}
function report_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){
$sql="SELECT pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,sd.SupplierName as supplier_name,ifnull(pl.Quantity,0) as quantity,ifnull(pl.Rate,0) as rate,round(ifnull((pl.Quantity * pl.Rate),0),2) as value,ifnull(st.After_SGST,0) as sgst,ifnull(st.After_CGST,0) as cgst,ifnull(st.After_IGST,0) as igst,round((ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
$sql="SELECT pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,sd.SupplierName as supplier_name,ifnull(sum(pl.Quantity),0) as quantity,ifnull(sum(pl.Rate),0) as rate,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,ifnull(sum(st.After_SGST),0) as sgst,ifnull(sum(st.After_CGST),0) as cgst,ifnull(sum(st.After_IGST),0) as igst,round((ifnull(sum(pl.Quantity * pl.Rate),0) + ifnull(sum(st.After_SGST),0) + ifnull(sum(st.After_CGST),0) + ifnull(sum(st.After_IGST),0)),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@ -474,14 +540,78 @@ if ($cname!= ''){
$sql.="order by pono";
$sql.="group by pono,material_name,supplier_name";
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
function report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d){
}
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.PONO as pono,date_format(pm.CreatedDate,'%d-%m-%Y') as created_date, TIME_FORMAT(pm.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,sd.SupplierName as supplier_name,ifnull(sum(pl.Quantity),0) as quantity,ifnull(sum(pl.Rate),0) as rate,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,ifnull(sum(st.After_SGST),0) as sgst,ifnull(sum(st.After_CGST),0) as cgst,ifnull(sum(st.After_IGST),0) as igst,round((ifnull(sum(pl.Quantity * pl.Rate),0) + ifnull(sum(st.After_SGST),0) + ifnull(sum(st.After_CGST),0) + ifnull(sum(st.After_IGST),0)),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
where
pm.PONO>'0' ";
if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'";
}
if ($fa and $aa != ''){
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
}
if ($m!= ''){
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
}
if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t));
$sql.="and date(pm.CreatedDate) >= '".$fromd."'
and date(pm.CreatedDate) <= '".$tod."'";
}
if ($prod!= ''){
$sql.=" and mm.MaterialName = '".$prod."' ";
}
if ($sid!= ''){
$sql.=" and sd.SupplierID = '".$sid."' ";
}
if ($mid!= ''){
$sql.=" and mm.MaterialCode = '".$mid."' ";
}
if ($d!= ''){
$sql.=" and date(pm.CreatedDate) = '".$d."' ";
}
$sql.="group by pono,material_name,supplier_name";
//echo $sql;
$query = $this->db->query($sql);
return $query->result();
}
function report_finyear(){
@ -500,7 +630,7 @@ GROUP BY financial_year";
function report_year_wise(){
$sql="SELECT pm.CreatedDate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round((ifnull(sum(pl.Quantity * pl.Rate),0) + ifnull(sum(st.After_SGST),0) + ifnull(sum(st.After_CGST),0) + ifnull(sum(st.After_IGST),0)),2) as total
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.CreatedDate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@ -527,7 +657,7 @@ group by month(created_date)";
$month= date("m",strtotime($mont));
$year = date("Y",strtotime($mont));
$sql="SELECT sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,pl.Quantity as quantity,round((ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@ -540,7 +670,7 @@ group by supplier_name,material_name";
}
function report_year_wise_total($a,$b){
$sql="SELECT sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,pl.Quantity as quantity,round((ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
@ -555,7 +685,7 @@ group by supplier_name,material_name";
function report_supplier($cname,$fa,$aa,$m,$frm,$t){
$sql="SELECT sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,round(sum(ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
$sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(pm.PONO) as counts,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,round(sum(ifnull((pl.Quantity * pl.Rate),0) + ifnull(st.After_SGST,0) + ifnull(st.After_CGST,0) + ifnull(st.After_IGST,0)),2) as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
@ -596,8 +726,146 @@ if ($cname!= ''){
return $query->result();
}
function report_consolidate($cname,$fa,$aa){
$sql="select sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,mm.MaterialName as material_name,
SUM(IF(month(pm.CreatedDate) = 4, pl.Quantity, 0)) AS April,
SUM(IF(month(pm.CreatedDate) = 5, pl.Quantity, 0)) AS May,
SUM(IF(month(pm.CreatedDate) = 6, pl.Quantity, 0)) AS June,
SUM(IF(month(pm.CreatedDate) = 7, pl.Quantity, 0)) AS July,
SUM(IF(month(pm.CreatedDate) = 8, pl.Quantity, 0)) AS August,
SUM(IF(month(pm.CreatedDate) = 9, pl.Quantity, 0)) AS September,
SUM(IF(month(pm.CreatedDate) = 10, pl.Quantity, 0)) AS October,
SUM(IF(month(pm.CreatedDate) = 11, pl.Quantity, 0)) AS November,
SUM(IF(month(pm.CreatedDate) = 12, pl.Quantity, 0)) AS December,
SUM(IF(month(pm.CreatedDate) = 1, pl.Quantity, 0)) AS January,
SUM(IF(month(pm.CreatedDate) = 2, pl.Quantity, 0)) AS February,
SUM(IF(month(pm.CreatedDate) = 3, pl.Quantity, 0)) AS March,
sum(pl.Quantity) as qtotal,
SUM(IF(month(pm.CreatedDate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril,
SUM(IF(month(pm.CreatedDate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay,
SUM(IF(month(pm.CreatedDate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune,
SUM(IF(month(pm.CreatedDate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly,
SUM(IF(month(pm.CreatedDate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust,
SUM(IF(month(pm.CreatedDate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember,
SUM(IF(month(pm.CreatedDate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober,
SUM(IF(month(pm.CreatedDate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember,
SUM(IF(month(pm.CreatedDate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember,
SUM(IF(month(pm.CreatedDate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary,
SUM(IF(month(pm.CreatedDate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary,
SUM(IF(month(pm.CreatedDate) = 3, pl.Quantity * pl.Rate, 0)) AS vMarch,
sum(pl.Quantity * pl.Rate) as vtotal
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 ";
if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'";
}
if ($fa and $aa != ''){
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
}
$sql.= "group by supplier_name,material_name";
//echo $sql;
$query = $this->db->query($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
FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and
case
when (month(pm.CreatedDate) >=4) then
(YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.CreatedDate) <= 3 )
else
(YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) <= 3 )
end
group by supplier_name,material_name
) as year left join
(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as mquantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as mtotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and
month(pm.CreatedDate) = month(current_date())
group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
left join
(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and
date(pm.CreatedDate) = current_date()
group by supplier_name,material_name
) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name
group by supplier_name,material_name
";
$query = $this->db->query($sql);
return $query->result();
}
function report_cum_month($sup=null,$mat=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and month(pm.CreatedDate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
return $query->result();
}
function report_cum_year($sup=null,$mat=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and
case
when (month(pm.CreatedDate) >=4) then
(YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.CreatedDate) <= 3 )
else
(YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.CreatedDate) >= 4 ) or ( YEAR(pm.CreatedDate) = YEAR(CURRENT_DATE) and MONTH(pm.CreatedDate) <= 3 )
end
and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
return $query->result();
}
function report_cum_day($sup=null,$mat=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where sd.SupplierName is not null and
date(pm.CreatedDate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name";
$query = $this->db->query($sql);
return $query->result();
}
}
?>

View File

@ -0,0 +1,668 @@
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #3c8dbc;
border-color: #3c8dbc;
}
</style>
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Report - Consolidate</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="panel-body">
<form method="post" action="<?php echo base_url($this->uri->uri_string()); ?>">
<div class="form-group has-feedback">
<div class="col-md-4">
<label for="client_name">
<?php echo 'Customer'; ?>
</label>
<div class="input-group">
<select class="form-control" id="client_name" name="client_name">
<option value="">Select Customer</option>
<?php
foreach($cust as $item):
{?>
<option value="<?php echo $item->SupplierName;?>"><?php echo $item->SupplierName ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-2">
<label for="to_date">
<?php echo 'year'; ?>
</label>
<div class="input-group">
<select class="form-control" id="financialyear" name="financialyear">
<option value="">Select Year</option>
<?php
foreach($finyear as $item):
{?>
<option value="<?php echo $item->financial_year;?>"><?php echo $item->financial_year ; ?></option>
<?php } endforeach; ?>
</select>
</div>
</div>
<div class="col-md-2">
<label><input type="radio" name="colorRadio" id="value" onclick="toggleTables('2')" value="tab"> Value</label>
<label><input type="radio" name="colorRadio" id="qty" onclick="toggleTables('1')" value="ta" checked> Quantity</label>
</div>
<div class="col-md-2 col-md-offset-10" style="padding:3%;">
<input type="submit" class="btn btn-success" name="btn_submit"
value="View Report">
</div>
</div>
</form>
</div>
<div class="box-body" style="display:block" id="a">
<table class="table table-bordered table-hover" id="tab" style="font-size:10.4px;">
<thead>
<tr>
<th style="text-align:center;">Supplier</th>
<th style="text-align:center;">Product</th>
<th style="text-align:center;">April</th>
<th style="text-align:center;">May</th>
<th style="text-align:center;">June</th>
<th style="text-align:center;">July</th>
<th style="text-align:center;">August</th>
<th style="text-align:center;">September</th>
<th style="text-align:center;">October</th>
<th style="text-align:center;">November</th>
<th style="text-align:center;">December</th>
<th style="text-align:center;">January</th>
<th style="text-align: center;">February</th>
<th style="text-align: center;">March</th>
<th style="text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<?php
$apr = 0;
$may = 0;
$jun = 0;
$jul = 0;
$aug = 0;
$sep = 0;
$oct = 0;
$nov = 0;
$dec = 0;
$jan = 0;
$feb = 0;
$mar = 0;
$tot = 0;
$ab=$this->input->post('financialyear');
foreach ($spurchse as $result) { ?>
<tr>
<td style="text-align:left;">
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $result->sid;?>&ab=<?php echo $ab;?>&mid=<?php echo $result->mid;?>"><?php echo $result->supplier_name;?></a>
</td>
<td style="text-align:left;"><?php
if(!empty($result->material_name)) { echo $result->material_name ; } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$apr= $apr + round($result->April);
if(!empty($result->April)) { echo round($result->April); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$may= $may + round($result->May);
if(!empty($result->May)) { echo round($result->May); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jun= $jun + round($result->June);
if(!empty($result->June)) { echo round($result->June); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jul= $jul + round($result->July);
if(!empty($result->July)) { echo round($result->July); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$aug= $aug + round($result->August);
if(!empty($result->August)) { echo round($result->August); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$sep= $sep + $result->September;
if(!empty($result->September)) { echo round($result->September); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$oct= $oct + round($result->October);
if(!empty($result->October)) { echo round($result->October); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$nov= $nov + round($result->November);
if(!empty($result->November)) { echo round($result->November); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$dec= $dec + round($result->December);
if(!empty($result->December)) { echo round($result->December); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jan= $jan + round($result->January);
if(!empty($result->January)) { echo round($result->January); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$feb= $feb + round($result->February);
if(!empty($result->February)) { echo round($result->February); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$mar= $mar + round($result->March);
if(!empty($result->March)) { echo round($result->March); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$tot= $tot + round($result->qtotal);
if(!empty($result->qtotal)) { echo round($result->qtotal); } else {echo "-";}
?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right;"><strong><?php
{
echo '';
}
?>
</strong></td>
<td style="text-align:right;"><strong><?php
{
echo $apr;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $may;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jun;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jul;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $aug;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $sep;
}
?>
</strong>
</td>
<td style="text-align:right;"><strong>
<?php
{
echo $oct;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $nov;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $dec;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $jan;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $feb;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $mar;
}
?>
</strong></td>
<td style="text-align:right;">
<strong>
<?php
{
echo $tot;
}
?>
</strong></td>
</tr>
</tfoot>
</table>
</div>
<div class="box-body" id="b" style="display:none">
<table class="table table-bordered table-hover" style="font-size:10.4px;" id="ta">
<thead>
<tr>
<th style="text-align:center;">Supplier</th>
<th style="text-align:center;">Product</th>
<th style="text-align:center;">April</th>
<th style="text-align:center;">May</th>
<th style="text-align:center;">June</th>
<th style="text-align:center;">July</th>
<th style="text-align:center;">August</th>
<th style="text-align:center;">September</th>
<th style="text-align:center;">October</th>
<th style="text-align:center;">November</th>
<th style="text-align:center;">December</th>
<th style="text-align:center;">January</th>
<th style="text-align: center;">February</th>
<th style="text-align: center;">March</th>
<th style="text-align: center;">Total</th>
</tr>
</thead>
<tbody>
<?php
$apr = 0;
$may = 0;
$jun = 0;
$jul = 0;
$aug = 0;
$sep = 0;
$oct = 0;
$nov = 0;
$dec = 0;
$jan = 0;
$feb = 0;
$mar = 0;
$tot = 0;
foreach ($spurchse as $result) { ?>
<tr>
<td style="text-align:left;"><a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $result->sid;?>&ab=<?php echo $ab;?>&mid=<?php echo $result->mid;?>"><?php echo $result->supplier_name;?></a></td>
<td style="text-align:left;"><?php
if(!empty($result->material_name)) { echo $result->material_name ; } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$apr= $apr + round($result->vApril);
if(!empty($result->vApril)) { echo round($result->vApril); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$may= $may + round($result->vMay);
if(!empty($result->vMay)) { echo round($result->vMay); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jun= $jun + round($result->vJune);
if(!empty($result->vJune)) { echo round($result->vJune); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jul= $jul + round($result->vJuly);
if(!empty($result->vJuly)) { echo round($result->vJuly); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$aug= $aug + round($result->vAugust);
if(!empty($result->vAugust)) { echo round($result->vAugust); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$sep= $sep + $result->vSeptember;
if(!empty($result->vSeptember)) { echo round($result->vSeptember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$oct= $oct + round($result->vOctober);
if(!empty($result->vOctober)) { echo round($result->vOctober); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$nov= $nov + round($result->vNovember);
if(!empty($result->vNovember)) { echo round($result->vNovember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$dec= $dec + round($result->vDecember);
if(!empty($result->vDecember)) { echo round($result->vDecember); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$jan= $jan + round($result->vJanuary);
if(!empty($result->vJanuary)) { echo round($result->vJanuary); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$feb= $feb + round($result->vFebruary);
if(!empty($result->vFebruary)) { echo round($result->vFebruary); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$mar= $mar + round($result->vMarch);
if(!empty($result->vMarch)) { echo round($result->vMarch); } else {echo "-";}
?></td>
<td style="text-align:right;"><?php
$tot= $tot + round($result->vtotal);
if(!empty($result->vtotal)) { echo round($result->vtotal); } else {echo "-";}
?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td><strong><?php
{
echo '';
}
?>
</strong></td>
<td style="text-align:right;"><strong><?php
{
echo $apr;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $may;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jun;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $jul;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $aug;
}
?>
</strong></td>
<td style="text-align:right;"><strong>
<?php
{
echo $sep;
}
?>
</strong>
</td>
<td style="text-align:right;"><strong>
<?php
{
echo $oct;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $nov;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $dec;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $jan;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $feb;
}
?>
</strong>
</td>
<td style="text-align:right;">
<strong>
<?php
{
echo $mar;
}
?>
</strong></td>
<td style="text-align:right;">
<strong>
<?php
{
echo $tot;
}
?>
</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#tab').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export Purchase Report',
buttons: [
'excel'
]
}
]
} );
} );
$(document).ready(function() {
table = $('#ta').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export Purchase Report',
buttons: [
'excel'
]
}
]
} );
} );
function toggleTables(which)
{
if(which == "1") {
document.getElementById('a').style.display = "block";
document.getElementById('b').style.display = "none";
}
if(which == "2") {
document.getElementById('b').style.display = "block";
document.getElementById('a').style.display = "none";
}
}
</script>

View File

@ -0,0 +1,257 @@
<?php
if(!empty($mms))
{
}
?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #3c8dbc;
border-color: #3c8dbc;
}
</style>
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Report - Cumulative</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<table class="table table-bordered table-hover" id="cc" style="font-size:12px;">
<thead>
<tr>
<?php
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
?>
<th style="text-align:center" rowspan="2">Supplier</th>
<th style="text-align:center" rowspan="2">Product</th>
<th style="text-align:center" colspan="2"><?php echo date('d-m-Y'); ?></th>
<th style="text-align:center" colspan="2"><?php echo date('M-Y'); ?></th>
<th style="text-align:center" colspan="2"><?php echo $ab; ?></th>
</tr>
<tr>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
</tr>
</thead>
<tbody>
<?php if(!empty($cum)){
$yqt=0;
$yvt=0;
$mqt=0;
$mvt=0;
$tqt=0;
$tvt=0;
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
foreach($cum as $rel)
{
?>
<tr>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&ab=<?php echo $ab;?>&mid=<?php echo $rel->mid;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tqt= $tqt + round($rel->tquantity);
echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,round($rel->tquantity));?></span></td>
<td style="text-align:right"><span><?php
$tvt= $tvt + round($rel->ttotal);
echo anchor('report/cum_day/'.$rel->sid . '/' . $rel->mid,round($rel->ttotal));?></span></td>
<td style="text-align:right"><span><?php
$mqt= $mqt + round($rel->mquantity);
echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,round($rel->mquantity));?></span></td>
<td style="text-align:right"><span><?php
$mvt= $mvt + round($rel->mtotal);
echo anchor('report/cum_month/'.$rel->sid . '/' . $rel->mid,round($rel->mtotal));?></span></td>
<td style="text-align:right"><span><?php
$yqt= $yqt + round($rel->quantity);
echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,round($rel->quantity));?></span></td>
<td style="text-align:right"><span><?php
$yvt= $yvt + round($rel->total);
echo anchor('report/cum_year/'.$rel->sid . '/' . $rel->mid,round($rel->total));?></span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right"><strong>
<?php
{
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tvt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $mqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $mvt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $yqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $yvt;
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#cc').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export cumulative Report',
buttons: [
'excel'
]
}
]
} );
} );
$('#mySelect').on('change',function(){
table
.column(4)
.search(this.value)
.draw();
});
</script>

View File

@ -0,0 +1,183 @@
<?php
if(!empty($mms))
{
}
?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #3c8dbc;
border-color: #3c8dbc;
}
</style>
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Report - Cumulative Today</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<table class="table table-bordered table-hover" id="cc" style="font-size:12px;">
<thead>
<tr>
<th style="text-align:center" rowspan="2">Supplier</th>
<th style="text-align:center" rowspan="2">Product</th>
<th style="text-align:center" colspan="2"><?php echo date('d-m-Y'); ?></th>
</tr>
<tr>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
</tr>
</thead>
<tbody>
<?php if(!empty($cum_day)){
$tqt=0;
$tvt=0;
$d=date('Y-m-d');
foreach($cum_day as $rel)
{
?>
<tr>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&d=<?php echo $d;?>&mid=<?php echo $rel->mid;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tqt= $tqt + round($rel->tquantity);
echo round($rel->tquantity);?></span></td>
<td style="text-align:right"><span><?php
$tvt= $tvt + round($rel->ttotal);
echo round($rel->ttotal);?></span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right"><strong>
<?php
{
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tvt;
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#cc').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export cumulative Year Report',
buttons: [
'excel'
]
}
]
} );
} );
$('#mySelect').on('change',function(){
table
.column(4)
.search(this.value)
.draw();
});
</script>

View File

@ -0,0 +1,189 @@
<?php
if(!empty($mms))
{
}
?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #3c8dbc;
border-color: #3c8dbc;
}
</style>
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Report - Cumulative Month</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<table class="table table-bordered table-hover" id="cc" style="font-size:12px;">
<thead>
<tr>
<th style="text-align:center" rowspan="2">Supplier</th>
<th style="text-align:center" rowspan="2">Product</th>
<th style="text-align:center" colspan="2"><?php echo date('M-Y'); ?></th>
</tr>
<tr>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
</tr>
</thead>
<tbody>
<?php if(!empty($cum_month)){
$tqt=0;
$tvt=0;
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
$month=date('F');
//echo $month;
foreach($cum_month as $rel)
{
?>
<tr>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&ab=<?php echo $ab;?>&month=<?php echo $month;?>&mid=<?php echo $rel->mid;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tqt= $tqt + round($rel->tquantity);
echo round($rel->tquantity);?></span></td>
<td style="text-align:right"><span><?php
$tvt= $tvt + round($rel->ttotal);
echo round($rel->ttotal);?></span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right"><strong>
<?php
{
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tvt;
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#cc').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export cumulative month Report',
buttons: [
'excel'
]
}
]
} );
} );
$('#mySelect').on('change',function(){
table
.column(4)
.search(this.value)
.draw();
});
</script>

View File

@ -0,0 +1,195 @@
<?php
if(!empty($mms))
{
}
?>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css">
<style>
.dataTables_filter {
width: 50%;
float: right;
text-align: right;
}
.dataTables_paginate {
width: 50%;
float: right;
text-align: right;
}
div.dt-buttons {
position: relative;
float: right;
}
.btn-success {
background-color: #3c8dbc;
border-color: #3c8dbc;
}
</style>
<div class="row" style="min-height: 600px;">
<!-- Left col -->
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="box box-info">
<div class="box-header with-border">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Report - Cumulative Year</b></p></h3></center>
</div>
<!-- /.box-header -->
<div class="box-body">
<div>
<table class="table table-bordered table-hover" id="cc" style="font-size:12px;">
<thead>
<tr>
<?php
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
?>
<th style="text-align:center" rowspan="2">Supplier</th>
<th style="text-align:center" rowspan="2">Product</th>
<th style="text-align:center" colspan="2"><?php echo $ab; ?></th>
</tr>
<tr>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
</tr>
</thead>
<tbody>
<?php if(!empty($cum_year)){
$tqt=0;
$tvt=0;
if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1);
} else {
$yearl = (date('Y')-1).'-'.date('Y');
}
$ab=$yearl;
foreach($cum_year as $rel)
{
?>
<tr>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&ab=<?php echo $ab;?>&mid=<?php echo $rel->mid;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tqt= $tqt + round($rel->tquantity);
echo round($rel->tquantity);?></span></td>
<td style="text-align:right"><span><?php
$tvt= $tvt + round($rel->ttotal);
echo round($rel->ttotal);?></span></td>
</tr>
<?php
}
?>
</tbody>
<tfoot width="100%">
<tr>
<td style="text-align:center;"><strong>Total</strong></td>
<td style="text-align:right"><strong>
<?php
{
echo '';
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tqt;
}
?>
</strong>
</td>
<td style="text-align:right">
<strong>
<?php
{
echo $tvt;
}
?>
</strong>
</td>
</tr>
</tfoot>
<?php
}
?>
</table>
</div>
</div>
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.flash.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.3.1/js/buttons.print.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script>
// Bootstrap datepicker
// Set up your table
$(document).ready(function() {
table = $('#cc').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
"<'row'<'col-md-6'><'col-md-6'>>" +
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
buttons: [
{
extend: 'collection',
text: 'Export cumulative Year Report',
buttons: [
'excel'
]
}
]
} );
} );
$('#mySelect').on('change',function(){
table
.column(4)
.search(this.value)
.draw();
});
</script>

View File

@ -57,11 +57,16 @@ if(!empty($mms))
<?php if(!empty($month)){
$tr3=0;
$tr4=0;
$ab = $this->input->get('ab');
$last = $this->input->get('dat');
$new = date("F",strtotime($last))."\n";
foreach($month as $rel)
{
?>
<tr>
<td><span><?php echo $rel->supplier_name;?></span></td>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&mid=<?php echo $rel->mid;?>&ab=<?php echo $ab;?>&month=<?php echo $new;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tr3= $tr3 + round($rel->quantity);

View File

@ -160,7 +160,7 @@ if(!empty($mms))
<th style="text-align:center">Count</th>
<th style="text-align:center">Quantity</th>
<th style="text-align:center">Value</th>
<<th style="text-align:center">Total</th>
<th style="text-align:center">Total</th>
</tr>
</thead>
@ -170,12 +170,17 @@ if(!empty($mms))
$tot_qty = 0;
$tot_value = 0;
$tot_tot = 0;
$ab=$this->input->post('financialyear');
$month=$this->input->post('month');
$frm = $this->input->post('from_date');
$t = $this->input->post('to_date');
foreach($spurchse as $rel)
{
?>
<tr>
<td><span><?php echo $rel->supplier_name;?></span></td>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&ab=<?php echo $ab;?>&month=<?php echo $month;?>&frm=<?php echo $frm;?>&t=<?php echo $t;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td style="text-align:right"><span><?php
$tot_rate= $tot_rate + round($rel->counts);
echo round($rel->counts);?></span></td>

View File

@ -101,10 +101,12 @@ if(!empty($mms))
<?php
$date = strtotime($rel->created_date);
$new = date('M-y', $date);
$pass = date('Y-m-d',$date)
$pass = date('Y-m-d',$date);
$ab=$this->input->post('financialyear');
//echo $new;
?>
<a href="<?= base_url()."report/month_wise/$pass" ?>"><?php echo $new;?></a>
<a href="<?= base_url() ?>report/month_wise?ab=<?php echo $ab;?>&dat=<?php echo $pass;?>"><?php echo $new;?></a>
</span></td>
<td style="text-align:right"><span><?php
$tr3= $tr3 + $rel->quantity;

View File

@ -57,11 +57,15 @@ if(!empty($mms))
<?php if(!empty($ytotal)){
$tr3=0;
$tr4=0;
$last = $this->uri->total_segments();
$ab=$this->uri->segment($last);
foreach($ytotal as $rel)
{
?>
<tr>
<td><span><?php echo $rel->supplier_name;?></span></td>
<td><span>
<a href="<?= base_url() ?>report/link_purchase?sid=<?php echo $rel->sid;?>&mid=<?php echo $rel->mid;?>&ab=<?php echo $ab;?>"><?php echo $rel->supplier_name;?></a>
</span></td>
<td><span><?php echo $rel->material_name;?></span></td>
<td style="text-align:right"><span><?php
$tr3= $tr3 + round($rel->quantity);

View File

@ -697,6 +697,18 @@ $(function() {
<span>Purchase Supplier-wise</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>Report_consolidate">
<i class="fa fa-keyboard-o"></i>
<span>Consolidate Report</span>
</a>
</li>
<li class="treeview">
<a href="<?php echo base_url(); ?>Report_cumulative">
<i class="fa fa-keyboard-o"></i>
<span>Cumulative Report</span>
</a>
</li>
</ul>
</li>