Introduced invoices and deliveries. Integration (especially of deliveries) isn't finished yet.

This commit is contained in:
Benjamin Meichsner 2009-01-08 16:33:27 +01:00
parent 1894f27fe0
commit 30f3d199d3
65 changed files with 1193 additions and 209 deletions

View file

@ -0,0 +1,17 @@
<h1>Editing delivery</h1>
<% form_for([@supplier,@delivery]) do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :supplier_id %>
<p>
<%= f.label :delivered_on %><br />
<%= f.date_select :delivered_on %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
<%= link_to 'Show', [@supplier,@delivery] %> |
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View file

@ -0,0 +1,22 @@
<% title "#{@supplier.name}/deliveries" %>
<table>
<tr>
<th>Delivered on</th>
<th>Invoice</th>
</tr>
<% for delivery in @deliveries %>
<tr>
<td><%=h delivery.delivered_on %></td>
<td><%=h "invoice ..." %></td>
<td><%= link_to 'Show', [@supplier, delivery] %></td>
<td><%= link_to 'Edit', edit_supplier_delivery_path(@supplier,delivery) %></td>
<td><%= link_to 'Destroy', [@supplier,delivery], :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New delivery', new_supplier_delivery_path(@supplier) %>

View file

@ -0,0 +1,16 @@
<h1>New delivery</h1>
<% form_for([@supplier,@delivery]) do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :supplier_id %>
<p>
<%= f.label :delivered_on %><br />
<%= f.date_select :delivered_on %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View file

@ -0,0 +1,13 @@
<p>
<b>Supplier:</b>
<%=h @delivery.supplier_id %>
</p>
<p>
<b>Delivered on:</b>
<%=h @delivery.delivered_on %>
</p>
<%= link_to 'Edit', edit_supplier_delivery_path(@supplier,@delivery) %> |
<%= link_to 'Back', supplier_deliveries_path(@supplier) %>

View file

@ -0,0 +1,36 @@
<h1>Editing invoice</h1>
<% form_for(@invoice) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :supplier_id %><br />
<%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %>
</p>
<p>
<%= f.label :number %><br />
<%= f.text_field :number %>
</p>
<p>
<%= f.label :date %><br />
<%= f.date_select :date %>
</p>
<p>
<%= f.label :paid_on %><br />
<%= f.date_select :paid_on, :include_blank => true %>
</p>
<p>
<%= f.label :amount %><br />
<%= f.text_field :amount %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_area :note %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
<%= link_to 'Show', @invoice %> |
<%= link_to 'Back', invoices_path %>

View file

@ -0,0 +1,32 @@
<% title "Invoices" %>
<table class="list" style="width:70em">
<tr>
<th>Supplier</th>
<th>Number</th>
<th>Date</th>
<th>Paid on</th>
<th>Amount</th>
<th>Delivery</th>
<th>Note</th>
</tr>
<% for invoice in @invoices %>
<tr>
<td><%=h invoice.supplier.name %></td>
<td><%=h invoice.number %></td>
<td><%= invoice.date %></td>
<td><%= invoice.paid_on %></td>
<td><%= invoice.amount %></td>
<td><%=h invoice.delivery_id %></td>
<td><%=h truncate(invoice.note) %></td>
<td><%= link_to 'Show', invoice %></td>
<td><%= link_to 'Edit', edit_invoice_path(invoice) %></td>
<td><%= link_to 'Destroy', invoice, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New invoice', new_invoice_path %>

View file

@ -0,0 +1,35 @@
<h1>New invoice</h1>
<% form_for(@invoice) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :supplier_id %><br />
<%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %>
</p>
<p>
<%= f.label :number %><br />
<%= f.text_field :number %>
</p>
<p>
<%= f.label :date %><br />
<%= f.date_select :date %>
</p>
<p>
<%= f.label :paid_on %><br />
<%= f.date_select :paid_on, :include_blank => true %>
</p>
<p>
<%= f.label :amount %><br />
<%= f.text_field :amount %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_area :note %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
<%= link_to 'Back', invoices_path %>

View file

@ -0,0 +1,40 @@
<% title "Show invoice #{@invoice.number}" %>
<p>
<b>Supplier:</b>
<%=h @invoice.supplier.name %>
</p>
<p>
<b>Delivery:</b>
<%=h @invoice.delivery_id %>
</p>
<p>
<b>Number:</b>
<%=h @invoice.number %>
</p>
<p>
<b>Date:</b>
<%=h @invoice.date %>
</p>
<p>
<b>Paid on:</b>
<%=h @invoice.paid_on %>
</p>
<p>
<b>Amount:</b>
<%=h @invoice.amount %>
</p>
<p>
<b>Note:</b>
<%=h @invoice.note %>
</p>
<%= link_to 'Edit', edit_invoice_path(@invoice) %> |
<%= link_to 'Back', invoices_path %>

