33 |
33 |
|
34 |
34 |
use SL::AP;
|
35 |
35 |
use SL::IR;
|
|
36 |
use SL::IS;
|
36 |
37 |
use SL::PE;
|
37 |
38 |
|
38 |
39 |
require "bin/mozilla/arap.pl";
|
... | ... | |
850 |
851 |
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
851 |
852 |
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
852 |
853 |
|
853 |
|
print qq|<input class="submit" type="submit" name="action" id="update_button" value="|
|
854 |
|
. $locale->text('Update') . qq|">|;
|
|
854 |
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
|
|
855 |
print qq|<input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|">|
|
|
856 |
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap') && !$form->{paid_1});
|
855 |
857 |
|
856 |
|
if ($form->{id}) {
|
|
858 |
print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">|;
|
857 |
859 |
|
858 |
|
# print qq|<input class=submit type=submit name=action value="|.$locale->text('Update').qq|">
|
859 |
|
# |;
|
|
860 |
if ($form->{id}) {
|
860 |
861 |
if ($form->{radier}) {
|
861 |
|
print qq|
|
862 |
|
<input class=submit type=submit name=action value="|
|
863 |
|
. $locale->text('Post') . qq|">
|
864 |
|
<input class=submit type=submit name=action value="|
|
865 |
|
. $locale->text('Delete') . qq|">
|
|
862 |
print qq| <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">
|
|
863 |
<input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">
|
866 |
864 |
|;
|
867 |
865 |
}
|
868 |
866 |
|
869 |
|
print qq|
|
870 |
|
<input class=submit type=submit name=action value="|
|
871 |
|
. $locale->text('Use As Template') . qq|">
|
872 |
|
<input class=submit type=submit name=action value="|
|
873 |
|
. $locale->text('Post Payment') . qq|">
|
|
867 |
print qq| <input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|">
|
|
868 |
<input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
|
874 |
869 |
|;
|
875 |
870 |
} elsif (($transdate > $closedto) && !$form->{id}) {
|
876 |
871 |
print qq|
|
877 |
|
<input class=submit type=submit name=action value="|
|
878 |
|
. $locale->text('Post') . qq|"> | .
|
879 |
|
NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'),
|
880 |
|
'-class' => 'submit'));
|
|
872 |
<input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> | .
|
|
873 |
NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
|
881 |
874 |
}
|
882 |
875 |
# button for saving history
|
883 |
876 |
if($form->{id} ne "") {
|
884 |
|
print qq|
|
885 |
|
<input type="button" class="submit" onclick="set_history_window(|
|
886 |
|
. $form->{id}
|
887 |
|
. qq|);" name="history" id="history" value="|
|
888 |
|
. $locale->text('history')
|
889 |
|
. qq|">|;
|
|
877 |
print qq| <input type="button" class="submit" onclick="set_history_window($form->{id});" name="history" id="history" value="| . $locale->text('history') . qq|">|;
|
890 |
878 |
}
|
891 |
879 |
# /button for saving history
|
892 |
880 |
print "
|
... | ... | |
1745 |
1733 |
|
1746 |
1734 |
$lxdebug->leave_sub();
|
1747 |
1735 |
}
|
|
1736 |
|
|
1737 |
sub storno {
|
|
1738 |
$lxdebug->enter_sub();
|
|
1739 |
|
|
1740 |
if (IS->has_storno(\%myconfig, $form, 'ap')) {
|
|
1741 |
$form->{title} = $locale->text("Cancel Accounts Payables Transaction");
|
|
1742 |
$form->error($locale->text("Transaction has already been cancelled!"));
|
|
1743 |
}
|
|
1744 |
|
|
1745 |
# negate amount/taxes
|
|
1746 |
for my $i (1 .. $form->{rowcount}) {
|
|
1747 |
$form->{"amount_$i"} *= -1;
|
|
1748 |
$form->{"tax_$i"} *= -1;
|
|
1749 |
}
|
|
1750 |
|
|
1751 |
# format things
|
|
1752 |
for my $i (1 .. $form->{rowcount}) {
|
|
1753 |
for (qw(amount tax)) {
|
|
1754 |
$form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) if $form->{"${_}_$i"};
|
|
1755 |
}
|
|
1756 |
}
|
|
1757 |
|
|
1758 |
$form->{storno} = 1;
|
|
1759 |
$form->{storno_id} = $form->{id};
|
|
1760 |
$form->{id} = 0;
|
|
1761 |
|
|
1762 |
$form->{invnumber} = "Storno-" . $form->{invnumber};
|
|
1763 |
|
|
1764 |
post();
|
|
1765 |
|
|
1766 |
# saving the history
|
|
1767 |
if(!exists $form->{addition} && $form->{id} ne "") {
|
|
1768 |
$form->{snumbers} = "ordnumber_$form->{ordnumber}";
|
|
1769 |
$form->{addition} = "STORNO";
|
|
1770 |
$form->save_history($form->dbconnect(\%myconfig));
|
|
1771 |
}
|
|
1772 |
# /saving the history
|
|
1773 |
|
|
1774 |
$lxdebug->leave_sub();
|
|
1775 |
}
|
Storno fuer Kreditorenbuchungen