Revision dc7f3c9a
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/GL.pm | ||
---|---|---|
70 | 70 |
|
71 | 71 |
my $i; |
72 | 72 |
|
73 |
# check if debit and credit balances |
|
74 |
|
|
75 |
if ($form->{storno}) { |
|
76 |
$form->{reference} = "Storno-" . $form->{reference}; |
|
77 |
$form->{description} = "Storno-" . $form->{description}; |
|
78 |
} |
|
79 |
|
|
80 | 73 |
# connect to database, turn off AutoCommit |
81 | 74 |
my $dbh = $form->dbconnect_noauto($myconfig); |
82 | 75 |
|
... | ... | |
119 | 112 |
$query = |
120 | 113 |
qq|UPDATE gl SET |
121 | 114 |
reference = ?, description = ?, notes = ?, |
122 |
transdate = ?, department_id = ?, taxincluded = ? |
|
115 |
transdate = ?, department_id = ?, taxincluded = ?, |
|
116 |
storno = ?, storno_id = ? |
|
123 | 117 |
WHERE id = ?|; |
124 | 118 |
|
125 | 119 |
@values = ($form->{reference}, $form->{description}, $form->{notes}, |
126 | 120 |
conv_date($form->{transdate}), $department_id, $form->{taxincluded}, |
121 |
$form->{storno} ? 't' : 'f', conv_i($form->{storno_id}), |
|
127 | 122 |
conv_i($form->{id})); |
128 | 123 |
do_query($form, $dbh, $query, @values); |
129 | 124 |
|
... | ... | |
180 | 175 |
} |
181 | 176 |
} |
182 | 177 |
|
178 |
if ($form->{storno} && $form->{storno_id}) { |
|
179 |
do_query($form, $dbh, qq|UPDATE gl SET storno = 't' WHERE id = ?|, conv_i($form->{storno_id})); |
|
180 |
} |
|
181 |
|
|
183 | 182 |
# commit and redirect |
184 | 183 |
my $rc = $dbh->commit; |
185 | 184 |
$dbh->disconnect; |
... | ... | |
558 | 557 |
|
559 | 558 |
if ($form->{id}) { |
560 | 559 |
$query = |
561 |
qq|SELECT g.reference, g.description, g.notes, g.transdate, |
|
560 |
qq|SELECT g.reference, g.description, g.notes, g.transdate, g.storno, g.storno_id,
|
|
562 | 561 |
d.description AS department, e.name AS employee, g.taxincluded, g.gldate |
563 | 562 |
FROM gl g |
564 | 563 |
LEFT JOIN department d ON (d.id = g.department_id) |
bin/mozilla/gl.pl | ||
---|---|---|
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 | 34 |
use SL::GL; |
35 |
use SL::IS; |
|
35 | 36 |
use SL::PE; |
36 | 37 |
|
37 | 38 |
require "bin/mozilla/arap.pl"; |
... | ... | |
109 | 110 |
|
110 | 111 |
} |
111 | 112 |
|
112 |
sub edit {
|
|
113 |
sub prepare_transaction {
|
|
113 | 114 |
$lxdebug->enter_sub(); |
114 | 115 |
|
115 | 116 |
GL->transaction(\%myconfig, \%$form); |
... | ... | |
178 | 179 |
($form->datetonum($form->{transdate}, \%myconfig) <= |
179 | 180 |
$form->datetonum($form->{closedto}, \%myconfig)); |
180 | 181 |
|
182 |
$lxdebug->leave_sub(); |
|
183 |
} |
|
184 |
|
|
185 |
sub edit { |
|
186 |
$lxdebug->enter_sub(); |
|
187 |
|
|
188 |
prepare_transaction(); |
|
189 |
|
|
181 | 190 |
$form->{title} = "Edit"; |
182 | 191 |
|
183 |
&form_header; |
|
184 |
&display_rows; |
|
185 |
&form_footer; |
|
186 |
$lxdebug->leave_sub(); |
|
192 |
form_header(); |
|
193 |
display_rows(); |
|
194 |
form_footer(); |
|
187 | 195 |
|
196 |
$lxdebug->leave_sub(); |
|
188 | 197 |
} |
189 | 198 |
|
199 |
|
|
190 | 200 |
sub search { |
191 | 201 |
$lxdebug->enter_sub(); |
192 | 202 |
|
... | ... | |
1317 | 1327 |
<body onLoad="fokus()"> |
1318 | 1328 |
|
1319 | 1329 |
<form method=post name="gl" action=$form->{script}> |
1330 |
|; |
|
1320 | 1331 |
|
1321 |
<input name=id type=hidden value=$form->{id}>
|
|
1332 |
$form->hide_form(qw(id closedto locked storno storno_id));
|
|
1322 | 1333 |
|
1323 |
<input type=hidden name=closedto value=$form->{closedto}> |
|
1324 |
<input type=hidden name=locked value=$form->{locked}> |
|
1334 |
print qq| |
|
1325 | 1335 |
<input type=hidden name=title value="$title"> |
1326 | 1336 |
|
1327 | 1337 |
|
... | ... | |
1466 | 1476 |
|
1467 | 1477 |
if ($form->{id}) { |
1468 | 1478 |
|
1469 |
print qq|<input class=submit type=submit name=action value="| |
|
1470 |
. $locale->text('Storno') . qq|">|; |
|
1479 |
if (!$form->{storno}) { |
|
1480 |
print qq|<input class=submit type=submit name=action value="| |
|
1481 |
. $locale->text('Storno') . qq|">|; |
|
1482 |
} |
|
1471 | 1483 |
|
1472 | 1484 |
# L?schen und ?ndern von Buchungen nicht mehr m?glich (GoB) nur am selben Tag m?glich |
1473 | 1485 |
|
... | ... | |
1575 | 1587 |
|
1576 | 1588 |
my @flds = |
1577 | 1589 |
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart); |
1578 |
if ($form->{storno}) { |
|
1579 |
for my $i (1 .. $form->{rowcount}) { |
|
1580 |
unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) { |
|
1581 |
if ($form->{"debit_$i"} ne "") { |
|
1582 |
$form->{"credit_$i"} = $form->{"debit_$i"}; |
|
1583 |
$form->{"debit_$i"} = ""; |
|
1584 |
} elsif ($form->{"credit_$i"} ne "") { |
|
1585 |
$form->{"debit_$i"} = $form->{"credit_$i"}; |
|
1586 |
$form->{"credit_$i"} = ""; |
|
1587 |
} |
|
1588 |
} |
|
1589 |
} |
|
1590 |
} |
|
1591 | 1590 |
|
1592 | 1591 |
for my $i (1 .. $form->{rowcount}) { |
1593 | 1592 |
|
... | ... | |
1758 | 1757 |
sub storno { |
1759 | 1758 |
$lxdebug->enter_sub(); |
1760 | 1759 |
|
1761 |
$form->{id} = 0; |
|
1762 |
$form->{storno} = 1; |
|
1760 |
if (IS->has_storno(\%myconfig, $form, 'gl')) { |
|
1761 |
$form->{title} = $locale->text("Cancel General Ledger Transaction"); |
|
1762 |
$form->error($locale->text("Transaction has already been cancelled!")); |
|
1763 |
} |
|
1764 |
|
|
1765 |
my %keep_keys = map { $_, 1 } qw(login password id stylesheet); |
|
1766 |
map { delete $form->{$_} unless $keep_keys{$_} } keys %{ $form }; |
|
1767 |
|
|
1768 |
prepare_transaction(); |
|
1769 |
|
|
1770 |
for my $i (1 .. $form->{rowcount}) { |
|
1771 |
for (qw(debit credit tax)) { |
|
1772 |
$form->{"${_}_$i"} = |
|
1773 |
($form->{"${_}_$i"}) |
|
1774 |
? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) |
|
1775 |
: ""; |
|
1776 |
} |
|
1777 |
} |
|
1778 |
|
|
1779 |
$form->{storno} = 1; |
|
1780 |
$form->{storno_id} = $form->{id}; |
|
1781 |
$form->{id} = 0; |
|
1782 |
|
|
1783 |
$form->{reference} = "Storno-" . $form->{reference}; |
|
1784 |
$form->{description} = "Storno-" . $form->{description}; |
|
1785 |
|
|
1786 |
for my $i (1 .. $form->{rowcount}) { |
|
1787 |
next if (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")); |
|
1788 |
|
|
1789 |
if ($form->{"debit_$i"} ne "") { |
|
1790 |
$form->{"credit_$i"} = $form->{"debit_$i"}; |
|
1791 |
$form->{"debit_$i"} = ""; |
|
1792 |
|
|
1793 |
} else { |
|
1794 |
$form->{"debit_$i"} = $form->{"credit_$i"}; |
|
1795 |
$form->{"credit_$i"} = ""; |
|
1796 |
} |
|
1797 |
} |
|
1798 |
|
|
1799 |
post(); |
|
1800 |
|
|
1763 | 1801 |
# saving the history |
1764 | 1802 |
if(!exists $form->{addition} && $form->{id} ne "") { |
1765 | 1803 |
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber}; |
... | ... | |
1767 | 1805 |
$form->save_history($form->dbconnect(\%myconfig)); |
1768 | 1806 |
} |
1769 | 1807 |
# /saving the history |
1770 |
&post; |
|
1808 |
|
|
1771 | 1809 |
$lxdebug->leave_sub(); |
1772 | 1810 |
|
1773 | 1811 |
} |
locale/de/all | ||
---|---|---|
206 | 206 |
'C' => 'G', |
207 | 207 |
'CANCELED' => 'Storniert', |
208 | 208 |
'Calculate' => 'Berechnen', |
209 |
'Cancel General Ledger Transaction' => 'Buchung stornieren', |
|
209 | 210 |
'Cannot create Lock!' => 'System kann nicht gesperrt werden!', |
210 | 211 |
'Cannot delete account!' => 'Konto kann nicht gel?scht werden!', |
211 | 212 |
'Cannot delete customer!' => 'Kunde kann nicht gel?scht werden!', |
... | ... | |
1083 | 1084 |
'Transaction Date missing!' => 'Buchungsdatum fehlt!', |
1084 | 1085 |
'Transaction deleted!' => 'Buchung gel?scht!', |
1085 | 1086 |
'Transaction description' => 'Vorgangsbezeichnung', |
1087 |
'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.', |
|
1086 | 1088 |
'Transaction posted!' => 'Buchung verbucht!', |
1087 | 1089 |
'Transaction reversal enforced for all dates' => 'Fehleintragungen m?ssen f?r jeden Zeitraum mit einer Kontraeintragung ausgebessert werden', |
1088 | 1090 |
'Transaction reversal enforced up to' => 'Fehleintragungen k?nnen bis zu dem angegebenen Zeitraum nur mit einer Kontraeintragung ausgebessert werden!', |
locale/de/gl | ||
---|---|---|
22 | 22 |
'Buchungsjournal' => 'Buchungsjournal', |
23 | 23 |
'Buchungsnummer' => 'Buchungsnummer', |
24 | 24 |
'CANCELED' => 'Storniert', |
25 |
'Cancel General Ledger Transaction' => 'Buchung stornieren', |
|
25 | 26 |
'Cannot delete transaction!' => 'Buchung kann nicht gel?scht werden!', |
26 | 27 |
'Cannot have a value in both Debit and Credit!' => 'Es kann nicht gleichzeitig Soll und Haben gebucht werden!', |
27 | 28 |
'Cannot post a transaction without a value!' => 'Eine Buchung ohne Betrag kann nicht vorgenommen werden!', |
... | ... | |
149 | 150 |
'To (time)' => 'Bis', |
150 | 151 |
'Transaction Date missing!' => 'Buchungsdatum fehlt!', |
151 | 152 |
'Transaction deleted!' => 'Buchung gel?scht!', |
153 |
'Transaction has already been cancelled!' => 'Diese Buchung wurde bereits storniert.', |
|
152 | 154 |
'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.', |
153 | 155 |
'Unbalanced Ledger' => 'Bilanzfehler', |
154 | 156 |
'Unit' => 'Einheit', |
sql/Pg-upgrade2/gl_storno.sql | ||
---|---|---|
1 |
-- @tag: gl_storno |
|
2 |
-- @description: Spalten für Dialogbuchen zum Speichern, ob diese Buchung storniert wurde bzw. für welche andere Buchung diese eine Stornobuchung ist |
|
3 |
-- @depends: release_2_4_2 |
|
4 |
ALTER TABLE gl ADD COLUMN storno boolean; |
|
5 |
ALTER TABLE gl ALTER COLUMN storno SET DEFAULT 'f'; |
|
6 |
|
|
7 |
ALTER TABLE gl ADD COLUMN storno_id integer; |
|
8 |
ALTER TABLE gl ADD FOREIGN KEY (storno_id) REFERENCES gl (id); |
|
9 |
|
|
10 |
UPDATE gl SET storno = 'f'; |
|
11 |
|
|
12 |
UPDATE gl SET storno = 't' |
|
13 |
WHERE (reference LIKE 'Storno-%') |
|
14 |
AND (description LIKE 'Storno-%') |
|
15 |
AND EXISTS |
|
16 |
(SELECT gl2.id |
|
17 |
FROM gl gl2 |
|
18 |
WHERE ('Storno-' || gl2.reference = gl.reference) |
|
19 |
AND ('Storno-' || gl2.description = gl.description) |
|
20 |
AND (gl2.id < gl.id)); |
|
21 |
|
|
22 |
UPDATE gl SET storno = 't' |
|
23 |
WHERE (reference NOT LIKE 'Storno-%') |
|
24 |
AND (description NOT LIKE 'Storno-%') |
|
25 |
AND EXISTS |
|
26 |
(SELECT gl2.id |
|
27 |
FROM gl gl2 |
|
28 |
WHERE ('Storno-' || gl.reference = gl2.reference) |
|
29 |
AND ('Storno-' || gl.description = gl2.description) |
|
30 |
AND (gl2.id > gl.id)); |
|
31 |
|
|
32 |
UPDATE gl SET storno_id = |
|
33 |
(SELECT id |
|
34 |
FROM gl gl2 |
|
35 |
WHERE ('Storno-' || gl2.reference = gl.reference) |
|
36 |
AND ('Storno-' || gl2.description = gl.description) |
|
37 |
AND (gl2.id < gl.id) |
|
38 |
ORDER BY itime |
|
39 |
LIMIT 1) |
|
40 |
WHERE storno |
|
41 |
AND (reference LIKE 'Storno-%') |
|
42 |
AND (description LIKE 'Storno-%'); |
Auch abrufbar als: Unified diff
Stornieren beim Dialogbuchen:
1. In der Datenbank wird tatsächlich gespeichert, ob eine Buchung storniert wurde bzw. eine Stornobuchung ist.
2. Der "Storno"-Button wird nur angezeigt, wenn die Buchung noch nicht storniert wurde.
3. Es wird verhindert, dass eine bereits stornierte Buchung erneut storniert wird (Fix für Bug 646).
4. Vor dem Stornieren wird die ursprüngliche Buchung erneut aus der Datenbank geladen, damit die Stornierung nicht vom Benutzer verändert werden kann.