Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

currency variables to sum in a faux cross tab

Status
Not open for further replies.

lauriesamh

Technical User
Sep 1, 2004
119
US
I'm trying to sum charges for claims.

Each claim is assigned a type based on a formula (@ClaimType). I have accumulated the number of claims (thanks to Tek Tips earlier) via a count,accumulation and display (for a faux cross tab) formulas see below. How can I do this for charges where there is a field of total charges (currency field)per claim id?

@TypeCounter
If Maximum ({@ClaimType}, {Claims.ClaimID}) = "0" then 0 else
If Maximum ({@ClaimType}, {Claims.ClaimID}) = "1" then 1 else
If Maximum ({@ClaimType}, {Claims.ClaimID}) = "2" then 2 else
If Maximum ({@ClaimType}, {Claims.ClaimID}) = "3" then 3 else
If Maximum ({@ClaimType}, {Claims.ClaimID}) = "4" then 4

-----------------------------------
@Accum
whileprintingrecords;

numbervar x0;
numbervar x1;
numbervar x2;
numbervar x3;
numbervar x4;

if {@TypeCounter} = 0 then x0 := x0 + 1;
if {@TypeCounter} = 1 then x1 := x1 + 1;
if {@TypeCounter} = 2 then x2 := x2 + 1;
if {@TypeCounter} = 3 then x3 := x3 + 1;
if {@TypeCounter} = 4 then x4 := x4 + 1;

@DisplayOffice
whileprintingrecords;
numbervar x1;
replicatestring(" ", 8 - len(totext(x1))) + totext(x1,0,"") + chr(13)

 
Since you didn't share the claimtype formula, it's hard to say.

BTW, your @TypeCounter formula could be simplified to:

val(Maximum ({@ClaimType}, {Claims.ClaimID}))

I would probably use an array to handle all of this, akin to:

numbervar array MyCounts[5];
if val(Maximum ({@ClaimType}, {Claims.ClaimID})) in 0 to 4 then
MyCounts[val(Maximum ({@ClaimType}, {Claims.ClaimID}))-1] = MyCounts[val(Maximum ({@ClaimType}, {Claims.ClaimID}))-1]+1

Now to display each you would subtract one from the array value, as in:

MyCounts[1] would contain the count of claimid = 0

I don't understand the scope of your need very well, but hopefully this will allow you to simplify and add elegance.

Of course this is dependent upon the version of Crystal, which you should always post.

-k
 
Thanks for the comments, I'm still pretty new using CR V8.5.

I am trying to sum/accumulate the total of each claims' total charge based on the Claim type assigned below. I am going to place this in a faux crosstab unless it can be done in one.

I also have to sum these totals based on two time periods I have setup (pre care and post care). Though, if I can figure out how to get this running total to work then I can figure out how to break it by the two time periods.

The ClaimType formula is:

@ClaimType
if {Claims.ClmType} = "H" and ({HCFASrvLine.ProcCode} in ("99201" to "99205") or
{HCFASrvLine.ProcCode} in ("99211" to "99215") or
{HCFASrvLine.ProcCode} in ("99241" to "99245") or
{HCFASrvLine.ProcCode} in ("99381" to "99387") or
{HCFASrvLine.ProcCode} in ("99391" to "99397") or
{HCFASrvLine.ProcCode} in ("99401" to "99404") or
{HCFASrvLine.ProcCode} in ("99411" to "99412") or
{HCFASrvLine.ProcCode} in ("99420" to "99429") or
{HCFASrvLine.ProcCode} in ("99431" to "99440"))
Then "1" else

If {Claims.ClmType} = "H" and {HCFASrvLine.ProcCode} in ("99281" to "99288")
Then "2" else

If {Claims.ClmType} = "H" and not ({HCFASrvLine.ProcCode} in ("99281" to "99228"))
Then "0" else

If {Claims.ClmType} = "U" and (({UBSrvLine.RevCode} startswith "11")
or ({UBSrvLine.RevCode} startswith "12") or ({UBSrvLine.RevCode} startswith "18"))
Then "4" else


If {Claims.ClmType} = "U" and (({UBSrvLine.RevCode} startswith "13")
or ({UBSrvLine.RevCode} startswith "14"))
Then "3" else


If {Claims.ClmType} = "U" and (({UBSrvLine.RevCode} startswith "45")
or ({UBSrvLine.RevCode} startswith "46") )
Then "2"

else

If {Claims.ClmType} = "U" and (not ({UBSrvLine.RevCode} startswith "45")
or ({UBSrvLine.RevCode} startswith "46") or ({UBSrvLine.RevCode} startswith "13")
or ({UBSrvLine.RevCode} startswith "14")or ({UBSrvLine.RevCode} startswith "11")
or ({UBSrvLine.RevCode} startswith "12") or ({UBSrvLine.RevCode} startswith "18"))
Then "0"


//OFFICE = 1
//Other = 0
//ER = 2
//OP on UB = 3
//IP = 4


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top