Fully Working build with Different print locations and table loading. Pending: Bill Settlement, Modifiers, etc.

This commit is contained in:
unknown
2011-01-17 20:25:43 +05:30
parent 76cd512ebc
commit 3ea5fc75ab
43 changed files with 81708 additions and 148 deletions

View File

@ -10,6 +10,6 @@ namespace Tanshu.Accounts.DAOFactory
void Update(PrintLocationBO printLocation);
bool Delete(int tableID);
PrintLocationBO GetPrintLocation(int printLocationID);
PrintLocationBO GetPrintLocation(Guid productTypeID, string location);
PrintLocationBO GetPrintLocation(Guid? productTypeID, string location);
}
}

View File

@ -5,7 +5,7 @@ namespace Tanshu.Accounts.Contracts
{
public class FoodTableBO
{
public int TableID { get; set; }
public string Name { get; set; }
public virtual int TableID { get; set; }
public virtual string Name { get; set; }
}
}

View File

@ -9,5 +9,63 @@ namespace Tanshu.Accounts.Contracts
public Guid ProductTypeID { get; set; }
public string Location { get; set; }
public string Printer { get; set; }
public int Copies { get; set; }
public string CutCode { get; set; }
public override bool Equals(System.Object obj)
{
// If parameter is null return false.
if (obj == null)
{
return false;
}
// If parameter cannot be cast to Point return false.
PrintLocationBO p = obj as PrintLocationBO;
if ((System.Object)p == null)
{
return false;
}
// Return true if the fields match:
//return (PrintLocationID == p.PrintLocationID)
// && (ProductTypeID == p.ProductTypeID)
// && (Location == p.Location)
// && (Printer == p.Printer)
// && (Copies == p.Copies)
// && (CutCode == p.CutCode);
return (Location == p.Location)
&& (Printer == p.Printer)
&& (Copies == p.Copies)
&& (CutCode == p.CutCode);
}
public bool Equals(PrintLocationBO p)
{
// If parameter is null return false:
if ((object)p == null)
{
return false;
}
// Return true if the fields match:
//return (PrintLocationID == p.PrintLocationID)
// && (ProductTypeID == p.ProductTypeID)
// && (Location == p.Location)
// && (Printer == p.Printer)
// && (Copies == p.Copies)
// && (CutCode == p.CutCode);
return (Location == p.Location)
&& (Printer == p.Printer)
&& (Copies == p.Copies)
&& (CutCode == p.CutCode);
}
public override int GetHashCode()
{
//return PrintLocationID.GetHashCode() ^ ProductTypeID.GetHashCode() ^ Location.GetHashCode() ^ Printer.GetHashCode() ^ Copies.GetHashCode() ^ CutCode.GetHashCode();
return Location.GetHashCode() ^ Printer.GetHashCode() ^ Copies.GetHashCode() ^ CutCode.GetHashCode();
}
}
}

View File

@ -3,16 +3,23 @@ using System.Runtime.Serialization;
namespace Tanshu.Accounts.Contracts
{
[DataContract]
public class SalesBillItemBO
{
[DataMember]
public Guid productID;
[DataMember]
public string Name { get; set; }
private decimal price;
[DataMember]
private decimal quantity;
private decimal discount;
private decimal printed;
public SalesBillItemBO()
{
quantity = 1;
discount = 0;
printed = 0;
serviceCharge = 0.1M;
}
public decimal Price
{
get { return price; }
@ -24,9 +31,6 @@ namespace Tanshu.Accounts.Contracts
price = value;
}
}
private decimal quantity = 1;
[DataMember]
public decimal Quantity
{
get { return quantity; }
@ -39,8 +43,6 @@ namespace Tanshu.Accounts.Contracts
}
}
private decimal discount = 0;
[DataMember]
public decimal Discount
{
get { return discount; }
@ -55,17 +57,39 @@ namespace Tanshu.Accounts.Contracts
}
}
[DataMember]
public decimal Tax { get; set; }
private decimal serviceCharge;
public decimal ServiceCharge
{
get { return serviceCharge; }
set
{
if (value < 0)
throw new ArgumentException("Service Charge has to be non-negative greater than or equal to zero.");
else if (value > 1)
throw new ArgumentException("Service Charge has to be less than one.");
else
serviceCharge = value;
}
}
#region Calculated Amounts
public decimal ServiceChargeAmount
{
get
{
return quantity * price * (1 - discount) * serviceCharge;
}
}
public decimal TaxAmount
{
get
{
return quantity * price * Tax * (1 - discount);
return quantity * price * (1 - discount) * (1 + serviceCharge) * Tax;
}
}
public decimal DiscountAmount
{
get
@ -73,7 +97,6 @@ namespace Tanshu.Accounts.Contracts
return quantity * price * discount;
}
}
public decimal GrossAmount
{
get
@ -81,9 +104,15 @@ namespace Tanshu.Accounts.Contracts
return quantity * price * (1 - discount);
}
}
public decimal Value
{
get
{
return price * quantity * (1 - discount) * (1 + serviceCharge) * (1 + Tax);
}
}
private decimal printed = 0;
[DataMember]
#endregion
public decimal Printed
{
get { return printed; }
@ -95,16 +124,8 @@ namespace Tanshu.Accounts.Contracts
printed = value;
}
}
[DataMember]
public string location;
public decimal Value
{
get
{
return price * quantity * (1 - discount) * (1 + Tax);
}
}
public decimal Additional
{
get
@ -113,7 +134,6 @@ namespace Tanshu.Accounts.Contracts
}
}
[DataMember]
public bool isNew = true;
public string Display
@ -122,7 +142,7 @@ namespace Tanshu.Accounts.Contracts
{
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
if (discount != 0)
output += string.Format(" - {0:#.##%}", discount);
output += string.Format(" - {0:#.##%}", discount);
return output;
}
}