public KOTAppClassLibrary.Models.FunctionResponse GenerateBill(string TableNo) { try { KOTHelpler kothelper = new KOTHelpler(); POSstandardLibrary.Models.TrnMainBaseModel trnMain = kothelper.GenerateBill(TableNo); //TrnMain.ReCalculateBill(); var bill = new BillMain(); bill.GrossTotal = trnMain.TOTAMNT; bill.Discount = trnMain.DISVALUE; bill.Taxable = trnMain.TAXABLE; bill.NonTaxable = trnMain.NONTAXABLE; bill.ServiceCharge = trnMain.ServiceCharge; bill.Vat = trnMain.VATAMNT; bill.items = new List <BillProd>(); var prods = trnMain.ProdList.Select(x => new BillProd() { Sno = x.SNO, Code = x.MCODE, Particular = x.ITEMDESC, Unit = x.UNIT, Quantity = x.Quantity, Rate = x.RATE, Amount = x.AMOUNT }).ToList(); if (prods != null) { bill.items = new List <BillProd>(prods); } return(new KOTAppClassLibrary.Models.FunctionResponse() { status = "ok", result = bill }); } catch (Exception ex) { return(new KOTAppClassLibrary.Models.FunctionResponse() { status = "error", Message = ex.Message }); } }
public PreBillPageVM() { try { IsLoading = false; LoadingMessage = ""; OrderItemsList = new List <KOTProd>(); SelectedItemsList = new List <MenuItem>(); SelectedTable = Helpers.Data.SelectedTable; BillMain = new BillMain(); if (Helpers.Data.MenuItemsList != null) { SelectedItemsList = new List <MenuItem>(Helpers.Data.MenuItemsList.Where(x => x.TYPE == "A").ToList()); } if (Helpers.Data.BillMain != null) { BillMain = Helpers.Data.BillMain; } //if (Helpers.Data.BillMain != null) //{ // BillMain = Helpers.Data.BillMain; // //OrderItemsList = Helpers.Data.OrderItemsList.OrderBy(x=>x.MCODE).ToList(); // //OrderItemsList = new List<KOTProd>(); // //foreach (var item in Helpers.Data.OrderItemsList) // //{ // // var found = OrderItemsList.Find(x => x.MCODE == item.MCODE); // // if (found == null) // // { // // var newItem = new KOTProd(item); // // newItem.SNO = OrderItemsList.Count + 1; // // OrderItemsList.Add(newItem); // // } // // else // // { // // found.Quantity += item.Quantity; // // } // //} // //OrderItemsList.ForEach(x => x.DisMode = (SelectedItemsList.Find(y => y.MCODE == x.MCODE).DisMode)); // //OrderItemsList.ForEach(x => x.RATE = (SelectedItemsList.Find(y => y.MCODE == x.MCODE).RATE_A)); // //foreach(var item in OrderItemsList) // //{ // // if(item.DisMode == "DISCOUNTABLE") // // { // // if(item.ISBOT == 0) // // { // // item.AMOUNT = (item.RATE * item.Quantity); // // item.DISCOUNT = ((double)(FoodDiscount / 100) * item.AMOUNT); // // item.NAMNT = item.AMOUNT - item.DISCOUNT; // // } // // else // // { // // item.AMOUNT = (item.RATE * item.Quantity); // // item.DISCOUNT = ((double)(BeverageDiscount / 100) * item.AMOUNT); // // item.NAMNT = item.AMOUNT - item.DISCOUNT; // // } // // } // // else // // { // // item.AMOUNT = (item.RATE * item.Quantity); // // item.NAMNT = item.AMOUNT; // // item.DISCOUNT = 0; // // } // //} //} }catch (Exception ex) { } }