private void PrintAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            SalesOrder   record      = (SalesOrder)((DevExpress.ExpressApp.DetailView) this.ObjectSpace.Owner).CurrentObject;
            IObjectSpace objectSpace =
                ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));

            IReportDataV2 reportData =
                objectSpace.FindObject <ReportDataV2>(
                    CriteriaOperator.Parse("[DisplayName] = 'Sales Order'"));
            string handle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
            //var __report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            //__report.FilterString = "[InvoiceNo]='" + record.InvoiceNo + "'";
            ReportServiceController controller = Frame.GetController <ReportServiceController>();


            string           reportContainerHandle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
            CriteriaOperator criteria = new BinaryOperator("SalesOrder.DocumentNumber", record.DocumentNumber); // Filter by Tags

            //var dataSource = (DevExpress.Persistent.Base.ReportsV2.ISupportCriteria)__report.DataSource;
            //dataSource.Criteria = DevExpress.Data.Filtering.CriteriaOperator.Parse(
            //    "StartsWith(InvoiceNo, '" + record.InvoiceNo + "')");

            if (controller != null)
            {
                controller.ShowPreview(handle, criteria);
            }
        }
        protected override void PrintReport(IReportDataV2 reportData)
        {
            string reportContainerHandle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);

            ((WebWindow)WebApplication.Instance.MainWindow).RegisterStartupScript(
                "InstantPrintReport", GetPrintingScript(reportContainerHandle), overwrite: true);
        }
Example #3
0
        private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e)
        {//b6
            ReportPhieuNhapKho report  = new ReportPhieuNhapKho();
            Employee           receipt = View.CurrentObject as Employee;

            if (receipt != null)
            {
                IReportDataV2 reportData = null;

                reportData =
                    View.ObjectSpace.FindObject <XtraReportData>
                    (
                        CriteriaOperator.And
                        (
                            new BinaryOperator("PredefinedReportType", typeof(ReportPhieuNhapKho), BinaryOperatorType.Equal),
                            new BinaryOperator("DisplayName", "Phieu nhap kho 2", BinaryOperatorType.Equal)
                        )
                    );

                string handle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
                ReportServiceController reportServiceController = Frame.GetController <ReportServiceController>();
                printActionSVP = e.ShowViewParameters;

                reportServiceController.ShowPreview(handle, CriteriaOperator.Parse(""));
            }
        }
        private void ShowInPlaceReportAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            if (checkObjectType())
            {
                IList <int> oids       = new List <int>();
                string      reportname = e.SelectedChoiceActionItem.Data.ToString();

                if (typeof(ClassDocument).IsAssignableFrom(View.ObjectTypeInfo.Type))
                {
                    if (View is ListView)
                    {
                        foreach (ClassDocument dtl in View.SelectedObjects)
                        {
                            oids.Add(dtl.Oid);
                        }
                    }
                    else if (View is DetailView)
                    {
                        oids.Add(((ClassDocument)View.CurrentObject).Oid);
                    }
                }
                else if (typeof(ClassStockTransferDocument).IsAssignableFrom(View.ObjectTypeInfo.Type))
                {
                    if (View is ListView)
                    {
                        foreach (ClassStockTransferDocument dtl in View.SelectedObjects)
                        {
                            oids.Add(dtl.Oid);
                        }
                    }
                    else if (View is DetailView)
                    {
                        oids.Add(((ClassStockTransferDocument)View.CurrentObject).Oid);
                    }
                }

                if (oids.Count > 0)
                {
                    string temp = "";
                    foreach (int dtl in oids)
                    {
                        if (temp == "")
                        {
                            temp = dtl.ToString();
                        }
                        else
                        {
                            temp += "," + dtl.ToString();
                        }
                    }
                    IObjectSpace  objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
                    IReportDataV2 reportData  = objectSpace.FindObject <ReportDataV2>(CriteriaOperator.Parse("[DisplayName] = '" + reportname + "'"));
                    objectSpace.Dispose();
                    string handle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
                    Frame.GetController <ReportServiceController>().ShowPreview(handle, CriteriaOperator.Parse("Oid in (" + temp + ")"));
                }
            }
        }
        private static void ExportReport(IReportDataV2 reportData, IObjectSpaceProvider objectSpaceProvider)
        {
            XtraReport report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            MyReportDataSourceHelper reportDataSourceHelper = new MyReportDataSourceHelper(objectSpaceProvider);

            ReportDataProvider.ReportObjectSpaceProvider = new MyReportObjectSpaceProvider(objectSpaceProvider);
            reportDataSourceHelper.SetupBeforePrint(report);
            report.ExportToPdf("test.pdf");
        }
        protected override void PrintReport(IReportDataV2 reportData)
        {
            XtraReport      report        = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            ReportsModuleV2 reportsModule = ReportsModuleV2.FindReportsModule(Application.Modules);

            if (reportsModule != null && reportsModule.ReportsDataSourceHelper != null)
            {
                reportsModule.ReportsDataSourceHelper.SetupBeforePrint(report);
                report.PrintDialog();
            }
        }
