diff --git a/Tanshu.Accounts.BI/AdvanceBI.cs b/Tanshu.Accounts.BI/AdvanceBI.cs index 425a819..5aaec84 100644 --- a/Tanshu.Accounts.BI/AdvanceBI.cs +++ b/Tanshu.Accounts.BI/AdvanceBI.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.BI { @@ -9,10 +9,10 @@ namespace Tanshu.Accounts.BI { public void Insert(AdvanceBO advance) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection)) + using (var dao = new SqlDAO.AdvanceDAO(connection)) { dao.Insert(advance); } @@ -20,10 +20,10 @@ namespace Tanshu.Accounts.BI } public AdvanceBO Get(Guid advanceID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (var dao = factory.GetAdvanceDAO(connection)) + using (var dao = new SqlDAO.AdvanceDAO(connection)) { return dao.Get(advanceID); } @@ -33,10 +33,10 @@ namespace Tanshu.Accounts.BI { fromDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", fromDate)); toDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", toDate)); - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection)) + using (var dao = new SqlDAO.AdvanceDAO(connection)) { return dao.GetAdvances(fromDate, toDate, all); } @@ -44,10 +44,10 @@ namespace Tanshu.Accounts.BI } public void Adjust(Guid advanceID, Guid userID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection)) + using (var dao = new SqlDAO.AdvanceDAO(connection)) { dao.Adjust(advanceID, userID); diff --git a/Tanshu.Accounts.BI/CheckoutBI.cs b/Tanshu.Accounts.BI/CheckoutBI.cs index b145570..7def91f 100644 --- a/Tanshu.Accounts.BI/CheckoutBI.cs +++ b/Tanshu.Accounts.BI/CheckoutBI.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; + using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI @@ -88,10 +88,10 @@ namespace Tanshu.Accounts.BI public CheckoutBI(Guid cashier, DateTime startDate, DateTime finishDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (var dao = factory.GetCheckoutDAO(startDate, finishDate, cashier, connection)) + using (var dao = new SqlDAO.CheckoutDAO(startDate, finishDate, cashier, connection)) { //Actual Closing this.CashierID = cashier; diff --git a/Tanshu.Accounts.BI/CustomerBI.cs b/Tanshu.Accounts.BI/CustomerBI.cs index a949a6f..6ab6aa7 100644 --- a/Tanshu.Accounts.BI/CustomerBI.cs +++ b/Tanshu.Accounts.BI/CustomerBI.cs @@ -1,12 +1,6 @@ using System; using System.Collections.Generic; -//using System.Linq; -using System.Text; using Tanshu.Accounts.Contracts; -using System.Data.SqlClient; -using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; - namespace Tanshu.Accounts.BI { @@ -15,10 +9,10 @@ namespace Tanshu.Accounts.BI public List GetCustomerLedgers() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { return dao.GetCustomerLedgers(); } @@ -26,10 +20,10 @@ namespace Tanshu.Accounts.BI } public CustomerBO GetCustomer(Guid customerID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { return dao.GetCustomer(customerID); } @@ -38,10 +32,10 @@ namespace Tanshu.Accounts.BI } public List GetFilteredCustomers(Dictionary filter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { return dao.GetFilteredCustomers(filter); } @@ -49,10 +43,10 @@ namespace Tanshu.Accounts.BI } public List GetCustomers() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { return dao.GetCustomers(); } @@ -60,10 +54,10 @@ namespace Tanshu.Accounts.BI } public List GetSingleCustomers(Guid customerID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { return dao.GetCustomers(customerID); } @@ -71,10 +65,10 @@ namespace Tanshu.Accounts.BI } public bool Update(CustomerBO customer) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { dao.Update(customer); return true; @@ -83,10 +77,10 @@ namespace Tanshu.Accounts.BI } public bool Delete(Guid customerID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { dao.Delete(customerID); return true; @@ -95,10 +89,10 @@ namespace Tanshu.Accounts.BI } public bool Insert(CustomerBO customer) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ICustomerDAO dao = factory.GetCustomerDAO(connection)) + using (var dao = new SqlDAO.CustomerDAO(connection)) { dao.Insert(customer); return true; diff --git a/Tanshu.Accounts.BI/LedgerBI.cs b/Tanshu.Accounts.BI/LedgerBI.cs index f784014..bb5fdb2 100644 --- a/Tanshu.Accounts.BI/LedgerBI.cs +++ b/Tanshu.Accounts.BI/LedgerBI.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; -using System.Data.SqlClient; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -12,10 +8,10 @@ namespace Tanshu.Accounts.BI { public LedgerBO GetLedger(Guid ledgerID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.GetLedger(ledgerID); } @@ -23,10 +19,10 @@ namespace Tanshu.Accounts.BI } public LedgerBO GetLedgerByName(string name) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.GetLedger(name); } @@ -34,10 +30,10 @@ namespace Tanshu.Accounts.BI } public bool Insert(LedgerBO ledger) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.Insert(ledger); } @@ -45,10 +41,10 @@ namespace Tanshu.Accounts.BI } public bool Update(LedgerBO ledger) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.Update(ledger); } @@ -56,10 +52,10 @@ namespace Tanshu.Accounts.BI } public List GetLedgers() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.GetLedgers(); } @@ -67,10 +63,10 @@ namespace Tanshu.Accounts.BI } public List GetLedgersOfType(char type) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ILedgerDAO dao = factory.GetLedgerDAO(connection)) + using (var dao = new SqlDAO.LedgerDAO(connection)) { return dao.GetLedgers(type); } diff --git a/Tanshu.Accounts.BI/ManagementBI.cs b/Tanshu.Accounts.BI/ManagementBI.cs index fdc9dfb..8970244 100644 --- a/Tanshu.Accounts.BI/ManagementBI.cs +++ b/Tanshu.Accounts.BI/ManagementBI.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Data.SqlClient; -using Tanshu.Accounts.DAOFactory; using Tanshu.Accounts.Contracts; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -12,10 +8,10 @@ namespace Tanshu.Accounts.BI { public decimal GetBalance(decimal? tax, DateTime startDate, DateTime endDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, endDate, connection)) { return dao.GetBalance(tax); } @@ -23,10 +19,10 @@ namespace Tanshu.Accounts.BI } public List GetUpdateBillList(decimal tax, DateTime startDate, DateTime endDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, endDate, connection)) { return dao.GetUpdateBillList(tax); } @@ -34,10 +30,10 @@ namespace Tanshu.Accounts.BI } public decimal Update(Guid voucherID, decimal tax, DateTime startDate, DateTime endDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, endDate, connection)) { return dao.Update(voucherID, tax); } @@ -46,10 +42,10 @@ namespace Tanshu.Accounts.BI public void Reorder(DateTime startDate, DateTime endDate, ShowProgessDelegate showProgressDelegate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, endDate, connection)) { dao.Reorder(showProgressDelegate); } @@ -59,10 +55,10 @@ namespace Tanshu.Accounts.BI public bool MergeData(DateTime startDate, DateTime endDate, string sourceDB, string targetDB) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, endDate, connection)) { return dao.MergeData(sourceDB, targetDB); } @@ -70,10 +66,10 @@ namespace Tanshu.Accounts.BI } public List GetPaidBills(DateTime startDate, DateTime finishDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IManagementDAO dao = factory.GetManagementDAO(startDate, finishDate, connection)) + using (var dao = new SqlDAO.ManagementDAO(startDate, finishDate, connection)) { return dao.GetPaidBills(); } diff --git a/Tanshu.Accounts.BI/MembershipBI.cs b/Tanshu.Accounts.BI/MembershipBI.cs index 9eec749..a37e701 100644 --- a/Tanshu.Accounts.BI/MembershipBI.cs +++ b/Tanshu.Accounts.BI/MembershipBI.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -//using System.Linq; -using System.Text; -using System.Data.SqlClient; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -13,10 +7,10 @@ namespace Tanshu.Accounts.BI { public bool ValidateUser(string name, string password) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { return dao.ValidateUser(name, password); } @@ -25,10 +19,10 @@ namespace Tanshu.Accounts.BI public void AddUsersToRoles(string[] usernames, string[] roleNames) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { dao.AddUsersToRoles(usernames, roleNames); } @@ -37,10 +31,10 @@ namespace Tanshu.Accounts.BI public string[] GetAllRoles() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (var dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { return dao.GetAllRoles(); } @@ -49,10 +43,10 @@ namespace Tanshu.Accounts.BI public string[] GetRolesForUser(string username) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { return dao.GetRolesForUser(username); } @@ -61,10 +55,10 @@ namespace Tanshu.Accounts.BI public bool IsUserInRole(string username, string roleName) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { if (!dao.RoleExists(roleName)) throw new Exception(string.Format("Role {0} does not exist in the database", roleName)); @@ -75,10 +69,10 @@ namespace Tanshu.Accounts.BI public bool IsUserInRole(Guid userID, string roleName) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { if (!dao.RoleExists(roleName)) throw new Exception(string.Format("Role {0} does not exist in the database", roleName)); @@ -91,10 +85,10 @@ namespace Tanshu.Accounts.BI { if ((roleNames.Length > 0) || (usernames.Length > 0)) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { dao.RemoveUsersFromRoles(usernames, roleNames); } @@ -104,10 +98,10 @@ namespace Tanshu.Accounts.BI public UserBO GetUserFromName(string name) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IMembershipDAO dao = factory.GetMembershipDAO(connection)) + using (var dao = new SqlDAO.MembershipDAO(connection)) { return dao.GetUserFromName(name); } diff --git a/Tanshu.Accounts.BI/PaymentBI.cs b/Tanshu.Accounts.BI/PaymentBI.cs index 6daf14e..38e9fad 100644 --- a/Tanshu.Accounts.BI/PaymentBI.cs +++ b/Tanshu.Accounts.BI/PaymentBI.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; -using System.Data.SqlClient; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -12,10 +8,10 @@ namespace Tanshu.Accounts.BI { public void Insert(PaymentBO payment) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IPaymentDAO dao = factory.GetPaymentDAO(connection)) + using (var dao = new SqlDAO.PaymentDAO(connection)) { dao.Insert(payment); } @@ -25,10 +21,10 @@ namespace Tanshu.Accounts.BI { fromDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", fromDate)); toDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", toDate)); - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IPaymentDAO dao = factory.GetPaymentDAO(connection)) + using (var dao = new SqlDAO.PaymentDAO(connection)) { return dao.GetPayments(userID, fromDate, toDate); } @@ -36,10 +32,10 @@ namespace Tanshu.Accounts.BI } public void Delete(Guid paymentID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IPaymentDAO dao = factory.GetPaymentDAO(connection)) + using (var dao = new SqlDAO.PaymentDAO(connection)) { dao.Delete(paymentID); } diff --git a/Tanshu.Accounts.BI/ProductBI.cs b/Tanshu.Accounts.BI/ProductBI.cs index 337ebd8..24334a0 100644 --- a/Tanshu.Accounts.BI/ProductBI.cs +++ b/Tanshu.Accounts.BI/ProductBI.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; -using System.Data.SqlClient; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -12,10 +8,10 @@ namespace Tanshu.Accounts.BI { public bool Insert(ProductBO product) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.Insert(product); } @@ -23,10 +19,10 @@ namespace Tanshu.Accounts.BI } public bool Update(ProductBO product) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.Update(product); } @@ -34,10 +30,10 @@ namespace Tanshu.Accounts.BI } public bool Delete(Guid productID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.Delete(productID); } @@ -45,10 +41,10 @@ namespace Tanshu.Accounts.BI } public ProductBO GetProductFromName(string nameAndUnits) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetProduct(nameAndUnits); } @@ -56,10 +52,10 @@ namespace Tanshu.Accounts.BI } public ProductBO GetProduct(Guid productID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetProduct(productID); } @@ -67,10 +63,10 @@ namespace Tanshu.Accounts.BI } public decimal GetProductStock(DateTime date, Guid productID, Guid? voucherID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetProductStock(date, productID, voucherID); } @@ -78,10 +74,10 @@ namespace Tanshu.Accounts.BI } public List GetProducts() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetProducts(); } @@ -90,10 +86,10 @@ namespace Tanshu.Accounts.BI public List GetFilteredProducts(Dictionary filter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetFilteredProducts(filter); } @@ -102,10 +98,10 @@ namespace Tanshu.Accounts.BI public void UpdateShortName() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { dao.UpdateShortName(); } @@ -121,10 +117,10 @@ namespace Tanshu.Accounts.BI } public List GetProductTypes() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IProductDAO dao = factory.GetProductDAO(connection)) + using (var dao = new SqlDAO.ProductDAO(connection)) { return dao.GetProductTypes(); } diff --git a/Tanshu.Accounts.BI/SaleVoucherBI.cs b/Tanshu.Accounts.BI/SaleVoucherBI.cs index 6729665..f58fb4c 100644 --- a/Tanshu.Accounts.BI/SaleVoucherBI.cs +++ b/Tanshu.Accounts.BI/SaleVoucherBI.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; namespace Tanshu.Accounts.BI { @@ -9,10 +8,10 @@ namespace Tanshu.Accounts.BI { public SalesBillItemBO GetDefaultSaleBillItem(Guid productID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.GetDefaultSaleBillItem(productID); } @@ -20,10 +19,10 @@ namespace Tanshu.Accounts.BI } public decimal GetProductDiscountLimit(Guid productID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.GetProductDiscountLimit(productID); } @@ -31,10 +30,10 @@ namespace Tanshu.Accounts.BI } public bool IsBillPrinted(Guid voucherID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.IsBillPrinted(voucherID); } @@ -43,10 +42,10 @@ namespace Tanshu.Accounts.BI public decimal Amount(Guid voucherID) { //throw new NotImplementedException(); - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.Amount(voucherID); } @@ -54,14 +53,14 @@ namespace Tanshu.Accounts.BI } public bool Insert(SaleVoucherBO saleVoucher, List inventory) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IVoucherDAO vdao = factory.GetVoucherDAO(connection)) + using (var vdao = new SqlDAO.VoucherDAO(connection)) { - using (ISaleVoucherDAO svdao = factory.GetSaleVoucherDAO(connection)) + using (var svdao = new SqlDAO.SaleVoucherDAO(connection)) { - using (IInventoryDAO idao = factory.GetInventoryDAO(connection)) + using (var idao = new SqlDAO.InventoryDAO(connection)) { connection.BeginTransaction(); #region Voucher @@ -89,14 +88,14 @@ namespace Tanshu.Accounts.BI } public bool Update(SaleVoucherBO saleVoucher, List inventory) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IVoucherDAO vdao = factory.GetVoucherDAO(connection)) + using (var vdao = new SqlDAO.VoucherDAO(connection)) { - using (ISaleVoucherDAO svdao = factory.GetSaleVoucherDAO(connection)) + using (var svdao = new SqlDAO.SaleVoucherDAO(connection)) { - using (IInventoryDAO idao = factory.GetInventoryDAO(connection)) + using (var idao = new SqlDAO.InventoryDAO(connection)) { connection.BeginTransaction(); #region Voucher @@ -124,12 +123,12 @@ namespace Tanshu.Accounts.BI } public bool GetSaleVoucher(Guid voucherID, ref SaleVoucherBO voucherSale, ref List iList) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherDAO svdao = factory.GetSaleVoucherDAO(connection)) + using (var svdao = new SqlDAO.SaleVoucherDAO(connection)) { - using (IInventoryDAO idao = factory.GetInventoryDAO(connection)) + using (var idao = new SqlDAO.InventoryDAO(connection)) { voucherSale = svdao.GetVoucherSale(voucherID); iList = idao.GetInventories(voucherID); @@ -140,12 +139,12 @@ namespace Tanshu.Accounts.BI } public bool GetSaleVoucher(string billID, ref SaleVoucherBO voucherSale, ref List iList) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (var svdao = factory.GetSaleVoucherDAO(connection)) + using (var svdao = new SqlDAO.SaleVoucherDAO(connection)) { - using (var idao = factory.GetInventoryDAO(connection)) + using (var idao = new SqlDAO.InventoryDAO(connection)) { voucherSale = svdao.GetVoucherSale(billID); iList = idao.GetInventories(voucherSale.VoucherID); @@ -157,10 +156,10 @@ namespace Tanshu.Accounts.BI public List GetPendingBills(PendingType list, int floor) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.GetPendingBills(list, floor); } @@ -169,10 +168,10 @@ namespace Tanshu.Accounts.BI public Guid? GetPendingVoucherID(string tableID, int floor) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.GetPendingVoucherID(tableID, floor); } @@ -180,10 +179,10 @@ namespace Tanshu.Accounts.BI } public List SaleInventory(Dictionary.ValueCollection list, Guid? voucherID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { return dao.SaleInventory(list, voucherID); } @@ -191,33 +190,33 @@ namespace Tanshu.Accounts.BI } public void SetAlarm(Guid voucherID, DateTime? alarmTime) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherDAO dao = factory.GetSaleVoucherDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherDAO(connection)) { dao.SetAlarm(voucherID, alarmTime); } } } - public void VoidBill(Guid voucherID, string reason) + public void VoidBill(Guid voucherID, string reason, Guid userID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherDAO dao = factory.GetSaleVoucherDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherDAO(connection)) { - dao.VoidBill(voucherID, reason); + dao.VoidBill(voucherID, reason, userID); } } } public void DeclareBillsPaid(Guid userID, List billList, PaidStatus paidStatus) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISaleVoucherMixDAO dao = factory.GetSaleVoucherMixDAO(connection)) + using (var dao = new SqlDAO.SaleVoucherMixDAO(connection)) { dao.DeclareBillsPaid(userID, billList, paidStatus); } diff --git a/Tanshu.Accounts.BI/SalesAnalysisBI.cs b/Tanshu.Accounts.BI/SalesAnalysisBI.cs index 7403ef7..0fe685b 100644 --- a/Tanshu.Accounts.BI/SalesAnalysisBI.cs +++ b/Tanshu.Accounts.BI/SalesAnalysisBI.cs @@ -1,11 +1,6 @@ using System; using System.Collections.Generic; -//using System.Linq; -using System.Text; -using System.Data.SqlClient; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -13,10 +8,10 @@ namespace Tanshu.Accounts.BI { public List GetSaleDetail(DateTime startDate, DateTime finishDate, Guid costCenterID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISalesAnalysisDAO dao = factory.GetSalesAnalysisDAO(connection)) + using (var dao = new SqlDAO.SalesAnalysisDAO(connection)) { return dao.GetSaleDetail(startDate, finishDate, costCenterID); } @@ -24,21 +19,22 @@ namespace Tanshu.Accounts.BI } public List GetSale(DateTime startDate, DateTime finishDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + List list; + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISalesAnalysisDAO dao = factory.GetSalesAnalysisDAO(connection)) + using (var dao = new SqlDAO.SalesAnalysisDAO(connection)) { - return dao.GetSale(startDate, finishDate); + list = dao.GetSale(startDate, finishDate); + return list; } } } public void GetAdditionalInfo(ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax, DateTime startDate, DateTime finishDate) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISalesAnalysisDAO dao = factory.GetSalesAnalysisDAO(connection)) + using (var dao = new SqlDAO.SalesAnalysisDAO(connection)) { dao.GetAdditionalInfo(ref freeSale, ref voids, ref pending, ref net, ref tax, startDate, finishDate); } @@ -46,10 +42,10 @@ namespace Tanshu.Accounts.BI } public List GetSalesTaxReturn(DateTime startDate, DateTime finishDate, ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (ISalesAnalysisDAO dao = factory.GetSalesAnalysisDAO(connection)) + using (var dao = new SqlDAO.SalesAnalysisDAO(connection)) { return dao.GetSalesTaxReturn(startDate, finishDate, ref freeSale, ref voids, ref pending, ref net, ref tax); } diff --git a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj index 5d03b9f..233aa65 100644 --- a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj +++ b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj @@ -83,9 +83,9 @@ {59A6F8B8-12EE-4D8E-BEBB-61CB665A2C17} Tanshu.Accounts.Contracts - - {AC7AA7C5-4712-4992-B733-092D703E7AA9} - Tanshu.Accounts.DAOFactory + + {B755D152-37C3-47D6-A721-3AD17A8EF316} + Tanshu.Accounts.SqlDAO diff --git a/Tanshu.Accounts.BI/UserBI.cs b/Tanshu.Accounts.BI/UserBI.cs index 1d51e04..c1230db 100644 --- a/Tanshu.Accounts.BI/UserBI.cs +++ b/Tanshu.Accounts.BI/UserBI.cs @@ -1,12 +1,6 @@ using System; using System.Collections.Generic; -//using System.Linq; -using System.Text; using Tanshu.Accounts.Contracts; -using System.Data.SqlClient; -using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; - namespace Tanshu.Accounts.BI { @@ -14,10 +8,10 @@ namespace Tanshu.Accounts.BI { public UserBO GetUser(Guid userID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.GetUser(userID); } @@ -25,10 +19,10 @@ namespace Tanshu.Accounts.BI } public bool ChangePassword(UserBO userData, string newPassword) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.ChangePassword(userData, newPassword); } @@ -36,10 +30,10 @@ namespace Tanshu.Accounts.BI } public List GetUsers() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.GetUsers(); } @@ -47,10 +41,10 @@ namespace Tanshu.Accounts.BI } public List GetFilteredUsers(Dictionary filter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.GetFilteredUsers(filter); } @@ -58,10 +52,10 @@ namespace Tanshu.Accounts.BI } public bool UserExists(string userName) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.UserExists(userName); } @@ -69,10 +63,10 @@ namespace Tanshu.Accounts.BI } public bool Insert(UserBO user) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.Insert(user); } @@ -81,10 +75,10 @@ namespace Tanshu.Accounts.BI public bool Update(UserBO user) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.Update(user); } @@ -93,10 +87,10 @@ namespace Tanshu.Accounts.BI public bool Delete(Guid userID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IUserDAO dao = factory.GetUserDAO(connection)) + using (var dao = new SqlDAO.UserDAO(connection)) { return dao.Delete(userID); } diff --git a/Tanshu.Accounts.BI/WaiterBI.cs b/Tanshu.Accounts.BI/WaiterBI.cs index 4a0ec76..8266a01 100644 --- a/Tanshu.Accounts.BI/WaiterBI.cs +++ b/Tanshu.Accounts.BI/WaiterBI.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; using Tanshu.Accounts.Contracts; -using System.Data.SqlClient; -using Tanshu.Accounts.DAOFactory; -using Tanshu.Data.DAO; namespace Tanshu.Accounts.BI { @@ -12,10 +8,10 @@ namespace Tanshu.Accounts.BI { public bool Insert(WaiterBO waiter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.Insert(waiter); @@ -24,10 +20,10 @@ namespace Tanshu.Accounts.BI } public bool Update(WaiterBO waiter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.Update(waiter); @@ -36,10 +32,10 @@ namespace Tanshu.Accounts.BI } public bool Delete(Guid waiterID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.Delete(waiterID); @@ -49,10 +45,10 @@ namespace Tanshu.Accounts.BI public WaiterBO GetWaiter(Guid waiterID) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.GetWaiter(waiterID); @@ -61,10 +57,10 @@ namespace Tanshu.Accounts.BI } public WaiterBO GetWaiter(int code) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.GetWaiter(code); @@ -73,10 +69,10 @@ namespace Tanshu.Accounts.BI } public List GetWaiters() { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.GetWaiters(); @@ -85,10 +81,10 @@ namespace Tanshu.Accounts.BI } public List GetFilteredWaiters(Dictionary filter) { - var factory = GetFactory.GetDAOFactory(Database.GetFactoryType); - using (var connection = factory.Connection) + + using (var connection = new SqlDAO.SqlConnectionDAO()) { - using (IWaiterDAO dao = factory.GetWaiterDAO(connection)) + using (var dao = new SqlDAO.WaiterDAO(connection)) { return dao.GetFilteredWaiters(filter); diff --git a/Tanshu.Accounts.Contracts/DAOFactory/AdvanceDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/AdvanceDAO.cs deleted file mode 100644 index 1d1df5c..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/AdvanceDAO.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IAdvanceDAO : IDisposable - { - void Insert(AdvanceBO advance); - AdvanceBO Get(Guid advanceID); - List GetAdvances(DateTime fromDate, DateTime toDate, bool all); - void Adjust(Guid advanceID, Guid userID); - - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/CheckoutDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/CheckoutDAO.cs deleted file mode 100644 index 2c13edc..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/CheckoutDAO.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ICheckoutDAO :IDisposable - { - decimal GetDetail(ref string info, PaidStatus paidStatus, string infoLine); - decimal GetOpenings(); - decimal GetReceipts(); - decimal GetPayments(); - decimal GetAdditionalVoids(); - decimal GetRetainedOvernight(); - decimal GetAdvancesReceived(); - decimal GetAdvancesAdjusted(); - string GetPaymentString(); - string GetActiveCashiers(); - decimal GetNetSales(); - decimal GetDiscountsBills(ref string info); - - decimal GetOldPending(); - decimal GetOldReceipts(); - decimal GetOldVoided(); - - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/CustomerDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/CustomerDAO.cs deleted file mode 100644 index a0cd817..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/CustomerDAO.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ICustomerDAO :IDisposable - { - void Insert(CustomerBO customer); - void Update(CustomerBO customer); - void Delete(Guid customerID); - - CustomerBO GetCustomer(Guid customerID); - List GetFilteredCustomers(Dictionary filter); - List GetCustomerLedgers(); - List GetCustomers(); - List GetCustomers(Guid customerID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/InventoryDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/InventoryDAO.cs deleted file mode 100644 index e4333ce..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/InventoryDAO.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IInventoryDAO : IDisposable - { - bool Insert(InventoryBO inventory); - bool Update(InventoryBO inventory); - bool Delete(Guid voucherID); - bool Delete(Guid voucherID, Guid productID); - - List GetInventories(Guid voucherID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/LedgerDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/LedgerDAO.cs deleted file mode 100644 index acc99c2..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/LedgerDAO.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ILedgerDAO : IDisposable - { - bool Insert(LedgerBO ledger); - LedgerBO GetLedger(Guid ledgerID); - LedgerBO GetLedger(string name); - List GetLedgers(char type); - bool Delete(Guid ledgerID); - bool Update(LedgerBO ledger); - List GetLedgers(); - - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs deleted file mode 100644 index 80ea231..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/ManagementDAO.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Tanshu.Accounts.Contracts; -using System.Collections.Generic; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IManagementDAO : IDisposable - { - decimal GetBalance(decimal? tax); - List GetUpdateBillList(decimal tax); - decimal Update(Guid voucherID, decimal tax); - - List GetPaidBills(); - - void Reorder(ShowProgessDelegate showProgressDelegate); - - bool MergeData(string sourceDB, string targetDB); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/MembershipDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/MembershipDAO.cs deleted file mode 100644 index 05abffd..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/MembershipDAO.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IMembershipDAO : IDisposable - { - bool ValidateUser(string name, string password); - - bool IsUserInRole(string username, string roleName); - - bool IsUserInRole(Guid userID, string roleName); - - string[] GetRolesForUser(string username); - - UserBO GetUserFromName(string name); - - string[] GetAllRoles(); - - void AddUsersToRoles(string[] usernames, string[] roleNames); - - void RemoveUsersFromRoles(string[] usernames, string[] roleNames); - - bool RoleExists(string roleID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/PaymentDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/PaymentDAO.cs deleted file mode 100644 index bcfb22c..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/PaymentDAO.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IPaymentDAO : IDisposable - { - void Insert(PaymentBO payment); - List GetPayments(Guid? userID, DateTime fromDate, DateTime toDate); - void Delete(Guid paymentID); - } -} \ No newline at end of file diff --git a/Tanshu.Accounts.Contracts/DAOFactory/ProductDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/ProductDAO.cs deleted file mode 100644 index 273764d..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/ProductDAO.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IProductDAO : IDisposable - { - bool Insert(ProductBO product); - ProductBO GetProduct(Guid productID); - bool Delete(Guid productID); - bool Update(ProductBO product); - ProductBO GetProduct(string nameAndUnits); - decimal GetProductStock(DateTime date, Guid productID, Guid? voucherID); - - List GetProducts(); - - void UpdateShortName(); - - List GetFilteredProducts(Dictionary filter); - - List GetProductTypes(); - - List GetProducts(string name, int skip, int count); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs deleted file mode 100644 index af96bdd..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherDAO.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ISaleVoucherDAO : IDisposable - { - bool Insert(SaleVoucherBO saleVoucher); - bool Update(SaleVoucherBO saleVoucher); - void SetAlarm(Guid voucherID, DateTime? alarmTime); - void VoidBill(Guid voucherID, string reason); - SaleVoucherBO GetVoucherSale(Guid voucherID); - SaleVoucherBO GetVoucherSale(string billID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherMixDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherMixDAO.cs deleted file mode 100644 index ed877ad..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/SaleVoucherMixDAO.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ISaleVoucherMixDAO : IDisposable - { - SalesBillItemBO GetDefaultSaleBillItem(Guid productID); - decimal GetProductDiscountLimit(Guid productID); - bool IsBillPrinted(Guid voucherID); - - List GetPendingBills(PendingType list, int floor); - Nullable GetPendingVoucherID(string tableID, int floor); - List SaleInventory(Dictionary.ValueCollection list, Guid? voucherID); - - void DeclareBillsPaid(Guid userID, List billList, PaidStatus paidStatus); - - decimal Amount(Guid voucherID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/SalesAnalysisDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/SalesAnalysisDAO.cs deleted file mode 100644 index ca2e72b..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/SalesAnalysisDAO.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ISalesAnalysisDAO : IDisposable - { - List GetSalesTaxReturn(DateTime startDate, DateTime finishDate, ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax); - void GetAdditionalInfo(ref decimal freeSale, ref decimal voids, ref decimal pending, ref decimal net, ref decimal tax, DateTime startDate, DateTime finishDate); - List GetSaleDetail(DateTime startDate, DateTime finishDate, Guid costCenterID); - List GetSale(DateTime startDate, DateTime finishDate); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/TaxDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/TaxDAO.cs deleted file mode 100644 index 64317c9..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/TaxDAO.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface ITaxDAO : IDisposable - { - List GetTaxes(); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/UserDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/UserDAO.cs deleted file mode 100644 index 2dbaf07..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/UserDAO.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IUserDAO : IDisposable - { - UserBO GetUser(Guid userID); - List GetUsers(); - List GetFilteredUsers(Dictionary filter); - bool UserExists(string userName); - bool Insert(UserBO user); - - bool ChangePassword(UserBO userData, string newPassword); - - bool Update(UserBO user); - - bool Delete(Guid userID); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/VoucherDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/VoucherDAO.cs deleted file mode 100644 index 344a944..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/VoucherDAO.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IVoucherDAO : IDisposable - { - bool Insert(VoucherBO voucher); - VoucherBO GetVoucher(Guid voucherID); - bool Delete(Guid voucherID); - bool Update(VoucherBO voucher); - } -} diff --git a/Tanshu.Accounts.Contracts/DAOFactory/WaiterDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/WaiterDAO.cs deleted file mode 100644 index 01b459b..0000000 --- a/Tanshu.Accounts.Contracts/DAOFactory/WaiterDAO.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using Tanshu.Accounts.Contracts; - -namespace Tanshu.Accounts.DAOFactory -{ - public interface IWaiterDAO : IDisposable - { - bool Insert(WaiterBO waiter); - bool Update(WaiterBO waiter); - bool Delete(Guid waiterID); - - WaiterBO GetWaiter(Guid waiterID); - WaiterBO GetWaiter(int code); - - List GetWaiters(); - List GetFilteredWaiters(Dictionary filter); - } -} diff --git a/Tanshu.Accounts.Contracts/Data Contracts/SalesAnalysisBO.cs b/Tanshu.Accounts.Contracts/Data Contracts/SalesAnalysisBO.cs index 2951930..994ad02 100644 --- a/Tanshu.Accounts.Contracts/Data Contracts/SalesAnalysisBO.cs +++ b/Tanshu.Accounts.Contracts/Data Contracts/SalesAnalysisBO.cs @@ -30,4 +30,13 @@ namespace Tanshu.Accounts.Contracts [DataMember] public decimal Amount { get; set; } } + + [DataContract] + public class SettlementReportBO + { + [DataMember] + public PaidStatus Status { get; set; } + [DataMember] + public decimal Amount { get; set; } + } } diff --git a/Tanshu.Accounts.Contracts/Service Contracts/SaleVoucherBI.cs b/Tanshu.Accounts.Contracts/Service Contracts/SaleVoucherBI.cs index 0342112..ec507b1 100644 --- a/Tanshu.Accounts.Contracts/Service Contracts/SaleVoucherBI.cs +++ b/Tanshu.Accounts.Contracts/Service Contracts/SaleVoucherBI.cs @@ -30,7 +30,7 @@ namespace Tanshu.Accounts.Contracts [OperationContract] void SetAlarm(Guid voucherID, DateTime? alarmTime); [OperationContract] - void VoidBill(Guid voucherID, string reason); + void VoidBill(Guid voucherID, string reason, Guid userID); [OperationContract] void DeclareBillsPaid(Guid userID, List billList, PaidStatus paidStatus); } diff --git a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj index 464e1ed..2f4b77e 100644 --- a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj +++ b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj @@ -54,22 +54,6 @@ - - - - - - - - - - - - - - - - diff --git a/Tanshu.Accounts.DAOFactory/DAOFactory.cs b/Tanshu.Accounts.DAOFactory/DAOFactory.cs deleted file mode 100644 index e18c37c..0000000 --- a/Tanshu.Accounts.DAOFactory/DAOFactory.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Tanshu.Data.DAO; - -namespace Tanshu.Accounts.DAOFactory -{ - // List of DAO types supported by the factory - public enum DAOFactoryTypes - { - SqlServer = 0, - PostgreSQL = 1 - } - // Abstract class DAO Factory - public abstract class GetFactory - { - - // There will be a method for each DAO that can be - // created. The concrete factories will have to - // implement these methods. - public abstract IAdvanceDAO GetAdvanceDAO(IConnectionDAO connection); - public abstract ICheckoutDAO GetCheckoutDAO(DateTime startDate, DateTime finishDate, Guid userID, IConnectionDAO connection); - public abstract ICustomerDAO GetCustomerDAO(IConnectionDAO connection); - public abstract IInventoryDAO GetInventoryDAO(IConnectionDAO connection); - public abstract ILedgerDAO GetLedgerDAO(IConnectionDAO connection); - public abstract IManagementDAO GetManagementDAO(DateTime startDate, DateTime finishDate, IConnectionDAO connection); - public abstract IMembershipDAO GetMembershipDAO(IConnectionDAO connection); - public abstract IPaymentDAO GetPaymentDAO(IConnectionDAO connection); - public abstract IProductDAO GetProductDAO(IConnectionDAO connection); - public abstract ISalesAnalysisDAO GetSalesAnalysisDAO(IConnectionDAO connection); - public abstract ISaleVoucherDAO GetSaleVoucherDAO(IConnectionDAO connection); - public abstract ISaleVoucherMixDAO GetSaleVoucherMixDAO(IConnectionDAO connection); - public abstract IUserDAO GetUserDAO(IConnectionDAO connection); - public abstract IVoucherDAO GetVoucherDAO(IConnectionDAO connection); - public abstract IWaiterDAO GetWaiterDAO(IConnectionDAO connection); - - - public abstract IConnectionDAO Connection { get; } - - public static GetFactory GetDAOFactory(DAOFactoryTypes type) - { - - switch (type) - { - //case DAOFactoryTypes.PostgreSQL: - // return new PostgreSQLDAOFactory(); - case DAOFactoryTypes.SqlServer: - return new SqlServerDAOFactory(); - //case DAOFactoryTypes.PostgreSQL: - // return new PostgresDAOFactory(); - default: - throw new ArgumentException(); - } - } - } -} diff --git a/Tanshu.Accounts.DAOFactory/GetFactoryTypes.cs b/Tanshu.Accounts.DAOFactory/GetFactoryTypes.cs deleted file mode 100644 index f2da1c8..0000000 --- a/Tanshu.Accounts.DAOFactory/GetFactoryTypes.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Configuration; -using System; - -namespace Tanshu.Accounts.DAOFactory -{ - public static class Database - { - public static DAOFactoryTypes GetFactoryType - { - get - { - string type = ConfigurationManager.AppSettings["Factory"].ToLowerInvariant(); - if (DAOFactoryTypes.SqlServer.ToString().ToLowerInvariant() == type) - return DAOFactoryTypes.SqlServer; - else if (DAOFactoryTypes.PostgreSQL.ToString().ToLowerInvariant() == type) - return DAOFactoryTypes.PostgreSQL; - else - throw new ArgumentException(); - } - } - } -} diff --git a/Tanshu.Accounts.DAOFactory/PostgresDAOFactory.cs b/Tanshu.Accounts.DAOFactory/PostgresDAOFactory.cs deleted file mode 100644 index fc2f7a2..0000000 --- a/Tanshu.Accounts.DAOFactory/PostgresDAOFactory.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Tanshu.WebAccounts.PostgresDAO; -using Tanshu.Data.DAO; -using Tanshu.WebAccounts.PostgresDAO.Reports; - -namespace Tanshu.WebAccounts.DAOFactory -{ - public class PostgresDAOFactory : GetFactory - { - public override ICostCenterDAO GetCostCenterDAO(IConnectionDAO connection) - { - return new CostCenterDAO(connection); - } - - public override IEmployeeDAO GetEmployeeDAO(IConnectionDAO connection) - { - return new EmployeeDAO(connection); - } - - public override IInventoryDAO GetInventoryDAO(IConnectionDAO connection) - { - return new InventoryDAO(connection); - } - - public override IInventoryDisplayDAO GetInventoryDisplayDAO(IConnectionDAO connection) - { - return new InventoryDisplayDAO(connection); - } - - public override IIssueDAO GetIssueDAO(IConnectionDAO connection) - { - return new IssueDAO(connection); - } - - public override IJournalDAO GetJournalDAO(IConnectionDAO connection) - { - return new JournalDAO(connection); - } - - public override ILedgerDAO GetLedgerDAO(IConnectionDAO connection) - { - return new LedgerDAO(connection); - } - - public override IMaintenanceDAO GetMaintenanceDAO(IConnectionDAO connection) - { - return new MaintenanceDAO(connection); - } - - public override IMembershipDAO GetMembershipDAO(IConnectionDAO connection) - { - return new MembershipDAO(connection); - } - - public override IPaymentSheetDAO GetPaymentSheetDAO(IConnectionDAO connection) - { - return new PaymentSheetDAO(connection); - } - - public override IProductDAO GetProductDAO(IConnectionDAO connection) - { - return new ProductDAO(connection); - } - - public override IProductTypeDAO GetProductTypeDAO(IConnectionDAO connection) - { - return new ProductTypeDAO(connection); - } - - public override IRequirementDAO GetRequirementDAO(IConnectionDAO connection) - { - return new RequirementDAO(connection); - } - - public override ISalarySheetDAO GetSalarySheetDAO(IConnectionDAO connection) - { - return new SalarySheetDAO(connection); - } - - public override ITaxDAO GetTaxDAO(IConnectionDAO connection) - { - return new TaxDAO(connection); - } - - public override IUserDAO GetUserDAO(IConnectionDAO connection) - { - return new UserDAO(connection); - } - - public override IVerificationDAO GetVerificationDAO(IConnectionDAO connection) - { - return new VerificationDAO(connection); - } - - public override IVoucherDAO GetVoucherDAO(IConnectionDAO connection) - { - return new VoucherDAO(connection); - } - - public override IConnectionDAO Connection - { - get { return new Tanshu.WebAccounts.PostgresDAO.PostgresConnectionDAO(); } - } - - public override ICashFlowDAO GetCashFlowDAO(IConnectionDAO connection) - { - return new CashFlowDAO(connection); - } - - public override IClosingStockDAO GetClosingStockDAO(IConnectionDAO connection) - { - return new ClosingStockDAO(connection); - } - - public override IEntriesDAO GetEntriesDAO(IConnectionDAO connection) - { - return new EntriesDAO(connection); - } - - public override IIssueReportsDAO GetIssueReportsDAO(IConnectionDAO connection) - { - return new IssueReportsDAO(connection); - } - - public override ILedgerReportDAO GetLedgerReportDAO(IConnectionDAO connection) - { - return new LedgerReportDAO(connection); - } - - public override ILiabilityReportsDAO GetLiabilityReportsDAO(IConnectionDAO connection) - { - return new LiabilityReportsDAO(connection); - } - - public override IProductLedgerDAO GetProductLedgerDAO(IConnectionDAO connection) - { - return new ProductLedgerDAO(connection); - } - - public override IProfitLossDAO GetProfitLossDAO(IConnectionDAO connection) - { - return new ProfitLossDAO(connection); - } - - public override IPurchaseDAO GetPurchaseDAO(IConnectionDAO connection) - { - return new PurchaseDAO(connection); - } - - public override IStockDAO GetStockDAO(IConnectionDAO connection) - { - return new StockDAO(connection); - } - } -} diff --git a/Tanshu.Accounts.DAOFactory/Properties/AssemblyInfo.cs b/Tanshu.Accounts.DAOFactory/Properties/AssemblyInfo.cs deleted file mode 100644 index b13f1e3..0000000 --- a/Tanshu.Accounts.DAOFactory/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Tanshu.WebAccounts.DAOFactory")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tanshu.WebAccounts.DAOFactory")] -[assembly: AssemblyCopyright("Copyright © 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4d63472a-b214-416c-a26b-1f963d39743b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs b/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs deleted file mode 100644 index a2f73e8..0000000 --- a/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Tanshu.Accounts.SqlDAO; -using Tanshu.Data.DAO; - -namespace Tanshu.Accounts.DAOFactory -{ - public class SqlServerDAOFactory : GetFactory - { - public override IAdvanceDAO GetAdvanceDAO(IConnectionDAO connection) - { - return new AdvanceDAO(connection); - } - - public override ICheckoutDAO GetCheckoutDAO(DateTime startDate, DateTime finishDate, Guid userID, IConnectionDAO connection) - { - return new CheckoutDAO(startDate, finishDate, userID, connection); - } - - public override IConnectionDAO Connection - { - get { return new SqlDAO.SqlConnectionDAO(); } - } - - public override ICustomerDAO GetCustomerDAO(IConnectionDAO connection) - { - return new CustomerDAO(connection); - } - - public override IInventoryDAO GetInventoryDAO(IConnectionDAO connection) - { - return new InventoryDAO(connection); - } - - public override ILedgerDAO GetLedgerDAO(IConnectionDAO connection) - { - return new LedgerDAO(connection); - } - - public override IManagementDAO GetManagementDAO(DateTime startDate, DateTime finishDate, IConnectionDAO connection) - { - return new ManagementDAO(startDate, finishDate, connection); - } - - public override IMembershipDAO GetMembershipDAO(IConnectionDAO connection) - { - return new MembershipDAO(connection); - } - - public override IPaymentDAO GetPaymentDAO(IConnectionDAO connection) - { - return new PaymentDAO(connection); - } - - public override IProductDAO GetProductDAO(IConnectionDAO connection) - { - return new ProductDAO(connection); - } - - public override ISalesAnalysisDAO GetSalesAnalysisDAO(IConnectionDAO connection) - { - return new SalesAnalysisDAO(connection); - } - - public override ISaleVoucherDAO GetSaleVoucherDAO(IConnectionDAO connection) - { - return new SaleVoucherDAO(connection); - } - - public override ISaleVoucherMixDAO GetSaleVoucherMixDAO(IConnectionDAO connection) - { - return new SaleVoucherMixDAO(connection); - } - - public override IUserDAO GetUserDAO(IConnectionDAO connection) - { - return new UserDAO(connection); - } - - public override IVoucherDAO GetVoucherDAO(IConnectionDAO connection) - { - return new VoucherDAO(connection); - } - - public override IWaiterDAO GetWaiterDAO(IConnectionDAO connection) - { - return new WaiterDAO(connection); - } - } -} diff --git a/Tanshu.Accounts.DAOFactory/Tanshu.Accounts.DAOFactory.csproj b/Tanshu.Accounts.DAOFactory/Tanshu.Accounts.DAOFactory.csproj deleted file mode 100644 index f744d2c..0000000 --- a/Tanshu.Accounts.DAOFactory/Tanshu.Accounts.DAOFactory.csproj +++ /dev/null @@ -1,76 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {AC7AA7C5-4712-4992-B733-092D703E7AA9} - Library - Properties - Tanshu.Accounts.DAOFactory - Tanshu.Accounts.DAOFactory - v3.5 - 512 - - - true - full - false - ..\Bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\Bin\ - TRACE - prompt - 4 - - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - False - ..\Include\Tanshu.Data.dll - - - - - - - - - - - {59A6F8B8-12EE-4D8E-BEBB-61CB665A2C17} - Tanshu.Accounts.Contracts - - - {B755D152-37C3-47D6-A721-3AD17A8EF316} - Tanshu.Accounts.SqlDAO - - - - - \ No newline at end of file diff --git a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs index 755c7f6..54ecf9f 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs @@ -3,19 +3,20 @@ using System.Collections.Generic; using System.Windows.Forms; using Tanshu.Accounts.BI; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.Helpers; + namespace Tanshu.Accounts.PointOfSale { public partial class frmSaleAnalysisForm : Form { - Guid? details = null; - List det; - private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + Guid? _details; + List _analysis; + List _analysisDetail; + private static readonly Tanshu.Logging.SqlLogger Log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public frmSaleAnalysisForm() { InitializeComponent(); - log.Warn(string.Format("Sales Analysis by: {0}", CurrentUser.user.Name)); + Log.Warn(string.Format("Sales Analysis by: {0}", CurrentUser.user.Name)); } private void dtpStart_ValueChanged(object sender, EventArgs e) @@ -25,23 +26,23 @@ 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)); + var startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); + var finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); - if (details.HasValue) + if (_details.HasValue) { - List list = new SalesAnalysisBI().GetSaleDetail(startDate, finishDate, details.Value); + _analysisDetail = new SalesAnalysisBI().GetSaleDetail(startDate, finishDate, _details.Value); dgvSale.AutoGenerateColumns = true; - dgvSale.DataSource = list; + dgvSale.DataSource = _analysisDetail; 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); + _analysis = new SalesAnalysisBI().GetSale(startDate, finishDate); dgvSale.AutoGenerateColumns = true; - dgvSale.DataSource = det; + dgvSale.DataSource = _analysis; dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dgvSale.Columns[0].Visible = false; dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0"; @@ -73,25 +74,26 @@ namespace Tanshu.Accounts.PointOfSale private void dgvSale_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - try - { - if (!details.HasValue) - details = ((SalesAnalysisBO)dgvSale.SelectedRows[0].DataBoundItem).TypeID; - else - details = null; - ShowStatement(); - } - catch (Exception ex) - { throw ex; } + if (!_details.HasValue) + _details = ((SalesAnalysisBO)dgvSale.SelectedRows[0].DataBoundItem).TypeID; + else + _details = null; + ShowStatement(); } private void btnPrint_Click(object sender, EventArgs e) { - if (det != null) + if (!_details.HasValue) { - 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(det, startDate, finishDate); + var startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); + var finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); + Print.Thermal.PrintSale(_analysis, startDate, finishDate); + } + else + { + var startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value)); + var finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value)); + Print.Thermal.PrintSale(_analysisDetail, startDate, finishDate); } } } diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs index 667da2a..1d824a5 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs @@ -29,8 +29,8 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.tmrPending = new System.Windows.Forms.Timer(this.components); this.label7 = new System.Windows.Forms.Label(); this.txtDiscount = new System.Windows.Forms.TextBox(); @@ -43,9 +43,6 @@ this.txtGrossTax = new System.Windows.Forms.TextBox(); this.dgvProducts = new System.Windows.Forms.DataGridView(); this.Display = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.printedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.additionalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.bindingSource = new System.Windows.Forms.BindingSource(this.components); this.pnlBilling = new System.Windows.Forms.Panel(); this.btnAdvance = new System.Windows.Forms.Button(); this.btnResetCustomer = new System.Windows.Forms.Button(); @@ -78,19 +75,7 @@ this.btnPaidCredit = new System.Windows.Forms.Button(); this.dgvPending = new System.Windows.Forms.DataGridView(); this.selectDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.billNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.kotDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.TableID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.amountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.importantDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.alarmDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.bookingTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.lastEditedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.waiterDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.cashierDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.printedDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.alarmTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.bsPending = new System.Windows.Forms.BindingSource(this.components); this.btnAlarm = new System.Windows.Forms.Button(); this.chkRefresh = new System.Windows.Forms.CheckBox(); this.btnRefresh = new System.Windows.Forms.Button(); @@ -105,14 +90,29 @@ this.tpAll = new System.Windows.Forms.TabPage(); this.tpAlarm = new System.Windows.Forms.TabPage(); this.lblUser = new System.Windows.Forms.Label(); + this.billNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.kotDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.amountDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.importantDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.alarmDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.bookingTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lastEditedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.waiterDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.cashierDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.printedDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.alarmTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.bsPending = new System.Windows.Forms.BindingSource(this.components); + this.printedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.additionalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.bindingSource = new System.Windows.Forms.BindingSource(this.components); this.bsWaiter = new System.Windows.Forms.BindingSource(this.components); ((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); this.pnlBilling.SuspendLayout(); this.pnlWaiting.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvPending)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.bsPending)).BeginInit(); this.tcPending.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bsPending)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsWaiter)).BeginInit(); this.SuspendLayout(); // @@ -138,7 +138,7 @@ // this.txtDiscount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtDiscount.Location = new System.Drawing.Point(1133, 633); - this.txtDiscount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtDiscount.Margin = new System.Windows.Forms.Padding(4); this.txtDiscount.Name = "txtDiscount"; this.txtDiscount.ReadOnly = true; this.txtDiscount.Size = new System.Drawing.Size(159, 22); @@ -162,7 +162,7 @@ // this.txtGrossAmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtGrossAmount.Location = new System.Drawing.Point(1133, 665); - this.txtGrossAmount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtGrossAmount.Margin = new System.Windows.Forms.Padding(4); this.txtGrossAmount.Name = "txtGrossAmount"; this.txtGrossAmount.ReadOnly = true; this.txtGrossAmount.Size = new System.Drawing.Size(159, 22); @@ -176,7 +176,7 @@ this.txtAmount.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtAmount.ForeColor = System.Drawing.Color.Transparent; this.txtAmount.Location = new System.Drawing.Point(1133, 697); - this.txtAmount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtAmount.Margin = new System.Windows.Forms.Padding(4); this.txtAmount.Name = "txtAmount"; this.txtAmount.ReadOnly = true; this.txtAmount.Size = new System.Drawing.Size(159, 26); @@ -211,7 +211,7 @@ // txtNarration // this.txtNarration.Location = new System.Drawing.Point(16, 593); - this.txtNarration.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtNarration.Margin = new System.Windows.Forms.Padding(4); this.txtNarration.Multiline = true; this.txtNarration.Name = "txtNarration"; this.txtNarration.Size = new System.Drawing.Size(287, 130); @@ -221,7 +221,7 @@ // this.txtGrossTax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtGrossTax.Location = new System.Drawing.Point(1133, 601); - this.txtGrossTax.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtGrossTax.Margin = new System.Windows.Forms.Padding(4); this.txtGrossTax.Name = "txtGrossTax"; this.txtGrossTax.ReadOnly = true; this.txtGrossTax.Size = new System.Drawing.Size(159, 22); @@ -247,7 +247,7 @@ this.dgvProducts.DataSource = this.bindingSource; this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgvProducts.Location = new System.Drawing.Point(16, 111); - this.dgvProducts.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dgvProducts.Margin = new System.Windows.Forms.Padding(4); this.dgvProducts.MultiSelect = false; this.dgvProducts.Name = "dgvProducts"; this.dgvProducts.RowHeadersVisible = false; @@ -266,31 +266,6 @@ this.Display.ReadOnly = true; this.Display.Width = 5; // - // printedDataGridViewTextBoxColumn - // - this.printedDataGridViewTextBoxColumn.DataPropertyName = "Printed"; - dataGridViewCellStyle1.Format = "N2"; - this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1; - this.printedDataGridViewTextBoxColumn.HeaderText = "Printed"; - this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn"; - this.printedDataGridViewTextBoxColumn.ReadOnly = true; - this.printedDataGridViewTextBoxColumn.Width = 5; - // - // additionalDataGridViewTextBoxColumn - // - this.additionalDataGridViewTextBoxColumn.DataPropertyName = "Additional"; - dataGridViewCellStyle2.Format = "N2"; - dataGridViewCellStyle2.NullValue = null; - this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; - this.additionalDataGridViewTextBoxColumn.HeaderText = "Additional"; - this.additionalDataGridViewTextBoxColumn.Name = "additionalDataGridViewTextBoxColumn"; - this.additionalDataGridViewTextBoxColumn.ReadOnly = true; - this.additionalDataGridViewTextBoxColumn.Width = 5; - // - // bindingSource - // - this.bindingSource.DataSource = typeof(Tanshu.Accounts.Contracts.SalesBillItemBO); - // // pnlBilling // this.pnlBilling.AutoSize = true; @@ -333,7 +308,7 @@ this.pnlBilling.Controls.Add(this.label7); this.pnlBilling.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlBilling.Location = new System.Drawing.Point(0, 0); - this.pnlBilling.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.pnlBilling.Margin = new System.Windows.Forms.Padding(4); this.pnlBilling.Name = "pnlBilling"; this.pnlBilling.Size = new System.Drawing.Size(1309, 815); this.pnlBilling.TabIndex = 121; @@ -341,7 +316,7 @@ // btnAdvance // this.btnAdvance.Location = new System.Drawing.Point(455, 668); - this.btnAdvance.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnAdvance.Margin = new System.Windows.Forms.Padding(4); this.btnAdvance.Name = "btnAdvance"; this.btnAdvance.Size = new System.Drawing.Size(135, 55); this.btnAdvance.TabIndex = 152; @@ -354,7 +329,7 @@ this.btnResetCustomer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnResetCustomer.ForeColor = System.Drawing.Color.Red; this.btnResetCustomer.Location = new System.Drawing.Point(652, 66); - this.btnResetCustomer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnResetCustomer.Margin = new System.Windows.Forms.Padding(4); this.btnResetCustomer.Name = "btnResetCustomer"; this.btnResetCustomer.Size = new System.Drawing.Size(48, 42); this.btnResetCustomer.TabIndex = 151; @@ -364,7 +339,7 @@ // btnWaiter // this.btnWaiter.Location = new System.Drawing.Point(455, 593); - this.btnWaiter.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnWaiter.Margin = new System.Windows.Forms.Padding(4); this.btnWaiter.Name = "btnWaiter"; this.btnWaiter.Size = new System.Drawing.Size(135, 68); this.btnWaiter.TabIndex = 150; @@ -375,7 +350,7 @@ // txtCode // this.txtCode.Location = new System.Drawing.Point(708, 66); - this.txtCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtCode.Margin = new System.Windows.Forms.Padding(4); this.txtCode.Name = "txtCode"; this.txtCode.Size = new System.Drawing.Size(584, 22); this.txtCode.TabIndex = 149; @@ -383,7 +358,7 @@ // btnClear // this.btnClear.Location = new System.Drawing.Point(312, 593); - this.btnClear.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnClear.Margin = new System.Windows.Forms.Padding(4); this.btnClear.Name = "btnClear"; this.btnClear.Size = new System.Drawing.Size(135, 130); this.btnClear.TabIndex = 148; @@ -394,7 +369,7 @@ // btnRate // this.btnRate.Location = new System.Drawing.Point(884, 697); - this.btnRate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnRate.Margin = new System.Windows.Forms.Padding(4); this.btnRate.Name = "btnRate"; this.btnRate.Size = new System.Drawing.Size(139, 28); this.btnRate.TabIndex = 146; @@ -405,7 +380,7 @@ // btnPrintKot // this.btnPrintKot.Location = new System.Drawing.Point(740, 593); - this.btnPrintKot.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPrintKot.Margin = new System.Windows.Forms.Padding(4); this.btnPrintKot.Name = "btnPrintKot"; this.btnPrintKot.Size = new System.Drawing.Size(136, 130); this.btnPrintKot.TabIndex = 145; @@ -416,7 +391,7 @@ // btnPrintBill // this.btnPrintBill.Location = new System.Drawing.Point(597, 593); - this.btnPrintBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPrintBill.Margin = new System.Windows.Forms.Padding(4); this.btnPrintBill.Name = "btnPrintBill"; this.btnPrintBill.Size = new System.Drawing.Size(135, 130); this.btnPrintBill.TabIndex = 144; @@ -427,7 +402,7 @@ // btnVoid // this.btnVoid.Location = new System.Drawing.Point(884, 597); - this.btnVoid.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnVoid.Margin = new System.Windows.Forms.Padding(4); this.btnVoid.Name = "btnVoid"; this.btnVoid.Size = new System.Drawing.Size(139, 28); this.btnVoid.TabIndex = 143; @@ -438,7 +413,7 @@ // btnDiscount // this.btnDiscount.Location = new System.Drawing.Point(884, 633); - this.btnDiscount.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnDiscount.Margin = new System.Windows.Forms.Padding(4); this.btnDiscount.Name = "btnDiscount"; this.btnDiscount.Size = new System.Drawing.Size(139, 28); this.btnDiscount.TabIndex = 142; @@ -449,7 +424,7 @@ // btnQuantity // this.btnQuantity.Location = new System.Drawing.Point(884, 661); - this.btnQuantity.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnQuantity.Margin = new System.Windows.Forms.Padding(4); this.btnQuantity.Name = "btnQuantity"; this.btnQuantity.Size = new System.Drawing.Size(139, 28); this.btnQuantity.TabIndex = 141; @@ -460,7 +435,7 @@ // txtTableID // this.txtTableID.Location = new System.Drawing.Point(520, 34); - this.txtTableID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtTableID.Margin = new System.Windows.Forms.Padding(4); this.txtTableID.Name = "txtTableID"; this.txtTableID.ReadOnly = true; this.txtTableID.Size = new System.Drawing.Size(123, 22); @@ -489,7 +464,7 @@ // txtUserID // this.txtUserID.Location = new System.Drawing.Point(1076, 34); - this.txtUserID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtUserID.Margin = new System.Windows.Forms.Padding(4); this.txtUserID.Name = "txtUserID"; this.txtUserID.ReadOnly = true; this.txtUserID.Size = new System.Drawing.Size(216, 22); @@ -528,7 +503,7 @@ // txtDate // this.txtDate.Location = new System.Drawing.Point(652, 34); - this.txtDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtDate.Margin = new System.Windows.Forms.Padding(4); this.txtDate.Name = "txtDate"; this.txtDate.ReadOnly = true; this.txtDate.Size = new System.Drawing.Size(203, 22); @@ -537,7 +512,7 @@ // txtLastEditDate // this.txtLastEditDate.Location = new System.Drawing.Point(864, 34); - this.txtLastEditDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtLastEditDate.Margin = new System.Windows.Forms.Padding(4); this.txtLastEditDate.Name = "txtLastEditDate"; this.txtLastEditDate.ReadOnly = true; this.txtLastEditDate.Size = new System.Drawing.Size(203, 22); @@ -546,7 +521,7 @@ // txtCreationDate // this.txtCreationDate.Location = new System.Drawing.Point(349, 34); - this.txtCreationDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtCreationDate.Margin = new System.Windows.Forms.Padding(4); this.txtCreationDate.Name = "txtCreationDate"; this.txtCreationDate.ReadOnly = true; this.txtCreationDate.Size = new System.Drawing.Size(161, 22); @@ -575,7 +550,7 @@ // txtBillID // this.txtBillID.Location = new System.Drawing.Point(16, 34); - this.txtBillID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtBillID.Margin = new System.Windows.Forms.Padding(4); this.txtBillID.Name = "txtBillID"; this.txtBillID.ReadOnly = true; this.txtBillID.Size = new System.Drawing.Size(144, 22); @@ -584,7 +559,7 @@ // txtKotID // this.txtKotID.Location = new System.Drawing.Point(169, 34); - this.txtKotID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtKotID.Margin = new System.Windows.Forms.Padding(4); this.txtKotID.Name = "txtKotID"; this.txtKotID.ReadOnly = true; this.txtKotID.Size = new System.Drawing.Size(171, 22); @@ -595,7 +570,7 @@ this.btnCustomer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnCustomer.ForeColor = System.Drawing.Color.Red; this.btnCustomer.Location = new System.Drawing.Point(16, 66); - this.btnCustomer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCustomer.Margin = new System.Windows.Forms.Padding(4); this.btnCustomer.Name = "btnCustomer"; this.btnCustomer.Size = new System.Drawing.Size(628, 42); this.btnCustomer.TabIndex = 126; @@ -621,7 +596,7 @@ this.pnlWaiting.Controls.Add(this.lblUser); this.pnlWaiting.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlWaiting.Location = new System.Drawing.Point(0, 0); - this.pnlWaiting.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.pnlWaiting.Margin = new System.Windows.Forms.Padding(4); this.pnlWaiting.Name = "pnlWaiting"; this.pnlWaiting.Size = new System.Drawing.Size(1309, 815); this.pnlWaiting.TabIndex = 121; @@ -629,7 +604,7 @@ // btnPaidStaff // this.btnPaidStaff.Location = new System.Drawing.Point(1133, 649); - this.btnPaidStaff.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPaidStaff.Margin = new System.Windows.Forms.Padding(4); this.btnPaidStaff.Name = "btnPaidStaff"; this.btnPaidStaff.Size = new System.Drawing.Size(160, 71); this.btnPaidStaff.TabIndex = 138; @@ -640,7 +615,7 @@ // btnPaidCredit // this.btnPaidCredit.Location = new System.Drawing.Point(1133, 727); - this.btnPaidCredit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnPaidCredit.Margin = new System.Windows.Forms.Padding(4); this.btnPaidCredit.Name = "btnPaidCredit"; this.btnPaidCredit.Size = new System.Drawing.Size(160, 65); this.btnPaidCredit.TabIndex = 137; @@ -676,10 +651,11 @@ this.alarmTimeDataGridViewTextBoxColumn}); this.dgvPending.DataSource = this.bsPending; this.dgvPending.Location = new System.Drawing.Point(16, 49); - this.dgvPending.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dgvPending.Margin = new System.Windows.Forms.Padding(4); this.dgvPending.MultiSelect = false; this.dgvPending.Name = "dgvPending"; this.dgvPending.RowHeadersVisible = false; + this.dgvPending.RowTemplate.Height = 24; this.dgvPending.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvPending.Size = new System.Drawing.Size(928, 599); this.dgvPending.TabIndex = 0; @@ -695,6 +671,172 @@ this.selectDataGridViewCheckBoxColumn.Name = "selectDataGridViewCheckBoxColumn"; this.selectDataGridViewCheckBoxColumn.Width = 53; // + // TableID + // + this.TableID.DataPropertyName = "TableID"; + this.TableID.HeaderText = "TableID"; + this.TableID.Name = "TableID"; + this.TableID.Width = 82; + // + // btnAlarm + // + this.btnAlarm.Location = new System.Drawing.Point(1133, 484); + this.btnAlarm.Margin = new System.Windows.Forms.Padding(4); + this.btnAlarm.Name = "btnAlarm"; + this.btnAlarm.Size = new System.Drawing.Size(160, 79); + this.btnAlarm.TabIndex = 136; + this.btnAlarm.Text = "Alarm"; + this.btnAlarm.UseVisualStyleBackColor = true; + this.btnAlarm.Click += new System.EventHandler(this.btnAlarm_Click); + // + // chkRefresh + // + this.chkRefresh.AutoSize = true; + this.chkRefresh.Checked = true; + this.chkRefresh.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkRefresh.Location = new System.Drawing.Point(952, 49); + this.chkRefresh.Margin = new System.Windows.Forms.Padding(4); + this.chkRefresh.Name = "chkRefresh"; + this.chkRefresh.Size = new System.Drawing.Size(160, 21); + this.chkRefresh.TabIndex = 134; + this.chkRefresh.Text = "Keep refreshing Bills"; + this.chkRefresh.UseVisualStyleBackColor = true; + // + // btnRefresh + // + this.btnRefresh.Location = new System.Drawing.Point(12, 649); + this.btnRefresh.Margin = new System.Windows.Forms.Padding(4); + this.btnRefresh.Name = "btnRefresh"; + this.btnRefresh.Size = new System.Drawing.Size(172, 144); + this.btnRefresh.TabIndex = 133; + this.btnRefresh.Text = "Refresh - F5"; + this.btnRefresh.UseVisualStyleBackColor = true; + this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); + // + // btnPaidCC + // + this.btnPaidCC.Location = new System.Drawing.Point(1133, 574); + this.btnPaidCC.Margin = new System.Windows.Forms.Padding(4); + this.btnPaidCC.Name = "btnPaidCC"; + this.btnPaidCC.Size = new System.Drawing.Size(160, 68); + this.btnPaidCC.TabIndex = 6; + this.btnPaidCC.Text = "Paid By CC"; + this.btnPaidCC.UseVisualStyleBackColor = true; + this.btnPaidCC.Click += new System.EventHandler(this.btnPaidCC_Click); + // + // btnPaidCash + // + this.btnPaidCash.Location = new System.Drawing.Point(952, 649); + this.btnPaidCash.Margin = new System.Windows.Forms.Padding(4); + this.btnPaidCash.Name = "btnPaidCash"; + this.btnPaidCash.Size = new System.Drawing.Size(173, 144); + this.btnPaidCash.TabIndex = 5; + this.btnPaidCash.Text = "Paid"; + this.btnPaidCash.UseVisualStyleBackColor = true; + this.btnPaidCash.Click += new System.EventHandler(this.btnPaidCash_Click); + // + // btnBillList + // + this.btnBillList.Location = new System.Drawing.Point(952, 484); + this.btnBillList.Margin = new System.Windows.Forms.Padding(4); + this.btnBillList.Name = "btnBillList"; + this.btnBillList.Size = new System.Drawing.Size(173, 158); + this.btnBillList.TabIndex = 4; + this.btnBillList.Text = "List Of Bills to Cancel"; + this.btnBillList.UseVisualStyleBackColor = true; + this.btnBillList.Click += new System.EventHandler(this.btnBillList_Click); + // + // btnSelectBill + // + this.btnSelectBill.Location = new System.Drawing.Point(952, 294); + this.btnSelectBill.Margin = new System.Windows.Forms.Padding(4); + this.btnSelectBill.Name = "btnSelectBill"; + this.btnSelectBill.Size = new System.Drawing.Size(341, 182); + this.btnSelectBill.TabIndex = 3; + this.btnSelectBill.Text = "Select Bill"; + this.btnSelectBill.UseVisualStyleBackColor = true; + this.btnSelectBill.Click += new System.EventHandler(this.btnSelectBill_Click); + // + // btnStartBill + // + this.btnStartBill.Location = new System.Drawing.Point(952, 78); + this.btnStartBill.Margin = new System.Windows.Forms.Padding(4); + this.btnStartBill.Name = "btnStartBill"; + this.btnStartBill.Size = new System.Drawing.Size(341, 209); + this.btnStartBill.TabIndex = 2; + this.btnStartBill.Text = "New Bill - F6"; + this.btnStartBill.UseVisualStyleBackColor = true; + this.btnStartBill.Click += new System.EventHandler(this.btnStartBill_Click); + // + // tcPending + // + this.tcPending.Controls.Add(this.tpToday); + this.tcPending.Controls.Add(this.tpWeek); + this.tcPending.Controls.Add(this.tpAll); + this.tcPending.Controls.Add(this.tpAlarm); + this.tcPending.Location = new System.Drawing.Point(256, 15); + this.tcPending.Margin = new System.Windows.Forms.Padding(4); + this.tcPending.Name = "tcPending"; + this.tcPending.SelectedIndex = 0; + this.tcPending.Size = new System.Drawing.Size(361, 25); + this.tcPending.TabIndex = 1; + this.tcPending.SelectedIndexChanged += new System.EventHandler(this.tcPending_SelectedIndexChanged); + // + // tpToday + // + this.tpToday.Location = new System.Drawing.Point(4, 25); + this.tpToday.Margin = new System.Windows.Forms.Padding(4); + this.tpToday.Name = "tpToday"; + this.tpToday.Padding = new System.Windows.Forms.Padding(4); + this.tpToday.Size = new System.Drawing.Size(353, 0); + this.tpToday.TabIndex = 1; + this.tpToday.Text = "Today"; + this.tpToday.UseVisualStyleBackColor = true; + // + // tpWeek + // + this.tpWeek.Location = new System.Drawing.Point(4, 25); + this.tpWeek.Margin = new System.Windows.Forms.Padding(4); + this.tpWeek.Name = "tpWeek"; + this.tpWeek.Padding = new System.Windows.Forms.Padding(4); + this.tpWeek.Size = new System.Drawing.Size(353, 0); + this.tpWeek.TabIndex = 2; + this.tpWeek.Text = "Week"; + this.tpWeek.UseVisualStyleBackColor = true; + // + // tpAll + // + this.tpAll.Location = new System.Drawing.Point(4, 25); + this.tpAll.Margin = new System.Windows.Forms.Padding(4); + this.tpAll.Name = "tpAll"; + this.tpAll.Padding = new System.Windows.Forms.Padding(4); + this.tpAll.Size = new System.Drawing.Size(353, 0); + this.tpAll.TabIndex = 3; + this.tpAll.Text = "All"; + this.tpAll.UseVisualStyleBackColor = true; + // + // tpAlarm + // + this.tpAlarm.Location = new System.Drawing.Point(4, 25); + this.tpAlarm.Margin = new System.Windows.Forms.Padding(4); + this.tpAlarm.Name = "tpAlarm"; + this.tpAlarm.Padding = new System.Windows.Forms.Padding(4); + this.tpAlarm.Size = new System.Drawing.Size(353, 0); + this.tpAlarm.TabIndex = 5; + this.tpAlarm.Text = "Alarms"; + this.tpAlarm.UseVisualStyleBackColor = true; + // + // lblUser + // + this.lblUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblUser.ForeColor = System.Drawing.Color.Red; + this.lblUser.Location = new System.Drawing.Point(192, 652); + this.lblUser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblUser.Name = "lblUser"; + this.lblUser.Size = new System.Drawing.Size(752, 140); + this.lblUser.TabIndex = 135; + this.lblUser.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // billNoDataGridViewTextBoxColumn // this.billNoDataGridViewTextBoxColumn.DataPropertyName = "BillNo"; @@ -709,13 +851,6 @@ this.kotDataGridViewTextBoxColumn.Name = "kotDataGridViewTextBoxColumn"; this.kotDataGridViewTextBoxColumn.Width = 54; // - // TableID - // - this.TableID.DataPropertyName = "TableID"; - this.TableID.HeaderText = "TableID"; - this.TableID.Name = "TableID"; - this.TableID.Width = 82; - // // amountDataGridViewTextBoxColumn // this.amountDataGridViewTextBoxColumn.DataPropertyName = "Amount"; @@ -781,164 +916,30 @@ // this.bsPending.DataSource = typeof(Tanshu.Accounts.Contracts.PendingBillsBO); // - // btnAlarm + // printedDataGridViewTextBoxColumn // - this.btnAlarm.Location = new System.Drawing.Point(1133, 484); - this.btnAlarm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnAlarm.Name = "btnAlarm"; - this.btnAlarm.Size = new System.Drawing.Size(160, 79); - this.btnAlarm.TabIndex = 136; - this.btnAlarm.Text = "Alarm"; - this.btnAlarm.UseVisualStyleBackColor = true; - this.btnAlarm.Click += new System.EventHandler(this.btnAlarm_Click); + this.printedDataGridViewTextBoxColumn.DataPropertyName = "Printed"; + dataGridViewCellStyle3.Format = "N2"; + this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3; + this.printedDataGridViewTextBoxColumn.HeaderText = "Printed"; + this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn"; + this.printedDataGridViewTextBoxColumn.ReadOnly = true; + this.printedDataGridViewTextBoxColumn.Width = 5; // - // chkRefresh + // additionalDataGridViewTextBoxColumn // - this.chkRefresh.AutoSize = true; - this.chkRefresh.Checked = true; - this.chkRefresh.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkRefresh.Location = new System.Drawing.Point(952, 49); - this.chkRefresh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.chkRefresh.Name = "chkRefresh"; - this.chkRefresh.Size = new System.Drawing.Size(160, 21); - this.chkRefresh.TabIndex = 134; - this.chkRefresh.Text = "Keep refreshing Bills"; - this.chkRefresh.UseVisualStyleBackColor = true; + this.additionalDataGridViewTextBoxColumn.DataPropertyName = "Additional"; + dataGridViewCellStyle4.Format = "N2"; + dataGridViewCellStyle4.NullValue = null; + this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4; + this.additionalDataGridViewTextBoxColumn.HeaderText = "Additional"; + this.additionalDataGridViewTextBoxColumn.Name = "additionalDataGridViewTextBoxColumn"; + this.additionalDataGridViewTextBoxColumn.ReadOnly = true; + this.additionalDataGridViewTextBoxColumn.Width = 5; // - // btnRefresh + // bindingSource // - this.btnRefresh.Location = new System.Drawing.Point(12, 649); - this.btnRefresh.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnRefresh.Name = "btnRefresh"; - this.btnRefresh.Size = new System.Drawing.Size(172, 144); - this.btnRefresh.TabIndex = 133; - this.btnRefresh.Text = "Refresh - F5"; - this.btnRefresh.UseVisualStyleBackColor = true; - this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); - // - // btnPaidCC - // - this.btnPaidCC.Location = new System.Drawing.Point(1133, 574); - this.btnPaidCC.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnPaidCC.Name = "btnPaidCC"; - this.btnPaidCC.Size = new System.Drawing.Size(160, 68); - this.btnPaidCC.TabIndex = 6; - this.btnPaidCC.Text = "Paid By CC"; - this.btnPaidCC.UseVisualStyleBackColor = true; - this.btnPaidCC.Click += new System.EventHandler(this.btnPaidCC_Click); - // - // btnPaidCash - // - this.btnPaidCash.Location = new System.Drawing.Point(952, 649); - this.btnPaidCash.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnPaidCash.Name = "btnPaidCash"; - this.btnPaidCash.Size = new System.Drawing.Size(173, 144); - this.btnPaidCash.TabIndex = 5; - this.btnPaidCash.Text = "Paid"; - this.btnPaidCash.UseVisualStyleBackColor = true; - this.btnPaidCash.Click += new System.EventHandler(this.btnPaidCash_Click); - // - // btnBillList - // - this.btnBillList.Location = new System.Drawing.Point(952, 484); - this.btnBillList.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnBillList.Name = "btnBillList"; - this.btnBillList.Size = new System.Drawing.Size(173, 158); - this.btnBillList.TabIndex = 4; - this.btnBillList.Text = "List Of Bills to Cancel"; - this.btnBillList.UseVisualStyleBackColor = true; - this.btnBillList.Click += new System.EventHandler(this.btnBillList_Click); - // - // btnSelectBill - // - this.btnSelectBill.Location = new System.Drawing.Point(952, 294); - this.btnSelectBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnSelectBill.Name = "btnSelectBill"; - this.btnSelectBill.Size = new System.Drawing.Size(341, 182); - this.btnSelectBill.TabIndex = 3; - this.btnSelectBill.Text = "Select Bill"; - this.btnSelectBill.UseVisualStyleBackColor = true; - this.btnSelectBill.Click += new System.EventHandler(this.btnSelectBill_Click); - // - // btnStartBill - // - this.btnStartBill.Location = new System.Drawing.Point(952, 78); - this.btnStartBill.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnStartBill.Name = "btnStartBill"; - this.btnStartBill.Size = new System.Drawing.Size(341, 209); - this.btnStartBill.TabIndex = 2; - this.btnStartBill.Text = "New Bill - F6"; - this.btnStartBill.UseVisualStyleBackColor = true; - this.btnStartBill.Click += new System.EventHandler(this.btnStartBill_Click); - // - // tcPending - // - this.tcPending.Controls.Add(this.tpToday); - this.tcPending.Controls.Add(this.tpWeek); - this.tcPending.Controls.Add(this.tpAll); - this.tcPending.Controls.Add(this.tpAlarm); - this.tcPending.Location = new System.Drawing.Point(256, 15); - this.tcPending.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tcPending.Name = "tcPending"; - this.tcPending.SelectedIndex = 0; - this.tcPending.Size = new System.Drawing.Size(361, 25); - this.tcPending.TabIndex = 1; - this.tcPending.SelectedIndexChanged += new System.EventHandler(this.tcPending_SelectedIndexChanged); - // - // tpToday - // - this.tpToday.Location = new System.Drawing.Point(4, 25); - this.tpToday.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpToday.Name = "tpToday"; - this.tpToday.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpToday.Size = new System.Drawing.Size(353, 0); - this.tpToday.TabIndex = 1; - this.tpToday.Text = "Today"; - this.tpToday.UseVisualStyleBackColor = true; - // - // tpWeek - // - this.tpWeek.Location = new System.Drawing.Point(4, 25); - this.tpWeek.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpWeek.Name = "tpWeek"; - this.tpWeek.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpWeek.Size = new System.Drawing.Size(353, 0); - this.tpWeek.TabIndex = 2; - this.tpWeek.Text = "Week"; - this.tpWeek.UseVisualStyleBackColor = true; - // - // tpAll - // - this.tpAll.Location = new System.Drawing.Point(4, 25); - this.tpAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpAll.Name = "tpAll"; - this.tpAll.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpAll.Size = new System.Drawing.Size(353, 0); - this.tpAll.TabIndex = 3; - this.tpAll.Text = "All"; - this.tpAll.UseVisualStyleBackColor = true; - // - // tpAlarm - // - this.tpAlarm.Location = new System.Drawing.Point(4, 25); - this.tpAlarm.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpAlarm.Name = "tpAlarm"; - this.tpAlarm.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tpAlarm.Size = new System.Drawing.Size(353, 0); - this.tpAlarm.TabIndex = 5; - this.tpAlarm.Text = "Alarms"; - this.tpAlarm.UseVisualStyleBackColor = true; - // - // lblUser - // - this.lblUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblUser.ForeColor = System.Drawing.Color.Red; - this.lblUser.Location = new System.Drawing.Point(192, 652); - this.lblUser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblUser.Name = "lblUser"; - this.lblUser.Size = new System.Drawing.Size(752, 140); - this.lblUser.TabIndex = 135; - this.lblUser.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.bindingSource.DataSource = typeof(Tanshu.Accounts.Contracts.SalesBillItemBO); // // bsWaiter // @@ -952,7 +953,7 @@ this.Controls.Add(this.pnlWaiting); this.Controls.Add(this.pnlBilling); this.KeyPreview = true; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.Name = "SalesForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -961,14 +962,14 @@ this.Load += new System.EventHandler(this.SalesForm_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SalesForm_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); this.pnlBilling.ResumeLayout(false); this.pnlBilling.PerformLayout(); this.pnlWaiting.ResumeLayout(false); this.pnlWaiting.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvPending)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.bsPending)).EndInit(); this.tcPending.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.bsPending)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsWaiter)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs index b73287f..d113d72 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.cs @@ -712,7 +712,7 @@ namespace Tanshu.Accounts.PointOfSale voidReason.ShowDialog(); if (voidReason.SelectedItem != null) { - new SaleVoucherBI().VoidBill(_billInfo.VoucherID, voidReason.SelectedItem.Description); + new SaleVoucherBI().VoidBill(_billInfo.VoucherID, voidReason.SelectedItem.Description, CurrentUser.user.UserID); ClearBill(); } else diff --git a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx index 4a412fa..aeade32 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx +++ b/Tanshu.Accounts.PointOfSale/Sales/SalesForm.resx @@ -126,6 +126,9 @@ 17, 17 + + True + True @@ -135,6 +138,18 @@ 248, 17 + + True + + + True + + + 248, 17 + + + 17, 17 + 148, 17 diff --git a/Tanshu.Accounts.Print/Thermal.cs b/Tanshu.Accounts.Print/Thermal.cs index eb2d9cf..bf46a72 100644 --- a/Tanshu.Accounts.Print/Thermal.cs +++ b/Tanshu.Accounts.Print/Thermal.cs @@ -219,35 +219,51 @@ namespace Tanshu.Accounts.Print } catch (Exception ex) { - throw ex; + throw; } } public static Boolean PrintSale(List det, DateTime startDate, DateTime endDate) { - try + var printText = FormatText(CurrentUser.user.Name, 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 d in det) { - var printText = FormatText(CurrentUser.user.Name, 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 (SalesAnalysisBO d in det) + if (d.Section.Length > 30) + d.Section = d.Section.Substring(0, 30); + if (d.Gross != 0) { - 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 += DrawEqual; - printText += CutPrinter; - return PrintRaw(printText, "Sale Detail " + CurrentUser.user.Name); - } - catch (Exception ex) - { - throw ex; + else + { + printText += string.Format("\n\r{0,-32} {1,9:#,##0}", d.Section, d.Net); + } + printText += DrawLine; } + printText += DrawEqual; + printText += CutPrinter; + return PrintRaw(printText, "Sale Detail " + CurrentUser.user.Name); + } + public static Boolean PrintSale(List det, DateTime startDate, DateTime endDate) + { + var printText = FormatText(CurrentUser.user.Name, 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 d in det) + { + printText += string.Format("\n\r{0,-23} {1,9:#,##0.00} {2,8:#,##0}", d.Product, d.Quantity, d.Amount); + printText += DrawLine; + } + printText += DrawEqual; + printText += CutPrinter; + return PrintRaw(printText, "Sale Detail " + CurrentUser.user.Name); } private static string CashLine(IDictionary amount, int key) diff --git a/Tanshu.Accounts.SqlDAO/AdvanceDAO.cs b/Tanshu.Accounts.SqlDAO/AdvanceDAO.cs index 10401c7..42ab3c7 100644 --- a/Tanshu.Accounts.SqlDAO/AdvanceDAO.cs +++ b/Tanshu.Accounts.SqlDAO/AdvanceDAO.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class AdvanceDAO : BaseDAO, IAdvanceDAO + public class AdvanceDAO : BaseDAO { public AdvanceDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs b/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs index 2e40ca5..124b30a 100644 --- a/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs +++ b/Tanshu.Accounts.SqlDAO/CheckoutDAO.cs @@ -2,12 +2,11 @@ using System.Data.SqlClient; using System.Data; using Tanshu.Accounts.Contracts; -using Tanshu.Accounts.DAOFactory; using Tanshu.Data.DAO; namespace Tanshu.Accounts.SqlDAO { - public class CheckoutDAO : BaseDAO, ICheckoutDAO + public class CheckoutDAO : BaseDAO { private readonly DateTime _startDate; private readonly DateTime _finishDate; @@ -25,13 +24,13 @@ namespace Tanshu.Accounts.SqlDAO info = ""; const string query = @" -SELECT t.Date, s.BillID, c.Name, SUM(i.Amount) AS Amount, SUM(Quantity * Rate * Discount) AS Discount FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID +SELECT t.Date, s.BillID, c.Name, t.LastEditDate, SUM(i.Amount) AS Amount, SUM(i.Quantity * i.Rate * i.Discount) AS Discount FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID INNER JOIN Inventory i ON t.VoucherID = i.VoucherID INNER JOIN Customers c ON s.CustomerID = c.CustomerID WHERE t.Type = 'S' AND t.LastEditDate BETWEEN @StartDate AND @FinishDate AND t.UserID = @UserID AND s.PaidStatus = @PaidStatus -GROUP BY t.Date, c.Name, s.BillID +GROUP BY t.Date, c.Name, s.BillID, t.LastEditDate "; using (var cmd = new SqlCommand(query)) { @@ -48,9 +47,10 @@ GROUP BY t.Date, c.Name, s.BillID do { - amount += dr.GetDecimal(3); + amount += dr.GetDecimal(4); info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", dr.GetDateTime(0), dr.GetString(1), dr.GetString(2)); - info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", dr.GetDecimal(3), dr.GetDecimal(4)); + info += string.Format("\n\rPaid / Void Time {0:dd-MMM-yyyy HH:mm:ss}", dr.GetDateTime(3)); + info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", dr.GetDecimal(4), dr.GetDecimal(5)); info += "\n\r------------------------------------------"; } while (dr.Read()); } diff --git a/Tanshu.Accounts.SqlDAO/CustomerDAO.cs b/Tanshu.Accounts.SqlDAO/CustomerDAO.cs index 229ffc5..c6e0e7a 100644 --- a/Tanshu.Accounts.SqlDAO/CustomerDAO.cs +++ b/Tanshu.Accounts.SqlDAO/CustomerDAO.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class CustomerDAO : BaseDAO, ICustomerDAO + public class CustomerDAO : BaseDAO { public CustomerDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/InventoryDAO.cs b/Tanshu.Accounts.SqlDAO/InventoryDAO.cs index 04617b9..d704f31 100644 --- a/Tanshu.Accounts.SqlDAO/InventoryDAO.cs +++ b/Tanshu.Accounts.SqlDAO/InventoryDAO.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class InventoryDAO : BaseDAO, IInventoryDAO + public class InventoryDAO : BaseDAO { public InventoryDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/LedgerDAO.cs b/Tanshu.Accounts.SqlDAO/LedgerDAO.cs index 7fbc597..2fe57df 100644 --- a/Tanshu.Accounts.SqlDAO/LedgerDAO.cs +++ b/Tanshu.Accounts.SqlDAO/LedgerDAO.cs @@ -1,14 +1,13 @@ - using System; +using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class LedgerDAO : BaseDAO , ILedgerDAO + public class LedgerDAO : BaseDAO { public LedgerDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/ManagementDAO.cs b/Tanshu.Accounts.SqlDAO/ManagementDAO.cs index 55fcbf9..b2334db 100644 --- a/Tanshu.Accounts.SqlDAO/ManagementDAO.cs +++ b/Tanshu.Accounts.SqlDAO/ManagementDAO.cs @@ -1,15 +1,14 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; using System.Data; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class ManagementDAO : BaseDAO, IManagementDAO + public class ManagementDAO : BaseDAO { private DateTime startDate; private DateTime finishDate; diff --git a/Tanshu.Accounts.SqlDAO/MembershipDAO.cs b/Tanshu.Accounts.SqlDAO/MembershipDAO.cs index 735f40a..71c4656 100644 --- a/Tanshu.Accounts.SqlDAO/MembershipDAO.cs +++ b/Tanshu.Accounts.SqlDAO/MembershipDAO.cs @@ -1,15 +1,14 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; using System.Data; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class MembershipDAO : BaseDAO, IMembershipDAO + public class MembershipDAO : BaseDAO { public MembershipDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/PaymentDAO.cs b/Tanshu.Accounts.SqlDAO/PaymentDAO.cs index 3304612..6184a51 100644 --- a/Tanshu.Accounts.SqlDAO/PaymentDAO.cs +++ b/Tanshu.Accounts.SqlDAO/PaymentDAO.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class PaymentDAO : BaseDAO, IPaymentDAO + public class PaymentDAO : BaseDAO { public PaymentDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/ProductDAO.cs b/Tanshu.Accounts.SqlDAO/ProductDAO.cs index aec59a1..4cb5338 100644 --- a/Tanshu.Accounts.SqlDAO/ProductDAO.cs +++ b/Tanshu.Accounts.SqlDAO/ProductDAO.cs @@ -1,16 +1,15 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; using System.Data; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class ProductDAO : BaseDAO, IProductDAO + public class ProductDAO : BaseDAO { public ProductDAO(IConnectionDAO connection) : base(connection) @@ -21,13 +20,12 @@ namespace Tanshu.Accounts.SqlDAO product.ProductID = Guid.NewGuid(); SqlCommand cmd = new SqlCommand(@" SELECT @Code = ISNULL(MAX(Code), 0) + 1 FROM Products; -INSERT INTO Products (ProductID, Code, Name, Units, ProductTypeID, SaleLedgerID, SaleTaxID ,SalePrice , PurchaseLedgerID ,PurchaseTaxID , PurchasePrice, Discontinued, MinimumLevel, MaximumLevel, SortOrder) VALUES (@ProductID, @Code, @Name, @Units, @ProductTypeID, @SaleLedgerID, @SaleTaxID, @SalePrice ,@PurchaseLedgerID ,@PurchaseTaxID , @PurchasePrice, @Discontinued, @MinimumLevel, @MaximumLevel, @SortOrder); +INSERT INTO Products (ProductID, Code, Name, ShortName, BarCode, Units, ProductTypeID, SaleLedgerID, SaleTaxID ,SalePrice , PurchaseLedgerID ,PurchaseTaxID , PurchasePrice, Discontinued, MinimumLevel, MaximumLevel, SortOrder) VALUES (@ProductID, @Code, @Name, '', '', @Units, @ProductTypeID, @SaleLedgerID, @SaleTaxID, @SalePrice ,@PurchaseLedgerID ,@PurchaseTaxID , @PurchasePrice, @Discontinued, @MinimumLevel, @MaximumLevel, @SortOrder); SELECT @timestamp = timestamp FROM Products WHERE ProductID = @ProductID;"); { cmd.Parameters.AddWithValue("@ProductID", product.ProductID); cmd.Parameters.Add("@Code", SqlDbType.Int); cmd.Parameters["@Code"].Direction = ParameterDirection.Output; - cmd.Parameters.AddWithValue("@Code", product.Code); cmd.Parameters.AddWithValue("@Name", product.Name); cmd.Parameters.AddWithValue("@Units", product.Units); cmd.Parameters.AddWithValue("@ProductTypeID", product.ProductTypeID); diff --git a/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs b/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs index 112ac58..7480ab1 100644 --- a/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs +++ b/Tanshu.Accounts.SqlDAO/SaleVoucherDAO.cs @@ -2,11 +2,11 @@ using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class SaleVoucherDAO : BaseDAO, ISaleVoucherDAO + public class SaleVoucherDAO : BaseDAO { public SaleVoucherDAO(IConnectionDAO connection) : base(connection) @@ -151,11 +151,12 @@ IF @Printed = 1 AND (SELECT Printed FROM SaleVoucher WHERE VoucherID = @VoucherI connection.ExecuteNonQuery(cmd); } } - public void VoidBill(Guid voucherID, string reason) + public void VoidBill(Guid voucherID, string reason, Guid userID) { - using (SqlCommand cmd = new SqlCommand(@"UPDATE SaleVoucher SET PaidStatus = @PaidStatus, VoidReason = @VoidReason WHERE VoucherID = @VoucherID")) - { + using (SqlCommand cmd = new SqlCommand(@"UPDATE SaleVoucher SET PaidStatus = @PaidStatus, VoidReason = @VoidReason WHERE VoucherID = @VoucherID; UPDATE Vouchers SET UserID = @UserID, LastEditDate = GETDATE() WHERE VoucherID = @VoucherID")) + { cmd.Parameters.AddWithValue("@VoucherID", voucherID); + cmd.Parameters.AddWithValue("@UserID", userID); cmd.Parameters.AddWithValue("@PaidStatus", (int)PaidStatus.Void); cmd.Parameters.AddWithValue("@VoidReason", reason); connection.ExecuteNonQuery(cmd); diff --git a/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs b/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs index ec25eed..995ea79 100644 --- a/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs +++ b/Tanshu.Accounts.SqlDAO/SaleVoucherMixDAO.cs @@ -2,14 +2,13 @@ using System.Collections.Generic; using Tanshu.Accounts.Contracts; using System.Data.SqlClient; -using System.Data; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class SaleVoucherMixDAO : BaseDAO, ISaleVoucherMixDAO + public class SaleVoucherMixDAO : BaseDAO { public SaleVoucherMixDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/SalesAnalysisDAO.cs b/Tanshu.Accounts.SqlDAO/SalesAnalysisDAO.cs index 18ae89d..b7c8dc3 100644 --- a/Tanshu.Accounts.SqlDAO/SalesAnalysisDAO.cs +++ b/Tanshu.Accounts.SqlDAO/SalesAnalysisDAO.cs @@ -3,11 +3,11 @@ using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using System; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class SalesAnalysisDAO : BaseDAO, ISalesAnalysisDAO + public class SalesAnalysisDAO : BaseDAO { public SalesAnalysisDAO(IConnectionDAO connection) : base(connection) @@ -247,14 +247,68 @@ ORDER BY Net DESC;"; gross += i.Gross; net += i.Net; } - var item = new SalesAnalysisBO + list.Add(new SalesAnalysisBO { + Section = "Total", Gross = gross, - Net = net, - }; - item.Section = string.Format("Total: {0:#,##0.00;(#,##0.00);0}", item.Gross - item.Net); - list.Add(item); - return list; + Net = net + }); + list.Add(new SalesAnalysisBO() { Section = " -- ", Gross = 0, Net = 0 }); + list.Add(new SalesAnalysisBO + { + Section = "Tax", + Net = gross - net + }); + return GetSettlement(list, startDate, finishDate); + } + } + + private List GetSettlement(List outList, DateTime startDate, DateTime finishDate) + { + outList.Add(new SalesAnalysisBO() { Section = " -- ", Gross = 0, Net = 0 }); + if (finishDate <= startDate) + return new List(); + using (var cmd = new SqlCommand()) + { + const string query = @" +SELECT s.PaidStatus AS Status, Sum(i.Amount) AS Amount +FROM Vouchers v INNER JOIN SaleVoucher s ON v.VoucherID = s.VoucherID +INNER JOIN Inventory i ON v.VoucherID = i.VoucherID +WHERE v.LastEditDate BETWEEN @StartDate AND @FinishDate +GROUP BY s.PaidStatus +ORDER BY s.PaidStatus +"; + cmd.CommandText = query; + cmd.Parameters.AddWithValue("@StartDate", startDate); + cmd.Parameters.AddWithValue("@FinishDate", finishDate); + + var list = BusinessObjectDAO.GetBusinessObjects(connection.ExecuteReader(cmd)); + decimal amount = 0; + foreach (var item in list) + { + amount += item.Amount; + outList.Add(new SalesAnalysisBO(){ Section = item.Status.ToString() , Net = item.Amount}); + } + outList.Add(new SalesAnalysisBO() { Section = "Total", Net = amount }); + return outList; + } + } + + public decimal GetDetail(PaidStatus paidStatus, DateTime startDate, DateTime finishDate) + { + const string query = @" +SELECT SUM(i.Amount) AS Amount, SUM(i.Quantity * i.Rate * i.Discount) AS Discount 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.PaidStatus = @PaidStatus +"; + using (var cmd = new SqlCommand(query)) + { + cmd.Parameters.AddWithValue("@PaidStatus", (int)paidStatus); + cmd.Parameters.AddWithValue("@StartDate", startDate); + cmd.Parameters.AddWithValue("@FinishDate", finishDate); + return (decimal)connection.ExecuteScalar(cmd); } } } diff --git a/Tanshu.Accounts.SqlDAO/UserDAO.cs b/Tanshu.Accounts.SqlDAO/UserDAO.cs index 21d1eea..8b0aa94 100644 --- a/Tanshu.Accounts.SqlDAO/UserDAO.cs +++ b/Tanshu.Accounts.SqlDAO/UserDAO.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class UserDAO : BaseDAO, IUserDAO + public class UserDAO : BaseDAO { public UserDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/VoucherDAO.cs b/Tanshu.Accounts.SqlDAO/VoucherDAO.cs index bc66ca2..48f9e97 100644 --- a/Tanshu.Accounts.SqlDAO/VoucherDAO.cs +++ b/Tanshu.Accounts.SqlDAO/VoucherDAO.cs @@ -2,11 +2,11 @@ using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class VoucherDAO : BaseDAO, IVoucherDAO + public class VoucherDAO : BaseDAO { public VoucherDAO(IConnectionDAO connection) : base(connection) diff --git a/Tanshu.Accounts.SqlDAO/WaiterDAO.cs b/Tanshu.Accounts.SqlDAO/WaiterDAO.cs index 384b5d0..6cf7d30 100644 --- a/Tanshu.Accounts.SqlDAO/WaiterDAO.cs +++ b/Tanshu.Accounts.SqlDAO/WaiterDAO.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; -using System.Text; using System.Data.SqlClient; using Tanshu.Accounts.Contracts; using Tanshu.Data.DAO; -using Tanshu.Accounts.DAOFactory; + namespace Tanshu.Accounts.SqlDAO { - public class WaiterDAO : BaseDAO, IWaiterDAO + public class WaiterDAO : BaseDAO { public WaiterDAO(IConnectionDAO connection) diff --git a/Tanshu.Accounts.sln b/Tanshu.Accounts.sln index 489b0ef..cdd748b 100644 --- a/Tanshu.Accounts.sln +++ b/Tanshu.Accounts.sln @@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Accounts.Print", "Ta EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Accounts.SqlDAO", "Tanshu.Accounts.SqlDAO\Tanshu.Accounts.SqlDAO.csproj", "{B755D152-37C3-47D6-A721-3AD17A8EF316}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tanshu.Accounts.DAOFactory", "Tanshu.Accounts.DAOFactory\Tanshu.Accounts.DAOFactory.csproj", "{AC7AA7C5-4712-4992-B733-092D703E7AA9}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,10 +43,6 @@ Global {B755D152-37C3-47D6-A721-3AD17A8EF316}.Debug|Any CPU.Build.0 = Debug|Any CPU {B755D152-37C3-47D6-A721-3AD17A8EF316}.Release|Any CPU.ActiveCfg = Release|Any CPU {B755D152-37C3-47D6-A721-3AD17A8EF316}.Release|Any CPU.Build.0 = Release|Any CPU - {AC7AA7C5-4712-4992-B733-092D703E7AA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC7AA7C5-4712-4992-B733-092D703E7AA9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC7AA7C5-4712-4992-B733-092D703E7AA9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC7AA7C5-4712-4992-B733-092D703E7AA9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE