全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:929
推到 Plurk!
推到 Facebook!

To Justmade Plz Help Me... :( Urgent

尚未結案
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-06 23:28:06 IP:217.36.xxx.xxx 未訂閱
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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-07 08:08:11 IP:211.74.xxx.xxx 未訂閱
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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-07 08:22:10 IP:218.16.xxx.xxx 未訂閱
引言: 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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-07 08:31:31 IP:217.36.xxx.xxx 未訂閱
u mentioned using array before, do I not need to use that in this case?
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-04-07 08:43:12 IP:217.36.xxx.xxx 未訂閱
My original design was searching the Menu Dbase using SQL.Command with edit.text, then copy the information to the temp order table. now, I try to use array, will the method be totally different?
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-04-07 08:58:13 IP:217.36.xxx.xxx 未訂閱
Also, referring to your design. Do u directly input the item into the detail and history table? This is the bit I am unsure of. Cux I am little unsure of when or where to execute the sql.command
Mickey
版主


發表:77
回覆:1882
積分:1390
註冊:2002-12-11

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-04-07 09:52:38 IP:61.219.xxx.xxx 未訂閱
Dear Vashee : 這是一個討論網站, 請發表時僅針對問題描述, 切勿指名要誰回答.  < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=7540183&CC=168637"> 資料庫種類繁多, 記得先說用啥資料庫喔
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-04-07 10:01:43 IP:217.36.xxx.xxx 未訂閱
Oh, sorry about that. but it is just the post is follow up some solution for me came up by Justmade. I won't do it again
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-04-07 10:33:43 IP:218.16.xxx.xxx 未訂閱
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

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-04-07 15:35:05 IP:217.36.xxx.xxx 未訂閱
No, it is true. but I just ask for a 3 days extensive for this. and I still can't finish it. :(
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-04-07 17:55:43 IP:195.195.xxx.xxx 未訂閱
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

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-04-07 19:26:37 IP:218.16.xxx.xxx 未訂閱
Have you study the MastApp Demo ? It is in C:\Program Files\Borland\DelphiX\Demos\Db\MastApp It give you good demo of how delphi work with database.
系統時間:2024-06-26 23:09:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!