Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 422f2f17

Von Rolf Fluehmann vor fast 9 Jahren hinzugefügt

  • ID 422f2f17365ea7879c14b902c5db1e4cd7023e48
  • Vorgänger e3f82371
  • Nachfolger 3e67a3f4

Belege runden, und Rundungsdifferenzen auf Extrakonten buchen.

Unterschiede anzeigen:

SL/DB/MetaSetup/Default.pm
88 88
  revtrans                                  => { type => 'boolean', default => 'false' },
89 89
  rfqnumber                                 => { type => 'text' },
90 90
  rmanumber                                 => { type => 'text' },
91
  rndgain_accno_id                          => { type => 'integer'},
92
  rndloss_accno_id                          => { type => 'integer'},
91 93
  sales_delivery_order_show_delete          => { type => 'boolean', default => 'true' },
92 94
  sales_order_show_delete                   => { type => 'boolean', default => 'true' },
93 95
  sales_purchase_order_ship_missing_column  => { type => 'boolean', default => 'false' },
SL/Form.pm
2859 2859
           d.closedto, d.revtrans,
2860 2860
           (SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
2861 2861
           (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
2862
           (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
2862
           (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
2863
           (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno,
2864
           (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno
2863 2865
         FROM defaults d|;
2864 2866
    $ref = selectfirst_hashref_query($self, $dbh, $query);
2865 2867
    map { $self->{$_} = $ref->{$_} } keys %$ref;
......
2872 2874
            current_date AS transdate, d.closedto, d.revtrans,
2873 2875
            (SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
2874 2876
            (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
2875
            (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
2877
            (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
2878
            (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno,
2879
            (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno
2876 2880
          FROM defaults d|;
2877 2881
    $ref = selectfirst_hashref_query($self, $dbh, $query);
2878 2882
    map { $self->{$_} = $ref->{$_} } keys %$ref;
SL/IS.pm
967 967
    }
968 968
  }
969 969

  
970
  $form->{amount}{ $form->{id} }{ $form->{AR} } = $netamount + $tax;
970
  # Invoice Summary includes Rounding
971
  my $rounding = $form->round_amount(
972
    $form->round_amount($netamount + $tax, 2, 1) - $form->round_amount($netamount + $tax, 2), 2
973
  );
974
  my $rnd_accno = $rounding == 0 ? 0
975
                : $rounding > 0  ? $form->{rndgain_accno}
976
                :                  $form->{rndloss_accno};
977
  $form->{amount}{ $form->{id} }{ $form->{AR} } = $form->round_amount($netamount + $tax, 2, 1);
971 978
  $form->{paid} =
972 979
    $form->round_amount($form->{paid} * $form->{exchangerate} + $diff, 2);
973 980

  
......
1072 1079
        do_query($form, $dbh, $query, @values);
1073 1080
      }
1074 1081
    }
1082
    if (!$payments_only && ($rnd_accno != 0)) {
1083
      $query =
1084
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, tax_id, taxkey, project_id, chart_link)
1085
             VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, (SELECT id FROM tax WHERE taxkey=0), 0, ?, (SELECT link FROM chart WHERE accno = ?))|;
1086
      @values = (conv_i($trans_id), $rnd_accno, $rounding, conv_date($form->{invdate}), conv_i($project_id), $rnd_accno);
1087
      do_query($form, $dbh, $query, @values);
1088
      $rnd_accno = 0;
1089
    }
1075 1090
  }
1076 1091

  
1077 1092
  # deduct payment differences from diff
......
1234 1249
    return;
1235 1250
  }
1236 1251

  
1237
  $amount = $netamount + $tax;
1252
  $amount = $form->round_amount( $netamount + $tax, 2, 1);
1238 1253

  
1239 1254
  # save AR record
1240 1255
  #erweiterung fuer lieferscheinnummer (donumber) 12.02.09 jb
......
1872 1887
         (SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id)    AS income_accno,
1873 1888
         (SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id)   AS expense_accno,
1874 1889
         (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id)    AS fxgain_accno,
1875
         (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno
1890
         (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id)    AS fxloss_accno,
1891
         (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id)   AS rndgain_accno,
1892
         (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id)   AS rndloss_accno
1876 1893
         ${query_transdate}
1877 1894
       FROM defaults d|;
1878 1895

  
SL/OE.pm
644 644
  my $tax = 0;
645 645
  map { $tax += $form->round_amount($taxaccounts{$_}, 2) } keys %taxaccounts;
646 646

  
647
  $amount = $form->round_amount($netamount + $tax, 2);
647
  $amount = $form->round_amount($netamount + $tax, 2, 1);
648 648
  $netamount = $form->round_amount($netamount, 2);
649 649

  
650 650
  if ($form->{currency} eq $form->{defaultcurrency}) {
......
905 905
                     (SELECT c.accno FROM chart c WHERE d.income_accno_id    = c.id) AS income_accno,
906 906
                     (SELECT c.accno FROM chart c WHERE d.expense_accno_id   = c.id) AS expense_accno,
907 907
                     (SELECT c.accno FROM chart c WHERE d.fxgain_accno_id    = c.id) AS fxgain_accno,
908
                     (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id    = c.id) AS fxloss_accno
908
                     (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id    = c.id) AS fxloss_accno,
909
                     (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id   = c.id) AS rndgain_accno,
910
                     (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id   = c.id) AS rndloss_accno
909 911
              $query_add
910 912
              FROM defaults d|;
911 913
  my $ref = selectfirst_hashref_query($form, $dbh, $query);
bin/mozilla/am.pl
575 575
  $form->{title} = $locale->text('Delete Account');
576 576

  
577 577
  foreach my $id (
578
    qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
578
    qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id rndgain_accno_id rndloss_accno_id)
579 579
    ) {
580 580
    if ($form->{id} == $form->{$id}) {
581 581
      $form->error($locale->text('Cannot delete default account!'));
bin/mozilla/is.pl
460 460
    }
461 461
  }
462 462

  
463
  $form->{rounding} = $form->round_amount(
464
    $form->round_amount($form->{invtotal}, 2, 1) - $form->round_amount($form->{invtotal}, 2), 2
465
  );
466
  $form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1 );
467

  
463 468
  # follow ups
464 469
  if ($form->{id}) {
465 470
    $form->{follow_ups}            = FU->follow_ups('trans_id' => $form->{id}) || [];
bin/mozilla/oe.pl
533 533
              </tr> |;
534 534
      }
535 535
    }
536

  
537
#    $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this
538

  
539 536
  } else {
540 537
    foreach my $item (split / /, $form->{taxaccounts}) {
541 538
      if ($form->{"${item}_base"}) {
......
557 554
    }
558 555
  }
559 556

  
557
  $form->{rounding} = $form->round_amount(
558
    $form->round_amount($form->{invtotal}, 2, 1) - $form->round_amount($form->{invtotal}, 2)
559
  );
560
  $form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1);
560 561
  $form->{oldinvtotal} = $form->{invtotal};
561 562

  
562 563
  $TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
locale/de/all
2250 2250
  'Risk'                        => 'Risiko',
2251 2251
  'Risk levels'                 => 'Risikograde',
2252 2252
  'Risks'                       => 'Risikograde',
2253
  'Rounding'                    => 'Rundung',
2254
  'Rounding Gain'               => 'Rundungserträge',
2255
  'Rounding Loss'               => 'Rundungsaufwendungen',
2253 2256
  'Row'                         => 'Zeile',
2254 2257
  'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.',
2255 2258
  'Row number'                  => 'Zeilennummer',
locale/en/all
1782 1782
  'Revenues EU without UStId'   => '',
1783 1783
  'Review of Aging list'        => '',
1784 1784
  'Right'                       => '',
1785
  'Rounding'                    => '',
1786
  'Rounding Gain'               => '',
1787
  'Rounding Loss'               => '',
1785 1788
  'Row #1: amount has to be different from zero.' => '',
1786 1789
  'Row number'                  => '',
1787 1790
  '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