lizzie Posted September 30, 2007 Posted September 30, 2007 Greetings I need to keep an eye on our sales team's weekly numbers. How can I generate a script that finds all invoices for last week (which would theoretically be every Monday to Sunday). Thanks!
LaRetta Posted September 30, 2007 Posted September 30, 2007 Set Error Capture [ On ] Enter Find Mode [ ] ... uncheck pause Set Field [ InvoiceDate ; Let ( start = Get ( CurrentDate ) - DayOfWeek ( Get ( CurrentDate ) ) - 5 ; start & ".." & start + 6 ) ] Perform Find [ ] If [ not Get ( FoundCount ) ] Show Custom Dialog [ OK ; "No records found" ] Show All Records End If
comment Posted September 30, 2007 Posted September 30, 2007 I would make the calculation = Let ( [ today = Get (CurrentDate) ; mon = today - DayOfWeek ( today - 1 ) - 6 ] ; mon & ".." & mon + 6 ) The difference comes to play on Sunday. If today is Sunday, it will still calculate the dates of LAST week, i.e. the week beginning on the Monday before last.
LaRetta Posted September 30, 2007 Posted September 30, 2007 (edited) I assumed monsta would want the week ending that day (if on Sunday). This was poor assumption because it is possible that the day's invoices have not yet been entered, ie, sales for the day will still happen for several hours! Your calc is clearer as well. :wink2: Edited September 30, 2007 by Guest
Recommended Posts
This topic is 6324 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now