Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Running Total Post Reply Post New Topic
Author Message
Hala
Newbie
Newbie
Avatar

Joined: 14 Feb 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Hala Replybullet Topic: Running Total
     Posted: 14 Feb 2008 at 1:10pm

I am trying to do inventory valuation.  I have the final count on hand at year end and the purchased quantities through out the year.

I want to be able to value the quantity purchased for each purchase order up to the inventory count on hand at year end.
 
For Example:  Inventory at year end for ITEM ABC was 1000 and we had 3 purchases throughtout the year.
PO#1 Qty was 250  then it should return 250 as running total is 250 which is <1000
PO#2 Qty was 700 then it should return 700 as running total is 950 which is < 1000
PO#3 Qty was 900 then it should return 50 to match limit of count on hand.
 
I have been attempting Previous({Runningtotal}) - Qty purchased and it does not allow previous feather with running totals.  Can anyone assist me with a resolution?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 14 Feb 2008 at 4:37pm
Create a global variable that tracks the running total. Then compare this variable with the current inventory to see if it exceeds the max. Something like this:
Global NumberVar TotalInven;
NumberVar NewTotal;
NewTotal := {item.qty} + TotalInven
if NewTotal < 1000 Then
{
    //Update the grand total
    TotalInven := NewTotal;
    //return the current quantity
   {item.qty};
}
else
{
    //Overwrite the NewTotal with the value to return (to keep from creating another variable. This is whatever is left from the remaining 1000
    NewTotal := 1000-TotalInven;
    //Update TotalInven
    TotalInven := 1000;
    ///return the NewTotal value
    NewTotal;
}

You'll probably have to debug this a bit, but it should be close to what you want.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Hala
Newbie
Newbie
Avatar

Joined: 14 Feb 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Hala Replybullet Posted: 14 Feb 2008 at 6:45pm
Thank you for your reply!
 
So if my quantity on hand formula is {inv.onhand} for the product group and the quantity purchased per po is {pu.qty}.  How do I plug this into your previous reply?  Sorry if this is obvious but it is not to me!
IP IP Logged
Hala
Newbie
Newbie
Avatar

Joined: 14 Feb 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Hala Replybullet Posted: 15 Feb 2008 at 12:22pm

I added your formula, but it highlights the IF statement "The remaining text does not appear as part of the formula" upon saving the formula!

Do you know why it does not want to save it?  We are on the right track and thank you for that!
IP IP Logged
Savan
Senior Member
Senior Member
Avatar

Joined: 14 Dec 2007
Location: India
Online Status: Offline
Posts: 162
Quote Savan Replybullet Posted: 16 Feb 2008 at 3:11am
try using () instead of {} brackets
Thanks
Savan
IP IP Logged
Hala
Newbie
Newbie
Avatar

Joined: 14 Feb 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Hala Replybullet Posted: 18 Feb 2008 at 6:35am
I did replace { with (
Still not working at the IF statement!


Edited by Hala - 18 Feb 2008 at 6:36am
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