X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep707.php;h=e19c29fee14db86c90259da0cd401424eea9bb68;hb=64ece402c019dd54bd6ca9882fd300362ef42871;hp=5dd9c1b2e282484590a78c4f4885f381820cec11;hpb=fa3dd600a4b60b528e4c69519c856125e6c3f9bf;p=fa-stable.git diff --git a/reporting/rep707.php b/reporting/rep707.php index 5dd9c1b2..e19c29fe 100644 --- a/reporting/rep707.php +++ b/reporting/rep707.php @@ -154,6 +154,10 @@ function print_profit_and_loss_statement() $salesacc = 0.0; $last = -1; + $closeclass = false; + $convert = 1; + $ctype = 0; + $accounts = get_gl_accounts_all(0); while ($account=db_fetch($accounts)) @@ -187,14 +191,14 @@ function print_profit_and_loss_statement() { for ( ; $level >= 0, $typename[$level] != ''; $level--) { - if ($account['parent'] == $closing[$level] || $account['parent'] < $last) + if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0) { $rep->row += 6; $rep->Line($rep->row); $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); - $rep->AmountCol(2, 3, $typeper[$level], $dec); - $rep->AmountCol(3, 4, $typeacc[$level], $dec); + $rep->AmountCol(2, 3, $typeper[$level] * $convert, $dec); + $rep->AmountCol(3, 4, $typeacc[$level] * $convert, $dec); $rep->AmountCol(4, 5, Achieve($typeper[$level], $typeacc[$level]), $pdec); if ($graphics) { @@ -216,8 +220,8 @@ function print_profit_and_loss_statement() $rep->NewLine(); $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->AmountCol(2, 3, $classper, $dec); - $rep->AmountCol(3, 4, $classacc, $dec); + $rep->AmountCol(2, 3, $classper * $convert, $dec); + $rep->AmountCol(3, 4, $classacc * $convert, $dec); $rep->AmountCol(4, 5, Achieve($classper, $classacc), $pdec); $rep->Font(); $salesper += $classper; @@ -246,11 +250,13 @@ function print_profit_and_loss_statement() $rep->NewLine(); } $classname = $account['AccountClassName']; - + $ctype = $account['ClassType']; + $convert = get_class_type_convert($ctype); + if ($account['account_code'] != null) { - $per_balance *= -1; - $acc_balance *= -1; + //$per_balance *= -1; + //$acc_balance *= -1; for ($i = 0; $i <= $level; $i++) { @@ -262,8 +268,8 @@ function print_profit_and_loss_statement() $rep->TextCol(0, 1, $account['account_code']); $rep->TextCol(1, 2, $account['account_name']); - $rep->AmountCol(2, 3, $per_balance, $dec); - $rep->AmountCol(3, 4, $acc_balance, $dec); + $rep->AmountCol(2, 3, $per_balance * $convert, $dec); + $rep->AmountCol(3, 4, $acc_balance * $convert, $dec); $rep->AmountCol(4, 5, Achieve($per_balance, $acc_balance), $pdec); $rep->NewLine(); @@ -288,14 +294,14 @@ function print_profit_and_loss_statement() { for ( ; $level >= 0, $typename[$level] != ''; $level--) { - if ($account['parent'] == $closing[$level] || $account['parent'] < $last) + if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0) { $rep->row += 6; $rep->Line($rep->row); $rep->NewLine(); $rep->TextCol(0, 2, _('Total') . " " . $typename[$level]); - $rep->AmountCol(2, 3, $typeper[$level], $dec); - $rep->AmountCol(3, 4, $typeacc[$level], $dec); + $rep->AmountCol(2, 3, $typeper[$level] * $convert, $dec); + $rep->AmountCol(3, 4, $typeacc[$level] * $convert, $dec); $rep->AmountCol(4, 5, Achieve($typeper[$level], $typeacc[$level]), $pdec); if ($graphics) { @@ -321,14 +327,14 @@ function print_profit_and_loss_statement() $rep->Font('bold'); $rep->TextCol(0, 2, _('Total') . " " . $classname); - $rep->AmountCol(2, 3, $classper, $dec); - $rep->AmountCol(3, 4, $classacc, $dec); + $rep->AmountCol(2, 3, $classper * $convert, $dec); + $rep->AmountCol(3, 4, $classacc * $convert, $dec); $rep->AmountCol(4, 5, Achieve($classper, $classacc), $pdec); $rep->NewLine(2); $rep->TextCol(0, 2, _('Calculated Return')); - $rep->AmountCol(2, 3, $calculateper, $dec); - $rep->AmountCol(3, 4, $calculateacc, $dec); + $rep->AmountCol(2, 3, $calculateper *-1, $dec); // always convert + $rep->AmountCol(3, 4, $calculateacc * -1, $dec); $rep->AmountCol(4, 5, Achieve($calculateper, $calculateacc), $pdec); if ($graphics) {