if (!$params{dont_save}) {
%saved = map { ($_ => $form->{$_}) } qw(direct_debit id taxincluded);
$saved{duedate} = $form->{duedate} if $form->{duedate};
+ $saved{currency} = $form->{currency} if $form->{currency};
}
IS->get_customer(\%myconfig, \%$form);
# currencies
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
+ $form->{selectcurrency} = "";
map { $form->{selectcurrency} .= "<option>$_\n" } $form->get_all_currencies(\%myconfig);
# customers
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
$form->{exchangerate} = $form->{forex} if $form->{forex};
+ # format exchangerate
+ $form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : '';
+
$rows = max 2, $form->numtextrows($form->{notes}, 50);
my @old_project_ids = grep { $_ } map { $form->{"project_id_$_"} } 1..$form->{rowcount};
my $cgi = $::request->{cgi};
if ( $form->{id} ) {
- my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
+ my $follow_ups = FU->follow_ups('trans_id' => $form->{id}, 'not_done' => 1);
if ( @{ $follow_ups} ) {
$form->{follow_up_length} = scalar(@{$follow_ups});
$form->{follow_up_due_length} = sum(map({ $_->{due} * 1 } @{ $follow_ups }));
@columns =
qw(ids transdate id type invnumber ordnumber cusordnumber name netamount tax amount paid
datepaid due duedate transaction_description notes salesman employee shippingpoint shipvia
- marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype direct_debit dunning_description);
+ marge_total marge_percent globalprojectnumber customernumber country ustid taxzone
+ payment_terms charts customertype direct_debit dunning_description department);
my $ct_cvar_configs = CVar->get_configs('module' => 'CT');
my @ct_includeable_custom_variables = grep { $_->{includeable} } @{ $ct_cvar_configs };
my @hidden_variables = map { "l_${_}" } @columns;
push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber cusordnumber transaction_description notes project_id transdatefrom transdateto duedatefrom duedateto
- employee_id salesman_id business_id parts_partnumber parts_description);
+ employee_id salesman_id business_id parts_partnumber parts_description department_id);
push @hidden_variables, map { "cvar_$_->{name}" } @ct_searchable_custom_variables;
$href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
'charts' => { 'text' => $locale->text('Buchungskonto'), },
'customertype' => { 'text' => $locale->text('Customer type'), },
'direct_debit' => { 'text' => $locale->text('direct debit'), },
+ 'department' => { 'text' => $locale->text('Department'), },
dunning_description => { 'text' => $locale->text('Dunning level'), },
%column_defs_cvars,
);
if ($form->{cp_name}) {
push @options, $locale->text('Contact Person') . " : $form->{cp_name}";
}
+
+ # $form->{department} seems to never be filled, and showing the department_id
+ # at the top of the report doesn't make much sense.
+ # So determine the department name from the id whenever we have a filter for
+ # department
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
}
if ($form->{department_id}) {
- push @options, $locale->text('Department Id') . " : $form->{department_id}";
+ # push @options, $locale->text('Department Id') . " : $form->{department_id}";
+ unless ($form->{department}) {
+ require SL::DB::Department;
+ my $department = SL::DB::Manager::Department->find_by(id => $::form->{department_id});
+ push @options, $locale->text('Department') . " : " . $department->description if $department;
+ }
}
if ($form->{invnumber}) {
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
$subtotals{marge_percent} = $subtotals{netamount} ? ($subtotals{marge_total} * 100 / $subtotals{netamount}) : 0;
$totals{marge_percent} = $totals{netamount} ? ($totals{marge_total} * 100 / $totals{netamount} ) : 0;
- map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent);
-
my $is_storno = $ar->{storno} && $ar->{storno_id};
my $has_storno = $ar->{storno} && !$ar->{storno_id};
$ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") :
$locale->text("AR Transaction (abbreviation)");
+ map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent);
+
$ar->{direct_debit} = $ar->{direct_debit} ? $::locale->text('yes') : $::locale->text('no');
my $row = { };