Jump to content

calculate my monthly profit


hogava

Recommended Posts

I have about 100 product that my profit is a percentage of each product prices. This percentage is different for each product. Now I want to calculate my monthly profit by using the data of DB. But the ID of products is not mentioned in each invoice tables. (tblinvoices - tblinvoiceitems) 

I have just description in tblinvoiceitems that is not help to do this.

If i know each order or invoice is for which product, i can calculate my profit.

Please guide me regarding this issue.

Link to comment
Share on other sites

5 minutes ago, hogava said:

But the ID of products is not mentioned in each invoice tables. (tblinvoices - tblinvoiceitems) 

the information you want is in the tables - just not all in the same table. 😞

9 minutes ago, hogava said:

I have just description in tblinvoiceitems that is not help to do this.

If i know each order or invoice is for which product, i can calculate my profit.

  • tblinvoices -> this will tell you whether the invoice has been paid... for your needs, only those that are paid will matter.
  • tblinvoiceitems -> using the ID value from tblinvoices, this gives you two fields in tblinvoiceitems, 'type' & 'relid'... if these are products, the 'type' will be "Hosting" and the 'relid' value will be the ID value in tblhosting... note: if they're not products, then the relid will point to ID values in other tables, depending on the value on 'type'.
  • tblhosting -> with the hosting ID (relid) you got from tblinvoiceitems, you can then get the packageid value in tblhosting - that will be the ID value of the product in tblproducts.
  • tblproducts -> with the product ID, you will be able to get the name of the product and this, I assume, calculate your profit for that product.
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