Giter VIP home page Giter VIP logo

red_panda's Introduction

RedPanda

##Installation Add to GemFile:

"red_panda","~>0.0.1.pre2"

Then run the boot generator which accepts in order: col placed in service, col lifetime, col initial value.

rails g red_panda:boot purchase_date lifetime purchase_price

Then add the extension to your assets you want to depricate:

include RedPanda::Extension

##Supports

Red_Panda tries to conform to IRS publication 946 and supports:

  • Any property that does not fall under the mid-month convention (Residential and Some RR Property)
  • GDS Recovery Period

Red_Panda does not support:

  • Automated checks
  • ADS Recovery Period
  • Completion of form 4562

Red_Panda is used at the risk of the programmer and any company choosing to use it in their own software. While Red_Panda was designed we tried to implement it according to IRS publication 946 acuratly. However, no responsibility for any malfunction of Red_Panda can be given to Red_Panda or its creators. This software is provided as-is with no waranty written or implied. Proceed with use at own risk.

##Use

The RedPanda model extension (RedPanda::Extension) provides methods that can be used directly on the object itself.

@asset.get_convention #=> Will return string "HY" or "MQ" depending on the year placed in service

@asset.get_convention_rate #=> Returns percentage bassed on convention (given as decimal ie 80% = 0.8)

# Anything that takes year or tax_year, if not given will default to last years tax year
# So, if it is 2013 then the determined tax year will be 2012

@asset.get_remaining_life(year=nil) #=> Returns the amount of life remaining as an integer. 

@asset.get_adjusted_basis(year=nil) #=> Returns the value of the asset after applying previous years adjustments

@asset.get_depreciation_amount(year=nil)  #=> Gives the amount that can be used for that year's depreciation

ActiveRecord is lacking in support for an agnostic way to add an integer to a date so, RedPanda implements agnostic_date_add which takes an argument on the date column followed by the integer column and what you want to add it to.

For example:

Asset.find(agnostic_date_add("purchase_date","lifetime year"))

Year can be any of the following:

  • Day
  • Month
  • Year

The method agnostic_date_add does not support all databases and may not be tested on some. The following adapters have implementations

  • Sqlite3 (implemented and tested)
  • MySql2 (implemented not tested)
  • PostgreSQL (implemented not tested)

Note: This probably will not work in JRuby at the current time, but should be easy to implement

###How to get deductions for assets placed in service before the tax year which have not expired:

@assets = Asset.where("#{agnostic_date_add("purchase_date","lifetime year")}> ? AND purchase_date < ?",Date.today,Date.today).all

Then we need to sum the depriciations by year therefore:

@assets.sum{|asset|asset.get_deprication_amount(params[:tax_year].to_i)}

##CAUTIONS This gem uses floating number calculations which are known to have problems in some calculations and accuracy cannot be trusted. For accuracy it is advised to store all currency objects as an integer and later inject the decimal.

This project rocks and uses MIT-LICENSE.

red_panda's People

Contributors

travispessetto avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.