226 |
226 |
|
227 |
227 |
$auth->assert('vendor_invoice_edit');
|
228 |
228 |
|
|
229 |
push @{ $form->{AJAX} }, CGI::Ajax->new('set_duedate_vendor' => "$form->{script}?action=set_duedate_vendor");
|
|
230 |
|
229 |
231 |
# set option selected
|
230 |
232 |
foreach $item (qw(AP vendor currency department)) {
|
231 |
233 |
$form->{"select$item"} =~ s/ selected//;
|
... | ... | |
389 |
391 |
$jsscript = "";
|
390 |
392 |
|
391 |
393 |
$button1 = qq|
|
392 |
|
<td><input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\">
|
393 |
|
<input type=button name=invdate id="trigger1" value=| . $locale->text('button') . qq|></td>\n|;
|
|
394 |
<td nowrap>
|
|
395 |
<input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\"
|
|
396 |
onChange="if (this.value) set_duedate_vendor(['invdate__' + this.value, 'old_duedate__' + document.getElementsByName('duedate')[0].value, 'vendor_id__' + document.getElementsByName('vendor_id')[0].value],['duedate'])">
|
|
397 |
<input type=button name=invdate id="trigger1" value="?">
|
|
398 |
</td>\n|;
|
|
399 |
|
|
400 |
#, 'old_duedate__'' + document.getElementsByName('duedate')[0].value, 'vendor_id__' + document.getElementsByName('vendor_id')[0].value],['duedate'])">
|
394 |
401 |
$button2 = qq|
|
395 |
|
<td width="13"><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\">
|
396 |
|
<input type=button name=duedate id="trigger2" value=| . $locale->text('button') . qq|></td>\n|;
|
|
402 |
<td width="13" nowrap>
|
|
403 |
<input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\">
|
|
404 |
<input type=button name=duedate id="trigger2" value=| . $locale->text('button') . qq|>
|
|
405 |
</td>\n|;
|
397 |
406 |
|
398 |
407 |
#write Trigger
|
399 |
408 |
$jsscript =
|
... | ... | |
419 |
428 |
print qq|
|
420 |
429 |
<body onLoad="$onload">
|
421 |
430 |
<script type="text/javascript" src="js/common.js"></script>
|
422 |
|
<form method=post action=$form->{script}>
|
|
431 |
<form method="post" action="ir.pl" name="Form">
|
423 |
432 |
|;
|
424 |
433 |
|
425 |
434 |
$form->hide_form(qw(id title vc type level creditlimit creditremaining closedto locked shippted storno storno_id
|
... | ... | |
1206 |
1215 |
|
1207 |
1216 |
$lxdebug->leave_sub();
|
1208 |
1217 |
}
|
|
1218 |
|
|
1219 |
sub set_duedate_vendor {
|
|
1220 |
$lxdebug->enter_sub();
|
|
1221 |
|
|
1222 |
print $cgi->header(), IR->get_duedate('vendor_id' => $form->{vendor_id},
|
|
1223 |
'invdate' => $form->{invdate},
|
|
1224 |
'default' => $form->{old_duedate});
|
|
1225 |
|
|
1226 |
$lxdebug->leave_sub();
|
|
1227 |
}
|
Eingangsrechnungen: Wird das Rechnungsdatum verändert, so wird per AJAX das Fälligkeitsdatum anhand der beim Lieferanten hinterlegten Zahlungsbedingungen berechnet und im Formular ersetzt.