use SL::GenericTranslations;
use SL::IO;
use SL::MoreCommon;
+use SL::DB::Default;
use List::Util qw(min);
use strict;
# update parts table by setting lastcost to current price, don't allow negative values by using abs
$query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
- @values = (abs($form->{"sellprice_$i"}), conv_i($form->{"id_$i"}));
+ @values = (abs($form->{"sellprice_$i"} / $basefactor), conv_i($form->{"id_$i"}));
do_query($form, $dbh, $query, @values);
# check if we sold the item already and
# update lastcost
$query = qq|UPDATE parts SET lastcost = ? WHERE id = ?|;
- do_query($form, $dbh, $query, $form->{"sellprice_$i"}, conv_i($form->{"id_$i"}));
+ do_query($form, $dbh, $query, $form->{"sellprice_$i"} / $basefactor, conv_i($form->{"id_$i"}));
}
next if $payments_only;
for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"acc_trans_id_$i"}
&& $payments_only
- && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
+ && (SL::DB::Default->get->payments_changeable == 0)) {
next;
}
'table' => 'ap',);
# safety check datev export
- if ($::lx_office_conf{datev_check}{check_on_purchase_invoice}) {
+ if ($::instance_conf->get_datev_check_on_purchase_invoice) {
my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
$transdate ||= DateTime->today;
$old_form = save_form();
# Delete all entries in acc_trans from prior payments.
- if ($::lx_office_conf{features}->{payments_changeable} != 0) {
+ if (SL::DB::Default->get->payments_changeable != 0) {
$self->_delete_payments($form, $dbh);
}