Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I calculate a formula based on two or more fields, for example, subtotal=unit_price * quantity?

0
Posted

How can I calculate a formula based on two or more fields, for example, subtotal=unit_price * quantity?

0

Let’s assume your table is called “order_data”. In the folder containing the PHPMagic-generated files, look for a file named “order_data_view.php”. Open this file in a text editor. Now, on line 17 of that file, you will see the SQL query used to display the table view. It looks something like this (on a single line): $x->Query = “select item as ‘Item’, unit_price as ‘Unit price’, qty as ‘Quantity’ from order_data”; All you need to do is modify the query to something like this (on a single line): $x->Query = “select item as ‘Item’, unit_price as ‘Unit price’, qty as ‘Quantity’, unit_price * qty as ‘Subtotal’ from order_data”; Then save the changes and upload the file to your web server.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123