Breaking Changes. Upgrade Script in Sql directory. Deployed
This commit is contained in:
1 parent
d4cfa92848
commit
9ed5843dbd
86 files changed
+2616
-2358
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,138 @@
|
||||
BEGIN TRANSACTION
|
||||
GO
|
||||
ALTER TABLE Auth_Groups ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Auth_Groups ADD CONSTRAINT UQ_Auth_Groups__6A3BB341 UNIQUE NONCLUSTERED (Name)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE dbo.Auth_RoleGroups ADD CONSTRAINT UQ_Auth_RoleGroups UNIQUE NONCLUSTERED (RoleID, GroupID)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE Auth_Roles ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Auth_Roles ADD CONSTRAINT UQ_Auth_Roles UNIQUE NONCLUSTERED (Name)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE dbo.Auth_UserGroups ADD CONSTRAINT UQ_Auth_UserGroups UNIQUE NONCLUSTERED (UserID, GroupID)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE Auth_Users ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Auth_Users ADD CONSTRAINT UQ_Auth_Users UNIQUE NONCLUSTERED (Name)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE Entities_FoodTables ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Entities_FoodTables ADD CONSTRAINT UQ_Entities_FoodTables UNIQUE NONCLUSTERED (Name)ON [PRIMARY]
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FKE67F888598906505]') AND parent_object_id = OBJECT_ID(N'[dbo].[Entities_Vouchers]'))
|
||||
ALTER TABLE [dbo].[Entities_Vouchers] DROP CONSTRAINT [FKE67F888598906505]
|
||||
GO
|
||||
EXECUTE sp_rename N'dbo.Entities_Vouchers.SettledID', N'Settled', 'COLUMN'
|
||||
GO
|
||||
--delete from entities_inventorymodifiers where inventorymodifierid in (22,23, 39, 103, 104, 174, 175, 177, 229, 272, 441, 487, 488, 364)
|
||||
--GO
|
||||
--ALTER TABLE dbo.Entities_InventoryModifiers ADD CONSTRAINT UQ_Entities_InventoryModifiers UNIQUE NONCLUSTERED (InventoryID, ModifierID)ON [PRIMARY]
|
||||
--GO
|
||||
CREATE TABLE [dbo].[Entities_Kots](
|
||||
[KotID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Code] [nvarchar](255) NULL,
|
||||
[TableID] [nvarchar](255) NULL,
|
||||
[Printed] [bit] NULL,
|
||||
[Date] [datetime] NULL,
|
||||
[VoucherID] [int] NULL,
|
||||
[UserID] [int] NULL,
|
||||
CONSTRAINT [PK__Entities_Kots] PRIMARY KEY CLUSTERED
|
||||
(KotID ASC)ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Kots] WITH CHECK ADD CONSTRAINT [FK7785BB6998E59CD2] FOREIGN KEY([VoucherID])
|
||||
REFERENCES [dbo].[Entities_Vouchers] ([VoucherID])
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Kots] CHECK CONSTRAINT [FK7785BB6998E59CD2]
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Kots] WITH CHECK ADD CONSTRAINT [FK7785BB69B9E9332A] FOREIGN KEY([UserID])
|
||||
REFERENCES [dbo].[Auth_Users] ([UserID])
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Kots] CHECK CONSTRAINT [FK7785BB69B9E9332A]
|
||||
GO
|
||||
ALTER TABLE Entities_Modifiers ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE dbo.Entities_Modifiers ADD CONSTRAINT UQ_Entities_Modifiers UNIQUE NONCLUSTERED (Name)ON [PRIMARY]
|
||||
GO
|
||||
ALTER TABLE Entities_Products ALTER COLUMN Name nvarchar(255) NOT NULL
|
||||
GO
|
||||
ALTER TABLE Entities_Vouchers DROP COLUMN discriminator
|
||||
GO
|
||||
ALTER TABLE Entities_Vouchers DROP COLUMN Code
|
||||
GO
|
||||
ALTER TABLE Entities_Vouchers DROP COLUMN Ref
|
||||
GO
|
||||
ALTER TABLE Entities_Vouchers DROP COLUMN Type
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FKE67F8885A819A402]') AND parent_object_id = OBJECT_ID(N'[dbo].[Entities_Vouchers]'))
|
||||
ALTER TABLE [dbo].[Entities_Vouchers] DROP CONSTRAINT [FKE67F8885A819A402]
|
||||
GO
|
||||
ALTER TABLE Entities_Vouchers DROP COLUMN PaymentGroupID
|
||||
GO
|
||||
SET IDENTITY_INSERT dbo.Entities_Kots ON
|
||||
GO
|
||||
INSERT INTO Entities_Kots(KotID, Code, TableID, Printed, Date, VoucherID, UserID)
|
||||
SELECT VoucherID, 'S-' + CAST(VoucherID AS nvarchar(200)), TableID, 1, CreationDate, VoucherID, UserID from entities_Vouchers
|
||||
GO
|
||||
SET IDENTITY_INSERT dbo.Entities_Kots OFF
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK695304F8BA29671A]') AND parent_object_id = OBJECT_ID(N'[dbo].[Entities_InventoryModifiers]'))
|
||||
ALTER TABLE [dbo].[Entities_InventoryModifiers] DROP CONSTRAINT [FK695304F8BA29671A]
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK53E4F7FE3F88CAB6]') AND parent_object_id = OBJECT_ID(N'[dbo].[Entities_Inventories]'))
|
||||
ALTER TABLE [dbo].[Entities_Inventories] DROP CONSTRAINT [FK53E4F7FE3F88CAB6]
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK53E4F7FEDB70F42]') AND parent_object_id = OBJECT_ID(N'[dbo].[Entities_Inventories]'))
|
||||
ALTER TABLE [dbo].[Entities_Inventories] DROP CONSTRAINT [FK53E4F7FEDB70F42]
|
||||
GO
|
||||
CREATE TABLE [dbo].[Temp_Entities_Inventories](
|
||||
[InventoryID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Quantity] [decimal](19, 5) NULL,
|
||||
[Rate] [decimal](19, 5) NULL,
|
||||
[Tax] [decimal](19, 5) NULL,
|
||||
[Discount] [decimal](19, 5) NULL,
|
||||
[ServiceCharge] [decimal](19, 5) NULL,
|
||||
[Amount] AS (((([Quantity]*[Rate])*((1)-[Discount]))*((1)+[ServiceCharge]))*((1)+[Tax])),
|
||||
[KotID] [int] NULL,
|
||||
[ProductID] [int] NULL,
|
||||
CONSTRAINT [PK__Entities_Inventories] PRIMARY KEY CLUSTERED
|
||||
([InventoryID] ASC) ON [PRIMARY]
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
SET IDENTITY_INSERT dbo.Temp_Entities_Inventories ON
|
||||
GO
|
||||
IF EXISTS(SELECT * FROM dbo.Entities_Inventories)
|
||||
EXEC('INSERT INTO Temp_Entities_Inventories (InventoryID, Quantity, Rate, Tax, Discount, ServiceCharge, KotID, ProductID)
|
||||
SELECT InventoryID, Quantity, Rate, Tax, Discount, ServiceCharge, VoucherID, ProductID FROM Entities_Inventories WITH (HOLDLOCK TABLOCKX)')
|
||||
GO
|
||||
SET IDENTITY_INSERT dbo.Temp_Entities_Inventories OFF
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Entities_Inventories]') AND type in (N'U'))
|
||||
DROP TABLE [dbo].[Entities_Inventories]
|
||||
GO
|
||||
EXECUTE sp_rename N'dbo.Temp_Entities_Inventories', N'Entities_Inventories', 'OBJECT'
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Inventories] WITH CHECK ADD CONSTRAINT [FK53E4F7FE3F88CAB6] FOREIGN KEY([ProductID])
|
||||
REFERENCES [dbo].[Entities_Products] ([ProductID])
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Inventories] CHECK CONSTRAINT [FK53E4F7FE3F88CAB6]
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Inventories] WITH CHECK ADD CONSTRAINT [FK53E4F7FEDB70F42] FOREIGN KEY([KotID])
|
||||
REFERENCES [dbo].[Entities_Kots] ([KotID])
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_Inventories] CHECK CONSTRAINT [FK53E4F7FEDB70F42]
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_InventoryModifiers] WITH CHECK ADD CONSTRAINT [FK695304F8BA29671A] FOREIGN KEY([InventoryID])
|
||||
REFERENCES [dbo].[Entities_Inventories] ([InventoryID])
|
||||
GO
|
||||
ALTER TABLE [dbo].[Entities_InventoryModifiers] CHECK CONSTRAINT [FK695304F8BA29671A]
|
||||
GO
|
||||
INSERT INTO Auth_Roles(Name) VALUES ('Sales/MergeTable')
|
||||
INSERT INTO Auth_Roles(Name) VALUES ('Sales/MergeKot')
|
||||
INSERT INTO Auth_Roles(Name) VALUES ('Sales/MoveKot')
|
||||
GO
|
||||
COMMIT TRANSACTION
|
||||
|
||||
select * from auth_roles order by roleid
|
||||
@@ -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 AllowNullAttribute : Attribute
|
||||
{
|
||||
private string message = string.Empty;
|
||||
public string Message
|
||||
{
|
||||
get { return message; }
|
||||
set { message = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public class FormulaAttribute : Attribute
|
||||
{
|
||||
private string message = string.Empty;
|
||||
public string Message
|
||||
{
|
||||
get { return message; }
|
||||
set { message = value; }
|
||||
}
|
||||
private string formula = string.Empty;
|
||||
public string Formula
|
||||
{
|
||||
get { return formula; }
|
||||
set { formula = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public class AllowNullAttribute : Attribute
|
||||
public class NotNullAttribute : Attribute
|
||||
{
|
||||
private string message = string.Empty;
|
||||
public string Message
|
||||
|
||||
@@ -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 UniqueAttribute : Attribute
|
||||
{
|
||||
private string message = string.Empty;
|
||||
public string Message
|
||||
{
|
||||
get { return message; }
|
||||
set { message = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,18 +60,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
}
|
||||
}
|
||||
|
||||
private decimal printed;
|
||||
public decimal Printed
|
||||
{
|
||||
get { return printed; }
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
throw new ArgumentException("Printed has to be non-negative greater than or equal to zero.");
|
||||
else
|
||||
printed = value;
|
||||
}
|
||||
}
|
||||
public bool Printed {get; set;}
|
||||
|
||||
public decimal Value
|
||||
{
|
||||
@@ -80,14 +69,6 @@ namespace Tanshu.Accounts.Contracts
|
||||
return Price * Quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
|
||||
}
|
||||
}
|
||||
public decimal Additional
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity - Printed;
|
||||
}
|
||||
}
|
||||
public bool isNew;
|
||||
|
||||
public string Display
|
||||
{
|
||||
@@ -116,8 +97,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
public BillInventory()
|
||||
{
|
||||
Quantity = 1;
|
||||
printed = 0;
|
||||
isNew = true;
|
||||
Printed = false;
|
||||
Modifiers = new List<Modifier>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,25 +6,18 @@ namespace Tanshu.Accounts.Contracts
|
||||
public class BillItemKey
|
||||
{
|
||||
//Old = 0, New = 1, Modifiers = 2+
|
||||
public BillItemKey(int ProductID, bool IsNew)
|
||||
public BillItemKey(int ProductID, int KotID)
|
||||
{
|
||||
this.ProductID = ProductID;
|
||||
this.IsNew = IsNew;
|
||||
this.KotID = KotID;
|
||||
}
|
||||
|
||||
public int ProductID
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public bool IsNew
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public int ProductID { get; private set; }
|
||||
public int KotID { get; private set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ProductID.GetHashCode() ^ IsNew.GetHashCode();
|
||||
return ProductID.GetHashCode() ^ KotID.GetHashCode();
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
@@ -35,7 +28,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} - {1}", ProductID, IsNew);
|
||||
return string.Format("{0} - {1}", ProductID, KotID);
|
||||
}
|
||||
|
||||
public static bool operator ==(BillItemKey a, BillItemKey b)
|
||||
@@ -48,7 +41,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
if (!(b is BillItemKey))
|
||||
return false;
|
||||
|
||||
return a.ProductID == b.ProductID && a.IsNew == b.IsNew;
|
||||
return a.ProductID == b.ProductID && a.KotID == b.KotID;
|
||||
}
|
||||
public static bool operator !=(BillItemKey a, BillItemKey b)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
@@ -10,6 +11,7 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual int AdvanceID { get; private set; }
|
||||
public virtual decimal Amount { get; set; }
|
||||
public virtual string Narration { get; set; }
|
||||
[NotNull]
|
||||
public virtual User CashierIn { get; set; }
|
||||
public virtual DateTime DateIn { get; set; }
|
||||
public virtual User CashierOut { get; set; }
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities.Auth
|
||||
{
|
||||
public class Group
|
||||
{
|
||||
public virtual int GroupID { get; set; }
|
||||
[NotNull, Unique]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual IList<RoleGroup> RoleGroups { get; set; }
|
||||
public virtual IList<UserGroup> UserGroups { get; set; }
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities.Auth
|
||||
{
|
||||
public class Role
|
||||
{
|
||||
public virtual int RoleID { get; set; }
|
||||
[NotNull, Unique]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual IList<RoleGroup> Groups { get; set; }
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities.Auth
|
||||
{
|
||||
public class RoleGroup
|
||||
{
|
||||
public virtual int RoleGroupID { get; set; }
|
||||
[NotNull]
|
||||
public virtual Role Role { get; set; }
|
||||
[NotNull]
|
||||
public virtual Group Group { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,19 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities.Auth
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public virtual int UserID { get; set; }
|
||||
[Unique] [NotNull]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string MsrString { get; set; }
|
||||
[NotNull]
|
||||
public virtual string Password { get; set; }
|
||||
[NotNull]
|
||||
public virtual bool LockedOut { get; set; }
|
||||
public virtual IList<UserGroup> UserGroups { get; set; }
|
||||
public User()
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities.Auth
|
||||
{
|
||||
public class UserGroup
|
||||
{
|
||||
public virtual int UserGroupID { get; set; }
|
||||
[NotNull]
|
||||
public virtual User User { get; set; }
|
||||
[NotNull]
|
||||
public virtual Group Group { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,7 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual int FoodTableID { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Location { get; set; }
|
||||
public virtual string Status { get; set; }
|
||||
public virtual int VoucherID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,39 +9,27 @@ namespace Tanshu.Accounts.Entities
|
||||
public class Inventory
|
||||
{
|
||||
public virtual int InventoryID { get; set; }
|
||||
public virtual Voucher Voucher { get; set; }
|
||||
[NotNull]
|
||||
public virtual Kot Kot { get; set; }
|
||||
[NotNull]
|
||||
public virtual Product Product { get; set; }
|
||||
|
||||
public virtual decimal Quantity { get; set; }
|
||||
|
||||
public virtual decimal Rate { get; set; }
|
||||
|
||||
public virtual decimal Tax { get; set; }
|
||||
|
||||
public virtual decimal Discount { get; set; }
|
||||
|
||||
public virtual decimal ServiceCharge { get; set;}
|
||||
public virtual decimal ServiceCharge { get; set; }
|
||||
|
||||
[Cascade]
|
||||
public virtual IList<InventoryModifier> InventoryModifier { get; set; }
|
||||
|
||||
[Formula(Formula = "Quantity * Rate * (1 - Discount) * (1 + ServiceCharge) * (1 + Tax)")]
|
||||
public virtual decimal Amount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Quantity * Rate * (1 + Tax) * (1 + ServiceCharge) * (1 - Discount);
|
||||
}
|
||||
set
|
||||
{ }
|
||||
private set { }
|
||||
}
|
||||
|
||||
//public decimal DiscountAmount
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return quantity * rate * (1 + tax) * (1 + serviceCharge) * discount;
|
||||
// }
|
||||
//}
|
||||
public Inventory()
|
||||
{
|
||||
InventoryModifier = new List<InventoryModifier>();
|
||||
|
||||
@@ -8,7 +8,9 @@ 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class Kot
|
||||
{
|
||||
public virtual int KotID { get; set; }
|
||||
public virtual Voucher Voucher { get; set; }
|
||||
public virtual string Code { get; set; }
|
||||
public virtual string TableID { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual DateTime Date { get; set; }
|
||||
[NotNull]
|
||||
public virtual User User { get; set; }
|
||||
[Cascade]
|
||||
public virtual IList<Inventory> Inventories { get; set; }
|
||||
public Kot()
|
||||
{
|
||||
Inventories = new List<Inventory>();
|
||||
Printed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
@@ -10,6 +11,7 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual int PaymentID { get; set; }
|
||||
public virtual DateTime Date { get; set; }
|
||||
public virtual string Type { get; set; }
|
||||
[NotNull]
|
||||
public virtual User Cashier { get; set; }
|
||||
public virtual decimal Amount { get; set; }
|
||||
public virtual string Narration { get; set; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
@@ -8,9 +9,12 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public virtual int ProductID { get; set; }
|
||||
public virtual int Code { get; set; }
|
||||
[NotNull]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string Units { get; set; }
|
||||
[NotNull]
|
||||
public virtual ProductGroup ProductGroup { get; set; }
|
||||
[NotNull]
|
||||
public virtual Tax Tax { get; set; }
|
||||
public virtual decimal ServiceCharge { get; set; }
|
||||
public virtual decimal SalePrice { get; set; }
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class ProductGroup
|
||||
{
|
||||
public virtual int ProductGroupID { get; set; }
|
||||
[NotNull, Unique]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual decimal DiscountLimit { get; set; }
|
||||
public virtual bool IsModifierCompulsory { get; set; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
@@ -8,6 +9,7 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public virtual int ProductGroupModifierID { get; set; }
|
||||
public virtual ProductGroup ProductGroup { get; set; }
|
||||
[NotNull]
|
||||
public virtual Modifier Modifier { get; set; }
|
||||
public virtual bool ShowAutomatically { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class SaleVoucher : Voucher
|
||||
{
|
||||
public virtual string BillID { get; set; }
|
||||
public virtual string TableID { get; set; }
|
||||
public virtual Waiter Waiter { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
public virtual SettleOption Settled { get; set; }
|
||||
public virtual bool Void { get; set; }
|
||||
[AllowNull]
|
||||
public virtual string VoidReason { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual string KotID { get; set; }
|
||||
public virtual PaymentGroup PaymentGroup { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,64 +5,13 @@ using System.Text;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class SettleOption
|
||||
public enum SettleOption
|
||||
{
|
||||
public virtual int SettleOptionID { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
|
||||
public override bool Equals(System.Object obj)
|
||||
{
|
||||
if (obj is SettleOption)
|
||||
return (this == (SettleOption)obj);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return SettleOptionID.GetHashCode() ^ Name.GetHashCode();
|
||||
}
|
||||
public static bool operator ==(SettleOption a, SettleOption b)
|
||||
{
|
||||
if (object.ReferenceEquals(null, a))
|
||||
return object.ReferenceEquals(null, b);
|
||||
|
||||
if (!(a is SettleOption))
|
||||
return false;
|
||||
if (!(b is SettleOption))
|
||||
return false;
|
||||
|
||||
return (a.SettleOptionID == b.SettleOptionID)
|
||||
&& (a.Name == b.Name);
|
||||
}
|
||||
public static bool operator !=(SettleOption a, SettleOption b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
//public enum SettleOption
|
||||
//{
|
||||
// Unsettled = 0,
|
||||
// Cash = 1,
|
||||
// CreditCard = 2,
|
||||
// NoCharge = 3,
|
||||
// BillToCompany = 4,
|
||||
// Staff = 5
|
||||
//}
|
||||
//public class SettleOption
|
||||
//{
|
||||
// public static readonly SettleOption Unsettled = new SettleOption(0);
|
||||
// public static readonly SettleOption Cash = new SettleOption(1);
|
||||
// public static readonly SettleOption CreditCard = new SettleOption(2);
|
||||
// public static readonly SettleOption NoCharge = new SettleOption(3);
|
||||
// public static readonly SettleOption BillToCompany = new SettleOption(4);
|
||||
// public static readonly SettleOption Staff = new SettleOption(5);
|
||||
|
||||
// public int SettleOptionID { get; private set; }
|
||||
|
||||
// private SettleOption(int settleOption)
|
||||
// {
|
||||
// this.SettleOptionID = settleOption;
|
||||
// }
|
||||
//}
|
||||
Unsettled = 1,
|
||||
Cash = 2,
|
||||
CreditCard = 3,
|
||||
NoCharge = 4,
|
||||
BillToCompany = 5,
|
||||
Staff = 6
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class Tax
|
||||
{
|
||||
public virtual int TaxID { get; set; }
|
||||
[NotNull, Unique]
|
||||
public virtual string Name { get; set; }
|
||||
public virtual decimal Rate { get; set; }
|
||||
}
|
||||
|
||||
@@ -10,19 +10,37 @@ namespace Tanshu.Accounts.Entities
|
||||
public class Voucher
|
||||
{
|
||||
public virtual int VoucherID { get; set; }
|
||||
public virtual int Code { get; set; }
|
||||
public virtual string Ref { get; set; }
|
||||
public virtual DateTime? Date { get; set; }
|
||||
public virtual string Narration { get; set; }
|
||||
[NotNull]
|
||||
public virtual User User { get; set; }
|
||||
[NotNull]
|
||||
public virtual DateTime CreationDate { get; set; }
|
||||
[NotNull]
|
||||
public virtual DateTime LastEditDate { get; set; }
|
||||
public virtual char Type { get; set; }
|
||||
[NotNull]
|
||||
public virtual string BillID { get; set; }
|
||||
[NotNull]
|
||||
public virtual string TableID { get; set; }
|
||||
[NotNull]
|
||||
public virtual Waiter Waiter { get; set; }
|
||||
[NotNull]
|
||||
public virtual Customer Customer { get; set; }
|
||||
[NotNull]
|
||||
public virtual SettleOption Settled { get; set; }
|
||||
[NotNull]
|
||||
public virtual bool Void { get; set; }
|
||||
[AllowNull]
|
||||
public virtual string VoidReason { get; set; }
|
||||
[NotNull]
|
||||
public virtual bool Printed { get; set; }
|
||||
[NotNull]
|
||||
public virtual string KotID { get; set; }
|
||||
[Cascade]
|
||||
public virtual IList<Inventory> Inventories { get; set; }
|
||||
public virtual IList<Kot> Kots { get; set; }
|
||||
public Voucher()
|
||||
{
|
||||
Inventories = new List<Inventory>();
|
||||
this.Kots = new List<Kot>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using FluentNHibernate.Mapping;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class Waiter
|
||||
{
|
||||
public virtual int WaiterID { get; set; }
|
||||
[NotNull, Unique]
|
||||
public virtual string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,10 @@ namespace Tanshu.Accounts.Contracts
|
||||
public static RoleConstants DISCOUNT = new RoleConstants("Sales/Discount");
|
||||
public static RoleConstants EDIT_PRINTED_BILL = new RoleConstants("Sales/EditBill");
|
||||
public static RoleConstants EDIT_PRINTED_PRODUCT = new RoleConstants("Sales/EditPrintedProduct");
|
||||
public static RoleConstants MERGE_TABLE = new RoleConstants("Sales/MergeTable");
|
||||
public static RoleConstants MOVE_TABLE = new RoleConstants("Sales/MoveTable");
|
||||
public static RoleConstants MERGE_KOT = new RoleConstants("Sales/MergeKot");
|
||||
public static RoleConstants MOVE_KOT = new RoleConstants("Sales/MoveKot");
|
||||
public static RoleConstants PRINT_BILL = new RoleConstants("Sales/PrintBill");
|
||||
public static RoleConstants PRINT_KOT = new RoleConstants("Sales/PrintKOT");
|
||||
public static RoleConstants SALES = new RoleConstants("Sales/SalesBill");
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Attributes\CascadeAttribute.cs" />
|
||||
<Compile Include="Attributes\AllowNullAttribute.cs" />
|
||||
<Compile Include="Attributes\FormulaAttribute.cs" />
|
||||
<Compile Include="Attributes\UniqueAttribute.cs" />
|
||||
<Compile Include="Attributes\PermissionAttribute.cs" />
|
||||
<Compile Include="Attributes\SecutiryAttribute.cs" />
|
||||
<Compile Include="Attributes\NotNullAttribute.cs" />
|
||||
@@ -88,6 +91,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\KotBO.cs" />
|
||||
<Compile Include="Data Contracts\PaymentGroupBO.cs" />
|
||||
<Compile Include="Data Contracts\InventoryModifierBO.cs" />
|
||||
<Compile Include="Data Contracts\SettleOption.cs" />
|
||||
@@ -111,7 +115,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Data Contracts Display\SalesAnalysisBO.cs" />
|
||||
<Compile Include="Data Contracts Display\BillInventoryBO.cs" />
|
||||
<Compile Include="Data Contracts\SaleVoucherBO.cs" />
|
||||
<Compile Include="Data Contracts\Auth\UserBO.cs" />
|
||||
<Compile Include="Data Contracts\VoucherBO.cs" />
|
||||
<Compile Include="RolesConstants.cs" />
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace Tanshu.Accounts.Helpers
|
||||
|
||||
public static class ControlFactory
|
||||
{
|
||||
public static void GenerateTables(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<FoodTable> inList, ButtonClickDelegate bcDelegate)
|
||||
public static void GenerateTables(ref FlowLayoutPanel panel, Point size, int start, IList<FoodTable> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<FoodTable> list = new List<FoodTable>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new FoodTable() { FoodTableID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@@ -33,22 +33,20 @@ namespace Tanshu.Accounts.Helpers
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var status = SaleVoucherBI.GetTableStatus(item.Name);
|
||||
var status = item.Status;
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
if (status == "printed")
|
||||
control.BackColor = Color.Green;
|
||||
else if (status == "running")
|
||||
control.BackColor = Color.Red;
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
}
|
||||
public static void GenerateProducts(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<Product> inList, ButtonClickDelegate bcDelegate)
|
||||
public static void GenerateProducts(ref FlowLayoutPanel panel, Point size, int start, IList<Product> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<Product> list = new List<Product>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new Product() { ProductID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@@ -64,37 +62,29 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("p{0}", i), item.Units == string.Empty ? item.Name : string.Format("{0} ({1})", item.Name, item.Units), size.X, size.Y, item, bcDelegate);
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public static void GenerateGroups(ref FlowLayoutPanel panel, ref IList<UnselectableCheckbox> controlList, Point size, IList<ProductGroup> list, ButtonClickDelegate bcDelegate)
|
||||
// For Discount Form
|
||||
public static void GenerateGroups(ref FlowLayoutPanel panel, Point size, IList<string> list, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
if (controlList.Count != 0)
|
||||
{
|
||||
for (int i = controlList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
controlList[i].Dispose();
|
||||
}
|
||||
controlList = new List<UnselectableCheckbox>();
|
||||
}
|
||||
panel.Controls.Clear();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetUnselectableCheckbox(i.ToString(), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
var control = GetUnselectableCheckbox(i.ToString(), item, size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
controlList.Add(control);
|
||||
}
|
||||
}
|
||||
public static void GenerateGroups(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<ProductGroup> inList, ButtonClickDelegate bcDelegate)
|
||||
// For Main Form
|
||||
public static void GenerateGroups(ref FlowLayoutPanel panel, Point size, int start, IList<ProductGroup> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<ProductGroup> list = new List<ProductGroup>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new ProductGroup() { ProductGroupID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@@ -108,9 +98,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
}
|
||||
public static void GenerateModifiers(ref FlowLayoutPanel panel, ref IList<CheckBox> controlList, IList<Modifier> selection, Point size, int count, IList<Modifier> list, ButtonClickDelegate bcDelegate)
|
||||
@@ -135,16 +123,9 @@ namespace Tanshu.Accounts.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
private static void PageSetup(ref FlowLayoutPanel panel, ref List<Button> buttonList, int start, IList inList, out int pageLength, out int stop)
|
||||
private static void PageSetup(ref FlowLayoutPanel panel, int start, IList inList, out int pageLength, out int stop)
|
||||
{
|
||||
if (buttonList.Count != 0)
|
||||
{
|
||||
for (int i = buttonList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
buttonList[i].Dispose();
|
||||
}
|
||||
buttonList = new List<Button>();
|
||||
}
|
||||
panel.Controls.Clear();
|
||||
pageLength = (panel.Height / (3 + 75 + 3));
|
||||
pageLength *= (panel.Width / (3 + 75 + 3));
|
||||
pageLength -= 2;
|
||||
|
||||
+3
-3
@@ -10,14 +10,14 @@ using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class AdjustAdvanceForm : Form
|
||||
public partial class frmAdjustAdvance : Form
|
||||
{
|
||||
bool loading = true;
|
||||
public AdjustAdvanceForm()
|
||||
public frmAdjustAdvance()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void AdjustAdvancesForm_Load(object sender, EventArgs e)
|
||||
private void frmAdjustAdvance_Load(object sender, EventArgs e)
|
||||
{
|
||||
dtpFrom.Format = DateTimePickerFormat.Custom;
|
||||
dtpFrom.CustomFormat = "dd-MMM-yyyy";
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class AdjustAdvanceForm
|
||||
partial class frmAdjustAdvance
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -212,7 +212,7 @@
|
||||
this.dgExpenses.Size = new System.Drawing.Size(378, 356);
|
||||
this.dgExpenses.TabIndex = 112;
|
||||
//
|
||||
// AdjustAdvanceForm
|
||||
// frmAdjustAdvance
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -236,10 +236,10 @@
|
||||
this.Controls.Add(this.dtpFrom);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AdjustAdvanceForm";
|
||||
this.Name = "frmAdjustAdvance";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Payment Details";
|
||||
this.Load += new System.EventHandler(this.AdjustAdvancesForm_Load);
|
||||
this.Load += new System.EventHandler(this.frmAdjustAdvance_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgExpenses)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
File renamed without changes.
+3
-3
@@ -9,10 +9,10 @@ using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class RecieveAdvanceForm : Form
|
||||
public partial class frmRecieveAdvance : Form
|
||||
{
|
||||
bool loading = true;
|
||||
public RecieveAdvanceForm()
|
||||
public frmRecieveAdvance()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
|
||||
|
||||
private void RecieveAdvanceForm_Load(object sender, EventArgs e)
|
||||
private void frmRecieveAdvance_Load(object sender, EventArgs e)
|
||||
{
|
||||
dtpFrom.Format = DateTimePickerFormat.Custom;
|
||||
dtpFrom.CustomFormat = "dd-MMM-yyyy";
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class RecieveAdvanceForm
|
||||
partial class frmRecieveAdvance
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -204,7 +204,7 @@
|
||||
this.dgExpenses.Size = new System.Drawing.Size(378, 356);
|
||||
this.dgExpenses.TabIndex = 110;
|
||||
//
|
||||
// RecieveAdvanceForm
|
||||
// frmRecieveAdvance
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -226,10 +226,10 @@
|
||||
this.Controls.Add(this.dtpTo);
|
||||
this.Controls.Add(this.dtpFrom);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "RecieveAdvanceForm";
|
||||
this.Name = "frmRecieveAdvance";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Received Advance";
|
||||
this.Load += new System.EventHandler(this.RecieveAdvanceForm_Load);
|
||||
this.Load += new System.EventHandler(this.frmRecieveAdvance_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgExpenses)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
File renamed without changes.
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<connectionStrings>
|
||||
<add name="FluentCon" connectionString="Server=Frodo;Initial Catalog=Pets;User ID=sa;Password=123456" />
|
||||
<add name="FluentCon" connectionString="Server=.;Initial Catalog=Pets;User ID=sa;Password=123456" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<add key ="Location" value ="Office"/>
|
||||
<add key ="Location" value ="Ground"/>
|
||||
<add key ="Factory" value ="SqlServer"/>
|
||||
<add key ="LogConnection" value ="connection"/>
|
||||
<add key ="LogLevel" value ="Warn"/>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
class KeyboardLogin : ILogin
|
||||
{
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public bool LoginUser()
|
||||
{
|
||||
return LoginUser(true);
|
||||
@@ -37,7 +36,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
static void SetThreadPrincipal(string userName)
|
||||
{
|
||||
//log.Warn(string.Format("User Login: '{0}'", userName));
|
||||
if (userName.Contains(":"))
|
||||
userName = userName.Substring(userName.IndexOf(":") + 1);
|
||||
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
//size: 296, 123
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private bool isAuthenticated;
|
||||
private string userName;
|
||||
private User user;
|
||||
private IKeyboardControl keyboardControl;
|
||||
public LoginForm(IKeyboardControl keyboardControl)
|
||||
{
|
||||
InitializeComponent();
|
||||
isAuthenticated = false;
|
||||
userName = null;
|
||||
user = null;
|
||||
this.keyboardControl = keyboardControl;
|
||||
|
||||
var control = keyboardControl as UserControl;
|
||||
@@ -47,22 +42,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
userName = txtUserName.Text.Trim();
|
||||
isAuthenticated = UserBI.ValidateUser(userName, Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
|
||||
if (isAuthenticated)
|
||||
{
|
||||
user = UserBI.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
if (user != null)
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Username or password is not valid");
|
||||
|
||||
}
|
||||
|
||||
public bool UserName(out string userName)
|
||||
{
|
||||
userName = this.userName;
|
||||
return isAuthenticated;
|
||||
userName = this.user == null ? "" : this.user.Name;
|
||||
return this.user != null;
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using System.Threading;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
class MsrLogin : ILogin
|
||||
{
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public bool LoginUser()
|
||||
{
|
||||
return LoginUser(true);
|
||||
}
|
||||
bool LoginUser(bool setThreadPrincipal)
|
||||
{
|
||||
using (var frm = new MsrLoginForm(false))
|
||||
{
|
||||
string userName;
|
||||
frm.ShowDialog();
|
||||
bool authenticated = frm.UserName(out userName);
|
||||
if (authenticated && setThreadPrincipal)
|
||||
SetThreadPrincipal(userName);
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool LogoutUser()
|
||||
{
|
||||
Session.User = null;
|
||||
return true;
|
||||
}
|
||||
static void SetThreadPrincipal(string userName)
|
||||
{
|
||||
//log.Warn(string.Format("User Login: '{0}'", userName));
|
||||
if (userName.Contains(":"))
|
||||
userName = userName.Substring(userName.IndexOf(":") + 1);
|
||||
|
||||
Session.User = UserBI.GetUserFromName(userName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class MsrLoginForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnLogin = new UnselectableButton();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
this.btnLogin.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnLogin.Location = new System.Drawing.Point(0, 0);
|
||||
this.btnLogin.Name = "btnLogin";
|
||||
this.btnLogin.Size = new System.Drawing.Size(290, 97);
|
||||
this.btnLogin.TabIndex = 0;
|
||||
this.btnLogin.Text = "Login";
|
||||
this.btnLogin.UseVisualStyleBackColor = true;
|
||||
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
|
||||
//
|
||||
// MsrLoginForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(290, 97);
|
||||
this.Controls.Add(this.btnLogin);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.KeyPreview = true;
|
||||
this.Name = "MsrLoginForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Login";
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MsrLoginForm_KeyPress);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UnselectableButton btnLogin;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Repository;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class MsrLoginForm : Form
|
||||
{
|
||||
private string loginString;
|
||||
private User user;
|
||||
private bool register;
|
||||
public MsrLoginForm(bool register)
|
||||
{
|
||||
InitializeComponent();
|
||||
user = null;
|
||||
loginString = string.Empty;
|
||||
this.register = register;
|
||||
this.btnLogin.Enabled = false;
|
||||
}
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!register)
|
||||
{
|
||||
var user = UserBI.MsrValidateUser(loginString);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
this.user = user;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Unrecognised Card");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user = new User() { Name = loginString };
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public bool UserName(out string userName)
|
||||
{
|
||||
userName = this.user == null ? "" : this.user.Name;
|
||||
return this.user != null;
|
||||
}
|
||||
|
||||
private void MsrLoginForm_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
btnLogin.Enabled = true;
|
||||
this.loginString += e.KeyChar.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -17,7 +17,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class BillController
|
||||
{
|
||||
private SaleVoucher billInfo;
|
||||
private Voucher billInfo;
|
||||
private OrderedDictionary<BillItemKey, BillInventory> bill = new OrderedDictionary<BillItemKey, BillInventory>();
|
||||
int? editVoucherID;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void ShowModifiers(int productGroupID, BillInventory item)
|
||||
{
|
||||
if (item.Printed > 0)
|
||||
if (item.Printed)
|
||||
return;
|
||||
var list = ProductGroupModifierBI.GetProductGroupModifiers(productGroupID);
|
||||
using (var frm = new ModifierForm(list, item.Modifiers))
|
||||
@@ -79,18 +79,20 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (!Session.IsAllowed(RoleConstants.DISCOUNT))
|
||||
return;
|
||||
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
var list = new ProductGroupBI().GetProductGroupTypes();
|
||||
using (var frm = new DiscountForm(list))
|
||||
{
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
IList<int> outList;
|
||||
HashSet<string> outList;
|
||||
decimal discount = frm.Selection(out outList);
|
||||
discount = discount / 100;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.KotID == -1)
|
||||
continue;
|
||||
var pg = new ProductGroupBI().GetProductGroupOfProduct(item.Value.ProductID);
|
||||
if (outList.Contains(pg.ProductGroupID))
|
||||
if (outList.Contains(pg.GroupType))
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, item.Value.ProductID).SetDiscount(item.Value.Name, discount);
|
||||
|
||||
}
|
||||
@@ -131,26 +133,31 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void Save(bool print, int waiterID, string tableID)
|
||||
{
|
||||
|
||||
if (print && !Session.IsAllowed(RoleConstants.PRINT_BILL))
|
||||
return;
|
||||
if (!print && !Session.IsAllowed(RoleConstants.PRINT_KOT))
|
||||
return;
|
||||
if ((billInfo != null) && (SaleVoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
if ((billInfo != null) && (VoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
return;
|
||||
if (bill.Count == 0)
|
||||
if (bill.Count == 1) //new kot only
|
||||
return;
|
||||
|
||||
if (print)
|
||||
ShowDiscount();
|
||||
int? saved;
|
||||
if (billInfo == null)
|
||||
saved = InsertVoucher(print, waiterID, tableID);
|
||||
else
|
||||
saved = UpdateSale(print, waiterID, tableID);
|
||||
if (saved.HasValue)
|
||||
if (editVoucherID.HasValue)
|
||||
saleForm.CloseWindow();
|
||||
else
|
||||
{
|
||||
if (editVoucherID.HasValue)
|
||||
saleForm.CloseWindow();
|
||||
else
|
||||
PrintBill(print, saved.Value);
|
||||
int kotID = 0;
|
||||
if (!print && saved.HasValue)
|
||||
kotID = saved.Value;
|
||||
if (print || kotID != 0)
|
||||
PrintBill(billInfo.VoucherID, kotID);
|
||||
}
|
||||
ClearBill();
|
||||
}
|
||||
@@ -161,13 +168,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
MessageBox.Show("Error in InsertVoucher, there is a previous sale in memory", "Error");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
#region SaleVoucher
|
||||
SaleVoucher saleVoucher = new SaleVoucher
|
||||
#region Voucher
|
||||
billInfo = new Voucher
|
||||
{
|
||||
Customer = customer,
|
||||
Settled = SettleOptionBI.GetSettleOption(SettleOptionFactory.Unsettled),
|
||||
Settled = SettleOption.Unsettled,
|
||||
//Paid = finalBill,
|
||||
TableID = tableID,
|
||||
Waiter = WaiterBI.GetWaiter(waiterID),
|
||||
@@ -175,21 +180,19 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
Ref = "",
|
||||
Type = 'S',
|
||||
User = Session.User
|
||||
};
|
||||
#endregion
|
||||
#region Inventories
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
SaleVoucherBI.Insert(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
|
||||
return VoucherBI.Insert(billInfo);
|
||||
}
|
||||
private int? UpdateSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
#region SaleVoucher
|
||||
#region Voucher
|
||||
billInfo.User = Session.User;
|
||||
billInfo.Customer = customer;
|
||||
if (!billInfo.Printed && finalBill)
|
||||
@@ -197,59 +200,46 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
billInfo.Printed = billInfo.Printed || finalBill;
|
||||
billInfo.TableID = tableID;
|
||||
billInfo.Waiter = WaiterBI.GetWaiter(waiterID);
|
||||
//if ((!billInfo.Printed) && finalBill)
|
||||
// billInfo.Date = null;
|
||||
billInfo.Inventories = new List<Inventory>();
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
#region Inventory
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
#endregion
|
||||
SaleVoucherBI.Update(billInfo, iList);
|
||||
return billInfo.VoucherID;
|
||||
return VoucherBI.Update(billInfo);
|
||||
}
|
||||
private IList<Inventory> GetInventoryForBill(ICollection<BillInventory> list)
|
||||
private Kot GetKotForBill()
|
||||
{
|
||||
Dictionary<int, Inventory> localList = new Dictionary<int, Inventory>();
|
||||
HashSet<int> keys = new HashSet<int>();
|
||||
|
||||
foreach (BillInventory item in list)
|
||||
var kot = new Kot();
|
||||
foreach (var item in bill)
|
||||
{
|
||||
Inventory temp = new Inventory();
|
||||
if (localList.ContainsKey(item.ProductID))
|
||||
if (item.Key.KotID == -1 || item.Value.Quantity == 0)
|
||||
continue;
|
||||
else if (item.Key.KotID != 0)
|
||||
{
|
||||
if (temp.Quantity <= 0)
|
||||
keys.Remove(item.ProductID);
|
||||
|
||||
temp = localList[item.ProductID];
|
||||
temp.Quantity += item.Quantity;
|
||||
temp.Amount += item.Value;
|
||||
foreach (var mod in item.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod });
|
||||
if (temp.Quantity <= 0)
|
||||
keys.Add(item.ProductID);
|
||||
var oldKot = billInfo.Kots.Where(x => x.KotID == item.Key.KotID).Single();
|
||||
var inv = oldKot.Inventories.Where(x => x.Product.ProductID == item.Key.ProductID).Single();
|
||||
inv.Rate = item.Value.Price;
|
||||
inv.Discount = item.Value.Discount;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.Product = ProductBI.GetProduct(item.ProductID);
|
||||
temp.Quantity = item.Quantity;
|
||||
temp.Rate = item.Price;
|
||||
temp.Discount = item.Discount;
|
||||
temp.ServiceCharge = item.ServiceCharge;
|
||||
temp.Tax = item.Tax;
|
||||
temp.Amount = item.Value;
|
||||
foreach (var mod in item.Modifiers)
|
||||
Inventory temp = new Inventory();
|
||||
temp.Product = ProductBI.GetProduct(item.Key.ProductID);
|
||||
temp.Quantity = item.Value.Quantity;
|
||||
temp.Rate = item.Value.Price;
|
||||
temp.Discount = item.Value.Discount;
|
||||
temp.ServiceCharge = item.Value.ServiceCharge;
|
||||
temp.Tax = item.Value.Tax;
|
||||
foreach (var mod in item.Value.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod });
|
||||
localList.Add(item.ProductID, temp);
|
||||
|
||||
if (item.Quantity <= 0)
|
||||
keys.Add(item.ProductID);
|
||||
kot.Inventories.Add(temp);
|
||||
}
|
||||
}
|
||||
foreach (var item in keys)
|
||||
{
|
||||
localList.Remove(item);
|
||||
}
|
||||
return localList.Values.ToList();
|
||||
if (kot.Inventories.Count == 0)
|
||||
return null;
|
||||
else
|
||||
return kot;
|
||||
}
|
||||
#endregion
|
||||
public void VoidBill()
|
||||
@@ -266,7 +256,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
{
|
||||
SaleVoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
VoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
ClearBill();
|
||||
}
|
||||
else
|
||||
@@ -284,12 +274,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return form.Customer;
|
||||
}
|
||||
}
|
||||
private void PrintBill(bool finalBill, int voucherID)
|
||||
private void PrintBill(int voucherID, int kotID)
|
||||
{
|
||||
if (!finalBill)
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, bill.Values.ToList());
|
||||
if (kotID == 0)
|
||||
Accounts.Print.Thermal.PrintBill(voucherID);
|
||||
else
|
||||
Accounts.Print.Thermal.PrintBill(voucherID, bill.Values.ToList());
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, kotID);
|
||||
}
|
||||
|
||||
private List<StringType> GetVoidReason(Dictionary<string, string> filter)
|
||||
@@ -312,7 +302,31 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
return bill.ElementAt(saleForm.BindingSource.Position).Value;
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID == -1)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BillInventory CurrentKot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID != -1)
|
||||
return null;
|
||||
else if (item.Key.ProductID == 0)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ShowAmount()
|
||||
@@ -332,14 +346,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
if (item.Printed > 0)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
else if (MessageBox.Show(string.Format("Already {0} items have been printed.\n\rAre you sure you want to delete this item?", item.Printed), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return;
|
||||
}
|
||||
bill.Remove(new BillItemKey(item.ProductID, item.Printed == 0));
|
||||
if (item.Printed)
|
||||
return;
|
||||
bill.Remove(new BillItemKey(item.ProductID, 0));
|
||||
bill.ReCompact();
|
||||
ShowAmount();
|
||||
}
|
||||
@@ -355,6 +364,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void ChangeRate()
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetPrice(CurrentProduct);
|
||||
ShowAmount();
|
||||
|
||||
@@ -375,31 +387,60 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void LoadBill(int voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
IList<Inventory> iList = new List<Inventory>();
|
||||
SaleVoucherBI.GetSaleVoucher(voucherID, out billInfo, out iList);
|
||||
bill.Clear();
|
||||
billInfo = null;
|
||||
billInfo = VoucherBI.GetSaleVoucher(voucherID);
|
||||
|
||||
this.customer = billInfo.Customer;
|
||||
saleForm.ShowInfo(billInfo.BillID, billInfo.KotID, billInfo.CreationDate, billInfo.Date.Value, billInfo.LastEditDate, customer.Name, billInfo.TableID, billInfo.Waiter.WaiterID, billInfo.Waiter.Name);
|
||||
|
||||
foreach (Inventory inventory in iList)
|
||||
foreach (var kot in billInfo.Kots)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inventory.Product.ProductID, false);
|
||||
var product = ProductBI.GetProduct(inventory.Product.ProductID);
|
||||
var item = new BillInventory
|
||||
BillItemKey kotKey = new BillItemKey(kot.KotID, -1);
|
||||
var kotItem = new BillInventory
|
||||
{
|
||||
ProductID = product.ProductID,
|
||||
Discount = inventory.Discount,
|
||||
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")",
|
||||
Price = inventory.Rate,
|
||||
Printed = inventory.Quantity,
|
||||
Quantity = inventory.Quantity,
|
||||
Tax = inventory.Tax,
|
||||
ServiceCharge = inventory.ServiceCharge,
|
||||
ProductID = kot.KotID,
|
||||
Discount = 0,
|
||||
Name = string.Format("Kot No.: {0} / KotID {1}", kot.KotID, kot.Code),
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
foreach (var mod in inventory.InventoryModifier)
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
bill.Add(key, item);
|
||||
bill.Add(kotKey, kotItem);
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
||||
var item = new BillInventory
|
||||
{
|
||||
ProductID = inv.Product.ProductID,
|
||||
Discount = inv.Discount,
|
||||
Name = inv.Product.Units == string.Empty ? inv.Product.Name : inv.Product.Name + " (" + inv.Product.Units + ")",
|
||||
Price = inv.Rate,
|
||||
Printed = true,
|
||||
Quantity = inv.Quantity,
|
||||
Tax = inv.Tax,
|
||||
ServiceCharge = inv.ServiceCharge,
|
||||
};
|
||||
foreach (var mod in inv.InventoryModifier)
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
bill.Add(key, item);
|
||||
}
|
||||
}
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
ShowAmount();
|
||||
|
||||
}
|
||||
@@ -407,10 +448,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
SaleVoucher voucher = SaleVoucherBI.GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
var table = new FoodTableBI().GetByName(tableName);
|
||||
if (table != null && table.VoucherID != 0)
|
||||
{
|
||||
LoadBill(voucher.VoucherID);
|
||||
LoadBill(table.VoucherID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -422,10 +463,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
string tableID = result.Text.Trim();
|
||||
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
||||
{
|
||||
SaleVoucher voucher = SaleVoucherBI.GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
var table = new FoodTableBI().GetByName(tableName);
|
||||
if (table != null && table.VoucherID != 0)
|
||||
{
|
||||
LoadBill(voucher.VoucherID);
|
||||
LoadBill(table.VoucherID);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -436,7 +477,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void CancelBillChanges()
|
||||
{
|
||||
if (bill.Count != 0 && bill.Values.Any(i => i.Printed != i.Quantity))
|
||||
if (bill.Count != 0 && bill.Values.Any(i => i.Printed == false))
|
||||
if (MessageBox.Show("Abandon Changes?", "Abandon Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
|
||||
return;
|
||||
ClearBill();
|
||||
@@ -446,10 +487,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
billInfo = null;
|
||||
ShowCustomerList(true);
|
||||
bill.Clear();
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
saleForm.ClearBill(bill);
|
||||
}
|
||||
public void FormLoad()
|
||||
{
|
||||
ClearBill();
|
||||
if (editVoucherID.HasValue)
|
||||
{
|
||||
LoadBill(editVoucherID.Value);
|
||||
@@ -463,20 +518,118 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
if (!Session.IsAllowed(RoleConstants.SETTLE_BILL))
|
||||
return;
|
||||
int option = SettleOptionFactory.Unsettled;
|
||||
var option = SettleOption.Unsettled;
|
||||
using (BillSettleForm frm = new BillSettleForm())
|
||||
{
|
||||
frm.ShowDialog();
|
||||
option = frm.optionChosen;
|
||||
}
|
||||
if (option != SettleOptionFactory.Unsettled)
|
||||
if (option != SettleOption.Unsettled)
|
||||
{
|
||||
SaleVoucherBI.SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
VoucherBI.SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
ClearBill();
|
||||
}
|
||||
}
|
||||
|
||||
internal void MoveTable()
|
||||
{
|
||||
if (billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var table = GetTableForMove(true);
|
||||
if (table == null)
|
||||
return;
|
||||
if (table.VoucherID == 0)
|
||||
LoadBill(MoveTable(table));
|
||||
else
|
||||
LoadBill(MergeTable(table));
|
||||
}
|
||||
private int MoveTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_TABLE))
|
||||
return 0;
|
||||
return new FoodTableBI().Move(billInfo.TableID, table);
|
||||
}
|
||||
private int MergeTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_TABLE))
|
||||
return 0;
|
||||
var kots = bill.Where(x => x.Key.KotID == -1 && x.Key.ProductID != 0);
|
||||
foreach (var item in kots)
|
||||
MergeKot(item.Value, table);
|
||||
VoucherBI.Delete(billInfo.VoucherID);
|
||||
return table.VoucherID;
|
||||
}
|
||||
|
||||
private int MergeKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_KOT))
|
||||
return 0;
|
||||
return VoucherBI.MoveKot(kot.ProductID, table);
|
||||
}
|
||||
private int MoveKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_KOT))
|
||||
return 0;
|
||||
CreateNewVoucherForKotMove(kot, table);
|
||||
return MergeKot(kot, table);
|
||||
}
|
||||
private void CreateNewVoucherForKotMove(BillInventory kot, FoodTable table)
|
||||
{
|
||||
var voucher = new Voucher
|
||||
{
|
||||
Customer = billInfo.Customer,
|
||||
Settled = SettleOption.Unsettled,
|
||||
TableID = table.Name,
|
||||
Waiter = billInfo.Waiter,
|
||||
Printed = false,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
VoucherBI.Insert(voucher);
|
||||
}
|
||||
private FoodTable GetTableForMove(bool allowMerge)
|
||||
{
|
||||
using (var frm = new frmMoveTable(new FoodTableBI().List(), allowMerge))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
if (frm.Selection != null)
|
||||
return frm.Selection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void MergeKot()
|
||||
{
|
||||
if (billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var kot = CurrentKot;
|
||||
if (kot == null)
|
||||
return;
|
||||
var table = GetTableForMove(true);
|
||||
if (table == null)
|
||||
return;
|
||||
var count = bill.Keys.Count(x => x.KotID == -1 && x.ProductID != 0);
|
||||
int voucherID = 0;
|
||||
if (table.VoucherID == 0 && count > 1)
|
||||
//Move Kot
|
||||
voucherID = MoveKot(kot, table);
|
||||
else if (table.VoucherID == 0 && count == 1)
|
||||
//Move Table
|
||||
voucherID = MoveTable(table);
|
||||
else if (table.VoucherID != 0 && count > 1)
|
||||
//Merge Kot
|
||||
voucherID = MergeKot(kot, table);
|
||||
else if (table.VoucherID != 0 && count == 1)
|
||||
//Merge Table
|
||||
voucherID = MergeTable(table);
|
||||
if (voucherID != 0)
|
||||
LoadBill(voucherID);
|
||||
}
|
||||
}
|
||||
}
|
||||
// How to load a bill
|
||||
//LoadBill(((PendingBills)bsPending.Current).editVoucherID);
|
||||
// ChangeFormState(SaleFormState.Billing);
|
||||
@@ -40,22 +40,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
ILogin login = new KeyboardLogin();
|
||||
if (!Session.IsAuthenticated)
|
||||
{
|
||||
if (login.LoginUser())
|
||||
{
|
||||
this.Text = "Main Menu - User: " + Session.User.Name;
|
||||
btnLogin.Text = "Logout";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
login.LogoutUser();
|
||||
this.Text = "Main Menu - Login";
|
||||
btnLogin.Text = "Login";
|
||||
}
|
||||
CheckRoles();
|
||||
LoginUser(true);
|
||||
}
|
||||
private void btnSale_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -94,8 +79,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
#if (DEBUG)
|
||||
if (Session.IsAllowed(RoleConstants.MASTER_OWNER))
|
||||
{
|
||||
//Fixtures.CreateSchema();
|
||||
//MessageBox.Show("Schema Recreated");
|
||||
Fixtures.CreateSchema();
|
||||
MessageBox.Show("Schema Recreated");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -103,14 +88,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void btnAdvanceReceive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALES))
|
||||
using (RecieveAdvanceForm frm = new RecieveAdvanceForm())
|
||||
using (frmRecieveAdvance frm = new frmRecieveAdvance())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnAdvanceAdjust_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALES))
|
||||
using (AdjustAdvanceForm frm = new AdjustAdvanceForm())
|
||||
using (frmAdjustAdvance frm = new frmAdjustAdvance())
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
@@ -160,7 +145,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnSaleDetail_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALE_ANALYSIS))
|
||||
if (Session.IsAllowed(RoleConstants.SALE_DETAIL))
|
||||
using (var frm = new frmSaleDetail())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
@@ -171,7 +156,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
private void CheckRoles()
|
||||
{
|
||||
#if (DEBUG)
|
||||
btnInitial.Visible = Session.IsAllowed(RoleConstants.MASTER_OWNER);
|
||||
#else
|
||||
btnInitial.Visible = false;
|
||||
#endif
|
||||
|
||||
btnSale.Visible = Session.IsAllowed(RoleConstants.SALES);
|
||||
|
||||
@@ -189,7 +178,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
btnGroupRoles.Visible = Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES);
|
||||
|
||||
btnCashierCheckout.Visible = Session.IsAllowed(RoleConstants.SALE_ANALYSIS);
|
||||
btnCashierCheckout.Visible = Session.IsAllowed(RoleConstants.CASHIER_CHECKOUT);
|
||||
btnSaleAnalysis.Visible = Session.IsAllowed(RoleConstants.SALE_ANALYSIS);
|
||||
btnSaleDetail.Visible = Session.IsAllowed(RoleConstants.SALE_DETAIL);
|
||||
|
||||
@@ -204,5 +193,37 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
}
|
||||
|
||||
private void btnSwipeLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoginUser(false);
|
||||
}
|
||||
private void LoginUser(bool keyboard)
|
||||
{
|
||||
ILogin login;
|
||||
if (keyboard)
|
||||
login = new KeyboardLogin();
|
||||
else
|
||||
login = new MsrLogin();
|
||||
|
||||
if (!Session.IsAuthenticated)
|
||||
{
|
||||
if (login.LoginUser())
|
||||
{
|
||||
this.Text = "Main Menu - User: " + Session.User.Name;
|
||||
btnLogin.Text = "Logout";
|
||||
btnSwipeLogin.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
login.LogoutUser();
|
||||
this.Text = "Main Menu - Login";
|
||||
btnLogin.Text = "Login";
|
||||
btnSwipeLogin.Visible = true;
|
||||
}
|
||||
CheckRoles();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+48
-35
@@ -42,9 +42,10 @@
|
||||
this.btnGroupRoles = new System.Windows.Forms.Button();
|
||||
this.btnCashierCheckout = new System.Windows.Forms.Button();
|
||||
this.btnSaleAnalysis = new System.Windows.Forms.Button();
|
||||
this.btnSaleDetail = new System.Windows.Forms.Button();
|
||||
this.btnChangePassword = new System.Windows.Forms.Button();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.btnSaleDetail = new System.Windows.Forms.Button();
|
||||
this.btnSwipeLogin = new System.Windows.Forms.Button();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -60,10 +61,10 @@
|
||||
//
|
||||
// btnSale
|
||||
//
|
||||
this.btnSale.Location = new System.Drawing.Point(315, 3);
|
||||
this.btnSale.Location = new System.Drawing.Point(471, 3);
|
||||
this.btnSale.Name = "btnSale";
|
||||
this.btnSale.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnSale.TabIndex = 2;
|
||||
this.btnSale.TabIndex = 3;
|
||||
this.btnSale.Text = "&Sale";
|
||||
this.btnSale.UseVisualStyleBackColor = true;
|
||||
this.btnSale.Click += new System.EventHandler(this.btnSale_Click);
|
||||
@@ -82,6 +83,7 @@
|
||||
//
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnInitial);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnLogin);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnSwipeLogin);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnSale);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnCustomer);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnProduct);
|
||||
@@ -104,133 +106,143 @@
|
||||
//
|
||||
// btnCustomer
|
||||
//
|
||||
this.btnCustomer.Location = new System.Drawing.Point(471, 3);
|
||||
this.btnCustomer.Location = new System.Drawing.Point(627, 3);
|
||||
this.btnCustomer.Name = "btnCustomer";
|
||||
this.btnCustomer.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnCustomer.TabIndex = 3;
|
||||
this.btnCustomer.TabIndex = 4;
|
||||
this.btnCustomer.Text = "Customers";
|
||||
this.btnCustomer.UseVisualStyleBackColor = true;
|
||||
this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_Click);
|
||||
//
|
||||
// btnProduct
|
||||
//
|
||||
this.btnProduct.Location = new System.Drawing.Point(627, 3);
|
||||
this.btnProduct.Location = new System.Drawing.Point(3, 109);
|
||||
this.btnProduct.Name = "btnProduct";
|
||||
this.btnProduct.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnProduct.TabIndex = 4;
|
||||
this.btnProduct.TabIndex = 5;
|
||||
this.btnProduct.Text = "Products";
|
||||
this.btnProduct.UseVisualStyleBackColor = true;
|
||||
this.btnProduct.Click += new System.EventHandler(this.btnProduct_Click);
|
||||
//
|
||||
// btnProductGroup
|
||||
//
|
||||
this.btnProductGroup.Location = new System.Drawing.Point(3, 109);
|
||||
this.btnProductGroup.Location = new System.Drawing.Point(159, 109);
|
||||
this.btnProductGroup.Name = "btnProductGroup";
|
||||
this.btnProductGroup.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnProductGroup.TabIndex = 5;
|
||||
this.btnProductGroup.TabIndex = 6;
|
||||
this.btnProductGroup.Text = "Product Groups";
|
||||
this.btnProductGroup.UseVisualStyleBackColor = true;
|
||||
this.btnProductGroup.Click += new System.EventHandler(this.btnProductGroup_Click);
|
||||
//
|
||||
// btnAdvanceReceive
|
||||
//
|
||||
this.btnAdvanceReceive.Location = new System.Drawing.Point(159, 109);
|
||||
this.btnAdvanceReceive.Location = new System.Drawing.Point(315, 109);
|
||||
this.btnAdvanceReceive.Name = "btnAdvanceReceive";
|
||||
this.btnAdvanceReceive.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnAdvanceReceive.TabIndex = 6;
|
||||
this.btnAdvanceReceive.TabIndex = 7;
|
||||
this.btnAdvanceReceive.Text = "Receive Advance";
|
||||
this.btnAdvanceReceive.UseVisualStyleBackColor = true;
|
||||
this.btnAdvanceReceive.Click += new System.EventHandler(this.btnAdvanceReceive_Click);
|
||||
//
|
||||
// btnAdvanceAdjust
|
||||
//
|
||||
this.btnAdvanceAdjust.Location = new System.Drawing.Point(315, 109);
|
||||
this.btnAdvanceAdjust.Location = new System.Drawing.Point(471, 109);
|
||||
this.btnAdvanceAdjust.Name = "btnAdvanceAdjust";
|
||||
this.btnAdvanceAdjust.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnAdvanceAdjust.TabIndex = 7;
|
||||
this.btnAdvanceAdjust.TabIndex = 8;
|
||||
this.btnAdvanceAdjust.Text = "Adjust Advance";
|
||||
this.btnAdvanceAdjust.UseVisualStyleBackColor = true;
|
||||
this.btnAdvanceAdjust.Click += new System.EventHandler(this.btnAdvanceAdjust_Click);
|
||||
//
|
||||
// btnCreateUser
|
||||
//
|
||||
this.btnCreateUser.Location = new System.Drawing.Point(471, 109);
|
||||
this.btnCreateUser.Location = new System.Drawing.Point(627, 109);
|
||||
this.btnCreateUser.Name = "btnCreateUser";
|
||||
this.btnCreateUser.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnCreateUser.TabIndex = 8;
|
||||
this.btnCreateUser.TabIndex = 9;
|
||||
this.btnCreateUser.Text = "Create User";
|
||||
this.btnCreateUser.UseVisualStyleBackColor = true;
|
||||
this.btnCreateUser.Click += new System.EventHandler(this.btnCreateUser_Click);
|
||||
//
|
||||
// btnUserRoles
|
||||
//
|
||||
this.btnUserRoles.Location = new System.Drawing.Point(627, 109);
|
||||
this.btnUserRoles.Location = new System.Drawing.Point(3, 215);
|
||||
this.btnUserRoles.Name = "btnUserRoles";
|
||||
this.btnUserRoles.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnUserRoles.TabIndex = 9;
|
||||
this.btnUserRoles.TabIndex = 10;
|
||||
this.btnUserRoles.Text = "Manage User Roles";
|
||||
this.btnUserRoles.UseVisualStyleBackColor = true;
|
||||
this.btnUserRoles.Click += new System.EventHandler(this.btnUserRoles_Click);
|
||||
//
|
||||
// btnGroupRoles
|
||||
//
|
||||
this.btnGroupRoles.Location = new System.Drawing.Point(3, 215);
|
||||
this.btnGroupRoles.Location = new System.Drawing.Point(159, 215);
|
||||
this.btnGroupRoles.Name = "btnGroupRoles";
|
||||
this.btnGroupRoles.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnGroupRoles.TabIndex = 10;
|
||||
this.btnGroupRoles.TabIndex = 11;
|
||||
this.btnGroupRoles.Text = "Manage Group Roles";
|
||||
this.btnGroupRoles.UseVisualStyleBackColor = true;
|
||||
this.btnGroupRoles.Click += new System.EventHandler(this.btnGroupRoles_Click);
|
||||
//
|
||||
// btnCashierCheckout
|
||||
//
|
||||
this.btnCashierCheckout.Location = new System.Drawing.Point(159, 215);
|
||||
this.btnCashierCheckout.Location = new System.Drawing.Point(315, 215);
|
||||
this.btnCashierCheckout.Name = "btnCashierCheckout";
|
||||
this.btnCashierCheckout.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnCashierCheckout.TabIndex = 11;
|
||||
this.btnCashierCheckout.TabIndex = 12;
|
||||
this.btnCashierCheckout.Text = "Cashier Checkout";
|
||||
this.btnCashierCheckout.UseVisualStyleBackColor = true;
|
||||
this.btnCashierCheckout.Click += new System.EventHandler(this.btnCashierCheckout_Click);
|
||||
//
|
||||
// btnSaleAnalysis
|
||||
//
|
||||
this.btnSaleAnalysis.Location = new System.Drawing.Point(315, 215);
|
||||
this.btnSaleAnalysis.Location = new System.Drawing.Point(471, 215);
|
||||
this.btnSaleAnalysis.Name = "btnSaleAnalysis";
|
||||
this.btnSaleAnalysis.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnSaleAnalysis.TabIndex = 12;
|
||||
this.btnSaleAnalysis.TabIndex = 13;
|
||||
this.btnSaleAnalysis.Text = "Sale Analysis";
|
||||
this.btnSaleAnalysis.UseVisualStyleBackColor = true;
|
||||
this.btnSaleAnalysis.Click += new System.EventHandler(this.btnSaleAnalysis_Click);
|
||||
//
|
||||
// btnSaleDetail
|
||||
//
|
||||
this.btnSaleDetail.Location = new System.Drawing.Point(627, 215);
|
||||
this.btnSaleDetail.Name = "btnSaleDetail";
|
||||
this.btnSaleDetail.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnSaleDetail.TabIndex = 14;
|
||||
this.btnSaleDetail.Text = "Sale Detail";
|
||||
this.btnSaleDetail.UseVisualStyleBackColor = true;
|
||||
this.btnSaleDetail.Click += new System.EventHandler(this.btnSaleDetail_Click);
|
||||
//
|
||||
// btnChangePassword
|
||||
//
|
||||
this.btnChangePassword.Location = new System.Drawing.Point(627, 215);
|
||||
this.btnChangePassword.Location = new System.Drawing.Point(3, 321);
|
||||
this.btnChangePassword.Name = "btnChangePassword";
|
||||
this.btnChangePassword.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnChangePassword.TabIndex = 13;
|
||||
this.btnChangePassword.TabIndex = 15;
|
||||
this.btnChangePassword.Text = "Change Password";
|
||||
this.btnChangePassword.UseVisualStyleBackColor = true;
|
||||
this.btnChangePassword.Click += new System.EventHandler(this.btnChangePassword_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.Location = new System.Drawing.Point(3, 321);
|
||||
this.btnExit.Location = new System.Drawing.Point(159, 321);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnExit.TabIndex = 14;
|
||||
this.btnExit.TabIndex = 16;
|
||||
this.btnExit.Text = "Exit";
|
||||
this.btnExit.UseVisualStyleBackColor = true;
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// btnSaleDetail
|
||||
// btnSwipeLogin
|
||||
//
|
||||
this.btnSaleDetail.Location = new System.Drawing.Point(471, 215);
|
||||
this.btnSaleDetail.Name = "btnSaleDetail";
|
||||
this.btnSaleDetail.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnSaleDetail.TabIndex = 15;
|
||||
this.btnSaleDetail.Text = "Sale Detail";
|
||||
this.btnSaleDetail.UseVisualStyleBackColor = true;
|
||||
this.btnSaleDetail.Click += new System.EventHandler(this.btnSaleDetail_Click);
|
||||
this.btnSwipeLogin.Location = new System.Drawing.Point(315, 3);
|
||||
this.btnSwipeLogin.Name = "btnSwipeLogin";
|
||||
this.btnSwipeLogin.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnSwipeLogin.TabIndex = 2;
|
||||
this.btnSwipeLogin.Text = "Swipe Login";
|
||||
this.btnSwipeLogin.UseVisualStyleBackColor = true;
|
||||
this.btnSwipeLogin.Click += new System.EventHandler(this.btnSwipeLogin_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -267,5 +279,6 @@
|
||||
private System.Windows.Forms.Button btnSaleAnalysis;
|
||||
private System.Windows.Forms.Button btnGroupRoles;
|
||||
private System.Windows.Forms.Button btnSaleDetail;
|
||||
private System.Windows.Forms.Button btnSwipeLogin;
|
||||
}
|
||||
}
|
||||
+207
-181
@@ -32,14 +32,10 @@
|
||||
this.Label4 = new System.Windows.Forms.Label();
|
||||
this.txtSalePrice = new System.Windows.Forms.TextBox();
|
||||
this.bsProducts = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.GroupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.btnAddCategory = new System.Windows.Forms.Button();
|
||||
this.cmbProductTypes = new System.Windows.Forms.ComboBox();
|
||||
this.bsTypes = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.cmbUnits = new System.Windows.Forms.ComboBox();
|
||||
this.bsUnits = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.btnAddProductGroup = new System.Windows.Forms.Button();
|
||||
this.cmbProductGroup = new System.Windows.Forms.ComboBox();
|
||||
this.bsProductGroups = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.Label7 = new System.Windows.Forms.Label();
|
||||
this.Label3 = new System.Windows.Forms.Label();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.btnNavFirst = new System.Windows.Forms.Button();
|
||||
@@ -54,34 +50,38 @@
|
||||
this.btnUpdate = new System.Windows.Forms.Button();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
|
||||
this.cmbSalesLedger = new System.Windows.Forms.ComboBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.cmbSalesTax = new System.Windows.Forms.ComboBox();
|
||||
this.bsSalesTax = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.bsTax = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.txtProductID = new System.Windows.Forms.TextBox();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.txtUnits = new System.Windows.Forms.TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProducts)).BeginInit();
|
||||
this.GroupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsTypes)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsUnits)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsSalesTax)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsTax)).BeginInit();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// Label4
|
||||
//
|
||||
this.Label4.AutoSize = true;
|
||||
this.Label4.Location = new System.Drawing.Point(13, 148);
|
||||
this.Label4.Location = new System.Drawing.Point(3, 105);
|
||||
this.Label4.Name = "Label4";
|
||||
this.Label4.Size = new System.Drawing.Size(60, 13);
|
||||
this.Label4.Size = new System.Drawing.Size(84, 13);
|
||||
this.Label4.TabIndex = 59;
|
||||
this.Label4.Text = "Sales Price";
|
||||
this.Label4.Text = "Sale Price / Tax";
|
||||
//
|
||||
// txtSalePrice
|
||||
//
|
||||
this.txtSalePrice.AccessibleName = "Phone 1";
|
||||
this.txtSalePrice.AccessibleName = "";
|
||||
this.txtSalePrice.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "SalePrice", true));
|
||||
this.txtSalePrice.Location = new System.Drawing.Point(13, 164);
|
||||
this.txtSalePrice.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtSalePrice.Location = new System.Drawing.Point(106, 108);
|
||||
this.txtSalePrice.Name = "txtSalePrice";
|
||||
this.txtSalePrice.Size = new System.Drawing.Size(74, 20);
|
||||
this.txtSalePrice.Size = new System.Drawing.Size(149, 20);
|
||||
this.txtSalePrice.TabIndex = 53;
|
||||
this.txtSalePrice.Text = "0";
|
||||
//
|
||||
@@ -91,122 +91,89 @@
|
||||
this.bsProducts.AddingNew += new System.ComponentModel.AddingNewEventHandler(this.bsProducts_AddingNew);
|
||||
this.bsProducts.PositionChanged += new System.EventHandler(this.bsProducts_PositionChanged);
|
||||
//
|
||||
// GroupBox1
|
||||
// btnAddProductGroup
|
||||
//
|
||||
this.GroupBox1.Controls.Add(this.btnAddCategory);
|
||||
this.GroupBox1.Controls.Add(this.cmbProductTypes);
|
||||
this.GroupBox1.Controls.Add(this.cmbUnits);
|
||||
this.GroupBox1.Controls.Add(this.Label7);
|
||||
this.GroupBox1.Controls.Add(this.Label3);
|
||||
this.GroupBox1.Controls.Add(this.txtName);
|
||||
this.GroupBox1.Controls.Add(this.Label2);
|
||||
this.GroupBox1.Location = new System.Drawing.Point(12, 37);
|
||||
this.GroupBox1.Name = "GroupBox1";
|
||||
this.GroupBox1.Size = new System.Drawing.Size(312, 102);
|
||||
this.GroupBox1.TabIndex = 52;
|
||||
this.GroupBox1.TabStop = false;
|
||||
this.btnAddProductGroup.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.btnAddProductGroup.Location = new System.Drawing.Point(261, 73);
|
||||
this.btnAddProductGroup.Name = "btnAddProductGroup";
|
||||
this.btnAddProductGroup.Size = new System.Drawing.Size(151, 21);
|
||||
this.btnAddProductGroup.TabIndex = 37;
|
||||
this.btnAddProductGroup.Text = "Add Group";
|
||||
this.btnAddProductGroup.Click += new System.EventHandler(this.btnAddCategory_Click);
|
||||
//
|
||||
// btnAddCategory
|
||||
// cmbProductGroup
|
||||
//
|
||||
this.btnAddCategory.Location = new System.Drawing.Point(281, 72);
|
||||
this.btnAddCategory.Name = "btnAddCategory";
|
||||
this.btnAddCategory.Size = new System.Drawing.Size(25, 21);
|
||||
this.btnAddCategory.TabIndex = 37;
|
||||
this.btnAddCategory.Text = "+";
|
||||
this.btnAddCategory.Click += new System.EventHandler(this.btnAddCategory_Click);
|
||||
this.cmbProductGroup.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "ProductGroup", true));
|
||||
this.cmbProductGroup.DataSource = this.bsProductGroups;
|
||||
this.cmbProductGroup.DisplayMember = "Name";
|
||||
this.cmbProductGroup.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.cmbProductGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbProductGroup.Location = new System.Drawing.Point(106, 73);
|
||||
this.cmbProductGroup.Name = "cmbProductGroup";
|
||||
this.cmbProductGroup.Size = new System.Drawing.Size(149, 21);
|
||||
this.cmbProductGroup.TabIndex = 35;
|
||||
this.cmbProductGroup.ValueMember = "ProductTypeID";
|
||||
//
|
||||
// cmbProductTypes
|
||||
// bsProductGroups
|
||||
//
|
||||
this.cmbProductTypes.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "ProductTypeID", true));
|
||||
this.cmbProductTypes.DataSource = this.bsTypes;
|
||||
this.cmbProductTypes.DisplayMember = "Name";
|
||||
this.cmbProductTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbProductTypes.Location = new System.Drawing.Point(94, 72);
|
||||
this.cmbProductTypes.Name = "cmbProductTypes";
|
||||
this.cmbProductTypes.Size = new System.Drawing.Size(181, 21);
|
||||
this.cmbProductTypes.TabIndex = 35;
|
||||
this.cmbProductTypes.ValueMember = "ProductTypeID";
|
||||
//
|
||||
// bsTypes
|
||||
//
|
||||
this.bsTypes.DataSource = typeof(Tanshu.Accounts.Entities.ProductGroup);
|
||||
//
|
||||
// cmbUnits
|
||||
//
|
||||
this.cmbUnits.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "Units", true));
|
||||
this.cmbUnits.DataSource = this.bsUnits;
|
||||
this.cmbUnits.DisplayMember = "Description";
|
||||
this.cmbUnits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbUnits.Location = new System.Drawing.Point(94, 45);
|
||||
this.cmbUnits.Name = "cmbUnits";
|
||||
this.cmbUnits.Size = new System.Drawing.Size(212, 21);
|
||||
this.cmbUnits.TabIndex = 34;
|
||||
this.cmbUnits.ValueMember = "Description";
|
||||
//
|
||||
// bsUnits
|
||||
//
|
||||
this.bsUnits.DataSource = typeof(Tanshu.Accounts.Helpers.StringType);
|
||||
this.bsProductGroups.DataSource = typeof(Tanshu.Accounts.Entities.ProductGroup);
|
||||
//
|
||||
// Label7
|
||||
//
|
||||
this.Label7.AutoSize = true;
|
||||
this.Label7.Location = new System.Drawing.Point(12, 75);
|
||||
this.Label7.Location = new System.Drawing.Point(3, 70);
|
||||
this.Label7.Name = "Label7";
|
||||
this.Label7.Size = new System.Drawing.Size(76, 13);
|
||||
this.Label7.TabIndex = 33;
|
||||
this.Label7.Text = "Product Types";
|
||||
//
|
||||
// Label3
|
||||
//
|
||||
this.Label3.AutoSize = true;
|
||||
this.Label3.Location = new System.Drawing.Point(57, 48);
|
||||
this.Label3.Name = "Label3";
|
||||
this.Label3.Size = new System.Drawing.Size(31, 13);
|
||||
this.Label3.TabIndex = 30;
|
||||
this.Label3.Text = "Units";
|
||||
this.Label7.Text = "Product Group";
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
this.txtName.AccessibleName = "";
|
||||
this.txtName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "Name", true));
|
||||
this.txtName.Location = new System.Drawing.Point(94, 19);
|
||||
this.txtName.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtName.Location = new System.Drawing.Point(106, 38);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(212, 20);
|
||||
this.txtName.Size = new System.Drawing.Size(149, 20);
|
||||
this.txtName.TabIndex = 0;
|
||||
//
|
||||
// Label2
|
||||
//
|
||||
this.Label2.AutoSize = true;
|
||||
this.Label2.Location = new System.Drawing.Point(53, 22);
|
||||
this.Label2.Location = new System.Drawing.Point(3, 35);
|
||||
this.Label2.Name = "Label2";
|
||||
this.Label2.Size = new System.Drawing.Size(35, 13);
|
||||
this.Label2.Size = new System.Drawing.Size(70, 13);
|
||||
this.Label2.TabIndex = 28;
|
||||
this.Label2.Text = "Name";
|
||||
this.Label2.Text = "Name / Units";
|
||||
//
|
||||
// btnNavFirst
|
||||
//
|
||||
this.btnNavFirst.Location = new System.Drawing.Point(40, 334);
|
||||
this.btnNavFirst.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnNavFirst.Location = new System.Drawing.Point(3, 53);
|
||||
this.btnNavFirst.Name = "btnNavFirst";
|
||||
this.btnNavFirst.Size = new System.Drawing.Size(40, 23);
|
||||
this.btnNavFirst.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnNavFirst.TabIndex = 44;
|
||||
this.btnNavFirst.Text = "<<";
|
||||
this.btnNavFirst.Click += new System.EventHandler(this.btnNavFirst_Click);
|
||||
//
|
||||
// btnNavPrev
|
||||
//
|
||||
this.btnNavPrev.Location = new System.Drawing.Point(86, 334);
|
||||
this.btnNavPrev.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnNavPrev.Location = new System.Drawing.Point(106, 53);
|
||||
this.btnNavPrev.Name = "btnNavPrev";
|
||||
this.btnNavPrev.Size = new System.Drawing.Size(35, 23);
|
||||
this.btnNavPrev.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnNavPrev.TabIndex = 45;
|
||||
this.btnNavPrev.Text = "<";
|
||||
this.btnNavPrev.Click += new System.EventHandler(this.btnNavPrev_Click);
|
||||
//
|
||||
// lblNavLocation
|
||||
//
|
||||
this.lblNavLocation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblNavLocation.BackColor = System.Drawing.Color.White;
|
||||
this.lblNavLocation.Location = new System.Drawing.Point(118, 334);
|
||||
this.lblNavLocation.Location = new System.Drawing.Point(12, 186);
|
||||
this.lblNavLocation.Name = "lblNavLocation";
|
||||
this.lblNavLocation.Size = new System.Drawing.Size(95, 23);
|
||||
this.lblNavLocation.Size = new System.Drawing.Size(391, 23);
|
||||
this.lblNavLocation.TabIndex = 46;
|
||||
this.lblNavLocation.Text = "No Records";
|
||||
this.lblNavLocation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
@@ -214,39 +181,40 @@
|
||||
//
|
||||
// btnNavNext
|
||||
//
|
||||
this.btnNavNext.Location = new System.Drawing.Point(214, 334);
|
||||
this.btnNavNext.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnNavNext.Location = new System.Drawing.Point(209, 53);
|
||||
this.btnNavNext.Name = "btnNavNext";
|
||||
this.btnNavNext.Size = new System.Drawing.Size(35, 23);
|
||||
this.btnNavNext.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnNavNext.TabIndex = 47;
|
||||
this.btnNavNext.Text = ">";
|
||||
this.btnNavNext.Click += new System.EventHandler(this.btnNavNext_Click);
|
||||
//
|
||||
// btnLast
|
||||
//
|
||||
this.btnLast.Location = new System.Drawing.Point(254, 334);
|
||||
this.btnLast.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnLast.Location = new System.Drawing.Point(312, 53);
|
||||
this.btnLast.Name = "btnLast";
|
||||
this.btnLast.Size = new System.Drawing.Size(40, 23);
|
||||
this.btnLast.Size = new System.Drawing.Size(100, 44);
|
||||
this.btnLast.TabIndex = 48;
|
||||
this.btnLast.Text = ">>";
|
||||
this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
|
||||
//
|
||||
// txtUniqueID
|
||||
//
|
||||
this.txtUniqueID.AccessibleName = "Unique ID";
|
||||
this.txtUniqueID.AccessibleName = "";
|
||||
this.txtUniqueID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "Code", true));
|
||||
this.txtUniqueID.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.bsProducts, "ProductID", true));
|
||||
this.txtUniqueID.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtUniqueID.Enabled = false;
|
||||
this.txtUniqueID.Location = new System.Drawing.Point(75, 12);
|
||||
this.txtUniqueID.Location = new System.Drawing.Point(261, 3);
|
||||
this.txtUniqueID.Name = "txtUniqueID";
|
||||
this.txtUniqueID.Size = new System.Drawing.Size(249, 20);
|
||||
this.txtUniqueID.Size = new System.Drawing.Size(151, 20);
|
||||
this.txtUniqueID.TabIndex = 37;
|
||||
this.txtUniqueID.Text = "UniqueID";
|
||||
this.txtUniqueID.WordWrap = false;
|
||||
//
|
||||
// Label1
|
||||
//
|
||||
this.Label1.AutoSize = true;
|
||||
this.Label1.Location = new System.Drawing.Point(37, 15);
|
||||
this.Label1.Location = new System.Drawing.Point(3, 0);
|
||||
this.Label1.Name = "Label1";
|
||||
this.Label1.Size = new System.Drawing.Size(32, 13);
|
||||
this.Label1.TabIndex = 36;
|
||||
@@ -255,18 +223,20 @@
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Location = new System.Drawing.Point(9, 300);
|
||||
this.btnAdd.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnAdd.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnAdd.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnAdd.TabIndex = 72;
|
||||
this.btnAdd.Text = "&Add";
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(91, 300);
|
||||
this.btnDelete.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnDelete.Location = new System.Drawing.Point(106, 3);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnDelete.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnDelete.TabIndex = 73;
|
||||
this.btnDelete.Text = "&Delete";
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
@@ -274,9 +244,10 @@
|
||||
// btnUpdate
|
||||
//
|
||||
this.btnUpdate.AccessibleName = "Done";
|
||||
this.btnUpdate.Location = new System.Drawing.Point(173, 300);
|
||||
this.btnUpdate.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnUpdate.Location = new System.Drawing.Point(209, 3);
|
||||
this.btnUpdate.Name = "btnUpdate";
|
||||
this.btnUpdate.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnUpdate.Size = new System.Drawing.Size(97, 44);
|
||||
this.btnUpdate.TabIndex = 71;
|
||||
this.btnUpdate.Text = "&Update";
|
||||
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
|
||||
@@ -284,9 +255,10 @@
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.AccessibleName = "Done";
|
||||
this.btnExit.Location = new System.Drawing.Point(252, 300);
|
||||
this.btnExit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnExit.Location = new System.Drawing.Point(312, 3);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnExit.Size = new System.Drawing.Size(100, 44);
|
||||
this.btnExit.TabIndex = 70;
|
||||
this.btnExit.Text = "E&xit";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
@@ -295,82 +267,138 @@
|
||||
//
|
||||
this.chkDiscontinued.AutoSize = true;
|
||||
this.chkDiscontinued.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.bsProducts, "Discontinued", true));
|
||||
this.chkDiscontinued.Location = new System.Drawing.Point(236, 190);
|
||||
this.chkDiscontinued.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.chkDiscontinued.Location = new System.Drawing.Point(261, 143);
|
||||
this.chkDiscontinued.Name = "chkDiscontinued";
|
||||
this.chkDiscontinued.Size = new System.Drawing.Size(88, 17);
|
||||
this.chkDiscontinued.Size = new System.Drawing.Size(151, 17);
|
||||
this.chkDiscontinued.TabIndex = 78;
|
||||
this.chkDiscontinued.Text = "Discontinued";
|
||||
this.chkDiscontinued.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cmbSalesLedger
|
||||
// cmbSalesTax
|
||||
//
|
||||
this.cmbSalesLedger.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "SaleLedgerID", true));
|
||||
this.cmbSalesLedger.DisplayMember = "LedgerID";
|
||||
this.cmbSalesLedger.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbSalesLedger.Location = new System.Drawing.Point(93, 163);
|
||||
this.cmbSalesLedger.Name = "cmbSalesLedger";
|
||||
this.cmbSalesLedger.Size = new System.Drawing.Size(137, 21);
|
||||
this.cmbSalesLedger.TabIndex = 80;
|
||||
this.cmbSalesLedger.ValueMember = "LedgerID";
|
||||
this.cmbSalesTax.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "Tax", true));
|
||||
this.cmbSalesTax.DataSource = this.bsTax;
|
||||
this.cmbSalesTax.DisplayMember = "Name";
|
||||
this.cmbSalesTax.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.cmbSalesTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbSalesTax.Location = new System.Drawing.Point(261, 108);
|
||||
this.cmbSalesTax.Name = "cmbSalesTax";
|
||||
this.cmbSalesTax.Size = new System.Drawing.Size(151, 21);
|
||||
this.cmbSalesTax.TabIndex = 82;
|
||||
this.cmbSalesTax.ValueMember = "LedgerID";
|
||||
//
|
||||
// bsTax
|
||||
//
|
||||
this.bsTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(98, 148);
|
||||
this.label5.Location = new System.Drawing.Point(3, 140);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(69, 13);
|
||||
this.label5.TabIndex = 79;
|
||||
this.label5.Text = "Sales Ledger";
|
||||
this.label5.Size = new System.Drawing.Size(80, 13);
|
||||
this.label5.TabIndex = 84;
|
||||
this.label5.Text = "Service Charge";
|
||||
//
|
||||
// cmbSalesTax
|
||||
// textBox1
|
||||
//
|
||||
this.cmbSalesTax.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProducts, "SaleTaxID", true));
|
||||
this.cmbSalesTax.DataSource = this.bsSalesTax;
|
||||
this.cmbSalesTax.DisplayMember = "Name";
|
||||
this.cmbSalesTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbSalesTax.Location = new System.Drawing.Point(236, 163);
|
||||
this.cmbSalesTax.Name = "cmbSalesTax";
|
||||
this.cmbSalesTax.Size = new System.Drawing.Size(91, 21);
|
||||
this.cmbSalesTax.TabIndex = 82;
|
||||
this.cmbSalesTax.ValueMember = "LedgerID";
|
||||
this.textBox1.AccessibleName = "Phone 1";
|
||||
this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "ServiceCharge", true));
|
||||
this.textBox1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.textBox1.Location = new System.Drawing.Point(106, 143);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(149, 20);
|
||||
this.textBox1.TabIndex = 83;
|
||||
this.textBox1.Text = "0";
|
||||
//
|
||||
// bsSalesTax
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.bsSalesTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.5F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.5F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtUnits, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtProductID, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.chkDiscontinued, 2, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtSalePrice, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnAddProductGroup, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.Label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.cmbSalesTax, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.cmbProductGroup, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtUniqueID, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.Label7, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.Label2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.txtName, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.Label4, 0, 3);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 5;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(415, 175);
|
||||
this.tableLayoutPanel1.TabIndex = 85;
|
||||
//
|
||||
// label10
|
||||
// txtProductID
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(241, 148);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(54, 13);
|
||||
this.label10.TabIndex = 81;
|
||||
this.label10.Text = "Sales Tax";
|
||||
this.txtProductID.AccessibleName = "";
|
||||
this.txtProductID.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "ProductID", true));
|
||||
this.txtProductID.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtProductID.Enabled = false;
|
||||
this.txtProductID.Location = new System.Drawing.Point(106, 3);
|
||||
this.txtProductID.Name = "txtProductID";
|
||||
this.txtProductID.Size = new System.Drawing.Size(149, 20);
|
||||
this.txtProductID.TabIndex = 83;
|
||||
this.txtProductID.WordWrap = false;
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.ColumnCount = 4;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnAdd, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnDelete, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnNavPrev, 1, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnLast, 3, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnNavNext, 2, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnNavFirst, 0, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnExit, 3, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.btnUpdate, 2, 0);
|
||||
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 212);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 2;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(415, 100);
|
||||
this.tableLayoutPanel2.TabIndex = 86;
|
||||
//
|
||||
// txtUnits
|
||||
//
|
||||
this.txtUnits.AccessibleName = "";
|
||||
this.txtUnits.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProducts, "Units", true));
|
||||
this.txtUnits.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtUnits.Location = new System.Drawing.Point(261, 38);
|
||||
this.txtUnits.Name = "txtUnits";
|
||||
this.txtUnits.Size = new System.Drawing.Size(151, 20);
|
||||
this.txtUnits.TabIndex = 85;
|
||||
//
|
||||
// ProductsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(336, 365);
|
||||
this.Controls.Add(this.cmbSalesTax);
|
||||
this.Controls.Add(this.Label1);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.cmbSalesLedger);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.chkDiscontinued);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.btnDelete);
|
||||
this.Controls.Add(this.btnUpdate);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.Controls.Add(this.Label4);
|
||||
this.Controls.Add(this.txtSalePrice);
|
||||
this.Controls.Add(this.GroupBox1);
|
||||
this.Controls.Add(this.btnNavFirst);
|
||||
this.Controls.Add(this.btnNavPrev);
|
||||
this.ClientSize = new System.Drawing.Size(415, 312);
|
||||
this.Controls.Add(this.tableLayoutPanel2);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.lblNavLocation);
|
||||
this.Controls.Add(this.btnNavNext);
|
||||
this.Controls.Add(this.btnLast);
|
||||
this.Controls.Add(this.txtUniqueID);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ProductsForm";
|
||||
@@ -378,13 +406,12 @@
|
||||
this.Text = "Products";
|
||||
this.Load += new System.EventHandler(this.Products_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProducts)).EndInit();
|
||||
this.GroupBox1.ResumeLayout(false);
|
||||
this.GroupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsTypes)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsUnits)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsSalesTax)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsTax)).EndInit();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -392,12 +419,9 @@
|
||||
|
||||
internal System.Windows.Forms.Label Label4;
|
||||
internal System.Windows.Forms.TextBox txtSalePrice;
|
||||
internal System.Windows.Forms.GroupBox GroupBox1;
|
||||
internal System.Windows.Forms.Button btnAddCategory;
|
||||
internal System.Windows.Forms.ComboBox cmbProductTypes;
|
||||
internal System.Windows.Forms.ComboBox cmbUnits;
|
||||
internal System.Windows.Forms.Button btnAddProductGroup;
|
||||
internal System.Windows.Forms.ComboBox cmbProductGroup;
|
||||
internal System.Windows.Forms.Label Label7;
|
||||
internal System.Windows.Forms.Label Label3;
|
||||
internal System.Windows.Forms.TextBox txtName;
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.Button btnNavFirst;
|
||||
@@ -412,13 +436,15 @@
|
||||
internal System.Windows.Forms.Button btnUpdate;
|
||||
internal System.Windows.Forms.Button btnExit;
|
||||
private System.Windows.Forms.CheckBox chkDiscontinued;
|
||||
internal System.Windows.Forms.ComboBox cmbSalesLedger;
|
||||
internal System.Windows.Forms.Label label5;
|
||||
internal System.Windows.Forms.ComboBox cmbSalesTax;
|
||||
internal System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.BindingSource bsProducts;
|
||||
private System.Windows.Forms.BindingSource bsUnits;
|
||||
private System.Windows.Forms.BindingSource bsTypes;
|
||||
private System.Windows.Forms.BindingSource bsSalesTax;
|
||||
private System.Windows.Forms.BindingSource bsProductGroups;
|
||||
private System.Windows.Forms.BindingSource bsTax;
|
||||
internal System.Windows.Forms.Label label5;
|
||||
internal System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
internal System.Windows.Forms.TextBox txtProductID;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
internal System.Windows.Forms.TextBox txtUnits;
|
||||
}
|
||||
}
|
||||
@@ -32,29 +32,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void FillCombos()
|
||||
{
|
||||
bsUnits.DataSource = new StringType[17] {new StringType ( "Cms"),
|
||||
new StringType ("Meter"),
|
||||
new StringType ("Quintal"),
|
||||
new StringType ("Can"),
|
||||
new StringType ("Gms"),
|
||||
new StringType ("Rs."),
|
||||
new StringType ("Piece"),
|
||||
new StringType ("Petti"),
|
||||
new StringType ("No.'s"),
|
||||
new StringType ("Liter"),
|
||||
new StringType ("Box"),
|
||||
new StringType ("Tin"),
|
||||
new StringType ("Dibbi"),
|
||||
new StringType ("Plate"),
|
||||
new StringType ("Kg."),
|
||||
new StringType ("Bottle"),
|
||||
new StringType ("Pack" )};
|
||||
|
||||
bsTypes.DataSource = new ProductGroupBI().GetProductGroups();
|
||||
//bsPurchaseLedgers.DataSource = new LedgerBI().GetLedgersOfType('P');
|
||||
//bsSalesLedgers.DataSource = new LedgerBI().GetLedgersOfType('X');
|
||||
//bsSalesTax.DataSource = new LedgerBI().GetLedgersOfType('T');
|
||||
//bsPurchaseTax.DataSource = new LedgerBI().GetLedgersOfType('T');
|
||||
bsProductGroups.DataSource = new ProductGroupBI().GetProductGroups();
|
||||
bsTax.DataSource = TaxBI.GetTaxes();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -129,23 +108,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
#region Add / Edit / Delete
|
||||
private bool ValidateValues()
|
||||
{
|
||||
bool returnType;
|
||||
returnType = (bool)(txtName.Text.Trim().Length > 0 ? true : false);
|
||||
returnType = (cmbSalesLedger.SelectedValue == null ? false : true);
|
||||
returnType = (cmbSalesTax.SelectedValue == null ? false : true);
|
||||
return returnType;
|
||||
if (txtName.Text.Trim().Length == 0)
|
||||
return false;
|
||||
if (cmbProductGroup.SelectedValue == null)
|
||||
return false;
|
||||
if (cmbSalesTax.SelectedValue == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool Save(bool addNew)
|
||||
{
|
||||
#region Setup Products
|
||||
User user = Session.User;
|
||||
Product product = new Product();
|
||||
if (!addNew)
|
||||
product = ProductBI.GetProduct(productList.ElementAt(bsProducts.Position).ProductID);
|
||||
product = (Product)bsProducts.Current;
|
||||
product.Name = txtName.Text;
|
||||
product.Units = cmbUnits.Text;
|
||||
product.ProductGroup = new ProductGroupBI().GetProductGroup((int)cmbProductTypes.SelectedValue);
|
||||
product.Units = txtUnits.Text;
|
||||
product.ProductGroup = new ProductGroupBI().GetProductGroup((int)cmbProductGroup.SelectedValue);
|
||||
product.SalePrice = Convert.ToDecimal(txtSalePrice.Text);
|
||||
product.Discontinued = chkDiscontinued.Checked;
|
||||
product.Tax = new Tax();
|
||||
@@ -190,7 +170,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
frm.ShowDialog();
|
||||
frm.Dispose();
|
||||
FillCombos();
|
||||
cmbProductTypes.SelectedIndex = 0;
|
||||
cmbProductGroup.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -120,26 +120,11 @@
|
||||
<metadata name="bsProducts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsProducts.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
<metadata name="bsProductGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>211, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsTypes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>251, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsTypes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>251, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsUnits.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>123, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsUnits.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>123, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsSalesTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 54</value>
|
||||
</metadata>
|
||||
<metadata name="bsSalesTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 54</value>
|
||||
<metadata name="bsTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>129, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>102</value>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class BlockTimer : IDisposable
|
||||
{
|
||||
private string _description;
|
||||
private long _start;
|
||||
|
||||
public BlockTimer(string description)
|
||||
{
|
||||
_description = description;
|
||||
_start = DateTime.Now.Ticks;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
long totalTime = DateTime.Now.Ticks - _start;
|
||||
Console.WriteLine(_description);
|
||||
Console.Write(" - Total Execution Time: ");
|
||||
Console.Write(new TimeSpan(totalTime).TotalMilliseconds.ToString());
|
||||
Console.WriteLine(" ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,58 +15,54 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
BindingSource bindingSource;
|
||||
OrderedDictionary<BillItemKey, BillInventory> bill;
|
||||
BillItemKey oldKey;
|
||||
BillItemKey newKey;
|
||||
public BillHelperFunctions(BindingSource bindingSource, OrderedDictionary<BillItemKey, BillInventory> bill, int productID)
|
||||
{
|
||||
this.bindingSource = bindingSource;
|
||||
this.bill = bill;
|
||||
this.oldKey = new BillItemKey(productID, false);
|
||||
this.newKey = new BillItemKey(productID, true);
|
||||
this.newKey = new BillItemKey(productID, 0);
|
||||
}
|
||||
public void SetDiscount(string name, decimal discount)
|
||||
{
|
||||
if (discount > 1 || discount < 0)
|
||||
return;
|
||||
decimal maxDiscount = SaleVoucherBI.GetProductDiscountLimit(newKey.ProductID);
|
||||
decimal maxDiscount = VoucherBI.GetProductDiscountLimit(newKey.ProductID);
|
||||
if (discount > maxDiscount)
|
||||
MessageBox.Show(string.Format("Maximum discount for {0} is {1:P}", name, maxDiscount), "Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
if (bill.ContainsKey(oldKey))
|
||||
bill[oldKey].Discount = discount;
|
||||
if (bill.ContainsKey(newKey))
|
||||
bill[newKey].Discount = discount;
|
||||
return;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
item.Value.Discount = discount;
|
||||
}
|
||||
}
|
||||
#region Add Product
|
||||
public BillInventory AddProduct()
|
||||
{
|
||||
BillInventory product;
|
||||
if ((!bill.ContainsKey(oldKey)) && (!bill.ContainsKey(newKey)))
|
||||
if (bill.ContainsKey(newKey))
|
||||
{
|
||||
//No new or old
|
||||
product = SaleVoucherBI.GetDefaultSaleBillItem(newKey.ProductID);
|
||||
product = AddProduct(product);
|
||||
}
|
||||
else if (bill.ContainsKey(newKey))
|
||||
{
|
||||
//Has new or both
|
||||
bindingSource.CurrencyManager.Position = bill.IndexOfKey(newKey);
|
||||
product = bill[newKey];
|
||||
product.Quantity += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Has only old
|
||||
product = SaleVoucherBI.GetDefaultSaleBillItem(oldKey.ProductID);
|
||||
product.Discount = bill[oldKey].Discount;
|
||||
product.Price = bill[oldKey].Price;
|
||||
{ //Has only old
|
||||
product = VoucherBI.GetDefaultSaleBillItem(newKey.ProductID);
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.ProductID == newKey.ProductID)
|
||||
{
|
||||
product.Discount = item.Value.Discount;
|
||||
product.Price = item.Value.Price;
|
||||
}
|
||||
}
|
||||
product = AddProduct(product);
|
||||
}
|
||||
return product;
|
||||
}
|
||||
private BillInventory AddProduct(BillInventory product)
|
||||
{
|
||||
bill.Add(new BillItemKey(product.ProductID, true), product);
|
||||
bill.Add(new BillItemKey(product.ProductID, 0), product);
|
||||
bindingSource.DataSource = bill.Values;
|
||||
bindingSource.CurrencyManager.Position = bindingSource.CurrencyManager.Count + 1;
|
||||
return product;
|
||||
@@ -75,48 +71,28 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
#region Quantity
|
||||
public void SetQuantity(BillInventory product, decimal quantity, bool prompt)
|
||||
{
|
||||
if (product.Printed)
|
||||
return;
|
||||
if (prompt && !GetInput("Price", ref quantity))
|
||||
return;
|
||||
|
||||
if (product.Printed == 0)
|
||||
{ // new
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
else if (bill.ContainsKey(newKey))
|
||||
{
|
||||
BillInventory newProduct = bill[newKey];
|
||||
if (prompt)
|
||||
SetQuantity(newProduct, quantity - product.Printed);
|
||||
else
|
||||
SetQuantity(newProduct, newProduct.Quantity + quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
////Has only old
|
||||
if (prompt)
|
||||
quantity -= product.Printed;
|
||||
if (quantity > 0 || Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
{
|
||||
var newProduct = SaleVoucherBI.GetDefaultSaleBillItem(product.ProductID);
|
||||
newProduct.Price = product.Price;
|
||||
newProduct.Discount = product.Discount;
|
||||
newProduct = AddProduct(newProduct);
|
||||
SetQuantity(newProduct, quantity);
|
||||
}
|
||||
}
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
private void SetQuantity(BillInventory product, decimal quantity)
|
||||
{
|
||||
if (quantity < 0 && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
if (bill.ContainsKey(oldKey))
|
||||
var total = quantity;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
var totalQuantity = bill[oldKey].Quantity + quantity;
|
||||
if (totalQuantity < 0)
|
||||
quantity += 0 - totalQuantity;
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
total += item.Value.Quantity;
|
||||
}
|
||||
|
||||
if (total < 0)
|
||||
quantity -= total;
|
||||
product.Quantity = quantity;
|
||||
}
|
||||
#endregion
|
||||
@@ -129,10 +105,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
if (rate == 0 && !Session.IsAllowed(RoleConstants.ZERO_RATE))
|
||||
return;
|
||||
if (bill.ContainsKey(new BillItemKey(product.ProductID, true)))
|
||||
bill[new BillItemKey(product.ProductID, true)].Price = rate;
|
||||
if (bill.ContainsKey(new BillItemKey(product.ProductID, false)))
|
||||
bill[new BillItemKey(product.ProductID, false)].Price = rate;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
item.Value.Price = rate;
|
||||
}
|
||||
}
|
||||
private void InputBox_Validating(object sender, InputBoxValidatingArgs e)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class BillSettleForm : Form
|
||||
{
|
||||
private int settleOption = SettleOptionFactory.Unsettled;
|
||||
private SettleOption settleOption = SettleOption.Unsettled;
|
||||
public BillSettleForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -22,38 +22,38 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnCash_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Cash;
|
||||
settleOption = SettleOption.Cash;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCreditCard_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.CreditCard;
|
||||
settleOption = SettleOption.CreditCard;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnNC_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.NoCharge;
|
||||
settleOption = SettleOption.NoCharge;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Unsettled;
|
||||
settleOption = SettleOption.Unsettled;
|
||||
this.Close();
|
||||
}
|
||||
private void btnStaff_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Staff;
|
||||
settleOption = SettleOption.Staff;
|
||||
this.Close();
|
||||
}
|
||||
private void btnBillToCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.BillToCompany;
|
||||
settleOption = SettleOption.BillToCompany;
|
||||
this.Close();
|
||||
}
|
||||
public int optionChosen
|
||||
public SettleOption optionChosen
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -16,16 +16,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class DiscountForm : Form
|
||||
{
|
||||
private IList<ProductGroup> source;
|
||||
private IList<UnselectableCheckbox> list;
|
||||
private IList<int> selection;
|
||||
private IList<string> source;
|
||||
private HashSet<string> selection;
|
||||
decimal discount;
|
||||
public DiscountForm(IList<ProductGroup> source)
|
||||
public DiscountForm(IList<string> source)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.source = source;
|
||||
list = new List<UnselectableCheckbox>();
|
||||
selection = new List<int>();
|
||||
selection = new HashSet<string>();
|
||||
}
|
||||
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
@@ -33,13 +31,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
CheckBox button = sender as CheckBox;
|
||||
if (button == null)
|
||||
return;
|
||||
var pg = (ProductGroup)button.Tag;
|
||||
var item = (string)button.Tag;
|
||||
if (button.CheckState == CheckState.Checked)
|
||||
selection.Add(pg.ProductGroupID);
|
||||
selection.Add(item);
|
||||
else
|
||||
selection.Remove(pg.ProductGroupID);
|
||||
selection.Remove(item);
|
||||
}
|
||||
public decimal Selection(out IList<int> list)
|
||||
public decimal Selection(out HashSet<string> list)
|
||||
{
|
||||
list = selection;
|
||||
return discount;
|
||||
@@ -52,7 +50,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void DiscountForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ControlFactory.GenerateGroups(ref flpModifier, ref list, new Point(75, 75), source, new ButtonClickDelegate(button_Click));
|
||||
ControlFactory.GenerateGroups(ref flpModifier, new Point(75, 75), source, new ButtonClickDelegate(button_Click));
|
||||
}
|
||||
|
||||
private void txtAmount_KeyDown(object sender, KeyEventArgs e)
|
||||
|
||||
+66
-38
@@ -29,9 +29,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtDiscount = new System.Windows.Forms.TextBox();
|
||||
this.Label12 = new System.Windows.Forms.Label();
|
||||
@@ -48,9 +47,11 @@
|
||||
this.flpActions = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnQuantity = new System.Windows.Forms.Button();
|
||||
this.btnRate = new System.Windows.Forms.Button();
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnDiscount = new System.Windows.Forms.Button();
|
||||
this.btnModifier = new System.Windows.Forms.Button();
|
||||
this.btnWaiter = new System.Windows.Forms.Button();
|
||||
this.btnMoveTable = new System.Windows.Forms.Button();
|
||||
this.btnPrintKot = new System.Windows.Forms.Button();
|
||||
this.btnPrintBill = new System.Windows.Forms.Button();
|
||||
this.btnClear = new System.Windows.Forms.Button();
|
||||
@@ -72,11 +73,11 @@
|
||||
this.txtKotID = new System.Windows.Forms.TextBox();
|
||||
this.btnCustomer = new System.Windows.Forms.Button();
|
||||
this.printedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.additionalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.bsWaiter = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.bsPending = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnMore = new System.Windows.Forms.Button();
|
||||
this.btnMoveKot = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
|
||||
this.pnlBilling.SuspendLayout();
|
||||
this.flpActions.SuspendLayout();
|
||||
@@ -189,8 +190,7 @@
|
||||
this.dgvProducts.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvProducts.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Display,
|
||||
this.printedDataGridViewTextBoxColumn,
|
||||
this.additionalDataGridViewTextBoxColumn});
|
||||
this.printedDataGridViewTextBoxColumn});
|
||||
this.dgvProducts.DataSource = this.bindingSource;
|
||||
this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgvProducts.Location = new System.Drawing.Point(12, 90);
|
||||
@@ -206,13 +206,15 @@
|
||||
//
|
||||
// Display
|
||||
//
|
||||
this.Display.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.Display.DataPropertyName = "Display";
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Display.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Display.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.Display.HeaderText = "Display";
|
||||
this.Display.MinimumWidth = 250;
|
||||
this.Display.Name = "Display";
|
||||
this.Display.ReadOnly = true;
|
||||
this.Display.Width = 5;
|
||||
this.Display.Width = 250;
|
||||
//
|
||||
// pnlBilling
|
||||
//
|
||||
@@ -278,10 +280,13 @@
|
||||
this.flpActions.Controls.Add(this.btnModifier);
|
||||
this.flpActions.Controls.Add(this.btnWaiter);
|
||||
this.flpActions.Controls.Add(this.btnPrintKot);
|
||||
this.flpActions.Controls.Add(this.btnMoveTable);
|
||||
this.flpActions.Controls.Add(this.btnPrintBill);
|
||||
this.flpActions.Controls.Add(this.btnClear);
|
||||
this.flpActions.Controls.Add(this.btnVoid);
|
||||
this.flpActions.Controls.Add(this.btnSettle);
|
||||
this.flpActions.Controls.Add(this.btnMore);
|
||||
this.flpActions.Controls.Add(this.btnMoveKot);
|
||||
this.flpActions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flpActions.Location = new System.Drawing.Point(0, 607);
|
||||
this.flpActions.Name = "flpActions";
|
||||
@@ -308,6 +313,16 @@
|
||||
this.btnRate.UseVisualStyleBackColor = true;
|
||||
this.btnRate.Click += new System.EventHandler(this.btnRate_Click);
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(165, 3);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnDelete.TabIndex = 157;
|
||||
this.btnDelete.Text = "Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
//
|
||||
// btnDiscount
|
||||
//
|
||||
this.btnDiscount.Location = new System.Drawing.Point(246, 3);
|
||||
@@ -338,6 +353,16 @@
|
||||
this.btnWaiter.UseVisualStyleBackColor = true;
|
||||
this.btnWaiter.Click += new System.EventHandler(this.btnWaiter_Click);
|
||||
//
|
||||
// btnMoveTable
|
||||
//
|
||||
this.btnMoveTable.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnMoveTable.Name = "btnMoveTable";
|
||||
this.btnMoveTable.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveTable.TabIndex = 158;
|
||||
this.btnMoveTable.Text = "Move Table";
|
||||
this.btnMoveTable.UseVisualStyleBackColor = true;
|
||||
this.btnMoveTable.Click += new System.EventHandler(this.btnMoveTable_Click);
|
||||
//
|
||||
// btnPrintKot
|
||||
//
|
||||
this.btnPrintKot.Location = new System.Drawing.Point(489, 3);
|
||||
@@ -350,7 +375,7 @@
|
||||
//
|
||||
// btnPrintBill
|
||||
//
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnPrintBill.Name = "btnPrintBill";
|
||||
this.btnPrintBill.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnPrintBill.TabIndex = 144;
|
||||
@@ -360,7 +385,7 @@
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
this.btnClear.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnClear.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnClear.Name = "btnClear";
|
||||
this.btnClear.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnClear.TabIndex = 148;
|
||||
@@ -370,7 +395,7 @@
|
||||
//
|
||||
// btnVoid
|
||||
//
|
||||
this.btnVoid.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnVoid.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnVoid.Name = "btnVoid";
|
||||
this.btnVoid.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnVoid.TabIndex = 143;
|
||||
@@ -380,7 +405,7 @@
|
||||
//
|
||||
// btnSettle
|
||||
//
|
||||
this.btnSettle.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnSettle.Location = new System.Drawing.Point(894, 3);
|
||||
this.btnSettle.Name = "btnSettle";
|
||||
this.btnSettle.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnSettle.TabIndex = 155;
|
||||
@@ -524,24 +549,15 @@
|
||||
//
|
||||
// printedDataGridViewTextBoxColumn
|
||||
//
|
||||
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Printed";
|
||||
dataGridViewCellStyle2.Format = "N2";
|
||||
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.printedDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Quantity";
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
|
||||
dataGridViewCellStyle4.Format = "N2";
|
||||
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.printedDataGridViewTextBoxColumn.HeaderText = "Printed";
|
||||
this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn";
|
||||
this.printedDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
this.printedDataGridViewTextBoxColumn.Width = 5;
|
||||
//
|
||||
// additionalDataGridViewTextBoxColumn
|
||||
//
|
||||
this.additionalDataGridViewTextBoxColumn.DataPropertyName = "Additional";
|
||||
dataGridViewCellStyle3.Format = "N2";
|
||||
dataGridViewCellStyle3.NullValue = null;
|
||||
this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.additionalDataGridViewTextBoxColumn.HeaderText = "Additional";
|
||||
this.additionalDataGridViewTextBoxColumn.Name = "additionalDataGridViewTextBoxColumn";
|
||||
this.additionalDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
this.additionalDataGridViewTextBoxColumn.Width = 5;
|
||||
this.printedDataGridViewTextBoxColumn.Width = 65;
|
||||
//
|
||||
// bindingSource
|
||||
//
|
||||
@@ -555,15 +571,25 @@
|
||||
//
|
||||
this.bsPending.DataSource = typeof(Tanshu.Accounts.Contracts.PendingBills);
|
||||
//
|
||||
// btnDelete
|
||||
// btnMore
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(165, 3);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnDelete.TabIndex = 157;
|
||||
this.btnDelete.Text = "Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
this.btnMore.Location = new System.Drawing.Point(3, 84);
|
||||
this.btnMore.Name = "btnMore";
|
||||
this.btnMore.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMore.TabIndex = 159;
|
||||
this.btnMore.Text = "More";
|
||||
this.btnMore.UseVisualStyleBackColor = true;
|
||||
this.btnMore.Click += new System.EventHandler(this.btnMore_Click);
|
||||
//
|
||||
// btnMoveKot
|
||||
//
|
||||
this.btnMoveKot.Location = new System.Drawing.Point(84, 84);
|
||||
this.btnMoveKot.Name = "btnMoveKot";
|
||||
this.btnMoveKot.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveKot.TabIndex = 160;
|
||||
this.btnMoveKot.Text = "Move Kot";
|
||||
this.btnMoveKot.UseVisualStyleBackColor = true;
|
||||
this.btnMoveKot.Click += new System.EventHandler(this.btnMoveKot_Click);
|
||||
//
|
||||
// SalesForm
|
||||
//
|
||||
@@ -634,10 +660,12 @@
|
||||
private System.Windows.Forms.Button btnModifier;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpGroup;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpMain;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnMoveTable;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Display;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn printedDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn additionalDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnMore;
|
||||
private System.Windows.Forms.Button btnMoveKot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public partial class SalesForm : Form, ISaleForm
|
||||
{
|
||||
BillController billController;
|
||||
List<Button> buttonList = new List<Button>();
|
||||
List<Button> buttonHeads = new List<Button>();
|
||||
|
||||
public SalesForm(BillController billController)
|
||||
{
|
||||
@@ -133,24 +131,21 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtGrossAmount.Text = "0.00";
|
||||
txtAmount.Text = "0.00";
|
||||
bindingSource.DataSource = bill.Values;
|
||||
MoreButton(false);
|
||||
ChangeFormState(SaleFormState.Waiting);
|
||||
}
|
||||
private void ChangeFormState(SaleFormState state)
|
||||
{
|
||||
foreach (var button in buttonList)
|
||||
button.Dispose();
|
||||
foreach (var button in buttonHeads)
|
||||
button.Dispose();
|
||||
buttonList = new List<Button>();
|
||||
buttonHeads = new List<Button>();
|
||||
flpGroup.Controls.Clear();
|
||||
flpMain.Controls.Clear();
|
||||
if (state == SaleFormState.Billing)
|
||||
{
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, ref buttonHeads, new Point(75, 75), 0, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,11 +161,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, ref buttonHeads, new Point(75, 75), start, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateProducts(ref flpMain, ref buttonList, new Point(75, 75), 0, ProductBI.GetProducts(item.ProductGroupID), new ButtonClickDelegate(productButton_Click));
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), 0, ProductBI.GetProducts(item.ProductGroupID), new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
}
|
||||
private void productButton_Click(object sender, EventArgs e)
|
||||
@@ -185,7 +180,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = ProductBI.GetProducts();
|
||||
ControlFactory.GenerateProducts(ref flpMain, ref buttonList, new Point(75, 75), start, list, new ButtonClickDelegate(productButton_Click));
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,7 +199,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new FoodTableBI().List();
|
||||
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -315,7 +310,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
DataGridView dgv = sender as DataGridView;
|
||||
BillInventory data = dgv.Rows[e.RowIndex].DataBoundItem as BillInventory;
|
||||
|
||||
if (data.Printed > 0)
|
||||
if (data.Tax == -1)
|
||||
{
|
||||
e.CellStyle.SelectionBackColor = Color.Blue;
|
||||
e.CellStyle.BackColor = Color.LightBlue;
|
||||
}
|
||||
else if (data.Printed)
|
||||
{
|
||||
e.CellStyle.SelectionBackColor = Color.HotPink;
|
||||
e.CellStyle.BackColor = Color.LightPink;
|
||||
@@ -389,14 +389,43 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dgvProducts.Rows.Count <= 0)
|
||||
return;
|
||||
var p = billController.CurrentProduct;
|
||||
if (p.Quantity > 1)
|
||||
billController.SetQuantity(-1, false);
|
||||
else
|
||||
billController.ProductRemove();
|
||||
billController.SetQuantity(-1, false);
|
||||
}
|
||||
|
||||
private void btnMoveTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MoveTable();
|
||||
}
|
||||
|
||||
private void btnMore_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button.Text == "More")
|
||||
MoreButton(true);
|
||||
else if (button.Text == "Less")
|
||||
MoreButton(false);
|
||||
else
|
||||
throw new InvalidOperationException("Button State incorrect");
|
||||
}
|
||||
private void MoreButton(bool more)
|
||||
{
|
||||
btnMore.Text = more ? "Less" : "More";
|
||||
btnQuantity.Visible = !more;
|
||||
btnRate.Visible = more;
|
||||
btnDelete.Visible = !more;
|
||||
btnDiscount.Visible = !more;
|
||||
btnModifier.Visible = !more;
|
||||
btnMoveTable.Visible = more;
|
||||
btnMoveKot.Visible = more;
|
||||
btnVoid.Visible = more;
|
||||
|
||||
}
|
||||
|
||||
private void btnMoveKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MergeKot();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,12 @@
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsWaiter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>148, 17</value>
|
||||
</metadata>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class frmMoveTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.flpTables = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flpTables
|
||||
//
|
||||
this.flpTables.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flpTables.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flpTables.Location = new System.Drawing.Point(0, 0);
|
||||
this.flpTables.Name = "flpTables";
|
||||
this.flpTables.Size = new System.Drawing.Size(847, 492);
|
||||
this.flpTables.TabIndex = 7;
|
||||
//
|
||||
// frmMoveTable
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(847, 492);
|
||||
this.Controls.Add(this.flpTables);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "frmMoveTable";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Move Table / Kot";
|
||||
this.Load += new System.EventHandler(this.frmMoveTable_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.FlowLayoutPanel flpTables;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class frmMoveTable : Form
|
||||
{
|
||||
private IList<FoodTable> source;
|
||||
private FoodTable selection;
|
||||
private bool allowMerge;
|
||||
public frmMoveTable(IList<FoodTable> source, bool allowMerge)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.source = source;
|
||||
selection = null;
|
||||
this.allowMerge = allowMerge;
|
||||
}
|
||||
public FoodTable Selection
|
||||
{
|
||||
get
|
||||
{
|
||||
return selection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void frmMoveTable_Load(object sender, EventArgs e)
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), 0, source, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
private void tableButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as FoodTable;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.FoodTableID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), start, source, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Status != null && item.Status != string.Empty && !allowMerge)
|
||||
{
|
||||
MessageBox.Show("Cannot move to a running table", "Cannot Move", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else if (MessageBox.Show(string.Format("Move selected table to table {0}", item.Name), "Move", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
selection = item;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -107,6 +107,13 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Authentication\MsrLoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Authentication\MsrLoginForm.Designer.cs">
|
||||
<DependentUpon>MsrLoginForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Authentication\MsrLogin.cs" />
|
||||
<Compile Include="Authentication\PermissionException.cs" />
|
||||
<Compile Include="Authentication\KeyboardLogin.cs" />
|
||||
<Compile Include="Authentication\ILogin.cs" />
|
||||
@@ -118,6 +125,7 @@
|
||||
<Compile Include="CurrencyCounter.Designer.cs">
|
||||
<DependentUpon>CurrencyCounter.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Profiling\BlockTimer.cs" />
|
||||
<Compile Include="Reports\SaleDetail.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -131,11 +139,17 @@
|
||||
<Compile Include="Sales\BillSettleForm.Designer.cs">
|
||||
<DependentUpon>BillSettleForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Advances\AdjustAdvanceForm.cs">
|
||||
<Compile Include="Advances\frmAdjustAdvance.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Advances\AdjustAdvanceForm.designer.cs">
|
||||
<DependentUpon>AdjustAdvanceForm.cs</DependentUpon>
|
||||
<Compile Include="Advances\frmAdjustAdvance.designer.cs">
|
||||
<DependentUpon>frmAdjustAdvance.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\frmMoveTable.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Sales\frmMoveTable.Designer.cs">
|
||||
<DependentUpon>frmMoveTable.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\DiscountForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -213,6 +227,10 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Authentication\MsrLoginForm.resx">
|
||||
<DependentUpon>MsrLoginForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CurrencyCounter.resx">
|
||||
<DependentUpon>CurrencyCounter.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -223,10 +241,13 @@
|
||||
<EmbeddedResource Include="Sales\BillSettleForm.resx">
|
||||
<DependentUpon>BillSettleForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Advances\AdjustAdvanceForm.resx">
|
||||
<DependentUpon>AdjustAdvanceForm.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Advances\frmAdjustAdvance.resx">
|
||||
<DependentUpon>frmAdjustAdvance.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\frmMoveTable.resx">
|
||||
<DependentUpon>frmMoveTable.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\DiscountForm.resx">
|
||||
<DependentUpon>DiscountForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -273,8 +294,8 @@
|
||||
<DependentUpon>ProductTypes.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Advances\RecieveAdvanceForm.resx">
|
||||
<DependentUpon>RecieveAdvanceForm.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Advances\frmRecieveAdvance.resx">
|
||||
<DependentUpon>frmRecieveAdvance.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Reports\SaleAnalysisForm.resx">
|
||||
@@ -286,11 +307,11 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="App.config" />
|
||||
<Compile Include="Advances\RecieveAdvanceForm.cs">
|
||||
<Compile Include="Advances\frmRecieveAdvance.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Advances\RecieveAdvanceForm.designer.cs">
|
||||
<DependentUpon>RecieveAdvanceForm.cs</DependentUpon>
|
||||
<Compile Include="Advances\frmRecieveAdvance.designer.cs">
|
||||
<DependentUpon>frmRecieveAdvance.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Reports\SaleAnalysisForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.btnCreateUSer = new System.Windows.Forms.Button();
|
||||
this.btnMsr = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtPassword
|
||||
@@ -46,16 +47,16 @@
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '/';
|
||||
this.txtPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtPassword.TabIndex = 5;
|
||||
this.txtPassword.TabIndex = 0;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(28, 38);
|
||||
this.label2.Location = new System.Drawing.Point(26, 38);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(70, 13);
|
||||
this.label2.TabIndex = 6;
|
||||
this.label2.Text = "old Password";
|
||||
this.label2.Size = new System.Drawing.Size(72, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Old Password";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// txtUsername
|
||||
@@ -64,7 +65,7 @@
|
||||
this.txtUsername.Location = new System.Drawing.Point(104, 12);
|
||||
this.txtUsername.Name = "txtUsername";
|
||||
this.txtUsername.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtUsername.TabIndex = 3;
|
||||
this.txtUsername.TabIndex = 10;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@@ -72,7 +73,7 @@
|
||||
this.label1.Location = new System.Drawing.Point(38, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "User Name";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
@@ -82,7 +83,7 @@
|
||||
this.txtnewPassword.Name = "txtnewPassword";
|
||||
this.txtnewPassword.PasswordChar = '/';
|
||||
this.txtnewPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtnewPassword.TabIndex = 7;
|
||||
this.txtnewPassword.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
@@ -100,7 +101,7 @@
|
||||
this.txtConfirmPassword.Name = "txtConfirmPassword";
|
||||
this.txtConfirmPassword.PasswordChar = '/';
|
||||
this.txtConfirmPassword.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtConfirmPassword.TabIndex = 9;
|
||||
this.txtConfirmPassword.TabIndex = 2;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
@@ -108,35 +109,46 @@
|
||||
this.label4.Location = new System.Drawing.Point(7, 90);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(91, 13);
|
||||
this.label4.TabIndex = 10;
|
||||
this.label4.TabIndex = 9;
|
||||
this.label4.Text = "Confirm Password";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(220, 116);
|
||||
this.button2.Location = new System.Drawing.Point(211, 116);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(46, 23);
|
||||
this.button2.TabIndex = 12;
|
||||
this.button2.Size = new System.Drawing.Size(55, 23);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "Ca&ncel";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// btnCreateUSer
|
||||
//
|
||||
this.btnCreateUSer.Location = new System.Drawing.Point(104, 116);
|
||||
this.btnCreateUSer.Location = new System.Drawing.Point(84, 116);
|
||||
this.btnCreateUSer.Name = "btnCreateUSer";
|
||||
this.btnCreateUSer.Size = new System.Drawing.Size(110, 23);
|
||||
this.btnCreateUSer.TabIndex = 11;
|
||||
this.btnCreateUSer.Size = new System.Drawing.Size(121, 23);
|
||||
this.btnCreateUSer.TabIndex = 4;
|
||||
this.btnCreateUSer.Text = "&Change Password";
|
||||
this.btnCreateUSer.UseVisualStyleBackColor = true;
|
||||
this.btnCreateUSer.Click += new System.EventHandler(this.btnCreateUSer_Click);
|
||||
//
|
||||
// btnMsr
|
||||
//
|
||||
this.btnMsr.Location = new System.Drawing.Point(12, 116);
|
||||
this.btnMsr.Name = "btnMsr";
|
||||
this.btnMsr.Size = new System.Drawing.Size(66, 23);
|
||||
this.btnMsr.TabIndex = 3;
|
||||
this.btnMsr.Text = "Msr";
|
||||
this.btnMsr.UseVisualStyleBackColor = true;
|
||||
this.btnMsr.Click += new System.EventHandler(this.btnMsr_Click);
|
||||
//
|
||||
// ChangePassword
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(287, 185);
|
||||
this.Controls.Add(this.btnMsr);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.btnCreateUSer);
|
||||
this.Controls.Add(this.txtConfirmPassword);
|
||||
@@ -169,5 +181,6 @@
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Button btnCreateUSer;
|
||||
private System.Windows.Forms.Button btnMsr;
|
||||
}
|
||||
}
|
||||
@@ -71,10 +71,37 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
userEntity.Name = txtUsername.Text.Trim();
|
||||
userEntity.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
|
||||
|
||||
if (UserBI.ValidateUser(userEntity.Name, userEntity.Password))
|
||||
if (UserBI.ValidateUser(userEntity.Name, userEntity.Password) != null)
|
||||
return UserBI.ChangePassword(userEntity, Tanshu.Common.Md5.Hash(txtnewPassword.Text.Trim(), "v2"));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private void btnMsr_Click(object sender, EventArgs e)
|
||||
{
|
||||
User user = new User();
|
||||
user.Name = txtUsername.Text.Trim();
|
||||
user.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
|
||||
|
||||
if (UserBI.ValidateUser(user.Name, user.Password) == null)
|
||||
return;
|
||||
using (var frm = new MsrLoginForm(true))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
string userName;
|
||||
frm.UserName(out userName);
|
||||
if (userName != null || userName != string.Empty)
|
||||
{
|
||||
if (MessageBox.Show("Update Msr Card", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
user = UserBI.GetUserFromName(user.Name);
|
||||
user.MsrString = userName;
|
||||
UserBI.Update(user);
|
||||
MessageBox.Show("Msr Card Updated");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace Tanshu.Accounts.Print
|
||||
{
|
||||
private const string DrawLine = "\n\r------------------------------------------";
|
||||
private const string DrawEqual = "\n\r==========================================";
|
||||
private static string DesignKot(SaleVoucher trans, List<BillInventory> billItems, int copyNumber)
|
||||
private static string DesignKot(Voucher trans, string kotCode, List<Inventory> billItems, int copyNumber)
|
||||
{
|
||||
Waiter waiter = trans.Waiter;
|
||||
string BillText;
|
||||
@@ -31,20 +31,16 @@ namespace Tanshu.Accounts.Print
|
||||
BillText = "\n\r" + FormatText("KOT / BOT", 42, false, Align.Centre);
|
||||
BillText += "\n\r" + FormatText(string.Format("Copy No. {0}", copyNumber), 42, false, Align.Centre);
|
||||
BillText += DrawLine;
|
||||
BillText += string.Format("\n\rKOT ID : {0,-13} {1:dd-MMM-yyyy HH:mm}", trans.KotID, trans.Date);
|
||||
BillText += string.Format("\n\rKOT ID : {0,-7}/{1,-7} {2:dd-MMM-yyyy HH:mm}", trans.KotID, kotCode, trans.Date);
|
||||
BillText += string.Format("\n\rTable No.: {0} / {1}", trans.TableID, waiter.Name);
|
||||
BillText += DrawLine;
|
||||
BillText += "\n\r Qty. x Name ";
|
||||
BillText += DrawLine;
|
||||
foreach (BillInventory item in billItems)
|
||||
foreach (var item in billItems)
|
||||
{
|
||||
Decimal additional = item.Quantity - item.Printed;
|
||||
if (additional != 0)
|
||||
{
|
||||
BillText += string.Format("\n\r{0,6} x {1,-33}", additional, item.Name);
|
||||
foreach (var mod in item.Modifiers)
|
||||
BillText += string.Format("\n\r --- {0,-32}", mod.Name);
|
||||
}
|
||||
BillText += string.Format("\n\r{0,6:#,##0.00} x {1,-33}", item.Quantity, Name(item.Product));
|
||||
foreach (var mod in item.InventoryModifier)
|
||||
BillText += string.Format("\n\r --- {0,-32}", mod.Modifier.Name);
|
||||
}
|
||||
BillText += DrawLine;
|
||||
if (trans.Narration != "")
|
||||
@@ -59,8 +55,19 @@ namespace Tanshu.Accounts.Print
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
private static string DesignBill(SaleVoucher trans, List<BillInventory> billItems)
|
||||
private static string DesignBill(Voucher trans)
|
||||
{
|
||||
Dictionary<int, Inventory> list = new Dictionary<int, Inventory>();
|
||||
foreach (var kot in trans.Kots)
|
||||
{
|
||||
foreach (var item in kot.Inventories)
|
||||
{
|
||||
if (list.ContainsKey(item.Product.ProductID))
|
||||
list[item.Product.ProductID].Quantity += item.Quantity;
|
||||
else
|
||||
list.Add(item.Product.ProductID, item);
|
||||
}
|
||||
}
|
||||
User cashier = trans.User;
|
||||
Waiter waiter = trans.Waiter;
|
||||
Customer customer = trans.Customer;
|
||||
@@ -78,35 +85,47 @@ namespace Tanshu.Accounts.Print
|
||||
BillText += "\n\r" + "------------------------------------------";
|
||||
BillText += "\n\r" + "Qty. Particulars Price Amount";
|
||||
BillText += "\n\r" + "------------------------------------------";
|
||||
foreach (BillInventory item in billItems)
|
||||
foreach (var item in list.Values)
|
||||
{
|
||||
if (Math.Round((item.Price * (1 + item.Tax)), 0) == 1)
|
||||
if (item.Quantity == 0)
|
||||
continue;
|
||||
if (Math.Round((item.Rate * (1 + item.Tax)), 0) == 1)
|
||||
{
|
||||
BillText += "\n\r" + " ";
|
||||
BillText += FormatText(item.Name, 22, false, Align.Left) + " ";
|
||||
BillText += FormatText(Name(item.Product), 22, false, Align.Left) + " ";
|
||||
BillText += " ";
|
||||
BillText += FormatBillNum(item.Price * item.Quantity, 6);
|
||||
BillText += FormatBillNum(item.Rate * item.Quantity, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
BillText += "\n\r" + FormatBillNum(item.Quantity, 5) + " ";
|
||||
BillText += FormatText(item.Name, 22, false, Align.Left) + " ";
|
||||
BillText += FormatBillNum(item.Price, 6) + " ";
|
||||
BillText += FormatBillNum(item.Price * item.Quantity, 6);
|
||||
BillText += FormatText(Name(item.Product), 22, false, Align.Left) + " ";
|
||||
BillText += FormatBillNum(item.Rate, 6) + " ";
|
||||
BillText += FormatBillNum(item.Rate * item.Quantity, 6);
|
||||
}
|
||||
}
|
||||
BillText += "\n\r" + "------------------------------------------";
|
||||
if (billItems.Sum(b => b.DiscountAmount) != 0)
|
||||
{
|
||||
BillText += "\n\r" + FormatText("Discount : ", 33, false, Align.Right) + FormatBillNum(billItems.Sum(b => b.DiscountAmount), 9);
|
||||
}
|
||||
BillText += "\n\r" + FormatText("Service Charge : ", 33, false, Align.Right) + FormatBillNum(billItems.Sum(b => b.ServiceChargeAmount), 9);
|
||||
if (billItems.Sum(b => b.TaxAmount) != 0)
|
||||
{
|
||||
BillText += "\n\r" + FormatText("VAT (incl. surcharge) : ", 33, false, Align.Right) + FormatBillNum(billItems.Sum(b => b.TaxAmount), 9);
|
||||
}
|
||||
decimal amount;
|
||||
amount = Net(trans);
|
||||
if (amount != 0)
|
||||
BillText += "\n\r" + FormatText("Net : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
|
||||
|
||||
amount = Discount(trans);
|
||||
if (amount != 0)
|
||||
BillText += "\n\r" + FormatText("Discount : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
|
||||
|
||||
amount = ServiceCharge(trans);
|
||||
if (amount != 0)
|
||||
BillText += "\n\r" + FormatText("Service Charge : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
|
||||
|
||||
amount = Tax(trans);
|
||||
if (amount != 0)
|
||||
BillText += "\n\r" + FormatText("VAT (incl. surcharge) : ", 33, false, Align.Right) + FormatBillNum(amount, 9);
|
||||
|
||||
amount = Amount(trans);
|
||||
if (amount != 0)
|
||||
BillText += string.Format("\n\r Final Amount : {0,9:#,##0.00;(#,##0.00);0}", Math.Round(amount, 0));
|
||||
|
||||
BillText += string.Format("\n\r Final Amount : {0,9:#,##0.00;(#,##0.00);0}", Math.Round(billItems.Sum(b => b.Value), 0));
|
||||
BillText += DrawLine;
|
||||
if (trans.Narration != "")
|
||||
{
|
||||
@@ -123,7 +142,73 @@ namespace Tanshu.Accounts.Print
|
||||
BillText += "\n\r" + "Call: 0172-4026666, 8054923853, 8054923856";
|
||||
return BillText;
|
||||
}
|
||||
|
||||
private static decimal Amount(Voucher voucher)
|
||||
{
|
||||
decimal amount = 0;
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
amount += inv.Quantity * inv.Rate * (1 - inv.Discount) * (1 + inv.ServiceCharge) * (1 + inv.Tax);
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
private static decimal Tax(Voucher voucher)
|
||||
{
|
||||
decimal amount = 0;
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
amount += inv.Quantity * inv.Rate * (1 - inv.Discount) * (1 + inv.ServiceCharge) * inv.Tax;
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
private static decimal ServiceCharge(Voucher voucher)
|
||||
{
|
||||
decimal amount = 0;
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
amount += inv.Quantity * inv.Rate * (1 - inv.Discount) * inv.ServiceCharge;
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
private static decimal Discount(Voucher voucher)
|
||||
{
|
||||
decimal amount = 0;
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
amount += inv.Quantity * inv.Rate * inv.Discount;
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
private static decimal Net(Voucher voucher)
|
||||
{
|
||||
decimal amount = 0;
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
amount += inv.Quantity * inv.Rate;
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
private static string Name(Product product)
|
||||
{
|
||||
if (product.Units == null || product.Units == string.Empty)
|
||||
return product.Name;
|
||||
else
|
||||
return string.Format("{0} ({1})", product.Name, product.Units);
|
||||
}
|
||||
private static string FormatText(string inputString, int width, Boolean multiline, Align alignment)
|
||||
{
|
||||
if ((multiline) && (inputString.Length > width))
|
||||
@@ -245,7 +330,7 @@ namespace Tanshu.Accounts.Print
|
||||
printText += DrawLine;
|
||||
foreach (var item in list)
|
||||
{
|
||||
printText += string.Format("\n\r{0,-22} {1,9:#,##0.00} {1,9:#,##0.00}", item.Product, item.Sale, item.NC);
|
||||
printText += string.Format("\n\r{0,-22} {1,9:#,##0.00} {2,9:#,##0.00}", item.Product, item.Sale, item.NC);
|
||||
}
|
||||
printText += DrawEqual;
|
||||
return PrintRAW(PrintLocationBI.BasePrinter, printText, "Sale Detail " + user);
|
||||
@@ -369,33 +454,29 @@ namespace Tanshu.Accounts.Print
|
||||
return FormatText(InputString, 24, false, Align.Right);
|
||||
}
|
||||
|
||||
public static void PrintBill(int voucherID, List<BillInventory> list)
|
||||
public static void PrintBill(int voucherID)
|
||||
{
|
||||
SaleVoucher trans = new SaleVoucher();
|
||||
IList<Inventory> iList = new List<Inventory>();
|
||||
SaleVoucherBI.GetSaleVoucher(voucherID, out trans, out iList);
|
||||
PrintRAW(PrintLocationBI.BasePrinter, DesignBill(trans, list), "Bill");
|
||||
var voucher = VoucherBI.GetSaleVoucher(voucherID);
|
||||
PrintRAW(PrintLocationBI.BasePrinter, DesignBill(voucher), "Bill");
|
||||
}
|
||||
|
||||
public static void PrintKot(int voucherID, List<BillInventory> list)
|
||||
public static void PrintKot(int voucherID, int kotID)
|
||||
{
|
||||
SaleVoucher trans = new SaleVoucher();
|
||||
IList<Inventory> iList = new List<Inventory>();
|
||||
SaleVoucherBI.GetSaleVoucher(voucherID, out trans, out iList);
|
||||
Dictionary<PrintLocation, List<BillInventory>> dict = new Dictionary<PrintLocation, List<BillInventory>>();
|
||||
var voucher = VoucherBI.GetSaleVoucher(voucherID);
|
||||
Dictionary<PrintLocation, List<Inventory>> dict = new Dictionary<PrintLocation, List<Inventory>>();
|
||||
//Dictionary<string, int> dictCount = new Dictionary<string, int>();
|
||||
foreach (var item in list)
|
||||
foreach (var item in voucher.Kots.Where(x => x.KotID == kotID))
|
||||
{
|
||||
if (item.Printed != item.Quantity)
|
||||
foreach (var inventory in item.Inventories)
|
||||
{
|
||||
int type = ProductBI.GetProduct(item.ProductID).ProductGroup.ProductGroupID;
|
||||
int type = ProductBI.GetProduct(inventory.Product.ProductID).ProductGroup.ProductGroupID;
|
||||
var printer = PrintLocationBI.KotPrinter(type);
|
||||
if (!dict.ContainsKey(printer))
|
||||
{
|
||||
dict.Add(printer, new List<BillInventory>());
|
||||
dict.Add(printer, new List<Inventory>());
|
||||
//dictCount.Add(printer.Printer, 0);
|
||||
}
|
||||
dict[printer].Add(item);
|
||||
dict[printer].Add(inventory);
|
||||
//dictCount[printer.Printer] = printer.Copies;
|
||||
}
|
||||
}
|
||||
@@ -403,7 +484,7 @@ namespace Tanshu.Accounts.Print
|
||||
{
|
||||
for (int i = 0; i < item.Key.Copies; i++)
|
||||
{
|
||||
PrintRAW(item.Key, DesignKot(trans, item.Value, i), "KOT");
|
||||
PrintRAW(item.Key, DesignKot(voucher, voucher.Kots.Where(x => x.KotID == kotID).Single().Code, item.Value, i), "KOT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,12 +151,12 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Pending Bills ------------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false &&
|
||||
i.Settled == SettleOptionFactory.OUnsettled
|
||||
i.Settled == SettleOption.Unsettled
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
@@ -169,12 +169,12 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- No Charge ----------------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false &&
|
||||
i.Settled == SettleOptionFactory.ONoCharge
|
||||
i.Settled == SettleOption.NoCharge
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
@@ -187,12 +187,12 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Bill To Company ----------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false &&
|
||||
i.Settled == SettleOptionFactory.OBillToCompany
|
||||
i.Settled == SettleOption.BillToCompany
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
@@ -205,12 +205,12 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Staff Bills --------------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false &&
|
||||
i.Settled == SettleOptionFactory.OStaff
|
||||
i.Settled == SettleOption.Staff
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
@@ -223,12 +223,12 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Credit Card Bills --------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false &&
|
||||
i.Settled == SettleOptionFactory.OCreditCard
|
||||
i.Settled == SettleOption.CreditCard
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
@@ -241,7 +241,7 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Void Bills ---------------------------";
|
||||
var list = (from i in session.QueryOver<SaleVoucher>()
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
@@ -259,18 +259,19 @@ namespace Tanshu.Accounts.Repository
|
||||
decimal discount;
|
||||
info = "\n\r--- High Discount Bills ------------------";
|
||||
string query = @"
|
||||
select distinct(v) from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
select distinct(v) from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and v.Void = false and v.Settled != :unSettled and v.Settled != :noCharge
|
||||
and i.Discount >= :discount";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("startDate", StartDate)
|
||||
.SetParameter("finishDate", FinishDate)
|
||||
.SetParameter("cashierID", Cashier.UserID)
|
||||
.SetParameter("unSettled", SettleOptionFactory.Unsettled)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("unSettled", SettleOption.Unsettled)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.SetParameter("discount", disount)
|
||||
.List<SaleVoucher>();
|
||||
.List<Voucher>();
|
||||
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return discount;
|
||||
@@ -283,21 +284,22 @@ and i.Discount >= :discount";
|
||||
{
|
||||
decimal amount = 0;
|
||||
string query = @"
|
||||
select sum(i.Amount) from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
select sum(i.Amount) from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and v.Void = false and v.Settled != :unSettled and v.Settled != :noCharge";
|
||||
amount = session.CreateQuery(query)
|
||||
.SetParameter("startDate", StartDate)
|
||||
.SetParameter("finishDate", FinishDate)
|
||||
.SetParameter("cashierID", Cashier.UserID)
|
||||
.SetParameter("unSettled", SettleOptionFactory.Unsettled)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("unSettled", SettleOption.Unsettled)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.UniqueResult<decimal>();
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
private void GetInfo(IList<SaleVoucher> list, out decimal amount, out decimal discount, ref string info)
|
||||
private void GetInfo(IList<Voucher> list, out decimal amount, out decimal discount, ref string info)
|
||||
{
|
||||
amount = 0;
|
||||
discount = 0;
|
||||
@@ -306,12 +308,11 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and
|
||||
info = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
decimal amt, disc;
|
||||
amt = item.Inventories.Sum(x => x.Amount);
|
||||
disc = item.Inventories.Sum(x => x.Quantity * x.Rate * x.Discount);
|
||||
amt = item.Kots.Sum(x => x.Inventories.Sum(y => y.Amount));
|
||||
disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Rate * y.Discount));
|
||||
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
|
||||
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
|
||||
info += "\n\r------------------------------------------";
|
||||
@@ -326,7 +327,7 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = @"
|
||||
select distinct(u.Name) from SaleVoucher v
|
||||
select distinct(u.Name) from Voucher v
|
||||
inner join v.User u
|
||||
where v.Date >= :startDate and v.Date <= :finishDate";
|
||||
var list = session.CreateQuery(query)
|
||||
|
||||
@@ -7,15 +7,34 @@ using Tanshu.Data.DAO;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using NHibernate;
|
||||
using NHibernate.Criterion;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class FoodTableBI
|
||||
public class FoodTableBI : IDisposable
|
||||
{
|
||||
ISession session;
|
||||
bool disposeSession;
|
||||
bool useTransaction;
|
||||
|
||||
public FoodTableBI()
|
||||
{
|
||||
this.session = SessionManager.Session;
|
||||
disposeSession = true;
|
||||
this.useTransaction = false;
|
||||
}
|
||||
|
||||
public FoodTableBI(ISession session)
|
||||
{
|
||||
this.session = session;
|
||||
disposeSession = false;
|
||||
this.useTransaction = false;
|
||||
}
|
||||
public FoodTableBI(ISession session, bool useTransaction)
|
||||
{
|
||||
this.session = session;
|
||||
disposeSession = false;
|
||||
this.useTransaction = useTransaction;
|
||||
}
|
||||
|
||||
public void Insert(FoodTable foodTable)
|
||||
@@ -34,13 +53,75 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
return session.Get<FoodTable>(foodTableID);
|
||||
}
|
||||
public FoodTable GetByName(string name)
|
||||
{
|
||||
return session.CreateCriteria<FoodTable>()
|
||||
.Add(Restrictions.Eq("Name", name))
|
||||
.UniqueResult<FoodTable>();
|
||||
}
|
||||
public IList<FoodTable> List()
|
||||
{
|
||||
return session.CreateCriteria<FoodTable>().List<FoodTable>();
|
||||
}
|
||||
public void UpdateStatus(string name, int voucherID, string status)
|
||||
{
|
||||
if (!useTransaction)
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var table = session.CreateCriteria<FoodTable>()
|
||||
.Add(Restrictions.Eq("Name", name))
|
||||
.UniqueResult<FoodTable>();
|
||||
if (table == null)
|
||||
return;
|
||||
if (status == null || status == string.Empty)
|
||||
table.VoucherID = 0;
|
||||
else
|
||||
table.VoucherID = voucherID;
|
||||
table.Status = status;
|
||||
session.Update(table);
|
||||
trans.Commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
var table = session.CreateCriteria<FoodTable>()
|
||||
.Add(Restrictions.Eq("Name", name))
|
||||
.UniqueResult<FoodTable>();
|
||||
if (status == null || status == string.Empty)
|
||||
table.VoucherID = 0;
|
||||
else
|
||||
table.VoucherID = voucherID;
|
||||
table.Status = status;
|
||||
session.Update(table);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
session.Dispose();
|
||||
if (disposeSession)
|
||||
session.Dispose();
|
||||
}
|
||||
|
||||
public int Move(string name, FoodTable foodTable)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var oldTable = session.CreateCriteria<FoodTable>()
|
||||
.Add(Restrictions.Eq("Name", name))
|
||||
.UniqueResult<FoodTable>();
|
||||
foodTable.Status = oldTable.Status;
|
||||
foodTable.VoucherID = oldTable.VoucherID;
|
||||
oldTable.Status = null;
|
||||
oldTable.VoucherID = 0;
|
||||
session.Merge(foodTable);
|
||||
session.Update(oldTable);
|
||||
|
||||
var voucher = session.Get<Voucher>(foodTable.VoucherID);
|
||||
voucher.TableID = foodTable.Name;
|
||||
session.Update(voucher);
|
||||
trans.Commit();
|
||||
return voucher.VoucherID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,15 @@ namespace Tanshu.Accounts.Repository
|
||||
.List<ProductGroup>();
|
||||
}
|
||||
}
|
||||
public IList<string> GetProductGroupTypes()
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = @"select distinct(pg.GroupType) from ProductGroup pg order by pg.GroupType";
|
||||
var hnq = session.CreateQuery(query);
|
||||
return hnq.List<string>();
|
||||
}
|
||||
}
|
||||
public ProductGroup GetProductGroupOfProduct(int productID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Data.DAO;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using NHibernate.Criterion;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using NHibernate;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public static class SaleVoucherBI
|
||||
{
|
||||
static public BillInventory GetDefaultSaleBillItem(int productID)
|
||||
{
|
||||
Product product;
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
product = session.Get<Product>(productID);
|
||||
return new BillInventory()
|
||||
{
|
||||
ProductID = product.ProductID,
|
||||
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")",
|
||||
Price = product.SalePrice,
|
||||
Tax = product.Tax.Rate,
|
||||
ServiceCharge = product.ServiceCharge,
|
||||
Discount = 0,
|
||||
Printed = 0,
|
||||
Quantity = 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
static public decimal GetProductDiscountLimit(int productID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<Product>(productID).ProductGroup.DiscountLimit;
|
||||
}
|
||||
}
|
||||
static public bool IsBillPrinted(int voucherID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<SaleVoucher>(voucherID).Printed;
|
||||
}
|
||||
}
|
||||
static public bool Insert(SaleVoucher saleVoucher, IList<Inventory> inventory)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
DateTime dt = DbValues.Date;
|
||||
saleVoucher.CreationDate = dt;
|
||||
saleVoucher.LastEditDate = dt;
|
||||
saleVoucher.Date = dt;
|
||||
saleVoucher.KotID = DbValues.KotID;
|
||||
if (saleVoucher.Printed)
|
||||
saleVoucher.BillID = DbValues.BillID;
|
||||
else
|
||||
saleVoucher.BillID = saleVoucher.KotID;
|
||||
session.Save(saleVoucher);
|
||||
foreach (var item in inventory)
|
||||
{
|
||||
item.Voucher = saleVoucher;
|
||||
IList<Modifier> list = new List<Modifier>();
|
||||
foreach (var mod in item.InventoryModifier)
|
||||
list.Add(mod.Modifier);
|
||||
item.InventoryModifier = new List<InventoryModifier>();
|
||||
session.Save(item);
|
||||
foreach (var mod in list)
|
||||
session.Save(new InventoryModifier() { Inventory = item, Modifier = mod });
|
||||
}
|
||||
trans.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
static public bool Update(SaleVoucher saleVoucher, IList<Inventory> inventory)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
DateTime dt = DbValues.Date;
|
||||
saleVoucher.LastEditDate = dt;
|
||||
saleVoucher.Inventories = inventory;
|
||||
if (saleVoucher.Date == null)
|
||||
{
|
||||
saleVoucher.Date = dt;
|
||||
saleVoucher.BillID = DbValues.BillID;
|
||||
}
|
||||
if (!saleVoucher.Printed)
|
||||
saleVoucher.Date = dt;
|
||||
foreach (var item in inventory)
|
||||
{
|
||||
item.Voucher = saleVoucher;
|
||||
IList<Modifier> list = new List<Modifier>();
|
||||
foreach (var mod in item.InventoryModifier)
|
||||
list.Add(mod.Modifier);
|
||||
item.InventoryModifier = new List<InventoryModifier>();
|
||||
session.Save(item);
|
||||
foreach (var mod in list)
|
||||
session.Save(new InventoryModifier() { Inventory = item, Modifier = mod });
|
||||
|
||||
}
|
||||
session.Merge(saleVoucher);
|
||||
|
||||
trans.Commit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
static public bool GetSaleVoucher(int voucherID, out SaleVoucher saleVoucher, out IList<Inventory> iList)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
saleVoucher = session.Get<SaleVoucher>(voucherID);
|
||||
foreach (var item in saleVoucher.Inventories)
|
||||
{
|
||||
NHibernateUtil.Initialize(item);
|
||||
foreach (var inmod in item.InventoryModifier)
|
||||
NHibernateUtil.Initialize(inmod.Modifier);
|
||||
}
|
||||
iList = saleVoucher.Inventories;
|
||||
NHibernateUtil.Initialize(saleVoucher.Customer);
|
||||
NHibernateUtil.Initialize(saleVoucher.Waiter);
|
||||
NHibernateUtil.Initialize(saleVoucher.User);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//public List<PendingBillsBO> GetPendingBills(PendingType list)
|
||||
//{
|
||||
// GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
||||
// using (IConnectionDAO connection = factory.Connection)
|
||||
// {
|
||||
// using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection))
|
||||
// {
|
||||
// return dao.GetPendingBills(list);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
static public SaleVoucher GetPendingVoucherID(string tableID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return (from v in session.QueryOver<SaleVoucher>()
|
||||
where v.Void == false && v.TableID == tableID && v.Settled.SettleOptionID == SettleOptionFactory.Unsettled
|
||||
select v).SingleOrDefault();
|
||||
}
|
||||
}
|
||||
static public string GetTableStatus(string tableID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var s = (from v in session.QueryOver<SaleVoucher>()
|
||||
where v.Void == false && v.TableID == tableID && v.Settled.SettleOptionID == SettleOptionFactory.Unsettled
|
||||
select v).SingleOrDefault();
|
||||
if (s == null)
|
||||
return "default";
|
||||
else if (s.Printed == true)
|
||||
return "printed";
|
||||
else
|
||||
return "running";
|
||||
}
|
||||
}
|
||||
//public List<InventoryBO> SaleInventory(Dictionary<BillItemKey, BillInventoryBO>.ValueCollection list, Guid? voucherID)
|
||||
//{
|
||||
// GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
||||
// using (IConnectionDAO connection = factory.Connection)
|
||||
// {
|
||||
// using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection))
|
||||
// {
|
||||
// return dao.SaleInventory(list, voucherID);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//public void GetComplexBillInformation(Guid voucherID, Guid complexProductID, ref decimal rate, ref decimal quantity, ref string name)
|
||||
//{
|
||||
// GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
||||
// using (IConnectionDAO connection = factory.Connection)
|
||||
// {
|
||||
// using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection))
|
||||
// {
|
||||
// dao.GetComplexBillInformation(voucherID, complexProductID, ref rate, ref quantity, ref name);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//public void SetAlarm(Guid voucherID, DateTime? alarmTime)
|
||||
//{
|
||||
// GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
||||
// using (IConnectionDAO connection = factory.Connection)
|
||||
// {
|
||||
// using (ISaleVoucherDAO dao = factory.GetSaleVoucherDAO(connection))
|
||||
// {
|
||||
// dao.SetAlarm(voucherID, alarmTime);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
static public void VoidBill(int voucherID, string reason)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var saleVoucher = session.Get<SaleVoucher>(voucherID);
|
||||
saleVoucher.Void = true;
|
||||
saleVoucher.VoidReason = reason;
|
||||
session.Save(saleVoucher);
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public void SettleVoucher(User user, int voucherID, int settleOption)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var saleVoucher = session.Get<SaleVoucher>(voucherID);
|
||||
saleVoucher.Settled = SettleOptionBI.GetSettleOption(settleOption);
|
||||
saleVoucher.User = user;
|
||||
saleVoucher.LastEditDate = DbValues.Date;
|
||||
session.Merge(saleVoucher);
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,9 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
var query = @"
|
||||
select concat(p.Name, ' ', p.Units) as Product, Sum(i.Quantity) as Amount
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
inner join i.Product p
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge
|
||||
group by concat(p.Name, ' ', p.Units), p.ProductGroup
|
||||
@@ -36,7 +37,7 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.List<object[]>();
|
||||
var outList = new OrderedDictionary<string, SalesAnalysisDetail>();
|
||||
foreach (var item in list)
|
||||
@@ -44,8 +45,9 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
|
||||
|
||||
query = @"
|
||||
select concat(p.Name, ' ', p.Units) as Product, Sum(i.Quantity) as Amount
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
inner join i.Product p
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled = :noCharge
|
||||
group by concat(p.Name, ' ', p.Units), p.ProductGroup
|
||||
@@ -55,7 +57,7 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.List<object[]>();
|
||||
foreach (var item in list)
|
||||
if (outList.ContainsKey((string)item[0]))
|
||||
@@ -76,11 +78,12 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
|
||||
{
|
||||
var query = @"
|
||||
select g.GroupType as GroupType, Sum(i.Quantity * i.Rate * (1 - i.Discount)) as Amount
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
inner join i.Product p
|
||||
inner join p.ProductGroup g
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge and v.Settled != :unsettled
|
||||
group by g.GroupType
|
||||
order by g.GroupType
|
||||
";
|
||||
@@ -88,11 +91,17 @@ order by g.GroupType
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.SetParameter("unsettled", SettleOption.Unsettled)
|
||||
.List<object[]>();
|
||||
var outList = new List<SalesAnalysis>();
|
||||
decimal amount = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
amount += (decimal)item[1];
|
||||
outList.Add(new SalesAnalysis() { GroupType = (string)item[0], Amount = (decimal)item[1] });
|
||||
}
|
||||
outList.Add(new SalesAnalysis() { GroupType = "Total Settled", Amount = amount });
|
||||
return GetSettlement(outList, startDate, finishDate);
|
||||
}
|
||||
}
|
||||
@@ -103,23 +112,29 @@ order by g.GroupType
|
||||
return new List<SalesAnalysis>();
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
//select v.Settled, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
|
||||
var query = @"
|
||||
select s.Name, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
inner join v.Settled s
|
||||
select v.Settled, Sum(i.Amount)
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge
|
||||
group by s.Name
|
||||
order by s.Name
|
||||
group by v.Settled
|
||||
order by v.Settled
|
||||
";
|
||||
var list = session
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.List<object[]>();
|
||||
decimal amount = 0;
|
||||
foreach (var item in list)
|
||||
outList.Add(new SalesAnalysis() { GroupType = (string)item[0], Amount = (decimal)item[1] });
|
||||
{
|
||||
amount += (decimal)item[1];
|
||||
outList.Add(new SalesAnalysis() { GroupType = ((SettleOption)item[0]).ToString(), Amount = (decimal)item[1] });
|
||||
}
|
||||
outList.Add(new SalesAnalysis() { GroupType = "Total", Amount = amount });
|
||||
return GetOtherDetails(outList, startDate, finishDate);
|
||||
}
|
||||
}
|
||||
@@ -133,31 +148,37 @@ order by s.Name
|
||||
#region Service Charge
|
||||
var query = @"
|
||||
select Sum(i.Quantity * i.Rate * (1 - i.Discount) * i.ServiceCharge)
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge and v.Settled != :unsettled
|
||||
";
|
||||
var amt = session
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.SetParameter("unsettled", SettleOption.Unsettled)
|
||||
.UniqueResult();
|
||||
if (amt == null)
|
||||
amt = 0M;
|
||||
outList.Add(new SalesAnalysis() { GroupType = "Service Charge", Amount = (decimal)amt });
|
||||
#endregion
|
||||
#region Tax
|
||||
query = @"
|
||||
select i.Tax, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
|
||||
from SaleVoucher v
|
||||
inner join v.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge and v.Settled != :unsettled
|
||||
group by i.Tax
|
||||
";
|
||||
var list = session
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.SetParameter("unsettled", SettleOption.Unsettled)
|
||||
.List<object[]>();
|
||||
foreach (var item in list)
|
||||
outList.Add(new SalesAnalysis() { GroupType = string.Format("Tax {0:P}", (decimal)item[0]), Amount = (decimal)item[1] });
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Data.SqlClient;
|
||||
using Tanshu.Data.DAO;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using NHibernate.Criterion;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public static class SettleOptionBI
|
||||
{
|
||||
public static SettleOption GetSettleOption(int settleOptionID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<SettleOption>(settleOptionID);
|
||||
}
|
||||
}
|
||||
public static IList<SettleOption> GetSettleOptions()
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.CreateCriteria<SettleOption>().List<SettleOption>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Data.SqlClient;
|
||||
using Tanshu.Data.DAO;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using NHibernate.Criterion;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public static class TaxBI
|
||||
{
|
||||
public static void Insert(Tax tax)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
session.Save(tax);
|
||||
}
|
||||
}
|
||||
public static void Update(Tax tax)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
session.Update(tax);
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void Delete(int taxID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
session.Delete(new Tax() { TaxID = taxID });
|
||||
}
|
||||
}
|
||||
|
||||
public static Tax GetTax(int taxID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<Tax>(taxID);
|
||||
}
|
||||
}
|
||||
public static IList<Tax> GetTaxes()
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.CreateCriteria<Tax>()
|
||||
.List<Tax>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,11 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
session.Update(user);
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
session.Update(user);
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void Delete(int userID)
|
||||
@@ -100,15 +104,24 @@ namespace Tanshu.Accounts.Repository
|
||||
return (int)count > 0;
|
||||
}
|
||||
}
|
||||
public static bool ValidateUser(string name, string password)
|
||||
public static User ValidateUser(string name, string password)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var count = session.CreateCriteria<User>()
|
||||
return session.CreateCriteria<User>()
|
||||
.Add(Restrictions.Eq("Name", name))
|
||||
.Add(Restrictions.Eq("Password", password))
|
||||
.SetProjection(Projections.Count("UserID")).UniqueResult();
|
||||
return (int)count > 0;
|
||||
.UniqueResult<User>();
|
||||
}
|
||||
}
|
||||
public static User MsrValidateUser(string msrString)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var user = session.CreateCriteria<User>()
|
||||
.Add(Restrictions.Eq("MsrString", msrString))
|
||||
.UniqueResult<User>();
|
||||
return user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Data.DAO;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using NHibernate.Criterion;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using NHibernate;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public static class VoucherBI
|
||||
{
|
||||
static public BillInventory GetDefaultSaleBillItem(int productID)
|
||||
{
|
||||
Product product;
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
product = session.Get<Product>(productID);
|
||||
return new BillInventory()
|
||||
{
|
||||
ProductID = product.ProductID,
|
||||
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")",
|
||||
Price = product.SalePrice,
|
||||
Tax = product.Tax.Rate,
|
||||
ServiceCharge = product.ServiceCharge,
|
||||
Discount = 0,
|
||||
Printed = false,
|
||||
Quantity = 1,
|
||||
};
|
||||
}
|
||||
}
|
||||
static public decimal GetProductDiscountLimit(int productID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<Product>(productID).ProductGroup.DiscountLimit;
|
||||
}
|
||||
}
|
||||
static public bool IsBillPrinted(int voucherID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.Get<Voucher>(voucherID).Printed;
|
||||
}
|
||||
}
|
||||
static public int? Insert(Voucher saleVoucher)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
DateTime dt = DbValues.Date;
|
||||
saleVoucher.CreationDate = dt;
|
||||
saleVoucher.LastEditDate = dt;
|
||||
saleVoucher.Date = dt;
|
||||
saleVoucher.KotID = DbValues.KotID;
|
||||
if (saleVoucher.Printed)
|
||||
saleVoucher.BillID = DbValues.BillID;
|
||||
else
|
||||
saleVoucher.BillID = saleVoucher.KotID;
|
||||
Kot addedKot = null;
|
||||
foreach (var item in saleVoucher.Kots)
|
||||
{
|
||||
if (item.KotID != 0)
|
||||
continue;
|
||||
addedKot = item;
|
||||
item.Date = dt;
|
||||
item.Printed = true;
|
||||
item.TableID = saleVoucher.TableID;
|
||||
item.User = saleVoucher.User;
|
||||
item.Code = DbValues.KotCode;
|
||||
}
|
||||
session.Save(saleVoucher);
|
||||
using (var ft = new FoodTableBI(session, true))
|
||||
{
|
||||
string status;
|
||||
if (!saleVoucher.Printed)
|
||||
status = "running";
|
||||
else if (saleVoucher.Settled == SettleOption.Unsettled && saleVoucher.Void == false)
|
||||
status = "printed";
|
||||
else
|
||||
status = null;
|
||||
ft.UpdateStatus(saleVoucher.TableID, saleVoucher.VoucherID, status);
|
||||
}
|
||||
trans.Commit();
|
||||
if (addedKot == null)
|
||||
return null;
|
||||
else
|
||||
return addedKot.KotID;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void Delete(int voucherID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
session.Delete(session.Get<Voucher>(voucherID));
|
||||
using (var ft = new FoodTableBI(session, true))
|
||||
{
|
||||
var table = session.QueryOver<FoodTable>()
|
||||
.Where(x => x.VoucherID == voucherID)
|
||||
.SingleOrDefault();
|
||||
ft.UpdateStatus(table.Name, voucherID, null);
|
||||
}
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public int? Update(Voucher saleVoucher)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
DateTime dt = DbValues.Date;
|
||||
saleVoucher.LastEditDate = dt;
|
||||
if (saleVoucher.Date == null)
|
||||
{
|
||||
saleVoucher.Date = dt;
|
||||
saleVoucher.BillID = DbValues.BillID;
|
||||
}
|
||||
if (!saleVoucher.Printed)
|
||||
saleVoucher.Date = dt;
|
||||
Kot addedKot = null;
|
||||
foreach (var item in saleVoucher.Kots)
|
||||
{
|
||||
if (item.KotID != 0)
|
||||
continue;
|
||||
addedKot = item;
|
||||
item.Date = dt;
|
||||
item.Printed = true;
|
||||
item.TableID = saleVoucher.TableID;
|
||||
item.User = saleVoucher.User;
|
||||
item.Code = DbValues.KotCode;
|
||||
}
|
||||
session.Update(saleVoucher);
|
||||
using (var ft = new FoodTableBI(session, true))
|
||||
{
|
||||
string status;
|
||||
if (!saleVoucher.Printed)
|
||||
status = "running";
|
||||
else if (saleVoucher.Settled == SettleOption.Unsettled && saleVoucher.Void == false)
|
||||
status = "printed";
|
||||
else
|
||||
status = null;
|
||||
ft.UpdateStatus(saleVoucher.TableID, saleVoucher.VoucherID, status);
|
||||
}
|
||||
trans.Commit();
|
||||
if (addedKot == null)
|
||||
return null;
|
||||
else
|
||||
return addedKot.KotID;
|
||||
}
|
||||
}
|
||||
}
|
||||
static public Voucher GetSaleVoucher(int voucherID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var voucher = session.Get<Voucher>(voucherID);
|
||||
NHibernateUtil.Initialize(voucher.Customer);
|
||||
NHibernateUtil.Initialize(voucher.Waiter);
|
||||
NHibernateUtil.Initialize(voucher.User);
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
NHibernateUtil.Initialize(kot);
|
||||
foreach (var item in kot.Inventories)
|
||||
{
|
||||
NHibernateUtil.Initialize(item);
|
||||
NHibernateUtil.Initialize(item.Product);
|
||||
foreach (var inmod in item.InventoryModifier)
|
||||
NHibernateUtil.Initialize(inmod.Modifier);
|
||||
}
|
||||
}
|
||||
return voucher;
|
||||
}
|
||||
}
|
||||
|
||||
static public void VoidBill(int voucherID, string reason)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var saleVoucher = session.Get<Voucher>(voucherID);
|
||||
saleVoucher.Void = true;
|
||||
saleVoucher.VoidReason = reason;
|
||||
session.Save(saleVoucher);
|
||||
using (var ft = new FoodTableBI(session, true))
|
||||
{
|
||||
string status;
|
||||
if (!saleVoucher.Printed)
|
||||
status = "running";
|
||||
else if (saleVoucher.Settled == SettleOption.Unsettled && saleVoucher.Void == false)
|
||||
status = "printed";
|
||||
else
|
||||
status = null;
|
||||
ft.UpdateStatus(saleVoucher.TableID, saleVoucher.VoucherID, status);
|
||||
}
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public void SettleVoucher(User user, int voucherID, SettleOption settleOption)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var saleVoucher = session.Get<Voucher>(voucherID);
|
||||
saleVoucher.Settled = (SettleOption)settleOption;
|
||||
saleVoucher.User = user;
|
||||
saleVoucher.LastEditDate = DbValues.Date;
|
||||
session.Update(saleVoucher);
|
||||
var table = session.CreateCriteria<FoodTable>()
|
||||
.Add(Restrictions.Eq("Name", saleVoucher.TableID))
|
||||
.UniqueResult<FoodTable>();
|
||||
table.Status = null;
|
||||
session.Update(table);
|
||||
using (var ft = new FoodTableBI(session, true))
|
||||
{
|
||||
string status;
|
||||
if (!saleVoucher.Printed)
|
||||
status = "running";
|
||||
else if (saleVoucher.Settled == SettleOption.Unsettled && saleVoucher.Void == false)
|
||||
status = "printed";
|
||||
else
|
||||
status = null;
|
||||
ft.UpdateStatus(saleVoucher.TableID, saleVoucher.VoucherID, status);
|
||||
}
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int MoveKot(int kotID, FoodTable foodTable)
|
||||
{
|
||||
var session = SessionManager.Session;
|
||||
using (var trans = session.BeginTransaction())
|
||||
{
|
||||
var kot = session.Get<Kot>(kotID);
|
||||
foodTable = session.Get<FoodTable>(foodTable.FoodTableID);
|
||||
var voucher = session.Get<Voucher>(foodTable.VoucherID);
|
||||
voucher.Kots.Add(kot);
|
||||
session.Update(voucher);
|
||||
trans.Commit();
|
||||
return voucher.VoucherID;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,19 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = @"
|
||||
SELECT ISNULL('K-' + CAST(MAX(CAST(SUBSTRING(KotID, 3,8) AS int)) + 1 AS nvarchar(8)), 'K-1') FROM Entities_Vouchers
|
||||
WHERE discriminator = 'Tanshu.Accounts.Entities.SaleVoucher'";
|
||||
string query = @"SELECT ISNULL('K-' + CAST(MAX(CAST(SUBSTRING(KotID, 3,8) AS int)) + 1 AS nvarchar(8)), 'K-1') FROM Entities_Vouchers";
|
||||
var sqlQuery = session.CreateSQLQuery(query);
|
||||
return (string)sqlQuery.UniqueResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static string KotCode
|
||||
{
|
||||
get
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = @"SELECT ISNULL('S-' + CAST(MAX(CAST(SUBSTRING(Code, 3,8) AS int)) + 1 AS nvarchar(8)), 'S-1') FROM Entities_Kots";
|
||||
var sqlQuery = session.CreateSQLQuery(query);
|
||||
return (string)sqlQuery.UniqueResult();
|
||||
}
|
||||
@@ -37,7 +47,7 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
string query = @"
|
||||
DECLARE @BillID nvarchar(10)
|
||||
SELECT @BillID = ISNULL(CAST(MAX(CAST(REPLACE(BillID, '-', '') AS int)) + 1 AS nvarchar(9)), '010001') FROM Entities_Vouchers WHERE BillID LIKE '__-____' AND discriminator = 'Tanshu.Accounts.Entities.SaleVoucher'
|
||||
SELECT @BillID = ISNULL(CAST(MAX(CAST(REPLACE(BillID, '-', '') AS int)) + 1 AS nvarchar(9)), '010001') FROM Entities_Vouchers WHERE BillID LIKE '__-____'
|
||||
IF LEN(@BillID) = 5
|
||||
SET @BillID = '0' + @BillID
|
||||
SET @BillID = SUBSTRING(@BillID, 1, 2) + '-' + SUBSTRING(@BillID, 3, 7)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using System.Reflection;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
public static class AttributeChecker
|
||||
{
|
||||
public static bool Cascade(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(CascadeAttribute), false).Length == 1;
|
||||
}
|
||||
public static bool Unique(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(UniqueAttribute), false).Length == 1;
|
||||
}
|
||||
public static bool NotNull(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(NotNullAttribute), false).Length == 1;
|
||||
}
|
||||
public static bool Formula(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(FormulaAttribute), false).Length == 1;
|
||||
}
|
||||
public static string GetFormula(ICustomAttributeProvider provider)
|
||||
{
|
||||
var vv = (FormulaAttribute)provider.GetCustomAttributes(typeof(FormulaAttribute), false)[0];
|
||||
return vv.Formula;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
@@ -14,29 +17,18 @@ namespace Tanshu.Accounts.SqlDAO
|
||||
public void Apply(IManyToOneInstance instance)
|
||||
{
|
||||
var property = instance.Property;
|
||||
|
||||
if (!HasAttribute(property.MemberInfo)) return;
|
||||
|
||||
Console.WriteLine("CascadeAll on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
|
||||
if (!AttributeChecker.Cascade(property.MemberInfo)) return;
|
||||
Trace.TraceInformation("CascadeAll on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Cascade.All();
|
||||
}
|
||||
|
||||
public void Apply(IOneToManyCollectionInstance instance)
|
||||
{
|
||||
var property = instance.Member;
|
||||
|
||||
if (!HasAttribute(property)) return;
|
||||
|
||||
Console.WriteLine("CascadeAllDeleteOrphan on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
|
||||
if (!AttributeChecker.Cascade(property)) return;
|
||||
Trace.TraceInformation("CascadeAllDeleteOrphan on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Cascade.AllDeleteOrphan();
|
||||
}
|
||||
|
||||
bool HasAttribute(ICustomAttributeProvider provider)
|
||||
{
|
||||
return provider.GetCustomAttributes(typeof(CascadeAttribute), false).Length == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,25 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
public class ClassConvention : IClassConvention
|
||||
public class ClassConvention : IClassConvention, IClassConventionAcceptance
|
||||
{
|
||||
public void Apply(IClassInstance instance)
|
||||
{
|
||||
string table = Inflector.Pluralize(instance.EntityType.Name);
|
||||
table = instance.EntityType.Namespace.Substring(instance.EntityType.Namespace.LastIndexOf('.') + 1) + "_" + table;
|
||||
Trace.TraceInformation(string.Format("Table for {0}: {1}", instance.EntityType.Name, table));
|
||||
instance.Table(table);
|
||||
//instance.Cache.NonStrictReadWrite();
|
||||
}
|
||||
|
||||
public void Accept(IAcceptanceCriteria<IClassInspector> criteria)
|
||||
{
|
||||
criteria.Expect(x => !x.EntityType.IsEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using FluentNHibernate;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
@@ -16,39 +17,12 @@ namespace Tanshu.Accounts.Conventions
|
||||
|| (x.Property.PropertyType.IsGenericType &&
|
||||
x.Property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>) &&
|
||||
x.Property.PropertyType.GetGenericArguments()[0].IsEnum)));
|
||||
//criteria.Expect(x => x.Property.PropertyType.IsEnum);
|
||||
}
|
||||
|
||||
public void Apply(IPropertyInstance target)
|
||||
{
|
||||
Trace.TraceInformation(string.Format("Custom Enum for {0}.{1}", target.EntityType.Name, target.Property.Name));
|
||||
target.CustomType(target.Property.PropertyType);
|
||||
}
|
||||
}
|
||||
|
||||
//public class EnumConvention : IPropertyConvention, IPropertyConventionAcceptance
|
||||
//{
|
||||
// #region IPropertyConvention Members
|
||||
|
||||
// public void Apply(IPropertyInstance instance)
|
||||
// {
|
||||
// instance.CustomType(instance.Property.PropertyType);
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region IPropertyConventionAcceptance Members
|
||||
|
||||
// public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
||||
// {
|
||||
// criteria.Expect(x => x.Property.PropertyType.IsEnum ||
|
||||
// (x.Property.PropertyType.IsGenericType &&
|
||||
// x.Property.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>) &&
|
||||
// x.Property.PropertyType.GetGenericArguments()[0].IsEnum)
|
||||
// );
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,9 @@ using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Reflection;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System;
|
||||
using System.IO;
|
||||
using NHibernate.Cfg;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@@ -14,10 +17,7 @@ namespace Tanshu.Accounts.Repository
|
||||
public static bool CreateSchema()
|
||||
{
|
||||
var cfg = SessionManager.Configuration;
|
||||
new SchemaExport(cfg).Execute(true, true, true);
|
||||
new SchemaExport(cfg).Execute(true, true, false);
|
||||
// next line is just for checking how the nhibernate xml configuration files look
|
||||
//persistenceModel.WriteMappingsTo(@"C:\Temp");
|
||||
Recreate(cfg);
|
||||
Fixtures.InsertRole();
|
||||
Fixtures.InsertUser();
|
||||
Fixtures.InsertGroup();
|
||||
@@ -37,7 +37,26 @@ namespace Tanshu.Accounts.Repository
|
||||
InsertProductGroupModifier();
|
||||
return true;
|
||||
}
|
||||
private static void Recreate(Configuration cfg)
|
||||
{
|
||||
new SchemaExport(cfg).Execute(true, true, true);
|
||||
new SchemaExport(cfg).Execute(true, true, false);
|
||||
}
|
||||
private static void Update(Configuration cfg)
|
||||
{
|
||||
string path = @"C:\Users\tanshu\update.sql";
|
||||
Action<string> updateExport = x =>
|
||||
{
|
||||
using (var file = new FileStream(path, FileMode.Create, FileAccess.Write))
|
||||
using (var sw = new StreamWriter(file))
|
||||
{
|
||||
sw.Write(x);
|
||||
sw.Close();
|
||||
}
|
||||
};
|
||||
new SchemaUpdate(cfg).Execute(updateExport, true);
|
||||
|
||||
}
|
||||
#region role
|
||||
public static void InsertRole()
|
||||
{
|
||||
@@ -399,15 +418,15 @@ namespace Tanshu.Accounts.Repository
|
||||
#region settle_option
|
||||
public static void InsertSettleOption()
|
||||
{
|
||||
using (var session = SessionManager.StatelessSession)
|
||||
{
|
||||
session.Insert(SettleOptionFactory.OUnsettled);
|
||||
session.Insert(SettleOptionFactory.OCash);
|
||||
session.Insert(SettleOptionFactory.OCreditCard);
|
||||
session.Insert(SettleOptionFactory.ONoCharge);
|
||||
session.Insert(SettleOptionFactory.OBillToCompany);
|
||||
session.Insert(SettleOptionFactory.OStaff);
|
||||
}
|
||||
//using (var session = SessionManager.StatelessSession)
|
||||
//{
|
||||
// session.Insert(SettleOption.Unsettled);
|
||||
// session.Insert(SettleOption.Cash);
|
||||
// session.Insert(SettleOption.CreditCard);
|
||||
// session.Insert(SettleOption.NoCharge);
|
||||
// session.Insert(SettleOption.BillToCompany);
|
||||
// session.Insert(SettleOption.Staff);
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using FluentNHibernate.Conventions;
|
||||
using System.Reflection;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
public class FormulaConvention : IPropertyConvention, IPropertyConventionAcceptance
|
||||
{
|
||||
public void Apply(IPropertyInstance instance)
|
||||
{
|
||||
var property = instance.Property;
|
||||
Trace.TraceInformation("Formula on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Formula(AttributeChecker.GetFormula(property.MemberInfo));
|
||||
instance.Generated.Always();
|
||||
}
|
||||
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
||||
{
|
||||
criteria.Expect(x => AttributeChecker.Formula(x.Property.MemberInfo));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,28 @@
|
||||
//using System;
|
||||
//using FluentNHibernate.Conventions;
|
||||
//using System.Reflection;
|
||||
//using FluentNHibernate;
|
||||
//using FluentNHibernate.Conventions.Instances;
|
||||
//using FluentNHibernate.Conventions.Inspections;
|
||||
//using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
//using Tanshu.Accounts.Contracts;
|
||||
using System;
|
||||
using FluentNHibernate.Conventions;
|
||||
using System.Reflection;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Diagnostics;
|
||||
|
||||
//namespace Tanshu.Accounts.Conventions
|
||||
//{
|
||||
// public class NotNullConvention : IPropertyConvention
|
||||
// {
|
||||
// public void Apply(IPropertyInstance instance)
|
||||
// {
|
||||
// instance.Not.Nullable();
|
||||
// }
|
||||
// }
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
public class NotNullConvention : IPropertyConvention, IPropertyConventionAcceptance
|
||||
{
|
||||
public void Apply(IPropertyInstance instance)
|
||||
{
|
||||
var property = instance.Property;
|
||||
Trace.TraceInformation("Not Null on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Not.Nullable();
|
||||
}
|
||||
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
||||
{
|
||||
criteria.Expect(x => AttributeChecker.NotNull(x.Property.MemberInfo));
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
@@ -13,6 +14,7 @@ namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
public void Apply(IIdentityInstance instance)
|
||||
{
|
||||
Trace.TraceInformation("PK on {0}.{1}", instance.EntityType.Name, instance.EntityType.Name + "ID");
|
||||
instance.Column(instance.EntityType.Name + "ID");
|
||||
//instance.GeneratedBy.Assigned();
|
||||
//instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.None);
|
||||
@@ -20,8 +22,7 @@ namespace Tanshu.Accounts.Conventions
|
||||
|
||||
public void Accept(IAcceptanceCriteria<IIdentityInspector> criteria)
|
||||
{
|
||||
criteria.Expect(x => x.Name.EndsWith("ID"));
|
||||
criteria.Expect(x => x.Name == x.EntityType.Name + "ID");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentNHibernate.Conventions;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using NHibernate;
|
||||
using NHibernate.SqlCommand;
|
||||
using System.Diagnostics;
|
||||
using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.SqlDAO
|
||||
{
|
||||
public static class SettleOptionFactory
|
||||
{
|
||||
public static SettleOption OUnsettled = new SettleOption() { SettleOptionID = 1, Name = "Unsettled" };
|
||||
public static SettleOption OCash = new SettleOption() { SettleOptionID = 2, Name = "Cash" };
|
||||
public static SettleOption OCreditCard = new SettleOption() { SettleOptionID = 3, Name = "CreditCard" };
|
||||
public static SettleOption ONoCharge = new SettleOption() { SettleOptionID = 4, Name = "NoCharge" };
|
||||
public static SettleOption OBillToCompany = new SettleOption() { SettleOptionID = 5, Name = "BillToCompany" };
|
||||
public static SettleOption OStaff = new SettleOption() { SettleOptionID = 6, Name = "Staff" };
|
||||
|
||||
public static int Unsettled = 1;
|
||||
public static int Cash = 2;
|
||||
public static int CreditCard = 3;
|
||||
public static int NoCharge = 4;
|
||||
public static int BillToCompany = 5;
|
||||
public static int Staff = 6;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Tanshu.Accounts.Repository
|
||||
private readonly ISessionFactory factory;
|
||||
private SessionManager()
|
||||
{
|
||||
cfg = GetConfiguration();
|
||||
cfg = BuildConfiguration();
|
||||
factory = cfg.BuildSessionFactory();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,11 @@ namespace Tanshu.Accounts.Repository
|
||||
internal static readonly SessionManager sessionManager = new SessionManager();
|
||||
}
|
||||
|
||||
public Configuration GetConfiguration()
|
||||
private Configuration GetConfiguration()
|
||||
{
|
||||
return cfg;
|
||||
}
|
||||
private Configuration BuildConfiguration()
|
||||
{
|
||||
var storeConfiguration = new StoreConfiguration();
|
||||
var persistenceModel = AutoMap.AssemblyOf<Voucher>(storeConfiguration)
|
||||
@@ -51,10 +55,11 @@ namespace Tanshu.Accounts.Repository
|
||||
c.Add<CustomForeignKeyConvention>();
|
||||
c.Add<ClassConvention>();
|
||||
c.Add<CascadeConvention>();
|
||||
c.Add<UniqueConvention>();
|
||||
c.Add<NotNullConvention>();
|
||||
c.Add<FormulaConvention>();
|
||||
//c.Add<AllowNullConvention>();
|
||||
//c.Add<NotNullConvention>();
|
||||
//c.Add(DefaultLazy.Never());
|
||||
//c.Add<EnumConvention>();
|
||||
c.Add<EnumConvention>();
|
||||
});
|
||||
|
||||
return Fluently.Configure()
|
||||
@@ -63,11 +68,11 @@ namespace Tanshu.Accounts.Repository
|
||||
.BuildConfiguration()
|
||||
.SetInterceptor(new NHSQLInterceptor());
|
||||
}
|
||||
public ISession GetSession()
|
||||
private ISession GetSession()
|
||||
{
|
||||
return factory.OpenSession();
|
||||
}
|
||||
public IStatelessSession GetStatelessSession()
|
||||
private IStatelessSession GetStatelessSession()
|
||||
{
|
||||
return factory.OpenStatelessSession();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Automapping;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@@ -8,7 +10,10 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public override bool ShouldMap(Type type)
|
||||
{
|
||||
return type.Namespace.StartsWith("Tanshu.Accounts.Entities");
|
||||
bool val = type.Namespace.StartsWith("Tanshu.Accounts.Entities");
|
||||
if (type.IsEnum)
|
||||
val = false;
|
||||
return val;
|
||||
}
|
||||
public override bool IsId(Member member)
|
||||
{
|
||||
@@ -19,5 +24,16 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override string SimpleTypeCollectionValueColumn(Member member)
|
||||
{
|
||||
return base.SimpleTypeCollectionValueColumn(member);
|
||||
}
|
||||
public override bool ShouldMap(Member member)
|
||||
{
|
||||
//if (AttributeChecker.Formula(member.MemberInfo))
|
||||
// return false;
|
||||
//else
|
||||
return base.ShouldMap(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using FluentNHibernate.Conventions;
|
||||
using System.Reflection;
|
||||
using FluentNHibernate;
|
||||
using FluentNHibernate.Conventions.Instances;
|
||||
using FluentNHibernate.Conventions.Inspections;
|
||||
using FluentNHibernate.Conventions.AcceptanceCriteria;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Tanshu.Accounts.Conventions
|
||||
{
|
||||
public class UniqueConvention : IPropertyConvention, IPropertyConventionAcceptance
|
||||
{
|
||||
public void Apply(IPropertyInstance instance)
|
||||
{
|
||||
var property = instance.Property;
|
||||
Trace.TraceInformation("Unique on {0}.{1}", property.DeclaringType.Name, property.Name);
|
||||
instance.Unique();
|
||||
}
|
||||
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
|
||||
{
|
||||
criteria.Expect(x => AttributeChecker.Unique(x.Property.MemberInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,21 +81,19 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Tanshu.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Tanshu.Logging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Tanshu.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BusinessLayer\CheckoutBI.cs" />
|
||||
<Compile Include="BusinessLayer\SettleOptionBI.cs" />
|
||||
<Compile Include="BusinessLayer\TaxBI.cs" />
|
||||
<Compile Include="BusinessLayer\ManagementBI.cs" />
|
||||
<Compile Include="Fluent\AttributeChecker.cs" />
|
||||
<Compile Include="Fluent\CascadeConvention.cs" />
|
||||
<Compile Include="Fluent\FormulaConvention.cs" />
|
||||
<Compile Include="Fluent\UniqueConvention.cs" />
|
||||
<Compile Include="Fluent\NotNullConvention.cs" />
|
||||
<Compile Include="Lifetime\Session.cs" />
|
||||
<Compile Include="Ninject\SessionRepository.cs" />
|
||||
<Compile Include="Fluent\AllowNullConvention.cs" />
|
||||
<Compile Include="Fluent\SettleOptionFactory.cs" />
|
||||
<Compile Include="Fluent\EnumConvention.cs" />
|
||||
<Compile Include="Fluent\QueryStore.cs" />
|
||||
<Compile Include="Fluent\Fixtures.cs" />
|
||||
@@ -111,7 +109,7 @@
|
||||
<Compile Include="BusinessLayer\ProductGroupModifierBI.cs" />
|
||||
<Compile Include="BusinessLayer\RoleBI.cs" />
|
||||
<Compile Include="BusinessLayer\SalesAnalysisBI.cs" />
|
||||
<Compile Include="BusinessLayer\SaleVoucherBI.cs" />
|
||||
<Compile Include="BusinessLayer\VoucherBI.cs" />
|
||||
<Compile Include="BusinessLayer\UserBI.cs" />
|
||||
<Compile Include="BusinessLayer\WaiterBI.cs" />
|
||||
<Compile Include="Fluent\ClassConvention.cs" />
|
||||
|
||||
Reference in new issue
Block a user