View file

@ -0,0 +1,61 @@
<%
u = @current_user
tabs = [
{ :name => "Start", :url => root_path, :active => ["index", "messages", "tasks"],
:subnav => [
{ :name => "Members", :url => "/index/foodcoop_members"},
{ :name => "Workgroups", :url => "/index/workgroups"},
{ :name => "Tasks", :url => "/tasks"},
{ :name => "Messages", :url => "/messages/inbox"},
{ :name => "My Ordergroup", :url => my_order_group_path},
{ :name => "My Ordergroup", :url => my_profile_path}
]
},
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
:subnav => [
{ :name => "Order", :url => "/ordering" },
{ :name => "My orders", :url => "/ordering/myOrders" },
{ :name => "Manage orders", :url => "/orders", :access? => (u.role_orders?) }
]
},
{ :name => "Articles", :url => "/articles", :active => ["articles", "suppliers"],
:access? => (u.role_article_meta? || u.role_suppliers?),
:subnav => [
{ :name => "Show articles", :url => "/articles/list" },
{ :name => "Categories", :url => "/articles" },
{ :name => "Suppliers", :url => suppliers_path, :access? => (u.role_suppliers?) }
]
},
{ :name => "Finance", :url => "/finance", :active => ["finance", "invoices"],
:access? => (u.role_finance?),
:subnav => [
{ :name => "Ordergroups", :url => "/finance/listOrdergroups" },
{ :name => "Balance orders", :url => "/finance/listOrders" },
{ :name => "Invoices", :url => invoices_path }
]
},
{ :name => "Administration", :url => "/admin", :active => ["admin"],
:access? => (u.role_admin?),
:subnav => [
{ :name => "Users", :url => "/admin/listUsers" },
{ :name => "Groups", :url => "/admin/listGroups" }
]
}
]
-%>
<ul>
<% for tab in tabs -%>
<% unless tab[:access?] and tab[:access?] == false %>
<li class="<%= 'current' if tab_is_active?(tab) %>">
<%= link_to tab[:name], tab[:url] %>
<ul>
<% for subtab in tab[:subnav] -%>
<% unless subtab[:access?] and subtab[:access?] == false %>
<li><%= link_to subtab[:name], subtab[:url] %></li>
<% end -%>
<% end -%>
</ul>
</li>
<% end -%>
<% end -%>
</ul>

View file

@ -18,7 +18,7 @@
%a{:href => "/"}
<span>food</span>soft
%span{:style => "color:white; font-size:45%; letter-spacing: -1px;"}= APP_CONFIG[:name]
#nav= render :partial => 'shared/nav'
#nav= render :partial => 'layouts/main_tabnav'
#main
#content

View file

