0

Multiple invoices for the same item

Hello All,

This is my first post. The forum as been helpful and great to follow. I’m at loss for this scenario and would appreciate some help. 

Is it possible by formula to generate multiple invoices at the same time?

One customer has 10 pets. 

Each pet will have its own invoice with the same item(s) as the other pets. Typically that is 2-3 items for each pet.

A few of the pets are owned by more than one person. The ownership is not equal. Examples are 60/40%, 72/25 and 50/50.

I’m assuming the invoices with the mixed % will be a separate process from those owned 100% by the customer.

We do have a customer, invoice, pet and item table. 

Sam

6 replies

null
    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Sam

    Your list of tables is a good start but  you need a few more to complete the picture.

    Because a customer can own more than one pet, and a pet can be owned by more than one customer you need a join table, call it Owner, to allow this many to many relationship.

    Similarly, you also need a join table to allow you invoices to have more than one item, call it Line.

    I would have a table, called Batch, to hold a list of pets and the items their owners are going to be invoiced with. The data model then looks like this

     

    Once you have set up your customers and pets, and the share of ownership in the Owner table you would start the invoicing process from Batch. Add a list of pets who's owners are going to be invoiced. Add the invoice lines in BatchLine. Add a button that then loops through all the owners creating an invoice for each one.

    let a := this;
    for b in BatchPet.Pet.Owner do
        let c := (create Invoice);
        c.(Customer := b.Customer);
        for d in a.BatchLine do
            (create Line).(
                Invoice := c;
                Item := d.Item
            )
        end
    end
    

    You may want to track which pet the invoice relates to, and you may want just one invoice per customer for all their pets, not one per customer per pet.

    If you want this fleshed out a bit more, let me know.

    Regards John

      • Sam.1
      • 2 yrs ago
      • Reported - view

      John Halls 

      • Sam.1
      • 2 yrs ago
      • Reported - view

      Sam thanks John! I’ll set it up and give an update.

      sam

      • Sam.1
      • 2 yrs ago
      • Reported - view

      Dan James (Ninox Partner) Sam thanks John! I’ll set it up and give an update.

    • Danjamesmedia
    • 2 yrs ago
    • Reported - view

    Hey  Sam ,

    Here's a complete demo that does everything you need to!

      • Sam.1
      • 2 yrs ago
      • Reported - view

      Dan James (Ninox Partner) the file looks great. I’ll review and get back to you.

      Sam

Content aside

  • 2 yrs agoLast active
  • 6Replies
  • 658Views
  • 3 Following