Ejemplo n.º 1
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                using (var db = new MSPAccountingContext())
                {
                    var isClientSelected = cmbbxClient.SelectedItem != null;
                    var expense = new Expense()
                    {
                        Date = datetime_Date.Value == null ? DateTime.Now : (DateTime)datetime_Date.Value,
                        Amount = dcmlAmount.Value == null ? 0 : (decimal)dcmlAmount.Value,
                        Client = isClientSelected ? db.Client.SingleOrDefault(x => x.ID == ((Client)cmbbxClient.SelectedItem).ID) : null,
                        Comments = txtbxComments.Text
                    };

                    var errors = expense.GetModelErrors();

                    if (errors.Count > 0)
                    {
                        new ErrorDisplay(errors).Show();
                    }
                    else
                    {
                        db.Expense.Add(expense);
                        db.SaveChanges();
                    }
                }
            }

            catch (Exception ex)
            {

            }
        }
Ejemplo n.º 2
0
        public void TransferData()
        {
            var xmlDoc = XDocument.Load(this.ExpensesImportPath);
            var vendorNamesList = xmlDoc.Root.Elements("vendor");

            foreach (var vendorElement in vendorNamesList)
            {
                var vendorName = vendorElement.Attribute("name").Value;
                var vendorId = this.SqlMarketContext.Vendors
                    .Where(u => u.Name == vendorName)
                    .Select(u => u.Id)
                    .FirstOrDefault();

                var monthExpenses = vendorElement.Elements("expenses");
                foreach (var monthExpense in monthExpenses)
                {
                    var dt = monthExpense.Attribute("month").Value;
                    var parsedDatetime = DateTime.Parse(dt);
                    var expense = monthExpense.Value;

                    var vendorExpense = new Expense
                    {
                        VendorId = vendorId,
                        DateOfExpense = parsedDatetime,
                        ExpenseAmount = decimal.Parse(expense, CultureInfo.InvariantCulture)
                    };

                    this.SqlMarketContext.Expenses.Add(vendorExpense);
                    this.SqlMarketContext.SaveChanges();
                }
            }
        }
        public void CreateExpenseTest()
        {
            var client = ClientTest.SampleClient().ClientId;
            double amt = new Random().Next(10000)/100.0;
            Expense rec = new Expense
                              {
                                  StaffId = StaffTest.Self.StaffId,
                                  ClientId = client,
                                  Amount = amt,
                                  CategoryId = CategoryTest.SampleCategory().CategoryId,
                              };

            ExpenseIdentity id = Service.Create(new ExpenseRequest {Expense = rec});

            try
            {
                Expense fetched = Service.Get(id).Expense;
                Assert.AreEqual(amt, fetched.Amount);
                Assert.AreEqual(client, fetched.ClientId);
            }
            finally
            {
                Service.Delete(id);
            }
        }
Ejemplo n.º 4
0
        /*------New Expense-------*/
        public void AddExpense(Trip trip)
        {
            Console.Clear();
            Expense expense = new Expense();

            Console.WriteLine("enter expense Name");

            expense.ExpenseName = Console.ReadLine();

            Console.WriteLine("enter expense type");
            int i = 1;
            foreach (var item in Enum.GetNames(typeof(ExpenseType)))
            {
                Console.WriteLine(i + item);
                i++;
            }
            var option = Convert.ToInt16(Console.ReadLine());
            expense.ExpenseType = (ExpenseType)option;
            Console.WriteLine("Enter The Amount you Spend:");
            expense.Amount = Convert.ToDouble(Console.ReadLine());
            trip.Expenses.Add(expense);
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Expense Added Your Expense id is: " + expense.Id);
            Console.ResetColor();
        }
