public static void Release(PrintParameters filter, List <DetailsResult> list) { if (list.Count > 0) { bool failed = false; ARDunningLetterMaint graph = PXGraph.CreateInstance <ARDunningLetterMaint>(); int i = 0; foreach (DetailsResult res in list) { try { ARDunningLetter doc = PXSelect <ARDunningLetter, Where <ARDunningLetter.dunningLetterID, Equal <Required <DetailsResult.dunningLetterID> > > > .Select(graph, res.DunningLetterID); ARDunningLetterMaint.ReleaseProcess(graph, doc); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { failed = true; PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); } i++; } if (failed) { throw new PXException(Messages.OneOrMoreItemsAreNotReleased); } } }
public static void Email(PrintParameters filter, List <DetailsResult> list, bool markOnly) { ARDunningLetterUpdate graph = CreateInstance <ARDunningLetterUpdate>(); int i = 0; bool failed = false; foreach (DetailsResult it in list) { try { graph.EMailDL(it.DunningLetterID.Value, markOnly, filter.ShowAll == true); PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(it); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); failed = true; } i++; } if (failed) { throw new PXException(ErrorMessages.MailSendFailed); } }
public static void EmailStatements(PrintParameters filter, List <DetailsResult> list, bool markOnly) { ARStatementUpdate graph = CreateInstance <ARStatementUpdate>(); int i = 0; bool failed = false; foreach (DetailsResult it in list) { try { graph.EMailStatement(filter.BranchCD, it.CustomerID, filter.StatementDate, filter.CuryStatements == true? it.CuryID: null, markOnly, filter.ShowAll == true); if (!markOnly) { it.Emailed = true; } PXFilteredProcessing <DetailsResult, PrintParameters> .SetCurrentItem(it); PXFilteredProcessing <DetailsResult, PrintParameters> .SetProcessed(); } catch (Exception e) { PXFilteredProcessing <DetailsResult, PrintParameters> .SetError(i, e); failed = true; } i++; } if (failed) { throw new PXException(ErrorMessages.MailSendFailed); } }
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 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); } }