new report Erfolgsrechnung
authorRolf Fluehmann <rolf.fluehmann@revamp-it.ch>
Mon, 7 Oct 2013 12:51:09 +0000 (14:51 +0200)
committerRolf Fluehmann <rolf.fluehmann@revamp-it.ch>
Fri, 16 Oct 2015 11:11:49 +0000 (13:11 +0200)
Conflicts:
bin/mozilla/rp.pl

SL/Layout/Base.pm
SL/RP.pm
bin/mozilla/am.pl
bin/mozilla/rp.pl
menus/erp_ch.ini [new file with mode: 0644]
templates/webpages/rp/erfolgsrechnung.html [new file with mode: 0644]
templates/webpages/rp/report.html

index e39502f..f3c40bf 100644 (file)
@@ -19,6 +19,7 @@ use Rose::Object::MakeMethods::Generic (
 
 use SL::Menu;
 use SL::Presenter;
+use SL::DBUtils;
 
 my %menu_cache;
 
@@ -29,7 +30,14 @@ sub new {
 }
 
 sub init_menu {
-  SL::Menu->new('user');
+  my @menu_files;
+  if(scalar(grep(/^Switzerland/, (selectrow_query($::form, $::form->get_standard_dbh, 'SELECT coa FROM defaults'))[0]))) {
+    @menu_files = qw(menus/erp_ch.ini);
+  } else {
+    @menu_files = qw(menus/erp.ini);
+  }
+  unshift @menu_files, 'menus/crm.ini' if $::instance_conf->crm_installed;
+  Menu->new(@menu_files);
 }
 
 sub init_auto_reload_resources_param {
index e8e07e0..b5f35e5 100644 (file)
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -1872,33 +1872,89 @@ sub income_statement {
   $main::lxdebug->leave_sub();
 }
 
-sub income_statement_ch {
-
+sub erfolgsrechnung {
   $main::lxdebug->enter_sub();
 
   my ($self, $myconfig, $form) = @_;
+  ($form->{company}, $form->{adress}) = get_defaults_ch();
+
+  # wrong user inputs should be handled during users input
+  # e.g.  spaces, tabs, wrong format or wrong dates
+  $form->{fromdate} = "01.01.2000" if ! $form->{fromdate};
+  $form->{todate} = $form->current_date(%{$myconfig}) if ! $form->{todate};
+
+  my %categories = (I => "ERTRAG", E => "AUFWAND");
+  my $fromdate = conv_dateq($form->{fromdate});
+  my $todate = conv_dateq($form->{todate});
+
+  $form->{total} = 0;
+  foreach my $category (keys %categories) {
+    my %category = (
+      name => $categories{$category},
+      total => 0,
+      accounts => get_accounts_ch($category),
+    );
+    foreach my $account (@{$category{accounts}}) {
+      $account->{total} = 0;
+      $account->{total} += ($account->{category} eq $category ? 1 : -1) * $_ foreach (@{get_amounts_ch($account->{id}, $fromdate, $todate)});
+      $category{total} = $account->{total};
+    }
+    $form->{total} += $category{total};
+    push(@{$form->{categories}}, \%category);
+  }
 
-  my $last_period  = 0;
-
+  $main::lxdebug->leave_sub();
+  return {};
+}
 
-  # connect to database
-  my $dbh = $form->dbconnect($myconfig);
+sub get_defaults_ch {
+  $main::lxdebug->enter_sub();
 
-  get_accounts_ch($dbh, $last_period, $form->{fromdate}, $form->{todate}, $form);
+  my $query = q|SELECT company, address FROM defaults|;
+  my $row = @{_query($query)}[0];
+  my ($company, $adress) = ($row->{company}, $row->{address});
 
-   $main::lxdebug->leave_sub();
+  $main::lxdebug->leave_sub();
+  return ($company, $adress);
 }
 
+sub get_accounts_ch {
+  $main::lxdebug->enter_sub();
+
+  my ($category) = @_;
+  my ($query, $inclusion);
+  if ($category eq 'I') {$inclusion = "AND pos_eur = NULL OR pos_eur > '0' AND pos_eur <= '5'";}
+  elsif ($category eq 'E') {$inclusion = "AND pos_eur = NUll OR pos_eur >= '6' AND pos_eur < '100'";}
+  else {$inclusion = "";}
+  $query = qq|
+    SELECT id, accno, description, category
+    FROM chart
+    WHERE category = '$category' $inclusion
+    ORDER BY accno
+  |;
+  my $accounts = _query($query);
+
+  $main::lxdebug->leave_sub();
+  return $accounts;
+}
 
- sub get_accounts_ch {
+sub get_amounts_ch {
   $main::lxdebug->enter_sub();
 
-  my $query =
-    qq|SELECT c.accno, c.description
-       FROM chart c
-       ORDER BY c.accno|;
+  my ($chart_id, $fromdate, $todate) = @_;
+  my $query = qq|
+    SELECT amount
+    FROM acc_trans
+    WHERE chart_id = '$chart_id'
+      AND transdate >= $fromdate
+      AND transdate <= $todate
+  |;
+  my $amounts = _query($query);
 
-   $main::lxdebug->leave_sub();
+  $main::lxdebug->leave_sub();
+  return $amounts;
 }
 
+sub _query {return selectall_hashref_query($::form, $::form->get_standard_dbh, $_[0]);}
+
 1;
index ad17f31..5cde7ae 100644 (file)
@@ -214,38 +214,66 @@ sub account_header {
   }
 
   my $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
-  my %eur = (
-          1  => "Umsatzerlöse",
-          2  => "sonstige Erlöse",
-          3  => "Privatanteile",
-          4  => "Zinserträge",
-          5  => "Ausserordentliche Erträge",
-          6  => "Vereinnahmte Umsatzst.",
-          7  => "Umsatzsteuererstattungen",
-          8  => "Wareneingänge",
-          9  => "Löhne und Gehälter",
-          10 => "Gesetzl. sozialer Aufw.",
-          11 => "Mieten",
-          12 => "Gas, Strom, Wasser",
-          13 => "Instandhaltung",
-          14 => "Steuern, Versich., Beiträge",
-          15 => "Kfz-Steuern",
-          16 => "Kfz-Versicherungen",
-          17 => "Sonst. Fahrzeugkosten",
-          18 => "Werbe- und Reisekosten",
-          19 => "Instandhaltung u. Werkzeuge",
-          20 => "Fachzeitschriften, Bücher",
-          21 => "Miete für Einrichtungen",
-          22 => "Rechts- und Beratungskosten",
-          23 => "Bürobedarf, Porto, Telefon",
-          24 => "Sonstige Aufwendungen",
-          25 => "Abschreibungen auf Anlagever.",
-          26 => "Abschreibungen auf GWG",
-          27 => "Vorsteuer",
-          28 => "Umsatzsteuerzahlungen",
-          29 => "Zinsaufwand",
-          30 => "Ausserordentlicher Aufwand",
-          31 => "Betriebliche Steuern");
+  my %eur;
+  if(scalar(grep(/^Switzerland/, (selectrow_query($form, $form->get_standard_dbh, 'SELECT coa FROM defaults'))[0]))) {
+    %eur = (
+         1  => "Umsatzerlöse",
+         2  => "Spenden",
+         3  => "Mitgliederbeiträge",
+         4  => "Finanzerträge",
+         5  => "Ertragsminderungen",
+         6  => "Einkauf",
+         7  => "Löhne und Gehälter",
+         8  => "Sozialversicherungen",
+         9  => "Mieten",
+         10 => "Betriebsversicherungen",
+         11 => "Material- und Warenverluste",
+         12 => "Werbeaufwand",
+         13 => "Werkzeuge, Unterhalt, Betriebsmaterial",
+         14 => "Internet- und Serverhousingkosten",
+         15 => "Arbeitsleistungen externer Firmen",
+         16 => "Bürobedarf, Versandspesen, Telefon",
+         17 => "Sonstige Aufwendungen",
+         18 => "Abschreibungen",
+         19 => "Finanzaufwand",
+         20 => "Aufwandsminderungen",
+         21 => "Betriebliche Steuern",
+    );
+  } else {
+    %eur = (
+         1  => "Umsatzerlöse",
+         2  => "sonstige Erlöse",
+         3  => "Privatanteile",
+         4  => "Zinserträge",
+         5  => "Ausserordentliche Erträge",
+         6  => "Vereinnahmte Umsatzst.",
+         7  => "Umsatzsteuererstattungen",
+         8  => "Wareneingänge",
+         9  => "Löhne und Gehälter",
+         10 => "Gesetzl. sozialer Aufw.",
+         11 => "Mieten",
+         12 => "Gas, Strom, Wasser",
+         13 => "Instandhaltung",
+         14 => "Steuern, Versich., Beiträge",
+         15 => "Kfz-Steuern",
+         16 => "Kfz-Versicherungen",
+         17 => "Sonst. Fahrzeugkosten",
+         18 => "Werbe- und Reisekosten",
+         19 => "Instandhaltung u. Werkzeuge",
+         20 => "Fachzeitschriften, Bücher",
+         21 => "Miete für Einrichtungen",
+         22 => "Rechts- und Beratungskosten",
+         23 => "Bürobedarf, Porto, Telefon",
+         24 => "Sonstige Aufwendungen",
+         25 => "Abschreibungen auf Anlagever.",
+         26 => "Abschreibungen auf GWG",
+         27 => "Vorsteuer",
+         28 => "Umsatzsteuerzahlungen",
+         29 => "Zinsaufwand",
+         30 => "Ausserordentlicher Aufwand",
+         31 => "Betriebliche Steuern",
+    );
+  }
   foreach my $item (sort({ $a <=> $b } keys(%eur))) {
     my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
     if ($item == $form->{pos_eur}) {
index 6672be7..b4092e0 100644 (file)
@@ -108,7 +108,7 @@ my $rp_access_map = {
   'payments'           => 'cash',
   'trial_balance'      => 'report',
   'income_statement'   => 'report',
-  'income_statement_ch'=> 'report',
+  'erfolgsrechnung'    => 'report',
   'bwa'                => 'report',
   'balance_sheet'      => 'report',
 };
@@ -130,7 +130,7 @@ sub report {
   my %title = (
     balance_sheet        => $::locale->text('Balance Sheet'),
     income_statement     => $::locale->text('Income Statement'),
-    income_statement_ch     => ('Erfolgsrechnung'),
+    erfolgsrechnung      => ('Erfolgsrechnung'),
     trial_balance        => $::locale->text('Trial Balance'),
     ar_aging             => $::locale->text('Search AR Aging'),
     ap_aging             => $::locale->text('Search AP Aging'),
@@ -144,8 +144,13 @@ sub report {
 
   $::form->{title} = $title{$::form->{report}};
   $::request->{layout}->add_javascripts('autocomplete_customer.js');
+  $::form->{dateformat} = $::myconfig{dateformat};
+  my $year = DateTime->today->year;
+  $::form->{fromdate} = $::locale->reformat_date(\%::myconfig, '01.01.'.$year, $::myconfig{dateformat});
+  $::form->{todate} = $::locale->reformat_date(\%::myconfig, '31.01.'.$year, $::myconfig{dateformat});
 
   # get departments
+
   $::form->all_departments(\%::myconfig);
   if (@{ $::form->{all_departments} || [] }) {
     $::form->{selectdepartment} = "<option>\n";
@@ -156,7 +161,7 @@ sub report {
 
   my $is_projects            = $::form->{report} eq "projects";
   my $is_income_statement    = $::form->{report} eq "income_statement";
-  my $is_income_statement_ch = $::form->{report} eq "income_statement_ch";
+  my $is_erfolgsrechnung     = $::form->{report} eq "erfolgsrechnung";
   my $is_bwa                 = $::form->{report} eq "bwa";
   my $is_balance_sheet       = $::form->{report} eq "balance_sheet";
   my $is_trial_balance       = $::form->{report} eq "trial_balance";
@@ -209,7 +214,7 @@ sub report {
     is_balance_sheet       => $is_balance_sheet,
     is_bwa                 => $is_bwa,
     is_income_statement    => $is_income_statement,
-    is_income_statement_ch => $is_income_statement_ch,
+    is_erfolgsrechnung     => $is_erfolgsrechnung,
     is_projects            => $is_projects,
   });
 
@@ -401,172 +406,25 @@ sub generate_income_statement {
   $main::lxdebug->leave_sub();
 }
 
-sub generate_income_statement_ch {
-  $main::lxdebug->enter_sub();
-
-  $main::auth->assert('report');
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-  my $locale   = $main::locale;
+sub generate_erfolgsrechnung {
+  $::lxdebug->enter_sub;
+  $::auth->assert('report');
 
   my $defaults = SL::DB::Default->get;
-  $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
-  $form->{templates} = $defaults->templates;
-
-  $form->{padding} = "&nbsp;&nbsp;";
-  $form->{bold}    = "<b>";
-  $form->{endbold} = "</b>";
-  $form->{br}      = "<br>";
-
-  if ($form->{reporttype} eq "custom") {
-
-    #forgotten the year --> thisyear
-    if ($form->{year} !~ m/^\d\d\d\d$/) {
-      $locale->date(\%myconfig, $form->current_date(\%myconfig), 0) =~
-        /(\d\d\d\d)/;
-      $form->{year} = $1;
-    }
-
-    #yearly report
-    if ($form->{duetyp} eq "13") {
-      $form->{fromdate} = "1.1.$form->{year}";
-      $form->{todate}   = "31.12.$form->{year}";
-    }
-   #Quater reports
-    if ($form->{duetyp} eq "A") {
-      $form->{fromdate} = "1.1.$form->{year}";
-      $form->{todate}   = "31.3.$form->{year}";
-    }
-    if ($form->{duetyp} eq "B") {
-      $form->{fromdate} = "1.4.$form->{year}";
-      $form->{todate}   = "30.6.$form->{year}";
-    }
-    if ($form->{duetyp} eq "C") {
-      $form->{fromdate} = "1.7.$form->{year}";
-      $form->{todate}   = "30.9.$form->{year}";
-    }
-    if ($form->{duetyp} eq "D") {
-      $form->{fromdate} = "1.10.$form->{year}";
-      $form->{todate}   = "31.12.$form->{year}";
-    }
-  #Monthly reports
-  SWITCH: {
-      $form->{duetyp} eq "1" && do {
-        $form->{fromdate} = "1.1.$form->{year}";
-        $form->{todate}   = "31.1.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "2" && do {
-        $form->{fromdate} = "1.2.$form->{year}";
-
-        #this works from 1901 to 2099, 1900 and 2100 fail.
-        my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
-        $form->{todate} = "$leap.2.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "3" && do {
-        $form->{fromdate} = "1.3.$form->{year}";
-        $form->{todate}   = "31.3.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "4" && do {
-        $form->{fromdate} = "1.4.$form->{year}";
-        $form->{todate}   = "30.4.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "5" && do {
-        $form->{fromdate} = "1.5.$form->{year}";
-        $form->{todate}   = "31.5.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "6" && do {
-        $form->{fromdate} = "1.6.$form->{year}";
-        $form->{todate}   = "30.6.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "7" && do {
-        $form->{fromdate} = "1.7.$form->{year}";
-        $form->{todate}   = "31.7.$form->{year}";
-        last SWITCH;
-      };
-    $form->{duetyp} eq "8" && do {
-        $form->{fromdate} = "1.8.$form->{year}";
-        $form->{todate}   = "31.8.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "9" && do {
-        $form->{fromdate} = "1.9.$form->{year}";
-        $form->{todate}   = "30.9.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "10" && do {
-        $form->{fromdate} = "1.10.$form->{year}";
-        $form->{todate}   = "31.10.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "11" && do {
-        $form->{fromdate} = "1.11.$form->{year}";
-        $form->{todate}   = "30.11.$form->{year}";
-        last SWITCH;
-      };
-      $form->{duetyp} eq "12" && do {
-        $form->{fromdate} = "1.12.$form->{year}";
-        $form->{todate}   = "31.12.$form->{year}";
-        last SWITCH;
-      };
-    }
-    hotfix_reformat_date();
-  } # Ende Bericht für vorgewählten Zeitraum (warum auch immer die Prüfung (custom eq true) ist ...
-
-   RP->income_statement_ch(\%myconfig, \%$form);
-
-  ($form->{department}) = split /--/, $form->{department};
-
-  $form->{period} =
-    $locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
-  $form->{todate} = $form->current_date(\%myconfig) unless $form->{todate};
-
-  # if there are any dates construct a where
-  if ($form->{fromdate} || $form->{todate}) {
-
-    unless ($form->{todate}) {
-      $form->{todate} = $form->current_date(\%myconfig);
-    }
-
-    my $longtodate  = $locale->date(\%myconfig, $form->{todate}, 1);
-    my $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
-
-    my $longfromdate  = $locale->date(\%myconfig, $form->{fromdate}, 1);
-    my $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
-
-    $form->{this_period} = "$shortfromdate\n$shorttodate";
-    $form->{period}      =
-        $locale->text('for Period')
-      . qq|\n$longfromdate |
-      . $locale->text('Bis')
-      . qq| $longtodate|;
-  }
-
-  if ($form->{comparefromdate} || $form->{comparetodate}) {
-    my $longcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 1);
-    my $shortcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 0);
-
-    my $longcomparetodate  = $locale->date(\%myconfig, $form->{comparetodate}, 1);
-    my $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
-
-    $form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
-    $form->{period} .=
-        "\n$longcomparefromdate "
-      . $locale->text('Bis')
-      . qq| $longcomparetodate|;
-  }
+  $::form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+  $::form->{templates}     = $defaults->templates;
+  $::form->{decimalplaces} = $::form->{decimalplaces} * 1 || 2;
+  $::form->{padding}       = "&emsp;";
+  $::form->{bold}          = "<b>";
+  $::form->{endbold}       = "</b>";
+  $::form->{br}            = "<br>";
 
-   $form->{IN} = "erfolgsrechnung.html";
+  my $data = RP->erfolgsrechnung(\%::myconfig, $::form);
 
-  $form->parse_template;
+  $::form->header();
+  print $::form->parse_html_template('rp/erfolgsrechnung', $data);
 
-  $main::lxdebug->leave_sub();
+  $::lxdebug->leave_sub;
 }
 
 
diff --git a/menus/erp_ch.ini b/menus/erp_ch.ini
new file mode 100644 (file)
index 0000000..33519f2
--- /dev/null
@@ -0,0 +1,723 @@
+[Master Data]
+
+[Master Data--Add Customer]
+ACCESS=customer_vendor_edit
+module=controller.pl
+action=CustomerVendor/add
+db=customer
+
+[Master Data--Add Vendor]
+ACCESS=customer_vendor_edit
+module=controller.pl
+action=CustomerVendor/add
+db=vendor
+
+[Master Data--Add Part]
+ACCESS=part_service_assembly_edit
+module=ic.pl
+action=add
+item=part
+
+[Master Data--Add Service]
+ACCESS=part_service_assembly_edit
+module=ic.pl
+action=add
+item=service
+
+[Master Data--Add Assembly]
+ACCESS=part_service_assembly_edit
+module=ic.pl
+action=add
+item=assembly
+
+[Master Data--Add Project]
+ACCESS=project_edit
+module=controller.pl
+action=Project/new
+
+[Master Data--Update Prices]
+ACCESS=part_service_assembly_edit
+module=ic.pl
+action=search_update_prices
+
+
+[Master Data--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[Master Data--Reports--Customers]
+ACCESS=customer_vendor_edit
+module=controller.pl
+action=CustomerVendor/search
+db=customer
+
+[Master Data--Reports--Vendors]
+ACCESS=customer_vendor_edit
+module=controller.pl
+action=CustomerVendor/search
+db=vendor
+
+[Master Data--Reports--Contacts]
+ACCESS=customer_vendor_edit
+module=controller.pl
+action=CustomerVendor/search_contact
+db=customer
+
+[Master Data--Reports--Parts]
+ACCESS=part_service_assembly_details
+module=ic.pl
+action=search
+searchitems=part
+
+[Master Data--Reports--Services]
+ACCESS=part_service_assembly_details
+module=ic.pl
+action=search
+searchitems=service
+
+[Master Data--Reports--Assemblies]
+ACCESS=part_service_assembly_details
+module=ic.pl
+action=search
+searchitems=assembly
+
+[Master Data--Reports--Projects]
+ACCESS=project_edit
+module=controller.pl
+action=Project/search
+
+[AR]
+
+[AR--Add Quotation]
+ACCESS=sales_quotation_edit
+module=oe.pl
+action=add
+type=sales_quotation
+
+[AR--Add Sales Order]
+ACCESS=sales_order_edit
+module=oe.pl
+action=add
+type=sales_order
+
+[AR--Add Delivery Order]
+ACCESS=sales_delivery_order_edit
+module=do.pl
+action=add
+type=sales_delivery_order
+
+[AR--Add Sales Invoice]
+ACCESS=invoice_edit
+module=is.pl
+action=add
+type=invoice
+
+[AR--Add Credit Note]
+ACCESS=invoice_edit
+module=is.pl
+action=add
+type=credit_note
+
+[AR--Add Dunning]
+ACCESS=dunning_edit
+module=dn.pl
+action=add
+
+[AR--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[AR--Reports--Quotations]
+ACCESS=sales_quotation_edit
+module=oe.pl
+action=search
+type=sales_quotation
+
+[AR--Reports--Sales Orders]
+ACCESS=sales_order_edit
+module=oe.pl
+action=search
+type=sales_order
+
+[AR--Reports--Delivery Orders]
+ACCESS=sales_delivery_order_edit
+module=do.pl
+action=search
+type=sales_delivery_order
+
+[AR--Reports--Invoices, Credit Notes & AR Transactions]
+ACCESS=invoice_edit
+module=ar.pl
+action=search
+nextsub=ar_transactions
+
+[AR--Reports--Sales Report]
+ACCESS=invoice_edit
+module=vk.pl
+action=search_invoice
+nextsub=invoice_transactions
+
+[AR--Reports--Dunnings]
+ACCESS=dunning_edit
+module=dn.pl
+action=search
+
+[AR--Reports--Delivery Plan]
+ACCESS=sales_order_edit
+module=controller.pl
+action=DeliveryPlan/list
+
+[AP]
+
+[AP--Add RFQ]
+ACCESS=request_quotation_edit
+module=oe.pl
+action=add
+type=request_quotation
+
+[AP--Add Purchase Order]
+ACCESS=purchase_order_edit
+module=oe.pl
+action=add
+type=purchase_order
+
+[AP--Add Delivery Note]
+ACCESS=purchase_delivery_order_edit
+module=do.pl
+action=add
+type=purchase_delivery_order
+
+[AP--Add Vendor Invoice]
+ACCESS=vendor_invoice_edit
+module=ir.pl
+action=add
+type=invoice
+
+
+[AP--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[AP--Reports--RFQs]
+ACCESS=request_quotation_edit
+module=oe.pl
+action=search
+type=request_quotation
+
+[AP--Reports--Purchase Orders]
+ACCESS=purchase_order_edit
+module=oe.pl
+action=search
+type=purchase_order
+
+[AP--Reports--Delivery Orders]
+ACCESS=purchase_delivery_order_edit
+module=do.pl
+action=search
+type=purchase_delivery_order
+
+[AP--Reports--Vendor Invoices & AP Transactions]
+ACCESS=vendor_invoice_edit
+module=ap.pl
+action=search
+nextsub=ap_transactions
+
+
+[Warehouse]
+
+[Warehouse--Stock]
+ACCESS=warehouse_management
+module=controller.pl
+action=Inventory/stock_in
+
+[Warehouse--Produce Assembly]
+ACCESS=warehouse_management
+module=wh.pl
+action=transfer_warehouse_selection
+trans_type=assembly
+
+[Warehouse--Transfer]
+ACCESS=warehouse_management
+module=wh.pl
+action=transfer_warehouse_selection
+trans_type=transfer
+
+[Warehouse--Removal]
+ACCESS=warehouse_management
+module=wh.pl
+action=transfer_warehouse_selection
+trans_type=removal
+
+[Warehouse--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[Warehouse--Reports--Warehouse content]
+ACCESS=warehouse_contents | warehouse_management
+module=wh.pl
+action=report
+
+[Warehouse--Reports--WHJournal]
+ACCESS=warehouse_management
+module=wh.pl
+action=journal
+
+
+[General Ledger]
+
+[General Ledger--Add Transaction]
+ACCESS=general_ledger
+module=gl.pl
+action=add
+
+[General Ledger--Add AR Transaction]
+ACCESS=general_ledger
+module=ar.pl
+action=add
+
+[General Ledger--Add AP Transaction]
+ACCESS=general_ledger
+module=ap.pl
+action=add
+
+[General Ledger--DATEV - Export Assistent]
+ACCESS=datev_export
+module=datev.pl
+action=export
+
+
+
+
+[General Ledger--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+
+[General Ledger--Reports--AR Aging]
+ACCESS=general_ledger
+module=rp.pl
+action=report
+report=ar_aging
+
+
+[General Ledger--Reports--AP Aging]
+ACCESS=general_ledger
+module=rp.pl
+action=report
+report=ap_aging
+
+[General Ledger--Reports--Journal]
+ACCESS=general_ledger
+module=gl.pl
+action=search
+
+
+[Cash]
+ACCESS=cash
+
+[Cash--Receipt]
+module=cp.pl
+action=payment
+type=receipt
+vc=customer
+
+[Cash--Payment]
+module=cp.pl
+action=payment
+type=check
+vc=vendor
+
+[Cash--Reconciliation]
+ACCESS=cash
+module=rc.pl
+action=reconciliation
+
+[Cash--Bank collection via SEPA]
+module=sepa.pl
+action=bank_transfer_add
+vc=customer
+
+[Cash--Bank transfer via SEPA]
+module=sepa.pl
+action=bank_transfer_add
+vc=vendor
+
+[Cash--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[Cash--Reports--Receipts]
+module=rp.pl
+action=report
+report=receipts
+
+[Cash--Reports--Payments]
+module=rp.pl
+action=report
+report=payments
+
+[Cash--Reports--Bank collections via SEPA]
+module=sepa.pl
+action=bank_transfer_search
+vc=customer
+
+[Cash--Reports--Bank transfers via SEPA]
+module=sepa.pl
+action=bank_transfer_search
+vc=vendor
+
+[Reports]
+
+[Reports--Chart of Accounts]
+ACCESS=report
+module=ca.pl
+action=chart_of_accounts
+
+[Reports--Trial Balance]
+ACCESS=report
+module=rp.pl
+action=report
+report=trial_balance
+
+[Reports--Erfolgsrechnung]
+ACCESS=report
+module=rp.pl
+action=report
+report=erfolgsrechnung
+
+[Reports--BWA]
+ACCESS=report
+module=rp.pl
+action=report
+report=bwa
+
+[Reports--Balance Sheet]
+ACCESS=report
+module=rp.pl
+action=report
+report=balance_sheet
+
+[Reports--UStVa]
+ACCESS=advance_turnover_tax_return
+module=ustva.pl
+action=report
+
+[Reports--Projecttransactions]
+ACCESS=report
+module=rp.pl
+action=report
+report=projects
+
+
+[Batch Printing]
+ACCESS=batch_printing
+
+[Batch Printing--Sales Invoices]
+ACCESS=invoice_edit
+module=bp.pl
+action=search
+vc=customer
+type=invoice
+
+[Batch Printing--Sales Orders]
+ACCESS=sales_order_edit
+module=bp.pl
+action=search
+vc=customer
+type=sales_order
+
+[Batch Printing--Quotations]
+ACCESS=sales_quotation_edit
+module=bp.pl
+action=search
+vc=customer
+type=sales_quotation
+
+[Batch Printing--Packing Lists]
+ACCESS=invoice_edit | sales_order_edit
+module=bp.pl
+action=search
+vc=customer
+type=packing_list
+
+[Batch Printing--Purchase Orders]
+ACCESS=purchase_order_edit
+module=bp.pl
+action=search
+vc=vendor
+type=purchase_order
+
+[Batch Printing--RFQs]
+ACCESS=request_quotation_edit
+module=bp.pl
+action=search
+vc=vendor
+type=request_quotation
+
+[Batch Printing--Checks]
+ACCESS=cash
+module=bp.pl
+action=search
+vc=vendor
+type=check
+
+[Batch Printing--Receipts]
+ACCESS=cash
+module=bp.pl
+action=search
+vc=customer
+type=receipt
+
+
+[Productivity]
+ACCESS=productivity
+
+[Productivity--Show TODO list]
+module=todo.pl
+action=show_todo_list
+
+[Productivity--Add Follow-Up]
+module=fu.pl
+action=add
+
+[Productivity--Edit Access Rights]
+module=fu.pl
+action=edit_access_rights
+
+[Productivity--Reports]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[Productivity--Reports--Follow-Ups]
+module=fu.pl
+action=search
+
+
+[System]
+ACCESS=config
+
+[System--Client Configuration]
+ACCESS=admin
+module=controller.pl
+action=ClientConfig/edit
+
+[System--UStVa Einstellungen]
+module=ustva.pl
+action=config_step1
+
+[System--Edit Dunning]
+module=dn.pl
+action=edit_config
+
+[System--Chart of Accounts]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[System--Chart of Accounts--Add Account]
+module=am.pl
+action=add_account
+
+[System--Chart of Accounts--List Accounts]
+module=am.pl
+action=list_account
+
+[System--Buchungsgruppen]
+module=am.pl
+action=list_buchungsgruppe
+
+[System--Taxes]
+module=am.pl
+action=list_tax
+
+[System--Bank accounts]
+module=bankaccounts.pl
+action=bank_account_list
+
+[System--Groups]
+module=pe.pl
+action=search
+type=partsgroup
+
+[System--Pricegroups]
+module=pe.pl
+action=search
+type=pricegroup
+
+[System--Edit units]
+module=am.pl
+action=edit_units
+
+[System--Price Factors]
+module=am.pl
+action=list_price_factors
+
+[System--Departments]
+module=controller.pl
+action=Department/list
+
+[System--Types of Business]
+module=controller.pl
+action=Business/list
+
+[System--Leads]
+module=am.pl
+action=list_lead
+
+[System--Languages and translations]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[System--Languages and translations--Add Language]
+module=am.pl
+action=add_language
+
+[System--Languages and translations--List Languages]
+module=am.pl
+action=list_language
+
+[System--Languages and translations--Greetings]
+module=generictranslations.pl
+action=edit_greetings
+
+[System--Languages and translations--SEPA strings]
+module=generictranslations.pl
+action=edit_sepa_strings
+
+
+[System--Payment Terms]
+module=controller.pl
+action=PaymentTerm/list
+
+[System--Manage Custom Variables]
+module=controller.pl
+action=CustomVariableConfig/list
+
+[System--Warehouses]
+module=am.pl
+action=list_warehouses
+
+
+[System--Import CSV]
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[System--Import CSV--Customers and vendors]
+module=controller.pl
+action=CsvImport/new
+profile.type=customers_vendors
+
+[System--Import CSV--Contacts]
+module=controller.pl
+action=CsvImport/new
+profile.type=contacts
+
+[System--Import CSV--Shipto]
+module=controller.pl
+action=CsvImport/new
+profile.type=addresses
+
+[System--Import CSV--Parts]
+module=controller.pl
+action=CsvImport/new
+profile.type=parts
+
+[System--Import CSV--Projects]
+module=controller.pl
+action=CsvImport/new
+profile.type=projects
+
+[System--Templates]
+ACCESS=admin
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[System--Templates--HTML Templates]
+module=amtemplates.pl
+action=display_template_form
+type=templates
+format=html
+
+[System--Templates--LaTeX Templates]
+module=amtemplates.pl
+action=display_template_form
+type=templates
+format=tex
+
+[System--Templates--Stylesheet]
+module=amtemplates.pl
+action=display_template_form
+type=stylesheet
+
+[System--General Ledger Corrections]
+module=acctranscorrections.pl
+action=analyze_filter
+
+[System--Background jobs and task server]
+ACCESS=admin
+module=menu.pl
+action=acc_menu
+submenu=1
+
+[System--Background jobs and task server--List current background jobs]
+module=controller.pl
+action=BackgroundJob/list
+
+[System--Background jobs and task server--Background job history]
+module=controller.pl
+action=BackgroundJobHistory/list
+
+[System--Background jobs and task server--Task server control]
+module=controller.pl
+action=TaskServer/show
+
+[System--Audit Control]
+module=am.pl
+action=audit_control
+
+[System--History Search Engine]
+module=am.pl
+action=show_history_search
+
+[System--Employees]
+ACCESS=admin
+module=controller.pl
+action=Employee/list
+
+[Program]
+
+[Program--User Preferences]
+module=am.pl
+action=config
+
+[Program--Version]
+module=login.pl
+action=company_logo
+no_todo_list=1
+
+[Program--Administration area]
+ACCESS=display_admin_link
+module=controller.pl
+action=Admin/login
+
+[Program--Documentation (in German)]
+href=doc/kivitendo-Dokumentation.pdf
+target=_blank
+
+[Program--kivitendo website (external)]
+href=http://www.kivitendo.de/
+target=_blank
+
+[Program--Logout]
+module=controller.pl
+action=LoginScreen/logout
diff --git a/templates/webpages/rp/erfolgsrechnung.html b/templates/webpages/rp/erfolgsrechnung.html
new file mode 100644 (file)
index 0000000..4e477df
--- /dev/null
@@ -0,0 +1,40 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+
+<h2 align="center">
+  <br>[% company %]
+  <br>[% adress %]
+  <p>[% 'ERFOLGSRECHNUNG' %]
+  <br>[% fromdate %] bis [% todate %]
+</h2>
+<table border="0">
+  <tr>
+    <th align="left" width="400" colspan="2"><br></th>
+  </tr>
+  [%- FOREACH category = categories %]
+    <tr valign="top">
+      <th align="left" colspan="4">[% category.name %]<b><hr align="left" width="250" size="5" noshade></th>
+    </tr>
+    [%- FOREACH row = category.accounts %]
+      <tr>
+        <td align="left">[% row.accno %]</td>
+        <td align="left">[% row.description %]</td>
+        <td align="right">[% row.total %]</td>
+      </tr>
+    [%- END %]
+    <tr>
+      <td colspan="2"> </td>
+      <td><hr noshade size="1"></td>
+      <td><hr noshade size="1"></td>
+    </tr>
+    <tr valign="top">
+      <th align="left" colspan="2">TOTAL</th>
+      <td align="right">[% category.total %]<hr noshade size="2"></td>
+    </tr>
+  [%- END %]
+  <tr valign="top">
+    <th align="left" colspan="2">TOTAL ERTRAG &amp; AUFWAND</th>
+    <td align="right">[% total %]<br><hr noshade size="2"></td>
+  </tr>
+</table>
index 7744f31..c4e629b 100644 (file)
@@ -9,7 +9,9 @@
   </tr>
   <tr>
     <th colspan=1>[% 'Year' | $T8 %]</th>
-    <td><input name=year size=11 title="[% 'YYYY' | $T8 %]" value="[% year %]" class="initial_focus"></td>
+    <td>
+      <input name=year size=11 title="[% 'YYYY' | $T8 %]" value="[% year %]" class="initial_focus" oninput='set_from_to(duetyp.value, this.value)'>
+    </td>
   </tr>
   <tr>
     <td align=right> <b>[% 'Yearly' | $T8 %]</b> </td>
     <th align=left colspan=3>[% 'Monthly' | $T8 %]</th>
   </tr>
   <tr>
-    <td align=right>&nbsp; <input name=duetyp class=radio type=radio value="13"></td>
-    <td><input name=duetyp class=radio type=radio value="A">&nbsp;1. [% 'Quarter' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="1" checked>&nbsp;[% 'January' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="5">&nbsp;[% 'May' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="9">&nbsp;[% 'September' | $T8 %]</td>
+    <td align=right>&nbsp;
+      <input name=duetyp class=radio type=radio value="13" onchange='set_from_to(this.value, year.value)'>
+    </td>
+    <td><input name=duetyp class=radio type=radio value="A" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;1. [% 'Quarter' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="1" checked onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'January' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="5" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'May' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="9" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'September' | $T8 %]
+    </td>
   </tr>
   <tr>
     <td align= right>&nbsp;</td>
-    <td><input name=duetyp class=radio type=radio value="B">&nbsp;2. [% 'Quarter' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="2">&nbsp;[% 'February' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="6">&nbsp;[% 'June' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="10">&nbsp;[% 'October' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="B" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;2. [% 'Quarter' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="2" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'February' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="6" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'June' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="10" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'October' | $T8 %]
+    </td>
   </tr>
   <tr>
     <td> &nbsp;</td>
-    <td><input name=duetyp class=radio type=radio value="C">&nbsp;3. [% 'Quarter' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="3">&nbsp;[% 'March' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="7">&nbsp;[% 'July' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="11">&nbsp;[% 'November' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="C" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;3. [% 'Quarter' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="3" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'March' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="7" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'July' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="11" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'November' | $T8 %]
+    </td>
   </tr>
   <tr>
     <td> &nbsp;</td>
-    <td><input name=duetyp class=radio type=radio value="D">&nbsp;4. [% 'Quarter' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="4">&nbsp;[% 'April' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="8">&nbsp;[% 'August' | $T8 %]</td>
-    <td><input name=duetyp class=radio type=radio value="12">&nbsp;[% 'December' | $T8 %]</td>
+    <td><input name=duetyp class=radio type=radio value="D" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;4. [% 'Quarter' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="4" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'April' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="8" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'August' | $T8 %]
+    </td>
+    <td><input name=duetyp class=radio type=radio value="12" onchange='set_from_to(this.value, year.value)'>
+      &nbsp;[% 'December' | $T8 %]
+    </td>
   </tr>
   <tr>
     <td colspan=5><hr size=3 noshade></td>
@@ -51,7 +87,7 @@
     <th align=left><input name=reporttype class=radio type=radio value="free">[% 'Free report period' | $T8 %]</th>
     <td align=left colspan=4>
       [% 'From' | $T8 %] [% L.date_tag('fromdate', fromdate) %]
-      [% 'Bis' | $T8 %] [% L.date_tag('todate') %]
+      [% 'Bis' | $T8 %] [% L.date_tag('todate', todate)  %]
     </td>
   </tr>
   <tr>
   </tr>
 [%- END %]
 
-<h1>[% title %]</h1>
+<h1>
+  <br> [% title %]
+</h1>
 
 <form method=post action='[% script %]'>
 
   </tr>
 [%- END %]
 
-  [%- IF is_income_statement_ch %]
+
+[%- IF is_bwa %]
 [%- PROCESS projectnumber %]
-  <input type=hidden name=nextsub value=generate_income_statement_ch>
+  <input type=hidden name=nextsub value=generate_bwa>
 </table>
 <table>
 [%- PROCESS customized_report %]
 [%- PROCESS cash_or_accrual %]
   <tr>
-    <th align=left nowrap>[% 'Include in Report' | $T8 %]</th>
-    <td><input name=l_cb class=checkbox type=checkbox value=Y>&nbsp;[% 'CB Transactions' | $T8 %]</td>
+  <th align=right colspan=4>[% 'Decimalplaces' | $T8 %]</th>
+    <td><input name=decimalplaces size=3 value="2"></td>
   </tr>
 [%- END %]
 
 
-[%- IF is_bwa %]
-[%- PROCESS projectnumber %]
-  <input type=hidden name=nextsub value=generate_bwa>
+[%- IF is_erfolgsrechnung %]
+  <input type=hidden name=nextsub value=generate_erfolgsrechnung>
 </table>
 <table>
 [%- PROCESS customized_report %]
-[%- PROCESS cash_or_accrual %]
-  <tr>
-  <th align=right colspan=4>[% 'Decimalplaces' | $T8 %]</th>
-    <td><input name=decimalplaces size=3 value="2"></td>
-  </tr>
 [%- END %]
 
+
 [%- IF is_balance_sheet %]
   <input type=hidden name=nextsub value=generate_balance_sheet>
   <tr>
 <input type=submit class=submit name=action value="[% 'Continue' | $T8 %]">
 
 </form>
+
+<script type="text/javascript">
+function format_date(yy, mm, dd) {
+  var format = "[% dateformat %]";
+  format = format.replace("yyyy", "yy");
+  format = format.replace("yy", yy);
+  format = format.replace("mm", mm);
+  format = format.replace("dd", dd);
+  return format;
+}
+function set_from_to(duetyp, year) {
+  switch(duetyp) {
+    case '1':
+      document.getElementById('fromdate').value=format_date(year, '01', '01');
+      document.getElementById('todate').value=format_date(year, '01', '31');
+    break;
+    case '2':
+      document.getElementById('fromdate').value=format_date(year, '02', '01');
+      if(year % 4) document.getElementById('todate').value=format_date(year, '02', '28');
+      else document.getElementById('todate').value=format_date(year, '2', '29');
+    break;
+    case '3':
+      document.getElementById('fromdate').value=format_date(year, '03', '01');
+      document.getElementById('todate').value=format_date(year, '03', '31');
+    break;
+    case '4':
+      document.getElementById('fromdate').value=format_date(year, '04', '01');
+      document.getElementById('todate').value=format_date(year, '04', '30');
+    break;
+    case '5':
+      document.getElementById('fromdate').value=format_date(year, '05', '01');
+      document.getElementById('todate').value=format_date(year, '05', '31');
+    break;
+    case '6':
+      document.getElementById('fromdate').value=format_date(year, '06', '01');
+      document.getElementById('todate').value=format_date(year, '06', '30');
+    break;
+    case '7':
+      document.getElementById('fromdate').value=format_date(year, '07', '01');
+      document.getElementById('todate').value=format_date(year, '07', '31');
+    break;
+    case '8':
+      document.getElementById('fromdate').value=format_date(year, '08', '01');
+      document.getElementById('todate').value=format_date(year, '08', '31');
+    break;
+    case '9':
+      document.getElementById('fromdate').value=format_date(year, '09', '01');
+      document.getElementById('todate').value=format_date(year, '09', '30');
+    break;
+    case '10':
+      document.getElementById('fromdate').value=format_date(year, '10', '01');
+      document.getElementById('todate').value=format_date(year, '10', '31');
+    break;
+    case '11':
+      document.getElementById('fromdate').value=format_date(year, '11', '01');
+      document.getElementById('todate').value=format_date(year, '11', '30');
+    break;
+    case '12':
+      document.getElementById('fromdate').value=format_date(year, '12', '01');
+      document.getElementById('todate').value=format_date(year, '12', '31');
+    break;
+    case '13':
+      document.getElementById('fromdate').value=format_date(year, '01', '01');
+      document.getElementById('todate').value=format_date(year, '12', '31');
+    break;
+    case 'A':
+      document.getElementById('fromdate').value=format_date(year, '01', '01');
+      document.getElementById('todate').value=format_date(year, '03', '31');
+    break;
+    case 'B':
+      document.getElementById('fromdate').value=format_date(year, '04', '01');
+      document.getElementById('todate').value=format_date(year, '06', '30');
+    break;
+    case 'C':
+      document.getElementById('fromdate').value=format_date(year, '07', '01');
+      document.getElementById('todate').value=format_date(year, '09', '31');
+    break;
+    case 'D':
+      document.getElementById('fromdate').value=format_date(year, '10', '01');
+      document.getElementById('todate').value=format_date(year, '12', '31');
+    break;
+    default:
+      document.getElementById('fromdate').value=format_date(year, '01', '01');
+      document.getElementById('todate').value=format_date(year, '12', '31');
+  }
+  return true;
+}
+</script>
+