narsil/Tanshu.Accounts.Contracts/Data Contracts/Voucher.cs
2018-08-24 16:11:33 +05:30

76 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
namespace Tanshu.Accounts.Entities
{
public class Voucher
{
public Voucher()
{
Kots = new List<Kot>();
Settlements = new List<VoucherSettlement>();
}
public Voucher(User user, Customer customer)
: this()
{
this.User = user;
VoucherType = VoucherType.Regular;
Customer = customer;
}
public Voucher(User user, Customer customer, FoodTable table, bool printed, bool isVoid, string narration)
: this(user, customer)
{
Table = table;
Printed = printed;
Void = isVoid;
Narration = narration;
VoucherType = VoucherType.Regular;
}
public Guid VoucherID { get; set; }
public DateTime Date { private set; get; }
public int Pax { get; set; }
public User User { get; set; }
public DateTime CreationDate { private set; get; }
public DateTime LastEditDate { private set; get; }
public int? BillID { private set; get; }
public FoodTable Table { get; set; }
public Customer Customer { get; set; }
public List<VoucherSettlement> Settlements { get; set; }
public string Narration { get; set; }
public bool Void { get; set; }
public string VoidReason { get; set; }
public bool Printed { get; set; }
public VoucherType VoucherType { get; set; }
public int KotID { private set; get; }
public List<Kot> Kots { get; set; }
public List<Reprint> Reprints { get; set; }
public string FullBillID
{
get
{
if (BillID.HasValue)
{
switch (VoucherType)
{
case VoucherType.NoCharge:
return "NC-" + BillID.Value.ToString();
case VoucherType.Staff:
return "ST-" + BillID.Value.ToString();
case VoucherType.TakeAway:
case VoucherType.Regular:
default:
return (BillID.Value / 10000).ToString() + "-" + (BillID.Value % 10000).ToString();
}
}
else
{
return "K-" + KotID.ToString();
}
}
}
}
}