merge with crm

This commit is contained in:
Yan
2017-07-01 20:11:52 +06:30
28 changed files with 467 additions and 98 deletions

View File

@@ -41,10 +41,10 @@ class Origami::PaymentsController < BaseOrigamiController
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash")
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = saleObj.grand_total - new_total
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
# rounding_adj = saleObj.grand_total - new_total
saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
# saleObj.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
rebate_amount = nil
@@ -144,4 +144,14 @@ class Origami::PaymentsController < BaseOrigamiController
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, "Re-print")
end
def rounding_adj
saleObj = Sale.find(params[:sale_id])
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
end

View File

@@ -23,6 +23,26 @@ class Origami::SaleEditController < BaseOrigamiController
@newsaleitem.save
end
def item_edit
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
update_price = params[:update_price]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'void'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = update_qty
@newsaleitem.price = update_price
@newsaleitem.unit_price = update_price
@newsaleitem.taxable_price = update_price
@newsaleitem.is_taxable = 0
@newsaleitem.remark = 'edit'
@newsaleitem.product_name = saleitemObj.product_name + " - updated"
@newsaleitem.save
end
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]

View File

@@ -4,7 +4,6 @@ class Origami::ShiftsController < BaseOrigamiController
end
def show
puts current_user.id
@shift = ShiftSale.current_open_shift(current_user.id)
end
@@ -15,8 +14,9 @@ class Origami::ShiftsController < BaseOrigamiController
def create
opening_balance = params[:opening_balance]
cashier_terminal = params[:cashier_terminal]
@shift = ShiftSale.new
@shift.create(opening_balance,current_user)
@shift.create(opening_balance,cashier_terminal, current_user)
end
def update_shift
@@ -27,10 +27,21 @@ class Origami::ShiftsController < BaseOrigamiController
@shift.shift_closed_at = DateTime.now.utc
@shift.closing_balance = closing_balance.to_f
@shift.save
end
end
unique_code = "CloseCashierPdf"
shop_details = Shop.find(1)
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,@shift,shop_details)
end
end
def edit
end
end