Пример #1
0
        ///<summary>This report has never worked for Oracle.</summary>
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //create the report
            ReportComplex report           = new ReportComplex(true, false);
            Font          font             = new Font("Tahoma", 9);
            Font          fontBold         = new Font("Tahoma", 9, FontStyle.Bold);
            Font          fontTitle        = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle     = new Font("Tahoma", 10, FontStyle.Bold);
            DataTable     tableAssets      = Accounts.GetAssetTable(date1.SelectionStart);
            DataTable     tableLiabilities = Accounts.GetLiabilityTable(date1.SelectionStart);
            DataTable     tableEquity      = Accounts.GetEquityTable(date1.SelectionStart);

            //Add two new rows to the equity data table to show Retained Earnings (Auto) and NetIncomeThisYear
            tableEquity.LoadDataRow(new object[] { "Retained Earnings (Auto)", Accounts.RetainedEarningsAuto(date1.SelectionStart) }, LoadOption.OverwriteChanges);
            tableEquity.LoadDataRow(new object[] { "NetIncomeThisYear", Accounts.NetIncomeThisYear(date1.SelectionStart) }, LoadOption.OverwriteChanges);
            report.ReportName = "Balance Sheet";
            report.AddTitle("Title", Lan.g(this, "Balance Sheet"), fontTitle);
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", date1.SelectionStart.ToShortDateString(), fontSubTitle);
            //setup query
            QueryObject query;

            query = report.AddQuery(tableAssets, "Assets", "", SplitByKind.None, 0, true);
            // add columns to report
            query.AddColumn("Description", 300, FieldValueType.String, font);
            query.AddColumn("Amount", 150, FieldValueType.Number, font);
            query.AddSummaryLabel("Amount", "Total Assets", SummaryOrientation.West, false, fontBold);
            query = report.AddQuery(tableLiabilities, "Liabilities", "", SplitByKind.None, 0, true);
            query.IsNegativeSummary = true;
            // add columns to report
            query.AddColumn("Description", 300, FieldValueType.String, font);
            query.AddColumn("Amount", 150, FieldValueType.Number, font);
            query.AddSummaryLabel("Amount", "Total Liabilities", SummaryOrientation.West, false, fontBold);
            query.AddGroupSummaryField("Net Assets:", "Amount", "SumTotal", SummaryOperation.Sum, Color.Black, fontBold, 0, 10);
            query = report.AddQuery(tableEquity, "Equity", "", SplitByKind.None, 1, true);
            query.AddLine("EquityLine", AreaSectionType.GroupHeader, LineOrientation.Horizontal, LinePosition.North, Color.Black, 2, 90, 0, -30);
            // add columns to report
            query.AddColumn("Description", 300, FieldValueType.String, font);
            query.AddColumn("Amount", 150, FieldValueType.Number, font);
            query.AddSummaryLabel("Amount", "Total Equity", SummaryOrientation.West, false, fontBold);
            report.AddPageNum(font);
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            //FormR.MyReport=report;
            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }