Revision 46231fcc
Von Thomas Heck vor fast 12 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
192 | 192 |
|
193 | 193 |
$main::auth->assert('general_ledger'); |
194 | 194 |
|
195 |
my $title = $form->{title}; |
|
196 |
$form->{title} = $locale->text("$title Accounts Payables Transaction"); |
|
197 |
|
|
198 |
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; |
|
195 |
$form->{title_} = $form->{title}; |
|
196 |
$form->{title} = $locale->text($form->{title} .' Accounts Payables Transaction'); |
|
199 | 197 |
|
200 | 198 |
# type=submit $locale->text('Add Accounts Payables Transaction') |
201 | 199 |
# type=submit $locale->text('Edit Accounts Payables Transaction') |
202 | 200 |
|
203 |
$form->{javascript} = qq|<script type="text/javascript"> |
|
204 |
<!-- |
|
205 |
function setTaxkey(accno, row) { |
|
206 |
var taxkey = accno.options[accno.selectedIndex].value; |
|
207 |
var reg = /--([0-9]*)/; |
|
208 |
var found = reg.exec(taxkey); |
|
209 |
var index = found[1]; |
|
210 |
index = parseInt(index); |
|
211 |
var tax = 'taxchart_' + row; |
|
212 |
for (var i = 0; i < document.getElementById(tax).options.length; ++i) { |
|
213 |
var reg2 = new RegExp("^"+ index, ""); |
|
214 |
if (reg2.exec(document.getElementById(tax).options[i].value)) { |
|
215 |
document.getElementById(tax).options[i].selected = true; |
|
216 |
break; |
|
217 |
} |
|
218 |
} |
|
219 |
}; |
|
220 |
//--> |
|
221 |
</script>|; |
|
222 |
# show history button |
|
223 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|; |
|
224 |
#/show hhistory button |
|
225 |
|
|
226 | 201 |
# set option selected |
227 | 202 |
foreach my $item (qw(vendor currency department)) { |
228 | 203 |
my $to_replace = H($form->{$item}); |
229 | 204 |
$form->{"select$item"} =~ s/ selected//; |
230 | 205 |
$form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/; |
231 | 206 |
} |
232 |
my $readonly = ($form->{id}) ? "readonly" : "";
|
|
207 |
my $readonly = $form->{id} ? "readonly" : "";
|
|
233 | 208 |
|
234 | 209 |
$form->{radier} = ($::instance_conf->get_ap_changeable == 2) |
235 | 210 |
? ($form->current_date(\%myconfig) eq $form->{gldate}) |
236 | 211 |
: ($::instance_conf->get_ap_changeable == 1); |
237 |
$readonly = ($form->{radier}) ? "" : $readonly;
|
|
212 |
$readonly = $form->{radier} ? "" : $readonly;
|
|
238 | 213 |
|
239 |
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell'); |
|
240 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
|
214 |
$form->{readonly} = $readonly; |
|
215 |
|
|
216 |
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell'); |
|
217 |
if ( $form->{forex} ) { |
|
218 |
$form->{exchangerate} = $form->{forex}; |
|
219 |
} |
|
241 | 220 |
|
242 | 221 |
# format amounts |
243 | 222 |
$form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : ''; |
244 | 223 |
$form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); |
245 | 224 |
$form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); |
246 | 225 |
|
247 |
my $exchangerate = qq| |
|
248 |
<input type=hidden name=forex value=$form->{forex}> |
|
249 |
|; |
|
250 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { |
|
251 |
if ($form->{forex}) { |
|
252 |
$exchangerate .= qq| |
|
253 |
<tr> |
|
254 |
<th align=right>| . $locale->text('Exchangerate') . qq|</th> |
|
255 |
<td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td> |
|
256 |
</tr> |
|
257 |
|; |
|
258 |
} else { |
|
259 |
$exchangerate .= qq| |
|
260 |
<th align=right>| . $locale->text('Exchangerate') . qq|</th> |
|
261 |
<td><input name=exchangerate size=10 value=$form->{exchangerate}></td> |
|
262 |
|; |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
266 |
my $taxincluded = ""; |
|
267 |
|
|
268 |
$taxincluded = qq| |
|
269 |
<tr> |
|
270 |
<td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td> |
|
271 |
<th align=left nowrap>| |
|
272 |
. $locale->text('Tax Included') . qq|</th> |
|
273 |
</tr> |
|
274 |
|; |
|
275 |
|
|
276 | 226 |
my $rows; |
277 | 227 |
if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) { |
278 | 228 |
$rows = 2; |
279 | 229 |
} |
280 |
my $notes = |
|
281 |
qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|; |
|
282 |
my $intnotes = qq|<textarea name=intnotes rows=$rows cols=50 wrap=soft readonly>$form->{intnotes}</textarea>|; |
|
283 |
|
|
284 |
my $department; |
|
285 |
$department = qq| |
|
286 |
<tr> |
|
287 |
<th align="right" nowrap>| . $locale->text('Department') . qq|</th> |
|
288 |
<td colspan=3><select name=department>$form->{selectdepartment}</select> |
|
289 |
<input type=hidden name=selectdepartment value="| . H($form->{selectdepartment}) . qq|"> |
|
290 |
</td> |
|
291 |
</tr> |
|
292 |
| if $form->{selectdepartment}; |
|
293 |
|
|
294 |
my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1"; |
|
295 |
|
|
296 |
my $vendor = |
|
297 |
($form->{selectvendor}) |
|
298 |
? qq|<select name="vendor" onchange="document.getElementById('update_button').click();">$form->{selectvendor} </select>| |
|
299 |
: qq|<input name=vendor value="$form->{vendor}" size=35>|; |
|
230 |
$form->{textarea_rows} = $rows; |
|
231 |
|
|
232 |
$form->{creditremaining_plus} = ($form->{creditremaining} =~ /-/) ? "0" : "1"; |
|
300 | 233 |
|
301 | 234 |
my @old_project_ids = (); |
302 |
map({ push(@old_project_ids, $form->{"project_id_$_"}) |
|
303 |
if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); |
|
235 |
map( |
|
236 |
{ |
|
237 |
if ($form->{"project_id_$_"}) { |
|
238 |
push(@old_project_ids, $form->{"project_id_$_"}); |
|
239 |
} |
|
240 |
} |
|
241 |
(1..$form->{"rowcount"}) |
|
242 |
); |
|
304 | 243 |
|
305 | 244 |
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", |
306 | 245 |
"all" => 0, |
... | ... | |
310 | 249 |
"taxcharts" => { "key" => "ALL_TAXCHARTS", |
311 | 250 |
"module" => "AP" },); |
312 | 251 |
|
313 |
map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; } |
|
314 |
@{ $form->{ALL_CHARTS} }); |
|
252 |
map( |
|
253 |
{ $_->{link_split} = [ split(/:/, $_->{link}) ]; } |
|
254 |
@{ $form->{ALL_CHARTS} } |
|
255 |
); |
|
315 | 256 |
|
316 | 257 |
my %project_labels = (); |
317 | 258 |
my @project_values = (""); |
318 | 259 |
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) { |
319 |
push(@project_values, $item->{"id"});
|
|
320 |
$project_labels{$item->{"id"}} = $item->{"projectnumber"};
|
|
260 |
push(@project_values, $item->{id});
|
|
261 |
$project_labels{$item->{id}} = $item->{projectnumber};
|
|
321 | 262 |
} |
322 | 263 |
|
323 | 264 |
my (%AP_amount_labels, @AP_amount_values); |
... | ... | |
359 | 300 |
$taxcharts{$item->{id}} = $item; |
360 | 301 |
} |
361 | 302 |
|
362 |
# use JavaScript Calendar or not |
|
363 | 303 |
$form->{jsscript} = 1; |
364 |
my $jsscript = ""; |
|
365 |
my ($button1, $button2); |
|
366 |
if ($form->{jsscript}) { |
|
367 |
|
|
368 |
# with JavaScript Calendar |
|
369 |
$button1 = qq| |
|
370 |
<td><input name=transdate onchange="set_duedate()" id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\" $readonly></td> |
|
371 |
<td><input type=button name=transdate id="trigger1" value=| |
|
372 |
. $locale->text('button') . qq|></td> |
|
373 |
|; |
|
374 |
$button2 = qq| |
|
375 |
<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\" $readonly></td> |
|
376 |
<td><input type=button name=duedate id="trigger2" value=| |
|
377 |
. $locale->text('button') . qq|></td></td> |
|
378 |
|; |
|
379 |
|
|
380 |
#write Trigger |
|
381 |
$jsscript = |
|
382 |
Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", |
|
383 |
"duedate", "BL", "trigger2"); |
|
384 |
} else { |
|
385 |
|
|
386 |
# without JavaScript Calendar |
|
387 |
$button1 = |
|
388 |
qq|<td><input name=transdate onchange="set_duedate()" id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\" $readonly></td>|; |
|
389 |
$button2 = |
|
390 |
qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\" $readonly></td>|; |
|
391 |
} |
|
392 | 304 |
|
393 | 305 |
my $follow_up_vc = $form->{vendor}; |
394 | 306 |
$follow_up_vc =~ s/--.*?//; |
... | ... | |
398 | 310 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|; |
399 | 311 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|; |
400 | 312 |
|
401 |
my $globalprojectnumber =
|
|
313 |
$form->{globalprojectnumber} =
|
|
402 | 314 |
NTI($cgi->popup_menu('-name' => "globalproject_id", |
403 | 315 |
'-values' => \@project_values, |
404 | 316 |
'-labels' => \%project_labels, |
405 | 317 |
'-default' => $form->{"globalproject_id"} )); |
406 | 318 |
|
407 | 319 |
$form->header; |
408 |
print qq| |
|
409 |
<form method=post action=$form->{script}> |
|
410 |
|
|
411 |
<input type=hidden name=id value=$form->{id}> |
|
412 |
<input type=hidden name=sort value=$form->{sort}> |
|
413 |
<input type=hidden name=closedto value=$form->{closedto}> |
|
414 |
<input type=hidden name=locked value=$form->{locked}> |
|
415 |
<input type=hidden name=title value="$title"> |
|
416 |
|
|
417 |
<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|"> |
|
418 |
<input type="hidden" name="follow_up_trans_type_1" value="ap_transaction"> |
|
419 |
<input type="hidden" name="follow_up_trans_info_1" value="| . H($follow_up_trans_info) . qq|"> |
|
420 |
<input type="hidden" name="follow_up_rowcount" value="1"> |
|
421 |
|
|
422 |
| . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq| |
|
423 |
|
|
424 |
<table width=100%> |
|
425 |
<tr class=listtop> |
|
426 |
<th class=listtop>$form->{title}</th> |
|
427 |
</tr> |
|
428 |
<tr height="5"></tr> |
|
429 |
<tr valign=top> |
|
430 |
<td> |
|
431 |
<table width=100%> |
|
432 |
<tr valign=top> |
|
433 |
<td> |
|
434 |
<table> |
|
435 |
<tr> |
|
436 |
<th align=right nowrap>| . $locale->text('Vendor') . qq|</th> |
|
437 |
<td colspan=3>$vendor <input type="button" value="D" onclick="show_vc_details('vendor')"></td> |
|
438 |
<input type=hidden name=selectvendor value="| . H($form->{selectvendor}) . qq|"> |
|
439 |
<input type=hidden name=oldvendor value="| . H($form->{oldvendor}) . qq|"> |
|
440 |
<input type=hidden name=vendor_id value="| . H($form->{vendor_id}) . qq|"> |
|
441 |
<input type=hidden name=terms value="| . H($form->{terms}) . qq|"> |
|
442 |
</tr> |
|
443 |
<tr> |
|
444 |
<td></td> |
|
445 |
<td colspan=3> |
|
446 |
<table width=100%> |
|
447 |
<tr> |
|
448 |
<th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th> |
|
449 |
<td>$form->{creditlimit}</td> |
|
450 |
<th align=left nowrap>| . $locale->text('Remaining') . qq|</th> |
|
451 |
<td class="plus$n">$form->{creditremaining}</td> |
|
452 |
<input type=hidden name=creditlimit value=$form->{creditlimit}> |
|
453 |
<input type=hidden name=creditremaining value=$form->{creditremaining}> |
|
454 |
</tr> |
|
455 |
</table> |
|
456 |
</td> |
|
457 |
<tr> |
|
458 |
<th align=right nowrap>| . $locale->text('Currency') . qq|</th> |
|
459 |
<td><select name=currency>$form->{selectcurrency}</select></td> |
|
460 |
<input type=hidden name=selectcurrency value="| . H($form->{selectcurrency}) . qq|"> |
|
461 |
<input type=hidden name=defaultcurrency value=$form->{defaultcurrency}> |
|
462 |
<input type=hidden name=fxgain_accno value=$form->{fxgain_accno}> |
|
463 |
<input type=hidden name=fxloss_accno value=$form->{fxloss_accno}> |
|
464 |
$exchangerate |
|
465 |
</tr> |
|
466 |
$department |
|
467 |
$taxincluded |
|
468 |
</table> |
|
469 |
</td> |
|
470 |
<td align=right> |
|
471 |
<table> |
|
472 |
<tr> |
|
473 |
<th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th> |
|
474 |
<td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td> |
|
475 |
</tr> |
|
476 |
<tr> |
|
477 |
<th align=right nowrap>| . $locale->text('Order Number') . qq|</th> |
|
478 |
<td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td> |
|
479 |
</tr> |
|
480 |
<tr> |
|
481 |
<th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th> |
|
482 |
$button1 |
|
483 |
</tr> |
|
484 |
<tr> |
|
485 |
<th align=right nowrap>| . $locale->text('Due Date') . qq|</th> |
|
486 |
$button2 |
|
487 |
</tr> |
|
488 |
<tr> |
|
489 |
<th align=right nowrap>| . $locale->text('Project Number') . qq|</th> |
|
490 |
<td>$globalprojectnumber</td> |
|
491 |
</tr> |
|
492 |
</table> |
|
493 |
</td> |
|
494 |
</tr> |
|
495 |
</table> |
|
496 |
</td> |
|
497 |
</tr> |
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
$jsscript |
|
502 |
<input type=hidden name=rowcount value=$form->{rowcount}> |
|
503 |
<tr> |
|
504 |
<td> |
|
505 |
<table width=100%> |
|
506 |
<tr class=listheading> |
|
507 |
<th class=listheading style="width:15%">| . $locale->text('Account') . qq|</th> |
|
508 |
<th class=listheading style="width:10%">| . $locale->text('Amount') . qq|</th> |
|
509 |
<th class=listheading style="width:10%">| . $locale->text('Tax') . qq|</th> |
|
510 |
<th class=listheading style="width:10%">| . $locale->text('Taxkey') . qq|</th> |
|
511 |
<th class=listheading style="width:10%">| . $locale->text('Project') . qq|</th> |
|
512 |
</tr> |
|
513 |
|; |
|
514 |
|
|
515 |
my $amount = $locale->text('Amount'); |
|
516 |
my $project = $locale->text('Project'); |
|
517 | 320 |
|
518 | 321 |
for my $i (1 .. $form->{rowcount}) { |
519 | 322 |
|
520 | 323 |
# format amounts |
521 |
$form->{"amount_$i"} = |
|
522 |
$form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); |
|
324 |
$form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); |
|
523 | 325 |
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); |
524 | 326 |
|
525 | 327 |
my $selected_accno_full; |
... | ... | |
540 | 342 |
|
541 | 343 |
$selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); |
542 | 344 |
|
543 |
my $selectAP_amount =
|
|
345 |
$form->{'selectAP_amount_'. $i} =
|
|
544 | 346 |
NTI($cgi->popup_menu('-name' => "AP_amount_$i", |
545 | 347 |
'-id' => "AP_amount_$i", |
546 | 348 |
'-style' => 'width:400px', |
... | ... | |
551 | 353 |
. $cgi->hidden('-name' => "previous_AP_amount_$i", |
552 | 354 |
'-default' => $selected_accno_full); |
553 | 355 |
|
554 |
my $tax = qq|<td>| .
|
|
356 |
$form->{'select_tax_'. $i} =
|
|
555 | 357 |
NTI($cgi->popup_menu('-name' => "taxchart_$i", |
556 | 358 |
'-id' => "taxchart_$i", |
557 | 359 |
'-style' => 'width:200px', |
558 | 360 |
'-values' => \@taxchart_values, |
559 | 361 |
'-labels' => \%taxchart_labels, |
560 |
'-default' => $selected_taxchart)) |
|
561 |
. qq|</td>|; |
|
362 |
'-default' => $selected_taxchart)); |
|
562 | 363 |
|
563 |
my $projectnumber =
|
|
364 |
$form->{'select_projectnumber_'. $i} =
|
|
564 | 365 |
NTI($cgi->popup_menu('-name' => "project_id_$i", |
565 | 366 |
'-values' => \@project_values, |
566 | 367 |
'-labels' => \%project_labels, |
567 | 368 |
'-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} )); |
568 |
|
|
569 |
print qq| |
|
570 |
<tr> |
|
571 |
<td>$selectAP_amount</td> |
|
572 |
<td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td> |
|
573 |
<td><input type="hidden" name="tax_$i" value="$form->{"tax_$i"}">$form->{"tax_$i"}</td> |
|
574 |
$tax |
|
575 |
<td>$projectnumber</td> |
|
576 |
</tr> |
|
577 |
|; |
|
578 |
$amount = ""; |
|
579 |
$project = ""; |
|
580 | 369 |
} |
581 | 370 |
|
582 |
my $taxlabel = |
|
583 |
($form->{taxincluded}) |
|
584 |
? $locale->text('Tax Included') |
|
585 |
: $locale->text('Tax'); |
|
586 | 371 |
|
587 | 372 |
$form->{invtotal_unformatted} = $form->{invtotal}; |
588 | 373 |
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2); |
589 | 374 |
|
590 |
my $APselected =
|
|
375 |
$form->{APselected} =
|
|
591 | 376 |
NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected", |
592 | 377 |
'-style' => 'width:400px', |
593 | 378 |
'-values' => \@AP_values, '-labels' => \%AP_labels, |
594 | 379 |
'-default' => $form->{APselected})); |
595 |
print qq| |
|
596 |
<tr> |
|
597 |
<td colspan=6> |
|
598 |
<hr noshade> |
|
599 |
</td> |
|
600 |
</tr> |
|
601 |
<tr> |
|
602 |
<td>${APselected}</td> |
|
603 |
<th align=left>$form->{invtotal}</th> |
|
604 |
|
|
605 |
<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}> |
|
606 |
<input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}> |
|
607 |
|
|
608 |
<input type=hidden name=taxaccounts value="$form->{taxaccounts}"> |
|
609 |
|
|
610 |
<td colspan=4></td> |
|
611 |
|
|
612 |
|
|
613 |
</tr> |
|
614 |
</table> |
|
615 |
</td> |
|
616 |
</tr> |
|
617 |
<tr> |
|
618 |
<td> |
|
619 |
<table width=100%> |
|
620 |
<tr> |
|
621 |
<th align=left width=1%>| . $locale->text('Notes') . qq|</th> |
|
622 |
<td align=left>$notes</td> |
|
623 |
|
|
624 |
<th align=left width=1%>| . $locale->text('Notes for vendor') . qq|</th> |
|
625 |
<td align=left>$intnotes</td> |
|
626 |
</tr> |
|
627 |
</table> |
|
628 |
</td> |
|
629 |
</tr> |
|
630 |
<tr> |
|
631 |
<td> |
|
632 |
<table width=100%> |
|
633 |
<tr class=listheading> |
|
634 |
<th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th> |
|
635 |
</tr> |
|
636 |
|; |
|
637 | 380 |
|
638 |
my @column_index; |
|
639 |
if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) { |
|
640 |
@column_index = qw(datepaid source memo paid AP_paid paid_project_id); |
|
641 |
} else { |
|
642 |
@column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id); |
|
643 |
} |
|
644 |
|
|
645 |
my %column_data; |
|
646 |
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>"; |
|
647 |
$column_data{paid} = "<th>" . $locale->text('Amount') . "</th>"; |
|
648 |
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>"; |
|
649 |
$column_data{AP_paid} = "<th>" . $locale->text('Account') . "</th>"; |
|
650 |
$column_data{source} = "<th>" . $locale->text('Source') . "</th>"; |
|
651 |
$column_data{memo} = "<th>" . $locale->text('Memo') . "</th>"; |
|
652 |
$column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>"; |
|
653 |
|
|
654 |
print " |
|
655 |
<tr> |
|
656 |
"; |
|
657 |
map { print "$column_data{$_}\n" } @column_index; |
|
658 |
print " |
|
659 |
</tr> |
|
660 |
"; |
|
661 |
|
|
662 |
my @triggers = (); |
|
663 | 381 |
$form->{totalpaid} = 0; |
664 | 382 |
|
665 |
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); |
|
383 |
if ( $form->{'paid_'. $form->{paidaccounts}} ) { |
|
384 |
$form->{paidaccounts}++; |
|
385 |
} |
|
666 | 386 |
for my $i (1 .. $form->{paidaccounts}) { |
667 |
print " |
|
668 |
<tr> |
|
669 |
"; |
|
670 | 387 |
|
671 |
my $selectAP_paid =
|
|
388 |
$form->{'selectAP_paid_'. $i} =
|
|
672 | 389 |
NTI($cgi->popup_menu('-name' => "AP_paid_$i", |
673 | 390 |
'-id' => "AP_paid_$i", |
674 | 391 |
'-values' => \@AP_paid_values, |
... | ... | |
679 | 396 |
|
680 | 397 |
# format amounts |
681 | 398 |
if ($form->{"paid_$i"}) { |
682 |
$form->{"paid_$i"} = |
|
683 |
$form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); |
|
399 |
$form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); |
|
684 | 400 |
} |
685 | 401 |
if ($form->{"exchangerate_$i"} == 0) { |
686 | 402 |
$form->{"exchangerate_$i"} = ""; |
... | ... | |
689 | 405 |
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); |
690 | 406 |
} |
691 | 407 |
|
692 |
print qq|<input type=hidden name="acc_trans_id_$i" value=$form->{"acc_trans_id_$i"}>\n|; |
|
693 |
print qq|<input type=hidden name="gldate_$i" value=$form->{"gldate_$i"}>\n|; |
|
694 | 408 |
my $changeable = 1; |
695 | 409 |
if (SL::DB::Default->get->payments_changeable == 0) { |
696 | 410 |
# never |
... | ... | |
701 | 415 |
$changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); |
702 | 416 |
} |
703 | 417 |
|
704 |
$exchangerate = qq| |; |
|
705 |
if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { |
|
706 |
if ($form->{"forex_$i"}) { |
|
707 |
$exchangerate = |
|
708 |
qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; |
|
709 |
} else { |
|
710 |
if ($changeable) { |
|
711 |
$exchangerate = |
|
712 |
qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|; |
|
713 |
} else { |
|
714 |
$exchangerate = |
|
715 |
qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; |
|
716 |
} |
|
717 |
} |
|
718 |
} |
|
719 |
|
|
720 |
$exchangerate .= qq| |
|
721 |
<input type=hidden name="forex_$i" value=$form->{"forex_$i"}> |
|
722 |
|; |
|
723 |
|
|
724 |
my $datepaid; |
|
725 |
if ($changeable) { |
|
726 |
$datepaid = qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\"> |
|
727 |
<input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="| . $locale->text('Details (one letter abbreviation)') . qq|"></td>|; |
|
728 |
} else { |
|
729 |
$datepaid = qq|<td align=center>$form->{"datepaid_$i"}</td>|. |
|
730 |
qq|<input type=hidden name="datepaid_$i" value=$form->{"datepaid_$i"}>|; |
|
731 |
} |
|
418 |
$form->{'paidaccount_changeable_'. $i} = $changeable; |
|
732 | 419 |
|
733 |
my $paid; |
|
734 |
if ($changeable) { |
|
735 |
$paid = qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|; |
|
420 |
if ( $changeable ) { |
|
421 |
$form->{'selectpaid_project_id_'. $i} = |
|
422 |
NTI($cgi->popup_menu('-name' => "paid_project_id_$i", |
|
423 |
'-values' => \@project_values, |
|
424 |
'-labels' => \%project_labels, |
|
425 |
'-default' => $form->{"paid_project_id_$i"})); |
|
736 | 426 |
} else { |
737 |
$paid = qq|<td align=center>$form->{"paid_$i"}</td>|. |
|
738 |
qq|<input type=hidden name="paid_$i" value=$form->{"paid_$i"}>|; |
|
739 |
} |
|
740 |
|
|
741 |
my $source; |
|
742 |
if ($changeable) { |
|
743 |
$source = qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|; |
|
744 |
} else { |
|
745 |
$source = qq|<td align=center>$form->{"source_$i"}</td>|. |
|
746 |
qq|<input type=hidden name="source_$i" value=$form->{"source_$i"}>|; |
|
747 |
} |
|
748 |
|
|
749 |
my $memo; |
|
750 |
if ($changeable) { |
|
751 |
$memo = qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|; |
|
752 |
} else { |
|
753 |
$memo = qq|<td align=center>$form->{"memo_$i"}</td>|. |
|
754 |
qq|<input type=hidden name="memo_$i" value=$form->{"memo_$i"}>|; |
|
755 |
} |
|
756 |
|
|
757 |
my $AP_paid; |
|
758 |
if ($changeable) { |
|
759 |
$AP_paid = qq|<td align=center>${selectAP_paid}</td>|; |
|
760 |
} else { |
|
761 |
$AP_paid = qq|<td align=center>$form->{"AP_paid_$i"}</td>|. |
|
762 |
qq|<input type=hidden name="AP_paid_$i" value=$form->{"AP_paid_$i"}>|; |
|
763 |
} |
|
764 |
|
|
765 |
my $paid_project_id; |
|
766 |
if ($changeable) { |
|
767 |
$paid_project_id = |
|
768 |
qq|<td>| |
|
769 |
. NTI($cgi->popup_menu('-name' => "paid_project_id_$i", |
|
770 |
'-values' => \@project_values, |
|
771 |
'-labels' => \%project_labels, |
|
772 |
'-default' => $form->{"paid_project_id_$i"} )) |
|
773 |
. qq|</td>|; |
|
774 |
} else { |
|
775 |
my $projectnumber = $project_labels{$form->{"paid_project_id_$i"}}; |
|
776 |
$paid_project_id = qq|<td>$projectnumber</td>|. |
|
777 |
qq|<input type=hidden name="paid_project_id_$i" value=$form->{"paid_project_id_$i"}>|; |
|
778 |
} |
|
779 |
|
|
780 |
$column_data{"paid_$i"} = $paid; |
|
781 |
$column_data{"AP_paid_$i"} = $AP_paid; |
|
782 |
$column_data{"exchangerate_$i"} = qq|<td align=center>$exchangerate</td>|; |
|
783 |
$column_data{"datepaid_$i"} = $datepaid; |
|
784 |
$column_data{"source_$i"} = $source; |
|
785 |
$column_data{"memo_$i"} = $memo; |
|
786 |
$column_data{"paid_project_id_$i"} = $paid_project_id; |
|
787 |
|
|
788 |
map { print qq|$column_data{"${_}_$i"}\n| } @column_index; |
|
789 |
|
|
790 |
print " |
|
791 |
</tr> |
|
792 |
"; |
|
793 |
if ($changeable) { |
|
794 |
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); |
|
427 |
$form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}}; |
|
795 | 428 |
} |
796 | 429 |
} |
797 | 430 |
|
798 |
my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
|
|
431 |
$form->{paid_missing} = $form->{invtotal_unformatted} - $form->{totalpaid};
|
|
799 | 432 |
|
800 |
print qq| |
|
801 |
<tr> |
|
802 |
<td></td> |
|
803 |
<td></td> |
|
804 |
<td align="center">| . $locale->text('Total') . qq|</td> |
|
805 |
<td align="center">| . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq|</td> |
|
806 |
</tr> |
|
807 |
<tr> |
|
808 |
<td></td> |
|
809 |
<td></td> |
|
810 |
<td align="center">| . $locale->text('Missing amount') . qq|</td> |
|
811 |
<td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td> |
|
812 |
</tr> |
|
813 |
| . $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) . |
|
814 |
qq| |
|
815 |
<input type=hidden name=paidaccounts value=$form->{paidaccounts}> |
|
816 |
|
|
817 |
</table> |
|
818 |
</td> |
|
819 |
</tr> |
|
820 |
<tr> |
|
821 |
<td><hr size=3 noshade></td> |
|
822 |
</tr> |
|
823 |
</table> |
|
824 |
|; |
|
433 |
print $form->parse_html_template('ap/form_header'); |
|
825 | 434 |
|
826 | 435 |
$main::lxdebug->leave_sub(); |
827 | 436 |
} |
Auch abrufbar als: Unified diff
HTML-Code aus bin/ap.pl/form_header in ein eigenes Template übertragen