update
This commit is contained in:
@@ -138,7 +138,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">15%</div>
|
||||
<div class="fluid cashier_number" data-value="15" data-type="add">15%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||
@@ -149,7 +149,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">20%</div>
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||
@@ -160,7 +160,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="50" data-type="add">30%</div>
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number"></div>
|
||||
@@ -190,8 +190,9 @@
|
||||
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">RemoveItem Discount</button>
|
||||
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
|
||||
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
|
||||
<!-- <hr />
|
||||
<button id="member-discount" class="btn btn-success btn-block action-btn">Member Discount</button> -->
|
||||
<hr />
|
||||
<button id="member-discount" class="btn btn-success btn-block action-btn
|
||||
<%= @sale_data.customer.membership_id ? " " : "disabled"%>">Member Discount</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -283,7 +284,7 @@ $(document).ready(function(){
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_value = parseFloat($('#discount-amount').val());
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
@@ -330,10 +331,15 @@ $(document).ready(function(){
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var total = 0;
|
||||
|
||||
$('.discount-item-row.selected-item').each(function(i){
|
||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||
total = total + Math.abs(amount);
|
||||
$(this).remove();
|
||||
});
|
||||
$("#order-sub-total").text(origin_sub_total + total);
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
@@ -477,31 +483,50 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
// Pay Discount for membership
|
||||
// $("#member-discount").on('click', function(e){
|
||||
// e.preventDefault();
|
||||
// var sale_id = $('#sale-id').text();
|
||||
// var sub_total = $('#order-sub-total').text();
|
||||
// var ajax_url = "/origami/" + sale_id + "/member_discount";
|
||||
$("#member-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var ajax_url = "/origami/" + sale_id + "/member_discount";
|
||||
|
||||
// // Selected Account
|
||||
// var account_types = JSON.stringify(get_selected_account_types());
|
||||
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
// Selected Account
|
||||
var account_types = JSON.stringify(get_selected_account_types());
|
||||
var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: ajax_url,
|
||||
// data: params,
|
||||
// success:function(result){
|
||||
// alert("Successfully Discount!");
|
||||
// if(result.table_type == "Table"){
|
||||
// window.location.href = "/origami/table/" + result.table_id
|
||||
// }
|
||||
// else {
|
||||
// window.location.href = "/origami/room/" + result.table_id
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
|
||||
if (result.url_status == false) {
|
||||
status = result.url_message
|
||||
}else{
|
||||
status = result.status
|
||||
}
|
||||
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* Remove Selection */
|
||||
@@ -628,21 +653,21 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,23 +715,23 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
// }
|
||||
}
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
json.status true
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
<td style="width:50%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
||||
<td><strong>Table No</strong> - <%=@table_no%></td>
|
||||
<td><strong>Sale Id</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer ID :</strong> <%= @sale_data.customer.customer_id%></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -351,10 +352,11 @@ $( document ).ready(function() {
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
localStorage.removeItem("cash");
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
|
||||
@@ -372,10 +374,9 @@ $( document ).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
}
|
||||
else{
|
||||
$('#pay').text("Pay")
|
||||
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: 'Thank you !',
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% grand_total = 0 %>
|
||||
<% old_grand_total = 0 %>
|
||||
<% total_tax = 0 %>
|
||||
<% guest_count = 0 %>
|
||||
<% total_sum = 0 %>
|
||||
@@ -64,6 +65,7 @@
|
||||
<% @sale_data.each do |result| %>
|
||||
|
||||
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
|
||||
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
|
||||
<% total_tax += result.total_tax.to_f %>
|
||||
<% total_sum += result.total_amount.to_f %>
|
||||
<% discount_amt += result.total_discount.to_f %>
|
||||
@@ -75,7 +77,7 @@
|
||||
<td><%= result.cashier_name rescue '-' %></td>
|
||||
<td><%= result.total_amount rescue '-' %></td>
|
||||
<td><%= result.total_discount rescue '-' %></td>
|
||||
<td><%= sprintf "%.2f",result.total_tax rescue '-' %></td>
|
||||
<td><%= result.total_tax rescue '-' %></td>
|
||||
|
||||
|
||||
<td><%= result.grand_total %></td>
|
||||
@@ -93,7 +95,7 @@
|
||||
<!-- <td><b><%= other_amt rescue '-'%></b></td> -->
|
||||
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
|
||||
<td><b><%= rounding_adj rescue '-'%></b></td>
|
||||
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
|
||||
<td><b><%= old_grand_total.to_f.round + rounding_adj %></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<div class="page-header">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Daily Sale Report</li>
|
||||
</ul>
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li>Sale Item Report</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user