...
A script to hide modifier selectors
The "sandwich" «sandwich» dish has a scheme of modifiers from several groups (types of bread, types of cheese, toppings, sauces). An additional group of "Diet Bans" «Diet Bans» modifiers is introduced with modifiers: Soy, Fish, Gluten, Egg.
...
Code Block | ||
---|---|---|
| ||
procedure MainSelectorOnSuitableItemScript(Sender: TBasePanel; item: TReferentItem; var Suitable: boolean); var i, j, p, z, ModifCode1: integer; it, CurItem: TCheckItem; DishCode, CntDish1, CntDish2, AddDishCode: integer; CheckView: TCheckView; DishesCode,ModifDenyList: TStringList; ModifDenied: boolean; s,s1:string; ii:Integer; begin if SYS.ObjectInheritsFrom(item, 'TModifier') then begin ModifDenied := false; DishesCode := TStringList.Create; ModifDenyList := TStringList.Create; //********** Set parameters ***********// DishesCode.Add('1002016=1002017;45'); // modifier code = hidden modifier code ; DishesCode.Add('20=21;46'); DishesCode.Add('17=18;43'); //********** Set parameters ***********// begin for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(it, 'TDish') then begin for j := 0 to TDish(it).Modifiers.Count - 1 do // checking by modifier begin for z := 0 to DishesCode.Count-1 do begin p:=pos('=',DishesCode.Strings[z]); ModifCode1 := StrToInt(copy(DishesCode.Strings[z],1,p-1)); // key modifier code if TDish(it).Modifiers.Items[j].Code = ModifCode1 then begin s:=copy(DishesCode.Strings[z],p+1,length(DishesCode.Strings[z])); while length(s)<>0 do begin ii:=pos(';',s); if ii=0 then begin s1:=s; delete(s,1,length(s1)); ModifDenyList.Add(s1); end else begin s1:=copy(s,1,ii-1); delete(s,1,ii); ModifDenyList.Add(s1) end; end; end; end; end; end; end; end; for i := 0 to ModifDenyList.Count - 1 do begin if TModifier(item).code = StrToInt(ModifDenyList.Strings[i]) then ModifDenied := True; end; ModifDenyList.Free(); DishesCode.Free(); Suitable := Suitable and not(ModifDenied); // hide forbidden modifiers end; end; |
A script to select the print layout from 2 available, depending on the currency used in the
...
«Top up PDS card
...
balance» dialog
On the "Cash «Cash replenishment/collection" collection» form of the MainSelector object, insert the script in the OnSuitableItem event:
...