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>|;
167 $column_data{active} =
168 qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
170 $column_data{email} =
171 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>|;
174 qq|<td><input type=checkbox name=auto_$i value=1 $auto></td>|;
175 $column_data{payment_terms} = qq|<td><input size=3 name=payment_terms_$i></td>|;
176 $column_data{terms} = qq|<td><input size=3 name=terms_$i></td>|;
177 $column_data{fee} = qq|<td><input size=5 name=fee_$i></td>|;
178 $column_data{interest} = qq|<td><input size=4 name=interest_$i>%</td>|;
179 $column_data{template} = qq|<td><input name=template_$i></td>|;
182 $form->{rowcount} = $i;
183 map { print "$column_data{$_}\n" } @column_index;
195 <td><hr size=3 noshade></td>
200 <form method=post action=$form->{script}>
202 <input name=callback type=hidden value="$form->{callback}">
203 <input name=rowcount type=hidden value="$form->{rowcount}">
205 <input type=hidden name=path value=$form->{path}>
206 <input type=hidden name=login value=$form->{login}>
207 <input type=hidden name=password value=$form->{password}>
209 <input class=submit type=submit name=action value="|
210 . $locale->text('Save') . qq|">
218 $lxdebug->leave_sub();
222 $lxdebug->enter_sub();
223 # setup customer selection
224 $form->all_vc(\%myconfig, "customer", "AR");
226 DN->get_config(\%myconfig, \%$form);
228 if (@{ $form->{all_customer} }) {
229 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
230 @{ $form->{all_customer} };
231 $customer = qq|<select name=customer><option>\n$customer</select>|;
233 $customer = qq|<input name=customer size=35>|;
237 if (@{ $form->{DUNNING} }) {
238 $form->{selectdunning_level} = "<option></option\n";
240 $form->{selectdunning_level} .=
241 "<option value=$_->{id}>$_->{dunning_description}</option>\n"
242 } (@{ $form->{DUNNING} });
246 <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
247 <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
249 | if $form->{selectdunning_level};
252 if (@{ $form->{all_departments} }) {
253 $form->{selectdepartment} = "<option>\n";
255 $form->{selectdepartment} .=
256 "<option>$_->{description}--$_->{id}\n"
257 } (@{ $form->{all_departments} });
261 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
262 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
264 | if $form->{selectdepartment};
265 $form->{title} = $locale->text('Start Dunning Process');
266 $form->{nextsub} = "show_invoices";
268 # use JavaScript Calendar or not
269 $form->{jsscript} = $jscalendar;
271 if ($form->{jsscript}) {
273 # with JavaScript Calendar
275 <td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}">
276 <input type=button name=paymentuntil id="trigger1" value=|
277 . $locale->text('button') . qq|></td>
282 Form->write_trigger(\%myconfig, "1", "paymentuntil", "BR", "trigger1");
285 # without JavaScript Calendar
287 qq|<td><input name=paymentuntil id=paymentuntil size=11 title="$myconfig{dateformat}"></td>|;
289 $form->{fokus} = "search.customer";
292 <body onLoad="fokus()">
294 <form method=post name="search" action=$form->{script}>
297 <tr><th class=listtop>$form->{title}</th></tr>
303 <th align=right>| . $locale->text('Customer') . qq|</th>
304 <td colspan=3>$customer</td>
309 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
310 <td colspan=3><input name=invnumber size=20></td>
313 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
314 <td colspan=3><input name=ordnumber size=20></td>
317 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
318 <td colspan=3><input name=notes size=40></td>
321 <th align=right nowrap>| . $locale->text('Payment until') . qq|</th>
328 <td><hr size=3 noshade></td>
334 <th align=right nowrap>| . $locale->text('Minimum Amount') . qq|</th>
335 <td><input name=minamount size=6></td>
338 <th align=right nowrap>| . $locale->text('Group Invoices') . qq|</th>
339 <td><input type=checkbox value=1 name=groupinvoices checked></td>
346 <input type=hidden name=nextsub value=$form->{nextsub}>
348 <input type=hidden name=path value=$form->{path}>
349 <input type=hidden name=login value=$form->{login}>
350 <input type=hidden name=password value=$form->{password}>
353 <input class=submit type=submit name=action value="|
354 . $locale->text('Continue') . qq|">
365 $lxdebug->leave_sub();
370 $lxdebug->enter_sub();
372 DN->get_invoices(\%myconfig, \%$form);
373 $form->{title} = $locale->text('Start Dunning Process');
375 if (@{ $form->{DUNNING_CONFIG} }) {
376 foreach $item (@{ $form->{DUNNING_CONFIG} }) {
377 $form->{selectdunning} .=
378 "<option value=$item->{id}>$item->{dunning_description}</option>";
383 $form->{nextsub} = "save_dunning";
386 "$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}"
387 unless $form->{callback};
389 @column_index = qw(dunning_description active email customername invnumber invdate inv_duedate invamount next_duedate fee interest );
391 $column_header{dunning_description} =
392 qq|<th class=listheading>|
393 . $locale->text('Current / Next Level')
395 $column_header{active} =
396 qq|<th class=listheading>|
397 . $locale->text('Active?')
399 $column_header{email} =
400 qq|<th class=listheading>|
401 . $locale->text('eMail?')
403 $column_header{customername} =
404 qq|<th class=listheading>|
405 . $locale->text('Customername')
407 $column_header{invnumber} =
408 qq|<th class=listheading>|
409 . $locale->text('Invno.')
411 $column_header{inv_duedate} =
412 qq|<th class=listheading>|
413 . $locale->text('Inv. Duedate')
415 $column_header{next_duedate} =
416 qq|<th class=listheading>|
417 . $locale->text('Dunning Duedate')
419 $column_header{invdate} =
420 qq|<th class=listheading>|
421 . $locale->text('Invdate')
423 $column_header{invamount} =
424 qq|<th class=listheading>|
425 . $locale->text('Amount')
427 $column_header{fee} =
428 qq|<th class=listheading>|
429 . $locale->text('Total Fees')
431 $column_header{interest} =
432 qq|<th class=listheading>|
433 . $locale->text('Total Interest')
441 <script type="text/javascript" src="js/common.js"></script>
442 <script type="text/javascript" src="js/dunning.js"></script>
443 <form name=Form method=post action=$form->{script}>
448 <th class=listtop colspan=11>$form->{title}</th>
452 map { print "$column_header{$_}\n" } @column_index;
458 foreach $ref (@{ $form->{DUNNINGS} }) {
464 <tr valign=top class=listrow$j>
467 $form->{selectdunning} =~ s/ selected//g;
468 if ($ref->{next_dunning_id} ne "") {
469 $form->{selectdunning} =~ s/value=$ref->{next_dunning_id}/value=$ref->{next_dunning_id} selected/;
473 $dunning = qq|<select name=next_dunning_id_$i>$form->{selectdunning}</select>|;
476 $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>|;
477 my $active = ($ref->{active}) ? "checked" : "";
478 $column_data{active} =
479 qq|<td><input type=checkbox name=active_$i value=1 $active></td>|;
480 my $email = ($ref->{email}) ? "checked" : "";
481 $column_data{email} =
482 qq|<td><input type=checkbox name=email_$i value=1 $email></td>|;
483 $column_data{next_duedate} = qq|<td><input type=hidden name=next_duedate_$i size=6 value="$ref->{next_duedate}">$ref->{next_duedate}</td>|;
485 $column_data{inv_duedate} = qq|<td><input type=hidden name=inv_duedate_$i size=6 value="$ref->{duedate}">$ref->{duedate}</td>|;
486 $column_data{invdate} = qq|<td><input type=hidden name=invdate_$i size=6 value="$ref->{transdate}">$ref->{transdate}</td>|;
487 $column_data{invnumber} = qq|<td><input type=hidden name=invnumber_$i size=6 value="$ref->{invnumber}">$ref->{invnumber}</td>|;
488 $column_data{customername} = qq|<td><input type=hidden name=customername_$i size=6 value="$ref->{customername}">$ref->{customername}</td>|;
489 $column_data{invamount} = qq|<td><input type=hidden name=invamount_$i size=6 value="$ref->{amount}">$ref->{amount}</td>|;
490 $column_data{fee} = qq|<td><input type=hidden name=fee_$i size=5 value="$ref->{fee}">$ref->{fee}</td>|;
491 $column_data{interest} = qq|<td><input type=hidden name=interest_$i size=4 value="$ref->{interest}">$ref->{interest}</td>|;
495 map { print "$column_data{$_}\n" } @column_index;
502 $form->{rowcount} = $i;
509 <td><hr size=3 noshade></td>
515 <form method=post action=$form->{script}>
517 <input name=callback type=hidden value="$form->{callback}">
518 <input name=rowcount type=hidden value="$form->{rowcount}">
519 <input name=nextsub type=hidden value="$form->{nextsub}">
520 <input name=groupinvoices type=hidden value="$form->{groupinvoices}">
523 <input type=hidden name=path value=$form->{path}>
524 <input type=hidden name=login value=$form->{login}>
525 <input type=hidden name=password value=$form->{password}>
526 <input type="hidden" name="action">
527 <input type="submit" name="dummy" value="|
528 . $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()">
537 $lxdebug->leave_sub();
542 $lxdebug->enter_sub();
544 for my $i (1 .. $form->{rowcount}) {
545 if ($form->{"dunning_description_$i"} ne "") {
546 $form->isblank("dunning_level_$i", $locale->text('Dunning Level missing in row '). $i);
547 $form->isblank("dunning_description_$i", $locale->text('Dunning Description missing in row '). $i);
548 $form->isblank("terms_$i", $locale->text('Terms missing in row '). $i);
549 $form->isblank("payment_terms_$i", $locale->text('Payment Terms missing in row '). $i);
553 DN->save_config(\%myconfig, \%$form);
555 if(!exists $form->{addition} && $form->{id} ne "") {
556 $form->{addition} = "SAVED FOR DUNNING";
557 $form->save_history($form->dbconnect(\%myconfig));
559 # /saving the history
560 $form->redirect($locale->text('Dunning Process Config saved!'));
562 $lxdebug->leave_sub();
566 $lxdebug->enter_sub();
570 undef($form->{DUNNING_PDFS});
571 if ($form->{groupinvoices}) {
574 $form->{inv_ids} = [];
577 for my $i (1 .. $form->{rowcount}) {
578 $form->{"active_$i"} *= 1;
579 $lastcustomer = $form->{"customer_id_$i"} unless ($lastcustomer);
580 if ($form->{"active_$i"} && ($form->{"customer_id_$i"} == $lastcustomer)) {
581 push(@{ $form->{inv_ids} }, $form->{"inv_id_$i"});
582 $form->{"active_$i"} = 0;
583 $form->{"customer_id_$i"} = 0;
585 } elsif ($form->{"active_$i"}) {
588 $form->{"customer_id_$i"} = 0;
591 if (scalar(@{ $form->{inv_ids} }) != 0) {
592 DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
596 for my $i (1 .. $form->{rowcount}) {
597 if ($form->{"active_$i"}) {
599 $form->{inv_ids} = [ $form->{"inv_id_$i"} ];
601 DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail);
605 if($form->{DUNNING_PDFS}) {
606 DN->melt_pdfs(\%myconfig, \%$form,$spool);
609 if(!exists $form->{addition} && $form->{id} ne "") {
610 $form->{addition} = "DUNNING STARTED";
611 $form->save_history($form->dbconnect(\%myconfig));
613 # /saving the history
614 $form->redirect($locale->text('Dunning Process started for selected invoices!'));
616 $lxdebug->leave_sub();
620 $lxdebug->enter_sub();
623 my $callback = "$form->{script}?action=set_email&";
624 map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
625 (qw(login path password name input_subject input_body input_attachment email_subject email_body email_attachment), grep({ /^[fl]_/ } keys %$form)));
627 if ($form->{email_attachment}) {
628 $form->{email_attachment} = "checked";
630 $form->{"title"} = $locale->text("Set eMail text");
632 print($form->parse_html_template("dunning/set_email"));
634 $lxdebug->leave_sub();
638 $lxdebug->enter_sub();
639 # setup customer selection
640 $form->all_vc(\%myconfig, "customer", "AR");
642 DN->get_config(\%myconfig, \%$form);
644 if (@{ $form->{all_customer} }) {
645 map { $customer .= "<option>$_->{name}--$_->{id}\n" }
646 @{ $form->{all_customer} };
647 $customer = qq|<select name=customer><option>\n$customer</select>|;
649 $customer = qq|<input name=customer size=35>|;
653 if (@{ $form->{DUNNING} }) {
654 $form->{selectdunning_level} = "<option></option\n";
656 $form->{selectdunning_level} .=
657 "<option value=$_->{id}>$_->{dunning_description}</option>\n"
658 } (@{ $form->{DUNNING} });
662 <th align=right nowrap>| . $locale->text('Next Dunning Level') . qq|</th>
663 <td colspan=3><select name=dunning_level>$form->{selectdunning_level}</select></td>
665 | if $form->{selectdunning_level};
668 if (@{ $form->{all_departments} }) {
669 $form->{selectdepartment} = "<option>\n";
671 $form->{selectdepartment} .=
672 "<option>$_->{description}--$_->{id}\n"
673 } (@{ $form->{all_departments} });
677 <th align=right nowrap>| . $locale->text('Department') . qq|</th>
678 <td colspan=3><select name=department>$form->{selectdepartment}</select></td>
680 | if $form->{selectdepartment};
681 $form->{title} = $locale->text('Search Dunning');
682 $form->{nextsub} = "show_dunning";
684 # use JavaScript Calendar or not
685 $form->{jsscript} = $jscalendar;
687 if ($form->{jsscript}) {
689 # with JavaScript Calendar
691 <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}">
692 <input type=button name=transdatefrom id="trigger1" value=|
693 . $locale->text('button') . qq|></td>
696 <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}">
697 <input type=button name=transdateto id="trigger2" value=|
698 . $locale->text('button') . qq|></td>
701 <td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}">
702 <input type=button name=dunningfrom id="trigger3" value=|
703 . $locale->text('button') . qq|></td>
706 <td><input name=dunningto id=dunningto size=11 title="$myconfig{dateformat}">
707 <input type=button name=dunningto id="trigger4" value=|
708 . $locale->text('button') . qq|></td>
713 Form->write_trigger(\%myconfig, "4", "transdatefrom", "BR", "trigger1", "transdateto", "BR", "trigger2", "dunningfrom", "BR", "trigger3", "dunningto", "BR", "trigger4");
716 # without JavaScript Calendar
718 qq|<td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
720 qq|<td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
722 qq|<td><input name=dunningfrom id=dunningfrom size=11 title="$myconfig{dateformat}"></td>|;
724 qq|<td><input name=dunningfrom id=dunningto size=11 title="$myconfig{dateformat}"></td>|;
727 $form->{fokus} = "search.customer";
730 <body onLoad="fokus()">
732 <form method=post name="search" action=$form->{script}>
735 <tr><th class=listtop>$form->{title}</th></tr>
741 <th align=right>| . $locale->text('Customer') . qq|</th>
742 <td colspan=3>$customer</td>
747 <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
748 <td colspan=3><input name=invnumber size=20></td>
751 <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
752 <td colspan=3><input name=ordnumber size=20></td>
755 <th align=right nowrap>| . $locale->text('Notes') . qq|</th>
756 <td colspan=3><input name=notes size=40></td>
759 <th align=right nowrap>| . $locale->text('Invdate from') . qq|</th>
761 <th align=right nowrap>| . $locale->text('To') . qq|</th>
765 <th align=right nowrap>| . $locale->text('Dunning Date from') . qq|</th>
767 <th align=right nowrap>| . $locale->text('To') . qq|</th>
775 <td><hr size=3 noshade></td>
781 <th align=right nowrap>| . $locale->text('Show old dunnings') . qq|</th>
782 <td><input type=checkbox value=1 name=showold></td>
789 <input type=hidden name=nextsub value=$form->{nextsub}>
791 <input type=hidden name=path value=$form->{path}>
792 <input type=hidden name=login value=$form->{login}>
793 <input type=hidden name=password value=$form->{password}>
796 <input class=submit type=submit name=action value="|
797 . $locale->text('Continue') . qq|">
808 $lxdebug->leave_sub();
813 $lxdebug->enter_sub();
815 DN->get_dunning(\%myconfig, \%$form);
816 $form->{title} = $locale->text('Dunning overview');
823 "$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}"
824 unless $form->{callback};
826 @column_index = qw(dunning_description customername invnumber invdate inv_duedate invamount dunning_date next_duedate fee interest );
828 $column_header{dunning_description} =
829 qq|<th class=listheading>|
830 . $locale->text('Dunning Level')
832 $column_header{customername} =
833 qq|<th class=listheading>|
834 . $locale->text('Customername')
836 $column_header{invnumber} =
837 qq|<th class=listheading>|
838 . $locale->text('Invnumber')
840 $column_header{inv_duedate} =
841 qq|<th class=listheading>|
842 . $locale->text('Invoice Duedate')
844 $column_header{dunning_date} =
845 qq|<th class=listheading>|
846 . $locale->text('Dunning Date')
848 $column_header{next_duedate} =
849 qq|<th class=listheading>|
850 . $locale->text('Dunning Duedate')
852 $column_header{invdate} =
853 qq|<th class=listheading>|
854 . $locale->text('Invdate')
856 $column_header{invamount} =
857 qq|<th class=listheading>|
858 . $locale->text('Amount')
860 $column_header{fee} =
861 qq|<th class=listheading>|
862 . $locale->text('Total Fees')
864 $column_header{interest} =
865 qq|<th class=listheading>|
866 . $locale->text('Total Interest')
874 <script type="text/javascript" src="js/common.js"></script>
875 <script type="text/javascript" src="js/dunning.js"></script>
876 <form method=post action=$form->{script}>
881 <th class=listtop colspan=10>$form->{title}</th>
885 map { print "$column_header{$_}\n" } @column_index;
892 my $previous_customer_id;
893 foreach $ref (@{ $form->{DUNNINGS} }) {
895 $j++ if ($previous_customer_id != $ref->{customer_id});
897 $previous_customer_id = $ref->{customer_id};
900 <tr valign=top class=listrow$j>
905 $dunning = qq|<select name=next_dunning_id_$i>$form->{selectdunning}</select>|;
907 if ($ref->{invoice}) {
912 $column_data{dunning_description} = qq|<td><a href=dn.pl?action=print_dunning&dunning_id=$ref->{dunning_id}&customer_id=$ref->{customer_id}&format=pdf&media=screen&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{dunning_description}</a></td>|;
913 my $active = "checked";
914 $column_data{dunning_date} = qq|<td>$ref->{dunning_date}</td>|;
915 $column_data{next_duedate} = qq|<td>$ref->{dunning_duedate}</td>|;
917 $column_data{inv_duedate} = qq|<td>$ref->{duedate}</td>|;
918 $column_data{invdate} = qq|<td>$ref->{transdate}</td>|;
919 $column_data{invnumber} = qq|<td><a href=$script?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{invnumber}</a></td>|;
920 $column_data{customername} = qq|<td>$ref->{customername}</td>|;
921 $column_data{invamount} = qq|<td>$ref->{amount}</td>|;
922 $column_data{fee} = qq|<td>$ref->{fee}</td>|;
923 $column_data{interest} = qq|<td>$ref->{interest}</td>|;
927 map { print "$column_data{$_}\n" } @column_index;
934 $form->{rowcount} = $i;
941 <td><hr size=3 noshade></td>
946 <form method=post action=$form->{script}>
948 <input name=callback type=hidden value="$form->{callback}">
949 <input name=rowcount type=hidden value="$form->{rowcount}">
950 <input name=nextsub type=hidden value="$form->{nextsub}">
953 <input type=hidden name=path value=$form->{path}>
954 <input type=hidden name=login value=$form->{login}>
955 <input type=hidden name=password value=$form->{password}>
964 $lxdebug->leave_sub();
969 $lxdebug->enter_sub();
971 DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $form->{customer_id}, $userspath, $spool, $sendmail);
973 if($form->{DUNNING_PDFS}) {
974 DN->melt_pdfs(\%myconfig, \%$form,$spool);
976 $form->redirect($locale->text('Could not create dunning copy!'));
979 $lxdebug->leave_sub();