2012-12-01 09:49:33 +00:00
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
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();
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public void Load(Voucher voucher) {
|
|
|
|
|
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);
|
|
|
|
|
var item = new BillItemValue(inv.Product)
|
|
|
|
|
{
|
|
|
|
|
ProductID = inv.Product.ProductID,
|
|
|
|
|
Discount = inv.Discount,
|
|
|
|
|
Name =
|
|
|
|
|
inv.Product.Units == string.Empty
|
|
|
|
|
? inv.Product.Name
|
|
|
|
|
: inv.Product.Name + " (" + inv.Product.Units + ")",
|
|
|
|
|
Price = inv.Price,
|
|
|
|
|
Printed = true,
|
|
|
|
|
Quantity = inv.Quantity,
|
|
|
|
|
IsScTaxable = inv.IsScTaxable,
|
|
|
|
|
ServiceTaxRate = inv.ServiceTaxRate,
|
|
|
|
|
VatRate = inv.VatRate,
|
|
|
|
|
ServiceTax = inv.ServiceTax,
|
|
|
|
|
Vat = inv.Vat,
|
|
|
|
|
ServiceCharge = inv.ServiceCharge,
|
|
|
|
|
};
|
|
|
|
|
foreach (var mod in inv.InventoryModifier)
|
|
|
|
|
item.Modifiers.Add(mod.Modifier);
|
|
|
|
|
this.Add(key, item);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-12-01 09:49:33 +00:00
|
|
|
|
|
2014-10-12 09:41:45 +00:00
|
|
|
|
}
|
2012-12-01 09:49:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|