#======================================================================
use POSIX qw(strftime);
+use List::Util qw(sum);
use SL::AR;
+use SL::FU;
use SL::IS;
use SL::PE;
use SL::ReportGenerator;
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $form->{exchangerate} = $exchangerate
- if (
- $form->{forex} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
- )));
+ $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
+ $form->{exchangerate} = $form->{forex} if $form->{forex};
# format amounts
$form->{exchangerate} =
qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\"></td>|;
}
+ my $follow_up_vc = $form->{customer};
+ $follow_up_vc =~ s/--.*?//;
+ my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
+
$form->{javascript} .=
qq|<script type="text/javascript" src="js/common.js"></script>| .
- qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
+ qq|<script type="text/javascript" src="js/show_vc_details.js"></script>| .
+ qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
$form->header;
$onload = qq|focus()|;
<input type=hidden name=closedto value=$form->{closedto}>
<input type=hidden name=locked value=$form->{locked}>
<input type=hidden name=title value="$title">
+<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|">
+<input type="hidden" name="follow_up_trans_type_1" value="ar_transaction">
+<input type="hidden" name="follow_up_trans_info_1" value="| . H($follow_up_trans_info) . qq|">
+<input type="hidden" name="follow_up_rowcount" value="1">
| . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq|
my ($transdate, $closedto);
+ 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|<p>| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|</p>|;
+ }
+ }
+
print qq|
+$follow_ups_block
+
<input name=gldate type=hidden value="| . Q($form->{gldate}) . qq|">
<input name=callback type=hidden value="$form->{callback}">
<input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|"> |;
}
print qq|
- <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|"> |;
+ <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
+ <input type="button" class="submit" onclick="follow_up_window()" value="|
+ . $locale->text('Follow-Up')
+ . qq|"> |;
} else {
if ($transdate > $closedto) {
$form->{rowcount} = $count + 1;
map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount});
- $form->{exchangerate} = $exchangerate
- if (
- $form->{forex} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{transdate}, 'buy'
- )));
+ $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
+ $form->{exchangerate} = $form->{forex} if $form->{forex};
$form->{invdate} = $form->{transdate};
my $save_AR = $form->{AR};
$totalpaid += $form->{"paid_$i"};
- $form->{"exchangerate_$i"} = $exchangerate
- if (
- $form->{"forex_$i"} = (
- $exchangerate =
- $form->check_exchangerate(
- \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'
- )));
+ $form->{"forex_$i"} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy');
+ $form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"};
}
}
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
-# $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto);
+ $form->error($locale->text('Cannot post payment for a closed period!')) if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
if ($form->{currency} ne $form->{defaultcurrency}) {
# $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid);
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
- $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto);
+ $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig));
$form->error($locale->text('Zero amount posting!'))
unless grep $_*1, map $form->parse_amount(\%myconfig, $form->{"amount_$_"}), 1..$form->{rowcount};
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
$form->error($locale->text('Cannot post payment for a closed period!'))
- if ($datepaid <= $closedto);
+ if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
if ($form->{currency} ne $form->{defaultcurrency}) {
$form->{"exchangerate_$i"} = $form->{exchangerate} if ($transdate == $datepaid);
<tr>
<td align=right><input name="l_notes" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Notes') . qq|</td>
- <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
+ <td align=right><input name="l_salesman" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Salesperson') . qq|</td>
<td align=right><input name="l_shippingpoint" class=checkbox type=checkbox value=Y></td>
<td nowrap>| . $locale->text('Shipping Point') . qq|</td>
<td nowrap>| . $locale->text('Ship via') . qq|</td>
</tr>
<tr>
- <td align=right><input name="l_marge_total" class=checkbox type=checkbox value=Y></td><td> |
- . $locale->text('Ertrag') . qq|</td>
- <td align=right><input name="l_marge_percent" class=checkbox type=checkbox value=Y></td><td> |
- . $locale->text('Ertrag prozentual') . qq|</td>
+ <td align=right><input name="l_marge_total" class=checkbox type=checkbox value=Y></td>
+ <td nowrap> | . $locale->text('Ertrag') . qq|</td>
+ <td align=right><input name="l_marge_percent" class=checkbox type=checkbox value=Y></td>
+ <td nowrap> | . $locale->text('Ertrag prozentual') . qq|</td>
+ <td align=right><input name="l_employee" class=checkbox type=checkbox value=Y></td>
+ <td nowrap>| . $locale->text('Employee') . qq|</td>
</tr>
<tr>
<td align=right><input name="l_subtotal" class=checkbox type=checkbox value=Y></td>
@columns =
qw(transdate id type invnumber ordnumber name netamount tax amount paid
- datepaid due duedate transaction_description notes employee shippingpoint shipvia
+ datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia
marge_total marge_percent globalprojectnumber);
my @hidden_variables = map { "l_${_}" } @columns;
'duedate' => { 'text' => $locale->text('Due Date'), },
'transaction_description' => { 'text' => $locale->text('Transaction description'), },
'notes' => { 'text' => $locale->text('Notes'), },
- 'employee' => { 'text' => $locale->text('Salesperson'), },
+ 'salesman' => { 'text' => $locale->text('Salesperson'), },
+ 'employee' => { 'text' => $locale->text('Employee'), },
'shippingpoint' => { 'text' => $locale->text('Shipping Point'), },
'shipvia' => { 'text' => $locale->text('Ship via'), },
'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },