How can we add Customer with Head Office & Branches

How can we add Customer with Head Office & Branches

Customers in some industries place orders locally (i.e. via their branches), but pay invoices centrally (from head office)

Example: Hyper Markets with multiple branches but pay invoices by head office.

Current Solution:
Currently we are managing this by creating headoffice as a customer and adding multiple shipping address as branch. In this case the payment reconciliation is very difficult and to provide branch wise receivable and statement of account is also another challenge.

How SAP handle this problem: By represent this as business relationship with head office and branch accounts (Documentation: Head Office and Branch concept demostrated for both Vendors & Customers | SAP Blogs) (Video: Head Office & Branch Office Concept SAP FICO call @ 7416797921 for more details - YouTube)

We created a custom app (GitHub - m20zero/multi_branch) with similar features mentioned in SAP documentation by adding branch and head office field in customer doctype and in invoice by creating script to auto create GL entries related to it but we are not sure what all GL entries are needed in this case.

Requesting for ideas and suggestions to complete this requirement.

Thanks in-advance