Friday, 19 January 2018

GST TAX QUERRY :- GSTR1-B2B,GSTR1-B2CL,GSTR1-B2CS,GSTR1-CNDR,GSTR1-CDNUR

GSTR1-B2B

Declare @fdate as date
Declare @Tdate as date
Set @fdate =  (select min(ta.docdate) from OINV ta where ta.docdate >= '[%0]')
Set @Tdate =(select max(tb.docdate) from OINV tb where tb.docdate <= '[%1]')
select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
T0.DocNum [Invoice Number],
T0.CARDNAME,
CAST(t0.DocDate AS DATE) 'INVOICE DATE',
ISNULL(t0.DocTotal,0) 'Invoice Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
'' 'Reverse Charge',
'Regular' 'Invoice Type',
'' 'E-Commerce GSTIN',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from INV4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from INV1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from OINV t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
inner join CRD1 t3  on t0.CardCode=t3.cardcode AND T3.AdresType='S' AND T0.ShipToCode=T3.Address
INNER JOIN INV12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N'
AND (T12.BpGSTN IS NOT NULL OR T3.GSTRegnNo IS NOT NULL)
AND  T0.revrefno IS NULL

------------------------------------------------------------------------------------------------------------------------
GSTR1-B2CL

Declare @fdate as date
Declare @Tdate as date
Set @fdate =  (select min(ta.docdate) from OINV ta where ta.docdate >= '[%0]')
Set @Tdate =(select max(tb.docdate) from OINV tb where tb.docdate <= '[%1]')
select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
T0.CARDNAME,
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
T0.DocNum [Invoice Number],
CAST(t0.DocDate AS DATE) 'INVOICE DATE',
ISNULL(t0.DocTotal,0) 'Invoice Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
'' 'Reverse Charge',
'Regular' 'Invoice Type',
'' 'E-Commerce GSTIN',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from INV4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from INV1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from OINV t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
LEFT join CRD1 t3  on t0.CardCode=t3.cardcode and t3.AdresType='S' AND T0.SHIPTOCODE=T3.ADDRESS
INNER JOIN INV12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N' AND T12.BpGSTN IS NULL AND T3.GSTRegnNo IS NULL AND ISNULL(t0.DocTotal,0) > 250000 AND T16.GSTCode!=t15.GSTCode AND  T0.revrefno IS NULL


--------------------------------------------------------------------------------------------------------------------------

GSTR1-B2CS

Declare @fdate as date
Declare @Tdate as date
Set @fdate =  (select min(ta.docdate) from OINV ta where ta.docdate >= '[%0]')
Set @Tdate =(select max(tb.docdate) from OINV tb where tb.docdate <= '[%1]')
select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
T0.CARDNAME,
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
T0.DocNum [Invoice Number],
CAST(t0.DocDate AS DATE) 'INVOICE DATE',
ISNULL(t0.DocTotal,0) 'Invoice Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
'' 'Reverse Charge',
'Regular' 'Invoice Type',
'' 'E-Commerce GSTIN',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from INV4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from INV1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from OINV t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
LEFT join CRD1 t3  on t0.CardCode=t3.cardcode and t3.AdresType='S' AND T0.SHIPTOCODE=T3.ADDRESS
INNER JOIN INV12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N' AND T12.BpGSTN IS NULL
AND T3.GSTRegnNo IS NULL AND (ISNULL(t0.DocTotal,0) <= 250000 OR T16.GSTCode=t15.GSTCode) AND  T0.revrefno IS NULL




----------------------------------------------------------------------------------------------------------------------------
GSTR1-CNDR

Declare @fdate as date
Declare @Tdate as date
Set @fdate =  (select min(ta.docdate) from OINV ta where ta.docdate >= '[%0]')
Set @Tdate =(select max(tb.docdate) from OINV tb where tb.docdate <= '[%1]')
select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
 T0.CARDNAME,
T0.revrefno [Invoice/Advacnce Receipt Number],
CAST(t0.revrefdate AS DATE) '3. Invoice/Advance Receipt date',
T0.docnum [Note/Refund Voucher Number],
CAST(t0.docdate AS DATE) 'Note/Refund Voucher Date',
'D' 'Invoice Type',
t0.comments 'Reason for Issuing Document',
ISNULL(t0.DocTotal,0) 'Note/Refund Voucher Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from INV4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from INV4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from INV1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from OINV t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
inner join CRD1 t3  on t0.CardCode=t3.cardcode AND T3.AdresType='S' AND T0.ShipToCode=T3.Address
INNER JOIN INV12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N'
AND (T12.BpGSTN IS NOT NULL OR T3.GSTRegnNo IS NOT NULL)
AND  T0.revrefno IS NOT NULL

union all

select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
 T0.CARDNAME,
