コード例 #1
0
        /**
         *  After Save
         *	@param newRecord
         *	@param success
         *	@return success
         */
        protected override bool AfterSave(bool newRecord, bool success)
        {
            if (!success)
            {
                return(success);
            }

            if (!UpdateCbAndLine())
            {
                return(false);
            }

            if (GetVSS_PAYMENTTYPE() == X_C_CashLine.VSS_PAYMENTTYPE_Payment && GetC_BPartner_ID() > 0)
            {
                MCash   csh = new MCash(GetCtx(), GetC_Cash_ID(), Get_TrxName());
                Decimal amt = MConversionRate.ConvertBase(GetCtx(), GetAmount(),        //	CM adjusted
                                                          GetC_Currency_ID(), csh.GetDateAcct(), 0, GetAD_Client_ID(), GetAD_Org_ID());

                MBPartner bp     = new MBPartner(GetCtx(), GetC_BPartner_ID(), Get_Trx());
                string    retMsg = "";
                bool      crdAll = bp.IsCreditAllowed(GetC_BPartner_Location_ID(), Decimal.Subtract(0, amt), out retMsg);
                if (!crdAll)
                {
                    log.SaveWarning("Warning", retMsg);
                }
                else if (bp.IsCreditWatch(GetC_BPartner_Location_ID()))
                {
                    log.SaveWarning("Warning", Msg.GetMsg(GetCtx(), "VIS_BPCreditWatch"));
                }
            }

            return(true);
        }