inward summary fix
This commit is contained in:
parent
e2bc6885d0
commit
7ffc33c0fb
@ -1399,26 +1399,47 @@ group by supplier_name,material_name";
|
||||
|
||||
|
||||
$sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,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.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(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(rt.AfterCGST),sum(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(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount,
|
||||
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight,
|
||||
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package,
|
||||
ifnull(rt.Insurance,0) as insurance,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
|
||||
|
||||
round((
|
||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0)
|
||||
+ ifnull(rt.Insurance,0)
|
||||
- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total,pb.FilePath as file
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
|
||||
- round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
|
||||
pb.FilePath as file
|
||||
from T_IGR_Master im
|
||||
|
||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||
@ -1478,26 +1499,47 @@ $sql.="group by pono,material_name,category,supplier_name";
|
||||
|
||||
|
||||
$sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,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.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(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(rt.AfterCGST),sum(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(rt.AfterDiscount),sum(st.Afterdiscountval)),0) as discount,
|
||||
ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0) as freight,
|
||||
ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0) as Package,
|
||||
ifnull(rt.Insurance,0) as insurance,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) as cgst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) as igst,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2) as discount,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) as freight,
|
||||
round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
|
||||
|
||||
round((
|
||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0)
|
||||
+ ifnull(rt.Insurance,0)
|
||||
- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total,pb.FilePath as file
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
|
||||
+ round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
|
||||
- round(ifnull(if(POType = 'REVENUE',
|
||||
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
|
||||
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
|
||||
pb.FilePath as file
|
||||
from T_IGR_Master im
|
||||
|
||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||
@ -1583,33 +1625,15 @@ $sql.="group by pono,material_name,category,supplier_name";
|
||||
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
|
||||
|
||||
|
||||
$sql="select sd.SupplierID as sid,im.PONO as pono,pm.POType as potype,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,sd.SupplierName as supplier_name,
|
||||
round((
|
||||
if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
|
||||
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterSGST),sum(st.After_SGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterCGST),sum(st.After_CGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterIGST),sum(st.After_IGST)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterFreightValue),sum(st.AfterFreightValue)),0)
|
||||
+ ifnull(if(POType = 'REVENUE',sum(rt.AfterPackagingValue),0),0)
|
||||
+ ifnull(rt.Insurance,0)
|
||||
- ifnull(if(POType = 'REVENUE',sum(rt.AfterDiscount),sum(st.Afterdiscountval)),0)),2) as total,pb.FilePath as file1
|
||||
from T_IGR_Master im
|
||||
|
||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||
join T_PurchaseOrder_Master pm on pm.PONO = pl.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
|
||||
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
||||
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
||||
where pm.Status != 'ST030' ";
|
||||
$sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,supplier_name,
|
||||
sum(total) as total,file
|
||||
from igr
|
||||
where status != 'ST030'
|
||||
";
|
||||
|
||||
if ($cname!= ''){
|
||||
|
||||
$sql.="and sd.SupplierName = '".$cname."'";
|
||||
$sql.="and supplier_name = '".$cname."'";
|
||||
|
||||
}
|
||||
|
||||
@ -1617,12 +1641,12 @@ if ($cname!= ''){
|
||||
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
|
||||
$sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')";
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
$sql.="and monthname(im.CreatedDate) = '".$m."'";
|
||||
$sql.="and monthname(created_date) = '".$m."'";
|
||||
|
||||
}
|
||||
|
||||
@ -1630,8 +1654,8 @@ if ($cname!= ''){
|
||||
$fromd= date("Y-m-d",strtotime($frm));
|
||||
$tod=date("Y-m-d",strtotime($t));
|
||||
|
||||
$sql.="and date(im.CreatedDate) >= '".$fromd."'
|
||||
and date(im.CreatedDate) <= '".$tod."'";
|
||||
$sql.="and date(created_date) >= '".$fromd."'
|
||||
and date(created_date) <= '".$tod."'";
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user