From d4cfa9284800d80557f1c6b3ede742c1d0f24eef Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2011 17:33:22 +0530 Subject: [PATCH] User management fixed. Reports working now. Deployed --- Include/Tanshu.Common.dll | Bin 34816 -> 44032 bytes .../Attributes/PermissionAttribute.cs | 17 ++ .../Data Contracts Display/BillInventoryBO.cs | 7 +- .../Data Contracts Display/SalesAnalysisBO.cs | 12 +- .../Data Contracts/Auth/UserBO.cs | 4 +- .../Data Contracts/InventoryBO.cs | 70 +---- .../Data Contracts/ProductGroupBO.cs | 1 + Tanshu.Accounts.Contracts/RolesConstants.cs | 49 +++- .../Tanshu.Accounts.Contracts.csproj | 9 +- Tanshu.Accounts.Helpers/SelectCustomer.cs | 1 - Tanshu.Accounts.Helpers/SelectUser.cs | 1 - Tanshu.Accounts.PointOfSale/App.config | 4 +- .../Authentication/KeyboardLogin.cs | 4 +- .../Authentication/LoginForm.Designer.cs | 13 +- .../Authentication/LoginForm.cs | 16 +- .../Controllers/BillController.cs | 223 +++++++-------- .../CurrencyCounter.cs | 1 + Tanshu.Accounts.PointOfSale/MainForm.cs | 199 +++++-------- .../MainForm.designer.cs | 148 ++++++---- .../Reports/CheckoutForm.Designer.cs | 1 - .../Reports/CheckoutForm.cs | 21 +- .../Reports/SaleAnalysisForm.cs | 63 +--- .../Reports/SaleAnalysisForm.designer.cs | 126 +------- .../Reports/SaleDetail.cs | 60 ++++ .../Reports/SaleDetail.designer.cs | 128 +++++++++ .../SaleDetail.resx} | 0 .../Sales/BillHelperFunctions.cs | 263 ++++++----------- .../Sales/DiscountForm.Designer.cs | 8 +- .../Sales/SalesForm.cs | 58 ++-- .../Tanshu.Accounts.PointOfSale.csproj | 35 ++- .../AssignRoleGroups.Designer.cs | 180 ++++++++++++ .../User Management/AssignRoleGroups.cs | 119 ++++++++ .../User Management/AssignRoleGroups.resx | 120 ++++++++ .../User Management/AssignRoles.cs | 120 -------- ...signer.cs => AssignUserGroups.Designer.cs} | 59 ++-- .../User Management/AssignUserGroups.cs | 119 ++++++++ .../User Management/AssignUserGroups.resx | 120 ++++++++ .../ChangePassword.Designer.cs | 2 +- .../User Management/ChangePassword.cs | 17 +- .../User Management/RoleFactoryBI.cs | 7 +- Tanshu.Accounts.Print/Thermal.cs | 53 +++- .../BusinessLayer/CheckoutBI.cs | 93 ++++-- .../BusinessLayer/CustomerBI.cs | 11 +- .../BusinessLayer/MembershipBI.cs | 239 +++++++++++----- .../BusinessLayer/ProductGroupBI.cs | 1 + .../BusinessLayer/RoleBI.cs | 27 +- .../BusinessLayer/SalesAnalysisBI.cs | 268 +++++++++--------- .../BusinessLayer/UserBI.cs | 27 +- Tanshu.Accounts.SqlDAO/Fluent/Fixtures.cs | 199 +++++++------ .../Lifetime}/Session.cs | 20 +- .../Tanshu.Accounts.Repository.csproj | 5 +- 51 files changed, 1990 insertions(+), 1358 deletions(-) create mode 100644 Tanshu.Accounts.Contracts/Attributes/PermissionAttribute.cs create mode 100644 Tanshu.Accounts.PointOfSale/Reports/SaleDetail.cs create mode 100644 Tanshu.Accounts.PointOfSale/Reports/SaleDetail.designer.cs rename Tanshu.Accounts.PointOfSale/{User Management/AssignRoles.resx => Reports/SaleDetail.resx} (100%) create mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.Designer.cs create mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.cs create mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.resx delete mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs rename Tanshu.Accounts.PointOfSale/User Management/{AssignRoles.Designer.cs => AssignUserGroups.Designer.cs} (81%) create mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.cs create mode 100644 Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.resx rename {Tanshu.Accounts.PointOfSale/Authentication => Tanshu.Accounts.SqlDAO/Lifetime}/Session.cs (58%) diff --git a/Include/Tanshu.Common.dll b/Include/Tanshu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XrpSy-mlRBv!sg zf#;i;_F=#Wku7w7LC}xxY6+bWe|yl2F%MR#PdWnjdeFnJ6Kdp&ycJ_T?$G&VY{*76 z>hNRG`8lU6SibUf#PtSLLb$oN6Kl4kH0%{|`YBKP!r!|+oRu1$F?~Ar^i%MYAhS0| z=gf@FnLRBwFE)MJtY}AUTF1+#$RhhgaxDV$K@DAX<0Khq5ySqU*eW?6cm44YkLAp_`FQ1mLq>sE(BQ5(HUqaNTpFbEzK@Sw z_%M!-PIxEBp9xZmkA?WSE-CvuK7Hh4AoaP|bvcA;(20+pct5yh6iMBZXFA%g{^4aq zwgLY7a30F?5s^B^>c#QXO4QW@J^0gZ*Si&a%CKlA`#b0zL^(%eK33!7GOoW5dSvv= zE?;lg!~0&=embH;M#ehG;GJit>8HrRS5anI_gxY7rJ$4X?x_l>alm`<4U44 z@x4+_j==aF7jKS1mp-(aHQ$0gH;%PN;f3+7*YFW+5yts4+Z5pupB18Gt1XXvgKKf@ z#FVn^=h5{9vGFR%vY>xI?2AXoX$iS~Gt#!R#J0I*M_PEKeV5BOnH$jueD2T#59x+w u!tl=Ao^i_IR~d1>#62_<=VP Groups { get; set; } + public virtual IList UserGroups { get; set; } public User() { - Groups = new List(); + UserGroups = new List(); } } } diff --git a/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs b/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs index 9ae7d73..a76b171 100644 --- a/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs +++ b/Tanshu.Accounts.Contracts/Data Contracts/InventoryBO.cs @@ -12,78 +12,24 @@ namespace Tanshu.Accounts.Entities public virtual Voucher Voucher { get; set; } public virtual Product Product { get; set; } - private decimal quantity; - public virtual decimal Quantity - { - get { return quantity; } - set - { - quantity = value; - if (amount != null) - CalculateAmount(); - } - } + public virtual decimal Quantity { get; set; } - private decimal rate; - public virtual decimal Rate - { - get { return rate; } - set - { - rate = value; - if (amount != null) - CalculateAmount(); - } - } + public virtual decimal Rate { get; set; } - decimal tax; - public virtual decimal Tax - { - get { return tax; } - set - { - tax = value; - if (amount != null) - CalculateAmount(); - } - } + public virtual decimal Tax { get; set; } - decimal discount; - public virtual decimal Discount - { - get { return discount; } - set - { - discount = value; - if (amount != null) - CalculateAmount(); - } - } + public virtual decimal Discount { get; set; } - private decimal serviceCharge; - public virtual decimal ServiceCharge - { - get { return serviceCharge; } - set - { - discount = value; - if (amount != null) - CalculateAmount(); - } - - } + public virtual decimal ServiceCharge { get; set;} [Cascade] public virtual IList InventoryModifier { get; set; } - decimal? amount; public virtual decimal Amount { get { - if (!amount.HasValue) - CalculateAmount(); - return amount.Value; + return Quantity * Rate * (1 + Tax) * (1 + ServiceCharge) * (1 - Discount); } set { } @@ -96,10 +42,6 @@ namespace Tanshu.Accounts.Entities // return quantity * rate * (1 + tax) * (1 + serviceCharge) * discount; // } //} - protected void CalculateAmount() - { - amount = quantity * rate * (1 + tax) * (1 + serviceCharge) * (1 - discount); - } public Inventory() { InventoryModifier = new List(); diff --git a/Tanshu.Accounts.Contracts/Data Contracts/ProductGroupBO.cs b/Tanshu.Accounts.Contracts/Data Contracts/ProductGroupBO.cs index 437d6d4..c842c37 100644 --- a/Tanshu.Accounts.Contracts/Data Contracts/ProductGroupBO.cs +++ b/Tanshu.Accounts.Contracts/Data Contracts/ProductGroupBO.cs @@ -11,6 +11,7 @@ namespace Tanshu.Accounts.Entities public virtual string Name { get; set; } public virtual decimal DiscountLimit { get; set; } public virtual bool IsModifierCompulsory { get; set; } + public virtual string GroupType { get; set; } public virtual IList Products { get; set; } public ProductGroup() { diff --git a/Tanshu.Accounts.Contracts/RolesConstants.cs b/Tanshu.Accounts.Contracts/RolesConstants.cs index 1033296..eb7e79b 100644 --- a/Tanshu.Accounts.Contracts/RolesConstants.cs +++ b/Tanshu.Accounts.Contracts/RolesConstants.cs @@ -5,23 +5,44 @@ using System.Text; namespace Tanshu.Accounts.Contracts { - public static class RolesConstants + public sealed class RoleConstants { - public const string SALES_CHECKOUT = "Sales/Checkout"; - public const string SALES_SALES_BILL = "Sales/SalesBill"; - public const string SALES_SALE_DETAIL = "Sales/SaleDetail"; - public const string SALES_VOID_BILL = "Sales/VoidPrintedBill"; - public const string SALES_EDIT_BILL = "Sales/EditBill"; - public const string SALES_PRINT_KOT = "Sales/PrintKOT"; - public const string SALES_PRINT_BILL = "Sales/PrintBill"; - public const string SALES_CHANGE_RATE = "Sales/ChangeRate"; - public const string SALES_EDIT_PRINTED_PRODUCT = "Sales/EditPrintedProduct"; + private readonly string role; + private RoleConstants(string role) + { + this.role = role; + } + public override string ToString() + { + return role; + } + public string Role + { + get { return role; } + } + public static RoleConstants ADJUST_ADVANCE = new RoleConstants("Sales/AdjustAdvance"); + public static RoleConstants RECEIVE_ADVANCE = new RoleConstants("Sales/ReceiveAdvance"); + public static RoleConstants CHANGE_RATE = new RoleConstants("Sales/ChangeRate"); + public static RoleConstants CASHIER_CHECKOUT = new RoleConstants("Sales/CashierCheckout"); + public static RoleConstants CUSTOMERS = new RoleConstants("Sales/Customers"); + 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 PRINT_BILL = new RoleConstants("Sales/PrintBill"); + public static RoleConstants PRINT_KOT = new RoleConstants("Sales/PrintKOT"); + public static RoleConstants SALES = new RoleConstants("Sales/SalesBill"); + public static RoleConstants SALE_ANALYSIS = new RoleConstants("Sales/SaleAnalysis"); + public static RoleConstants SALE_DETAIL = new RoleConstants("Sales/SaleDetail"); + public static RoleConstants VOID_BILL = new RoleConstants("Sales/VoidPrintedBill"); + public static RoleConstants ZERO_RATE = new RoleConstants("Sales/ZeroRate"); + public static RoleConstants SETTLE_BILL = new RoleConstants("Sales/SettleBill"); - public const string MASTER_PRODUCTS = "Master/Products"; + public static RoleConstants PRODUCTS = new RoleConstants("Master/Products"); - public const string SECURITY_MANAGE_ROLES = "Security/ManageRoles"; - public const string LOG_VIEW = "Log/View"; - public const string MASTER_OWNER = "Master/Owner"; + public static RoleConstants SECURITY_MANAGE_USERS = new RoleConstants("Security/ManageUsers"); + public static RoleConstants SECURITY_MANAGE_ROLES = new RoleConstants("Security/ManageRoles"); + public static RoleConstants LOG_VIEW = new RoleConstants("Log/View"); + public static RoleConstants MASTER_OWNER = new RoleConstants("Master/Owner"); } } diff --git a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj index ddaef3f..8fd47f3 100644 --- a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj +++ b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj @@ -41,10 +41,6 @@ False ..\Include\Fluent\Castle.Core.dll - - False - ..\Include\Fluent\Castle.DynamicProxy2.dll - False ..\Include\Fluent\FluentNHibernate.dll @@ -53,10 +49,6 @@ False ..\Include\Fluent\Iesi.Collections.dll - - False - ..\Include\Fluent\log4net.dll - False ..\Include\Fluent\NHibernate.dll @@ -86,6 +78,7 @@ + diff --git a/Tanshu.Accounts.Helpers/SelectCustomer.cs b/Tanshu.Accounts.Helpers/SelectCustomer.cs index dd49282..4d7bca5 100644 --- a/Tanshu.Accounts.Helpers/SelectCustomer.cs +++ b/Tanshu.Accounts.Helpers/SelectCustomer.cs @@ -22,7 +22,6 @@ namespace Tanshu.Accounts.Helpers filters.Add("Universal"); SetFilterColumns(filters); grid.Columns["CustomerID"].Visible = false; - grid.Columns["LedgerID"].Visible = false; } protected override void FilterChanged(Dictionary filter) diff --git a/Tanshu.Accounts.Helpers/SelectUser.cs b/Tanshu.Accounts.Helpers/SelectUser.cs index 8e2ac13..8cb7f60 100644 --- a/Tanshu.Accounts.Helpers/SelectUser.cs +++ b/Tanshu.Accounts.Helpers/SelectUser.cs @@ -21,7 +21,6 @@ namespace Tanshu.Accounts.Helpers filters.Add("Name"); SetFilterColumns(filters); grid.Columns["UserID"].Visible = false; - grid.Columns["timestamp"].Visible = false; } protected override void FilterChanged(Dictionary filter) diff --git a/Tanshu.Accounts.PointOfSale/App.config b/Tanshu.Accounts.PointOfSale/App.config index bbd28be..183e9a3 100644 --- a/Tanshu.Accounts.PointOfSale/App.config +++ b/Tanshu.Accounts.PointOfSale/App.config @@ -1,10 +1,10 @@  - + - + diff --git a/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs b/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs index e86421c..89c103e 100644 --- a/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs +++ b/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs @@ -4,6 +4,8 @@ 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 { @@ -16,7 +18,7 @@ namespace Tanshu.Accounts.PointOfSale } bool LoginUser(bool setThreadPrincipal) { - using (LoginForm login = new LoginForm()) + using (LoginForm login = new LoginForm(new KeyboardControl())) { string userName; login.ShowDialog(); diff --git a/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs index 1a954b2..b3c120f 100644 --- a/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.Designer.cs @@ -34,7 +34,6 @@ this.Label2 = new System.Windows.Forms.Label(); this.txtUserName = new System.Windows.Forms.TextBox(); this.Label1 = new System.Windows.Forms.Label(); - this.numpadControl1 = new Tanshu.Common.KeyboardControl.NumpadControl(); this.SuspendLayout(); // // btnExit @@ -91,21 +90,12 @@ this.Label1.TabIndex = 4; this.Label1.Text = "Username"; // - // numpadControl1 - // - this.numpadControl1.Location = new System.Drawing.Point(35, 93); - this.numpadControl1.Name = "numpadControl1"; - this.numpadControl1.Size = new System.Drawing.Size(224, 224); - this.numpadControl1.TabIndex = 6; - this.numpadControl1.TabStop = false; - // // LoginForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnExit; - this.ClientSize = new System.Drawing.Size(290, 329); - this.Controls.Add(this.numpadControl1); + this.ClientSize = new System.Drawing.Size(290, 97); this.Controls.Add(this.txtPassword); this.Controls.Add(this.Label2); this.Controls.Add(this.txtUserName); @@ -129,6 +119,5 @@ internal System.Windows.Forms.Label Label2; internal System.Windows.Forms.TextBox txtUserName; internal System.Windows.Forms.Label Label1; - private Tanshu.Common.KeyboardControl.NumpadControl numpadControl1; } } \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs index df8920b..4b157aa 100644 --- a/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs +++ b/Tanshu.Accounts.PointOfSale/Authentication/LoginForm.cs @@ -3,6 +3,7 @@ using System.Threading; using System.Windows.Forms; using Tanshu.Accounts.Repository; using Tanshu.Accounts.Helpers; +using Tanshu.Common.KeyboardControl; namespace Tanshu.Accounts.PointOfSale { @@ -12,11 +13,24 @@ namespace Tanshu.Accounts.PointOfSale //private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private bool isAuthenticated; private string userName; - public LoginForm() + private IKeyboardControl keyboardControl; + public LoginForm(IKeyboardControl keyboardControl) { InitializeComponent(); isAuthenticated = false; userName = null; + this.keyboardControl = keyboardControl; + + var control = keyboardControl as UserControl; + if (control != null) + { + control.Location = new System.Drawing.Point(6, 87); + var border = (this.Width - this.ClientSize.Width) / 2; + var titlebarHeight = this.Height - this.ClientSize.Height - (2 * border); + this.Controls.Add(control); + this.Width = 6 + control.Width + 6 + (border * 2); + this.Height = titlebarHeight + 87 + control.Height + 6 + (border * 2); + } } private void txtUserName_KeyDown(object sender, KeyEventArgs e) diff --git a/Tanshu.Accounts.PointOfSale/Controllers/BillController.cs b/Tanshu.Accounts.PointOfSale/Controllers/BillController.cs index 377d640..94f7a26 100644 --- a/Tanshu.Accounts.PointOfSale/Controllers/BillController.cs +++ b/Tanshu.Accounts.PointOfSale/Controllers/BillController.cs @@ -18,13 +18,15 @@ namespace Tanshu.Accounts.PointOfSale public class BillController { private SaleVoucher billInfo; - // private KeyedCollection b1 = new KeyedCollection(); - private OrderedDictionary bill = new OrderedDictionary(); - int? newBillID; + int? editVoucherID; ISaleForm saleForm; private Customer customer = new CustomerBI().GetCustomer(1); + public BillController(int? editVoucherID) + { + this.editVoucherID = editVoucherID; + } public void InitGui(ISaleForm saleForm) { this.saleForm = saleForm; @@ -49,7 +51,7 @@ namespace Tanshu.Accounts.PointOfSale } public void AddProductToGrid(int productID) { - BillHelperFunctions.AddProductToGrid(productID, saleForm.BindingSource, bill); + new BillHelperFunctions(saleForm.BindingSource, bill, productID).AddProduct(); Product product = ProductBI.GetProduct(productID); if (ProductGroupModifierBI.HasCompulsoryModifier(product.ProductGroup.ProductGroupID)) { @@ -74,6 +76,9 @@ namespace Tanshu.Accounts.PointOfSale public void ShowDiscount() { + if (!Session.IsAllowed(RoleConstants.DISCOUNT)) + return; + var list = new ProductGroupBI().GetProductGroups(); using (var frm = new DiscountForm(list)) { @@ -86,7 +91,8 @@ namespace Tanshu.Accounts.PointOfSale { var pg = new ProductGroupBI().GetProductGroupOfProduct(item.Value.ProductID); if (outList.Contains(pg.ProductGroupID)) - item.Value.Discount = discount; + new BillHelperFunctions(saleForm.BindingSource, bill, item.Value.ProductID).SetDiscount(item.Value.Name, discount); + } } } @@ -125,35 +131,34 @@ namespace Tanshu.Accounts.PointOfSale public void Save(bool print, int waiterID, string tableID) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_EDIT_BILL)) + 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))) + return; + if (bill.Count == 0) + return; + + int? saved; + if (billInfo == null) + saved = InsertVoucher(print, waiterID, tableID); + else + saved = UpdateSale(print, waiterID, tableID); + if (saved.HasValue) { - if ((billInfo != null) && (SaleVoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!roleBI.IsAllowed)) - { - throw new PermissionException("You do not have the permission to reprint a bill."); - } - } - if (bill.Count != 0) - { - int? saved; - if (billInfo == null) - saved = AddNewSale(print, waiterID, tableID); + if (editVoucherID.HasValue) + saleForm.CloseWindow(); else - saved = UpdateSale(print, waiterID, tableID); - if (saved.HasValue) - { - if (newBillID.HasValue) - saleForm.CloseWindow(); - else - PrintBill(print, saved.Value); - } - ClearBill(); + PrintBill(print, saved.Value); } + ClearBill(); } - private int? AddNewSale(bool finalBill, int waiterID, string tableID) + private int? InsertVoucher(bool finalBill, int waiterID, string tableID) { if (billInfo != null) { - MessageBox.Show("Error in AddNewSale, there is a previous sale in memory", "Error"); + MessageBox.Show("Error in InsertVoucher, there is a previous sale in memory", "Error"); return null; } @@ -205,41 +210,46 @@ namespace Tanshu.Accounts.PointOfSale private IList GetInventoryForBill(ICollection list) { Dictionary localList = new Dictionary(); + HashSet keys = new HashSet(); + foreach (BillInventory item in list) { Inventory temp = new Inventory(); if (localList.ContainsKey(item.ProductID)) { + 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); } else { - temp.Discount = item.Discount; 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) temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod }); localList.Add(item.ProductID, temp); + + if (item.Quantity <= 0) + keys.Add(item.ProductID); } } - return localList.Values.ToList(); - } - public decimal GetInput(string type, decimal basic) - { - decimal value; - InputBoxResult result = InputBox.Show(type, basic.ToString(), InputBox_Validating); - if (result.OK) + foreach (var item in keys) { - if (!decimal.TryParse(result.Text, out value)) - return 0; - return value; + localList.Remove(item); } - return 0; + return localList.Values.ToList(); } #endregion public void VoidBill() @@ -248,27 +258,22 @@ namespace Tanshu.Accounts.PointOfSale return; if (!billInfo.Printed) return; - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_VOID_BILL)) + if (Session.IsAllowed(RoleConstants.VOID_BILL)) { - if (roleBI.IsAllowed) + if (MessageBox.Show("Are you sure you want to void this bill?", "Void Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { - if (MessageBox.Show("Are you sure you want to void this bill?", "Void Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) + SelectVoidReason voidReason = new SelectVoidReason(GetVoidReason, true); + voidReason.ShowDialog(); + if (voidReason.SelectedItem != null) { - SelectVoidReason voidReason = new SelectVoidReason(GetVoidReason, true); - voidReason.ShowDialog(); - if (voidReason.SelectedItem != null) - { - SaleVoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description); - ClearBill(); - } - else - { - MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); - } + SaleVoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description); + ClearBill(); + } + else + { + MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } - else - throw new PermissionException("You do not have the permission to void a bill."); } } Customer selectCustomer_customerEvent(object sender, CustomerEventArgs e) @@ -281,25 +286,10 @@ namespace Tanshu.Accounts.PointOfSale } private void PrintBill(bool finalBill, int voucherID) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_PRINT_KOT)) - if (!roleBI.IsAllowed) - throw new PermissionException("You are not allowed to print KOT"); - if (!finalBill) Accounts.Print.Thermal.PrintKot(voucherID, bill.Values.ToList()); else - { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_PRINT_BILL)) - { - if (roleBI.IsAllowed) - { - Accounts.Print.Thermal.PrintBill(true, voucherID, bill.Values.ToList()); - - } - else - throw new PermissionException("You are not allowed to print KOT"); - } - } + Accounts.Print.Thermal.PrintBill(voucherID, bill.Values.ToList()); } private List GetVoidReason(Dictionary filter) @@ -315,15 +305,14 @@ namespace Tanshu.Accounts.PointOfSale list.Add(new StringType("Other")); return list.Where(i => i.Description.ToLower().Contains(filter["Name"].ToLower().Trim())).ToList(); } - public void SetNewBillID(int voucherID) - { - this.newBillID = voucherID; - } public BillInventory CurrentProduct { get { - return bill.ElementAt(saleForm.BindingSource.Position).Value; + if (saleForm.BindingSource.Position == -1) + return null; + else + return bill.ElementAt(saleForm.BindingSource.Position).Value; } } private void ShowAmount() @@ -338,64 +327,48 @@ namespace Tanshu.Accounts.PointOfSale //bill.Values.ToList(); saleForm.ShowAmount(discountAmount, grossAmount, serviceChargeAmount, taxAmount, valueAmount, bill.Values.ToList()); } - public void SetDiscount(BillInventory billInventory, decimal discount) + public void ProductRemove() { - if (billInventory == null) + var item = CurrentProduct; + if (!Allowed(item)) return; - BillHelperFunctions.SetDiscount(billInventory.ProductID, discount, customer, bill); - ShowAmount(); - } - public void SetAmount(BillInventory billInventory, decimal amount) - { - if (billInventory == null) - return; - BillHelperFunctions.SetAmount(billInventory, amount, saleForm.BindingSource, bill); - ShowAmount(); - } - public void ProductRemove(BillInventory billInventory) - { - if (billInventory == null) - return; - if (billInventory.Printed > 0) + if (item.Printed > 0) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_EDIT_PRINTED_PRODUCT)) - { - if (roleBI.IsAllowed) - { - if (MessageBox.Show(string.Format("Already {0} items have been printed.\n\rAre you sure you want to delete this item?", billInventory.Printed), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - return; - } - } + 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(billInventory.ProductID, billInventory.Printed == 0)); + bill.Remove(new BillItemKey(item.ProductID, item.Printed == 0)); bill.ReCompact(); ShowAmount(); } - public void SetQuantity(BillInventory billInventory, decimal quantity, bool absolute, bool prompt) + public void SetQuantity(decimal quantity, bool prompt) { - if (billInventory == null) + var item = CurrentProduct; + if (!Allowed(item)) return; - BillHelperFunctions.SetQuantity(billInventory, quantity, absolute, prompt, saleForm.BindingSource, bill); + new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetQuantity(item, quantity, prompt); ShowAmount(); } public void ChangeRate() { - var item = CurrentProduct; - if (item != null) - { - decimal rate = 0; - InputBoxResult result = InputBox.Show("Rate", item.Price.ToString(), InputBox_Validating); - if (result.OK) - rate = Convert.ToDecimal(result.Text); - if (rate != 0) - { - BillHelperFunctions.SetRate(item.ProductID, rate, bill); - ShowAmount(); - } - } + new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetPrice(CurrentProduct); + ShowAmount(); + } + private bool Allowed(BillInventory item, RoleConstants role) + { + if (item == null) + return false; + if (!Session.IsAllowed(role)) + return false; + return true; + } + private bool Allowed(BillInventory item) + { return item != null; } private void InputBox_Validating(object sender, InputBoxValidatingArgs e) { } @@ -463,11 +436,10 @@ namespace Tanshu.Accounts.PointOfSale public void CancelBillChanges() { - if (bill.Count != 0) - if (MessageBox.Show("Cancel current bill?", "Cancel bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) + if (bill.Count != 0 && bill.Values.Any(i => i.Printed != i.Quantity)) + if (MessageBox.Show("Abandon Changes?", "Abandon Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) return; ClearBill(); - } public void ClearBill() { @@ -478,11 +450,10 @@ namespace Tanshu.Accounts.PointOfSale } public void FormLoad() { - if (newBillID.HasValue) + if (editVoucherID.HasValue) { - LoadBill(newBillID.Value); + LoadBill(editVoucherID.Value); } - } internal void SettleBill() { @@ -490,6 +461,8 @@ namespace Tanshu.Accounts.PointOfSale return; if (!billInfo.Printed) return; + if (!Session.IsAllowed(RoleConstants.SETTLE_BILL)) + return; int option = SettleOptionFactory.Unsettled; using (BillSettleForm frm = new BillSettleForm()) { @@ -505,5 +478,5 @@ namespace Tanshu.Accounts.PointOfSale } } // How to load a bill -//LoadBill(((PendingBills)bsPending.Current).voucherID); +//LoadBill(((PendingBills)bsPending.Current).editVoucherID); // ChangeFormState(SaleFormState.Billing); \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs b/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs index 818550b..16515b4 100644 --- a/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs +++ b/Tanshu.Accounts.PointOfSale/CurrencyCounter.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; +using Tanshu.Accounts.Contracts; namespace Tanshu.Accounts.PointOfSale { diff --git a/Tanshu.Accounts.PointOfSale/MainForm.cs b/Tanshu.Accounts.PointOfSale/MainForm.cs index 99fa211..76e20cb 100644 --- a/Tanshu.Accounts.PointOfSale/MainForm.cs +++ b/Tanshu.Accounts.PointOfSale/MainForm.cs @@ -5,6 +5,7 @@ using Tanshu.Accounts.Entities.Auth; using Tanshu.Accounts.Helpers; using Tanshu.Accounts.Repository; using System.Collections.Generic; +using Tanshu.Common.KeyboardControl; namespace Tanshu.Accounts.PointOfSale { @@ -56,38 +57,26 @@ namespace Tanshu.Accounts.PointOfSale } CheckRoles(); } - private void btnSale_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_SALES_BILL)) - { - if (roleBI.IsAllowed) - { - using (SalesForm frmSale = new SalesForm(new BillController())) - frmSale.ShowDialog(); - } - } + if (Session.IsAllowed(RoleConstants.SALES)) + using (SalesForm frmSale = new SalesForm(new BillController(null))) + frmSale.ShowDialog(); } private void btnProduct_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.MASTER_PRODUCTS)) - { - if (roleBI.IsAllowed) - using (ProductsForm frm = new ProductsForm()) - frm.ShowDialog(); - } + if (Session.IsAllowed(RoleConstants.PRODUCTS)) + using (ProductsForm frm = new ProductsForm()) + frm.ShowDialog(); } private void btnProductGroup_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.MASTER_PRODUCTS)) - { - if (roleBI.IsAllowed) - using (var frm = new ProductTypes()) - frm.ShowDialog(); - } + if (Session.IsAllowed(RoleConstants.PRODUCTS)) + using (var frm = new ProductTypes()) + frm.ShowDialog(); } @@ -102,40 +91,27 @@ namespace Tanshu.Accounts.PointOfSale private void btnInitial_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.MASTER_OWNER)) +#if (DEBUG) + if (Session.IsAllowed(RoleConstants.MASTER_OWNER)) { - if (roleBI.IsAllowed) - { - Fixtures.CreateSchema(); - MessageBox.Show("Schema Recreated"); - } + //Fixtures.CreateSchema(); + //MessageBox.Show("Schema Recreated"); } - +#endif } private void btnAdvanceReceive_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_SALES_BILL)) - { - if (roleBI.IsAllowed) - { - using (RecieveAdvanceForm frm = new RecieveAdvanceForm()) - frm.ShowDialog(); - } - } - + if (Session.IsAllowed(RoleConstants.SALES)) + using (RecieveAdvanceForm frm = new RecieveAdvanceForm()) + frm.ShowDialog(); } private void btnAdvanceAdjust_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_SALES_BILL)) - { - if (roleBI.IsAllowed) - { - using (AdjustAdvanceForm frm = new AdjustAdvanceForm()) - frm.ShowDialog(); - } - } + if (Session.IsAllowed(RoleConstants.SALES)) + using (AdjustAdvanceForm frm = new AdjustAdvanceForm()) + frm.ShowDialog(); } @@ -146,110 +122,87 @@ namespace Tanshu.Accounts.PointOfSale private void btnCreateUser_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SECURITY_MANAGE_ROLES)) - { - if (roleBI.IsAllowed) - using (SelectUser form = new SelectUser(UserBI.GetFilteredUsers, true)) - { - form.userEvent += new UserEventHandler(form_userEvent); - form.ShowDialog(); - } - } - + if (Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES)) + using (SelectUser form = new SelectUser(UserBI.GetFilteredUsers, true)) + { + form.userEvent += new UserEventHandler(form_userEvent); + form.ShowDialog(); + } } - private void btnAssignRoles_Click(object sender, EventArgs e) + private void btnUserRoles_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SECURITY_MANAGE_ROLES)) - { - if (roleBI.IsAllowed) - using (AssignRoles frm = new AssignRoles()) - frm.ShowDialog(); - - } - + if (Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES)) + using (var frm = new AssignUserGroups()) + frm.ShowDialog(); } private void btnChangePassword_Click(object sender, EventArgs e) { - using (ChangePassword frm = new ChangePassword()) + using (ChangePassword frm = new ChangePassword(new KeyboardControl())) frm.ShowDialog(); } private void btnCashierCheckout_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_CHECKOUT)) - { - if (roleBI.IsAllowed) - using (Cashier_Checkout_Form frm = new Cashier_Checkout_Form()) - frm.ShowDialog(); - } + if (Session.IsAllowed(RoleConstants.CASHIER_CHECKOUT)) + using (Cashier_Checkout_Form frm = new Cashier_Checkout_Form()) + frm.ShowDialog(); } private void btnSaleAnalysis_Click(object sender, EventArgs e) { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_SALE_DETAIL)) - { - if (roleBI.IsAllowed) - using (frmSaleAnalysisForm frm = new frmSaleAnalysisForm()) - frm.ShowDialog(); - } + if (Session.IsAllowed(RoleConstants.SALE_ANALYSIS)) + using (frmSaleAnalysisForm frm = new frmSaleAnalysisForm()) + frm.ShowDialog(); + } + private void btnSaleDetail_Click(object sender, EventArgs e) + { + if (Session.IsAllowed(RoleConstants.SALE_ANALYSIS)) + using (var frm = new frmSaleDetail()) + frm.ShowDialog(); } private void MainForm_Load(object sender, EventArgs e) { - //foreach (Control item in this.flowLayoutPanel1.Controls) - //{ - // Button but = item as Button; - // if (but != null) - // { - - // } - //} - CheckRoles(); } private void CheckRoles() { - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.MASTER_OWNER)) - { - if (roleBI.IsAllowed) - { - btnInitial.Visible = true; - } - else - { - btnInitial.Visible = false; - } - } - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_SALES_BILL)) - { - if (roleBI.IsAllowed) - { - btnSale.Visible = true; - btnCustomer.Visible = true; - } - else - { - btnSale.Visible = false; - btnCustomer.Visible = true; - } - } - using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.MASTER_PRODUCTS)) - { - if (roleBI.IsAllowed) - { - btnProduct.Visible = true; - btnProductGroup.Visible = true; - } - else - { - btnProduct.Visible = false; - btnProductGroup.Visible = false; - } - } + btnInitial.Visible = Session.IsAllowed(RoleConstants.MASTER_OWNER); + + btnSale.Visible = Session.IsAllowed(RoleConstants.SALES); + + btnProduct.Visible = Session.IsAllowed(RoleConstants.PRODUCTS); + btnProductGroup.Visible = Session.IsAllowed(RoleConstants.PRODUCTS); + + btnCustomer.Visible = Session.IsAllowed(RoleConstants.CUSTOMERS); + + btnAdvanceReceive.Visible = Session.IsAllowed(RoleConstants.RECEIVE_ADVANCE); + + btnAdvanceAdjust.Visible = Session.IsAllowed(RoleConstants.ADJUST_ADVANCE); + + btnCreateUser.Visible = Session.IsAllowed(RoleConstants.SECURITY_MANAGE_USERS); + btnUserRoles.Visible = Session.IsAllowed(RoleConstants.SECURITY_MANAGE_USERS); + + btnGroupRoles.Visible = Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES); + + btnCashierCheckout.Visible = Session.IsAllowed(RoleConstants.SALE_ANALYSIS); + btnSaleAnalysis.Visible = Session.IsAllowed(RoleConstants.SALE_ANALYSIS); + btnSaleDetail.Visible = Session.IsAllowed(RoleConstants.SALE_DETAIL); + + btnChangePassword.Visible = Session.IsAuthenticated; } + + private void btnGroupRoles_Click(object sender, EventArgs e) + { + if (Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES)) + using (var frm = new AssignGroupRoles()) + frm.ShowDialog(); + + } + } } diff --git a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs index 23e750e..0d67f3c 100644 --- a/Tanshu.Accounts.PointOfSale/MainForm.designer.cs +++ b/Tanshu.Accounts.PointOfSale/MainForm.designer.cs @@ -32,17 +32,19 @@ this.btnSale = new System.Windows.Forms.Button(); this.btnInitial = new System.Windows.Forms.Button(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnCustomer = new System.Windows.Forms.Button(); this.btnProduct = new System.Windows.Forms.Button(); this.btnProductGroup = new System.Windows.Forms.Button(); - this.btnCustomer = new System.Windows.Forms.Button(); this.btnAdvanceReceive = new System.Windows.Forms.Button(); this.btnAdvanceAdjust = new System.Windows.Forms.Button(); - this.btnExit = new System.Windows.Forms.Button(); this.btnCreateUser = new System.Windows.Forms.Button(); - this.btnAssignRoles = new System.Windows.Forms.Button(); - this.btnChangePassword = new System.Windows.Forms.Button(); + this.btnUserRoles = new System.Windows.Forms.Button(); + this.btnGroupRoles = new System.Windows.Forms.Button(); this.btnCashierCheckout = new System.Windows.Forms.Button(); this.btnSaleAnalysis = 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.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -51,7 +53,7 @@ this.btnLogin.Location = new System.Drawing.Point(159, 3); this.btnLogin.Name = "btnLogin"; this.btnLogin.Size = new System.Drawing.Size(150, 100); - this.btnLogin.TabIndex = 27; + this.btnLogin.TabIndex = 1; this.btnLogin.Text = "&Login"; this.btnLogin.UseVisualStyleBackColor = true; this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); @@ -61,7 +63,7 @@ this.btnSale.Location = new System.Drawing.Point(315, 3); this.btnSale.Name = "btnSale"; this.btnSale.Size = new System.Drawing.Size(150, 100); - this.btnSale.TabIndex = 28; + this.btnSale.TabIndex = 2; this.btnSale.Text = "&Sale"; this.btnSale.UseVisualStyleBackColor = true; this.btnSale.Click += new System.EventHandler(this.btnSale_Click); @@ -71,7 +73,7 @@ this.btnInitial.Location = new System.Drawing.Point(3, 3); this.btnInitial.Name = "btnInitial"; this.btnInitial.Size = new System.Drawing.Size(150, 100); - this.btnInitial.TabIndex = 29; + this.btnInitial.TabIndex = 0; this.btnInitial.Text = "Initial Data"; this.btnInitial.UseVisualStyleBackColor = true; this.btnInitial.Click += new System.EventHandler(this.btnInitial_Click); @@ -81,59 +83,61 @@ this.flowLayoutPanel1.Controls.Add(this.btnInitial); this.flowLayoutPanel1.Controls.Add(this.btnLogin); this.flowLayoutPanel1.Controls.Add(this.btnSale); + this.flowLayoutPanel1.Controls.Add(this.btnCustomer); this.flowLayoutPanel1.Controls.Add(this.btnProduct); this.flowLayoutPanel1.Controls.Add(this.btnProductGroup); - this.flowLayoutPanel1.Controls.Add(this.btnCustomer); this.flowLayoutPanel1.Controls.Add(this.btnAdvanceReceive); this.flowLayoutPanel1.Controls.Add(this.btnAdvanceAdjust); - this.flowLayoutPanel1.Controls.Add(this.btnExit); this.flowLayoutPanel1.Controls.Add(this.btnCreateUser); - this.flowLayoutPanel1.Controls.Add(this.btnAssignRoles); - this.flowLayoutPanel1.Controls.Add(this.btnChangePassword); + this.flowLayoutPanel1.Controls.Add(this.btnUserRoles); + this.flowLayoutPanel1.Controls.Add(this.btnGroupRoles); this.flowLayoutPanel1.Controls.Add(this.btnCashierCheckout); this.flowLayoutPanel1.Controls.Add(this.btnSaleAnalysis); + this.flowLayoutPanel1.Controls.Add(this.btnSaleDetail); + this.flowLayoutPanel1.Controls.Add(this.btnChangePassword); + this.flowLayoutPanel1.Controls.Add(this.btnExit); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(792, 537); - this.flowLayoutPanel1.TabIndex = 30; + this.flowLayoutPanel1.TabIndex = 0; + // + // btnCustomer + // + this.btnCustomer.Location = new System.Drawing.Point(471, 3); + this.btnCustomer.Name = "btnCustomer"; + this.btnCustomer.Size = new System.Drawing.Size(150, 100); + this.btnCustomer.TabIndex = 3; + 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(471, 3); + this.btnProduct.Location = new System.Drawing.Point(627, 3); this.btnProduct.Name = "btnProduct"; this.btnProduct.Size = new System.Drawing.Size(150, 100); - this.btnProduct.TabIndex = 30; + this.btnProduct.TabIndex = 4; 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(627, 3); + this.btnProductGroup.Location = new System.Drawing.Point(3, 109); this.btnProductGroup.Name = "btnProductGroup"; this.btnProductGroup.Size = new System.Drawing.Size(150, 100); - this.btnProductGroup.TabIndex = 31; + this.btnProductGroup.TabIndex = 5; this.btnProductGroup.Text = "Product Groups"; this.btnProductGroup.UseVisualStyleBackColor = true; this.btnProductGroup.Click += new System.EventHandler(this.btnProductGroup_Click); // - // btnCustomer - // - this.btnCustomer.Location = new System.Drawing.Point(3, 109); - this.btnCustomer.Name = "btnCustomer"; - this.btnCustomer.Size = new System.Drawing.Size(150, 100); - this.btnCustomer.TabIndex = 32; - this.btnCustomer.Text = "Customers"; - this.btnCustomer.UseVisualStyleBackColor = true; - this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_Click); - // // btnAdvanceReceive // this.btnAdvanceReceive.Location = new System.Drawing.Point(159, 109); this.btnAdvanceReceive.Name = "btnAdvanceReceive"; this.btnAdvanceReceive.Size = new System.Drawing.Size(150, 100); - this.btnAdvanceReceive.TabIndex = 33; + this.btnAdvanceReceive.TabIndex = 6; this.btnAdvanceReceive.Text = "Receive Advance"; this.btnAdvanceReceive.UseVisualStyleBackColor = true; this.btnAdvanceReceive.Click += new System.EventHandler(this.btnAdvanceReceive_Click); @@ -143,71 +147,91 @@ this.btnAdvanceAdjust.Location = new System.Drawing.Point(315, 109); this.btnAdvanceAdjust.Name = "btnAdvanceAdjust"; this.btnAdvanceAdjust.Size = new System.Drawing.Size(150, 100); - this.btnAdvanceAdjust.TabIndex = 34; + this.btnAdvanceAdjust.TabIndex = 7; this.btnAdvanceAdjust.Text = "Adjust Advance"; this.btnAdvanceAdjust.UseVisualStyleBackColor = true; this.btnAdvanceAdjust.Click += new System.EventHandler(this.btnAdvanceAdjust_Click); // - // btnExit - // - this.btnExit.Location = new System.Drawing.Point(471, 109); - this.btnExit.Name = "btnExit"; - this.btnExit.Size = new System.Drawing.Size(150, 100); - this.btnExit.TabIndex = 35; - this.btnExit.Text = "Exit"; - this.btnExit.UseVisualStyleBackColor = true; - this.btnExit.Click += new System.EventHandler(this.btnExit_Click); - // // btnCreateUser // - this.btnCreateUser.Location = new System.Drawing.Point(627, 109); + this.btnCreateUser.Location = new System.Drawing.Point(471, 109); this.btnCreateUser.Name = "btnCreateUser"; this.btnCreateUser.Size = new System.Drawing.Size(150, 100); - this.btnCreateUser.TabIndex = 36; + this.btnCreateUser.TabIndex = 8; this.btnCreateUser.Text = "Create User"; this.btnCreateUser.UseVisualStyleBackColor = true; this.btnCreateUser.Click += new System.EventHandler(this.btnCreateUser_Click); // - // btnAssignRoles + // btnUserRoles // - this.btnAssignRoles.Location = new System.Drawing.Point(3, 215); - this.btnAssignRoles.Name = "btnAssignRoles"; - this.btnAssignRoles.Size = new System.Drawing.Size(150, 100); - this.btnAssignRoles.TabIndex = 37; - this.btnAssignRoles.Text = "Assign Roles"; - this.btnAssignRoles.UseVisualStyleBackColor = true; - this.btnAssignRoles.Click += new System.EventHandler(this.btnAssignRoles_Click); + this.btnUserRoles.Location = new System.Drawing.Point(627, 109); + this.btnUserRoles.Name = "btnUserRoles"; + this.btnUserRoles.Size = new System.Drawing.Size(150, 100); + this.btnUserRoles.TabIndex = 9; + this.btnUserRoles.Text = "Manage User Roles"; + this.btnUserRoles.UseVisualStyleBackColor = true; + this.btnUserRoles.Click += new System.EventHandler(this.btnUserRoles_Click); // - // btnChangePassword + // btnGroupRoles // - this.btnChangePassword.Location = new System.Drawing.Point(159, 215); - this.btnChangePassword.Name = "btnChangePassword"; - this.btnChangePassword.Size = new System.Drawing.Size(150, 100); - this.btnChangePassword.TabIndex = 38; - this.btnChangePassword.Text = "Change Password"; - this.btnChangePassword.UseVisualStyleBackColor = true; - this.btnChangePassword.Click += new System.EventHandler(this.btnChangePassword_Click); + this.btnGroupRoles.Location = new System.Drawing.Point(3, 215); + this.btnGroupRoles.Name = "btnGroupRoles"; + this.btnGroupRoles.Size = new System.Drawing.Size(150, 100); + this.btnGroupRoles.TabIndex = 10; + 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(315, 215); + this.btnCashierCheckout.Location = new System.Drawing.Point(159, 215); this.btnCashierCheckout.Name = "btnCashierCheckout"; this.btnCashierCheckout.Size = new System.Drawing.Size(150, 100); - this.btnCashierCheckout.TabIndex = 39; + this.btnCashierCheckout.TabIndex = 11; 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(471, 215); + this.btnSaleAnalysis.Location = new System.Drawing.Point(315, 215); this.btnSaleAnalysis.Name = "btnSaleAnalysis"; this.btnSaleAnalysis.Size = new System.Drawing.Size(150, 100); - this.btnSaleAnalysis.TabIndex = 40; + this.btnSaleAnalysis.TabIndex = 12; this.btnSaleAnalysis.Text = "Sale Analysis"; this.btnSaleAnalysis.UseVisualStyleBackColor = true; this.btnSaleAnalysis.Click += new System.EventHandler(this.btnSaleAnalysis_Click); // + // btnChangePassword + // + this.btnChangePassword.Location = new System.Drawing.Point(627, 215); + this.btnChangePassword.Name = "btnChangePassword"; + this.btnChangePassword.Size = new System.Drawing.Size(150, 100); + this.btnChangePassword.TabIndex = 13; + 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.Name = "btnExit"; + this.btnExit.Size = new System.Drawing.Size(150, 100); + this.btnExit.TabIndex = 14; + this.btnExit.Text = "Exit"; + this.btnExit.UseVisualStyleBackColor = true; + this.btnExit.Click += new System.EventHandler(this.btnExit_Click); + // + // btnSaleDetail + // + 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); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -237,9 +261,11 @@ private System.Windows.Forms.Button btnAdvanceAdjust; private System.Windows.Forms.Button btnExit; private System.Windows.Forms.Button btnCreateUser; - private System.Windows.Forms.Button btnAssignRoles; + private System.Windows.Forms.Button btnUserRoles; private System.Windows.Forms.Button btnChangePassword; private System.Windows.Forms.Button btnCashierCheckout; private System.Windows.Forms.Button btnSaleAnalysis; + private System.Windows.Forms.Button btnGroupRoles; + private System.Windows.Forms.Button btnSaleDetail; } } \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.Designer.cs index d3c48f7..a4664fa 100644 --- a/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.Designer.cs @@ -195,7 +195,6 @@ this.txtSales.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.txtSales.Size = new System.Drawing.Size(200, 20); this.txtSales.TabIndex = 54; - this.txtSales.TextChanged += new System.EventHandler(this.txtSales_TextChanged); // // txtDeposited // diff --git a/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.cs b/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.cs index 5164b22..fd7e165 100644 --- a/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.cs +++ b/Tanshu.Accounts.PointOfSale/Reports/CheckoutForm.cs @@ -9,21 +9,24 @@ namespace Tanshu.Accounts.PointOfSale public partial class Cashier_Checkout_Form : Form { CheckoutBI coProxy; + bool loading; //private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public Cashier_Checkout_Form() { + loading = true; InitializeComponent(); } private void Cashier_Checkout_Form_Load(object sender, EventArgs e) { dtpStart.Format = DateTimePickerFormat.Custom; - dtpStart.CustomFormat = "dd-MMM-yyyy HH:mm:ss"; + dtpStart.CustomFormat = "dd-MMM-yyyy"; dtpStart.Value = DateTime.Now; dtpFinish.Format = DateTimePickerFormat.Custom; - dtpFinish.CustomFormat = "dd-MMM-yyyy HH:mm:ss"; + dtpFinish.CustomFormat = "dd-MMM-yyyy"; dtpFinish.Value = DateTime.Now; FillUsers(); + loading = false; } private void FillUsers() @@ -41,11 +44,8 @@ namespace Tanshu.Accounts.PointOfSale private void EmployeeStatus() { - if (cmbCashier.SelectedValue == null) + if (loading || cmbCashier.SelectedValue == null) return; - dtpStart.Value = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); - dtpFinish.Value = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); - coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value); txtOpening.Text = string.Format("{0:#,##0.00}", coProxy); txtReceipts.Text = string.Format("{0:#,##0.00}", coProxy.Receipts); @@ -57,10 +57,10 @@ namespace Tanshu.Accounts.PointOfSale txtPayments.Text = string.Format("{0:#,##0.00}", coProxy.CashPayments); txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", coProxy.AdditionalVoids); txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", coProxy.VoidsInSystem); + txtDiscounts.Text = string.Format("{0:#,##0.00}", coProxy.Discount); txtPending.Text = string.Format("{0:#,##0.00}", coProxy.PendingBills); txtSales.Text = string.Format("{0:#,##0.00}", coProxy.NetSales); - txtClosingCash.Text = string.Format("{0:#,##0.00}", coProxy.ClosingBalance - ); + txtClosingCash.Text = string.Format("{0:#,##0.00}", coProxy.ClosingBalance); txtStatus.Text = coProxy.Status; } @@ -88,10 +88,5 @@ namespace Tanshu.Accounts.PointOfSale { Thermal.PrintClosing(coProxy); } - - private void txtSales_TextChanged(object sender, EventArgs e) - { - - } } } \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs b/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs index 9000e03..c9fc5f8 100644 --- a/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs +++ b/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.cs @@ -9,8 +9,7 @@ namespace Tanshu.Accounts.PointOfSale { public partial class frmSaleAnalysisForm : Form { - int? details = null; - IList det; + IList list; //private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public frmSaleAnalysisForm() { @@ -25,38 +24,12 @@ namespace Tanshu.Accounts.PointOfSale private void ShowStatement() { - DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); - DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); - - if (details.HasValue) - { - var list = new SalesAnalysisBI().GetSaleDetail(startDate, finishDate, details.Value); - dgvSale.AutoGenerateColumns = true; - dgvSale.DataSource = list; - dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; - dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; - dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; - } - else - { - det = new SalesAnalysisBI().GetSale(startDate, finishDate); - dgvSale.AutoGenerateColumns = true; - dgvSale.DataSource = det; - dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; - dgvSale.Columns[0].Visible = false; - dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; - dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; - } - - - decimal freeSale = 0, voids = 0, pending = 0, net = 0, tax = 0; - new SalesAnalysisBI().GetAdditionalInfo(ref freeSale, ref voids, ref pending, ref net, ref tax, startDate, finishDate); - - txtVoid.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", voids); - txtPending.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", pending); - txtNet.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net); - txtTax.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", tax); - txtGross.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net + tax); + list = new SalesAnalysisBI().GetSale(dtpStart.Value, dtpFinish.Value); + dgvSale.AutoGenerateColumns = true; + dgvSale.DataSource = list; + dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; + dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } private void dtpFinish_ValueChanged(object sender, EventArgs e) @@ -71,27 +44,13 @@ namespace Tanshu.Accounts.PointOfSale ShowStatement(); } - private void dgvSale_CellDoubleClick(object sender, DataGridViewCellEventArgs e) - { - try - { - if (!details.HasValue) - details = ((SalesAnalysis)dgvSale.SelectedRows[0].DataBoundItem).TypeID; - else - details = null; - ShowStatement(); - } - catch (Exception ex) - { throw ex; } - } - private void btnPrint_Click(object sender, EventArgs e) { - if (det != null) + if (list != null) { - DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); - DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); - Accounts.Print.Thermal.PrintSale(Session.User.Name, det, startDate, finishDate); + var startDate = dtpStart.Value.Date.AddHours(6); + var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5); + Accounts.Print.Thermal.PrintSale(Session.User.Name, list, startDate, finishDate); } } } diff --git a/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.designer.cs b/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.designer.cs index f987f2d..7c43a52 100644 --- a/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.designer.cs +++ b/Tanshu.Accounts.PointOfSale/Reports/SaleAnalysisForm.designer.cs @@ -28,16 +28,6 @@ /// private void InitializeComponent() { - this.txtNet = new System.Windows.Forms.TextBox(); - this.txtTax = new System.Windows.Forms.TextBox(); - this.txtGross = new System.Windows.Forms.TextBox(); - this.txtPending = new System.Windows.Forms.TextBox(); - this.txtVoid = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); this.dgvSale = new System.Windows.Forms.DataGridView(); this.dtpFinish = new System.Windows.Forms.DateTimePicker(); this.dtpStart = new System.Windows.Forms.DateTimePicker(); @@ -46,96 +36,14 @@ ((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit(); this.SuspendLayout(); // - // txtNet - // - this.txtNet.Location = new System.Drawing.Point(224, 487); - this.txtNet.Name = "txtNet"; - this.txtNet.ReadOnly = true; - this.txtNet.Size = new System.Drawing.Size(100, 20); - this.txtNet.TabIndex = 17; - // - // txtTax - // - this.txtTax.Location = new System.Drawing.Point(330, 487); - this.txtTax.Name = "txtTax"; - this.txtTax.ReadOnly = true; - this.txtTax.Size = new System.Drawing.Size(100, 20); - this.txtTax.TabIndex = 18; - // - // txtGross - // - this.txtGross.Location = new System.Drawing.Point(436, 487); - this.txtGross.Name = "txtGross"; - this.txtGross.ReadOnly = true; - this.txtGross.Size = new System.Drawing.Size(100, 20); - this.txtGross.TabIndex = 19; - // - // txtPending - // - this.txtPending.Location = new System.Drawing.Point(118, 487); - this.txtPending.Name = "txtPending"; - this.txtPending.ReadOnly = true; - this.txtPending.Size = new System.Drawing.Size(100, 20); - this.txtPending.TabIndex = 16; - // - // txtVoid - // - this.txtVoid.Location = new System.Drawing.Point(12, 487); - this.txtVoid.Name = "txtVoid"; - this.txtVoid.ReadOnly = true; - this.txtVoid.Size = new System.Drawing.Size(100, 20); - this.txtVoid.TabIndex = 15; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(115, 471); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(70, 13); - this.label5.TabIndex = 24; - this.label5.Text = "Pending Sale"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 471); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(52, 13); - this.label4.TabIndex = 23; - this.label4.Text = "Void Sale"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(327, 471); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(25, 13); - this.label3.TabIndex = 26; - this.label3.Text = "Tax"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(433, 471); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(58, 13); - this.label2.TabIndex = 27; - this.label2.Text = "Gross Sale"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(221, 471); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(48, 13); - this.label1.TabIndex = 25; - this.label1.Text = "Net Sale"; - // // dgvSale // this.dgvSale.AllowUserToAddRows = false; this.dgvSale.AllowUserToDeleteRows = false; this.dgvSale.AllowUserToResizeRows = false; + this.dgvSale.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.dgvSale.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSale.Location = new System.Drawing.Point(12, 41); this.dgvSale.MultiSelect = false; @@ -145,9 +53,8 @@ this.dgvSale.RowTemplate.Height = 19; this.dgvSale.RowTemplate.ReadOnly = true; this.dgvSale.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvSale.Size = new System.Drawing.Size(524, 427); + this.dgvSale.Size = new System.Drawing.Size(335, 466); this.dgvSale.TabIndex = 14; - this.dgvSale.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSale_CellDoubleClick); // // dtpFinish // @@ -180,7 +87,8 @@ // // btnPrint // - this.btnPrint.Location = new System.Drawing.Point(461, 12); + this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPrint.Location = new System.Drawing.Point(272, 12); this.btnPrint.Name = "btnPrint"; this.btnPrint.Size = new System.Drawing.Size(75, 23); this.btnPrint.TabIndex = 28; @@ -192,18 +100,8 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(548, 519); + this.ClientSize = new System.Drawing.Size(359, 519); this.Controls.Add(this.btnPrint); - this.Controls.Add(this.txtNet); - this.Controls.Add(this.txtTax); - this.Controls.Add(this.txtGross); - this.Controls.Add(this.txtPending); - this.Controls.Add(this.txtVoid); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); this.Controls.Add(this.dgvSale); this.Controls.Add(this.dtpFinish); this.Controls.Add(this.dtpStart); @@ -221,16 +119,6 @@ #endregion - private System.Windows.Forms.TextBox txtNet; - private System.Windows.Forms.TextBox txtTax; - private System.Windows.Forms.TextBox txtGross; - private System.Windows.Forms.TextBox txtPending; - private System.Windows.Forms.TextBox txtVoid; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; private System.Windows.Forms.DataGridView dgvSale; private System.Windows.Forms.DateTimePicker dtpFinish; private System.Windows.Forms.DateTimePicker dtpStart; diff --git a/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.cs b/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.cs new file mode 100644 index 0000000..1c8783c --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Tanshu.Accounts.Repository; +using Tanshu.Accounts.Contracts; +using Tanshu.Accounts.Helpers; +using System.Linq; + +namespace Tanshu.Accounts.PointOfSale +{ + public partial class frmSaleDetail : Form + { + IList list; + //private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public frmSaleDetail() + { + InitializeComponent(); + //log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name)); + } + + private void dtpStart_ValueChanged(object sender, EventArgs e) + { + ShowStatement(); + } + + private void ShowStatement() + { + list = new SalesAnalysisBI().GetSaleDetail(dtpStart.Value, dtpFinish.Value).ToList(); + dgvSale.AutoGenerateColumns = true; + dgvSale.DataSource = list; + dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; + dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; + dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; + dgvSale.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; + } + + private void dtpFinish_ValueChanged(object sender, EventArgs e) + { + ShowStatement(); + } + + private void Sale_Analysis_Form_Load(object sender, EventArgs e) + { + dtpStart.Value = DateTime.Today; + dtpFinish.Value = DateTime.Today; + ShowStatement(); + } + + private void btnPrint_Click(object sender, EventArgs e) + { + if (list != null) + { + var startDate = dtpStart.Value.Date.AddHours(6); + var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5); + Accounts.Print.Thermal.PrintSale(Session.User.Name, list, startDate, finishDate); + } + } + } +} diff --git a/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.designer.cs b/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.designer.cs new file mode 100644 index 0000000..7608ed8 --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.designer.cs @@ -0,0 +1,128 @@ +namespace Tanshu.Accounts.PointOfSale +{ + partial class frmSaleDetail + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dgvSale = new System.Windows.Forms.DataGridView(); + this.dtpFinish = new System.Windows.Forms.DateTimePicker(); + this.dtpStart = new System.Windows.Forms.DateTimePicker(); + this.label10 = new System.Windows.Forms.Label(); + this.btnPrint = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit(); + this.SuspendLayout(); + // + // dgvSale + // + this.dgvSale.AllowUserToAddRows = false; + this.dgvSale.AllowUserToDeleteRows = false; + this.dgvSale.AllowUserToResizeRows = false; + this.dgvSale.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dgvSale.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvSale.Location = new System.Drawing.Point(12, 41); + this.dgvSale.MultiSelect = false; + this.dgvSale.Name = "dgvSale"; + this.dgvSale.ReadOnly = true; + this.dgvSale.RowHeadersVisible = false; + this.dgvSale.RowTemplate.Height = 19; + this.dgvSale.RowTemplate.ReadOnly = true; + this.dgvSale.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgvSale.Size = new System.Drawing.Size(335, 466); + this.dgvSale.TabIndex = 14; + // + // dtpFinish + // + this.dtpFinish.CustomFormat = "dd-MMM-yyyy"; + this.dtpFinish.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dtpFinish.Location = new System.Drawing.Point(168, 12); + this.dtpFinish.Name = "dtpFinish"; + this.dtpFinish.Size = new System.Drawing.Size(90, 20); + this.dtpFinish.TabIndex = 21; + this.dtpFinish.ValueChanged += new System.EventHandler(this.dtpFinish_ValueChanged); + // + // dtpStart + // + this.dtpStart.CustomFormat = "dd-MMM-yyyy"; + this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dtpStart.Location = new System.Drawing.Point(12, 12); + this.dtpStart.Name = "dtpStart"; + this.dtpStart.Size = new System.Drawing.Size(90, 20); + this.dtpStart.TabIndex = 20; + this.dtpStart.ValueChanged += new System.EventHandler(this.dtpStart_ValueChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(108, 16); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(54, 13); + this.label10.TabIndex = 22; + this.label10.Text = "<- Date ->"; + // + // btnPrint + // + this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPrint.Location = new System.Drawing.Point(272, 12); + this.btnPrint.Name = "btnPrint"; + this.btnPrint.Size = new System.Drawing.Size(75, 23); + this.btnPrint.TabIndex = 28; + this.btnPrint.Text = "Print"; + this.btnPrint.UseVisualStyleBackColor = true; + this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); + // + // frmSaleDetail + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(359, 519); + this.Controls.Add(this.btnPrint); + this.Controls.Add(this.dgvSale); + this.Controls.Add(this.dtpFinish); + this.Controls.Add(this.dtpStart); + this.Controls.Add(this.label10); + this.MaximizeBox = false; + this.Name = "frmSaleDetail"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Sale Detail"; + this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load); + ((System.ComponentModel.ISupportInitialize)(this.dgvSale)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dgvSale; + private System.Windows.Forms.DateTimePicker dtpFinish; + private System.Windows.Forms.DateTimePicker dtpStart; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button btnPrint; + } +} \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.resx b/Tanshu.Accounts.PointOfSale/Reports/SaleDetail.resx similarity index 100% rename from Tanshu.Accounts.PointOfSale/User Management/AssignRoles.resx rename to Tanshu.Accounts.PointOfSale/Reports/SaleDetail.resx diff --git a/Tanshu.Accounts.PointOfSale/Sales/BillHelperFunctions.cs b/Tanshu.Accounts.PointOfSale/Sales/BillHelperFunctions.cs index b095030..63759d9 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/BillHelperFunctions.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/BillHelperFunctions.cs @@ -11,227 +11,148 @@ using Tanshu.Accounts.Entities; namespace Tanshu.Accounts.PointOfSale { - public static class BillHelperFunctions + public class BillHelperFunctions { - #region Discount - public static void SetDiscount(int productID, decimal discount, Customer customer, OrderedDictionary bill) + BindingSource bindingSource; + OrderedDictionary bill; + BillItemKey oldKey; + BillItemKey newKey; + public BillHelperFunctions(BindingSource bindingSource, OrderedDictionary bill, int productID) { - #region InputBox - if (discount == -1) - { - InputBoxResult result = InputBox.Show("Discount", "0", InputBox_Validating); - if (result.OK) - { - if (!decimal.TryParse(result.Text, out discount)) - return; - discount /= 100; - } - } - if (discount == -1) + this.bindingSource = bindingSource; + this.bill = bill; + this.oldKey = new BillItemKey(productID, false); + this.newKey = new BillItemKey(productID, true); + } + public void SetDiscount(string name, decimal discount) + { + if (discount > 1 || discount < 0) return; - #endregion - - #region Max Discount - decimal maxDiscount = SaleVoucherBI.GetProductDiscountLimit(productID); - if ((discount > maxDiscount) && customer.CustomerID != 1) - { - MessageBox.Show(string.Format("Maximum discount for this product is {0:P}", maxDiscount), "Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - else if ((discount > maxDiscount) && customer.CustomerID == 1) - { - MessageBox.Show(string.Format("Maximum discount for this product is {0:P} Discount Disallowed", maxDiscount), "Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - #endregion - - if (bill.ContainsKey(new BillItemKey(productID, true))) - SetDiscount(bill[new BillItemKey(productID, true)], discount); - if (bill.ContainsKey(new BillItemKey(productID, false))) - SetDiscount(bill[new BillItemKey(productID, false)], discount); + decimal maxDiscount = SaleVoucherBI.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; } - private static void SetDiscount(BillInventory product, decimal discount) - { - product.Discount = discount; - } - #endregion #region Add Product - public static BillInventory AddProductToGrid(int productID, BindingSource bindingSource, OrderedDictionary bill) + public BillInventory AddProduct() { BillInventory product; - if ((!bill.ContainsKey(new BillItemKey(productID, false))) && (!bill.ContainsKey(new BillItemKey(productID, true)))) + if ((!bill.ContainsKey(oldKey)) && (!bill.ContainsKey(newKey))) { //No new or old - product = AddNewProduct(productID, bindingSource, bill); + product = SaleVoucherBI.GetDefaultSaleBillItem(newKey.ProductID); + product = AddProduct(product); } - else if (bill.ContainsKey(new BillItemKey(productID, true))) + else if (bill.ContainsKey(newKey)) { //Has new or both - BillItemKey key = new BillItemKey(productID, true); - bindingSource.CurrencyManager.Position = ProductPosition(key, bill); - product = bill[key]; - SetQuantity(product, 1, false); + bindingSource.CurrencyManager.Position = bill.IndexOfKey(newKey); + product = bill[newKey]; + product.Quantity += 1; } else { //Has only old - product = bill[new BillItemKey(productID, false)]; - if (product.Additional <= -1) - SetQuantity(product, 1, false); - else if (product.Additional < 0) - { - decimal quantity = 1 + product.Additional; - SetQuantity(product, 1, false); - - decimal rate = bill[new BillItemKey(productID, false)].Discount; - decimal discount = bill[new BillItemKey(productID, false)].Price; - product = AddNewProduct(productID, bindingSource, bill); - SetDiscount(product, discount); - SetRate(productID, rate, bill); - - SetQuantity(product, quantity, true); - - } - else - { - decimal discount = bill[new BillItemKey(productID, false)].Discount; - decimal rate = bill[new BillItemKey(productID, false)].Price; - product = AddNewProduct(productID, bindingSource, bill); - SetDiscount(product, discount); - SetRate(productID, rate, bill); - } + product = SaleVoucherBI.GetDefaultSaleBillItem(oldKey.ProductID); + product.Discount = bill[oldKey].Discount; + product.Price = bill[oldKey].Price; + product = AddProduct(product); } return product; } - private static BillInventory AddNewProduct(int productID, BindingSource bindingSource, OrderedDictionary bill) + private BillInventory AddProduct(BillInventory product) { - BillItemKey key = new BillItemKey(productID, true); - BillInventory product = SaleVoucherBI.GetDefaultSaleBillItem(productID); - product.Quantity = 1; - bill.Add(key, product); + bill.Add(new BillItemKey(product.ProductID, true), product); bindingSource.DataSource = bill.Values; bindingSource.CurrencyManager.Position = bindingSource.CurrencyManager.Count + 1; return product; - } - private static int ProductPosition(BillItemKey key, OrderedDictionary bill) - { - for (int i = 0; i < bill.Count; i++) - { - if (bill.Keys.ElementAt(i) == key) - return i; - } - return 0; - } - #endregion #region Quantity - public static void SetQuantity(BillInventory product, decimal quantity, bool absolute, bool prompt, BindingSource bindingSource, OrderedDictionary bill) + public void SetQuantity(BillInventory product, decimal quantity, bool prompt) { - #region Prompt - if (prompt) - { - InputBoxResult result = InputBox.Show("Quantity", (product.Quantity + 1).ToString(), InputBox_Validating); - if (result.OK) - { - if (!decimal.TryParse(result.Text, out quantity)) - return; - absolute = true; - } - } - if (quantity == 0) + if (prompt && !GetInput("Price", ref quantity)) return; - #endregion - - CheckQuantity(product, quantity, absolute); if (product.Printed == 0) - { - SetQuantity(product, quantity, absolute); + { // new + if (!prompt) + quantity += product.Quantity; + SetQuantity(product, quantity); } - else if (bill.ContainsKey(new BillItemKey(product.ProductID, true))) + else if (bill.ContainsKey(newKey)) { - BillInventory otherProduct = bill[new BillItemKey(product.ProductID, true)]; - if (absolute) - SetQuantity(otherProduct, quantity - product.Printed, absolute); + BillInventory newProduct = bill[newKey]; + if (prompt) + SetQuantity(newProduct, quantity - product.Printed); else - SetQuantity(otherProduct, quantity, absolute); + SetQuantity(newProduct, newProduct.Quantity + quantity); } else { - if (product.Additional < 0) + ////Has only old + if (prompt) + quantity -= product.Printed; + if (quantity > 0 || Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT)) { - if (!absolute) - quantity += product.Additional; - product.Quantity = product.Printed; - } - if (absolute) - quantity -= product.Quantity; - if (quantity > 0) - { - BillInventory otherProduct = AddProductToGrid(product.ProductID, bindingSource, bill); - SetQuantity(otherProduct, quantity, true); - } - else if ((quantity < 0) && (Thread.CurrentPrincipal.IsInRole("Sales/EditPrintedProduct"))) - { - SetQuantity(product, quantity, false); + var newProduct = SaleVoucherBI.GetDefaultSaleBillItem(product.ProductID); + newProduct.Price = product.Price; + newProduct.Discount = product.Discount; + newProduct = AddProduct(newProduct); + SetQuantity(newProduct, quantity); } } - } - private static bool CheckQuantity(BillInventory product, decimal quantity, bool absolute) + private void SetQuantity(BillInventory product, decimal quantity) { - if (!absolute) - quantity = product.Quantity + quantity; - if (quantity < 0) - return false; - else if ((quantity < product.Printed) && (!Thread.CurrentPrincipal.IsInRole("Sales/EditPrintedProduct"))) - return false; - else - return true; - } - private static void SetQuantity(BillInventory product, decimal quantity, bool absolute) - { - if (!absolute) - { - quantity = product.Quantity + quantity; - } - if (quantity <= 0) + if (quantity < 0 && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT)) return; + if (bill.ContainsKey(oldKey)) + { + var totalQuantity = bill[oldKey].Quantity + quantity; + if (totalQuantity < 0) + quantity += 0 - totalQuantity; + } product.Quantity = quantity; } #endregion - #region Amount - public static void SetAmount(BillInventory product, decimal amount, BindingSource bindingSource, OrderedDictionary bill) + public void SetPrice(BillInventory product) { - if (amount == -1) - { - InputBoxResult result = InputBox.Show("Amount", (product.Value).ToString(), InputBox_Validating); - if (result.OK) - { - amount = Convert.ToDecimal(result.Text); - } - } - if (amount == -1) + if (!Allowed(product, RoleConstants.CHANGE_RATE)) return; - else - { - SetQuantity(product, amount / (product.Price * (1 + product.Tax) * (1 - product.Discount)), true, false, bindingSource, bill); - } + decimal rate = product.Price; + if (!GetInput("Price", ref rate)) + 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; } - #endregion - #region Rate - public static void SetRate(int productID, decimal rate, OrderedDictionary bill) - { - if (bill.ContainsKey(new BillItemKey(productID, true))) - bill[new BillItemKey(productID, true)].Price = rate; - if (bill.ContainsKey(new BillItemKey(productID, false))) - bill[new BillItemKey(productID, false)].Price = rate; - } - #endregion - private static void InputBox_Validating(object sender, InputBoxValidatingArgs e) + private void InputBox_Validating(object sender, InputBoxValidatingArgs e) { } - + private bool Allowed(BillInventory item, RoleConstants role) + { + if (item == null) + return false; + if (!Session.IsAllowed(role)) + return false; + return true; + } + private bool GetInput(string prompt, ref decimal amount) + { + InputBoxResult result = InputBox.Show(prompt, amount.ToString(), InputBox_Validating); + if (!result.OK) + return false; + if (!decimal.TryParse(result.Text, out amount)) + return false; + return true; + } } } diff --git a/Tanshu.Accounts.PointOfSale/Sales/DiscountForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Sales/DiscountForm.Designer.cs index dad31fc..61b4367 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/DiscountForm.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/DiscountForm.Designer.cs @@ -51,8 +51,8 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.flpModifier); - this.splitContainer1.Size = new System.Drawing.Size(619, 492); - this.splitContainer1.SplitterDistance = 230; + this.splitContainer1.Size = new System.Drawing.Size(847, 492); + this.splitContainer1.SplitterDistance = 232; this.splitContainer1.TabIndex = 2; // // numpadControl1 @@ -76,14 +76,14 @@ this.flpModifier.Dock = System.Windows.Forms.DockStyle.Fill; this.flpModifier.Location = new System.Drawing.Point(0, 0); this.flpModifier.Name = "flpModifier"; - this.flpModifier.Size = new System.Drawing.Size(385, 492); + this.flpModifier.Size = new System.Drawing.Size(611, 492); this.flpModifier.TabIndex = 6; // // DiscountForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(619, 492); + this.ClientSize = new System.Drawing.Size(847, 492); this.ControlBox = false; this.Controls.Add(this.splitContainer1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs index bb742ec..459836b 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs @@ -27,12 +27,6 @@ namespace Tanshu.Accounts.PointOfSale billController.InitGui(this); } - public SalesForm(int voucherID, BillController billController) - : this(billController) - { - billController.SetNewBillID(voucherID); - } - public void SetUserName(string name) { this.Text = name; @@ -43,10 +37,7 @@ namespace Tanshu.Accounts.PointOfSale { case Keys.F2: { - if (dgvProducts.Rows.Count > 0) - { - billController.SetQuantity(billController.CurrentProduct, 0, false, true); - } + btnQuantity_Click(sender, new EventArgs()); break; } case Keys.F3: @@ -80,14 +71,6 @@ namespace Tanshu.Accounts.PointOfSale billController.LoadBillFromTable(null); break; } - case Keys.F9: - { - if (dgvProducts.Rows.Count > 0) - { - billController.SetAmount(billController.CurrentProduct, -1); - } - break; - } case Keys.F11: { btnPrintBill_Click(sender, e); @@ -100,20 +83,17 @@ namespace Tanshu.Accounts.PointOfSale } case Keys.Delete: { - if (dgvProducts.Rows.Count > 0) - billController.ProductRemove(billController.CurrentProduct); + billController.ProductRemove(); break; } case Keys.Add: { - if (dgvProducts.Rows.Count > 0) - billController.SetQuantity(billController.CurrentProduct, 1, false, false); + billController.SetQuantity(1, false); break; } case Keys.Subtract: { - if (dgvProducts.Rows.Count > 0) - billController.SetQuantity(billController.CurrentProduct, -1, false, false); + billController.SetQuantity(-1, false); break; } case Keys.Up: @@ -257,13 +237,6 @@ namespace Tanshu.Accounts.PointOfSale btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID; billController.Save(false, (int)btnWaiter.Tag, txtTableID.Text); } - private void btnMultiPrint_Click(object sender, EventArgs e) - { - if (btnWaiter.Tag == null) - btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID; - billController.Save(true, (int)btnWaiter.Tag, txtTableID.Text); - - } private void btnCancel_Click(object sender, EventArgs e) { billController.CancelBillChanges(); @@ -271,10 +244,7 @@ namespace Tanshu.Accounts.PointOfSale private void btnQuantity_Click(object sender, EventArgs e) { - if (dgvProducts.Rows.Count > 0) - { - billController.SetQuantity(billController.CurrentProduct, 0, false, true); - } + billController.SetQuantity(0, true); } private void btnDiscount_Click(object sender, EventArgs e) { @@ -333,14 +303,11 @@ namespace Tanshu.Accounts.PointOfSale } private void btnRate_Click(object sender, EventArgs e) { - if (dgvProducts.Rows.Count > 0) - { - billController.ChangeRate(); - } + billController.ChangeRate(); } private void btnClear_Click(object sender, EventArgs e) { - billController.ClearBill(); + billController.CancelBillChanges(); } private void dgvProducts_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) @@ -414,14 +381,21 @@ namespace Tanshu.Accounts.PointOfSale private void btnModifier_Click(object sender, EventArgs e) { var item = billController.CurrentProduct; + if (item == null) + return; var id = new ProductGroupBI().GetProductGroupOfProduct(item.ProductID).ProductGroupID; billController.ShowModifiers(id, item); } private void btnDelete_Click(object sender, EventArgs e) { - if (dgvProducts.Rows.Count > 0) - billController.ProductRemove(billController.CurrentProduct); + if (dgvProducts.Rows.Count <= 0) + return; + var p = billController.CurrentProduct; + if (p.Quantity > 1) + billController.SetQuantity(-1, false); + else + billController.ProductRemove(); } } } diff --git a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj index ee2fcf0..8c0db0f 100644 --- a/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj +++ b/Tanshu.Accounts.PointOfSale/Tanshu.Accounts.PointOfSale.csproj @@ -55,10 +55,6 @@ False ..\Include\Fluent\Castle.Core.dll - - False - ..\Include\Windsor\Castle.Windsor.dll - False ..\Include\Fluent\FluentNHibernate.dll @@ -112,7 +108,6 @@ - @@ -123,6 +118,12 @@ CurrencyCounter.cs + + Form + + + SaleDetail.cs + Form @@ -148,11 +149,11 @@ ModifierForm.cs - + Form - - AssignRoles.cs + + AssignUserGroups.cs Form @@ -185,6 +186,12 @@ MainForm.cs + + Form + + + AssignRoleGroups.cs + Form @@ -209,6 +216,10 @@ CurrencyCounter.cs + + SaleDetail.cs + Designer + BillSettleForm.cs @@ -222,8 +233,8 @@ ModifierForm.cs - - AssignRoles.cs + + AssignUserGroups.cs Designer @@ -246,6 +257,10 @@ MainForm.cs Designer + + AssignRoleGroups.cs + Designer + UserForm.cs Designer diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.Designer.cs b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.Designer.cs new file mode 100644 index 0000000..56adf02 --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.Designer.cs @@ -0,0 +1,180 @@ +namespace Tanshu.Accounts.PointOfSale +{ + partial class AssignGroupRoles + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lstRoles = new System.Windows.Forms.ListBox(); + this.lstGroupRoles = new System.Windows.Forms.ListBox(); + this.cmbGroup = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.btnAddSelected = new System.Windows.Forms.Button(); + this.btnAddAll = new System.Windows.Forms.Button(); + this.btnRemoveSelected = new System.Windows.Forms.Button(); + this.btnRemoveAll = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lstGroups + // + this.lstRoles.FormattingEnabled = true; + this.lstRoles.Location = new System.Drawing.Point(12, 59); + this.lstRoles.Name = "lstGroups"; + this.lstRoles.ScrollAlwaysVisible = true; + this.lstRoles.Size = new System.Drawing.Size(183, 225); + this.lstRoles.TabIndex = 0; + // + // lstUserGroups + // + this.lstGroupRoles.FormattingEnabled = true; + this.lstGroupRoles.Location = new System.Drawing.Point(274, 59); + this.lstGroupRoles.Name = "lstUserGroups"; + this.lstGroupRoles.ScrollAlwaysVisible = true; + this.lstGroupRoles.Size = new System.Drawing.Size(183, 225); + this.lstGroupRoles.TabIndex = 1; + // + // cmbGroup + // + this.cmbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbGroup.FormattingEnabled = true; + this.cmbGroup.Location = new System.Drawing.Point(82, 12); + this.cmbGroup.Name = "cmbGroup"; + this.cmbGroup.Size = new System.Drawing.Size(375, 21); + this.cmbGroup.TabIndex = 2; + this.cmbGroup.SelectedIndexChanged += new System.EventHandler(this.cmbUsers_SelectedIndexChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(67, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Group Name"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 43); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(76, 13); + this.label2.TabIndex = 5; + this.label2.Text = "Pending Roles"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(271, 43); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(80, 13); + this.label3.TabIndex = 6; + this.label3.Text = "Assigned Roles"; + // + // btnAddSelected + // + this.btnAddSelected.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAddSelected.Location = new System.Drawing.Point(201, 105); + this.btnAddSelected.Name = "btnAddSelected"; + this.btnAddSelected.Size = new System.Drawing.Size(67, 25); + this.btnAddSelected.TabIndex = 7; + this.btnAddSelected.Text = ">"; + this.btnAddSelected.UseVisualStyleBackColor = true; + this.btnAddSelected.Click += new System.EventHandler(this.btnAddSelected_Click); + // + // btnAddAll + // + this.btnAddAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnAddAll.Location = new System.Drawing.Point(201, 136); + this.btnAddAll.Name = "btnAddAll"; + this.btnAddAll.Size = new System.Drawing.Size(67, 25); + this.btnAddAll.TabIndex = 8; + this.btnAddAll.Text = ">>"; + this.btnAddAll.UseVisualStyleBackColor = true; + this.btnAddAll.Click += new System.EventHandler(this.btnAddAll_Click); + // + // btnRemoveSelected + // + this.btnRemoveSelected.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRemoveSelected.Location = new System.Drawing.Point(201, 167); + this.btnRemoveSelected.Name = "btnRemoveSelected"; + this.btnRemoveSelected.Size = new System.Drawing.Size(67, 25); + this.btnRemoveSelected.TabIndex = 9; + this.btnRemoveSelected.Text = "<"; + this.btnRemoveSelected.UseVisualStyleBackColor = true; + this.btnRemoveSelected.Click += new System.EventHandler(this.btnRemoveSelected_Click); + // + // btnRemoveAll + // + this.btnRemoveAll.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRemoveAll.Location = new System.Drawing.Point(201, 198); + this.btnRemoveAll.Name = "btnRemoveAll"; + this.btnRemoveAll.Size = new System.Drawing.Size(67, 25); + this.btnRemoveAll.TabIndex = 10; + this.btnRemoveAll.Text = "<<"; + this.btnRemoveAll.UseVisualStyleBackColor = true; + this.btnRemoveAll.Click += new System.EventHandler(this.btnRemoveAll_Click); + // + // AssignGroupRoles + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(469, 323); + this.Controls.Add(this.btnRemoveAll); + this.Controls.Add(this.btnRemoveSelected); + this.Controls.Add(this.btnAddAll); + this.Controls.Add(this.btnAddSelected); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.cmbGroup); + this.Controls.Add(this.lstGroupRoles); + this.Controls.Add(this.lstRoles); + this.MaximizeBox = false; + this.Name = "AssignGroupRoles"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Assign Role Groups"; + this.Load += new System.EventHandler(this.AssignGroupRoles_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListBox lstRoles; + private System.Windows.Forms.ListBox lstGroupRoles; + private System.Windows.Forms.ComboBox cmbGroup; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button btnAddSelected; + private System.Windows.Forms.Button btnAddAll; + private System.Windows.Forms.Button btnRemoveSelected; + private System.Windows.Forms.Button btnRemoveAll; + } +} \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.cs b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.cs new file mode 100644 index 0000000..7cf0a04 --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.cs @@ -0,0 +1,119 @@ +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.Helpers; +using System.Threading; +using Tanshu.Accounts.Repository; +using Tanshu.Accounts.Entities.Auth; + +namespace Tanshu.Accounts.PointOfSale +{ + public partial class AssignGroupRoles : Form + { + public AssignGroupRoles() + { + InitializeComponent(); + } + + private void AssignGroupRoles_Load(object sender, EventArgs e) + { + FillUsers(); + } + + private void FillUsers() + { + cmbGroup.DisplayMember = "Name"; + cmbGroup.ValueMember = "GroupID"; + cmbGroup.DataSource = MembershipBI.GetGroups(); + } + + private void cmbUsers_SelectedIndexChanged(object sender, EventArgs e) + { + GetLists(); + } + + private void GetLists() + { + IList roles; + IList roleGroups; + if (cmbGroup.SelectedValue == null) + { + roles = MembershipBI.GetRoles(); + roleGroups = new List(); + + } + else + { + int groupID = (int)cmbGroup.SelectedValue; + roles = MembershipBI.GetRolesNotOfGroup(groupID); + roleGroups = MembershipBI.GetRolesOfGroup(groupID); + } + + RefreshRoles(roles, roleGroups); + } + private void RefreshRoles(IList roles, IList roleGroups) + { + lstRoles.DisplayMember = "Name"; + lstRoles.ValueMember = "RoleID"; + lstRoles.DataSource = roles; + + lstGroupRoles.DisplayMember = "Name"; + lstGroupRoles.ValueMember = "RoleID"; + lstGroupRoles.DataSource = roleGroups; + + btnAddAll.Enabled = btnAddSelected.Enabled = roles.Count > 0; + btnRemoveAll.Enabled = btnRemoveSelected.Enabled = roleGroups.Count > 0; + } + + private void btnAddSelected_Click(object sender, EventArgs e) + { + if (lstRoles.SelectedItem != null) + { + int groupID = (int)cmbGroup.SelectedValue; + int roleID = (int)lstRoles.SelectedValue; + MembershipBI.AddRoleToGroup(roleID, groupID); + GetLists(); + } + } + + private void btnRemoveSelected_Click(object sender, EventArgs e) + { + if (lstGroupRoles.SelectedItem != null) + { + int groupID = (int)cmbGroup.SelectedValue; + int roleID = (int)lstGroupRoles.SelectedValue; + MembershipBI.RemoveRoleFromGroup(roleID, groupID); + GetLists(); + } + } + + private void btnAddAll_Click(object sender, EventArgs e) + { + int groupID = (int)cmbGroup.SelectedValue; + int roleID; + for (int i = 0; i <= lstRoles.Items.Count - 1; i++) + { + roleID = ((Role)lstRoles.Items[i]).RoleID; + MembershipBI.AddRoleToGroup(roleID, groupID); + } + GetLists(); + } + + private void btnRemoveAll_Click(object sender, EventArgs e) + { + int groupID = (int)cmbGroup.SelectedValue; + int roleID; + for (int i = 0; i <= lstGroupRoles.Items.Count - 1; i++) + { + roleID = ((Role)lstGroupRoles.Items[i]).RoleID; + MembershipBI.RemoveRoleFromGroup(roleID, groupID); + } + GetLists(); + } + } +} diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.resx b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignRoleGroups.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs b/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs deleted file mode 100644 index 00ff0cc..0000000 --- a/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.cs +++ /dev/null @@ -1,120 +0,0 @@ -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.Helpers; -using System.Threading; -using Tanshu.Accounts.Repository; - -namespace Tanshu.Accounts.PointOfSale -{ - public partial class AssignRoles : Form - { - public AssignRoles() - { - InitializeComponent(); - } - - private void AssignRoles_Load(object sender, EventArgs e) - { - FillUsers(); - } - - private void FillUsers() - { - cmbUsers.DisplayMember = "Name"; - cmbUsers.ValueMember = "UserID"; - cmbUsers.DataSource = UserBI.GetUsers(); - } - - private void cmbUsers_SelectedIndexChanged(object sender, EventArgs e) - { - RefreshRoles(); - } - - private void RefreshRoles() - { - if (cmbUsers.SelectedValue == null) - { - string[] roles = new MembershipBI().GetAllRoles(); - lstRoles.DataSource = roles; - // lstRoles.DataBind(); - string[] userRoles = new string[0]; - lstUserRoles.DataSource = userRoles; - // lstUserRoles.DataBind(); - - btnAddAll.Enabled = false; - btnAddSelected.Enabled = false; - btnRemoveAll.Enabled = false; - btnRemoveSelected.Enabled = false; - } - else - { - string[] roles = new MembershipBI().GetAllRoles(); - string[] userRoles = new MembershipBI().GetRolesForUser(cmbUsers.Text.Trim()); - roles = roles.Where(r => !userRoles.Contains(r)).ToArray(); - lstRoles.DataSource = roles; - // lstRoles.DataBind(); - - lstUserRoles.DataSource = userRoles; - // lstUserRoles.DataBind(); - - btnAddAll.Enabled = true; - btnAddSelected.Enabled = true; - btnRemoveAll.Enabled = true; - btnRemoveSelected.Enabled = true; - - } - } - - private void btnAddSelected_Click(object sender, EventArgs e) - { - //if (lstRoles.SelectedItem != null) - //{ - // new MembershipBI().AddUsersToRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstRoles.SelectedItem.ToString() }); - // RefreshRoles(); - //} - } - - private void btnRemoveSelected_Click(object sender, EventArgs e) - { - //if (lstUserRoles.SelectedItem != null) - //{ - // new MembershipBI().RemoveUsersFromRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstUserRoles.SelectedItem.ToString() }); - // RefreshRoles(); - //} - } - - private void btnAddAll_Click(object sender, EventArgs e) - { - //for (int i = 0; i <= lstRoles.Items.Count - 1; i++) - //{ - // new MembershipBI().AddUsersToRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstRoles.Items[i].ToString() }); - //} - //RefreshRoles(); - - } - - private void btnRemoveAll_Click(object sender, EventArgs e) - { - //for (int i = 0; i <= lstUserRoles.Items.Count - 1; i++) - //{ - // new MembershipBI().RemoveUsersFromRoles(new string[] { cmbUsers.Text.Trim() }, new string[] { lstUserRoles.Items[i].ToString() }); - //} - //RefreshRoles(); - } - - private void AssignRoles_FormClosing(object sender, FormClosingEventArgs e) - { - //string userName = Thread.CurrentPrincipal.Identity.Name; - //AccountsPrincipal principal = AccountsPrincipal.CreateAccountsPrincipal(new MembershipBI().GetRolesForUser(userName), new MembershipBI().GetUserFromName(userName)); - - //// bind the generic principal to the thread - //Thread.CurrentPrincipal = principal; - } - } -} diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.Designer.cs b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.Designer.cs similarity index 81% rename from Tanshu.Accounts.PointOfSale/User Management/AssignRoles.Designer.cs rename to Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.Designer.cs index 27ce76f..acf753a 100644 --- a/Tanshu.Accounts.PointOfSale/User Management/AssignRoles.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.Designer.cs @@ -1,6 +1,6 @@ namespace Tanshu.Accounts.PointOfSale { - partial class AssignRoles + partial class AssignUserGroups { /// /// Required designer variable. @@ -28,8 +28,8 @@ /// private void InitializeComponent() { - this.lstRoles = new System.Windows.Forms.ListBox(); - this.lstUserRoles = new System.Windows.Forms.ListBox(); + this.lstGroups = new System.Windows.Forms.ListBox(); + this.lstUserGroups = new System.Windows.Forms.ListBox(); this.cmbUsers = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); @@ -40,28 +40,30 @@ this.btnRemoveAll = new System.Windows.Forms.Button(); this.SuspendLayout(); // - // lstRoles + // lstGroups // - this.lstRoles.FormattingEnabled = true; - this.lstRoles.Location = new System.Drawing.Point(12, 59); - this.lstRoles.Name = "lstRoles"; - this.lstRoles.Size = new System.Drawing.Size(183, 225); - this.lstRoles.TabIndex = 0; + this.lstGroups.FormattingEnabled = true; + this.lstGroups.Location = new System.Drawing.Point(12, 59); + this.lstGroups.Name = "lstGroups"; + this.lstGroups.ScrollAlwaysVisible = true; + this.lstGroups.Size = new System.Drawing.Size(183, 225); + this.lstGroups.TabIndex = 0; // - // lstUserRoles + // lstUserGroups // - this.lstUserRoles.FormattingEnabled = true; - this.lstUserRoles.Location = new System.Drawing.Point(274, 59); - this.lstUserRoles.Name = "lstUserRoles"; - this.lstUserRoles.Size = new System.Drawing.Size(183, 225); - this.lstUserRoles.TabIndex = 1; + this.lstUserGroups.FormattingEnabled = true; + this.lstUserGroups.Location = new System.Drawing.Point(274, 59); + this.lstUserGroups.Name = "lstUserGroups"; + this.lstUserGroups.ScrollAlwaysVisible = true; + this.lstUserGroups.Size = new System.Drawing.Size(183, 225); + this.lstUserGroups.TabIndex = 1; // - // cmbUsers + // cmbGroup // this.cmbUsers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbUsers.FormattingEnabled = true; this.cmbUsers.Location = new System.Drawing.Point(72, 12); - this.cmbUsers.Name = "cmbUsers"; + this.cmbUsers.Name = "cmbGroup"; this.cmbUsers.Size = new System.Drawing.Size(276, 21); this.cmbUsers.TabIndex = 2; this.cmbUsers.SelectedIndexChanged += new System.EventHandler(this.cmbUsers_SelectedIndexChanged); @@ -80,18 +82,18 @@ this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 43); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(76, 13); + this.label2.Size = new System.Drawing.Size(83, 13); this.label2.TabIndex = 5; - this.label2.Text = "Pending Roles"; + this.label2.Text = "Pending Groups"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(271, 43); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(80, 13); + this.label3.Size = new System.Drawing.Size(87, 13); this.label3.TabIndex = 6; - this.label3.Text = "Assigned Roles"; + this.label3.Text = "Assigned Groups"; // // btnAddSelected // @@ -137,7 +139,7 @@ this.btnRemoveAll.UseVisualStyleBackColor = true; this.btnRemoveAll.Click += new System.EventHandler(this.btnRemoveAll_Click); // - // AssignRoles + // AssignUserGroups // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -150,14 +152,13 @@ this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.cmbUsers); - this.Controls.Add(this.lstUserRoles); - this.Controls.Add(this.lstRoles); + this.Controls.Add(this.lstUserGroups); + this.Controls.Add(this.lstGroups); this.MaximizeBox = false; - this.Name = "AssignRoles"; + this.Name = "AssignUserGroups"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "AssignRoles"; + this.Text = "Assign User Groups"; this.Load += new System.EventHandler(this.AssignRoles_Load); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AssignRoles_FormClosing); this.ResumeLayout(false); this.PerformLayout(); @@ -165,8 +166,8 @@ #endregion - private System.Windows.Forms.ListBox lstRoles; - private System.Windows.Forms.ListBox lstUserRoles; + private System.Windows.Forms.ListBox lstGroups; + private System.Windows.Forms.ListBox lstUserGroups; private System.Windows.Forms.ComboBox cmbUsers; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.cs b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.cs new file mode 100644 index 0000000..da969cf --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.cs @@ -0,0 +1,119 @@ +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.Helpers; +using System.Threading; +using Tanshu.Accounts.Repository; +using Tanshu.Accounts.Entities.Auth; + +namespace Tanshu.Accounts.PointOfSale +{ + public partial class AssignUserGroups : Form + { + public AssignUserGroups() + { + InitializeComponent(); + } + + private void AssignRoles_Load(object sender, EventArgs e) + { + FillUsers(); + } + + private void FillUsers() + { + cmbUsers.DisplayMember = "Name"; + cmbUsers.ValueMember = "UserID"; + cmbUsers.DataSource = UserBI.GetUsers(); + } + + private void cmbUsers_SelectedIndexChanged(object sender, EventArgs e) + { + GetLists(); + } + + private void GetLists() + { + IList groups; + IList userGroups; + if (cmbUsers.SelectedValue == null) + { + groups = MembershipBI.GetGroups(); + userGroups = new List(); + + } + else + { + int userid = (int)cmbUsers.SelectedValue; + groups = MembershipBI.GetGroupsNotOfUser(userid); + userGroups = MembershipBI.GetGroupsOfUser(userid); + } + + RefreshRoles(groups, userGroups); + } + private void RefreshRoles(IList groups, IList userGroups) + { + lstGroups.DisplayMember = "Name"; + lstGroups.ValueMember = "GroupID"; + lstGroups.DataSource = groups; + + lstUserGroups.DisplayMember = "Name"; + lstUserGroups.ValueMember = "GroupID"; + lstUserGroups.DataSource = userGroups; + + btnAddAll.Enabled = btnAddSelected.Enabled = groups.Count > 0; + btnRemoveAll.Enabled = btnRemoveSelected.Enabled = userGroups.Count > 0; + } + + private void btnAddSelected_Click(object sender, EventArgs e) + { + if (lstGroups.SelectedItem != null) + { + int userID = (int)cmbUsers.SelectedValue; + int groupID = (int)lstGroups.SelectedValue; + MembershipBI.AddUserToGroup(userID, groupID); + GetLists(); + } + } + + private void btnRemoveSelected_Click(object sender, EventArgs e) + { + if (lstUserGroups.SelectedItem != null) + { + int userID = (int)cmbUsers.SelectedValue; + int groupID = (int)lstUserGroups.SelectedValue; + MembershipBI.RemoveUserFromGroup(userID, groupID); + GetLists(); + } + } + + private void btnAddAll_Click(object sender, EventArgs e) + { + int userID = (int)cmbUsers.SelectedValue; + int groupID; + for (int i = 0; i <= lstGroups.Items.Count - 1; i++) + { + groupID = ((Group)lstGroups.Items[i]).GroupID; + MembershipBI.AddUserToGroup(userID, groupID); + } + GetLists(); + } + + private void btnRemoveAll_Click(object sender, EventArgs e) + { + int userID = (int)cmbUsers.SelectedValue; + int groupID; + for (int i = 0; i <= lstUserGroups.Items.Count - 1; i++) + { + groupID = ((Group)lstUserGroups.Items[i]).GroupID; + MembershipBI.RemoveUserFromGroup(userID, groupID); + } + GetLists(); + } + } +} diff --git a/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.resx b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Tanshu.Accounts.PointOfSale/User Management/AssignUserGroups.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs b/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs index 18ecabc..73f2c9c 100644 --- a/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.Designer.cs @@ -136,7 +136,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(287, 145); + this.ClientSize = new System.Drawing.Size(287, 185); this.Controls.Add(this.button2); this.Controls.Add(this.btnCreateUSer); this.Controls.Add(this.txtConfirmPassword); diff --git a/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.cs b/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.cs index 8fe30c9..539cba1 100644 --- a/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.cs +++ b/Tanshu.Accounts.PointOfSale/User Management/ChangePassword.cs @@ -4,14 +4,29 @@ using Tanshu.Accounts.Repository; using Tanshu.Accounts.Contracts; using Tanshu.Accounts.Helpers; using Tanshu.Accounts.Entities.Auth; +using Tanshu.Common.KeyboardControl; namespace Tanshu.Accounts.PointOfSale { public partial class ChangePassword : Form { - public ChangePassword() + IKeyboardControl keyboardControl; + public ChangePassword(IKeyboardControl keyboardControl) { InitializeComponent(); + this.keyboardControl = keyboardControl; + + var control = keyboardControl as UserControl; + if (control != null) + { + control.Location = new System.Drawing.Point(6, 140); + var border = (this.Width - this.ClientSize.Width) / 2; + var titlebarHeight = this.Height - this.ClientSize.Height - (2 * border); + this.Controls.Add(control); + this.Width = 6 + control.Width + 6 + (border * 2); + this.Height = titlebarHeight + 140 + control.Height + 6 + (border * 2); + } + } private void ChangePassword_Load(object sender, EventArgs e) diff --git a/Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs b/Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs index 6ae5a4b..acbc47a 100644 --- a/Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs +++ b/Tanshu.Accounts.PointOfSale/User Management/RoleFactoryBI.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading; using Tanshu.Accounts.Repository; +using Tanshu.Accounts.Contracts; namespace Tanshu.Accounts.PointOfSale { @@ -11,13 +12,13 @@ namespace Tanshu.Accounts.PointOfSale { private RoleFactoryBI() { } - public static RoleBI GetRoleBI(string roleID) + private static RoleBI GetRoleBI(RoleConstants role) { RoleBI roleBI; if (Session.User != null) - roleBI = new RoleBI(roleID, Session.User.UserID); + roleBI = new RoleBI(role.Role, Session.User.UserID); else - roleBI = new RoleBI(roleID, -1); + roleBI = new RoleBI(role.Role, -1); return roleBI; //bool repeat = true; //while (!roleBI.IsAllowed && repeat) diff --git a/Tanshu.Accounts.Print/Thermal.cs b/Tanshu.Accounts.Print/Thermal.cs index ad12b36..375e363 100644 --- a/Tanshu.Accounts.Print/Thermal.cs +++ b/Tanshu.Accounts.Print/Thermal.cs @@ -221,10 +221,31 @@ namespace Tanshu.Accounts.Print printText += DrawLine; foreach (SalesAnalysis d in det) { - if (d.Section.Length > 30) - d.Section = d.Section.Substring(0, 30); - printText += string.Format("\n\r{0,-22} {1,9:#,##0} {2,9:#,##0}", d.Section, d.Net, d.Gross); - printText += DrawLine; + printText += string.Format("\n\r {0,-22} {1,9:#,##0}", d.GroupType, d.Amount); + } + printText += DrawEqual; + return PrintRAW(PrintLocationBI.BasePrinter, printText, "Sale Detail " + user); + } + catch (Exception ex) + { + throw ex; + } + + } + + public static Boolean PrintSale(string user, IList list, DateTime startDate, DateTime endDate) + { + string printText; + try + { + printText = FormatText(user, 42, false, Align.Centre); + printText += DrawLine; + printText += "\n\r" + FormatText(string.Format("{0:dd-MMM-yyyy HH:mm:ss}", DateTime.Now), 42, false, Align.Centre); + printText += "\n\r" + FormatText(string.Format("{0:dd-MMM-yyyy} to {1:dd-MMM-yyyy}", startDate, endDate), 42, false, Align.Centre); + 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 += DrawEqual; return PrintRAW(PrintLocationBI.BasePrinter, printText, "Sale Detail " + user); @@ -284,16 +305,19 @@ namespace Tanshu.Accounts.Print try { BillText = FormatText(string.Format("{0} Checkout By {1}", details.Cashier.Name, details.Manager), 42, false, Align.Centre); - BillText += string.Format("{0:dd-MMM-yy} To {1:dd-MMM-yy} @ {2:dd-MMM-yyyy HH:mm}", details.StartDate, details.FinishDate, DateTime.Now); + BillText += string.Format("\n\r{0:dd-MMM-yy} To {1:dd-MMM-yy} @ {2:dd-MMM-yyyy HH:mm}", details.StartDate, details.FinishDate, DateTime.Now); BillText += DrawLine; - BillText += string.Format("\n\rOpening : {0,26:#,##0.00}", details.Opening); - BillText += string.Format("\n\rReceipts : {0,26:#,##0.00}", details.Receipts); + //BillText += string.Format("\n\rOpening : {0,26:#,##0.00}", details.Opening); + //BillText += string.Format("\n\rReceipts : {0,26:#,##0.00}", details.Receipts); BillText += string.Format("\n\rAdvance Rcv. : {0,26:#,##0.00}", details.AdvanceReceipts); BillText += string.Format("\n\rCC Receipts : {0,26:#,##0.00}", details.CCReceipts); + BillText += string.Format("\n\rNC Amount : {0,26:#,##0.00}", details.NCReceipts); + BillText += string.Format("\n\rBTC Amount : {0,26:#,##0.00}", details.BTCReceipts); BillText += string.Format("\n\rAdvance Adj. : {0,26:#,##0.00}", details.AdvanceAdjusted); - BillText += string.Format("\n\rPayments : {0,26:#,##0.00}", details.CashPayments); - BillText += string.Format("\n\rAddl. Voids : {0,26:#,##0.00}", details.AdditionalVoids); + //BillText += string.Format("\n\rPayments : {0,26:#,##0.00}", details.CashPayments); + //BillText += string.Format("\n\rAddl. Voids : {0,26:#,##0.00}", details.AdditionalVoids); BillText += string.Format("\n\rVoids in Sys. : {0,26:#,##0.00}", details.VoidsInSystem); + BillText += string.Format("\n\rDiscounts : {0,26:#,##0.00}", details.Discount); BillText += string.Format("\n\rPending Bills : {0,26:#,##0.00}", details.PendingBills); BillText += string.Format("\n\rNet Sales : {0,26:#,##0.00}", details.NetSales); BillText += string.Format("\n\rClosing Bal. : {0,26:#,##0.00}", details.ClosingBalance); @@ -313,6 +337,15 @@ namespace Tanshu.Accounts.Print if (details.CCString.Length > 0) BillText += details.CCString; + if (details.NCString.Length > 0) + BillText += details.NCString; + + if (details.BTCString.Length > 0) + BillText += details.BTCString; + + if (details.StaffString.Length > 0) + BillText += details.StaffString; + if (details.VoidsString.Length > 0) BillText += details.VoidsString; @@ -336,7 +369,7 @@ namespace Tanshu.Accounts.Print return FormatText(InputString, 24, false, Align.Right); } - public static void PrintBill(bool bill, int voucherID, List list) + public static void PrintBill(int voucherID, List list) { SaleVoucher trans = new SaleVoucher(); IList iList = new List(); diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/CheckoutBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/CheckoutBI.cs index 4dd00e1..5ce2308 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/CheckoutBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/CheckoutBI.cs @@ -9,6 +9,7 @@ using Tanshu.Accounts.SqlDAO; using Tanshu.Accounts.Entities; using Tanshu.Accounts.Entities.Auth; using NHibernate.Criterion; +using Tanshu.Accounts.Contracts; namespace Tanshu.Accounts.Repository { @@ -21,10 +22,12 @@ namespace Tanshu.Accounts.Repository public decimal CCReceipts { get; private set; } public decimal NCReceipts { get; private set; } public decimal BTCReceipts { get; private set; } + public decimal StaffReceipts { get; private set; } public decimal AdvanceAdjusted { get; private set; } public decimal CashPayments { get; private set; } public decimal AdditionalVoids { get; private set; } public decimal VoidsInSystem { get; private set; } + public decimal Discount { get; private set; } public decimal PendingBills { get; private set; } public decimal NetSales { get; private set; } public decimal ClosingBalance { get; private set; } @@ -46,18 +49,14 @@ namespace Tanshu.Accounts.Repository public string CCString { get; private set; } public string NCString { get; private set; } public string BTCString { get; private set; } + public string StaffString { get; private set; } public string VoidsString { get; private set; } public string DiscountString { get; private set; } - //public string PendingString { get; private set; } // - //public string CCString { get; private set; } // - //public string VoidsString { get; private set; } - //public string DiscountString { get; private set; } - - public string PaymentString { get; private set; } // + public string PaymentString { get; private set; } public string Manager { - get { return Thread.CurrentPrincipal.Identity.Name; } + get { return Session.User.Name; } } #endregion @@ -65,10 +64,9 @@ namespace Tanshu.Accounts.Repository { using (var session = SessionManager.Session) { - //Actual Closing this.Cashier = UserBI.GetUser(cashier); - this.StartDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", startDate)); - this.FinishDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", finishDate)); + this.StartDate = startDate.Date.AddHours(6); + this.FinishDate = finishDate.Date.AddDays(1).AddHours(5); string info; PendingBills = GetPending(out info); @@ -79,10 +77,13 @@ namespace Tanshu.Accounts.Repository NCString = info; BTCReceipts = GetBillToCompany(out info); BTCString = info; + StaffReceipts = GetStaffBills(out info); + StaffString = info; VoidsInSystem = GetVoids(out info); VoidsString = info; // Opening = dao.GetOpenings(); // Receipts = GetReceipts(); + PaymentString = ""; // CashPayments = dao.GetPayments(); // AdditionalVoids = dao.GetAdditionalVoids(); // RetainedOvernight = dao.GetRetainedOvernight(); @@ -96,14 +97,15 @@ namespace Tanshu.Accounts.Repository // OldVoided = dao.GetOldVoided(); - //Cashiers = GetActiveCashiers(); + Cashiers = GetActiveCashiers(); NetSales = GetNetSales(); - GetDiscountBills(.1M, out info); + Discount = GetDiscountBills(.1M, out info); DiscountString = info; ClosingBalance = Opening + Receipts + AdvanceReceipts - CCReceipts + - BTCReceipts - AdvanceAdjusted - CashPayments - AdditionalVoids @@ -147,6 +149,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- Pending Bills ------------------------"; var list = (from i in session.QueryOver() where i.LastEditDate >= StartDate && @@ -155,7 +158,7 @@ namespace Tanshu.Accounts.Repository i.Void == false && i.Settled == SettleOptionFactory.OUnsettled select i).List(); - GetInfo(list, out amount, ref info); + GetInfo(list, out amount, out discount, ref info); return amount; } } @@ -164,6 +167,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- No Charge ----------------------------"; var list = (from i in session.QueryOver() where i.LastEditDate >= StartDate && @@ -172,7 +176,7 @@ namespace Tanshu.Accounts.Repository i.Void == false && i.Settled == SettleOptionFactory.ONoCharge select i).List(); - GetInfo(list, out amount, ref info); + GetInfo(list, out amount, out discount, ref info); return amount; } } @@ -181,6 +185,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- Bill To Company ----------------------"; var list = (from i in session.QueryOver() where i.LastEditDate >= StartDate && @@ -189,7 +194,25 @@ namespace Tanshu.Accounts.Repository i.Void == false && i.Settled == SettleOptionFactory.OBillToCompany select i).List(); - GetInfo(list, out amount, ref info); + GetInfo(list, out amount, out discount, ref info); + return amount; + } + } + private decimal GetStaffBills(out string info) + { + using (var session = SessionManager.Session) + { + decimal amount; + decimal discount; + info = "\n\r--- Staff Bills --------------------------"; + var list = (from i in session.QueryOver() + where i.LastEditDate >= StartDate && + i.LastEditDate <= FinishDate && + i.User == Cashier && + i.Void == false && + i.Settled == SettleOptionFactory.OStaff + select i).List(); + GetInfo(list, out amount, out discount, ref info); return amount; } } @@ -198,6 +221,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- Credit Card Bills --------------------"; var list = (from i in session.QueryOver() where i.LastEditDate >= StartDate && @@ -206,7 +230,7 @@ namespace Tanshu.Accounts.Repository i.Void == false && i.Settled == SettleOptionFactory.OCreditCard select i).List(); - GetInfo(list, out amount, ref info); + GetInfo(list, out amount, out discount, ref info); return amount; } } @@ -215,6 +239,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- Void Bills ---------------------------"; var list = (from i in session.QueryOver() where i.LastEditDate >= StartDate && @@ -222,7 +247,7 @@ namespace Tanshu.Accounts.Repository i.User == Cashier && i.Void == true select i).List(); - GetInfo(list, out amount, ref info); + GetInfo(list, out amount, out discount, ref info); return amount; } } @@ -231,10 +256,11 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { decimal amount; + decimal discount; info = "\n\r--- High Discount Bills ------------------"; string query = @" -select v from SaleVoucher v -inner join v.Inventories i +select distinct(v) from SaleVoucher v +inner join v.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) @@ -246,8 +272,8 @@ and i.Discount >= :discount"; .SetParameter("discount", disount) .List(); - GetInfo(list, out amount, ref info); - return amount; + GetInfo(list, out amount, out discount, ref info); + return discount; } } @@ -271,9 +297,10 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and } } - private void GetInfo(IList list, out decimal amount, ref string info) + private void GetInfo(IList list, out decimal amount, out decimal discount, ref string info) { amount = 0; + discount = 0; if (list.Count == 0) { info = string.Empty; @@ -284,11 +311,31 @@ where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and { decimal amt, disc; amt = item.Inventories.Sum(x => x.Amount); - disc = item.Inventories.Sum(x => x.Quantity * x.Rate * (1 + x.Tax) * (1 + x.ServiceCharge) * x.Discount); + disc = item.Inventories.Sum(x => x.Quantity * x.Rate * x.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------------------------------------------"; amount += amt; + discount += disc; + } + } + + private string GetActiveCashiers() + { + string cashiers = ""; + using (var session = SessionManager.Session) + { + string query = @" +select distinct(u.Name) from SaleVoucher v +inner join v.User u +where v.Date >= :startDate and v.Date <= :finishDate"; + var list = session.CreateQuery(query) + .SetParameter("startDate", StartDate) + .SetParameter("finishDate", FinishDate) + .List(); + foreach (var item in list) + cashiers += item + ", "; + return cashiers; } } } diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/CustomerBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/CustomerBI.cs index 7c901c4..02a85b9 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/CustomerBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/CustomerBI.cs @@ -60,9 +60,16 @@ namespace Tanshu.Accounts.Repository } } - public List GetFilteredCustomers(Dictionary filter) + public IList GetFilteredCustomers(Dictionary filter) { - throw new NotImplementedException(); + + using (var session = SessionManager.Session) + { + string name = string.Format("%{0}%", filter["Universal"]); + return session.CreateCriteria() + .Add(Restrictions.Like("Name", name)) + .List(); + } } } } diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/MembershipBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/MembershipBI.cs index 57d889d..9bbd873 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/MembershipBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/MembershipBI.cs @@ -14,75 +14,55 @@ using NHibernate; namespace Tanshu.Accounts.Repository { - public class MembershipBI + public static class MembershipBI { - public void AddUserToGroup(int userID, int groupID) - { - using (var session = SessionManager.Session) - { - var user = session.Get(userID); - var group = session.Get(groupID); - var userGroup = session.CreateCriteria() - .Add(Restrictions.Eq("UserID", userID)) - .Add(Restrictions.Eq("GroupID", groupID)) - .UniqueResult(); - if (userGroup == null) - session.Save( - new UserGroup() - { - User = user, - Group = group - } - ); - } - } - public string[] GetAllRoles() - { - using (var session = SessionManager.Session) - { - var roleList = session.CreateCriteria().List(); - string[] list = new string[roleList.Count]; - for (int i = 0; i < list.Length; i++) - { - list[i] = roleList[i].Name; - } - return list; - } - } + //public string[] GetAllRoles() + //{ + // using (var session = SessionManager.Session) + // { + // var roleList = session.CreateCriteria().List(); + // string[] list = new string[roleList.Count]; + // for (int i = 0; i < list.Length; i++) + // { + // list[i] = roleList[i].Name; + // } + // return list; + // } + //} - public string[] GetRolesForUser(string username) - { - using (var session = SessionManager.Session) - { - var user = session.CreateCriteria() - .Add(Restrictions.Eq("Name", username)) - .UniqueResult(); + //public string[] GetRolesForUser(string username) + //{ + // using (var session = SessionManager.Session) + // { + // var user = session.CreateCriteria() + // .Add(Restrictions.Eq("Name", username)) + // .UniqueResult(); - List roles = new List(); - foreach (var group in user.Groups) - { - foreach (var item in group.RoleGroups) - { - roles.Add(item.Role.Name); - } - } - return roles.ToArray(); - } - } + // List roles = new List(); + // foreach (var group in user.Groups) + // { + // foreach (var item in group.RoleGroups) + // { + // roles.Add(item.Role.Name); + // } + // } + // return roles.ToArray(); + // } + //} - public bool IsUserInRole(string username, string roleName) - { - using (var session = SessionManager.Session) - { - var user = session.CreateCriteria() - .Add(Restrictions.Eq("Name", username)) - .UniqueResult(); - return IsUserInRole(user.UserID, roleName); - } - } + //public bool IsUserInRole(string username, string roleName) + //{ + // using (var session = SessionManager.Session) + // { + // var user = session.CreateCriteria() + // .Add(Restrictions.Eq("Name", username)) + // .UniqueResult(); + // return IsUserInRole(user.UserID, roleName); + // } + //} - public bool IsUserInRole(int userID, string roleName) + public static bool IsUserInRole(int userID, string roleName) { string query = @" SELECT COUNT(*) AS Role_Count FROM @@ -93,24 +73,139 @@ WHERE ug.UserID = :UserID AND r.Name = :Role;"; { return session .CreateSQLQuery(query) - .AddScalar("Role_Count",NHibernateUtil.Int32) + .AddScalar("Role_Count", NHibernateUtil.Int32) .SetInt32("UserID", userID) .SetString("Role", roleName) .UniqueResult() > 0; } } - - public void RemoveUserFromGroup(int userID, int groupID) + #region UserGroup + public static IList GetGroups() { using (var session = SessionManager.Session) { - var userGroup = session.CreateCriteria() - .Add(Restrictions.Eq("UserID", userID)) - .Add(Restrictions.Eq("GroupID", groupID)) - .UniqueResult(); - if (userGroup != null) - session.Delete(userGroup); + return session.CreateCriteria() + .List(); } } + public static IList GetGroupsOfUser(int userID) + { + using (var session = SessionManager.Session) + { + string query = "select ug.Group from UserGroup ug where ug.User.UserID = :userID"; + var list = session.CreateQuery(query) + .SetParameter("userID", userID) + .List(); + foreach (var item in list) + NHibernateUtil.Initialize(item); + return list; + } + } + public static IList GetGroupsNotOfUser(int userID) + { + using (var session = SessionManager.Session) + { + string query = "select g from Group g where g not in (select ug.Group from UserGroup ug where ug.User.UserID = :userID)"; + var list = session.CreateQuery(query) + .SetParameter("userID", userID) + .List(); + foreach (var item in list) + NHibernateUtil.Initialize(item); + return list; + } + } + public static void AddUserToGroup(int userID, int groupID) + { + using (var session = SessionManager.Session) + { + var userGroup = session.CreateQuery("select count(*) from UserGroup ug where ug.User.UserID = :userID and ug.Group.GroupID = :groupID") + .SetParameter("userID", userID) + .SetParameter("groupID", groupID) + .UniqueResult(); + if (userGroup == 0) + { + var user = session.Get(userID); + var group = session.Get(groupID); + session.Save(new UserGroup() { User = user, Group = group }); + } + } + } + public static void RemoveUserFromGroup(int userID, int groupID) + { + using (var session = SessionManager.Session) + { + string query = "delete UserGroup ug where ug.User.UserID = :userID and ug.Group.GroupID = :groupID"; + session.CreateQuery(query) + .SetParameter("userID", userID) + .SetParameter("groupID", groupID) + .ExecuteUpdate(); + } + } + #endregion + #region RoleGroup + public static IList GetRoles() + { + using (var session = SessionManager.Session) + { + return session.CreateCriteria() + .List(); + } + } + public static IList GetRolesOfGroup(int groupID) + { + using (var session = SessionManager.Session) + { + string query = "select rg.Role from RoleGroup rg where rg.Group.GroupID = :groupID"; + var list = session.CreateQuery(query) + .SetParameter("groupID", groupID) + .List(); + foreach (var item in list) + NHibernateUtil.Initialize(item); + return list; + } + } + public static IList GetRolesNotOfGroup(int groupID) + { + using (var session = SessionManager.Session) + { + string query = "select r from Role r where r not in (select rg.Role from RoleGroup rg where rg.Group.GroupID = :groupID)"; + var list = session.CreateQuery(query) + .SetParameter("groupID", groupID) + .List(); + foreach (var item in list) + NHibernateUtil.Initialize(item); + return list; + } + } + public static void AddRoleToGroup(int roleID, int groupID) + { + using (var session = SessionManager.Session) + { + var roleGroup = session.CreateQuery("select count(*) from RoleGroup rg where rg.Role.RoleID = :roleID and rg.Group.GroupID = :groupID") + .SetParameter("roleID", roleID) + .SetParameter("groupID", groupID) + .UniqueResult(); + if (roleGroup == 0) + { + var role = session.Get(roleID); + var group = session.Get(groupID); + session.Save(new RoleGroup() { Role = role, Group = group }); + } + } + } + public static void RemoveRoleFromGroup(int roleID, int groupID) + { + using (var session = SessionManager.Session) + { + string query = "delete RoleGroup rg where rg.Role.RoleID = :roleID and rg.Group.GroupID = :groupID"; + session.CreateQuery(query) + .SetParameter("roleID", roleID) + .SetParameter("groupID", groupID) + .ExecuteUpdate(); + } + } + #endregion + + } } diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/ProductGroupBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/ProductGroupBI.cs index 83596dc..642893d 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/ProductGroupBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/ProductGroupBI.cs @@ -48,6 +48,7 @@ namespace Tanshu.Accounts.Repository using (var session = SessionManager.Session) { return session.CreateCriteria() + .AddOrder(Order.Asc("Name")) .List(); } } diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/RoleBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/RoleBI.cs index fdcb64e..21164c0 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/RoleBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/RoleBI.cs @@ -9,30 +9,25 @@ namespace Tanshu.Accounts.Repository public delegate bool AuthenticateUser(out string userName); public class RoleBI : IDisposable { - string roleID; + string roleName; int userID; + bool isAllowed; //bool elevated; //AccountsPrincipal originalUser; //AuthenticateUser authenticateUser; - public RoleBI(string roleID, int userID) + public RoleBI(string roleName, int userID) { - this.roleID = roleID; + this.roleName = roleName; this.userID = userID; - //elevated = false; - //originalUser = null; - //authenticateUser = null; + if (userID == 0) + isAllowed = false; + else + isAllowed = MembershipBI.IsUserInRole(userID, this.roleName); disposed = false; } - + public bool IsAllowed - { - get - { - if (userID == 0) - return false; - return new MembershipBI().IsUserInRole(userID, roleID); - } - } + { get { return isAllowed; } } //public bool IsElevated //{ @@ -57,7 +52,7 @@ namespace Tanshu.Accounts.Repository // if (userName.Contains(":")) // userName = userName.Substring(userName.IndexOf(":") + 1); - // Session.User = new MembershipBI().GetUserFromName(userName)); + // Session.User = MembershipBI.GetUserFromName(userName)); // // bind the generic principal to the thread // Thread.CurrentPrincipal = principal; diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/SalesAnalysisBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/SalesAnalysisBI.cs index dc2c29a..d91e006 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/SalesAnalysisBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/SalesAnalysisBI.cs @@ -7,169 +7,163 @@ using Tanshu.Data.DAO; using Tanshu.Accounts.SqlDAO; using Tanshu.Accounts.Entities; using NHibernate.Criterion; +using Tanshu.Common; namespace Tanshu.Accounts.Repository { public class SalesAnalysisBI { - public IList GetSaleDetail(DateTime startDate, DateTime finishDate, int costCenterID) + public ICollection GetSaleDetail(DateTime startDate, DateTime finishDate) { - string query = @" -SELECT p.Name AS Product, pt.Name AS Section, SUM(i.Quantity) AS Quantity, SUM(Amount) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -INNER JOIN Products p ON i.ProductID = p.ProductID -INNER JOIN ProductTypes pt ON p.ProductTypeID = pt.ProductTypeID -INNER JOIN Ledgers l ON p.SaleLedgerID = l.LedgerID -WHERE t.Type = 'S' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN :StartDate AND :FinishDate AND l.CostCenterID = :CostCenterID -GROUP BY p.Name, pt.Name -ORDER BY Amount DESC;"; + + startDate = startDate.Date.AddHours(6); + finishDate = finishDate.Date.AddDays(1).AddHours(5); + if (finishDate <= startDate) + return new List(); + using (var session = SessionManager.Session) { - return session - .CreateSQLQuery(query) - .AddEntity(typeof(SalesAnalysisDetail)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .SetInt32("CostCenterID", costCenterID) - .List(); + var query = @" +select concat(p.Name, ' ', p.Units) as Product, Sum(i.Quantity) as Amount +from SaleVoucher v +inner join v.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 +order by p.ProductGroup, concat(p.Name, ' ', p.Units) +"; + var list = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .List(); + var outList = new OrderedDictionary(); + foreach (var item in list) + outList.Add((string)item[0], new SalesAnalysisDetail() { Product = (string)item[0], Sale = (decimal)item[1] }); + + query = @" +select concat(p.Name, ' ', p.Units) as Product, Sum(i.Quantity) as Amount +from SaleVoucher v +inner join v.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 +order by p.ProductGroup, concat(p.Name, ' ', p.Units) +"; + list = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .List(); + foreach (var item in list) + if (outList.ContainsKey((string)item[0])) + outList[(string)item[0]].NC = (decimal)item[1]; + else + outList.Add((string)item[0], new SalesAnalysisDetail() { Product = (string)item[0], NC = (decimal)item[1] }); + + return outList.Values; } } public IList GetSale(DateTime startDate, DateTime finishDate) { + startDate = startDate.Date.AddHours(6); + finishDate = finishDate.Date.AddDays(1).AddHours(5); + if (finishDate <= startDate) + return new List(); using (var session = SessionManager.Session) { - var temp = from sal in session.QueryOver() - where sal.Date >= startDate && sal.Date <= finishDate - && sal.Settled != SettleOptionFactory.ONoCharge && sal.Void == false - select sal.Inventories; - - string query = @" -SELECT c.CostCenterID AS TypeID, c.Name AS Section, SUM(i.Quantity) AS Quantity, SUM(Amount) AS Gross, SUM(i.Quantity * i.Rate * (1 - Discount)) AS Net -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -INNER JOIN Products p ON i.ProductID = p.ProductID -INNER JOIN Ledgers l ON p.SaleLedgerID = l.LedgerID -INNER JOIN CostCenters c ON l.CostCenterID = c.CostCenterID -WHERE t.Type = 's' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate -GROUP BY c.CostCenterID, c.Name -ORDER BY Net DESC;"; - return session - .CreateSQLQuery(query) - .AddEntity(typeof(SalesAnalysis)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .List(); + 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 +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 +group by g.GroupType +order by g.GroupType +"; + var list = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .List(); + var outList = new List(); + foreach (var item in list) + outList.Add(new SalesAnalysis() { GroupType = (string)item[0], Amount = (decimal)item[1] }); + return GetSettlement(outList, startDate, finishDate); } } - public void GetAdditionalInfo(ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax, DateTime startDate, DateTime finishDate) + private IList GetSettlement(IList outList, DateTime startDate, DateTime finishDate) { - string query; + outList.Add(new SalesAnalysis() { GroupType = " -- ", Amount = 0 }); + if (finishDate <= startDate) + return new List(); using (var session = SessionManager.Session) { - query = @" -SELECT ISNULL(SUM(Quantity * Rate), 0) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 's' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate -AND i.Amount = 0"; - freeSale = session - .CreateSQLQuery(query) - .AddEntity(typeof(decimal)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .UniqueResult(); - freeSale = Math.Round(freeSale); - - query = @" -SELECT ISNULL(SUM(Amount), 0) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 's' -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate -AND s.Void = 1"; - voids = session - .CreateSQLQuery(query) - .AddEntity(typeof(decimal)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .UniqueResult(); - voids = Math.Round(voids); - - query = @" -SELECT ISNULL(SUM(Amount), 0) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 's' AND s.Paid = 0 AND s.Void = 0 -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate -ORDER BY Amount DESC;"; - pending = session - .CreateSQLQuery(query) - .AddEntity(typeof(decimal)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .UniqueResult(); - pending = Math.Round(pending); - - query = @" -SELECT ISNULL(SUM(Quantity * Rate * (1 - Discount )), 0) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 's' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate"; - net = session - .CreateSQLQuery(query) - .AddEntity(typeof(decimal)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .UniqueResult(); - net = Math.Round(net); - - query = @" -SELECT ISNULL(SUM(Amount), 0) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -WHERE t.Type = 's' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN @StartDate AND @FinishDate"; - tax = session - .CreateSQLQuery(query) - .AddEntity(typeof(decimal)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .UniqueResult(); - tax = Math.Round(tax); + 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 +where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.Settled != :noCharge +group by s.Name +order by s.Name +"; + var list = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .List(); + foreach (var item in list) + outList.Add(new SalesAnalysis() { GroupType = (string)item[0], Amount = (decimal)item[1] }); + return GetOtherDetails(outList, startDate, finishDate); } } - public IList GetSalesTaxReturn(DateTime startDate, DateTime finishDate, ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax) + private IList GetOtherDetails(IList outList, DateTime startDate, DateTime finishDate) { - IList list = new List(); - - string query; + outList.Add(new SalesAnalysis() { GroupType = " -- ", Amount = 0 }); + if (finishDate <= startDate) + return new List(); using (var session = SessionManager.Session) { + #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 +"; + var amt = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .UniqueResult(); + outList.Add(new SalesAnalysis() { GroupType = "Service Charge", Amount = (decimal)amt }); + #endregion + #region Tax query = @" -SELECT p.Name AS Product, pt.Name AS Section, SUM(i.Quantity) AS Quantity, SUM(Amount) AS Amount -FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID -INNER JOIN Inventory i ON t.VoucherID = i.VoucherID -INNER JOIN Products p ON i.ProductID = p.ProductID -INNER JOIN ProductTypes pt ON p.ProductTypeID = pt.ProductTypeID -INNER JOIN Ledgers l ON p.SaleLedgerID = l.LedgerID -WHERE t.Type = 'S' AND s.Paid = 1 AND s.Void = 0 -AND t.LastEditDate BETWEEN :StartDate AND :FinishDate AND l.CostCenterID = :CostCenterID -GROUP BY p.Name, pt.Name -ORDER BY Amount DESC;"; - list = session - .CreateSQLQuery(query) - .AddEntity(typeof(SalesAnalysis)) - .SetDateTime("StartDate", startDate) - .SetDateTime("FinishDate", finishDate) - .List(); +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 +group by i.Tax +"; + var list = session + .CreateQuery(query) + .SetParameter("startDate", startDate) + .SetParameter("finishDate", finishDate) + .SetParameter("noCharge", SettleOptionFactory.NoCharge) + .List(); + foreach (var item in list) + outList.Add(new SalesAnalysis() { GroupType = string.Format("Tax {0:P}", (decimal)item[0]), Amount = (decimal)item[1] }); + #endregion + return outList; } - GetAdditionalInfo(ref freeSale, ref voids, ref pending, ref net, ref tax, startDate, finishDate); - return list; } } } diff --git a/Tanshu.Accounts.SqlDAO/BusinessLayer/UserBI.cs b/Tanshu.Accounts.SqlDAO/BusinessLayer/UserBI.cs index e99bffc..84bcd0d 100644 --- a/Tanshu.Accounts.SqlDAO/BusinessLayer/UserBI.cs +++ b/Tanshu.Accounts.SqlDAO/BusinessLayer/UserBI.cs @@ -64,20 +64,29 @@ namespace Tanshu.Accounts.Repository } public static IList GetFilteredUsers(Dictionary filter) { - throw new NotImplementedException(); + using (var session = SessionManager.Session) + { + return session.CreateCriteria() + .Add(Restrictions.Like("Name", string.Format("%{0}%", filter["Name"]))) + .List(); + } } public static bool ChangePassword(User userData, string newPassword) { using (var session = SessionManager.Session) { - var dbUser = session.CreateCriteria() - .Add(Restrictions.Eq("Name", userData.Name)) - .Add(Restrictions.Eq("Password", userData.Password)) - .UniqueResult(); - if (dbUser == null) - return false; - dbUser.Password = newPassword; - session.Update(dbUser); + using (var trans = session.BeginTransaction()) + { + var dbUser = session.CreateCriteria() + .Add(Restrictions.Eq("Name", userData.Name)) + .Add(Restrictions.Eq("Password", userData.Password)) + .UniqueResult(); + if (dbUser == null) + return false; + dbUser.Password = newPassword; + session.Update(dbUser); + trans.Commit(); + } return true; } } diff --git a/Tanshu.Accounts.SqlDAO/Fluent/Fixtures.cs b/Tanshu.Accounts.SqlDAO/Fluent/Fixtures.cs index 31e7b88..9c7702c 100644 --- a/Tanshu.Accounts.SqlDAO/Fluent/Fixtures.cs +++ b/Tanshu.Accounts.SqlDAO/Fluent/Fixtures.cs @@ -4,6 +4,8 @@ using NHibernate.Tool.hbm2ddl; using Tanshu.Accounts.Entities; using Tanshu.Accounts.Entities.Auth; using Tanshu.Accounts.SqlDAO; +using System.Reflection; +using Tanshu.Accounts.Contracts; namespace Tanshu.Accounts.Repository { @@ -41,29 +43,16 @@ namespace Tanshu.Accounts.Repository { using (var session = SessionManager.StatelessSession) { - session.Insert(GetRole(1, "Sales/Checkout")); - session.Insert(GetRole(2, "Sales/SalesBill")); - session.Insert(GetRole(3, "Sales/SaleDetail")); - session.Insert(GetRole(4, "Sales/VoidPrintedBill")); - session.Insert(GetRole(5, "Sales/EditBill")); - session.Insert(GetRole(6, "Sales/PrintKOT")); - session.Insert(GetRole(7, "Sales/PrintBill")); - session.Insert(GetRole(8, "Sales/EditPrintedProduct")); - session.Insert(GetRole(9, "Sales/ChangeRate")); - session.Insert(GetRole(10, "Master/Products")); - session.Insert(GetRole(11, "Security/ManageRoles")); - session.Insert(GetRole(12, "Log/View")); - session.Insert(GetRole(13, "Master/Owner")); + + FieldInfo[] list = typeof(RoleConstants).GetFields(BindingFlags.Public | BindingFlags.Static); + // write method names + foreach (var item in list) + { + var role = (RoleConstants)item.GetValue(null); + session.Insert(new Role() { Name = role.Role }); + } } } - private static Role GetRole(int roleID, string name) - { - return new Role() - { - RoleID = roleID, - Name = name - }; - } #endregion #region user public static void InsertUser() @@ -91,10 +80,12 @@ namespace Tanshu.Accounts.Repository { session.Insert(GetGroup(1, "owner")); session.Insert(GetGroup(2, "waiter")); - session.Insert(GetGroup(3, "captain")); - session.Insert(GetGroup(4, "manager")); - session.Insert(GetGroup(5, "controller")); - session.Insert(GetGroup(6, "accountant")); + session.Insert(GetGroup(3, "cashier")); + session.Insert(GetGroup(4, "captain")); + session.Insert(GetGroup(5, "senior captain")); + session.Insert(GetGroup(6, "manager")); + session.Insert(GetGroup(7, "controller")); + session.Insert(GetGroup(8, "accountant")); } } private static Group GetGroup(int groupID, string name) @@ -130,7 +121,8 @@ namespace Tanshu.Accounts.Repository { using (var session = SessionManager.StatelessSession) { - var owner = session.Get(1); + #region owner + var group = session.Get(1); var list = session.CreateCriteria() .List(); foreach (var item in list) @@ -138,9 +130,74 @@ namespace Tanshu.Accounts.Repository session.Insert(new RoleGroup() { Role = item, - Group = owner + Group = group }); } + #endregion + #region waiter + group = session.Get(2); + var role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.PRINT_KOT.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() + { + Role = role, + Group = group + }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.SALES.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() + { + Role = role, + Group = group + }); + #endregion + #region cashier + group = session.Get(3); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.PRINT_BILL.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.SALES.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.SETTLE_BILL.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.DISCOUNT.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + #endregion + #region senior captain + group = session.Get(5); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.EDIT_PRINTED_PRODUCT.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + #endregion + #region manager + group = session.Get(6); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.CHANGE_RATE.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.VOID_BILL.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.EDIT_PRINTED_BILL.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + role = session.CreateCriteria() + .Add(Restrictions.Eq("Name", RoleConstants.PRODUCTS.Role)) + .UniqueResult(); + session.Insert(new RoleGroup() { Role = role, Group = group }); + #endregion } } #endregion @@ -360,66 +417,34 @@ namespace Tanshu.Accounts.Repository { using (var session = SessionManager.StatelessSession) { - session.Insert(new FoodTable() { Location = "", Name = "1" }); - session.Insert(new FoodTable() { Location = "", Name = "2" }); - session.Insert(new FoodTable() { Location = "", Name = "3" }); - session.Insert(new FoodTable() { Location = "", Name = "4" }); - session.Insert(new FoodTable() { Location = "", Name = "5" }); - session.Insert(new FoodTable() { Location = "", Name = "6" }); - session.Insert(new FoodTable() { Location = "", Name = "7" }); - session.Insert(new FoodTable() { Location = "", Name = "8" }); - session.Insert(new FoodTable() { Location = "", Name = "9" }); - session.Insert(new FoodTable() { Location = "", Name = "10" }); - session.Insert(new FoodTable() { Location = "", Name = "11" }); - session.Insert(new FoodTable() { Location = "", Name = "12" }); - session.Insert(new FoodTable() { Location = "", Name = "13" }); - session.Insert(new FoodTable() { Location = "", Name = "14" }); - session.Insert(new FoodTable() { Location = "", Name = "15" }); - session.Insert(new FoodTable() { Location = "", Name = "16" }); - session.Insert(new FoodTable() { Location = "", Name = "17" }); - session.Insert(new FoodTable() { Location = "", Name = "18" }); - session.Insert(new FoodTable() { Location = "", Name = "19" }); - session.Insert(new FoodTable() { Location = "", Name = "20" }); - session.Insert(new FoodTable() { Location = "", Name = "21" }); - session.Insert(new FoodTable() { Location = "", Name = "22" }); - session.Insert(new FoodTable() { Location = "", Name = "23" }); - session.Insert(new FoodTable() { Location = "", Name = "24" }); - session.Insert(new FoodTable() { Location = "", Name = "25" }); - session.Insert(new FoodTable() { Location = "", Name = "26" }); - session.Insert(new FoodTable() { Location = "", Name = "27" }); - session.Insert(new FoodTable() { Location = "", Name = "28" }); - session.Insert(new FoodTable() { Location = "", Name = "29" }); - session.Insert(new FoodTable() { Location = "", Name = "30" }); - session.Insert(new FoodTable() { Location = "", Name = "31" }); - session.Insert(new FoodTable() { Location = "", Name = "32" }); - session.Insert(new FoodTable() { Location = "", Name = "33" }); - session.Insert(new FoodTable() { Location = "", Name = "34" }); - session.Insert(new FoodTable() { Location = "", Name = "35" }); - session.Insert(new FoodTable() { Location = "", Name = "36" }); - session.Insert(new FoodTable() { Location = "", Name = "37" }); - session.Insert(new FoodTable() { Location = "", Name = "38" }); - session.Insert(new FoodTable() { Location = "", Name = "39" }); - session.Insert(new FoodTable() { Location = "", Name = "40" }); - session.Insert(new FoodTable() { Location = "", Name = "41" }); - session.Insert(new FoodTable() { Location = "", Name = "42" }); - session.Insert(new FoodTable() { Location = "", Name = "43" }); - session.Insert(new FoodTable() { Location = "", Name = "44" }); - session.Insert(new FoodTable() { Location = "", Name = "45" }); - session.Insert(new FoodTable() { Location = "", Name = "46" }); - session.Insert(new FoodTable() { Location = "", Name = "47" }); - session.Insert(new FoodTable() { Location = "", Name = "48" }); - session.Insert(new FoodTable() { Location = "", Name = "49" }); - session.Insert(new FoodTable() { Location = "", Name = "50" }); - session.Insert(new FoodTable() { Location = "", Name = "51" }); - session.Insert(new FoodTable() { Location = "", Name = "52" }); - session.Insert(new FoodTable() { Location = "", Name = "53" }); - session.Insert(new FoodTable() { Location = "", Name = "54" }); - session.Insert(new FoodTable() { Location = "", Name = "55" }); - session.Insert(new FoodTable() { Location = "", Name = "56" }); - session.Insert(new FoodTable() { Location = "", Name = "57" }); - session.Insert(new FoodTable() { Location = "", Name = "58" }); - session.Insert(new FoodTable() { Location = "", Name = "59" }); - session.Insert(new FoodTable() { Location = "", Name = "60" }); + for (int i = 1; i < 34; i++) + { + session.Insert(new FoodTable() { Location = "", Name = i.ToString() }); + } + for (int i = 40; i < 43; i++) + { + session.Insert(new FoodTable() { Location = "", Name = i.ToString() }); + } + for (int i = 50; i < 52; i++) + { + session.Insert(new FoodTable() { Location = "", Name = i.ToString() }); + } + for (int i = 60; i < 62; i++) + { + session.Insert(new FoodTable() { Location = "", Name = i.ToString() }); + } + for (int i = 70; i < 91; i++) + { + session.Insert(new FoodTable() { Location = "", Name = i.ToString() }); + } + for (int i = 1; i < 21; i++) + { + session.Insert(new FoodTable() { Location = "", Name = "B" + i.ToString() }); + } + for (int i = 1; i < 11; i++) + { + session.Insert(new FoodTable() { Location = "", Name = "D" + i.ToString() }); + } } } #endregion diff --git a/Tanshu.Accounts.PointOfSale/Authentication/Session.cs b/Tanshu.Accounts.SqlDAO/Lifetime/Session.cs similarity index 58% rename from Tanshu.Accounts.PointOfSale/Authentication/Session.cs rename to Tanshu.Accounts.SqlDAO/Lifetime/Session.cs index 4f4b350..fb52336 100644 --- a/Tanshu.Accounts.PointOfSale/Authentication/Session.cs +++ b/Tanshu.Accounts.SqlDAO/Lifetime/Session.cs @@ -3,14 +3,15 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.Repository; using System.Configuration; using Tanshu.Accounts.Entities.Auth; +using Tanshu.Accounts.Repository; -namespace Tanshu.Accounts.PointOfSale +namespace Tanshu.Accounts.Contracts { - static class Session + public static class Session { + private static Dictionary roles; private static User currentUser; public static bool IsAuthenticated { get; private set; } public static User User @@ -30,8 +31,21 @@ namespace Tanshu.Accounts.PointOfSale { currentUser = null; IsAuthenticated = false; + roles = null; } } } + public static bool IsAllowed(RoleConstants role) + { + if (currentUser == null) + return false; + if (roles == null) + roles = new Dictionary(); + if (!roles.ContainsKey(role.Role)) + roles.Add(role.Role, MembershipBI.IsUserInRole(currentUser.UserID, role.Role)); + return roles[role.Role]; + + + } } } diff --git a/Tanshu.Accounts.SqlDAO/Tanshu.Accounts.Repository.csproj b/Tanshu.Accounts.SqlDAO/Tanshu.Accounts.Repository.csproj index 682d24f..f8ab95c 100644 --- a/Tanshu.Accounts.SqlDAO/Tanshu.Accounts.Repository.csproj +++ b/Tanshu.Accounts.SqlDAO/Tanshu.Accounts.Repository.csproj @@ -40,10 +40,6 @@ False ..\Include\Fluent\Castle.Core.dll - - False - ..\Include\Windsor\Castle.Windsor.dll - False ..\Include\Fluent\FluentNHibernate.dll @@ -96,6 +92,7 @@ +