Exemplo n.º 1
0
        public ActionResult ListActive()
        {
            GetData();
            IEnumerable <income> IncomeList;

            IncomeList = IncomeRepository.GetIncomeByStatus("Inactive");

            ViewBag.RecordCount = IncomeList.Count();
            foreach (var i in IncomeList)
            {
                i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID);
                i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID);
            }

            decimal cash = (decimal)IncomeList.Sum(e => e.CashAmount);

            ViewBag.TotalCash = cash;
            decimal check = (decimal)IncomeList.Sum(e => e.CheckAmount);

            ViewBag.TotalCheck = check;
            decimal coin = (decimal)IncomeList.Sum(e => e.CoinAmount);

            ViewBag.TotalCoin = coin;

            ViewBag.TotalAmount = cash + check + coin;

            return(PartialView(IncomeList));
        }
Exemplo n.º 2
0
        public ActionResult IncomeReport(string date_from, string date_to)
        {
            List <IncomeList> IncList = new List <IncomeList>();
            Property          p       = new Property();
            DataSet           ds      = new DataSet();

            p.OnTable    = "GetIncomeRecord";
            p.Condition1 = date_from;
            p.Condition2 = date_to;
            ds           = dl.GetIncomeReport_sp(p);
            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    IncomeList m = new IncomeList();

                    m.Id        = item["Id"].ToString();
                    m.Name      = item["Name"].ToString();
                    m.InvoiceNo = item["InvoiceNo"].ToString();
                    m.HeadId    = item["HeadId"].ToString();
                    m.HeadName  = item["HeadName"].ToString();
                    m.Date      = item["Date"].ToString();
                    m.Amount    = item["Amount"].ToString();
                    //m.ReceiverName = item["ReceiverName"].ToString();
                    //m.IsActive = item["IsActive"].ToString();
                    IncList.Add(m);
                }
                ViewBag.IncList = IncList;
            }
            catch (Exception ex)
            {
            }
            return(View());
        }
Exemplo n.º 3
0
        public void DeleteIncome()
        {
            Income itemToDelete;

            //1. Get Account from DB
            using (var ctx = new EntitySaveItContext())
            {
                itemToDelete =
                    ctx.Incomes.FirstOrDefault(s => s.Id == SelectedIncome.Id);
            }

            //Create new context for disconnected scenario
            using (var newContext = new EntitySaveItContext())
            {
                newContext.Entry(itemToDelete).State = System.Data.Entity.EntityState.Deleted;

                try
                {
                    newContext.SaveChanges();

                    // remove the item to be deleted from the list
                    IncomeList.Remove(SelectedIncome);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
 public IncomeController(User user)
 {
     if (user == null)
     {
         throw new ArgumentNullException("Имя пользователя не может быть пустым!", nameof(user));
     }
     this.user  = user;
     Incomes    = GetAllIncomes();
     IncomeList = GetIncomeList();
 }
Exemplo n.º 5
0
        public void AddTest()
        {
            var userName         = Guid.NewGuid().ToString();
            var incomeName       = Guid.NewGuid().ToString();
            var rnd              = new Random();
            var userController   = new UserController(userName);
            var incomeController = new IncomeController(userController.CurrentUser);
            var cost             = new IncomeList(incomeName, rnd.Next(100, 500));

            incomeController.Add(cost, rnd.Next(100, 500));
            Assert.AreEqual(cost.Name, incomeController.Incomes.First().Name);
        }
Exemplo n.º 6
0
        private async Task <IncomeList> GetIncomeList(string id)
        {
            List <IncomeModel> dbRec = new List <IncomeModel>();
            var record = await _context.Income.Where(a => a.UserId == id).SingleOrDefaultAsync();

            //var incomeBayanihan = new IncomeModel
            //{
            //    IncomeType = "Bayanihan",
            //    Description = "Bayanihan Income",
            //    TotalAmount = record.BayanihanIncome,
            //    NetIncome = record.NetIncome

            //};

            var incomeBinary = new IncomeModel
            {
                IncomeType  = "Incentives",
                Description = "Incentives Income",
                TotalAmount = record.DirectReferralIncome,
                NetIncome   = record.NetIncome
            };

            //var incomeUnilevel = new IncomeModel
            //{
            //    IncomeType = "Unilevel",
            //    Description = "Unilevel Income",
            //    TotalAmount = record.UnilevelIncome,
            //    NetIncome = record.NetIncome
            //};

            var incomeGeneology = new IncomeModel
            {
                IncomeType  = "Pairing Bonus",
                Description = "Pairing Bonus Income",
                TotalAmount = record.GeneologyIncome,
                NetIncome   = record.NetIncome
            };


            //dbRec.Add(incomeBayanihan);
            dbRec.Add(incomeBinary);
            //dbRec.Add(incomeUnilevel);
            dbRec.Add(incomeGeneology);

            IncomeList incomeList = new IncomeList
            {
                Records = dbRec
            };

            return(incomeList);
        }
Exemplo n.º 7
0
        public ActionResult IncomeList()
        {
            List <IncomeList> CategoryList = new List <IncomeList>();
            Property          p            = new Property();
            DataSet           ds           = new DataSet();

            p.OnTable = "FetchIncomeList";

            ds = dl.FetchIncomeList_sp(p);

            List <SelectListItem> Categoryinventory = new List <SelectListItem>();

            Categoryinventory.Add(new SelectListItem {
                Text = "Select", Value = ""
            });
            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                Categoryinventory.Add(new SelectListItem {
                    Text = dr["HeadName"].ToString(), Value = dr["HeadId"].ToString()
                });
            }
            ViewBag.Categoryinventory = new SelectList(Categoryinventory, "Value", "Text");


            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    IncomeList m = new IncomeList();

                    m.Id          = item["Id"].ToString();
                    m.HeadId      = item["HeadId"].ToString();
                    m.HeadName    = item["HeadName"].ToString();
                    m.Name        = item["Name"].ToString();
                    m.InvoiceNo   = item["InvoiceNo"].ToString();
                    m.Date        = item["Date"].ToString();
                    m.Amount      = item["Amount"].ToString();
                    m.Attachment  = item["Attachment"].ToString();
                    m.Description = item["Description"].ToString();
                    m.IsActive    = item["IsActive"].ToString();
                    CategoryList.Add(m);
                }
                ViewBag.CategoryList = CategoryList;
            }
            catch (Exception e)
            {
            }
            return(View());
        }
