2016-03-29 09:36:46 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
2012-12-01 09:49:33 +00:00
|
|
|
|
using Tanshu.Common;
|
2014-10-12 09:41:45 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
2012-12-01 09:49:33 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
|
|
|
|
public class BillDict : OrderedDictionary<BillItemKey, BillItemValue>
|
|
|
|
|
{
|
|
|
|
|
public delegate void ItemChangedHandler();
|
2016-03-29 09:36:46 +00:00
|
|
|
|
public void Load(Voucher voucher)
|
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
foreach (var kot in voucher.Kots)
|
|
|
|
|
{
|
|
|
|
|
var kotKey = new BillItemKey(kot.KotID);
|
|
|
|
|
var kotItem = new BillItemValue(kot);
|
|
|
|
|
this.Add(kotKey, kotItem);
|
|
|
|
|
foreach (var inv in kot.Inventories)
|
|
|
|
|
{
|
|
|
|
|
var key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
2016-03-29 09:36:46 +00:00
|
|
|
|
var item = new BillItemValue(inv);
|
2014-10-12 09:41:45 +00:00
|
|
|
|
this.Add(key, item);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-29 09:36:46 +00:00
|
|
|
|
}
|
|
|
|
|
public decimal Tax
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.ServiceTaxAmount + i.Value.inventory.VatAmount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public decimal Discount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.DiscountAmount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public decimal ServiceCharge
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.ServiceChargeAmount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public decimal NetAmount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.Net);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public decimal Amount
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.Where(x => x.Key.BillItemType != BillItemType.Kot).Sum(i => i.Value.inventory.Amount);
|
|
|
|
|
}
|
2014-10-12 09:41:45 +00:00
|
|
|
|
}
|
2012-12-01 09:49:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|