private static void AddJointPayeeName(JointCheckPrintModel printModel, string jointPayeeName) { var updatedNames = $"{printModel.JointPayeeNames}{jointPayeeName} And "; printModel.JointPayeeNames = printModel.IsMultilinePrintMode ? $"{updatedNames}{Environment.NewLine}" : updatedNames; }
private string GetJointPayees(string documentType, string referenceNumber, bool isMultiline) { var jointPayeePayments = GetJointPayeePayments(documentType, referenceNumber); var printModel = JointCheckPrintModel.Create(isMultiline); foreach (var jointPayeePayment in jointPayeePayments) { ProcessJointPayeePayment(printModel, jointPayeePayment); } return(printModel.JointPayeeNames); }
private static void UpdateJointCheckPrintModelWithNewPayee(JointCheckPrintModel printModel, JointPayee jointPayee, BAccount vendor) { if (jointPayee.JointPayeeExternalName.IsNullOrEmpty()) { printModel.InternalJointPayeeIds.Add(vendor.BAccountID); } else { printModel.ExternalJointPayeeNames.Add(jointPayee.JointPayeeExternalName); } }
private static string GetJointPayeeNameIfNew(JointCheckPrintModel printModel, JointPayee jointPayee, BAccount vendor) { if (jointPayee.JointPayeeExternalName.IsNullOrEmpty()) { return(printModel.InternalJointPayeeIds.Any(id => id == vendor.BAccountID) ? string.Empty : vendor.AcctName); } return(printModel.ExternalJointPayeeNames.Any(name => IsSameJointPayeeExternalName(name, jointPayee)) ? string.Empty : jointPayee.JointPayeeExternalName); }
private static void ProcessJointPayeePayment(JointCheckPrintModel printModel, PXResult jointPayeePayment) { var jointPayee = jointPayeePayment.GetItem <JointPayee>(); var vendor = jointPayeePayment.GetItem <Vendor>(); var jointPayeeName = GetJointPayeeNameIfNew(printModel, jointPayee, vendor); if (jointPayeeName == string.Empty) { return; } UpdateJointCheckPrintModelWithNewPayee(printModel, jointPayee, vendor); AddJointPayeeName(printModel, jointPayeeName); }