コード例 #1
0
ファイル: balance_sheet.php プロジェクト: M-Shahbaz/FA
function display_balance_sheet()
{
    global $path_to_root;
    $from = begin_fiscalyear();
    $to = $_POST['TransToDate'];
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $lconvert = $econvert = 1;
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    div_start('balance_tbl');
    start_table(TABLESTYLE, "width='30%'");
    if (!$drilldown) {
        $equityclose = 0.0;
        $lclose = 0.0;
        $calculateclose = 0.0;
        $parent = -1;
        //Get classes for BS
        $classresult = get_account_classes(false, 1);
        while ($class = db_fetch($classresult)) {
            $classclose = 0.0;
            $convert = get_class_type_convert($class["ctype"]);
            $ctype = $class["ctype"];
            $classname = $class["class_name"];
            //Print Class Name
            table_section_title($class["class_name"]);
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
                //Print Summary
                if ($TypeTotal != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/balance_sheet.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal * $convert);
                    end_row();
                }
                $classclose += $TypeTotal;
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($classclose * $convert);
            end_row();
            if ($ctype == CL_EQUITY) {
                $equityclose += $classclose;
                $econvert = $convert;
            }
            if ($ctype == CL_LIABILITIES) {
                $lclose += $classclose;
                $lconvert = $convert;
            }
            $calculateclose += $classclose;
        }
        if ($lconvert == 1) {
            $calculateclose *= -1;
        }
        //Final Report Summary
        $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&Compare=0'>" . _('Calculated Return') . "</a>";
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell($url);
        amount_cell($calculateclose);
        end_row();
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities'));
        amount_cell($lclose * $lconvert + $equityclose * $econvert + $calculateclose);
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]));
        $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
コード例 #2
0
function display_profit_and_loss()
{
    global $path_to_root, $sel;
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $from = $_POST['TransFromDate'];
    $to = $_POST['TransToDate'];
    $compare = $_POST['Compare'];
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    $dec = 0;
    $pdec = user_percent_dec();
    if ($compare == 0 || $compare == 2) {
        $end = $to;
        if ($compare == 2) {
            $begin = $from;
        } else {
            $begin = begin_fiscalyear();
        }
    } elseif ($compare == 1) {
        $begin = add_months($from, -12);
        $end = add_months($to, -12);
    }
    div_start('pl_tbl');
    start_table(TABLESTYLE, "width=50%");
    $tableheader = "<tr>\n        <td class='tableheader'>" . _("Group/Account Name") . "</td>\n        <td class='tableheader'>" . _("Period") . "</td>\n\t\t<td class='tableheader'>" . $sel[$compare] . "</td>\n\t\t<td class='tableheader'>" . _("Achieved %") . "</td>\n        </tr>";
    if (!$drilldown) {
        $parent = -1;
        $classper = 0.0;
        $classacc = 0.0;
        $salesper = 0.0;
        $salesacc = 0.0;
        //Get classes for PL
        $classresult = get_account_classes(false, 0);
        while ($class = db_fetch($classresult)) {
            $class_per_total = 0;
            $class_acc_total = 0;
            $convert = get_class_type_convert($class["ctype"]);
            //Print Class Name
            table_section_title($class["class_name"], 4);
            echo $tableheader;
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
                $class_per_total += $TypeTotal[0];
                $class_acc_total += $TypeTotal[1];
                if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Compare=" . $compare . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal[0] * $convert);
                    amount_cell($TypeTotal[1] * $convert);
                    amount_cell(Achieve($TypeTotal[0], $TypeTotal[1]));
                    end_row();
                }
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($class_per_total * $convert);
            amount_cell($class_acc_total * $convert);
            amount_cell(Achieve($class_per_total, $class_acc_total));
            end_row();
            $salesper += $class_per_total;
            $salesacc += $class_acc_total;
        }
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Calculated Return'));
        amount_cell($salesper * -1);
        amount_cell($salesacc * -1);
        amount_cell(achieve($salesper, $salesacc));
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]), 4);
        echo $tableheader;
        $classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
コード例 #3
0
    } else {
        label_cell($class_types[$myrow["ctype"]]);
    }
    inactive_control_cell($myrow["cid"], $myrow["inactive"], 'chart_class', 'cid');
    edit_button_cell("Edit" . $myrow["cid"], _("Edit"));
    delete_button_cell("Delete" . $myrow["cid"], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table(1);
//-----------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != "") {
    if ($Mode == 'Edit') {
        //editing an existing status code
        $myrow = get_account_class($selected_id);
        $_POST['id'] = $myrow["cid"];
        $_POST['name'] = $myrow["class_name"];
        if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) {
            $_POST['ctype'] = $myrow["ctype"] >= CL_ASSETS && $myrow["ctype"] < CL_INCOME ? 1 : 0;
        } else {
            $_POST['ctype'] = $myrow["ctype"];
        }
        hidden('selected_id', $selected_id);
    }
    hidden('id');
    label_row(_("Class ID:"), $_POST['id']);
} else {
    text_row_ex(_("Class ID:"), 'id', 3);
}
text_row_ex(_("Class Name:"), 'name', 50, 60);