Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Subreport Design Post Reply Post New Topic
Author Message
aeckaren
Newbie
Newbie
Avatar

Joined: 24 Jul 2012
Online Status: Offline
Posts: 26
Quote aeckaren Replybullet Topic: Subreport Design
    Posted: 20 Aug 2013 at 8:55am
I need ideas on the best way to approach an issue with inventory in a report.

My main report basically details open orders for our company, listing them by date, order number, and then line by line it lists each item on the order with quantities. Grouping is by date and then by order number.

Management wants to see inventory stock quantities for each item on the report listed beside the items on the order. I know the opening stock balance for each item. I need to take the opening balance and subtract the order quantities each time the item is ordered on the main report (basically a running total of the stock balance for each item).

The only answer I can come up with is to create a subreport sorted by ITEM instead of by order. When I sort by Item, I can then get a running total of each item which can then be subtracted from the opening balance to get the balance after each order quantity.  This works fine on the subreport, but I don't know how to pass that information to the main report...when I try, the quantities are resetting each time the order number changes.

Is there a better approach to this situation (rather than using a subreport)? I cannot change the sorting on the main report...it has to be sorted by date and by order number.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Aug 2013 at 10:27am
do they really want a row by row change or do they want to see a total for all based on all records in the report?
IP IP Logged
aeckaren
Newbie
Newbie
Avatar

Joined: 24 Jul 2012
Online Status: Offline
Posts: 26
Quote aeckaren Replybullet Posted: 20 Aug 2013 at 10:35am
They want to see a row by row change. By showing the stock being consumed by orders on a day-by-day basis, they can see on which day (in relation to customer orders) that the stock balance will go negative. This is very simple if I can sort by item number, but they want me to maintain the sorting of the original report (date and customer order #). I had the idea that I can use the report sorted by item number as a subreport, but it's not working as I expected. 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Aug 2013 at 10:47am
I think you will have to use a sub report if you cannot make a stored procedure to do the calculations outside the report.
I assume your data is set so you have a field that is a stock type another field with quantity ordered.
You could create a subreport that runs at the end of each grouping on day and does the calculations. Rather than using shared variables to try and pass amounts back and forth just make the sub report rerun for a wider date range each group.
link the sub report on the day but change the sub report select statment to use a date range.


Edited by DBlank - 20 Aug 2013 at 10:49am
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.