Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2017-06-14 15:59:52 +06:30
12 changed files with 39 additions and 12 deletions

View File

@@ -42,7 +42,7 @@ gem 'to_xls-rails'
#Reporting gem
#gem 'compendium'
#gem "cancan"
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'

View File

@@ -10,9 +10,13 @@ class HomeController < ApplicationController
@login_form.emp_id = params[:login_form][:emp_id]
@login_form.password = params[:login_form][:password]
@employee = Employee.login(@login_form.emp_id, @login_form.password)
if @employee
puts @employee.role
if @employee.role == "administrator"
session[:session_token] = @employee.token_session
redirect_to dashboard_path
elsif @employee.role == "cashier"
session[:session_token] = @employee.token_session
redirect_to origami_root_path
else
render :index
end

View File

@@ -19,6 +19,7 @@ class Origami::PaymentsController < BaseOrigamiController
if Sale.exists?(sale_id)
@cash = 0.0
@other = 0.0
@ppamount = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
#get customer amount
@@ -55,8 +56,10 @@ class Origami::PaymentsController < BaseOrigamiController
if spay.payment_method == "cash"
@cash = spay.payment_amount
end
if spay.payment_method == "mpu" || spay.payment_method == "paypar"
if spay.payment_method == "mpu"
@other += spay.payment_amount
elsif spay.payment_method == "paypar"
@ppamount += spay.payment_amount
end
end
end

View File

@@ -123,7 +123,7 @@ $(document).on('click', '.cashier_number', function(event){
$('#jcb_pay').on('click',function(){
var amount = $('#amount').val();
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
$.ajax({type: "POST",

View File

@@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){
}
});
$('#master_pay').on('click',function(){
var amount = $('#amount').val();
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
$.ajax({type: "POST",

View File

@@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){
}
});
$('#mpu_pay').on('click',function(){
var amount = $('#amount').val();
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
$.ajax({type: "POST",

View File

@@ -102,8 +102,24 @@
</div>
<hr>
<div class="row" id="card_payment">
<div class="col-md-8">Others Payment</div>
<div class="col-md-4" id="others"><%= @other %></div>
<div class="container">
<% if @other != 0.0 %>
<div class="row">
<div class="col-md-8">MPU</div>
<div class="col-md-4" id="others"><%= @other %></div>
</div>
<% elsif @ppamount != 0.0 %>
<div class="row">
<div class="col-md-8">Paypar</div>
<div class="col-md-4" id="others"><%= @ppamount %></div>
</div>
<% else %>
<div class="row">
<div class="col-md-8">Others Payment</div>
<div class="col-md-4" id="others"><%= @ppamount %></div>
</div>
<% end %>
</div>
</div>
<hr>
<div class="row">

View File

@@ -120,7 +120,7 @@ $(document).on('click', '.cashier_number', function(event){
}
});
$('#visa_pay').on('click',function(){
var amount = $('#amount').val();
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
$.ajax({type: "POST",

View File

@@ -116,6 +116,7 @@
<tr>
<!-- <th>Menu Item Id</th> -->
<th>item_instance_code</th>
<th>item_instance_name</th>
<th>item_attributes</th>
<th>price</th>
<th>is_on_promotion</th>
@@ -131,6 +132,7 @@
<tr>
<!-- <td><%= settings_menu_item.menu_item_id %></td> -->
<td><%= settings_menu_item.item_instance_code %></td>
<td><%= settings_menu_item.item_instance_name %></td>
<td><%= settings_menu_item.item_attributes %></td>
<td><%= settings_menu_item.price %></td>
<td><%= settings_menu_item.is_on_promotion %></td>

View File

@@ -122,6 +122,7 @@
<tr>
<!-- <th>Menu Item Id</th> -->
<th>item_instance_code</th>
<th>Instances Name</th>
<th>item_attributes</th>
<th>price</th>
<th>is_on_promotion</th>
@@ -138,6 +139,7 @@
<tr>
<td><%= settings_menu_item.item_instance_code %></td>
<td><%= settings_menu_item.item_instance_name %></td>
<td><%= settings_menu_item.item_attributes %></td>
<td><%= settings_menu_item.price %></td>
<td><%= settings_menu_item.is_on_promotion %></td>

View File

@@ -91,7 +91,7 @@ Rails.application.routes.draw do
post 'payment/mpu' => "mpu#create"
post 'payment/jcb' => "jcb#create"
post 'payment/master' => "master#create"
post 'payment/visa' => "master#visa"
post 'payment/visa' => "visa#create"
post 'payment/paypar' => 'paypar_payments#create'
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"

View File

@@ -136,8 +136,8 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o
#Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter", role: "Waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"})
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})