public System.Collections.IEnumerable PrintReport(PXAdapter adapter)
        {
            if (this.Details.Current != null && this.Filter.Current != null)
            {
                if (this.Filter.Current.CustomerID.HasValue)
                {
                    Customer customer = PXSelect <Customer,
                                                  Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                        .Select(this, Filter.Current.CustomerID);

                    if (customer != null)
                    {
                        Dictionary <string, string> parameters = ARStatementReportParams.FromCustomer(customer);
                        Export(parameters, this.Details.Current);

                        string reportID       = ARStatementReportParams.ReportIDForCustomer(this, customer, this.Details.Current.BranchID);
                        var    reportRequired = PXReportRequiredException.CombineReport(
                            null,
                            reportID,
                            parameters);

                        if (reportRequired != null)
                        {
                            throw reportRequired;
                        }
                    }
                }
            }
            return(Filter.Select());
        }
        public static void Print(PrintParameters filter, List <DetailsResult> list, bool markOnly)
        {
            bool failed = false;
            ARDunningLetterUpdate     graph = PXGraph.CreateInstance <ARDunningLetterUpdate>();
            PXReportRequiredException ex    = null;

            foreach (DetailsResult t in list)
            {
                int?            L   = t.DunningLetterID;
                ARDunningLetter doc = graph.DL.Select(L.Value);
                PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(t);

                if (doc.Released == false || doc.Voided == true)
                {
                    PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(CA.Messages.DocumentStatusInvalid);

                    failed = true;
                    continue;
                }
                if (markOnly)
                {
                    if (filter.ShowAll != true)
                    {
                        doc.DontPrint = true;
                        graph.docs.Cache.Update(doc);
                        PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed();
                    }
                }
                else
                {
                    Dictionary <string, string> d = new Dictionary <string, string>();
                    d["ARDunningLetter.DunningLetterID"] = L.ToString();

                    if (doc.Printed != true)
                    {
                        doc.Printed = true;
                        graph.docs.Cache.Update(doc);
                        PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed();
                    }
                    ex = PXReportRequiredException.CombineReport(ex, GetCustomerReportID(graph, "AR661000", t), d);
                }
            }


            graph.Save.Press();

            if (ex != null)
            {
                throw ex;
            }

            if (failed)
            {
                throw new PXException(Messages.OneOrMoreItemsAreNotProcessed);
            }
        }
        public virtual IEnumerable printLetter(PXAdapter adapter)
        {
            if (Document.Current != null && Document.Current.Released == true && Document.Current.Voided == false)
            {
                Document.Current.Printed = true;
                Save.Press();

                int?L = Document.Current.DunningLetterID;
                Dictionary <string, string> d = new Dictionary <string, string>();
                d["ARDunningLetter.DunningLetterID"] = L.ToString();
                PXReportRequiredException ex = null;
                ex = PXReportRequiredException.CombineReport(ex, ARDunningLetterPrint.GetCustomerReportID(this, "AR661000", Document.Current.BAccountID, Document.Current.BranchID), d);
                throw ex;
            }
            return(adapter.Get());
        }
        private void ConfigurePrintActionParameters(string reportId, int?branchId)
        {
            reportRequiredException = PXReportRequiredException.CombineReport(
                reportRequiredException, reportId,
                LienWaiverReportGenerationModel.Parameters, false);
            var reportParametersForDeviceHub = GetReportParametersForDeviceHub();
            var reportToPrint = new Dictionary <PrintSettings, PXReportRequiredException>();

            reportToPrint = SMPrintJobMaint.AssignPrintJobToPrinter(
                reportToPrint, reportParametersForDeviceHub,
                PrintEmailLienWaiversProcess.Filter.Current,
                new NotificationUtility(PrintEmailLienWaiversProcess).SearchPrinter,
                Constants.ComplianceNotification.LienWaiverNotificationSourceCd,
                reportId, reportId, branchId);
            SMPrintJobMaint.CreatePrintJobGroups(reportToPrint);
        }
        public System.Collections.IEnumerable PrintReport(PXAdapter adapter)
        {
            if (this.Details.Current != null && this.Filter.Current != null)
            {
                if (this.Filter.Current.CustomerID.HasValue)
                {
                    Customer customer = PXSelect <Customer,
                                                  Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                        .Select(this, Filter.Current.CustomerID);

                    if (customer != null)
                    {
                        Dictionary <string, string> parameters = new Dictionary <string, string>();

                        Export(parameters, this.Details.Current);
                        parameters[ARStatementReportParams.Parameters.CustomerID] = customer.AcctCD;

                        parameters[ARStatementReportParams.Parameters.PrintOnPaper] =
                            customer.PrintStatements == true ?
                            ARStatementReportParams.BoolValues.True :
                            ARStatementReportParams.BoolValues.False;
                        parameters[ARStatementReportParams.Parameters.SendByEmail] =
                            customer.SendStatementByEmail == true ?
                            ARStatementReportParams.BoolValues.True:
                            ARStatementReportParams.BoolValues.False;

                        string reportID = (customer.PrintCuryStatements ?? false) ? ARStatementReportParams.CS_CuryStatementReportID : ARStatementReportParams.CS_StatementReportID;

                        var reportRequired = PXReportRequiredException.CombineReport(null,
                                                                                     ARStatementPrint.GetCustomerReportID(this, reportID, customer.BAccountID, this.Details.Current.BranchID), parameters);
                        if (reportRequired != null)
                        {
                            throw reportRequired;
                        }
                    }
                }
            }
            return(Filter.Select());
        }
