• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking to generate an invoice using product tables

#1
I have a project which was created in Procedural PHP that manages inventory for a local commercial nursery (plants).  The inventory app is updated by field workers during the day and manages the inventory levels for over 900 plants.

The customer is asking to integrate their sales process to allow the office to generate sales quotes and invoices that integrate to the current inventory to avoid "overbooking" product due to multiple sales.

I have been researching my options and have been told a framework is my best option to accomplish this requirement.  I have been reviewing CodeIgniter and the MVC architecture makes sense to me, however, I am still looking for the ability to create a master invoice with customer and delivery data (stored in the invoice table) and then link an invoiceDetails table which would contain the products, quantity and price (at the time of sale).

I would appreciate any suggestions as to tutorials or documentation that would as me in mastering this requirement.  I reviewed InvoicePlane and it has quite a bit of the functionality, but I am looking for a tighter integration of the Master/Detail forms for data entry. 

I have build this type of functionality in MS Access for a different client, but really need a web based solution due to the integration of the inventory counting for real-time updates.

Any suggestions would be greatly appreciated.
Reply

#2
Hi, It looks like you need up read up on how SQL relationships works. Here are one to get you started:
https://code.tutsplus.com/articles/sql-f...--net-8561

After you have mastered relationships you can dive into the starter tutorials in the documentation. But instead of making one insert, you will be making (maybe 3) at the same time. To get your database tables linked.
Reply

#3
(02-21-2020, 12:53 PM)jreklund Wrote: Hi, It looks like you need up read up on how SQL relationships works. Here are one to get you started:
https://code.tutsplus.com/articles/sql-f...--net-8561

After you have mastered relationships you can dive into the starter tutorials in the documentation. But instead of making one insert, you will be making (maybe 3) at the same time. To get your database tables linked.
Thanks for the input.  I really don’t have an issue with the database relationships as I have been working with databases for over 30 years.  My question is really about how to control the input from the users when they generate the invoice.  I want to constrain the selections to only products that are in stock (visible through a view from my inventory tables).  

Ideally, the interface for the product drop down would be populated with “in-stock” products, and upon selecting an item, the primary key would be used to retrieve the item price from a pricing table and place the description, key and price into a HTML form or table where the user would simply enter the quantity (verifying that the quantity is less than the available inventory units).

So basically, I want to have the user create the invoice by selecting a customer and then editing any changes to dates or delivery conditions.  Once the customer data is entered, the record (last_id) would be used to populate the details form.  

I am looking for tutorials or documentation about passing a “master” key to a child form and then adding in rows of detail.
I appreciate the help and I am very impressed with the community in this forum.
Reply

#4
I can see two approaches to this, either you make an e-shop like application that your users browse all products in stock and add them to a cart. And then "check out" the cart to a customer.

Or you will utilize a search function on your invoice page so users can search for the item (search automatically with ajax), but that would mean they know what they are looking for. And would be harder to find something you don't know the name of (as you can't browse the inventory).

The functionally you are searching for are JavaScript and AJAX depending, and you need to read up on that instead. :-)
Ajax for sending inputs (searching) and return available products. And how many are in stock.

After an item and quantity a user press "add" and it gets copied to an table with all items (with JavaScript).

https://code.tutsplus.com/tutorials/how-...-cms-32494
Reply

#5
(02-21-2020, 02:11 PM)jreklund Wrote: I can see two approaches to this, either you make an e-shop like application that your users browse all products in stock and add them to a cart. And then "check out" the cart to a customer.

Or you will utilize a search function on your invoice page so users can search for the item (search automatically with ajax), but that would mean they know what they are looking for. And would be harder to find something you don't know the name of (as you can't browse the inventory).

The functionally you are searching for are JavaScript and AJAX depending, and you need to read up on that instead. :-)
Ajax for sending inputs (searching) and return available products. And how many are in stock.

After an item and quantity a user press "add" and it gets copied to an table with all items (with JavaScript).

https://code.tutsplus.com/tutorials/how-...-cms-32494
Thanks, this is good advice and along the lines of what I was thinking. I have done this on other projects using Procedural PHP.  I was told that a framework would make this easier to accomplish, but I am not sure I can afford the time for the learning curve at this point if I will be using ajax and jquery primarily.  I appreciate your input, many thanks.
Reply

#6
A framework can only do so much, it provides helper classes and function and provide good structure (MVC). What you do with it are up to you. It's not a full featured application in any way, it helps you get to go the goal faster by providing for e.g. URI handling.

jQuery are JavaScript a framework/toolkit, the same can be done in pure JavaScript as well. It provide the tools for rapid coding, but you need to tell it what to do.

What CodeIgniter can help you with in this regard:
- Provide endpoints for your AJAX
- Output json with correct headers
- Connect to the database and make queries
- Validate your data
- etc...

https://codeigniter4.github.io/userguide...stful.html
https://codeigniter4.github.io/userguide...model.html
https://codeigniter4.github.io/userguide...ities.html
https://codeigniter4.github.io/userguide...ponse.html
https://codeigniter4.github.io/userguide...onses.html
Reply

#7
You can pass keys to forms using a hidden form field.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.