Reputation: 1
I have a database table named ORDERS that contains repair order data and invoice data. Each record has an ORDERTYPE (i.e. INVOICE or REPAIR) and all invoice records have a system-generated ORDERID that links them to the repair orders (called the REFORDERID).
I have a second database table called ORDERLN that contains all individual line items for the repair orders and invoices. I need to access this data selectively to retrieve sales and cost information.
I need to limit my selected report data by the INVOICE DATE, which is contained in the ORDERS table. I have been trying to limit the report's record selection by DATE and INVOICE TYPE but that restricts me to only working with INVOICE data. I need sales data, which is on the invoice and I can get this easily, but I also need cost data which is only on the repair order, hence my need to query that data as well.
I need a way to first restrict the invoice close date, then pull in the invoice data AND pull in the repair order data. The link to the repair order data must be made via the REFORDERID records.
Can anyone guide me either with record selection formulas or SQL queries?
Thanks, John
Upvotes: 0
Views: 1998
Reputation: 9101
As per your requirement and explanation.. below is my approach...
ORDERS
and ORDERLN
tables in database expert.Start Date
, End Date
and one parameter for Invoice type
.If you are picking the invoice date form ORDERS
then
ORDERS.Invoice Date>={?Start Date} and ORDERS.Invoice Date<{?End Date} and
ORDERS.Invoice Type={?Invoice Type}
Above selection will pick the user required date and invoice type from database.
Upvotes: -1