update add order

This commit is contained in:
Aung Myo
2017-08-17 09:54:19 +06:30
202 changed files with 7514 additions and 2844 deletions

View File

@@ -1,117 +1,177 @@
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="ta" style="max-height:550px; overflow:auto">
<ul class="nav nav-tabs flex-column" role="tablist" >
<% @menu.each do |menu| %>
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
</li>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2">
<ul class="nav nav-tabs flex-column" role="tablist" >
<% @menu.each do |menu| %>
<li class="nav-item menu_category" data-ref="<%= api_restaurant_menu_category_path menu.id%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%></a>
</li>
<% end %>
</ul>
</div>
</div>
<div class="col-md-6 col-lg-6">
<div class="card-columns menu_items_list" style="column-gap: 10px;">
<!-- append data -->
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<div class="card-header">
<div><strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%></div>
<div class="col-md-7 col-lg-7 col-sm-7">
<div class="card-columns menu_items_list" style="column-gap: 10px;">
<!-- append data -->
</div>
</div>
<div class="card-block">
<div class="card-text" style="min-height:500px; max-height:500px; overflow:auto">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td class='item-name'>aaaaa x2</td>
<td class='item-attr'>name</td>
</tr>
<div class="col-md-3 col-lg-3 col-sm-3">
<div class="card-header">
<div>
<strong id="order-title">ORDER DETAILS </strong> | Table <%=@table_id%>
</div>
</div>
<div class="card-block">
<div class="card-text" style="min-height:500px; max-height:500px; overflow:auto">
<table class="table table-striped summary-items">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-qty">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total">22222</strong></td>
</tr>
</table>
</div>
</div>
</div>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total">22222</strong></td>
</tr>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$(".menu_category").on("click", function(){
var menu_id = $(this).find(".menu-id").text();
var url = $(this).attr('data-ref');
show_details(url);
}); //End Booking Click
$(".menu_category").on("click", function(){
var menu_id = $(this).find(".menu-id").text();
var url = $(this).attr('data-ref');
show_menu_item_list(url);
}); //End menu category Click
function show_details(url_item){
var menu_list = $('.menu_items_list');
// menu_list.empty();
// var row = '';
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
function show_menu_item_list(url_item){
menu_items = data.menu_items;
var menu_list = $('.menu_items_list');
menu_list.empty();
for(var field in menu_items) {
if (menu_items[field].item_instances){
console.log(menu_items[field].item_instances[0]);
var price = parseFloat(menu_items[field].item_instances[0].price).toFixed(2);
}else{
var price = parseFloat(menu_items[field].price).toFixed(2);
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
for(var field in menu_items) {
if (menu_items[field].item_instances){
var price = parseFloat(menu_items[field].item_instances[1].price).toFixed(2);
var is_available = menu_items[field].item_instances[1].is_available
var is_on_promotion = menu_items[field].item_instances[1].is_on_promotion
var item_attributes = menu_items[field].item_instances[1].item_attributes
var item_instance_code = menu_items[field].item_instances[1].item_instance_item_code
var item_instance_name = menu_items[field].item_instances[1].item_instance_name
var promotion_price = menu_items[field].item_instances[1].promotion_price
}else{
var price = parseFloat(menu_items[field].price).toFixed(2);
var is_available = menu_items[field].is_available
var is_on_promotion = menu_items[field].is_on_promotion
var item_attributes = menu_items[field].item_attributes
var item_instance_code = menu_items[field].item_instance_item_code
var item_instance_name = menu_items[field].item_instance_name
var promotion_price = menu_items[field].promotion_price
}
row = '<div class="card">'
+'<div class="card-head" style="line-height:14px;">'
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
+'<div class="col-md-3 add_icon"'
+'data-id="'+ menu_items[field].name +'"'
+'data-item-code="'+ menu_items[field].item_code +'"'
+'data-name="'+ menu_items[field].name +'"'
+'data-price="'+ price +'"'
+'data-available="'+ is_available +'"'
+'data-promotion="'+ is_on_promotion +'"'
+'data-attributes="'+ item_attributes +'"'
+'data-instance-code="'+ item_instance_code +'"'
+'data-instance="'+ item_instance_name +'"'
+'data-promotion-price="'+ promotion_price +'"'
+'>'
+'<i class="fa fa-plus "'
+ 'style="margin-top:4px;">'
+'</i></div>'
+'</div>'
+'<div class="card-block">'
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
+'</div>'
+'<div class="card-footer">'
+'<small>'+ price +'</small>'
+'</div>';
$('.menu_items_list').append(row);
}
row = '<div class="card">'
+'<div class="card-head" style="line-height:14px;">'
+'<small>'+ menu_items[field].name +'</small>'
+'</div>'
}
});
//end Ajax
}
//end show detail function
+'<div class="card-block">'
+'<%= image_tag "logo.png" ,width: '75', height: '75', :style => '' %>'
+'</div>'
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
show_item_detail(item_data);
}); //End Add Icon Click
function show_item_detail(data){
price = data.attr('data-price');
if (data.attr('data-qty') === undefined){
qty = 1;
}else{
qty = data.attr('data-qty');
}
if (data.attr('data-instance') == "undefined"){
instance = '';
}else{
instance = data.attr('data-instance');
}
var rowCount = $('.summary-items tbody');
console.log(rowCount);
for(var field in rowCount) {
// console.log(rowCount[field].attr('data-code'));
}
row ='<tr>'
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" data-code='+data.attr('data-item-code')+'>' + data.attr('data-name')+ ' ' + instance + '</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(price).toFixed(2)
+'</td>'
+'</tr>';
$(".summary-items tbody").append(row);
}
+'<div class="card-footer">'
+'<small>'+ price +'</small>'
+'</div>';
$('.menu_items_list').append(row);
}
}
});
//end Ajax
}
});
</script>
@@ -156,6 +216,25 @@ function show_details(url_item){
column-count: 4;
}
}
.nav-tabs .nav-item {
border-bottom: 1px solid #fff;
border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;
}
.nav > li > a{
color:#54A5AF;
}
.nav-tabs {
background-color: #eeeeee;
}
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
background-color: #fff;
border-left: 6px solid #111;
color:#54A5AF;
font-weight: bold;
border-color: #fff #fff #fff #54A5AF;
}
</style>

