A script to automatically add a menu group to the order
В заказе группа должна отображаться строкой, при нажатии на которую была бы возможность, либо пробить блюдо, находящееся в ней, либо удалить строку.
In the order, the group should be displayed as a line. When clicking on it, it would be possible to either add the dish from the group or delete the line.
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); begin if AVerifyType = vtNewQuickCheck then if RKCheck.CurrentOrder.IsEmpty then RK7.PerformRefObject(RK7.FindItemByCode(rkrefCategList, 5 {Menu group code})); end;
A script to create 2+1 and 3+1 special offers
Insert the script in the OnOrderVerify event of the CheckView component on the check editing form. The discount will be calculated and added to the receipt when the bill is printed.
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i: integer; i2, j, j2, t1, cntdisc, tdisc, DiscCode: integer; it, CurItem, ds: TCheckItem; SL: TStringList; a, q, Price: double; minPrice1, cnt1: double; d, dd: TDish; CheckView: TCheckView; begin // Before print if (AVerifyType=vtBill) // bill // or (AVerifyType=vtBeforeSave) // save order // or (AVerifyType=vtFirstPay) // first payment input // or (AVerifyType=vtPrintReceipt) // print receipt then begin DiscCode := 11; // code of discount CheckView := TCheckView(GUI.FindComponentByName('CheckView')); if CheckView = Nil then Exit; cntdisc := 0; CurItem := RKCheck.CurrentCheckItem; SL := TStringList.Create; try // Create list of the dishes, sorted by price SL.Sorted := False; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscountItem') then if (it.Code = DiscCode) then begin cntdisc := cntdisc + 1; j2 := i; end; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if ((it.State = disOpened) or (it.State = disPrinted)) then begin if (TDish(it).Quantity = 0) or (TDish(it).PRListSum = 0) then Price := TDish(it).Price else Price := TDish(it).PRListSum/TDish(it).Quantity; SL.AddObject(FormatFloat('00000000.00', Price) + IntToStr(TDish(it).UNI), TObject(it)); end; end; minPrice1 := 0; cnt1 :=0; if (RKCheck.CurrentOrder.TableCode = 2) then // different discounts for different tables tdisc := 2 // 2+1 special offer else tdisc := 3; // 3+1 special offer for i := 0 to SL.Count - 1 do begin d := TDish(SL.Objects[i]); a := 0; q := d.Quantity; if (d.Quantity = 0) or (d.PRListSum = 0) then Price := d.Price else Price := d.PRListSum/d.Quantity; // if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then begin if (d.RefItem.MainParent.code = 1) then // if dish from category of menu and have same code begin cnt1 := cnt1 + d.Quantity; if 0.00 = minPrice1 then begin dd := TDish(SL.Objects[i]); minPrice1 := Price; end; // else if (Price < minPrice1) then begin dd := TDish(SL.Objects[i]); minPrice1 := Price; end; end; end; a := minPrice1; if ((cntdisc > 0)and(cnt1<tdisc)) then for i2 := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i2]; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscountItem') then if (it.Code = DiscCode) then begin RKCheck.DeleteCheckItem(it); cntdisc := 0 end; end; // Create discount to a dish if ((cntdisc = 0) and (a > 0) and (cnt1 >= tdisc)) then begin CheckView.GotoItem(TObject(dd)); RKCheck.CreateCheckItem(rkrefDiscounts, IntToStr(DiscCode), FloatToStr(a)); end; end; finally SL.Free(); if CurItem <> Nil then CheckView.GotoItem(CurItem); end; RKCheck.CurrentOrder.Recalc(); end; end;
A script to add a discount when using a PDS card
The operation algorithm:
- When swiping the PDS card (the OnProcessCard handler), the script checks if it is possible to add a discount to the dish.
- If the discount was not used, the script finds for a dish that can be given a 100% discount:
- This dish is given a 100% discount.
- The discount "DISCOUNT USED" is added to the order via PerformMCRAlgoritm, so that the card code is registered in the discount.
The «DISCOUNT USED» discount must have the «Not manually» flag set and the «Print nulls» option unchecked.
Insert the script in the OnProcessCard method on the order editing form.
procedure DesignFormOnProcessCard(IntfID, EntranceCardType: integer; CardCode: string; RKCardInfo: TRKCardInfo; var res: integer); var i,fst,dsk, CntDsk: integer; it,it2: TCheckItem; DeviceID : integer; begin fst:=-1; dsk:=0; CntDsk:=0; DeviceID := 0; // PDC interface ID for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if ((it.CODE = 5502) OR (it.CODE = 1003)) then // code of dishes begin fst:=i; it2 := it; end; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscountItem') then if ((it.CODE = 11)) then // code of 100% discounts for dish dsk:=1; end; //function GetDiscountCount(const Sifr: integer; IntfID: integer; const CardCode: string): integer; CntDsk := RKCheck.GetDiscountCount(1000308, DeviceID, CardCode); // replace 1000308 with the corresponding value of the SIFR field from the SQL table [DISCOUNTS] for a 100% discount. If (fst>=0) and (dsk=0) and (CntDsk=0) then begin RK7.PerformOperation(rkoHome, 0); repeat it := RKCheck.CurrentCheckItem; if TObject(it) <> TObject(it2) then RK7.PerformOperation(rkoUp, 0); until ( TObject(it) = TObject(it2)) or ( TObject(it) = Nil); RKCheck.CreateCheckItem(rkrefDiscounts, '11', FloatToStr(100)); // add discount // 11 change on 100% discount for dish Data := 'CardCode'; RK7.PerformMCRAlgorith('8989=', DeviceID); end; end;
Create an MCR script with the following settings:
Basic — Scope: Discount
Basic — Object: DISCOUNT USED
Basic — Device Types — Script: check the box
function MCR1001146(DeviceSignal: Integer; DeviceIdent: Integer; var Parameter: String): Boolean; var RestCode: integer; begin Result := False; if pos('8989=', Parameter) = 1 then begin Result := True; end; end;
A script to stop service without a special dish and displaying a message
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, Interval, RND, DEV,happynum, CntDish, HaveSpecialDish: integer; rr : double; tt: string; it: TCheckItem; begin //************************************// // stop service without special dish // //************************************// if (AVerifyType = vtBeforeSave) then begin HaveSpecialDish := 0; CntDish := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if (TDish(it).Quantity <> 0) then begin CntDish := CntDish + 1; if ((it.CODE = 5502) OR (it.CODE = 1003)) then HaveSpecialDish := HaveSpecialDish + 1; end; end; if (CntDish>0) and (HaveSpecialDish = 0) then begin // gui.showmessage('No mandatory dish! Saving prohibited'); if GUI.RKMessageDlg('Return to edit order?', 0, 3, 10000) = 6 then AContinue := False else AContinue := True; end; end; //************************************// // stop service without special dish // //************************************// // show meessage on special order Interval := 10; DEV := 5; tt := TimeToStr(time); rr := 10*1/StrToInt(Copy(tt,length(tt)-1,2)); happynum := trunc(Interval + rr*DEV - trunc(DEV/2)); // GUI.ShowMessage('Happy Num='+IntToStr(happynum)); // GUI.ShowMessage('Happy Time='+tt+' --'+Copy(tt,length(tt)-1,2)); if (AVerifyType = vtBill) and (happynum=RKCheck.CurrentOrder.SeqNumber) then begin GUI.ShowMessage('Happy Order '+IntToStr(RKCheck.CurrentOrder.SeqNumber)); // ss := RKCheck.CurrentOrder.OrderName; // CheckView.Tag:=1; end; end;
A script to show a message after printing authorization slips or printing a receipt when paying with a MasterCard card
On the order form for the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i: integer; it: TCheckItem; begin if (AVerifyType = vtAfterReceipt) then begin for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TPayLine') then if Pos('MASTERCARD', UpperCase(TPayLine(it).Owner)) > 0 then gui.ShowMessage('Ta-Da-a!'); end; end; end;
A script for automatic LogOut after each sale in Quick Sale Mode
On the quick check form, insert the script for the CheckView object in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); begin if (AVerifyType=vtAfterReceipt) then begin RK7.PostOperation(rkoOk,0); RK7.PostOperation(rkoUnregister,0); end; end;
A script to add a gift dish to the order, depending on the order amount and the number of guests
On the order editing form, insert the script for the CheckView object in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var DishCode, DishCode2, GuestTypeCode: integer; limit: double; begin DishCode := 43; // special dish code DishCode2 := 46; // special dish2 code limit := 5000; // gift offer limit GuestTypeCode := 2; // guest type code if (AVerifyType=vtBill) // bill then if RKCheck.CurrentOrder.Visit.GuestType <> 0 then if RK7.FindItemBySifr(rkrefGuestTypes, RKCheck.CurrentOrder.Visit.GuestType).Code = GuestTypeCode then begin if RKCheck.CurrentOrder.ToPaySum >= limit then begin gui.showmessage('The "Postcard..." dish will be added to the order in the amount of'+IntToStr(RKCheck.CurrentOrder.GuestsCount)+'servings, dish "Gift set",'+#10#13+'don't forget to bring guest a gift'); RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode), IntToStr(RKCheck.CurrentOrder.GuestsCount) ); // postcards RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode2), IntToStr(1) ); // gift end else begin gui.showmessage('The "Postcard..." dish will be added to the order in the amount of'+IntToStr(RKCheck.CurrentOrder.GuestsCount)+' servings,'+#10#13+'don't forget to bring guest a gift'); RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode), IntToStr(RKCheck.CurrentOrder.GuestsCount) ); // postcards end; end; end;
A script to change the delivery cost depending on the delivery zone
The cost of delivery to zone 1 is 600 rubles, to zone 2 — 750 rubles. If the cost of the order in zone 1 is more than 600 rubles, then the delivery is free.
The script is inserted in the OnOrderVerify event of the CheckView object located on the check editing form:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var DishCode1, DishCode2, DishCode3, DishCode4, ZoneId1,ZoneId2,ZoneId3,ZoneId4: integer; limit1, limit2, limit3, limit4: double; begin DishCode1 := 43; // special dish1 code DishCode2 := 46; // special dish2 code DishCode3 := 47; // special dish3 code DishCode4 := 48; // special dish4 code limit1 := 600; // paid delivery limit 1 limit2 := 750; // paid delivery limit 2 limit3 := 850; // paid delivery limit 3 limit4 := 950; // paid delivery limit 4 ZoneId1 := 2; // delivery zone 1 ID ZoneId2 := 3; // delivery zone 2 ID ZoneId3 := 4; // delivery zone 3 ID ZoneId4 := 5; // delivery zone 4 ID if (AVerifyType=vtBill) // bill then if RKCheck.CurrentOrder.ZoneID > 0 then begin if RKCheck.CurrentOrder.ZoneID = ZoneId1 then if RKCheck.CurrentOrder.ToPaySum <= limit1 then RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode1), IntToStr(1) ); // delivery 1 if RKCheck.CurrentOrder.ZoneID = ZoneId2 then if RKCheck.CurrentOrder.ToPaySum <= limit2 then RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode2), IntToStr(1) ); // delivery 2 if RKCheck.CurrentOrder.ZoneID = ZoneId3 then if RKCheck.CurrentOrder.ToPaySum <= limit3 then RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode3), IntToStr(1) ); // delivery 3 if RKCheck.CurrentOrder.ZoneID = ZoneId4 then if RKCheck.CurrentOrder.ToPaySum <= limit4 then RKCheck.CreateCheckItem(rkrefMenuItems, IntToStr(DishCode4), IntToStr(1) ); // delivery 4 end; end;
A script to control swiping of the PDS card
There are dishes that are only available to club card holders. When you select this dish, the «Use the PDS card» window should appear. If there is no card, the dish is not added to the order.
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, DishCode1, DishCode2, DishCode3, DiscountCode1, DiscountCode2, DiscountCode3, CardPresent,DishPresent: integer; CardCode: string; it: TCheckItem; begin DishCode1 := 1; DiscountCode1 := 12; DiscountCode2 := 13; DiscountCode3 := 14; CardPresent := 0; DishPresent := 0; CardCode := ''; if (AVerifyType = vtBill)or(AVerifyType = vtPrintReceipt) then begin for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then //Check dish lines only if (TDish(it).code = DishCode1) then //Check category of the dish if TDish(it).Quantity > 0 then DishPresent := DishPresent + 1; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscountItem') then //Check discount lines only if (TDiscountItem(it).code = DiscountCode1) or(TDiscountItem(it).code = DiscountCode2) or(TDiscountItem(it).code = DiscountCode3) then // defining PDS card by PDS discount availability CardPresent := 1; end; if DishPresent > 0 then if CardPresent > 0 then AContinue:= True else { if GUI.RKMessageDlg('Special dishes available, use PDS card' ,0,3, 10000)=6 then AContinue := false else AContinue := True; } begin // gui.showmessage('There are special dishes in the order, use PDS card' '); gui.showmessage('Special dishes: '+inttostr(DishPresent)+' ; Cards found in the order: '+inttostr(CardPresent)); // test line AContinue := false; end; end; if (AVerifyType = vtBill) or(AVerifyType = vtPrintReceipt) or (AVerifyType=vtBeforeSave) then for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(it, 'TDish') then if CheckDishCode(TDish(it).Code) then // if (TDish(it).Code = DishCode) then begin // checking by Consumators if TDish(it).Consumators.Count = 0 then begin gui.ShowMessage('Operation impossible, add consumator'); AContinue := false; end; end; end; end;
A script to restrict the payment with PDS cards to a quick check only
Payments with PDS cards should be allowed only if the order is created using the «Quick Check» button.
On the quick check form of the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); begin if AVerifyType = vtNewQuickCheck then if RKCheck.CurrentOrder.IsEmpty then RKCheck.CurrentOrder.UserTag2 := 33; end;
Add a line to the MCR script to check the specified custom tag:
if (RKCheck.CurrentOrder.UserTag2 = 33) then
A script to control the number of consumators for some dishes
Необходимо сделать так, чтобы к одним блюдам был привязан один консумант, а к другим — два консуманта.
Для этого в параметре задайте ограничение консумантов — 2, а скриптом ограничьте блюда специальной категории одним консумантом.
На форме редактирования заказа у объекта CheckView в событии OnOrderVerify укажите скрипт:
Some dishes should be given one consumator, while other dishes should be given 2 consumators.
To do this, set the limit of consumators — 2 in the parameter, and use the script to limit the dishes of a special category to one consumator.
On the order editing form for the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i,j,CntConsumators,MaxQntConsumCateg1:integer; it: TCheckItem; CategCode2: integer; Categ2: TClassificatorGroup; begin //************************* Set parameters ******************************// CategCode2 := 8; // controlled dishes category MaxQntConsumCateg1 := 1; //************************* Set parameters ******************************// Categ2 := TClassificatorGroup(getitemBycodeNum('ClassificatorGroups', CategCode2)); if (AVerifyType = vtBeforeSave)or(AVerifyType = vtBill)or(AVerifyType = vtPrintReceipt) then for i:= 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then begin CntConsumators := 0; CntConsumators := TDish(it).Consumators.Count; //dbg.dbgprint(' dish '+TDish(it).Name +' of modifiers '+inttostr(CntConsumators)); if not(Categ2.IsChild(it.RefItem)) then //Check category of the dish if CntConsumators>MaxQntConsumCateg1 then begin AContinue := False; gui.showmessage('The number of dish consumants is exceeded'+TDish(it).Name); end; end; end; end;
A script to check the presence of a gift dish in the order
The special offer: A gift depending on the order sum. One dish is for free if the order sum is bigger than 1000 rubles. When it is bigger than 1200 rubles, one of two free dishes may be chosen.
The cashier shouldn't be able to calculate the order equal to or bigger than 1000 rubles if there is no gift dish in it.
Place the script on the order editing form at the CheckView object in the OnOrderVerify event.
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, CntDish, HaveSpecialDish, SpecialDishCode1, SpecialDishCode2: integer; LimitSum : double; it: TCheckItem; begin //************************************// // stop service without special dish // //************************************// //********** Set parameters ***********// SpecialDishCode1 := 23; // dish code SpecialDishCode2 := 24; // dish code LimitSum := 1000; // the sum of the check, over which the gift dish is due //********** Set parameters ***********// if ((AVerifyType=vtBill) // bill or (AVerifyType=vtBeforeSave) // save order or (AVerifyType=vtFirstPay) // first payment input or (AVerifyType=vtPrintReceipt)) // print receipt then begin HaveSpecialDish := 0; CntDish := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if (TDish(it).Quantity <> 0) then begin CntDish := CntDish + 1; if (it.CODE = SpecialDishCode1)or(it.CODE = SpecialDishCode2) then HaveSpecialDish := HaveSpecialDish + 1; end; end; if (HaveSpecialDish = 0)and(RKCheck.CurrentOrder.ToPaySum >= LimitSum) then begin gui.showmessage('No gift dishes!'); AContinue := False end; end; //************************************// // stop service without special dish // //************************************// end;
A script for link currencies to the type of guest
To arrange the staff meals, the following options were created:
- two guest types («Guest» and «Staff») and an additional type of price;
- the staff price type is linked to the «Staff» guests type;
- two special currencies are used to pay for the order at staff prices.
The script restricts the payment only to these currency types when selecting the «Staff» guests type.
The version of the cash register system 7.5.2.377
On the order editing form for the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, CntDish, HaveSpecialDish, HaveDiscount: integer; it: TCheckItem; HaveAnotherCurr: integer; begin //***********41012********************// if (AVerifyType = vtBill)or(AVerifyType = vtPrintReceipt) then // if RKCheck.CurrentOrder.GuestType = 'Staff' then if RKCheck.CurrentOrder.Visit.GuestType <> 0 then if RK7.FindItemBySifr(rkrefGuestTypes, RKCheck.CurrentOrder.Visit.GuestType).Code = 2 then begin HaveAnotherCurr := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TPayLine') then if (TPayLine(it).Code <> 98)and(TPayLine(it).Code <> 99) then //Currency code for staff HaveAnotherCurr := HaveAnotherCurr + 1; end; if (HaveAnotherCurr>0) then begin AContinue := False; gui.showmessage('Prohibited currency for this order!'); end; end; //***********41012********************// end;
A script to print the final receipt in R_Keeper_7
The restaurant works under two types of business entities — private limited company and sole proprietorship. In the first one, a fiscal register and a fiscal memory device are used. In the second one, a check printer is used. A fiscal register works as a POS printer and has the «FR department» classification set. Alongside these two separated receipts, the third — a common one — should be printed on a check printer.
Create a layout in «Other — Custom Layout» and load a check layout. Create a print view for it in the print layouts.
On the check editing form of the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); begin if (AVerifyType=vtAfterReceipt) then begin RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,219)); // print view code end; end;
Specify the print view code of the custom layout instead of «219».
A script to remove the markup, if the order has a certain discount
The « Service 10% » charge applies only to waiters and is calculated from the order amount. A set of discounts (5%, 10%, Employee, Private) is calculated from the order amount.
Discounts «Employee» (code 5) and «Private» (code 6) remove the markup.
On the check editing form of the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i,dsk1, dsk2: integer; it, it2: TCheckItem; begin dsk1 := 0; // discounts counter canceling markup dsk2 := 0; // markup counter for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscount') then Begin if ((it.CODE = 5) or (it.CODE = 6)) then // discounts codes canceling markup dsk1 := dsk1 + 1; if (it.CODE = 10) then // markup code begin dsk2 := dsk2 + 1; it2 := it; end; End; end; if (dsk1 > 0) and (dsk2 > 0) then RKCheck.DeleteCheckItem(it2); // delete markup end;
A script to activate the «Plastek» loyalty card
If there is a deposit or activation item in the receipt— the table cannot be closed without using a loyalty card.
The script checks the presence of the specified dish and the discount in the order. If there is a dish, but there is no discount, then a message is displayed and the action is blocked until the discount is added or the dish is removed.
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, Interval, RND, DEV,happynum, CntDish, HaveSpecialDish, HaveSpecialDisc, SpecialDishCode, SpecialDiscCode: integer; rr : double; tt: string; it: TCheckItem; begin //************************************// // stop service without special dish // //************************************// if ((AVerifyType=vtBill) // bill or (AVerifyType=vtBeforeSave) // save order or (AVerifyType=vtFirstPay) // input of the first payment or (AVerifyType=vtPrintReceipt)) // print receipt then begin SpecialDishCode := 23; // dish code SpecialDiscCode := 10; // discount code HaveSpecialDish := 0; HaveSpecialDisc := 0; CntDish := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if (TDish(it).Quantity <> 0) then begin CntDish := CntDish + 1; if (it.CODE = SpecialDishCode) then HaveSpecialDish := HaveSpecialDish + 1; end; if SYS.ObjectInheritsFrom(TObject(it), 'TDiscountItem') then if (it.CODE = SpecialDiscCode) then HaveSpecialDisc := HaveSpecialDisc + 1; end; if (HaveSpecialDisc = 0) and (HaveSpecialDish > 0) then begin gui.showmessage('No mandatory discount!'); AContinue := False end; end; //************************************// // stop service without special dish // //************************************// end;
A script to print a coupon layout
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, CntDish2, CntDish3, CntDish4, CodeDish2, CodeDish3_1, CodeDish3_2, CodeCateg4_1, CodeCateg4_2: integer; it: TCheckItem; Categ: TClassificatorGroup; s1: string; begin s1 := FormatDateTime('hh',Now); CntDish2 := 0; CntDish3 := 0; CntDish4 := 0; CodeDish2 := 10; // dish code CodeDish3_1 := 100; // dish code CodeDish3_2 := 105; // dish code CodeCateg4_1 := 5; // "Salad" category code CodeCateg4_2 := 8; // "Drink" category code for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then begin if TDish(it).Code = CodeDish2 then CntDish2 := CntDish2 + 1; if (TDish(it).Code = CodeDish3_1) or (TDish(it).Code = CodeDish3_2) then CntDish3 := CntDish3 + 1; Categ := TClassificatorGroup(getitemBycodeNum('ClassificatorGroups', CodeCateg4_1)); if Categ.IsChild(it.RefItem) then CntDish4 := CntDish4 + 1; Categ := TClassificatorGroup(getitemBycodeNum('ClassificatorGroups', CodeCateg4_2)); if Categ.IsChild(it.RefItem) then CntDish4 := CntDish4 + 1; end end; if AVerifyType = vtPrintReceipt then if StrtoInt(s1) <= 18 then Begin // order sum >= 500 rub. if (RKCheck.CurrentOrder.ToPaySum >= 500) {and (RKCheck.CurrentOrder.ToPaySum < 1000)} then RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,3031)) else // there is the dish with the code "xxx" in the order if (CntDish2 > 0) then begin RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,3032)); end else // there is the dish with the code "100" and "105" in the order if (CntDish3 > 0) then begin RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,3033)); end else // there is the dish from "salad" and "drink" category in the order if (CntDish4 > 0) then begin RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,3034)); end; end; end;
A script to prohibit selling a catch weight product if the weight is less than the norm
On the check editing form of the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i: integer; minweight: double; it: TCheckItem; begin minweight := 0.3; // setting the minimum weight for sale if (AVerifyType = vtBill)or(AVerifyType = vtPrintReceipt) then begin for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if TDish(it).Quantity>0.0 then if SYS.ObjectInheritsFrom(it, 'TPortion') then //check for a catch weight dish if Tdish(it).Quantity < minweight then begin gui.showmessage('Too small weight! Set more then '+FloatToStr(minweight)); AContinue := False; end; end; end; end;
A script to confirm saving the special dish by the manager's card
The algorithm :
- The waiter adds a special dish or drink (with the letter A) to the order.
- Then he or she clicks «Save order». After that, the «Confirmation by the manager's card is required » window pops up.
- The manager swipes his or her card, controlling if the special offer is correctly applied. The "Save order" window pops up.
- After that, the added dishes are printed on the kitchen printers.
On the order editing form of the CheckView object, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, DishCode, CntDish, HaveSpecialDish: integer; it: TCheckItem; begin //************************************// // 57799 // //************************************// if (AVerifyType = vtBeforeSave) then begin DishCode := 25; // code of dish HaveSpecialDish := 0; CntDish := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if (TDish(it).Quantity <> 0) then begin CntDish := CntDish + 1; if (it.CODE = DishCode) then HaveSpecialDish := HaveSpecialDish + 1; end; end; if (CntDish>0) and (HaveSpecialDish > 0) then begin // gui.showmessage('??? ????????????? ?????! ?????????? ?????????'); if RK7.PerformOperation(rkoUser07, 0)=1 then AContinue := True else AContinue := False; end; end; //************************************// // 57799 // //************************************// end;
Specify an empty script for a custom operation (operation #7 is used in the example):
procedure ProcessOperation1001837(Parameter: integer); begin end;
In the operation properties, check the box «Access Control» and assign rights to the appropriate user.
A script to automatically add a dish when creating an order
On the check editing form for the CheckView component, insert the script in the OnOrderVerify event:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var i, CntDish, HaveSpecialDish: integer; it:Tcheckitem; begin //************************************// // stop service without special dish // //************************************// if (AVerifyType = vtBeforeSave) then begin HaveSpecialDish := 0; CntDish := 0; for i := 0 to RKCheck.CurrentOrder.Sessions.LinesCount - 1 do begin it := RKCheck.CurrentOrder.Sessions.Lines[i]; if SYS.ObjectInheritsFrom(TObject(it), 'TDish') then if (TDish(it).Quantity <> 0) then begin CntDish := CntDish + 1; if ((it.CODE = 5502) OR (it.CODE = 1003)) then HaveSpecialDish := HaveSpecialDish + 1; end; end; if (CntDish>0) and (HaveSpecialDish = 0) then begin // gui.showmessage('No mandatory dish! Saving prohibited'); if GUI.RKMessageDlg('Return to edit order?', 0, 3, 10000) = 6 then AContinue := False else AContinue := True; end; end; //************************************// // stop service without special dish // //************************************// end;
In the line:
if ((it.CODE = 5502) OR (it.CODE = 1003)) then
codes of required dishes are specified. Replace the condition in this line with your own.
The script that prints a receipt and a bill in the «quick check» mode
A script for the «Edit Order (quick receipt)» form:
procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); begin if (AVerifyType=vtAfterReceipt) then RK7.PerformRefObject(RK7.FindItemByCode(rkrefMaketSchemeDetails,1001965)); end;
Insert the code of your check view instead of 1001965. Printing will take place immediately after printing the main receipt.