# README

SXRestuarant is a new Dedicate project for SmartSales Restaurant. It is improvement from v1.2 with upgrade to latest Bootstrap and Rails 5.2. The API is better define and route are refactor.

Things you may want to cover:

- Ruby version
  ruby 2.4.1p111

- Membership Details
  Osaka =>
  Auth Token => wu8YvlLmah0CL => New => v3
  => rj0MJ0XI5GsKZehE => Old => v2
  => code2lab => Old

      Merchant account => RxzaYyAGzm7VqAZ4hKnv
      Campaign Id      => {"campaign_type_id": 5}

BITP
Auth Token => pZBHXEFbGNj/G => New => V3
iua0SjUHzRaQw
=> rj0MJ0XI5GsKZehE => Old => V2
=> code2lab => Old

    Merchant account => vWSsseoZCzxd6xcNf_uS
    Campaign Id      => {"campaign_type_id": 1}

java -jar ~/Documents/Jade.jar http://192.168.1.88:3002
java -jar ~/Documents/c2l_jade.jar http://192.168.1.151:3002

Person and Extra Time
category_code = SPL... //for menu categories special

1. must create Person in settings/accounts
2. must create Adult and Child in settings/item_attributes
3. must be PSA*[a-z/0-9] for Adult and PSC*[a-z/0-9] for Child in settings/menu_categories/[cat_id]/simple_menu_items
4. must be PSAI*[a-z/0-9] for Adult and PSCI*[a-z/0-9] for Child in settings/simple_menu_items/[item_id]/menu_item_instances

For Extra Time
item_instance_code

- must start with 'Ext'[a..z]'\_'[1..100]
- note : don't add character after '\_'

For Order Printing
1)) \***\*\*\*\*** Order Pdf \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => OrderItemPdf & OrderSummaryPdf
(b) Font is present => {Header font size:11, Item Font Size:9}
Font is blank => {Header font size:12, Item Font Size:10}
2)) \***\*\*\*\*** Order Set Pdf \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => OrderSetItemPdf & OrderSummarySetPdf
(b) Font is present => {Header font size:11, Item Font Size:9}
Font is blank => {Header font size:12, Item Font Size:10}
3)) \***\*\*\*\*** Order Slim Pdf \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => OrderItemSlimPdf & OrderSummarySlimPdf
(b) Font is present => {Header font size:11, Item Font Size:9}
Font is blank => {Header font size:12, Item Font Size:10}
4)) \***\*\*\*\*** Order Customise PDF \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => OrderItemCustomisePdf & OrderSummaryCustomisePdf
(b) Can change Header font size and Item Font Size as you like
5)) \***\*\*\*\*** Order Set Pdf \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => OrderSetItemCustomisePdf & OrderSummarySetCustomisePdf
(b) Can change Header font size and Item Font Size as you like
6)) \***\*\*\*\*** Order Slim Customise PDF 1) settings/print_settings
(a) Unique Code => OrderItemSlimCustomisePdf & OrderSummarySlimCustomisePdf
(b) Can change Header font size and Item Font Size as you like
For Check in-out Printing \***\*\*\*\*** Check in-out Pdf \***\*\*\*\*** 1) settings/print_settings
(a) Unique Code => CheckInOutPdf
(b) Heading Space => 5

For ReceiptBillA5Pdf
\*\*\* change ReceiptBillPdf to ReceiptBillA5Pdf 1) settings/print_settings , width:680, height:1450, Header font Size:16, Item font size:14 2) settings/lookups => { type:print_settings, name:ReceiptBillA5Pdf, value:1 }

For ReceiptBillAltName options 1) settings/lookups => { type:print_settings, name:ReceiptBillAltName, value:1 }

For Using Star Printer
**_ Need to change these print settings 1) settings/print_settings/unique_code => OrderItemStarPdf 2) settings/print_settings/unique_code => ReceiptBillStarPdf 3) settings/print_settings/unique_code => SaleItemsStarPdf
_** Other print settings aren't need to change.

For Show Sale Items Summary at CloseCashierPrint 1) settings/print_settings
a) Check => Shift Sale Items

For Show/Hide AddOrder Button in QuickService 1) settings/lookups => {type:quickservice_add_order, name: QuickServiceAddOrder, value:1 OR 0}

For Show Print Button in ReceiptNo Report 1) settings/lookups => {type:reprint_receipt, name: Reprint Receipt in Report, value:1}

For Credit Payment Receipt Pdf and Print

1. settings/lookups => { type:credit_pdf, name: Credit Pdf, value:1 }

For Bank Integration setting

1. rake db:migrate for card_sale_trans, card_settle_trans
2. settings/lookups => { type:bank_integration, name: Bank Integration, value:1 }

For checkout time and checkout alert time

1. checkout time => { type: checkout_time, name: 9:00 AM - 12:00 PM, value: 120 }
2. checkout alert time => { type: checkout_alert_time, name: 8:00 AM - 12:00 PM, value: 60 }