Example #7
0
        protected override void PrintReport(IReportDataV2 reportData)
        {
            XtraReport report = ReportDataProvider.ReportsStorage.LoadReport(reportData);

            ReportsModuleV2 reportsModule = ReportsModuleV2.FindReportsModule(Application.Modules);

            if (reportsModule != null && reportsModule.ReportsDataSourceHelper != null)
            {
                reportsModule.ReportsDataSourceHelper.SetupBeforePrint(report, null, ((ListView)View).CollectionSource.Criteria["filter"], true, null, false);
                report.Print();
            }
        }
        private void PlainReportListView_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            IObjectSpace  objectSpace           = Application.CreateObjectSpace();
            IReportDataV2 reportData            = objectSpace.FindObject <ReportDataV2>(CriteriaOperator.Parse("DisplayName = 'PilotsReport'"));
            var           reportContainerHandle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);

            ReportsModuleV2 module = ReportsModuleV2.FindReportsModule(Application.Modules);

            if (module != null)
            {
                Frame.GetController <ReportServiceController>().ShowPreview(reportContainerHandle);
            }
        }
 private void EventScheduleReport_Execute(object sender, SimpleActionExecuteEventArgs e)
 {
     try
     {
         IObjectSpace  objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
         IReportDataV2 reportData  = objectSpace.FindObject <ReportDataV2>(CriteriaOperator.Parse("[DisplayName] = 'SchedulerReport'"));
         string        handle      = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
         Frame.GetController <MyWebReportServiceController>().ShowPreview(handle, null, null, false, null, false, e.ShowViewParameters);
     }
     catch (Exception ex)
     {
     }
 }
Example #10
0
        private XtraReport Report(string ReportDisplayName)
        {
            if (ReportDataProvider.ReportsStorage.ReportDataType != null)
            {
                return(ReportDataProvider.ReportsStorage.LoadReport(this.ReportData(ReportDisplayName)));
            }
            else
            {
                IReportDataV2   reportData = ReportObjectSpaceProvider.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", ReportDisplayName));
                ReportContainer container  = new ReportContainer(reportData);

                return(container.Report);
            }
        }
 protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs e)
 {
     base.ShowNavigationItem(e);
     if (e.SelectedChoiceActionItem != null)
     {
         var model = e.SelectedChoiceActionItem.Model as IModelNavigationItemReport;
         if (model != null && !string.IsNullOrEmpty(model.ReportName))
         {
             IObjectSpace            objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
             IReportDataV2           reportData  = objectSpace.FindObject <ReportDataV2>(CriteriaOperator.Parse("DisplayName = ?", model.ReportName));
             string                  handle      = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
             ReportServiceController controller  = Frame.GetController <ReportServiceController>();
             if (controller != null)
             {
                 controller.ShowPreview(handle);
             }
         }
     }
 }
        protected override object CreateControlCore()
        {
            _reportsModuleV2 = ReportsModuleV2.FindReportsModule(_application.Modules);
            var reportDataType = _reportsModuleV2.ReportDataType;

            _reportData = (IReportDataV2)View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("DisplayName=?", Model.ReportName));
            string handle = ReportDataProvider.ReportsStorage.GetReportContainerHandle(_reportData);

            if (_reportData == null)
            {
                throw new NullReferenceException(string.Format("Report {0} not found", Model.ReportName));
            }
            report = ReportDataProvider.ReportsStorage.LoadReport(_reportData);
            report.DataSourceDemanded += report_DataSourceDemanded;
            ASPxWebDocumentViewer viewer = CreateASPxWebDocumentViewer();

            viewer.OpenReport(report);
            return(viewer);
        }
