Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: customer statement Post Reply Post New Topic
Author Message
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Topic: customer statement
     Posted: 25 May 2014 at 8:28am
Hello,
i want to generate report to get customer statement sheet for specified period
i want to calculate the statement for the previous duration

i create a formula
whileprintingrecords;
if {CreditMovements.MoveDate}<{?dat} then
(
if {CreditMovements.CreditType} =1 then
(
currencyvar open := open - {CreditMovements.CreditAmount};
shared currencyvar openduration := openduration - {CreditMovements.CreditAmount};
)
else
(
currencyvar open := open + {CreditMovements.CreditAmount};
shared currencyvar openduration := openduration + {CreditMovements.CreditAmount};
)
)
else
(
if {CreditMovements.CreditType} =1
then
(
currencyvar open := open - {CreditMovements.CreditAmount};

)
else (currencyvar open := open + {CreditMovements.CreditAmount};)
)
but i want the openning balance to be on the head

Edited by fanan - 25 May 2014 at 8:29am
IP IP Logged
Erik
Groupie
Groupie
Avatar

Joined: 05 Dec 2013
Online Status: Offline
Posts: 50
Quote Erik Replybullet Posted: 18 Jun 2014 at 6:07am
Use "global currencyVar open;" after "whileprintingrecords;" in your formula to make it available report wide.

Create a separate formula for your report header that also has "global currencyVar open;" followed by "open" to display the value you calculated in the original formula.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jun 2014 at 5:07am
I have heard that the default is shared, which is actually a larger scope then Global.

As a simple change, you could move the currencyvar open out of each part of the if statement and just put it at the top...then just assign to the value.

just a thought
IP IP Logged
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Posted: 30 Sep 2014 at 8:45am
dear erik thank you for replying
i used global scope it work but there is still an error
the header formula calculate only the first value
IP IP Logged
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Posted: 30 Sep 2014 at 9:33am
hello erik
IP IP Logged
Erik
Groupie
Groupie
Avatar

Joined: 05 Dec 2013
Online Status: Offline
Posts: 50
Quote Erik Replybullet Posted: 14 May 2015 at 9:40am
I'm a bit stumped. My best guess is that the header formula is being executed before the formula that calculates the data you are looking for, in which case the calculations may be occurring after the value is displayed, but that's a shot in the dark.

To test this, you might try doing a Grouping on a distinct value. What this will do is give you a Group header that you can hijack for what is currently in your Report header, since your Details will remain unchanged as long as what you are Grouping on does not have any "like" values within that data subset.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum