Пример #1
0
 // GET: Accountings/Payments/Create
 public IActionResult Create()
 {
     ViewData["BankAccountId"] = new SelectList(_context.BankAccounts, "BankAccountId", "Account");
     ViewData["PartyId"]       = new SelectList(_context.Parties, "PartyId", "PartyName");
     ViewData["StoreId"]       = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);
     return(PartialView());
 }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ExpenseId,Particulars,PartyName,EmployeeId,OnDate,PayMode,BankAccountId,PaymentDetails,Amount,Remarks,PartyId,LedgerEnteryId,IsCash,StoreId,UserId,EntryStatus")] Expense expense)
        {
            if (ModelState.IsValid)
            {
                if (expense.PayMode == PaymentMode.Cash)
                {
                    expense.BankAccountId = null;
                }
                _context.Add(expense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BankAccountId"] = new SelectList(_context.BankAccounts, "BankAccountId", "Account", expense.BankAccountId);
            ViewData["EmployeeId"]    = new SelectList(_context.Employees, "EmployeeId", "StaffName", expense.EmployeeId);
            ViewData["PartyId"]       = new SelectList(_context.Parties.OrderBy(c => c.PartyName), "PartyId", "PartyName", expense.PartyId);
            ViewData["StoreId"]       = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);

            Console.WriteLine($"StoreId+{expense.StoreId}\tEnt {expense.EntryStatus},\t us {expense.UserId}, \taa=" + ModelState.IsValid);
            foreach (var modelState in ViewData.ModelState.Values)
            {
                foreach (ModelError error in modelState.Errors)
                {
                    Console.WriteLine(error.ErrorMessage);
                }
            }
            return(View(expense));
        }
Пример #3
0
        public IActionResult Index()
        {
            // Setting Store Info Here
            ViewBag.StoreID = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Home/Index");
            MasterViewReport mvr = DashboardWidget.GetMasterViewReport(_context);

            return(View(mvr));
        }
Пример #4
0
        // GET: Accounts/CashPayments/Create
        public IActionResult Create()
        {
            ViewData["TranscationModeId"] = new SelectList(_context.TranscationModes, "TranscationModeId", "Transcation");
            // ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreId");
            ViewData["StoreId"] = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);

            return(PartialView());
        }
Пример #5
0
        // GET: DailySales/Create
        public IActionResult Create()
        {
            // Setting Store Info Here

            ViewBag.StoreID = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales");

            ViewData["SalesmanId"] = new SelectList(db.Salesmen, "SalesmanId", "SalesmanName");
            return(PartialView());
        }
Пример #6
0
        public IActionResult Index()
        {
            int StoreId = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales");

            var vm = aprajitaContext.RegularInvoices.Include(c => c.Customer).Include(c => c.SaleItems).Include(c => c.PaymentDetail)
                     .Where(c => c.IsManualBill && c.StoreId == StoreId).OrderByDescending(c => c.OnDate).ThenByDescending(c => c.InvoiceNo).ToList();

            return(View(vm));
        }
Пример #7
0
        // GET: Tailoring/TalioringBookings/Create
        public IActionResult Create()
        {
            // Setting Store Info Here

            ViewBag.StoreID = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Tailoring/TalioringBookings");

            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName");
            return(PartialView());
        }
Пример #8
0
        public async Task <IActionResult> Create([Bind("TalioringBookingId,BookingDate,CustName,DeliveryDate,TryDate,BookingSlipNo,TotalAmount,TotalQty,ShirtQty,ShirtPrice,PantQty,PantPrice,CoatQty,CoatPrice,KurtaQty,KurtaPrice,BundiQty,BundiPrice,Others,OthersPrice,IsDelivered,StoreId,UserId,EntryStatus,IsReadOnly")] TalioringBooking talioringBooking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(talioringBooking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.StoreID     = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Tailoring/TalioringBookings");
            ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreName", talioringBooking.StoreId);
            return(View(talioringBooking));
        }
Пример #9
0
        public async Task <IActionResult> Create([Bind("CashReceiptId,InwardDate,TranscationModeId,ReceiptFrom,Amount,SlipNo,Remarks,StoreId,UserId,EntryStatus,IsReadOnly")] CashReceipt cashReceipt)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cashReceipt);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TranscationModeId"] = new SelectList(_context.TranscationModes, "TranscationModeId", "Transcation", cashReceipt.TranscationModeId);
            // ViewData["StoreId"] = new SelectList(_context.Stores, "StoreId", "StoreId", cashReceipt.StoreId);
            ViewData["StoreId"] = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);

            return(View(cashReceipt));
        }
