Modify formula like this...
Global numbervar SumOfTtlPrice;
numbervar discrate := ToNumber({@Discrate});
if discrate = 0.00 then
(
SumOfTtlPrice := SumOfTtlPrice + {DataTable1.TotalPrice};
cstr({DataTable1.TotalPrice});
)
dragdrop it in detail section
Now To print SumOfTtlPrice create another formula name it
PrintSumOfTtlPrice
WhilePrintingRecords;
Global numbervar SumOfTtlPrice;
SumOfTtlPrice;
drag drop it in footer section
Happy Coding!
:)