public
Description: A basic accounting software, written in Ruby, using the Rails framework. UI in French.
Clone URL: git://github.com/francois/acctsoft.git
New QuickTxn model and controller.
francois (author)
Wed Mar 19 13:20:11 -0700 2008
commit  cb4ecb0d6844b962ee3cb3d211771f5cfb78586b
tree    d162ca4d8cc5d728fc7fd36069f9c72d8d7964f4
parent  c2b9d2bce98e1abb8fd6024c0c9dca975719ff1e
...
2
3
4
 
5
6
7
...
34
35
36
 
 
 
 
 
 
 
37
...
2
3
4
5
6
7
8
...
35
36
37
38
39
40
41
42
43
44
45
0
@@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base
0
   before_filter :load_company
0
   before_filter :pagination_handler, :only => [:index]
0
   before_filter :transform_parameters
0
+ before_filter :quicktxn
0
   after_filter :set_content_type
0
 
0
   protected
0
@@ -34,4 +35,11 @@ class ApplicationController < ActionController::Base
0
     return unless response.headers['Content-Type'].blank?
0
     response.headers['Content-Type'] = 'text/html; charset=UTF-8'
0
   end
0
+
0
+ def quicktxn
0
+ @quicktxn = QuickTxn.new
0
+ @quicktxn.debit_account = Account.find(:first)
0
+ @quicktxn.credit_account = @quicktxn.debit_account
0
+ @quicktxn.amount = Money.zero
0
+ end
0
 end
...
23
24
25
 
 
 
 
26
27
28
...
23
24
25
26
27
28
29
30
31
32
0
@@ -23,6 +23,10 @@ class TxnAccount < ActiveRecord::Base
0
     self.account.name
0
   end
0
 
0
+ def name=(name)
0
+ self.account = Account.find_by_name(name)
0
+ end
0
+
0
   def reconcile!(reconciliation)
0
     self.reconciliation = reconciliation
0
     self.save!
...
26
27
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
30
31
...
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
0
@@ -26,6 +26,31 @@
0
       <li><%= link_to 'Infos Compagnie', config_url %></li>
0
     </ul>
0
   </div>
0
+ <% form_tag(quick_txn_path, :id => "quicktxn") do %>
0
+ <%= hidden_field_tag "rt", request.url %>
0
+ <table class="dead">
0
+ <caption>Ajout rapide de transaction</caption>
0
+ <tr>
0
+ <th scope="column"><label for="quicktxn_posted_on">Date</label></th>
0
+ <th scope="column"><label for="quicktxn_debit_account">Débiter</label></th>
0
+ <th scope="column"><label for="quicktxn_credit_account">Créditer</label></th>
0
+ <th scope="column"><label for="quicktxn_amount">Montant</label></th>
0
+ <th scope="column"><label for="quicktxn_description">Description</label></th>
0
+ <td rowspan="2" valign="middle"><%= submit_tag "Enregister" %></td>
0
+ </tr>
0
+ <tr>
0
+ <td><%= text_field_tag "quicktxn[posted_on]", @quicktxn.posted_on, :id => "quicktxn_posted_on" %></td>
0
+ <td>
0
+ <%= text_field_tag "quicktxn[debit_account]", @quicktxn.debit_account.name, :id => "quicktxn_debit_account" %>
0
+ </td>
0
+ <td>
0
+ <%= text_field_tag "quicktxn[credit_account]", @quicktxn.credit_account.name, :id => "quicktxn_credit_account" %>
0
+ </td>
0
+ <td><%= text_field_tag "quicktxn[amount]", @quicktxn.amount.format, :id => "quicktxn_amount" %></td>
0
+ <td><%= text_field_tag "quicktxn[description]", @quicktxn.description, :id => "quicktxn_description" %></td>
0
+ </tr>
0
+ </table>
0
+ <% end %>
0
   <div id="content">
0
 <% unless @title.blank? -%>
0
     <h1><%= @title %></h1>
...
56
57
58
 
 
59
60
...
56
57
58
59
60
61
62
0
@@ -56,5 +56,7 @@ ActionController::Routing::Routes.draw do |map|
0
   map.config '/compagnie/comptes/:id', :controller => 'account_configurations', :action => 'edit'
0
   map.config '/compagnie', :controller => 'company', :action => 'edit'
0
 
0
+ map.resource :quick_txn
0
+
0
   map.connect ':controller/:action/:id'
0
 end
...
112
113
114
 
 
 
 
 
 
 
...
112
113
114
115
116
117
118
119
120
121
0
@@ -112,3 +112,10 @@ span.money .symbol { display: none; }
0
 #transactions { clear: none; margin-right: 35em; }
0
 
0
 .amount { font-weight: bold; }
0
+
0
+#quicktxn { clear: both; border: 1px solid black; padding: .2em; margin: 0 auto; background: #F5F8FF; border: 3px double #C9CFFF; width: 69em; }
0
+#quicktxn caption { font-weight: bold; font-size: 110%; }
0
+#quicktxn #quicktxn_posted_on { width: 8em; }
0
+#quicktxn_debit_account, #quicktxn_credit_account { width: 12em; }
0
+#quicktxn_description { width: 20em; }
0
+#quicktxn_amount { width: 6em; }

Comments

    No one has commented yet.