Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

Detail Lines not getting printed

$
0
0

Hi

  I have below query . Since there is no record in Database it should display 2 lines since i have specified no record exists condition in query

If OBJECT_ID('TempDB.dbo.#GST_Report_GSTR3B_Exempt_Details') Is Not Null
	begin
		Drop Table #GST_Report_GSTR3B_Exempt_Details
	end
	select DocEntry,LineNum,DocNum,DocDate,CardName,LocGSTN,BaseSum,ItemTaxType,IsIntraState
	into #GST_Report_GSTR3B_Exempt_Details
	from (select distinct DocEntry,LineNum,DocNum,DocDate,CardName,LocGSTN,
	case when ObjType = 19 then -BaseSum
	else BaseSum end as BaseSum, ItemTaxType, IsIntraState
	from GST_ODOC_Result_Ignore_RvsCharge t0
	where ObjType in (18, 19)
	and ItemTaxType = 'GN'
	and PureNilRateDoc = 'Y'
	and BpGSTType <> 3
	and DocDate >= {?frDate}
	and DocDate <= {?toDate}
	and LocGSTN = '{?locGSTN}'
;

	with
	CTE1 as
	(
		select DocEntry,LineNum,DocNum,DocDate,CardName,LocGSTN,
		'From a supplier under composition scheme, Exempt and Nil rated supply' as "Nature of Supplies",
		convert(numeric(19, 2), isnull((case when IsIntraState <> 'Y' then BaseSum else 0 end), 0)) as "InterState",
		convert(numeric(19, 2), isnull((case when IsIntraState = 'Y' then BaseSum else 0 end), 0)) as "IntraState"
		from #GST_Report_GSTR3B_Exempt_Details
		where ItemTaxType <> 'NN'

        union all

		select 0,0,'','','','','From a supplier under composition scheme, Exempt and Nil rated supply',0,0
        where not exists
		(select 1 from #GST_Report_GSTR3B_Exempt_Details where ItemTaxType <> 'NN')
	),

	CTE2 as
	(
		select DocEntry,LineNum,DocNum,DocDate,CardName,LocGSTN,
		'Non-GST supply' as "Description",
		convert(numeric(19, 2), isnull((case when IsIntraState <> 'Y' then BaseSum else 0 end), 0)) as "InterState",
		convert(numeric(19, 2), isnull((case when IsIntraState = 'Y' then BaseSum else 0 end), 0)) as "IntraState"
		from #GST_Report_GSTR3B_Exempt_Details
		where ItemTaxType = 'NN'

        union all

		select 0,0,'','','','','Non-GST supply',0,0
        where not exists
		(select 1 from #GST_Report_GSTR3B_Exempt_Details where ItemTaxType = 'NN')
	),

	CTEU as
	(
		select * from CTE1
		union all
		select * from CTE2
	)

	select * from CTEU

Thanks


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>