$::form->get_lists(
projects => { key => "ALL_PROJECTS", all => 1 },
);
- $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
+ $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]);
$::form->header;
print $::form->parse_html_template('gl/search', {
# add employee here, so that variable is still known and passed in url when choosing a different sort order in resulting table
my @hidden_variables = qw(accno source reference department description notes project_id datefrom dateto employee_id datesort category l_subtotal);
push @hidden_variables, map { "l_${_}" } @columns;
- foreach ( @hidden_variables ) {
- print URL "$_\n";
- };
my $employee = $form->{employee_id} ? SL::DB::Employee->new(id => $form->{employee_id})->load->name : '';
my $callback = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
- print URL $callback;
- close URL;
$form->{l_credit_accno} = 'Y';
$form->{l_debit_accno} = 'Y';
} else {
$credittax = 1;
}
- if ($form->{taxincluded}) {
- $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
- } else {
- $form->{"tax_$i"} = $amount * $rate;
- }
- } else {
- $form->{"tax_$i"} = 0;
- }
+ };
+ my ($tmpnetamount,$tmpdiff);
+ ($tmpnetamount,$form->{"tax_$i"},$tmpdiff) = $form->calculate_tax($amount,$rate,$form->{taxincluded} *= 1,2);
for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} }
$count++;
if (GL->delete_transaction(\%myconfig, \%$form)){
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
+ $form->{snumbers} = qq|gltransaction_| . $form->{id};
$form->{addition} = "DELETED";
+ $form->{what_done} = "gl_transaction";
$form->save_history;
}
# /saving the history
} else {
$credittax = 1;
}
- if ($form->{taxincluded}) {
- $form->{"tax_$i"} = $amount / ($rate + 1) * $rate;
- if ($debitcredit) {
- $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"};
- } else {
- $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"};
- }
+
+ my ($tmpnetamount,$tmpdiff);
+ ($tmpnetamount,$form->{"tax_$i"},$tmpdiff) = $form->calculate_tax($amount,$rate,$form->{taxincluded} *= 1,2);
+ if ($debitcredit) {
+ $form->{"debit_$i"} = $tmpnetamount;
} else {
- $form->{"tax_$i"} = $amount * $rate;
+ $form->{"credit_$i"} = $tmpnetamount;
}
+
} else {
$form->{"tax_$i"} = 0;
}
undef($form->{callback});
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
- $form->{addition} = "SAVED";
- $form->{what_done} = $locale->text("Buchungsnummer") . " = " . $form->{id};
+ $form->{snumbers} = qq|gltransaction_| . $form->{id};
+ $form->{addition} = "POSTED";
+ $form->{what_done} = "gl transaction";
$form->save_history;
}
# /saving the history
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
- $form->{snumbers} = "ordnumber_$form->{ordnumber}";
+ $form->{snumbers} = qq|gltransaction_| . $form->{id};
$form->{addition} = "STORNO";
+ $form->{what_done} = "gl_transaction";
$form->save_history;
}
# /saving the history