Reprint and Printed bill editing logged.

Printed bill can no longer be changed, any changes voids the bill and prints a new one.
Added option to Split Bill.
Kot printed with right time.
Numerous bug fixes.
This commit is contained in:
unknown
2011-08-23 12:40:05 +05:30
parent 226cc30057
commit 831ec37cda
28 changed files with 625 additions and 286 deletions

View File

@ -77,8 +77,9 @@ namespace Tanshu.Accounts.Contracts
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);
if (Modifiers != null)
foreach (var item in Modifiers)
output += string.Format("\n\r -- {0}", item.Name);
return output;
//if (Price == 0)
@ -96,10 +97,45 @@ namespace Tanshu.Accounts.Contracts
public IList<Modifier> Modifiers { get; set; }
public BillItemValue(Product product)
{
Quantity = 1;
Printed = false;
Modifiers = new List<Modifier>();
Product = product;
if (product != null)
{
Product = product;
ProductID = product.ProductID;
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")";
Quantity = 1;
Price = product.SalePrice;
Tax = product.Tax.Rate;
ServiceCharge = product.ServiceCharge;
Discount = 0;
Printed = false;
}
}
public BillItemValue()
{
Product = null;
ProductID = 0;
Discount = 0;
Name = "== New Kot ==";
Price = 0;
Printed = true;
Quantity = 0;
Tax = -1;
ServiceCharge = 0;
}
public BillItemValue(Kot kot)
{
Product = null;
ProductID = kot.KotID;
Discount = 0;
Name = string.Format("Kot: {0} / {1:dd-MMM HH:mm} ({2})", kot.Code, kot.Date, kot.User.Name);
Price = 0;
Printed = true;
Quantity = 0;
Tax = -1;
ServiceCharge = 0;
}
}
}
}

View File

@ -0,0 +1,13 @@
using System;
using Tanshu.Accounts.Entities.Auth;
namespace Tanshu.Accounts.Entities
{
public class Reprint
{
public virtual int ReprintID { get; set; }
public virtual User User { get; set; }
public virtual DateTime Date { get; set; }
public virtual Voucher Voucher { get; set; }
}
}

View File

@ -8,27 +8,56 @@ namespace Tanshu.Accounts.Entities
{
public class Voucher
{
public Voucher()
protected Voucher()
{
Kots = new List<Kot>();
Settlements = new List<VoucherSettlement>();
}
public virtual int VoucherID { get; set; }
public virtual DateTime? Date { get; set; }
public Voucher(User user)
: this()
{
this._date = null;
this.User = user;
}
protected int _voucherID;
public virtual int VoucherID
{
get { return _voucherID; }
}
protected DateTime? _date;
public virtual DateTime? Date
{
get { return _date; }
}
public virtual string Narration { get; set; }
[NotNull]
public virtual User User { get; set; }
protected DateTime _creationDate;
[NotNull]
public virtual DateTime CreationDate { get; set; }
public virtual DateTime CreationDate
{
get { return _creationDate; }
}
protected DateTime _lastEditDate;
[NotNull]
public virtual DateTime LastEditDate { get; set; }
public virtual DateTime LastEditDate
{
get { return _lastEditDate; }
}
protected string _billID;
[NotNull]
public virtual string BillID { get; set; }
public virtual string BillID
{
get { return _billID; }
}
[NotNull]
public virtual string TableID { get; set; }
@ -48,11 +77,33 @@ namespace Tanshu.Accounts.Entities
[AllowNull]
public virtual string VoidReason { get; set; }
[NotNull]
public virtual bool Printed { get; set; }
protected bool _printed;
[NotNull]
public virtual string KotID { get; set; }
public virtual bool Printed
{
get
{ return _printed; }
set
{
if (_printed)
return;
if (value == false)
return;
_date = null;
_printed = value;
}
}
#pragma warning disable 649
private string _kotID;
#pragma warning restore 649
[NotNull]
public virtual string KotID
{
get { return _kotID; }
}
[Cascade]
public virtual IList<Kot> Kots { get; set; }

View File

@ -0,0 +1,28 @@
using System.Reflection;
using Tanshu.Accounts.Entities;
namespace Tanshu.Common.Helpers
{
public enum VoucherFields
{
CreationDate,
LastEditDate,
Date,
BillID,
KotID
}
public static class ReflectionHelper
{
public static void SetValue(this Voucher voucher, VoucherFields field, object value)
{
var fi = typeof(Voucher).GetField(ConvertToCamelCaseUnderscore(field.ToString()), BindingFlags.NonPublic | BindingFlags.Instance);
if (fi != null)
fi.SetValue(voucher, value);
}
private static string ConvertToCamelCaseUnderscore(string propertyName)
{
return "_" + propertyName[0].ToString().ToLower() + propertyName.Substring(1);
}
}
}

View File

@ -39,6 +39,7 @@ namespace Tanshu.Accounts.Contracts
public static RoleConstants BILL_DETAILS = new RoleConstants("Sales/BillDetails");
public static RoleConstants SALE_ANALYSIS = new RoleConstants("Sales/SaleAnalysis");
public static RoleConstants SALE_DETAIL = new RoleConstants("Sales/SaleDetail");
public static RoleConstants SPLIT_BILL = new RoleConstants("Split Bill");
public static RoleConstants VOID_BILL = new RoleConstants("Sales/VoidPrintedBill");
public static RoleConstants ZERO_RATE = new RoleConstants("Sales/ZeroRate");
public static RoleConstants SETTLE_BILL = new RoleConstants("Sales/SettleBill");

View File

@ -93,6 +93,7 @@
<Compile Include="Data Contracts\Auth\RoleGroup.cs" />
<Compile Include="Data Contracts\Auth\Group.cs" />
<Compile Include="Data Contracts\Auth\Role.cs" />
<Compile Include="Data Contracts\ReprintBO.cs" />
<Compile Include="Data Contracts\VoucherSettlementBO.cs" />
<Compile Include="Data Contracts\KotBO.cs" />
<Compile Include="Data Contracts\PaymentGroupBO.cs" />
@ -114,6 +115,7 @@
<Compile Include="Data Contracts Display\ProductDisplayBO.cs" />
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs" />
<Compile Include="Data Contracts\ProductGroupBO.cs" />
<Compile Include="Helper Functions\ReflectionHelper.cs" />
<Compile Include="Helper Functions\EnumHelper.cs" />
<Compile Include="nHibernate\IAuditable.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />