Moved numpad control to Tanshu.Common. Billing feature complete. Delete not working as expected

Signed-off-by: unknown <tanshu@.(none)>
This commit is contained in:
unknown
2011-02-01 02:03:22 +05:30
parent eb05811868
commit 0f323f8fab
64 changed files with 2029 additions and 1382 deletions

View File

@ -11,31 +11,9 @@ namespace Tanshu.Accounts.Contracts
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;
}
}
public decimal Price { get; set; }
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;
}
}
public decimal Quantity { get; set; }
private decimal discount = 0;
public decimal Discount
@ -57,7 +35,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount) * (1 + ServiceCharge) * Tax;
return Quantity * Price * (1 - discount) * (1 + ServiceCharge) * Tax;
}
}
@ -66,7 +44,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount) * ServiceCharge;
return Quantity * Price * (1 - discount) * ServiceCharge;
}
}
@ -74,7 +52,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * discount;
return Quantity * Price * discount;
}
}
@ -82,7 +60,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount);
return Quantity * Price * (1 - discount);
}
}
@ -103,14 +81,14 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return price * quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
return Price * Quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
}
}
public decimal Additional
{
get
{
return quantity - printed;
return Quantity - printed;
}
}
@ -120,15 +98,29 @@ namespace Tanshu.Accounts.Contracts
{
get
{
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
string output = string.Format("{0} @ Rs. {1:#.##}", Name, Price);
if (discount != 0)
output += string.Format(" - {0:#.##%}", discount);
foreach (var item in Modifiers)
output += string.Format("\n\r -- {0}", item.Name);
return output;
//if (Price == 0)
// return string.Format(" -- {0}", Name);
//string output = string.Format("{0} @ Rs. {1:#.##}", Name, Price);
//if (discount != 0)
// output += string.Format(" - {0:#.##%}", discount);
//return output;
}
}
public override string ToString()
{
return string.Format("{0} - {1}", ProductID, Name);
}
public IList<Modifier> Modifiers { get; set; }
public BillInventory()
{
Quantity = 1;
printed = 0;
isNew = true;
Modifiers = new List<Modifier>();

View File

@ -5,10 +5,11 @@ namespace Tanshu.Accounts.Contracts
{
public class BillItemKey
{
public BillItemKey(int productID, bool isNew)
//Old = 0, New = 1, Modifiers = 2+
public BillItemKey(int ProductID, bool IsNew)
{
ProductID = productID;
IsNew = isNew;
this.ProductID = ProductID;
this.IsNew = IsNew;
}
public int ProductID
@ -41,7 +42,7 @@ namespace Tanshu.Accounts.Contracts
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (!(a is BillItemKey))
return false;
if (!(b is BillItemKey))