Jump to content

Match Invoice Item with Product


chaos_29

Recommended Posts

Hello,

I am building a module for work. For this module I nee to match all invoice items from the table tblinvoiceitems to the corresponding product from the tabl tblproducts. I have tried many different things but can't get a link between them. 
I need this information, because my module adds a discount to the invoice depending on the group of the product. Is there another way to get these  informations?

Thanks for your help.

Link to comment
Share on other sites

3 hours ago, chaos_29 said:

I am building a module for work. For this module I nee to match all invoice items from the table tblinvoiceitems to the corresponding product from the tabl tblproducts. I have tried many different things but can't get a link between them. 
I need this information, because my module adds a discount to the invoice depending on the group of the product. Is there another way to get these  informations?

I think you've got two missing steps in the process...

  • in tblinvoiceitems, you've got a relid field... that matches the id field in either the tblhosting (product/services) or tbldomains (domains) tables - let's ignore domains for now as you don't seem to be interested in them.
  • using the id value in the tblhosting table, you get get the relevant packageid value... that value matches the id of the tblproducts database table and will allow you to identify the specific product.
  • using the id value in the tblproducts table, you can get the gid value for that product - that is the product group ID.
  • if you had to, you could use the gid value as the id value in tblproductgroups to get the product groupname... though it seems the ID will be sufficient for your needs.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated