[
*
procedure CheckViewOnShowScript(Sender: TObject); var i : integer; it: TCheckItem; paysum, cntdish: double; begin if not(RKCheck.CurrentOrder.FinishedService) then // if the receipt is open, then... begin paysum := 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 //Check dish lines only cntdish := cntdish + TDish(it).Quantity; if SYS.ObjectInheritsFrom(TObject(it), 'TPayLine') then //Check pay lines only paysum := paysum + TPayLine(it).NationalSum; end; if cntdish > 0 then if RKCheck.CurrentOrder.UnpaidSum <= paysum then if GUI.RKMessageDlg('Order is paid. Print the receipt?', 0, 3, 10000) = 6 then begin RK7.PostOperation(rkoBalanceReceipt, 0); end; end; end; |
The script displays a message (for example, "No personal data"), provided that the "To show PDS card info" parameter is disabled.
Script in the OnProcessCard event of the main order editing form:
procedure DesignFormOnProcessCard(IntfID, EntranceCardType: integer; CardCode: string; RKCardInfo: TRKCardInfo; var res:integer);
begin
if trim(RKCardInfo.CardAddInfo)<>'' then
begin
gui.showmessage('CardAddInfo = '+RKCardInfo.CardAddInfo);
res := 0;
// dbg.dbgprint('CardAddInfo = '+RKCardInfo.CardAddInfo);
end;
end;
The script is written on the OnRefObject handler of the form itself.
procedure DesignFormOnRefObject(Item: TReferentItem; Param: integer; var res: integer);
begin
if SYS.ObjectInheritsFrom(Item, 'TCurrencyFaceValue') then begin
if TCurrencyFaceValue(Item).FaceValue > 1000 then begin
if not RK7.CashUser.ConfirmOperation(rkoUser11) then
res := 1;
end;
end;
end;
The script uses rkoUser11 (user operation 11). This operation executes the manager's approval.
First, you should configure this operation (the "Operations" directory in the R_Keeper_7 manager station):
Insert the script in the OnRefObject event in the receipt editing form:
procedure DesignFormOnRefObject(Item: TReferentItem; Param: integer; var res: integer);
begin
if SYS.ObjectInheritsFrom(Item, 'TCurrencyFaceValue') then
RK7.PerformOperation(rkoOpenDrawer, 0);
end;
When currency denomination is selected, the cash drawer is opened on command.
On the editing form of the CheckView object, insert the following script in the OnSuitableObjectScript event:
procedure CheckViewOnSuitableObjectScript(Sender: TBasePanel; Obj: TObject; var Suitable: boolean);
begin
if RKCheck.CurrentOrder.FinishedService then
if (SYS.ObjectInheritsFrom(Obj, 'TPayLine')) then
Suitable := Suitable and (TPayLine(Obj).code <> 1); // Tips code
end;
You may also hide the change line by currency type or the discount line by its code in the receipt editor:
procedure CheckViewOnSuitableObjectScript(Sender: TBasePanel; Obj: TObject; var Suitable: boolean);
var TypeCurrCode, DiscountCode: integer;
begin
TypeCurrCode := 15; // Currency type
DiscountCode := 1113; // discount code
if (SYS.ObjectInheritsFrom(Obj, 'TDiscountItem')) then
Suitable := Suitable and (TDiscountItem(Obj).Code <> DiscountCode);
if (SYS.ObjectInheritsFrom(Obj, 'TPayLine')) then
if (TPayLine(Obj).BasicSum < 0) then
Suitable := Suitable and (TCurrencyType(TCurrency(TPayLine(Obj).RefItem).MainParent).Code <> TypeCurrCode);
end;
procedure CheckViewOnSuitableObjectScript(Sender: TBasePanel; Obj: TObject; var Suitable: boolean);
begin
if RKCheck.CurrentOrder.FinishedService then
if (SYS.ObjectInheritsFrom(Obj, 'TPayLine')) then
Suitable := Suitable and (TPayLine(Obj).BasicSum >= 0); // hide payments with a negative amount, i.e. change
end;
When ordering a dish marked with a colored button, the script adds this dish to the order with the same color.
procedure CheckViewOnGetColors(Sender: TObject; CheckItem: TObject; Selected: boolean; var Color, FontColor: TColor);
begin
if SYS.ObjectInheritsFrom(CheckItem, 'TDish') then begin
if (TDish(CheckItem).State = disOpened) then
if not Selected then
begin
Color := Trk7menuitem(TDish(CheckItem).RefItem).VisualType_BColor;
FontColor := Trk7menuitem(TDish(CheckItem).RefItem).VisualType_TextColor;
end
else
begin
Color := clBlack;
FontColor := clWhite;
// Color := Trk7menuitem(TDish(CheckItem).RefItem).VisualType_TextColor;
// FontColor := Trk7menuitem(TDish(CheckItem).RefItem).VisualType_BColor;
end;
end;
end;
CheckViewOnSuitableObject DesignFormOnProcessCard