Thường xuyên xảy ra tình trạng cửa hàng sữa chua tự phục vụ bán theo gr. Khách hàng sau khi tự lấy sữa chua ở máy, mang ra quầy thu ngân đặt lên cân điện tử, sau khi nhân viên thu ngân bấm nút “Cân” trên phần mềm thì máy POS sẽ hiển thị trọng lượng và tổng tiền tương ứng trên màn hình hiển thị. Khách thanh toán tiền, không lấy bill và đi ra. Nhân viên thu ngân không thực hiện thanh toán thật, mà sẽ xóa món sữa chua vừa nhập vào màn hình, sau đó thoát ra ngoài. Như vậy người chủ nhà hàng đã bị thất thoát một số lượng tiền lớn do các thủ thuật tiêu cực này.
Yêu cầu của chủ nhà hàng, khi đã đặt sữa chua lên cân, nhân viên thu ngân đã bấm vào nút “Cân” thì hệ thống sẽ bắt buộc thu ngân phải tính tiền nếu không sẽ không cho nhập order mới. Việc kiểm tra được thực hiện theo cách, liệt kê các món cần kiểm soát vào một nhóm (category) và sau đó phần mềm sẽ kiểm tra tất cả các món ở trong đó.
procedure CheckOperation503377(Operation, Parameter: integer; var ValidResult, CallNextTime: boolean);
var
CategorySifr: integer;
Classification: TReferentItem;
Category: TClassificatorGroup;
DishItem: TDish;
MenuItem: TRK7MenuItem;
ClassificationCode: integer;
CategoryCode: integer;
SessionsCount : integer;
SessionsIndex : integer;
OneSession : TCheckItem;
SessionLines : TObject;
LinesCount : integer;
LinesIndex : integer;
CheckObject : TCheckItem;
CheckItem: TObject;
item_to_check: TCheckItem;
begin
//assign category and classification to check - change to your values!
ClassificationCode := 7;
CategoryCode := 12;
// additional check
if not RkCheck.Valid then
exit;
if (Operation = rkoCancelOrder) then
begin //start checking
SessionsCount := RkCheck.CheckItemCount( TObject(RkCheck.CurrentOrder.Sessions) );
for SessionsIndex := 0 to SessionsCount - 1 do
begin //cycle2 - global
OneSession := RkCheck.CheckItemByNumber( TObject(RkCheck.CurrentOrder.Sessions), SessionsIndex);
if not sys.GetObjObjectProperty( TObject(OneSession), 'Lines', SessionLines) then
continue;
LinesCount := RkCheck.CheckItemCount( SessionLines ); //count N of lines in order
for LinesIndex := 0 to LinesCount - 1 do
begin //cycle1 - for all lines in order
item_to_check := RkCheck.CheckItemByNumber( SessionLines, LinesIndex );
if not sys.ObjectInheritsFrom( TObject(item_to_check), 'TDISH') then
continue;
DishItem := TDish(item_to_check);
MenuItem := TRK7MenuItem( rk7.FindItemBySifr(rkRefMenuItems, DishItem.SIFR) );
Classification := rk7.FindItemByCode(rkRefClassificatorGroups, ClassificationCode);
CategorySifr := MenuItem.GetCategory(Classification.Ident);
if CategorySifr = 0 then
continue;
Category := TClassificatorGroup( rk7.FindItemBySifr(rkRefClassificatorGroups, CategorySifr) );
if assigned(Category) and (Category.Code = CategoryCode) then
begin
gui.ShowMessage('You can not exit without saving'); //any message text!
ValidResult:=false;
exit;
end
else
continue;
end; //end of cycle1
end; //end of cycle2
end; //finish checking
end; //end of procedure |