function gl_inquiry_controls() { $dim = get_company_pref('use_dimension'); start_form(); start_table(TABLESTYLE_NOBORDER); $date = today(); if (!isset($_POST['TransFromDate'])) { $_POST['TransFromDate'] = begin_month($date); } if (!isset($_POST['TransToDate'])) { $_POST['TransToDate'] = end_month($date); } date_cells(_("From:"), 'TransFromDate'); date_cells(_("To:"), 'TransToDate'); if ($dim >= 1) { dimensions_list_cells(_("Dimension") . " 1:", 'Dimension', null, true, " ", false, 1); } if ($dim > 1) { dimensions_list_cells(_("Dimension") . " 2:", 'Dimension2', null, true, " ", false, 2); } check_cells(_("No zero values"), 'NoZero', null); check_cells(_("Only balances"), 'Balance', null); submit_cells('Show', _("Show"), '', '', 'default'); end_table(); end_form(); }
function inquiry_controls() { global $Ajax; $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); $date = today(); if (!isset($_POST['TransFromDate'])) { $_POST['TransFromDate'] = begin_month($date); } if (!isset($_POST['TransToDate'])) { $_POST['TransToDate'] = end_month($date); } date_cells(_("From:"), 'TransFromDate'); date_cells(_("To:"), 'TransToDate'); type_list_cells(_("Category: "), 'typeId', null, true); $r = set(); account_list_cells(_(""), 'accountId', $r); submit_cells('submit_submit', _("Generate Report"), true, '', 'default'); //submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), 'default'); end_table(); }
hidden('end', $end); $total = $btotal = $ltotal = 0; for ($i = 0, $date_ = $begin; date1_greater_date2($end, $date_); $i++) { start_row(); $_POST['amount' . $i] = number_format2(get_only_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']), 0); label_cell($date_); if (!isset($_POST['amount' . $i])) { $_POST['amount' . $i] = '0'; } amount_cells(null, 'amount' . $i, null, 15, null, 0); if ($showdims) { $d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']); label_cell(number_format2($d, 0), "nowrap align=right"); $btotal += $d; } $lamount = get_gl_trans_from_to(add_years($date_, -1), add_years(end_month($date_), -1), $_POST['account'], $_POST['dim1'], $_POST['dim2']); $total += input_num('amount' . $i); $ltotal += $lamount; label_cell(number_format2($lamount, 0), "nowrap align=right"); $date_ = add_months($date_, 1); end_row(); } start_row(); label_cell("<b>" . tr("Total") . "</b>"); label_cell("<b>" . number_format2($total, 0) . "</b>", 'align=right'); if ($showdims) { label_cell("<b>" . number_format2($btotal, 0) . "</b>", "nowrap align=right"); } label_cell("<b>" . number_format2($ltotal, 0) . "</b>", "nowrap align=right"); end_row(); end_table(1);
function print_annual_balance_breakdown_detail() { global $path_to_root, $date_system; $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; if ($dim == 2) { $date = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; $dimension2 = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; } else { if ($dim == 1) { $date = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; } else { $date = $_POST['PARAM_0']; $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; } } if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report.inc"; } $title = _("Annual Balance Breakdown - Detailed"); $output_filename = "AnnualBalanceBreakDownDetail"; $fontsize = 7; $page_size = user_pagesize(); $page_orientation = 'L'; $margins = array('top' => 30, 'bottom' => 34, 'left' => 16, 'right' => 10); $excelColWidthFactor = 5; $rep = new FrontReport($title, $output_filename, $page_size, $fontsize, $page_orientation, $margins, $excelColWidthFactor); $enddate = end_month($date); $dec = user_price_dec(); // Lay out the columns for this report //$cols2 = array(0, 70, 127, 184, 232, 280, 328, 376, 424, 472, 520, 568, 616, 664, 712, 760); //-------------0--1---2----3----4----5----6----7----8----9----10---11---12---13---14---15- $cols2 = array(0 => 0, 70); $endline = $rep->endLine - 20; $wi = ($endline - $cols2[1]) / 12; // 12 amount columns for ($i = 2; $i < 15; $i++) { $cols2[$i] = $cols2[$i - 1] + $wi; } $cols = $cols2; //---------------------------------------------------------------------------------------- $aligns2 = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right'); $headers2 = array(); //$cols = array(0, 70, 127, 184, 232, 280, 328, 376, 424, 472, 520, 568, 616, 664, 712, 760); //-------------0--1---2----3----4----5----6----7----8----9----10---11---12---13---14---15- //---------------------------------------------------------------------------------------- $aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right'); $headers = array(); $date = begin_month($date); $date = add_months($date, -11); list($da, $mo, $yr) = explode_date_to_dmy($date); if ($date_system == 1) { list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da); } elseif ($date_system == 2) { list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da); } $headers2[0] = 'Account'; $headers[0] = ''; for ($i = 0; $i < 12; $i++) { $header_row[$i] = $rep->DatePrettyPrint($date, 0, 1); // Wrap at space between month & year $wrap_point = strpos($header_row[$i], ' '); if ($wrap_point) { $headers2[] = substr($header_row[$i], 0, $wrap_point); $headers[] = substr($header_row[$i], $wrap_point + 1); } else { $headers2[] = ''; $headers[] = $header_row[$i]; } $date = add_months($date, 1); } /* $header_row[] = "Fiscal Year Begin"; $header_row[] = "Fiscal YTD"; for ($i = 12; $i < 14; $i++) { $wrapped_header_text = $rep->TextWrapCalc($header_row[$i], $cols[$i+2] - $cols[$i+1], true); $headers2[] = trim($wrapped_header_text[0]); $headers[] = trim($wrapped_header_text[1]); } */ if ($dim == 2) { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate)), 2 => array('text' => '', 'from' => '', 'to' => ''), 3 => array('text' => '', 'from' => '', 'to' => ''), 4 => array('text' => _("Dimension 1"), 'from' => get_dimension_string($dimension), 'to' => ''), 5 => array('text' => _("Dimension 2"), 'from' => get_dimension_string($dimension2), 'to' => '')); } else { if ($dim == 1) { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate)), 2 => array('text' => '', 'from' => '', 'to' => ''), 3 => array('text' => _('Dimension'), 'from' => get_dimension_string($dimension), 'to' => '')); } else { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate))); } } // Company logo setting $companylogoenable = true; // Footer Settings $footerenable = true; $footertext = _('For Management Purposes Only'); $rep->Font(); $rep->SetFillColor(240, 240, 240); $rep->scaleLogoWidth = true; $rep->lineHeight = 8; $rep->SetCellPadding(4); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2, $companylogoenable, $footerenable, $footertext); $rep->SetHeaderType('Header3'); $rep->NewPage(); $rep->SetDrawColor(0, 0, 0); $rep->SetLineWidth(0.1); $sales = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $classresult = get_account_classes(false, 1); while ($class = db_fetch($classresult)) { $ctotal = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $convert = get_class_type_convert($class["ctype"]); //Print Class Name $rep->NewLine(); $oldcMargin = $rep->GetCellPadding(); $rep->SetCellPadding(0); $oldFontSize = $rep->fontSize; $rep->fontSize = 12; $rep->Font('b'); $rep->TextCol(0, 5, $class["class_name"]); $rep->Font(); $rep->fontSize = $oldFontSize; $rep->SetCellPadding($oldcMargin); $rep->NewLine(); //Get Account groups/types under this group/type with no parents $typeresult = get_account_types(false, $class['cid'], -1); while ($accounttype = db_fetch($typeresult)) { $classtotal = display_type($accounttype["id"], $accounttype["name"], $yr, $mo, $convert, $dec, $rep, $dimension, $dimension2); for ($i = 1; $i <= 12; $i++) { $ctotal[$i] += $classtotal[$i]; } } //Print Class Summary $rep->row += 5; $rep->Line($rep->row - 3); $rep->NewLine(); $rep->Font('b'); $oldcMargin = $rep->GetCellPadding(); $rep->SetCellPadding(0); $fill = 0; $rep->TextCol(0, 1, _('Total') . " " . $class["class_name"], 0, 4, 0, $fill, NULL, 1); $rep->SetCellPadding($oldcMargin); for ($i = 1; $i <= 12; $i++) { $rep->AmountCol2($i, $i + 1, $ctotal[$i] * $convert, $dec, 0, 4, 0, $fill, NULL, 1, true); $sales[$i] += $ctotal[$i]; } $rep->Font(); $rep->NewLine(2); } $rep->Font('bold'); $oldcMargin = $rep->GetCellPadding(); $rep->SetCellPadding(0); $rep->TextCol(0, 1, _('Net Assets (Liabilities)'), 0, 4, 0, $fill, NULL, 1); $rep->SetCellPadding($oldcMargin); for ($i = 1; $i <= 12; $i++) { $rep->AmountCol2($i, $i + 1, $sales[$i] * -1, $dec, 0, 4, 0, $fill, NULL, 1, true); } $rep->Font(); $rep->NewLine(); $rep->Line($rep->row); $rep->NewLine(2); $calc = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $total = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $classresult = get_account_classes(false, 0); while ($class = db_fetch($classresult)) { $convert = get_class_type_convert($class["ctype"]); //Print Class Name $oldcMargin = $rep->GetCellPadding(); $rep->SetCellPadding(0); $rep->Font('b'); $rep->TextCol(0, 1, _("Total ") . $class["class_name"], 0, 4, 0, $fill, NULL, 1); $rep->SetCellPadding($oldcMargin); $typeresult = get_account_types(false, $class['cid']); while ($accounttype = db_fetch($typeresult)) { $result = get_gl_accounts(null, null, $accounttype['id']); while ($account = db_fetch($result)) { $bal = getPeriods($yr, $mo, $account["account_code"], $dimension, $dimension2); $balance = array(1 => $bal['per01'], $bal['per02'], $bal['per03'], $bal['per04'], $bal['per05'], $bal['per06'], $bal['per07'], $bal['per08'], $bal['per09'], $bal['per10'], $bal['per11'], $bal['per12']); for ($i = 1; $i <= 12; $i++) { $total[$i] += $balance[$i]; } } } for ($i = 1; $i <= 12; $i++) { $rep->AmountCol2($i, $i + 1, $total[$i] * $convert, $dec, 0, 4, 0, $fill, NULL, 1, true); $calc[$i] += $total[$i]; $total[$i] = 0; } $rep->NewLine(2); } $oldcMargin = $rep->GetCellPadding(); $rep->SetCellPadding(0); $rep->TextCol(0, 1, _('Total Profit/Loss'), 0, 4, 0, $fill, NULL, 1); $rep->SetCellPadding($oldcMargin); for ($i = 1; $i <= 12; $i++) { $rep->AmountCol2($i, $i + 1, -$calc[$i], $dec, 0, 4, 0, $fill, NULL, 1, true); // no convert } $rep->Font(); $rep->End(); }
} if ($use_date_picker) { $js .= get_js_date_picker(); } page(_($help_context = "Tax Inquiry (Cash Basis)"), false, false, '', $js); //---------------------------------------------------------------------------------------------------- // Ajax updates // if (get_post('Show')) { $Ajax->activate('trans_tbl'); } if (get_post('TransFromDate') == "" && get_post('TransToDate') == "") { $date = Today(); $row = get_company_prefs(); $edate = add_months($date, -$row['tax_last']); $edate = end_month($edate); $bdate = begin_month($edate); $bdate = add_months($bdate, -$row['tax_prd'] + 1); $_POST["TransFromDate"] = $bdate; $_POST["TransToDate"] = $edate; } //---------------------------------------------------------------------------------------------------- function tax_inquiry_controls() { start_form(); start_table(TABLESTYLE_NOBORDER); start_row(); date_cells(_("from:"), 'TransFromDate', '', null, -30); date_cells(_("to:"), 'TransToDate'); check_cells(_("Net Output/Input:"), 'NetAmounts', null); submit_cells('Show', _("Show"), '', '', 'default');
function inquiry_controls() { $dim = get_company_pref('use_dimension'); start_table(TABLESTYLE_NOBORDER); $date = today(); if (!isset($_POST['TransFromDate'])) { $_POST['TransFromDate'] = begin_month($date); } if (!isset($_POST['TransToDate'])) { $_POST['TransToDate'] = end_month($date); } date_cells(_("From:"), 'TransFromDate'); date_cells(_("To:"), 'TransToDate'); //Compare Combo global $sel; $sel = array(_("Accumulated"), _("Period Y-1"), _("Budget")); echo "<td>" . _("Compare to") . ":</td>\n"; echo "<td>"; echo array_selector('Compare', null, $sel); echo "</td>\n"; if ($dim >= 1) { dimensions_list_cells(_("Dimension") . " 1:", 'Dimension', null, true, " ", false, 1); } if ($dim > 1) { dimensions_list_cells(_("Dimension") . " 2:", 'Dimension2', null, true, " ", false, 2); } submit_cells('Show', _("Show"), '', '', 'default'); end_table(); hidden('AccGrp'); }
function display_fiscalyear_edit($selected_id) { global $Mode; start_form(); start_table(TABLESTYLE2); $company_year = get_company_pref('f_year'); $result = get_all_fiscalyears(); $row_cnt = db_num_rows($result); if ($selected_id != -1) { if ($Mode == 'Edit') { $myrow = get_fiscalyear($selected_id); $_POST['from_date'] = sql2date($myrow["begin"]); $_POST['to_date'] = sql2date($myrow["end"]); $_POST['closed'] = $myrow["closed"]; } if ($row_cnt == 1) { date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001); } else { hidden('from_date'); label_row(_("Fiscal Year Begin:"), $_POST['from_date']); } hidden('to_date'); label_row(_("Fiscal Year End:"), $_POST['to_date']); if ($myrow["id"] != $company_year) { yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false); } else { hidden('closed'); label_row(_("Is Closed:"), yesno_value($_POST['closed'])); } } else { $begin = next_begin_date(); if ($begin && $Mode != 'ADD_ITEM') { $_POST['from_date'] = $begin; $_POST['to_date'] = end_month(add_months($begin, 11)); $_POST['closed'] = 0; } hidden('from_date'); hidden('to_date'); hidden('closed'); } hidden('selected_id', $selected_id); end_table(1); submit_add_or_update_center($selected_id == -1, '', 'both'); end_form(); }
function display_fiscalyear_edit($selected_id) { global $Mode; start_form(); start_table(TABLESTYLE2); if ($selected_id != -1) { if ($Mode == 'Edit') { $myrow = get_fiscalyear($selected_id); $_POST['from_date'] = sql2date($myrow["begin"]); $_POST['to_date'] = sql2date($myrow["end"]); $_POST['closed'] = $myrow["closed"]; } hidden('from_date'); hidden('to_date'); label_row(_("Fiscal Year Begin:"), $_POST['from_date']); label_row(_("Fiscal Year End:"), $_POST['to_date']); } else { $begin = next_begin_date(); if ($begin && $Mode != 'ADD_ITEM') { $_POST['from_date'] = $begin; $_POST['to_date'] = end_month(add_months($begin, 11)); } date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001); date_row(_("Fiscal Year End:"), 'to_date', '', null, 0, 0, 1001); } hidden('selected_id', $selected_id); yesno_list_row(_("Is Closed:"), 'closed', null, "", "", false); end_table(1); submit_add_or_update_center($selected_id == -1, '', 'both'); end_form(); }
function print_cash_flow_statement() { global $path_to_root, $date_system, $comp_path; $dim = get_company_pref('use_dimension'); $dimension = $dimension2 = 0; if ($dim == 2) { $date = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; $dimension2 = $_POST['PARAM_2']; $comments = $_POST['PARAM_3']; $destination = $_POST['PARAM_4']; } else { if ($dim == 1) { $date = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; $comments = $_POST['PARAM_2']; $destination = $_POST['PARAM_3']; } else { $date = $_POST['PARAM_0']; $comments = $_POST['PARAM_1']; $destination = $_POST['PARAM_2']; } } if ($destination) { include_once $path_to_root . "/reporting/includes/excel_report.inc"; } else { include_once $path_to_root . "/reporting/includes/pdf_report.inc"; } if ($comments) { $comments .= ". - "; } $comments .= _("Balances in Home Currency"); $title = _("Cash Flow Statement"); $output_filename = "CashFlowStatement"; $fontsize = 7; $page_size = user_pagesize(); $page_orientation = 'L'; $margins = array('top' => 30, 'bottom' => 34, 'left' => 16, 'right' => 10); $excelColWidthFactor = 5; $rep = new FrontReport($title, $output_filename, $page_size, $fontsize, $page_orientation, $margins, $excelColWidthFactor); $enddate = end_month($date); $dec = user_price_dec(); // Lay out the columns for this report //$cols2 = array(0, 70, 127, 184, 232, 280, 328, 376, 424, 472, 520, 568, 616, 664, 712, 760); //-------------0--1---2----3----4----5----6----7----8----9----10---11---12---13---14---15- $cols2 = array(0 => 0, 70); $endline = $rep->endLine - 20; $wi = ($endline - $cols2[1]) / 14; // 14 amount columns for ($i = 2; $i < 17; $i++) { $cols2[$i] = $cols2[$i - 1] + $wi; } $cols = $cols2; //---------------------------------------------------------------------------------------- $aligns2 = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right'); $headers2 = array(); //$cols = array(0, 70, 127, 184, 232, 280, 328, 376, 424, 472, 520, 568, 616, 664, 712, 760); //-------------0--1---2----3----4----5----6----7----8----9----10---11---12---13---14---15- //---------------------------------------------------------------------------------------- $aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right'); $headers = array(); $date = begin_month($date); $date = add_months($date, -11); list($da, $mo, $yr) = explode_date_to_dmy($date); if ($date_system == 1) { list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da); } elseif ($date_system == 2) { list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da); } $headers2[0] = 'Account'; $headers[0] = ''; for ($i = 0; $i < 12; $i++) { $header_row[$i] = $rep->DatePrettyPrint($date, 0, 1); // Wrap at space between month & year $wrap_point = strpos($header_row[$i], ' '); if ($wrap_point) { $headers2[] = substr($header_row[$i], 0, $wrap_point); $headers[] = substr($header_row[$i], $wrap_point + 1); } else { $headers2[] = ''; $headers[] = $header_row[$i]; } $date = add_months($date, 1); } $header_row[] = _("Fiscal YTD"); $header_row[] = _("12 Mo. to Date"); for ($i = 12; $i < 14; $i++) { $wrapped_header_text = $rep->TextWrapCalc($header_row[$i], $cols[$i + 2] - $cols[$i + 1], true); $headers2[] = trim($wrapped_header_text[0]); $headers[] = trim($wrapped_header_text[1]); } if ($dim == 2) { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate)), 2 => array('text' => '', 'from' => '', 'to' => ''), 3 => array('text' => '', 'from' => '', 'to' => ''), 4 => array('text' => _("Dimension 1"), 'from' => get_dimension_string($dimension), 'to' => ''), 5 => array('text' => _("Dimension 2"), 'from' => get_dimension_string($dimension2), 'to' => '')); } else { if ($dim == 1) { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate)), 2 => array('text' => '', 'from' => '', 'to' => ''), 3 => array('text' => _('Dimension'), 'from' => get_dimension_string($dimension), 'to' => '')); } else { $params = array(0 => $comments, 1 => array('text' => _("Report Period"), 'from' => '', 'to' => $rep->DatePrettyPrint($enddate))); } } // Company logo setting $companylogoenable = true; // Footer Settings $footerenable = true; $footertext = _('For Management Purposes Only'); $rep->Font(); $rep->SetFillColor(240, 240, 240); $rep->scaleLogoWidth = true; $rep->lineHeight = 8; $rep->SetCellPadding(4); $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2, $companylogoenable, $footerenable, $footertext); $rep->SetHeaderType('Header3'); $rep->NewPage(); $rep->SetDrawColor(0, 0, 0); $rep->SetLineWidth(0.1); $rep->row += 8; display_bank_trans($yr, $mo, $dec, $rep, $dimension, $dimension2, $enddate); $rep->Font(); $rep->End(); }