Ejemplo n.º 5
0
        public void Expense_Copy()
        {
            var first = new Expense
            {
                Amount = 120,
                Category = new ExpenseCategory
                {
                    Id = 0,
                    Name = "Category"
                },
                Comments = "Stuff",
                Date = DateTime.Today,
                Id = 0,
                Method = new PaymentMethod
                {
                    Id = 0,
                    Name = "Method"
                }
            };

            var second = first.Copy();

            Assert.AreNotSame(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
        }
Ejemplo n.º 6
0
 public void ApplyToBO(Expense expense, UserService Users, ExpenseIconService Icons)
 {
     expense.Name = this.Name;
     expense.AmountType = this.AmountType;
     expense.Creator = Users.FetchById(this.CreatorUserId.Value);
     expense.Icon = Icons.FetchById(this.IconId.Value);
     expense.IsKioskModeAllowed = this.IsKioskModeAllowed;
 }
Ejemplo n.º 7
0
        public void Load(Expense e)
        {
            this.PriceLayout.Layer.CornerRadius = 8;
            this.PriceLabel.Text = string.Format ("{0:C}", e.Amount);
            this.VendorLabel.Text = e.Vendor;

            this.TicketImageView.Image = UIImage.FromBundle ("");
        }
 public void CreateRepository()
 {
     _repo = new ExpenseRepository();
     _exp1 = new Expense(TypeExpense.Car, 34, "euro");
     _exp2 = new Expense(TypeExpense.Eat, 45, "euro");
     _repo.Save(_exp1);
     _repo.Save(_exp2);
 }
Ejemplo n.º 9
0
 public ExpenseEx(Expense exp)
 {
     ExpenseID = exp.ExpenseID;
     TransactionDate = exp.TransactionDate;
     Description = exp.Description;
     Amount = exp.Amount;
     Category = exp.Category;
     PaymentMethod = exp.PaymentMethod;
 }
Ejemplo n.º 10
0
        public void Initialize()
        {
            this.DataContext = new EntityFrameworkDataContext();

            this.Expense = new Expense {Amount = 1000, Description = "Description", Title = "Title"};

            IRepository<Expense> repository = this.DataContext.GetRepository<Expense>();
            repository.Save(this.Expense);
        }
        public void AdjustExpenseBalance(Expense expense, Transaction transaction)
        {
            expense.Balance = transaction.IsWithdrawal
                       ? expense.Balance - transaction.Amount
                       : expense.Balance + transaction.Amount;

            FinancialPlannerRepository.EditExpense(expense);
            FinancialPlannerRepository.Save();
        }
Ejemplo n.º 12
0
        public void Expense_to_ExpenseTable_should_copy_all_values()
        {
            var expense = new Expense {Id = 1, Amount = 100, Title = "Title", Description = "Description"};
            ExpenseTable expenseTable = this.Mapping.GetDataEntity(expense);

            Assert.AreEqual(expense.Id, expenseTable.Id);
            Assert.AreEqual(expense.Amount, expenseTable.Amount);
            Assert.AreEqual(expense.Title, expenseTable.Title);
            Assert.AreEqual(expense.Description, expenseTable.Description);
        }
Ejemplo n.º 13
0
        public override void UpdateExpense(Expense expense)
        {
            Expense oldExpense = base.LoadExpense(expense.Code);

            oldExpense.Remark = expense.Remark;
            oldExpense.LastModifyDate = DateTime.Now;
            oldExpense.LastModifyUser = expense.LastModifyUser;

            base.UpdateExpense(oldExpense);
        }
Ejemplo n.º 14
0
        public ActionResult Create(Expense expense)
        {
            if (ModelState.IsValid)
            {
                db.Expenses.Add(expense);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(expense);
        }
Ejemplo n.º 15
0
 public void UpdateEntity(Expense expense)
 {
     expense.CurrencyId = CurrencyId;
     expense.Currency = null;
     expense.Description = Description;
     expense.Description = Description;
     expense.TypeId = TypeId;
     expense.Amount = Amount;
     expense.ExchangeRate = ExchangeRate;
     expense.Date = Date;
 }
Ejemplo n.º 16
0
        public ActionResult MoveTo(WFMoveToParameter param, Expense expense)
        {
            return this.JsonExecute(() =>
            {
                SaveExpense(param.RuntimeContext, expense);

                ResponseData data = param.Execute((ex) => true);

                return Json(data);
            });
        }
Ejemplo n.º 17
0
        public void CanCountExpenses()
        {
            var db = new LittleDB("newYorkTryp");
            var newyorkExpenses = new Tryp(db);

            var food = new Expense(20.3m, "Food", DateTime.Today);
            var taxi = new Expense(3.2m, "Taxi", DateTime.Today);
            newyorkExpenses.AddExpense(food);
            newyorkExpenses.AddExpense(taxi);

            newyorkExpenses.GetTotalExpenses().Should().Be(23.5m);
        }
        public void AdjustExpenseBalance(Expense expense)
        {
            var transactions =
               FinancialPlannerRepository.GetTransactions().Where(m => m.ExpenseId == expense.Id).ToList();

            var newWithdrawalAmount = transactions.Where(m => m.IsWithdrawal).Sum(m => m.Amount);
            var newDepositAmount = transactions.Where(m => !m.IsWithdrawal).Sum(m => m.Amount);

            expense.Balance = expense.Amount - newWithdrawalAmount + newDepositAmount;

            FinancialPlannerRepository.EditExpense(expense);
            FinancialPlannerRepository.Save();
        }
Ejemplo n.º 19
0
        public ActionResult StartWorkflow()
        {
            Expense expense = new Expense()
            {
                ID = Guid.NewGuid().ToString(),
                Amount = 500,
                Department = DeluxeIdentity.CurrentUser.TopOU.DisplayName,
                Name = DeluxeIdentity.CurrentUser.DisplayName,
                TransitionDate = DateTime.Now
            };

            return View(expense);
        }
Ejemplo n.º 20
0
        public void Initialize()
        {
            Id = 1;

            Expense = new Expense
            {
                Id = Id,
                Amount = 500,
                Description = "Test"
            };

            DataContext = new MemoryDataContext();

            ExpenseModel = new ExpenseModel(DataContext);
        }
        // POST api/ExpenseApi
        public async Task PostAsync(Expense expensePosted)
        {
            MongoHelper<Expense> expenseHelper = new MongoHelper<Expense>();

            try
            {
                await expenseHelper.Collection.InsertOneAsync(expensePosted);
            }
            catch (Exception e)
            {
                Trace.TraceError("ExpenseApi PostAsync error : " + e.Message);
                throw;
            }
            
        }
        public void Initialize()
        {
            Id = 1;

            Expense = new Expense
                          {
                              Id = Id
                          };

            var dataContext = new MemoryDataContext();
            dataContext.Save(Expense);
            dataContext.Commit();

            ExpenseModel = new ExpenseModel(dataContext);
        }
Ejemplo n.º 23
0
        // POST api/Expenses
        public HttpResponseMessage PostExpense(Expense expense)
        {
            if (ModelState.IsValid)
            {
                db.Expenses.Add(expense);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, expense);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = expense.ExpenseId }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
Ejemplo n.º 24
0
        public Expense AddExpense(EditExpenseViewModel vm, string username)
        {
            var expense = new Expense
            {
                Name = vm.Name,
                Amount = vm.Amount,
                Balance = vm.Amount,
                InterestRate = vm.InterestRate,
                Username = username
            };

            FinancialPlannerRepository.AddExpense(expense);
            FinancialPlannerRepository.Save();

            return expense;
        }
        public async void AddNewExpenseLocally(string name, string imageUrl, string description, double price, Category category)
        {
            var expense = new Expense
            {
                Name = name,
                Category = category,
                Coast = price,
                Description = description,
                ImageUrl = imageUrl,
                CreatedOn = DateTime.Now,
                UserId = await this.GetUserId()
            };

            this.expenses.Insert(expense);

            var successMessage = new MessageDialog("You successfully added a new expense");
            await successMessage.ShowAsync();
        }
Ejemplo n.º 26
0
        public ActionResult MoveTo()
        {
            Expense expense = new Expense() { Amount = 0, Department = "IT", Name = "测试名称", TransitionDate = DateTime.Now };

            WFUIRuntimeContext runtime = this.Request.GetWFContext();

            if (runtime != null && runtime.Process != null)
            {
                if (runtime.Process.ProcessContext.ContainsKey("Expense"))
                {
                    string serilizedData = (string)runtime.Process.ProcessContext["Expense"];

                    expense = JsonConvert.DeserializeObject<Expense>(serilizedData);
                }
            }

            return View(expense);
        }
Ejemplo n.º 27
0
        public Transaction AddTransaction(Expense expense, EditExpenseTransactionViewModel vm)
        {
            var newTransaction = new Transaction
            {
                Name = vm.Name,
                Amount = vm.Amount,
                IsWithdrawal = vm.IsWithdrawal,
                ExpenseId = vm.SelectedExpenseId != -1 ? vm.SelectedExpenseId : 0,
                PaymentDate = vm.PaymentDate,
                Balance = expense.Amount,
                BudgetItemId = vm.SelectedBudgetItemId
            };

            FinancialPlannerRepository.AddTransaction(newTransaction);
            FinancialPlannerRepository.Save();

            return newTransaction;
        }
Ejemplo n.º 28
0
        public void CanAddExpensesAndRecoverThem()
        {
            var db = new LittleDB("newYorkTryp");
            var newyorkExpenses = new Tryp(db);

            var food = new Expense(20.3m, "Food", DateTime.Today);
            newyorkExpenses.AddExpense(food);

            var expenses = newyorkExpenses.GetExpenses();
            expenses.Count.Should().Be(1);
            expenses[0].Amount.Should().Be(20.3m);

            var taxiExpense = new Expense(5, "Taxi", DateTime.Today);
            newyorkExpenses.AddExpense(taxiExpense);

            var actualizedExpenses = newyorkExpenses.GetExpenses();
            actualizedExpenses.Count.Should().Be(2);
            actualizedExpenses[1].Description.Should().Be("Taxi");
        }
Ejemplo n.º 29
0
        public void Initialize()
        {
            using (var dc = new EntityFrameworkDataContext())
            {
                this.Expense = new Expense {Amount = 1000, Description = "Description", Title = "Title"};

                IRepository<Expense> repository = dc.GetRepository<Expense>();
                repository.Save(this.Expense);
                dc.Commit();
            }

            this.DataContext = new EntityFrameworkDataContext();

            IRepository<Expense> repository2 = this.DataContext.GetRepository<Expense>();
            this.UpdatedExpense = repository2.GetById(this.Expense.Id);
            this.UpdatedExpense.Amount = 500;
            this.UpdatedExpense.Title = "Updated";

            repository2.Save(this.UpdatedExpense);
        }
Ejemplo n.º 30
0
        public ActionResult StartWorkflow(WFStartWorkflowParameter param, Expense expense)
        {
            return this.JsonExecute(() =>
                {
                    //设置当前操作用户
                    param.ProcessStartupParams.Creator = (WfClientUser)DeluxeIdentity.CurrentUser.ToClientOguObject();

                    param.BusinessUrl = Url.Action("MoveTo", "home");

                    param.ProcessStartupParams.ResourceID = expense.ID;
                    //加入流程参数
                    param.ProcessStartupParams.ApplicationRuntimeParameters["Amount"] = expense.Amount;
                    param.ProcessStartupParams.ApplicationRuntimeParameters["RequestorName"] = expense.Name;
                    param.ProcessStartupParams.ProcessContext["Expense"] = JsonConvert.SerializeObject(expense);

                    param.ProcessStartupParams.ApplicationRuntimeParameters["Subject"] = expense.Name;

                    ResponseData data = param.Execute((ex) => true);

                    return Json(data);
                });
        }
Ejemplo n.º 31
0
 public static ExpenseDto AsDto(this Expense expense) => new ExpenseDto(expense.Id, expense.ApplicationUserId, expense.Price, expense.Description, expense.DateOfExpense, expense.CategoryId);
Ejemplo n.º 32
0
 public ActionResult Create(Expense expense)
 {
     return(View());
 }
Ejemplo n.º 33
0
 public int Put([FromBody] Expense expense) => expensesRepository.UpdateExpense(expense);
Ejemplo n.º 34
0
 virtual public void setYears(Expense view)
 {
 }
Ejemplo n.º 35
0
        public void WriteoffMainTest()
        {
            var ask = Substitute.For <IInteractiveQuestion>();

            ask.Question(string.Empty).ReturnsForAnyArgs(true);
            var baseParameters = Substitute.For <BaseParameters>();

            using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) {
                var warehouse = new Warehouse();
                uow.Save(warehouse);

                var nomenclatureType = new ItemsType {
                    Name = "Тестовый тип номенклатуры"
                };
                uow.Save(nomenclatureType);

                var nomenclature = new Nomenclature {
                    Type = nomenclatureType
                };
                uow.Save(nomenclature);

                var size   = new Size();
                var height = new Size();
                uow.Save(size);
                uow.Save(height);

                var position1 = new StockPosition(nomenclature, 0, size, height);

                var protectionTools = new ProtectionTools {
                    Name = "СИЗ для тестирования"
                };
                protectionTools.AddNomeclature(nomenclature);
                uow.Save(protectionTools);

                var employee = new EmployeeCard();
                uow.Save(employee);
                uow.Commit();

                var income = new Income {
                    Warehouse = warehouse,
                    Date      = new DateTime(2017, 1, 1),
                    Operation = IncomeOperations.Enter
                };
                var incomeItem1 = income.AddItem(nomenclature);
                incomeItem1.Amount = 10;
                income.UpdateOperations(uow, ask);
                uow.Save(income);

                var expense = new Expense {
                    Operation = ExpenseOperations.Employee,
                    Warehouse = warehouse,
                    Employee  = employee,
                    Date      = new DateTime(2018, 10, 22)
                };
                var item = expense.AddItem(position1, 3);

                //Обновление операций
                expense.UpdateOperations(uow, baseParameters, ask);
                uow.Save(expense);
                uow.Commit();

                var balance = EmployeeRepository.ItemsBalance(uow, employee, new DateTime(2018, 10, 30));
                Assert.That(balance.First().Amount, Is.EqualTo(3));

                //Списываем
                var writeoff = new Writeoff {
                    Date = new DateTime(2018, 10, 25)
                };
                writeoff.AddItem(item.EmployeeIssueOperation, 1);

                //Обновление операций
                writeoff.UpdateOperations(uow);
                uow.Save(writeoff);
                uow.Commit();

                var balanceAfter = EmployeeRepository.ItemsBalance(uow, employee, new DateTime(2018, 10, 30));
                Assert.That(balanceAfter.First().Amount, Is.EqualTo(2));
            }
        }
Ejemplo n.º 36
0
 public void Put([FromBody] Expense value)
 {
     _unit.ExpensesRepository.Update(value);
     _unit.Submit();
 }
Ejemplo n.º 37
0
 public IActionResult UpdateTrip(int id, [FromBody] Expense exp)
 {
     _service.UpdateExpense(id, exp);
     return(Ok(exp));
 }
Ejemplo n.º 38
0
        //Making sure that database has nothing before seeding
        public void SeedData()
        {
            if (!_dbContext.Expenses.Any())
            {
                var approver1 = new Employee
                {
                    UserName                 = "******",
                    EmployeeName             = "Dhaval Trivedi",
                    Gender                   = "M",
                    Designation              = "Manager",
                    SkillSet                 = "HTML 5, AngularJS, JavaScript",
                    EmployeeId               = 1234,
                    Email                    = "*****@*****.**",
                    DOB                      = "05/05/1986",
                    Mobile                   = "2345678901",
                    AlternateNumber          = "1234567890",
                    AddressLine1             = "Flat No 203, Suncity Apartment",
                    AddressLine2             = "Off Sarjapur Road",
                    AddressLine3             = "Near Wipro Office",
                    ZipCode                  = "560102",
                    Country                  = "India",
                    State                    = "Karnataka",
                    FatherName               = "Rakesh Kumar",
                    MotherName               = "Uma Devi",
                    FatherDOB                = "18/11/1957",
                    MotherDOB                = "06/05/1961",
                    EmergencyContactName     = "Kumar Gautham",
                    EmergencyContactNumber   = "3456789012",
                    EmergencyContactRelation = "Brother",
                    EmergencyContactDOB      = "15/10/1985",
                    ReportingManager         = "",
                    RoleName                 = ""
                };
                _dbContext.Employees.Add(approver1);
                _dbContext.SaveChanges();

                var approver2 = new Employee
                {
                    UserName                 = "******",
                    EmployeeName             = "Mrinal Pandya",
                    Gender                   = "M",
                    Designation              = "Manager",
                    SkillSet                 = "HTML 5, AngularJS, JavaScript",
                    EmployeeId               = 3456,
                    Email                    = "*****@*****.**",
                    DOB                      = "05/05/1986",
                    Mobile                   = "2345678901",
                    AlternateNumber          = "1234567890",
                    AddressLine1             = "Flat No 203, Suncity Apartment",
                    AddressLine2             = "Off Sarjapur Road",
                    AddressLine3             = "Near Wipro Office",
                    ZipCode                  = "560102",
                    Country                  = "India",
                    State                    = "Karnataka",
                    FatherName               = "Rakesh Kumar",
                    MotherName               = "Uma Devi",
                    FatherDOB                = "18/11/1957",
                    MotherDOB                = "06/05/1961",
                    EmergencyContactName     = "Kumar Gautham",
                    EmergencyContactNumber   = "3456789012",
                    EmergencyContactRelation = "Brother",
                    EmergencyContactDOB      = "15/10/1985",
                    ReportingManager         = "",
                    RoleName                 = ""
                };
                _dbContext.Employees.Add(approver2);
                _dbContext.SaveChanges();

                var approver3 = new Employee
                {
                    UserName                 = "******",
                    EmployeeName             = "Deepak Kumar Swain",
                    Gender                   = "M",
                    Designation              = "Manager",
                    SkillSet                 = "HTML 5, AngularJS, JavaScript",
                    EmployeeId               = 2345,
                    Email                    = "*****@*****.**",
                    DOB                      = "05/05/1986",
                    Mobile                   = "2345678901",
                    AlternateNumber          = "1234567890",
                    AddressLine1             = "Flat No 203, Suncity Apartment",
                    AddressLine2             = "Off Sarjapur Road",
                    AddressLine3             = "Near Wipro Office",
                    ZipCode                  = "560102",
                    Country                  = "India",
                    State                    = "Karnataka",
                    FatherName               = "Rakesh Kumar",
                    MotherName               = "Uma Devi",
                    FatherDOB                = "18/11/1957",
                    MotherDOB                = "06/05/1961",
                    EmergencyContactName     = "Kumar Gautham",
                    EmergencyContactNumber   = "3456789012",
                    EmergencyContactRelation = "Brother",
                    EmergencyContactDOB      = "15/10/1985",
                    ReportingManager         = "",
                    RoleName                 = ""
                };
                _dbContext.Employees.Add(approver3);
                _dbContext.SaveChanges();

                //Add New Set
                var expense = new Expense
                {
                    ExpenseDate = "12/09/2017",
                    SubmitDate  = "13/09/2017",
                    Amount      = 5200,
                    Employees   = new Employee
                    {
                        UserName                 = "******",
                        EmployeeName             = "Saket Kumar",
                        Gender                   = "M",
                        Designation              = "SDE 1",
                        SkillSet                 = "HTML 5, AngularJS, JavaScript, .NET",
                        EmployeeId               = 93865,
                        Email                    = "*****@*****.**",
                        DOB                      = "15/01/1985",
                        Mobile                   = "8147602853",
                        AlternateNumber          = "7975645963",
                        AddressLine1             = "Flat No 205, Shobha Garnet",
                        AddressLine2             = "Off Sarjapur Road",
                        AddressLine3             = "Near Wipro Office",
                        ZipCode                  = "560102",
                        Country                  = "India",
                        State                    = "Karnataka",
                        FatherName               = "Anil Kumar",
                        MotherName               = "Anila Kumari",
                        FatherDOB                = "15/03/1957",
                        MotherDOB                = "05/04/1961",
                        EmergencyContactName     = "Nirja Kumari",
                        EmergencyContactNumber   = "1234567890",
                        EmergencyContactRelation = "Wife",
                        EmergencyContactDOB      = "17/07/1985",
                        ReportingManager         = "Dhaval"
                    },
                    ExpenseDetails = "Random",
                    TotalAmount    = 5200,
                    ExpCategory    = new ExpenseCategory
                    {
                        CategoryId = 1,
                        Category   = "Visa"
                    },
                    Approvers = new Approver
                    {
                        ApproverId   = 1234,
                        ApprovedDate = "13/09/2017",
                        Name         = "Dhaval",
                        Remarks      = "Approved"
                    },
                    Status = new TicketStatus {
                        State = TicketState.ApprovedFromFinance, Reason = "Claim Approved"
                    },
                    Reason = new Reason {
                        Reasoning = "Approved From Finance", EmployeeId = 93865
                    }
                };
                _dbContext.Expenses.Add(expense);
                _dbContext.Employees.AddRange(expense.Employees);
                _dbContext.Approvers.AddRange(expense.Approvers);
                _dbContext.SaveChanges();

                var expense1 = new Expense
                {
                    ExpenseDate = "11/09/2017",
                    SubmitDate  = "12/09/2017",
                    Amount      = 5300,
                    Employees   = new Employee
                    {
                        UserName                 = "******",
                        EmployeeName             = "Shyam Sinha",
                        Gender                   = "M",
                        Designation              = "SDE 2",
                        SkillSet                 = "C#, .NET",
                        EmployeeId               = 93868,
                        Email                    = "*****@*****.**",
                        DOB                      = "19/05/1983",
                        Mobile                   = "8147612345",
                        AlternateNumber          = "7975612345",
                        AddressLine1             = "Flat No 206, Suncity Apartment",
                        AddressLine2             = "Off Sarjapur Road",
                        AddressLine3             = "Near Wipro Office",
                        ZipCode                  = "560102",
                        Country                  = "India",
                        State                    = "Karnataka",
                        FatherName               = "Ram Kumar",
                        MotherName               = "Anita Kumari",
                        FatherDOB                = "05/10/1961",
                        MotherDOB                = "06/12/1961",
                        EmergencyContactName     = "Kritika Kumari",
                        EmergencyContactNumber   = "2345678901",
                        EmergencyContactRelation = "Sister",
                        EmergencyContactDOB      = "15/07/1983",
                        ReportingManager         = "Deepak"
                    },
                    ExpenseDetails = "Another Expense",
                    TotalAmount    = 5300,
                    ExpCategory    = new ExpenseCategory
                    {
                        CategoryId = 2,
                        Category   = "Party"
                    },
                    Approvers = new Approver
                    {
                        ApproverId   = 2345,
                        ApprovedDate = "13/09/2017",
                        Name         = "Deepak",
                        Remarks      = "nothing"
                    },
                    Status = new TicketStatus {
                        State = TicketState.ApprovedFromAdmin, Reason = "Claim Pending for document submission."
                    },
                    Reason = new Reason {
                        Reasoning = "Pending From Finance", EmployeeId = 93868
                    }
                };
                _dbContext.Expenses.Add(expense1);
                _dbContext.Employees.AddRange(expense1.Employees);
                _dbContext.Approvers.AddRange(expense1.Approvers);
                _dbContext.SaveChanges();

                var expense2 = new Expense
                {
                    ExpenseDate = "10/09/2017",
                    SubmitDate  = "11/09/2017",
                    Amount      = 5400,
                    Employees   = new Employee
                    {
                        UserName                 = "******",
                        EmployeeName             = "Sheena Kumari",
                        Gender                   = "F",
                        Designation              = "Developer",
                        SkillSet                 = "HTML 5, AngularJS, JavaScript",
                        EmployeeId               = 93869,
                        Email                    = "*****@*****.**",
                        DOB                      = "19/05/1986",
                        Mobile                   = "8147602843",
                        AlternateNumber          = "7975645965",
                        AddressLine1             = "Flat No 205, Suncity Apartment",
                        AddressLine2             = "Off Sarjapur Road",
                        AddressLine3             = "Near Wipro Office",
                        ZipCode                  = "560102",
                        Country                  = "India",
                        State                    = "Karnataka",
                        FatherName               = "Rakesh Kumar",
                        MotherName               = "Uma Devi",
                        FatherDOB                = "18/11/1957",
                        MotherDOB                = "06/05/1961",
                        EmergencyContactName     = "Kumar Gautham",
                        EmergencyContactNumber   = "3456789012",
                        EmergencyContactRelation = "Brother",
                        EmergencyContactDOB      = "15/10/1985",
                        ReportingManager         = "Mrinal"
                    },
                    ExpenseDetails = "Misel",
                    TotalAmount    = 5400,
                    ExpCategory    = new ExpenseCategory
                    {
                        CategoryId = 3,
                        Category   = "Cab"
                    },
                    Approvers = new Approver
                    {
                        ApproverId   = 3456,
                        ApprovedDate = "13/09/2017",
                        Name         = "Mrinal",
                        Remarks      = "Reviewing"
                    },
                    Status = new TicketStatus {
                        State = TicketState.Submitted, Reason = "Claim Submitted!"
                    },
                    Reason = new Reason {
                        Reasoning = "Claim Submitted", EmployeeId = 93869
                    }
                };
                _dbContext.Expenses.Add(expense2);
                _dbContext.Employees.AddRange(expense2.Employees);
                _dbContext.Approvers.AddRange(expense2.Approvers);
                _dbContext.SaveChanges();
            }


            //Seed Expense CategorySet
            if (!_dbContext.ExpenseCategorySets.Any())
            {
                //Add New Set of Expense Category
                var expenseCat = new ExpenseCategorySet
                {
                    CategoryId = 1,
                    Category   = "Visa"
                };
                _dbContext.ExpenseCategorySets.Add(expenseCat);
                _dbContext.SaveChanges();

                var expenseCat2 = new ExpenseCategorySet
                {
                    CategoryId = 2,
                    Category   = "Party"
                };
                _dbContext.ExpenseCategorySets.Add(expenseCat2);
                _dbContext.SaveChanges();
                var expenseCat3 = new ExpenseCategorySet
                {
                    CategoryId = 3,
                    Category   = "Cab"
                };
                _dbContext.ExpenseCategorySets.Add(expenseCat3);
                _dbContext.SaveChanges();
                var expenseCat4 = new ExpenseCategorySet
                {
                    CategoryId = 4,
                    Category   = "OnSite-Kit"
                };
                _dbContext.ExpenseCategorySets.Add(expenseCat4);
                _dbContext.SaveChanges();
            }

            if (!_dbContext.Roles.Any())
            {
                /*  var role1 = new Role
                 * {
                 *    RoleName = "SuperAdmin"
                 * };
                 * _dbContext.Roles.Add(role1);
                 * _dbContext.SaveChanges();*/

                var role2 = new Role
                {
                    RoleName = "Admin"
                };
                _dbContext.Roles.Add(role2);
                _dbContext.SaveChanges();

                var role3 = new Role
                {
                    RoleName = "Manager"
                };
                _dbContext.Roles.Add(role3);
                _dbContext.SaveChanges();

                var role4 = new Role
                {
                    RoleName = "Finance"
                };
                _dbContext.Roles.Add(role4);
                _dbContext.SaveChanges();

                var role5 = new Role
                {
                    RoleName = "User"
                };
                _dbContext.Roles.Add(role5);
                _dbContext.SaveChanges();
            }
            //Seed Approver Lists

            /*if (!_dbContext.ApproverLists.Any())
             * {
             *  //Add New Set of Expense Category
             *  var approverCat = new ApproverList
             *  {
             *      ApproverId = 1234,
             *      Name = "Dhaval",
             *
             *  };
             *  _dbContext.ApproverLists.Add(approverCat);
             *  _dbContext.SaveChanges();
             *  var approverCat2 = new ApproverList
             *  {
             *      ApproverId = 2345,
             *      Name = "Deepak",
             *
             *  };
             *  _dbContext.ApproverLists.Add(approverCat2);
             *  _dbContext.SaveChanges();
             *  var approverCat3 = new ApproverList
             *  {
             *      ApproverId = 3456,
             *      Name = "Mrinal",
             *
             *  };
             *  _dbContext.ApproverLists.Add(approverCat3);
             *  _dbContext.SaveChanges();
             *  var approverCat4 = new ApproverList
             *  {
             *      ApproverId = 4567,
             *      Name = "Vesta",
             *
             *  };
             *  _dbContext.ApproverLists.Add(approverCat4);
             *  _dbContext.SaveChanges();
             * }*/
        }
Ejemplo n.º 39
0
        public IActionResult Put(int id, [FromBody] Expense expense)
        {
            var result = expenseService.Upsert(id, expense);

            return(Ok(result));
        }
Ejemplo n.º 40
0
 private static void DeleteExpense(Expense expense, ExpenseAppEntities entity)
 {
     entity.Expenses.Remove(expense);
     entity.SaveChanges();
 }
Ejemplo n.º 41
0
        public void GetReferencedDocuments_ReturnTest()
        {
            var interactive = Substitute.For <IInteractiveQuestion>();

            interactive.Question(string.Empty).ReturnsForAnyArgs(true);
            var baseParameters = Substitute.For <BaseParameters>();

            using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) {
                var warehouse = new Warehouse();
                uow.Save(warehouse);

                var nomenclatureType = new ItemsType {
                    Name = "Тестовый тип номенклатуры"
                };
                uow.Save(nomenclatureType);

                var nomenclature = new Nomenclature {
                    Type = nomenclatureType
                };
                uow.Save(nomenclature);

                var employee = new EmployeeCard();
                uow.Save(employee);

                var expense = new Expense {
                    Date      = new DateTime(2021, 9, 10),
                    Employee  = employee,
                    Operation = ExpenseOperations.Employee,
                    Warehouse = warehouse,
                };

                var size   = new Size();
                var height = new Size();
                uow.Save(size);
                uow.Save(height);

                var stockPosition = new StockPosition(nomenclature, 0, size, height);
                var item          = expense.AddItem(stockPosition, 10);

                expense.UpdateOperations(uow, baseParameters, interactive);
                uow.Save(expense);

                //Возвращаем 2 штуки
                var income = new Income {
                    Date         = new DateTime(2021, 9, 11),
                    Operation    = IncomeOperations.Return,
                    EmployeeCard = employee,
                    Warehouse    = warehouse,
                };

                var returnItem = income.AddItem(item.EmployeeIssueOperation, 2);
                income.UpdateOperations(uow, interactive);
                uow.Save(income);
                uow.Commit();

                var repository = new EmployeeIssueRepository(uow);
                var result     = repository.GetReferencedDocuments(returnItem.ReturnFromEmployeeOperation.Id);
                Assert.That(result.First().DocumentType, Is.EqualTo(StokDocumentType.IncomeDoc));
                Assert.That(result.First().DocumentId, Is.EqualTo(income.Id));
                Assert.That(result.First().ItemId, Is.EqualTo(returnItem.Id));
            }
        }
