Skip to content

Instantly share code, notes, and snippets.

View Viswanathantv's full-sized avatar

Viswanathan Viswanathantv

View GitHub Profile
../views/rds/index.html
<td><%= Member.where(["id = ?",rd.member_id ]).select("name").to_s %></td>
output
1 #<ActiveRecord::Relation:0xb6672c9c> 2013-03-21 1000.0 12 132 0.01 6180.0 Thu, 21 Mar 2013 05:40:17 +0000
<%= form_for @rd_transaction, :html => { :class => 'form-horizontal' } do |f| %>
<div class="control-group">
<%= f.label :member_id, :class => 'control-label' %>
<div class="controls">
<%= f.select :member_id, Member.find(:all).collect { |s| [s.name,s.id]} ,:class => 'number_field' %>
</div>
</div>
<div class="control-group">
<%= f.label :rd_id, :class => 'control-label' %>
<div class="controls">
<%= form_for @rd_transaction, :html => { :class => 'form-horizontal' } do |f| %>
<div class="control-group">
<%= f.label :rd_id, :class => 'control-label' %>
<div class="controls">
<%= f.number_field :rd_id, :class => 'number_field' %>
</div>
</div>
<div class="control-group">
<%= f.label :member_id, :class => 'control-label' %>
<div class="controls">
../controllers/rd_transactions.rb
def create
@rd_transaction = RdTransaction.new(params[:rd_transaction])
@rd = Rd.find(params[:rd_id])
@rd.update_attribute( :current_amount, (@rd.current_amount + @rd_transaction.amount_deposited))
respond_to do |format|
if @rd_transaction.save
@rd.save
format.html { redirect_to @rd_transaction, notice: 'Rd transaction was successfully created.' }
@Viswanathantv
Viswanathantv / Vaibhav app
Last active December 15, 2015 04:59
Vaibhav bank app rails
rails g scaffold member name:string account_number:integer pan_card:string address:string dob:date mobile:string nominee_one:string nominee_two:string
rails g scaffold rd member_id:integer start_date:date amount:decimal period:integer monthly_deposit:integer rate_of_interest:decimal current_amount:decimal
rails g scaffold fd member_id:integer start_date:date amount:decimal period:integer rate_of_interest:decimal current_amount:decimal
rails g scaffold ctd member_id:integer start_date:date amount:decimal rate_of_interest:decimal current_amount:decimal
rails g scaffold loan member_id:integer start_date:date amount:decimal period:integer monthly_emi:integer rate_of_interest:decimal current_amount_returned:decimal
rails g scaffold share member_id:integer no_of_share:integer per_share_value:decimal current_share_value:decimal
rails g scaffold rd_transaction rd_id:integer member_id:integer amount_deposited:decimal deposit_type:string
rails g scaffold ctd_transaction ctd_id:integer member_id:integer amount_de
@Viswanathantv
Viswanathantv / main app
Last active December 14, 2015 18:49
For vaibhav banking application
hobo generate resource employee name:string account_number:integer pan_card:string address:text date_of_birth:date mobile:string nominee_one:string nominee_two:string
hobo generate resource rd rd_generation_id:integer period:integer amount:integer monthly_deposit:integer rate_of_interest:decimal current_amount:decimal
hobo generate resource fd fd_generation_id:integer period:integer amount:integer rate_of_interest:decimal current_amount:decimal
hobo generate resource ctd ctd_generation_id:integer period:integer monthly_deposit:integer rate_of_interest:decimal current_amount:decimal
hobo generate resource loan loan_generation_id:integer period:integer borrowed_amount:integer emi:decimal rate_of_interest:decimal paid_amount:decimal
hobo generate resource share share_generation_id:integer number_of_shares:integer rate_of_interest:decimal current_amount:decimal
../model/employee.rb
rds_count :integer, :default => 0, :null => false