Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Evaluate Amount for Manual Running Tots Post Reply Post New Topic
Author Message
kimmer
Newbie
Newbie


Joined: 05 Nov 2010
Location: United States
Online Status: Offline
Posts: 3
Quote kimmer Replybullet Topic: Evaluate Amount for Manual Running Tots
     Posted: 05 Nov 2010 at 7:55am
Hi,

I'm really struggling here... (I'm new to Crystal, but have a DB2/SQL programming background, not that it's helping right now! ;o) In my report I have been using Crystal's running totals, within the 4 groups in my report. However, I have a sales tax amount that needs to go into either a "rent sales tax total" or a "property tax sales tax total". The tran code for sales tax is the same regardless of which invoice it is applied to: rent vs. property tax. The only way to tell where the sales tax goes is by the other line item(s) on the invoice (rent and property tax would never by on the same invoice.)

So, I sorted the invoice line items so that the sales tax is last within the invoice. This way I can see if rent or property tax is present on the invoice. (I did use a Crystal running total within the invoice to accum Sales Tax.)

Then I checked to see if Crystal's property tax running total for the invoice is > 0. If so, I then "tried" to add Crystal's running invoice sales tax total to my manual running total PropSTAX. Otherwise, I knew the sales tax was tied to a rent; so I "tried" to add Cyrstal's running invoice sales tax total to my manual running total STAX.

I had to also accumulate these two STAX and PropSTAX manual running totals for 3 other higher groupings.

When testing, I can see there is a Crystal running total for invoice Sales Tax. However, my accumulating function (which is placed in the footer of the inner most grouping "Invoice Number")shows my manual running totals for STAX & PropSTAX zero for all groupings.

I even tried summing these fields at the detail level to see if the accumulating function didn't work at the group footer level.

Keep in mind I am dependent upon checking Crystal's running total of Property Tax to determine which manual running total I need to place the sales tax into (either STAX or PropTAX). Any suggestions would be greatly appreciated...   
kimmer
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Nov 2010 at 4:04am
can't totally visualize this but here is an idea.
group on invoice number
create flag formulas for each invoice to determine the type (rent or property tax)
don't know your fields so this is a guess...
if table.lineitem='Rent' then 1 else 0
SUM this at the invoice number group level. This means if the SUM of that is >0 then this is a Rent invoice.
you can now use that as a formula condition in your running totals
 


Edited by DBlank - 08 Nov 2010 at 4:05am
IP IP Logged
kimmer
Newbie
Newbie


Joined: 05 Nov 2010
Location: United States
Online Status: Offline
Posts: 3
Quote kimmer Replybullet Posted: 08 Nov 2010 at 3:40pm
Thanks for the suggestion. I already have invoice number as the inner most group. Here's my groupings:
- customer number (1)
.. - lease number (2)
.... - asset number (3)
...... - invoice number (4)
........   (detail)       

Inside of the invoice number group I have Crystal running totals for Rent, Property Tax and Sales Tax. I sorted the detail lines of the invoice so that the sales tax transaction would be last on the invoice, accumulating either Rent or Prop Tax first.

I also created two manual sales tax totals, one for rent and one for property tax. I programmed these two manual running totals to check the Crystal running totals to determine which manual running total to accumulate the Crystal Grp 4 running sales tax within.

IF Grp 4 Crystal Running Total for Rent > 0 THEN
   Grp 3 Manual Rent Sales Tax Total := Grp 3 Manual Rent
   Sales Tax Total + Grp 4 Crystal Running Sales Tax
ELSE
   Grp 3 Manual Prop Sales Tax Total := Grp 3 Manual
   Prop Sales Tax Total + Grp 4 Crystal Running Sales Tax
(syntax not exact, but you get the idea...)

When I tested my report, I could see there was an amount in the Crystal Grp 4 Running Total for Sales Tax. I put the above function into the Grp 4 Invoice footer.

However, the above function code did not work in having the Crystal running Sales Tax added into one of my two Grp 3 manual running totals (Rent Sales Tax or Property Sales Tax).

Here's an abbreviated data example

Asset   Inv #    Tran Code     Amt
A        1        RENT      $50.00
A        1        RENT      $50.00    
A        1        SLTAX       $5.00
A        1        SLTAX       $5.00   
A        2        PTAX      $75.00
A        2        SLTAX       $7.50
A        3        RENT      $25.00
A        3        SLTAX       $2.50

I'm hiding the footer from grp 4, as all amounts need to display at the asset (Grp 3) level in the footer line, which should look like this:

Asset     Rent     Sales Tax     Prop Tax     Sales Tax
A       $125.00     $12.50       $75.00        $7.50

Before going to this coding structure described above, I did try a Boolean indicator but that didn't work either... Wish I could just code this in Cobol with SQL. Showing my age here! ;o)

Any specific examples on how to program this would be greatly appreciated. Trying to avoid linking the invoice line detail table as an alias to split the sales tax amount, as I don't know how to make that work either...       

Thanks, Kimmer      

Edited by kimmer - 08 Nov 2010 at 3:42pm
kimmer
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Nov 2010 at 3:46am
again, try my process.
I will assume it has to be either rent or not
create a formula to flag your invoices...
Name=RentFlag
if table.trancode='RENT' then 1 else 0
SUm this at group level 4
Now in your running total you can use this as an item in your evalaute formula to include or exclude the taxes at any group level.
if you want it to count as rent
SUM(@rentflag,invoiceno)>0
if you want to count it as not rent
 


Edited by DBlank - 09 Nov 2010 at 3:49am
IP IP Logged
kimmer
Newbie
Newbie


Joined: 05 Nov 2010
Location: United States
Online Status: Offline
Posts: 3
Quote kimmer Replybullet Posted: 09 Nov 2010 at 9:55am
THANK YOU SO VERY MUCH!! This worked perfectly! I have been trying so many different options. I figured there had to be a way to do this without joining the table twice... Again, much appreciated!     [IMG]smileys/smiley10.gif" align="middle" />

Edited by kimmer - 09 Nov 2010 at 9:55am
kimmer
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