__PACKAGE__->run_before('check_auth');
use Rose::Object::MakeMethods::Generic (
- 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates posting_options payment_options accounting_options inventory_options profit_options accounts) ],
+ 'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates posting_options payment_options accounting_options inventory_options profit_options accounts balance_startdate_method_options) ],
);
sub action_edit {
{ title => t8("income"), value => "income" }, ]
}
+sub init_balance_startdate_method_options {
+ [ { title => t8("After closed period"), value => "closed_to" },
+ { title => t8("Start of year"), value => "start_of_year" },
+ { title => t8("All transactions"), value => "all_transactions" },
+ { title => t8("Last opening balance or all transactions"), value => "last_ob_or_all_transactions" },
+ { title => t8("Last opening balance or start of year"), value => "last_ob_or_start_of_year" }, ]
+}
+
sub init_accounts {
my %accounts;
ar_show_mark_as_paid => { type => 'boolean', default => 'true' },
articlenumber => { type => 'text' },
assemblynumber => { type => 'text' },
+ balance_startdate_method => { type => 'text' },
bin_id => { type => 'integer' },
bin_id_ignore_onhand => { type => 'integer' },
businessnumber => { type => 'text' },
Returns the default profit determination method, balance or income
+=item C<get_balance_startdate_method>
+
+Returns the default method for determining the startdate for the balance
+report.
+
+Valid options:
+closed_to start_of_year all_transactions last_ob_or_all_transactions last_ob_or_start_of_year
=item C<get_is_changeable>
# - proper testing for heading charts
# - transmission from $form to TMPL realm is not as clear as i'd like
-sub get_openbalance_date {
- my ($closedto, $target) = map { $::locale->parse_date_to_object(\%::myconfig, $_) } @_;
+sub get_balance_starting_date {
- return unless $closedto;
+ # determine date from which the balance is calculated. The method is
+ # configured in the client configuration.
- $closedto->subtract(years => 1) while ($target - $closedto)->is_negative;
- $closedto->add(days => 1);
- return $::locale->format_date(\%::myconfig, $closedto);
-}
+ my $asofdate = shift;
+ return unless $asofdate;
+
+ $asofdate = $::locale->parse_date_to_object(\%::myconfig, $asofdate);
+
+ my $form = $main::form;
+ my $dbh = $::form->get_standard_dbh;
+
+ my $startdate_method = $::instance_conf->get_balance_startdate_method;
+
+ # We could use the following objects to determine the starting date for
+ # calculating the balance from asofdate (the reference date for the balance):
+ # * start_of_year - 1.1., no deviating fiscal year supported
+ # * closed_to - all transactions since the books were last closed
+ # * last_ob - all transactions since last opening balance transaction (usually 1.1.)
+ # * mindate - all transactions in database
+
+ my $start_of_year = $asofdate->clone();
+ $start_of_year->set_day(1);
+ $start_of_year->set_month(1);
+
+ # closedto assumes that we only close the books at the end of a fiscal year,
+ # never during the fiscal year. If this assumption is valid closedto should
+ # also work for deviating fiscal years. But as the trial balance (SuSa)
+ # doesn't yet deal with deviating fiscal years, and is useful to also close
+ # the books after a month has been exported via DATEV, so this method of
+ # determining the starting date isn't recommended and has been removed as
+ # default.
+ my ($closedto) = selectfirst_array_query($form, $dbh, 'SELECT closedto FROM defaults');
+ if ($closedto) {
+ $closedto = $::locale->parse_date_to_object(\%::myconfig, $closedto);
+ $closedto->subtract(years => 1) while ($asofdate - $closedto)->is_negative;
+ $closedto->add(days => 1);
+ };
+
+ my ($query, $startdate, $last_ob, $mindate);
+ $query = qq|select max(transdate) from acc_trans where ob_transaction is true and transdate <= ?|;
+ ($last_ob) = selectrow_query($::form, $dbh, $query, $::locale->format_date(\%::myconfig, $asofdate));
+ $last_ob = $::locale->parse_date_to_object(\%::myconfig, $last_ob) if $last_ob;
+
+ $query = qq|select min(transdate) from acc_trans|;
+ ($mindate) = selectrow_query($::form, $dbh, $query);
+ $mindate = $::locale->parse_date_to_object(\%::myconfig, $mindate);
+
+ # the default method is to use all transactions ($mindate)
+
+ if ( $startdate_method eq 'closed_to' and $closedto ) {
+ # if no closedto is configured use default
+ return $::locale->format_date(\%::myconfig, $closedto);
+
+ } elsif ( $startdate_method eq 'start_of_year' ) {
+
+ return $::locale->format_date(\%::myconfig, $start_of_year);
+
+ } elsif ( $startdate_method eq 'all_transactions' ) {
+
+ return $::locale->format_date(\%::myconfig, $mindate);
+
+ } elsif ( $startdate_method eq 'last_ob_or_all_transactions' and $last_ob ) {
+ # use default if there are no ob transactions
+
+ return $::locale->format_date(\%::myconfig, $last_ob);
+
+ } elsif ( $startdate_method eq 'last_ob_or_start_of_year' ) {
+
+ if ( $last_ob ) {
+ return $::locale->format_date(\%::myconfig, $last_ob);
+ } else {
+ return $::locale->format_date(\%::myconfig, $start_of_year);
+ };
+
+ } else {
+ # default action, also used for closedto and last_ob_or_all_transactions if
+ # there are no valid dates
+
+ return $::locale->format_date(\%::myconfig, $mindate);
+ };
+
+};
sub balance_sheet {
$main::lxdebug->enter_sub();
$form->{period} = $form->{this_period} = conv_dateq($form->{asofdate});
}
- # get end of financial year and convert to Date format
- my ($closedto) = selectfirst_array_query($form, $dbh, 'SELECT closedto FROM defaults');
-
- # get date of last opening balance
- my $startdate = get_openbalance_date($closedto, $form->{asofdate});
+ # get starting date for calculating balance
+ $form->{this_startdate} = get_balance_starting_date($form->{asofdate});
- get_accounts($dbh, $last_period, $startdate, $form->{asofdate}, $form, \@categories);
+ get_accounts($dbh, $last_period, $form->{this_startdate}, $form->{asofdate}, $form, \@categories);
# if there are any compare dates
if ($form->{compareasofdate}) {
$last_period = 1;
- $startdate = get_openbalance_date($closedto, $form->{compareasofdate});
+ $form->{last_startdate} = get_balance_starting_date($form->{compareasofdate});
- get_accounts($dbh, $last_period, $startdate, $form->{compareasofdate}, $form, \@categories);
+ get_accounts($dbh, $last_period, $form->{last_startdate} , $form->{compareasofdate}, $form, \@categories);
$form->{last_period} = conv_dateq($form->{compareasofdate});
}
maximalen Zeitraum in dem in die Zukunft gebucht werden darf (default 360 Tage) (s.a. #1987)
- Alle Feature-Konfigurationen sind jetzt in der Mandantenkonfiguration eingestellt (s.a. #2300)
+
- Dokumentenbelege optional in WebDAV-Ordner speichern (s.a. #2301)
+- Die Bestimmung des Startdatums für die Bilanz kann jetzt in der
+__Mandantenkonfiguration einstellt werden.
+
Wichtige Änderungen:
- Der Administrationsbereich ist unter einer neuen URL erreichbar:
- Bugfix #2430: installaton_check.pl: bitte -D pushen
- Bugfix #2432: Neuer Mandant - Kunde oder Lieferant speichern schlägt fehl bei Nummernkreis
- Bugfix #2433: HTML UStVA-Bericht funktioniert nicht wenn WebDAV Belege speichern aktiv ist
+- Bugfix #2444: Datum aus "Bücher abschließen zum" wird als Basis für Startdatum der Bilanz benutzt
2012-12-10 - Release 3.0.0
'Administration' => 'Administration',
'Administration area' => 'Administration',
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung',
+ 'After closed period' => 'Ab geschlossenem Zeitraum',
'Aktion' => 'Aktion',
'All' => 'Alle',
'All Accounts' => 'Alle Konten',
'All reports' => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, GuV, BWA, Bilanz, Projektbuchungen)',
'All the other clients will start with an empty set of WebDAV folders.' => 'Alle anderen Mandanten werden mit einem leeren Satz von WebDAV-Ordnern ausgestattet.',
'All the selected exports have already been closed, or all of their items have already been executed.' => 'Alle ausgewählten Exporte sind als abgeschlossen markiert, oder für alle Einträge wurden bereits Zahlungen verbucht.',
+ 'All transactions' => 'Alle Buchungen',
'All units have either no or exactly one base unit of which they are multiples.' => 'Einheiten haben entweder keine oder genau eine Basiseinheit, von der sie ein Vielfaches sind.',
'All users' => 'Alle BenutzerInnen',
'Allow access' => 'Zugriff erlauben',
'Balance' => 'Bilanz',
'Balance Sheet' => 'Bilanz',
'Balance sheet date' => 'Bilanzstichtag',
+ 'Balance startdate method' => 'Methode zur Ermittlung des Startdatums für Bilanz',
'Balancing' => 'Bilanzierung',
'Bank' => 'Bank',
'Bank Code' => 'BLZ',
'Last Transaction' => 'Letzte Buchung',
'Last Vendor Number' => 'Letzte Lieferantennummer',
'Last command output' => 'Ausgabe des letzten Befehls',
+ 'Last opening balance or all transactions' => 'Letzte Eröffnungsbuchung oder alle Buchungen',
+ 'Last opening balance or start of year' => 'Letzte Eröffnungsbuchung oder Jahresanfang',
'Last run at' => 'Letzte Ausführung um',
'Lastcost' => 'Einkaufspreis',
'Lastcost (with X being a number)' => 'Einkaufspreis (X ist eine fortlaufende Zahl)',
'Start Dunning Process' => 'Mahnprozess starten',
'Start analysis' => 'Analyse beginnen',
'Start date' => 'Startdatum',
+ 'Start of year' => 'Jahresanfang',
'Start task server' => 'Task-Server starten',
'Start the correction assistant' => 'Korrekturassistenten starten',
'Startdate_coa' => 'Gültig ab',
'This means that the user has created an AP transaction and chosen a taxkey for sales taxes, or that he has created an AR transaction and chosen a taxkey for input taxes.' => 'Das bedeutet, dass ein Benutzer eine Kreditorenbuchung angelegt und in ihr einen Umsatzsteuer-Steuerschlüssel verwendet oder eine Debitorenbuchung mit Vorsteuer-Steuerschlüssel angelegt hat.',
'This module can help you identify and correct such entries by analyzing the general ledger and presenting you likely solutions but also allowing you to fix problems yourself.' => 'Dieses Modul kann Ihnen helfen, problematische Einträge im Hauptbuch zu identifizieren und teilweise zu beheben. Dabei werden je nach Problem mögliche Lösungen aufgezeigt, wobei Sie die entscheiden können, welche Probleme automatisch gelöst werden sollen.',
'This option controls the inventory system.' => 'Dieser Parameter legt die Warenbuchungsmethode fest.',
+ 'This option controls the method used for determining the startdate for the balance report.' => 'Diese Option bestimmt, wie das Startdatum für den Bilanzbericht ermittelt wird',
'This option controls the method used for profit determination.' => 'Dieser Parameter legt die Berechnungsmethode für die Gewinnermittlung fest.',
'This option controls the posting and calculation behavior for the accounting method.' => 'Dieser Parameter steuert die Buchungs- und Berechnungsmethoden für die Versteuerungsart.',
'This partnumber is not unique. You should change it.' => 'Diese Artikelnummer ist nicht eindeutig. Bitte wählen Sie eine andere.',
<td>[% L.select_tag('defaults.profit_determination', SELF.profit_options, value_key = 'value', title_key = 'title', default = SELF.defaults.profit_determination) %]</td>
<td>[% LxERP.t8('This option controls the method used for profit determination.') %]</td>
</tr>
+ <tr>
+ <td align="right">[% LxERP.t8('Balance startdate method') %]</td>
+ <td>[% L.select_tag('defaults.balance_startdate_method', SELF.balance_startdate_method_options, value_key = 'value', title_key = 'title', default = SELF.defaults.balance_startdate_method) %]</td>
+ <td>[% LxERP.t8('This option controls the method used for determining the startdate for the balance report.') %]</td>
+ </tr>
</table>
</div>
<table border="0">
<tr>
<th align="left" width="400" colspan="2">[% 'ASSETS' | $T8 %]<br><hr align="left" width="250" size="5" noshade></th>
- <th><b>[% this_period %]<b></th>
- <th><b>[% last_period %]<b></th>
+ <th><b>[% this_startdate %] - [% this_period %]<b></th>
+ <th><b>[% IF last_period %][% last_startdate %] - [% last_period %][% END %]<b></th>
</tr>
[% FOREACH row = A %]