2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
|
using System.Collections.Generic;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public class BillInventory
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public int ProductID { get; set; }
|
2011-01-17 14:55:43 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public string Name { get; set; }
|
2011-01-17 14:55:43 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
private decimal price;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal Price
|
|
|
|
|
{
|
|
|
|
|
get { return price; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
if (value <= 0)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
throw new ArgumentException("Price has to be non-negative greater than zero.");
|
|
|
|
|
else
|
|
|
|
|
price = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
|
|
|
|
private decimal quantity = 1;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal Quantity
|
|
|
|
|
{
|
|
|
|
|
get { return quantity; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value <= 0)
|
|
|
|
|
throw new ArgumentException("Quantity has to be non-negative greater than zero.");
|
|
|
|
|
quantity = value;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
private decimal discount = 0;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
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 Tax { get; set; }
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public decimal TaxAmount
|
2011-01-17 14:55:43 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
get
|
2011-01-17 14:55:43 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
return quantity * price * (1 - discount) * (1 + ServiceCharge) * Tax;
|
2011-01-17 14:55:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public decimal ServiceCharge { get; set; }
|
2011-01-17 14:55:43 +00:00
|
|
|
|
public decimal ServiceChargeAmount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
return quantity * price * (1 - discount) * ServiceCharge;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal DiscountAmount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return quantity * price * discount;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal GrossAmount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return quantity * price * (1 - discount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
private decimal printed;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public decimal Value
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return price * quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
public decimal Additional
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return quantity - printed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public bool isNew;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
|
|
|
|
public string Display
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
|
|
|
|
|
if (discount != 0)
|
2011-01-17 14:55:43 +00:00
|
|
|
|
output += string.Format(" - {0:#.##%}", discount);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
public IList<Modifier> Modifiers { get; set; }
|
|
|
|
|
public BillInventory()
|
|
|
|
|
{
|
|
|
|
|
printed = 0;
|
|
|
|
|
isNew = true;
|
|
|
|
|
Modifiers = new List<Modifier>();
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|