Added inverse Attribute to ProductGroup.
BillInventory Renamed. Refactored Bill to be more usable. Added Bill Detail Report. Added Open Bill and Bill Details Roles. Zero Rate Products have Yellow background Color. Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI, Cached the Products List. Product and Product Group Form Working.
This commit is contained in:
@ -1,28 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
public class BillInventory
|
||||
public class BillItemValue
|
||||
{
|
||||
public int ProductID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public decimal Quantity { get; set; }
|
||||
private decimal discount = 0;
|
||||
private decimal _discount;
|
||||
public Product Product { get; private set; }
|
||||
|
||||
public decimal Discount
|
||||
{
|
||||
get { return 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)
|
||||
if (value > 1)
|
||||
throw new ArgumentException("Discount has to be less than one.");
|
||||
else
|
||||
discount = value;
|
||||
_discount = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity * Price * (1 - discount) * (1 + ServiceCharge) * Tax;
|
||||
return Quantity * Price * (1 - _discount) * (1 + ServiceCharge) * Tax;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity * Price * (1 - discount) * ServiceCharge;
|
||||
return Quantity * Price * (1 - _discount) * ServiceCharge;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity * Price * discount;
|
||||
return Quantity * Price * _discount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,17 +56,17 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity * Price * (1 - discount);
|
||||
return Quantity * Price * (1 - _discount);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Printed {get; set;}
|
||||
public bool Printed { get; set; }
|
||||
|
||||
public decimal Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return Price * Quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
|
||||
return Price * Quantity * (1 - _discount) * (1 + ServiceCharge) * (1 + Tax);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,9 +74,9 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
get
|
||||
{
|
||||
string output = string.Format("{0} @ Rs. {1:#.##}", Name, Price);
|
||||
if (discount != 0)
|
||||
output += string.Format(" - {0:#.##%}", discount);
|
||||
var 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;
|
||||
@ -94,11 +94,12 @@ namespace Tanshu.Accounts.Contracts
|
||||
return string.Format("{0} - {1}", ProductID, Name);
|
||||
}
|
||||
public IList<Modifier> Modifiers { get; set; }
|
||||
public BillInventory()
|
||||
public BillItemValue(Product product)
|
||||
{
|
||||
Quantity = 1;
|
||||
Printed = false;
|
||||
Modifiers = new List<Modifier>();
|
||||
Product = product;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,46 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
public enum BillItemType
|
||||
{
|
||||
Product,
|
||||
Kot
|
||||
}
|
||||
public class BillItemKey
|
||||
{
|
||||
//Old = 0, New = 1, Modifiers = 2+
|
||||
public BillItemKey(int ProductID, int KotID)
|
||||
private BillItemKey(int productID, int kotID, BillItemType billItemType)
|
||||
{
|
||||
this.ProductID = ProductID;
|
||||
this.KotID = KotID;
|
||||
if (kotID < 0)
|
||||
throw new ArgumentException("KotID Cannot be Negative");
|
||||
if (productID < 0)
|
||||
throw new ArgumentException("ProductID Cannot be Negative");
|
||||
BillItemType = billItemType;
|
||||
ProductID = productID;
|
||||
KotID = kotID;
|
||||
}
|
||||
public BillItemKey(int kotID)
|
||||
: this(0, kotID, BillItemType.Kot)
|
||||
{ }
|
||||
public BillItemKey(int productID, int kotID)
|
||||
: this(productID, kotID, BillItemType.Product)
|
||||
{ }
|
||||
|
||||
private int _productID;
|
||||
public int ProductID
|
||||
{
|
||||
get { return BillItemType == BillItemType.Product ? _productID : 0; }
|
||||
private set { _productID = BillItemType == BillItemType.Product ? value : 0; }
|
||||
}
|
||||
|
||||
public int ProductID { get; private set; }
|
||||
public int KotID { get; private set; }
|
||||
|
||||
public BillItemType BillItemType { get; private set; }
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ProductID.GetHashCode() ^ KotID.GetHashCode();
|
||||
return BillItemType == BillItemType.Product ?
|
||||
ProductID.GetHashCode() ^ KotID.GetHashCode() ^ BillItemType.GetHashCode()
|
||||
: KotID.GetHashCode() ^ BillItemType.GetHashCode(); ;
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@ -41,7 +64,12 @@ namespace Tanshu.Accounts.Contracts
|
||||
if (!(b is BillItemKey))
|
||||
return false;
|
||||
|
||||
return a.ProductID == b.ProductID && a.KotID == b.KotID;
|
||||
if (a.BillItemType != b.BillItemType)
|
||||
return false;
|
||||
|
||||
return a.BillItemType == BillItemType.Product ?
|
||||
a.ProductID == b.ProductID && a.KotID == b.KotID && a.BillItemType == b.BillItemType
|
||||
: a.KotID == b.KotID && a.BillItemType == b.BillItemType;
|
||||
}
|
||||
public static bool operator !=(BillItemKey a, BillItemKey b)
|
||||
{
|
||||
|
||||
@ -16,4 +16,11 @@ namespace Tanshu.Accounts.Contracts
|
||||
public virtual decimal Sale { get; set; }
|
||||
public virtual decimal NC { get; set; }
|
||||
}
|
||||
public class BillDetail
|
||||
{
|
||||
public virtual DateTime Date { get; set; }
|
||||
public virtual string BillID { get; set; }
|
||||
public virtual string Settlement { get; set; }
|
||||
public virtual decimal Amount { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user