Financial formulation in Crystal Reports - crystal-reports

I need help with creating a trial balance report for a specific tenure, from beginning of fiscal year to a selected period. I need this in Crystal Reports.
I am unable to formulate how can I get debit and credit amounts totalling from beginning of the fiscal year till the end of selected period (not YTD).
For example, I want to get a trial balance report till period 6 (June), I am able to get the balance at the end of period 6, but unable to formulate total credits and total debits for selected number of periods/months. Instead, it is either debit/credit amounts for June or it's for total debit/credits till date.
Can anyone help me please?

Create a formula that returns, for each record, it's dollar amount if it's within the target date range, otherwise, zero.
Sum that formula to get the total for that time period.

I'm a user of the DelmiaWorks/IQMS ERP solution as well. IQMS uses a stored procedure to populate a database table named "C_TRIAL_BALANCE_AS_OF". When you publish a report into IQMS, there is a field named "Execute Before Print" on the Edit Report Definition window that opens when edit a report. To run this stored procedure in conjunction with another report, you will want to choose "POP_C_TRIAL_BALANCE_AS_OF" in the drop-down box control for this field. This will ensure the procedure is run prior to the report so you have the account balances you need as of a specified date. When the report is executed, IQMS will present the user with a Date Picker for the As Of Date. Almost all of the data you need to do a Trial Balance report can be found on this calculated table. The only joins needed should be "V_GLYEAR_PERIODS", "V_GLACCT", and "EPLANT".
There is a built-in report that may do what you want already though. If you begin the Trial Balance module and then click "Reports" > "Print" to bring up the list of all reports, then look for one named "Trial Balance As Of". Even if this report is lacking some information you need, it will likely be much easier to edit this existing report than it would be to create one from scratch.
If you don't have this built-in report, you may be able to get a copy of the RPT file from their support department. As long as you have the Trial Balance module, you should have this report. Its a standard report that is included in every version of IQMS I've worked with. However, my experience is limited to the 15.3 and 2020 versions.

Related

Crystal reports - Can't filter on custom formula number field

