A script to show the same message to the cashier when creating each new order
The message should be displayed after adding the first course to the quick check.
procedure CheckViewOnAfterCheckViewEdit(Sender: TObject; AEditType: TEditType; AObjectBef, AObjectAft: TObject); var i, CntDish: integer; it: TCheckItem; begin if SYS.ObjectInheritsFrom(AObjectAft, 'TDish') then begin 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 CntDish := CntDish + 1; end; if CntDish = 1 then gui.ShowMessage('New QuickCheck'); end; end;
A script to display the PDS card balance.
The algorithm:
- The PDS card balance should be displayed on the order editing form in the quick check.
- The balance should be calculated as follows: card balance minus order amount.
- If the calculated balance is negative, the amount is shown in red.
Add userGLabel1 and userTimer1 to the quick receipt editing form.
Then add the following scripts to the form:
procedure show_rest_sum; var i: integer; Limit, restsum: double; CardCode: string; McrPay: TMcrPay; label_rest: TObject; begin Limit := 0; restsum := 0; CardCode := ''; for i := 0 to RKCheck.CurrentOrder.Sessions.McrPays.ItemCount - 1 do begin McrPay := TMcrPay(RKCheck.CurrentOrder.Sessions.McrPays.Items[i]); Limit := Limit + McrPay.MaxAmount; CardCode := McrPay.CardNum; end; if CardCode = '' then Exit else begin restsum:=Limit-RKCheck.CurrentOrder.ToPaySum; label_rest := TObject(gui.FindComponentByName('userGLabel1')); if SYS.ObjectInheritsFrom(TObject(label_rest), 'TGLabel') then begin TGLabel(label_rest).Caption := FloatToStr(restsum); if restsum >=0 then TGLabel(label_rest).Color := clBlue else TGLabel(label_rest).Color := clRed; end; end; end; procedure CheckViewOnOrderVerify(Sender: TObject; AVerifyType: TVerifyType; oper: integer; var AContinue: boolean); var label_rest: TObject; begin if AVerifyType = vtNewQuickCheck then if RKCheck.CurrentOrder.IsEmpty then begin label_rest := TObject(gui.FindComponentByName('userGLabel1')); if SYS.ObjectInheritsFrom(TObject(label_rest), 'TGLabel') then begin TGLabel(label_rest).Caption := '0'; TGLabel(label_rest).Color := clBlue; end; end; end; procedure userTimer1OnTimer(Sender: TObject); begin if not RKCheck.Valid then Exit; if (GUI.CheckFormInPayMode) then exit; if SYS.ObjectInheritsFrom(RKCheck.CurrentCheckItem, 'TPrintCheckItem') then Exit; show_rest_sum; end;
Script to display the «Guest Type» button in the Main Menu
The «Staff Meals» button should be added to the main menu. Clicking opens the «Quick Receipt» mode and the «Staff» guest type.
A script for the selector on the main menu:
procedure ProcessOperation1001774(Parameter: integer); begin RKCheck.StrTag := 'Personal'; RK7.PerformOperation(rkoQuickCheck,0); end;
On the «New Order (quick check)» form, specify the script for the GuestTypeEditor object in the OnShow event:
procedure GuestTypeEditorOnShowScript(Sender: TObject); begin if RKCheck.StrTag = 'Personal' then begin RK7.PerformRefObject ( RK7.FindItemByCode(rkrefGuestTypes, 1) ); // specify the guest type code RKCheck.StrTag := ''; RK7.PostOperation(rkoEnter,0); end; end;