for date change
This commit is contained in:
parent
87110c500d
commit
2d85e688e4
1138
application/logs/log-2017-12-11.php
Normal file
1138
application/logs/log-2017-12-11.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -452,7 +452,7 @@ function reqdetail(){
|
||||
function report_relpo(){
|
||||
|
||||
|
||||
$sql="select Mast.PONO,Mast.POType,date_format(Mast.CreatedDate,'%d-%m-%Y') as CreatedDate,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 CreatedDate,date_format(Mast.ReleasedOn,'%d-%m-%Y') as ReleasedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue
|
||||
from T_PurchaseOrder_Master Mast
|
||||
JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO
|
||||
JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
|
||||
@ -473,7 +473,7 @@ group by Mast.PONO";
|
||||
function report_openpending(){
|
||||
|
||||
|
||||
$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
|
||||
$sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.PODate,'%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
|
||||
@ -552,7 +552,7 @@ JOIN T_CostCenter_Master Cost_Mast on Cost_Center_Budget.CostCenterCode=Cost_Mas
|
||||
JOIN T_CostCenter_Departments CostCentDept on CostCentDept.CostCenterCode=Cost_Mast.CostCenterCode
|
||||
JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode= CostCentDept.DEPCode
|
||||
left JOIN T_Service_Tax st on st.LineItemNo = PO_Line_Item.LineItemNo
|
||||
WHERE Cost_Center_Budget.BudgetType = po.POType and date(po.CreatedDate) >= '".$fa."-04-01' and date(po.CreatedDate) <= '".$aa."-03-31'
|
||||
WHERE Cost_Center_Budget.BudgetType = po.POType and date(po.PODate) >= '".$fa."-04-01' and date(po.PODate) <= '".$aa."-03-31'
|
||||
group by
|
||||
Cost_Center_Budget.CostCenterCode,Cost_Center_Budget.BudgetYear,Cost_Center_Budget.BudgetType
|
||||
order by Cost_Center_Budget.CostCenterCode";
|
||||
@ -567,7 +567,7 @@ order by Cost_Center_Budget.CostCenterCode";
|
||||
function report_MMSupplier(){
|
||||
|
||||
|
||||
$sql="select po.CreatedDate as Material_Date,po.SupplierID,sup.SupplierName,pl.MaterialCode,mm.MaterialName,mm.MaterialType,mm.UOM,mm.HSNCODE
|
||||
$sql="select po.PODate as Material_Date,po.SupplierID,sup.SupplierName,pl.MaterialCode,mm.MaterialName,mm.MaterialType,mm.UOM,mm.HSNCODE
|
||||
from T_PurchaseOrder_Master po
|
||||
join T_PurchaseOrder_LineItem pl on pl.PONO=po.PONO
|
||||
join T_MaterialMaster mm on mm.MaterialCode=pl.MaterialCode
|
||||
@ -610,8 +610,8 @@ 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,
|
||||
$sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date,
|
||||
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
|
||||
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,
|
||||
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
|
||||
@ -651,12 +651,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -664,8 +664,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
if ($prod!= ''){
|
||||
@ -684,8 +684,8 @@ $sql.="group by pono,material_name,supplier_name";
|
||||
function report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d){
|
||||
|
||||
|
||||
$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,
|
||||
$sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date,
|
||||
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
|
||||
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,
|
||||
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
|
||||
@ -725,12 +725,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -738,8 +738,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
if ($prod!= ''){
|
||||
@ -759,7 +759,7 @@ if ($cname!= ''){
|
||||
}
|
||||
if ($d!= ''){
|
||||
|
||||
$sql.=" and date(pm.CreatedDate) = '".$d."' ";
|
||||
$sql.=" and date(pm.PODate) = '".$d."' ";
|
||||
|
||||
}
|
||||
|
||||
@ -774,9 +774,9 @@ $sql.="group by pono,material_name,supplier_name";
|
||||
|
||||
|
||||
$sql="SELECT
|
||||
CASE WHEN MONTH(CreatedDate)>=4 THEN
|
||||
concat(YEAR(CreatedDate), '-',YEAR(CreatedDate)+1)
|
||||
ELSE concat(YEAR(CreatedDate)-1,'-', YEAR(CreatedDate)) END AS financial_year
|
||||
CASE WHEN MONTH(PODate)>=4 THEN
|
||||
concat(YEAR(PODate), '-',YEAR(PODate)+1)
|
||||
ELSE concat(YEAR(PODate)-1,'-', YEAR(PODate)) END AS financial_year
|
||||
FROM T_PurchaseOrder_Master
|
||||
GROUP BY financial_year";
|
||||
$query = $this->db->query($sql);
|
||||
@ -788,7 +788,7 @@ GROUP BY financial_year";
|
||||
function report_year_wise(){
|
||||
|
||||
|
||||
$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
|
||||
$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
|
||||
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
@ -822,7 +822,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
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.CreatedDate)= ? and year(pm.CreatedDate) = ?
|
||||
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.PODate)= ? and year(pm.PODate) = ?
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql,array($month,$year));
|
||||
return $query->result();
|
||||
@ -835,7 +835,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
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.CreatedDate) >= '$a-04-01' and date(pm.CreatedDate) <= '$b-03-31'
|
||||
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'
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql,array());
|
||||
return $query->result();
|
||||
@ -897,12 +897,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -910,8 +910,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
$sql.= "group by supplier_name";
|
||||
@ -924,31 +924,31 @@ if ($cname!= ''){
|
||||
|
||||
|
||||
$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(IF(month(pm.PODate) = 4, pl.Quantity, 0)) AS April,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity, 0)) AS May,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity, 0)) AS June,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity, 0)) AS July,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity, 0)) AS August,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity, 0)) AS September,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity, 0)) AS October,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity, 0)) AS November,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity, 0)) AS December,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity, 0)) AS January,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity, 0)) AS February,
|
||||
SUM(IF(month(pm.PODate) = 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(IF(month(pm.PODate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary,
|
||||
SUM(IF(month(pm.PODate) = 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
|
||||
@ -966,7 +966,7 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
|
||||
@ -986,10 +986,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
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
|
||||
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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
group by supplier_name,material_name
|
||||
) as year left join
|
||||
@ -999,7 +999,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and
|
||||
month(pm.CreatedDate) = month(current_date())
|
||||
month(pm.PODate) = 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
|
||||
@ -1009,7 +1009,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and
|
||||
date(pm.CreatedDate) = current_date()
|
||||
date(pm.PODate) = 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
|
||||
@ -1024,7 +1024,7 @@ 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 pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and month(pm.CreatedDate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
|
||||
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."'
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1038,10 +1038,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
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
|
||||
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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.POdate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
|
||||
group by supplier_name,material_name";
|
||||
@ -1056,7 +1056,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status != 'ST056' and sd.SupplierName is not null and
|
||||
date(pm.CreatedDate) = 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";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1064,8 +1064,8 @@ group by supplier_name,material_name";
|
||||
function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
|
||||
|
||||
|
||||
$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,
|
||||
$sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date,
|
||||
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
|
||||
mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,
|
||||
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate,
|
||||
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
|
||||
@ -1104,12 +1104,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -1117,8 +1117,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
if ($prod!= ''){
|
||||
@ -1142,8 +1142,8 @@ $sql.="group by pono,material_name,category,supplier_name";
|
||||
function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat){
|
||||
|
||||
|
||||
$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,
|
||||
$sql="SELECT pm.PONO as pono,date_format(pm.PODate,'%d-%m-%Y') as created_date,
|
||||
TIME_FORMAT(pm.PODate,'%l:%i %p') as created_time,
|
||||
mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,
|
||||
ifnull(sum(pl.Quantity),0) as quantity,mm.UOM as UOM,ifnull(sum(pl.Rate),0) as rate,
|
||||
round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as value,
|
||||
@ -1183,12 +1183,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -1196,8 +1196,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
if ($prod!= ''){
|
||||
@ -1217,7 +1217,7 @@ if ($cname!= ''){
|
||||
}
|
||||
if ($d!= ''){
|
||||
|
||||
$sql.=" and date(pm.CreatedDate) = '".$d."' ";
|
||||
$sql.=" and date(pm.PODate) = '".$d."' ";
|
||||
|
||||
}
|
||||
if ($cat!= ''){
|
||||
@ -1237,7 +1237,7 @@ $sql.="group by pono,material_name,category,supplier_name";
|
||||
function ireport_year_wise(){
|
||||
|
||||
|
||||
$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
|
||||
$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
|
||||
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
|
||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
@ -1262,7 +1262,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and pm.PONO in (select PONO from T_IGR_Master) and month(pm.CreatedDate)= ? and year(pm.CreatedDate) = ?
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate)= ? and year(pm.PODate) = ?
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql,array($month,$year));
|
||||
return $query->result();
|
||||
@ -1275,7 +1275,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and sd.SupplierName is not null and date(pm.CreatedDate) >= '$a-04-01' and date(pm.CreatedDate) <= '$b-03-31'
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) 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";
|
||||
$query = $this->db->query($sql,array());
|
||||
return $query->result();
|
||||
@ -1337,12 +1337,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(pm.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(pm.PODate) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -1350,8 +1350,8 @@ if ($cname!= ''){
|
||||
$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."'";
|
||||
$sql.="and date(pm.PODate) >= '".$fromd."'
|
||||
and date(pm.PODate) <= '".$tod."'";
|
||||
|
||||
}
|
||||
$sql.= "group by supplier_name";
|
||||
@ -1364,31 +1364,31 @@ if ($cname!= ''){
|
||||
|
||||
|
||||
$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(IF(month(pm.PODate) = 4, pl.Quantity, 0)) AS April,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity, 0)) AS May,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity, 0)) AS June,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity, 0)) AS July,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity, 0)) AS August,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity, 0)) AS September,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity, 0)) AS October,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity, 0)) AS November,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity, 0)) AS December,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity, 0)) AS January,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity, 0)) AS February,
|
||||
SUM(IF(month(pm.PODate) = 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(IF(month(pm.PODate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary,
|
||||
SUM(IF(month(pm.PODate) = 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
|
||||
@ -1406,7 +1406,7 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
|
||||
@ -1426,10 +1426,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) 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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
group by supplier_name,material_name
|
||||
) as year left join
|
||||
@ -1439,7 +1439,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
month(pm.CreatedDate) = month(current_date())
|
||||
month(pm.PODate) = 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
|
||||
@ -1449,7 +1449,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
date(pm.CreatedDate) = current_date()
|
||||
date(pm.PODate) = 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
|
||||
@ -1464,7 +1464,7 @@ 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 pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and month(pm.CreatedDate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and month(pm.PODate) = 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();
|
||||
@ -1478,10 +1478,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) 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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
|
||||
group by supplier_name,material_name";
|
||||
@ -1496,7 +1496,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
date(pm.CreatedDate) = 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";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1511,10 +1511,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) 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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
group by category,material_name
|
||||
) as year left join
|
||||
@ -1524,7 +1524,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
month(pm.CreatedDate) = month(current_date())
|
||||
month(pm.PODate) = month(current_date())
|
||||
group by category,material_name
|
||||
) as month on month.material_name=year.material_name and month.category=year.category
|
||||
left join
|
||||
@ -1534,7 +1534,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
date(pm.CreatedDate) = current_date()
|
||||
date(pm.PODate) = current_date()
|
||||
group by category,material_name
|
||||
) as today on today.material_name=month.material_name and today.category=month.category
|
||||
group by category,material_name ";
|
||||
@ -1550,10 +1550,10 @@ left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) 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 )
|
||||
when (month(pm.PODate) >=4) then
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 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 )
|
||||
(YEAR(pm.PODate) = YEAR(CURRENT_DATE)-1 and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) <= 3 )
|
||||
end
|
||||
and mm.MaterialCode = '".$mat."' and mm.Category = '".$cat."'
|
||||
group by supplier_name,material_name";
|
||||
@ -1569,7 +1569,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
month(pm.CreatedDate) = month(current_date()) and mm.MaterialCode = '".$mat."' and mm.Category = '".$cat."'
|
||||
month(pm.PODate) = month(current_date()) and mm.MaterialCode = '".$mat."' and mm.Category = '".$cat."'
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1582,7 +1582,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_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
date(pm.CreatedDate) = current_date() and mm.MaterialCode = '".$mat."'and mm.Category = '".$cat."'
|
||||
date(pm.PODate) = current_date() and mm.MaterialCode = '".$mat."'and mm.Category = '".$cat."'
|
||||
group by supplier_name,material_name";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1591,31 +1591,31 @@ group by supplier_name,material_name";
|
||||
|
||||
|
||||
$sql="select mm.Category as category,mm.MaterialCode as mid,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(IF(month(pm.PODate) = 4, pl.Quantity, 0)) AS April,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity, 0)) AS May,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity, 0)) AS June,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity, 0)) AS July,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity, 0)) AS August,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity, 0)) AS September,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity, 0)) AS October,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity, 0)) AS November,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity, 0)) AS December,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity, 0)) AS January,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity, 0)) AS February,
|
||||
SUM(IF(month(pm.PODate) = 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(IF(month(pm.PODate) = 4, pl.Quantity * pl.Rate, 0)) AS vApril,
|
||||
SUM(IF(month(pm.PODate) = 5, pl.Quantity * pl.Rate, 0)) AS vMay,
|
||||
SUM(IF(month(pm.PODate) = 6, pl.Quantity * pl.Rate, 0)) AS vJune,
|
||||
SUM(IF(month(pm.PODate) = 7, pl.Quantity * pl.Rate, 0)) AS vJuly,
|
||||
SUM(IF(month(pm.PODate) = 8, pl.Quantity * pl.Rate, 0)) AS vAugust,
|
||||
SUM(IF(month(pm.PODate) = 9, pl.Quantity * pl.Rate, 0)) AS vSeptember,
|
||||
SUM(IF(month(pm.PODate) = 10, pl.Quantity * pl.Rate, 0)) AS vOctober,
|
||||
SUM(IF(month(pm.PODate) = 11, pl.Quantity * pl.Rate, 0)) AS vNovember,
|
||||
SUM(IF(month(pm.PODate) = 12, pl.Quantity * pl.Rate, 0)) AS vDecember,
|
||||
SUM(IF(month(pm.PODate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary,
|
||||
SUM(IF(month(pm.PODate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary,
|
||||
SUM(IF(month(pm.PODate) = 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
|
||||
@ -1633,7 +1633,7 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
|
||||
@ -1653,10 +1653,10 @@ 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
|
||||
where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO from T_IGR_Master) and
|
||||
monthname(pm.CreatedDate) = '".$m."' and mm.Category = '".$cat."' and mm.MaterialCode = '".$mat."' ";
|
||||
monthname(pm.PODate) = '".$m."' and mm.Category = '".$cat."' and mm.MaterialCode = '".$mat."' ";
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
$sql.= "group by category,supplier_name,material_name";
|
||||
@ -1677,7 +1677,7 @@ where pm.Status != 'ST030' and pm.Status = 'ST056' and pm.PONO in (select PONO f
|
||||
mm.Category = '".$cat."' and mm.MaterialCode = '".$mat."' ";
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (pm.CreatedDate >= '".$fa."-04-01' and pm.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
$sql.= "group by category,supplier_name,material_name";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user