1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
30 # Dunning process module
32 #======================================================================
39 require "$form->{path}/io.pl";
40 require "$form->{path}/arap.pl";
45 $lxdebug->enter_sub();
47 # edit all dunning config data
50 DN->get_config(\%myconfig, \%$form);
51 $form->{title} = $locale->text('Edit Dunning Process Config');
54 "$form->{script}?action=edit_config&path=$form->{path}&login=$form->{login}&password=$form->{password}"
55 unless $form->{callback};
57 @column_index = qw(dunning_level dunning_description active auto email payment_terms terms fee interest template);
59 $column_header{dunning_level} =
60 qq|<th class=listheading>|
61 . $locale->text('Dunning Level')
63 $column_header{dunning_description} =
64 qq|<th class=listheading>|
65 . $locale->text('Dunning Description')
67 $column_header{active} =
68 qq|<th class=listheading>|
69 . $locale->text('Active?')
71 $column_header{auto} =
72 qq|<th class=listheading>|
73 . $locale->text('Auto Send?')
75 $column_header{email} =
76 qq|<th class=listheading>|
77 . $locale->text('eMail Send?')
79 $column_header{payment_terms} =
80 qq|<th class=listheading>|
81 . $locale->text('Fristsetzung')
83 $column_header{terms} =
84 qq|<th class=listheading>|
85 . $locale->text('Duedate +Days')
88 qq|<th class=listheading>|
89 . $locale->text('Fee')
91 $column_header{interest} =
92 qq|<th class=listheading>|
93 . $locale->text('Interest Rate')
95 $column_header{template} =
96 qq|<th class=listheading>|
97 . $locale->text('Template')
101 <script type="text/javascript" src="js/common.js"></script>
102 <script type="text/javascript" src="js/dunning.js"></script>
103 <form method=post action=$form->{script}>
108 <th class=listtop colspan=10>$form->{title}</th>
112 map { print "$column_header{$_}\n" } @column_index;
118 foreach $ref (@{ $form->{DUNNING} }) {
124 <tr valign=top class=listrow$j>
128 $column_data{dunning_level} =
129 qq|<td><input type=hidden name=dunning_level_$i size=2 value="$i"><input type=hidden name=id_$i value="$ref->{id}">$i</td>|;
130 $column_data{dunning_description} = qq|<td><input name=dunning_description_$i value="$ref->{dunning_description}"></td>|;
131 my $active = ($ref->{active}) ? "checked" : "";
132 $column_data{active} =
133 qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
134 my $email = ($ref->{email}) ? "checked" : "";
135 $column_data{email} =
136 qq|<td><input type=checkbox name=email_$i value=1 $email><button type="button" onclick="set_email_window('email_subject_$i', 'email_body_$i', 'email_attachment_$i')">| . $locale->text('L') . qq|</button><input type=hidden name=email_body_$i value="$ref->{email_body}"><input type=hidden name=email_subject_$i value="$ref->{email_subject}"><input type=hidden name=email_attachment_$i value="$ref->{email_attachment}"></td>|;
138 my $auto = ($ref->{auto}) ? "checked" : "";
140 qq|<td><input type=checkbox name=auto_$i value=1 $auto></td>|;
141 $column_data{payment_terms} = qq|<td><input name=payment_terms_$i size=3 value="$ref->{payment_terms}"></td>|;
142 $column_data{terms} = qq|<td><input name=terms_$i size=3 value="$ref->{terms}"></td>|;
143 $column_data{fee} = qq|<td><input name=fee_$i size=5 value="$ref->{fee}"></td>|;
144 $column_data{interest} = qq|<td><input name=interest_$i size=4 value="$ref->{interest}">%</td>|;
145 $column_data{template} = qq|<td><input name=template_$i value="$ref->{template}"></td>|;
149 map { print "$column_data{$_}\n" } @column_index;
159 <tr valign=top class=listrow$j>
163 $column_data{dunning_level} =
164 qq|<td><input type=hidden size=2 name=dunning_level_$i value=$i>$i</td>|;
165 $column_data{dunning_description} = qq|<td><input name=dunning_description_$i ></td>|;
166 $column_data{active} =
167 qq|<td><input type=checkbox name=active_$i value=1></td>|;
169 $column_data{email} =
170 qq|<td><input type=checkbox name=email_$i value=1 $email><button type="button" onclick="set_email_window('email_subject_$i', 'email_body_$i', 'email_attachment_$i')">| . $locale->text('L') . qq|</button><input type=hidden name=email_body_$i><input type=hidden name=email_subject_$i><input type=hidden name=email_attachment_$i></td>|;
173 qq|<td><input type=checkbox name=auto_$i value=1 $auto></td>|;
174 $column_data{payment_terms} = qq|<td><input size=3 name=payment_terms_$i></td>|;
175 $column_data{terms} = qq|<td><input size=3 name=terms_$i></td>|;
176 $column_data{fee} = qq|<td><input size=5 name=fee_$i></td>|;
177 $column_data{interest} = qq|<td><input size=4 name=interest_$i>%</td>|;
178 $column_data{template} = qq|<td><input name=template_$i></td>|;
181 $form->{rowcount} = $i;
182 map { print "$column_data{$_}\n" } @column_index;
194 <td><hr size=3 noshade></td>
199 <form method=post action=$form->{script}>
201 <input name=callback type=hidden value="$form->{callback}">
202 <input name=rowcount type=hidden value="$form->{rowcount}">
204 <input type=hidden name=path value=$form->{path}>
205 <input type=hidden name=login value=$form->{login}>
206 <input type=hidden name=password value=$form->{password}>
208 <input class=submit type=submit name=action value="|
209 . $locale->text('Save') . qq|">
217 $lxdebug->leave_sub();
221 $lxdebug->enter_sub();
222 # setup customer selection
223 $form->all_vc(\%myconfig, "customer", "AR");
225 DN->get_config(\%myconfig, \%$form);
227 if (@{ $form->{all_customer} }) {
228 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
229 @{ $form->{all_customer} };
230 $customer = qq|<select name=customer><option>\n$customer</select>|;
232 $customer = qq|<input name=customer size=35>|;
236 if (@{ $form->{DUNNING} }) {
237 $form->{selectdunning_level} = "<option></option\n";
239 $form->{selectdunning_level} .=
240 "<option value=$_->{id}>$_->{dunning_description}</option>\n"
241 } (@{ $form->{DUNNING} });
245 <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
246 <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
248 | if $form->{selectdunning_level};
251 if (@{ $form->{all_departments} }) {
252 $form->{selectdepartment} = "<option>\n";
254 $form->{selectdepartment} .=
255 "<option>$_->{description}--$_->{id}\n"
256 } (@{ $form->{all_departments} });
260 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
261 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
263 | if $form->{selectdepartment};
264 $form->{title} = $locale->text('Start Dunning Process');
265 $form->{nextsub} = "show_invoices";
267 # use JavaScript Calendar or not
268 $form->{jsscript} = $jscalendar;
270 if ($form->{jsscript}) {
272 # with JavaScript Calendar
274 <td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}">
275 <input type=button name=paymentuntil id="trigger1" value=|
276 . $locale->text('button') . qq|></td>
281 Form->write_trigger(\%myconfig, "1", "paymentuntil", "BR", "trigger1");
284 # without JavaScript Calendar
286 qq|<td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}"></td>|;
288 $form->{fokus} = "search.customer";
291 <body onLoad="fokus()">
293 <form method=post name="search" action=$form->{script}>
296 <tr><th class=listtop>$form->{title}</th></tr>
302 <th align=right>| . $locale->text('Customer') . qq|</th>
303 <td colspan=3>$customer</td>
308 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
309 <td colspan=3><input name=invnumber size=20></td>
312 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
313 <td colspan=3><input name=ordnumber size=20></td>
316 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
317 <td colspan=3><input name=notes size=40></td>
320 <th align=right nowrap>| . $locale->text('Payment until') . qq|</th>
327 <td><hr size=3 noshade></td>
333 <th align=right nowrap>| . $locale->text('Minimum Amount') . qq|</th>
334 <td><input name=minamount size=6></td>
337 <th align=right nowrap>| . $locale->text('Group Invoices') . qq|</th>
338 <td><input type=checkbox value=1 name=groupinvoices checked></td>
345 <input type=hidden name=nextsub value=$form->{nextsub}>
347 <input type=hidden name=path value=$form->{path}>
348 <input type=hidden name=login value=$form->{login}>
349 <input type=hidden name=password value=$form->{password}>
352 <input class=submit type=submit name=action value="|
353 . $locale->text('Continue') . qq|">
364 $lxdebug->leave_sub();
369 $lxdebug->enter_sub();
371 DN->get_invoices(\%myconfig, \%$form);
372 $form->{title} = $locale->text('Start Dunning Process');
374 if (@{ $form->{DUNNING_CONFIG} }) {
375 foreach $item (@{ $form->{DUNNING_CONFIG} }) {
376 $form->{selectdunning} .=
377 "<option value=$item->{id}>$item->{dunning_description}</option>";
382 $form->{nextsub} = "save_dunning";
385 "$form->{script}?action=show_invoices&path=$form->{path}&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&paymentuntil=$form->{paymentuntil}&groupinvoices=$form->{groupinvoices}&minamount=$form->{minamount}&dunning_level=$form->{dunning_level}¬es=$form->{notes}"
386 unless $form->{callback};
388 @column_index = qw(dunning_description active email customername invnumber invdate inv_duedate invamount next_duedate fee interest );
390 $column_header{dunning_description} =
391 qq|<th class=listheading>|
392 . $locale->text('Current / Next Level')
394 $column_header{active} =
395 qq|<th class=listheading>|
396 . $locale->text('Active?')
398 $column_header{email} =
399 qq|<th class=listheading>|
400 . $locale->text('eMail?')
402 $column_header{customername} =
403 qq|<th class=listheading>|
404 . $locale->text('Customername')
406 $column_header{invnumber} =
407 qq|<th class=listheading>|
408 . $locale->text('Invno.')
410 $column_header{inv_duedate} =
411 qq|<th class=listheading>|
412 . $locale->text('Inv. Duedate')
414 $column_header{next_duedate} =
415 qq|<th class=listheading>|
416 . $locale->text('Dunning Duedate')
418 $column_header{invdate} =
419 qq|<th class=listheading>|
420 . $locale->text('Invdate')
422 $column_header{invamount} =
423 qq|<th class=listheading>|
424 . $locale->text('Amount')
426 $column_header{fee} =
427 qq|<th class=listheading>|
428 . $locale->text('Total Fees')
430 $column_header{interest} =
431 qq|<th class=listheading>|
432 . $locale->text('Total Interest')
440 <script type="text/javascript" src="js/common.js"></script>
441 <script type="text/javascript" src="js/dunning.js"></script>
442 <form name=Form method=post action=$form->{script}>
447 <th class=listtop colspan=11>$form->{title}</th>
451 map { print "$column_header{$_}\n" } @column_index;
457 foreach $ref (@{ $form->{DUNNINGS} }) {
463 <tr valign=top class=listrow$j>
466 $form->{selectdunning} =~ s/ selected//g;
467 if ($ref->{next_dunning_config_id} ne "") {
468 $form->{selectdunning} =~ s/value=$ref->{next_dunning_config_id}/value=$ref->{next_dunning_config_id} selected/;
472 $dunning = qq|<select name=next_dunning_config_id_$i>$form->{selectdunning}</select>|;
475 $column_data{dunning_description} = qq|<td><input type=hidden name=inv_id_$i size=2 value="$ref->{id}"><input type=hidden name=customer_id_$i size=2 value="$ref->{customer_id}">$ref->{dunning_level}: $dunning</td>|;
476 my $active = ($ref->{active}) ? "checked" : "";
477 $column_data{active} =
478 qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
479 my $email = ($ref->{email}) ? "checked" : "";
480 $column_data{email} =
481 qq|<td><input type=checkbox name=email_$i value=1 $email></td>|;
482 $column_data{next_duedate} = qq|<td><input type=hidden name=next_duedate_$i size=6 value="$ref->{next_duedate}">$ref->{next_duedate}</td>|;
484 $column_data{inv_duedate} = qq|<td><input type=hidden name=inv_duedate_$i size=6 value="$ref->{duedate}">$ref->{duedate}</td>|;
485 $column_data{invdate} = qq|<td><input type=hidden name=invdate_$i size=6 value="$ref->{transdate}">$ref->{transdate}</td>|;
486 $column_data{invnumber} = qq|<td><input type=hidden name=invnumber_$i size=6 value="$ref->{invnumber}">$ref->{invnumber}</td>|;
487 $column_data{customername} = qq|<td><input type=hidden name=customername_$i size=6 value="$ref->{customername}">$ref->{customername}</td>|;
488 $column_data{invamount} = qq|<td><input type=hidden name=invamount_$i size=6 value="$ref->{amount}">$ref->{amount}</td>|;
489 $column_data{fee} = qq|<td><input type=hidden name=fee_$i size=5 value="$ref->{fee}">$ref->{fee}</td>|;
490 $column_data{interest} = qq|<td><input type=hidden name=interest_$i size=4 value="$ref->{interest}">$ref->{interest}</td>|;
494 map { print "$column_data{$_}\n" } @column_index;
501 $form->{rowcount} = $i;
508 <td><hr size=3 noshade></td>
514 <form method=post action=$form->{script}>
516 <input name=callback type=hidden value="$form->{callback}">
517 <input name=rowcount type=hidden value="$form->{rowcount}">
518 <input name=nextsub type=hidden value="$form->{nextsub}">
519 <input name=groupinvoices type=hidden value="$form->{groupinvoices}">
522 <input type=hidden name=path value=$form->{path}>
523 <input type=hidden name=login value=$form->{login}>
524 <input type=hidden name=password value=$form->{password}>
525 <input type="hidden" name="action">
526 <input type="submit" name="dummy" value="|
527 . $locale->text('Continue') . qq|" onclick="this.disabled=true; this.value='| . $locale->text("The dunning process started") . qq|'; document.Form.action.value='| . $locale->text('Continue') . qq|'; document.Form.submit()">
536 $lxdebug->leave_sub();
541 $lxdebug->enter_sub();
543 for my $i (1 .. $form->{rowcount}) {
544 if ($form->{"dunning_description_$i"} ne "") {
545 $form->isblank("dunning_level_$i", $locale->text('Dunning Level missing in row '). $i);
546 $form->isblank("dunning_description_$i", $locale->text('Dunning Description missing in row '). $i);
547 $form->isblank("terms_$i", $locale->text('Terms missing in row '). $i);
548 $form->isblank("payment_terms_$i", $locale->text('Payment Terms missing in row '). $i);
552 DN->save_config(\%myconfig, \%$form);
554 if(!exists $form->{addition} && $form->{id} ne "") {
555 $form->{addition} = "SAVED FOR DUNNING";
556 $form->save_history($form->dbconnect(\%myconfig));
558 # /saving the history
559 $form->redirect($locale->text('Dunning Process Config saved!'));
561 $lxdebug->leave_sub();
565 $lxdebug->enter_sub();
569 undef($form->{DUNNING_PDFS});
570 if ($form->{groupinvoices}) {
573 $form->{inv_ids} = [];
576 for my $i (1 .. $form->{rowcount}) {
577 $form->{"active_$i"} *= 1;
578 $lastcustomer = $form->{"customer_id_$i"} unless ($lastcustomer);
579 if ($form->{"active_$i"} && ($form->{"customer_id_$i"} == $lastcustomer)) {
580 push(@{ $form->{inv_ids} }, $form->{"inv_id_$i"});
581 $form->{"active_$i"} = 0;
582 $form->{"customer_id_$i"} = 0;
584 } elsif ($form->{"active_$i"}) {
587 $form->{"customer_id_$i"} = 0;
590 if (scalar(@{ $form->{inv_ids} }) != 0) {
591 DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath, $spool, $sendmail);
595 for my $i (1 .. $form->{rowcount}) {
596 if ($form->{"active_$i"}) {
598 $form->{inv_ids} = [ $form->{"inv_id_$i"} ];
600 DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath, $spool, $sendmail);
604 if($form->{DUNNING_PDFS}) {
605 DN->melt_pdfs(\%myconfig, \%$form,$spool);
608 if(!exists $form->{addition} && $form->{id} ne "") {
609 $form->{addition} = "DUNNING STARTED";
610 $form->save_history($form->dbconnect(\%myconfig));
612 # /saving the history
613 $form->redirect($locale->text('Dunning Process started for selected invoices!'));
615 $lxdebug->leave_sub();
619 $lxdebug->enter_sub();
622 my $callback = "$form->{script}?action=set_email&";
623 map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
624 (qw(login path password name input_subject input_body input_attachment email_subject email_body email_attachment), grep({ /^[fl]_/ } keys %$form)));
626 if ($form->{email_attachment}) {
627 $form->{email_attachment} = "checked";
629 $form->{"title"} = $locale->text("Set eMail text");
631 print($form->parse_html_template("dunning/set_email"));
633 $lxdebug->leave_sub();
637 $lxdebug->enter_sub();
638 # setup customer selection
639 $form->all_vc(\%myconfig, "customer", "AR");
641 DN->get_config(\%myconfig, \%$form);
643 if (@{ $form->{all_customer} }) {
644 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
645 @{ $form->{all_customer} };
646 $customer = qq|<select name=customer><option>\n$customer</select>|;
648 $customer = qq|<input name=customer size=35>|;
652 if (@{ $form->{DUNNING} }) {
653 $form->{selectdunning_level} = "<option></option\n";
655 $form->{selectdunning_level} .=
656 "<option value=$_->{id}>$_->{dunning_description}</option>\n"
657 } (@{ $form->{DUNNING} });
661 <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
662 <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
664 | if $form->{selectdunning_level};
667 if (@{ $form->{all_departments} }) {
668 $form->{selectdepartment} = "<option>\n";
670 $form->{selectdepartment} .=
671 "<option>$_->{description}--$_->{id}\n"
672 } (@{ $form->{all_departments} });
676 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
677 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
679 | if $form->{selectdepartment};
680 $form->{title} = $locale->text('Search Dunning');
681 $form->{nextsub} = "show_dunning";
683 # use JavaScript Calendar or not
684 $form->{jsscript} = $jscalendar;
686 if ($form->{jsscript}) {
688 # with JavaScript Calendar
690 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
691 <input type=button name=transdatefrom id="trigger1" value=|
692 . $locale->text('button') . qq|></td>
695 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
696 <input type=button name=transdateto id="trigger2" value=|
697 . $locale->text('button') . qq|></td>
700 <td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}">
701 <input type=button name=dunningfrom id="trigger3" value=|
702 . $locale->text('button') . qq|></td>
705 <td><input name=dunningto id=dunningto size=11 title="$myconfig{dateformat}">
706 <input type=button name=dunningto id="trigger4" value=|
707 . $locale->text('button') . qq|></td>
712 Form->write_trigger(\%myconfig, "4", "transdatefrom", "BR", "trigger1", "transdateto", "BR", "trigger2", "dunningfrom", "BR", "trigger3", "dunningto", "BR", "trigger4");
715 # without JavaScript Calendar
717 qq|<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
719 qq|<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
721 qq|<td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}"></td>|;
723 qq|<td><input name=dunningfrom id=dunningto size=11 title="$myconfig{dateformat}"></td>|;
726 $form->{fokus} = "search.customer";
729 <body onLoad="fokus()">
731 <form method=post name="search" action=$form->{script}>
734 <tr><th class=listtop>$form->{title}</th></tr>
740 <th align=right>| . $locale->text('Customer') . qq|</th>
741 <td colspan=3>$customer</td>
746 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
747 <td colspan=3><input name=invnumber size=20></td>
750 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
751 <td colspan=3><input name=ordnumber size=20></td>
754 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
755 <td colspan=3><input name=notes size=40></td>
758 <th align=right nowrap>| . $locale->text('Invdate from') . qq|</th>
760 <th align=right nowrap>| . $locale->text('To') . qq|</th>
764 <th align=right nowrap>| . $locale->text('Dunning Date from') . qq|</th>
766 <th align=right nowrap>| . $locale->text('To') . qq|</th>
774 <td><hr size=3 noshade></td>
780 <th align=right nowrap>| . $locale->text('Show old dunnings') . qq|</th>
781 <td><input type=checkbox value=1 name=showold></td>
788 <input type=hidden name=nextsub value=$form->{nextsub}>
790 <input type=hidden name=path value=$form->{path}>
791 <input type=hidden name=login value=$form->{login}>
792 <input type=hidden name=password value=$form->{password}>
795 <input class=submit type=submit name=action value="|
796 . $locale->text('Continue') . qq|">
807 $lxdebug->leave_sub();
812 $lxdebug->enter_sub();
814 DN->get_dunning(\%myconfig, \%$form);
815 $form->{title} = $locale->text('Dunning overview');
822 "$form->{script}?action=show_dunning&path=$form->{path}&login=$form->{login}&password=$form->{password}&customer=$form->{customer}&invnumber=$form->{invnumber}&ordnumber=$form->{ordnumber}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&dunningfrom=$form->{dunningfrom}&dunningto=$form->{dunningto}¬es=$form->{notes}&showold=$form->{showold}&dunning_level=$form->{dunning_level}"
823 unless $form->{callback};
825 @column_index = qw(dunning_description customername invnumber invdate inv_duedate invamount dunning_date next_duedate fee interest );
827 $column_header{dunning_description} =
828 qq|<th class=listheading>|
829 . $locale->text('Dunning Level')
831 $column_header{customername} =
832 qq|<th class=listheading>|
833 . $locale->text('Customername')
835 $column_header{invnumber} =
836 qq|<th class=listheading>|
837 . $locale->text('Invnumber')
839 $column_header{inv_duedate} =
840 qq|<th class=listheading>|
841 . $locale->text('Invoice Duedate')
843 $column_header{dunning_date} =
844 qq|<th class=listheading>|
845 . $locale->text('Dunning Date')
847 $column_header{next_duedate} =
848 qq|<th class=listheading>|
849 . $locale->text('Dunning Duedate')
851 $column_header{invdate} =
852 qq|<th class=listheading>|
853 . $locale->text('Invdate')
855 $column_header{invamount} =
856 qq|<th class=listheading>|
857 . $locale->text('Amount')
859 $column_header{fee} =
860 qq|<th class=listheading>|
861 . $locale->text('Total Fees')
863 $column_header{interest} =
864 qq|<th class=listheading>|
865 . $locale->text('Total Interest')
873 <script type="text/javascript" src="js/common.js"></script>
874 <script type="text/javascript" src="js/dunning.js"></script>
875 <form method=post action=$form->{script}>
880 <th class=listtop colspan=10>$form->{title}</th>
884 map { print "$column_header{$_}\n" } @column_index;
891 "dunning_duedate" => "next_duedate",
892 "duedate" => "inv_duedate",
893 "transdate" => "invdate",
894 "amount" => "invamount",
899 my ($previous_dunning_id, $first_row_for_dunning);
900 foreach $ref (@{ $form->{DUNNINGS} }) {
903 if ($previous_dunning_id != $ref->{dunning_id}) {
906 $first_row_for_dunning = 1;
908 $first_row_for_dunning = 0;
910 $previous_dunning_id = $ref->{dunning_id};
913 <tr valign=top class=listrow$j>
918 foreach (qw(dunning_date dunning_duedate duedate transdate customername
919 amount fee interest)) {
920 my $col = $columns{$_} ? $columns{$_} : $_;
921 $column_data{$col} = "<td>" . H($ref->{$_}) . "</td>";
924 if ($first_row_for_dunning) {
925 $column_data{dunning_description} =
926 qq|<td><a href="dn.pl?action=print_dunning&format=pdf&media=screen&| .
927 qq|dunning_id=| . E($ref->{dunning_id}) .
928 join(map({ "&${_}=" . E($form->{$_}) } qw(login path password callback))) .
929 qq|">| . H($ref->{dunning_description}) . qq|</a></td>|;
931 $column_data{dunning_description} = qq|<td> </td>|;
932 $column_data{customername} = qq|<td> </td>|;
935 $column_data{invnumber} =
936 qq|<td><a href="| . ($ref->{invoice} ? "is.pl" : "ar.pl" ) .
937 qq|?action=edit&id=| . H($ref->{id}) .
938 join(map({ "&${_}=" . E($form->{$_}) } qw(login path password callback))) .
939 qq|">| . H($ref->{invnumber}) . qq|</a></td>|;
941 map { print "$column_data{$_}\n" } @column_index;
948 $form->{rowcount} = $i;
955 <td><hr size=3 noshade></td>
960 <form method=post action=$form->{script}>
962 <input name=callback type=hidden value="$form->{callback}">
963 <input name=rowcount type=hidden value="$form->{rowcount}">
964 <input name=nextsub type=hidden value="$form->{nextsub}">
967 <input type=hidden name=path value=$form->{path}>
968 <input type=hidden name=login value=$form->{login}>
969 <input type=hidden name=password value=$form->{password}>
978 $lxdebug->leave_sub();
983 $lxdebug->enter_sub();
985 DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $userspath, $spool, $sendmail);
987 if($form->{DUNNING_PDFS}) {
988 DN->melt_pdfs(\%myconfig, \%$form,$spool);
990 $form->redirect($locale->text('Could not create dunning copy!'));
993 $lxdebug->leave_sub();