$self->{all_salesmen} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $self->{cv}->salesman_id, deleted => 0 ] ]);
}
- $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all();
+ $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(where => [ or => [ id => $self->{cv}->payment_id,
+ obsolete => 0 ] ]);
$self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all();
$self->{all_projects} = SL::DB::Manager::Project->get_all(where => [ or => [ id => $self->order->globalproject_id,
active => 1 ] ],
sort_by => 'projectnumber');
- $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted();
+ $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(where => [ or => [ id => $self->order->payment_id,
+ obsolete => 0 ] ]);
+
$self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
$self->{current_employee_id} = SL::DB::Manager::Employee->current->id;
}
sub init_all_payment_terms {
- SL::DB::Manager::PaymentTerm->get_all_sorted;
+ my ($self) = @_;
+ SL::DB::Manager::PaymentTerm->get_all_sorted(query => [ or => [ id => $self->part->payment_id, obsolete => 0 ] ]);
}
sub init_all_price_factors {
id => { type => 'integer', not_null => 1, sequence => 'id' },
itime => { type => 'timestamp', default => 'now()' },
mtime => { type => 'timestamp' },
- percent_skonto => { type => 'float', precision => 4, scale => 4 },
+ obsolete => { type => 'boolean', default => 'false' },
+ percent_skonto => { type => 'float', scale => 4 },
ranking => { type => 'integer' },
sortkey => { type => 'integer', not_null => 1 },
terms_netto => { type => 'integer' },
# get payment terms
$query = qq|SELECT id, description
FROM payment_terms
- ORDER BY sortkey|;
-
- $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query);
+ WHERE ( obsolete IS FALSE OR id = ? )
+ ORDER BY sortkey |;
+ $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef);
$main::lxdebug->leave_sub();
}
}
}
+# language_payment duplicates some of the functionality of all_vc (language,
+# printer, payment_terms), and at least in the case of sales invoices both
+# all_vc and language_payment are called when adding new invoices
sub language_payment {
$main::lxdebug->enter_sub();
# get payment terms
$query = qq|SELECT id, description
FROM payment_terms
- ORDER BY sortkey|;
-
- $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query);
+ WHERE ( obsolete IS FALSE OR id = ? )
+ ORDER BY sortkey |;
+ $self->{payment_terms} = selectall_hashref_query($self, $dbh, $query, $self->{payment_id} || undef);
# get buchungsgruppen
$query = qq|SELECT id, description
use SL::DB::Customer;
use SL::DB::TaxZone;
+use SL::DB::PaymentTerm;
require "bin/mozilla/io.pl";
require "bin/mozilla/arap.pl";
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
- "payments" => "ALL_PAYMENTS",
"currencies" => "ALL_CURRENCIES",
$vc => { key => "ALL_" . uc($vc),
limit => $myconfig{vclimit} + 1 },
"price_factors" => "ALL_PRICE_FACTORS");
+ $form->{ALL_PAYMENTS} = SL::DB::Manager::PaymentTerm->get_all( where => [ or => [ obsolete => 0, id => $form->{payment_id} || undef ] ]);
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
--- /dev/null
+-- @tag: payment_terms_obsolete
+-- @description: Zahlungsbedingungen ungültig setzen
+-- @charset: UTF-8
+-- @depends: release_3_4_1
+-- @ignore: 0
+
+ALTER TABLE payment_terms ADD COLUMN obsolete BOOLEAN DEFAULT FALSE;
<table>
<tr>
<th align="right">[% 'Payment Terms' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'payment_id',
- style = 'width: 250px',
- DATA = payment_terms,
- id_key = 'id',
- label_key = 'description',
- show_empty = 1
- allow_textbox = 0 -%]
+ <td>[% L.select_tag('payment_id', payment_terms, default = payment_id, title_key = 'description', with_empty = 1, style="width: 250px") %]
<script type='text/javascript'>$('#payment_id').change(function(){ kivi.SalesPurchase.set_duedate_on_reference_date_change("invdate"); })</script>
</td>
</tr>
</tr>
<tr>
<th align="right">[% 'Payment Terms' | $T8 %]</th>
- <td>
- [%- INCLUDE 'generic/multibox.html'
- name = 'payment_id',
- style = 'width: 250px',
- DATA = ALL_PAYMENTS,
- id_key = 'id',
- label_key = 'description',
- show_empty = 1 -%]
- </td>
+ <td>[% L.select_tag('payment_id', ALL_PAYMENTS, default = payment_id, title_key = 'description', with_empty = 1, style="width: 250px") %]</td>
</tr>
<tr>
<th align="right">[% 'Delivery Terms' | $T8 %]</th>
</td>
</tr>
+ [% IF SELF.payment_term.id %]
+ <tr>
+ <td>[% 'Obsolete' | $T8 %]</td>
+ <td>[% L.checkbox_tag('payment_term.obsolete', checked = SELF.payment_term.obsolete, for_submit=1) %]</td>
+ </tr>
+ </tr>
+ [% END %]
+
<tr class="listheading">
<th></th>
<th>[% LxERP.t8("Texts for quotations & orders") %]</th>
<th align="right">[%- 'Netto Terms' | $T8 %]</th>
<th align="right">[%- 'Skonto Terms' | $T8 %]</th>
<th align="right">[%- 'Skonto' | $T8 %]</th>
+ <th align="right">[%- 'Obsolete' | $T8 %]</th>
</tr>
</thead>
<td align="right">[%- HTML.escape(payment_term.terms_netto_as_number) %]</td>
<td align="right">[%- HTML.escape(payment_term.terms_skonto_as_number) %]</td>
<td align="right">[%- HTML.escape(payment_term.percent_skonto_as_percent) %] %</td>
+ <td align="right">[%- HTML.escape(payment_term.obsolete) %]</td>
</tr>
[%- END %]
</tbody>