d8ecec8bb6
BillInventory Renamed. Refactored Bill to be more usable. Added Bill Detail Report. Added Open Bill and Bill Details Roles. Zero Rate Products have Yellow background Color. Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI, Cached the Products List. Product and Product Group Form Working.
106 lines
2.9 KiB
C#
106 lines
2.9 KiB
C#
using System;
|
|
using Tanshu.Accounts.Entities;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Tanshu.Accounts.Contracts
|
|
{
|
|
public class BillItemValue
|
|
{
|
|
public int ProductID { get; set; }
|
|
public string Name { get; set; }
|
|
public decimal Price { get; set; }
|
|
public decimal Quantity { get; set; }
|
|
private decimal _discount;
|
|
public Product Product { get; private set; }
|
|
|
|
public decimal Discount
|
|
{
|
|
get { return _discount; }
|
|
set
|
|
{
|
|
if (value < 0)
|
|
throw new ArgumentException("Discount has to be non-negative greater than or equal to zero.");
|
|
if (value > 1)
|
|
throw new ArgumentException("Discount has to be less than one.");
|
|
_discount = value;
|
|
}
|
|
}
|
|
|
|
public decimal Tax { get; set; }
|
|
public decimal TaxAmount
|
|
{
|
|
get
|
|
{
|
|
return Quantity * Price * (1 - _discount) * (1 + ServiceCharge) * Tax;
|
|
}
|
|
}
|
|
|
|
public decimal ServiceCharge { get; set; }
|
|
public decimal ServiceChargeAmount
|
|
{
|
|
get
|
|
{
|
|
return Quantity * Price * (1 - _discount) * ServiceCharge;
|
|
}
|
|
}
|
|
|
|
public decimal DiscountAmount
|
|
{
|
|
get
|
|
{
|
|
return Quantity * Price * _discount;
|
|
}
|
|
}
|
|
|
|
public decimal GrossAmount
|
|
{
|
|
get
|
|
{
|
|
return Quantity * Price * (1 - _discount);
|
|
}
|
|
}
|
|
|
|
public bool Printed { get; set; }
|
|
|
|
public decimal Value
|
|
{
|
|
get
|
|
{
|
|
return Price * Quantity * (1 - _discount) * (1 + ServiceCharge) * (1 + Tax);
|
|
}
|
|
}
|
|
|
|
public string Display
|
|
{
|
|
get
|
|
{
|
|
var output = string.Format("{0} @ Rs. {1:#.##}", Name, Price);
|
|
if (_discount != 0)
|
|
output += string.Format(" - {0:#.##%}", _discount);
|
|
foreach (var item in Modifiers)
|
|
output += string.Format("\n\r -- {0}", item.Name);
|
|
return output;
|
|
|
|
//if (Price == 0)
|
|
// return string.Format(" -- {0}", Name);
|
|
//string output = string.Format("{0} @ Rs. {1:#.##}", Name, Price);
|
|
//if (discount != 0)
|
|
// output += string.Format(" - {0:#.##%}", discount);
|
|
//return output;
|
|
}
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} - {1}", ProductID, Name);
|
|
}
|
|
public IList<Modifier> Modifiers { get; set; }
|
|
public BillItemValue(Product product)
|
|
{
|
|
Quantity = 1;
|
|
Printed = false;
|
|
Modifiers = new List<Modifier>();
|
|
Product = product;
|
|
}
|
|
}
|
|
}
|