Esempio n. 6
0
        public static void Print(PrintParameters filter, List <DetailsResult> list, bool markOnly)
        {
            ARDunningLetterUpdate     graph = PXGraph.CreateInstance <ARDunningLetterUpdate>();
            PXReportRequiredException ex    = null;

            foreach (DetailsResult t in list)
            {
                int?            L   = t.DunningLetterID;
                ARDunningLetter doc = graph.DL.Select(L.Value);
                if (markOnly)
                {
                    if (filter.ShowAll != true)
                    {
                        doc.DontPrint = true;
                        graph.docs.Cache.Update(doc);
                    }
                }
                else
                {
                    Dictionary <string, string> d = new Dictionary <string, string>();
                    d["ARDunningLetter.DunningLetterID"] = L.ToString();

                    if (doc.Printed != true)
                    {
                        doc.Printed = true;
                        graph.docs.Cache.Update(doc);
                    }
                    ex = PXReportRequiredException.CombineReport(ex, GetCustomerReportID(graph, "AR661000", t), d);
                }
            }


            graph.Save.Press();

            if (ex != null)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        public static void PrintStatements(PrintParameters filter, List <DetailsResult> list, bool markOnly)
        {
            PXGraph graph   = new PXGraph();
            PXView  docview =
                filter.CuryStatements == true ?
                new PXView(graph, false, BqlCommand.CreateInstance(typeof(Select <ARStatement,
                                                                                  Where <ARStatement.statementCycleId, Equal <Required <ARStatement.statementCycleId> >,
                                                                                         And <ARStatement.statementDate, Equal <Required <ARStatement.statementDate> >,
                                                                                              And <ARStatement.statementCustomerID, Equal <Required <ARStatement.customerID> >,
                                                                                                   And <ARStatement.curyID, Equal <Required <ARStatement.curyID> > > > > > >)))
                          :
                new PXView(graph, false, BqlCommand.CreateInstance(typeof(Select <ARStatement,
                                                                                  Where <ARStatement.statementCycleId, Equal <Required <ARStatement.statementCycleId> >,
                                                                                         And <ARStatement.statementDate, Equal <Required <ARStatement.statementDate> >,
                                                                                              And <ARStatement.statementCustomerID, Equal <Required <ARStatement.customerID> > > > > >)));

            graph.Views["_ARStatement_"] = docview;
            graph.Views.Caches.Add(typeof(ARStatement));
            PXReportRequiredException ex = null;
            string reportID = (filter.CuryStatements ?? false) ?
                              ARStatementReportParams.CS_CuryStatementReportID :
                              ARStatementReportParams.CS_StatementReportID;

            foreach (DetailsResult t in list)
            {
                if (markOnly)
                {
                    if (filter.ShowAll != true)
                    {
                        foreach (ARStatement doc in docview.SelectMulti(filter.StatementCycleId, filter.StatementDate, t.CustomerID, t.CuryID))
                        {
                            doc.DontPrint = true;
                            docview.Cache.Update(doc);
                        }
                    }
                }
                else
                {
                    Dictionary <string, string> d = new Dictionary <string, string>();

                    d[ARStatementReportParams.Parameters.BranchID]     = filter.BranchCD;
                    d[ARStatementReportParams.Fields.StatementCycleID] = filter.StatementCycleId;
                    d[ARStatementReportParams.Fields.StatementDate]    = filter.StatementDate.Value.ToString("d", CultureInfo.InvariantCulture);
                    d[ARStatementReportParams.Fields.CustomerID]       = t.CustomerID.ToString();

                    if (filter.ShowAll == true)
                    {
                        d[ARStatementReportParams.Parameters.IgnorePrintFlags] = ARStatementReportParams.BoolValues.True;
                    }
                    else
                    {
                        d[ARStatementReportParams.Fields.PrintStatements] = ARStatementReportParams.BoolValues.True;
                    }
                    if (filter.CuryStatements ?? false)
                    {
                        d[ARStatementReportParams.Fields.CuryID] = t.CuryID;
                    }

                    foreach (ARStatement doc in docview.SelectMulti(filter.StatementCycleId, filter.StatementDate, t.CustomerID, t.CuryID))
                    {
                        if (doc.Printed != true)
                        {
                            doc.Printed = true;
                            docview.Cache.Update(doc);
                        }
                    }

                    ex = PXReportRequiredException.CombineReport(ex, GetCustomerReportID(graph, reportID, t), d);
                }
            }

            graph.Actions.PressSave();
            if (ex != null)
            {
                throw ex;
            }
        }
        public static void Print(PrintParameters filter, List <DetailsResult> list, bool markOnly)
        {
            bool failed = false;
            ARDunningLetterUpdate     graph = PXGraph.CreateInstance <ARDunningLetterUpdate>();
            PXReportRequiredException reportRedirectException             = null;
            Dictionary <string, PXReportRequiredException> reportsToPrint = new Dictionary <string, PXReportRequiredException>();

            foreach (DetailsResult res in list)
            {
                int?            letterID = res.DunningLetterID;
                ARDunningLetter doc      = graph.DL.Select(letterID.Value);
                PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(res);

                if (doc.Released == false || doc.Voided == true)
                {
                    PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(CA.Messages.DocumentStatusInvalid);

                    failed = true;
                    continue;
                }
                if (markOnly)
                {
                    if (filter.ShowAll != true)
                    {
                        doc.DontPrint = true;
                        graph.docs.Cache.Update(doc);
                        PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed();
                    }
                }
                else
                {
                    Dictionary <string, string> reportParameters = new Dictionary <string, string>();
                    reportParameters["ARDunningLetter.DunningLetterID"] = letterID.ToString();

                    if (doc.Printed != true)
                    {
                        doc.Printed = true;
                        graph.docs.Cache.Update(doc);
                        PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed();
                    }

                    string actualReportID = GetCustomerReportID(graph, ARReports.DunningLetterReportID, res);

                    reportRedirectException = PXReportRequiredException.CombineReport(reportRedirectException, actualReportID, reportParameters);

                    reportsToPrint = PX.SM.SMPrintJobMaint.AssignPrintJobToPrinter(reportsToPrint, reportParameters, filter, new NotificationUtility(graph).SearchPrinter, ARNotificationSource.Customer, ARReports.DunningLetterReportID, actualReportID, doc.BranchID);
                }
            }

            graph.Save.Press();

            if (reportRedirectException != null)
            {
                PX.SM.SMPrintJobMaint.CreatePrintJobGroups(reportsToPrint);

                throw reportRedirectException;
            }

            if (failed)
            {
                throw new PXException(Messages.OneOrMoreItemsAreNotProcessed);
            }
        }