From ff6b460cfc9c0f7c17233bce2ffffbbf123192b9 Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Sun, 18 Jan 2009 17:42:51 +0100 Subject: [PATCH] Improved delivery-invoice-workflow. --- .../article_categories_controller.rb | 6 +- app/controllers/articles_controller.rb | 1 - .../finance/invoices_controller.rb | 2 +- app/controllers/stockit_controller.rb | 6 + app/controllers/suppliers_controller.rb | 17 +-- app/helpers/deliveries_helper.rb | 9 ++ app/helpers/stockit_helper.rb | 2 + app/models/article.rb | 4 +- app/models/delivery.rb | 3 + app/models/invoice.rb | 1 + app/views/article_categories/index.html.haml | 8 ++ app/views/articles/index.haml | 2 +- app/views/articles/sync.html.haml | 27 ++-- app/views/deliveries/index.html.haml | 2 + app/views/deliveries/show.html.haml | 5 +- app/views/finance/invoices/_form.html.haml | 32 +++++ app/views/finance/invoices/edit.html.erb | 32 +---- app/views/finance/invoices/index.html.erb | 2 +- app/views/finance/invoices/new.html.erb | 37 +----- app/views/finance/invoices/show.html.erb | 40 ------ app/views/finance/invoices/show.html.haml | 28 ++++ app/views/layouts/_main_tabnav.html.erb | 10 +- app/views/layouts/article_categories.html.erb | 17 --- app/views/layouts/workgroups.html.erb | 17 --- app/views/stockit/index.html.haml | 27 ++++ app/views/suppliers/index.haml | 16 ++- app/views/suppliers/show.haml | 123 ++++++++++-------- test/functional/stockit_controller_test.rb | 8 ++ 28 files changed, 253 insertions(+), 231 deletions(-) create mode 100644 app/controllers/stockit_controller.rb create mode 100644 app/helpers/stockit_helper.rb create mode 100644 app/views/article_categories/index.html.haml create mode 100644 app/views/finance/invoices/_form.html.haml delete mode 100644 app/views/finance/invoices/show.html.erb create mode 100644 app/views/finance/invoices/show.html.haml delete mode 100644 app/views/layouts/article_categories.html.erb delete mode 100644 app/views/layouts/workgroups.html.erb create mode 100644 app/views/stockit/index.html.haml create mode 100644 test/functional/stockit_controller_test.rb diff --git a/app/controllers/article_categories_controller.rb b/app/controllers/article_categories_controller.rb index aa65797e..c4130017 100644 --- a/app/controllers/article_categories_controller.rb +++ b/app/controllers/article_categories_controller.rb @@ -1,7 +1,11 @@ class ArticleCategoriesController < ApplicationController before_filter :authenticate_article_meta - + + def index + @article_categories = ArticleCategory.all :order => 'name' + end + def new @article_category = ArticleCategory.new diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 2b9f36e9..a7cd5102 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -307,7 +307,6 @@ class ArticlesController < ApplicationController # sync all articles with the external database # renders a form with articles, which should be updated def sync - @supplier = Supplier.find(params[:id]) # check if there is an shared_supplier unless @supplier.shared_supplier flash[:error]= @supplier.name + _(" ist not assigned to an external database.") diff --git a/app/controllers/finance/invoices_controller.rb b/app/controllers/finance/invoices_controller.rb index 76aad868..0af37494 100644 --- a/app/controllers/finance/invoices_controller.rb +++ b/app/controllers/finance/invoices_controller.rb @@ -19,7 +19,7 @@ class Finance::InvoicesController < ApplicationController end def new - @invoice = Invoice.new + @invoice = Invoice.new(:supplier_id => params[:supplier_id], :delivery_id => params[:delivery_id]) respond_to do |format| format.html # new.html.erb diff --git a/app/controllers/stockit_controller.rb b/app/controllers/stockit_controller.rb new file mode 100644 index 00000000..415cd59f --- /dev/null +++ b/app/controllers/stockit_controller.rb @@ -0,0 +1,6 @@ +class StockitController < ApplicationController + def index + @articles = Article.in_stock + end + +end diff --git a/app/controllers/suppliers_controller.rb b/app/controllers/suppliers_controller.rb index 0beaa563..639675aa 100644 --- a/app/controllers/suppliers_controller.rb +++ b/app/controllers/suppliers_controller.rb @@ -1,20 +1,15 @@ class SuppliersController < ApplicationController before_filter :authenticate_suppliers, :except => [:index, :list] + helper :deliveries - # messages - MSG_SUPPLIER_DESTOYED = "Lieferant wurde gelöscht" - MSG_SUPPLIER_UPDATED = 'Lieferant wurde aktualisiert' - MSG_SUPPLIER_CREATED = "Lieferant wurde erstellt" - def index @suppliers = Supplier.all :order => 'name' - #@categories = ArticleCategory.all :order => 'name' + @deliveries = Delivery.recent end def show @supplier = Supplier.find(params[:id]) - @supplier_column_names = ["Name", "Telefon", "Telefon2", "FAX", "Email", "URL", "Kontakt", "Kundennummer", "Liefertage", "BestellHowTo", "Notiz", "Mindestbestellmenge"] - @supplier_columns = ["name", "phone", "phone2", "fax", "email", "url", "contact_person", "customer_number", "delivery_days", "order_howto", "note", "min_order_quantity"] + @deliveries = @supplier.deliveries.recent end # new supplier @@ -31,7 +26,7 @@ class SuppliersController < ApplicationController def create @supplier = Supplier.new(params[:supplier]) if @supplier.save - flash[:notice] = MSG_SUPPLIER_CREATED + flash[:notice] = "Lieferant wurde erstellt" redirect_to suppliers_path else render :action => 'new' @@ -45,7 +40,7 @@ class SuppliersController < ApplicationController def update @supplier = Supplier.find(params[:id]) if @supplier.update_attributes(params[:supplier]) - flash[:notice] = MSG_SUPPLIER_UPDATED + flash[:notice] = 'Lieferant wurde aktualisiert' redirect_to @supplier else render :action => 'edit' @@ -55,7 +50,7 @@ class SuppliersController < ApplicationController def destroy @supplier = Supplier.find(params[:id]) @supplier.destroy - flash[:notice] = MSG_SUPPLIER_DESTOYED + flash[:notice] = "Lieferant wurde gelöscht" redirect_to suppliers_path rescue => e flash[:error] = _("An error has occurred: ") + e.message diff --git a/app/helpers/deliveries_helper.rb b/app/helpers/deliveries_helper.rb index 03c5a703..20c97887 100644 --- a/app/helpers/deliveries_helper.rb +++ b/app/helpers/deliveries_helper.rb @@ -9,4 +9,13 @@ module DeliveriesHelper end end + def link_to_invoice(delivery) + if delivery.invoice + link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice], + :title => "Rechnung anzeigen" + else + link_to "Rechnung anlegen", new_finance_invoice_path(:supplier_id => delivery.supplier.id, :delivery_id => delivery.id) + end + end + end diff --git a/app/helpers/stockit_helper.rb b/app/helpers/stockit_helper.rb new file mode 100644 index 00000000..8a34e11d --- /dev/null +++ b/app/helpers/stockit_helper.rb @@ -0,0 +1,2 @@ +module StockitHelper +end diff --git a/app/models/article.rb b/app/models/article.rb index 09b480a9..dbbfc384 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -27,7 +27,9 @@ class Article < ActiveRecord::Base belongs_to :supplier belongs_to :article_category - + + named_scope :in_stock, :conditions => "quantity > 0", :order => 'suppliers.name', :include => :supplier + validates_presence_of :name, :unit, :net_price, :tax, :deposit, :unit_quantity, :supplier_id validates_length_of :name, :in => 4..60 validates_length_of :unit, :in => 2..15 diff --git a/app/models/delivery.rb b/app/models/delivery.rb index 30046378..5103f49d 100644 --- a/app/models/delivery.rb +++ b/app/models/delivery.rb @@ -12,8 +12,11 @@ class Delivery < ActiveRecord::Base belongs_to :supplier + has_one :invoice has_many :stock_changes + named_scope :recent, :order => 'created_at DESC', :limit => 10 + validates_presence_of :supplier_id def stock_change_attributes=(stock_change_attributes) diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 3ed883d8..07bd4db5 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -18,6 +18,7 @@ class Invoice < ActiveRecord::Base belongs_to :supplier + belongs_to :delivery validates_presence_of :supplier_id validates_uniqueness_of :date, :scope => [:supplier_id] diff --git a/app/views/article_categories/index.html.haml b/app/views/article_categories/index.html.haml new file mode 100644 index 00000000..137dfdc5 --- /dev/null +++ b/app/views/article_categories/index.html.haml @@ -0,0 +1,8 @@ +- title "Artikelkategorien" + +.left_column{:style => "width:50em"} + .box_title + %h2 Artikelkategorien + .column_content#categories + #category_form.box.edit_form{:style => "display:none;margin-bottom:1em;"} + #category_list= render :partial => 'article_categories/list' \ No newline at end of file diff --git a/app/views/articles/index.haml b/app/views/articles/index.haml index e5a409b6..b30d7b16 100644 --- a/app/views/articles/index.haml +++ b/app/views/articles/index.haml @@ -16,7 +16,7 @@ =_ 'Change supplier:' - form_tag do = select_tag :switch_supplier, | - options_for_select( Supplier.all.collect {|s| [s.name, url_for(supplier_articles_path(s))] }, | + options_for_select( Supplier.all(:order => 'name').collect {|s| [s.name, url_for(supplier_articles_path(s))] }, | url_for(supplier_articles_path(@supplier)) ), | :onchange => "redirectTo(this)", | :style => "font-size: 0.9em;margin-left:1em;" | diff --git a/app/views/articles/sync.html.haml b/app/views/articles/sync.html.haml index 4bde787a..02c04670 100644 --- a/app/views/articles/sync.html.haml +++ b/app/views/articles/sync.html.haml @@ -51,20 +51,21 @@ %td= article.deposit %td= article.article_category.name if article.article_category %tr - %td{:style => highlight_new(unequal_attributes, :name)} - = text_field 'article[]', 'name', :size => 0 - = hidden_field 'article[]', 'shared_updated_on' - %td{:style => highlight_new(unequal_attributes, :note)}= text_field 'article[]', 'note', :size => 15 - %td{:style => highlight_new(unequal_attributes, :manufacturer)}= text_field 'article[]', 'manufacturer', :size => 10 - %td{:style => highlight_new(unequal_attributes, :origin)}= text_field 'article[]', 'origin', :size => 5 - %td{:style => highlight_new(unequal_attributes, :unit)}= text_field 'article[]', 'unit', :size => 5 - %td{:style => highlight_new(unequal_attributes, :unit_quantity)}= text_field 'article[]', 'unit_quantity', :size => 5 - %td{:style => highlight_new(unequal_attributes, :net_price)}= text_field 'article[]', 'net_price', :size => 5 - %td{:style => highlight_new(unequal_attributes, :tax)}= text_field 'article[]', 'tax', :size => 4 - %td{:style => highlight_new(unequal_attributes, :deposit)}= text_field 'article[]', 'deposit', :size => 4 - %td= select 'article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true } + - fields_for 'articles[]', @article do |form| + %td{:style => highlight_new(unequal_attributes, :name)} + = form.text_field 'name', :size => 0 + = form.hidden_field 'shared_updated_on' + %td{:style => highlight_new(unequal_attributes, :note)}= form.text_field 'note', :size => 15 + %td{:style => highlight_new(unequal_attributes, :manufacturer)}= form.text_field 'manufacturer', :size => 10 + %td{:style => highlight_new(unequal_attributes, :origin)}= form.text_field 'origin', :size => 5 + %td{:style => highlight_new(unequal_attributes, :unit)}= form.text_field 'unit', :size => 5 + %td{:style => highlight_new(unequal_attributes, :unit_quantity)}= form.text_field 'unit_quantity', :size => 5 + %td{:style => highlight_new(unequal_attributes, :net_price)}= form.text_field 'net_price', :size => 5 + %td{:style => highlight_new(unequal_attributes, :tax)}= form.text_field 'tax', :size => 4 + %td{:style => highlight_new(unequal_attributes, :deposit)}= form.text_field 'deposit', :size => 4 + %td= select 'article[]', 'article_category_id', ArticleCategory.find(:all).collect {|a| [ a.name, a.id ] }, { :include_blank => true } %hr/ = hidden_field 'supplier', 'id' = submit_tag 'Alle löschen/aktualisieren' | - = link_to 'Abbrechen', :action => 'list', :id => @supplier \ No newline at end of file + = link_to 'Abbrechen', supplier_articles_path(@supplier) \ No newline at end of file diff --git a/app/views/deliveries/index.html.haml b/app/views/deliveries/index.html.haml index 95111e11..53315f34 100644 --- a/app/views/deliveries/index.html.haml +++ b/app/views/deliveries/index.html.haml @@ -14,3 +14,5 @@ %br/ = link_to 'New delivery', new_supplier_delivery_path(@supplier) +| += link_to "Lieferantenübersicht", suppliers_path diff --git a/app/views/deliveries/show.html.haml b/app/views/deliveries/show.html.haml index 4b68cac7..10a1dcb6 100644 --- a/app/views/deliveries/show.html.haml +++ b/app/views/deliveries/show.html.haml @@ -5,7 +5,10 @@ =h @delivery.supplier.name %p %b Delivered on: - =h @delivery.delivered_on + = @delivery.delivered_on +%p + %b Rechnungsbetrag: + = link_to_invoice(@delivery) %h2 Artikel %table.list{:style => "width:30em"} diff --git a/app/views/finance/invoices/_form.html.haml b/app/views/finance/invoices/_form.html.haml new file mode 100644 index 00000000..9f10e3d0 --- /dev/null +++ b/app/views/finance/invoices/_form.html.haml @@ -0,0 +1,32 @@ +- form_for([:finance, @invoice]) do |f| + = f.error_messages + = f.hidden_field :delivery_id + + - if @invoice.delivery + %p= "Diese Rechnung ist mit einer #{link_to "Lieferung", [@invoice.supplier,@invoice.delivery]} verknüpft." + %p + = f.label :supplier_id + %br/ + = f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } + %p + = f.label :number + %br/ + = f.text_field :number + %p + = f.label :date + %br/ + = f.date_select :date + %p + = f.label :paid_on + %br/ + = f.date_select :paid_on, :include_blank => true + %p + = f.label :amount + %br/ + = f.text_field :amount + %p + = f.label :note + %br/ + = f.text_area :note + %p + = f.submit "Speichern" diff --git a/app/views/finance/invoices/edit.html.erb b/app/views/finance/invoices/edit.html.erb index e14fec17..151b221d 100644 --- a/app/views/finance/invoices/edit.html.erb +++ b/app/views/finance/invoices/edit.html.erb @@ -1,36 +1,6 @@

