Improved stockit: Creating/updating of stock_articles.\nTranslated deliveries and invoices.

This commit is contained in:
Benjamin Meichsner 2009-02-11 18:09:04 +01:00
parent 325d47b22f
commit 86b2b28dc9
19 changed files with 248 additions and 86 deletions

View file

@ -0,0 +1,41 @@
- form_for stock_article do |form|
= form.error_messages
= form.hidden_field :supplier_id
%p
Name
%br/
= form.text_field :name
%p
Einheit
%br/
= form.text_field :unit
%p
Notiz
%br/
= form.text_field :note
- if stock_article.new_record?
%p
Nettopreis
%br/
= form.text_field :price
%p
MwSt
%br/
= form.text_field :tax, :value => (stock_article.tax || 7.0)
%p
Pfand
%br/
= form.text_field :deposit
- else
%p
Preis:
%br/
Um Chaos zu vermeiden können bis auf weiteres die Preise von angelegten
Lagerartikeln nicht mehr verändert werden.
%p
Kategorie:
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
%p
= submit_tag "Lagerartikel speichern"
|
= link_to "Abbrechen", stock_articles_path

View file

@ -0,0 +1,3 @@
- title "Lagerartikel bearbeiten"
= render :partial => 'form', :locals => {:stock_article => @stock_article}

View file

@ -1,32 +1,50 @@
- title "Lagerübersicht"
%p
- form_tag do
Neue Lieferung anlegen für:
= select_tag :new_delivery, |
options_for_select([[" -- Lieferantin wählen --", ""]] + |
Supplier.without_deleted.collect {|s| [ s.name, url_for(new_supplier_delivery_path(s))] }), |
:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" |
%p
= link_to "Lagerbestellung online stellen", new_order_path(:supplier_id => 0)
%p
%table.list
%thead
%tr
%th Artikel
%th im Lager
%th davon bestellt
%th Einheit
%th Preis
%th Lieferant
%th Kategorie
%tbody
- for article in @articles
%tr{:class => cycle("even", "odd")}
%td=h article.name
%td= article.quantity
%td= article.quantity - article.quantity_available
%td= article.unit
%td= article.price
%td= link_to article.supplier.name, article.supplier
%td= article.article_category.name
%div{:style => "padding:0 0 0.5em 0.7em;margin-bottom:2em"}
%span{:style => "float:left"}
- form_tag do
Neue Lieferung anlegen für:
= select_tag :new_delivery, |
options_for_select([[" -- Lieferantin wählen --", ""]] + |
Supplier.without_deleted.collect {|s| [ s.name, url_for(new_supplier_delivery_path(s))] }), |
:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" |
.single_column{:style => 'width:100%; clear:both'}
.box_title
.column_content
#actions
%b Neuen Lagerartikel anlegen für
= select_tag :new_stock_article, |
options_for_select([[" -- Lieferantin wählen --", ""]] + |
Supplier.without_deleted.collect {|s| [ s.name, url_for(new_stock_article_path(:supplier_id => s))] }), |
:onchange => "redirectTo(this)", :style => "font-size: 0.9em;margin-left:1em;" |
|
= link_to_if @current_user.role_orders?, "Lagerbestellung online stellen", {:controller => 'orders', :action => 'new', :supplier_id => 0}
#articles{:style => "clear:both;margin-top:1em"}
%table.list
%thead
%tr
%th Artikel
%th im Lager
%th davon bestellt
%th Einheit
%th Preis
%th Lieferant
%th Kategorie
%th
%tbody
- for article in @stock_articles
%tr{:class => cycle("even", "odd")}
%td=h article.name
%td= article.quantity
%td= article.quantity - article.quantity_available
%td= article.unit
%td= article.price
%td= link_to article.supplier.name, article.supplier
%td= article.article_category.name
%td
= link_to icon(:edit), edit_stock_article_path(article)
= link_to icon(:delete), article, :method => :delete, :confirm => "Bist Du sicher?"

View file

@ -0,0 +1,16 @@
- title "Neuen Lagerartikel für #{@supplier.name} anlegen"
:javascript
function fillNewStockArticle(text, li) {
new Ajax.Updater('stock_article_form', '/stockit/fill_new_stock_article_form', {
parameters: {article_id: li.id}
});
}
%p
Suche nach Artikeln aus dem Katalog:
= text_field_with_auto_complete :article, :name, {}, |
{:url => {:action => 'auto_complete_for_article_name', :supplier_id => @supplier.id}, |
:after_update_element => 'fillNewStockArticle'} |
#stock_article_form
= render :partial => 'form', :locals => {:stock_article => @stock_article}