示例#1
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //ProcessReportFinanceDocumentPayment

        public static string ProcessReportFinanceDocumentPayment(CustomReportDisplayMode pViewMode, Guid pDocumentFinancePaymentOid, List <int> pCopyNames, string pDestinationFileName = "")
        {
            string result = String.Empty;

            try
            {
                string       fileUserReportDocumentFinancePayment = FrameworkUtils.OSSlash(string.Format("{0}{1}\\{2}", GlobalFramework.Path["reports"], "UserReports", "ReportDocumentFinancePayment.frx"));
                CustomReport customReport = new CustomReport(fileUserReportDocumentFinancePayment, pCopyNames);

                //Get Result Objects from FRBOHelper
                ResultFRBODocumentFinancePayment fRBOHelperResponseProcessReportFinancePayment = FRBOHelper.GetFRBOFinancePayment(pDocumentFinancePaymentOid);
                //Get Generic Collections From FRBOHelper Results
                FRBOGenericCollection <FRBODocumentFinancePaymentView> gcDocumentFinancePayment = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment;

                //Prepare and Enable DataSources
                customReport.RegisterData(gcDocumentFinancePayment, "DocumentFinancePayment");
                if (customReport.GetDataSource("DocumentFinancePayment") != null)
                {
                    customReport.GetDataSource("DocumentFinancePayment").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinancePayment.DocumentFinancePaymentDocument") != null)
                {
                    customReport.GetDataSource("DocumentFinancePayment.DocumentFinancePaymentDocument").Enabled = true;
                }

                //Add ReportInfo.Name, to be used for Ex in Pdf Filenames, OS etc
                customReport.ReportInfo.Name = gcDocumentFinancePayment.List[0].PaymentRefNo;
                result = customReport.Process(pViewMode, pDestinationFileName);
                customReport.Dispose();

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                throw new Exception(ex.Message);
            }
        }
示例#2
0
        public static string ProcessReportFinanceDocument(CustomReportDisplayMode pViewMode, Guid pDocumentFinanceMasterOid, string pHash4Chars, List <int> pCopyNames, bool pSecondCopy, string pMotive, string pDestinationFileName = "")
        {
            string result = String.Empty;

            try
            {
                //TODO: Move This to CustomReport SubClasses ex Filename, Params, DataSources etc

                //Get DocumentFinanceMaster
                FIN_DocumentFinanceMaster documentMaster = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), pDocumentFinanceMasterOid);

                // Build Final Filename Report
                string fileName = (documentMaster.DocumentType.WayBill) ? "ReportDocumentFinanceWayBill.frx" : "ReportDocumentFinance.frx";
                string fileUserReportDocumentFinance = FrameworkUtils.OSSlash(string.Format("{0}{1}\\{2}", GlobalFramework.Path["reports"], "UserReports", fileName));

                CustomReport customReport = new CustomReport(fileUserReportDocumentFinance, pCopyNames);
                customReport.DoublePass = (documentMaster.DocumentDetail.Count > SettingsApp.CustomReportReportDocumentFinanceMaxDetail);
                customReport.Hash4Chars = pHash4Chars;
                //Report Parameters
                //customReport.SetParameterValue("Invoice Noº", 280);

                //Get Result Objects from FRBOHelper
                ResultFRBODocumentFinanceMaster fRBOHelperResponseProcessReportFinanceDocument = FRBOHelper.GetFRBOFinanceDocument(pDocumentFinanceMasterOid);
                //Get Generic Collections From FRBOHelper Results
                FRBOGenericCollection <FRBODocumentFinanceMasterView> gcDocumentFinanceMaster = fRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster;

                //Prepare and Enable DataSources
                customReport.RegisterData(gcDocumentFinanceMaster, "DocumentFinanceMaster");
                if (customReport.GetDataSource("DocumentFinanceMaster") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceDetail") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceDetail").Enabled = true;
                }
                if (customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceMasterTotal") != null)
                {
                    customReport.GetDataSource("DocumentFinanceMaster.DocumentFinanceMasterTotal").Enabled = true;
                }

                //Scripts - Dont Delete this Comment, may be usefull if we remove Script from Report File
                //Print X Records per Data Band
                //FastReport.DataBand dataBand = (DataBand) customReport.FindObject("Data1");
                //int dataBandRec = 1;
                ////Used to Break Page on X Recs, Usefull to leave open space for Report Summary
                //int dataBandMaxRecs = 30;
                //dataBand.AfterPrint += delegate {
                //  Console.WriteLine(string.Format("dataBandRec.RowNo:[{0}], dataBandMaxRecs:[{1}], , dataBand.RowNo[{2}], report.Pages.Count[{3}]", dataBandRec, dataBandMaxRecs, dataBand.RowNo, report.Pages.Count));
                //  if (dataBandRec == dataBandMaxRecs) {
                //    dataBandRec = 1;
                //    dataBand.StartNewPage = true;
                //  }
                //  else
                //  {
                //    dataBandRec++;
                //    dataBand.StartNewPage = false;
                //  };
                //};

                //Assign Second Copy Reference
                _secondCopy = pSecondCopy;

                //Add ReportInfo.Name, to be used for Ex in Pdf Filenames, OS etc
                customReport.ReportInfo.Name = gcDocumentFinanceMaster.List[0].DocumentNumber;
                result = customReport.Process(pViewMode, pDestinationFileName);
                customReport.Dispose();

                return(result);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                throw new Exception(ex.Message);
            }
        }
