Multiple settlement options. Upgrade SQL Script included.
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<add name="FluentCon" connectionString="Server=.;Initial Catalog=Pets;User ID=sa;Password=123456" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<add key ="Location" value ="Ground"/>
|
||||
<add key ="Location" value ="Office"/>
|
||||
<add key ="Factory" value ="SqlServer"/>
|
||||
<add key ="LogConnection" value ="connection"/>
|
||||
<add key ="LogLevel" value ="Warn"/>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Repository;
|
||||
@ -8,23 +9,20 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class LoginForm : Form
|
||||
{
|
||||
private User user;
|
||||
private IKeyboardControl keyboardControl;
|
||||
private User _user;
|
||||
private IKeyboardControl _keyboardControl;
|
||||
public LoginForm(IKeyboardControl keyboardControl)
|
||||
{
|
||||
InitializeComponent();
|
||||
user = null;
|
||||
this.keyboardControl = keyboardControl;
|
||||
_user = null;
|
||||
this._keyboardControl = keyboardControl;
|
||||
|
||||
var control = keyboardControl as UserControl;
|
||||
if (control != null)
|
||||
{
|
||||
control.Location = new System.Drawing.Point(6, 87);
|
||||
var border = (this.Width - this.ClientSize.Width) / 2;
|
||||
var titlebarHeight = this.Height - this.ClientSize.Height - (2 * border);
|
||||
this.Controls.Add(control);
|
||||
this.Width = 6 + control.Width + 6 + (border * 2);
|
||||
this.Height = titlebarHeight + 87 + control.Height + 6 + (border * 2);
|
||||
this.Size = this.SizeFromClientSize(new Size(6 + control.Width + 6, 87 + control.Height + 6));
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,8 +40,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
user = UserBI.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
if (user != null)
|
||||
_user = UserBI.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
if (_user != null)
|
||||
this.Close();
|
||||
else
|
||||
MessageBox.Show("Username or password is not valid");
|
||||
@ -51,8 +49,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public bool UserName(out string userName)
|
||||
{
|
||||
userName = this.user == null ? "" : this.user.Name;
|
||||
return this.user != null;
|
||||
userName = this._user == null ? "" : this._user.Name;
|
||||
return this._user != null;
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
|
||||
@ -1,39 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.PointOfSale.Sales;
|
||||
using Tanshu.Accounts.Print;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Common;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class BillController
|
||||
{
|
||||
private Voucher billInfo;
|
||||
private OrderedDictionary<BillItemKey, BillInventory> bill = new OrderedDictionary<BillItemKey, BillInventory>();
|
||||
int? editVoucherID;
|
||||
private readonly OrderedDictionary<BillItemKey, BillInventory> bill =
|
||||
new OrderedDictionary<BillItemKey, BillInventory>();
|
||||
|
||||
private Voucher _billInfo;
|
||||
private Customer _customer = new CustomerBI().GetCustomer(1);
|
||||
|
||||
private int? _editVoucherID;
|
||||
|
||||
private ISaleForm _saleForm;
|
||||
|
||||
ISaleForm saleForm;
|
||||
private Customer customer = new CustomerBI().GetCustomer(1);
|
||||
public BillController(int? editVoucherID)
|
||||
{
|
||||
this.editVoucherID = editVoucherID;
|
||||
this._editVoucherID = editVoucherID;
|
||||
}
|
||||
|
||||
public BillInventory CurrentProduct
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
var item = bill.ElementAt(_saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID == -1)
|
||||
return null;
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BillInventory CurrentKot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
KeyValuePair<BillItemKey, BillInventory> item = bill.ElementAt(_saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID != -1)
|
||||
return null;
|
||||
if (item.Key.ProductID == 0)
|
||||
return null;
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void InitGui(ISaleForm saleForm)
|
||||
{
|
||||
this.saleForm = saleForm;
|
||||
this.saleForm.SetCustomerDisplay(customer.Name);
|
||||
this.saleForm.SetUserName(Session.User.Name);
|
||||
|
||||
this._saleForm = saleForm;
|
||||
this._saleForm.SetCustomerDisplay(_customer.Name);
|
||||
this._saleForm.SetUserName(Session.User.Name);
|
||||
}
|
||||
|
||||
private void InitComponents()
|
||||
{
|
||||
InitModel();
|
||||
@ -49,10 +85,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddProductToGrid(int productID)
|
||||
{
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, productID).AddProduct();
|
||||
Product product = ProductBI.GetProduct(productID);
|
||||
new BillHelperFunctions(_saleForm.BindingSource, bill, productID).AddProduct();
|
||||
var product = ProductBI.GetProduct(productID);
|
||||
if (ProductGroupModifierBI.HasCompulsoryModifier(product.ProductGroup.ProductGroupID))
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
@ -85,16 +122,16 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
HashSet<string> outList;
|
||||
decimal discount = frm.Selection(out outList);
|
||||
var discount = frm.Selection(out outList);
|
||||
discount = discount / 100;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.KotID == -1)
|
||||
continue;
|
||||
var pg = new ProductGroupBI().GetProductGroupOfProduct(item.Value.ProductID);
|
||||
ProductGroup pg = new ProductGroupBI().GetProductGroupOfProduct(item.Value.ProductID);
|
||||
if (outList.Contains(pg.GroupType))
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, item.Value.ProductID).SetDiscount(item.Value.Name, discount);
|
||||
|
||||
new BillHelperFunctions(_saleForm.BindingSource, bill, item.Value.ProductID).SetDiscount(
|
||||
item.Value.Name, discount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,244 +140,102 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void ShowCustomerList(bool reset)
|
||||
{
|
||||
if ((customer.CustomerID == 1) && (!reset))
|
||||
if ((_customer.CustomerID == 1) && (!reset))
|
||||
{
|
||||
using (SelectCustomer selectCustomer = new SelectCustomer(new CustomerBI().GetFilteredCustomers, true))
|
||||
using (var selectCustomer = new SelectCustomer(new CustomerBI().GetFilteredCustomers, true))
|
||||
{
|
||||
selectCustomer.customerEvent += new CustomerEventHandler(selectCustomer_customerEvent);
|
||||
selectCustomer.customerEvent += selectCustomer_customerEvent;
|
||||
selectCustomer.ShowDialog();
|
||||
if (selectCustomer.SelectedItem != null)
|
||||
{
|
||||
customer = selectCustomer.SelectedItem;
|
||||
saleForm.SetCustomerDisplay(customer.Name);
|
||||
_customer = selectCustomer.SelectedItem;
|
||||
_saleForm.SetCustomerDisplay(_customer.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
customer = new CustomerBI().GetCustomer(1);
|
||||
_customer = new CustomerBI().GetCustomer(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
customer = new CustomerBI().GetCustomer(1);
|
||||
saleForm.SetCustomerDisplay(customer.Name);
|
||||
_customer = new CustomerBI().GetCustomer(1);
|
||||
_saleForm.SetCustomerDisplay(_customer.Name);
|
||||
}
|
||||
}
|
||||
|
||||
#region Save
|
||||
// if (btnWaiter.Tag == null)
|
||||
//btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
|
||||
public void Save(bool print, int waiterID, string tableID)
|
||||
{
|
||||
|
||||
if (print && !Session.IsAllowed(RoleConstants.PRINT_BILL))
|
||||
return;
|
||||
if (!print && !Session.IsAllowed(RoleConstants.PRINT_KOT))
|
||||
return;
|
||||
if ((billInfo != null) && (VoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
return;
|
||||
if (bill.Count == 1) //new kot only
|
||||
return;
|
||||
if (print)
|
||||
ShowDiscount();
|
||||
int? saved;
|
||||
if (billInfo == null)
|
||||
saved = InsertVoucher(print, waiterID, tableID);
|
||||
else
|
||||
saved = UpdateSale(print, waiterID, tableID);
|
||||
if (editVoucherID.HasValue)
|
||||
saleForm.CloseWindow();
|
||||
else
|
||||
{
|
||||
int kotID = 0;
|
||||
if (!print && saved.HasValue)
|
||||
kotID = saved.Value;
|
||||
if (print || kotID != 0)
|
||||
PrintBill(billInfo.VoucherID, kotID);
|
||||
}
|
||||
ClearBill();
|
||||
}
|
||||
private int? InsertVoucher(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
if (billInfo != null)
|
||||
{
|
||||
MessageBox.Show("Error in InsertVoucher, there is a previous sale in memory", "Error");
|
||||
return null;
|
||||
}
|
||||
#region Voucher
|
||||
billInfo = new Voucher
|
||||
{
|
||||
Customer = customer,
|
||||
Settled = SettleOption.Unsettled,
|
||||
//Paid = finalBill,
|
||||
TableID = tableID,
|
||||
Waiter = WaiterBI.GetWaiter(waiterID),
|
||||
Printed = finalBill,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
#endregion
|
||||
#region Inventories
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
return VoucherBI.Insert(billInfo);
|
||||
}
|
||||
private int? UpdateSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
#region Voucher
|
||||
billInfo.User = Session.User;
|
||||
billInfo.Customer = customer;
|
||||
if (!billInfo.Printed && finalBill)
|
||||
billInfo.Date = null;
|
||||
billInfo.Printed = billInfo.Printed || finalBill;
|
||||
billInfo.TableID = tableID;
|
||||
billInfo.Waiter = WaiterBI.GetWaiter(waiterID);
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
#region Inventory
|
||||
#endregion
|
||||
return VoucherBI.Update(billInfo);
|
||||
}
|
||||
private Kot GetKotForBill()
|
||||
{
|
||||
var kot = new Kot();
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.KotID == -1 || item.Value.Quantity == 0)
|
||||
continue;
|
||||
else if (item.Key.KotID != 0)
|
||||
{
|
||||
var oldKot = billInfo.Kots.Where(x => x.KotID == item.Key.KotID).Single();
|
||||
var inv = oldKot.Inventories.Where(x => x.Product.ProductID == item.Key.ProductID).Single();
|
||||
inv.Rate = item.Value.Price;
|
||||
inv.Discount = item.Value.Discount;
|
||||
}
|
||||
else
|
||||
{
|
||||
Inventory temp = new Inventory();
|
||||
temp.Product = ProductBI.GetProduct(item.Key.ProductID);
|
||||
temp.Quantity = item.Value.Quantity;
|
||||
temp.Rate = item.Value.Price;
|
||||
temp.Discount = item.Value.Discount;
|
||||
temp.ServiceCharge = item.Value.ServiceCharge;
|
||||
temp.Tax = item.Value.Tax;
|
||||
foreach (var mod in item.Value.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod });
|
||||
kot.Inventories.Add(temp);
|
||||
}
|
||||
}
|
||||
if (kot.Inventories.Count == 0)
|
||||
return null;
|
||||
else
|
||||
return kot;
|
||||
}
|
||||
#endregion
|
||||
public void VoidBill()
|
||||
{
|
||||
if (billInfo == null)
|
||||
if (_billInfo == null)
|
||||
return;
|
||||
if (!billInfo.Printed)
|
||||
if (!_billInfo.Printed)
|
||||
return;
|
||||
if (Session.IsAllowed(RoleConstants.VOID_BILL))
|
||||
if (!Session.IsAllowed(RoleConstants.VOID_BILL))
|
||||
return;
|
||||
if (MessageBox.Show("Are you sure you want to void this bill?", "Void Bill", MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
|
||||
return;
|
||||
var voidReason = new SelectVoidReason(GetVoidReason, true);
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
{
|
||||
if (MessageBox.Show("Are you sure you want to void this bill?", "Void Bill", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
|
||||
{
|
||||
SelectVoidReason voidReason = new SelectVoidReason(GetVoidReason, true);
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
{
|
||||
VoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
ClearBill();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
}
|
||||
VoucherBI.VoidBill(_billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
ClearBill();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Please Select a reason if you want to void the bill", "Bill NOT Voided",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
}
|
||||
Customer selectCustomer_customerEvent(object sender, CustomerEventArgs e)
|
||||
|
||||
private Customer selectCustomer_customerEvent(object sender, CustomerEventArgs e)
|
||||
{
|
||||
using (CustomersForm form = new CustomersForm(e.CustomerID, e.Phone))
|
||||
using (var form = new CustomersForm(e.CustomerID, e.Phone))
|
||||
{
|
||||
form.ShowDialog();
|
||||
return form.Customer;
|
||||
}
|
||||
}
|
||||
private void PrintBill(int voucherID, int kotID)
|
||||
|
||||
private static void PrintBill(int voucherID, int kotID)
|
||||
{
|
||||
if (kotID == 0)
|
||||
Accounts.Print.Thermal.PrintBill(voucherID);
|
||||
Thermal.PrintBill(voucherID);
|
||||
else
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, kotID);
|
||||
Thermal.PrintKot(voucherID, kotID);
|
||||
}
|
||||
|
||||
private List<StringType> GetVoidReason(Dictionary<string, string> filter)
|
||||
private static List<StringType> GetVoidReason(Dictionary<string, string> filter)
|
||||
{
|
||||
List<StringType> list = new List<StringType>();
|
||||
list.Add(new StringType("Discount"));
|
||||
list.Add(new StringType("Printing Fault"));
|
||||
list.Add(new StringType("Item Changed"));
|
||||
list.Add(new StringType("Quantity Reduced"));
|
||||
list.Add(new StringType("Costing Bill for Party"));
|
||||
list.Add(new StringType("Cashier Mistake"));
|
||||
list.Add(new StringType("Management Freesale"));
|
||||
list.Add(new StringType("Other"));
|
||||
var list = new List<StringType>
|
||||
{
|
||||
new StringType("Discount"),
|
||||
new StringType("Printing Fault"),
|
||||
new StringType("Item Changed"),
|
||||
new StringType("Quantity Reduced"),
|
||||
new StringType("Costing Bill for Party"),
|
||||
new StringType("Cashier Mistake"),
|
||||
new StringType("Management Freesale"),
|
||||
new StringType("Other")
|
||||
};
|
||||
return list.Where(i => i.Description.ToLower().Contains(filter["Name"].ToLower().Trim())).ToList();
|
||||
}
|
||||
public BillInventory CurrentProduct
|
||||
{
|
||||
get
|
||||
{
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID == -1)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BillInventory CurrentKot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID != -1)
|
||||
return null;
|
||||
else if (item.Key.ProductID == 0)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowAmount()
|
||||
{
|
||||
//saleForm.BindingSource.CurrencyManager.Position = 1;
|
||||
|
||||
decimal taxAmount = bill.Values.Sum(b => b.TaxAmount);
|
||||
decimal discountAmount = bill.Values.Sum(b => b.DiscountAmount);
|
||||
decimal grossAmount = bill.Values.Sum(b => b.GrossAmount);
|
||||
decimal valueAmount = bill.Values.Sum(b => b.Value);
|
||||
decimal serviceChargeAmount = bill.Values.Sum(b => b.ServiceChargeAmount);
|
||||
var taxAmount = bill.Values.Sum(b => b.TaxAmount);
|
||||
var discountAmount = bill.Values.Sum(b => b.DiscountAmount);
|
||||
var grossAmount = bill.Values.Sum(b => b.GrossAmount);
|
||||
var valueAmount = bill.Values.Sum(b => b.Value);
|
||||
var serviceChargeAmount = bill.Values.Sum(b => b.ServiceChargeAmount);
|
||||
//bill.Values.ToList();
|
||||
saleForm.ShowAmount(discountAmount, grossAmount, serviceChargeAmount, taxAmount, valueAmount, bill.Values.ToList());
|
||||
_saleForm.ShowAmount(discountAmount, grossAmount, serviceChargeAmount, taxAmount, valueAmount,
|
||||
bill.Values.ToList());
|
||||
}
|
||||
|
||||
public void ProductRemove()
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
@ -358,7 +253,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetQuantity(item, quantity, prompt);
|
||||
new BillHelperFunctions(_saleForm.BindingSource, bill, CurrentProduct.ProductID).SetQuantity(item, quantity,
|
||||
prompt);
|
||||
ShowAmount();
|
||||
}
|
||||
|
||||
@ -367,83 +263,91 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetPrice(CurrentProduct);
|
||||
new BillHelperFunctions(_saleForm.BindingSource, bill, CurrentProduct.ProductID).SetPrice(CurrentProduct);
|
||||
ShowAmount();
|
||||
|
||||
}
|
||||
|
||||
private bool Allowed(BillInventory item, RoleConstants role)
|
||||
{
|
||||
if (item == null)
|
||||
return false;
|
||||
if (!Session.IsAllowed(role))
|
||||
return false;
|
||||
return true;
|
||||
return Session.IsAllowed(role);
|
||||
}
|
||||
|
||||
private bool Allowed(BillInventory item)
|
||||
{ return item != null; }
|
||||
{
|
||||
return item != null;
|
||||
}
|
||||
|
||||
private void InputBox_Validating(object sender, InputBoxValidatingArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void LoadBill(int voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
bill.Clear();
|
||||
billInfo = null;
|
||||
billInfo = VoucherBI.GetSaleVoucher(voucherID);
|
||||
_billInfo = null;
|
||||
_billInfo = VoucherBI.GetVoucher(voucherID);
|
||||
|
||||
this.customer = billInfo.Customer;
|
||||
saleForm.ShowInfo(billInfo.BillID, billInfo.KotID, billInfo.CreationDate, billInfo.Date.Value, billInfo.LastEditDate, customer.Name, billInfo.TableID, billInfo.Waiter.WaiterID, billInfo.Waiter.Name);
|
||||
_customer = _billInfo.Customer;
|
||||
_saleForm.ShowInfo(_billInfo.BillID, _billInfo.KotID, _billInfo.CreationDate, _billInfo.Date.Value,
|
||||
_billInfo.LastEditDate, _customer.Name, _billInfo.TableID, _billInfo.Waiter.WaiterID,
|
||||
_billInfo.Waiter.Name);
|
||||
|
||||
foreach (var kot in billInfo.Kots)
|
||||
foreach (var kot in _billInfo.Kots)
|
||||
{
|
||||
BillItemKey kotKey = new BillItemKey(kot.KotID, -1);
|
||||
var kotKey = new BillItemKey(kot.KotID, -1);
|
||||
var kotItem = new BillInventory
|
||||
{
|
||||
ProductID = kot.KotID,
|
||||
Discount = 0,
|
||||
Name = string.Format("Kot No.: {0} / KotID {1}", kot.KotID, kot.Code),
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
{
|
||||
ProductID = kot.KotID,
|
||||
Discount = 0,
|
||||
Name = string.Format("Kot No.: {0} / KotID {1}", kot.KotID, kot.Code),
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(kotKey, kotItem);
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
||||
var key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
||||
var item = new BillInventory
|
||||
{
|
||||
ProductID = inv.Product.ProductID,
|
||||
Discount = inv.Discount,
|
||||
Name = inv.Product.Units == string.Empty ? inv.Product.Name : inv.Product.Name + " (" + inv.Product.Units + ")",
|
||||
Price = inv.Rate,
|
||||
Printed = true,
|
||||
Quantity = inv.Quantity,
|
||||
Tax = inv.Tax,
|
||||
ServiceCharge = inv.ServiceCharge,
|
||||
};
|
||||
{
|
||||
ProductID = inv.Product.ProductID,
|
||||
Discount = inv.Discount,
|
||||
Name =
|
||||
inv.Product.Units == string.Empty
|
||||
? inv.Product.Name
|
||||
: inv.Product.Name + " (" + inv.Product.Units + ")",
|
||||
Price = inv.Rate,
|
||||
Printed = true,
|
||||
Quantity = inv.Quantity,
|
||||
Tax = inv.Tax,
|
||||
ServiceCharge = inv.ServiceCharge,
|
||||
};
|
||||
foreach (var mod in inv.InventoryModifier)
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
bill.Add(key, item);
|
||||
}
|
||||
}
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
ShowAmount();
|
||||
|
||||
}
|
||||
|
||||
public void LoadBillFromTable(string tableName)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
@ -453,14 +357,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
LoadBill(table.VoucherID);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
InputBoxResult result = InputBox.Show("Table Number", "0", InputBox_Validating);
|
||||
var result = InputBox.Show("Table Number", "0", InputBox_Validating);
|
||||
if (result.OK)
|
||||
{
|
||||
string tableID = result.Text.Trim();
|
||||
var tableID = result.Text.Trim();
|
||||
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
||||
{
|
||||
var table = new FoodTableBI().GetByName(tableName);
|
||||
@ -478,79 +381,82 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public void CancelBillChanges()
|
||||
{
|
||||
if (bill.Count != 0 && bill.Values.Any(i => i.Printed == false))
|
||||
if (MessageBox.Show("Abandon Changes?", "Abandon Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
|
||||
if (
|
||||
MessageBox.Show("Abandon Changes?", "Abandon Changes", MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
|
||||
return;
|
||||
ClearBill();
|
||||
}
|
||||
|
||||
public void ClearBill()
|
||||
{
|
||||
billInfo = null;
|
||||
_billInfo = null;
|
||||
ShowCustomerList(true);
|
||||
bill.Clear();
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
saleForm.ClearBill(bill);
|
||||
_saleForm.ClearBill(bill);
|
||||
}
|
||||
|
||||
public void FormLoad()
|
||||
{
|
||||
ClearBill();
|
||||
if (editVoucherID.HasValue)
|
||||
if (_editVoucherID.HasValue)
|
||||
{
|
||||
LoadBill(editVoucherID.Value);
|
||||
LoadBill(_editVoucherID.Value);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SettleBill()
|
||||
{
|
||||
if (billInfo == null)
|
||||
if (_billInfo == null)
|
||||
return;
|
||||
if (!billInfo.Printed)
|
||||
if (!_billInfo.Printed)
|
||||
return;
|
||||
if (!Session.IsAllowed(RoleConstants.SETTLE_BILL))
|
||||
return;
|
||||
var option = SettleOption.Unsettled;
|
||||
using (BillSettleForm frm = new BillSettleForm())
|
||||
IDictionary<SettleOption, decimal> options;
|
||||
using (var frm = new SettleChoicesForm(_billInfo))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
option = frm.optionChosen;
|
||||
}
|
||||
if (option != SettleOption.Unsettled)
|
||||
{
|
||||
VoucherBI.SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
ClearBill();
|
||||
options = frm.OptionsChosen;
|
||||
}
|
||||
if (options.Count == 0)
|
||||
return;
|
||||
VoucherBI.SettleVoucher(Session.User, _billInfo.VoucherID, options);
|
||||
ClearBill();
|
||||
}
|
||||
|
||||
internal void MoveTable()
|
||||
{
|
||||
if (billInfo == null)
|
||||
if (_billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
if (VoucherBI.IsBillPrinted(_billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var table = GetTableForMove(true);
|
||||
if (table == null)
|
||||
return;
|
||||
if (table.VoucherID == 0)
|
||||
LoadBill(MoveTable(table));
|
||||
else
|
||||
LoadBill(MergeTable(table));
|
||||
LoadBill(table.VoucherID == 0 ? MoveTable(table) : MergeTable(table));
|
||||
}
|
||||
|
||||
private int MoveTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_TABLE))
|
||||
return 0;
|
||||
return new FoodTableBI().Move(billInfo.TableID, table);
|
||||
return new FoodTableBI().Move(_billInfo.TableID, table);
|
||||
}
|
||||
|
||||
private int MergeTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_TABLE))
|
||||
@ -558,16 +464,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var kots = bill.Where(x => x.Key.KotID == -1 && x.Key.ProductID != 0);
|
||||
foreach (var item in kots)
|
||||
MergeKot(item.Value, table);
|
||||
VoucherBI.Delete(billInfo.VoucherID);
|
||||
VoucherBI.Delete(_billInfo.VoucherID);
|
||||
return table.VoucherID;
|
||||
}
|
||||
|
||||
private int MergeKot(BillInventory kot, FoodTable table)
|
||||
private static int MergeKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_KOT))
|
||||
return 0;
|
||||
return VoucherBI.MoveKot(kot.ProductID, table);
|
||||
}
|
||||
|
||||
private int MoveKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_KOT))
|
||||
@ -575,23 +482,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
CreateNewVoucherForKotMove(kot, table);
|
||||
return MergeKot(kot, table);
|
||||
}
|
||||
|
||||
private void CreateNewVoucherForKotMove(BillInventory kot, FoodTable table)
|
||||
{
|
||||
var voucher = new Voucher
|
||||
{
|
||||
Customer = billInfo.Customer,
|
||||
Settled = SettleOption.Unsettled,
|
||||
TableID = table.Name,
|
||||
Waiter = billInfo.Waiter,
|
||||
Printed = false,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
{
|
||||
Customer = _billInfo.Customer,
|
||||
TableID = table.Name,
|
||||
Waiter = _billInfo.Waiter,
|
||||
Printed = false,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
VoucherBI.Insert(voucher);
|
||||
}
|
||||
private FoodTable GetTableForMove(bool allowMerge)
|
||||
|
||||
private static FoodTable GetTableForMove(bool allowMerge)
|
||||
{
|
||||
using (var frm = new frmMoveTable(new FoodTableBI().List(), allowMerge))
|
||||
{
|
||||
@ -604,9 +512,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
internal void MergeKot()
|
||||
{
|
||||
if (billInfo == null)
|
||||
if (_billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
if (VoucherBI.IsBillPrinted(_billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var kot = CurrentKot;
|
||||
if (kot == null)
|
||||
@ -615,7 +523,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (table == null)
|
||||
return;
|
||||
var count = bill.Keys.Count(x => x.KotID == -1 && x.ProductID != 0);
|
||||
int voucherID = 0;
|
||||
var voucherID = 0;
|
||||
if (table.VoucherID == 0 && count > 1)
|
||||
//Move Kot
|
||||
voucherID = MoveKot(kot, table);
|
||||
@ -631,5 +539,137 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (voucherID != 0)
|
||||
LoadBill(voucherID);
|
||||
}
|
||||
|
||||
#region Save
|
||||
|
||||
// if (btnWaiter.Tag == null)
|
||||
//btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
|
||||
public void Save(bool print, int waiterID, string tableID)
|
||||
{
|
||||
if (print && !Session.IsAllowed(RoleConstants.PRINT_BILL))
|
||||
return;
|
||||
if (!print && !Session.IsAllowed(RoleConstants.PRINT_KOT))
|
||||
return;
|
||||
if ((_billInfo != null) && (VoucherBI.IsBillPrinted(_billInfo.VoucherID)) &&
|
||||
(!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
return;
|
||||
if (bill.Count == 1) //new kot only
|
||||
return;
|
||||
if (print)
|
||||
ShowDiscount();
|
||||
int? saved;
|
||||
if (_billInfo == null)
|
||||
saved = InsertVoucher(print, waiterID, tableID);
|
||||
else
|
||||
saved = UpdateSale(print, waiterID, tableID);
|
||||
if (_editVoucherID.HasValue)
|
||||
_saleForm.CloseWindow();
|
||||
else
|
||||
{
|
||||
int kotID = 0;
|
||||
if (!print && saved.HasValue)
|
||||
kotID = saved.Value;
|
||||
if (print || kotID != 0)
|
||||
PrintBill(_billInfo.VoucherID, kotID);
|
||||
}
|
||||
ClearBill();
|
||||
}
|
||||
|
||||
private int? InsertVoucher(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
if (_billInfo != null)
|
||||
{
|
||||
MessageBox.Show("Error in InsertVoucher, there is a previous sale in memory", "Error");
|
||||
return null;
|
||||
}
|
||||
|
||||
#region Voucher
|
||||
|
||||
_billInfo = new Voucher
|
||||
{
|
||||
Customer = _customer,
|
||||
//Paid = finalBill,
|
||||
TableID = tableID,
|
||||
Waiter = WaiterBI.GetWaiter(waiterID),
|
||||
Printed = finalBill,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inventories
|
||||
|
||||
Kot kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
_billInfo.Kots.Add(kot);
|
||||
|
||||
#endregion
|
||||
|
||||
return VoucherBI.Insert(_billInfo);
|
||||
}
|
||||
|
||||
private int? UpdateSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
#region Voucher
|
||||
|
||||
_billInfo.User = Session.User;
|
||||
_billInfo.Customer = _customer;
|
||||
if (!_billInfo.Printed && finalBill)
|
||||
_billInfo.Date = null;
|
||||
_billInfo.Printed = _billInfo.Printed || finalBill;
|
||||
_billInfo.TableID = tableID;
|
||||
_billInfo.Waiter = WaiterBI.GetWaiter(waiterID);
|
||||
Kot kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
_billInfo.Kots.Add(kot);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inventory
|
||||
|
||||
#endregion
|
||||
|
||||
return VoucherBI.Update(_billInfo);
|
||||
}
|
||||
|
||||
private Kot GetKotForBill()
|
||||
{
|
||||
var kot = new Kot();
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.KotID == -1 || item.Value.Quantity == 0)
|
||||
continue;
|
||||
else if (item.Key.KotID != 0)
|
||||
{
|
||||
Kot oldKot = _billInfo.Kots.Where(x => x.KotID == item.Key.KotID).Single();
|
||||
Inventory inv = oldKot.Inventories.Where(x => x.Product.ProductID == item.Key.ProductID).Single();
|
||||
inv.Rate = item.Value.Price;
|
||||
inv.Discount = item.Value.Discount;
|
||||
}
|
||||
else
|
||||
{
|
||||
var temp = new Inventory();
|
||||
temp.Product = ProductBI.GetProduct(item.Key.ProductID);
|
||||
temp.Quantity = item.Value.Quantity;
|
||||
temp.Rate = item.Value.Price;
|
||||
temp.Discount = item.Value.Discount;
|
||||
temp.ServiceCharge = item.Value.ServiceCharge;
|
||||
temp.Tax = item.Value.Tax;
|
||||
foreach (Modifier mod in item.Value.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier { Modifier = mod });
|
||||
kot.Inventories.Add(temp);
|
||||
}
|
||||
}
|
||||
if (kot.Inventories.Count == 0)
|
||||
return null;
|
||||
else
|
||||
return kot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,8 @@ using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.PointOfSale.Sales;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
@ -16,20 +16,20 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
User form_userEvent(object sender, UserEventArgs e)
|
||||
private User form_userEvent(object sender, UserEventArgs e)
|
||||
{
|
||||
User user = e.User;
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
using (UserForm form = new UserForm(null))
|
||||
using (var form = new UserForm(null))
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (UserForm form = new UserForm(user.UserID))
|
||||
using (var form = new UserForm(user.UserID))
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
@ -42,19 +42,19 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
LoginUser(true);
|
||||
}
|
||||
|
||||
private void btnSale_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALES))
|
||||
using (SalesForm frmSale = new SalesForm(new BillController(null)))
|
||||
using (var frmSale = new SalesForm(new BillController(null)))
|
||||
frmSale.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnProduct_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.PRODUCTS))
|
||||
using (ProductsForm frm = new ProductsForm())
|
||||
using (var frm = new ProductsForm())
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnProductGroup_Click(object sender, EventArgs e)
|
||||
@ -62,16 +62,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (Session.IsAllowed(RoleConstants.PRODUCTS))
|
||||
using (var frm = new ProductTypes())
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnCustomer_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (CustomersForm Customer = new CustomersForm(null, ""))
|
||||
using (var Customer = new CustomersForm(null, ""))
|
||||
{
|
||||
Customer.ShowDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnInitial_Click(object sender, EventArgs e)
|
||||
@ -88,29 +86,28 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void btnAdvanceReceive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALES))
|
||||
using (frmRecieveAdvance frm = new frmRecieveAdvance())
|
||||
using (var frm = new frmRecieveAdvance())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnAdvanceAdjust_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALES))
|
||||
using (frmAdjustAdvance frm = new frmAdjustAdvance())
|
||||
using (var frm = new frmAdjustAdvance())
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCreateUser_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES))
|
||||
using (SelectUser form = new SelectUser(UserBI.GetFilteredUsers, true))
|
||||
using (var form = new SelectUser(UserBI.GetFilteredUsers, true))
|
||||
{
|
||||
form.userEvent += new UserEventHandler(form_userEvent);
|
||||
form.userEvent += form_userEvent;
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
@ -124,29 +121,28 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnChangePassword_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ChangePassword frm = new ChangePassword(new KeyboardControl()))
|
||||
using (var frm = new ChangePassword(new KeyboardControl()))
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnCashierCheckout_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.CASHIER_CHECKOUT))
|
||||
using (Cashier_Checkout_Form frm = new Cashier_Checkout_Form())
|
||||
using (var frm = new CashierCheckoutForm())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnSaleAnalysis_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALE_ANALYSIS))
|
||||
using (frmSaleAnalysisForm frm = new frmSaleAnalysisForm())
|
||||
using (var frm = new frmSaleAnalysisForm())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnSaleDetail_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed(RoleConstants.SALE_DETAIL))
|
||||
using (var frm = new frmSaleDetail())
|
||||
using (var frm = new FrmSaleDetail())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
@ -154,6 +150,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
CheckRoles();
|
||||
}
|
||||
|
||||
private void CheckRoles()
|
||||
{
|
||||
#if (DEBUG)
|
||||
@ -190,13 +187,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (Session.IsAllowed(RoleConstants.SECURITY_MANAGE_ROLES))
|
||||
using (var frm = new AssignGroupRoles())
|
||||
frm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnSwipeLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoginUser(false);
|
||||
}
|
||||
|
||||
private void LoginUser(bool keyboard)
|
||||
{
|
||||
ILogin login;
|
||||
@ -209,7 +206,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (login.LoginUser())
|
||||
{
|
||||
this.Text = "Main Menu - User: " + Session.User.Name;
|
||||
Text = "Main Menu - User: " + Session.User.Name;
|
||||
btnLogin.Text = "Logout";
|
||||
btnSwipeLogin.Visible = false;
|
||||
}
|
||||
@ -217,13 +214,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
else
|
||||
{
|
||||
login.LogoutUser();
|
||||
this.Text = "Main Menu - Login";
|
||||
Text = "Main Menu - Login";
|
||||
btnLogin.Text = "Login";
|
||||
btnSwipeLogin.Visible = true;
|
||||
}
|
||||
CheckRoles();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class Cashier_Checkout_Form
|
||||
partial class CashierCheckoutForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -486,7 +486,7 @@
|
||||
this.Controls.Add(this.txtReceipts);
|
||||
this.Controls.Add(this.txtOpening);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "Cashier_Checkout_Form";
|
||||
this.Name = "CashierCheckoutForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Cashier Checkout Form";
|
||||
this.Load += new System.EventHandler(this.Cashier_Checkout_Form_Load);
|
||||
|
||||
@ -6,14 +6,14 @@ using Tanshu.Accounts.Helpers;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class Cashier_Checkout_Form : Form
|
||||
public partial class CashierCheckoutForm : Form
|
||||
{
|
||||
CheckoutBI coProxy;
|
||||
bool loading;
|
||||
CheckoutBI _coProxy;
|
||||
bool _loading;
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public Cashier_Checkout_Form()
|
||||
public CashierCheckoutForm()
|
||||
{
|
||||
loading = true;
|
||||
_loading = true;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@ -21,19 +21,19 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
dtpStart.Format = DateTimePickerFormat.Custom;
|
||||
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
||||
dtpStart.Value = DateTime.Now;
|
||||
dtpStart.Value = DateTime.Now.Date;
|
||||
dtpFinish.Format = DateTimePickerFormat.Custom;
|
||||
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
||||
dtpFinish.Value = DateTime.Now;
|
||||
dtpFinish.Value = DateTime.Now.Date;
|
||||
FillUsers();
|
||||
loading = false;
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
private void FillUsers()
|
||||
{
|
||||
cmbCashier.DisplayMember = "Name";
|
||||
cmbCashier.ValueMember = "UserID";
|
||||
cmbCashier.DataSource = UserBI.GetUsers();
|
||||
cmbCashier.DataSource = UserBI.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
||||
}
|
||||
|
||||
private void cmbCashier_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@ -44,24 +44,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void EmployeeStatus()
|
||||
{
|
||||
if (loading || cmbCashier.SelectedValue == null)
|
||||
if (_loading || cmbCashier.SelectedValue == null)
|
||||
return;
|
||||
coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
||||
txtOpening.Text = string.Format("{0:#,##0.00}", coProxy);
|
||||
txtReceipts.Text = string.Format("{0:#,##0.00}", coProxy.Receipts);
|
||||
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", coProxy.AdvanceReceipts);
|
||||
txtCCReceipts.Text = string.Format("{0:#,##0.00}", coProxy.CCReceipts);
|
||||
txtNC.Text = string.Format("{0:#,##0.00}", coProxy.NCReceipts);
|
||||
txtBillToCompany.Text = string.Format("{0:#,##0.00}", coProxy.BTCReceipts);
|
||||
txtAdvanceAdjusted.Text = string.Format("{0:#,##0.00}", coProxy.AdvanceAdjusted);
|
||||
txtPayments.Text = string.Format("{0:#,##0.00}", coProxy.CashPayments);
|
||||
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", coProxy.AdditionalVoids);
|
||||
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", coProxy.VoidsInSystem);
|
||||
txtDiscounts.Text = string.Format("{0:#,##0.00}", coProxy.Discount);
|
||||
txtPending.Text = string.Format("{0:#,##0.00}", coProxy.PendingBills);
|
||||
txtSales.Text = string.Format("{0:#,##0.00}", coProxy.NetSales);
|
||||
txtClosingCash.Text = string.Format("{0:#,##0.00}", coProxy.ClosingBalance);
|
||||
txtStatus.Text = coProxy.Status;
|
||||
_coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
||||
txtOpening.Text = string.Format("{0:#,##0.00}", _coProxy);
|
||||
txtReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.Receipts);
|
||||
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceReceipts);
|
||||
txtCCReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CcReceipts);
|
||||
txtNC.Text = string.Format("{0:#,##0.00}", _coProxy.NcReceipts);
|
||||
txtBillToCompany.Text = string.Format("{0:#,##0.00}", _coProxy.BtcReceipts);
|
||||
txtAdvanceAdjusted.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceAdjusted);
|
||||
txtPayments.Text = string.Format("{0:#,##0.00}", _coProxy.CashPayments);
|
||||
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", _coProxy.AdditionalVoids);
|
||||
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", _coProxy.VoidsInSystem);
|
||||
txtDiscounts.Text = string.Format("{0:#,##0.00}", _coProxy.Discount);
|
||||
txtPending.Text = string.Format("{0:#,##0.00}", _coProxy.PendingBills);
|
||||
txtSales.Text = string.Format("{0:#,##0.00}", _coProxy.NetSales);
|
||||
txtClosingCash.Text = string.Format("{0:#,##0.00}", _coProxy.ClosingBalance);
|
||||
txtStatus.Text = _coProxy.Status;
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
@ -80,13 +80,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (!decimal.TryParse(txtDeposited.Text, out deposited))
|
||||
deposited = 0;
|
||||
|
||||
coProxy.Calculate(deposited, 0);
|
||||
txtStatus.Text = coProxy.Status;
|
||||
_coProxy.Calculate(deposited, 0);
|
||||
txtStatus.Text = _coProxy.Status;
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
Thermal.PrintClosing(coProxy);
|
||||
Thermal.PrintClosing(_coProxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,14 +8,12 @@ using System.Linq;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class frmSaleDetail : Form
|
||||
public partial class FrmSaleDetail : Form
|
||||
{
|
||||
IList<SalesAnalysisDetail> list;
|
||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public frmSaleDetail()
|
||||
IList<SalesAnalysisDetail> _list;
|
||||
public FrmSaleDetail()
|
||||
{
|
||||
InitializeComponent();
|
||||
//log.Warn(string.Format("Sales Analysis by: {0}", Session.User.Name));
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
@ -25,9 +23,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void ShowStatement()
|
||||
{
|
||||
list = new SalesAnalysisBI().GetSaleDetail(dtpStart.Value, dtpFinish.Value).ToList();
|
||||
_list = new SalesAnalysisBI().GetSaleDetail(dtpStart.Value, dtpFinish.Value).ToList();
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
dgvSale.DataSource = list;
|
||||
dgvSale.DataSource = _list;
|
||||
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
||||
@ -49,12 +47,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (list != null)
|
||||
{
|
||||
var startDate = dtpStart.Value.Date.AddHours(6);
|
||||
var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5);
|
||||
Accounts.Print.Thermal.PrintSale(Session.User.Name, list, startDate, finishDate);
|
||||
}
|
||||
if (_list == null)
|
||||
return;
|
||||
var startDate = dtpStart.Value.Date.AddHours(6);
|
||||
var finishDate = dtpFinish.Value.Date.AddDays(1).AddHours(5);
|
||||
Print.Thermal.PrintSale(Session.User.Name, _list, startDate, finishDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class frmSaleDetail
|
||||
partial class FrmSaleDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -107,7 +107,7 @@
|
||||
this.Controls.Add(this.dtpStart);
|
||||
this.Controls.Add(this.label10);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "frmSaleDetail";
|
||||
this.Name = "FrmSaleDetail";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Sale Detail";
|
||||
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
|
||||
|
||||
@ -1,101 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Common;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
{
|
||||
public class BillHelperFunctions
|
||||
{
|
||||
BindingSource bindingSource;
|
||||
OrderedDictionary<BillItemKey, BillInventory> bill;
|
||||
BillItemKey newKey;
|
||||
public BillHelperFunctions(BindingSource bindingSource, OrderedDictionary<BillItemKey, BillInventory> bill, int productID)
|
||||
private readonly OrderedDictionary<BillItemKey, BillInventory> bill;
|
||||
private readonly BindingSource _bindingSource;
|
||||
private readonly BillItemKey _newKey;
|
||||
|
||||
public BillHelperFunctions(BindingSource bindingSource, OrderedDictionary<BillItemKey, BillInventory> bill,
|
||||
int productID)
|
||||
{
|
||||
this.bindingSource = bindingSource;
|
||||
this._bindingSource = bindingSource;
|
||||
this.bill = bill;
|
||||
this.newKey = new BillItemKey(productID, 0);
|
||||
_newKey = new BillItemKey(productID, 0);
|
||||
}
|
||||
|
||||
public void SetDiscount(string name, decimal discount)
|
||||
{
|
||||
if (discount > 1 || discount < 0)
|
||||
return;
|
||||
decimal maxDiscount = VoucherBI.GetProductDiscountLimit(newKey.ProductID);
|
||||
decimal maxDiscount = VoucherBI.GetProductDiscountLimit(_newKey.ProductID);
|
||||
if (discount > maxDiscount)
|
||||
MessageBox.Show(string.Format("Maximum discount for {0} is {1:P}", name, maxDiscount), "Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(string.Format("Maximum discount for {0} is {1:P}", name, maxDiscount),
|
||||
"Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
if (item.Value.ProductID == _newKey.ProductID)
|
||||
item.Value.Discount = discount;
|
||||
}
|
||||
}
|
||||
#region Add Product
|
||||
public BillInventory AddProduct()
|
||||
{
|
||||
BillInventory product;
|
||||
if (bill.ContainsKey(newKey))
|
||||
{
|
||||
bindingSource.CurrencyManager.Position = bill.IndexOfKey(newKey);
|
||||
product = bill[newKey];
|
||||
product.Quantity += 1;
|
||||
}
|
||||
else
|
||||
{ //Has only old
|
||||
product = VoucherBI.GetDefaultSaleBillItem(newKey.ProductID);
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.ProductID == newKey.ProductID)
|
||||
{
|
||||
product.Discount = item.Value.Discount;
|
||||
product.Price = item.Value.Price;
|
||||
}
|
||||
}
|
||||
product = AddProduct(product);
|
||||
}
|
||||
return product;
|
||||
}
|
||||
private BillInventory AddProduct(BillInventory product)
|
||||
{
|
||||
bill.Add(new BillItemKey(product.ProductID, 0), product);
|
||||
bindingSource.DataSource = bill.Values;
|
||||
bindingSource.CurrencyManager.Position = bindingSource.CurrencyManager.Count + 1;
|
||||
return product;
|
||||
}
|
||||
#endregion
|
||||
#region Quantity
|
||||
public void SetQuantity(BillInventory product, decimal quantity, bool prompt)
|
||||
{
|
||||
if (product.Printed)
|
||||
return;
|
||||
if (prompt && !GetInput("Price", ref quantity))
|
||||
return;
|
||||
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
private void SetQuantity(BillInventory product, decimal quantity)
|
||||
{
|
||||
if (quantity < 0 && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
var total = quantity;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
total += item.Value.Quantity;
|
||||
}
|
||||
|
||||
if (total < 0)
|
||||
quantity -= total;
|
||||
product.Quantity = quantity;
|
||||
}
|
||||
#endregion
|
||||
public void SetPrice(BillInventory product)
|
||||
{
|
||||
if (!Allowed(product, RoleConstants.CHANGE_RATE))
|
||||
@ -107,13 +46,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
if (item.Value.ProductID == _newKey.ProductID)
|
||||
item.Value.Price = rate;
|
||||
}
|
||||
}
|
||||
|
||||
private void InputBox_Validating(object sender, InputBoxValidatingArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private bool Allowed(BillInventory item, RoleConstants role)
|
||||
{
|
||||
if (item == null)
|
||||
@ -122,6 +63,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool GetInput(string prompt, ref decimal amount)
|
||||
{
|
||||
InputBoxResult result = InputBox.Show(prompt, amount.ToString(), InputBox_Validating);
|
||||
@ -131,5 +73,70 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Add Product
|
||||
|
||||
public BillInventory AddProduct()
|
||||
{
|
||||
BillInventory product;
|
||||
if (bill.ContainsKey(_newKey))
|
||||
{
|
||||
_bindingSource.CurrencyManager.Position = bill.IndexOfKey(_newKey);
|
||||
product = bill[_newKey];
|
||||
product.Quantity += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Has only old
|
||||
product = VoucherBI.GetDefaultSaleBillItem(_newKey.ProductID);
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.ProductID == _newKey.ProductID)
|
||||
{
|
||||
product.Discount = item.Value.Discount;
|
||||
product.Price = item.Value.Price;
|
||||
}
|
||||
}
|
||||
product = AddProduct(product);
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
private BillInventory AddProduct(BillInventory product)
|
||||
{
|
||||
bill.Add(new BillItemKey(product.ProductID, 0), product);
|
||||
_bindingSource.DataSource = bill.Values.ToList();
|
||||
_bindingSource.CurrencyManager.Position = _bindingSource.CurrencyManager.Count - 1;
|
||||
return product;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Quantity
|
||||
|
||||
public void SetQuantity(BillInventory product, decimal quantity, bool prompt)
|
||||
{
|
||||
if (product.Printed)
|
||||
return;
|
||||
if (prompt && !GetInput("Price", ref quantity))
|
||||
return;
|
||||
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
|
||||
private void SetQuantity(BillInventory product, decimal quantity)
|
||||
{
|
||||
if (quantity < 0 && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
var total = quantity + bill.Where(item => item.Value.ProductID == _newKey.ProductID).Sum(item => item.Value.Quantity);
|
||||
|
||||
if (total < 0)
|
||||
quantity -= total;
|
||||
product.Quantity = quantity;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,129 +0,0 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class BillSettleForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnCash = new System.Windows.Forms.Button();
|
||||
this.btnCreditCard = new System.Windows.Forms.Button();
|
||||
this.btnNC = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnStaff = new System.Windows.Forms.Button();
|
||||
this.btnBillToCompany = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnCash
|
||||
//
|
||||
this.btnCash.Location = new System.Drawing.Point(12, 12);
|
||||
this.btnCash.Name = "btnCash";
|
||||
this.btnCash.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnCash.TabIndex = 0;
|
||||
this.btnCash.Text = "Cash";
|
||||
this.btnCash.UseVisualStyleBackColor = true;
|
||||
this.btnCash.Click += new System.EventHandler(this.btnCash_Click);
|
||||
//
|
||||
// btnCreditCard
|
||||
//
|
||||
this.btnCreditCard.Location = new System.Drawing.Point(93, 12);
|
||||
this.btnCreditCard.Name = "btnCreditCard";
|
||||
this.btnCreditCard.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnCreditCard.TabIndex = 1;
|
||||
this.btnCreditCard.Text = "Credit Card";
|
||||
this.btnCreditCard.UseVisualStyleBackColor = true;
|
||||
this.btnCreditCard.Click += new System.EventHandler(this.btnCreditCard_Click);
|
||||
//
|
||||
// btnNC
|
||||
//
|
||||
this.btnNC.Location = new System.Drawing.Point(174, 12);
|
||||
this.btnNC.Name = "btnNC";
|
||||
this.btnNC.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnNC.TabIndex = 2;
|
||||
this.btnNC.Text = "No Charge";
|
||||
this.btnNC.UseVisualStyleBackColor = true;
|
||||
this.btnNC.Click += new System.EventHandler(this.btnNC_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(417, 12);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnCancel.TabIndex = 3;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// btnStaff
|
||||
//
|
||||
this.btnStaff.Location = new System.Drawing.Point(255, 12);
|
||||
this.btnStaff.Name = "btnStaff";
|
||||
this.btnStaff.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnStaff.TabIndex = 4;
|
||||
this.btnStaff.Text = "Staff";
|
||||
this.btnStaff.UseVisualStyleBackColor = true;
|
||||
this.btnStaff.Click += new System.EventHandler(this.btnStaff_Click);
|
||||
//
|
||||
// btnBillToCompany
|
||||
//
|
||||
this.btnBillToCompany.Location = new System.Drawing.Point(336, 12);
|
||||
this.btnBillToCompany.Name = "btnBillToCompany";
|
||||
this.btnBillToCompany.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnBillToCompany.TabIndex = 5;
|
||||
this.btnBillToCompany.Text = "Bill To Company";
|
||||
this.btnBillToCompany.UseVisualStyleBackColor = true;
|
||||
this.btnBillToCompany.Click += new System.EventHandler(this.btnBillToCompany_Click);
|
||||
//
|
||||
// BillSettleForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(504, 99);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnBillToCompany);
|
||||
this.Controls.Add(this.btnStaff);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnNC);
|
||||
this.Controls.Add(this.btnCreditCard);
|
||||
this.Controls.Add(this.btnCash);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "BillSettleForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Settle Bill";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnCash;
|
||||
private System.Windows.Forms.Button btnCreditCard;
|
||||
private System.Windows.Forms.Button btnNC;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnStaff;
|
||||
private System.Windows.Forms.Button btnBillToCompany;
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class BillSettleForm : Form
|
||||
{
|
||||
private SettleOption settleOption = SettleOption.Unsettled;
|
||||
public BillSettleForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnCash_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.Cash;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCreditCard_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.CreditCard;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnNC_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.NoCharge;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.Unsettled;
|
||||
this.Close();
|
||||
}
|
||||
private void btnStaff_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.Staff;
|
||||
this.Close();
|
||||
}
|
||||
private void btnBillToCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOption.BillToCompany;
|
||||
this.Close();
|
||||
}
|
||||
public SettleOption optionChosen
|
||||
{
|
||||
get
|
||||
{
|
||||
return settleOption;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
80
Tanshu.Accounts.PointOfSale/Sales/FrmSettleAmounts.Designer.cs
generated
Normal file
80
Tanshu.Accounts.PointOfSale/Sales/FrmSettleAmounts.Designer.cs
generated
Normal file
@ -0,0 +1,80 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class FrmSettleAmounts
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtAmount = new System.Windows.Forms.TextBox();
|
||||
this.txtCurrentAmount = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtAmount
|
||||
//
|
||||
this.txtAmount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtAmount.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtAmount.Name = "txtAmount";
|
||||
this.txtAmount.ReadOnly = true;
|
||||
this.txtAmount.Size = new System.Drawing.Size(173, 20);
|
||||
this.txtAmount.TabIndex = 1;
|
||||
//
|
||||
// txtCurrentAmount
|
||||
//
|
||||
this.txtCurrentAmount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtCurrentAmount.Location = new System.Drawing.Point(3, 26);
|
||||
this.txtCurrentAmount.Name = "txtCurrentAmount";
|
||||
this.txtCurrentAmount.Size = new System.Drawing.Size(173, 20);
|
||||
this.txtCurrentAmount.TabIndex = 0;
|
||||
this.txtCurrentAmount.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtCurrentAmountKeyDown);
|
||||
//
|
||||
// FrmSettleAmounts
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(179, 249);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.txtCurrentAmount);
|
||||
this.Controls.Add(this.txtAmount);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "FrmSettleAmounts";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Settle Bill";
|
||||
this.Load += new System.EventHandler(this.SettleChoicesFormLoad);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtAmount;
|
||||
private System.Windows.Forms.TextBox txtCurrentAmount;
|
||||
|
||||
}
|
||||
}
|
||||
76
Tanshu.Accounts.PointOfSale/Sales/FrmSettleAmounts.cs
Normal file
76
Tanshu.Accounts.PointOfSale/Sales/FrmSettleAmounts.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class FrmSettleAmounts : Form
|
||||
{
|
||||
private IKeyboardControl _keyboardControl;
|
||||
private readonly decimal _amount;
|
||||
private readonly SettleOption _settleOption;
|
||||
private decimal _settleAmount;
|
||||
public FrmSettleAmounts(IKeyboardControl keyboardControl, SettleOption settleOption, decimal amount)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_keyboardControl = keyboardControl;
|
||||
_amount = amount;
|
||||
_settleOption = settleOption;
|
||||
_settleAmount = 0;
|
||||
var control = keyboardControl as UserControl;
|
||||
if (control != null)
|
||||
{
|
||||
control.Location = new System.Drawing.Point(3, 49);
|
||||
this.Controls.Add(control);
|
||||
this.Size = this.SizeFromClientSize(new Size(3 + control.Width + 3, 49 + control.Height + 3));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public decimal AmountSettled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settleAmount;
|
||||
}
|
||||
}
|
||||
|
||||
private void SettleChoicesFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
var attribute = (DisplayAttribute)_settleOption.GetType().GetField(_settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||
this.Text = attribute.Name;
|
||||
txtAmount.Text = string.Format("Pending Amount: Rs. {0}", _amount);
|
||||
txtCurrentAmount.Text = string.Format("{0:#,#00}", _amount);
|
||||
txtCurrentAmount.Focus();
|
||||
}
|
||||
|
||||
private void TxtCurrentAmountKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Escape:
|
||||
_settleAmount = 0;
|
||||
this.Close();
|
||||
break;
|
||||
case Keys.Return:
|
||||
{
|
||||
decimal settleAmount;
|
||||
if (!Decimal.TryParse(txtCurrentAmount.Text, out settleAmount))
|
||||
return;
|
||||
if (settleAmount > _amount)
|
||||
settleAmount = _amount;
|
||||
_settleAmount = settleAmount;
|
||||
this.Close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
{
|
||||
partial class SalesForm
|
||||
{
|
||||
@ -666,6 +666,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn printedDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.Button btnMore;
|
||||
private System.Windows.Forms.Button btnMoveKot;
|
||||
private readonly BillController _billController;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,34 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Common;
|
||||
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
{
|
||||
public partial class SalesForm : Form, ISaleForm
|
||||
{
|
||||
BillController billController;
|
||||
|
||||
public SalesForm(BillController billController)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.billController = billController;
|
||||
this._billController = billController;
|
||||
billController.InitGui(this);
|
||||
}
|
||||
|
||||
#region ISaleForm Members
|
||||
|
||||
public void SetUserName(string name)
|
||||
{
|
||||
this.Text = name;
|
||||
Text = name;
|
||||
}
|
||||
|
||||
public void SetCustomerDisplay(string name)
|
||||
{
|
||||
btnCustomer.Text = name;
|
||||
}
|
||||
|
||||
public void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate,
|
||||
string customer, string tableID, int waiterID, string waiter)
|
||||
{
|
||||
txtBillID.Text = billID;
|
||||
txtKotID.Text = kotID;
|
||||
txtCreationDate.Text = creationDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
txtDate.Text = date.ToString("HH:mm dd-MMM-yyyy");
|
||||
txtLastEditDate.Text = lastEditDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
btnCustomer.Text = customer;
|
||||
txtTableID.Text = tableID;
|
||||
btnWaiter.Tag = waiterID;
|
||||
btnWaiter.Text = string.Format("{0} - F5", waiter);
|
||||
}
|
||||
|
||||
public BindingSource BindingSource
|
||||
{
|
||||
get { return bindingSource; }
|
||||
}
|
||||
|
||||
public void CloseWindow()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SalesForm_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
@ -46,7 +75,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
case Keys.F4:
|
||||
{
|
||||
if (!e.Alt)
|
||||
billController.ShowCustomerList(false);
|
||||
_billController.ShowCustomerList(false);
|
||||
break;
|
||||
}
|
||||
case Keys.F5:
|
||||
@ -56,17 +85,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
case Keys.F7:
|
||||
{
|
||||
using (SelectProduct selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
|
||||
using (var selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
|
||||
{
|
||||
selectProduct.ShowDialog();
|
||||
if (selectProduct.SelectedItem != null)
|
||||
billController.AddProductToGrid(selectProduct.SelectedItem.ProductID);
|
||||
_billController.AddProductToGrid(selectProduct.SelectedItem.ProductID);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Keys.F8:
|
||||
{
|
||||
billController.LoadBillFromTable(null);
|
||||
_billController.LoadBillFromTable(null);
|
||||
break;
|
||||
}
|
||||
case Keys.F11:
|
||||
@ -81,17 +110,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
case Keys.Delete:
|
||||
{
|
||||
billController.ProductRemove();
|
||||
_billController.ProductRemove();
|
||||
break;
|
||||
}
|
||||
case Keys.Add:
|
||||
{
|
||||
billController.SetQuantity(1, false);
|
||||
_billController.SetQuantity(1, false);
|
||||
break;
|
||||
}
|
||||
case Keys.Subtract:
|
||||
{
|
||||
billController.SetQuantity(-1, false);
|
||||
_billController.SetQuantity(-1, false);
|
||||
break;
|
||||
}
|
||||
case Keys.Up:
|
||||
@ -108,207 +137,49 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
case Keys.Escape:
|
||||
{
|
||||
billController.CancelBillChanges();
|
||||
_billController.CancelBillChanges();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Helper Functions
|
||||
public void ClearBill(OrderedDictionary<BillItemKey, BillInventory> bill)
|
||||
{
|
||||
this.txtBillID.Text = "";
|
||||
this.txtKotID.Text = "";
|
||||
this.txtCreationDate.Text = "";
|
||||
this.txtDate.Text = "";
|
||||
this.txtLastEditDate.Text = "";
|
||||
this.txtTableID.Text = "";
|
||||
this.btnWaiter.Text = "Waiter - F5";
|
||||
this.btnWaiter.Tag = null;
|
||||
txtGrossTax.Text = "0.00";
|
||||
txtDiscount.Text = "0.00";
|
||||
txtServiceCharge.Text = "0.00";
|
||||
txtGrossAmount.Text = "0.00";
|
||||
txtAmount.Text = "0.00";
|
||||
bindingSource.DataSource = bill.Values;
|
||||
MoreButton(false);
|
||||
ChangeFormState(SaleFormState.Waiting);
|
||||
}
|
||||
private void ChangeFormState(SaleFormState state)
|
||||
{
|
||||
flpGroup.Controls.Clear();
|
||||
flpMain.Controls.Clear();
|
||||
if (state == SaleFormState.Billing)
|
||||
{
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
}
|
||||
|
||||
private void productTypeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as ProductGroup;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.ProductGroupID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), 0, ProductBI.GetProducts(item.ProductGroupID), new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
}
|
||||
private void productButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as Product;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.ProductID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = ProductBI.GetProducts();
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
billController.AddProductToGrid(item.ProductID);
|
||||
}
|
||||
}
|
||||
private void tableButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as FoodTable;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.FoodTableID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new FoodTableBI().List();
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
string tableName = item.Name;
|
||||
billController.LoadBillFromTable(tableName);
|
||||
txtTableID.Text = tableName;
|
||||
ChangeFormState(SaleFormState.Billing);
|
||||
}
|
||||
}
|
||||
public void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount, decimal taxAmount, decimal valueAmount, List<BillInventory> bill)
|
||||
{
|
||||
txtGrossTax.Text = string.Format("{0:#0.00}", taxAmount);
|
||||
txtDiscount.Text = string.Format("{0:#0.00}", discountAmount);
|
||||
txtServiceCharge.Text = string.Format("{0:#0.00}", serviceChargeAmount);
|
||||
txtGrossAmount.Text = string.Format("{0:#0.00}", grossAmount);
|
||||
txtAmount.Text = string.Format("{0:#0.00}", Math.Round(valueAmount));
|
||||
bindingSource.DataSource = bill;
|
||||
dgvProducts.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
|
||||
}
|
||||
|
||||
private void btnPrintBill_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
billController.Save(true, (int)btnWaiter.Tag, txtTableID.Text);
|
||||
}
|
||||
private void btnPrintKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
billController.Save(false, (int)btnWaiter.Tag, txtTableID.Text);
|
||||
}
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.CancelBillChanges();
|
||||
}
|
||||
|
||||
private void btnQuantity_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.SetQuantity(0, true);
|
||||
}
|
||||
private void btnDiscount_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.ShowDiscount();
|
||||
|
||||
//if (dgvProducts.Rows.Count > 0)
|
||||
// billController.SetDiscount(billController.CurrentProduct, -1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void SalesForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
billController.FormLoad();
|
||||
_billController.FormLoad();
|
||||
ChangeFormState(SaleFormState.Waiting);
|
||||
}
|
||||
|
||||
private void btnCustomer_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.ShowCustomerList(false);
|
||||
_billController.ShowCustomerList(false);
|
||||
}
|
||||
|
||||
public void SetCustomerDisplay(string name)
|
||||
{
|
||||
btnCustomer.Text = name;
|
||||
}
|
||||
public void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate, string customer, string tableID, int waiterID, string waiter)
|
||||
{
|
||||
this.txtBillID.Text = billID;
|
||||
this.txtKotID.Text = kotID;
|
||||
this.txtCreationDate.Text = creationDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
this.txtDate.Text = date.ToString("HH:mm dd-MMM-yyyy");
|
||||
this.txtLastEditDate.Text = lastEditDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
this.btnCustomer.Text = customer;
|
||||
this.txtTableID.Text = tableID;
|
||||
this.btnWaiter.Tag = waiterID;
|
||||
this.btnWaiter.Text = string.Format("{0} - F5", waiter);
|
||||
|
||||
}
|
||||
public BindingSource BindingSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return bindingSource;
|
||||
}
|
||||
}
|
||||
private void btnVoid_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
billController.VoidBill();
|
||||
_billController.VoidBill();
|
||||
}
|
||||
catch (PermissionException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRate_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.ChangeRate();
|
||||
_billController.ChangeRate();
|
||||
}
|
||||
|
||||
private void btnClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.CancelBillChanges();
|
||||
_billController.CancelBillChanges();
|
||||
}
|
||||
|
||||
private void dgvProducts_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
DataGridView dgv = sender as DataGridView;
|
||||
BillInventory data = dgv.Rows[e.RowIndex].DataBoundItem as BillInventory;
|
||||
var dgv = sender as DataGridView;
|
||||
var data = dgv.Rows[e.RowIndex].DataBoundItem as BillInventory;
|
||||
|
||||
if (data.Tax == -1)
|
||||
{
|
||||
@ -329,9 +200,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnWaiter_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (SelectWaiter selectWaiter = new SelectWaiter(WaiterBI.GetFilteredWaiters, true))
|
||||
using (var selectWaiter = new SelectWaiter(WaiterBI.GetFilteredWaiters, true))
|
||||
{
|
||||
selectWaiter.waiterEvent += new WaiterEventHandler(selectWaiter_waiterEvent);
|
||||
selectWaiter.waiterEvent += selectWaiter_waiterEvent;
|
||||
selectWaiter.ShowDialog();
|
||||
if (selectWaiter.SelectedItem != null)
|
||||
{
|
||||
@ -345,7 +216,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
}
|
||||
}
|
||||
Waiter selectWaiter_waiterEvent(object sender, WaiterEventArgs e)
|
||||
|
||||
private Waiter selectWaiter_waiterEvent(object sender, WaiterEventArgs e)
|
||||
{
|
||||
Waiter waiter = e.Waiter;
|
||||
if (!Thread.CurrentPrincipal.IsInRole("Waiter/Master"))
|
||||
@ -368,33 +240,29 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
public void CloseWindow()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnSettle_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.SettleBill();
|
||||
_billController.SettleBill();
|
||||
}
|
||||
|
||||
private void btnModifier_Click(object sender, EventArgs e)
|
||||
{
|
||||
var item = billController.CurrentProduct;
|
||||
BillInventory item = _billController.CurrentProduct;
|
||||
if (item == null)
|
||||
return;
|
||||
var id = new ProductGroupBI().GetProductGroupOfProduct(item.ProductID).ProductGroupID;
|
||||
billController.ShowModifiers(id, item);
|
||||
int id = new ProductGroupBI().GetProductGroupOfProduct(item.ProductID).ProductGroupID;
|
||||
_billController.ShowModifiers(id, item);
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.SetQuantity(-1, false);
|
||||
_billController.SetQuantity(-1, false);
|
||||
}
|
||||
|
||||
private void btnMoveTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MoveTable();
|
||||
_billController.MoveTable();
|
||||
}
|
||||
|
||||
private void btnMore_Click(object sender, EventArgs e)
|
||||
@ -407,6 +275,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
else
|
||||
throw new InvalidOperationException("Button State incorrect");
|
||||
}
|
||||
|
||||
private void MoreButton(bool more)
|
||||
{
|
||||
btnMore.Text = more ? "Less" : "More";
|
||||
@ -418,15 +287,159 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
btnMoveTable.Visible = more;
|
||||
btnMoveKot.Visible = more;
|
||||
btnVoid.Visible = more;
|
||||
|
||||
}
|
||||
|
||||
private void btnMoveKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MergeKot();
|
||||
_billController.MergeKot();
|
||||
}
|
||||
|
||||
#region Helper Functions
|
||||
|
||||
public void ClearBill(OrderedDictionary<BillItemKey, BillInventory> bill)
|
||||
{
|
||||
txtBillID.Text = "";
|
||||
txtKotID.Text = "";
|
||||
txtCreationDate.Text = "";
|
||||
txtDate.Text = "";
|
||||
txtLastEditDate.Text = "";
|
||||
txtTableID.Text = "";
|
||||
btnWaiter.Text = "Waiter - F5";
|
||||
btnWaiter.Tag = null;
|
||||
txtGrossTax.Text = "0.00";
|
||||
txtDiscount.Text = "0.00";
|
||||
txtServiceCharge.Text = "0.00";
|
||||
txtGrossAmount.Text = "0.00";
|
||||
txtAmount.Text = "0.00";
|
||||
bindingSource.DataSource = bill.Values;
|
||||
MoreButton(false);
|
||||
ChangeFormState(SaleFormState.Waiting);
|
||||
}
|
||||
|
||||
public void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount,
|
||||
decimal taxAmount, decimal valueAmount, List<BillInventory> bill)
|
||||
{
|
||||
txtGrossTax.Text = string.Format("{0:#0.00}", taxAmount);
|
||||
txtDiscount.Text = string.Format("{0:#0.00}", discountAmount);
|
||||
txtServiceCharge.Text = string.Format("{0:#0.00}", serviceChargeAmount);
|
||||
txtGrossAmount.Text = string.Format("{0:#0.00}", grossAmount);
|
||||
txtAmount.Text = string.Format("{0:#0.00}", Math.Round(valueAmount));
|
||||
bindingSource.DataSource = bill;
|
||||
dgvProducts.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
|
||||
}
|
||||
|
||||
private void ChangeFormState(SaleFormState state)
|
||||
{
|
||||
flpGroup.Controls.Clear();
|
||||
flpMain.Controls.Clear();
|
||||
if (state == SaleFormState.Billing)
|
||||
{
|
||||
IList<ProductGroup> list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, list, productTypeButton_Click);
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, new FoodTableBI().List(),
|
||||
tableButton_Click);
|
||||
}
|
||||
}
|
||||
|
||||
private void productTypeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as ProductGroup;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.ProductGroupID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
IList<ProductGroup> list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, list, productTypeButton_Click);
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), 0,
|
||||
ProductBI.GetProducts(item.ProductGroupID), productButton_Click);
|
||||
}
|
||||
}
|
||||
|
||||
private void productButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as Product;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.ProductID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
IList<Product> list = ProductBI.GetProducts();
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), start, list, productButton_Click);
|
||||
}
|
||||
else
|
||||
{
|
||||
_billController.AddProductToGrid(item.ProductID);
|
||||
}
|
||||
}
|
||||
|
||||
private void tableButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as FoodTable;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.FoodTableID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
IList<FoodTable> list = new FoodTableBI().List();
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), start, list, tableButton_Click);
|
||||
}
|
||||
else
|
||||
{
|
||||
string tableName = item.Name;
|
||||
_billController.LoadBillFromTable(tableName);
|
||||
txtTableID.Text = tableName;
|
||||
ChangeFormState(SaleFormState.Billing);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnPrintBill_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
_billController.Save(true, (int) btnWaiter.Tag, txtTableID.Text);
|
||||
}
|
||||
|
||||
private void btnPrintKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
_billController.Save(false, (int) btnWaiter.Tag, txtTableID.Text);
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
_billController.CancelBillChanges();
|
||||
}
|
||||
|
||||
private void btnQuantity_Click(object sender, EventArgs e)
|
||||
{
|
||||
_billController.SetQuantity(0, true);
|
||||
}
|
||||
|
||||
private void btnDiscount_Click(object sender, EventArgs e)
|
||||
{
|
||||
_billController.ShowDiscount();
|
||||
|
||||
//if (dgvProducts.Rows.Count > 0)
|
||||
// billController.SetDiscount(billController.CurrentProduct, -1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
78
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.Designer.cs
generated
Normal file
78
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.Designer.cs
generated
Normal file
@ -0,0 +1,78 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class SettleChoicesForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtAmount = new System.Windows.Forms.TextBox();
|
||||
this.flpSettlement = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.flpSettlement.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtAmount
|
||||
//
|
||||
this.txtAmount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtAmount.Location = new System.Drawing.Point(3, 3);
|
||||
this.txtAmount.Name = "txtAmount";
|
||||
this.txtAmount.ReadOnly = true;
|
||||
this.txtAmount.Size = new System.Drawing.Size(598, 20);
|
||||
this.txtAmount.TabIndex = 6;
|
||||
//
|
||||
// flpSettlement
|
||||
//
|
||||
this.flpSettlement.Controls.Add(this.txtAmount);
|
||||
this.flpSettlement.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flpSettlement.Location = new System.Drawing.Point(0, 0);
|
||||
this.flpSettlement.Name = "flpSettlement";
|
||||
this.flpSettlement.Size = new System.Drawing.Size(604, 107);
|
||||
this.flpSettlement.TabIndex = 7;
|
||||
//
|
||||
// SettleChoicesForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(604, 107);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.flpSettlement);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "SettleChoicesForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Settle Bill";
|
||||
this.Load += new System.EventHandler(this.SettleChoicesFormLoad);
|
||||
this.flpSettlement.ResumeLayout(false);
|
||||
this.flpSettlement.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtAmount;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpSettlement;
|
||||
}
|
||||
}
|
||||
136
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.cs
Normal file
136
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.cs
Normal file
@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Linq;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class SettleChoicesForm : Form
|
||||
{
|
||||
private readonly IDictionary<Button, int> _list;
|
||||
private decimal _amount;
|
||||
|
||||
public SettleChoicesForm(Voucher voucher)
|
||||
{
|
||||
InitializeComponent();
|
||||
_amount = voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount +
|
||||
voucher.Settlements.Single(x => x.Settled == SettleOption.RoundOff).Amount;
|
||||
_amount *= -1;
|
||||
OptionsChosen = new Dictionary<SettleOption, decimal>();
|
||||
_list = new Dictionary<Button, int>();
|
||||
}
|
||||
|
||||
private void ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null || button.Tag == null)
|
||||
return;
|
||||
if (button.Tag is SettleOption)
|
||||
{
|
||||
var settleOption = (SettleOption)button.Tag;
|
||||
using (var frm = new FrmSettleAmounts(new NumpadControl(), settleOption, _amount))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
UpdateChoice(settleOption, frm.AmountSettled, _list[button]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((string)button.Tag == "Cancel")
|
||||
_optionsChosen.Clear();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateChoice(SettleOption settleOption, decimal amount, int group)
|
||||
{
|
||||
var oldAmount = _optionsChosen.ContainsKey(settleOption) ? _optionsChosen[settleOption] : 0;
|
||||
if (amount == 0 && _optionsChosen.ContainsKey(settleOption))
|
||||
_optionsChosen.Remove(settleOption);
|
||||
else if (_optionsChosen.ContainsKey(settleOption))
|
||||
_optionsChosen[settleOption] = amount;
|
||||
else if (amount != 0)
|
||||
_optionsChosen.Add(settleOption, amount);
|
||||
_amount += oldAmount - amount;
|
||||
txtAmount.Text = string.Format("Pending Amount: Rs. {0}", _amount);
|
||||
|
||||
if (_optionsChosen.Count == 0)
|
||||
foreach (var item in _list.Where(item => item.Value != 0))
|
||||
item.Key.Enabled = true;
|
||||
else
|
||||
foreach (var item in _list.Where(item => item.Value != group && item.Value != 0))
|
||||
item.Key.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
private IDictionary<SettleOption, decimal> _optionsChosen;
|
||||
public IDictionary<SettleOption, decimal> OptionsChosen
|
||||
{
|
||||
get
|
||||
{
|
||||
return _amount == 0 ? _optionsChosen : new Dictionary<SettleOption, decimal>();
|
||||
}
|
||||
private set { _optionsChosen = value; }
|
||||
}
|
||||
|
||||
private void SettleChoicesFormLoad(object sender, EventArgs e)
|
||||
{
|
||||
txtAmount.Text = string.Format("Pending Amount: Rs. {0}", _amount);
|
||||
var count = 0;
|
||||
foreach (SettleOption item in Enum.GetValues(typeof(SettleOption)))
|
||||
{
|
||||
var attribute = (DisplayAttribute)item.GetType().GetField(item.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||
if (!attribute.ShowInChoices)
|
||||
continue;
|
||||
var button = new Button
|
||||
{
|
||||
Name = item.ToString(),
|
||||
Text = attribute.Name,
|
||||
Size = new System.Drawing.Size(75, 75),
|
||||
TabIndex = count,
|
||||
UseVisualStyleBackColor = true,
|
||||
Tag = item
|
||||
};
|
||||
button.Click += new EventHandler(ButtonClick);
|
||||
flpSettlement.Controls.Add(button);
|
||||
_list.Add(button, attribute.Group);
|
||||
count++;
|
||||
}
|
||||
var controlButton = new Button
|
||||
{
|
||||
Name = "btnOK",
|
||||
Text = "OK",
|
||||
Size = new System.Drawing.Size(75, 75),
|
||||
TabIndex = count,
|
||||
UseVisualStyleBackColor = true,
|
||||
Tag = "OK"
|
||||
};
|
||||
controlButton.Click += new EventHandler(ButtonClick);
|
||||
flpSettlement.Controls.Add(controlButton);
|
||||
_list.Add(controlButton, 0);
|
||||
count++;
|
||||
controlButton = new Button
|
||||
{
|
||||
Name = "btnCancel",
|
||||
Text = "Cancel",
|
||||
Size = new System.Drawing.Size(75, 75),
|
||||
TabIndex = count,
|
||||
UseVisualStyleBackColor = true,
|
||||
Tag = "Cancel"
|
||||
};
|
||||
controlButton.Click += new EventHandler(ButtonClick);
|
||||
flpSettlement.Controls.Add(controlButton);
|
||||
_list.Add(controlButton, 0);
|
||||
count++;
|
||||
txtAmount.TabIndex = count;
|
||||
|
||||
this.Size = this.SizeFromClientSize(new Size(_list.Count * (75 + 6), 3 + txtAmount.Height + 6 + 75 + 3));
|
||||
txtAmount.Width = flpSettlement.Width - 6;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.resx
Normal file
120
Tanshu.Accounts.PointOfSale/Sales/SettleChoicesForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -133,11 +133,17 @@
|
||||
<DependentUpon>SaleDetail.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\BillHelperFunctions.cs" />
|
||||
<Compile Include="Sales\BillSettleForm.cs">
|
||||
<Compile Include="Sales\FrmSettleAmounts.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Sales\BillSettleForm.Designer.cs">
|
||||
<DependentUpon>BillSettleForm.cs</DependentUpon>
|
||||
<Compile Include="Sales\FrmSettleAmounts.Designer.cs">
|
||||
<DependentUpon>FrmSettleAmounts.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Sales\SettleChoicesForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Sales\SettleChoicesForm.Designer.cs">
|
||||
<DependentUpon>SettleChoicesForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Advances\frmAdjustAdvance.cs">
|
||||
<SubType>Form</SubType>
|
||||
@ -238,8 +244,11 @@
|
||||
<DependentUpon>SaleDetail.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\BillSettleForm.resx">
|
||||
<DependentUpon>BillSettleForm.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Sales\FrmSettleAmounts.resx">
|
||||
<DependentUpon>FrmSettleAmounts.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sales\SettleChoicesForm.resx">
|
||||
<DependentUpon>SettleChoicesForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Advances\frmAdjustAdvance.resx">
|
||||
<DependentUpon>frmAdjustAdvance.cs</DependentUpon>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
@ -20,11 +21,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (control != null)
|
||||
{
|
||||
control.Location = new System.Drawing.Point(6, 140);
|
||||
var border = (this.Width - this.ClientSize.Width) / 2;
|
||||
var titlebarHeight = this.Height - this.ClientSize.Height - (2 * border);
|
||||
this.Controls.Add(control);
|
||||
this.Width = 6 + control.Width + 6 + (border * 2);
|
||||
this.Height = titlebarHeight + 140 + control.Height + 6 + (border * 2);
|
||||
this.Size = this.SizeFromClientSize(new Size(6 + control.Width + 6, 140 + control.Height + 6));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user