/** * Set Value Name Description * @param shipment shipment * @param line line * @param deliveryCount */ public void SetValueNameDescription(MInOut shipment, MInOutLine line, int deliveryCount) { VAdvantage.Model.MProduct product = line.GetProduct(); MBPartner partner = shipment.GetBPartner(); SetValueNameDescription(shipment, deliveryCount, product, partner); }
/** * Shipment Constructor * @param shipment shipment * @param shipLine shipment line * @param deliveryCount 0 or number of delivery */ public MAsset(MInOut shipment, MInOutLine shipLine, int deliveryCount) : this(shipment.GetCtx(), 0, shipment.Get_TrxName()) { SetClientOrg(shipment); SetValueNameDescription(shipment, shipLine, deliveryCount); // Header //SetIsOwned(true); SetC_BPartner_ID(shipment.GetC_BPartner_ID()); SetC_BPartner_Location_ID(shipment.GetC_BPartner_Location_ID()); SetAD_User_ID(shipment.GetAD_User_ID()); SetM_Locator_ID(shipLine.GetM_Locator_ID()); SetIsInPosession(true); SetAssetServiceDate(shipment.GetDateAcct()); // Line VAdvantage.Model.MProduct product = shipLine.GetProduct(); SetM_Product_ID(product.GetM_Product_ID()); SetA_Asset_Group_ID(product.GetA_Asset_Group_ID()); //////////////////////////////* //Changes for vafam // SetAssetServiceDate(shipment.GetMovementDate()); //SetGuaranteeDate(TimeUtil.AddDays(shipment.GetMovementDate(), product.GetGuaranteeDays())); MAssetGroup _assetGroup = new MAssetGroup(GetCtx(), GetA_Asset_Group_ID(), shipment.Get_TrxName()); if (_assetGroup.IsOwned()) { SetIsOwned(true); //SetC_BPartner_ID(0); } if (_assetGroup.IsDepreciated()) { SetIsDepreciated(true); SetIsFullyDepreciated(false); } //////////////////////////////////// //Change by Sukhwinder for setting Asset type and amortization template on Asset window, MANTIS ID:1762 int countVA038 = Util.GetValueOfInt(DB.ExecuteScalar("SELECT COUNT(AD_MODULEINFO_ID) FROM AD_MODULEINFO WHERE PREFIX='VA038_' ")); Set_Value("VAFAM_AssetType", _assetGroup.Get_Value("VAFAM_AssetType").ToString()); if (countVA038 > 0) { Set_Value("VA038_AmortizationTemplate_ID", VAdvantage.Utility.Util.GetValueOfInt(_assetGroup.Get_Value("VA038_AmortizationTemplate_ID"))); } Set_Value("VAFAM_DepreciationType_ID", VAdvantage.Utility.Util.GetValueOfInt(_assetGroup.Get_Value("VAFAM_DepreciationType_ID"))); //////////////////////////////////// // Guarantee & Version SetGuaranteeDate(TimeUtil.AddDays(shipment.GetMovementDate(), product.GetGuaranteeDays())); SetVersionNo(product.GetVersionNo()); if (shipLine.GetM_AttributeSetInstance_ID() != 0) // Instance { MAttributeSetInstance asi = new MAttributeSetInstance(GetCtx(), shipLine.GetM_AttributeSetInstance_ID(), Get_TrxName()); SetM_AttributeSetInstance_ID(asi.GetM_AttributeSetInstance_ID()); SetLot(asi.GetLot()); SetSerNo(asi.GetSerNo()); } SetHelp(shipLine.GetDescription()); // Qty int units = product.GetSupportUnits(); if (units == 0) { units = 1; } if (deliveryCount != 0) // one asset per UOM { SetQty(shipLine.GetMovementQty(), units); } else { SetQty((Decimal)units); } SetM_InOutLine_ID(shipLine.GetM_InOutLine_ID()); // Activate MAssetGroup ag = MAssetGroup.Get(GetCtx(), GetA_Asset_Group_ID()); if (!ag.IsCreateAsActive()) { SetIsActive(false); } }