narsil/Tanshu.Accounts.Contracts/Data Contracts/Inventory.cs
2018-08-24 16:11:33 +05:30

101 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
namespace Tanshu.Accounts.Entities
{
public class Inventory
{
public Inventory()
{
InventoryModifier = new List<InventoryModifier>();
}
public Guid InventoryID { get; set; }
public Kot Kot { get; set; }
public int SortOrder { get; set; }
public Product Product { get; set; }
public decimal Quantity { get; set; }
public decimal Price { get; set; }
public bool IsHappyHour { get; set; }
public decimal ServiceCharge { get; set; }
public bool IsScTaxable { get; set; }
public decimal ServiceTaxRate { get; set; }
public decimal VatRate { get; set; }
public Tax ServiceTax { get; set; }
public Tax Vat { get; set; }
public decimal Discount { get; set; }
public virtual List<InventoryModifier> InventoryModifier { get; set; }
public virtual string EffectiveName
{
get
{
return IsHappyHour ? string.Format("H H {0}", Product.FullName) : Product.FullName;
}
set { }
}
public virtual decimal EffectivePrice
{
get
{
return IsHappyHour ? 0 : Price;
}
set { }
}
public virtual decimal Amount
{
get
{
if (IsScTaxable)
return Quantity * EffectivePrice * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTaxRate + VatRate);
return Quantity * EffectivePrice * (1 - Discount) * (1 + ServiceCharge + ServiceTaxRate + VatRate);
}
set { }
}
public virtual decimal ServiceTaxAmount
{
get
{
if (IsScTaxable)
return Quantity * EffectivePrice * (1 - Discount) * (1 + ServiceCharge) * ServiceTaxRate;
return Quantity * EffectivePrice * (1 - Discount) * ServiceTaxRate;
}
}
public virtual decimal VatAmount
{
get
{
if (IsScTaxable)
return Quantity * EffectivePrice * (1 - Discount) * (1 + ServiceCharge) * VatRate;
return Quantity * EffectivePrice * (1 - Discount) * VatRate;
}
}
public virtual decimal ServiceChargeAmount
{
get
{
return Quantity * EffectivePrice * (1 - Discount) * ServiceCharge;
}
}
public virtual decimal DiscountAmount
{
get
{
return Quantity * EffectivePrice * Discount;
}
}
public virtual decimal Net
{
get
{
return Quantity * EffectivePrice * (1 - Discount);
}
}
}
}