Exemple #1
0
        /**
         *  Before Save
         *	@param newRecord new
         *	@return true
         */
        protected override bool BeforeSave(bool newRecord)
        {
            GetQty();           //	set to 1
            MAssetGroup astGrp = new MAssetGroup(GetCtx(), GetA_Asset_Group_ID(), Get_TrxName());

            if (newRecord && astGrp.Get_ColumnIndex("M_SerNoCtl_ID") > 0)
            {
                string    name = "";
                MSerNoCtl ctl  = new MSerNoCtl(GetCtx(), astGrp.GetM_SerNoCtl_ID(), Get_TrxName());
                name = ctl.CreateSerNo();
                SetValue(name);
            }
            #region Fixed Asset Management
            /*to Set Written Down Value on Asset i.e. Gross value of Asset-Depreciated/ Amortized Value Arpit*/
            if (Util.GetValueOfInt(DB.ExecuteScalar("select ad_moduleinfo_id from ad_moduleinfo where prefix='VAFAM_' and isactive='Y'")) > 0)
            {
                if (Get_ColumnIndex("VAFAM_WrittenDownValue") > 0 &&
                    Get_ColumnIndex("VAFAM_AssetGrossValue") > 0 && Get_ColumnIndex("VAFAM_SLMDepreciation") > 0)
                {
                    Set_Value("VAFAM_WrittenDownValue",
                              Decimal.Subtract(Util.GetValueOfDecimal(Get_Value("VAFAM_AssetGrossValue")),
                                               Util.GetValueOfDecimal(Get_Value("VAFAM_SLMDepreciation"))));
                }
            }
            #endregion

            return(true);
        }
        /**
         *  Before Save
         *	@param newRecord new
         *	@return true
         */
        protected override bool BeforeSave(bool newRecord)
        {
            GetQty();           //	set to 1
            MAssetGroup astGrp = new MAssetGroup(GetCtx(), GetA_Asset_Group_ID(), Get_TrxName());

            if (newRecord && astGrp.Get_ColumnIndex("M_SerNoCtl_ID") >= 0 && astGrp.GetM_SerNoCtl_ID() > 0 && String.IsNullOrEmpty(GetValue()))
            {
                string    name = "";
                MSerNoCtl ctl  = new MSerNoCtl(GetCtx(), astGrp.GetM_SerNoCtl_ID(), Get_TrxName());

                // if Organization level check box is true on Serila No Control, then Get Current next from Serila No tab.
                if (ctl.Get_ColumnIndex("IsOrgLevelSequence") >= 0)
                {
                    name = ctl.CreateDefiniteSerNo(this);
                }
                else
                {
                    name = ctl.CreateSerNo();
                }
                SetValue(name);
            }
            #region Fixed Asset Management
            /*to Set Written Down Value on Asset i.e. Gross value of Asset-Depreciated/ Amortized Value Arpit*/
            if (Util.GetValueOfInt(DB.ExecuteScalar("select ad_moduleinfo_id from ad_moduleinfo where prefix='VAFAM_' and isactive='Y'")) > 0)
            {
                if (Get_ColumnIndex("VAFAM_WrittenDownValue") > 0 &&
                    Get_ColumnIndex("VAFAM_AssetGrossValue") > 0 && Get_ColumnIndex("VAFAM_SLMDepreciation") > 0)
                {
                    Set_Value("VAFAM_WrittenDownValue",
                              Decimal.Subtract(Util.GetValueOfDecimal(Get_Value("VAFAM_AssetGrossValue")),
                                               Util.GetValueOfDecimal(Get_Value("VAFAM_SLMDepreciation"))));
                }
            }
            #endregion

            return(true);
        }