Breaking Changes. Upgrade Script in Sql directory. Deployed
This commit is contained in:
@ -17,7 +17,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class BillController
|
||||
{
|
||||
private SaleVoucher billInfo;
|
||||
private Voucher billInfo;
|
||||
private OrderedDictionary<BillItemKey, BillInventory> bill = new OrderedDictionary<BillItemKey, BillInventory>();
|
||||
int? editVoucherID;
|
||||
|
||||
@ -63,7 +63,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void ShowModifiers(int productGroupID, BillInventory item)
|
||||
{
|
||||
if (item.Printed > 0)
|
||||
if (item.Printed)
|
||||
return;
|
||||
var list = ProductGroupModifierBI.GetProductGroupModifiers(productGroupID);
|
||||
using (var frm = new ModifierForm(list, item.Modifiers))
|
||||
@ -79,18 +79,20 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (!Session.IsAllowed(RoleConstants.DISCOUNT))
|
||||
return;
|
||||
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
var list = new ProductGroupBI().GetProductGroupTypes();
|
||||
using (var frm = new DiscountForm(list))
|
||||
{
|
||||
if (frm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
IList<int> outList;
|
||||
HashSet<string> outList;
|
||||
decimal discount = frm.Selection(out outList);
|
||||
discount = discount / 100;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.KotID == -1)
|
||||
continue;
|
||||
var pg = new ProductGroupBI().GetProductGroupOfProduct(item.Value.ProductID);
|
||||
if (outList.Contains(pg.ProductGroupID))
|
||||
if (outList.Contains(pg.GroupType))
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, item.Value.ProductID).SetDiscount(item.Value.Name, discount);
|
||||
|
||||
}
|
||||
@ -131,26 +133,31 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void Save(bool print, int waiterID, string tableID)
|
||||
{
|
||||
|
||||
if (print && !Session.IsAllowed(RoleConstants.PRINT_BILL))
|
||||
return;
|
||||
if (!print && !Session.IsAllowed(RoleConstants.PRINT_KOT))
|
||||
return;
|
||||
if ((billInfo != null) && (SaleVoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
if ((billInfo != null) && (VoucherBI.IsBillPrinted(billInfo.VoucherID)) && (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL)))
|
||||
return;
|
||||
if (bill.Count == 0)
|
||||
if (bill.Count == 1) //new kot only
|
||||
return;
|
||||
|
||||
if (print)
|
||||
ShowDiscount();
|
||||
int? saved;
|
||||
if (billInfo == null)
|
||||
saved = InsertVoucher(print, waiterID, tableID);
|
||||
else
|
||||
saved = UpdateSale(print, waiterID, tableID);
|
||||
if (saved.HasValue)
|
||||
if (editVoucherID.HasValue)
|
||||
saleForm.CloseWindow();
|
||||
else
|
||||
{
|
||||
if (editVoucherID.HasValue)
|
||||
saleForm.CloseWindow();
|
||||
else
|
||||
PrintBill(print, saved.Value);
|
||||
int kotID = 0;
|
||||
if (!print && saved.HasValue)
|
||||
kotID = saved.Value;
|
||||
if (print || kotID != 0)
|
||||
PrintBill(billInfo.VoucherID, kotID);
|
||||
}
|
||||
ClearBill();
|
||||
}
|
||||
@ -161,13 +168,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
MessageBox.Show("Error in InsertVoucher, there is a previous sale in memory", "Error");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
#region SaleVoucher
|
||||
SaleVoucher saleVoucher = new SaleVoucher
|
||||
#region Voucher
|
||||
billInfo = new Voucher
|
||||
{
|
||||
Customer = customer,
|
||||
Settled = SettleOptionBI.GetSettleOption(SettleOptionFactory.Unsettled),
|
||||
Settled = SettleOption.Unsettled,
|
||||
//Paid = finalBill,
|
||||
TableID = tableID,
|
||||
Waiter = WaiterBI.GetWaiter(waiterID),
|
||||
@ -175,21 +180,19 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
Ref = "",
|
||||
Type = 'S',
|
||||
User = Session.User
|
||||
};
|
||||
#endregion
|
||||
#region Inventories
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
SaleVoucherBI.Insert(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
|
||||
return VoucherBI.Insert(billInfo);
|
||||
}
|
||||
private int? UpdateSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
#region SaleVoucher
|
||||
#region Voucher
|
||||
billInfo.User = Session.User;
|
||||
billInfo.Customer = customer;
|
||||
if (!billInfo.Printed && finalBill)
|
||||
@ -197,59 +200,46 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
billInfo.Printed = billInfo.Printed || finalBill;
|
||||
billInfo.TableID = tableID;
|
||||
billInfo.Waiter = WaiterBI.GetWaiter(waiterID);
|
||||
//if ((!billInfo.Printed) && finalBill)
|
||||
// billInfo.Date = null;
|
||||
billInfo.Inventories = new List<Inventory>();
|
||||
var kot = GetKotForBill();
|
||||
if (kot != null)
|
||||
billInfo.Kots.Add(kot);
|
||||
#endregion
|
||||
#region Inventory
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
#endregion
|
||||
SaleVoucherBI.Update(billInfo, iList);
|
||||
return billInfo.VoucherID;
|
||||
return VoucherBI.Update(billInfo);
|
||||
}
|
||||
private IList<Inventory> GetInventoryForBill(ICollection<BillInventory> list)
|
||||
private Kot GetKotForBill()
|
||||
{
|
||||
Dictionary<int, Inventory> localList = new Dictionary<int, Inventory>();
|
||||
HashSet<int> keys = new HashSet<int>();
|
||||
|
||||
foreach (BillInventory item in list)
|
||||
var kot = new Kot();
|
||||
foreach (var item in bill)
|
||||
{
|
||||
Inventory temp = new Inventory();
|
||||
if (localList.ContainsKey(item.ProductID))
|
||||
if (item.Key.KotID == -1 || item.Value.Quantity == 0)
|
||||
continue;
|
||||
else if (item.Key.KotID != 0)
|
||||
{
|
||||
if (temp.Quantity <= 0)
|
||||
keys.Remove(item.ProductID);
|
||||
|
||||
temp = localList[item.ProductID];
|
||||
temp.Quantity += item.Quantity;
|
||||
temp.Amount += item.Value;
|
||||
foreach (var mod in item.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod });
|
||||
if (temp.Quantity <= 0)
|
||||
keys.Add(item.ProductID);
|
||||
var oldKot = billInfo.Kots.Where(x => x.KotID == item.Key.KotID).Single();
|
||||
var inv = oldKot.Inventories.Where(x => x.Product.ProductID == item.Key.ProductID).Single();
|
||||
inv.Rate = item.Value.Price;
|
||||
inv.Discount = item.Value.Discount;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.Product = ProductBI.GetProduct(item.ProductID);
|
||||
temp.Quantity = item.Quantity;
|
||||
temp.Rate = item.Price;
|
||||
temp.Discount = item.Discount;
|
||||
temp.ServiceCharge = item.ServiceCharge;
|
||||
temp.Tax = item.Tax;
|
||||
temp.Amount = item.Value;
|
||||
foreach (var mod in item.Modifiers)
|
||||
Inventory temp = new Inventory();
|
||||
temp.Product = ProductBI.GetProduct(item.Key.ProductID);
|
||||
temp.Quantity = item.Value.Quantity;
|
||||
temp.Rate = item.Value.Price;
|
||||
temp.Discount = item.Value.Discount;
|
||||
temp.ServiceCharge = item.Value.ServiceCharge;
|
||||
temp.Tax = item.Value.Tax;
|
||||
foreach (var mod in item.Value.Modifiers)
|
||||
temp.InventoryModifier.Add(new InventoryModifier() { Modifier = mod });
|
||||
localList.Add(item.ProductID, temp);
|
||||
|
||||
if (item.Quantity <= 0)
|
||||
keys.Add(item.ProductID);
|
||||
kot.Inventories.Add(temp);
|
||||
}
|
||||
}
|
||||
foreach (var item in keys)
|
||||
{
|
||||
localList.Remove(item);
|
||||
}
|
||||
return localList.Values.ToList();
|
||||
if (kot.Inventories.Count == 0)
|
||||
return null;
|
||||
else
|
||||
return kot;
|
||||
}
|
||||
#endregion
|
||||
public void VoidBill()
|
||||
@ -266,7 +256,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
{
|
||||
SaleVoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
VoucherBI.VoidBill(billInfo.VoucherID, voidReason.SelectedItem.Description);
|
||||
ClearBill();
|
||||
}
|
||||
else
|
||||
@ -284,12 +274,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return form.Customer;
|
||||
}
|
||||
}
|
||||
private void PrintBill(bool finalBill, int voucherID)
|
||||
private void PrintBill(int voucherID, int kotID)
|
||||
{
|
||||
if (!finalBill)
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, bill.Values.ToList());
|
||||
if (kotID == 0)
|
||||
Accounts.Print.Thermal.PrintBill(voucherID);
|
||||
else
|
||||
Accounts.Print.Thermal.PrintBill(voucherID, bill.Values.ToList());
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, kotID);
|
||||
}
|
||||
|
||||
private List<StringType> GetVoidReason(Dictionary<string, string> filter)
|
||||
@ -312,7 +302,31 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
return bill.ElementAt(saleForm.BindingSource.Position).Value;
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID == -1)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BillInventory CurrentKot
|
||||
{
|
||||
get
|
||||
{
|
||||
if (saleForm.BindingSource.Position == -1)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
var item = bill.ElementAt(saleForm.BindingSource.Position);
|
||||
if (item.Key.KotID != -1)
|
||||
return null;
|
||||
else if (item.Key.ProductID == 0)
|
||||
return null;
|
||||
else
|
||||
return item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ShowAmount()
|
||||
@ -332,14 +346,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
if (item.Printed > 0)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
else if (MessageBox.Show(string.Format("Already {0} items have been printed.\n\rAre you sure you want to delete this item?", item.Printed), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return;
|
||||
}
|
||||
bill.Remove(new BillItemKey(item.ProductID, item.Printed == 0));
|
||||
if (item.Printed)
|
||||
return;
|
||||
bill.Remove(new BillItemKey(item.ProductID, 0));
|
||||
bill.ReCompact();
|
||||
ShowAmount();
|
||||
}
|
||||
@ -355,6 +364,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void ChangeRate()
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
if (!Allowed(item))
|
||||
return;
|
||||
new BillHelperFunctions(saleForm.BindingSource, bill, CurrentProduct.ProductID).SetPrice(CurrentProduct);
|
||||
ShowAmount();
|
||||
|
||||
@ -375,31 +387,60 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void LoadBill(int voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
IList<Inventory> iList = new List<Inventory>();
|
||||
SaleVoucherBI.GetSaleVoucher(voucherID, out billInfo, out iList);
|
||||
bill.Clear();
|
||||
billInfo = null;
|
||||
billInfo = VoucherBI.GetSaleVoucher(voucherID);
|
||||
|
||||
this.customer = billInfo.Customer;
|
||||
saleForm.ShowInfo(billInfo.BillID, billInfo.KotID, billInfo.CreationDate, billInfo.Date.Value, billInfo.LastEditDate, customer.Name, billInfo.TableID, billInfo.Waiter.WaiterID, billInfo.Waiter.Name);
|
||||
|
||||
foreach (Inventory inventory in iList)
|
||||
foreach (var kot in billInfo.Kots)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inventory.Product.ProductID, false);
|
||||
var product = ProductBI.GetProduct(inventory.Product.ProductID);
|
||||
var item = new BillInventory
|
||||
BillItemKey kotKey = new BillItemKey(kot.KotID, -1);
|
||||
var kotItem = new BillInventory
|
||||
{
|
||||
ProductID = product.ProductID,
|
||||
Discount = inventory.Discount,
|
||||
Name = product.Units == string.Empty ? product.Name : product.Name + " (" + product.Units + ")",
|
||||
Price = inventory.Rate,
|
||||
Printed = inventory.Quantity,
|
||||
Quantity = inventory.Quantity,
|
||||
Tax = inventory.Tax,
|
||||
ServiceCharge = inventory.ServiceCharge,
|
||||
ProductID = kot.KotID,
|
||||
Discount = 0,
|
||||
Name = string.Format("Kot No.: {0} / KotID {1}", kot.KotID, kot.Code),
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
foreach (var mod in inventory.InventoryModifier)
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
bill.Add(key, item);
|
||||
bill.Add(kotKey, kotItem);
|
||||
foreach (var inv in kot.Inventories)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inv.Product.ProductID, kot.KotID);
|
||||
var item = new BillInventory
|
||||
{
|
||||
ProductID = inv.Product.ProductID,
|
||||
Discount = inv.Discount,
|
||||
Name = inv.Product.Units == string.Empty ? inv.Product.Name : inv.Product.Name + " (" + inv.Product.Units + ")",
|
||||
Price = inv.Rate,
|
||||
Printed = true,
|
||||
Quantity = inv.Quantity,
|
||||
Tax = inv.Tax,
|
||||
ServiceCharge = inv.ServiceCharge,
|
||||
};
|
||||
foreach (var mod in inv.InventoryModifier)
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
bill.Add(key, item);
|
||||
}
|
||||
}
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
ShowAmount();
|
||||
|
||||
}
|
||||
@ -407,10 +448,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
SaleVoucher voucher = SaleVoucherBI.GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
var table = new FoodTableBI().GetByName(tableName);
|
||||
if (table != null && table.VoucherID != 0)
|
||||
{
|
||||
LoadBill(voucher.VoucherID);
|
||||
LoadBill(table.VoucherID);
|
||||
}
|
||||
|
||||
}
|
||||
@ -422,10 +463,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
string tableID = result.Text.Trim();
|
||||
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
||||
{
|
||||
SaleVoucher voucher = SaleVoucherBI.GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
var table = new FoodTableBI().GetByName(tableName);
|
||||
if (table != null && table.VoucherID != 0)
|
||||
{
|
||||
LoadBill(voucher.VoucherID);
|
||||
LoadBill(table.VoucherID);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -436,7 +477,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
public void CancelBillChanges()
|
||||
{
|
||||
if (bill.Count != 0 && bill.Values.Any(i => i.Printed != i.Quantity))
|
||||
if (bill.Count != 0 && bill.Values.Any(i => i.Printed == false))
|
||||
if (MessageBox.Show("Abandon Changes?", "Abandon Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
|
||||
return;
|
||||
ClearBill();
|
||||
@ -446,10 +487,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
billInfo = null;
|
||||
ShowCustomerList(true);
|
||||
bill.Clear();
|
||||
BillItemKey newKotKey = new BillItemKey(0, -1);
|
||||
var newKotItem = new BillInventory
|
||||
{
|
||||
ProductID = 0,
|
||||
Discount = 0,
|
||||
Name = "== New Kot ==",
|
||||
Price = 0,
|
||||
Printed = true,
|
||||
Quantity = 0,
|
||||
Tax = -1,
|
||||
ServiceCharge = 0,
|
||||
};
|
||||
bill.Add(newKotKey, newKotItem);
|
||||
saleForm.ClearBill(bill);
|
||||
}
|
||||
public void FormLoad()
|
||||
{
|
||||
ClearBill();
|
||||
if (editVoucherID.HasValue)
|
||||
{
|
||||
LoadBill(editVoucherID.Value);
|
||||
@ -463,20 +518,118 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
if (!Session.IsAllowed(RoleConstants.SETTLE_BILL))
|
||||
return;
|
||||
int option = SettleOptionFactory.Unsettled;
|
||||
var option = SettleOption.Unsettled;
|
||||
using (BillSettleForm frm = new BillSettleForm())
|
||||
{
|
||||
frm.ShowDialog();
|
||||
option = frm.optionChosen;
|
||||
}
|
||||
if (option != SettleOptionFactory.Unsettled)
|
||||
if (option != SettleOption.Unsettled)
|
||||
{
|
||||
SaleVoucherBI.SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
VoucherBI.SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
ClearBill();
|
||||
}
|
||||
}
|
||||
|
||||
internal void MoveTable()
|
||||
{
|
||||
if (billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var table = GetTableForMove(true);
|
||||
if (table == null)
|
||||
return;
|
||||
if (table.VoucherID == 0)
|
||||
LoadBill(MoveTable(table));
|
||||
else
|
||||
LoadBill(MergeTable(table));
|
||||
}
|
||||
private int MoveTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_TABLE))
|
||||
return 0;
|
||||
return new FoodTableBI().Move(billInfo.TableID, table);
|
||||
}
|
||||
private int MergeTable(FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_TABLE))
|
||||
return 0;
|
||||
var kots = bill.Where(x => x.Key.KotID == -1 && x.Key.ProductID != 0);
|
||||
foreach (var item in kots)
|
||||
MergeKot(item.Value, table);
|
||||
VoucherBI.Delete(billInfo.VoucherID);
|
||||
return table.VoucherID;
|
||||
}
|
||||
|
||||
private int MergeKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MERGE_KOT))
|
||||
return 0;
|
||||
return VoucherBI.MoveKot(kot.ProductID, table);
|
||||
}
|
||||
private int MoveKot(BillInventory kot, FoodTable table)
|
||||
{
|
||||
if (!Session.IsAllowed(RoleConstants.MOVE_KOT))
|
||||
return 0;
|
||||
CreateNewVoucherForKotMove(kot, table);
|
||||
return MergeKot(kot, table);
|
||||
}
|
||||
private void CreateNewVoucherForKotMove(BillInventory kot, FoodTable table)
|
||||
{
|
||||
var voucher = new Voucher
|
||||
{
|
||||
Customer = billInfo.Customer,
|
||||
Settled = SettleOption.Unsettled,
|
||||
TableID = table.Name,
|
||||
Waiter = billInfo.Waiter,
|
||||
Printed = false,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
User = Session.User
|
||||
};
|
||||
VoucherBI.Insert(voucher);
|
||||
}
|
||||
private FoodTable GetTableForMove(bool allowMerge)
|
||||
{
|
||||
using (var frm = new frmMoveTable(new FoodTableBI().List(), allowMerge))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
if (frm.Selection != null)
|
||||
return frm.Selection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void MergeKot()
|
||||
{
|
||||
if (billInfo == null)
|
||||
return;
|
||||
if (VoucherBI.IsBillPrinted(billInfo.VoucherID) && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_BILL))
|
||||
return;
|
||||
var kot = CurrentKot;
|
||||
if (kot == null)
|
||||
return;
|
||||
var table = GetTableForMove(true);
|
||||
if (table == null)
|
||||
return;
|
||||
var count = bill.Keys.Count(x => x.KotID == -1 && x.ProductID != 0);
|
||||
int voucherID = 0;
|
||||
if (table.VoucherID == 0 && count > 1)
|
||||
//Move Kot
|
||||
voucherID = MoveKot(kot, table);
|
||||
else if (table.VoucherID == 0 && count == 1)
|
||||
//Move Table
|
||||
voucherID = MoveTable(table);
|
||||
else if (table.VoucherID != 0 && count > 1)
|
||||
//Merge Kot
|
||||
voucherID = MergeKot(kot, table);
|
||||
else if (table.VoucherID != 0 && count == 1)
|
||||
//Merge Table
|
||||
voucherID = MergeTable(table);
|
||||
if (voucherID != 0)
|
||||
LoadBill(voucherID);
|
||||
}
|
||||
}
|
||||
}
|
||||
// How to load a bill
|
||||
//LoadBill(((PendingBills)bsPending.Current).editVoucherID);
|
||||
// ChangeFormState(SaleFormState.Billing);
|
||||
Reference in New Issue
Block a user