change tax profile overide

This commit is contained in:
phyusin
2018-05-25 13:26:55 +06:30
parent 36fe726fbe
commit 49453a22c0
7 changed files with 199 additions and 136 deletions

View File

@@ -96,6 +96,8 @@ class Origami::PaymentsController < BaseOrigamiController
cash = params[:cash]
sale_id = params[:sale_id]
member_info = nil
type = params[:type]
tax_type = params[:tax_type]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
@@ -298,11 +300,18 @@ class Origami::PaymentsController < BaseOrigamiController
# accounts = @customer.tax_profiles
accounts = TaxProfile.where("group_type = ?",@cashier_type).order("order_by ASC")
@account_arr =[]
@tax_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc.id)
@account_arr.push(account.name)
# @account_arr.push(account)
@tax_arr.push(account.name)
end
sale_taxes = SaleTax.where("sale_id = ?", saleObj.sale_id)
if !sale_taxes.empty?
sale_taxes.each do |sale_tax|
@account_arr.push(sale_tax)
end
end
rebate = MembershipSetting.find_by_rebate(1)
# get member information
if @customer.membership_id != nil && rebate
@@ -571,4 +580,15 @@ class Origami::PaymentsController < BaseOrigamiController
render :json => result.to_json
# render :json => {status: true}
end
#changable tax for sale
def change_tax
sale_id = params[:sale_id]
order_source = params[:cashier_type]
tax_type = params[:tax_type]
sale = Sale.find(sale_id)
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount,nil,order_source,tax_type)
render json: JSON.generate({:status => true})
end
end