Scenario: Looking to receive an weekly email with the number of outstanding invoices, age, and dollar amount by Reviewer and Month. Modify SQL as needed if you need multi-company support, etc.
Example Solution:
- Open the VA Inquiries form
- Create a new Record by entering CTS_APUISummary in the Query Name Field
- Enter Unapproved Invoice Summary Query for Weekly Email in the Title Field
- Enter Unapproved Invoice Summary Query for Weekly Email created by CTS-Kevin Halme on 2022.08.19 in the Description Field
- Select SQL as Type
- Check/Uncheck Assignable in Work Center as desired (Note Vista bug that doesn’t default this field correctly)
- Enter SQL Query #1 (found at the bottom) in the Select field.
- Save and close the form.
- Open WF Notifier Job Manager
- Enter CTS_APUISummary in the Job Name & Description Fields.
- Set Query type to 1-VA Inquiry
- Select CTS_APUISummary as the query.
- Set the desired schedule
- On the email tab, enter the desired recipient, subject, and header.
- Change Format to 1-Rich Text
- In the Body field, you can insert table by click Table button and add all columns to the table, format table as desired.
- Check the Consolidate Notifications field at the bottom of the form.
- On the Consolidations Group tab, add [To] to the Grouping Criteria.
- On the Email tab, press Test Email button to test the notifier to make sure it functions as expected.
SQL Query #1
select DateName(month,APUI.UIMth) + ' ' + CAST(YEAR(APUI.UIMth) AS VARCHAR(4)) AS Month , HQRV.Name as Reviewer,count(DISTINCT (convert(varchar(20),APUI.UIMth,101)+cast(APUI.UISeq as varchar(8)))) as [# Invoices]
,FORMAT(sum(isnull(APUL.GrossAmt,0)+isnull(TaxAmt,0)),'C') as Amount,CAST(AVG(CAST(DATEDIFF(dd,Cast(APUR.DateAssigned as Date),GETDATE()) as decimal(5,1))) as decimal(5,1)) as [Average Days]
FROM APUI
INNER JOIN APUL ON APUI.APCo=APUL.APCo AND APUI.UIMth=APUL.UIMth AND APUI.UISeq=APUL.UISeq
INNER JOIN APUR ON APUL.APCo=APUR.APCo AND APUL.Line=APUR.Line AND APUL.UIMth=APUR.UIMth AND APUL.UISeq=APUR.UISeq
LEFT OUTER JOIN HQRV ON APUR.Reviewer=HQRV.Reviewer
WHERE APUI.APCo=1 AND HQRV.Reviewer <> 'AP'
AND APUR.ApprvdYN<>'Y' AND APUR.Line<>-1
GROUP BY APUI.UIMth, HQRV.Name
ORDER BY APUI.UIMth, HQRV.Name
Leave A Comment