fix minus addorder.js and void and other origami
This commit is contained in:
@@ -855,12 +855,12 @@ $(function() {
|
||||
|
||||
$('#'+minus).on("click", function(){
|
||||
|
||||
var count = parseInt($('#'+id).val());
|
||||
var countEl = document.getElementById(id);
|
||||
// var count = parseInt($('#'+id).val());
|
||||
// var countEl = document.getElementById(id);
|
||||
|
||||
if (count > 1) {
|
||||
count--;
|
||||
countEl.value = count;
|
||||
$('#'+id).val(count);
|
||||
|
||||
if (id=="count") {
|
||||
price = $("#unit_price").text();
|
||||
|
||||
@@ -8,12 +8,19 @@ class Origami::VoidController < BaseOrigamiController
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
# update count for shift sale
|
||||
# if(sale.sale_status == "completed")
|
||||
if(sale.sale_status == "completed")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
# end
|
||||
else
|
||||
# void before sale payment complete
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.total_void = shift.total_void + sale.grand_total
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -95,4 +102,8 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def void_before_pay
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -174,7 +174,7 @@ class SalePayment < ApplicationRecord
|
||||
sale_items = SaleItem.where("sale_id='#{ self.sale.sale_id }'")
|
||||
|
||||
sale_items.each do|item|
|
||||
SaleItem.update_existing_item(item.qty,item.item_instance_code, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
||||
SaleItem.update_existing_item(item.qty, item, self.sale.sale_id, "foc", item.unit_price, item.price)
|
||||
end
|
||||
|
||||
self.payment_method = "foc"
|
||||
|
||||
@@ -54,7 +54,7 @@ class ShiftSale < ApplicationRecord
|
||||
self.cash_sales = self.cash_sales.to_f + cash.to_f
|
||||
self.credit_sales = self.credit_sales.to_i + credit.to_f
|
||||
self.other_sales = self.other_sales.to_i + other_sales.to_f
|
||||
self.nett_sales = self.nett_sales + (saleobj.total_amount.to_f - self.total_discounts) #self.grand_total.to_i - self.commercial_taxes
|
||||
self.nett_sales = self.nett_sales + (saleobj.total_amount.to_f - saleobj.total_discount) #self.grand_total.to_i - self.commercial_taxes
|
||||
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||
self.total_rounding = self.total_rounding + saleobj.rounding_adjustment
|
||||
self.total_receipt = self.total_receipt + 1
|
||||
|
||||
@@ -263,13 +263,14 @@ class CloseCashierPdf < Prawn::Document
|
||||
end
|
||||
#end total amount by Account
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Total Sale :", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
#COMMENTED FOR NO NEED AND NOT CORRECT WHEN OTHER CHARGES
|
||||
# y_position = cursor
|
||||
# bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
# text "Total Sale :", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
|
||||
# text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
|
||||
# end
|
||||
|
||||
move_down -5
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -446,7 +446,6 @@
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function update_balance(){
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace :clear do
|
||||
SaleOrder.delete_all
|
||||
SaleItem.delete_all
|
||||
Sale.delete_all
|
||||
SaleTax.delete_all
|
||||
SaleAudit.delete_all
|
||||
SalePayment.delete_all
|
||||
ShiftSale.delete_all
|
||||
|
||||
Reference in New Issue
Block a user