1.1.1. To make user functions that are not preset.
1.1.2. To achieve specific automatic system behaviour.
1.1.3. This manual based on ftp://ftp.ucs.ru/rk7/ForDealers/docs_english/RK7Scripts.doc
2.1.1.1. Open "Service" -> "Scripts".
2.1.1.2. Create new script in "Operations" (if you want to use it as operation) or other group and open editor by pressing "other" section "SomeScript" property.
2.1.2.1. Open "Service" -> "Operations". Choose one of editable user operations (rename it for convenience).
2.1.2.2. Assign your script to "Scripting" section "Script" parameter.
2.1.3.1. To use Scripts as form modifiers you are to do the following.
2.1.3.2. Open Form in builtin editor (copy preset one if you used to use that).
2.1.3.3. Select necessary selector panel and open "Events" tab [Other] section any ("OnCompare", for example) property.
2.1.3.4. And put in your script to editor and press "OK" to save.
2.1.4.1. Go to "Options" -> "User interface" -> "Function keys".
2.1.4.2. Create new one and give the name. Assign operation to "Basic" section "Operation" and "Operation for empty" parameters.
2.1.5.1. Go to "Options" -> "User interface" -> "Selectors". Copy preset selector if you used to use that.
2.1.5.2. Add necessary function keys to any chosen selector page.
2.1.5.3. Do not forget setting proper usage.
2.1.6.1. Open Layout editor and content editor inside it. There are script facilities both for bands and memos. Script area is a lower one.
2.1.6.2. This editor is not the same as in "scripts": you don't need to write a code outside "begin-end". There is even the special GUI for variables definitions.
2.1.6.3. Find additional information on layouts in .
function Abs(e : Extended) : Extended;
Returns absolute meaning of argument e (e by modulus).
function StrGet(var S : String; I : Integer) : Char;
Returns element of string S with index I.
procedure StrSet(c : Char; I : Integer; var s : String);
Sets element of string S with indexI in meaning c.
function Uppercase(s : string) : string;
Returnsstring s in upper case.
function Lowercase(s : string) : string;
Returns string s inlowercase.
function Trim(s : string) : string;
Returns changed string s: all beginning and ending “spaces” and control symbols are deleted.
function Length(s : String) : Longint;
Returns length of string s.
procedure SetLength(var S: String; L: Longint);
Sets length of string S in L.
function inttostr(i: Longint): string;
Returns string, that contains transformed integer value i.
function strtoint(s: string): Longint;
Returns integer value, taken from string s.
function strtointdef(s: string; def: Longint): Longint;
Returns string s, transformed to integer value. If this string is not allowed integer, then value by default def is returned.
function copy(s: string; ifrom, icount: Longint): string;
Returns string that is sub-string of string S, starting from S[ifrom] and containing icount number of symbols.
function pos(substr, s: string): Longint;
Returns position (index) of first meeting subsrtinS. If S doesn’t contain Substr, 0 is returned.
procedure delete(var s: string; ifrom, icount: Longint);
Deletes from string S icount number of symbols from position ifrom.
procedure insert(s: string; var s2: string; ipos: Longint);
Inserts string s into s2, from position ipos.
function StrToFloat(s: string): Extended;
Function returns real number (with floating point), transformed from s.
function FloatToStr(e : Extended) : String;
Returns string, this string is transformed value of e.
function Padl(s : string; I : longInt) : string;
Returns strings, added with “spaces” to the length of I on the left part.
function Padr(s : string; I : longInt) : string;
Returns strings, added with “spaces” to the length of I on the right part.
function Padz(s : string; I : longInt) : string;
Returns strings, addedwithsymbols ‘0’ to the length of I on the left part.
function StringOfChar(c : char; I : longInt) : string;
Returns string, that consists of I symbols ‘C’.
function FormatFloat(const Mask: string; d : Extended) : String;
Returns string, that consists of value d transformed with the help of mask Mask.
function getarraylength(var v: array): Integer;
Returns length of array v.
procedure setarraylength(var v: array; i: Integer);
Sets length of array v into i.
function VarGetType(x: Variant): TVarType;
Returns code of data type, that are stored in variable x.
function Null: Variant;
Returns value NULL.
Simple data types, that are used in functions and classes of RK7, are described below:
Type name | Corresponding type | Description |
TQuantity | Int64 | Usedforquantity |
TMoney | Int64 | Usedforsum |
TWeight | Int64 | Usedforweight |
TSmallWeight | Longint | |
TimeMacro | TDateTime | |
Int2 | Smallint | |
Int4 | Longint | |
Int8 | Int64 | |
TEditType | (etInsert, etRemove, etChange) | Usedforcallingfunctionoforderediting – defineseditingtype: pasting, deletionorchangingofanelement |
TDrawItemState | (disNone, disOpened, disLocked, disFixed, disPrinted, disPartClosed, disClosed, disDeleted) | Elementcondition: |
All classes, that can be used in RK7 scripts, are described below. Syntax:
ClassName (ParentClassName)
Methods
// methods description (may not be present)
Properties
// class properties description (may not be present). Syntax:
// AccessType PropertyType PropertyName
// AccessType: ROReadOnly, WOWriteOnly, RWReadWrite
// PropertyType: type of the property, for example, int64, string
// PropertyName: name for referring to property.
TIdentItem (TPersistent)
TIntegerId (TIdentItem)
TDrawItem (TIntegerId)
properties
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
TDrawItemList (TIdentItem)
properties
RO TDrawItem ITEMS[i]
RO integer ITEMCOUNT
TCheckItemList (TDrawItemList)
TCheckItem (TDrawItem)
properties
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
tPrintCheckItem (TCheckItem)
properties
RO Boolean WasAllChangeToTip
RO TRate BasicRate
RO Integer iVoid
RO Boolean IsBill
RO Integer PrintTry
RO Integer iDeleteManager
RO TDateTime DeleteDateTime
RO Boolean Deleted
RO tCheckSubItemList CurrLines
RO Boolean BillError
RO Boolean PrintError
RO String DeleteManager
RO String Void
RO String Drawer
RO String CloseStation
RO String PrintStation
RO String Printer
RO String SeatName
RO TMoney TaxSumAdded
RO TMoney TaxSum
RO TMoney DistrMarkupSum
RO TMoney DiscountSum
RO TMoney ChargePriceListSum
RO TMoney DishPriceListSum
RO TMoney PRListSum
RO TMoney BindedSum
RO TMoney ToPaySum
RO TMoney FiscalSum
RO TMoney NationalSum
RO TMoney BasicSum
RO Byte Seat
RO Integer ParentCheckNum
RO Integer CheckNum
RO Integer PrintNumber
RO Integer iDrawer
RO Integer iFiscShift
RO Integer iShift
RO Integer iCloseStation
RO String35 ExtFiscID
RO Integer iPrinter
RO Integer iPrintStation
RO TDateTime CloseDateTime
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
TDish (TCheckItem)
properties
RO Boolean Selected
RO String SeatName
RO TMoney ClosedPaySum
RO TMoney ClearSum
RO TMoney PaySum
RO TMoney SumWithDiscounts
RO tPayBindings PayBindings
RO TMoney PriceSumBinded
RO Boolean IsPortion
RO Integer iTaxDishType
RO TVoids Voids
RO TConsumators Consumators
RO TDiscounts Discounts
RO TModifiers Modifiers
RO Byte Seat
RO Byte QntFormat
RO Smallint CookMins
RO TMoney BonusBaseSum
RO TMoney CalcConsumSum
RO TMoney ConsumSum
RO TMoney PRListSum
RO TMoney Price
RO Boolean IsUserPrice
RO TQuantity SrcQuantity
RO TQuantity Pieces
RO TQuantity Quantity
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
tCommonPayLine (TCheckItem)
properties
RO Integer iHighLevelType
RO String PrintOwnerInfo
RO String OwnerInfo
RO String ISO
RO String CurrencyName
RO String TaxPayTypeName
RO Integer TaxPayTypeSifr
RO Integer PrintCheckUNI
RO TRate DBKurs
RO TMoney NationalSum
RO TMoney BasicSum
RO TMoney OriginalSum
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
TDishSubItem (TCheckItem)
properties
RO Integer DishUNI
RO Integer OwnerUNI
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
TDiscountItem (TDishSubItem)
properties
RO Boolean PDSTransaction
RO String SrcValue
RO String SeatName
RO String DishName
RO Boolean IsMarkup
RO Boolean IsDiscount
RO Integer SessionUNI
RO Byte Seat
RO Boolean ValueChanged
RO TMoney MaxAmount
RO Boolean IsCharge
RO TMoney BonusAmount
RO TMoney CalcAmount
RO TMoney DiscountBase
RO TPercent CalcPercent
RO TMoney SrcAmount
RO TCountType CountType
RO Integer MInterface
RO Integer BonusType
RO Int64 AccountIdent
RO String CardCode
RO TChargeSource ChargeSource
RO TChargeLocalization Localization
RO Integer DishUNI
RO Integer OwnerUNI
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
TSessionLines (TCheckItemList)
TOrderSession (TCheckItem)
properties
RO Integer iRemindServiceScheme
RO Integer iPrintServiceScheme
RO TSessionFlags SessionFlags
RO TDateTime ReadyAt
RO TPrintFlag ReadyFlag
RO TDateTime RemindAt
RO TPrintFlag RemindFlag
RO TDateTime PrintAt
RO TPrintFlag PrintFlag
RO Integer iKurs
RO tSessionLines Lines
RO Integer ExtraUNI
RO Integer ExtraVisit
RO String Kurs
RO String TransferInfo
RO String Station
RO String TradeGroup
RO String Period
RO String PriceScale
RO Integer CreatorCode
RO String Creator
RO String Author
RO Integer AuthorCode
RO String SessionType
RO Integer iStation
RO Integer iTradeGroup
RO Integer iPeriod
RO Integer iPriceScale
RO TDateTime EndService
RO TDateTime StartService
RO TSessionType iSessionType
RO Integer IdInVisit
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
tOrder (TCheckItem)
properties
RO Integer iLastUser
RO Integer LockedByStation
RO String OtherWaitersString
RO Integer iCommonShift
RO TMoney DiscountSum
RO TMoney UnClosedPrepaySum
RO TMoney UnClosedPriceSum
RO TMoney UnpaidSum
RO TMoney PaidSum
RO TMoney ToPaySum
RO TMoney PriceListSum
RO Int64 Duration
RO Boolean FinishedService
RO TDateTime EndService
RO TDateTime StartService
RO Integer iNationalCurrency
RO Integer iBasicCurrency
RO Integer Brigade
RO Integer MainWaiter
RO Integer UOT
RO Integer COT
RO Integer TableID
RO TDateTime OpenTime
RO Byte NumOnTable
RO Integer UVN
RO TDateTime LastService
RO TOrderFlags Flags
RO tLongSet256 SeatsFixed
RO tLongSet256 OrderGuests
RO Integer GuestsCount
RO String VisitOtherInfo
RO String VisitExtraInfo
RO Boolean UnPaid
RO String LastUser
RO String GuestType
RO Integer MainWaiterCode
RO Integer CreatorCode
RO String CreatorName
RO Integer OrderCategoryCode
RO String OrderCategory
RO Integer OrderTypeCode
RO String OrderType
RO Integer TableCode
RO String MainWaiterName
RO String OrderName
RO String TableName
RO String TableNum
RO Boolean CalcBySeats
RO Boolean CanClose
RO Boolean UnclosedReceipts
RO Boolean UnsavedExists
RO Boolean BillExists - checks if bill was printed (RKCheck.CurrentOrder.BillExists);
RO Boolean IsCalcVisit
RO Boolean UnclosedPrepays
RO Boolean Paid
RO Boolean Tarif
RO Boolean Unprinted
RO Boolean Locked
RO Boolean IsEmpty
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemState State
RO TOrderSession Sessions[i]
TOrderSessions (TCheckItemList)
properties
RO Integer Version
RO Integer iLastUser
RO TOrderFlags OrderFlags
RO Boolean BySeats
RO Integer COT
RO Integer UniCount
RO Boolean OneOrder
RO tLongSet256 SeatsClosed
RO TOrderSession Items[i]
RO TCheckItem Lines[i]
RO integer LinesCount
TPayLine (tCommonPayLine)
properties
RO Integer AddByInterface
RO Integer MInterface
RO tTransactionStatus TransactionStatus
RO TAuType AuthType
RO Integer TransactionID
RO String Owner
RO Int64 AccountIdent
RO String Track2
RO String AuthCode
RO TDateTime ExpDate
RO String CardNum
RO Integer CurrLineUNI
RO String PayPrefix
RO String AuthTypeName
RO String SeatName
RO Integer SessionUNI
RO Byte Seat
RO Integer SourcePayUNI
RO Boolean IsPrepay
RO TPayLineType PayLineType
RO TInputType InputType
RO TMoney CurrLineSum
RO String ChangeForOwnerInfo
RO String ChangeCurrency
RO Integer ChangeForCurr
RO Integer iHighLevelType
RO String PrintOwnerInfo
RO String OwnerInfo
RO String ISO
RO String CurrencyName
RO String TaxPayTypeName
RO Integer TaxPayTypeSifr
RO Integer PrintCheckUNI
RO TRate DBKurs
RO TMoney NationalSum
RO TMoney BasicSum
RO TMoney OriginalSum
RO Integer Tag
RO Boolean Modified
RO Integer iAuthor
RO Integer iCreator
RO String Name
RO Integer Code
RO Integer UNI
RO Integer Sifr
RO Integer Number
RO Boolean PartClosed
RO TDrawItemStateState
4.3.3.1. RKCheck.CurrentOrder.Visit.GuestCnt
Parameter search is made (using field ‘Parameter’ – value in this field is often in English.)
function StrParam(ParamName: string): string;
Returns string value of parameterParamName.
function IntParam(ParamName: string): integer;
Returns integer value of parameterParamName.
function BoolParam(ParamName: string): boolean;
Returns boolean value of parameterParamName.
procedure InterfaceHandlerProcessCard(InterfaceCode: integer; CardID: string);
Procedure calls interface processing with code InterfaceCode of information from the card - CardID. After processing data is put into structure CARDINFO (information about this structure is provided by request).
procedure InterfaceHandlerGetCardAddInfo(InterfaceCode: integer; CardID: string; InfoType: integer; var AddInfo: string);
Receives additional information from the card with data CardID, using interface with code InterfaceCode. AddInfo – is information, received as a result of making request. More detailed information is provided by request.
You can define your own event handlers for all components on the form. Element types and events, for that handlers can be defined, are described below.
TCheckView
Events that occur in process of CheckView editing: OnBeforeCheckViewEdit – before editing,OnAfterCheckViewEdit – after editing.
procedure OnBeforeCheckViewEdit(
Sender: TObject; // object CheckView itself
AEditType: TEditType; // type of editing
AObjectBef, // object before changing
AObjectAft: TObject; // object after editing
varAAllow: boolean; // allow changing
varAMessage: string); // error message, if changing is forbidden
procedure OnAfterCheckViewEdit(
Sender: TObject; // object CheckView itself
AEditType: TEditType; // type of editing
AObjectBef, // object before changing
AObjectAft: TObject); // object after changing
Both objects (AObjectBef, AObjectAft) are elements of TCheckItem type. You can define type, using function ObjectInheritsFrom. If editing type is etInsert (insertion), then AObjectBef = nil. If editing type is etRemove (deletion), then AObjectAft = nil.
function ObjectInheritsFrom(PersistentObject: TObject; PersistentClassName: string): boolean;
Defines, if object PersistentObject is inheritor of the class PersistentClassName.
function MenuItemBarcode(BarCode: string): boolean;
Defines, ifparameterBarCodeis a bar code of any particular dish.
function EmployeeCardCode(CardCode: string): boolean;
Defines, ifparameterCardCodeis a card code of any particular worker.
function Translate( S: String ): String;
Function makes translation of string S to current language, using translation file. It returns translated string (or current string, if translation was not found).
procedureWaiterMessage(MsgWaiter: integer; MsgText: string; ValidUntil: TDateTime);
Send message with text MsgText to worker with code MsgWaiter, ValidUntilis time, during that message is actual, for example:
WaiterMessage(10, ‘Sample Message’, NOW + DAYS(5));
It means to send message‘Sample Message’ to worker with code 10, actual time is 5 days from current moment.
function GetIntSysParameter(
ParamName: string; // parameter name
varValInt: Integer // numeric value of parameter
): Boolean; // result – if execution was successful
functionGetStrSysParameter(
ParamName: string; // parameter name
varValStr: string // string value of parameter
): Boolean; // result – if execution was successful
function GetIntOwnParameter(
ParamNum: integer; // parameter number
varValInt: Integer // numeric value of parameter
): Boolean; // result – if execution was successful
functionGetStrOwnParameter(
ParamNum: integer; // parameter number
varValStr: string // string value of parameter
): Boolean; // result – if execution was successful
function GetOrdObjectProperty(
Obj: TObject; // object
PropName: string; // property name
varValInt: Integer // numeric value of this property
): boolean; // result – if execution was successful
functionGetInt64ObjectProperty(
Obj: TObject; // object
PropName: string; // property name
varValInt64: int64 // numeric value of this property
): boolean; // result – if execution was successful
functionGetStrObjectProperty(
Obj: TObject; // object
PropName: string; // property name
varValStr: string // string value of this property
): boolean; // result – if execution was successful
// Number of elements in manual
functionRefItemCount(
ObjType: integer // object type
): integer; // result – number of elements
// Object from the manual by number
functionRefItemByNumber(
ObjType: integer; // object type
num: integer // number of this element
): TObject; // result – object TReferentItem or nil
//Find element in collection by id
functionFindRefItem(
ObjType, // object type
ItemID: integer // object identifier
): TObject; // result – object TReferentItem or nil
//Find elements by usage
function GetFilteredObject(
ft: TFilterType; // type of usage
ParentId: integer // element
): integer; // result – element identifier
// get current sessions
functionCashSessions(
): TObject; // result – object TOrderSessionsornil
// Number of elements in CheckItemList
function CheckItemCount(
List: TObject // object TCheckItemList
): integer; // result – number of elements
//Objectfrom CheckItemListby number
function CheckItemByNumber(
List: TObject; // object TCheckItemList
num: integer // element number
): TObject; // result – objectCheckItemornil
// Find in OrderSessions
function FindCheckItem(
Sessions: TObject;// list of sessions (object TOrderSessions)
ObjUNI: integer // identifier
): TObject; // result – object CheckItem or nil
// Current visit
function CurrentVisit: TObject; // result – object TVisitor nil
// Current order
function CurrentOrder: TObject; // result – object TOrder or nil
5.1.1. RK7 operations (represented on manager station in Service -> Operations) can be run from scripts. Common sytax is like this:
function PerformOperation( |
5.1.2. Some constants are created to provide easy using, they are seen in manual «Operations» as a property "Operation".
5.1.3. There are some operations, that change parameters value: functions SaveVarInt, SaveVarStr, SaveVarObj exist for such operations. So operation calling should be described like this:
var Data: integer; |
Operation | Parameter | Action |
rkoUserForm | Form number, | Opens user form with defined number |
rkoSetCurrentItem | Index | Sets position (in form of order editing) to defined element |
rkoSetInputText | String, | Defines text of entry field (order editing window) |
6.1. See details in