Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using PX.SM;
- using PX.Data;
- using PX.Objects.IN;
- using RealEstate.DAC.Extensions;
- namespace RealEstate.Graphs.CO
- {
- // Page : RE201001
- public class PropertyMaint : InventoryItemMaint
- {
- protected new virtual void InventoryItem_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
- {
- base.InventoryItem_RowSelected(cache, e);
- InventoryItem item = (InventoryItem)e.Row;
- var itemExt = item.GetExtension<InventoryItemExtension>();
- PropertyComputation prop = new PropertyComputation(item);
- itemExt.UsrRETotalSellingPrice = prop.TotalSellingPrice;
- itemExt.UsrRELotSellingPrice = prop.LotSellingPrice;
- itemExt.UsrREContractPriceTotal = prop.TotalContractPrice;
- }
- }
- public class PropertyComputation
- {
- private readonly InventoryItem _item;
- private readonly InventoryItemExtension _ext;
- public decimal TotalSellingPrice;
- public decimal LotSellingPrice;
- public decimal TotalContractPrice;
- public PropertyComputation(InventoryItem item)
- {
- _item = item;
- _ext = item.GetExtension<InventoryItemExtension>();
- LotSellingPrice = GetLotSellingPrice(_ext);
- TotalSellingPrice = GetSellingPriceTotal(_ext);
- TotalContractPrice = GetTotalContractPrice(_ext);
- }
- protected decimal GetLotSellingPrice(InventoryItemExtension ext)
- {
- return (ext.UsrRELandAreaTotal ?? 0) * (ext.UsrREPricePerSqAmt ?? 0);
- }
- protected decimal GetSellingPriceTotal(InventoryItemExtension ext)
- {
- return GetLotSellingPrice(ext) + (ext.UsrREHouseSellingPrice ?? 0) + (ext.UsrREEngineeredFillCost ?? 0);
- }
- protected decimal GetTotalContractPrice(InventoryItemExtension ext)
- {
- decimal totalSellingPrice = GetSellingPriceTotal(ext);
- decimal vat = totalSellingPrice * 0.12M;
- decimal registrationFee = ext.UsrRERegistrationAmt ?? 0;
- decimal moveInFee = ext.UsrREMoveInAmt ?? 0;
- decimal redeemableCommission = ext.UsrRERedeemableCommissionAmt ?? 0;
- decimal increaseCommission = 0;
- decimal misc = ext.UsrREMiscAmt ?? 0;
- return totalSellingPrice + vat + registrationFee + moveInFee + redeemableCommission + misc + increaseCommission;
- }
- }
- }
Add Comment
Please, Sign In to add comment