Exemplo n.º 8
0
        public ActionResult List(DateTime bDate, DateTime eDate, string code = "", int codeID = 0, string ReportType = "")
        {
            ViewBag.ReportType = ReportType;
            IEnumerable <income> IncomeList;

            if (code == "BankAccountSearch")
            {
                IncomeList = IncomeRepository.GetIncomeByBankAccount(codeID, bDate.Date, eDate.Date);
            }
            else if (code == "CategorySearch")
            {
                IncomeList = IncomeRepository.GetIncomeByCategory(codeID, bDate.Date, eDate.Date);
            }
            else if (code == "DateRangeSearch")
            {
                IncomeList = IncomeRepository.GetIncomeByDateRange(bDate.Date, eDate.Date);
            }
            else
            {
                IncomeList = IncomeRepository.GetIncomeByStatus("Inactive").OrderByDescending(e => e.IncomeDate);
            }

            ViewBag.RecordCount = IncomeList.Count();
            foreach (var i in IncomeList)
            {
                i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID);
                i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID);
            }

            decimal cash = (decimal)IncomeList.Sum(e => e.CashAmount);

            ViewBag.TotalCash = cash;
            decimal check = (decimal)IncomeList.Sum(e => e.CheckAmount);

            ViewBag.TotalCheck = check;
            decimal coin = (decimal)IncomeList.Sum(e => e.CoinAmount);

            ViewBag.TotalCoin = coin;

            ViewBag.TotalAmount = cash + check + coin;

            // GetData();
            return(PartialView(IncomeList.OrderByDescending(e => e.IncomeDate)));
        }
Exemplo n.º 9
0
        public ActionResult Create()
        {
            GetData();
            IEnumerable <income> IncomeList;

            IncomeList = IncomeRepository.GetIncomeByStatus("Inactive");

            ViewBag.RecordCount = IncomeList.Count();
            foreach (var i in IncomeList)
            {
                i.bankaccount = BankAccountRepository.GetBankAccountByID(i.bankAccountID);
                i.subcategory = SubCategoryRepository.GetBySubCategoryID(i.subCategoryID);
                if (i.CashAmount != null)
                {
                    i.TotalIncome += (decimal)i.CashAmount;
                }
                if (i.CheckAmount != null)
                {
                    i.TotalIncome += (decimal)i.CheckAmount;
                }
                if (i.CoinAmount != null)
                {
                    i.TotalIncome += (decimal)i.CoinAmount;
                }
            }

            decimal cash = (decimal)IncomeList.Sum(e => e.CashAmount);

            ViewBag.TotalCash = cash;
            decimal check = (decimal)IncomeList.Sum(e => e.CheckAmount);

            ViewBag.TotalCheck = check;
            decimal coin = (decimal)IncomeList.Sum(e => e.CoinAmount);

            ViewBag.TotalCoin = coin;

            ViewBag.TotalAmount = cash + check + coin;

            ViewBag.IncomeList = IncomeList;

            return(PartialView(new income {
                DateEntered = System.DateTime.Today, EnteredBy = User.Identity.Name.ToString(), Status = "Inactive"
            }));
        }
