I'm looking for some inspiration to improve on an approach I've been using for an Invoice system.
Currently I have a Product folder. In this folder I have my Products and their per unit price. I have an empty field then that says “order amount” on this form. I also have a Purchase button that clones the selected Product and moves a copy of it into a Shopping Cart Folder.
So I go about selecting each item I want to sell and I press the Purchase button to have them added to the shopping cart folder.
Now I go to my Invoice folder and I create a new invoice. This form has a many to many field to which I will populate with the contents of the shopping cart. I then update the quantity of each item I wish to order on the many to many field which in turn populates the field I left blank above. On my Invoice form, there is a total. This is populated by the totals of each item on my many to many field.
I press print, and my Invoice Prints out. Once printed, the shopping cart contents are then archived into a "Purchased Archive" folder which is hidden from the end users.
This brings me back to the start where I can now create a new Invoice.
So my question is, can you think of anyway to completely avoid the need to have to use the Shopping Card folder, and avoid having to clone the original products.
I would for example like to simply create a new invoice and directly select the item I wish to sell from the Products folder.
Can you think of any direction I could take to accomplish this?
Found a solution I'm happy to go with.
I select the items I want to charge for, and they are added to an invisible shopping cart folder. Go to my Invoice folder, create a new invoice, and the the many to many field of the invoice auto detects the contents of the invisible shopping cart folder and auto populates the many to many field with the contents of the shopping cart.
When I print, or save my invoice, the shopping cart is archived and I can create another invoice and repeat the cycle. So I never see the shopping cart, and I never have to populate the many to many field on my invoice manually.
I've made many more improvements since posting that so here's the idea behind all this.
I have products folder with my products. The form contains all the information I need for my products, unit price and so on, but the “quantity” field is left empty and populated later after the item is added to our invoice.
Next, I have my Shopping Cart folder, and inside that folder I have another folder called Archive. Both are hidden folders, meaning than they are invisible when the application is compiled. To do this, right click on the folder you want to make invisible and select “Access Levels”. Then click on the Tab “Additional”. You should now see the option to hide the folder from the compiled application.
So back in my products folder, I select all the products I want to invoice my customer. I press a “Purchase” button that clones the selected records and moves the copy created to the Shopping Cart folder.
Now, we go to the Invoice folder and I press the button I created to “Create a new Invoice”. When this form is created, a script runs a query that checks the Shopping Cart folder for any content. Any content the query finds it will auto populate into the many to many field. After it populates the many to many field, an action script moves the contents of the query into the Archive folder. So my shopping cart is now empty, and all the items are displayed on my Invoice.
I can at this point enter the “quantity” value directly onto the many to many field for each of the items displayed.
The Invoice form also has other fields then like Invoice Total. This is a formula that is auto populated. It uses the SUM total of the many to many field to give me an Invoice Total price.
I also have other field on this form which are auto populated from my “Customers” folder. For example, by simply clicking on Name, my Customers folder opens in a popup windiws. I select the customer, and then many fields are auto populated on my Invoice form from the data pulled from my customers record.
Things like phone number, address and so on.
My Invoice also has a Invoice number that's randomly generated. This way my customer doesn't know how many invoices I've issued in my business. For example, a typical random number that it will generate is V-72-A-234-B
At this stage it's just a matter of outputting everything to report style.
I like a lot your ideas but for me I like to choose my item directly into my invoice. I did know that bdb automatically numbered lines from the last number ''id'' but I didn't no that was possible to automatically generate it from another format.. is this customizable from format output ??
I like a lot your ideas but for me I like to choose my item directly into my invoice
Sure, you can do that too and bypass the Shopping Cart but not the Archive folder.
The same code only bypassing the shopping cart will do. For example, you add your products to the many to many field. Each time you add a product the On Edit function of the Many to Many field will clone the product and move it to the shopping cart.
This way you bypass the shopping cart and have the selected products moved automatically straight to the Archive folder as you add them to your Many to Many.
I did know that bdb automatically numbered lines from the last number ''id'' but I didn't no that was possible to automatically generate it from another format.. is this customizable from format output ??
Yes, there is a Maths formula called RND which generates a random number. You can use the traditional Formatting options to format the numbers.
To add dynamic letters you have to create a User Function that generate a random number between 1 and 26. You can use that to then extract a letter from the alphabet.
To ensure that final Invoice number is unique, when the number is generated a query must be run to check if any other invoice has the same number. If one is detected, write a loop until a unique number is generated.
In time I will share my database. I need to clean up a lot of things as it does much more than I've described, and I would need to remove all my personal information and customers from. Soon as I have that done I'll share my database.