# 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 
					 => 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
  3) 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 Item & Order Summary Slim
	*** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf
	1) settings/print_settings
		(a) Font is present => {Header font size:11, Item Font Size:9}
		(b) Font is blank   => {Header font size:12, Item Font Size:10}
	2) settings/lookups => { type:print_settings, name:OrderSlimPdf, value:1 }
	* no need to change these files
	{ app/controllers/oqs/edit_controller.rb
	  app/controllers/oqs/print_controller.rb
	  app/models/order_queue_station.rb
	  app/models/printer/order_queue_printer.rb
	  app/models/printer/receipt_printer.rb
	}

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 OrderSetPdf options
	*** change OrderItemPdf to OrderSetItemPdf and OrderSummaryPdf to OrderSummarySetPdf
	1) settings/lookups => { type:print_settings, name:OrderSetPdf, value:1 }
	2) settings/print_settings
		(a) Font is present => {Header font size:11, Item Font Size:9}
		(b) Font is blank   => {Header font size:12, Item Font Size:10}

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 }
/* Tax Profile Group Types in lookups */

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}' }

* 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


