Consolidate Report
This commit is contained in:
parent
04d2e8da33
commit
76d1a11019
@ -1672,51 +1672,51 @@ group by material_name,supplier_name";
|
|||||||
function ireport_supplier($cname,$fa,$aa,$m,$frm,$t){
|
function ireport_supplier($cname,$fa,$aa,$m,$frm,$t){
|
||||||
|
|
||||||
|
|
||||||
$sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
|
$sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
|
||||||
|
|
||||||
case pm.POType
|
case pm.POType
|
||||||
when 'IMPORT'
|
when 'IMPORT'
|
||||||
then ifnull((sum(distinct(id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
|
then ifnull((sum((id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
|
||||||
|
|
||||||
),0)
|
),0)
|
||||||
when 'CAPITAL'
|
when 'CAPITAL'
|
||||||
then sum(distinct if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * pl.Rate)
|
then sum( if(pm.CapitalRange=0,(( id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate),( id.QuantityAsPerInvoice * pl.Rate)
|
||||||
- st.Afterdiscountval))
|
- st.Afterdiscountval))
|
||||||
+ ifnull(sum(distinct st.After_SGST),0)
|
+ ifnull(sum(st.After_SGST),0)
|
||||||
+ ifnull(sum(distinct st.After_CGST),0)
|
+ ifnull(sum(st.After_CGST),0)
|
||||||
+ ifnull(sum(distinct st.After_IGST),0)
|
+ ifnull(sum(st.After_IGST),0)
|
||||||
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
+ ifnull(sum(st.AfterFreightValue),0)
|
||||||
|
|
||||||
|
|
||||||
when 'SERVICE'
|
when 'SERVICE'
|
||||||
then ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)
|
then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
|
||||||
+ ifnull(sum(distinct st.After_SGST),0)
|
+ ifnull(sum(st.After_SGST),0)
|
||||||
+ ifnull(sum(distinct st.After_CGST),0)
|
+ ifnull(sum(st.After_CGST),0)
|
||||||
+ ifnull(sum(distinct st.After_IGST),0)
|
+ ifnull(sum(st.After_IGST),0)
|
||||||
+ ifnull(sum(distinct st.AfterFreightValue),0)
|
+ ifnull(sum(st.AfterFreightValue),0)
|
||||||
- ifnull(sum(distinct st.Afterdiscountval),0)
|
- ifnull(sum(st.Afterdiscountval),0)
|
||||||
|
|
||||||
when 'REVENUE'
|
when 'REVENUE'
|
||||||
then ifnull(sum(distinct id.QuantityAsPerInvoice * pl.Rate),0)
|
then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
|
||||||
- ifnull(sum(distinct rt.AfterDiscount),0)
|
- ifnull(sum(rt.AfterDiscount),0)
|
||||||
+ ifnull(sum(distinct rt.AfterSGST),0)
|
+ ifnull(sum(rt.AfterSGST),0)
|
||||||
+ ifnull(sum(distinct rt.AfterCGST),0)
|
+ ifnull(sum(rt.AfterCGST),0)
|
||||||
+ ifnull(sum(distinct rt.AfterIGST),0)
|
+ ifnull(sum(rt.AfterIGST),0)
|
||||||
+ ifnull(sum(distinct rt.AfterFreightValue),0)
|
+ ifnull(sum(rt.AfterFreightValue),0)
|
||||||
+ ifnull(sum(distinct rt.AfterPackagingValue),0)
|
+ ifnull(sum(rt.AfterPackagingValue),0)
|
||||||
|
|
||||||
end
|
end
|
||||||
as total
|
as total
|
||||||
from T_IGR_Master im
|
from T_IGR_Master im
|
||||||
join T_IGR_Details id on id.IGRNO = im.IGRNO
|
|
||||||
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
|
||||||
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
|
||||||
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
|
||||||
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
|
||||||
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
|
||||||
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
|
||||||
left join T_PurchaseOrder_BillUpload pb on pb.PONO=pm.PONO
|
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
|
||||||
where pm.Status != 'ST030' ";
|
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
|
||||||
|
where pm.Status != 'ST030'";
|
||||||
|
|
||||||
if ($cname!= ''){
|
if ($cname!= ''){
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user