Revision 232a9153
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/DN.pm | ||
---|---|---|
34 | 34 |
|
35 | 35 |
package DN; |
36 | 36 |
|
37 |
use SL::Template; |
|
38 |
use SL::IS; |
|
39 | 37 |
use SL::Common; |
40 | 38 |
use SL::DBUtils; |
41 |
use Data::Dumper; |
|
39 |
use SL::IS; |
|
40 |
use SL::Mailer; |
|
41 |
use SL::MoreCommon; |
|
42 |
use SL::Template; |
|
42 | 43 |
|
43 | 44 |
sub get_config { |
44 | 45 |
$main::lxdebug->enter_sub(); |
... | ... | |
59 | 60 |
$ref->{interest_rate} = $form->format_amount($myconfig, ($ref->{interest_rate} * 100)); |
60 | 61 |
} |
61 | 62 |
|
63 |
$query = |
|
64 |
qq|SELECT |
|
65 |
dunning_create_invoices_for_fees, dunning_ar_amount_fee, |
|
66 |
dunning_ar_amount_interest, dunning_ar |
|
67 |
FROM defaults|; |
|
68 |
($form->{create_invoices_for_fees}, $form->{AR_amount_fee}, |
|
69 |
$form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query); |
|
70 |
|
|
62 | 71 |
$dbh->disconnect(); |
63 | 72 |
|
64 | 73 |
$main::lxdebug->leave_sub(); |
... | ... | |
112 | 121 |
} |
113 | 122 |
} |
114 | 123 |
|
115 |
$dbh->commit; |
|
116 |
$dbh->disconnect; |
|
124 |
$query = qq|UPDATE defaults SET dunning_create_invoices_for_fees = ?|; |
|
125 |
@values = ($form->{create_invoices_for_fees} ? 't' : 'f'); |
|
126 |
|
|
127 |
if ($form->{create_invoices_for_fees}) { |
|
128 |
$query .= qq|, dunning_ar_amount_fee = ?, dunning_ar_amount_interest = ?, dunning_ar = ?|; |
|
129 |
push @values, conv_i($form->{AR_amount_fee}), conv_i($form->{AR_amount_interest}), conv_i($form->{AR}); |
|
130 |
} |
|
131 |
|
|
132 |
do_query($form, $dbh, $query, @values); |
|
133 |
|
|
134 |
$dbh->commit(); |
|
135 |
$dbh->disconnect(); |
|
136 |
|
|
137 |
$main::lxdebug->leave_sub(); |
|
138 |
} |
|
139 |
|
|
140 |
sub create_invoice_for_fees { |
|
141 |
$main::lxdebug->enter_sub(); |
|
142 |
|
|
143 |
my ($self, $myconfig, $form, $dbh, $dunning_id) = @_; |
|
144 |
|
|
145 |
my ($query, @values, $sth, $ref); |
|
146 |
|
|
147 |
$query = |
|
148 |
qq|SELECT |
|
149 |
dunning_create_invoices_for_fees, dunning_ar_amount_fee, |
|
150 |
dunning_ar_amount_interest, dunning_ar |
|
151 |
FROM defaults|; |
|
152 |
($form->{create_invoices_for_fees}, $form->{AR_amount_fee}, |
|
153 |
$form->{AR_amount_interest}, $form->{AR} ) = selectrow_query($form, $dbh, $query); |
|
154 |
|
|
155 |
if (!$form->{create_invoices_for_fees}) { |
|
156 |
$main::lxdebug->leave_sub(); |
|
157 |
return; |
|
158 |
} |
|
159 |
|
|
160 |
$query = |
|
161 |
qq|SELECT |
|
162 |
fee, |
|
163 |
COALESCE(( |
|
164 |
SELECT MAX(d_fee.fee) |
|
165 |
FROM dunning d_fee |
|
166 |
WHERE (d_fee.trans_id = d.trans_id) |
|
167 |
AND (d_fee.dunning_id <> ?) |
|
168 |
AND NOT (d_fee.fee_interest_ar_id ISNULL) |
|
169 |
), 0) |
|
170 |
AS max_previous_fee, |
|
171 |
interest, |
|
172 |
COALESCE(( |
|
173 |
SELECT MAX(d_interest.interest) |
|
174 |
FROM dunning d_interest |
|
175 |
WHERE (d_interest.trans_id = d.trans_id) |
|
176 |
AND (d_interest.dunning_id <> ?) |
|
177 |
AND NOT (d_interest.fee_interest_ar_id ISNULL) |
|
178 |
), 0) |
|
179 |
AS max_previous_interest |
|
180 |
FROM dunning d |
|
181 |
WHERE dunning_id = ?|; |
|
182 |
@values = ($dunning_id, $dunning_id, $dunning_id); |
|
183 |
$sth = prepare_execute_query($form, $dbh, $query, @values); |
|
184 |
|
|
185 |
my ($fee_remaining, $interest_remaining) = (0, 0); |
|
186 |
my ($fee_total, $interest_total) = (0, 0); |
|
187 |
|
|
188 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
189 |
$fee_remaining += $form->round_amount($ref->{fee}, 2); |
|
190 |
$fee_remaining -= $form->round_amount($ref->{max_previous_fee}, 2); |
|
191 |
$fee_total += $form->round_amount($ref->{fee}, 2); |
|
192 |
$interest_remaining += $form->round_amount($ref->{interest}, 2); |
|
193 |
$interest_remaining -= $form->round_amount($ref->{max_previous_interest}, 2); |
|
194 |
$interest_total += $form->round_amount($ref->{interest}, 2); |
|
195 |
} |
|
196 |
|
|
197 |
$sth->finish(); |
|
198 |
|
|
199 |
my $amount = $fee_remaining + $interest_remaining; |
|
200 |
|
|
201 |
if (!$amount) { |
|
202 |
$main::lxdebug->leave_sub(); |
|
203 |
return; |
|
204 |
} |
|
205 |
|
|
206 |
my ($ar_id) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); |
|
207 |
|
|
208 |
$query = |
|
209 |
qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id, |
|
210 |
taxincluded, amount, netamount, paid, duedate, |
|
211 |
invoice, curr, notes, |
|
212 |
employee_id) |
|
213 |
VALUES ( |
|
214 |
?, -- id |
|
215 |
?, -- invnumber |
|
216 |
current_date, -- transdate |
|
217 |
current_date, -- gldate |
|
218 |
-- customer_id: |
|
219 |
(SELECT ar.customer_id |
|
220 |
FROM dunning dn |
|
221 |
LEFT JOIN ar ON (dn.trans_id = ar.id) |
|
222 |
WHERE dn.dunning_id = ? |
|
223 |
LIMIT 1), |
|
224 |
'f', -- taxincluded |
|
225 |
?, -- amount |
|
226 |
?, -- netamount |
|
227 |
0, -- paid |
|
228 |
-- duedate: |
|
229 |
(SELECT duedate FROM dunning WHERE dunning_id = ?), |
|
230 |
'f', -- invoice |
|
231 |
?, -- curr |
|
232 |
?, -- notes |
|
233 |
-- employee_id: |
|
234 |
(SELECT id FROM employee WHERE login = ?) |
|
235 |
)|; |
|
236 |
@values = ($ar_id, # id |
|
237 |
$form->update_defaults($myconfig, 'invnumber', $dbh), # invnumber |
|
238 |
$dunning_id, # customer_id |
|
239 |
$amount, |
|
240 |
$amount, |
|
241 |
$dunning_id, # duedate |
|
242 |
(split m/:/, $myconfig->{currency})[0], # currency |
|
243 |
sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes |
|
244 |
$form->{login}); # employee_id |
|
245 |
do_query($form, $dbh, $query, @values); |
|
246 |
|
|
247 |
$query = |
|
248 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, taxkey) |
|
249 |
VALUES (?, ?, ?, current_date, current_date, 0)|; |
|
250 |
$sth = prepare_query($form, $dbh, $query); |
|
251 |
|
|
252 |
@values = ($ar_id, conv_i($form->{AR_amount_fee}), $fee_remaining); |
|
253 |
do_statement($form, $sth, $query, @values); |
|
254 |
|
|
255 |
if ($interest_remaining) { |
|
256 |
@values = ($ar_id, conv_i($form->{AR_amount_interest}), $interest_remaining); |
|
257 |
do_statement($form, $sth, $query, @values); |
|
258 |
} |
|
259 |
|
|
260 |
@values = ($ar_id, conv_i($form->{AR}), -1 * $amount); |
|
261 |
do_statement($form, $sth, $query, @values); |
|
262 |
|
|
263 |
$sth->finish(); |
|
264 |
|
|
265 |
$query = qq|UPDATE dunning SET fee_interest_ar_id = ? WHERE dunning_id = ?|; |
|
266 |
do_query($form, $dbh, $query, $ar_id, $dunning_id); |
|
117 | 267 |
|
118 | 268 |
$main::lxdebug->leave_sub(); |
119 | 269 |
} |
... | ... | |
133 | 283 |
my $h_update_ar = prepare_query($form, $dbh, $q_update_ar); |
134 | 284 |
|
135 | 285 |
my $q_insert_dunning = |
136 |
qq|INSERT INTO dunning (dunning_id, dunning_config_id, dunning_level, |
|
137 |
trans_id, fee, interest, transdate, duedate)
|
|
286 |
qq|INSERT INTO dunning (dunning_id, dunning_config_id, dunning_level, trans_id,
|
|
287 |
fee, interest, transdate, duedate)
|
|
138 | 288 |
VALUES (?, ?, |
139 | 289 |
(SELECT dunning_level FROM dunning_config WHERE id = ?), |
140 | 290 |
?, |
... | ... | |
174 | 324 |
$h_update_ar->finish(); |
175 | 325 |
$h_insert_dunning->finish(); |
176 | 326 |
|
327 |
$form->{DUNNING_PDFS_EMAIL} = []; |
|
328 |
|
|
329 |
$self->create_invoice_for_fees($myconfig, $form, $dbh, $dunning_id); |
|
330 |
|
|
331 |
$self->print_invoice_for_fees($myconfig, $form, $dunning_id, $dbh); |
|
332 |
$self->print_dunning($myconfig, $form, $dunning_id, $dbh); |
|
333 |
|
|
334 |
$form->{dunning_id} = $dunning_id; |
|
335 |
|
|
336 |
if ($send_email) { |
|
337 |
$self->send_email($myconfig, $form, $dunning_id, $dbh); |
|
338 |
} |
|
339 |
|
|
340 |
# $dbh->commit(); |
|
341 |
$dbh->disconnect(); |
|
342 |
|
|
343 |
$main::lxdebug->leave_sub(); |
|
344 |
} |
|
345 |
|
|
346 |
sub send_email { |
|
347 |
$main::lxdebug->enter_sub(); |
|
348 |
|
|
349 |
my ($self, $myconfig, $form, $dunning_id, $dbh) = @_; |
|
350 |
|
|
177 | 351 |
my $query = |
178 | 352 |
qq|SELECT |
179 |
ar.invnumber, ar.ordnumber, ar.amount, ar.netamount, |
|
180 |
ar.transdate, ar.duedate, ar.paid, ar.amount - ar.paid AS open_amount, |
|
181 |
da.fee, da.interest, da.transdate AS dunning_date, da.duedate AS dunning_duedate |
|
182 |
FROM ar |
|
183 |
LEFT JOIN dunning_config cfg ON (cfg.id = ar.dunning_config_id) |
|
184 |
LEFT JOIN dunning da ON (ar.id = da.trans_id AND cfg.dunning_level = da.dunning_level) |
|
185 |
WHERE ar.id IN (| |
|
186 |
. join(", ", map { "?" } @invoice_ids) . qq|)|; |
|
353 |
dcfg.email_body, dcfg.email_subject, dcfg.email_attachment, |
|
354 |
c.email AS recipient |
|
187 | 355 |
|
188 |
my $sth = prepare_execute_query($form, $dbh, $query, @invoice_ids);
|
|
189 |
my $first = 1;
|
|
190 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
|
|
191 |
if ($first) {
|
|
192 |
map({ $form->{"dn_$_"} = []; } keys(%{$ref}));
|
|
193 |
$first = 0;
|
|
194 |
}
|
|
356 |
FROM dunning d
|
|
357 |
LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id)
|
|
358 |
LEFT JOIN ar ON (d.trans_id = ar.id)
|
|
359 |
LEFT JOIN customer c ON (ar.customer_id = c.id)
|
|
360 |
WHERE (d.dunning_id = ?)
|
|
361 |
LIMIT 1|;
|
|
362 |
my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id);
|
|
195 | 363 |
|
196 |
$ref->{interest_rate} = $form->format_amount($myconfig, $ref->{interest_rate} * 100); |
|
197 |
map { $ref->{$_} = $form->format_amount($myconfig, $ref->{$_}, 2) } qw(amount netamount paid open_amount fee interest); |
|
198 |
map { push(@{ $form->{"dn_$_"} }, $ref->{$_})} keys %$ref; |
|
199 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
|
364 |
if (!$ref || !$ref->{recipient} || !$myconfig->{email}) { |
|
365 |
$main::lxdebug->leave_sub(); |
|
366 |
return; |
|
200 | 367 |
} |
201 |
$sth->finish; |
|
202 | 368 |
|
203 |
$query =
|
|
204 |
qq|SELECT id AS customer_id, name, street, zipcode, city, country, department_1, department_2, email
|
|
205 |
FROM customer
|
|
206 |
WHERE id = ?|;
|
|
207 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $customer_id);
|
|
208 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref };
|
|
369 |
my $template = PlainTextTemplate->new(undef, $form, $myconfig);
|
|
370 |
my $mail = Mailer->new();
|
|
371 |
$mail->{from} = $myconfig->{email};
|
|
372 |
$mail->{to} = $ref->{recipient};
|
|
373 |
$mail->{subject} = $template->parse_block($ref->{email_subject});
|
|
374 |
$mail->{message} = $template->parse_block($ref->{email_body});
|
|
209 | 375 |
|
210 |
$query = |
|
211 |
qq|SELECT |
|
212 |
cfg.interest_rate, cfg.template AS formname, |
|
213 |
cfg.email_subject, cfg.email_body, cfg.email_attachment, |
|
214 |
(SELECT SUM(fee) |
|
215 |
FROM dunning |
|
216 |
WHERE dunning_id = ?) |
|
217 |
AS fee, |
|
218 |
(SELECT SUM(interest) |
|
219 |
FROM dunning |
|
220 |
WHERE dunning_id = ?) |
|
221 |
AS total_interest, |
|
222 |
(SELECT SUM(amount) - SUM(paid) |
|
223 |
FROM ar |
|
224 |
WHERE id IN (| . join(", ", map { "?" } @invoice_ids) . qq|)) |
|
225 |
AS total_open_amount |
|
226 |
FROM dunning_config cfg |
|
227 |
WHERE id = ?|; |
|
228 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id, $dunning_id, @invoice_ids, $next_dunning_config_id); |
|
229 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
|
376 |
if ($myconfig->{signature}) { |
|
377 |
$mail->{message} .= "\n-- \n$myconfig->{signature}"; |
|
378 |
} |
|
230 | 379 |
|
231 |
$form->{interest_rate} = $form->format_amount($myconfig, $ref->{interest_rate} * 100); |
|
232 |
$form->{fee} = $form->format_amount($myconfig, $ref->{fee}, 2); |
|
233 |
$form->{total_interest} = $form->format_amount($myconfig, $form->round_amount($ref->{total_interest}, 2), 2); |
|
234 |
$form->{total_open_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{total_open_amount}, 2), 2); |
|
235 |
$form->{total_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{fee} + $ref->{total_interest} + $ref->{total_open_amount}, 2), 2); |
|
380 |
$mail->{message} =~ s/\r\n/\n/g; |
|
381 |
|
|
382 |
if ($ref->{email_attachment} && @{ $form->{DUNNING_PDFS_EMAIL} }) { |
|
383 |
$mail->{attachments} = $form->{DUNNING_PDFS_EMAIL}; |
|
384 |
} |
|
385 |
|
|
386 |
$mail->send(); |
|
387 |
|
|
388 |
$main::lxdebug->leave_sub(); |
|
389 |
} |
|
390 |
|
|
391 |
sub set_template_options { |
|
392 |
$main::lxdebug->enter_sub(); |
|
393 |
|
|
394 |
my ($self, $myconfig, $form) = @_; |
|
236 | 395 |
|
237 | 396 |
$form->{templates} = "$myconfig->{templates}"; |
238 |
$form->{language} = $form->get_template_language(\%myconfig);
|
|
239 |
$form->{printer_code} = $form->get_printer_code(\%myconfig);
|
|
397 |
$form->{language} = $form->get_template_language($myconfig);
|
|
398 |
$form->{printer_code} = $form->get_printer_code($myconfig);
|
|
240 | 399 |
|
241 | 400 |
if ($form->{language} ne "") { |
242 | 401 |
$form->{language} = "_" . $form->{language}; |
... | ... | |
246 | 405 |
$form->{printer_code} = "_" . $form->{printer_code}; |
247 | 406 |
} |
248 | 407 |
|
249 |
$form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html"; |
|
250 |
if ($form->{format} eq 'postscript') { |
|
251 |
$form->{postscript} = 1; |
|
252 |
$form->{IN} =~ s/html$/tex/; |
|
253 |
} elsif ($form->{"format"} =~ /pdf/) { |
|
254 |
$form->{pdf} = 1; |
|
255 |
if ($form->{"format"} =~ /opendocument/) { |
|
256 |
$form->{IN} =~ s/html$/odt/; |
|
257 |
} else { |
|
258 |
$form->{IN} =~ s/html$/tex/; |
|
259 |
} |
|
260 |
} elsif ($form->{"format"} =~ /opendocument/) { |
|
261 |
$form->{"opendocument"} = 1; |
|
262 |
$form->{"IN"} =~ s/html$/odt/; |
|
263 |
} |
|
264 |
|
|
265 |
if ($send_email && ($form->{email} ne "")) { |
|
266 |
$form->{media} = 'email'; |
|
267 |
} |
|
268 |
|
|
269 |
$form->{keep_tmpfile} = 0; |
|
270 |
if ($form->{media} eq 'email') { |
|
271 |
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}| |
|
272 |
unless $form->{subject}; |
|
273 |
if (!$form->{email_attachment}) { |
|
274 |
$form->{do_not_attach} = 1; |
|
275 |
} else { |
|
276 |
$form->{do_not_attach} = 0; |
|
277 |
} |
|
278 |
$form->{subject} = parse_strings($myconfig, $form, $userspath, $form->{email_subject}); |
|
279 |
$form->{message} = parse_strings($myconfig, $form, $userspath, $form->{email_body}); |
|
280 |
|
|
281 |
$form->{OUT} = "$sendmail"; |
|
408 |
$form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html"; |
|
409 |
$form->{pdf} = 1; |
|
282 | 410 |
|
411 |
if ($form->{"format"} =~ /opendocument/) { |
|
412 |
$form->{IN} =~ s/html$/odt/; |
|
283 | 413 |
} else { |
284 |
|
|
285 |
my $filename = Common::unique_id() . $form->{login} . ".pdf"; |
|
286 |
$form->{OUT} = ">$spool/$filename"; |
|
287 |
push(@{ $form->{DUNNING_PDFS} }, $filename); |
|
288 |
$form->{keep_tmpfile} = 1; |
|
414 |
$form->{IN} =~ s/html$/tex/; |
|
289 | 415 |
} |
290 | 416 |
|
291 |
delete($form->{tmpfile}); |
|
292 |
$form->parse_template($myconfig, $userspath); |
|
293 |
|
|
294 |
$dbh->commit; |
|
295 |
$dbh->disconnect; |
|
296 |
|
|
297 | 417 |
$main::lxdebug->leave_sub(); |
298 | 418 |
} |
299 | 419 |
|
... | ... | |
495 | 615 |
$main::lxdebug->leave_sub(); |
496 | 616 |
} |
497 | 617 |
|
498 |
sub parse_strings { |
|
499 |
|
|
500 |
$main::lxdebug->enter_sub(); |
|
501 |
|
|
502 |
my ($myconfig, $form, $userspath, $string) = @_; |
|
503 |
|
|
504 |
local (*IN, *OUT); |
|
505 |
|
|
506 |
my $format = $form->{format}; |
|
507 |
$form->{format} = "html"; |
|
508 |
|
|
509 |
$tmpstring = "parse_string.html"; |
|
510 |
$tmpfile = "$myconfig->{templates}/$tmpstring"; |
|
511 |
open(OUT, ">", $tmpfile) or $form->error("$tmpfile : $!"); |
|
512 |
|
|
513 |
print(OUT $string); |
|
514 |
close(OUT); |
|
515 |
|
|
516 |
my $in = $form->{IN}; |
|
517 |
$form->{IN} = $tmpstring; |
|
518 |
$template = HTMLTemplate->new($tmpstring, $form, $myconfig, $userspath); |
|
519 |
|
|
520 |
my $fileid = time; |
|
521 |
$form->{tmpfile} = "$userspath/${fileid}.$tmpstring"; |
|
522 |
|
|
523 |
open(OUT, ">", $form->{tmpfile}) or $form->error("$form->{OUT} : $!"); |
|
524 |
if (!$template->parse(*OUT)) { |
|
525 |
$form->cleanup(); |
|
526 |
$form->error("$form->{IN} : " . $template->get_error()); |
|
527 |
} |
|
528 |
|
|
529 |
close(OUT); |
|
530 |
my $result = ""; |
|
531 |
open(IN, "<", $form->{tmpfile}) or $form->error($form->cleanup . "$form->{tmpfile} : $!"); |
|
532 |
|
|
533 |
while (<IN>) { |
|
534 |
$result .= $_; |
|
535 |
} |
|
536 |
|
|
537 |
close(IN); |
|
538 |
# unlink($tmpfile); |
|
539 |
# unlink($form->{tmpfile}); |
|
540 |
$form->{IN} = $in; |
|
541 |
$form->{format} = $format; |
|
542 |
|
|
543 |
$main::lxdebug->leave_sub(); |
|
544 |
return $result; |
|
545 |
} |
|
546 |
|
|
547 | 618 |
sub melt_pdfs { |
548 | 619 |
|
549 | 620 |
$main::lxdebug->enter_sub(); |
550 | 621 |
|
551 |
my ($self, $myconfig, $form, $userspath) = @_; |
|
552 |
|
|
553 |
local (*IN, *OUT); |
|
622 |
my ($self, $myconfig, $form, $copies) = @_; |
|
554 | 623 |
|
555 |
# Don't allow access outside of $userspath.
|
|
624 |
# Don't allow access outside of $spool.
|
|
556 | 625 |
map { $_ =~ s|.*/||; } @{ $form->{DUNNING_PDFS} }; |
557 | 626 |
|
558 |
my $inputfiles = join " ", map { "$userspath/$_" } @{ $form->{DUNNING_PDFS} }; |
|
559 |
my $outputfile = "$userspath/dunning.pdf"; |
|
627 |
$copies *= 1; |
|
628 |
$copies = 1 unless $copies; |
|
629 |
my $inputfiles = join " ", map { "${main::spool}/$_ " x $copies } @{ $form->{DUNNING_PDFS} }; |
|
630 |
my $dunning_id = $form->{dunning_id}; |
|
560 | 631 |
|
561 |
system("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outputfile $inputfiles");
|
|
632 |
$dunning_id =~ s|[^\d]||g;
|
|
562 | 633 |
|
563 |
map { unlink("$userspath/$_") } @{ $form->{DUNNING_PDFS} }; |
|
634 |
my $in = IO::File->new("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=- $inputfiles |"); |
|
635 |
$form->error($main::locale->text('Could not spawn ghostscript.')) unless $in; |
|
564 | 636 |
|
565 |
my $numbytes = (-s $outputfile); |
|
566 |
open(IN, $outputfile) || $form->error($self->cleanup() . "$outputfile : $!"); |
|
637 |
my $out; |
|
567 | 638 |
|
568 |
$form->{copies} = 1 unless $form->{media} eq 'printer'; |
|
569 |
|
|
570 |
chdir($self->{cwd}); |
|
571 |
|
|
572 |
for my $i (1 .. $form->{copies}) { |
|
573 |
# launch application |
|
574 |
print qq|Content-Type: Application/PDF |
|
575 |
Content-Disposition: attachment; filename="$outputfile" |
|
576 |
Content-Length: $numbytes |
|
577 |
|
|
578 |
|; |
|
579 |
|
|
580 |
open(OUT, ">-") or $form->error($form->cleanup . "$!: STDOUT"); |
|
581 |
|
|
582 |
while (<IN>) { |
|
583 |
print OUT $_; |
|
639 |
if ($form->{media} eq 'printer') { |
|
640 |
$form->get_printer_code($myconfig); |
|
641 |
if ($form->{printer_command}) { |
|
642 |
$out = IO::File->new("| $form->{printer_command}"); |
|
584 | 643 |
} |
585 | 644 |
|
586 |
close(OUT); |
|
645 |
$form->error($main::locale->text('Could not spawn the printer command.')) unless $out; |
|
646 |
|
|
647 |
} else { |
|
648 |
$out = IO::File->new('>-'); |
|
649 |
$out->print(qq|Content-Type: Application/PDF\n| . |
|
650 |
qq|Content-Disposition: attachment; filename="dunning_${dunning_id}.pdf"\n\n|); |
|
651 |
} |
|
587 | 652 |
|
588 |
seek(IN, 0, 0); |
|
653 |
while (my $line = <$in>) { |
|
654 |
$out->print($line); |
|
589 | 655 |
} |
590 | 656 |
|
591 |
close(IN); |
|
592 |
unlink($outputfile); |
|
657 |
$in->close(); |
|
658 |
$out->close(); |
|
659 |
|
|
660 |
map { unlink("${main::spool}/$_") } @{ $form->{DUNNING_PDFS} }; |
|
593 | 661 |
|
594 | 662 |
$main::lxdebug->leave_sub(); |
595 | 663 |
} |
... | ... | |
597 | 665 |
sub print_dunning { |
598 | 666 |
$main::lxdebug->enter_sub(); |
599 | 667 |
|
600 |
my ($self, $myconfig, $form, $dunning_id, $userspath, $spool, $sendmail) = @_; |
|
668 |
my ($self, $myconfig, $form, $dunning_id, $provided_dbh) = @_; |
|
669 |
|
|
601 | 670 |
# connect to database |
602 |
my $dbh = $form->dbconnect_noauto($myconfig); |
|
671 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
|
672 |
|
|
673 |
$dunning_id =~ s|[^\d]||g; |
|
603 | 674 |
|
604 | 675 |
my $query = |
605 |
qq|SELECT invnumber, ordnumber, customer_id, amount, netamount, |
|
606 |
ar.transdate, ar.duedate, paid, amount - paid AS open_amount, |
|
607 |
template AS formname, email_subject, email_body, email_attachment, |
|
608 |
da.fee, da.interest, da.transdate AS dunning_date, da.duedate AS dunning_duedate |
|
676 |
qq|SELECT |
|
677 |
da.fee, da.interest, |
|
678 |
da.transdate AS dunning_date, |
|
679 |
da.duedate AS dunning_duedate, |
|
680 |
|
|
681 |
dcfg.template AS formname, |
|
682 |
dcfg.email_subject, dcfg.email_body, dcfg.email_attachment, |
|
683 |
|
|
684 |
ar.transdate, ar.duedate, ar.customer_id, |
|
685 |
ar.invnumber, ar.ordnumber, |
|
686 |
ar.amount, ar.netamount, ar.paid, |
|
687 |
ar.amount - ar.paid AS open_amount |
|
688 |
|
|
609 | 689 |
FROM dunning da |
610 |
LEFT JOIN dunning_config ON (dunning_config.id = da.dunning_config_id)
|
|
690 |
LEFT JOIN dunning_config dcfg ON (dcfg.id = da.dunning_config_id)
|
|
611 | 691 |
LEFT JOIN ar ON (ar.id = da.trans_id) |
612 | 692 |
WHERE (da.dunning_id = ?)|; |
613 | 693 |
|
... | ... | |
622 | 702 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
623 | 703 |
map { push @{ $form->{"dn_$_"} }, $ref->{$_}} keys %$ref; |
624 | 704 |
} |
625 |
$sth->finish; |
|
705 |
$sth->finish();
|
|
626 | 706 |
|
627 | 707 |
$query = |
628 |
qq|SELECT id AS customer_id, name, street, zipcode, city, country, department_1, department_2, email |
|
629 |
FROM customer |
|
630 |
WHERE id = |
|
631 |
(SELECT customer_id |
|
632 |
FROM dunning d |
|
633 |
LEFT JOIN ar ON (d.trans_id = ar.id) |
|
634 |
WHERE d.id = ?)|; |
|
708 |
qq|SELECT |
|
709 |
c.id AS customer_id, c.name, c.street, c.zipcode, c.city, |
|
710 |
c.country, c.department_1, c.department_2, c.email |
|
711 |
FROM dunning d |
|
712 |
LEFT JOIN ar ON (d.trans_id = ar.id) |
|
713 |
LEFT JOIN customer c ON (ar.customer_id = c.id) |
|
714 |
WHERE (d.dunning_id = ?) |
|
715 |
LIMIT 1|; |
|
635 | 716 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id); |
636 | 717 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
637 | 718 |
|
... | ... | |
668 | 749 |
$form->{total_open_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{total_open_amount}, 2), 2); |
669 | 750 |
$form->{total_amount} = $form->format_amount($myconfig, $form->round_amount($ref->{fee} + $ref->{total_interest} + $ref->{total_open_amount}, 2), 2); |
670 | 751 |
|
752 |
$self->set_template_options($myconfig, $form); |
|
671 | 753 |
|
672 |
$form->{templates} = "$myconfig->{templates}"; |
|
754 |
my $filename = "dunning_${dunning_id}_" . Common::unique_id() . ".pdf"; |
|
755 |
$form->{OUT} = ">${main::spool}/$filename"; |
|
756 |
$form->{keep_tmpfile} = 1; |
|
673 | 757 |
|
674 |
$form->{language} = $form->get_template_language(\%myconfig); |
|
675 |
$form->{printer_code} = $form->get_printer_code(\%myconfig); |
|
758 |
delete $form->{tmpfile}; |
|
676 | 759 |
|
677 |
if ($form->{language} ne "") {
|
|
678 |
$form->{language} = "_" . $form->{language};
|
|
679 |
}
|
|
760 |
push @{ $form->{DUNNING_PDFS} }, $filename;
|
|
761 |
push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => $filename,
|
|
762 |
'name' => "dunning_${dunning_id}.pdf" };
|
|
680 | 763 |
|
681 |
if ($form->{printer_code} ne "") { |
|
682 |
$form->{printer_code} = "_" . $form->{printer_code}; |
|
764 |
$form->parse_template($myconfig, $main::userspath); |
|
765 |
|
|
766 |
$dbh->disconnect() unless $provided_dbh; |
|
767 |
|
|
768 |
$main::lxdebug->leave_sub(); |
|
769 |
} |
|
770 |
|
|
771 |
sub print_invoice_for_fees { |
|
772 |
$main::lxdebug->enter_sub(); |
|
773 |
|
|
774 |
my ($self, $myconfig, $form, $dunning_id, $provided_dbh) = @_; |
|
775 |
|
|
776 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect($myconfig); |
|
777 |
|
|
778 |
my ($query, @values, $sth); |
|
779 |
|
|
780 |
$query = |
|
781 |
qq|SELECT |
|
782 |
d.fee_interest_ar_id, |
|
783 |
dcfg.template |
|
784 |
FROM dunning d |
|
785 |
LEFT JOIN dunning_config dcfg ON (d.dunning_config_id = dcfg.id) |
|
786 |
WHERE d.dunning_id = ?|; |
|
787 |
my ($ar_id, $template) = selectrow_query($form, $dbh, $query, $dunning_id); |
|
788 |
|
|
789 |
if (!$ar_id) { |
|
790 |
$main::lxdebug->leave_sub(); |
|
791 |
return; |
|
683 | 792 |
} |
684 | 793 |
|
685 |
$form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html"; |
|
686 |
if ($form->{format} eq 'postscript') { |
|
687 |
$form->{postscript} = 1; |
|
688 |
$form->{IN} =~ s/html$/tex/; |
|
689 |
} elsif ($form->{"format"} =~ /pdf/) { |
|
690 |
$form->{pdf} = 1; |
|
691 |
if ($form->{"format"} =~ /opendocument/) { |
|
692 |
$form->{IN} =~ s/html$/odt/; |
|
794 |
my $saved_form = save_form(); |
|
795 |
|
|
796 |
$query = qq|SELECT SUM(fee), SUM(interest) FROM dunning WHERE id = ?|; |
|
797 |
my ($fee_total, $interest_total) = selectrow_query($form, $dbh, $query, $dunning_id); |
|
798 |
|
|
799 |
$query = |
|
800 |
qq|SELECT |
|
801 |
ar.invnumber, ar.transdate, ar.amount, ar.netamount, |
|
802 |
ar.duedate, ar.notes, ar.notes AS invoicenotes, |
|
803 |
|
|
804 |
c.name, c.department_1, c.department_2, c.street, c.zipcode, c.city, c.country, |
|
805 |
c.contact, c.customernumber, c.phone, c.fax, c.email, |
|
806 |
c.taxnumber, c.sic_code, c.greeting |
|
807 |
|
|
808 |
FROM ar |
|
809 |
LEFT JOIN customer c ON (ar.customer_id = c.id) |
|
810 |
WHERE ar.id = ?|; |
|
811 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $ar_id); |
|
812 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
|
813 |
|
|
814 |
$query = qq|SELECT * FROM employee WHERE login = ?|; |
|
815 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $form->{login}); |
|
816 |
map { $form->{"employee_${_}"} = $ref->{$_} } keys %{ $ref }; |
|
817 |
|
|
818 |
$query = qq|SELECT * FROM acc_trans WHERE trans_id = ? ORDER BY oid ASC|; |
|
819 |
$sth = prepare_execute_query($form, $dbh, $query, $ar_id); |
|
820 |
|
|
821 |
my ($row, $fee, $interest) = (0, 0, 0); |
|
822 |
|
|
823 |
while ($ref = $sth->fetchrow_hashref()) { |
|
824 |
next if ($ref->{amount} < 0); |
|
825 |
|
|
826 |
$row++; |
|
827 |
|
|
828 |
if ($row == 1) { |
|
829 |
$fee = $ref->{amount}; |
|
693 | 830 |
} else { |
694 |
$form->{IN} =~ s/html$/tex/;
|
|
831 |
$interest = $ref->{amount};
|
|
695 | 832 |
} |
696 |
} elsif ($form->{"format"} =~ /opendocument/) { |
|
697 |
$form->{"opendocument"} = 1; |
|
698 |
$form->{"IN"} =~ s/html$/odt/; |
|
699 | 833 |
} |
700 | 834 |
|
701 |
if ($form->{"send_email"} && ($form->{email} ne "")) { |
|
702 |
$form->{media} = 'email'; |
|
703 |
} |
|
835 |
$form->{fee} = $form->round_amount($fee, 2); |
|
836 |
$form->{interest} = $form->round_amount($interest, 2); |
|
837 |
$form->{invamount} = $form->round_amount($fee + $interest, 2); |
|
838 |
$form->{dunning_id} = $dunning_id; |
|
839 |
$form->{formname} = "${template}_invoice"; |
|
704 | 840 |
|
705 |
$form->{keep_tmpfile} = 0; |
|
706 |
if ($form->{media} eq 'email') { |
|
707 |
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}| |
|
708 |
unless $form->{subject}; |
|
709 |
if (!$form->{email_attachment}) { |
|
710 |
$form->{do_not_attach} = 1; |
|
711 |
} else { |
|
712 |
$form->{do_not_attach} = 0; |
|
713 |
} |
|
714 |
$form->{subject} = parse_strings($myconfig, $form, $userspath, $form->{email_subject}); |
|
715 |
$form->{message} = parse_strings($myconfig, $form, $userspath, $form->{email_body}); |
|
841 |
map { $form->{$_} = $form->format_amount($myconfig, $form->{$_}, 2) } qw(fee interest invamount); |
|
716 | 842 |
|
717 |
$form->{OUT} = "$sendmail";
|
|
843 |
$self->set_template_options($myconfig, $form);
|
|
718 | 844 |
|
719 |
} else {
|
|
845 |
my $filename = Common::unique_id() . "dunning_invoice_${dunning_id}.pdf";
|
|
720 | 846 |
|
721 |
my $filename = Common::unique_id() . $form->{login} . ".pdf"; |
|
847 |
$form->{OUT} = ">$main::spool/$filename"; |
|
848 |
$form->{keep_tmpfile} = 1; |
|
849 |
delete $form->{tmpfile}; |
|
722 | 850 |
|
723 |
push(@{ $form->{DUNNING_PDFS} }, $filename); |
|
724 |
$form->{keep_tmpfile} = 1; |
|
725 |
} |
|
851 |
map { delete $form->{$_} } grep /^[a-z_]+_\d+$/, keys %{ $form }; |
|
726 | 852 |
|
727 |
$form->parse_template($myconfig, $userspath); |
|
853 |
$form->parse_template($myconfig, $main::userspath);
|
|
728 | 854 |
|
729 |
$dbh->commit; |
|
730 |
$dbh->disconnect; |
|
855 |
restore_form($saved_form); |
|
856 |
|
|
857 |
push @{ $form->{DUNNING_PDFS} }, $filename; |
|
858 |
push @{ $form->{DUNNING_PDFS_EMAIL} }, { 'filename' => $filename, |
|
859 |
'name' => "dunning_invoice_${dunning_id}.pdf" }; |
|
860 |
|
|
861 |
$dbh->disconnect() unless $provided_dbh; |
|
731 | 862 |
|
732 | 863 |
$main::lxdebug->leave_sub(); |
733 | 864 |
} |
bin/mozilla/dn.pl | ||
---|---|---|
31 | 31 |
# |
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 |
use POSIX; |
|
35 |
|
|
34 | 36 |
use SL::IS; |
35 | 37 |
use SL::PE; |
36 | 38 |
use SL::DN; |
37 |
use Data::Dumper; |
|
38 | 39 |
|
39 | 40 |
require "bin/mozilla/common.pl"; |
40 | 41 |
require "bin/mozilla/io.pl"; |
... | ... | |
46 | 47 |
$lxdebug->enter_sub(); |
47 | 48 |
|
48 | 49 |
DN->get_config(\%myconfig, \%$form); |
50 |
$form->get_lists('charts' => { 'key' => 'ALL_CHARTS', |
|
51 |
'transdate' => 'current_date' }); |
|
52 |
|
|
53 |
$form->{SELECT_AR_AMOUNT} = []; |
|
54 |
$form->{SELECT_AR} = []; |
|
55 |
|
|
56 |
foreach my $chart (@{ $form->{ALL_CHARTS} }) { |
|
57 |
$chart->{LINKS} = { map { $_, 1 } split m/:/, $chart->{link} }; |
|
58 |
|
|
59 |
if ($chart->{LINKS}->{AR}) { |
|
60 |
$chart->{AR_selected} = "selected" if $chart->{id} == $form->{AR}; |
|
61 |
push @{ $form->{SELECT_AR} }, $chart; |
|
62 |
} |
|
63 |
|
|
64 |
if ($chart->{LINKS}->{AR_amount}) { |
|
65 |
$chart->{AR_amount_fee_selected} = "selected" if $chart->{id} == $form->{AR_amount_fee}; |
|
66 |
$chart->{AR_amount_interest_selected} = "selected" if $chart->{id} == $form->{AR_amount_interest}; |
|
67 |
push @{ $form->{SELECT_AR_AMOUNT} }, $chart; |
|
68 |
} |
|
69 |
} |
|
49 | 70 |
|
50 | 71 |
$form->{title} = $locale->text('Edit Dunning Process Config'); |
51 | 72 |
$form->{callback} ||= build_std_url("action=edit_config"); |
... | ... | |
95 | 116 |
map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest); |
96 | 117 |
} |
97 | 118 |
|
119 |
$form->get_lists('printers' => 'printers', |
|
120 |
'languages' => 'languages'); |
|
121 |
|
|
98 | 122 |
$form->{type} = 'dunning'; |
99 | 123 |
$form->{rowcount} = scalar @{ $form->{DUNNINGS} }; |
100 | 124 |
$form->{jsscript} = 1; |
101 | 125 |
$form->{callback} ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes)); |
102 | 126 |
|
103 |
$form->{PRINT_OPTIONS} = print_options({ 'inline' => 1 }); |
|
127 |
$form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, |
|
128 |
'no_queue' => 1, |
|
129 |
'no_postscript' => 1, |
|
130 |
'no_html' => 1, |
|
131 |
'no_opendocument' => 1, }); |
|
104 | 132 |
|
105 | 133 |
$form->header(); |
106 | 134 |
print $form->parse_html_template("dunning/show_invoices"); |
... | ... | |
163 | 191 |
foreach my $level (values %{ $levels }) { |
164 | 192 |
next unless scalar @{ $level }; |
165 | 193 |
|
166 |
DN->save_dunning(\%myconfig, \%$form, $level, $userspath, $spool, $sendmail);
|
|
194 |
DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail); |
|
167 | 195 |
} |
168 | 196 |
} |
169 | 197 |
|
... | ... | |
176 | 204 |
"customer_id" => $form->{"customer_id_$i"}, |
177 | 205 |
"next_dunning_config_id" => $form->{"next_dunning_config_id_$i"}, |
178 | 206 |
"email" => $form->{"email_$i"}, } ]; |
179 |
DN->save_dunning(\%myconfig, \%$form, $level, $userspath, $spool, $sendmail);
|
|
207 |
DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool, $sendmail); |
|
180 | 208 |
} |
181 | 209 |
} |
182 | 210 |
|
183 | 211 |
if($form->{DUNNING_PDFS}) { |
184 |
DN->melt_pdfs(\%myconfig, \%$form,$spool);
|
|
212 |
DN->melt_pdfs(\%myconfig, $form);
|
|
185 | 213 |
} |
186 | 214 |
|
187 | 215 |
# saving the history |
... | ... | |
192 | 220 |
} |
193 | 221 |
# /saving the history |
194 | 222 |
|
195 |
$form->redirect($locale->text('Dunning Process started for selected invoices!')); |
|
223 |
$form->redirect($locale->text('Dunning Process started for selected invoices!')) if ($form->{media} eq 'printer');
|
|
196 | 224 |
|
197 | 225 |
$lxdebug->leave_sub(); |
198 | 226 |
} |
... | ... | |
270 | 298 |
ransdatefrom transdateto dunningfrom dunningto notes showold)); |
271 | 299 |
} |
272 | 300 |
|
273 |
$form->{title} = $locale->text('Dunning overview'); |
|
301 |
$form->get_lists('printers' => 'printers', |
|
302 |
'languages' => 'languages'); |
|
303 |
|
|
304 |
$form->{type} = 'dunning'; |
|
305 |
$form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, |
|
306 |
'no_queue' => 1, |
|
307 |
'no_postscript' => 1, |
|
308 |
'no_html' => 1, |
|
309 |
'no_opendocument' => 1, }); |
|
310 |
$form->{title} = $locale->text('Dunning overview'); |
|
311 |
|
|
274 | 312 |
$form->header(); |
275 | 313 |
|
276 | 314 |
print $form->parse_html_template("dunning/show_dunning"); |
... | ... | |
282 | 320 |
sub print_dunning { |
283 | 321 |
$lxdebug->enter_sub(); |
284 | 322 |
|
285 |
DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $userspath, $spool, $sendmail); |
|
323 |
$form->{rowcount} = 1; |
|
324 |
$form->{selected_1} = 1; |
|
325 |
$form->{dunning_id_1} = $form->{dunning_id}; |
|
326 |
|
|
327 |
print_multiple(); |
|
328 |
|
|
329 |
$lxdebug->leave_sub(); |
|
330 |
} |
|
331 |
|
|
332 |
sub print_multiple { |
|
333 |
$lxdebug->enter_sub(); |
|
334 |
|
|
335 |
$form->{title} = $locale->text('Print dunnings'); |
|
336 |
|
|
337 |
my @dunning_ids = map { $form->{"dunning_id_$_"} } grep { $form->{"selected_$_"} } (1..$form->{rowcount}); |
|
338 |
|
|
339 |
if (!scalar @dunning_ids) { |
|
340 |
$form->error($locale->text('No dunnings have been selected for printing.')); |
|
341 |
} |
|
342 |
|
|
343 |
$form->{DUNNING_PDFS} = []; |
|
344 |
|
|
345 |
foreach my $dunning_id (@dunning_ids) { |
|
346 |
DN->print_invoice_for_fees(\%myconfig, $form, $dunning_id); |
|
347 |
DN->print_dunning(\%myconfig, $form, $dunning_id); |
|
348 |
} |
|
349 |
|
|
350 |
if (scalar @{ $form->{DUNNING_PDFS} }) { |
|
351 |
$form->{dunning_id} = strftime("%Y%m%d", localtime time); |
|
352 |
DN->melt_pdfs(\%myconfig, $form, $form->{copies}); |
|
353 |
|
|
354 |
if ($form->{media} eq 'printer') { |
|
355 |
$form->header(); |
|
356 |
$form->info($locale->text('The dunnings have been printed.')); |
|
357 |
} |
|
286 | 358 |
|
287 |
if($form->{DUNNING_PDFS}) { |
|
288 |
DN->melt_pdfs(\%myconfig, \%$form,$spool); |
|
289 | 359 |
} else { |
290 |
$form->redirect($locale->text('Could not create dunning copy!'));
|
|
360 |
$form->redirect($locale->text('Could not print dunning.'));
|
|
291 | 361 |
} |
292 | 362 |
|
293 | 363 |
$lxdebug->leave_sub(); |
294 |
|
|
295 | 364 |
} |
296 | 365 |
|
297 | 366 |
# end of main |
bin/mozilla/io.pl | ||
---|---|---|
1425 | 1425 |
sub print { |
1426 | 1426 |
$lxdebug->enter_sub(); |
1427 | 1427 |
|
1428 |
if ($form->{print_nextsub}) { |
|
1429 |
call_sub($form->{print_nextsub}); |
|
1430 |
$lxdebug->leave_sub(); |
|
1431 |
return; |
|
1432 |
} |
|
1433 |
|
|
1428 | 1434 |
# if this goes to the printer pass through |
1429 | 1435 |
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') { |
1430 | 1436 |
$form->error($locale->text('Select postscript or PDF!')) |
js/common.js | ||
---|---|---|
34 | 34 |
return string; |
35 | 35 |
} |
36 | 36 |
|
37 |
function escape_more(s) { |
|
38 |
s = escape(s); |
|
39 |
return s.replace(/\+/g, '%2b'); |
|
40 |
} |
|
41 |
|
|
37 | 42 |
function set_longdescription_window(input_name) { |
38 | 43 |
var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes"; |
39 | 44 |
var name = document.getElementsByName(input_name)[0].value; |
... | ... | |
41 | 46 |
"action=set_longdescription&" + |
42 | 47 |
"login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+ |
43 | 48 |
"password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" + |
44 |
"longdescription=" + escape(document.getElementsByName(input_name)[0].value) + "&" + |
|
45 |
"input_name=" + escape(input_name) + "&" |
|
49 |
"longdescription=" + escape_more(document.getElementsByName(input_name)[0].value) + "&" +
|
|
50 |
"input_name=" + escape_more(input_name) + "&"
|
|
46 | 51 |
window.open(url, "_new_generic", parm); |
47 | 52 |
} |
48 | 53 |
|
js/dunning.js | ||
---|---|---|
4 | 4 |
"action=set_email&" + |
5 | 5 |
"login=" + encodeURIComponent(document.getElementsByName("login")[0].value)+ "&"+ |
6 | 6 |
"password=" + encodeURIComponent(document.getElementsByName("password")[0].value) + "&" + |
7 |
"email_subject=" + escape(document.getElementsByName(input_subject)[0].value) + "&" + |
|
8 |
"email_body=" + escape(document.getElementsByName(input_body)[0].value) + "&" + |
|
9 |
"email_attachment=" + escape(document.getElementsByName(input_attachment)[0].value) + "&" + |
|
10 |
"input_subject=" + escape(input_subject) + "&" + |
|
11 |
"input_body=" + escape(input_body) + "&" + |
|
12 |
"input_attachment=" + escape(input_attachment); |
|
7 |
"email_subject=" + escape_more(document.getElementsByName(input_subject)[0].value) + "&" +
|
|
8 |
"email_body=" + escape_more(document.getElementsByName(input_body)[0].value) + "&" +
|
|
9 |
"email_attachment=" + escape_more(document.getElementsByName(input_attachment)[0].value) + "&" +
|
|
10 |
"input_subject=" + escape_more(input_subject) + "&" +
|
|
11 |
"input_body=" + escape_more(input_body) + "&" +
|
|
12 |
"input_attachment=" + escape_more(input_attachment);
|
|
13 | 13 |
window.open(url, "_new_generic", parm); |
14 | 14 |
} |
locale/de/all | ||
---|---|---|
76 | 76 |
'Account Type' => 'Kontoart', |
77 | 77 |
'Account Type missing!' => 'Kontoart fehlt!', |
78 | 78 |
'Account deleted!' => 'Konto gel?scht!', |
79 |
'Account for fees' => 'Konto für Gebühren', |
|
80 |
'Account for interest' => 'Konto für Zinsen', |
|
79 | 81 |
'Account saved!' => 'Konto gespeichert!', |
80 | 82 |
'Accounting Group deleted!' => 'Buchungsgruppe gelöscht!', |
81 | 83 |
'Accounting Group saved!' => 'Buchungsgruppe gespeichert!', |
... | ... | |
165 | 167 |
'Aug' => 'Aug', |
166 | 168 |
'August' => 'August', |
167 | 169 |
'Auto Send?' => 'Auto. Versand?', |
170 |
'Automatically create customer invoices for fees and interests' => 'Automatisches Erstellen von Debitorenrechnungen über Mahngebühren und Zinsen', |
|
171 |
'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung f?r Geb?hren und Zinsen zu Mahnung %s', |
|
168 | 172 |
'BOM' => 'St?ckliste', |
169 | 173 |
'BWA' => 'BWA', |
170 | 174 |
'Back' => 'Zurück', |
... | ... | |
281 | 285 |
'Could not copy %s to %s. Reason: %s' => 'Die Datei "%s" konnte nicht nach "%s" kopiert werden. Grund: %s', |
282 | 286 |
'Could not create dunning copy!' => 'Eine Kopie der Zahlungserinnerung konnte nicht erstellt werden.', |
283 | 287 |
'Could not open the file users/members.' => 'Die Datei "users/members" konnte nicht geöffnet werden.', |
288 |
'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.', |
|
284 | 289 |
'Could not rename %s to %s. Reason: %s' => 'Die Datei "%s" konnte nicht in "%s" umbenannt werden. Grund: %s', |
290 |
'Could not spawn ghostscript.' => 'Die Anwendung "ghostscript" konnte nicht gestartet werden.', |
|
291 |
'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.', |
|
285 | 292 |
'Could not update prices!' => 'Preise konnten nicht aktualisiert werden!', |
286 | 293 |
'Country' => 'Land', |
287 | 294 |
'Create Buchungsgruppen' => 'Buchungsgruppe erfassen', |
... | ... | |
716 | 723 |
'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgew?hlt.', |
717 | 724 |
'No databases have been found on this server.' => 'Auf diesem Server wurden keine Datenbanken gefunden.', |
718 | 725 |
'No datasets have been selected.' => 'Es wurden keine Datenbanken ausgewählt.', |
726 |
'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', |
|
719 | 727 |
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.', |
720 | 728 |
'No entries were found which had no unit assigned to them.' => 'Es wurden keine Einträge gefunden, denen keine Einheit zugeordnet war.', |
721 | 729 |
'No licenses were found that match the search criteria.' => 'Es wurden keine Lizenzen gefunden, auf die die Suchkriterien zutreffen.', |
... | ... | |
844 | 852 |
'Pricegroups' => 'Preisgruppen', |
845 | 853 |
'Print' => 'Drucken', |
846 | 854 |
'Print and Post' => 'Drucken und Buchen', |
855 |
'Print dunnings' => 'Mahnungen drucken', |
|
847 | 856 |
'Print options' => 'Druckoptionen', |
848 | 857 |
'Printer' => 'Drucker', |
849 | 858 |
'Printer Command' => 'Druckbefehl', |
... | ... | |
1064 | 1073 |
'The dataset name is missing.' => 'Der Datenbankname fehlt.', |
1065 | 1074 |
'The directory %s does not exist.' => 'Das Verzeichnis %s existiert nicht.', |
1066 | 1075 |
'The dunning process started' => 'Der Mahnprozess ist gestartet.', |
1076 |
'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', |
|
1067 | 1077 |
'The email address is missing.' => 'Die Emailadresse fehlt.', |
1068 | 1078 |
'The factor is missing in row %d.' => 'Der Faktor fehlt in Zeile %d.', |
1069 | 1079 |
'The factor is missing.' => 'Der Faktor fehlt.', |
locale/de/dn | ||
---|---|---|
13 | 13 |
'Attempt to call an undefined sub named \'%s\'' => 'Es wurde versucht, eine nicht definierte Unterfunktion namens \'%s\' aufzurufen.', |
14 | 14 |
'Aug' => 'Aug', |
15 | 15 |
'August' => 'August', |
16 |
'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung f?r Geb?hren und Zinsen zu Mahnung %s', |
|
16 | 17 |
'Billing Address' => 'Rechnungsadresse', |
17 | 18 |
'Bin' => 'Lagerplatz', |
18 | 19 |
'Bin List' => 'Lagerliste', |
... | ... | |
22 | 23 |
'Confirmation' => 'Auftragsbest?tigung', |
23 | 24 |
'Contact' => 'Kontakt', |
24 | 25 |
'Continue' => 'Weiter', |
25 |
'Could not create dunning copy!' => 'Eine Kopie der Zahlungserinnerung konnte nicht erstellt werden.', |
|
26 |
'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.', |
|
27 |
'Could not spawn ghostscript.' => 'Die Anwendung "ghostscript" konnte nicht gestartet werden.', |
|
28 |
'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.', |
|
26 | 29 |
'Country' => 'Land', |
27 | 30 |
'Credit Note' => 'Gutschrift', |
28 | 31 |
'Customer Number' => 'Kundennummer', |
... | ... | |
83 | 86 |
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden', |
84 | 87 |
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein H?ndler gefunden', |
85 | 88 |
'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgew?hlt.', |
89 |
'No dunnings have been selected for printing.' => 'Es wurden keine Mahnungen zum Drucken ausgewählt.', |
|
86 | 90 |
'No employee was found matching the search parameters.' => 'Es wurde kein Angestellter gefunden, auf den die Suchparameter zutreffen.', |
87 | 91 |
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.', |
88 | 92 |
'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.', |
... | ... | |
117 | 121 |
'Postscript' => 'Postscript', |
118 | 122 |
'Price' => 'Preis', |
119 | 123 |
'Pricegroup' => 'Preisgruppe', |
124 |
'Print dunnings' => 'Mahnungen drucken', |
|
120 | 125 |
'Printer' => 'Drucker', |
121 | 126 |
'Proforma Invoice' => 'Proformarechnung', |
122 | 127 |
'Project' => 'Projekt', |
... | ... | |
163 | 168 |
'Subtotal' => 'Zwischensumme', |
164 | 169 |
'Terms missing in row ' => '+Tage fehlen in Zeile ', |
165 | 170 |
'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.', |
171 |
'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', |
|
166 | 172 |
'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', |
167 | 173 |
'Unit' => 'Einheit', |
168 | 174 |
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.', |
... | ... | |
226 | 232 |
'print' => 'print', |
227 | 233 |
'print_dunning' => 'print_dunning', |
228 | 234 |
'print_form' => 'print_form', |
235 |
'print_multiple' => 'print_multiple', |
|
229 | 236 |
'print_options' => 'print_options', |
230 | 237 |
'project_selected' => 'project_selected', |
231 | 238 |
'project_selection_internal' => 'project_selection_internal', |
... | ... | |
259 | 266 |
'vendor_invoice' => 'vendor_invoice', |
260 | 267 |
'vendor_selection' => 'vendor_selection', |
261 | 268 |
'weiter' => 'continue', |
269 |
'drucken' => 'print', |
|
262 | 270 |
'speichern' => 'save', |
263 | 271 |
}; |
264 | 272 |
|
sql/Pg-upgrade2/dunning_invoices_for_fees.sql | ||
---|---|---|
1 |
-- @tag: dunning_invoices_for_fees |
|
2 |
-- @description: Konfiguration für das automatische Erzeugen von Rechnungen über Mahngebühren sowie eine Verknüpfung zwischen Mahnungen und den dazu erzeugten Rechnungen. |
|
3 |
-- @depends: release_2_4_2 |
|
4 |
ALTER TABLE defaults ADD COLUMN dunning_create_invoices_for_fees boolean; |
|
5 |
ALTER TABLE defaults ADD COLUMN dunning_AR_amount_fee integer; |
|
6 |
ALTER TABLE defaults ADD COLUMN dunning_AR_amount_interest integer; |
|
7 |
ALTER TABLE defaults ADD COLUMN dunning_AR integer; |
|
8 |
UPDATE defaults SET dunning_create_invoices_for_fees = 'f'; |
|
9 |
|
|
10 |
ALTER TABLE dunning ADD COLUMN fee_interest_ar_id integer; |
|
11 |
ALTER TABLE dunning ADD FOREIGN KEY (fee_interest_ar_id) REFERENCES ar (id); |
templates/webpages/dunning/edit_config_de.html | ||
---|---|---|
2 | 2 |
<script type="text/javascript" src="js/common.js"></script> |
3 | 3 |
<script type="text/javascript" src="js/dunning.js"></script> |
4 | 4 |
|
5 |
<script type="text/javascript"> |
|
6 |
<!-- |
|
7 |
function enable_invoice_controls(enable) { |
|
8 |
document.Form.AR.disabled = !enable; |
|
9 |
document.Form.AR_amount_fee.disabled = !enable; |
|
10 |
document.Form.AR_amount_interest.disabled = !enable; |
|
11 |
} |
|
12 |
--> |
|
13 |
</script> |
|
14 |
|
|
5 | 15 |
<div class="listtop" width="100%"><TMPL_VAR title></div> |
6 | 16 |
|
7 |
<form method="post" action="dn.pl"> |
|
17 |
<form method="post" action="dn.pl" name="Form">
|
|
8 | 18 |
<table> |
9 | 19 |
<tr height="5"></tr> |
10 | 20 |
|
... | ... | |
78 | 88 |
</tr> |
79 | 89 |
</table> |
80 | 90 |
|
91 |
<input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>"> |
|
92 |
|
|
93 |
<hr size="3" noshade> |
|
94 |
|
|
95 |
<p> |
|
96 |
<input type="checkbox" name="create_invoices_for_fees" id="create_invoices_for_fees" |
|
97 |
<TMPL_IF create_invoices_for_fees>checked</TMPL_IF> |
|
98 |
value="1" onclick="enable_invoice_controls(this.checked);"> |
|
99 |
<label for="create_invoices_for_fees">Automatisches Erstellen von Debitorenrechnungen über Mahngebühren und Zinsen</label> |
|
100 |
</p> |
|
101 |
|
|
102 |
<table> |
|
103 |
<tr> |
|
104 |
<th align="right">Konto für Gebühren</th> |
|
105 |
<td> |
|
106 |
<select name="AR_amount_fee" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
107 |
<TMPL_LOOP SELECT_AR_AMOUNT><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_amount_fee_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
108 |
</TMPL_LOOP> |
|
109 |
</select> |
|
110 |
</td> |
|
111 |
</tr> |
|
112 |
|
|
113 |
<tr> |
|
114 |
<th align="right">Konto für Zinsen</th> |
|
115 |
<td> |
|
116 |
<select name="AR_amount_interest" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
117 |
<TMPL_LOOP SELECT_AR_AMOUNT><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_amount_interest_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
118 |
</TMPL_LOOP> |
|
119 |
</select> |
|
120 |
</td> |
|
121 |
</tr> |
|
122 |
|
|
123 |
<tr> |
|
124 |
<th align="right">Buchen auf</th> |
|
125 |
<td> |
|
126 |
<select name="AR" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
127 |
<TMPL_LOOP SELECT_AR><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
128 |
</TMPL_LOOP> |
|
129 |
</select> |
|
130 |
</td> |
|
131 |
</tr> |
|
132 |
</table> |
|
133 |
|
|
81 | 134 |
<hr size="3" noshade> |
82 | 135 |
|
83 |
<input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>"> |
|
84 | 136 |
<input type="hidden" name="callback" value="<TMPL_VAR callback ESCAPE=HTML>"> |
85 | 137 |
|
86 | 138 |
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>"> |
templates/webpages/dunning/edit_config_master.html | ||
---|---|---|
2 | 2 |
<script type="text/javascript" src="js/common.js"></script> |
3 | 3 |
<script type="text/javascript" src="js/dunning.js"></script> |
4 | 4 |
|
5 |
<script type="text/javascript"> |
|
6 |
<!-- |
|
7 |
function enable_invoice_controls(enable) { |
|
8 |
document.Form.AR.disabled = !enable; |
|
9 |
document.Form.AR_amount_fee.disabled = !enable; |
|
10 |
document.Form.AR_amount_interest.disabled = !enable; |
|
11 |
} |
|
12 |
--> |
|
13 |
</script> |
|
14 |
|
|
5 | 15 |
<div class="listtop" width="100%"><TMPL_VAR title></div> |
6 | 16 |
|
7 |
<form method="post" action="dn.pl"> |
|
17 |
<form method="post" action="dn.pl" name="Form">
|
|
8 | 18 |
<table> |
9 | 19 |
<tr height="5"></tr> |
10 | 20 |
|
... | ... | |
78 | 88 |
</tr> |
79 | 89 |
</table> |
80 | 90 |
|
91 |
<input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>"> |
|
92 |
|
|
93 |
<hr size="3" noshade> |
|
94 |
|
|
95 |
<p> |
|
96 |
<input type="checkbox" name="create_invoices_for_fees" id="create_invoices_for_fees" |
|
97 |
<TMPL_IF create_invoices_for_fees>checked</TMPL_IF> |
|
98 |
value="1" onclick="enable_invoice_controls(this.checked);"> |
|
99 |
<label for="create_invoices_for_fees"><translate>Automatically create customer invoices for fees and interests</translate></label> |
|
100 |
</p> |
|
101 |
|
|
102 |
<table> |
|
103 |
<tr> |
|
104 |
<th align="right"><translate>Account for fees</translate></th> |
|
105 |
<td> |
|
106 |
<select name="AR_amount_fee" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
107 |
<TMPL_LOOP SELECT_AR_AMOUNT><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_amount_fee_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
108 |
</TMPL_LOOP> |
|
109 |
</select> |
|
110 |
</td> |
|
111 |
</tr> |
|
112 |
|
|
113 |
<tr> |
|
114 |
<th align="right"><translate>Account for interest</translate></th> |
|
115 |
<td> |
|
116 |
<select name="AR_amount_interest" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
117 |
<TMPL_LOOP SELECT_AR_AMOUNT><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_amount_interest_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
118 |
</TMPL_LOOP> |
|
119 |
</select> |
|
120 |
</td> |
|
121 |
</tr> |
|
122 |
|
|
123 |
<tr> |
|
124 |
<th align="right"><translate>Record in</translate></th> |
|
125 |
<td> |
|
126 |
<select name="AR" <TMPL_UNLESS create_invoices_for_fees>disabled</TMPL_UNLESS>> |
|
127 |
<TMPL_LOOP SELECT_AR><option value="<TMPL_VAR id ESCAPE=HTML>" <TMPL_IF AR_selected>selected</TMPL_IF>><TMPL_VAR accno ESCAPE=HTML>--<TMPL_VAR description ESCAPE=HTML></option> |
|
128 |
</TMPL_LOOP> |
|
129 |
</select> |
|
130 |
</td> |
|
131 |
</tr> |
|
132 |
</table> |
|
133 |
|
|
81 | 134 |
<hr size="3" noshade> |
82 | 135 |
|
83 |
<input type="hidden" name="rowcount" value="<TMPL_VAR rowcount ESCAPE=HTML>"> |
|
84 | 136 |
<input type="hidden" name="callback" value="<TMPL_VAR callback ESCAPE=HTML>"> |
85 | 137 |
|
86 | 138 |
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>"> |
templates/webpages/dunning/set_email_de.html | ||
---|---|---|
31 | 31 |
|
32 | 32 |
<tr> |
33 | 33 |
<td valign="top">PDF anh?ngen</td> |
34 |
<td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" "<TMPL_VAR email_attachment ESCAPE=HTML>"></td>
|
|
34 |
<td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" <TMPL_IF email_attachment>checked</TMPL_IF>></td>
|
|
35 | 35 |
</tr> |
36 | 36 |
</table> |
37 | 37 |
|
templates/webpages/dunning/set_email_master.html | ||
---|---|---|
31 | 31 |
|
32 | 32 |
<tr> |
33 | 33 |
<td valign="top"><translate>Attach PDF:</translate></td> |
34 |
<td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" "<TMPL_VAR email_attachment ESCAPE=HTML>"></td>
|
|
34 |
<td valign="top"><input id="email_attachment" type="checkbox" name="email_attachment" value="1" <TMPL_IF email_attachment>checked</TMPL_IF>></td>
|
|
35 | 35 |
</tr> |
36 | 36 |
</table> |
37 | 37 |
|
templates/webpages/dunning/show_dunning_de.html | ||
---|---|---|
5 | 5 |
|
6 | 6 |
<div class="listtop" width="100%"><TMPL_VAR title></div> |
7 | 7 |
|
8 |
<p> |
|
9 |
<table width="100%"> |
|
10 |
<tr> |
|
11 |
<th class="listheading">Mahnlevel</th> |
|
12 |
<th class="listheading">Kundenname</th> |
|
13 |
<th class="listheading">Rechnungsnummer</th> |
|
14 |
<th class="listheading">Rechnungsdatum</th> |
|
15 |
<th class="listheading">F?lligkeitsdatum</th> |
|
16 |
<th class="listheading">Betrag</th> |
|
17 |
<th class="listheading">Mahndatum</th> |
|
18 |
<th class="listheading">Zahlbar bis</th> |
|
19 |
<th class="listheading">Kumulierte Geb?hren</th> |
|
20 |
<th class="listheading">Zinsen</th> |
|
21 |
</tr> |
|
22 |
|
|
23 |
<!-- Ausgabe der einzelnen Zeilen --> |
|
24 |
|
|
25 |
<TMPL_LOOP DUNNINGS> |
|
26 |
<tr class="listrow<TMPL_VAR listrow_odd_even>"> |
|
27 |
<td> |
|
28 |
<TMPL_IF first_row_for_dunning> |
|
29 |
<a href="dn.pl?action=print_dunning&format=pdf&media=screen&dunning_id=<TMPL_VAR dunning_id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"> |
|
30 |
<TMPL_VAR dunning_description ESCAPE=HTML> |
|
31 |
</a> |
|
32 |
<TMPL_ELSE> |
|
33 |
|
|
34 |
</TMPL_IF> |
|
35 |
</td> |
|
36 |
|
|
37 |
<td><TMPL_IF first_row_for_dunning><TMPL_VAR customername ESCAPE=HTML><TMPL_ELSE> </TMPL_IF></td> |
|
38 |
|
|
39 |
<td><a href="is.pl?action=edit&id=<TMPL_VAR id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"><TMPL_VAR invnumber ESCAPE=HTML></a></td> |
|
40 |
|
|
41 |
<td align="right"><TMPL_VAR transdate ESCAPE=HTML></td> |
|
42 |
<td align="right"><TMPL_VAR duedate ESCAPE=HTML></td> |
|
43 |
<td align="right"><TMPL_VAR amount ESCAPE=HTML></td> |
|
44 |
<td align="right"><TMPL_VAR dunning_date ESCAPE=HTML></td> |
|
45 |
<td align="right"><TMPL_VAR dunning_duedate ESCAPE=HTML></td> |
|
46 |
<td align="right"><TMPL_VAR fee ESCAPE=HTML></td> |
|
47 |
<td align="right"><TMPL_VAR interest ESCAPE=HTML></td> |
|
8 |
<form method="post" action="dn.pl"> |
|
9 |
|
|
10 |
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>"> |
|
11 |
<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>"> |
|
12 |
|
|
13 |
<p> |
|
14 |
<table width="100%"> |
|
15 |
<tr> |
|
16 |
<th class="listheading"> </th> |
|
17 |
<th class="listheading">Mahnlevel</th> |
|
18 |
<th class="listheading">Kundenname</th> |
|
19 |
<th class="listheading">Rechnungsnummer</th> |
|
20 |
<th class="listheading">Rechnungsdatum</th> |
|
21 |
<th class="listheading">F?lligkeitsdatum</th> |
|
22 |
<th class="listheading">Betrag</th> |
|
23 |
<th class="listheading">Mahndatum</th> |
|
24 |
<th class="listheading">Zahlbar bis</th> |
|
25 |
<th class="listheading">Kumulierte Geb?hren</th> |
|
26 |
<th class="listheading">Zinsen</th> |
|
48 | 27 |
</tr> |
49 |
</TMPL_LOOP> |
|
50 | 28 |
|
51 |
<tr><td colspan="10"><hr size="3" noshade></td></tr> |
|
52 |
</table> |
|
53 |
</p> |
|
29 |
<!-- Ausgabe der einzelnen Zeilen --> |
|
30 |
|
|
31 |
<TMPL_LOOP DUNNINGS> |
|
32 |
<tr class="listrow<TMPL_VAR listrow_odd_even>"> |
|
33 |
<td> |
|
34 |
<TMPL_IF first_row_for_dunning> |
|
35 |
<input type="checkbox" name="selected_<TMPL_VAR __counter__>" value="1"> |
|
36 |
<input type="hidden" name="dunning_id_<TMPL_VAR __counter__>" value="<TMPL_VAR dunning_id ESCAPE=HTML>"> |
|
37 |
</TMPL_IF> |
|
38 |
</td> |
|
39 |
|
|
40 |
<td> |
|
41 |
<TMPL_IF first_row_for_dunning> |
|
42 |
<a href="dn.pl?action=print_dunning&format=pdf&media=screen&dunning_id=<TMPL_VAR dunning_id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"> |
|
43 |
<TMPL_VAR dunning_description ESCAPE=HTML> |
|
44 |
</a> |
|
45 |
<TMPL_ELSE> |
|
46 |
|
|
47 |
</TMPL_IF> |
|
48 |
</td> |
|
49 |
|
|
50 |
<td><TMPL_IF first_row_for_dunning><TMPL_VAR customername ESCAPE=HTML><TMPL_ELSE> </TMPL_IF></td> |
|
51 |
|
|
52 |
<td><a href="is.pl?action=edit&id=<TMPL_VAR id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"><TMPL_VAR invnumber ESCAPE=HTML></a></td> |
|
53 |
|
|
54 |
<td align="right"><TMPL_VAR transdate ESCAPE=HTML></td> |
|
55 |
<td align="right"><TMPL_VAR duedate ESCAPE=HTML></td> |
|
56 |
<td align="right"><TMPL_VAR amount ESCAPE=HTML></td> |
|
57 |
<td align="right"><TMPL_VAR dunning_date ESCAPE=HTML></td> |
|
58 |
<td align="right"><TMPL_VAR dunning_duedate ESCAPE=HTML></td> |
|
59 |
<td align="right"><TMPL_VAR fee ESCAPE=HTML></td> |
|
60 |
<td align="right"><TMPL_VAR interest ESCAPE=HTML></td> |
|
61 |
</tr> |
|
62 |
|
|
63 |
<TMPL_IF __last__><input type="hidden" name="rowcount" value="<TMPL_VAR __counter__>"></TMPL_IF> |
|
64 |
</TMPL_LOOP> |
|
65 |
<tr><td colspan="11"><hr size="3" noshade></td></tr> |
|
66 |
</table> |
|
67 |
</p> |
|
68 |
|
|
69 |
|
|
70 |
<p><TMPL_VAR PRINT_OPTIONS></p> |
|
71 |
|
|
72 |
<p> |
|
73 |
<input type="hidden" name="print_nextsub" value="print_multiple"> |
|
74 |
<input type="submit" class="submit" name="action" value="Drucken"> |
|
75 |
</p> |
|
76 |
|
|
77 |
</form> |
|
54 | 78 |
|
55 | 79 |
</body> |
templates/webpages/dunning/show_dunning_master.html | ||
---|---|---|
5 | 5 |
|
6 | 6 |
<div class="listtop" width="100%"><TMPL_VAR title></div> |
7 | 7 |
|
8 |
<p> |
|
9 |
<table width="100%"> |
|
10 |
<tr> |
|
11 |
<th class="listheading"><translate>Dunning Level</translate></th> |
|
12 |
<th class="listheading"><translate>Customername</translate></th> |
|
13 |
<th class="listheading"><translate>Invnumber</translate></th> |
|
14 |
<th class="listheading"><translate>Invdate</translate></th> |
|
15 |
<th class="listheading"><translate>Invoice Duedate</translate></th> |
|
16 |
<th class="listheading"><translate>Amount</translate></th> |
|
17 |
<th class="listheading"><translate>Dunning Date</translate></th> |
|
18 |
<th class="listheading"><translate>Dunning Duedate</translate></th> |
|
19 |
<th class="listheading"><translate>Total Fees</translate></th> |
|
20 |
<th class="listheading"><translate>Interest</translate></th> |
|
21 |
</tr> |
|
22 |
|
|
23 |
<!-- Ausgabe der einzelnen Zeilen --> |
|
24 |
|
|
25 |
<TMPL_LOOP DUNNINGS> |
|
26 |
<tr class="listrow<TMPL_VAR listrow_odd_even>"> |
|
27 |
<td> |
|
28 |
<TMPL_IF first_row_for_dunning> |
|
29 |
<a href="dn.pl?action=print_dunning&format=pdf&media=screen&dunning_id=<TMPL_VAR dunning_id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"> |
|
30 |
<TMPL_VAR dunning_description ESCAPE=HTML> |
|
31 |
</a> |
|
32 |
<TMPL_ELSE> |
|
33 |
|
|
34 |
</TMPL_IF> |
|
35 |
</td> |
|
36 |
|
|
37 |
<td><TMPL_IF first_row_for_dunning><TMPL_VAR customername ESCAPE=HTML><TMPL_ELSE> </TMPL_IF></td> |
|
38 |
|
|
39 |
<td><a href="is.pl?action=edit&id=<TMPL_VAR id ESCAPE=URL>&login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&callback=<TMPL_VAR callback ESCAPE=URL>"><TMPL_VAR invnumber ESCAPE=HTML></a></td> |
|
40 |
|
|
41 |
<td align="right"><TMPL_VAR transdate ESCAPE=HTML></td> |
|
42 |
<td align="right"><TMPL_VAR duedate ESCAPE=HTML></td> |
|
43 |
<td align="right"><TMPL_VAR amount ESCAPE=HTML></td> |
|
44 |
<td align="right"><TMPL_VAR dunning_date ESCAPE=HTML></td> |
|
45 |
<td align="right"><TMPL_VAR dunning_duedate ESCAPE=HTML></td> |
|
46 |
<td align="right"><TMPL_VAR fee ESCAPE=HTML></td> |
|
47 |
<td align="right"><TMPL_VAR interest ESCAPE=HTML></td> |
|
8 |
<form method="post" action="dn.pl"> |
|
9 |
|
|
10 |
<input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>"> |
|
11 |
<input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>"> |
|
12 |
|
|
13 |
<p> |
|
14 |
<table width="100%"> |
|
15 |
<tr> |
|
16 |
<th class="listheading"> </th> |
|
17 |
<th class="listheading"><translate>Dunning Level</translate></th> |
|
18 |
<th class="listheading"><translate>Customername</translate></th> |
|
19 |
<th class="listheading"><translate>Invnumber</translate></th> |
|
20 |
<th class="listheading"><translate>Invdate</translate></th> |
|
21 |
<th class="listheading"><translate>Invoice Duedate</translate></th> |
|
22 |
<th class="listheading"><translate>Amount</translate></th> |
|
23 |
<th class="listheading"><translate>Dunning Date</translate></th> |
|
24 |
<th class="listheading"><translate>Dunning Duedate</translate></th> |
|
25 |
<th class="listheading"><translate>Total Fees</translate></th> |
|
26 |
<th class="listheading"><translate>Interest</translate></th> |
|
48 | 27 |
</tr> |
Auch abrufbar als: Unified diff
Mahnwesen:
1. Neues Feature: Automatisches Erzeugen von Debitorenrechnungen über die Mahngebühren und -zinsen. Diese werden ebenfalls als PDFs ausgegeben.
2. Neues Feature: Beim Bericht über aktive Mahnungen ermöglichen, dass mehrere Mahnungen und die eventuell dazu erstellen Debitorenrechnungen auf einmal ausgedruckt werden können.
3. Neues Feature: Mahnungen können wahlweise am Bildschirm oder direkt auf Druckern ausgegeben werden. Zusätzlich können andere Sprachen ausgewählt werden.
4. Bugfix: Beim Bearbeiten von Emaileinstellungen in der Mahnkonfiguration wurden +-Zeichen falsch escapet und verschwanden.
5. Code zum Ersetzen von $form-Variablen in Strings entfernt und durch die Verwendung von PlainTextTemplate ersetzt.
Fixes für Bugs 473 und 553.