Пример #10
0
        // GET: Accountings/Payments/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var payment = await _context.Payments.FindAsync(id);

            if (payment == null)
            {
                return(NotFound());
            }
            ViewData["BankAccountId"] = new SelectList(_context.BankAccounts, "BankAccountId", "Account", payment.BankAccountId);
            ViewData["PartyId"]       = new SelectList(_context.Parties, "PartyId", "PartyName", payment.PartyId);
            ViewData["StoreId"]       = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);
            return(PartialView(payment));
        }
Пример #11
0
        public IActionResult ReprintInvoice(int?id, int?Download)
        {
            // Setting Store Info Here
            int StoreId = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales");

            ViewBag.StoreID = StoreId;
            var vm = aprajitaContext.RegularInvoices.Include(c => c.Customer).Include(c => c.SaleItems).Include(c => c.PaymentDetail).
                     ThenInclude(c => c.CardDetail).Where(c => c.RegularInvoiceId == id && c.StoreId == StoreId).FirstOrDefault();

            string fileName = new RegularSaleManager().RePrintManaulInvoice(aprajitaContext, vm, StoreId);

            if (Download != null && Download == 101)
            {
                return(File(fileName, "application/pdf", Path.GetFileName(fileName)));
            }

            return(File(fileName, "application/pdf"));
        }
Пример #12
0
        public async Task <IActionResult> Create([Bind("ReceiptId,PartyName,RecieptSlipNo,OnDate,PayMode,BankAccountId,PaymentDetails,Amount,Remarks,PartyId,LedgerEnteryId,IsCash,StoreId,UserName")] Receipt receipt)
        {
            if (ModelState.IsValid)
            {
                if (receipt.PayMode == PaymentMode.Cash)
                {
                    receipt.BankAccountId = null;
                }
                _context.Add(receipt);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BankAccountId"] = new SelectList(_context.BankAccounts, "BankAccountId", "Account", receipt.BankAccountId);
            ViewData["PartyId"]       = new SelectList(_context.Parties, "PartyId", "PartyName", receipt.PartyId);
            ViewData["StoreId"]       = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);

            return(View(receipt));
        }
Пример #13
0
        public async Task <IActionResult> AddEditPaymentDetails(string InvNo)
        {
            // Setting Store Info Here
            ViewBag.StoreID   = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales");
            ViewData["EDCId"] = new SelectList(db.CardMachine, "EDCId", "EDCName");

            if (String.IsNullOrEmpty(InvNo))
            {
                return(NotFound());
            }
            else
            {
                var paydetails = await db.CardTranscations.Where(c => c.InvoiceNumber == InvNo).FirstOrDefaultAsync();

                if (paydetails == null)
                {
                    return(View(new EDCTranscation {
                        OnDate = DateTime.Today.Date, InvoiceNumber = InvNo, StoreId = ViewBag.StoreID
                    }));
                }
                return(View(paydetails));
            }
        }