Editing invoice

-<% form_for([:finance, @invoice]) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :supplier_id %>
- <%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %> -

-

- <%= f.label :number %>
- <%= f.text_field :number %> -

-

- <%= f.label :date %>
- <%= f.date_select :date %> -

-

- <%= f.label :paid_on %>
- <%= f.date_select :paid_on, :include_blank => true %> -

-

- <%= f.label :amount %>
- <%= f.text_field :amount %> -

-

- <%= f.label :note %>
- <%= f.text_area :note %> -

-

- <%= f.submit "Update" %> -

-<% end %> +<%= render :partial => 'form' %> <%= link_to 'Show', [:finance, @invoice] %> | <%= link_to 'Back', finance_invoices_path %> diff --git a/app/views/finance/invoices/index.html.erb b/app/views/finance/invoices/index.html.erb index 9feb7f7f..db3919f7 100644 --- a/app/views/finance/invoices/index.html.erb +++ b/app/views/finance/invoices/index.html.erb @@ -23,7 +23,7 @@ <%= invoice.date %> <%= invoice.paid_on %> <%= invoice.amount %> - <%=h invoice.delivery_id %> + <%= link_to "Lieferung", [invoice.supplier,invoice.delivery] if invoice.delivery %> <%=h truncate(invoice.note) %> <%= link_to 'Show', finance_invoice_path(invoice) %> <%= link_to 'Edit', edit_finance_invoice_path(invoice) %> diff --git a/app/views/finance/invoices/new.html.erb b/app/views/finance/invoices/new.html.erb index c51a13b6..65c24e2f 100644 --- a/app/views/finance/invoices/new.html.erb +++ b/app/views/finance/invoices/new.html.erb @@ -1,35 +1,4 @@ -

