class Vfwcash::Controller
Attributes
cash[RW]
config[RW]
Public Class Methods
new(date)
click to toggle source
# File lib/vfwcash/controller.rb, line 10 def initialize(date) @config = Vfwcash.config require_relative './sqlite_base' @date = date Dir.glob(File.join(LibPath,'models/*')).each do |file| require file end @cash = Gcash.new(@config) unless @cash.dates.include?(@date) puts "No transactions exist for #{@date.beginning_of_month}" exit(0) end end
Public Instance Methods
audit()
click to toggle source
# File lib/vfwcash/controller.rb, line 68 def audit pdf = Audit.new(@date,@cash) filename = "#{PWD}/pdf/audit_#{Vfwcash.yyyymm(@date.beginning_of_quarter)}.pdf" pdf.render_file(filename) open_pdf(filename) end
balance()
click to toggle source
# File lib/vfwcash/controller.rb, line 75 def balance pdf = Balance.new(@date,@cash) filename = "#{PWD}/pdf/balance_#{Vfwcash.yyyymm(@date)}.pdf" pdf.render_file(filename) open_pdf(filename) end
between(from,to)
click to toggle source
# File lib/vfwcash/controller.rb, line 32 def between(from,to) pdf = Between.new(@date,@cash,from,to) filename = "#{PWD}/pdf/between_#{from}_#{to}.pdf" pdf.render_file(filename) open_pdf(filename) end
cb_register()
click to toggle source
# File lib/vfwcash/controller.rb, line 54 def cb_register pdf = RegisterPdf.new(@date,@cash) filename = "#{PWD}/pdf/register_#{Vfwcash.yyyymm(@date)}.pdf" pdf.render_file(filename) open_pdf(filename) end
ledger()
click to toggle source
# File lib/vfwcash/controller.rb, line 39 def ledger pdf = Ledger.new(@date,@cash) filename = "#{PWD}/pdf/ledger_#{Vfwcash.yyyymm(@date)}.pdf" pdf.render_file(filename) open_pdf(filename) end
open_pdf(filename)
click to toggle source
# File lib/vfwcash/controller.rb, line 82 def open_pdf(filename) if Gem::Platform.local.os == 'darwin' `open #{filename}` else `start #{filename}` end end
profit_loss(options)
click to toggle source
# File lib/vfwcash/controller.rb, line 24 def profit_loss(options) report = @cash.profit_loss(options) pdf = ProfitLoss.new(report) filename = "#{PWD}/pdf/pl_#{report['options'][:from]}_#{report['options'][:to]}.pdf" pdf.render_file(filename) open_pdf(filename) end
split()
click to toggle source
# File lib/vfwcash/controller.rb, line 61 def split pdf = SplitLedger.new(@date,@cash) filename = "#{PWD}/pdf/split_#{Vfwcash.yyyymm(@date)}.pdf" pdf.render_file(filename) open_pdf(filename) end
summary()
click to toggle source
# File lib/vfwcash/controller.rb, line 46 def summary pdf = Summary.new(@cash) filename = "#{PWD}/pdf/ledger_summary.pdf" pdf.render_file(filename) open_pdf(filename) end