Beispiel #1
0
        public static void ShowForm(string ReportName, ref bool UsePrintPreview)
        {
            frmSetDefault frm = new frmSetDefault();

            frm.ReportName = ReportName;
            frm.Text       = "Set Default Laporan " + ReportName;

            frm.comboBoxEdit1.Properties.Items.AddRange(
                DocBrowseLayout.GetListLayout(ReportName));

            frm.radioGroup1.SelectedIndex = UsePrintPreview ? 0 : 1;
            string DefBrowse;
            string DefPrint;
            bool   Tmp;

            DocDefault.GetDefaultLayout(ReportName, out DefBrowse,
                                        out DefPrint, out Tmp);

            try
            {
                frm.comboBoxEdit1.Text = DefBrowse;
            }
            catch { }

            if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                UsePrintPreview = UsePreview;
            }
        }
        public void ShowForm2(EntityForm EntityForm,
                              string ReportName, string FreeFilter,
                              object TransStartDate, object TransEndDate,
                              object[] Parameters)
        {
            _ReportName = ReportName;
            _EntityForm = EntityForm;

            if (EntityForm.ModuleName.Length > 0 && BaseSecurity.CurrentLogin
                .CurrentRole.Length > 0)
            {
                ModuleAccess ma = BaseSecurity.GetModuleAccess(EntityForm.ModuleName);

                if (!ma.GetVariable <bool>(SecurityVarName.ReportDesignPrint, false))
                {
                    comboBoxEdit1.Properties.Buttons[2].Enabled = false;
                }
            }

            _Evaluator = BaseFactory.CreateInstance <Evaluator>();
            if (_ReportName.Contains("Laporan"))
            {
                Text = _ReportName;
            }
            else
            {
                Text = "Laporan " + _ReportName;
            }

            _FilterForm = BaseFactory.CreateInstance(
                _EntityForm.FilterFormType) as IFilterForm;
            if (_FilterForm == null)
            {
                XtraMessageBox.Show("Form Filter harus implement Interface IFilterForm !",
                                    "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }
            _ShowViewForm = _FilterForm as IShowView;
            if (_ShowViewForm == null)
            {
                XtraMessageBox.Show("Form Filter harus implement Interface IShowView !",
                                    "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            if (_EntityForm.FilterFormType == null || _FilterForm as ReportEntity != null)
            {
                splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            }
            else
            {
                XtraForm Frm = _FilterForm as XtraForm;
                if (Frm != null)
                {
                    InitFilterForm(Frm, xtraScrollableControl1,
                                   splitContainerControl1);
                }
                else
                {
                    QueryReportEntity(xtraScrollableControl1,
                                      splitContainerControl1);
                }
            }

            List <string> ListItems = DocPrintBrowseLayout
                                      .GetListLayout("F_" + _ReportName);

            if (ListItems.Count == 0)
            {
                if (re != null)
                {
                    Dictionary <string, object> Vars = new Dictionary <string, object>();
                    re.GetVariables(Vars);
                    SaveReportFromTemplateFolder("F_", ReportName,
                                                 ListItems, Vars);
                }
                else
                {
                    SaveReportFromTemplateFolder("F_", ReportName,
                                                 ListItems, _FilterForm != null ?
                                                 _FilterForm.FilterList : null);
                }
            }
            comboBoxEdit1.Properties.Items.AddRange(ListItems);

            string CurrBrowseLayoutId = string.Empty;
            bool   Tmp;

            DocDefault.GetDefaultLayout(_ReportName,
                                        out CurrBrowseLayoutId, out CurrPrintLayoutId, out Tmp);

            if (re != null)
            {
                ((IShowView)re).ShowView(Parameters);
            }
            else if (_ShowViewForm != null)
            {
                _ShowViewForm.ShowView(Parameters);
            }

            comboBoxEdit1.SelectedItem = CurrBrowseLayoutId;
            if (comboBoxEdit1.SelectedIndex < 0 && comboBoxEdit1.Properties.Items.Count > 0)
            {
                comboBoxEdit1.SelectedIndex = 0;
            }
            else
            {
                comboBoxEdit1_SelectedIndexChanged(null, null);
            }
            sbTotal.Caption = "Total Halaman: " +
                              printControl1.PrintingSystem.Pages.Count;
            ribbonStatusBar1.Refresh();
            printControl1.PrintingSystem.AfterChange += new DevExpress.XtraPrinting.ChangeEventHandler(PrintingSystem_AfterChange);
            Show();
            printControl1.Focus();
        }
Beispiel #3
0
        public void ShowForm(XtraForm MdiParent, Type FormType,
                             Type EntityType, DataPersistance dp,
                             Type FilterFormType, string DataFilter)
        {
            _Evaluator      = new Evaluator();
            Dp              = dp;
            this.DataFilter = DataFilter;
            comboBoxEdit1.Properties.Items.Add("(Layout Default)");

            if (EntityType != null)
            {
                _FormType   = FormType;
                _EntityType = EntityType;

                td = MetaData.GetTableDef(EntityType);
                Dp.ValidateTableDef(td);
                if (td.fldTransactionDate != null)
                {
                    dateEdit1.DateTime = DateTime.Today;
                    dateEdit2.DateTime = DateTime.Today;
                }
                else
                {
                    label3.Visible    = false;
                    label4.Visible    = false;
                    dateEdit1.Visible = false;
                    dateEdit2.Visible = false;
                }
                _ReportName = BaseUtility.SplitName(_EntityType.Name);
            }
            else
            {
                label3.Visible    = false;
                label4.Visible    = false;
                dateEdit1.Visible = false;
                dateEdit2.Visible = false;
                if (FilterFormType != null)
                {
                    _ReportName = FilterFormType.Name.Substring(0, 3).ToLower();
                    if (_ReportName == "frm" || _ReportName == "rpt")
                    {
                        _ReportName = BaseUtility.SplitName(
                            FilterFormType.Name.Substring(3));
                    }
                    else
                    {
                        _ReportName = BaseUtility.SplitName(FilterFormType.Name);
                    }
                }
                else
                {
                    _ReportName = "Bebas";
                }
            }
            Text = "Laporan " + _ReportName;

            comboBoxEdit1.Properties.Items.AddRange(
                DocBrowseLayout.GetListLayout(_ReportName));

            this.MdiParent = MdiParent;

            if (FilterFormType == null)
            {
                splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
            }
            else
            {
                _FilterForm = BaseFactory.CreateInstance(FilterFormType) as IFilterForm;
                if (_FilterForm == null)
                {
                    XtraMessageBox.Show("Form Filter harus implement Interface IFilterForm !",
                                        "Error Filter", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Close();
                    return;
                }
                XtraForm Frm = _FilterForm as XtraForm;
                if (Frm != null)
                {
                    Frm.FormBorderStyle = FormBorderStyle.None;
                    Frm.TopLevel        = false;
                    Frm.Parent          = xtraScrollableControl1;
                    splitContainerControl1.SplitterPosition = Frm.Height + 5;
                    Frm.KeyPreview = true;
                    Frm.KeyDown   += new KeyEventHandler(frmGridReport_KeyDown);
                    xtraScrollableControl1.BackColor = Frm.BackColor;
                    Frm.Show();
                }
                else
                {
                    splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel2;
                }
            }
            barButtonItem8_ItemClick(null, null);

            DefaultLayout = new MemoryStream();
            pivotGridControl1.SaveLayoutToStream(DefaultLayout);

            string CurrBrowseLayoutId = string.Empty;
            bool   Tmp;

            DocDefault.GetDefaultLayout(_ReportName,
                                        out CurrBrowseLayoutId, out CurrPrintLayoutId, out Tmp);
            Show();
            comboBoxEdit1.SelectedItem = CurrBrowseLayoutId;
            if (comboBoxEdit1.SelectedIndex < 0)
            {
                comboBoxEdit1.SelectedIndex = 0;
            }
            textEdit1.Focus();
        }