Home > Back-end >  SAP Crystal Report Header and Detail Level Discount
SAP Crystal Report Header and Detail Level Discount

Time:10-18

I am using SAP crystal report with VS 2013. I have two level discounts, first on the header table and second on the detail table.

When I have developed its report, with two levels group, the first group is on voucher number and the second level group is on customers. The detail level discount is working fine, but when I try to display header level sum on customer level totals. the sum of the header lever discount shows the wrong value. Actually, it multiplies the discount amount with the number of items in the invoice. how I can avoid multiplying.

If I can do this on query level that will be better I think.

Here is the SQL query for a report

    SELECT        TOP (100) PERCENT dbo.Party.Name, dbo.VH.VNo, dbo.VH.VType, dbo.VH.VDate, dbo.Stock.PNO, dbo.Stock.NAME AS IName, dbo.StTrans.RATE, dbo.StTrans.QTY, dbo.StTrans.BATCH, dbo.VH.Discount, dbo.VH.Company, 
                         dbo.StTrans.DISCOUNT AS dDiscount, dbo.StTrans.DPER
FROM            dbo.VH INNER JOIN
                         dbo.StTrans ON dbo.VH.MId = dbo.StTrans.MId INNER JOIN
                         dbo.Party ON dbo.VH.PerNo = dbo.Party.PerNo INNER JOIN
                         dbo.Stock ON dbo.StTrans.PNO = dbo.Stock.PNO
WHERE        (dbo.VH.PerNo NOT IN
                             (SELECT        PerNo
                               FROM            dbo.Party AS Party_1
                               WHERE        (Type = 10))) AND (dbo.VH.VType = 'SI') AND (dbo.VH.VDate BETWEEN '2021/10/01' AND '2021/10/16') AND (dbo.VH.PerNo <> 0) AND (dbo.VH.Company = 1)

Here is the query result and report view

enter image description here

enter image description here

CodePudding user response:

The best solution for this is to create a Running Total on the header-level discount. Simply set the Evaluate option to once per Voucher Number grouping. enter image description here

  • Related