Moved numpad control to Tanshu.Common. Billing feature complete. Delete not working as expected

Signed-off-by: unknown <tanshu@.(none)>
This commit is contained in:
unknown
2011-02-01 02:03:22 +05:30
parent eb05811868
commit 0f323f8fab
64 changed files with 2029 additions and 1382 deletions

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tanshu.Accounts.Contracts
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class CascadeAttribute : Attribute
{
private string message = string.Empty;
public string Message
{
get { return message; }
set { message = value; }
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tanshu.Accounts.Contracts
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class NotNullAttribute : Attribute
{
private string message = string.Empty;
public string Message
{
get { return message; }
set { message = value; }
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tanshu.Accounts.Contracts
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class SecurityAttribute : Attribute
{
private string message = string.Empty;
public string Message
{
get { return message; }
set { message = value; }
}
}
}

View File

@ -11,31 +11,9 @@ namespace Tanshu.Accounts.Contracts
public string Name { get; set; }
private decimal price;
public decimal Price
{
get { return price; }
set
{
if (value <= 0)
throw new ArgumentException("Price has to be non-negative greater than zero.");
else
price = value;
}
}
public decimal Price { get; set; }
private decimal quantity = 1;
public decimal Quantity
{
get { return quantity; }
set
{
if (value <= 0)
throw new ArgumentException("Quantity has to be non-negative greater than zero.");
quantity = value;
}
}
public decimal Quantity { get; set; }
private decimal discount = 0;
public decimal Discount
@ -57,7 +35,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount) * (1 + ServiceCharge) * Tax;
return Quantity * Price * (1 - discount) * (1 + ServiceCharge) * Tax;
}
}
@ -66,7 +44,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount) * ServiceCharge;
return Quantity * Price * (1 - discount) * ServiceCharge;
}
}
@ -74,7 +52,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * discount;
return Quantity * Price * discount;
}
}
@ -82,7 +60,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return quantity * price * (1 - discount);
return Quantity * Price * (1 - discount);
}
}
@ -103,14 +81,14 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return price * quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
return Price * Quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
}
}
public decimal Additional
{
get
{
return quantity - printed;
return Quantity - printed;
}
}
@ -120,15 +98,29 @@ namespace Tanshu.Accounts.Contracts
{
get
{
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
string 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 BillInventory()
{
Quantity = 1;
printed = 0;
isNew = true;
Modifiers = new List<Modifier>();

View File

@ -5,10 +5,11 @@ namespace Tanshu.Accounts.Contracts
{
public class BillItemKey
{
public BillItemKey(int productID, bool isNew)
//Old = 0, New = 1, Modifiers = 2+
public BillItemKey(int ProductID, bool IsNew)
{
ProductID = productID;
IsNew = isNew;
this.ProductID = ProductID;
this.IsNew = IsNew;
}
public int ProductID
@ -41,7 +42,7 @@ namespace Tanshu.Accounts.Contracts
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (!(a is BillItemKey))
return false;
if (!(b is BillItemKey))

View File

@ -2,13 +2,16 @@
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Entities
{
public class Inventory
{
public virtual int InventoryID { get; set; }
[NotNull]
public virtual Voucher Voucher { get; set; }
[NotNull]
public virtual Product Product { get; set; }
private decimal quantity;
@ -72,6 +75,7 @@ namespace Tanshu.Accounts.Entities
}
[Cascade]
public virtual IList<InventoryModifier> InventoryModifier { get; set; }
decimal? amount;

View File

@ -1,13 +1,16 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Entities
{
public class InventoryModifier
{
public virtual int InventoryModifierID { get; set; }
[NotNull]
public virtual Inventory Inventory { get; set; }
[NotNull]
public virtual Modifier Modifier { get; set; }
}
}

View File

@ -1,6 +1,8 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Entities
{
@ -9,6 +11,9 @@ namespace Tanshu.Accounts.Entities
public virtual int ModifierID { get; set; }
public virtual string Name { get; set; }
[NotNull]
public virtual IList<ProductGroupModifier> ProductGroupModifiers { get; set; }
public override int GetHashCode()
{
return ModifierID.GetHashCode() ^ Name.GetHashCode();

View File

@ -6,12 +6,12 @@ namespace Tanshu.Accounts.Entities
{
public class PrintLocation
{
public int PrintLocationID { get; set; }
public ProductGroup ProductGroup { get; set; }
public string Location { get; set; }
public string Printer { get; set; }
public int Copies { get; set; }
public string CutCode { get; set; }
public virtual int PrintLocationID { get; set; }
public virtual ProductGroup ProductGroup { get; set; }
public virtual string Location { get; set; }
public virtual string Printer { get; set; }
public virtual int Copies { get; set; }
public virtual string CutCode { get; set; }
public override bool Equals(System.Object obj)
{

View File

@ -15,8 +15,6 @@ namespace Tanshu.Accounts.Entities
public virtual decimal ServiceCharge { get; set; }
public virtual decimal SalePrice { get; set; }
public virtual bool Discontinued { get; set; }
public virtual decimal MinimumLevel { get; set; }
public virtual decimal MaximumLevel { get; set; }
public virtual int SortOrder { get; set; }
}
}

View File

@ -7,8 +7,8 @@ namespace Tanshu.Accounts.Entities
{
public class SettleOption
{
public int SettleOptionID { get; set; }
public string Name { get; set; }
public virtual int SettleOptionID { get; set; }
public virtual string Name { get; set; }
public override bool Equals(System.Object obj)
{

View File

@ -3,6 +3,7 @@ using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using Tanshu.Accounts.Entities.Auth;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Entities
{
@ -17,6 +18,7 @@ namespace Tanshu.Accounts.Entities
public virtual DateTime CreationDate { get; set; }
public virtual DateTime LastEditDate { get; set; }
public virtual char Type { get; set; }
[Cascade]
public virtual IList<Inventory> Inventories { get; set; }
public Voucher()
{

View File

@ -85,6 +85,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Attributes\CascadeAttribute.cs" />
<Compile Include="Attributes\SecutiryAttribute.cs" />
<Compile Include="Attributes\NotNullAttribute.cs" />
<Compile Include="Data Contracts Display\BillItemKey.cs">
<SubType>Code</SubType>
</Compile>