yearwise mismatch value fixed

This commit is contained in:
gandhimathi 2018-01-10 21:28:50 +05:30
parent 153a11b4ce
commit 1b4b56b43b
5 changed files with 118 additions and 124 deletions

View File

@ -351,8 +351,10 @@ class report extends BaseController
if ($this->input->post('financialyear')) { if ($this->input->post('financialyear')) {
$ab=$this->input->post('financialyear');
$data['year']=$this->dahsboard_Model->report_year_wise(); $a=substr($ab,0,-5);
$b=substr($ab,5,5);
$data['year']=$this->dahsboard_Model->report_year_wise($a,$b);
$data['finyear']=$this->dahsboard_Model->report_finyear(); $data['finyear']=$this->dahsboard_Model->report_finyear();
//$this->loadviews("Report_year_wise",$this->global,$data, NULL); //$this->loadviews("Report_year_wise",$this->global,$data, NULL);
@ -703,8 +705,10 @@ class report extends BaseController
if ($this->input->post('financialyear')) { if ($this->input->post('financialyear')) {
$ab=$this->input->post('financialyear');
$data['year']=$this->dahsboard_Model->ireport_year_wise(); $a=substr($ab,0,-5);
$b=substr($ab,5,5);
$data['year']=$this->dahsboard_Model->ireport_year_wise($a,$b);
$data['finyear']=$this->dahsboard_Model->report_finyear(); $data['finyear']=$this->dahsboard_Model->report_finyear();
//$this->loadviews("Report_year_wise",$this->global,$data, NULL); //$this->loadviews("Report_year_wise",$this->global,$data, NULL);

View File

@ -124,3 +124,5 @@ ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Undefined variable: cash C
ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97 ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97
ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97 ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97
ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97 ERROR - 2018-01-10 06:36:10 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookmonthlyexpenses.php 97
ERROR - 2018-01-10 16:55:12 --> Query error: Table 'kasiram9_SIADEV.year_wise_inward' doesn't exist
ERROR - 2018-01-10 16:56:49 --> Query error: Table 'kasiram9_SIADEV.year_wise_inward' doesn't exist

View File

@ -655,14 +655,13 @@ Cost_Center_Budget.BudgetYear
$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 $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 from T_PurchaseOrder_Master Mast
JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO
JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo left JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
JOIN T_Employee_Details as Emp_Det on Emp_Det.EmpID=Req.RequestedBy left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Emp_Det.Departmentcode left JOIN T_CostCenter_Master as Cost on
JOIN T_CostCenter_Master as Cost on
Cost.CostCenterCode=Req.CostCenterCode Cost.CostCenterCode=Req.CostCenterCode
JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
where Mast.Status='ST026' where Mast.Status='ST026'
"; ";
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31')"; $sql.=" and (Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31')";
@ -693,14 +692,13 @@ if ($fa and $aa != ''){
return $query->result(); return $query->result();
} }
function report_openpending($fa,$aa,$m,$frm,$t,$agf,$agt){ 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 $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 from T_PurchaseOrder_Master Mast
JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO left JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO
JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo left JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
JOIN T_Employee_Details as Emp_Det on Emp_Det.EmpID=Req.RequestedBy left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Emp_Det.Departmentcode left JOIN T_CostCenter_Master as Cost on
JOIN T_CostCenter_Master as Cost on
Cost.CostCenterCode=Req.CostCenterCode Cost.CostCenterCode=Req.CostCenterCode
JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
where (Mast.Status='ST025' or Mast.Status='ST005') where (Mast.Status='ST025' or Mast.Status='ST005')
@ -884,15 +882,15 @@ if ($fa and $aa != ''){
$sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date,
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
mm.MaterialName as material_name,sd.SupplierName as supplier_name, mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate,
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) as value,
if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, if(POType = 'IMPORT' or POType = 'CAPITAL',sum(distinct pm.ExchangeRate),0) as exchange_rate,
ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
round(( round((
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
@ -904,13 +902,13 @@ ifnull(sum(pl.Quantity * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) + ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total - ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where where
pm.Status != 'ST030' and pm.Status != 'ST056' "; pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027'";
if ($cname!= ''){ if ($cname!= ''){
@ -958,15 +956,15 @@ $sql.="group by pono,material_name,supplier_name";
$sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date, $sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as created_date,
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time, TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
mm.MaterialName as material_name,sd.SupplierName as supplier_name, mm.MaterialName as material_name,sd.SupplierName as supplier_name,
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate, ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate,
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value, round(ifnull(sum(distinct pl.Quantity * pl.Rate),0),2) as value,
if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate, if(POType = 'IMPORT' or POType = 'CAPITAL',sum(distinct pm.ExchangeRate),0) as exchange_rate,
ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0) as sgst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterSGST),sum(distinct st.After_SGST)),0) as sgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0) as cgst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterCGST),sum(distinct st.After_CGST)),0) as cgst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0) as igst, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterIGST),sum(distinct st.After_IGST)),0) as igst,
ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0) as discount,
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterFreightValue),sum(distinct st.AfterFreightValue)),0) as freight,
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package, ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0) as Package,
round(( round((
if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'IMPORT',sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)), if(POType = 'CAPITAL' && CapitalRange = 0,sum(distinct pm.ExchangeRate * (pl.Quantity * pl.Rate)),
@ -984,7 +982,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where where
pm.Status != 'ST030' and pm.Status != 'ST056' "; pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1056,16 +1054,16 @@ GROUP BY financial_year";
} }
function report_year_wise(){ function report_year_wise($a=null, $b=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.POdate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total $sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.POdate 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 FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' and pm.Status != 'ST056' where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and date(pm.POdate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31'
group by month(created_date)"; group by month(created_date)";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -1098,7 +1096,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.PODate)= ? and year(pm.PODate) = ? where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and month(pm.PODate)= ? and year(pm.PODate) = ?
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql,array($month,$year)); $query = $this->db->query($sql,array($month,$year));
return $query->result(); return $query->result();
@ -1111,7 +1109,7 @@ left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and date(pm.POdate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31' where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and date(pm.POdate) >= '$a-04-01' and date(pm.PODate) <= '$b-03-31'
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql,array()); $query = $this->db->query($sql,array());
return $query->result(); return $query->result();
@ -1161,7 +1159,7 @@ left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where where
pm.Status != 'ST030' and pm.Status != 'ST056' "; pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1230,7 +1228,7 @@ FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' "; where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
if ($cname!= ''){ if ($cname!= ''){
@ -1263,7 +1261,7 @@ join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' and pm.Status != 'ST056' and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and
monthname(pm.PODate) = '".$m."' and sd.SupplierID = '".$sid."' and mm.MaterialCode = '".$mid."' "; monthname(pm.PODate) = '".$m."' and sd.SupplierID = '".$sid."' and mm.MaterialCode = '".$mid."' ";
if ($fa and $aa != ''){ if ($fa and $aa != ''){
@ -1286,7 +1284,7 @@ join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierID = '".$sid."' and mm.MaterialCode = '".$mid."' "; where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierID = '".$sid."' and mm.MaterialCode = '".$mid."' ";
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
@ -1313,7 +1311,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
(pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31') (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')
group by supplier_name,material_name group by supplier_name,material_name
) as year left join ) as year left join
@ -1322,7 +1320,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
month(pm.PODate) = month(current_date()) month(pm.PODate) = month(current_date())
group by supplier_name,material_name group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name ) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
@ -1332,7 +1330,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
date(pm.PODate) = current_date() date(pm.PODate) = current_date()
group by supplier_name,material_name group by supplier_name,material_name
) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name ) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name
@ -1348,7 +1346,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -1367,7 +1365,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
(pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31') (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')
and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name"; group by supplier_name,material_name";
@ -1381,7 +1379,7 @@ FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
date(pm.PODate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."' date(pm.PODate) = current_date() and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -1390,7 +1388,7 @@ group by supplier_name,material_name";
function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){ function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
$sql="SELECT pm.PONO as pono,pm.POType as potype,date_format(im.CreatedDate,'%d-%m-%Y') as created_date, $sql="SELECT im.PONO as pono,pm.POType as potype,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,
TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time, TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,
mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name, mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,
ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate, ifnull(sum(distinct pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(distinct pl.Rate),0) as rate,
@ -1565,18 +1563,15 @@ $sql.="group by pono,material_name,category,supplier_name";
return $query->result(); return $query->result();
} }
function ireport_year_wise(){ function ireport_year_wise($a,$b){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,im.CreatedDate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value
FROM T_PurchaseOrder_Master pm from year_wise_inward
join T_IGR_Master im on im.PONO = pm.PONO where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO group by month(CreatedDate)
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode ";
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID //echo $sql;
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
where pm.Status != 'ST030'
group by month(created_date)";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -1588,29 +1583,19 @@ group by month(created_date)";
$month= date("m",strtotime($mont)); $month= date("m",strtotime($mont));
$year = date("Y",strtotime($mont)); $year = date("Y",strtotime($mont));
$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 $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
FROM T_PurchaseOrder_Master pm from year_wise_inward
join T_IGR_Master im on im.PONO = pm.PONO where status != 'ST030' and month(dat)= ? and year(dat) = ?
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO group by material_name,supplier_name";
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.Status != 'ST030' and sd.SupplierName is not null and month(im.CreatedDate)= ? and year(im.CreatedDate) = ?
group by supplier_name,material_name";
$query = $this->db->query($sql,array($month,$year)); $query = $this->db->query($sql,array($month,$year));
return $query->result(); return $query->result();
} }
function ireport_year_wise_total($a,$b){ function ireport_year_wise_total($a,$b){
$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 $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
FROM T_PurchaseOrder_Master pm from year_wise_inward
join T_IGR_Master im on im.PONO = pm.PONO where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO group by material_name,supplier_name";
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.Status != 'ST030' and sd.SupplierName is not null and date(im.CreatedDate) >= '$a-04-01' and date(im.CreatedDate) <= '$b-03-31'
group by supplier_name,material_name";
$query = $this->db->query($sql,array()); $query = $this->db->query($sql,array());
return $query->result(); return $query->result();
} }
@ -1698,45 +1683,39 @@ if ($cname!= ''){
function ireport_consolidate($cname,$fa,$aa){ function ireport_consolidate($cname,$fa,$aa){
$sql="select sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,mm.MaterialName as material_name, $sql="select sid,mid,supplier_name,material_name,
SUM(IF(month(im.CreatedDate) = 4, pl.Quantity, 0)) AS April, SUM(IF(month(dat) = 4, quantity, 0)) AS April,
SUM(IF(month(im.CreatedDate) = 5, pl.Quantity, 0)) AS May, SUM(IF(month(dat) = 5, quantity, 0)) AS May,
SUM(IF(month(im.CreatedDate) = 6, pl.Quantity, 0)) AS June, SUM(IF(month(dat) = 6, quantity, 0)) AS June,
SUM(IF(month(im.CreatedDate) = 7, pl.Quantity, 0)) AS July, SUM(IF(month(dat) = 7, quantity, 0)) AS July,
SUM(IF(month(im.CreatedDate) = 8, pl.Quantity, 0)) AS August, SUM(IF(month(dat) = 8, quantity, 0)) AS August,
SUM(IF(month(im.CreatedDate) = 9, pl.Quantity, 0)) AS September, SUM(IF(month(dat) = 9, quantity, 0)) AS September,
SUM(IF(month(im.CreatedDate) = 10, pl.Quantity, 0)) AS October, SUM(IF(month(dat) = 10, quantity, 0)) AS October,
SUM(IF(month(im.CreatedDate) = 11, pl.Quantity, 0)) AS November, SUM(IF(month(dat) = 11, quantity, 0)) AS November,
SUM(IF(month(im.CreatedDate) = 12, pl.Quantity, 0)) AS December, SUM(IF(month(dat) = 12, quantity, 0)) AS December,
SUM(IF(month(im.CreatedDate) = 1, pl.Quantity, 0)) AS January, SUM(IF(month(dat) = 1, quantity, 0)) AS January,
SUM(IF(month(im.CreatedDate) = 2, pl.Quantity, 0)) AS February, SUM(IF(month(dat) = 2, quantity, 0)) AS February,
SUM(IF(month(im.CreatedDate) = 3, pl.Quantity, 0)) AS March, SUM(IF(month(dat) = 3, quantity, 0)) AS March,
sum(pl.Quantity) as qtotal, sum(quantity) as qtotal,
SUM(IF(month(im.CreatedDate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril, SUM(IF(month(dat) = 4, value, 0)) AS vApril,
SUM(IF(month(im.CreatedDate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay, SUM(IF(month(dat) = 5, value, 0)) AS vMay,
SUM(IF(month(im.CreatedDate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune, SUM(IF(month(dat) = 6, value, 0)) AS vJune,
SUM(IF(month(im.CreatedDate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly, SUM(IF(month(dat) = 7, value, 0)) AS vJuly,
SUM(IF(month(im.CreatedDate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust, SUM(IF(month(dat) = 8, value, 0)) AS vAugust,
SUM(IF(month(im.CreatedDate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember, SUM(IF(month(dat) = 9, value, 0)) AS vSeptember,
SUM(IF(month(im.CreatedDate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober, SUM(IF(month(dat) = 10, value, 0)) AS vOctober,
SUM(IF(month(im.CreatedDate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember, SUM(IF(month(dat) = 11, value, 0)) AS vNovember,
SUM(IF(month(im.CreatedDate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember, SUM(IF(month(dat) = 12, value, 0)) AS vDecember,
SUM(IF(month(im.CreatedDate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary, SUM(IF(month(dat) = 1, value, 0)) AS vJanuary,
SUM(IF(month(im.CreatedDate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary, SUM(IF(month(dat) = 2, value, 0)) AS vFebruary,
SUM(IF(month(im.CreatedDate) = 3, pl.Quantity * pl.Rate, 0)) AS vMarch, SUM(IF(month(dat) = 3, value, 0)) AS vMarch,
sum(pl.Quantity * pl.Rate) as vtotal sum(value) as vtotal
FROM T_PurchaseOrder_Master pm FROM year_wise_inward
join T_IGR_Master im on im.PONO = pm.PONO where status != 'ST030' ";
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' ";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'"; $sql.="and supplier_name = '".$cname."'";
} }
@ -1744,7 +1723,7 @@ if ($cname!= ''){
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
} }

View File

@ -312,7 +312,7 @@ if(!empty($mms))
<td><strong>&nbsp</strong></td> <td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td> <td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td> <td><strong>&nbsp</strong></td>
<td><strong>&nbsp</strong></td>
<td class="amount" style="text-align:right"><strong> <td class="amount" style="text-align:right"><strong>
<?php <?php
@ -324,6 +324,15 @@ if(!empty($mms))
</strong> </strong>
</td> </td>
<td class="amount"><strong>
<?php
{
//echo format_currency($tot_rate,2,'.','');
}
?>
</strong>
</td>
<td class="amount"><strong> <td class="amount"><strong>
<?php <?php
{ {

View File

@ -108,11 +108,11 @@ if(!empty($mms))
<td style="text-align:center"><span> <td style="text-align:center"><span>
<?php <?php
$date = strtotime($rel->created_date); $da = strtotime($rel->CreatedDate);
$new = date('M-y', $date); $new = date('M-y', $da);
$pass = date('Y-m-d',$date); $pass = date('Y-m-d',$da);
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
//echo $new; //echo $rel->CreatedDate;
?> ?>
<a href="<?= base_url() ?>report/imonth_wise?ab=<?php echo $ab;?>&dat=<?php echo $pass;?>"><?php echo $new;?></a> <a href="<?= base_url() ?>report/imonth_wise?ab=<?php echo $ab;?>&dat=<?php echo $pass;?>"><?php echo $new;?></a>
@ -121,8 +121,8 @@ if(!empty($mms))
$tr3= $tr3 + $rel->quantity; $tr3= $tr3 + $rel->quantity;
echo round($rel->quantity);?></span></td> echo round($rel->quantity);?></span></td>
<td style="text-align:right"><span><?php <td style="text-align:right"><span><?php
$tr4= $tr4 + number_format($rel->total,2,'.',''); $tr4= $tr4 + number_format($rel->value,2,'.','');
echo number_format($rel->total,2,'.','');?></span></td> echo number_format($rel->value,2,'.','');?></span></td>