/** * Add Payment Selection Line * @param line line */ public void AddLine(MPaySelectionLine line) { if (GetC_BPartner_ID() != line.GetInvoice().GetC_BPartner_ID()) { throw new ArgumentException("Line for fifferent BPartner"); } // if (IsReceipt() == line.IsSOTrx()) { SetPayAmt(Decimal.Add(GetPayAmt(), line.GetPayAmt())); SetDiscountAmt(Decimal.Add(GetDiscountAmt(), line.GetDiscountAmt())); } else { SetPayAmt(Decimal.Subtract(GetPayAmt(), line.GetPayAmt())); SetDiscountAmt(Decimal.Subtract(GetDiscountAmt(), line.GetDiscountAmt())); } SetQty(GetQty() + 1); }
/** * Create from Line * @param line payment selection * @param PaymentRule payment rule */ public MPaySelectionCheck(MPaySelectionLine line, String PaymentRule) : this(line.GetCtx(), 0, line.Get_TrxName()) { SetClientOrg(line); SetC_PaySelection_ID(line.GetC_PaySelection_ID()); int C_BPartner_ID = line.GetInvoice().GetC_BPartner_ID(); SetC_BPartner_ID(C_BPartner_ID); // if (X_C_Order.PAYMENTRULE_DirectDebit.Equals(PaymentRule)) { MBPBankAccount[] bas = MBPBankAccount.GetOfBPartner(line.GetCtx(), C_BPartner_ID); for (int i = 0; i < bas.Length; i++) { MBPBankAccount account = bas[i]; if (account.IsDirectDebit()) { SetC_BP_BankAccount_ID(account.GetC_BP_BankAccount_ID()); break; } } } else if (X_C_Order.PAYMENTRULE_DirectDeposit.Equals(PaymentRule)) { MBPBankAccount[] bas = MBPBankAccount.GetOfBPartner(line.GetCtx(), C_BPartner_ID); for (int i = 0; i < bas.Length; i++) { MBPBankAccount account = bas[i]; if (account.IsDirectDeposit()) { SetC_BP_BankAccount_ID(account.GetC_BP_BankAccount_ID()); break; } } } SetPaymentRule(PaymentRule); // SetIsReceipt(line.IsSOTrx()); SetPayAmt(line.GetPayAmt()); SetDiscountAmt(line.GetDiscountAmt()); SetQty(1); }