update rake shift_sales:audit
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
namespace :shift_sales do
|
namespace :shift_sales do
|
||||||
desc "TODO"
|
desc "TODO"
|
||||||
task :audit, [:shift_sale_ids, :repayment] => [:environment] do |tasks, args|
|
task :audit, [:shift_sale_ids, :shop_code, :repayment] => [:environment] do |tasks, args|
|
||||||
Rails.logger = Logger.new(STDOUT)
|
Rails.logger = Logger.new(STDOUT)
|
||||||
|
|
||||||
if args[:shift_sale_ids].empty?
|
if args[:shift_sale_ids].empty?
|
||||||
@@ -38,13 +38,10 @@ namespace :shift_sales do
|
|||||||
sale.grand_total = sale.total_amount - sale.total_discount + sale.total_tax
|
sale.grand_total = sale.total_amount - sale.total_discount + sale.total_tax
|
||||||
sale.old_grand_total = grand_total
|
sale.old_grand_total = grand_total
|
||||||
|
|
||||||
license = License.new(ENV["SX_PROVISION_URL"])
|
if args[:shop_code]
|
||||||
shop_name = license.read_license_no_decrypt("shop_name")
|
shop = Shop.find_by!(shop_code: args[:shop_code])
|
||||||
|
|
||||||
shop = if Rails.env.production? || shop_name.present?
|
|
||||||
Shop.find_by(name: shop_name)
|
|
||||||
else
|
else
|
||||||
Shop.first
|
shop = Shop.first
|
||||||
end
|
end
|
||||||
|
|
||||||
if shop.is_rounding_adj
|
if shop.is_rounding_adj
|
||||||
|
|||||||
Reference in New Issue
Block a user