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

  1. Create an extended property with a system name of xmladress.
  2. In the List of type field, select System > Restaurant.
  3. The name is XML interface address.
  4. The property type is ANSI string.

  5. Save the changes.

Configuring XML Interface

Create an XML interface on the references server.

  1. Go to Options > OLAP Reports > Reporting Servers.
  2. 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.
  3. Save your changes and restart the references server.
  4. 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.

  1. Go to Service > Stations and Devices.
  2. Select the required restaurant, and open the Properties.
  3. 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.

  4. Save the changes.

Configuring Classification

  1. Go to Menu > Menu Classifications and create the Favorites classification.
  2. Under this classification, create the Favorites.

  3. Remember or write down the Code of the created category — specify it in the script bodies later.
  4. Save the changes.

Configuring Scripts

  1. Go to Service > Scripts.
  2. Select the Operations group and create the required scripts.
  3. Create a script with the name Empty and fill it with the following text:

    begin
    end;
  4. Select the Operations group and create 3 scripts; find the relevant texts below.
  5. Do not forget to specify the Favorites category code in the scripts instead of 4097, and Classifications code instead of 4096.
  6. 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.

  1. Go to Service > Operations.
  2. Select the User Operations.
  3. Select 4 vacant operations and assign previously created scripts to them. For convenience, name the operations similar to the scripts.
  4. Assign the name of Call favorites to the operation, where the empty script will be linked to, and check the Change page box. 
  5. Save the changes.

Linking Operations to Buttons

Assign operations to the function keys.

  1. Go to Settings > User Interface > Function Keys
  2. Create function keys to be linked to the previously created scripts.
  3. Go to Settings > User Interface > Selectors and choose the Order > Receipt: Main Selector > User
  4. Create a selector page with the name of Favorites
  5. Add the Favorites category from the favorites classification to the selector.
  6. Return to the Favorites selector and assign the Call Favorites operation in the properties thereof.
  7. Go to Settings > User interface > Usage of Selectors.
  8. In the upper left dropdown menu, choose Receipt: Main Selector.
  9. Drag the edited User selector from the left field to the right.
  10. Go to Selectors > Operations selector > Quick check: Operation selector.
  11. Create a copy of the Quick check: operations
  12. Edit the selector pages by placing there the previously created function keys.
  13. 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.
  14. The link to the created page is placed on the Extra page 
  15. The Favorites function key, which directly calls Favorites, is placed on the Operations Selector page so that it would be available at the startup.
  16. Go to Settings > User Interface > Usage of Selectors.
  17. In the left dropdown menu, choose Quick check: Operation selector.
  18. Drag the newly created selector from the right field to the left.
  19. Save the changes.

Cash station setup

  1. Download the archive attached to the article.
  2. 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.
  3. Move the bat and xmltest.exe files to the folder, from which the cash register is launched.
  4. Now, the configuration is finished. You can launch the cash station and use the functionality.

 

  • No labels