New invoice

+<% title "Neue Rechnung anlegen" -%> -<% form_for([:finance, @invoice]) do |f| %> - <%= f.error_messages %> - -

- <%= f.label :supplier_id %>
- <%= f.select :supplier_id, Supplier.all.collect { |s| [s.name, s.id] } %> -

-

- <%= f.label :number %>
- <%= f.text_field :number %> -

-

- <%= f.label :date %>
- <%= f.date_select :date %> -

-

- <%= f.label :paid_on %>
- <%= f.date_select :paid_on, :include_blank => true %> -

-

- <%= f.label :amount %>
- <%= f.text_field :amount %> -

-

- <%= f.label :note %>
- <%= f.text_area :note %> -

-

- <%= f.submit "Create" %> -

-<% end %> - -<%= link_to 'Back', finance_invoices_path %> +<%= render :partial => 'form' %> +<%= link_to 'Zurück', finance_invoices_path %> diff --git a/app/views/finance/invoices/show.html.erb b/app/views/finance/invoices/show.html.erb deleted file mode 100644 index 17b58042..00000000 --- a/app/views/finance/invoices/show.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -<% title "Show invoice #{@invoice.number}" %> - -

- Supplier: - <%=h @invoice.supplier.name %> -

- -

- Delivery: - <%=h @invoice.delivery_id %> -