T0.revrefno [Invoice/Advacnce Receipt Number],
CAST(t0.revrefdate AS DATE) '3. Invoice/Advance Receipt date',
T0.docnum [Note/Refund Voucher Number],
CAST(t0.docdate AS DATE) 'Note/Refund Voucher Date',
'C' 'Invoice Type',
t0.comments 'Reason for Issuing Document',
ISNULL(t0.DocTotal,0) 'Note/Refund Voucher Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from RIN1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from ORIN t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
inner join CRD1 t3  on t0.CardCode=t3.cardcode AND T3.AdresType='S' AND T0.ShipToCode=T3.Address
INNER JOIN RIN12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N'
AND (T12.BpGSTN IS NOT NULL OR T3.GSTRegnNo IS NOT NULL)
AND  T0.revrefno IS NOT NULL


UNION ALL
select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
 T0.CARDNAME,
T0.revrefno [Invoice/Advacnce Receipt Number],
CAST(t0.revrefdate AS DATE) '3. Invoice/Advance Receipt date',
T0.docnum [Note/Refund Voucher Number],
CAST(t0.docdate AS DATE) 'Note/Refund Voucher Date',
'D' 'Invoice Type',
t0.comments 'Reason for Issuing Document',
ISNULL(t0.DocTotal,0) 'Note/Refund Voucher Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from RIN1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from ORIN t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
inner join CRD1 t3  on t0.CardCode=t3.cardcode AND T3.AdresType='S' AND T0.ShipToCode=T3.Address
INNER JOIN RIN12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N'
AND (T12.BpGSTN IS NOT NULL OR T3.GSTRegnNo IS NOT NULL)
AND  T0.revrefno IS NULL



---------------------------------------------------------------------------------------------------------------------------
GSTR1-CDNUR


Declare @fdate as date
Declare @Tdate as date
Set @fdate =  (select min(ta.docdate) from OINV ta where ta.docdate >= '[%0]')
Set @Tdate =(select max(tb.docdate) from OINV tb where tb.docdate <= '[%1]')

select
T12.LOCGSTN 'LOCATION GSTN',
case when len(T16.GSTCode)=1
then '0'+ T16.GSTCode + '-' + T16.Name
else T16.GSTCode + '-'+T16.Name  end as 'Billing Location',
CASE WHEN ISNULL(T12.BpGSTN,'')=''
THEN T3.GSTRegnNo ELSE T12.BpGSTN END
 'GSTIN/UIN of Recipient',
 T0.CARDNAME,
T0.revrefno [Invoice/Advacnce Receipt Number],
CAST(t0.revrefdate AS DATE) '3. Invoice/Advance Receipt date',
T0.docnum [Note/Refund Voucher Number],
CAST(t0.docdate AS DATE) 'Note/Refund Voucher Date',
'D' 'Invoice Type',
t0.comments 'Reason for Issuing Document',
ISNULL(t0.DocTotal,0) 'Note/Refund Voucher Value',
case when len(t15.GSTCode)=1
then '0'+ t15.GSTCode + '-' + t15.Name
else t15.GSTCode + '-'+t15.Name  end as 'Place of Supply',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00)  'Taxable Value-SGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxRate-SGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-100'),0.00) as 'TaxSum-SGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00)  'Taxable Value-CGST',
ISNULL((Select distinct(TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxRate-CGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-110'),0.00) as 'TaxSum-CGST',
ISNULL((Select sum(BaseSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00)  'Taxable Value-IGST',
ISNULL((Select top 1 (TaxRate) from RIN4 where DocEntry=t0.docentry and staType='-120' order by TaxRate desc),0.00) as 'TaxRate-IGST',
ISNULL((Select SUM(TaxSum) from RIN4 where DocEntry=t0.docentry and staType='-120'),0.00) as 'TaxSum-IGST',
ISNULL((Select sum(VatSum) from RIN1 where DocEntry=t0.docentry),0.00) as 'Total Tax',
ISNULL(t0.TotalExpns,0.00) as 'Freight',
0 'Cess Amount'
 from ORIN t0
inner join OCRD t2  on t0.CardCode=t2.cardcode
inner join CRD1 t3  on t0.CardCode=t3.cardcode AND T3.AdresType='S' AND T0.ShipToCode=T3.Address
INNER JOIN RIN12 T12 ON T0.DocEntry=T12.DOCENTRY
INNER JOIN OCST T15 ON T12.BPSTATECod=t15.Code and t15.Country='IN'
INNER JOIN OCST T16 ON T12.LocStatCod=t16.Code and t16.Country='IN'
where T0.DocDate between @FDate AND @TDate AND T0.CANCELED='N'
AND T12.BpGSTN is null and T3.GSTRegnNo IS null 
--ISNULL(t0.DocTotal,0) > 250000 AND T16.GSTCode!=t15.GSTCode
AND  T0.revrefno IS NULL

No comments :

Post a Comment