Second part of stock-integration.

Introduced StockArticle and a special page for ordering from stock. StockChanges will be created and the StockArticle.quantity
updated in 'order.close!'.
This commit is contained in:
Benjamin Meichsner 2009-02-06 16:26:35 +01:00
parent 1912a3fd80
commit c17b63b192
37 changed files with 616 additions and 340 deletions

View file

@ -0,0 +1,34 @@
- remote_form_for stock_article, :url => add_stock_article_supplier_deliveries_path(@supplier) do |form|
= form.error_messages
%p
remote_link_to "Artikel aus dem Katalog wählen"...
%p
= form.label :name
%br/
= form.text_field :name
%p
= form.label :unit
%br/
= form.text_field :unit
%p
= form.label :note
%br/
= form.text_field :note
%p
= form.label :price
%br/
= form.text_field :price
%p
= form.label :tax
%br/
= form.text_field :tax, :value => (stock_article.tax || 7.0)
%p
= form.label :deposit
%br/
= form.text_field :deposit
%p
Kategorie:
= form.select :article_category, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
%p
= submit_tag "Artikel speichern"

View file

@ -1,6 +1,9 @@
%p
- fields_for "delivery[stock_change_attributes][]", stock_change do |form|
= form.select :article_id, articles_for_select(@supplier), :prompt => " -- Artikel auswählen -- "
= form.hidden_field :stock_article_id
Menge
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
= link_to_function "Löschen", "$(this).up('p').remove()"
- article = stock_change.stock_article
%b= article.name
= "(#{number_to_currency(article.price)} / #{article.unit})"
//= link_to_function "Löschen", "$(this).up('p').remove()"

View file

@ -1,4 +1,27 @@
- title "Neue Lieferung von #{@supplier.name}"
- render :layout => 'form' do
= render :partial => 'stock_change', :collection => @delivery.stock_changes
.left_column
- form_for([@supplier,@delivery]) do |f|
.box_title
%h2 Lieferung anlegen
.column_content
= f.error_messages
= f.hidden_field :supplier_id
%p
%b= f.label :delivered_on
= f.date_select :delivered_on
%h2 Lagerartikel des Lieferanten
#stock_changes
= render :partial => 'stock_change', :collection => @delivery.stock_changes
%p
= f.submit "Lieferung anlegen"
.right_column{:style => "width:35em;"}
.box_title
%h2 Neuen Lagerartikel anlegen
.column_content
#new_stock_article
= render :partial => 'new_stock_article', :locals => {:stock_article => @supplier.stock_articles.build}
%p{:style => "clear:both"}
= link_to 'Zurück', supplier_deliveries_path(@supplier)

View file

@ -16,10 +16,10 @@
%th Artikel
%th Einheit
%th Menge
- for stock_change in @delivery.stock_changes.find :all, :include => :article
- for stock_change in @delivery.stock_changes.find :all, :include => :stock_article
%tr
%td= stock_change.article.name
%td= stock_change.article.unit
%td= stock_change.stock_article.name
%td= stock_change.stock_article.unit
%td= stock_change.quantity
%br/