コード例 #1
0
        /**
         *  Get Accounst Of BPartner
         *	@param ctx context
         *	@param C_BPartner_ID bpartner
         *	@return
         */
        public static MBPBankAccount[] GetOfBPartner(Ctx ctx, int C_BPartner_ID)
        {
            String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=" + C_BPartner_ID
                         + " AND IsActive='Y'";
            List <MBPBankAccount> list = new List <MBPBankAccount>();
            DataTable             dt   = null;
            IDataReader           idr  = null;

            try
            {
                idr = DataBase.DB.ExecuteReader(sql, null, null);
                dt  = new DataTable();
                dt.Load(idr);
                idr.Close();
                foreach (DataRow dr in dt.Rows)
                {
                    list.Add(new MBPBankAccount(ctx, dr, null));
                }
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }
            finally { dt = null; }
            MBPBankAccount[] retValue = new MBPBankAccount[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }
コード例 #2
0
        /**
         *  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);
        }