I am updating an existing app. by replacing hard code with SQL queries. Most of the change over has been completed but I have hit a problem with a weekly sales summary.
I have a form which displays a breakdown of the weekly sales figures into sections.
The columns are
Date, Products (type 1), Products(type 2), Products(type 3), Paid In, Paid Out, Refunds.
I assume the simplest way to achieve this would be to use a grid, each column being populated from the results of its own query ie.
This is just a test query to get some useful data.
The problem I have, is that there are days when no transactions take place, Sundays and Bank Holidays, therefore no record is created for that day.
I could fill in the missing days by hard coding but wondered if it was possible to force the query to create a blank record on the missing days, giving me 7 records per query.
Keith
I have a form which displays a breakdown of the weekly sales figures into sections.
The columns are
Date, Products (type 1), Products(type 2), Products(type 3), Paid In, Paid Out, Refunds.
I assume the simplest way to achieve this would be to use a grid, each column being populated from the results of its own query ie.
Code:
*!* Find start of week
sunday=date()-(dow(date())-1)
*!* Get items with alpha start followed by a digit
SELECT upper(left(cdow(date),3)),DATE,SUM(NVL(each*QTY, 000000000)) AS SALES from z:\d_day;
WHERE ISALPHA(LEFT(CODE,1)) AND ! ISALPHA(SUBSTR(CODE,2,1)) and date>=sunday and date<=sunday+7;
GROUP BY DATE;
into cursor sales
The problem I have, is that there are days when no transactions take place, Sundays and Bank Holidays, therefore no record is created for that day.
I could fill in the missing days by hard coding but wondered if it was possible to force the query to create a blank record on the missing days, giving me 7 records per query.
Keith