Introduction
This article describes configuring the favorites — the list of dishes, which can be addressed from the cash station. It is also possible to add dishes to or remove them from the list right at the cash station. When the Load favorites button is pressed, dishes are added to the current order.
An XML interface on the references server, available at the cash register, is required for the functionality to work.
Configuring Extended Property
- Create an extended property with a system name of xmladress.
- In the List of type field, select System > Restaurant.
- The name is XML interface address.
- The property type is ANSI string.
- Save the changes.
Configuring XML Interface
Create an XML interface on the references server.
- Go to Options > OLAP Reports > Reporting Servers.
- Select the required server and specify a free port in the XML interface section, which should be available on the cash station.
If the port is unavailable, it will work anyway, but it will be impossible to edit favorites at the cash register. - Save your changes and restart the references server.
- Make sure that the port is available and listened to in a convenient manner, f.ex. with the use of Telnet. If everything is OK, proceed to the next step.
Now, fill in the extended property.
- Go to Service > Stations and Devices.
- Select the required restaurant, and open the Properties.
- In the Extended properties, specify the IP address: port of the XML interface in the previously created XML interface address property. For example, 16.0.1:583.
- Save the changes.
Configuring Classification
- Go to Menu > Menu Classifications and create the Favorites classification.
- Under this classification, create the Favorites.
- Remember or write down the Code of the created category — specify it in the script bodies later.
- Save the changes.
Configuring Scripts
- Go to Service > Scripts.
- Select the Operations group and create the required scripts.
Create a script with the name Empty and fill it with the following text:
begin end;
- Select the Operations group and create 3 scripts; find the relevant texts below.
- Do not forget to specify the Favorites category code in the scripts instead of 4097, and Classifications code instead of 4096.
- Save the changes.
Load Favorites
Before inserting a script, specify the «Favorites» category code.
procedure ProcessOperation1007303(Parameter: integer); var zapros,resp, idents:string; dishes:TStringList; dishstart,dishend:boolean; i,k, step:integer; it:tcheckitem; begin if httppost('https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress,'saasd',resp)<>0 then begin gui.showmessage('References server at the following address: '+'https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress+' does not respond.'); exit; end; k:=gui.MessageDlgEx('To clear the current order and to load «Favorites» ?', mtInformation, mbYes+mbNo, 'Yes;No'); if k=6 then begin rk7.performoperation(rkoDishSelector,0); RK7.PerformOperation(rkoHome, 0); while step<= RKCheck.CurrentOrder.Sessions.LinesCount do begin it := RKCheck.CurrentCheckItem; if TObject(it) = Nil then break; if SYS.ObjectInheritsFrom(TObject(it), 'TPrintCheckItem') then break; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then begin RK7.PerformOperation(rkoDeleteLine, 0); continue; RK7.PerformOperation(rkoHome, 0); end; step := step + 1; RK7.PerformOperation(rkoDown, 0); end; dishes:=TStringList.Create; zapros:='<RK7Query><RK7CMD CMD="GetRefData" RefName="ClassificatorGroups" PropMask="RIChildItems.(code)" WithChildItems="2" RefItemIdent="4097"></RK7CMD></RK7Query>'; // instead of 4097, specify the code of your «Favorites» category dishes.Add(zapros); dishes.SaveToFile('.\test.xml'); dishes.free; GUI.CmdExecWithFlags('.\runxml.bat', SW_HIDE, false); dishes:=TStringList.Create; dishes.LoadFromFile('.\Restest.xml'); for i:= 0 to dishes.Count - 1 do begin if pos('</RIChildItems>', dishes.strings[i])<>0 then dishend:=true; if (dishstart=true) and (dishend<>true) then begin idents:=copy(dishes.strings[i],26, length(dishes.strings[i])-28); RKCheck.CreateCheckItem(rkrefMenuItems, idents, '1'); end; if pos('<RIChildItems>', dishes.strings[i])<>0 then dishstart:=true; end; dishes.free; gui.showmessage('"Favorites" loaded to the current order.'); end; end;
Record Favorites
procedure ProcessOperation1007306(Parameter: integer); var dishes:TStringList; idents,cats, cats1,zapros, resp:string; i,k:integer; dishstart,dishend:boolean; it:tcheckitem; begin if httppost('https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress,'saasd',resp)<>0 then begin gui.showmessage('References server at the following address: '+'https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress+' does not respond.'); exit; end; if RKCheck.CurrentOrder.ToPaySum=0 then k:=gui.MessageDlgEx('The current order is empty, load "Favorites"?', mtInformation, mbYes+mbNo, 'Yes;No'); if RKCheck.CurrentOrder.ToPaySum<>0 then k:=gui.MessageDlgEx('To record the dishes from the current order into «Favorites»?', mtInformation, mbYes+mbNo, 'Yes;No'); if k=6 then begin dishes:=TStringList.Create; zapros:='<RK7Query><RK7CMD CMD="GetRefData" RefName="ClassificatorGroups" PropMask="RIChildItems.(ident)" WithChildItems="2" RefItemIdent="4097"></RK7CMD></RK7Query>'; // instead of 4097, specify the code of your "Favorites" category dishes.Add(zapros); dishes.SaveToFile('.\test.xml'); dishes.clear; dishes.free; GUI.CmdExecWithFlags('.\runxml.bat', SW_HIDE, false); dishes:=TStringList.Create; dishes.LoadFromFile('.\Restest.xml'); for i:= 0 to dishes.Count - 1 do begin if pos('</RIChildItems>', dishes.strings[i])<>0 then dishend:=true; if (dishstart=true) and (dishend<>true) then begin idents:=copy(dishes.strings[i],27, length(dishes.strings[i])-29); cats:=cats+'<Item Ident="'+idents+'" CLASSIFICATORGROUPS-4096="0"></Item>'; // instead of 4096, specify the code of your "Favorites" classification end; if pos('<RIChildItems>', dishes.strings[i])<>0 then dishstart:=true; end; dishes.clear; cats1:='<?xml version="1.0" encoding="utf-8"?><RK7Query><RK7Command CMD="SetRefData" RefName="MENUITEMS"><Items>'+cats+'</Items></RK7Command></RK7Query>'; dishes.Add(cats1); dishes.SaveToFile('.\test1.xml'); dishes.free; GUI.CmdExecWithFlags('.\runxmldel.bat', SW_HIDE, false); dishes.clear; dishes.free; dishes:=TStringList.Create; for i:=0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it:=RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(it, 'TDish') then if Tdish(it).quantity>0 then begin idents:=inttostr(TRk7MenuItem(getitemBycodeNum('MenuItems',TDish(it).Code)).ident); cats:=cats+'<Item Ident="'+idents+'" CLASSIFICATORGROUPS-4096="4097"></Item>'; // instead of 4096, specify the "Favorites" classification code; instead of 4097, specify the "Favorites" category code end; end; cats1:='<?xml version="1.0" encoding="utf-8"?><RK7Query><RK7Command CMD="SetRefData" RefName="MENUITEMS"><Items>'+cats+'</Items></RK7Command></RK7Query>'; dbg.dbgprint('!!-!! '+cats1); dishes.Add(cats1); dishes.SaveToFile('.\test.xml'); dishes.free; GUI.CmdExecWithFlags('.\runxml.bat', SW_HIDE, false); gui.showmessage('The dishes from the current order have been saved as «Favorites».'); end; end;
Delete Favorites
procedure ProcessOperation1007309(Parameter: integer); var dishes:TStringList; idents,cats, cats1,zapros,resp:string; i:integer; dishstart,dishend:boolean; it:tcheckitem; VoidCode, step: integer; begin if httppost('https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress,'saasd',resp)<>0 then begin gui.showmessage('The References server at the following address: '+'https://'+TRK7Restaurant(RK7.CashGroup.MainParent).genxmladress+' does not respond.'); exit; end; if gui.MessageDlgEx('Clear "Favorites"?', mtInformation, mbYes+mbNo, 'Yes;No')=6 then begin dishes:=TStringList.Create; zapros:='<RK7Query><RK7CMD CMD="GetRefData" RefName="ClassificatorGroups" PropMask="RIChildItems.(ident)" WithChildItems="2" RefItemIdent="4097"></RK7CMD></RK7Query>'; // instead of 4097, specify the code of your «Favorites» categorydishes.Add(zapros); dishes.SaveToFile('.\test.xml'); dishes.clear; dishes.free; GUI.CmdExecWithFlags('.\runxml.bat', SW_HIDE, false); dishes:=TStringList.Create; dishes.LoadFromFile('.\Restest.xml'); for i:= 0 to dishes.Count - 1 do begin if pos('</RIChildItems>', dishes.strings[i])<>0 then dishend:=true; if (dishstart=true) and (dishend<>true) then begin idents:=copy(dishes.strings[i],27, length(dishes.strings[i])-29); cats:=cats+'<Item Ident="'+idents+'" CLASSIFICATORGROUPS-4096="0"></Item>'; // instead of 4096, specify the code of your «Favorites» classification end; if pos('<RIChildItems>', dishes.strings[i])<>0 then dishstart:=true; end; dishes.clear; cats1:='<?xml version="1.0" encoding="utf-8"?><RK7Query><RK7Command CMD="SetRefData" RefName="MENUITEMS"><Items>'+cats+'</Items></RK7Command></RK7Query>'; dishes.Add(cats1); dishes.SaveToFile('.\test.xml'); dishes.free; GUI.CmdExecWithFlags('.\runxml.bat', SW_HIDE, false); dishes.free; RK7.PerformOperation(rkoHome, 0); while step<= RKCheck.CurrentOrder.Sessions.LinesCount do begin it := RKCheck.CurrentCheckItem; if TObject(it) = Nil then break; if SYS.ObjectInheritsFrom(TObject(it), 'TPrintCheckItem') then break; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then begin if it.State = disOpened then begin RK7.PerformOperation(rkoDeleteLine, 0); continue; end else begin RKCheck.CreateCheckItem(rkrefOrderVoids, IntToStr(VoidCode), FloatToStr(TDish(it).Quantity)); end; RK7.PerformOperation(rkoHome, 0); end; step := step + 1; RK7.PerformOperation(rkoDown, 0); end; gui.showmessage('«Favorites» deleted.'); end; end;
Operations configuration
Linking Scripts to Operations
After the scripts are created, they should be linked to user operations. Assign the name of Call favorites to the operation with an empty script.
- Go to Service > Operations.
- Select the User Operations.
- Select 4 vacant operations and assign previously created scripts to them. For convenience, name the operations similar to the scripts.
- Assign the name of Call favorites to the operation, where the empty script will be linked to, and check the Change page box.
- Save the changes.
Linking Operations to Buttons
Assign operations to the function keys.
- Go to Settings > User Interface > Function Keys
- Create function keys to be linked to the previously created scripts.
- Go to Settings > User Interface > Selectors and choose the Order > Receipt: Main Selector > User
- Create a selector page with the name of Favorites
- Add the Favorites category from the favorites classification to the selector.
- Return to the Favorites selector and assign the Call Favorites operation in the properties thereof.
- Go to Settings > User interface > Usage of Selectors.
- In the upper left dropdown menu, choose Receipt: Main Selector.
- Drag the edited User selector from the left field to the right.
- Go to Selectors > Operations selector > Quick check: Operation selector.
- Create a copy of the Quick check: operations
- Edit the selector pages by placing there the previously created function keys.
- As an example, we have created a separate page for the Favorites Configuration selector, where relevant keys for favorites loading, recording, and deleting are available.
- The link to the created page is placed on the Extra page
- The Favorites function key, which directly calls Favorites, is placed on the Operations Selector page so that it would be available at the startup.
- Go to Settings > User Interface > Usage of Selectors.
- In the left dropdown menu, choose Quick check: Operation selector.
- Drag the newly created selector from the right field to the left.
- Save the changes.
Cash station setup
- Download the archive attached to the article.
- In the bat file, change the IP address and port to the current IP address and port of the references server XML interface. In our case, it is 583.
- Move the bat and xmltest.exe files to the folder, from which the cash register is launched.
- Now, the configuration is finished. You can launch the cash station and use the functionality.