コード例 #1
0
        public ActionResult OverAllReport(DateTime?month)
        {
            if (month == null)
            {
                month = DateTime.UtcNow;
            }
            ViewBag.month = month;

            var budgets                = budgetDac.Get().OrderBy(x => x.Name);
            var transactions           = transactionDac.Get(month.Value).ToList();
            var bringForwordThisMonths = bringForwardDac.Get(month.Value);

            transactions.InsertRange(0, bringForwordThisMonths.Select(b => new Transaction
            {
                IssueDate = new DateTime(month.Value.Year, month.Value.Month, 1),
                Title     = "ยอดยกมา",
                Amount    = b?.Amount ?? 0,
                BudgetId  = b.BudgetId,
            }));
            var response = new OverAllReport
            {
                Budgets = budgets.OrderBy(x => x.Name).Select(x => new OverAllReportDetail
                {
                    Budget       = x,
                    Transactions = transactions.Where(t => t.BudgetId == x.Id).OrderBy(x => x.IssueDate).ThenBy(x => x.Id).ToList(),
                }).ToList(),
            };

            return(View(response));
        }
コード例 #2
0
        public IActionResult Index()
        {
            var budgets      = budgetDac.Get().Where(x => x.SchoolId == CurrentSchoolData.sc_id).OrderBy(x => x.Name);
            var bankAccounts = bankAccountDac.Get();

            ViewBag.bankAccounts = bankAccounts;
            return(View(budgets));
        }
コード例 #3
0
        public IActionResult Index(DateTime?month, int budgetId = 1)
        {
            if (month == null)
            {
                month = DateTime.UtcNow;
            }
            ViewBag.month    = month;
            ViewBag.budgetId = budgetId;

            var budgets = budgetDac.Get().ToList();

            budgets.Add(new Budget
            {
                Id   = 0,
                Name = "ภาษี ณ ที่จ่าย",
            });
            ViewBag.budgets = budgets.OrderBy(x => x.Name);

            var partners     = partnerDac.Get();
            var transactions = budgetId switch
            {
                0 => transactionDac.GetTeackVat(month.Value).OrderBy(x => x.IssueDate).ThenBy(x => x.Id).Select(x => new Transaction
                {
                    Id        = x.Id,
                    IssueDate = x.IssueDate,
                    Title     = $"รับเงินภาษี ณ ที่จ่ายจาก {partners.FirstOrDefault(p => p.Id == x.PartnerId)?.Name}",
                    Amount    = x.VatInclude.Value,
                }).ToList(),
                _ => transactionDac.Get(month.Value, budgetId).OrderBy(x => x.IssueDate).ThenBy(x => x.Id).ToList(),
            };
            var bringForword = bringForwardDac.Get(month.Value, budgetId);

            if (bringForword != null)
            {
                transactions.Insert(0, new Transaction
                {
                    IssueDate = new DateTime(month.Value.Year, month.Value.Month, 1),
                    Title     = "ยอดยกมา",
                    Amount    = bringForword?.Amount ?? 0,
                    BudgetId  = bringForword.BudgetId,
                });
            }
            return(View(transactions));
        }