What is the best way to handle a client with multiple locations?

I run a commercial cleaning company. Some of my clients have multiple locations. For example: I have a pharmacy client with 21 different branches.

In the past, when I was manually creating invoice documents in MS Word, I had the Billing Address and then the Location Address for the branch where service was rendered. What’s the best way to accomplish the same thing in Invoice Ninja? (Initially I thought “Shipping Address” might be the solution, but it doesn’t look like I can have more than one per client.)

Thanks

Hi,

There are two options:

  • Create separate client records for each address, and optionally use groups to link them together.

  • Add the address field as a client contact custom field.

My invoice numbers are {$client_number}{$client_counter}. So the pharmacy client a specific number as a prefix for all of its invoices, as does each of my clients. I also need all of the pharmacy client’s invoices to have a shared counter. So I suspect Option 1 would not be possible because of these requirements. If I’m wrong and there is a way around it, please let me know.

As for Option 2: are you referring to Settings > Advanced > Custom Fields > Clients? There appears to only be 4 configurable Contact fields there - yet I need to accommodate 20 different addresses. Should I be looking elsewhere?

For option one you may be able to use the group counter.

You would create one custom contact field called address and then add 20 contacts to the client, one for each address.

Thanks - Option 2 worked for me.

Summarizing for anyone else that might have this need.

I created a Location Address field in Settings > Advanced > Custom Fields > Contact Field 1.
For any clients I have with multiple locations I either edited an existing contact or or added a new one. The contact details field will now have a Location Address field. Add as many addresses as needed.

When creating a new invoice there will be a checkbox in the upper left to select the applicable contact.

In your custom invoice template, add the $contact.custom1 variable where needed. I added it to the location-details div in the template body, below billing-details:

<div id="location-details">
                <p data-ref="location_address-label">Location Address:</p>
                <p data-ref="client_details-location-address">$contact.custom1</p>
</div>

I needed the City, State, and Zip on a separate line from the Street Address, so I added this script to the Footer section that splits the address at the first comma (this assumes you entered a Location Address in your contact info with a comma after the street address):

//Code generated with ChatGPT
<script>
    document.addEventListener('DOMContentLoaded', () => {
        const addressElement = document.querySelector('p[data-ref="client_details-location-address"]');
        if (addressElement) {
            const address = addressElement.textContent;
            const parts = address.split(','); // split the address at the comma
            if (parts.length > 1) {
                addressElement.innerHTML = parts[0] + '<br>' + parts.slice(1).join(',');
            }
        }
    });
</script>
1 Like

Glad to hear it’s working, thanks for sharing the solution!