Revision fa654209
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
bin/mozilla/dn.pl | ||
---|---|---|
86 | 86 |
DN->get_invoices(\%myconfig, \%$form); |
87 | 87 |
$form->{title} = $locale->text('Start Dunning Process'); |
88 | 88 |
|
89 |
if (@{ $form->{DUNNING_CONFIG} }) { |
|
90 |
foreach $item (@{ $form->{DUNNING_CONFIG} }) { |
|
91 |
$form->{selectdunning} .= |
|
92 |
"<option value=$item->{id}>$item->{dunning_description}</option>"; |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
|
|
97 |
$form->{nextsub} = "save_dunning"; |
|
98 |
|
|
99 |
$form->{jsscript} = 1; |
|
100 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/checkbox_utils.js"></script>|; |
|
101 |
|
|
102 |
$form->{callback} = |
|
103 |
"$form->{script}?action=show_invoices&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}" |
|
104 |
unless $form->{callback}; |
|
105 |
|
|
106 |
@column_index = qw(dunning_description dunning_description_next active email customername invnumber invdate inv_duedate amount next_duedate fee interest ); |
|
107 |
|
|
108 |
$column_header{dunning_description} = |
|
109 |
qq|<th class="listheading" colspan="2">| |
|
110 |
. $locale->text('Current / Next Level') |
|
111 |
. qq|</th>|; |
|
112 |
$column_header{active} = |
|
113 |
qq|<th class=listheading>| |
|
114 |
. NTI($cgi->checkbox('-name' => 'selectall_active', |
|
115 |
'-label' => $locale->text('Active?'), |
|
116 |
'-checked' => 0, |
|
117 |
'-onclick' => "checkbox_check_all('selectall_active', 'active_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")")) |
|
118 |
. qq|</th>|; |
|
119 |
$column_header{email} = |
|
120 |
qq|<th class=listheading>| |
|
121 |
. NTI($cgi->checkbox('-name' => 'selectall_email', |
|
122 |
'-label' => $locale->text('eMail?'), |
|
123 |
'-checked' => 0, |
|
124 |
'-onclick' => "checkbox_check_all('selectall_email', 'email_', 1, " . scalar(@{ $form->{DUNNINGS} }) . ")")) |
|
125 |
. qq|</th>|; |
|
126 |
$column_header{customername} = |
|
127 |
qq|<th class=listheading>| |
|
128 |
. $locale->text('Customername') |
|
129 |
. qq|</th>|; |
|
130 |
$column_header{invnumber} = |
|
131 |
qq|<th class=listheading>| |
|
132 |
. $locale->text('Invno.') |
|
133 |
. qq|</th>|; |
|
134 |
$column_header{inv_duedate} = |
|
135 |
qq|<th class=listheading>| |
|
136 |
. $locale->text('Inv. Duedate') |
|
137 |
. qq|</th>|; |
|
138 |
$column_header{next_duedate} = |
|
139 |
qq|<th class=listheading>| |
|
140 |
. $locale->text('Dunning Duedate') |
|
141 |
. qq|</th>|; |
|
142 |
$column_header{invdate} = |
|
143 |
qq|<th class=listheading>| |
|
144 |
. $locale->text('Invdate') |
|
145 |
. qq|</th>|; |
|
146 |
$column_header{amount} = |
|
147 |
qq|<th class=listheading>| |
|
148 |
. $locale->text('Amount') |
|
149 |
. qq|</th>|; |
|
150 |
$column_header{fee} = |
|
151 |
qq|<th class=listheading>| |
|
152 |
. $locale->text('Total Fees') |
|
153 |
. qq|</th>|; |
|
154 |
$column_header{interest} = |
|
155 |
qq|<th class=listheading>| |
|
156 |
. $locale->text('Interest') |
|
157 |
. qq|</th>|; |
|
158 |
|
|
159 |
$form->header; |
|
160 |
|
|
161 |
|
|
162 |
print qq| |
|
163 |
<body> |
|
164 |
<script type="text/javascript" src="js/common.js"></script> |
|
165 |
<script type="text/javascript" src="js/dunning.js"></script> |
|
166 |
<form name=Form method=post action=$form->{script}> |
|
89 |
foreach my $row (@{ $form->{DUNNINGS} }) { |
|
90 |
$row->{DUNNING_CONFIG} = [ map +{ %{ $_ } }, @{ $form->{DUNNING_CONFIG} } ]; |
|
167 | 91 |
|
168 |
|
|
169 |
<table width=100%> |
|
170 |
<tr> |
|
171 |
<th class=listtop colspan=12>$form->{title}</th> |
|
172 |
</tr> |
|
173 |
<tr height="5"></tr> |
|
174 |
<tr>|; |
|
175 |
map { print "$column_header{$_}\n" if $column_header{$_}; } @column_index; |
|
176 |
|
|
177 |
print qq| |
|
178 |
</tr> |
|
179 |
|; |
|
180 |
my $i = 0; |
|
181 |
foreach $ref (@{ $form->{DUNNINGS} }) { |
|
182 |
|
|
183 |
$i++; |
|
184 |
my $j = $i % 2; |
|
185 |
|
|
186 |
print qq| |
|
187 |
<tr valign=top class=listrow$j> |
|
188 |
|; |
|
189 |
|
|
190 |
$form->{selectdunning} =~ s/ selected//g; |
|
191 |
if ($ref->{next_dunning_config_id} ne "") { |
|
192 |
$form->{selectdunning} =~ s/value=$ref->{next_dunning_config_id}/value=$ref->{next_dunning_config_id} selected/; |
|
92 |
if ($row->{next_dunning_config_id}) { |
|
93 |
map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } }; |
|
193 | 94 |
} |
194 |
|
|
195 |
$column_data{dunning_description} = |
|
196 |
qq|<td>| |
|
197 |
. qq|<input type=hidden name=inv_id_$i size=2 value="$ref->{id}">| |
|
198 |
. qq|<input type=hidden name=customer_id_$i size=2 value="$ref->{customer_id}">| |
|
199 |
. ($ref->{dunning_level} ? $ref->{dunning_level} : " ") |
|
200 |
. qq|</td>|; |
|
201 |
$column_data{dunning_description_next} = |
|
202 |
qq|<td>| |
|
203 |
. qq|<select name=next_dunning_config_id_$i>$form->{selectdunning}</select>| |
|
204 |
. qq|</td>|; |
|
205 |
my $active = ($ref->{active}) ? "checked" : ""; |
|
206 |
$column_data{active} = |
|
207 |
qq|<td><input type=checkbox name=active_$i value=1 $active></td>|; |
|
208 |
my $email = ($ref->{email}) ? "checked" : ""; |
|
209 |
$column_data{email} = |
|
210 |
qq|<td><input type=checkbox name=email_$i value=1 $email></td>|; |
|
211 |
$column_data{next_duedate} = qq|<td>$ref->{next_duedate}</td>|; |
|
212 |
|
|
213 |
$column_data{inv_duedate} = qq|<td><input type=hidden name=inv_duedate_$i size=6 value="$ref->{duedate}">$ref->{duedate}</td>|; |
|
214 |
$column_data{invdate} = qq|<td><input type=hidden name=invdate_$i size=6 value="$ref->{transdate}">$ref->{transdate}</td>|; |
|
215 |
$column_data{invnumber} = qq|<td><input type=hidden name=invnumber_$i size=6 value="$ref->{invnumber}">$ref->{invnumber}</td>|; |
|
216 |
$column_data{customername} = qq|<td><input type=hidden name=customername_$i size=6 value="$ref->{customername}">$ref->{customername}</td>|; |
|
217 |
|
|
218 |
map { $column_data{$_} = |
|
219 |
qq|<td align="right">| |
|
220 |
. H($form->format_amount(\%myconfig, $ref->{$_} * 1, -2)) |
|
221 |
. qq|</td>| |
|
222 |
} qw(amount fee interest); |
|
223 |
|
|
224 |
map { print "$column_data{$_}\n" } @column_index; |
|
225 |
|
|
226 |
print qq| |
|
227 |
</tr> |
|
228 |
|; |
|
95 |
map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest); |
|
229 | 96 |
} |
230 | 97 |
|
231 |
$form->{rowcount} = $i; |
|
98 |
$form->{rowcount} = scalar @{ $form->{DUNNINGS} }; |
|
99 |
$form->{jsscript} = 1; |
|
100 |
$form->{callback} ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes)); |
|
232 | 101 |
|
233 |
print qq| |
|
234 |
</table> |
|
235 |
</td> |
|
236 |
</tr> |
|
237 |
<tr> |
|
238 |
<td><hr size=3 noshade></td> |
|
239 |
</tr> |
|
240 |
</table>|; |
|
241 |
print_options(); |
|
242 |
print qq| |
|
243 |
<br> |
|
244 |
<form method=post action=$form->{script}> |
|
245 |
|
|
246 |
<input name=callback type=hidden value="$form->{callback}"> |
|
247 |
<input name=rowcount type=hidden value="$form->{rowcount}"> |
|
248 |
<input name=nextsub type=hidden value="$form->{nextsub}"> |
|
249 |
<input name=groupinvoices type=hidden value="$form->{groupinvoices}"> |
|
250 |
|
|
251 |
|
|
252 |
<input type=hidden name=login value=$form->{login}> |
|
253 |
<input type=hidden name=password value=$form->{password}> |
|
254 |
<input type="hidden" name="action"> |
|
255 |
<input type="submit" name="dummy" value="| |
|
256 |
. $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()"> |
|
257 |
|
|
258 |
</form> |
|
259 |
|
|
260 |
</body> |
|
261 |
</html> |
|
262 |
|; |
|
102 |
$form->{PRINT_OPTIONS} = print_options(1); |
|
263 | 103 |
|
104 |
$form->header(); |
|
105 |
print $form->parse_html_template("dunning/show_invoices"); |
|
264 | 106 |
|
265 | 107 |
$lxdebug->leave_sub(); |
266 |
|
|
267 | 108 |
} |
268 | 109 |
|
269 | 110 |
sub save { |
Auch abrufbar als: Unified diff
Funktion "show_invoices" auf die Verwendung von HTML-Vorlagen umgestellt.