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);
        }
Beispiel #5
0
        protected virtual void RedirectToResultNoBatch(APReleaseChecks pp, Dictionary <string, string> d, PaymentMethod paymenttype, bool printAdditionRemit, string NextCheckNbr)
        {
            d[ReportMessages.CheckReportFlag] = ReportMessages.CheckReportFlagValue;
            var requiredException = new PXReportRequiredException(d, paymenttype.APCheckReportID,
                                                                  PXBaseRedirectException.WindowMode.New, "Check");

            if (paymenttype.APPrintRemittance == true &&
                !string.IsNullOrEmpty(paymenttype.APRemittanceReportID) &&
                printAdditionRemit)
            {
                Dictionary <string, string> p = new Dictionary <string, string>(d);
                p["StartCheckNbr"] = "";
                p["EndCheckNbr"]   = NextCheckNbr;
                requiredException.SeparateWindows = true;
                requiredException.AddSibling(paymenttype.APRemittanceReportID, p);
            }
            throw new PXRedirectWithReportException(pp, requiredException, "Preview");
        }
        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());
        }
Beispiel #7
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;
            }
        }
        protected virtual void DoTransfer(TransferFilter filter, List <FixedAsset> list)
        {
            DocumentList <FARegister> created = new DocumentList <FARegister>(this);

            foreach (FixedAsset asset in list)
            {
                FADetails det = PXSelect <FADetails, Where <FADetails.assetID, Equal <Current <FixedAsset.assetID> > > > .SelectSingleBound(this, new object[] { asset });

                FALocationHistory location = PXSelect <FALocationHistory, Where <FALocationHistory.assetID, Equal <Current <FADetails.assetID> >, And <FALocationHistory.revisionID, Equal <Current <FADetails.locationRevID> > > > > .SelectSingleBound(this, new object[] { det });

                int?   destClassID  = filter.ClassTo ?? asset.ClassID;
                int?   destBranchID = filter.BranchTo ?? location.LocationID;
                string destDeptID   = string.IsNullOrEmpty(filter.DepartmentTo) ? location.Department : filter.DepartmentTo;

                if (location.LocationID != destBranchID || location.Department != destDeptID || asset.ClassID != destClassID)
                {
                    FADetails         copy_det = (FADetails)Details.Cache.CreateCopy(det);
                    FALocationHistory copy_loc = (FALocationHistory)Lochist.Cache.CreateCopy(location);
                    copy_loc.RevisionID      = ++copy_det.LocationRevID;
                    copy_loc.LocationID      = destBranchID;
                    copy_loc.Department      = destDeptID;
                    copy_loc.PeriodID        = filter.PeriodID;
                    copy_loc.TransactionDate = filter.TransferDate;
                    copy_loc.Reason          = filter.Reason;

                    TransactionEntry.SegregateRegister(this, (int)destBranchID, FARegister.origin.Transfer, null, filter.TransferDate, "", created);

                    Details.Update(copy_det);
                    location = Lochist.Insert(copy_loc);

                    if (asset.ClassID != destClassID)
                    {
                        asset.ClassID = destClassID;
                        AssetSelect.Cache.Update(asset);
                    }

                    FARegister reg = Register.Current;
                    AssetProcess.TransferAsset(this, asset, location, ref reg);
                }
            }
            if (Register.Current != null && created.Find(Register.Current) == null)
            {
                created.Add(Register.Current);
            }
            Actions.PressSave();
            if (fasetup.Current.AutoReleaseTransfer == true)
            {
                SelectTimeStamp();
                PXLongOperation.StartOperation(this, delegate { AssetTranRelease.ReleaseDoc(created, false); });
            }
            else if (created.Count > 0)
            {
                AssetTranRelease graph = CreateInstance <AssetTranRelease>();
                AssetTranRelease.ReleaseFilter fltr = (AssetTranRelease.ReleaseFilter)graph.Filter.Cache.CreateCopy(graph.Filter.Current);
                fltr.Origin = FARegister.origin.Transfer;
                graph.Filter.Update(fltr);
                graph.SelectTimeStamp();

                Dictionary <string, string> parameters = new Dictionary <string, string>();

                for (int i = 0; i < created.Count; ++i)
                {
                    FARegister reg = created[i];
                    reg.Selected = true;
                    graph.FADocumentList.Update(reg);
                    graph.FADocumentList.Cache.SetStatus(reg, PXEntryStatus.Updated);
                    graph.FADocumentList.Cache.IsDirty = false;

                    parameters["FARegister.RefNbr" + i] = reg.RefNbr;
                }

                parameters["PeriodFrom"] = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID);
                parameters["PeriodTo"]   = FinPeriodIDFormattingAttribute.FormatForDisplay(filter.PeriodID);
                parameters["Mode"]       = "U";

                PXReportRequiredException reportex = new PXReportRequiredException(parameters, "FA642000", "Preview");
                throw new PXRedirectWithReportException(graph, reportex, "Release FA Transaction");
            }
        }
