Skip to main content

Peliqan

Xero

Track accounts payable by due date

SQL query for Xero

Get accounts payable by due date.

SELECT a.AccountNumber, SUM(i.Amount – COALESCE(cn.Amount, 0) – COALESCE(p.Amount, 0)) AS AccountsPayable FROM Accounts a JOIN Invoices i ON a.AccountID = i.AccountID LEFT JOIN CreditNotes cn ON i.InvoiceID = cn.InvoiceID LEFT JOIN Payments p ON i.InvoiceID = p.InvoiceID WHERE i.DueDate < CURDATE() GROUP BY a.AccountNumber

Xero data model

Xero
Accounts

Xero
Contacts

Xero
Credit Notes

Xero
Invoices

Xero
Items

Xero
Journals

Xero
Manual Journals

Xero
Payments

Xero
Payment Services

Xero
Purchase Orders

Ready to get instant access to all your company data ?​

Connect 300+ sources, serve any BI tool, and give every AI agent one governed endpoint to read, and write back where the app supports it.