Page 1 of 1

Database help

Posted: Wed Aug 24, 2005 6:15 am
by chidolifetime
hi there,
I got some prob here hope you can help out.
Need to create a simple stock management program. Done all great but accounter 2 probs.

1
need to find an easy way to do some calculations like additonning amount in a column. like after having the amount by multiplying QTY*Unitprice in a column called Amount, I want to add all the amount in the column to have the total amount Per order or per invoice for example. Hope you have easy way of doing this.

2
I want to print out. But I can not get a good looking printout eventhough it look great on the computer screen.

Or is there an easy way of exporting the table in excel where i can carry out necessary calculation and print out?

Will appreciate your help.

Posted: Wed Aug 24, 2005 7:35 am
by feyd
  1. typically done like so:

    Code: Select all

    SELECT SUM(QTY*Amount) FROM `table` WHERE `condition` = 'foo'
  2. generating a PDF can be a good solution, setting up the screen to work properly with printing it directly can also work. You could export the information as a CSV as well (there has been talk about this a LOT here, look through the Code Snippets board. I blieve one is in there..)