Ejemplo n.º 42
0
 private void HandleItemSelected(Expense expense)
 {
     App.NavigationPage.Navigation.PushAsync(new ExpenseDetail(expense));
 }
Ejemplo n.º 43
0
 virtual public void setMonths(Expense view, int year)
 {
 }
Ejemplo n.º 44
0
 virtual public void addExpense(Expense view, bool regularActive, ExpenseDetails expDetails)
 {
 }
Ejemplo n.º 45
0
 public void Update(Expense expense)
 {
     _context.Expenses.Update(expense);
 }
Ejemplo n.º 46
0
        private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            Expense selectedExpense = (listView.SelectedItem) as Expense;

            Application.Current.MainPage.Navigation.PushAsync(new ExpenseDetailsPage(selectedExpense));
        }
Ejemplo n.º 47
0
 public void Add(Expense expense)
 {
     _context.Expenses.Add(expense);
 }
Ejemplo n.º 48
0
 public ExpenseDetail(Expense expense)
 {
     BindingContext = new ExpenseDetailViewModel(expense);
     Title          = "Expense Detail";
     InitializeComponent();
 }
Ejemplo n.º 49
0
 public void Post([FromBody] Expense value)
 {
     _unit.ExpensesRepository.Add(value);
     _unit.Submit();
 }
