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:
parent
feb0dc71c1
commit
00e5aa2902
20
stoptime.rb
20
stoptime.rb
|
@ -606,6 +606,7 @@ module StopTime::Controllers
|
||||||
@customer = Customer.create(
|
@customer = Customer.create(
|
||||||
:name => @input.name,
|
:name => @input.name,
|
||||||
:short_name => @input.short_name,
|
:short_name => @input.short_name,
|
||||||
|
:financial_contact => @input.financial_contact,
|
||||||
:address_street => @input.address_street,
|
:address_street => @input.address_street,
|
||||||
:address_postal_code => @input.address_postal_code,
|
:address_postal_code => @input.address_postal_code,
|
||||||
:address_city => @input.address_city,
|
:address_city => @input.address_city,
|
||||||
|
@ -675,7 +676,7 @@ module StopTime::Controllers
|
||||||
if @input.has_key? "delete"
|
if @input.has_key? "delete"
|
||||||
@customer.delete
|
@customer.delete
|
||||||
elsif @input.has_key? "update"
|
elsif @input.has_key? "update"
|
||||||
attrs = ["name", "short_name",
|
attrs = ["name", "short_name", "financial_contact",
|
||||||
"address_street", "address_postal_code", "address_city",
|
"address_street", "address_postal_code", "address_city",
|
||||||
"email", "phone", "hourly_rate"]
|
"email", "phone", "hourly_rate"]
|
||||||
attrs.each do |attr|
|
attrs.each do |attr|
|
||||||
|
@ -1213,7 +1214,8 @@ module StopTime::Controllers
|
||||||
"address_street", "address_postal_code", "address_city",
|
"address_street", "address_postal_code", "address_city",
|
||||||
"country", "country_code",
|
"country", "country_code",
|
||||||
"phone", "cell", "email", "website",
|
"phone", "cell", "email", "website",
|
||||||
"chamber", "vatno", "accountname", "accountno"]
|
"chamber", "vatno",
|
||||||
|
"bank_name", "bank_bic", "accountno", "accountiban"]
|
||||||
attrs.each do |attr|
|
attrs.each do |attr|
|
||||||
@company[attr] = @input[attr]
|
@company[attr] = @input[attr]
|
||||||
end
|
end
|
||||||
|
@ -1487,6 +1489,7 @@ module StopTime::Views
|
||||||
li { _form_input_with_label("City/town", "address_city", :text) }
|
li { _form_input_with_label("City/town", "address_city", :text) }
|
||||||
li { _form_input_with_label("Email address", "email", :text) }
|
li { _form_input_with_label("Email address", "email", :text) }
|
||||||
li { _form_input_with_label("Phone number", "phone", :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) }
|
li { _form_input_with_label("Default hourly rate", "hourly_rate", :text) }
|
||||||
end
|
end
|
||||||
input :type => "submit", :name => @button, :value => @button.capitalize
|
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("Cellular number", "cell", :text) }
|
||||||
li { _form_input_with_label("Email address", "email", :text) }
|
li { _form_input_with_label("Email address", "email", :text) }
|
||||||
li { _form_input_with_label("Web address", "website", :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("Chamber number", "chamber", :text) }
|
||||||
li { _form_input_with_label("VAT number", "vatno", :text) }
|
li { _form_input_with_label("VAT number", "vatno", :text) }
|
||||||
li { _form_input_with_label("Bank account name", "accountname", :text) }
|
end
|
||||||
li { _form_input_with_label("Bank account number", "accountno", :text) }
|
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
|
end
|
||||||
input :type => "submit", :name => "update", :value => "Update"
|
input :type => "submit", :name => "update", :value => "Update"
|
||||||
input :type => :reset, :name => "reset", :value => "Reset"
|
input :type => :reset, :name => "reset", :value => "Reset"
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
website=<%= @company.website %>,
|
website=<%= @company.website %>,
|
||||||
%% Addressee info.
|
%% Addressee info.
|
||||||
%foreign,
|
%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 %>},
|
<%= @customer.address_postal_code %> <%= @customer.address_city %>},
|
||||||
% Headlines.
|
% Headlines.
|
||||||
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
|
date=<%= @invoice.created_at.to_formatted_s(:day_code) %>,
|
||||||
|
@ -54,11 +56,15 @@
|
||||||
term=30,
|
term=30,
|
||||||
accountno=<%= @company.accountno %>,
|
accountno=<%= @company.accountno %>,
|
||||||
accountname=<%= @company.accountname %>,
|
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 %><% unless @company.chamber.blank? %> chamber=<%= @company.chamber %>
|
||||||
<% end %>}
|
<% end %>}
|
||||||
|
|
||||||
\newcommand{\addresstext}{adres}
|
<% if @company.bank_name.present? %>
|
||||||
|
\renewcommand{\accountnotext}{<%= @company.bank_name %> rekeningnr}
|
||||||
|
<% end %>\newcommand{\addresstext}{adres}
|
||||||
\newcommand{\addresswhotext}{t.n.v.}
|
\newcommand{\addresswhotext}{t.n.v.}
|
||||||
\renewcommand{\chambertext}{KvK-nr}
|
\renewcommand{\chambertext}{KvK-nr}
|
||||||
\renewcommand{\datetext}{Factuurdatum}
|
\renewcommand{\datetext}{Factuurdatum}
|
||||||
|
|
Loading…
Reference in New Issue