- you can add multiple record for checkout time and checkout alert time
- type must be 'checkout_time' and 'checkout_alert_time'
- you can change name and value
- name must be time range [12hr => 8:30 AM - 1:45 PM, 24hr => 8:00 - 13:45]
- value must be minutes[60]

For call waiter pdf

- Backend > Printer > Print Settings > New
  i) Name : Calling Waiter
  ii) Unique Code: CallWaiterPdf
  iii)Template: ...
  iv) Font: Zawgyi-One
  v) Printer: #printer name

Membership Actions SQL \* update membership_actions set additional_parameter='{\"campaign_type_id\":5}' where id=10;

SQL Update after rake clear:data runned \* update seed_generators
i) TableBooking, Order, OrderItem, sale, SaleOrder, SaleItem, SaleTax, SalePayment, SaleAudit, AssignedOrderItem => { current:0, next:0 }
\*\* Note :: do not update Customer

Change type in mysql
\*run if you got font error for Myanmar, Chinese, etc...
=> ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table
=> ALTER DATABASE [database_name] CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database

For split bill 1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }

For Sidekiq 1) If you want to use sidekiq
=> Create New Lookups => lookup_type = sidekiq, Name = sidekiq , Value = 1 or 0

For Clear Menu 1) rake clear:menu # menu,menu item,menu category,menu item instance,account,item option,item attribute,item set

For Check CUp status
###please open
sudo cat /etc/sudoers

### cope and parse

%superuser ALL=(ALL) NOPASSWD: ALL

<---- Extra Fields Script ----->
DROP TABLE IF EXISTS `display_images`;
CREATE TABLE `display_images` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`shop_id` int(11) DEFAULT NULL,
`image` blob,
`created_by` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE customers
ADD COLUMN image_path VARCHAR(255);

ALTER TABLE employees
ADD COLUMN image_path VARCHAR(255);

ALTER TABLE commissioners
ADD COLUMN image_path VARCHAR(255);

ALTER TABLE sales
ADD COLUMN equal_persons INT(11) after rebate_status;

ALTER TABLE sale_items
ADD COLUMN remark VARCHAR(255) after status;

ALTER TABLE shops
ADD COLUMN shop_code VARCHAR(255) after name,
ADD COLUMN client_name VARCHAR(255) after shop_code,
ADD COLUMN client_code VARCHAR(255) after client_name;

ALTER TABLE print_settings
ADD COLUMN brand_name VARCHAR(255) after api_settings,
ADD COLUMN type VARCHAR(255) after brand_name;

ALTER TABLE tax_profiles
ADD COLUMN group_type VARCHAR(255) after name;

<---- Extra Fields Script ----->
For CloseCashierCustomisePdf in lookups
\*\*\* change CloseCashierPdf to CloseCashierCustomisePdf 1) settings/print_settings 2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }

<---- Extra Fields Script ----->
For MoveTablePdf in lookups
**_ Both Table and Room Moving _** 1) settings/lookups => { type:print_settings, name: MoveTablePdf, value:1 }

For MoveTablePdf in print settings \* Backend > Printer > Print Settings > New
i) Name : Move Table
ii) Unique Code: MoveTablePdf
iii)Template: ...
iv) Font: Zawgyi-One v) Printer: #printer name

/_ Tax Profile Group Types in lookups _/

1. settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
2. settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
3. settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
4. settings/lookups => { type:tax*profiles, name: Food Court, value: food_court }
   /* Tax Profile Group Types in lookups \_/

/_Receipt Pdf View in lookups _/

1. settings/lookups => { type:ReceiptPdfView, name: Receipt Pdf View, value:1 or 0 }
   => 1 is active and 0 is in-active

Add Kitchen Role of Employee
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }

Add Base URL for DOEMAL 1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' } 2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }

Add Feature for Dine-in Cashier
** '0' means can not use dine-in cashier and '1' means can use dine-in cashier **
=> settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' }

Add Feature for Quick Service
** '0' means can not use quick service and '1' means can use quick service **
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }

Add Feature for Order and Reservation
** '0' means can not use order reservation and '1' means can use order reservation **
=> settings/lookups => { type:order_reservation, name: OrderReservation, value:'{0 or 1}' }

For Price 0 in receipt bill 2) settings/lookups => { type:show_price, name:Show Price, value:1 }

For Price 0 in receipt bill 2) settings/lookups => { type:order_by, name:Order By, value:name }

For Aston Request => Gift Voucher 1) settings/payment_method_settings => {payment_method:'GiftVoucher', is_active:true, ...}

For Login expiry time 1) settings/lookups => {type:expity_time, name:login, value: {minutes}} \* value should be minute only (30 / 60 / 120 / etc.)

Menu Image (Import guideline)

    => First, check shop_code, is there in shops table and prefix shop_code in image name?
    => You all must do this step
    	* If there is shop_code in shops table (mark in one place/ note and set NULL for this record for a while) and prefix shop_code for image name (like (121_ABC.png)), and copy and paste images into Application/[sxrestaurant]/public/image/menu_images.
    	* If there is shop_code/ no shop_code in shops table but no prefix in image name (* skip set NULL step) , copy and paste images into Application/…./image/menu_images.
    => Second, import [menu].xlsx file in /settings/menus and then checked image is uploaded into Application/[sxrestaurant]/public/image/menu_images and insert into menu_items table in database.
    => Last, if shop has shop_code, update marked/noted shop_code into shops table again.

For Edit Order Open & Close 1) settings/lookups => {type:edit_order, name:EditOrderOrigami, value: {1 or 0}}

For Dashboard Settings for supervisor and cashier 1) settings/lookups => {type:dashboard_settings, name:supervisor, value: {1 or 0}} 2) settings/lookups => {type:dashboard_settings, name:cashier, value: {1 or 0}}

For Customer Settings On/Off 1) settings/lookups => {type:customer_settings, name:create, value: {1 or 0}}

For TaxProfiles On/Off 1) settings/lookups => {type:changable_tax, name:change, value: {1 or 0}}

For Add Kitchen Role 1) settings/lookups => {type:employee_roles, name:Kitchen, value:kitchen}

For Food Court Settings On/Off
** '0' means can not use food court and '1' means can use food court **
=> settings/lookups => { type:food_court, name: FoodCourt, value:'{0 or 1}' }

For Number Formats
Precision
=> settings/lookups => { lookup_type: number_format, name: precision, value: {0..2} }
Delimiter
=> settings/lookups => { lookup_type: number_format, name: delimiter, value: { ',', '\u0020', '', ... }
Strip insignificant zeros
=> settings/lookups => { lookup_type: number_format, name: strip_insignificant_zeros,
value: {true: => ['1', 't', 'true', 'on', 'y', 'yes'], false: => ['0', 'f', 'false', 'off', 'n', 'no', ...] }

For Booking checkin time limit
settings/lookups =>
{ lookup_type: checkin_time_limit, name: CheckinTimeLimit, value: total hours before checkout (e.g., '48')) }

/_ Customer Types in lookups _/

1. settings/lookups => { type:customer_type, name: Dinein, value:Dinein }
2. settings/lookups => { type:customer_type, name: Takeaway, value: Takeaway }
3. settings/lookups => { type:customer_type, name: Doemal, value: Doemal }
4. settings/lookups => { type:customer*type, name: FoodCourt, value: FoodCourt }
   /* Tax Profile Group Types in lookups \_/

For Online Order Receipt Setting

1. settings/lookups => { type:order_reservation, name:ReceiptBill, value: {0 or 1} }
2. settings/print_settings => {name: ReceiptBillOrder, unique_code: ReceiptBillOrderPdf, ....}

For Close Cashier Print Settings
settings/lookups => {type:close_cashier_print, name:CloseCashierPrint, value: {0 or 1} }

For Second Display View Setting
settings/lookups => {type:display_type, name: Display Type, value: 2}

For show total before tax in receipt bill
settings/lookups => {type:show_total_before_tax, name:Show Total Before Tax, value: {0 or 1}}

For Using Staff Meal
settings/lookups => { type:customer_type, name: Staff, value:Staff }

For FoodCourt Cashier role
settings/lookups => { type:employee_roles, name: FoodCourt Cashier, value:foodcourt_cashier }


* ToDo list

1. Migration
2. Quick Service
3. Order & Reservation

- System Dependencies

- Configuration

- Database creation

- Database initialization

- How to run the test suite

- Services (job queues, cache servers, search engines, etc.)

- Deployment instructions

* Features

1. OQS

   1. Filter
   2. Order Item to each Stations
   3. Edit Order Item

2. Origami(Sale)

   1. Sale
   2. Add Customer for membership
   3. Discount and Member Discount for Sale
   4. Assign Commissioner
   5. Add other charges to Sale

3. CRM

   1. Customer Management

   2. Queue Management

4. Backend

   1. Dining Setup

   2. Queue Station Setup

   3. Menu Setup

   4. Cashier Terminal Setup

   5. Tax Profile Setup

   6. Printer Setup

   7. Payment Integration

   8. Employee Management

   9. Promotion Setup

   10. Commissioner Setup

   11. Membership Integration

5) Inventory

6. Report

- UI Standard

1. Layout

   1. 2-Column => Main Content - col-9, Information - col-3
   2. 3-Column => Sub Lint - col-2, Main Content - col-7, Information - col-3

   > Pixel

   Main Header Bar - height => 50 px
   Side Navigation - Weight => 230 px
   Main Content Padding => 15 px

2. Color

   > BUTTON

   1. Submit/Add/Edit/Confirm buttons => btn-primary (theme color)
   2. Show/Detail Buttons => btn-info
   3. Delete => btn-delete
   4. Cancel/Back => btn-default
