How much do your customers owe you? How about customers with payments long overdue? How much advance payments do you have in hand? For all these questions, the Customer Balance Report provides you with the answer. This week we'll see how to create a customer balance report based on your transactions over a specific period.
You can create this report over Zoho Books or Zoho Finance data.
To create a customer balance report, you need to follow the below steps.
Define the period for which you want to analyze the customer balance. The following query will set the period as from the beginning of the year till the current date.
SELECT
start_day(Year, current_date()) as 'From Date', current_date() as 'To Date'
|
Now you need to get the opening balance for each customer at the beginning of the period, and debits and credits during the period. The following query gets these details.
/*Opening Balance from Invoices*/
SELECT
"Customer ID",
"Total (BCY)" as 'Opening Balance',
0 as 'Debit',
0 as 'Credit'
FROM "Invoices"
JOIN "Period for Analysis" ON "Invoices"."Invoice Date" < "Period for Analysis"."From Date"
UNION ALL
SELECT
/*Opening Balance from Credit Notes*/ "Customer ID",
"Total (BCY)" * -1,
0,
0 FROM "Credit Notes"
JOIN "Period for Analysis" ON "Credit Notes"."Credit Note Date" < "Period for Analysis"."From Date"
WHERE
"Credit Notes"."Credit Note Date" < "Period for Analysis"."From Date"
UNION ALL
SELECT
/* Credit notes in Current period*/ "Customer ID",
0,
"Total (BCY)" * -1,
0
FROM "Credit Notes"
JOIN "Period for Analysis" ON "Credit Notes"."Credit Note Date" > "Period for Analysis"."From Date"
AND
"Credit Notes"."Credit Note Date" < "Period for Analysis"."To Date"
UNION ALL
SELECT
/*Opening Balance from Customer Payments*/ "Customer ID",
"Amount (BCY)" * -1 as "Opening",
0,
0
FROM "Customer Payments"
JOIN "Period for Analysis" ON "Customer Payments"."Payment Date" < "Period for Analysis"."From Date"
UNION ALL
SELECT
/*Invoices in the current period*/
"Customer ID",
0,
"Total (BCY)",
0
FROM "Invoices"
JOIN "Period for Analysis" ON "Invoices"."Invoice Date" > "Period for Analysis"."From Date"
AND
"Invoices"."Invoice Date" < "Period for Analysis"."To Date"
UNION ALL
SELECT
/*Customer Payments in the current period*/
"Customer ID",
0,
0,
"Amount (BCY)"
FROM "Customer Payments"
JOIN "Period for Analysis" ON "Customer Payments"."Payment Date" > "Period for Analysis"."From Date"
AND
"Customer Payments"."Payment Date" < "Period for Analysis"."To Date"
UNION ALL
SELECT
/*Opening Balance from Debit Notes*/
"Customer ID",
"Transaction Amount (BCY)",
0,
0
FROM "Accrual Transactions"
JOIN "Period for Analysis" ON "Accrual Transactions"."Transaction Date" < "Period for Analysis"."From Date"
WHERE
"Entity Type" in ( 'debit_note' )
UNION ALL
SELECT
/*debit Note in current period*/
"Customer ID",
0,
"Transaction Amount (BCY)",
0
FROM "Accrual Transactions"
JOIN "Period for Analysis" ON "Accrual Transactions"."Transaction Date" > "Period for Analysis"."From Date"
AND
"Accrual Transactions"."Transaction Date" < "Period for Analysis"."To Date"
WHERE
"Entity Type" in ( 'debit_note' )
UNION ALL
SELECT
/*Opening Balance for Customers*/ "Customer ID",
"Transaction Amount (BCY)",
0,
0
FROM "Accrual Transactions"
JOIN "Period for Analysis" ON "Accrual Transactions"."Transaction Date" <"Period for Analysis"."From Date"
WHERE
"Entity Type" in ( 'customer_ob_invoice' )
AND
"Accrual Transactions"."Debit or Credit" = 'debit'
UNION ALL
SELECT
/*Opening Balance for Customers*/
"Customer ID",
0,
"Transaction Amount (BCY)",
0
FROM "Accrual Transactions"
JOIN "Period for Analysis" ON "Accrual Transactions"."Transaction Date" > "Period for Analysis"."From Date"
AND
"Accrual Transactions"."Transaction Date" < "Period for Analysis"."To Date"
WHERE
"Entity Type" in ( 'customer_ob_invoice' )
AND
"Accrual Transactions"."Debit or Credit" = 'debit' |
Join the query table with your customer data to get the above details for each customer.
Create a new Pivot View and add columns as follows.
To complete the customer balance report, you need to find the Closing Balance. Create a Report Formula to get this. Click the formula icon and enter the below formula.
"1. Customer Balance.Opening Balance" + "2. Opening Balance.Debit" - "3. Opening Balance.Credit"
|
Report will be generated as follows. Apply the required theme.
The following is the final report.
Writer is a powerful online word processor, designed for collaborative work.