Ejemplo n.º 50
0
 public RecivedAdvance(Expense exp)
 {
     Advance  = exp;
     Selected = false;
 }
Ejemplo n.º 51
0
 public Expense Create(Expense expense)
 {
     context.Expenses.Add(expense);
     context.SaveChanges();
     return(expense);
 }
 public object CreateDataShapedObject(Expense expense, List <string> lstOfFields)
 {
     return(CreateDataShapedObject(CreateExpense(expense), lstOfFields));
 }
 public void Create(Expense expense)
 {
     _db.Expenses.Add(expense);
     _db.SaveChanges();
 }
        public Expense GetExpense(int expenseId)
        {
            Expense expense = _db.Expenses.Find(expenseId);

            return(expense);
        }
Ejemplo n.º 55
0
        public async Task <IActionResult> PostTransaction([FromBody] PettyCash transactionApi)
        {
            int orno = 0;
            //insert storeCode
            bool isStoreExist = _context.ExpenseStore.Any(c => c.StoreCode == transactionApi.storeCode);

            if (!isStoreExist)
            {
                ExpenseStore expenseStore = new ExpenseStore();
                expenseStore.StoreCode     = transactionApi.storeCode;
                expenseStore.RemaingBudget = 0;
                expenseStore.TotalExpense  = 0;
                expenseStore.Year          = DateTime.Now.Year;
                _context.ExpenseStore.Add(expenseStore);
            }
            APIResponse response = new APIResponse();

            try
            {
                //perbaiki transaksi petty cash
                //add more unit;
                orno = _context.Expense.Count() + transactionApi.pettyCashLine.Count();
                InforAPIPettyCash inforAPIPettyCash = new InforAPIPettyCash(_context);
                String            itrn = inforAPIPettyCash.getRoundNumber();
                foreach (PettyCashLine pl in transactionApi.pettyCashLine)
                {
                    Expense expense = new Expense();
                    expense.Amount           = (pl.price * pl.quantity);
                    expense.CostCategoryId   = transactionApi.expenseCategoryId;
                    expense.CostCategoryName = transactionApi.expenseCategory;
                    expense.ExpenseName      = pl.expenseName;
                    expense.StoreCode        = transactionApi.storeCode;
                    expense.Price            = pl.price;
                    expense.Qty      = pl.quantity;
                    expense.TypeId   = Config.RetailEnum.expenseExpense;
                    expense.TypeName = "Expense";
                    expense.Orno     = "PC" + orno;
                    expense.Itrn     = itrn;
                    try
                    {
                        expense.TransactionDate = DateTime.ParseExact(transactionApi.timeStamp, "MMM dd, yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        expense.TransactionDate = DateTime.ParseExact(transactionApi.date + transactionApi.time, "yyyy-MM-dd" + "H:mm:ss", CultureInfo.InvariantCulture);
                    }
                    _context.Add(expense);
                    _context.SaveChanges();
                }
                //log record

                this.updateExpense(transactionApi.storeCode);
                //post to infor
                inforAPIPettyCash.postPettyCash(transactionApi, orno, itrn).Wait();

                response.code    = "1";
                response.message = "Sucess Add Data";

                this.sequenceNumber(transactionApi);
            }
            catch (Exception ex)
            {
                response.code    = "0";
                response.message = ex.ToString();
            }
            LogRecord log = new LogRecord();

            log.TimeStamp = DateTime.Now;
            log.Tag       = "Petty Cash";
            log.Message   = JsonConvert.SerializeObject(transactionApi);
            _context.LogRecord.Add(log);
            _context.SaveChanges();

            return(Ok(response));
        }
Ejemplo n.º 56
0
 public int Post([FromBody] Expense expense) => expensesRepository.AddNewExpense(expense);
Ejemplo n.º 57
0
 public void AddExpenseToTrip(Expense expense)
 {
     Expenses.Add(expense);
 }
Ejemplo n.º 58
0
 public ExpenseViewModel(Expense Expense)
 {
     SetFromExpense(Expense);
 }
Ejemplo n.º 59
0
 public ActionResult Edit(int id, Expense expense)
 {
     return(View());
 }
Ejemplo n.º 60
0
        /// <summary>
        /// Deletes the selected expense.
        /// </summary>
        public void DeleteSelectedExpense(Expense expense)
        {
            var conn = DefaultDatabaseConnection();

            conn.Delete <Expense>(expense.Id);
        }