Exemplo n.º 10
0
        private void DrawContent(FormType formType)
        {
            IncomeList   incomeList   = null;
            OutcomeList  outcomeList  = null;
            DomesticList domesticList = null;

            try
            {
                if (formType.Equals(FormType.IncomeList))
                {
                    if (contentList.ContainsKey(FormType.IncomeList))
                    {
                        mainTabCtl.SelectedTabPage = contentList.Single(t => t.Key.Equals(FormType.IncomeList)).Value;
                        return;
                    }
                    else
                    {
                        incomeList      = new IncomeList(Tool.xmlStr, dbName, year);
                        incomeList.Dock = DockStyle.Fill;

                        XtraTabPage contentTab = new XtraTabPage();
                        contentTab.Text = incomeList.FormCaption;
                        contentTab.Controls.Add(incomeList);

                        mainTabCtl.TabPages.Add(contentTab);
                        mainTabCtl.SelectedTabPage = contentTab;

                        contentList.Add(FormType.IncomeList, contentTab);
                    }
                }
                else if (formType.Equals(FormType.OutcomeList))
                {
                    if (contentList.ContainsKey(FormType.OutcomeList))
                    {
                        mainTabCtl.SelectedTabPage = contentList.Single(t => t.Key.Equals(FormType.OutcomeList)).Value;
                        return;
                    }
                    else
                    {
                        outcomeList      = new OutcomeList(Tool.xmlStr, dbName, year);
                        outcomeList.Dock = DockStyle.Fill;

                        XtraTabPage contentTab = new XtraTabPage();
                        contentTab.Text = outcomeList.FormCaption;
                        contentTab.Controls.Add(outcomeList);

                        mainTabCtl.TabPages.Add(contentTab);
                        mainTabCtl.SelectedTabPage = contentTab;

                        contentList.Add(FormType.OutcomeList, contentTab);
                    }
                }
                else
                {
                    if (contentList.ContainsKey(FormType.DomesticList))
                    {
                        mainTabCtl.SelectedTabPage = contentList.Single(t => t.Key.Equals(FormType.DomesticList)).Value;
                        return;
                    }
                    else
                    {
                        domesticList      = new DomesticList(Tool.xmlStr, dbName, year);
                        domesticList.Dock = DockStyle.Fill;

                        XtraTabPage contentTab = new XtraTabPage();
                        contentTab.Text = domesticList.FormCaption;
                        contentTab.Controls.Add(domesticList);

                        mainTabCtl.TabPages.Add(contentTab);
                        mainTabCtl.SelectedTabPage = contentTab;

                        contentList.Add(FormType.DomesticList, contentTab);
                    }
                }
            }
            catch (MofException ex)
            {
                System.Diagnostics.Debug.WriteLine("Шинэ content-tab үүсгэж чадсангүй: " + ex.Message);
                Tool.ShowError(ex.Message, ex.InnerException.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Шинэ content-tab үүсгэж чадсангүй: " + ex.Message);
                Tool.ShowError("Шинэ content-tab үүсгэж чадсангүй: ", ex.Message);
            }
            finally { incomeList = null; outcomeList = null; }
        }
Exemplo n.º 11
0
        public ActionResult IncomeList(IncomeList c, List <HttpPostedFileBase> Attachment)
        {
            string fileLocation         = "";
            string ItemUploadFolderPath = "~/DataImages/";

            try
            {
                try
                {
                    if (Attachment.Count > 0)
                    {
                        foreach (HttpPostedFileBase file in Attachment)
                        {
                            try
                            {
                                if (file.ContentLength == 0)
                                {
                                    continue;
                                }

                                if (file.ContentLength > 0)
                                {
                                    fileLocation = HelperFunctions.renameUploadFile(file, ItemUploadFolderPath);
                                    if (fileLocation == "")
                                    {
                                        fileLocation = "";
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            if (fileLocation == "" || fileLocation == null)
                            {
                                c.Attachment = c.Attachment;
                            }
                            else
                            {
                                c.Attachment = fileLocation;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            catch (Exception ex)
            {
            }


            try
            {
                if (dl.InsertIncomeList_Sp(c) > 0)
                {
                    TempData["MSG"] = "Income List Added Successfully";
                }
            }
            catch (Exception ex)
            {
                TempData["MSG"] = "Something went wrong.";
                return(Redirect("/Finance/IncomeList"));
            }
            TempData["MSG"] = "Income List Added Successfully.";
            return(Redirect("/Finance/IncomeList"));
        }