Create a formula column in your data model

31-8 Oracle Reports Users Guide to Building Reports end if; end;

7. Click Compile. If you see any errors, compare your code against the code we have

provided.

8. When your code successfully compiles, click Close.

Your new formula column, called SPELLED_AMOUNT, now displays in the data model. Figure 31–7 Data Model with SPELLED_AMOUNT formula column

9. Save your report.

31.4 Create a Query That Returns the Items in the Order

The steps in this section will show you how to manually create a query in the Data Model view that will return the items in the customers order. This data retrieved will be used to display the order details in the check stub. To manually create a query:

1. In the Data Model view, click the SQL Query tool in the tool palette, then click an

open area in the Data Model view to display the SQL Query Statement dialog box.

2. In the SQL Query Statement field, enter the following SELECT statement:

SELECT ALL ORDER_ITEMS.LINE_ITEM_ID, ORDER_ITEMS.ORDER_ID, Note: You can enter this code by copying and pasting it from the provided text file called spellcash_code.txt into the PLSQL Editor. Building a Check Printing Report with Spelled-Out Cash Amounts 31-9 ORDER_ITEMS.PRODUCT_ID, ORDER_ITEMS.UNIT_PRICE, ORDER_ITEMS.QUANTITY, PRODUCT_INFORMATION.PRODUCT_NAME FROM ORDER_ITEMS, PRODUCT_INFORMATION WHERE PRODUCT_INFORMATION.PRODUCT_ID=ORDER_ITEMS.PRODUCT_ID ORDER BY ORDER_ITEMS.LINE_ITEM_ID ASC

3. Click OK. Your query displays in the Data Model view, and should look

something like this: Figure 31–8 Data Model with two queries 4. In the Data Model view, click the Data Link tool in the tool palette.

5. In the first query, Q_1, under G_ORDER_ID, click ORDER_ID, then drag the line

to ORDER_ID1 in Q_2. 6. Your data model should now look like this: Note: You can enter this query in any of the following ways: ■ Copy and paste the code from the provided text file called spellcash_code.txt into the SQL Query Statement field. ■ Click Query Builder to build the query without entering any code manually. ■ Type the code in the SQL Query Statement field. 31-10 Oracle Reports Users Guide to Building Reports Figure 31–9 Data Link between two queries

7. Save your report.

31.5 Import a Check Image and Arrange Fields for Printing

The steps in this section will show you how to adjust the margins of your check printing report and align the fields with an image of a check. You can scan any check and use its image to lay out the objects of your check report. In this section, we use the image we have provided to you, called blankcheck.jpg. This image is located in the spellcash example folder.

31.5.1 Rearrange the layout objects

Before you can insert the check image, you must first rearrange the layout objects. To rearrange the layout objects: 1. Click the Paper Layout button in the toolbar to display the Paper Layout view. The layout currently looks like this: Figure 31–10 Paper Layout view of your report

2. Click the Edit Margin button in the toolbar.

3. In the Paper Layout view, click the margin frame the heavy black line to select it.

4. At the top of the frame, click the center black resizing square and drag it up, so

that the margin is 0.25 inches 0.5 centimeters. When you are done, it should look something like this: Tip: When you click the center square, notice that a dotted guideline displays while your mouse button is depressed. You can use these guidelines to help place objects exactly where you want them in the Paper Layout view.