MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Database of orders, items



"Brian T. Allen" <brian@purenetfx.com> writes:

> [1  <text/plain; iso-8859-1 (quoted-printable)>]
> Hi Everyone,
> 
> I would like to have a MySQL table of all the orders, with the unique ID being the order number.  It would contain information just about the order such as name, address, payment method, date, etc.
> 
> Then I would like a second table for items in the order.  It will have a column with the order number it is from, and the details of the item, price, etc.
> 
> How can I add these to a MySQL database from the receipt / report pages?  Would this best be done in the etc/report page?

from my receipt page (you may use the AUTO_INCREMENT feature of
mysql), it is for postgres SQL

[comment]Generate order identifier[/comment]
[perl arg=values interpolate=1]
$ary=[sql type=array]SELECT NEXTVAL('ordersid')[/sql];
$row = shift (@$ary);
$Safe{'values'}->{orderid} = $$row[0]; '';
[/perl]
[comment]Record order[/comment]
[sql type=set interpolate=1]insert into orders (id, orderedat, companyid) values ([value orderid], 'now', [value companyid])[/sql]
[item-list]
[sql type=list 
query="SELECT price FROM price WHERE minimum = (select max(minimum) from price where [item-quantity] >= minimum and componentid = [item-code]) and componentid = [item-code]"] 
[set price][sql-code][/set]
[/sql]
[sql type=set interpolate=1]insert into orderdetails (orderid, componentid, count, price) values ([value orderid],[item-code], [item-quantity], [scratch price])[/sql]

Ciao
        Racke

-- 
LinuXia - Solutions of Cool Competence - Internetprogramming and more
D-30163 Hannover, Waldstraße 4, 0511-3941290 (http://www.linuxia.net/)
Wir realisieren Onlineshops mit Minivend (http://www.minivend.com)
und MiniMate (http://www.linuxia.net/minimate/).



Search for: Match: Format: Sort by: