projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bugfix bei Artikelstammdaten: Beim erneuten Aufrufen des Sprachenfensters wurden...
[kivitendo-erp.git]
/
SL
/
DN.pm
diff --git
a/SL/DN.pm
b/SL/DN.pm
index
4f08271
..
125e33c
100644
(file)
--- a/
SL/DN.pm
+++ b/
SL/DN.pm
@@
-61,12
+61,9
@@
sub get_config {
}
$query =
}
$query =
- qq|SELECT
- dunning_create_invoices_for_fees, dunning_ar_amount_fee,
- dunning_ar_amount_interest, dunning_ar
+ qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar
FROM defaults|;
FROM defaults|;
- ($form->{create_invoices_for_fees}, $form->{AR_amount_fee},
- $form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query);
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
$dbh->disconnect();
$dbh->disconnect();
@@
-93,7
+90,8
@@
sub save_config {
$form->{"email_subject_$i"}, $form->{"email_body_$i"},
$form->{"template_$i"}, $form->{"fee_$i"}, $form->{"interest_rate_$i"},
$form->{"active_$i"} ? 't' : 'f', $form->{"auto_$i"} ? 't' : 'f', $form->{"email_$i"} ? 't' : 'f',
$form->{"email_subject_$i"}, $form->{"email_body_$i"},
$form->{"template_$i"}, $form->{"fee_$i"}, $form->{"interest_rate_$i"},
$form->{"active_$i"} ? 't' : 'f', $form->{"auto_$i"} ? 't' : 'f', $form->{"email_$i"} ? 't' : 'f',
- $form->{"email_attachment_$i"} ? 't' : 'f', conv_i($form->{"payment_terms_$i"}), conv_i($form->{"terms_$i"}));
+ $form->{"email_attachment_$i"} ? 't' : 'f', conv_i($form->{"payment_terms_$i"}), conv_i($form->{"terms_$i"}),
+ $form->{"create_invoices_for_fees_$i"} ? 't' : 'f');
if ($form->{"id_$i"}) {
$query =
qq|UPDATE dunning_config SET
if ($form->{"id_$i"}) {
$query =
qq|UPDATE dunning_config SET
@@
-101,7
+99,8
@@
sub save_config {
email_subject = ?, email_body = ?,
template = ?, fee = ?, interest_rate = ?,
active = ?, auto = ?, email = ?,
email_subject = ?, email_body = ?,
template = ?, fee = ?, interest_rate = ?,
active = ?, auto = ?, email = ?,
- email_attachment = ?, payment_terms = ?, terms = ?
+ email_attachment = ?, payment_terms = ?, terms = ?,
+ create_invoices_for_fees = ?
WHERE id = ?|;
push(@values, conv_i($form->{"id_$i"}));
} else {
WHERE id = ?|;
push(@values, conv_i($form->{"id_$i"}));
} else {
@@
-109,8
+108,8
@@
sub save_config {
qq|INSERT INTO dunning_config
(dunning_level, dunning_description, email_subject, email_body,
template, fee, interest_rate, active, auto, email,
qq|INSERT INTO dunning_config
(dunning_level, dunning_description, email_subject, email_body,
template, fee, interest_rate, active, auto, email,
- email_attachment, payment_terms, terms)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ email_attachment, payment_terms, terms
, create_invoices_for_fees
)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
, ?
)|;
}
do_query($form, $dbh, $query, @values);
}
}
do_query($form, $dbh, $query, @values);
}
@@
-121,14
+120,8
@@
sub save_config {
}
}
}
}
- $query = qq|UPDATE defaults SET dunning_create_invoices_for_fees = ?|;
- @values = ($form->{create_invoices_for_fees} ? 't' : 'f');
-
- if ($form->{create_invoices_for_fees}) {
- $query .= qq|, dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|;
- push @values, conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR});
- }
-
+ $query = qq|UPDATE defaults SET dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|;
+ @values = (conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR}));
do_query($form, $dbh, $query, @values);
$dbh->commit();
do_query($form, $dbh, $query, @values);
$dbh->commit();
@@
-144,19
+137,20
@@
sub create_invoice_for_fees {
my ($query, @values, $sth, $ref);
my ($query, @values, $sth, $ref);
- $query =
- qq|SELECT
- dunning_create_invoices_for_fees, dunning_ar_amount_fee,
- dunning_ar_amount_interest, dunning_ar
- FROM defaults|;
- ($form->{create_invoices_for_fees}, $form->{AR_amount_fee},
- $form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query);
+ $query = qq|SELECT dcfg.create_invoices_for_fees
+ FROM dunning d
+ LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
+ WHERE d.dunning_id = ?|;
+ my ($create_invoices_for_fees) = selectrow_query($form, $dbh, $query, $dunning_id);
- if (!$
form->{create_invoices_for_fees}
) {
+ if (!$
create_invoices_for_fees
) {
$main::lxdebug->leave_sub();
return;
}
$main::lxdebug->leave_sub();
return;
}
+ $query = qq|SELECT dunning_ar_amount_fee, dunning_ar_amount_interest, dunning_ar FROM defaults|;
+ ($form->{AR_amount_fee}, $form->{AR_amount_interest}, $form->{AR}) = selectrow_query($form, $dbh, $query);
+
$query =
qq|SELECT
fee,
$query =
qq|SELECT
fee,
@@
-204,6
+198,7
@@
sub create_invoice_for_fees {
}
my ($ar_id) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
}
my ($ar_id) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|);
+ my $curr = $form->get_default_currency($myconfig);
$query =
qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id,
$query =
qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id,
@@
-226,7
+221,7
@@
sub create_invoice_for_fees {
?, -- netamount
0, -- paid
-- duedate:
?, -- netamount
0, -- paid
-- duedate:
- (SELECT duedate FROM dunning WHERE dunning_id = ?),
+ (SELECT duedate FROM dunning WHERE dunning_id = ?
LIMIT 1
),
'f', -- invoice
?, -- curr
?, -- notes
'f', -- invoice
?, -- curr
?, -- notes
@@
-239,7
+234,7
@@
sub create_invoice_for_fees {
$amount,
$amount,
$dunning_id, # duedate
$amount,
$amount,
$dunning_id, # duedate
-
(split m/:/, $myconfig->{currency})[0], #
currency
+
$curr, # default
currency
sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes
$form->{login}); # employee_id
do_query($form, $dbh, $query, @values);
sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes
$form->{login}); # employee_id
do_query($form, $dbh, $query, @values);
@@
-691,9
+686,10
@@
sub print_dunning {
dcfg.email_subject, dcfg.email_body, dcfg.email_attachment,
ar.transdate, ar.duedate, ar.customer_id,
dcfg.email_subject, dcfg.email_body, dcfg.email_attachment,
ar.transdate, ar.duedate, ar.customer_id,
- ar.invnumber, ar.ordnumber,
+ ar.invnumber, ar.ordnumber,
ar.cp_id,
ar.amount, ar.netamount, ar.paid,
ar.amount, ar.netamount, ar.paid,
- ar.amount - ar.paid AS open_amount
+ ar.amount - ar.paid AS open_amount,
+ ar.amount - ar.paid + da.fee + da.interest AS linetotal
FROM dunning da
LEFT JOIN dunning_config dcfg ON (dcfg.id = da.dunning_config_id)
FROM dunning da
LEFT JOIN dunning_config dcfg ON (dcfg.id = da.dunning_config_id)
@@
-707,7
+703,7
@@
sub print_dunning {
map({ $form->{"dn_$_"} = []; } keys(%{$ref}));
$first = 0;
}
map({ $form->{"dn_$_"} = []; } keys(%{$ref}));
$first = 0;
}
- map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2) } qw(amount netamount paid open_amount fee interest);
+ map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2) } qw(amount netamount paid open_amount fee interest
linetotal
);
map { $form->{$_} = $ref->{$_} } keys %$ref;
map { push @{ $form->{"dn_$_"} }, $ref->{$_}} keys %$ref;
}
map { $form->{$_} = $ref->{$_} } keys %$ref;
map { push @{ $form->{"dn_$_"} }, $ref->{$_}} keys %$ref;
}
@@
-716,10
+712,13
@@
sub print_dunning {
$query =
qq|SELECT
c.id AS customer_id, c.name, c.street, c.zipcode, c.city,
$query =
qq|SELECT
c.id AS customer_id, c.name, c.street, c.zipcode, c.city,
- c.country, c.department_1, c.department_2, c.email
+ c.country, c.department_1, c.department_2, c.email, c.customernumber,
+ -- contact information
+ co.*
FROM dunning d
FROM dunning d
- LEFT JOIN ar ON (d.trans_id = ar.id)
- LEFT JOIN customer c ON (ar.customer_id = c.id)
+ LEFT JOIN ar ON (d.trans_id = ar.id)
+ LEFT JOIN customer c ON (ar.customer_id = c.id)
+ LEFT JOIN contacts co ON (ar.cp_id = co.cp_id)
WHERE (d.dunning_id = ?)
LIMIT 1|;
$ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
WHERE (d.dunning_id = ?)
LIMIT 1|;
$ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
@@
-807,7
+806,7
@@
sub print_invoice_for_fees {
$query =
qq|SELECT
$query =
qq|SELECT
- ar.invnumber, ar.transdate, ar.amount, ar.netamount,
+ ar.invnumber, ar.transdate
AS invdate
, ar.amount, ar.netamount,
ar.duedate, ar.notes, ar.notes AS invoicenotes,
c.name, c.department_1, c.department_2, c.street, c.zipcode, c.city, c.country,
ar.duedate, ar.notes, ar.notes AS invoicenotes,
c.name, c.department_1, c.department_2, c.street, c.zipcode, c.city, c.country,