public ActionResult Index(string id)
        {
            //lấy ra danh sách tờ khai thuộc GTGT
            var accountId     = User.GetAccountId();
            var lstInvoiceNum = _listReleaseInvoiceSvc.GetByTemplateId(id, accountId);
            var invoiceModel  = new InvoiceModel();


            invoiceModel.RelesaseNos = lstInvoiceNum.Select(c => new SelectListItem
            {
                Text  = c.No,
                Value = c.Id + ""
            });


            invoiceModel.BanksSeller = _banksSvc.GelByAccountId(accountId);

            invoiceModel.Currencies = _currencySvc.GelAll().Select(c => new SelectListItem
            {
                Text  = c.CurrencyCode,
                Value = c.Id + ""
            });

            invoiceModel.Products = _productSvc.GetByAccountId(accountId);

            invoiceModel.Units = _unitSvc.GelAll();



            return(View(invoiceModel));
        }
Ejemplo n.º 2
0
        public ActionResult Index(string id)
        {
            //lấy ra danh sách tờ khai thuộc GTGT
            var accountId     = User.GetAccountId();
            var acc           = _accountSvc.GetById(accountId);
            var lstInvoiceNum = _listReleaseInvoiceSvc.GetByTemplateId(id, accountId);

            if (lstInvoiceNum == null || lstInvoiceNum.Count() < 1)
            {
                return(RedirectToAction("Index", "ListReleaseInvoice", new { message = "Chưa phát hành hóa đơn. Vui lòng chọn phát hành hóa đơn trước", messageType = "error" }));
            }

            var invoiceModel = new InvoiceModel();

            invoiceModel.RelesaseNos = lstInvoiceNum.Select(c => new SelectListItem {
                Text = c.No, Value = c.Id + ""
            });
            invoiceModel.BanksSeller = _banksSvc.GelByAccountId(accountId);
            invoiceModel.Currencies  = _currencySvc.GelAll().Select(c => new SelectListItem {
                Text = c.CurrencyCode, Value = c.Id + ""
            });
            invoiceModel.Products = _productSvc.GetByAccountId(accountId);
            invoiceModel.Units    = _unitSvc.GelAll();
            var invoiceNum = _invoiceNumberSvc.GetByReleaseIdAnduseStatus(lstInvoiceNum.First().Id, 0);

            if (invoiceNum == null || invoiceNum.Count() < 1)
            {
                return(RedirectToAction("Index", "ListReleaseInvoice", new { message = "Đã dùng hết số hóa đơn phát hành. Vui lòng phát hành mới để tiếp tục", messageType = "error" }));
            }
            invoiceModel.InvoiceNumber = "" + invoiceNum.First().InvoicesNumber;

            //thông tin người bán
            invoiceModel.CompanyNameAcc = acc.CompanyName;
            invoiceModel.CompanyCodeAcc = acc.CompanyCode;
            invoiceModel.AddressAcc     = acc.Address;
            invoiceModel.PhoneAcc       = acc.Phone;

            return(View(invoiceModel));
        }
Ejemplo n.º 3
0
        public ActionResult Index(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                id = "02GTTT";
            }
            //lấy ra danh sách tờ khai thuộc GTGT
            var accountId     = User.GetAccountId();
            var acc           = _accountSvc.GetById(accountId);
            var lstInvoiceNum = _listReleaseInvoiceSvc.GetByTemplateId(id, accountId);

            if (lstInvoiceNum == null || lstInvoiceNum.Count() < 1)
            {
                return(RedirectToAction("Index", "ListReleaseInvoice", new { message = "Chưa phát hành hóa đơn. Vui lòng chọn phát hành hóa đơn trước", messageType = "error" }));
            }

            var invoiceModel = new InvoiceModel();

            invoiceModel.RelesaseNos = lstInvoiceNum.Select(c => new SelectListItem {
                Text = c.No, Value = c.Id + ""
            });
            invoiceModel.BanksSeller = _banksSvc.GelByAccountId(accountId);
            invoiceModel.Currencies  = _currencySvc.GelAll().Select(c => new SelectListItem {
                Text = c.CurrencyCode, Value = c.Id + ""
            });
            invoiceModel.Products = _productSvc.GetByAccountId(accountId);
            invoiceModel.Units    = _unitSvc.GelAll();

            //thông tin người bán
            invoiceModel.CompanyNameAcc = acc.CompanyName;
            invoiceModel.CompanyCodeAcc = acc.CompanyCode;
            invoiceModel.AddressAcc     = acc.Address;
            invoiceModel.PhoneAcc       = acc.Phone;
            ViewBag.TemplateCode        = id;
            ViewBag.TemplateName        = _templateInvoiceSvc.GetByTemplateCode(id).TemplateName;

            return(View(invoiceModel));
        }