From: G. Richardson Date: Thu, 30 Jun 2011 07:57:27 +0000 (+0200) Subject: Umstellung von eur zu 3 Variablen in defaults X-Git-Tag: release-2.7.0beta1~353^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=43f9b1c512be9bc2199369c2f5accea32b8bd423;p=kivitendo-erp.git Umstellung von eur zu 3 Variablen in defaults accounting_method inventory_system profit_determination Details siehe doc/umstellung_eur.txt --- diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index d84d0feb7..a8e15481d 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -167,7 +167,7 @@ sub _calculate_amounts { sub _calculate_assembly_item { my ($self, $data, $part, $total_qty, $base_factor) = @_; - return 0 if $::lx_office_conf{system}->{eur} || !$data->{is_invoice}; + return 0 if $::instance_conf->get_inventory_system eq 'periodic' || !$data->{is_invoice}; foreach my $assembly_entry (@{ $part->assemblies }) { push @{ $data->{assembly_items}->[-1] }, { part => $assembly_entry->part, @@ -188,7 +188,7 @@ sub _calculate_part_item { _dbg("cpsi tq " . $total_qty); - return 0 if $::lx_office_conf{system}->{eur} || !$data->{is_invoice} || !$total_qty; + return 0 if $::instance_conf->get_inventory_system eq 'periodic' || !$data->{is_invoice} || !$total_qty; my ($entry); $base_factor ||= 1; diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index f213eda7f..7406c22f8 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -43,6 +43,9 @@ __PACKAGE__->meta->setup( sdonumber => { type => 'text' }, ar_paid_accno_id => { type => 'integer' }, id => { type => 'serial', not_null => 1 }, + accounting_method => { type => 'text' }, + inventory_system => { type => 'text' }, + profit_determination => { type => 'text' }, ], primary_key_columns => [ 'id' ], diff --git a/SL/IR.pm b/SL/IR.pm index 1f30c6b46..0fe19877d 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -103,7 +103,11 @@ sub post_invoice { $form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); $form->{"qty_$i"} *= -1 if $form->{storno}; - $form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"} if $::lx_office_conf{system}->{eur}; + if ( $::instance_conf->get_inventory_system eq 'periodic') { + # inventory account number is overwritten with expense account number, so + # never book incoming to inventory account but always to expense account + $form->{"inventory_accno_$i"} = $form->{"expense_accno_$i"} + }; # get item baseunit if (!$item_units{$form->{"id_$i"}}) { @@ -211,7 +215,7 @@ sub post_invoice { # check if we sold the item already and # make an entry for the expense and inventory $query = - qq|SELECT i.id, i.qty, i.allocated, i.trans_id, + qq|SELECT i.id, i.qty, i.allocated, i.trans_id, i.base_qty, p.inventory_accno_id, p.expense_accno_id, a.transdate FROM invoice i, ar a, parts p WHERE (i.parts_id = p.id) @@ -219,6 +223,20 @@ sub post_invoice { AND ((i.base_qty + i.allocated) > 0) AND (i.trans_id = a.id) ORDER BY transdate|; + # ORDER BY transdate guarantees FIFO + +# sold two items without having bought them yet, example result of query: +# id | qty | allocated | trans_id | inventory_accno_id | expense_accno_id | transdate +# ---+-----+-----------+----------+--------------------+------------------+------------ +# 9 | 2 | 0 | 9 | 15 | 151 | 2011-01-05 + +# base_qty + allocated > 0 if article has already been sold but not bought yet + +# select qty,allocated,base_qty,sellprice from invoice where trans_id = 9; +# qty | allocated | base_qty | sellprice +# -----+-----------+----------+------------ +# 2 | 0 | 2 | 1000.00000 + $sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"})); my $totalqty = $baseqty; @@ -227,32 +245,38 @@ sub post_invoice { my $qty = min $totalqty, ($ref->{base_qty} + $ref->{allocated}); $linetotal = $form->round_amount(($form->{"sellprice_$i"} * $qty) / $basefactor, 2); - if ($ref->{allocated} < 0) { - - # we have an entry for it already, adjust amount - $form->update_balance($dbh, "acc_trans", "amount", - qq| (trans_id = $ref->{trans_id}) - AND (chart_id = $ref->{inventory_accno_id}) - AND (transdate = '$ref->{transdate}')|, - $linetotal); - - $form->update_balance($dbh, "acc_trans", "amount", - qq| (trans_id = $ref->{trans_id}) - AND (chart_id = $ref->{expense_accno_id}) - AND (transdate = '$ref->{transdate}')|, - $linetotal * -1); - - } elsif ($linetotal != 0) { - # add entry for inventory, this one is for the sold item - $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?))|; - @values = ($ref->{trans_id}, $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}); - do_query($form, $dbh, $query, @values); - - # add expense - $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?))|; - @values = ($ref->{trans_id}, $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}); - do_query($form, $dbh, $query, @values); - } + if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { + # Warenbestandsbuchungen nur bei Bestandsmethode + + if ($ref->{allocated} < 0) { + +# we have an entry for it already, adjust amount + $form->update_balance($dbh, "acc_trans", "amount", + qq| (trans_id = $ref->{trans_id}) + AND (chart_id = $ref->{inventory_accno_id}) + AND (transdate = '$ref->{transdate}')|, + $linetotal); + + $form->update_balance($dbh, "acc_trans", "amount", + qq| (trans_id = $ref->{trans_id}) + AND (chart_id = $ref->{expense_accno_id}) + AND (transdate = '$ref->{transdate}')|, + $linetotal * -1); + + } elsif ($linetotal != 0) { + + # allocated >= 0 + # add entry for inventory, this one is for the sold item + $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES (?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE id = ?))|; + @values = ($ref->{trans_id}, $ref->{inventory_accno_id}, $linetotal, $ref->{transdate}, $ref->{inventory_accno_id}); + do_query($form, $dbh, $query, @values); + +# add expense + $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES (?, ?, ?, ?, (SELECT taxkey from tax WHERE chart_id = ?))|; + @values = ($ref->{trans_id}, $ref->{expense_accno_id}, ($linetotal * -1), $ref->{transdate}, $ref->{expense_accno_id}); + do_query($form, $dbh, $query, @values); + } + }; # update allocated for sold item $form->update_balance($dbh, "invoice", "allocated", qq|id = $ref->{id}|, $qty * -1); @@ -265,6 +289,8 @@ sub post_invoice { $sth->finish(); } else { # if ($form->{"inventory_accno_id_$i"}) + # part doesn't have an inventory_accno_id + # lastcost of the part is updated at the end $linetotal = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor, 2); diff --git a/SL/IS.pm b/SL/IS.pm index 261b342a2..165ae1aee 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1256,18 +1256,45 @@ sub cogs { my $allocated = 0; my $qty; +# all invoice entries of an example part: + +# id | trans_id | base_qty | allocated | sellprice | inventory_accno | income_accno | expense_accno +# ---+----------+----------+-----------+-----------+-----------------+--------------+--------------- +# 4 | 4 | -5 | 5 | 20.00000 | 1140 | 4400 | 5400 bought 5 for 20 +# 5 | 5 | 4 | -4 | 50.00000 | 1140 | 4400 | 5400 sold 4 for 50 +# 6 | 6 | 1 | -1 | 50.00000 | 1140 | 4400 | 5400 sold 1 for 50 +# 7 | 7 | -5 | 1 | 20.00000 | 1140 | 4400 | 5400 bought 5 for 20 +# 8 | 8 | 1 | -1 | 50.00000 | 1140 | 4400 | 5400 sold 1 for 50 + +# AND ((i.base_qty + i.allocated) < 0) filters out all but line with id=7, elsewhere i.base_qty + i.allocated has already reached 0 +# and all parts have been allocated + +# so transaction 8 only sees transaction 7 with unallocated parts and adjusts allocated for that transaction, before allocated was 0 +# 7 | 7 | -5 | 1 | 20.00000 | 1140 | 4400 | 5400 bought 5 for 20 + +# in this example there are still 4 unsold articles + + + # search all invoice entries for the part in question, adjusting "allocated" + # until the total number of sold parts has been reached + + # ORDER BY trans_id ensures FIFO + + while (my $ref = $sth->fetchrow_hashref('NAME_lc')) { if (($qty = (($ref->{base_qty} * -1) - $ref->{allocated})) > $totalqty) { $qty = $totalqty; } + # update allocated in invoice $form->update_balance($dbh, "invoice", "allocated", qq|id = $ref->{id}|, $qty); # total expenses and inventory # sellprice is the cost of the item my $linetotal = $form->round_amount(($ref->{sellprice} * $qty) / ( ($ref->{price_factor} || 1) * ( $basefactor || 1 )), 2); - if (!$::lx_office_conf{system}->{eur}) { + if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { + # Bestandsmethode: when selling parts, deduct their purchase value from the inventory account $ref->{expense_accno} = ($form->{"expense_accno_$row"}) ? $form->{"expense_accno_$row"} : $ref->{expense_accno}; # add to expense $form->{amount_cogs}{ $form->{id} }{ $ref->{expense_accno} } += -$linetotal; diff --git a/SL/InstanceConfiguration.pm b/SL/InstanceConfiguration.pm index b8dbee6ca..47cdd0e19 100644 --- a/SL/InstanceConfiguration.pm +++ b/SL/InstanceConfiguration.pm @@ -34,6 +34,21 @@ sub get_currencies { return $self->{currencies} ? @{ $self->{currencies} } : (); } +sub get_accounting_method { + my ($self) = @_; + return $self->{data}->{accounting_method}; +} + +sub get_inventory_system { + my ($self) = @_; + return $self->{data}->{inventory_system}; +} + +sub get_profit_determination { + my ($self) = @_; + return $self->{data}->{profit_determination}; +} + 1; __END__ @@ -74,6 +89,18 @@ Returns an array of configured currencies. Returns the default currency or undef if no currency has been configured. +=item C + +Returns the default accounting method, accrual or cash + +=item C + +Returns the default inventory system, perpetual or periodic + +=item C + +Returns the default profit determination method, balance or income + =back =head1 BUGS diff --git a/SL/User.pm b/SL/User.pm index d638220c2..75e7a38d0 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -404,6 +404,12 @@ sub dbcreate { $query = "UPDATE defaults SET coa = ?"; do_query($form, $dbh, $query, $form->{chart}); + $query = "UPDATE defaults SET accounting_method = ?"; + do_query($form, $dbh, $query, $form->{accounting_method}); + $query = "UPDATE defaults SET profit_determination = ?"; + do_query($form, $dbh, $query, $form->{profit_determination}); + $query = "UPDATE defaults SET inventory_system = ?"; + do_query($form, $dbh, $query, $form->{inventory_system}); $dbh->disconnect; diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 4be5e330f..08b97c439 100755 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -774,6 +774,24 @@ sub create_dataset { } closedir SQLDIR; + $form->{ACCOUNTING_METHODS} = []; + foreach my $item ( qw(accrual cash) ) { + push @{ $form->{ACCOUNTING_METHODS} }, { "name" => $item, + "selected" => $item eq "cash" }; + }; + + $form->{INVENTORY_SYSTEMS} = []; + foreach my $item ( qw(perpetual periodic) ) { + push @{ $form->{INVENTORY_SYSTEMS} }, { "name" => $item, + "selected" => $item eq "periodic" }; + }; + + $form->{PROFIT_DETERMINATIONS} = []; + foreach my $item ( qw(balance income) ) { + push @{ $form->{PROFIT_DETERMINATIONS} }, { "name" => $item, + "selected" => $item eq "income" }; + }; + my $default_charset = $::lx_office_conf{system}->{dbcharset}; $default_charset ||= Common::DEFAULT_CHARSET; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 19bb23ab2..9abf79883 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -46,8 +46,6 @@ use SL::Printer; use CGI::Ajax; use CGI; -use Data::Dumper; - require "bin/mozilla/common.pl"; use strict; @@ -1392,17 +1390,18 @@ sub buchungsgruppe_header { } my $linkaccounts; - if (!$::lx_office_conf{system}->{eur}) { + if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) { $linkaccounts = qq| | . $locale->text('Inventory') . qq| |; - } else { + } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) { + # don't allow choice of inventory accno and don't show that line $linkaccounts = qq| {inventory_accno_id}>|; - } + }; $linkaccounts .= qq| @@ -1550,6 +1549,8 @@ sub edit_defaults { map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; +# EÜR = cash, Bilanzierung = accrual + foreach my $key (keys %{ $form->{IC} }) { foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { my $array = "ACCNOS_" . uc($key); diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index ecce87429..27070bb3f 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -84,7 +84,8 @@ sub chart_of_accounts { $form->{title} = $locale->text('Chart of Accounts'); - if ($::lx_office_conf{system}->{eur}) { + if ( $::instance_conf->get_accounting_method eq 'cash' ) { + # $form->{method} can probably be made redundant now that we have get_accounting_method $form->{method} = "cash"; } @@ -177,8 +178,8 @@ sub list { | if $form->{selectdepartment}; - my $accrual = $::lx_office_conf{system}->{eur} ? "" : "checked"; - my $cash = $::lx_office_conf{system}->{eur} ? "checked" : ""; + my $accrual = $::instance_conf->get_accounting_method eq 'cash' ? "" : "checked"; + my $cash = $::instance_conf->get_accounting_method eq 'cash' ? "checked" : ""; my $name_1 = "fromdate"; my $id_1 = "fromdate"; @@ -246,7 +247,7 @@ sub list { $form->{description} =~ s/\"/"/g; - my $eur = $::lx_office_conf{system}->{eur}; + my $eur = $::instance_conf->get_accounting_method eq 'cash' ? 1 : 0; print qq| diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 28bc105e2..20a920612 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1528,7 +1528,9 @@ sub form_header { $auth->assert('part_service_assembly_edit'); - $form->{eur} = $::lx_office_conf{system}->{eur}; # config dumps into namespace - yuck + # what does eur set here? why is it in namespace? + # call of get_accounting_method preserves format of $form->{eur}, which expects 1 or 0 + $form->{eur} = $::instance_conf->get_accounting_method eq 'cash' ? 1 : 0; # config dumps into namespace - yuck $form->{pg_keys} = sub { "$_[0]->{partsgroup}--$_[0]->{id}" }; $form->{description_area} = ($form->{rows} = $form->numtextrows($form->{description}, 40)) > 1; $form->{notes_rows} = max 4, $form->numtextrows($form->{notes}, 40), $form->numtextrows($form->{formel}, 40); diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 1d8446966..8d0ec94f2 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -146,8 +146,8 @@ sub report { $form->{title} = $locale->text($title{ $form->{report} }); - my $accrual = $::lx_office_conf{system}->{eur} ? "" : "checked"; - my $cash = $::lx_office_conf{system}->{eur} ? "checked" : ""; + my $accrual = $::instance_conf->get_accounting_method eq 'cash' ? "" : "checked"; + my $cash = $::instance_conf->get_accounting_method eq 'cash' ? "checked" : ""; my $year = (localtime)[5] + 1900; diff --git a/doc/changelog b/doc/changelog index 0b8d98a9b..43812eefe 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,10 @@ # Veränderungen von Lx-Office ERP # ################################### +- Umstellung der Variablen eur in lx_office.conf zu drei neuen Variablen in + Tabelle defaults, zur Einstellung von Gewinnermittlungsart, Versteuerungsart + und Warenbuchungsmethode. Siehe Datei doc/umstellung_eur.txt + 2011-06-15 - Release 2.6.3 Größere neue Features: diff --git a/doc/umstellung_eur.txt b/doc/umstellung_eur.txt new file mode 100644 index 000000000..5df900358 --- /dev/null +++ b/doc/umstellung_eur.txt @@ -0,0 +1,49 @@ +Anstelle des Parameters eur in lx_office.conf werden drei neue Parameter +eingeführt, die in defaults bereitgehalten werden, und damit mandantenabhängig +konfiguriert werden können. + +Die drei Parameter regeln Gewinnermittlungsart, Versteuerungsart und +Warenbuchungsmethode: + +profit_determination (Gewinnermittlung) +* balance (Betriebsvermögensvergleich/Bilanzierung) +* income (Einnahmen-Überschuß-Rechnung) + +accounting_method (Versteuerungsart) +* accrual (Sollversteuerung) +* cash (Istversteuerung) + +inventory_system (Warenbuchungsmethode) +* perpetual (Bestandsmethode) +* periodic (Aufwandsmethode) + +Beim Anlegen eines neuen Mandanten können diese Optionen nun unabhängig +voneinander eingestellt werden. + +Beim Upgrade bestehender Mandanten wird eur ausgelesen und die Variablen werden +so gesetzt, daß sich an der Funktionalität nichts ändert. + +Bisher galt: +eur = 1: cash + periodic + income +eur = 0: accrual + perpetual + balance + +Die aktuelle Konfiguration wird unter Nummernkreise und Standardkonten unter +dem neuen Punkt "Einstellungen" angezeigt (read-only). + +Für die Umstellung eines bestehenden Mandanten gibt es an der Oberfläche +derzeit keine Möglichkeit (gab es aber vorher auch nicht). + +Die Konfiguration "eur" unter [system] in lx_office.conf wird nun nicht mehr +benötigt und kann aus der Konfigurationsdatei gelöscht werden (dies muß manuell +geschehen). + +TODO: + +* bei bestimmten Berichten kann man derzeit noch inviduell einstellen, ob man + nach Ist- oder Sollversteuerung auswertet, und es werden im Code Variablen + wie $accrual oder $cash gesetzt. Diese Codestellen wurden noch nicht + angefasst, sondern nur die wo bisher $::lx_office_conf{system}->{eur} + ausgewertet wurde. + +* Hilfetext beim Neuanlegen eines Mandanten, was die Optionen bedeuten, z.B. + mit zwei Standardfällen diff --git a/locale/de/all b/locale/de/all index 37e8bfaba..6a2dbecd3 100644 --- a/locale/de/all +++ b/locale/de/all @@ -95,6 +95,7 @@ $self->{texts} = { 'Account saved!' => 'Konto gespeichert!', 'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!', 'Accounting Group saved!' => 'Buchungsgruppe gespeichert!', + 'Accounting method' => 'Versteuerungsart', 'Accrual' => 'Bilanzierung', 'Active' => 'Aktiv', 'Active?' => 'Aktiviert?', @@ -401,6 +402,7 @@ $self->{texts} = { 'Company' => 'Firma', 'Company Name' => 'Firmenname', 'Compare to' => 'Gegenüberstellen zu', + 'Configuration' => 'Einstellungen', 'Configuration of individual TODO items' => 'Konfiguration für die einzelnen Aufgabenlistenpunkte', 'Configure' => 'Konfigurieren', 'Confirm' => 'Bestätigen', @@ -651,6 +653,7 @@ $self->{texts} = { 'EAN-Code' => 'EAN-Code', 'EB-Wert' => 'EB-Wert', 'EK' => 'EK', + 'EK-Preis' => '', 'ELSE' => 'Zusatz', 'ELSTER Export (Taxbird)' => 'ELSTER-Export nach Taxbird', 'ELSTER Export (Winston)' => 'ELSTER Export nach Winston', @@ -921,6 +924,7 @@ $self->{texts} = { 'Include in Report' => 'In Bericht aufnehmen', 'Include in drop-down menus' => 'In Aufklappmenü aufnehmen', 'Includeable in reports' => 'In Berichten anzeigbar', + 'income' => 'Einnahmen-/Überschussrechnung', 'Income Statement' => 'GuV', 'Income accno' => 'Erlöskonto', 'Incoming Payments' => 'Zahlungseingänge', @@ -949,6 +953,7 @@ $self->{texts} = { 'Inventory Account' => 'Warenbestand', 'Inventory quantity must be zero before you can set this assembly obsolete!' => 'Bevor dieses Erzeugnis als ungültig markiert werden kann, muß das Inventar auf Null sein!', 'Inventory quantity must be zero before you can set this part obsolete!' => 'Bevor diese Ware als ungültig markiert werden kann, muß das Inventar Null sein!', + 'Inventory system' => 'Warenbuchungsmethode', 'Invno.' => 'Rg. Nr.', 'Invnumber' => 'Rechnungsnummer', 'Invnumber missing!' => 'Rechnungsnummer fehlt!', @@ -1266,6 +1271,9 @@ $self->{texts} = { 'POSTED' => 'Gebucht', 'POSTED AS NEW' => 'Als neu gebucht', 'PRINTED' => 'Gedruckt', + 'Packing List' => '', + 'Packing List Date missing!' => '', + 'Packing List Number missing!' => '', 'Packing Lists' => 'Lieferschein', 'Page #1/#2' => 'Seite #1/#2', 'Paid' => 'bezahlt', @@ -1302,10 +1310,12 @@ $self->{texts} = { 'Per. Inv.' => 'Wied. Rech.', 'Period' => 'Zeitraum', 'Period:' => 'Zeitraum:', + 'periodic' => 'Aufwandsmethode', 'Periodic Invoices' => 'Wiederkehrende Rechnungen', 'Periodic invoices active' => 'Wiederkehrende Rechnungen aktiv', 'Periodic invoices inactive' => 'Wiederkehrende Rechnungen inaktiv', 'Periodicity' => 'Periodizität', + 'perpetual' => 'Bestandsmethode', 'Personal settings' => 'Persönliche Einstellungen', 'Pg Database Administration' => 'Datenbankadministration', 'Phone' => 'Telefon', @@ -1391,6 +1401,7 @@ $self->{texts} = { 'Produce Assembly' => 'Erzeugnis fertigen', 'Productivity' => 'Produktivität', 'Profit Center' => 'Erfolgsbereich', + 'Profit determination' => 'Gewinnermittlung', 'Proforma Invoice' => 'Proformarechnung', 'Program' => 'Programm', 'Project' => 'Projekt', @@ -1644,6 +1655,7 @@ $self->{texts} = { 'Storno' => 'Storno', 'Storno (one letter abbreviation)' => 'S', 'Storno Invoice' => 'Stornorechnung', + 'Storno Packing List' => '', 'Street' => 'Straße', 'Stylesheet' => 'Stilvorlage', 'Subject' => 'Betreff', @@ -2112,7 +2124,7 @@ $self->{texts} = { '[email]' => '[email]', 'absolute' => 'absolut', 'account_description' => 'Beschreibung', - 'accrual' => 'Bilanzierung (Soll-Versteuerung)', + 'accrual' => 'Soll-Versteuerung', 'action= not defined!' => 'action= nicht definiert!', 'active' => 'aktiv', 'all entries' => 'alle Einträge', @@ -2121,6 +2133,7 @@ $self->{texts} = { 'as at' => 'zum Stand', 'assembly_list' => 'erzeugnisliste', 'back' => 'zurück', + 'balance' => 'Betriebsvermögensvergleich', 'bank_collection_payment_list_#1' => 'bankeinzugszahlungsliste_#1', 'bank_transfer_payment_list_#1' => 'ueberweisungszahlungsliste_#1', 'bankaccounts' => 'Bankkonten', @@ -2129,7 +2142,7 @@ $self->{texts} = { 'bin_list' => 'Lagerliste', 'bis' => 'bis', 'button' => '?', - 'cash' => 'E/Ü-Rechnung (Ist-Versteuerung)', + 'cash' => 'Ist-Versteuerung', 'chargenumber #1' => 'Chargennummer #1', 'chart_of_accounts' => 'kontenuebersicht', 'choice' => 'auswählen', diff --git a/locale/en/all b/locale/en/all index 0253d49a0..0e1a4a042 100644 --- a/locale/en/all +++ b/locale/en/all @@ -105,6 +105,7 @@ $self->{texts} = { 'Account saved!' => '', 'Accounting Group deleted!' => '', 'Accounting Group saved!' => '', + 'Accounting method' => '', 'Accrual' => '', 'Active' => '', 'Active?' => '', @@ -388,6 +389,7 @@ $self->{texts} = { 'Company' => '', 'Company Name' => '', 'Compare to' => '', + 'Configuration' => '', 'Configuration of individual TODO items' => '', 'Configure' => '', 'Confirm' => '', @@ -857,6 +859,7 @@ $self->{texts} = { 'Include in Report' => '', 'Include in drop-down menus' => '', 'Includeable in reports' => '', + 'income' => 'Income statement', 'Income Statement' => '', 'Income accno' => '', 'Incoming Payments' => '', @@ -883,6 +886,7 @@ $self->{texts} = { 'Inventory Account' => '', 'Inventory quantity must be zero before you can set this assembly obsolete!' => '', 'Inventory quantity must be zero before you can set this part obsolete!' => '', + 'Inventory system' => '', 'Invno.' => '', 'Invnumber' => '', 'Invnumber missing!' => '', @@ -1212,10 +1216,12 @@ $self->{texts} = { 'Per. Inv.' => '', 'Period' => '', 'Period:' => '', + 'periodic' => '', 'Periodic Invoices' => '', 'Periodic invoices active' => '', 'Periodic invoices inactive' => '', 'Periodicity' => '', + 'perpetual:' => '', 'Personal settings' => '', 'Pg Database Administration' => '', 'Phone' => '', @@ -1299,6 +1305,7 @@ $self->{texts} = { 'Produce Assembly' => '', 'Productivity' => '', 'Profit Center' => '', + 'Profit determination' => '', 'Proforma Invoice' => '', 'Program' => '', 'Project' => '', @@ -1980,6 +1987,7 @@ $self->{texts} = { 'bankaccounts' => '', 'banktransfers' => '', 'bestbefore #1' => '', + 'balance' => '', 'bin_list' => '', 'bis' => '', 'button' => '', diff --git a/sql/Pg-upgrade2/umstellung_eur.pl b/sql/Pg-upgrade2/umstellung_eur.pl new file mode 100644 index 000000000..560bf645a --- /dev/null +++ b/sql/Pg-upgrade2/umstellung_eur.pl @@ -0,0 +1,75 @@ +# @tag: umstellung_eur +# @description: Variable eur umstellen: bitte doc/umstellung_eur.txt lesen +# @depends: units_id +# @charset: utf-8 + +# this script relies on $eur still being set in lx_office.conf, and the +# variable available in $::lx_office_conf{system}->{eur} +# better @depends would be release_2_6_3 + +use utf8; +#use strict; +use Data::Dumper; +die("This script cannot be run from the command line.") unless ($main::form); + +sub mydberror { + my ($msg) = @_; + die($dbup_locale->text("Database update error:") . + "
$msg
" . $DBI::errstr); +} + +sub do_query { + my ($query, $may_fail) = @_; + + if (!$dbh->do($query)) { + mydberror($query) unless ($may_fail); + $dbh->rollback(); + $dbh->begin_work(); + } +} + +sub do_update { + + # check if accounting_method has already been set (new database), if so return + # only set variables according to eur for update of existing database + + + foreach my $column (qw(accounting_method inventory_system profit_determination)) { + # this query will fail if columns already exist (new database) + do_query(qq|ALTER TABLE defaults ADD COLUMN ${column} TEXT|, 1); + } + + my $accounting_method; + my $inventory_system; + my $profit_determination; + + # check current configuration and set default variables accordingly, so that + # Lx-Office behaviour isn't changed by this update + + if ($::lx_office_conf{system}->{eur} == 0 ) { + $accounting_method = 'accrual'; + $inventory_system = 'perpetual'; + $profit_determination = 'balance'; + } elsif ( $::lx_office_conf{system}->{eur} == 1 ) { + $accounting_method = 'cash'; + $inventory_system = 'periodic'; + $profit_determination = 'income'; + } else { + die "illegal configuration of eur, must be 0 or 1, not " . $::lx_office_conf{system}->{eur} . "\n"; + # or maybe just return 1, dont do anything, because we assume everything is + # already set, or has maybe already been deleted + }; + + # only set parameters if they haven't already been set (this in only the case + # when upgrading) + + my $update_eur = "UPDATE defaults set accounting_method = '$accounting_method' where accounting_method is null;" . + "UPDATE defaults set inventory_system = '$inventory_system' where inventory_system is null; " . + "UPDATE defaults set profit_determination = '$profit_determination' where profit_determination is null;"; + do_query($update_eur); + + return 1; +} + +return do_update(); + diff --git a/sql/lx-office.sql b/sql/lx-office.sql index 3cffed08f..fcb157c2c 100644 --- a/sql/lx-office.sql +++ b/sql/lx-office.sql @@ -177,7 +177,10 @@ CREATE TABLE "defaults" ( itime timestamp without time zone DEFAULT now(), mtime timestamp without time zone, rmanumber text, - cnnumber text + cnnumber text, + accounting_method text, + inventory_system text, + profit_determination text ); diff --git a/templates/webpages/admin/create_dataset.html b/templates/webpages/admin/create_dataset.html index 0cfe3b92e..35f2a31a7 100644 --- a/templates/webpages/admin/create_dataset.html +++ b/templates/webpages/admin/create_dataset.html @@ -44,6 +44,32 @@ + + [% 'Accounting method' | $T8 %] + + + + + + [% 'Inventory system' | $T8 %] + + + + + + + [% 'Profit determination' | $T8 %] + + + + + diff --git a/templates/webpages/am/edit_defaults.html b/templates/webpages/am/edit_defaults.html index d346b893f..8829ba60c 100644 --- a/templates/webpages/am/edit_defaults.html +++ b/templates/webpages/am/edit_defaults.html @@ -156,6 +156,31 @@ + + [% 'Configuration' | $T8 %] + + + + [% 'Accounting method' | $T8 %] + + + + + [% 'Inventory system' | $T8 %] + + + + + [% 'Profit determination' | $T8 %] + + + + + [% 'Chart of accounts' | $T8 %] + + + +