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
#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
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
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
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 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 |
NewerOlder