Ejemplo n.º 1
0
        private void cmdPrint_Click(object sender, RoutedEventArgs e)
        {
            if (trvMain.SelectedItem is MReportGroup)
            {
                return;
            }

            MReportFilter mr = (MReportFilter)trvMain.SelectedItem;

            if (mr == null)
            {
                return;
            }

            CBaseReport paginator = (CBaseReport)reportObjs[mr.ReportName];

            if (paginator == null)
            {
                return;
            }

            Boolean isPageRange = (Boolean)cbxPageRange.IsChecked;

            if (isPageRange)
            {
                populatePageRange(paginator);

                if (paginator.toPage < paginator.fromPage)
                {
                    CHelper.ShowErorMessage("", "ERROR_PAGE_RANGE", null);
                    return;
                }
            }

            dialog.PrintQueue  = LocalPrintServer.GetDefaultPrintQueue();
            dialog.PrintTicket = dialog.PrintQueue.DefaultPrintTicket;
            dialog.PrintTicket.PageOrientation = paginator.GetPageOrientation();
            dialog.PrintTicket.PageMediaSize   = new PageMediaSize(PageMediaSizeName.Unknown, paginator.PageSize.Width, paginator.PageSize.Height);
            bool?result = dialog.ShowDialog();

            if (result == true)
            {
                paginator.isPageRange = isPageRange;

                FixedDocument fd = null;
                if (!isPageRange)
                {
                    fd = paginator.GetFixedDocument();
                }
                else
                {
                    fd = paginator.CreateFixedDocument();
                }

                docViewer.Document = paginator.GetFixedDocument();
                dialog.PrintDocument(fd.DocumentPaginator, "");

                CUtil.LoadPageNavigateCombo(cboPageNo, paginator.PageCount);
            }
        }
Ejemplo n.º 2
0
        private void loadFilterFromDB()
        {
            CUtil.EnableForm(false, this);

            CTable    t   = OnixWebServiceAPI.GetReportFilterInfo(new CTable(""));
            ArrayList arr = t.GetChildArray("REPORT_FILTER_ITEM");

            foreach (CTable o in arr)
            {
                MReportFilter rf = new MReportFilter(o);
                dbReportFilter.Add(rf.Key, rf);
            }

            CUtil.EnableForm(true, this);
        }
Ejemplo n.º 3
0
        private void trvMain_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (!(e.NewValue is MReportFilter))
            {
                return;
            }

            if (isInLoad && IsConfigMode)
            {
                return;
            }

            MReportFilter mr    = (MReportFilter)e.NewValue;
            String        rptId = mr.ReportName;

            if (reportObjs.ContainsKey(rptId))
            {
                rpt = (CBaseReport)reportObjs[rptId];
            }
            else
            {
                CBaseReport r = createObject(rptId);
                CUtil.EnableForm(false, this);
                MReportConfig rptCfg = CReportConfigs.GetReportConfig(null, rptId);
                CUtil.EnableForm(true, this);
                MReportConfig defaultCfg = r.CreateDefaultConfigValues();
                defaultCfg.ReportName = rptId;

                if (rptCfg == null)
                {
                    rptCfg = defaultCfg;
                    CReportConfigs.SaveReportConfig(null, rptCfg);
                }
                else
                {
                    rptCfg.PopulateMissingValue(defaultCfg);
                }

                MBaseModel d = null;
                if (dataSource == null)
                {
                    d = r.CreateDefaultData();
                }
                else
                {
                    d = dataSource;
                }

                r.SetDataSourceAndParam(d, rptCfg);
                r.isPageRange = false;
                r.CreateFixedDocument();

                reportObjs.Add(rptId, r);
                rpt = r;
            }

            cmdSave.IsEnabled      = rpt.GetReportConfig().IsModified;
            cbxPageRange.IsEnabled = rpt.IsPageRangeSupport;

            this.Title         = mr.Description;
            docViewer.Document = rpt.GetFixedDocument();

            CUtil.LoadPageNavigateCombo(cboPageNo, rpt.PageCount);
            CUtil.LoadPageCombo(cboFromPage, rpt.PageCount);
            CUtil.LoadPageCombo(cboToPage, rpt.PageCount);
        }
Ejemplo n.º 4
0
        private ObservableCollection <MReportGroup> constructReportTree()
        {
            groups = new ObservableCollection <MReportGroup>();
            MReportFilter r = null;

            foreach (String key in reportGroupKeys)
            {
                if (!reportGroup.Equals("") && !reportGroup.Equals(key))
                {
                    continue;
                }

                MReportGroup rg = new MReportGroup(new CTable(""));
                rg.GroupName = CLanguage.getValue(key);

                groups.Add(rg);

                ArrayList rpts = (ArrayList)reportGroups[key];
                if (rpts == null)
                {
                    rpts = new ArrayList();
                }

                int index = 0;
                foreach (String name in rpts)
                {
                    r             = new MReportFilter(new CTable(""));
                    r.ReportName  = name;
                    r.ReportGroup = key;
                    r.Description = CLanguage.getValue(name);

                    if (dbReportFilter.ContainsKey(r.Key))
                    {
                        MReportFilter rf = (MReportFilter)dbReportFilter[r.Key];
                        r.ReportFilterID = rf.ReportFilterID;
                        r.IsSelected     = rf.IsSelected;
                        r.ExtFlag        = "I";
                    }
                    else
                    {
                        r.IsSelected = false;
                        r.ExtFlag    = "A";
                    }

                    if (index == 0)
                    {
                        r.IsNodeSelected = true;
                    }

                    if (!reportGroup.Equals("") && !r.IsSelected)
                    {
                        //Normal mode but not yet selected
                        continue;
                    }

                    rg.AddItem(r);
                    index++;
                }
            }

            return(groups);
        }