Ejemplo n.º 1
0
        //------------------------Take Away Bills of All Outlets----------------//
        public ActionResult TakeBills()
        {
            AdminBillReportModel m = new AdminBillReportModel();
            var billdata           = (from p in db.tblBillMasters where p.BillingType == "Take Away Hall" && p.OutletId != 0 && p.BillDate == DateTime.Today select p).ToList();

            ViewBag.alloutletList = search.GetlistOfOutlets();
            List <BillingModel> list = new List <BillingModel>();

            foreach (var item in billdata)
            {
                BillingModel model = new BillingModel();
                List <AdminBillDetailsReportModel> lstBill = new List <AdminBillDetailsReportModel>();
                model.BillId          = item.BillId;
                model.BillDate        = item.BillDate;
                model.TotalAmount     = item.TotalAmount;
                model.VatAmount       = item.VatAmount;
                model.ServicChargeAmt = item.ServicChargesAmount;
                model.DiscountAmount  = item.DiscountAmount;
                model.NetAmount       = item.NetAmount;
                model.TableNo         = item.TableNo;
                model.Outletid        = item.OutletId;
                model.OutletName      = (from p in db.tblOutlets where p.OutletId == item.OutletId select p.Name).FirstOrDefault();
                foreach (var i in db.tblBillDetails.Where(a => a.BillId == item.BillId).ToList())
                {
                    AdminBillDetailsReportModel bill = new AdminBillDetailsReportModel();
                    bill.Amount       = i.Amount;
                    bill.BilldeatilId = i.BillDetailsId;
                    bill.FullQty      = i.FullQty.Value;
                    bill.HalfQty      = i.HalfQty.Value;
                    bill.ItemName     = (from p in db.tblItems where p.ItemId == i.ItemId select p.Name).FirstOrDefault();
                    lstBill.Add(bill);
                }
                model.getBillItemDetails = lstBill;
                list.Add(model);
            }
            m.getAllBillReports  = list;
            m.getAllListOfOutlet = search.GetlistOfOutlets();
            //m.SearchFrom = DateTime.Now.Date;
            //m.SearchTo = DateTime.Now.Date;
            //m.BillNo = 0;
            return(View(m));
        }
Ejemplo n.º 2
0
        public AdminBillReportModel getSearchData(AdminBillReportModel model, string type)
        {
            List <BillingModel> list = new List <BillingModel>();
            var result = (from p in entities.tblBillMasters
                          where p.BillId == model.BillNo
                          select p).ToList();;

            if (model.BillNo > 0)
            {
                if (type == "R")
                {
                    result = (from p in entities.tblBillMasters
                              where p.BillId == model.BillNo &&
                              (p.BillingType == "Ac Hall" || p.BillingType == "Dine In Hall")
                              select p).ToList();
                }
                else
                {
                    result = (from p in entities.tblBillMasters
                              where p.BillId == model.BillNo &&
                              p.BillingType == type
                              select p).ToList();
                }
            }
            else if (model.OutletId > 0)
            {
                if (type == "R")
                {
                    result = (from p in entities.tblBillMasters
                              where p.OutletId == model.OutletId &&
                              (p.BillingType == "Ac Hall" || p.BillingType == "Dine In Hall")
                              select p).ToList();
                }
                else
                {
                    result = (from p in entities.tblBillMasters
                              where p.OutletId == model.OutletId &&
                              p.BillingType == type
                              select p).ToList();
                }
            }
            else
            {
                if (type == "R")
                {
                    result = (from p in entities.tblBillMasters
                              where p.BillDate >= model.SearchFrom &&
                              p.BillDate <= model.SearchTo &&
                              (p.BillingType == "Ac Hall" || p.BillingType == "Dine In Hall")
                              select p).ToList();
                }
                else
                {
                    result = (from p in entities.tblBillMasters
                              where p.BillDate >= model.SearchFrom &&
                              p.BillDate <= model.SearchTo &&
                              p.BillingType == type
                              select p).ToList();
                }
            }
            foreach (var item in result)
            {
                BillingModel m = new BillingModel();
                List <AdminBillDetailsReportModel> lstBill = new List <AdminBillDetailsReportModel>();
                m.BillId          = item.BillId;
                m.BillDate        = item.BillDate;
                m.TotalAmount     = item.TotalAmount;
                m.VatAmount       = item.VatAmount;
                m.ServicChargeAmt = item.ServicChargesAmount;
                m.DiscountAmount  = item.DiscountAmount;
                m.NetAmount       = item.NetAmount;
                m.TableNo         = item.TableNo;
                if (item.TokenNo == null)
                {
                    m.TokenNo = 0;
                }
                else
                {
                    m.TokenNo = item.TokenNo.Value;
                }
                m.Outletid   = item.OutletId;
                m.OutletName = (from p in entities.tblOutlets where p.OutletId == item.OutletId select p.Name).FirstOrDefault();
                foreach (var i in entities.tblBillDetails.Where(a => a.BillId == item.BillId).ToList())
                {
                    AdminBillDetailsReportModel bill = new AdminBillDetailsReportModel();
                    bill.Amount       = i.Amount;
                    bill.BilldeatilId = i.BillDetailsId;
                    bill.FullQty      = i.FullQty.Value;
                    bill.HalfQty      = i.HalfQty.Value;
                    bill.ItemName     = (from p in entities.tblItems where p.ItemId == i.ItemId select p.Name).FirstOrDefault();
                    lstBill.Add(bill);
                }
                m.getBillItemDetails = lstBill;
                list.Add(m);
            }
            model.getAllBillReports  = list;
            model.getAllListOfOutlet = GetlistOfOutlets();
            model.SearchFrom         = model.SearchFrom;
            model.SearchTo           = model.SearchTo;
            model.BillNo             = model.BillNo;
            return(model);
        }
