fix tester bugs
This commit is contained in:
@@ -114,7 +114,8 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
dining = DiningFacility.find(table_id)
|
||||
table_type = dining.type
|
||||
|
||||
discount_items = []
|
||||
#destroy all discount sale item
|
||||
@@ -133,14 +134,14 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale.sale_items.destroy(discount_items)
|
||||
|
||||
action_by = current_user.id
|
||||
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
|
||||
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{dining.name} "
|
||||
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
||||
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
|
||||
result = {:status=> "Success", :table_id => table_id, :dining => dining.name, :table_type => table_type }
|
||||
else
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
|
||||
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => dining.name, :table_type => table_type }
|
||||
end
|
||||
|
||||
render :json => result.to_json
|
||||
|
||||
@@ -39,7 +39,7 @@ class SaleItem < ApplicationRecord
|
||||
|
||||
# Check for actual sale items
|
||||
sale_items.each do |si|
|
||||
if si.account_id == a.id
|
||||
if si.account_id == a.id
|
||||
account_price[:price] = account_price[:price] + si.price
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@ class CloseCashierPdf < Prawn::Document
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
|
||||
@@ -20,7 +20,7 @@ class CrmOrderPdf < Prawn::Document
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
|
||||
@@ -22,7 +22,7 @@ class StockResultPdf < Prawn::Document
|
||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != nil
|
||||
if printer_settings.font != ""
|
||||
font_families.update("#{printer_settings.font}" => {
|
||||
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||
|
||||
@@ -424,9 +424,11 @@
|
||||
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
console.log(sale_items.length);
|
||||
if(sale_items.length == 0){
|
||||
//swal("Information!", "You have no selected item!");
|
||||
swal ( "Oops" , "You have no selected item!" , "error" );
|
||||
swal ( "Oops" , "You have no selected item!" , "error" );
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
@@ -434,7 +436,8 @@
|
||||
discount_items.push(sale_items[i]);
|
||||
}
|
||||
else {
|
||||
swal ("Oops" , "You have no selected item!" , "error" );
|
||||
swal ("Oops" , "You have no selected item!" , "error" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user