bb2db24837
error prone and more understandable. Refactor: Also upgrade path to moving from Price/FullPrice to HasHappyHour/ IsHappyHour Must have a few errors.
67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
using System;
|
|
using Tanshu.Accounts.Entities;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
{
|
|
public class BillItemValue
|
|
{
|
|
public Inventory inventory { get; set; }
|
|
public Kot kot { get; private set; }
|
|
|
|
public string Display
|
|
{
|
|
get
|
|
{
|
|
if (inventory != null)
|
|
{
|
|
var output = string.Format("{0} @ Rs. {1:#.##}", inventory.Product.FullName, inventory.Price);
|
|
if (inventory.Discount != 0)
|
|
output += string.Format(" - {0:#.##%}", inventory.Discount);
|
|
foreach (var item in inventory.InventoryModifier)
|
|
output += string.Format("\n\r -- {0}", item.Modifier.Name);
|
|
return output;
|
|
}
|
|
else if (kot.KotID != Guid.Empty)
|
|
{
|
|
return string.Format("Kot: S-{0} / {1:dd-MMM HH:mm} ({2})", kot.Code, kot.Date, kot.User.Name);
|
|
}
|
|
else
|
|
{
|
|
return "== New Kot ==";
|
|
}
|
|
}
|
|
}
|
|
public BillItemValue(Inventory inv)
|
|
{
|
|
inventory = inv;
|
|
}
|
|
public BillItemValue(Product product)
|
|
{
|
|
inventory = new Inventory()
|
|
{
|
|
Product = product,
|
|
FullPrice = product.FullPrice,
|
|
Price = product.Price,
|
|
IsScTaxable = product.IsScTaxable,
|
|
Quantity = 1,
|
|
ServiceCharge = product.ServiceCharge,
|
|
ServiceTax = product.ServiceTax,
|
|
Vat = product.Vat,
|
|
Discount = 0,
|
|
ServiceTaxRate = product.ServiceTax.Rate,
|
|
VatRate = product.Vat.Rate
|
|
};
|
|
}
|
|
public BillItemValue()
|
|
{
|
|
this.kot = new Kot();
|
|
}
|
|
|
|
public BillItemValue(Kot kot)
|
|
{
|
|
this.kot = kot;
|
|
}
|
|
|
|
}
|
|
} |