2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
|
|
|
{
|
2013-11-28 10:39:33 +00:00
|
|
|
|
|
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; }
|
2014-08-08 12:05:38 +00:00
|
|
|
|
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;
|
2014-08-08 12:05:38 +00:00
|
|
|
|
amount = null;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-28 10:39:33 +00:00
|
|
|
|
|
2014-08-08 12:05:38 +00:00
|
|
|
|
private decimal rate;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal Rate
|
|
|
|
|
{
|
|
|
|
|
get { return rate; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
rate = value;
|
2014-08-08 12:05:38 +00:00
|
|
|
|
amount = null;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-28 10:39:33 +00:00
|
|
|
|
|
2014-08-08 12:05:38 +00:00
|
|
|
|
decimal vat;
|
2013-11-28 10:39:33 +00:00
|
|
|
|
public decimal Vat
|
|
|
|
|
{
|
|
|
|
|
get { return vat; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2014-08-08 12:05:38 +00:00
|
|
|
|
vat = value;
|
|
|
|
|
amount = null;
|
2013-11-28 10:39:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-08 12:05:38 +00:00
|
|
|
|
decimal serviceTax;
|
2013-11-28 10:39:33 +00:00
|
|
|
|
public decimal ServiceTax
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2013-11-28 10:39:33 +00:00
|
|
|
|
get { return serviceTax; }
|
2010-03-02 17:56:21 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
2014-08-08 12:05:38 +00:00
|
|
|
|
serviceTax = value;
|
|
|
|
|
amount = null;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-28 10:39:33 +00:00
|
|
|
|
|
2014-08-08 12:05:38 +00:00
|
|
|
|
decimal discount;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal Discount
|
|
|
|
|
{
|
|
|
|
|
get { return discount; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2014-08-08 12:05:38 +00:00
|
|
|
|
discount = value;
|
|
|
|
|
amount = null;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-28 10:39:33 +00:00
|
|
|
|
|
2014-08-08 12:05:38 +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()
|
|
|
|
|
{
|
2013-11-28 10:39:33 +00:00
|
|
|
|
amount = quantity * rate * (1 + vat + serviceTax) * (1 - discount);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|