public virtual IEnumerable export(PXAdapter adapter) { CheckPrevOperation(); CABatch document = this.Document.Current; if (document != null && document.Released == true && document.Hold == false) { PXResult <PaymentMethod, SYMapping> res = (PXResult <PaymentMethod, SYMapping>) PXSelectJoin <PaymentMethod, LeftJoin <SYMapping, On <SYMapping.mappingID, Equal <PaymentMethod.aPBatchExportSYMappingID> > >, Where <PaymentMethod.paymentMethodID, Equal <Optional <CABatch.paymentMethodID> > > > .Select(this, document.PaymentMethodID); PaymentMethod pt = res; SYMapping map = res; if (pt != null && pt.APCreateBatchPayment == true && pt.APBatchExportSYMappingID != null && map != null) { string defaultFileName = this.GenerateFileName(document); PXLongOperation.StartOperation(this, delegate() { PX.Api.SYExportProcess.RunScenario(map.Name, SYMapping.RepeatingOption.All, true, true, new PX.Api.PXSYParameter(ExportProviderParams.FileName, defaultFileName), new PX.Api.PXSYParameter(ExportProviderParams.BatchNbr, document.BatchNbr)); }); } else { throw new PXException(Messages.CABatchExportProviderIsNotConfigured); } } return(adapter.Get()); }
public virtual IEnumerable export(PXAdapter adapter) { if (PXLongOperation.Exists(UID)) { throw new ApplicationException(GL.Messages.PrevOperationNotCompleteYet); } CABatch doc = this.Document.Current; if (doc != null && doc.Released == true && doc.Hold == false) { PXResult <PaymentMethod, SYMapping> res = (PXResult <PaymentMethod, SYMapping>) PXSelectJoin <PaymentMethod, LeftJoin <SYMapping, On <SYMapping.mappingID, Equal <PaymentMethodExt.aRBatchExportSYMappingID> > >, Where <PaymentMethod.paymentMethodID, Equal <Optional <CABatch.paymentMethodID> > > > .Select(this, doc.PaymentMethodID); PaymentMethod pt = res; PaymentMethodExt ptx = PXCache <PaymentMethod> .GetExtension <PaymentMethodExt>(pt); SYMapping map = res; if (ptx != null && ptx.ARCreateBatchPayment == true && ptx.ARBatchExportSYMappingID != null && map != null) { string defaultFileName = this.GenerateFileName(doc); PXLongOperation.StartOperation(this, delegate() { PX.Api.SYExportProcess.RunScenario(map.Name, SYMapping.RepeatingOption.All, true, true, new PX.Api.PXSYParameter(CABatchEntry.ExportProviderParams.FileName, defaultFileName), new PX.Api.PXSYParameter(CABatchEntry.ExportProviderParams.BatchNbr, doc.BatchNbr) //, //new PX.Api.PXSYParameter(ExportProviderParams.BatchSequenceStartingNbr, "0000") ); }); } else { throw new PXException(CA.Messages.CABatchExportProviderIsNotConfigured); } } return(adapter.Get()); }