- -

- Number: - <%=h @invoice.number %> -

- -

- Date: - <%=h @invoice.date %> -

- -

- Paid on: - <%=h @invoice.paid_on %> -

- -

- Amount: - <%=h @invoice.amount %> -

- -

- Note: - <%=h @invoice.note %> -

- - -<%= link_to 'Edit', edit_finance_invoice_path(@invoice) %> | -<%= link_to 'Back', finance_invoices_path %> diff --git a/app/views/finance/invoices/show.html.haml b/app/views/finance/invoices/show.html.haml new file mode 100644 index 00000000..2d274011 --- /dev/null +++ b/app/views/finance/invoices/show.html.haml @@ -0,0 +1,28 @@ +- title "Rechnung #{@invoice.number}" + +%p + %b Supplier: + =h @invoice.supplier.name +- if @invoice.delivery + %p + %b Delivery: + ="Diese Rechnung ist mit einer #{link_to "Lieferung", [@invoice.supplier,@invoice.delivery]} verknüpft." +%p + %b Number: + =h @invoice.number +%p + %b Date: + =h @invoice.date +%p + %b Paid on: + =h @invoice.paid_on +%p + %b Amount: + =h @invoice.amount +%p + %b Note: + =h @invoice.note + += link_to 'Edit', edit_finance_invoice_path(@invoice) +| += link_to 'Back', finance_invoices_path diff --git a/app/views/layouts/_main_tabnav.html.erb b/app/views/layouts/_main_tabnav.html.erb index ddc41b34..5fd5066d 100644 --- a/app/views/layouts/_main_tabnav.html.erb +++ b/app/views/layouts/_main_tabnav.html.erb @@ -23,12 +23,14 @@ { :name => "Manage orders", :url => "/orders", :access? => (u.role_orders?) } ] }, - { :name => "Articles", :url => "/suppliers", :active => ["articles", "suppliers", "deliveries", "article_categories"], + { :name => "Articles", :url => "/suppliers", + :active => ["articles", "suppliers", "deliveries", "article_categories", "stockit"], :access? => (u.role_article_meta? || u.role_suppliers?), :subnav => [ - { :name => "Show articles", :url => "/suppliers" }, - { :name => "Categories", :url => "/suppliers" }, - { :name => "Suppliers", :url => suppliers_path, :access? => (u.role_suppliers?) } + { :name => "Artikel", :url => supplier_articles_path(Supplier.first) }, + { :name => "Lager", :url => "/stockit" }, + { :name => "Lieferantinnen", :url => suppliers_path, :access? => (u.role_suppliers?) }, + { :name => "Kategorien", :url => "/article_categories"} ] }, { :name => "Finance", :url => "/finance", diff --git a/app/views/layouts/article_categories.html.erb b/app/views/layouts/article_categories.html.erb deleted file mode 100644 index 04c4708f..00000000 --- a/app/views/layouts/article_categories.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - ArticleCategories: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= flash[:notice] %>

- -<%= yield %> - - - diff --git a/app/views/layouts/workgroups.html.erb b/app/views/layouts/workgroups.html.erb deleted file mode 100644 index bf392517..00000000 --- a/app/views/layouts/workgroups.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Workgroups: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= flash[:notice] %>

- -<%= yield %> - - - diff --git a/app/views/stockit/index.html.haml b/app/views/stockit/index.html.haml new file mode 100644 index 00000000..6004141d --- /dev/null +++ b/app/views/stockit/index.html.haml @@ -0,0 +1,27 @@ +- title "Lagerübersicht" + +%p + - form_tag do + Neue Lieferung anlegen für: + = select_tag :new_delivery, | + options_for_select([" -- Lieferantin wählen --", ""] + | + Supplier.find(:all).collect {|s| [ s.name, url_for(new_supplier_delivery_path(s))] }), | + :onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" | + +%p + %table.list + %thead + %tr + %th Artikel + %th Menge + %th Einheit + %th Preis + %th Lieferant + %tbody + - for article in @articles + %tr{:class => cycle("even", "odd")} + %td=h article.name + %td= article.quantity + %td= article.unit + %td= article.net_price + %td= link_to article.supplier.name, article.supplier diff --git a/app/views/suppliers/index.haml b/app/views/suppliers/index.haml index c8ffe6ab..62c6bbfe 100644 --- a/app/views/suppliers/index.haml +++ b/app/views/suppliers/index.haml @@ -28,7 +28,15 @@ .right_column{:style => "width:47%"} .box_title - %h2 Artikelkategorien - .column_content#categories - #category_form.box.edit_form{:style => "display:none;margin-bottom:1em;"} - #category_list= render :partial => 'article_categories/list' \ No newline at end of file + %h2 Letzte Lieferungen + .column_content + %table{:style => "width:50em"} + %tr + %th Datum + %th Betrag + %th Lieferant + - for delivery in @deliveries + %tr + %td= link_to delivery.delivered_on, [delivery.supplier, delivery] + %td= link_to_invoice(delivery) + %td=h delivery.supplier.name \ No newline at end of file diff --git a/app/views/suppliers/show.haml b/app/views/suppliers/show.haml index cdfa56f9..e160ca98 100644 --- a/app/views/suppliers/show.haml +++ b/app/views/suppliers/show.haml @@ -1,54 +1,71 @@ -%h1 - Lieferantin - =h @supplier.name -- if shared_supplier = @supplier.shared_supplier - %p - %strong Der Lieferant ist mit der externen ArtikleDatenbank verknüpft. +- title "Lieferantin #{h(@supplier.name)}" -%table{:style => "width:40em"} - %tr - %td Name: - %td{:style => "font-weight:bold"}=h @supplier.name - %tr - %td Adresse: - %td{:style => "font-weight:bold"}=h @supplier.address - %tr - %td Telefon: - %td{:style => "font-weight:bold"}=h @supplier.phone - %tr - %td Telefon2: - %td{:style => "font-weight:bold"}=h @supplier.phone2 - %tr - %td FAX: - %td{:style => "font-weight:bold"}=h @supplier.fax - %tr - %td Hompage: - %td{:style => "font-weight:bold"}=h @supplier.url - %tr - %td Kontakt-Person: - %td{:style => "font-weight:bold"}=h @supplier.contact_person - %tr - %td Kundennummer: - %td{:style => "font-weight:bold"}=h @supplier.customer_number - %tr - %td Liefertage: - %td{:style => "font-weight:bold"}=h @supplier.delivery_days - %tr - %td BestellHowTo: - %td{:style => "font-weight:bold"}=h @supplier.order_howto - %tr - %td Notiz: - %td{:style => "font-weight:bold"}=h @supplier.note - %tr - %td Liefertage: - %td{:style => "font-weight:bold"}=h @supplier.delivery_days - %tr - %td Mindestbestellmenge: - %td{:style => "font-weight:bold"}=h @supplier.min_order_quantity -%br/ -- if @current_user.role_suppliers? - = link_to 'Bearbeiten', edit_supplier_path(@supplier) - | - = link_to 'Löschen', @supplier, :confirm => 'Bist Du sicher?', :method => :delete - | -= link_to 'zurück', suppliers_path \ No newline at end of file +.left_column{:style => "width:45%"} + .box_title + %h2=h @supplier.name + .column_content + - if shared_supplier = @supplier.shared_supplier + %p + %strong Der Lieferant ist mit der externen ArtikleDatenbank verknüpft. + + %table{:style => "width:40em"} + %tr + %td Adresse: + %td{:style => "font-weight:bold"}=h @supplier.address + %tr + %td Telefon: + %td{:style => "font-weight:bold"}=h @supplier.phone + %tr + %td Telefon2: + %td{:style => "font-weight:bold"}=h @supplier.phone2 + %tr + %td FAX: + %td{:style => "font-weight:bold"}=h @supplier.fax + %tr + %td Hompage: + %td{:style => "font-weight:bold"}=h @supplier.url + %tr + %td Kontakt-Person: + %td{:style => "font-weight:bold"}=h @supplier.contact_person + %tr + %td Kundennummer: + %td{:style => "font-weight:bold"}=h @supplier.customer_number + %tr + %td Liefertage: + %td{:style => "font-weight:bold"}=h @supplier.delivery_days + %tr + %td BestellHowTo: + %td{:style => "font-weight:bold"}=h @supplier.order_howto + %tr + %td Notiz: + %td{:style => "font-weight:bold"}=h @supplier.note + %tr + %td Liefertage: + %td{:style => "font-weight:bold"}=h @supplier.delivery_days + %tr + %td Mindestbestellmenge: + %td{:style => "font-weight:bold"}=h @supplier.min_order_quantity + %br/ + - if @current_user.role_suppliers? + = link_to 'Bearbeiten', edit_supplier_path(@supplier) + | + = link_to 'Löschen', @supplier, :confirm => 'Bist Du sicher?', :method => :delete + | + = link_to 'zurück', suppliers_path + +.right_column{:style => "width:45%"} + .box_title + %h2 Letzte Lieferungen + .column_content + %table + %tr + %th Datum + %th Betrag + - for delivery in @deliveries + %tr + %td= link_to delivery.delivered_on, [@supplier, delivery] + %td= link_to_invoice(delivery) + %p + = link_to "Neue Lieferung anlegen", new_supplier_delivery_path(@supplier) + | + = link_to "Zeige alle Lieferungen", supplier_deliveries_path(@supplier) \ No newline at end of file diff --git a/test/functional/stockit_controller_test.rb b/test/functional/stockit_controller_test.rb new file mode 100644 index 00000000..9f99c150 --- /dev/null +++ b/test/functional/stockit_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class StockitControllerTest < ActionController::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end