class Api::ChangeTaxController < Api::ApiController

  def index
    sale_id = params[:sale_id]
    group_type = params[:group_type]
    tax_type = params[:tax_type].present? ? params[:tax_type] : "no_tax"

    sale = Sale.find(sale_id)

    sale.compute_by_sale_items(sale.total_discount, nil, group_type, tax_type)

    remark        = "Change tax to #{tax_type} for Sale ID #{sale_id} By #{current_login_employee.name}"
    SaleAudit.record_audit_change_tax(sale_id,remark,current_login_employee.name)
  end

end