Пример #14
0
        public async Task <IActionResult> Edit(int id, [Bind("ReceiptId,PartyName,RecieptSlipNo,OnDate,PayMode,BankAccountId,PaymentDetails,Amount,Remarks,PartyId,LedgerEnteryId,IsCash,StoreId,UserName")] Receipt receipt)
        {
            if (id != receipt.ReceiptId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (receipt.PayMode == PaymentMode.Cash)
                    {
                        receipt.BankAccountId = null;
                    }
                    _context.Update(receipt);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReceiptExists(receipt.ReceiptId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BankAccountId"] = new SelectList(_context.BankAccounts, "BankAccountId", "Account", receipt.BankAccountId);
            ViewData["PartyId"]       = new SelectList(_context.Parties, "PartyId", "PartyName", receipt.PartyId);
            ViewData["StoreId"]       = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, _returnUrl);

            return(View(receipt));
        }
Пример #15
0
        // GET: DailySales
        public async Task <IActionResult> Index(int?id, string salesmanId, string currentFilter, string searchString, DateTime?SaleDate, string sortOrder, int?pageNumber)
        {
            // Setting Store Info Here
            int StoreId = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales");

            ViewData["InvoiceSortParm"] = String.IsNullOrEmpty(sortOrder) ? "inv_desc" : "";
            ViewData["DateSortParm"]    = sortOrder == "Date" ? "date_desc" : "Date";
            ViewData["ManualSortParm"]  = sortOrder == "Manual" ? "notManual_desc" : "Manual";
            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewData["CurrentFilter"] = searchString;
            //For Current Day
            var dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate == DateTime.Today && c.StoreId == StoreId);

            if (id != null && id == 101)
            {
                //All
                dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.StoreId == StoreId).OrderByDescending(c => c.SaleDate).ThenByDescending(c => c.DailySaleId);
            }
            else if (id != null && id == 104)
            {
                dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate == DateTime.Today.AddDays(-1) && c.StoreId == StoreId);
            }
            else if (id != null && id == 102)
            {
                //Current Month
                dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate.Month == DateTime.Today.Month && c.SaleDate.Year == DateTime.Today.Year && c.StoreId == StoreId).OrderByDescending(c => c.SaleDate).ThenByDescending(c => c.DailySaleId);
            }
            else if (id != null && id == 103)
            {
                //Last Month
                dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate.Month == DateTime.Today.Month - 1 && c.SaleDate.Year == DateTime.Today.Year && c.StoreId == StoreId).OrderByDescending(c => c.SaleDate).ThenByDescending(c => c.DailySaleId);
            }
            else
            {
                dailySales = dailySales.OrderByDescending(c => c.SaleDate).ThenByDescending(c => c.DailySaleId);
            }

            if (!String.IsNullOrEmpty(searchString))
            {
                dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.InvNo == searchString && c.StoreId == StoreId);
                //return View(await dls.ToListAsync());
            }
            else if (!String.IsNullOrEmpty(salesmanId) || SaleDate != null)
            {
                //IEnumerable<DailySale> DailySales;

                if (SaleDate != null)
                {
                    dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate == SaleDate && c.StoreId == StoreId).OrderByDescending(c => c.DailySaleId);
                }
                else
                {
                    dailySales = db.DailySales.Include(d => d.Salesman).Where(c => c.SaleDate.Month == DateTime.Today.Month && c.SaleDate.Year == DateTime.Today.Year && c.StoreId == StoreId).OrderByDescending(c => c.SaleDate).ThenByDescending(c => c.DailySaleId);
                }

                if (!String.IsNullOrEmpty(salesmanId))
                {
                    dailySales = dailySales.Where(c => c.Salesman.SalesmanName == salesmanId);
                }
            }

            // For All Invoice

            #region FixedUI

            SaleInfoUIVM uIVM = new SaleInfoUIVM();
            uIVM = uIVM.GetSaleInfo(db, StoreId);

            // Fixed UI
            ViewBag.TodaySale     = uIVM.TodaySale;
            ViewBag.ManualSale    = uIVM.ManualSale;
            ViewBag.MonthlySale   = uIVM.MonthlySale;
            ViewBag.DuesAmount    = uIVM.DuesAmount;
            ViewBag.CashInHand    = uIVM.CashInHand;
            ViewBag.LastMonthSale = uIVM.LastMonthSale;

            #endregion FixedUI

            #region bySalesman

            // By Salesman
            var salesmanList = new List <string>();
            var smQry        = from d in db.Salesmen
                               orderby d.SalesmanName
                               select d.SalesmanName;
            salesmanList.AddRange(smQry.Distinct());
            ViewBag.salesmanId = new SelectList(salesmanList);

            #endregion bySalesman

            #region ByDate

            //var dateList = new List<DateTime>();
            //var opdQry = from d in db.DailySales
            //             orderby d.SaleDate
            //             select d.SaleDate;
            //dateList.AddRange(opdQry.Distinct());
            //ViewBag.dateID = new SelectList(dateList);

            #endregion ByDate

            //By Invoice No Search

            switch (sortOrder)
            {
            case "Manual":
                dailySales = dailySales.OrderBy(c => c.IsManualBill);
                break;

            case "notManual_desc":
                dailySales = dailySales.OrderByDescending(c => c.IsManualBill);
                break;

            case "inv_desc":
                dailySales = dailySales.OrderByDescending(s => s.InvNo);
                break;

            case "Date":
                dailySales = dailySales.OrderBy(s => s.SaleDate);
                break;

            case "date_desc":
                dailySales = dailySales.OrderByDescending(s => s.SaleDate);
                break;

            default:
                dailySales = dailySales.OrderBy(s => s.InvNo);
                break;
            }

            int pageSize = 10;
            return(View(await PaginatedList <DailySale> .CreateAsync(dailySales.AsNoTracking(), pageNumber ?? 1, pageSize)));
        }