# /saving the history
$form->{title} = "Add";
- $form->{callback} = "ar.pl?action=add" unless $form->{callback};
+ $form->{callback} = "ar.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback};
AR->get_transdate(\%myconfig, $form);
$form->{initial_transdate} = $form->{transdate};
$form->{exchangerate} = $form->{forex} if $form->{forex};
# format amounts
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- if ($form->{exchangerate} == 0) {
- $form->{exchangerate} = "";
- }
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
+ $form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : '';
+ $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
+ $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
$exchangerate = qq|
<input type=hidden name=forex value=$form->{forex}>
$form->{invdate} = $form->{transdate};
- my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1);
+ my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 oldcustomer);
&check_name("customer");
+ # check_name ruft get_customer auf, oldcustomer wird überschrieben, daher wird dies vorher gemerkt
+ # get_customer holt Bemerkungen als intnotes, für Debitorenbuchungen gibt es aber nur das Feld notes
+ $form->{notes} = $form->{intnotes} if $saved_variables{oldcustomer} ne $form->{customer};
+
$form->{AR} = $saved_variables{AR};
if ($saved_variables{AR_amount_1} =~ m/.--./) {
map { $form->{$_} = $saved_variables{$_} } qw(AR_amount_1 taxchart_1);
$form->{title} = $locale->text('AR Transactions');
$form->{jsscript} = 1;
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
- "customers" => "ALL_VC");
+ # Auch in Rechnungsübersicht nach Kundentyp filtern - jan
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
+ "departments" => "ALL_DEPARTMENTS",
+ "customers" => "ALL_VC",
+ "employees" => "ALL_EMPLOYEES",
+ "salesmen" => "ALL_SALESMEN",
+ "business_types" => "ALL_BUSINESS_TYPES");
+ $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
# constants and subs for template
$form->{jsscript} = 1;
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
+ $form->{employee_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
+ $form->{salesman_labels} = $form->{employee_labels};
$form->header;
print $form->parse_html_template('ar/search', { %myconfig });
my ($callback, $href, @columns);
- $form->{customer} = $form->unescape($form->{customer});
($form->{customer}, $form->{customer_id}) = split(/--/, $form->{customer});
report_generator_set_default_sort('transdate', 1);
@columns =
qw(transdate id type invnumber ordnumber 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);
+ marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype);
my @hidden_variables = map { "l_${_}" } @columns;
- push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto);
+ push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id);
$href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
'taxzone' => { 'text' => $locale->text('Steuersatz'), },
'payment_terms' => { 'text' => $locale->text('Payment Terms'), },
'charts' => { 'text' => $locale->text('Buchungskonto'), },
+ 'customertype' => { 'text' => $locale->text('Customer type'), },
);
foreach my $name (qw(id transdate duedate invnumber ordnumber name datepaid employee shippingpoint shipvia transaction_description)) {
'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time),
);
$report->set_options_from_form();
+ $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv';
# add sort and escape callback, this one we use for the add sub
$form->{callback} = $href .= "&sort=$form->{sort}";