View File

@@ -1,7 +1,7 @@
<div class='row'>
<div class="col-lg-11 col-md-11 col-sm-11">
<h2> Payment Credit </h2>
<h2> Cash In </h2>
<br>
<table class='table table-striped'>
<tr>

View File

@@ -2,7 +2,7 @@
<div class='row'>
<div class="col-lg-11 col-md-11 col-sm-11">
<h2>Payment Debit</h2>
<h2>Cash Out</h2>
<table class='table table-striped'>
<tr>
<td> Payment Reference

View File

@@ -81,23 +81,7 @@
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<label>Salutation :</label><br>
<label>Mr</label>
@@ -176,6 +160,37 @@
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
<div class="form-group">
<label>Select Customer Type</label>
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %></option>
<%end %>
</select>
</div>
<div class="form-group">
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :card_no, :class => "form-control col-md-6 card_no"%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block" style="margin-top:-10px"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Paypar Account No:</label>
<div class="input-group">
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
</div>
</div>
<div class="form-group">
<label>Select Member Group</label>
<select class="selectpicker form-control col-md-12" name="member_group_id">
@@ -216,17 +231,21 @@
$('.datepicker').css('cursor','pointer');
// Read Card Reader
$("#paypar_account_no").on('focus', function(e){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
},100);
$("#paypar_account_no").on('focus', function(e){
if($(this).val() == ''){
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
},100);
}
});
// Read Card Reader
$("#member_acc_no").on('click', function(e){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var sale_id = $("#sale_id").val() || 0;
var customer_mamber_card_no = 0;
$("#sxModal").show();
@@ -235,8 +254,18 @@
$("#sxModal").hide();
customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
update_sale(customer_mamber_card_no,sale_id);
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "get_customer" ,
data: { filter : customer_mamber_card_no },
dataType: "json",
success: function(data) {
customer_id = data[0].customer_id;
customer_name = data[0].name;
update_sale(customer_id, customer_name,sale_id);
}
});
}
},100);
});
@@ -261,10 +290,11 @@
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).attr('data-ref');
var customer_name = $(this).children("td:nth-child(3)").text();
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id,sale_id);
update_sale(customer_id, customer_name,sale_id);
}else{
var url = "customers/"+customer_id;
@@ -277,6 +307,12 @@
data: {},
dataType: "json",
success: function(data) {
var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes);
$.each(parse_taxes, function(i, value){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
});
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
@@ -286,7 +322,8 @@
$('#customer_membership_type').val(data.membership_type);
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code);
$('#customer_card_no').val(data.card_no);
$('#customer_type').val(data.customer_type);
$('#customer_salutation').val(data.salutation);
$('#customer_nrc_no').val(data.nrc_no);
$('#paypar_account_no').val(data.paypar_account_no);
@@ -325,10 +362,15 @@
// }
})
function update_sale(customer_id,sale_id) {
function update_sale(customer_id, customer_name, sale_id) {
var customer="";
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer!',
content: 'Are You Sure to assign this customer' + customer + '!',
buttons: {
cancel: function () {

View File

@@ -108,8 +108,17 @@
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
<!-- Temporary Disabled -->
<!-- <button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Sammary</button> -->
<%if current_login_employee.role == "cashier" && @shop.quick_sale_summary == true%>
<button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Summary</button>
<%end%>
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
<%if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
<button id="back" type="button" class="btn btn-block btn-primary"><i class="fa fa-home fa-lg"></i> Back
</button>
<%end%>
</div>
</div>
<!-- Column One -->
@@ -218,4 +227,7 @@ $('#cash_out').on('click',function(){
$('#close_cashier').on('click',function(){
window.location.href = '/origami/shift/close';
})
$('#back').on('click',function(){
window.location.href = '/dashboard';
})
</script>

View File

@@ -20,7 +20,6 @@
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content">
<!--- Panel 0 - Completed Orders -->
@@ -133,6 +132,7 @@
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span></p>
</div>
@@ -144,7 +144,10 @@
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
<p>Customer : <%= @sale_array[0].customer.name rescue '' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<%end%>
@@ -305,9 +308,7 @@
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
<% if @dining.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" id="add_order" class="btn btn-primary btn-block" >Add Order</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
@@ -317,7 +318,6 @@
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
<button type="button" id="add_order" class="btn btn-primary btn-block">Add Order</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
@@ -453,15 +453,16 @@ $("#first_bill").on('click', function(){
$('#pay').on('click',function() {
var sale_id = $('#sale_id').val();
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
});
});

View File

@@ -0,0 +1,2 @@
json.status true
json.get_type @get_type

View File

@@ -2,7 +2,7 @@
<div class="col-lg-11col-md-11 col-sm-11">
<div >
<div >
<% @payment_method_setting.each do |payment_method|%>
<% @payment_method_setting.where("is_active = true").each do |payment_method|%>
<div class="purple others-payment bottom left" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
<% end %>
</div>

View File

@@ -41,24 +41,24 @@
<% sub_total = 0
count = 0
%>
<% @sale_data.sale_items.each do |sale_item|
<% @sale_data.sale_items.each do |sale_item|
count += 1
%>
<% sub_total += sale_item.price%>
<tr>
<% sub_total += sale_item.price%>
<tr>
<td><%= count %></td>
<td style="width:60%; text-align:left">
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"><%=sale_item.qty%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"><%=(sale_item.price)%></span>
</td>
</tr>
<%end %>
<td style="width:60%; text-align:left">
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-qty"><%=sale_item.qty%></span>
</td>
<td style="width:20%; text-align:right">
<span id="item-total-price"><%=(sale_item.price)%></span>
</td>
</tr>
<%end %>
</tbody>
</table>
</div>
@@ -75,7 +75,7 @@
<%else%>
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
<%end%>
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
</tr>
<tr>
@@ -258,7 +258,7 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
<button type="button" class="btn btn-primary btn-block"> FOC </button>
<button type="button" class="btn btn-primary btn-block" id="foc"> FOC </button>
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
</div>
@@ -443,4 +443,40 @@ function update_balance(){
$('#balance').text(result.toFixed(2));
}
$('#foc').click(function() {
$( "#loading_wrapper" ).show();
// payment
var cash = $('#amount_due').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
$.ajax({type: "POST",
url: "<%= origami_payment_foc_path %>",
data: params,
success:function(result){
$( "#loading_wrapper" ).hide();
if (cash > 0) {
$.confirm({
title: 'Infomation!',
content: 'Thank you !',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami';
}
}
}
});
}
}
});
});
</script>

View File

@@ -26,9 +26,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -32,12 +32,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -119,9 +119,9 @@
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<% if @status == 'order' %>
<div id="save_order_id" data-order="<%= @obj.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% elsif @status == 'sale' %>
<% if @status_order == 'order' %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @room.name rescue "" %></div>
<% end %>
@@ -130,21 +130,25 @@
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p> Receipt No: <span id="receipt_no">
<% if @status == 'sale' %>
<%= @obj.receipt_no rescue '' %>
<% if @status_sale == 'sale' %>
<%= @obj_sale.receipt_no rescue '' %>
<% end %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date: <span id="receipt_date"><%= @obj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
<p>Date: <span id="receipt_date"><%= @obj_sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<%if @customer %>
<p class="hidden customer-id"><%= @customer.customer_id %></p>
<p>Customer : <%= @customer.name %></p>
<%end%>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @obj_sale_sale.customer_id rescue '' %></p>
<p>Customer : <%= @obj_sale_sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>
@@ -152,6 +156,7 @@
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th></th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</td>
<th class="item-attr">Price</td>
@@ -159,35 +164,48 @@
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status == "sale"
@obj.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj.sale_id %>">
<% unless sale_item.price == 0 %>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
count += 1
%>
<tr>
<td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<%
end
end
end
end
if @status == 'order'
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
unless order_item.price == 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
end
@@ -203,77 +221,78 @@
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<tr>
<%if @obj != nil && @status_sale == 'sale' && @obj.discount_type == 'member_discount'%>
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%=@obj.total_discount rescue 0%>)</strong></td>
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr>
<% if @status == "sale" %>
<% if @status_sale == "sale" %>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj.total_tax rescue 0%></strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj.rounding_adjustment rescue 0%></strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj.grand_total rescue 0%></strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
</tr>
<% end %>
<tr class="rebate_amount"></tr>
</table>
</div>
<br>
<%
if @status == 'sale'
unless @order_items.nil?
%>
Pending New Order
<table class="table table-striped">
<%
count = 0
@order_items.each do |order_item |
count += 1
%>
<tr>
<td><%= count %>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
<%
if @status_sale == 'sale'
unless @order_items.nil?
%>
Pending New Order
<table class="table table-striped">
<%
count = 0
@order_items.each do |order_item |
count += 1
%>
</table>
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
<% end %>
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
%>
<tr>
<td><%= count %>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
%>
</table>
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
<% end %>
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
%>
</div>
</div>
@@ -284,12 +303,13 @@
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<% if @room.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status == 'order' && @status != 'sale' %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn btn-primary btn-block" >Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
@@ -297,8 +317,10 @@
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
<% else %>
<!-- <button type="button" class="btn btn-primary btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
@@ -424,6 +446,25 @@ $(document).ready(function(){
return false;
});
// Add Other Charges
$('#other-charges').click(function() {
var sale = $('#sale_id').val();
if (sale!="") {
var sale_id = sale
}else{
var sale_id = $('#save_order_id').attr('data-order');
}
if(sale_id!=""){
window.location.href = '/origami/' + sale_id + '/other_charges'
}
else {
alert("Please select an table!");
}
return false;
});
});
// Print for first bill
@@ -494,7 +535,7 @@ $('#back').on('click',function(){
$('#add_invoice').on('click',function(){
var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj.sale_id rescue "" %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
@@ -577,7 +618,7 @@ $('#add_invoice').on('click',function(){
$('#edit').on('click',function(){
var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj.sale_id rescue "" %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
});

View File

@@ -1,216 +1,235 @@
<div class="row">
<!-- Column Two -->
<!-- Column Two -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong></div>
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p> Receipt No: <span id="receipt_no">
<div class="card">
<div class="card-header">
<div><strong id="order-title">INVOICE DETAILS </strong></div>
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p> Receipt No: <span id="receipt_no">
<%= @saleobj.receipt_no rescue '' %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date:
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
</p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
<table class="table " id="order-items-table">
<thead>
<tr>
<th width="4%">#</th>
<th class="" width="30%">Items</th>
<th style="" width="13%">QTY</td>
<th class="" width="13%">Price</td>
<!-- <th class='' width="17%"> Total </th> -->
<th class='' width="17%"> Action </th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
@saleobj.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
</div>
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
<table class="table " id="order-items-table">
<thead>
<tr>
<th width="4%">#</th>
<th class="" width="30%">Items</th>
<th style="" width="13%">QTY
</td>
<th class="" width="13%">Price
</td>
<!-- <th class='' width="17%"> Total </th> -->
<th class='' width="17%"> Action</th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
@saleobj.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
%>
<tr>
<td width="4%"><%= count %></td>
<td class='' width="30%">
<%= sale_item.product_name %>
</td>
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
<td class='' width="13%">
<input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
</td>
<td class='' width="13%">
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
</td>
<!-- <td class='' width="17%">
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
<tr>
<td width="4%"><%= count %></td>
<td class='' width="30%">
<%= sale_item.product_name %>
</td>
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
<td class='' width="13%">
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
</td>
<td class='' width="13%">
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
</td>
<!-- <td class='' width="17%">
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
</td> -->
<td class='' width="17%">
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update
</button>
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
</td>
<td class='' width="17%">
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update</button>
<button data-id="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
<button data-id="<%= sale_item.id %>" class='btn btn-info btn-md foc'>FOC</button>
</td>
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
</td>
<!-- <td class='' width="17%">
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
</td>
<!-- <td class='' width="17%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td> -->
<td class='' width="17%">
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel Void/Update</button>
</td>
<% else %>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td>
<td></td>
<% end %>
</tr>
<%
end
end
%>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<tr class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
<td class='' width="17%">
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel
Void/Update
</button>
</td>
<% else %>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td>
<td></td>
<% end %>
</tr>
<%
end
end
%>
</tbody>
</table>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<tr class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void' >Cancel All Void</button>
<button type="button" class="btn btn-primary btn-block" id='apply' >Apply</button>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void'>Cancel All Void</button>
<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>
</div>
</div>
<script>
// Bill Request
$(document).ready(function(){
$(".update").on('click',function() {
var sale_item_id = $(this).attr('data-id');
var qty = $('#'+sale_item_id + "_qty").val();
var price = $('#'+ sale_item_id + "_price").val();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
success:function(result){
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
// Bill Request
$(document).ready(function () {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function(){
location.reload();
$(".update").on('click', function () {
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
success: function (result) {
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function () {
location.reload();
}
}
}
});
}
});
});
$('.void').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.foc').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_foc";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.cancel').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
})
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/' + table_id;
})
$('#cancel_all_void').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
location.reload();
}
}
}
});
});
})
}
});
});
$('.void').on('click',function(){
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id,
success:function(result){
location.reload();
}
});
})
$('.cancel').on('click',function(){
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id,
success:function(result){
location.reload();
}
});
})
})
$('#back').on('click',function(){
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/'+ table_id;
})
$('#cancel_all_void').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
location.reload();
}
});
})
$('#apply').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
window.location.href = '/origami/table/'+ table_id ;
}
});
})
$('#apply').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
window.location.href = '/origami/table/' + table_id;
}
});
})
</script>