Crystal reports don't let me use a custom count formula field to filter which transactions to show in a manager report.
I'm creating a Crystal report that team leaders are supposed to take out to see on how many occasions their employees have reported in sick. A record is only supposed to show if that person has reported in sick 6 or more times the last 12 months.
The report shows a record (a page) for each employee belonging to the managers organisational unit. Below the employee information is a subreport where I show the transactions from the salary/time system. Using select expert, I have filtered out the transactions that is supposed to show. I have then created a database field that count which day was 12 months back from today, and filtered so that only the transactions falling into this period shows.
My last problem is that I only want to show the record that has a minimum of 6 such transactions during the period. I created a formula field named #Antal ("amount" in Swedish) that simply counts the distinct number of dates in the "from"-date for the salary transactions I'm showing (since a change of law 2019-01-01 we needed to create a new transaction type, so some of the occasions after 2019 may have two transactions referring to one sick leave, thus I'm counting the first day of the period instead), DistinctCount ({P_LSTAT.P_SXXX06})
Now, the subreport has a new column with Antal (amount) that counts the amount of the desired salary transaction. I then try to use the selection formula to only show records where {#Antal} >= 6 but I get the following error:
This formula cannot be used because it must be evaluated later
Is there any other (better) way of doing this, or am I simply missing something?
For your selection based on {#Antal} >= 6 you need to use the group selection formula, not the record selection formula. Record selection is used to select records which meet the criteria before reading in the data. Group selection is used to filter out entire groups of records based on summarised values, after the records have been read in and the summaries calculated - which sounds like exactly what you need here.
The value of a Formula Field is out of scope when the Select Expert is evaluated.
There is no process for calculating the value of a Formula Field before it is printed within the section of the report it is placed. The Select Expert is evaluated prior to any section of the report being printed, so at this time all Formula Fields are effectively Nothing.

Create a warning prompt box that appears before parameters are set in Crystal Reports

I have created a Crystal Report for some of my users with a date range parameter set. The volume of information that the SQL command returns means that anything over a 7 day period in the date parameter slows the report to unusable speeds and subsequently locks the DB for all other users.
Does anyone know of a way to create a prompt in Crystal Reports that will appear before the parameter set? I.e. As soon as they select the report and click "Open", the first thing they see is a box saying "Please ensure a maximum 7 day date period". Then upon clicking "OK" or something of my choosing, they are presented with the parameter fields and can continue with the report.
If this cannot be done, is there a way to restrict the parameters so that when the users select the start date, they can only select a maximum of 7 days after.
The other option, if it is doable, is to have them select the start date and then it auto complete the end date with a date 7 days after the start date.
At the moment i have just added (Must be a 7 day period) to the parameter title but i dont feel this does a good enough job at advertising it and as soon as i publish it i know someone will want to get 4/5 years worth of data...our clinicians will be most unimpressed if they PAS system locks up during a busy clinic.
I have attached a screenshot of the kind of thing i am after. It is a little crude as it was done in paint but it gets the point across.
I have searched high and low for this solution so i am not sure it even exists, but am asking out of sheer desperation.
Thanks in advance,
Mike
If you use Crystal Report solely (not within a program like .Net app) you can select your latest proposition. Get start date and in your SQL command (View, Stored Procedure, ...) select items from startDate to startDate + 7 days.
Depending on your DBMS there are ways to add some value to date (like dateadd function in MSSQL).
So its done.

Crystal Reports 2013 - Running Total with Weekly Data

I'm a beginner with Crystal Reports. I'm using Crystal Reports 2013, and I've made a report with a structure like:
<Person>
<date>
<sale amount>
<sale amount>
<sale amount>
So I'm grouping by Person, and then by date. (And sorting by time). Now, Crystal Reports decided to also group my data by the week. That's perfectly okay by me. But how do I calculate the weekly total sales?
More specifically, I don't know "why/how" the report is automatically grouping by week.
So here's what I've tried: I created a running total field for the sale field. But:
If I set it to group on the date field, it groups daily. (Fair enough, except it's inconvenient)
If I set it to group on the person field, it keeps a running total of all sales through that week.
Here's the thing though: I'd like the report to group the data into weeks by default, and keep a weekly total. But I'd also like to include the option to group the data into months, and have the running total know that it should be a monthly running total. So far, I've only seen a way to keep a daily running total.
So, I guess specific my question is what group is Crystal Reports grouping by when it automatically groups by week? If this is the wrong question, any other advice to achieving my goal would be helpful, though.
Thanks!
Its your running total that's probably doing it.
Have you tried using the sales amount field straight away and then insert Summation of the field on the group footers? YOu may not need to use running totals.

Create a chart using the records of certain type grouped by month, with a moving balance

I am trying to create a chart (bar or line) in crystal from one table in my database (Sage CRM).
The records are as follows
CustomerId Date Invoice Amount
1234 3/4/2013 Cust Invoice 3322.00
1234 3/4/2013 Payment 2445.00
1234 4/5/2013 A/c transaction 322.00
1234 5/6/2013 interest 32.00
1234 6/6/2013 payment 643.00
So I would like to have a report that meets the following criteria
Only records for the last 12 months grouped in month
Only invoice types of payment, invoice and interest
A moving balance that calculates all the invoice amounts ie
(when displaying the information for July 2012, the moving balance will be the total of all invoices prior to this date.
Without this field I can create the chart no problem using select expert but I am not sure now what to do)
Should I use a cross tab? if so how will I do the selection to only show the invoices I want and the the date range I want?
After spending almost a week on this problem, with a lot of help from an expert I have finally got a solution.
In order to create a amount that is the sum of all records for a company, month and invoice type since the beginning of time, while only displaying records for the last year, I have created a SQL command
Select
//All of the fields for the report,
movingBalance.Amount
from myInvoiceTable as mit
<join to any other tables for the report>
left join (
select customerID, sum(amount) as Amount
from myInvoiceTable
where Record_Type in ('Payment', 'Invoice','Interest')
and Date < {?Report Start Date}
group by customerID) movingBalance
on mit.customerID = movingBalance.customerID
where mit.RecordType in ('Payment', 'Invoice','Interest')
and mit.Date >= {?Report Start Date}
and mit.Date <= {?Report End Date}
There are a couple of tricks to using commands:
For performance reasons you generally want to include ALL of the data for the report in a single command. Avoid joining multiple commands or joining one or more tables to a command.
Filter the data in the command, NOT in the Select Expert in the report.
Create any parameters in the Command Editor, not in the main report. Parameters created in the report won't work in the Command Editor.
This has done the trick.
Create Date Parameters in the report to filter out the records at the time of fetching now when you run the report you have left with the data you need.
Now you can manuplate the data inside report using formula fields.
Accoding to me writing stored procedures is a bit hectic task as you can manuplate the data inside the report. I don't have any intentions to disrespect anyone opinions but frankly its my opinion.
In that case Rachsherry I would recommend the following.
For criteria parts 1 & 2 I think instead of using stored procs, it may be easier for you to use a formula.
For invoices right click the invoice field, then "Format Field" in the common tab next to the Suppress option there is a formula button, enter the following...
IF {YourInvoiceField} IN ["Payment", "Invoice", "Interest] THEN FALSE ELSE TRUE
For your date requirement you need to use a selection formula... The code for that should look something like this
{YourDateHere} > DateAdd ("yyyy", -1, CurrentDate) AND {YourDateHere} < CurrentDate
The above code basically looks at dates between the day the report is run, and exactly a year before.
For your moving balance, you should be able to achive that with the guide here
Edit - An alternative to this is to use parameter fields (Which I don't personally like) it just means having to input the parameters every time the report is refreshed, they are self explanatory but you can find a guide here

Crystal Reports - Select Current YYMM

I'm trying to create a Crystal Report that reads data from an access table. I have a particular field in the access table called REPT_YYMM. This is basically a run data field, so each month when a program is run it populates the current year/month in the field before exporting to access, so there is a way to do month to month comparisons. For the report I'm working on I just want to display the data along with the current REPT_YYMM field when the data is refreshed on a monthly basis. Is there a way to do this in a formula. I'm not familiar enough with date type functions to know where to start.
Any guidance or suggestions are appreciated!
Your question isn't very clear but if i understood correct you just need to filter the data where field REPT_YYMM = YYMM.
Goto selection formulas, record and enter:
{table.REPT_YYMM} = cStr(currentdate,'yyMM');