2011-03-11 18:49:48 +00:00
|
|
|
|
using System.Collections.Generic;
|
2011-01-31 20:33:22 +00:00
|
|
|
|
using Tanshu.Accounts.Contracts;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
namespace Tanshu.Accounts.Entities
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public class Inventory
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
public Inventory()
|
|
|
|
|
{
|
|
|
|
|
// ReSharper disable DoNotCallOverridableMethodsInConstructor
|
|
|
|
|
InventoryModifier = new List<InventoryModifier>();
|
|
|
|
|
// ReSharper restore DoNotCallOverridableMethodsInConstructor
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual int InventoryID { get; set; }
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
[NotNull]
|
|
|
|
|
public virtual Kot Kot { get; set; }
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
[NotNull]
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual Product Product { get; set; }
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2011-02-09 12:03:22 +00:00
|
|
|
|
public virtual decimal Quantity { get; set; }
|
2011-08-28 12:17:15 +00:00
|
|
|
|
public virtual decimal Price { get; set; }
|
|
|
|
|
public virtual decimal FullPrice { get; set; }
|
2011-02-18 16:54:48 +00:00
|
|
|
|
public virtual decimal ServiceCharge { get; set; }
|
2012-04-08 12:28:15 +00:00
|
|
|
|
public virtual bool IsScTaxable { get; set; }
|
|
|
|
|
public virtual decimal ServiceTax { get; set; }
|
|
|
|
|
public virtual decimal Vat { get; set; }
|
|
|
|
|
public virtual decimal Discount { get; set; }
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
2011-01-31 20:33:22 +00:00
|
|
|
|
[Cascade]
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual IList<InventoryModifier> InventoryModifier { get; set; }
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2012-04-08 12:28:15 +00:00
|
|
|
|
[Formula(Formula = "CASE WHEN IsScTaxable = 1 THEN Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat) ELSE Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat) END")]
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public virtual decimal Amount
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2012-04-08 12:28:15 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (IsScTaxable)
|
|
|
|
|
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat);
|
|
|
|
|
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat);
|
|
|
|
|
}
|
2011-02-18 16:54:48 +00:00
|
|
|
|
private set { }
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
}
|