View File

@@ -120,9 +120,11 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<p>Customer : <%= @sale.customer.name rescue "-" %></p>
</div>
</div>

View File

@@ -0,0 +1,201 @@
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10">
<h3 style="text-align: center;">Sales Summary Quick View </h3>
<table class="table table-striped">
<tbody>
<tr>
<th>Cashier </th>
<th>Cashier Terminal </th>
<th>Opening Date </th>
<th>Opening float </th>
<th>Received Amount </th>
<th>Cast In </th>
<th>Cast Out </th>
<th>Total Receipt </th>
<th>Dining Count </th>
<th>Takeaway Count </th>
<th>Total Void</th>
</tr>
<tr style="border-bottom:2px solid #000">
<td><%= @shift.employee.name%></td>
<td><%=@shift.cashier_terminal.name%></td>
<td><%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %>
</td>
<td><%=@shift.opening_balance %></td>
<td><%=@shift.closing_balance %></td>
<td><%=@shift.cash_in %></td>
<td><%=@shift.cash_out %></td>
<th><%= @shift.total_receipt %></th>
<th><%= @shift.dining_count %></th>
<th><%= @shift.takeaway_count %></th>
<th>(<%= @shift.total_void.round(2) %>)</th>
</tr>
<tr>
<td colspan="5">
<table width="100%">
<% @total_amount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Amount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Net Sales</th>
<th><%=@shift.nett_sales %></th>
</tr>
<% @total_discount_by_account.each do |amount| %>
<tr>
<th></th>
<td style="text-align: right;"> Total <%= amount.account_name %> Discount</td>
<td><%= amount.total_price.round(2) %></td>
</tr>
<%end%>
<% if !@total_member_discount[0].member_discount.nil?
@member_discount = @total_member_discount[0].member_discount rescue 0.0
@overall = @shift.total_discounts - @member_discount
%>
<tr>
<th></th>
<th style="text-align: right;"> Total Member Discount</th>
<th><%= @member_discount %></th>
</tr>
<%else @overall = @shift.total_discounts %>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Overall Discount</th>
<th><%= @overall %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Total Discount</th>
<th><%= @shift.total_discounts %></th>
</tr>
<% @sale_taxes.each do |tax| %>
<tr>
<th></th>
<td style="text-align: right;"> <%= tax.tax_name %> </td>
<td><%= tax.st_amount.round(2) %></td>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;"> Total Tax </th>
<th><%=@shift.total_taxes %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Rounding Adj </th>
<th><%= @shift.total_rounding.round(2) %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;"> Grand Total </th>
<th><%= @shift.grand_total.round(2) %></th>
</tr>
</table>
</td>
<td colspan="6">
<table width="100%">
<tr>
<th></th>
<th style="text-align: right;">Cash Payment </th>
<th><%=@shift.cash_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Credit Payment </th>
<th><%=@shift.credit_sales %></th>
</tr>
<% @total_amount = 0
@other_payment.each do |other| %>
<tr>
<th></th>
<th style="text-align: right;">Other Payment Detail </th>
<th></th>
</tr>
<tr>
<th></th>
<td style="text-align: right;">MPU Payment </td>
<td><%=other.mpu_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.mpu_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">VISA Payment </td>
<td><%=other.visa_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.visa_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">JCB Payment </td>
<td><%=other.master_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.master_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Master Payment </td>
<td><%=other.jcb_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;">Reedem Payment </td>
<td><%=other.paypar_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.paypar_amount rescue 0.0 %>
</tr>
<tr>
<th></th>
<td style="text-align: right;"><strong>FOC </strong></td>
<td><%=other.foc_amount.round(2) rescue 0.0 %></td>
<% @total_amount = @total_amount+other.foc_amount rescue 0.0 %>
</tr>
<%end%>
<tr>
<th></th>
<th style="text-align: right;">Total Other Payment </th>
<th><%=@shift.other_sales %></th>
</tr>
<tr>
<th></th>
<th style="text-align: right;">Total Payment </th>
<th><%= @total_amount+@shift.cash_sales+@shift.credit_sales %></th>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<br><br><br>
<button id="close_cashier" type="button" class="btn btn-block btn-primary btn-lg"> Close Cashier
</button>
<button id="back" type="button" class="btn btn-block btn-primary btn-lg"><i class="fa fa-home fa-lg"></i> Back
</button>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#close_cashier').on('click',function(){
window.location.href = '/origami/shift/close';
})
$('#back').on('click',function(){
window.location.href = '/origami';
})
})
</script>

