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.

Create an XML interface on the references server.

Now, fill in the extended property.


Create a script with the name Empty and fill it with the following text:
begin end; |
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; |
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; |
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; |
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.

Assign operations to the function keys.






