New topic: 

Report with data from several tables and fields on a window

<http://forums.realsoftware.com/viewtopic.php?t=46524>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        rhartz          Post subject: Report with data from several 
tables and fields on a windowPosted: Fri Jan 11, 2013 2:22 pm                   
      
Joined: Mon Feb 20, 2012 3:16 pm
Posts: 81                Hi.  I'm trying to use the RS Reports to generate a 
receipt for a customer's order that will be pulling data from the customers 
table (cust name and address), orderheaders table (order date, order number, 
order total, etc), and possibly orders table (item number, price, quantity).  

I could probably figure out the SQL statement for the most part to gather each 
of the items I need to fill the report, however, I'd like to use some fields 
from the vieweditorder screen (discount amount, sales tax amount, and possibly 
other fields).  For example, I save the sales tax as a percent in the 
orderheaders table, but on the vieweditorder screen, I have a field where it is 
expressed as the amount of sales tax in $x.xx, which is what I would rather 
have added to the receipt report.

Additionally, on the vieweditorder screen, I have a listbox for the specific 
order which includes item #, item name, quantity, price, and line total.  
Problem is, item name comes from yet another table, products, and line total is 
a calculated field in the listbox and not saved to any table.  If I can get the 
data from this listbox, I can get away from including the orders table in the 
SQL statement.

So what I want to know is if it is possible to include specific fields and all 
lines in a listbox from a screen and include them in a report plus pulling data 
from the 2 tables.  And how can this be done?

Here is the coding which should load the reportviewer, but where do you include 
fields and listbox items from a screen?
Dim ps As New PrinterSetup
dim sql as string
dim rpt as Report

if rpt <> nil then rpt.close

sql = "SELECT ???????"  'work in progress

rpt = new ResultsReport

// Now we select the records from the database and add them to the list.
dim rs as recordSet
rs = db.SQLSelect(sql)

if rs = nil then
  beep
  MsgBox "No records found to print."
else
  dim rsq as new Reports.RecordSetQuery(rs)
  
  If rpt.Run( rsq, ps ) Then
  If rpt.Document <> Nil Then ReportViewer1.SetDocument( rpt.Document )
  End If
end if
   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to