Beispiel #9
0
        protected virtual void PrintPayments(List <APPayment> list, PrintChecksFilter filter, PaymentMethod paymentMethod)
        {
            if (list.Count == 0)
            {
                return;
            }

            if (paymentMethod.UseForAP == true)
            {
                if (paymentMethod.APPrintChecks == true && string.IsNullOrEmpty(paymentMethod.APCheckReportID))
                {
                    throw new PXException(Messages.FieldNotSetInPaymentMethod, PXUIFieldAttribute.GetDisplayName <PaymentMethod.aPCheckReportID>(paymenttype.Cache), paymentMethod.PaymentMethodID);
                }

                if (paymentMethod.APPrintChecks == true && paymentMethod.APPrintRemittance == true && string.IsNullOrEmpty(paymentMethod.APRemittanceReportID))
                {
                    throw new PXException(Messages.FieldNotSetInPaymentMethod, PXUIFieldAttribute.GetDisplayName <PaymentMethod.aPRemittanceReportID>(paymenttype.Cache), paymentMethod.PaymentMethodID);
                }
            }

            bool printAdditionRemit = false;

            if (paymentMethod.APCreateBatchPayment == true)
            {
                CABatch batch = CreateBatchPayment(list, filter);
                if (batch != null)
                {
                    bool           failed = false;
                    APPaymentEntry pe     = CreateInstance <APPaymentEntry>();

                    string NextCheckNbr = filter.NextCheckNbr;
                    foreach (APPayment pmt in list)
                    {
                        APPayment payment = pmt;
                        PXProcessing <APPayment> .SetCurrentItem(payment);

                        try
                        {
                            payment = pe.Document.Search <APPayment.refNbr>(payment.RefNbr, payment.DocType);
                            if (payment.PrintCheck != true)
                            {
                                throw new PXException(Messages.CantPrintNonprintableCheck);
                            }
                            if ((payment.DocType == APDocType.Check || payment.DocType == APDocType.QuickCheck) &&
                                payment.Status != APDocStatus.PendingPrint)
                            {
                                throw new PXException(Messages.ChecksMayBePrintedInPendingPrintStatus);
                            }

                            AssignNumbers(pe, payment, ref NextCheckNbr, true);

                            if (payment.Passed == true)
                            {
                                pe.TimeStamp = payment.tstamp;
                            }
                            pe.Save.Press();
                            payment.tstamp = pe.TimeStamp;
                            pe.Clear();
                        }
                        catch (PXException e)
                        {
                            PXProcessing <APPayment> .SetError(e);

                            failed = true;
                        }
                    }
                    if (failed)
                    {
                        throw new PXOperationCompletedWithErrorException(Messages.APPaymentsAreAddedToTheBatchButWasNotUpdatedCorrectly, batch.BatchNbr);
                    }
                    RedirectToResultWithCreateBatch(batch);
                }
            }
            else
            {
                APReleaseChecks     pp          = CreateInstance <APReleaseChecks>();
                ReleaseChecksFilter filter_copy = PXCache <ReleaseChecksFilter> .CreateCopy(pp.Filter.Current);

                filter_copy.PayAccountID = filter.PayAccountID;
                filter_copy.PayTypeID    = filter.PayTypeID;
                filter_copy.CuryID       = filter.CuryID;
                pp.Filter.Cache.Update(filter_copy);

                APPaymentEntry pe             = CreateInstance <APPaymentEntry>();
                bool           failed         = false;
                Dictionary <string, string> d = new Dictionary <string, string>();

                string nextCheckNbr = filter.NextCheckNbr;
                string prevCheckNbr = nextCheckNbr;

                int idxReportFilter = 0;
                foreach (APPayment pmt in list)
                {
                    APPayment payment = pmt;
                    PXProcessing <APPayment> .SetCurrentItem(payment);

                    try
                    {
                        prevCheckNbr = nextCheckNbr;
                        if (filter.IsNextNumberDuplicated(this, nextCheckNbr))
                        {
                            string duplicate = nextCheckNbr;
                            nextCheckNbr = AutoNumberAttribute.NextNumber(nextCheckNbr);
                            throw new PXException(Messages.ConflictWithExistingCheckNumber, duplicate);
                        }

                        payment = pe.Document.Search <APPayment.refNbr>(payment.RefNbr, payment.DocType);
                        if (payment.PrintCheck != true)
                        {
                            throw new PXException(Messages.CantPrintNonprintableCheck);
                        }
                        if ((payment.DocType == APDocType.Check || payment.DocType == APDocType.QuickCheck) &&
                            payment.Status != APDocStatus.PendingPrint)
                        {
                            throw new PXException(Messages.ChecksMayBePrintedInPendingPrintStatus);
                        }
                        AssignNumbers(pe, payment, ref nextCheckNbr);

                        if (payment.Passed == true)
                        {
                            pe.TimeStamp = payment.tstamp;
                        }
                        pe.Save.Press();
                        payment.tstamp = pe.TimeStamp;
                        pe.Clear();

                        APPayment seldoc = pe.Document.Search <APPayment.refNbr>(payment.RefNbr, payment.DocType);
                        seldoc.Selected = true;
                        seldoc.Passed   = true;
                        seldoc.tstamp   = payment.tstamp;
                        pp.APPaymentList.Cache.Update(seldoc);
                        pp.APPaymentList.Cache.SetStatus(seldoc, PXEntryStatus.Updated);

                        printAdditionRemit |= seldoc.BillCntr > paymentMethod.APStubLines;

                        StringBuilder sbDocType = new StringBuilder("APPayment.DocType");
                        sbDocType.Append(Convert.ToString(idxReportFilter));
                        StringBuilder sbRefNbr = new StringBuilder("APPayment.RefNbr");
                        sbRefNbr.Append(Convert.ToString(idxReportFilter));

                        idxReportFilter++;

                        d[sbDocType.ToString()] = payment.DocType == APDocType.QuickCheck ? APDocType.QuickCheck : APDocType.Check;
                        d[sbRefNbr.ToString()]  = payment.RefNbr;
                        PXProcessing <APPayment> .SetProcessed();
                    }
                    catch (PXException e)
                    {
                        PXProcessing <APPayment> .SetError(e);

                        failed       = true;
                        nextCheckNbr = prevCheckNbr;
                    }
                }

                if (failed)
                {
                    PXReportRequiredException report = null;
                    if (d.Count > 0)
                    {
                        d[ReportMessages.CheckReportFlag] = ReportMessages.CheckReportFlagValue;
                        report = new PXReportRequiredException(d, paymentMethod.APCheckReportID, PXBaseRedirectException.WindowMode.New, "Check");
                    }
                    throw new PXOperationCompletedWithErrorException(GL.Messages.DocumentsNotReleased, report);
                }
                else
                {
                    if (d.Count > 0)
                    {
                        RedirectToResultNoBatch(pp, d, paymentMethod, printAdditionRemit, nextCheckNbr);
                    }
                }
            }
        }