View File

@@ -26,9 +26,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -32,12 +32,15 @@
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="card-title row customer_detail">
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- <% if !@customer.nil? %> -->
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "" %></p>
<!-- <% end %> -->
<% if @status_sale == 'sale' %>
<p class="hidden customer-id"><%= @sale.customer_id rescue '' %></p>
<p>Customer : <%= @sale.customer.name rescue '-' %></p>
<%else%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p>Customer : <%= @customer.name rescue "-" %></p>
<%end%>
</div>
</div>

View File

@@ -0,0 +1,5 @@
if(@status)
json.status @status
else
json.status false
end

View File

@@ -0,0 +1,179 @@
<div class="row">
<div class="col-lg-5 col-md-5 col-sm-3">
<div class="row">
<div class="col-md-6">
<h2>Voucher / Coupon</h2>
</div>
</div>
<div class="card" style="margin-top:10px;padding-top:20px;">
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">You can pay up to </label>
<input type="text" name="validamount" id="validamount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@can_voucher %>" data-member-value="">
</div>
<hr>
</div>
<% if @vouchercount != 0 %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Recent Voucher paid amount </label>
<input type="text" name="" id="" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@vouchercount %>" data-member-value="">
</div>
<hr>
</div>
<% end %>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Reference Number</label>
<input type="text" name="valid_amount" id="<%=@sale_id %>" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="<%=@sale_id %>" data-member-value="">
</div>
<hr>
</div>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label class="col-lg-4 col-md-4 col-sm-4">Amount</label>
<!-- <div id="amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div> -->
<input type="text" name="" id="amount" class="form-control col-lg-7 col-md-7 col-sm-7 float-value" value="" data-value="amount" data-member-value="">
</div>
<hr>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6" style="margin-top:75px;">
<div class="row">
<div class="col-lg-6 col-md-1 col-sm-1">
<div class="row bottom">
<div class=" cashier_number " data-value="1" data-type="num">1</div>
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="4" data-type="num">4</div>
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="7" data-type="num">7</div>
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
</div>
<div class="row bottom">
<div class=" cashier_number " data-value="0" data-type="num">0</div>
<div class=" cashier_number left" data-value="." data-type="num">.</div>
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
</div>
<div class="row bottom">
<div class=" cashier_number green" data-type="nett" >Nett</div>
<div class=" cashier_number red left" data-type="del">Del</div>
<div class=" cashier_number orange left" data-type="clr">Clr</div>
</div>
</div>
<div class="col-lg-6 col-md-1 col-sm-1">
<div class="row bottom">
<div class="cashier_number long" data-value="1000" data-type="add">1000</div>
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
</div>
<div class="row bottom">
<div class="cashier_number long" data-value="5000" data-type="add">5000</div>
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
</div>
<div class="row bottom">
<div class="pay purple" id="voucher_pay">Pay</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/payment/others_payment';"> Back </button>
</div>
</div>
<script>
$(document).ready(function() {
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_voucher %>") - parseFloat(localStorage.getItem("cash")));
}
});
// number key pad
var float_value = ""
var total = 0
$(document).on('focusout', '.float-value', function(event){
float_value = $(this).attr("data-value");
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
event.preventDefault();
if(event.handled !== true) {
var original_value;
original_value = $('#'+float_value).val();
var input_value = $(this).attr("data-value");
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
if (original_value == "0.0"){
$('#'+float_value).val(input_value);
}else{
$('#'+float_value).val(original_value+input_value);
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#'+float_value).val(amount);
break;
case 'clr':
$('#'+float_value).val("0.0");
break;
case 'del' :
var cash=$('#'+float_value).val();
$('#'+float_value).val(cash.substr(0,cash.length-1));
break;
case 'nett':
var remain_amount = $('#validamount').val();
$('#'+float_value).val(remain_amount);
break;
}
event.handled = true;
} else {
return false;
}
});
})
$('#voucher_pay').on('click',function(){
var amount = $('#amount').val();
var refnumber = $("#<%=@sale_id %>").val();
var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) ){
// alert(amount);
// alert(refnumber);
$.ajax({type: "POST",
url: "<%= origami_payment_voucher_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id+ "&refnumber="+ refnumber,
success:function(result){
if(result){
alert("Payment success")
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
});
}else{
alert("Paid Amount is over!");
}
})
</script>