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

67 lines
2.0 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using Tanshu.Accounts.Entities;
using System.Collections.Generic;
2010-03-02 17:56:21 +00:00
namespace Tanshu.Accounts.Contracts
{
public class BillItemValue
2010-03-02 17:56:21 +00:00
{
public Inventory inventory { get; set; }
public Kot kot { get; private set; }
2010-03-02 17:56:21 +00:00
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 ==";
}
2010-03-02 17:56:21 +00:00
}
}
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;
}
2010-03-02 17:56:21 +00:00
}
}