Beispiel #10
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;
            }
        }
Beispiel #11
0
        protected virtual void PrintPayments(List <APPayment> list, PrintChecksFilter filter, PaymentMethod paymenttype)
        {
            if (list.Count == 0)
            {
                return;
            }

            bool printAdditionRemit = false;

            if (paymenttype.APCreateBatchPayment == true)
            {
                CABatch batch = CreateBatchPayment(list, filter);
                if (batch != null)
                {
                    bool           failed = false;
                    APPaymentEntry pe     = PXGraph.CreateInstance <APPaymentEntry>();

                    string NextCheckNbr = filter.NextCheckNbr;
                    for (int i = 0; i < list.Count; i++)
                    {
                        try
                        {
                            AssignNumbers(pe, list[i], ref NextCheckNbr, true);

                            if (list[i].Passed == true)
                            {
                                pe.TimeStamp = list[i].tstamp;
                            }
                            pe.Save.Press();
                            list[i].tstamp = pe.TimeStamp;
                            pe.Clear();
                            APPayment seldoc = (APPayment)pe.Document.Search <APPayment.refNbr>(list[i].RefNbr, list[i].DocType);
                            printAdditionRemit = seldoc.BillCntr > paymenttype.APStubLines;
                        }
                        catch (Exception e)
                        {
                            PXProcessing <APPayment> .SetError(i, e);

                            failed = true;
                        }
                    }
                    if (failed)
                    {
                        throw new PXOperationCompletedException(Messages.APPaymentsAreAddedToTheBatchButWasNotUpdatedCorrectly, batch.BatchNbr);
                    }
                    else
                    {
                        RedirectToResultWithCreateBatch(batch);
                    }
                }
            }
            else
            {
                APReleaseChecks     pp          = PXGraph.CreateInstance <APReleaseChecks>();
                ReleaseChecksFilter filter_copy = PXCache <ReleaseChecksFilter> .CreateCopy(pp.Filter.Current);

                filter_copy.PayAccountID = filter.PayAccountID;
                filter_copy.PayTypeID    = filter.PayTypeID;
                filter_copy.CuryID       = filter.CuryID;
                pp.Filter.Cache.Update(filter_copy);

                APPaymentEntry              pe      = PXGraph.CreateInstance <APPaymentEntry>();
                bool                        failed  = false;
                List <APPayment>            paylist = new List <APPayment>(list.Count);
                Dictionary <string, string> d       = new Dictionary <string, string>();

                string NextCheckNbr = null;

                if (filter != null)
                {
                    NextCheckNbr = filter.NextCheckNbr;
                }

                int idxReportFilter = 0;

                for (int i = 0; i < list.Count; i++)
                {
                    try
                    {
                        AssignNumbers(pe, list[i], ref NextCheckNbr);

                        if (list[i].Passed == true)
                        {
                            pe.TimeStamp = list[i].tstamp;
                        }
                        pe.Save.Press();
                        list[i].tstamp = pe.TimeStamp;
                        pe.Clear();

                        APPayment seldoc = (APPayment)pe.Document.Search <APPayment.refNbr>(list[i].RefNbr, list[i].DocType);
                        seldoc.Selected = true;
                        seldoc.Passed   = true;
                        seldoc.tstamp   = list[i].tstamp;
                        pp.APPaymentList.Cache.Update(seldoc);
                        pp.APPaymentList.Cache.SetStatus(seldoc, PXEntryStatus.Updated);

                        printAdditionRemit = seldoc.BillCntr > paymenttype.APStubLines;

                        StringBuilder sbDocType = new StringBuilder("APPayment.DocType");
                        sbDocType.Append(Convert.ToString(idxReportFilter));
                        StringBuilder sbRefNbr = new StringBuilder("APPayment.RefNbr");
                        sbRefNbr.Append(Convert.ToString(idxReportFilter));

                        idxReportFilter++;

                        d[sbDocType.ToString()] = list[i].DocType == APDocType.QuickCheck ? APDocType.QuickCheck : APDocType.Check;
                        d[sbRefNbr.ToString()]  = list[i].RefNbr;
                    }
                    catch (Exception e)
                    {
                        PXProcessing <APPayment> .SetError(i, e);

                        failed = true;
                    }
                }

                if (failed)
                {
                    if (d.Count > 0)
                    {
                        d[ReportMessages.CheckReportFlag] = ReportMessages.CheckReportFlagValue;
                        var requiredException = new PXReportRequiredException(d, paymenttype.APCheckReportID,
                                                                              PXBaseRedirectException.WindowMode.New, "Check");
                        throw new PXException(GL.Messages.DocumentsNotReleased, requiredException);
                    }
                    throw new PXOperationCompletedException(GL.Messages.DocumentsNotReleased);
                }
                else
                {
                    if (d.Count > 0)
                    {
                        RedirectToResultNoBatch(pp, d, paymenttype, printAdditionRemit, NextCheckNbr);
                    }
                }
            }
        }
        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);
            }
        }