dis ui calc fix and update for shift
This commit is contained in:
@@ -67,10 +67,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
|
||||
|
||||
end
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -118,6 +118,23 @@ class CloseCashierPdf < Prawn::Document
|
||||
text "#{shift_sale.closing_balance}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash In:", :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.cash_in}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Cash Out:", :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.cash_out}", :size => self.item_font_size, :align => :right
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
|
||||
text "Net Sales:", :size => self.item_font_size, :align => :right
|
||||
|
||||
@@ -283,7 +283,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 +330,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
|
||||
@@ -628,21 +633,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 +695,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
|
||||
|
||||
|
||||
@@ -351,10 +351,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 +373,9 @@ $( document ).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
}
|
||||
else{
|
||||
$('#pay').text("Pay")
|
||||
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: 'Thank you !',
|
||||
|
||||
Reference in New Issue
Block a user