Skip to content

Instantly share code, notes, and snippets.

View patrickespake's full-sized avatar

Patrick Espake patrickespake

View GitHub Profile
namespace :calc_ceps do
desc "Calcular o redespacho dos correios do cliente específico"
task all_ceps: :environment do
customer = Customer.find_by(api_key:"c0414dadf7d5db207f1188e8e6c53ea3302dc1bb")
current_admin_user = AdminUser.find_by(email:"[email protected]")
##binding.pry
book = Spreadsheet::Workbook.new
# Define the sheet name
@product = Product.find_by_name("PAC")
@patrickespake
patrickespake / us.rb
Last active June 6, 2019 15:04 — forked from dgoscn/us.rb
class Administration::ContractsController < Administration::BaseController
def new
@company = Company.find(params[:company_id])
@contract = Contract.new
@contract.distance_fees.build
@contract.contract_authorizations.build
@contract.initial_charge = current_admin_user.levoo_unit.present? ? current_admin_user.levoo_unit.setting.initial_charge : Setting.first.initial_charge
@contract.extra_mileage_threshold = current_admin_user.levoo_unit.present? ? current_admin_user.levoo_unit.setting.extra_mileage_threshold : Setting.first.extra_mileage_threshold
@contract.extra_mileage_value = current_admin_user.levoo_unit.present? ? current_admin_user.levoo_unit.setting.extra_mileage_value : Setting.first.extra_mileage_value