I am developing kiosk canteen billing software which enables the billing of items at the canteen.
I have two tables in the database, one with menu and other with users.
The items are displayed on panels which are created dynamically according to the record count. When the user clicks a panel the item needs to be added to the dbgrid.
Finally, the bill has to be saved according to the 'userid' into a table.
In brief; I wanted the item with its price to be displayed on the dbgrid when user clicks the panel. Also I want the bill to be saved into a table using a save button in the design.
The following tables I have;
1.) dbo.Menu with columns Menu_index,Item_Name,Item_Price.
2.) dbo.Users with columns UserId,UserName,UsrPwd,Status.
3.) dbo.Tran_details with columns Menu_index,Menu_id,Item_price.
4.) dbo.Tran_header with columns Menu_index,Date,UserID.
The coding I did is something like this (below) but I am stuck at this point. Any methodology or an example coding would be appreciated.
Thanks in advance.
procedure TfrmMenu.FormCreate(Sender: TObject);
begin
with DMCanteen do
begin
QryMenu.Close;
QryMenu.SQL.Clear;
QryMenu.SQL.Add('select Menu_Index,Item_Name,Item_Price from MENU');
QryMenu.Open;
SetLength(arrmenu, QryMenu.recordCount);
SetLength(arrmenuid, QryMenu.recordCount);
SetLength(arritemprice, QryMenu.recordCount);
i := 0;
QryMenu.First;
while not QryMenu.Eof do
begin
arrmenu[i] := QryMenu.FieldByName('Item_Name').AsString;
arrmenuid[i] := QryMenu.FieldByName('Menu_Index').AsInteger;
arritemprice[i] := QryMenu.FieldByName('Item_Price').AsString;
QryMenu.Next;
inc(i);
end;
showmessage(Inttostr(QryMenu.recordcount));
CreateButtons(QryMenu.recordcount, 5, Panel1);
end;
end;