narsil/Tanshu.Accounts.Contracts/Data Contracts Display/BillInventoryBO.cs

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.EffectiveName, 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, bool isHappyHour)
{
inventory = new Inventory()
{
Product = product,
IsHappyHour = isHappyHour,
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;
}
}
}