narsil/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs

84 lines
1.8 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using System.Runtime.Serialization;
namespace Tanshu.Accounts.Contracts
{
2010-03-02 17:56:21 +00:00
public class InventoryBO
{
public Guid InventoryID { get; set; }
public Guid VoucherID { get; set; }
public Guid ProductID { get; set; }
public string ProductName { get; set; }
2010-03-02 17:56:21 +00:00
private decimal quantity;
public decimal Quantity
{
get { return quantity; }
set
{
quantity = value;
amount = null;
2010-03-02 17:56:21 +00:00
}
}
private decimal rate;
2010-03-02 17:56:21 +00:00
public decimal Rate
{
get { return rate; }
set
{
rate = value;
amount = null;
2010-03-02 17:56:21 +00:00
}
}
decimal vat;
public decimal Vat
{
get { return vat; }
set
{
vat = value;
amount = null;
}
}
decimal serviceTax;
public decimal ServiceTax
2010-03-02 17:56:21 +00:00
{
get { return serviceTax; }
2010-03-02 17:56:21 +00:00
set
{
serviceTax = value;
amount = null;
2010-03-02 17:56:21 +00:00
}
}
decimal discount;
2010-03-02 17:56:21 +00:00
public decimal Discount
{
get { return discount; }
set
{
discount = value;
amount = null;
2010-03-02 17:56:21 +00:00
}
}
decimal? amount;
2010-03-02 17:56:21 +00:00
public decimal Amount
{
get
{
if (!amount.HasValue)
CalculateAmount();
return amount.Value;
}
}
private void CalculateAmount()
{
amount = quantity * rate * (1 + vat + serviceTax) * (1 - discount);
2010-03-02 17:56:21 +00:00
}
}
}