narsil/Tanshu.Accounts.PointOfSale/Controllers/BillDict.cs
tanshu da929ad036 Breaking Change: Changed Kot/Voucher Table Name to Guid Foreign key
Breaking Change: Renamed Discontinued to IsActive and added NA field to products.
Cleanup: Removed not used attributes
Change: RoleConstants changed to simple string
Feature: Table Create/Edit/Reorder and Modifier Create/Edit Form
Feature: Bills now show the Tax name from the database and not a hack
2014-10-16 16:41:55 +05:30

45 lines
1.7 KiB
C#

using Tanshu.Accounts.Contracts;
using Tanshu.Common;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.PointOfSale
{
public class BillDict : OrderedDictionary<BillItemKey, BillItemValue>
{
public delegate void ItemChangedHandler();
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);
}
}
}
}
}