Introduced StockTaking. TODO: Dry up the stockit/stock_takings/deliveries controllers/views!

This commit is contained in:
Benjamin Meichsner 2009-02-12 18:32:20 +01:00
parent 2bb4cdb9d6
commit 951d19db6a
30 changed files with 436 additions and 55 deletions

View file

@ -0,0 +1,35 @@
- remote_form_for stock_article, :url => add_stock_article_stock_takings_path do |form|
= form.error_messages
%p
Lieferant
%br/
= form.select :supplier_id, Supplier.without_deleted(:order => 'name').collect{ |s| [s.name, s.id] }
%p
Name
%br/
= form.text_field :name
%p
Einheit
%br/
= form.text_field :unit
%p
Notiz
%br/
= form.text_field :note
%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
%p
Kategorie:
= form.select :article_category_id, ArticleCategory.all(:order => 'name').collect { |c| [c.name, c.id] }
%p
= submit_tag "Lagerartikel hinzufügen"

View file

@ -0,0 +1,9 @@
%p
- fields_for "stock_taking[stock_change_attributes][]", stock_change do |form|
- article = stock_change.stock_article
= form.hidden_field :stock_article_id
= "Menge (#{article.quantity_available})"
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
%b=h truncate(article.name)
= "(#{number_to_currency(article.price)} / #{article.unit})"

View file

@ -0,0 +1,16 @@
- title "Inventur bearbeiten"
- form_for(@stock_taking) do |f|
= f.error_messages
%p
%b Datum
%br/
= f.date_select :date
%p
%b Notiz
%br/
= f.text_area :note, :size => "28x7"
%p
= f.submit "Invenur speichern"
|
= link_to "Abbrechen", stock_takings_path

View file

@ -0,0 +1,25 @@
- title "Inventurübersicht"
%p
= link_to "Neue Iniventur anlegen", new_stock_taking_path
|
= link_to "Lager", stock_articles_path
%table.list{:style => "width:50em"}
%thead
%tr
%th Datum
%th Notiz
%th
%th
%th
%tbody
- for stock_taking in @stock_takings
%tr
%td= link_to format_date(stock_taking.date), stock_taking
%td=h truncate stock_taking.note
%td= link_to 'Anzeigen', stock_taking
%td= link_to 'Bearbeiten', edit_stock_taking_path(stock_taking)
%td= link_to 'Löschen', stock_taking, :confirm => 'Are you sure?', :method => :delete

View file

@ -0,0 +1,48 @@
- title "Neue Inventur anlegen"
.left_column{:style => "width:40em;"}
- form_for(@stock_taking) do |f|
.box_title
%h2 Lieferung anlegen
.column_content
= f.error_messages
%p
%b Datum
%br/
= f.date_select :date
%p
%b Notiz
%br/
= f.text_area :note, :size => "28x7", :value => "#{@current_user.nick}: ..."
%h2 Lagerartikel
%p
%i
Bitte trage hier alle gezählten Abweichungen vom
= link_to "vorläufigen Lagerbestand", stock_articles_path
ein. Bei Schwund benutze einfach ein Minus vor der Zahl.
#stock_changes
= render :partial => 'stock_change', :collection => @stock_taking.stock_changes
%p
= f.submit "Invenur anlegen"
|
= link_to "Abbrechen", stock_takings_path
.right_column{:style => "width:30em;"}
.box_title
%h2 Neuen Lagerartikel anlegen
.column_content
%p
:javascript
function fillNewStockArticle(text, li) {
new Ajax.Updater('stock_article_form', '/stock_takings/fill_new_stock_article_form', {
method: 'get',
parameters: {article_id: li.id}
});
}
Suche nach Artikeln aus dem allen Katalogen:
= text_field_with_auto_complete :article, :name, {}, |
{:url => {:controller => 'stockit', :action => 'auto_complete_for_article_name' }, |
:after_update_element => 'fillNewStockArticle', :method => :get} |
%hr/
#stock_article_form
= render :partial => 'stock_article_form', :locals => {:stock_article => StockArticle.new}

View file

@ -0,0 +1,29 @@
- title "Inventur anzeigen"
%p
Datum:
= format_date @stock_taking.date
%p
Notiz:
= simple_format @stock_taking.note
%h2 Artikel
%table.list{:style => "width:30em"}
%tr
%th Artikel
%th Lieferant
%th Einheit
%th Menge
- for stock_change in @stock_taking.stock_changes.all :include => :stock_article
%tr
%td= stock_change.stock_article.name
%td= stock_change.stock_article.supplier.name
%td= stock_change.stock_article.unit
%td= stock_change.quantity
%br/
= link_to "Bearbeiten", edit_stock_taking_path(@stock_taking)
|
= link_to "Inventurübersicht", stock_takings_path
|
= link_to "Löschen", @stock_taking, :method => :delete, :confirm => "Willst Du wirklich die Inventur löschen?"