This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.export_security_deposit_manual_entries_to_csv | |
CSV.open("report.csv", "wb") do |csv| | |
accounts = security_deposit_manual_entries | |
for acct in accounts do | |
for sec_deposit in acct.security_deposits do | |
for journal_entry in sec_deposit.journal_entries.where(entry_item_type: "ManualEntryItem") | |
csv << [journal_entry.entry_item.created_at, acct.short_code, sec_deposit.location.code, | |
journal_entry.entry_item.amount.to_f, journal_entry.entry_item.user.try("email"), journal_entry.entry_item.notes] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = PrimaryReservation.where(move_out_type: "Move Out").where(ended_on: Time.current.beginning_of_month.to_date...1.month.from_now.beginning_of_month.to_date) | |
def get_moveOut_info(p) | |
results = p.select{|r| r.reservable.name != "WW Membership"}.map do |p| | |
account = p.account | |
account_admin = p.account.account_admin | |
ach = account.account_admin.ach_profiles.where(location_id: p.location.id).where(move_out_refund: true).last | |
office = p.reservable | |
sd = account.reservations.select{|r| r.parent_id==p.id && r.reservable.name == "Security Deposit"}.last | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def invoices_for_lon02 | |
Invoice.where(location_id: 37).each do |m| | |
m.line_items.each do |l| | |
puts [m.account.name, m.account.short_code, m.started_on, m.name, m.aasm_state, m.amount,m.uuid, l.name, l.uuid, l.amount].join(", ") | |
end | |
end | |
return "" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def payments_for_lon02(loc_id) | |
Invoice.where(location_id: loc_id).each do |m| | |
m.payments.each do |l| | |
puts [m.account.name, m.account.short_code, m.started_on, m.name, m.aasm_state, m.amount, m.uuid, l.payment_method, l.status, l.requested_at, l.deposited_at, l.marked_deposited_at, l.amount, l.uuid].join(", ") | |
end | |
end | |
return "" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Assuming infos is an array of hashes, each having :location ('TLV01' is Herzlyia, 'TLV02' is Dubnov), :code (the member's short code), :exp (expiration), :card, :cvv and :id (should be 'N/A' for int'l cards) | |
require 'net/http' | |
require 'uri' | |
Net::HTTP.get(URI.parse("https://secure5.tranzila.com/cgi-bin/tranzila31cl.cgi?TranzilaPW=#{ENV['TRANZILLA_TOKEN_PW']}&supplier=wework")) | |
uri = URI.parse('https://secure5.tranzila.com/cgi-bin/tranzila31pan.cgi') | |
infos.each do |info| | |
next if info[:id].blank? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in spaceman | |
loc = Location.find_by(name: location_name) | |
floors = Floor.where(location_id: loc.id).where(name: floors) | |
os = Space.for_location(loc).where(floor_id: floors) | |
accounts = PrimaryReservation.where(reservable_uuid: os.pluck(:uuid)).where(started_on:Date.new(2015, 9, 1)).map(&:account).uniq | |
OR | |
accounts = PrimaryReservation.where(location_id: loc.id).where(started_on:Date.new(2015, 9, 1)).map(&:account).uniq | |
transfers = accounts.select{|a| a.primary_reservations.any?{ |p| p.started_on < Date.new(2015, 9, 1) } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account = Account.find_by(uuid: "066c4a44-6eaa-4712-9019-198817c4b2bd") | |
account_admin = User.find_by(email: "[email protected]") | |
account_admin.uuid = "b5465310-e7a0-0132-3401-1e4f0fde60c1" | |
account_admin.save! | |
account.name = "Nothing Forgotten" | |
account.account_admin_id = account_admin.id | |
account.account_admin_uuid = account_admin.uuid | |
account.save! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
batches = [ | |
{batch_number: 14625, location: "South Station" }, | |
{ batch_number: 14626, location: "Chinatown"}, | |
{ batch_number: 14627, location: "Wonder Bread"}, | |
{ batch_number: 14628, location: "Dupont Circle"}, | |
{ batch_number: 14629, location: "Soho West"}, | |
{ batch_number: 14630, location: "Bryant Park"}, | |
{ batch_number: 14631, location: "Park South"}, | |
{ batch_number: 14632, location: "42nd Street"}, | |
{ batch_number: 14633, location: "FiDi"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = PrimaryReservation.where(account_id: 7442, office_num: "1018") | |
p.started_on = p.started_on.last_month | |
p.save | |
ReservationService.new.move_out!(p, Date.now, "Move Out") | |
i = p.last.invoices.last | |
i.without_versioning :destroy | |
i.versions.each(&:delete) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account = Account.find_by(uuid: "4092f3a0-8251-0130-f786-123138068411") | |
account_admin = User.find_by(email: "[email protected]") | |
account.account_admin_id = account_admin.id | |
account.account_admin_uuid = account_admin.uuid | |
account.save! |
OlderNewer