Project Inquiries
Project Inquiry Custom Formulas [ New ]
Options
06-05-2015 01:59 PM - last edited on 11-04-2016 02:13 PM by JakeProsser Moderator
Custom Formulas
Project Inquiry: Get Last Invoice Number Used
SELECT TOP 1 ciInvoiceNumber
FROM
(SELECT TOP 1 igProject, ciInvoiceNumber, ciInvoiceDate FROM AxClientInvoice
LEFT JOIN AxInvoiceGroup ON igKey = ciInvoiceGroup WHERE igProject =
[Project Key] ORDER BY igProject, ciInvoiceDate DESC) SUB
Note: Only works with one invoice group
Phase Inquiry: Get Last Invoice Number Used
SELECT TOP 1 ciInvoiceNumber
FROM
(SELECT TOP 1 prjKey, ciInvoiceNumber, ciInvoiceDate FROM AxProject
LEFT JOIN AxClientInvoice ON ciInvoiceGroup = prjInvoiceGroup WHERE prjKey =
[Phase Key] ORDER BY prjKey, ciInvoiceDate DESC) SUB
Phase Inquiry: To add Project status (normally only displays phase status):
SELECT prjMainProjectStatusDescription FROM Project WHERE prjKey = [Project Key]
Project Inquiry: Get Last Invoice Date Used:
SELECT TOP 1 ciInvoiceDate
FROM
(SELECT TOP 1 igProject, ciInvoiceNumber, ciInvoiceDate FROM AxClientInvoice
LEFT JOIN AxInvoiceGroup ON igKey = ciInvoiceGroup WHERE igProject =
[Project Key] ORDER BY igProject, ciInvoiceDate DESC) SUB
Project Inquiry: Direct Expense and Consultant Combined with a Date Range
Note: Edit the formular to replace the date range.
SELECT SUM (tCostAmount) FROM CurrentTransactions WHERE
tActivityType IN (2,3)
AND tMainProject = [Project Key]
AND tstatus < 5
AND tDate BETWEEN '01-01-1900' AND '12-31-2078'
Project Inquiry: Add Client Type column
SELECT ctDescription FROM AxVEC JOIN AxClientType on vecClientType = ctKey WHERE veckey = [Client Key]
Project Inquiry: Add project created data
Select prjcreateddate from AxProject where prjkey = [Project Key]
Project Inquiry: Get Last Labor Transaction Created
select MAX(tdate) from AxTransaction
join AxProject on tproject = prjkey
where prjProject = [Project Key]
and tiscurrent = 1
and tactivitytype = 1
and ttype in (0, 2)
Project Inquiry: Amount invoiced
SELECT SUM(ciInvoiceAmount)
FROM ClientInvoice
WHERE prjProject = [Project Key]
Project Inquiry : Billing Contact Phone Number
SELECT cntPhone1 FROM axContact WHERE cntKey = [Billing Contact Key]
Project Inquiry : Billing Type
SELECT prjbillingtypedescription FROM project WHERE prjkey = [project key]
To Use these Custom Formulas
Copy the desired Formula into the definition of your Inquiry column.