@ -1,52 +0,0 @@
%ul
// Startarea
%li{:class => ("current" if controller.controller_name == 'index' || controller.controller_name == 'messages' || controller.controller_name == 'tasks')}
= link_to _('Startpage'), {:controller => 'index', :action => 'index'}, {:title => _('The Startpage. A good Startpoint.')}
%ul
%li= link_to _("Members"), {:controller => "index", :action => "foodcoop_members"}, {:title => _('Here you find a List with all Foodcoop members.')}
%li= link_to _("Workgroups"), {:controller => "index", :action => "workgroups"}, {:title => _('Here you find all Workgroups. For Example the sortinggroup with all their members.')}
%li= link_to _("Tasks"), {:controller => "tasks"}, {:title => _('Here you see the tasks. Please do something for the foodcoop!')}
- unread = Message.find_all_by_recipient_id_and_read(@current_user.id, false)
%li= link_to _("Messages") + "#{unread.nil? || unread.empty? ? '' : "(#{unread.size})"}", {:controller => 'messages', :action => 'inbox'}, {:title => _('Here you can read/write Messages from/to other foodcoop members')}
- if @current_user.find_ordergroup
%li= link_to _("My ordergroup"), {:controller => 'index', :action => 'myOrdergroup'}, {:title => _('Here are informations about your ordergroup. You can also see your accounts current')}
%li= link_to _("My Profile"), my_profile_path, {:title => _('Here are your personal Settings')}
// Orders
- hasOrderGroup = !@current_user.find_ordergroup.nil?
- hasOrdersRole = @current_user.role_orders?
- if hasOrderGroup || hasOrdersRole
%li{:class => ("current" if controller.controller_name == 'orders' || controller.controller_name == 'ordering')}
= hasOrderGroup ? link_to( _("Orders"), :controller => 'ordering') : link_to('Bestellungen', :controller => 'orders')
%ul
- if hasOrderGroup
%li= link_to _("Order"), :controller => "ordering"
%li= link_to _("My orders"), :controller => 'ordering', :action => "myOrders"
- if hasOrdersRole
%li= link_to _("Manage orders"), :controller => 'orders'
// Articles, Suppliers
- if @current_user.role_article_meta? || @current_user.role_suppliers?
%li{:class => ("current" if controller.controller_name == 'articles' || controller.controller_name == 'suppliers')}
= link_to _("Articles"), :controller => 'articles', :action => 'index'
%ul
%li= link_to _("Show articles"), :controller => 'articles', :action => 'list'
%li= link_to _("Categories"), :controller => 'articles', :action => 'index'
%li= link_to _("Suppliers"), :controller => 'suppliers', :action => 'list'
// Finance
- if @current_user.role_finance?
%li{:class => ("current" if controller.controller_name == 'finance')}
= link_to _("Finance"), :controller => 'finance'
%ul
%li= link_to _("Ordergroups"), :controller => 'finance', :action => 'listOrdergroups'
%li= link_to _("Balance orders"), :controller => 'finance', :action => 'listOrders'
// Administration
- if @current_user.role_admin?
%li{:class => ("current" if controller.controller_name == 'admin')}
= link_to _("Administration"), :controller => 'admin'
%ul
%li= link_to _("User"), :controller => 'admin', :action => 'listUsers'
%li= link_to _("Groups"), :controller => 'admin', :action => 'listGroups'

View file

@ -1,6 +1,5 @@
= error_messages_for 'supplier'
<!--[form:supplier]-->
- if @supplier.shared_supplier
%p Lieferantin wird mit externer Datenbank verknüpft.
.edit_form{:style=>"width:30em"}
@ -58,5 +57,4 @@
%label{:for => "supplier_min_order_quantity"} Mindestbestellmenge
%td= @f.text_field :min_order_quantity
= @f.hidden_field :shared_supplier_id
<!--[eoform:supplier]-->

View file

@ -1,6 +1,6 @@
%h1 Lieferantin bearbeiten
- form_for :supplier, @supplier, :url => {:action => 'update', :id => @supplier} do |@f|
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag 'Speichern'
|
= link_to 'Abbrechen', :action => 'list'
= link_to 'Abbrechen', suppliers_path

View file

@ -1,11 +1,12 @@
%h1 Lieferantinnen
- title "LieferantInnen"
- if @current_user.role_suppliers?
%p
%i
Erstelle eine
= link_to 'neue Lieferantin', :action => 'new'
= link_to 'neue Lieferantin', new_supplier_path
oder
= link_to 'importiere', :action => 'shared_suppliers'
= link_to 'importiere', shared_suppliers_suppliers_path
aus der externen ArtikelDatenbank.
.left_column{:style => "width:100%"}
@ -22,7 +23,7 @@
- for column in @supplier_columns
%td
- if column == 'name'
= link_to supplier[column], :action => 'show', :id => supplier
= link_to supplier[column], supplier
- else
=h supplier[column]
%td= link_to 'Artikel anzeigen', :controller => 'articles', :action => 'list', :id => supplier

View file

@ -1,7 +1,7 @@
%h1 Neue Lieferantinn
- form_for :supplier, @supplier, :url => {:action => 'create'} do |@f|
- form_for @supplier do |@f|
= render :partial => 'form'
= submit_tag "Speichern"
|
= link_to 'Abbrechen', :action => 'list'
= link_to 'Abbrechen', suppliers_path

View file

@ -24,4 +24,4 @@
%td=h shared_supplier.note
%td=h shared_supplier.delivery_days
%td= image_tag("icon_message.gif", :size => "16x16", :border => "0",:alt => "abonniert!") if shared_supplier.supplier
%td= link_to "abonnieren", :action => "new", :shared_supplier_id => shared_supplier unless shared_supplier.supplier
%td= link_to "abonnieren", new_supplier_path(:shared_supplier_id => shared_supplier) unless shared_supplier.supplier

View file

@ -47,8 +47,8 @@
%td{:style => "font-weight:bold"}=h @supplier.min_order_quantity
%br/
- if @current_user.role_suppliers?
= link_to 'Bearbeiten', :action => 'edit', :id => @supplier
= link_to 'Bearbeiten', edit_supplier_path(@supplier)
|
= link_to 'Löschen', { :action => 'destroy', :id => @supplier }, :confirm => 'Bist Du sicher?', :method => "post"
= link_to 'Löschen', @supplier, :confirm => 'Bist Du sicher?', :method => :delete
|
= link_to 'zurück', :action => 'list'
= link_to 'zurück', suppliers_path