Ejemplo n.º 3
0
        public AdminBillReportModel getOutletSearchData(AdminBillReportModel model, string type, int OutletId)
        {
            List <BillingModel> list = new List <BillingModel>();
            //var result = (from p in entities.tblBillMasters
            //              where p.BillId == model.BillNo
            //              && p.OutletId== OutletId
            //              select p).ToList();
            var result = entities.tblBillMasters.Where(a => a.BillId == model.BillNo && a.OutletId == OutletId).ToList();

            if (model.BillNo > 0)
            {
                //result = (from p in entities.tblBillMasters
                //          where p.BillId == model.BillNo
                //          && p.BillingType == type
                //          && p.OutletId == OutletId
                //          select p).ToList();
                result = entities.tblBillMasters.Where(a => a.BillId == model.BillNo && a.BillingType == type && a.OutletId == OutletId).ToList();
            }
            else if (model.OutletId > 0)
            {
                //result = (from p in entities.tblBillMasters
                //          where p.OutletId == model.OutletId
                //          && p.BillingType == type
                //          && p.OutletId == OutletId
                //          select p).ToList();
                result = entities.tblBillMasters.Where(a => a.OutletId == model.OutletId && a.BillingType == type && a.OutletId == OutletId).ToList();
            }
            else
            {
                //result = (from p in entities.tblBillMasters
                //          where p.BillDate.Date >= EntityFunctions.TruncateTime(model.SearchFrom)
                //          && p.BillDate.Date <= EntityFunctions.TruncateTime(model.SearchTo)
                //          && p.BillingType == type
                //          && p.OutletId == OutletId
                //          select p).ToList();
                result = entities.tblBillMasters.Where(a => EntityFunctions.TruncateTime(a.BillDate) >= model.SearchFrom.Date

                                                       && EntityFunctions.TruncateTime(a.BillDate) <= model.SearchTo.Date && a.BillingType == type && a.OutletId == OutletId).ToList();
            }
            foreach (var item in result)
            {
                BillingModel m = new BillingModel();
                List <AdminBillDetailsReportModel> lstBill = new List <AdminBillDetailsReportModel>();
                m.BillId          = item.BillId;
                m.BillDate        = item.BillDate;
                m.TotalAmount     = Math.Round(item.TotalAmount, 2);
                m.VatAmount       = Math.Round(item.VatAmount, 2);
                m.ServicChargeAmt = Math.Round(item.ServicChargesAmount, 2);
                if (item.ServiceTax.HasValue)
                {
                    m.ServiceTax = item.ServiceTax.Value;
                }
                m.DiscountAmount = Math.Round(item.DiscountAmount, 2);
                m.NetAmount      = Math.Round(item.NetAmount, 2);
                m.TableNo        = item.TableNo;
                if (item.TokenNo == null)
                {
                    m.TokenNo = 0;
                }
                else
                {
                    m.TokenNo = item.TokenNo.Value;
                }
                m.Outletid   = item.OutletId;
                m.OutletName = (from p in entities.tblOutlets where p.OutletId == item.OutletId select p.Name).FirstOrDefault();
                foreach (var i in entities.tblBillDetails.Where(a => a.BillId == item.BillId).ToList())
                {
                    AdminBillDetailsReportModel bill = new AdminBillDetailsReportModel();
                    bill.Amount       = Math.Round(i.Amount, 2);
                    bill.BilldeatilId = i.BillDetailsId;
                    bill.FullQty      = i.FullQty.Value;
                    bill.HalfQty      = i.HalfQty.Value;
                    bill.ItemName     = (from p in entities.tblItems where p.ItemId == i.ItemId select p.Name).FirstOrDefault();
                    lstBill.Add(bill);
                }
                m.getBillItemDetails = lstBill;
                list.Add(m);
            }
            model.getAllBillReports  = list;
            model.getAllListOfOutlet = GetlistOfOutlets();
            model.SearchFrom         = model.SearchFrom;
            model.SearchTo           = model.SearchTo;
            model.BillNo             = model.BillNo;
            return(model);
        }
Ejemplo n.º 4
0
 public ActionResult AllHomeDelivery(AdminBillReportModel model)
 {
     return(View(search.getSearchData(model, "Door Delivery Hall")));
 }
Ejemplo n.º 5
0
 public ActionResult TakeBills(AdminBillReportModel model)
 {
     return(View(search.getSearchData(model, "Take Away Hall")));
 }
Ejemplo n.º 6
0
 public ActionResult RestroBill(AdminBillReportModel model)
 {
     return(View(search.getSearchData(model, "R")));
 }