Revision 030c2086
Von Rolf Fluehmann vor mehr als 8 Jahren hinzugefügt
SL/DB/MetaSetup/Default.pm | ||
---|---|---|
91 | 91 |
revtrans => { type => 'boolean', default => 'false' }, |
92 | 92 |
rfqnumber => { type => 'text' }, |
93 | 93 |
rmanumber => { type => 'text' }, |
94 |
rndgain_accno_id => { type => 'integer' }, |
|
95 |
rndloss_accno_id => { type => 'integer' }, |
|
94 | 96 |
sales_delivery_order_show_delete => { type => 'boolean', default => 'true' }, |
95 | 97 |
sales_order_show_delete => { type => 'boolean', default => 'true' }, |
96 | 98 |
sales_purchase_order_ship_missing_column => { type => 'boolean', default => 'false' }, |
SL/Form.pm | ||
---|---|---|
2886 | 2886 |
d.closedto, d.revtrans, |
2887 | 2887 |
(SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency, |
2888 | 2888 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
2889 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
2889 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
2890 |
(SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno, |
|
2891 |
(SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno |
|
2890 | 2892 |
FROM defaults d|; |
2891 | 2893 |
$ref = selectfirst_hashref_query($self, $dbh, $query); |
2892 | 2894 |
map { $self->{$_} = $ref->{$_} } keys %$ref; |
... | ... | |
2899 | 2901 |
current_date AS transdate, d.closedto, d.revtrans, |
2900 | 2902 |
(SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency, |
2901 | 2903 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
2902 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
2904 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
2905 |
(SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno, |
|
2906 |
(SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno |
|
2903 | 2907 |
FROM defaults d|; |
2904 | 2908 |
$ref = selectfirst_hashref_query($self, $dbh, $query); |
2905 | 2909 |
map { $self->{$_} = $ref->{$_} } keys %$ref; |
SL/IS.pm | ||
---|---|---|
968 | 968 |
} |
969 | 969 |
} |
970 | 970 |
|
971 |
$form->{amount}{ $form->{id} }{ $form->{AR} } = $netamount + $tax; |
|
972 |
$form->{paid} = |
|
973 |
$form->round_amount($form->{paid} * $form->{exchangerate} + $diff, 2); |
|
971 |
# Invoice Summary includes Rounding |
|
972 |
my $grossamount = $netamount + $tax; |
|
973 |
my $rounding = $form->round_amount( |
|
974 |
$form->round_amount($grossamount, 2, 1) - $form->round_amount($grossamount, 2), |
|
975 |
2 |
|
976 |
); |
|
977 |
my $rnd_accno = $rounding == 0 ? 0 |
|
978 |
: $rounding > 0 ? $form->{rndgain_accno} |
|
979 |
: $form->{rndloss_accno} |
|
980 |
; |
|
981 |
$form->{amount}{ $form->{id} }{ $form->{AR} } = $form->round_amount($grossamount, 2, 1); |
|
982 |
$form->{paid} = $form->round_amount( |
|
983 |
$form->{paid} * $form->{exchangerate} + $diff, |
|
984 |
2 |
|
985 |
); |
|
974 | 986 |
|
975 | 987 |
# reverse AR |
976 | 988 |
$form->{amount}{ $form->{id} }{ $form->{AR} } *= -1; |
... | ... | |
1073 | 1085 |
do_query($form, $dbh, $query, @values); |
1074 | 1086 |
} |
1075 | 1087 |
} |
1088 |
if (!$payments_only && ($rnd_accno != 0)) { |
|
1089 |
$query = |
|
1090 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id, chart_link) |
|
1091 |
VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?, (SELECT link FROM chart WHERE accno = ?))|; |
|
1092 |
@values = (conv_i($trans_id), $rnd_accno, $rounding, conv_date($form->{invdate}), conv_i($project_id), $rnd_accno); |
|
1093 |
do_query($form, $dbh, $query, @values); |
|
1094 |
$rnd_accno = 0; |
|
1095 |
} |
|
1076 | 1096 |
} |
1077 | 1097 |
|
1078 | 1098 |
# deduct payment differences from diff |
... | ... | |
1237 | 1257 |
return; |
1238 | 1258 |
} |
1239 | 1259 |
|
1240 |
$amount = $netamount + $tax;
|
|
1260 |
$amount = $form->round_amount( $netamount + $tax, 2, 1);
|
|
1241 | 1261 |
|
1242 | 1262 |
# save AR record |
1243 | 1263 |
#erweiterung fuer lieferscheinnummer (donumber) 12.02.09 jb |
... | ... | |
1882 | 1902 |
(SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno, |
1883 | 1903 |
(SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno, |
1884 | 1904 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
1885 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
1905 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
1906 |
(SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno, |
|
1907 |
(SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno |
|
1886 | 1908 |
${query_transdate} |
1887 | 1909 |
FROM defaults d|; |
1888 | 1910 |
|
SL/OE.pm | ||
---|---|---|
690 | 690 |
my $tax = 0; |
691 | 691 |
map { $tax += $form->round_amount($taxaccounts{$_}, 2) } keys %taxaccounts; |
692 | 692 |
|
693 |
$amount = $form->round_amount($netamount + $tax, 2); |
|
693 |
$amount = $form->round_amount($netamount + $tax, 2, 1);
|
|
694 | 694 |
$netamount = $form->round_amount($netamount, 2); |
695 | 695 |
|
696 | 696 |
if ($form->{currency} eq $form->{defaultcurrency}) { |
... | ... | |
956 | 956 |
(SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno, |
957 | 957 |
(SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno, |
958 | 958 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
959 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
959 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
960 |
(SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno, |
|
961 |
(SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno |
|
960 | 962 |
$query_add |
961 | 963 |
FROM defaults d|; |
962 | 964 |
my $ref = selectfirst_hashref_query($form, $dbh, $query); |
SL/RP.pm | ||
---|---|---|
1873 | 1873 |
my ($self, $myconfig, $form) = @_; |
1874 | 1874 |
$form->{company} = $::instance_conf->get_company; |
1875 | 1875 |
$form->{address} = $::instance_conf->get_address; |
1876 |
#injection-filter |
|
1877 |
$form->{fromdate} =~ s/[^0-9\.]//g; |
|
1878 |
$form->{todate} =~ s/[^0-9\.]//g; |
|
1879 |
#input validation |
|
1880 |
$form->{fromdate} = "01.01.2000" if $form->{fromdate} !~ m/[0-9]*\.[0-9]*\.[0-9]*/; |
|
1881 |
$form->{todate} = $form->current_date(%{$myconfig}) if $form->{todate} !~ m/[0-9]*\.[0-9]*\.[0-9]*/; |
|
1876 |
$form->{fromdate} = DateTime->new(year => 2000, month => 1, day => 1)->to_kivitendo unless $form->{fromdate}; |
|
1877 |
$form->{todate} = $form->current_date(%{$myconfig}) unless $form->{todate}; |
|
1882 | 1878 |
|
1883 | 1879 |
my %categories = (I => "ERTRAG", E => "AUFWAND"); |
1884 | 1880 |
my $fromdate = conv_dateq($form->{fromdate}); |
... | ... | |
1924 | 1920 |
my $query = qq| |
1925 | 1921 |
SELECT id, accno, description, category |
1926 | 1922 |
FROM chart |
1927 |
WHERE category = '$category' $inclusion
|
|
1923 |
WHERE category = ? $inclusion
|
|
1928 | 1924 |
ORDER BY accno |
1929 | 1925 |
|; |
1930 |
my $accounts = _query($query); |
|
1926 |
my $accounts = _query($query, $category);
|
|
1931 | 1927 |
|
1932 | 1928 |
$main::lxdebug->leave_sub(); |
1933 | 1929 |
return $accounts; |
... | ... | |
1941 | 1937 |
my $query = qq| |
1942 | 1938 |
SELECT SUM(amount) |
1943 | 1939 |
FROM acc_trans |
1944 |
WHERE chart_id = '$chart_id'
|
|
1945 |
AND transdate >= $fromdate
|
|
1946 |
AND transdate <= $todate
|
|
1940 |
WHERE chart_id = ?
|
|
1941 |
AND transdate >= ?
|
|
1942 |
AND transdate <= ?
|
|
1947 | 1943 |
|; |
1948 |
$total += _query($query)->[0]->{sum}; |
|
1944 |
$total += _query($query, $chart_id, $fromdate, $todate)->[0]->{sum};
|
|
1949 | 1945 |
|
1950 | 1946 |
$main::lxdebug->leave_sub(); |
1951 | 1947 |
return $total; |
bin/mozilla/am.pl | ||
---|---|---|
590 | 590 |
$form->{title} = $locale->text('Delete Account'); |
591 | 591 |
|
592 | 592 |
foreach my $id ( |
593 |
qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id) |
|
593 |
qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id rndgain_accno_id rndloss_accno_id)
|
|
594 | 594 |
) { |
595 | 595 |
if ($form->{id} == $form->{$id}) { |
596 | 596 |
$form->error($locale->text('Cannot delete default account!')); |
bin/mozilla/is.pl | ||
---|---|---|
463 | 463 |
} |
464 | 464 |
} |
465 | 465 |
|
466 |
my $grossamount = $form->{invtotal}; |
|
467 |
$form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1 ); |
|
468 |
$form->{rounding} = $form->round_amount( |
|
469 |
$form->{invtotal} - $form->round_amount($grossamount, 2), |
|
470 |
2 |
|
471 |
); |
|
472 |
|
|
466 | 473 |
# follow ups |
467 | 474 |
if ($form->{id}) { |
468 | 475 |
$form->{follow_ups} = FU->follow_ups('trans_id' => $form->{id}) || []; |
bin/mozilla/oe.pl | ||
---|---|---|
539 | 539 |
</tr> |; |
540 | 540 |
} |
541 | 541 |
} |
542 |
|
|
543 |
# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this |
|
544 |
|
|
545 | 542 |
} else { |
546 | 543 |
foreach my $item (split / /, $form->{taxaccounts}) { |
547 | 544 |
if ($form->{"${item}_base"}) { |
... | ... | |
563 | 560 |
} |
564 | 561 |
} |
565 | 562 |
|
563 |
my $grossamount = $form->{invtotal}; |
|
564 |
$form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1); |
|
565 |
$form->{rounding} = $form->round_amount( |
|
566 |
$form->{invtotal} - $form->round_amount($grossamount, 2), |
|
567 |
2 |
|
568 |
); |
|
566 | 569 |
$form->{oldinvtotal} = $form->{invtotal}; |
567 | 570 |
|
568 | 571 |
$TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted(); |
locale/de/all | ||
---|---|---|
2320 | 2320 |
'Risk' => 'Risiko', |
2321 | 2321 |
'Risk levels' => 'Risikograde', |
2322 | 2322 |
'Risks' => 'Risikograde', |
2323 |
'Rounding' => 'Rundung', |
|
2324 |
'Rounding Gain' => 'Rundungserträge', |
|
2325 |
'Rounding Loss' => 'Rundungsaufwendungen', |
|
2323 | 2326 |
'Row' => 'Zeile', |
2324 | 2327 |
'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.', |
2325 | 2328 |
'Row number' => 'Zeilennummer', |
locale/en/all | ||
---|---|---|
1787 | 1787 |
'Revenues EU without UStId' => '', |
1788 | 1788 |
'Review of Aging list' => '', |
1789 | 1789 |
'Right' => '', |
1790 |
'Rounding' => '', |
|
1791 |
'Rounding Gain' => '', |
|
1792 |
'Rounding Loss' => '', |
|
1790 | 1793 |
'Row #1: amount has to be different from zero.' => '', |
1791 | 1794 |
'Row number' => '', |
1792 | 1795 |
'Row was created from current record' => '', |
sql/Pg-upgrade2/defaults_add_rnd_accno_ids.sql | ||
---|---|---|
1 |
-- @tag: defaults_add_rnd_accno_ids |
|
2 |
-- @description: adds new columns 'rndgain_accno_id' and 'rndloss_accno_id' in table defaults, used to book roundings |
|
3 |
-- @depends: release_3_1_0 |
|
4 |
ALTER TABLE defaults ADD COLUMN rndgain_accno_id Integer; |
|
5 |
ALTER TABLE defaults ADD COLUMN rndloss_accno_id Integer; |
|
6 |
|
templates/webpages/am/edit_accounts.html | ||
---|---|---|
27 | 27 |
<input type="hidden" name="expense_accno_id" value="[% HTML.escape(expense_accno_id) %]"> |
28 | 28 |
<input type="hidden" name="fxgain_accno_id" value="[% HTML.escape(fxgain_accno_id) %]"> |
29 | 29 |
<input type="hidden" name="fxloss_accno_id" value="[% HTML.escape(fxloss_accno_id) %]"> |
30 |
<input type="hidden" name="rndgain_accno_id" value="[% HTML.escape(rndgain_accno_id) %]"> |
|
31 |
<input type="hidden" name="rndloss_accno_id" value="[% HTML.escape(rndloss_accno_id) %]"> |
|
30 | 32 |
|
31 | 33 |
<fieldset> |
32 | 34 |
<legend> |
templates/webpages/client_config/_default_accounts.html | ||
---|---|---|
30 | 30 |
<td>[% L.chart_picker('defaults.fxloss_accno_id', SELF.defaults.fxloss_accno_id, category='E,A', choose=1, style=style) %]<td> |
31 | 31 |
</tr> |
32 | 32 |
|
33 |
<tr> |
|
34 |
<td align="right">[% LxERP.t8("Rounding Gain") %]</td> |
|
35 |
<td>[% L.chart_picker('defaults.rndgain_accno_id', SELF.defaults.rndgain_accno_id, category='I,A', choose=1, style=style) %]</td> |
|
36 |
</tr> |
|
37 |
|
|
38 |
<tr> |
|
39 |
<td align="right">[% LxERP.t8("Rounding Loss") %]</td> |
|
40 |
<td>[% L.chart_picker('defaults.rndloss_accno_id', SELF.defaults.rndloss_accno_id, category='E,A', choose=1, style=style) %]</td> |
|
41 |
</tr> |
|
42 |
|
|
33 | 43 |
<tr> |
34 | 44 |
<td align="right">[% LxERP.t8("Current assets account") %]</td> |
35 | 45 |
<td>[% L.chart_picker('defaults.ar_paid_accno_id', SELF.defaults.ar_paid_accno_id, type='AR_paid', choose=1, style=style) %]<td> |
templates/webpages/is/form_footer.html | ||
---|---|---|
107 | 107 |
</tr> |
108 | 108 |
[%- END %] |
109 | 109 |
|
110 |
[%- IF rounding %] |
|
111 |
<tr> |
|
112 |
<th align='right'>[% 'Rounding' | $T8 %]</th> |
|
113 |
<td align='right'>[% LxERP.format_amount(rounding, 2) %]</td> |
|
114 |
</tr> |
|
115 |
[%- END %] |
|
116 |
|
|
110 | 117 |
[%# tax %] |
111 | 118 |
[% FOREACH item = taxaccounts_array %] |
112 | 119 |
[% SET description_ref = item _ '_description' %] |
... | ... | |
124 | 131 |
</tr> |
125 | 132 |
[%- END %] |
126 | 133 |
[%- END %] |
127 |
|
|
128 | 134 |
<tr> |
129 | 135 |
<th align="right">[% 'Total' | $T8 %]</th> |
130 | 136 |
<td align="right">[% LxERP.format_amount(invtotal, 2) %]</td> |
templates/webpages/is/form_header.html | ||
---|---|---|
162 | 162 |
<td> |
163 | 163 |
<input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]"> |
164 | 164 |
<input type="hidden" name="fxloss_accno" value="[% fxloss_accno %]"> |
165 |
<input type="hidden" name="rndgain_accno" value="[% rndgain_accno %]"> |
|
166 |
<input type="hidden" name="rndloss_accno" value="[% rndloss_accno %]"> |
|
165 | 167 |
</td> |
166 | 168 |
</tr> |
167 | 169 |
[%- IF show_exchangerate %] |
templates/webpages/oe/form_footer.html | ||
---|---|---|
107 | 107 |
<th align='right'>[% 'Subtotal' | $T8 %]</th> |
108 | 108 |
<td align='right'>[% LxERP.format_amount(invsubtotal, 2) %]</td> |
109 | 109 |
</tr> |
110 |
[%- END %] |
|
111 |
[%- IF rounding %] |
|
112 |
<tr> |
|
113 |
<th align='right'>[% 'Rounding' | $T8 %]</th> |
|
114 |
<td align='right'>[% LxERP.format_amount(rounding, 2) %]</td> |
|
115 |
</tr> |
|
110 | 116 |
[%- END %] |
111 | 117 |
[% tax %] |
112 | 118 |
<tr> |
Auch abrufbar als: Unified diff
Belege runden, und Rundungsdifferenzen auf Extrakonten buchen.