示例#1
0
        }       //	checkBP

        /// <summary>
        /// Check Payments
        /// </summary>
        /// <param name="bp">bp business partner</param>
        private void CheckPayments(MBPartner bp)
        {
            //	See also VMerge.postMerge
            int changed = 0;

            MPayment[] payments = MPayment.GetOfBPartner(GetCtx(), bp.GetC_BPartner_ID(), Get_Trx());
            for (int i = 0; i < payments.Length; i++)
            {
                MPayment payment = payments[i];
                if (payment.TestAllocation())
                {
                    payment.Save();
                    changed++;
                }
            }
            if (changed != 0)
            {
                AddLog(0, null, new Decimal(payments.Length),
                       Msg.GetElement(GetCtx(), "C_Payment_ID") + " - #" + changed);
            }
        }       //	checkPayments
        }       //	mergeTable

        /// <summary>
        /// Post Merge
        /// </summary>
        /// <param name="ColumnName">column name</param>
        /// <param name="to_ID">ID</param>
        private void PostMerge(String ColumnName, int to_ID)
        {
            if (ColumnName.Equals(AD_ORG_ID))
            {
            }
            else if (ColumnName.Equals(AD_USER_ID))
            {
            }
            else if (ColumnName.Equals(C_BPARTNER_ID))
            {
                MBPartner bp = new MBPartner(GetCtx(), to_ID, Get_TrxName());
                if (bp.Get_ID() != 0)
                {
                    MPayment[] payments = MPayment.GetOfBPartner(GetCtx(), bp.GetC_BPartner_ID(), Get_TrxName());
                    for (int i = 0; i < payments.Length; i++)
                    {
                        MPayment payment = payments[i];
                        if (payment.TestAllocation())
                        {
                            payment.Save();
                        }
                    }
                    MInvoice[] invoices = MInvoice.GetOfBPartner(GetCtx(), bp.GetC_BPartner_ID(), Get_TrxName());
                    for (int i = 0; i < invoices.Length; i++)
                    {
                        MInvoice invoice = invoices[i];
                        if (invoice.TestAllocation())
                        {
                            invoice.Save();
                        }
                    }
                    bp.SetTotalOpenBalance();
                    bp.SetActualLifeTimeValue();
                    bp.Save();
                }
            }
            else if (ColumnName.Equals(M_PRODUCT_ID))
            {
            }
        }       //	postMerge