Net Zero?

 

Home
Up
OE Scripts
Net Zero?

 

After you're done with debugging the Order Entry window you'll want to make sure your details always "net zero".  Here's a GUI way to do it.  Notice that the last line of the report shows a net zero which is what we want to see.

AllDetailsRpt.png (26142 bytes)

 

Make a DataWindow, tabular style, that selects from all details, sorts by date & detail id, and has columns to show what the details were for.   This DataWindow joins detail, orders, and gs tables.  Joining to the entity table and adding the details' orders' entitys' names would be even better.  Here is the SQL/Data view for the DataWindow:  

AllDetailsSQLpng.png (25045 bytes)

The GUI view for the DataWindow shows how the report uses the header, detail, and summary 'bands'.  The Header band holds all the label objects that are repeated at the top of each printed page.  The Detail band holds the column objects & repeats every row returned from the query.  The Summary band holds a summation object created by highlighting the computed field 'qty * each' and choosing the big Sigma sign at the lower left corner of the toolbox. 

AllDetailsGUI.png (35643 bytes)

If constructed properly, your DataWindow should show the sum of the extensions of all your details in the Preview pane, like this screenshot does.  And, they should net zero.

When it works, save it and give it it's name.

 

Make a Window large enough to hold your report and an Exit button. Add a DataWindow Control (here named dwc_1) & use the DataWindow above as the DataObject for it. 

Place the following script in the Window's opening event to retrieve the data for the report.  Change the names in the script's SetTransObject and Retrieve methods to match your dwc's name.

CONNECT USING SQLCA;

if SQLCA.SQLCODE <> 0 then
    MessageBox("SQLCODE ->" + STRING(SQLCA.SQLCODE) + "<-",SQLCA.SQLERRTEXT)
    halt
end if

dwc_1.SetTransObject(SQLCA)
dwc_1.Retrieve()

DISCONNECT;

 

Add a button to open this new window to your main, or other, panel.  Use it to make sure your details net zero as you post orders to the system.

 

Here's a script that won't show each detail, but it will display the net of all details' extensions:

decimal Net

CONNECT USING SQLCA;
if SQLCA.SQLCODE <> 0 and SQLCA.SQLCODE <> -1 then
  MessageBox("SQLCODE ->" + STRING(SQLCA.SQLCODE) + "<-",SQLCA.SQLERRTEXT)
  halt
end if

DECLARE NetCursor CURSOR FOR
SELECT sum("qty" * "each") FROM "details";

OPEN NetCursor;

FETCH NetCursor INTO :Net;

if SQLCA.SQLCode <> 0 then
  messagebox("No Details","Error returned was " + SQLCA.SQLErrText)
else
  messagebox("Sum of all details' extensions:", string(Net,"#0.00"))
end if

DISCONNECT;

 

 

 

Back ] Home ] Up ]
Last modified: Wednesday June 27, 2001.