Example #13
0
        public PrintContactsController()
        {
            SimpleAction printAction = new SimpleAction(this, "PrintContacts", PredefinedCategory.Reports);

            printAction.ImageName = "Action_Printing_Print";
            printAction.Execute  += delegate(object sender, SimpleActionExecuteEventArgs e) {
                IObjectSpace  objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
                IReportDataV2 reportData  = objectSpace.FindObject <ReportDataV2>(
                    new BinaryOperator("DisplayName", "Contacts Report"));
                if (reportData == null)
                {
                    throw new UserFriendlyException("Cannot find the 'Contacts Report' report.");
                }
                else
                {
                    PrintReport(reportData);
                }
            };
        }
Example #14
0
        private void actionReportPilots_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            IObjectSpace            objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
            IReportDataV2           reportData  = objectSpace.FindObject <ReportDataV2>(CriteriaOperator.Parse("[DisplayName] = 'Пилоты самолеты'"));
            string                  handle      = ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData);
            ReportServiceController controller  = Frame.GetController <ReportServiceController>();

            CriteriaOperator criteriaId = null;

            if (View.Id == "Pilot_DetailView" && View.SelectedObjects.Count == 1)
            {
                criteriaId = CriteriaOperator.Parse("[Oid] = ?", ((Pilot)View.SelectedObjects[0]).Oid.ToString());
            }

            if (controller != null)
            {
                controller.ShowPreview(handle, criteriaId);
            }
        }
Example #15
0
        public void PrintPO()
        //public void PrintPO(ItemPurchaseOrder sender)
        {
            DevExpress.XtraEditors.XtraMessageBox.Show("Printing PO -" + PurchaseOrderNumber, "Print Po");

            string reportname = "poPrintRPT";

            IObjectSpace  objectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
            IReportDataV2 reportData  = objectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", reportname));

            if (reportData == null)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("Unable to find -" + reportname);
                throw new UserFriendlyException("Cannot find the 'Contacts Report' report.");
            }
            else
            {
                //PrintReport(reportData);
            }
        }
        private void simpleReport_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            IReportDataV2 reportData = View.ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", "Pilot Report"));

            DevExpress.XtraReports.UI.XtraReport report = ReportDataProvider.ReportsStorage.LoadReport(reportData);
            IObjectSpace    objectSpace = Application.CreateObjectSpace(typeof(rb_Pilot));
            List <rb_Pilot> list        = new List <rb_Pilot>();

            list.Add(objectSpace.FindObject <rb_Pilot>(new BinaryOperator("Id", $"{(View.SelectedObjects[0] as rb_Pilot)?.Id ?? 0}")));
            report.DataSource = list;
            ReportsModuleV2.FindReportsModule(Application.Modules).ReportsDataSourceHelper.SetupBeforePrint(report);
            using (ReportPrintTool printTool = new ReportPrintTool(report)) {
                // Invoke the Print Preview form modally,
                // and load the report document into it.
                printTool.ShowPreviewDialog();

                // Invoke the Print Preview form
                // with the specified look and feel setting.
                //printTool.ShowPreviewDialog(UserLookAndFeel.Default);
            }
        }
