From 7bff84cbc6daa65a74b9f5c83415c98856eb30a1 Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Thu, 6 Sep 2012 14:01:34 +0200 Subject: [PATCH] =?utf8?q?M=C3=B6glichkeit=20zum=20Setzen=20von=20"Steuer?= =?utf8?q?=20im=20Preis=20inbegriffen"=20als=20Default?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit fixt #1985 --- SL/CT.pm | 8 +- SL/DB/MetaSetup/Customer.pm | 89 ++++++++++--------- SL/IS.pm | 1 + SL/User.pm | 2 +- bin/mozilla/is.pl | 12 +++ bin/mozilla/oe.pl | 12 +++ locale/de/all | 2 + .../customer_add_taxincluded_checked.sql | 6 ++ templates/webpages/am/config.html | 8 ++ templates/webpages/ct/form_header.html | 5 ++ templates/webpages/is/form_footer.html | 3 +- templates/webpages/oe/form_footer.html | 4 +- 12 files changed, 103 insertions(+), 49 deletions(-) create mode 100644 sql/Pg-upgrade2/customer_add_taxincluded_checked.sql diff --git a/SL/CT.pm b/SL/CT.pm index fabc3cac8..45745f42d 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -319,7 +319,8 @@ sub save_customer { qq|user_password = ?, | . qq|c_vendor_id = ?, | . qq|klass = ?, | . - qq|curr = ? | . + qq|curr = ?, | . + qq|taxincluded_checked = ? | . qq|WHERE id = ?|; my @values = ( $form->{customernumber}, @@ -362,6 +363,7 @@ sub save_customer { $form->{c_vendor_id}, conv_i($form->{klass}), substr($form->{currency}, 0, 3), + $form->{taxincluded_checked}, $form->{id} ); do_query( $form, $dbh, $query, @values ); @@ -483,7 +485,8 @@ sub save_vendor { qq| username = ?, | . qq| user_password = ?, | . qq| v_customer_id = ?, | . - qq| curr = ? | . + qq| curr = ?, | . + qq| taxincluded_checked = ? | . qq|WHERE id = ?|; my @values = ( $form->{vendornumber}, @@ -524,6 +527,7 @@ sub save_vendor { $form->{user_password}, $form->{v_customer_id}, substr($form->{currency}, 0, 3), + $form->{taxincluded_checked}, $form->{id} ); do_query($form, $dbh, $query, @values); diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index 722ff9df6..a1d1dec5f 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -10,50 +10,51 @@ __PACKAGE__->meta->setup( table => 'customer', columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - name => { type => 'text', not_null => 1 }, - department_1 => { type => 'varchar', length => 75 }, - department_2 => { type => 'varchar', length => 75 }, - street => { type => 'varchar', length => 75 }, - zipcode => { type => 'varchar', length => 10 }, - city => { type => 'varchar', length => 75 }, - country => { type => 'varchar', length => 75 }, - contact => { type => 'text' }, - phone => { type => 'text' }, - fax => { type => 'varchar', length => 30 }, - homepage => { type => 'text' }, - email => { type => 'text' }, - notes => { type => 'text' }, - discount => { type => 'float', precision => 4 }, - taxincluded => { type => 'boolean' }, - creditlimit => { type => 'numeric', default => '0', precision => 5, scale => 15 }, - terms => { type => 'integer', default => '0' }, - customernumber => { type => 'text' }, - cc => { type => 'text' }, - bcc => { type => 'text' }, - business_id => { type => 'integer' }, - taxnumber => { type => 'text' }, - account_number => { type => 'text' }, - bank_code => { type => 'text' }, - bank => { type => 'text' }, - language => { type => 'varchar', length => 5 }, - itime => { type => 'timestamp', default => 'now()' }, - mtime => { type => 'timestamp' }, - obsolete => { type => 'boolean', default => 'false' }, - username => { type => 'varchar', length => 50 }, - user_password => { type => 'text' }, - salesman_id => { type => 'integer' }, - c_vendor_id => { type => 'text' }, - klass => { type => 'integer', default => '0' }, - language_id => { type => 'integer' }, - payment_id => { type => 'integer' }, - taxzone_id => { type => 'integer', default => '0', not_null => 1 }, - greeting => { type => 'text' }, - ustid => { type => 'text' }, - iban => { type => 'varchar', length => 100 }, - bic => { type => 'varchar', length => 100 }, - direct_debit => { type => 'boolean', default => 'false' }, - curr => { type => 'character', length => 3 }, + id => { type => 'integer', not_null => 1, sequence => 'id' }, + name => { type => 'text', not_null => 1 }, + department_1 => { type => 'varchar', length => 75 }, + department_2 => { type => 'varchar', length => 75 }, + street => { type => 'varchar', length => 75 }, + zipcode => { type => 'varchar', length => 10 }, + city => { type => 'varchar', length => 75 }, + country => { type => 'varchar', length => 75 }, + contact => { type => 'text' }, + phone => { type => 'text' }, + fax => { type => 'varchar', length => 30 }, + homepage => { type => 'text' }, + email => { type => 'text' }, + notes => { type => 'text' }, + discount => { type => 'float', precision => 4 }, + taxincluded => { type => 'boolean' }, + creditlimit => { type => 'numeric', default => '0', precision => 5, scale => 15 }, + terms => { type => 'integer', default => '0' }, + customernumber => { type => 'text' }, + cc => { type => 'text' }, + bcc => { type => 'text' }, + business_id => { type => 'integer' }, + taxnumber => { type => 'text' }, + account_number => { type => 'text' }, + bank_code => { type => 'text' }, + bank => { type => 'text' }, + language => { type => 'varchar', length => 5 }, + itime => { type => 'timestamp', default => 'now()' }, + mtime => { type => 'timestamp' }, + obsolete => { type => 'boolean', default => 'false' }, + username => { type => 'varchar', length => 50 }, + user_password => { type => 'text' }, + salesman_id => { type => 'integer' }, + c_vendor_id => { type => 'text' }, + klass => { type => 'integer', default => '0' }, + language_id => { type => 'integer' }, + payment_id => { type => 'integer' }, + taxzone_id => { type => 'integer', default => '0', not_null => 1 }, + greeting => { type => 'text' }, + ustid => { type => 'text' }, + iban => { type => 'varchar', length => 100 }, + bic => { type => 'varchar', length => 100 }, + direct_debit => { type => 'boolean', default => 'false' }, + curr => { type => 'character', length => 3 }, + taxincluded_checked => { type => 'varchar', length => 1 }, ], primary_key_columns => [ 'id' ], diff --git a/SL/IS.pm b/SL/IS.pm index 32b517121..22080c7e6 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1676,6 +1676,7 @@ sub get_customer { c.email, c.cc, c.bcc, c.language_id, c.payment_id, c.street, c.zipcode, c.city, c.country, c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, c.curr, + c.taxincluded_checked, $duedate + COALESCE(pt.terms_netto, 0) AS duedate, b.discount AS tradediscount, b.description AS business FROM customer c diff --git a/SL/User.pm b/SL/User.pm index 0ac87fe90..2de54ee5e 100644 --- a/SL/User.pm +++ b/SL/User.pm @@ -754,7 +754,7 @@ sub config_vars { taxnumber co_ustid duns menustyle template_format default_media default_printer_id copies show_form_details favorites pdonumber sdonumber hide_cvar_search_options mandatory_departments - sepa_creditor_id); + sepa_creditor_id taxincluded_checked); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index aefa54522..9d48cf2d8 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -405,6 +405,18 @@ sub form_footer { my ($tax, $subtotal); $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ]; + IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; + + if ( $form->{vc} eq 'customer' && !$form->{taxincluded_changed_by_user} ) { + if ( $form->{taxincluded_checked} eq 'y' ) { + $form->{taxincluded} = 1; + } elsif ( $form->{taxincluded_checked} eq 'n' ) { + $form->{taxincluded} = 0; + } else { + $form->{taxincluded} = $myconfig{taxincluded_checked}; + } + } + foreach my $item (@{ $form->{taxaccounts_array} }) { if ($form->{"${item}_base"}) { if ($form->{taxincluded}) { diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index c1b281c6b..73c70b30f 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -475,6 +475,18 @@ sub form_footer { $TMPL_VAR{notes} = qq||; $TMPL_VAR{intnotes} = qq||; + IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; + + if ( $form->{vc} eq 'customer' && !$form->{taxincluded_changed_by_user} ) { + if ( $form->{taxincluded_checked} eq 'y' ) { + $form->{taxincluded} = 1; + } elsif ( $form->{taxincluded_checked} eq 'n' ) { + $form->{taxincluded} = 0; + } else { + $form->{taxincluded} = $myconfig{taxincluded_checked}; + } + } + if (!$form->{taxincluded}) { foreach my $item (split / /, $form->{taxaccounts}) { diff --git a/locale/de/all b/locale/de/all index b4b66284b..a1f1c9b54 100644 --- a/locale/de/all +++ b/locale/de/all @@ -2398,6 +2398,7 @@ $self->{texts} = { 'tax_rate' => 'Prozent', 'tax_taxdescription' => 'Steuername', 'tax_taxkey' => 'Steuerschlüssel', + 'taxincluded checked' => '"Steuer im Preis inbegriffen" vorwählen', 'taxnumber' => 'Automatikkonto', 'terminated' => 'gekündigt', 'to (date)' => 'bis', @@ -2408,6 +2409,7 @@ $self->{texts} = { 'trial_balance' => 'susa', 'up' => 'hoch', 'use program settings' => 'benutze Programmeinstellungen', + 'use user config' => 'Verwende Benutzereinstellung', 'used' => 'Verbraucht', 'valid from' => 'Gültig ab', 'vendor' => 'Lieferant', diff --git a/sql/Pg-upgrade2/customer_add_taxincluded_checked.sql b/sql/Pg-upgrade2/customer_add_taxincluded_checked.sql new file mode 100644 index 000000000..b8b7507df --- /dev/null +++ b/sql/Pg-upgrade2/customer_add_taxincluded_checked.sql @@ -0,0 +1,6 @@ +-- @tag: customer_add_taxincluded_checked +-- @description: Feld "Steuer im Preis inbegriffen" vormarkierbar machen +-- @encoding: utf-8 +-- @depends: release_2_7_0 + +ALTER TABLE customer ADD COLUMN taxincluded_checked varchar(1) DEFAULT '' NOT NULL; diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index 7e2293d94..29a968757 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -69,6 +69,14 @@ [% 'SEPA creditor ID' | $T8 %] + + + [% 'taxincluded checked' | $T8 %] + + [% L.yes_no_tag('taxincluded_checked', myconfig_taxincluded_checked) %] + + +
diff --git a/templates/webpages/ct/form_header.html b/templates/webpages/ct/form_header.html index 9c3df1221..d2e5c3508 100644 --- a/templates/webpages/ct/form_header.html +++ b/templates/webpages/ct/form_header.html @@ -282,6 +282,11 @@ [% L.select_tag('salesman_id', ALL_SALESMEN, default = salesman_id, with_empty = 1, title_key = 'safe_name') %] [%- END %] + + + [% 'taxincluded checked' | $T8 %] + [% L.select_tag('taxincluded_checked', [[undef, LxERP.t8('use user config')], ['y', LxERP.t8('Yes')], ['n', LxERP.t8('No')]], default = taxincluded_checked) %] + diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index 966eafe1b..cf5c7d4fc 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -60,7 +60,8 @@ [%- END %]
[%- IF taxaccounts %] - + + [% 'Tax Included' | $T8 %]

diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index 19f90cd77..6a8e64fcd 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -70,8 +70,10 @@
+ [%- IF taxaccounts %] - [% 'Tax Included' | $T8 %]

+ + [% 'Tax Included' | $T8 %]

[%- END %] [%- IF NOT taxincluded %] -- 2.20.1