-
+ |
+ $vendors
+ $contact
+
+ | . $locale->text('Credit Limit') . qq| |
+ $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} |
+
- | . $locale->text('Vendor') . qq| |
- $vendor |
-
- |
- . $locale->text('Contact Person') . qq| |
- $contact |
-
- {vendor_id}>
-
-
-
-
- |
-
-
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit} |
- |
- | . $locale->text('Remaining') . qq| |
- $form->{creditremaining} |
-
-
- |
-
- | . $locale->text('Record in') . qq| |
- |
-
+ | . $locale->text('Record in') . qq| |
+ |
+
$taxzone
$department
- | . $locale->text('Currency') . qq| |
- |
+ $currencies
$exchangerate
|
+ $employees
| . $locale->text('Invoice Number') . qq| |
|
@@ -486,13 +511,13 @@ onchange="document.getElementById('update_button').click();">| .
| . $locale->text('Order Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Quotation Date') . qq| |
- |
- |
+
+ |
| . $locale->text('Project Number') . qq| |
@@ -507,33 +532,32 @@ onchange="document.getElementById('update_button').click();">| .
$jsscript
-
-{defaultcurrency}>
-{fxgain_accno}>
-{fxloss_accno}>
-
-
-
-
-
-
+
|;
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
print qq|
{"${item}_rate"}>
|;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
+ $main::auth->assert('vendor_invoice_edit');
$form->{invtotal} = $form->{invsubtotal};
+ my ($rows, $introws);
if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
$rows = 2;
}
@@ -541,14 +565,14 @@ sub form_footer {
$introws = 2;
}
$rows = ($rows > $introws) ? $rows : $introws;
- $notes =
+ my $notes =
qq||;
- $intnotes =
+ my $intnotes =
qq||;
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
- $taxincluded = "";
+ my $taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
{taxincluded}> |
@@ -556,9 +580,10 @@ sub form_footer {
|;
}
+ my ($tax, $subtotal);
if (!$form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{invtotal} += $form->{"${item}_total"} =
$form->round_amount(
@@ -590,7 +615,7 @@ sub form_footer {
}
if ($form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{"${item}_total"} =
$form->round_amount(
@@ -629,6 +654,21 @@ sub form_footer {
$form->{invtotal} =
$form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
+ my $follow_ups_block;
+ if ($form->{id}) {
+ my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
+
+ if (@{ $follow_ups} ) {
+ my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups };
+ $follow_ups_block = qq|
+
+ | . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq| |
+
+|;
+ }
+ }
+
+ our $colspan;
print qq|
@@ -644,6 +684,7 @@ sub form_footer {
| $notes |
$intnotes |
+ $follow_ups_block
|
@@ -652,7 +693,7 @@ sub form_footer {
$subtotal
$tax
- 0
+
| . $locale->text('Total') . qq| |
$form->{invtotal} |
@@ -663,7 +704,8 @@ sub form_footer {
|;
- if ($webdav) {
+ my $webdav_list;
+ if ($main::webdav) {
$webdav_list = qq|
|
@@ -675,11 +717,11 @@ sub form_footer {
Dateiname |
Webdavlink |
|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
+ foreach my $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
- $file |
- $form->{WEBDAV}{$file} |
+ $file->{name} |
+ $file->{type} |
|;
}
@@ -691,9 +733,6 @@ sub form_footer {
print $webdav_list;
}
print qq|
-{jscalendar}>
-|;
- print qq|
@@ -702,12 +741,14 @@ sub form_footer {
|;
+ my @column_index;
if ($form->{currency} eq $form->{defaultcurrency}) {
@column_index = qw(datepaid source memo paid AP_paid);
} else {
@column_index = qw(datepaid source memo paid exchangerate AP_paid);
}
+ my %column_data;
$column_data{datepaid} = "" . $locale->text('Date') . " | ";
$column_data{paid} = "" . $locale->text('Amount') . " | ";
$column_data{exchangerate} = "" . $locale->text('Exch') . " | ";
@@ -723,9 +764,11 @@ sub form_footer {
|;
- my @triggers = ();
+ my @triggers = ();
+ my $totalpaid = 0;
+
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
print qq|
@@ -735,6 +778,8 @@ sub form_footer {
$form->{"selectAP_paid_$i"} =~
s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
+ $totalpaid += $form->{"paid_$i"};
+
# format amounts
if ($form->{"paid_$i"}) {
$form->{"paid_$i"} =
@@ -743,7 +788,7 @@ sub form_footer {
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
- $exchangerate = qq| |;
+ my $exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
$exchangerate =
@@ -766,9 +811,9 @@ sub form_footer {
qq|
| |;
$column_data{"source_$i"} =
- qq|{"source_$i"}> | |;
+ qq| | |;
$column_data{"memo_$i"} =
- qq|{"memo_$i"}> | |;
+ qq| | |;
map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
@@ -778,7 +823,22 @@ sub form_footer {
push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
}
+ my $paid_missing = $form->{oldinvtotal} - $totalpaid;
+
print qq|
+
+ |
+ |
+ | . $locale->text('Total') . qq| |
+ | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| |
+
+
+ |
+ |
+ | . $locale->text('Missing amount') . qq| |
+ | . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq| |
+
+
{oldinvtotal}>
{paidaccounts}>
@@ -792,11 +852,15 @@ sub form_footer {
|;
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+
+ print qq|
+|;
if ($form->{id}) {
- my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
+ my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap") && (($totalpaid == 0) || ($totalpaid eq ""));
print qq|
@@ -812,13 +876,13 @@ sub form_footer {
}
print qq|
+
|;
}
- print qq||;
-
if (!$form->{id} && ($invdate > $closedto)) {
print qq| | .
@@ -827,7 +891,7 @@ sub form_footer {
}
print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers);
- $form->hide_form(qw(rowcount callback draft_id draft_description login password));
+ $form->hide_form(qw(rowcount callback draft_id draft_description vendor_discount));
# button for saving history
if($form->{id} ne "") {
@@ -839,51 +903,57 @@ sub form_footer {
. qq|">|;
}
# /button for saving history
-
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq| |;
+ }
+ # /mark_as_paid button
print qq|
-
| |