package RP;
-
sub balance_sheet {
$main::lxdebug->enter_sub();
my $project;
my $where = "1 = 1";
my $glwhere = "";
+ my $prwhere = "";
my $subwhere = "";
my $item;
if ($form->{method} eq 'cash') {
$subwhere .= " AND transdate >= '$fromdate'";
$glwhere = " AND ac.transdate >= '$fromdate'";
+ $prwhere = " AND ar.transdate >= '$fromdate'";
} else {
$where .= " AND ac.transdate >= '$fromdate'";
}
if ($todate) {
$where .= " AND ac.transdate <= '$todate'";
$subwhere .= " AND transdate <= '$todate'";
+ $prwhere .= " AND ar.transdate <= '$todate'";
}
if ($department_id) {
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.income_accno_id = c.id)
$dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'I'
$dpt_where
AND ac.trans_id IN
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.expense_accno_id = c.id)
$dpt_join
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'E'
$dpt_where
AND ac.trans_id IN
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.income_accno_id = c.id)
$dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'I'
$dpt_where
$project
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.expense_accno_id = c.id)
$dpt_join
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'E'
$dpt_where
$project
my @accno;
my $accno;
my $ref;
+
#print $query;
my $sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
my $sortorder = join ', ',
$form->sort_columns(qw(name invnumber ordnumber transdate source));
- $sortorder = $form->{sort} if $form->{sort};
-
+ $sortorder = $form->{sort} if $form->{sort};
+
# cycle through each id
foreach my $accno (split(/ /, $form->{paymentaccounts})) {
$form->{ "$key" . "gesamtleistung" } = 0;
$form->{ "$key" . "gesamtkosten" } = 0;
-
foreach $category (@categories) {
if (defined($form->{$category}{$key})) {
$form->{"$key$category"} =
$form->format_amount($myconfig,
$form->round_amount($form->{$category}{$key}, 2
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@gesamtleistung) {
$form->{ "$key" . "ergebnisvorsteuern" } =
$form->{ "$key" . "betriebsergebnis" } -
$form->{ "$key" . "neutraleraufwand" } +
- $form->{ "$key" . "neutralertrag" };
+ $form->{ "$key" . "neutralertrag" };
$form->{ "$key" . "ergebnis" } =
$form->{ "$key" . "ergebnisvorsteuern" } + $form->{35}{$key};
$form->{ "$key" . "gesamtleistung" } * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@ergebnisse) {
$form->{ "$key" . "gesamtleistung" } * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
$form->{ "$key" . "gesamtkosten" } * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@ergebnisse) {
$form->{ "$key" . "gesamtkosten" } * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
if (defined($form->{$category}{$key})) {
$form->{ "$key" . "pk" . "$category" } =
$form->format_amount(
- $myconfig,
- $form->round_amount(
- ($form->{$category}{$key} / $form->{10}{$key} * 100),
- $form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ $myconfig,
+ $form->round_amount(
+ ($form->{$category}{$key} / $form->{10}{$key} * 100),
+ $form->{decimalplaces}
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@ergebnisse) {
$form->{10}{$key} * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
if (defined($form->{$category}{$key})) {
$form->{ "$key" . "auf" . "$category" } =
$form->format_amount(
- $myconfig,
- $form->round_amount(
- ($form->{$category}{$key} / $form->{4}{$key} * 100),
- $form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ $myconfig,
+ $form->round_amount(
+ ($form->{$category}{$key} / $form->{4}{$key} * 100),
+ $form->{decimalplaces}
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@ergebnisse) {
$form->{4}{$key} * 100
),
$form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
foreach $item (@ergebnisse) {
$form->{ "$key" . "$item" } =
$form->format_amount($myconfig,
- $form->round_amount($form->{ "$key" . "$item" },
- $form->{decimalplaces}
- ), $form->{decimalplaces}, '0');
+ $form->round_amount($form->{ "$key" . "$item" },
+ $form->{decimalplaces}
+ ),
+ $form->{decimalplaces},
+ '0');
}
}
my $last_period = 0;
my $category = "pos_ustva";
my @categories_cent = qw(51r 511 86r 861 97r 971 93r 931
- 96 66 43 45 53 62 65 67);
+ 96 66 43 45 53 62 65 67);
my @categories_euro = qw(48 51 86 91 97 93 94);
$form->{decimalplaces} *= 1;
# }
#
# }
-
+
#
# Berechnung der USTVA Formularfelder
#
$form->{"86r"} = $form->{"861"};
$form->{"97r"} = $form->{"971"};
$form->{"93r"} = $form->{"931"};
+
#$form->{"96"} = $form->{"94"} * 0.16;
- $form->{"43"} =
+ $form->{"43"} =
$form->{"51r"} + $form->{"86r"} + $form->{"97r"} + $form->{"93r"} +
$form->{"96"};
$form->{"45"} = $form->{"43"};
foreach $item (@categories_cent) {
$form->{$item} =
- $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2), 2, '0');
+ $form->format_amount($myconfig, $form->round_amount($form->{$item}, 2),
+ 2, '0');
}
foreach $item (@categories_euro) {
$form->{$item} =
- $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0), 0, '0');
+ $form->format_amount($myconfig, $form->round_amount($form->{$item}, 0),
+ 0, '0');
}
$dbh->disconnect;