To Justmade Plz Help Me... :( Urgent |
尚未結案
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
Referring
--------------------------------------------------
--SQL : select OrderNumber, OrderTime, DishID, DishName, Description, Price, Quantity, (Price * Quantity) as SubTotal from
Detail D, History H, Food F where D.OrderNumber = H.OrderNumber
and D.FoodID = F.FoodID
and OrderNumber = :OrderNumber qDeleteDetail : ADOQuery
--SQL : Delete from Detail where OrderNumber = :OrderNumber When Order :
1. create an order number, with time auto inserted to tHist
2. User Input / Select Dish ID and Quantity, which is inserted into tDetail together with the Order Number
3. repeat 2 until all orders is inputed
4. If User press confirm and print button , open the qOrder query and print using those data:
qOrder.Parameters[0].Value := tHist.FieldByName('OrderNumber').Value;
qOrder.Active := true;
5. if User press cancel then execute qDeleteDetail to delete all items in the order then delete the order record.
qDeleteDetail.Parameters[0].Value := tHist.FieldByName('OrderNumber').Value;
qDeleteDetail.ExecSQL;
tHist.Delete; You can print any order later in any time using the qOrder query, what you have to do is to supply the order number.
For example, you can place a edit1 in form and when click print button :
qOrder.Parameters[0].Value := Edit1.Text; (if order number is number, you may need to change to string to integer)
qOrder.Active := true; To get Order totals you can use SQL
select OrderNumber, Sum(Price * Quantity) as OrderTotal
from Detail D, Food F
where D.FoodID = F.FoodID
group by OrderNumber
----------------------------------------------------------- How should I list the item during the the ordering?
Can u explain a bit more about what u did in the SQL Statement? thanx
|
chih
版主 發表:48 回覆:1186 積分:639 註冊:2002-04-02 發送簡訊給我 |
Print.SQL......
qOrder.Close; qOrder.SQL.Clear; qOrder.SQL.Add(' select OrderNumber, OrderTime, DishID, DishName, Description, Price, Quantity, (Price * Quantity) as SubTotal from Detail D, History H, Food F ' ' where D.OrderNumber = H.OrderNumber ' ' and D.FoodID = F.FoodID ' ' and OrderNumber = ' #39 Edit1.text #39) qOrder.Open;TRY TRY SEE 引言: You can print any order later in any time using the qOrder query, what you have to do is to supply the order number. For example, you can place a edit1 in form and when click print button : qOrder.Parameters[0].Value := Edit1.Text; (if order number is number, you may need to change to string to integer) qOrder.Active := true; |
Justmade
版主 發表:94 回覆:1934 積分:2030 註冊:2003-03-12 發送簡訊給我 |
引言: How should I list the item during the the ordering?the SQL and action of showing the data is same as Printing the data : qOrder.Parameters[0].Value := tHist.FieldByName('OrderNumber').Value; // submit the OrderNumber qOrder.Active := true; link qOrder to a dbGrid and you will see all items IN that specific order 引言: Can u explain a bit more about what u did in the SQL Statement?Simply put, I just join serveral table to get all relavant data I want, including doing some simple calculaton. Of casue the statement is based on my version of table design. You might have to modify it to suit for your situation. For more detail, It involve serveral chapters of a typical SQL book. |
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
|
Mickey
版主 發表:77 回覆:1882 積分:1390 註冊:2002-12-11 發送簡訊給我 |
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
|
Justmade
版主 發表:94 回覆:1934 積分:2030 註冊:2003-03-12 發送簡訊給我 |
Array :
Very different. It is fast and resources saving but you cant use DBControl (becasue it is not db) and you need manual printing flow control in Reporting. As I told you many time, you WONT having enough time for it. Your approach :
Add items : Add to temp table
Confirm : Copy to Hist / Detail table and Delete from temp table
Cancel : Delete from temp table My suggested approach :
Add items : Add to Hist/Detail table
Confirm : NIL
Cancel : Delete from Hist/Detail table As I mentioned both version work so you better stick to your own design. In your post in 2003/04/02 : 18:11:56 (Server Time - GMT -8), you mentioned this program need to be done by 2 days. If this is just the trick to get help faster, you might have got it for that time but this just discourage other from further helping you. http://delphi.ktop.com.tw/topic.php?TOPIC_ID=27961
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
|
Vashee
初階會員 發表:38 回覆:87 積分:25 註冊:2003-03-31 發送簡訊給我 |
I got another situation: Say there are some items listed in my temp table:
Item: 001 Quantity 5
Item:002 Quantity 2
Item:012 Quantity 1 Say the 001 Item Quantity was a input error, and I need to relocal this item and correct the quant.
what is the delphi syntax to local a record within a table with the use of Tedit.
The suggested idea is if I type 001 into the Input Itemcode field, it will automatically search through if there is existing item in that table, if not, add the item to the table.. so on..
|
Justmade
版主 發表:94 回覆:1934 積分:2030 註冊:2003-03-12 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |