148 lines
3.3 KiB
C#
148 lines
3.3 KiB
C#
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
{
|
|
|
|
public class SalesBillItemBO
|
|
{
|
|
|
|
public Guid productID;
|
|
|
|
public string Name { get; set; }
|
|
|
|
private decimal price;
|
|
|
|
public decimal Price
|
|
{
|
|
get { return price; }
|
|
set
|
|
{
|
|
if (value <= 0)
|
|
throw new ArgumentException("Price has to be non-negative greater than zero.");
|
|
else
|
|
price = value;
|
|
}
|
|
}
|
|
|
|
private decimal quantity = 1;
|
|
|
|
public decimal Quantity
|
|
{
|
|
get { return quantity; }
|
|
set
|
|
{
|
|
if (value <= 0)
|
|
throw new ArgumentException("Quantity has to be non-negative greater than zero.");
|
|
quantity = value;
|
|
|
|
}
|
|
}
|
|
|
|
private decimal discount = 0;
|
|
|
|
public decimal Discount
|
|
{
|
|
get { return discount; }
|
|
set
|
|
{
|
|
if (value < 0)
|
|
throw new ArgumentException("Discount has to be non-negative greater than or equal to zero.");
|
|
else if (value > 1)
|
|
throw new ArgumentException("Discount has to be less than one.");
|
|
else
|
|
discount = value;
|
|
}
|
|
}
|
|
|
|
|
|
public decimal Vat { get; set; }
|
|
|
|
public decimal VatAmount
|
|
{
|
|
get
|
|
{
|
|
return quantity * price * Vat * (1 - discount);
|
|
}
|
|
}
|
|
|
|
public decimal ServiceTax { get; set; }
|
|
|
|
public decimal ServiceTaxAmount
|
|
{
|
|
get
|
|
{
|
|
return quantity * price * ServiceTax * (1 - discount);
|
|
}
|
|
}
|
|
public decimal TotalTax
|
|
{
|
|
get
|
|
{
|
|
return quantity * price * (Vat + ServiceTax) * (1 - discount);
|
|
}
|
|
}
|
|
|
|
public decimal DiscountAmount
|
|
{
|
|
get
|
|
{
|
|
return quantity * price * discount;
|
|
}
|
|
}
|
|
|
|
public decimal GrossAmount
|
|
{
|
|
get
|
|
{
|
|
return quantity * price * (1 - discount);
|
|
}
|
|
}
|
|
|
|
private decimal printed = 0;
|
|
|
|
public decimal Printed
|
|
{
|
|
get { return printed; }
|
|
set
|
|
{
|
|
if (value < 0)
|
|
throw new ArgumentException("Printed has to be non-negative greater than or equal to zero.");
|
|
else
|
|
printed = value;
|
|
}
|
|
}
|
|
|
|
public string location;
|
|
|
|
public decimal Value
|
|
{
|
|
get
|
|
{
|
|
return price * quantity * (1 - discount) * (1 + Vat + ServiceTax );
|
|
}
|
|
}
|
|
public decimal Additional
|
|
{
|
|
get
|
|
{
|
|
return quantity - printed;
|
|
}
|
|
}
|
|
|
|
|
|
public bool isNew = true;
|
|
|
|
public string Display
|
|
{
|
|
get
|
|
{
|
|
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
|
|
if (discount != 0)
|
|
output += string.Format(" - {0:#.##%}", discount);
|
|
return output;
|
|
}
|
|
}
|
|
}
|
|
}
|