Adapted forms and the invoice template to accommodate more financial info

* Allow for setting and updating the financial contact of a customer
  and show in invoices when set (closes: #9d4c2e).
* Allow for setting and updating bank information (IBAN, BIC, name)
  and use it in the template (closes: #a11265).
This commit is contained in:
Paul van Tilburg 2012-01-03 16:51:07 +01:00
parent feb0dc71c1
commit 00e5aa2902
2 changed files with 25 additions and 7 deletions

View File

@ -606,6 +606,7 @@ module StopTime::Controllers
@customer = Customer.create(
:name => @input.name,
:short_name => @input.short_name,
:financial_contact => @input.financial_contact,
:address_street => @input.address_street,
:address_postal_code => @input.address_postal_code,
:address_city => @input.address_city,
@ -675,7 +676,7 @@ module StopTime::Controllers
if @input.has_key? "delete"
@customer.delete
elsif @input.has_key? "update"
attrs = ["name", "short_name",
attrs = ["name", "short_name", "financial_contact",
"address_street", "address_postal_code", "address_city",
"email", "phone", "hourly_rate"]
attrs.each do |attr|
@ -1213,7 +1214,8 @@ module StopTime::Controllers
"address_street", "address_postal_code", "address_city",
"country", "country_code",
"phone", "cell", "email", "website",
"chamber", "vatno", "accountname", "accountno"]
"chamber", "vatno",
"bank_name", "bank_bic", "accountno", "accountiban"]
attrs.each do |attr|
@company[attr] = @input[attr]
end
@ -1487,6 +1489,7 @@ module StopTime::Views
li { _form_input_with_label("City/town", "address_city", :text) }
li { _form_input_with_label("Email address", "email", :text) }
li { _form_input_with_label("Phone number", "phone", :text) }
li { _form_input_with_label("Financial contact", "financial_contact", :text) }
li { _form_input_with_label("Default hourly rate", "hourly_rate", :text) }
end
input :type => "submit", :name => @button, :value => @button.capitalize
@ -1800,10 +1803,19 @@ module StopTime::Views
li { _form_input_with_label("Cellular number", "cell", :text) }
li { _form_input_with_label("Email address", "email", :text) }
li { _form_input_with_label("Web address", "website", :text) }
end
h3 "Corporate information"
ol do
li { _form_input_with_label("Chamber number", "chamber", :text) }
li { _form_input_with_label("VAT number", "vatno", :text) }
li { _form_input_with_label("Bank account name", "accountname", :text) }
li { _form_input_with_label("Bank account number", "accountno", :text) }
end
h3 "Bank information"
ol do
li { _form_input_with_label("Name", "bank_name", :text) }
li { _form_input_with_label("Identification code", "bank_bic", :text) }
li { _form_input_with_label("Account holder", "accountname", :text) }
li { _form_input_with_label("Account number", "accountno", :text) }
li { _form_input_with_label("Intl. account number", "accountiban", :text) }
end
input :type => "submit", :name => "update", :value => "Update"
input :type => :reset, :name => "reset", :value => "Reset"

View File

@ -39,7 +39,9 @@
website=<%= @company.website %>,
%% Addressee info.
%foreign,
to={<%= @customer.name %>\\<%= @customer.address_street%>\\
to={<%= @customer.name %>\\<% unless @customer.financial_contact.blank?
%><%= @customer.financial_contact
%>\\<% end %><%= @customer.address_street%>\\
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
% Headlines.
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
@ -54,11 +56,15 @@
term=30,
accountno=<%= @company.accountno %>,
accountname=<%= @company.accountname %>,
<% unless @company.vatno.blank? %> vatno=<%= @company.vatno %>,
<% unless @company.accountiban.blank? %> iban=<% @company.accountiban %>,
<% end %><% unless @company.bank_bic.blank? %> bic=<% @company.bank_bic %>,
<% end %><% unless @company.vatno.blank? %> vatno=<%= @company.vatno %>,
<% end %><% unless @company.chamber.blank? %> chamber=<%= @company.chamber %>
<% end %>}
\newcommand{\addresstext}{adres}
<% if @company.bank_name.present? %>
\renewcommand{\accountnotext}{<%= @company.bank_name %> rekeningnr}
<% end %>\newcommand{\addresstext}{adres}
\newcommand{\addresswhotext}{t.n.v.}
\renewcommand{\chambertext}{KvK-nr}
\renewcommand{\datetext}{Factuurdatum}