示例#3
0
        public static void Print(sys_configurationprinters pPrinter)
        {
            try
            {
                ThermalPrinterGeneric thermalPrinterGeneric = new ThermalPrinterGeneric(pPrinter);

                List <TicketColumn> columns = new List <TicketColumn>();
                columns.Add(new TicketColumn("Code", "Code", 6, TicketColumnsAlign.Right));
                columns.Add(new TicketColumn("Designation", CustomFunctions.Res("global_designation"), 0));
                columns.Add(new TicketColumn("Quantity", "Qnt", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("UnitMeasure", "UM", 3));
                columns.Add(new TicketColumn("Price", "Preço", 10, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Tax", "Taxa", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Discount", "Desc", 7, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));
                columns.Add(new TicketColumn("Total", "Total", 11, TicketColumnsAlign.Right, typeof(decimal), "{0:0.00}"));

                string sql = string.Format(@"
                    SELECT 
                        Code,Designation,Quantity,UnitMeasure,Price,Vat,Discount,TotalFinal
                    FROM 
                        fin_documentfinancedetail 
                    WHERE 
                        DocumentMaster = '{0}'
                    ORDER 
                        BY Ord
                    ;",
                                           SettingsApp.XpoPrintFinanceDocument
                                           );
                TicketTable ticketTable = new TicketTable(sql, columns, thermalPrinterGeneric.MaxCharsPerLineSmall);
                ticketTable.Print(thermalPrinterGeneric);
                //Cut
                thermalPrinterGeneric.Cut(true);
                //Print Buffer
                thermalPrinterGeneric.PrintBuffer();

                //Get Result Objects
                ResultFRBODocumentFinanceMaster           FRBOHelperResponseProcessReportFinanceDocument = FRBOHelper.GetFRBOFinanceDocument(SettingsApp.XpoPrintFinanceDocument);
                List <FRBODocumentFinanceMasterView>      gcDocumentFinanceMaster      = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List;
                List <FRBODocumentFinanceDetail>          gcDocumentFinanceDetail      = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceDetail;
                List <FRBODocumentFinanceMasterTotalView> gcDocumentFinanceMasterTotal = FRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceMasterTotal;;

                _log.Debug(string.Format("DocumentNumber: [{0}]", gcDocumentFinanceMaster[0].DocumentNumber));

                foreach (FRBODocumentFinanceDetail item in gcDocumentFinanceDetail)
                {
                    _log.Debug(string.Format("Designation: [{0}], Price: [{1}]", item.Designation, item.Price));
                }

                foreach (FRBODocumentFinanceMasterTotalView item in gcDocumentFinanceMasterTotal)
                {
                    _log.Debug(string.Format("Designation: [{0}], Value :[{1}]", item.Designation, item.Value));
                }

                Dictionary <string, string> CustomVars = GlobalFramework.FastReportCustomVars;
                _log.Debug(string.Format("Company_Name: [{0}]", CustomVars["Company_Name"]));

                //ThermalPrinterFinanceDocument thermalPrinterFinanceDocument = new ThermalPrinterFinanceDocument(pPrinter);
                //thermalPrinterFinanceDocument.Print();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public ThermalPrinterFinanceDocumentPayment(SYS_ConfigurationPrinters pPrinter, FIN_DocumentFinancePayment pDocumentFinancePayment, List <int> pCopyNames, bool pSecondCopy)
            : base(pPrinter, pDocumentFinancePayment.DocumentType, pCopyNames, pSecondCopy)
        {
            try
            {
                //Parameters
                _documentFinancePayment = pDocumentFinancePayment;

                //Init Fast Reports Business Objects (From FRBOHelper)
                ResultFRBODocumentFinancePayment fRBOHelperResponseProcessReportFinancePayment = FRBOHelper.GetFRBOFinancePayment(pDocumentFinancePayment.Oid);
                //Get FRBOs Lists
                _documentFinancePaymentList         = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment.List;
                _documentFinancePaymentDocumentList = fRBOHelperResponseProcessReportFinancePayment.DocumentFinancePayment.List[0].DocumentFinancePaymentDocument;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public ThermalPrinterFinanceDocumentMaster(sys_configurationprinters pPrinter, fin_documentfinancemaster pDocumentMaster, List <int> pCopyNames, bool pSecondCopy, string pMotive)
            : base(pPrinter, pDocumentMaster.DocumentType, pCopyNames, pSecondCopy)
        {
            try
            {
                //Parameters
                _documentMaster = pDocumentMaster;

                //Init Fast Reports Business Objects (From FRBOHelper)
                ResultFRBODocumentFinanceMaster fRBOHelperResponseProcessReportFinanceDocument = FRBOHelper.GetFRBOFinanceDocument(_documentMaster.Oid);
                //Get FRBOs Lists
                _documentFinanceMasterList      = fRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List;
                _documentFinanceDetailList      = fRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceDetail;
                _documentFinanceMasterTotalList = fRBOHelperResponseProcessReportFinanceDocument.DocumentFinanceMaster.List[0].DocumentFinanceMasterTotal;;
            }
            catch (Exception ex)
            {
                _log.Debug("ThermalPrinterFinanceDocumentMaster(sys_configurationprinters pPrinter, fin_documentfinancemaster pDocumentMaster, List<int> pCopyNames, bool pSecondCopy, string pMotive) :: " + ex.Message, ex);
                throw ex;
            }
        }