Example #17
0
        private void ParametrizedAction_Execute(object sender, ParametrizedActionExecuteEventArgs e)
        {
            //IObjectSpace objectSpace = Application.CreateObjectSpace();
            string   parameter = e.ParameterCurrentValue as string;
            ListView view      = (ListView)View;

            if (!string.IsNullOrWhiteSpace(parameter))
            {
                view.CollectionSource.Criteria["filter"] = CriteriaOperator.Parse("[条形码]=? OR [京东码]=? OR [旧京东码]=?", parameter, parameter, parameter);
                view.CollectionSource.ResetCollection();
                if (view.CollectionSource.GetCount() != 0)
                {
                    IObjectSpace  rptObjectSpace = ReportDataProvider.ReportObjectSpaceProvider.CreateObjectSpace(typeof(ReportDataV2));
                    IReportDataV2 reportData     = rptObjectSpace.FindObject <ReportDataV2>(
                        new BinaryOperator("DisplayName", "入库标签"));
                    if (reportData == null)
                    {
                        throw new UserFriendlyException("Cannot find the '入库标签' report.");
                    }
                    else
                    {
                        PrintReport(reportData);
                    }
                }
            }
            else
            {
                view.CollectionSource.Criteria.Remove("filter");
                view.CollectionSource.ResetCollection();
            }
            //object obj = objectSpace.FindObject(((ListView)View).ObjectTypeInfo.Type, CriteriaOperator.Parse("[条形码]=? OR [京东码]=? OR [旧京东码]=?", parameter, parameter, parameter));
            //if (obj != null)
            //{
            //DetailView detailView = Application.CreateDetailView(objectSpace, obj);
            //detailView.ViewEditMode = ViewEditMode.Edit;
            //e.ShowViewParameters.CreatedView = detailView;

            //}
        }
Example #18
0
        private void ImprFto(string format, bool imprime, bool pdf, string nameF)
        {
            if (View != null && View.ObjectSpace != null)
            {
                XPObjectSpace objectSpace = (XPObjectSpace)View.ObjectSpace;
                NominaItem    fac         = View.CurrentObject as NominaItem;
                if (fac != null)
                {
                    Session uow = fac.Session;
                    //ReportData reportData = uow.FindObject<ReportData>(new BinaryOperator("Name", format));
                    // XPCollection dosyas = new XPCollection(fac.Session, typeof(NominaItem), false);
                    //XafReport report = null;
                    NominaItem doc = fac;

                    IReportDataV2 reportData2 = objectSpace.FindObject <ReportDataV2>(
                        new BinaryOperator("DisplayName", format));

                    if (doc != null)
                    {
                        doc.Empresa = uow.FindObject <Empresa>(/*CriteriaOperator.Parse("Clave = 'icpac'")*/ null);

                        if (doc.Status == NominaItemStatus.Alta)
                        {
                            if (doc.Empleado != null)
                            {
                                doc.Empleado.Reload();
                            }
                        }

                        QRCode2(doc);

                        /*
                         * if (reportData != null)
                         * {
                         *  report = reportData.LoadReport(objectSpace) as XafReport;
                         *  report.ObjectSpace = objectSpace;
                         *  dosyas.Add(doc);
                         *  report.DataSource = dosyas;
                         *
                         *  if (pdf)
                         *  {
                         *      report.ExportToPdf(nameF);
                         *  }
                         *  if (imprime)
                         *  {
                         *      try
                         *      {
                         *          ReportPrintTool printTool = new ReportPrintTool(report);
                         *
                         *          // Solo funciona para windows !!
                         *          printTool.ShowPreviewDialog();
                         *      }
                         *      catch (Exception)
                         *      {
                         *      }
                         *  }
                         * }*/

                        if (reportData2 != null)
                        {
                            string reportContainerHandler =
                                ReportDataProvider.ReportsStorage.GetReportContainerHandle(reportData2);

                            XtraReport report2 = ReportDataProvider.ReportsStorage.LoadReport(reportData2);

                            List <NominaItem> list = new List <NominaItem>();
                            list.Add(doc);

                            report2.DataSource = list;

                            if (pdf)
                            {
                                string namF = NegocioNom.NamePdf(doc);

                                DEFile       fd = new DEFile(doc.Session);
                                MemoryStream ms = new MemoryStream();

                                report2.ExportToPdf(ms);
                                ms.Seek(0, SeekOrigin.Begin);

                                fd.File = new FileData(doc.Session);
                                fd.File.LoadFromStream(Path.GetFileName(namF), ms);
                                fd.TpArchv = ETipoArchivo.Pdf;

                                doc.DElctrnc.Archivos.Add(fd);
                            }
                            if (imprime)
                            {
                                try
                                {
                                    ReportsModuleV2.FindReportsModule(Application.Modules).ReportsDataSourceHelper.SetupBeforePrint(report2);

                                    report2.ShowPreview();
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }

                        // dosyas.Dispose();
                    }
                }
            }
        }
Example #19
0
 protected abstract void PrintReport(IReportDataV2 reportData);
Example #20
0
 protected virtual void PrintReport(IReportDataV2 reportData)
 {
 }