Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -699,7 +699,7 @@
|
|||||||
<script>
|
<script>
|
||||||
var cashier_type = "cashier";
|
var cashier_type = "cashier";
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
localStorage.removeItem("tax_type");
|
// localStorage.removeItem("tax_type");
|
||||||
/* check webview loaded*/
|
/* check webview loaded*/
|
||||||
var webview = <%= @webview %>;
|
var webview = <%= @webview %>;
|
||||||
showHideNavbar(webview);
|
showHideNavbar(webview);
|
||||||
@@ -894,12 +894,14 @@
|
|||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
// type = $('.payment_method').val();
|
// type = $('.payment_method').val();
|
||||||
type = get_selected_attributes('selected-payment');
|
type = get_selected_attributes('selected-payment');
|
||||||
|
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||||
|
|
||||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
|
||||||
calculate_member_discount(sale_id,"Card");
|
calculate_member_discount(sale_id,"Card",tax_type);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
calculate_member_discount(sale_id,"Cash");
|
calculate_member_discount(sale_id,"Cash",tax_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||||
@@ -920,7 +922,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function calculate_member_discount(sale_id,type) {
|
function calculate_member_discount(sale_id,type,tax_type) {
|
||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
if (type == "Cash") {
|
if (type == "Cash") {
|
||||||
is_card = false
|
is_card = false
|
||||||
@@ -930,7 +932,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier' },
|
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
|
||||||
async: false,
|
async: false,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1253,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("button[name=tax_type]").on("click", function(){
|
$("button[name=tax_type]").on("click", function(){
|
||||||
var type = $(this).attr("data-value");
|
var tax_type = $(this).attr("data-value");
|
||||||
var cashier_type = 'cashier';
|
var cashier_type = 'cashier';
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var dining_id = "<%= @dining.id rescue "" %> ";
|
var dining_id = "<%= @dining.id rescue "" %> ";
|
||||||
@@ -1270,11 +1272,10 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
|
||||||
success:function(data){
|
success:function(data){
|
||||||
if(data.status){
|
if(data.status){
|
||||||
// console.log(type);
|
localStorage.setItem("tax_type", tax_type);
|
||||||
localStorage.setItem("tax_type", type);
|
|
||||||
window.location.href = '/origami/table/'+dining_id;
|
window.location.href = '/origami/table/'+dining_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -770,8 +770,7 @@ var pdf_view = '<%=@pdf_view%>';
|
|||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
|
|
||||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : '';
|
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||||
|
|
||||||
if (credit <= 0) {
|
if (credit <= 0) {
|
||||||
calculate_member_discount(sale_id,tax_type);
|
calculate_member_discount(sale_id,tax_type);
|
||||||
}
|
}
|
||||||
@@ -1037,7 +1036,6 @@ var pdf_view = '<%=@pdf_view%>';
|
|||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
var member_discount = $('#member_discount').text();
|
var member_discount = $('#member_discount').text();
|
||||||
var item_row = $('.is_card');
|
var item_row = $('.is_card');
|
||||||
|
|
||||||
if (member_id && member_discount) {
|
if (member_id && member_discount) {
|
||||||
if (item_row.length < 1) {
|
if (item_row.length < 1) {
|
||||||
is_card = false
|
is_card = false
|
||||||
|
|||||||
@@ -694,7 +694,7 @@
|
|||||||
<script>
|
<script>
|
||||||
var cashier_type = "cashier";
|
var cashier_type = "cashier";
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
localStorage.removeItem("tax_type");
|
// localStorage.removeItem("tax_type");
|
||||||
/* check webview loaded*/
|
/* check webview loaded*/
|
||||||
var webview = <%= @webview %>;
|
var webview = <%= @webview %>;
|
||||||
showHideNavbar(webview);
|
showHideNavbar(webview);
|
||||||
@@ -913,14 +913,14 @@ $(".choose_payment").on('click', function () {
|
|||||||
$( "#loading_wrapper").show();
|
$( "#loading_wrapper").show();
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
type = get_selected_attributes('selected-payment');
|
type = get_selected_attributes('selected-payment');
|
||||||
|
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||||
// type = $('.payment_method').val();
|
// type = $('.payment_method').val();
|
||||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL", type)) != -1) {
|
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL", type)) != -1) {
|
||||||
calculate_member_discount(sale_id,"Card");
|
calculate_member_discount(sale_id,"Card",tax_type);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
calculate_member_discount(sale_id,"Cash");
|
calculate_member_discount(sale_id,"Cash",tax_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||||
@@ -942,7 +942,7 @@ $(".choose_payment").on('click', function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
function calculate_member_discount(sale_id,type) {
|
function calculate_member_discount(sale_id,type,tax_type) {
|
||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
if (type == "Cash") {
|
if (type == "Cash") {
|
||||||
is_card = false
|
is_card = false
|
||||||
@@ -952,12 +952,11 @@ function calculate_member_discount(sale_id,type) {
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/" + sale_id + "/member_discount",
|
url: "/origami/" + sale_id + "/member_discount",
|
||||||
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
|
||||||
async: false,
|
async: false,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#pay').on('click',function() {
|
$('#pay').on('click',function() {
|
||||||
@@ -1319,7 +1318,7 @@ $('#add_invoice').on('click',function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("button[name=tax_type]").on("click", function(){
|
$("button[name=tax_type]").on("click", function(){
|
||||||
var type = $(this).attr("data-value");
|
var tax_type = $(this).attr("data-value");
|
||||||
var cashier_type = 'cashier';
|
var cashier_type = 'cashier';
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var dining_id = "<%= @room.id rescue "" %> ";
|
var dining_id = "<%= @room.id rescue "" %> ";
|
||||||
@@ -1338,11 +1337,11 @@ $('#add_invoice').on('click',function(){
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/origami/payment/"+cashier_type+"/change_tax",
|
url: "/origami/payment/"+cashier_type+"/change_tax",
|
||||||
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
|
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
|
||||||
success:function(data){
|
success:function(data){
|
||||||
if(data.status){
|
if(data.status){
|
||||||
// console.log(type);
|
// console.log(tax_type);
|
||||||
localStorage.setItem("tax_type", type);
|
localStorage.setItem("tax_type", tax_type);
|
||||||
window.location.href = '/origami/room/'+dining_id;
|
window.location.href = '/origami/room/'+dining_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user