Exemplo n.º 1
0
        public ActionResult EditPayMoney(int?id)
        {
            if (Session["empName"] != null)
            {
                ViewBag.Month = new SelectList(_db.Month.ToList(), "id", "months");

                string name = Session["empName"].ToString();

                var ss        = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault();
                var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == ss.id).FirstOrDefault();

                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Salaries _salary = _db.Salaries.Find(id);
                string   empid   = ss.id.ToString();


                if (_salary == null)
                {
                    return(HttpNotFound());
                }
                else if (_allowAll.Staticis == true)
                {
                    return(View(_salary));
                }
            }
            return(RedirectToAction("HavntAccess", "Employees"));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SailaryID,SailaryMonth,SailaryAmount,OtherGifts,EmployeeID")] Salaries salaries)
        {
            if (id != salaries.SailaryID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salaries);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalariesExists(salaries.SailaryID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employee, "EmployeeID", "EmployeeID", salaries.EmployeeID);
            return(View(salaries));
        }
Exemplo n.º 3
0
        private Dictionary <int, SalaryData> GetSalaryData()
        {
            Dictionary <int, SalaryData> result = new Dictionary <int, SalaryData>();
            Salaries salaries = Salaries.ForOrganization(_authenticationData.CurrentOrganization, true);

            foreach (Salary salary in salaries)
            {
                int monthKey = salary.PayoutDate.Year * 100 + salary.PayoutDate.Month;

                if (!result.ContainsKey(monthKey))
                {
                    result[monthKey] = new SalaryData();
                }

                result[monthKey].GrossSalaryCents += salary.GrossSalaryCents;
                result[monthKey].AdditiveTaxCents += salary.AdditiveTaxCents;
                result[monthKey].DeductedTaxCents += salary.SubtractiveTaxCents;

                if (monthKey < _minKey)
                {
                    _minKey = monthKey;
                }
            }

            return(result);
        }
Exemplo n.º 4
0
    private void PopulateSalaries()
    {
        Salaries salaries = Salaries.ForOrganization(CurrentOrganization);

        // No unattestability for previously attested salaries because complex

        foreach (Salary salary in salaries)
        {
            if (this._approvalRights.ContainsKey(salary.PayrollItem.BudgetId) ||
                salary.PayrollItem.Budget.OwnerPersonId == Person.NobodyId)
            {
                if (!salary.Attested)
                {
                    this._approvableCosts.Add(new ApprovableCost("S" + salary.Identity.ToString(CultureInfo.InvariantCulture),
                                                                 salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget,
                                                                 "[Loc]Financial_SalarySpecification|[Date]" +
                                                                 salary.PayoutDate.ToString(CultureInfo.InvariantCulture), "Financial_Salary", false, salary));
                }
                else
                {
                    this._approvedCosts.Add(new ApprovableCost("S" + salary.Identity.ToString(CultureInfo.InvariantCulture),
                                                               salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget,
                                                               "[Loc]Financial_SalarySpecification|[Date]" +
                                                               salary.PayoutDate.ToString(CultureInfo.InvariantCulture), "Financial_Salary", false, salary));
                }
            }
        }
    }
Exemplo n.º 5
0
        static void TesterCollection()
        {
            Salaries salaries = new Salaries();

            salaries.Add(new Salarie()
            {
                Matricule = "01tre12", Nom = "bost", Prenom = "Vincent", DateNaissance = new DateTime(1962, 01, 13)
            });
            salaries.Add(new Salarie()
            {
                Matricule     = "01tre13",
                Nom           = "bosti",
                Prenom        = "Vincente",
                DateNaissance = new DateTime(1962, 01, 14)
            });
            Salarie sal3 = new Salarie()
            {
                Matricule     = "01tre13",
                Nom           = "bosti",
                Prenom        = "Vincente",
                DateNaissance = new DateTime(1962, 01, 14)
            };

            salaries.Add(sal3);



            Console.ReadLine();
        }
        public SalariesDataBinding()
        {
            Salaries db = new Salaries();

            DataContext = new MasterViewModelSalarieDataBinding(db);
            InitializeComponent();
        }
Exemplo n.º 7
0
        private SalaryTaxData GetSalaryData(int year, int month, Organization organization, int[] yearBreakpoints)
        {
            SalaryTaxData result = new SalaryTaxData();

            Salaries salaries = Salaries.ForOrganization(organization, true);

            foreach (Salary salary in salaries)
            {
                if (salary.PayoutDate.Year == year && salary.PayoutDate.Month == month)
                {
                    int employeeBirthYear = salary.PayrollItem.Person.Birthdate.Year;
                    int ageBracket        = 0; // main
                    if (employeeBirthYear >= yearBreakpoints[2])
                    {
                        ageBracket = 1; // youth rebate
                    }
                    else if (employeeBirthYear < yearBreakpoints[1])
                    {
                        ageBracket = 2; // pensioners
                    }

                    result.Salary[ageBracket]      += salary.GrossSalaryCents / 100.0;
                    result.SalaryTotal             += salary.GrossSalaryCents / 100.0;
                    result.TaxSubtractiveTotal     += salary.SubtractiveTaxCents / 100.0;
                    result.TaxAdditive[ageBracket] += salary.AdditiveTaxCents / 100.0;
                    result.TaxAdditiveTotal        += salary.AdditiveTaxCents / 100.0;
                    result.TaxTotal += salary.TaxTotalCents / 100.0;
                }
            }

            return(result);
        }
Exemplo n.º 8
0
    protected void PopulateGrid()
    {
        Salaries                  salaries = Salaries.ForOrganization(Organization.PPSE, true);
        List <GridRow>            rows     = new List <GridRow>();
        Dictionary <int, GridRow> sumRows  = new Dictionary <int, GridRow>();

        foreach (Salary salary in salaries)
        {
            int monthKey = salary.PayoutDate.Year * 100 + salary.PayoutDate.Month;

            rows.Add(new GridRow(salary.Identity, monthKey, salary.PayrollItem.PersonCanonical, salary.GrossSalaryCents / 100.0,
                                 salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0));

            if (sumRows.ContainsKey(monthKey))
            {
                sumRows[monthKey].Add(salary.GrossSalaryCents / 100.0, salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }
            else
            {
                sumRows[monthKey] = new GridRow(monthKey, 0,
                                                salary.PayoutDate.ToString("yyyy MMMM", CultureInfo.InvariantCulture),
                                                salary.GrossSalaryCents / 100.0, salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }
        }

        foreach (int key in sumRows.Keys)
        {
            rows.Add(sumRows[key]);
        }


        this.GridSalaryTaxData.DataSource = rows;
    }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Salaries listeSalaries = new Salaries();

            listeSalaries.Add(new Salarie()
            {
                Matricule = "12XXX12", Nom = "Bost", Prenom = "Vincent"
            });
            listeSalaries.Add(new Salarie()
            {
                Matricule = "12XXX13", Nom = "Tartempion", Prenom = "Gilbert"
            });
            listeSalaries.Add(new Salarie()
            {
                Matricule = "12XXX12", Nom = "Bost", Prenom = "Vincent"
            });
            Console.WriteLine("attendu true {0}", 2 == listeSalaries.Count);
            Salarie salASupprimer = listeSalaries.Extraire("12XXX13");

            listeSalaries.Remove(salASupprimer);
            Console.WriteLine("attendu true {0}", 1 == listeSalaries.Count);
            Salarie salASupprimer2 = listeSalaries.Extraire("12XXX12");

            listeSalaries.Remove(salASupprimer2);
            listeSalaries.Remove()
            Console.WriteLine("attendu true {0}", 0 == listeSalaries.Count);
            Console.ReadLine();
        }
Exemplo n.º 10
0
    private void PopulateSalaries(AttestableItems items)
    {
        Salaries salaries           = Salaries.ForOrganization(Organization.PPSE);
        Salaries unattestedSalaries = new Salaries();

        // LINQ would be nice here. "Where Attested=0".

        foreach (Salary salary in salaries)
        {
            if (!salary.Attested)
            {
                if (attestationRights.ContainsKey(salary.PayrollItem.BudgetId) && salary.PayrollItem.PersonId != _currentUser.Identity)
                {
                    unattestedSalaries.Add(salary);
                }
                else if (salary.PayrollItem.ReportsToPersonId == _currentUser.Identity)
                {
                    unattestedSalaries.Add(salary);
                }
            }
        }

        foreach (Salary salary in unattestedSalaries)
        {
            AddAttestableItem(items, salary);
        }
    }
Exemplo n.º 11
0
 static void afficherSalaries(Salaries team)
 {
     Console.Write("\n");
     foreach (Salarie item in team)
     {
         Console.WriteLine("Nom : {0}, Prénom : {1}, Matricule : {2}", item.Nom, item.Prenom, item.Matricule);
     }
 }
Exemplo n.º 12
0
        private void OnSalaryAdded(SalaryAddedMessage message)
        {
            EditableSalaryViewModel salaryViewModel = new EditableSalaryViewModel(salaryValidator);

            salaryViewModel.LoadEntity(message.Content);
            Salaries.Add(salaryViewModel);
            exportCommand.RaiseCanExecuteChanged();
        }
Exemplo n.º 13
0
    void LoadSalary()
    {
        var salaryList = new Salaries().GetSalaries();

        foreach (var item in salaryList)
        {
            ddlMaxSalary.Items.Add(new ListItem(item.SalaryValue.ToString("C0"), item.SalaryValue.ToString()));
            ddlMinSalary.Items.Add(new ListItem(item.SalaryValue.ToString("C0"), item.SalaryValue.ToString()));
        }
    }
Exemplo n.º 14
0
        private void AddSalaries(IEnumerable <Salary> importedCollection)
        {
            foreach (var item in importedCollection)
            {
                EditableSalaryViewModel itemViewModel = new EditableSalaryViewModel(salaryValidator);
                itemViewModel.LoadEntity(item);
                Salaries.Add(itemViewModel);
            }

            exportCommand.RaiseCanExecuteChanged();
        }
Exemplo n.º 15
0
        private void ChargerSalaries()
        {
            salaries = new Salaries();
            ISauvegarde serialiseur = MonApplication.DispositifSauvegarde;

            salaries.Load(serialiseur, Properties.Settings.Default.AppData);
            foreach (Salarie item in salaries)
            {
                cb_ChoixSalarie.Items.Add(item.Matricule);
            }
        }
Exemplo n.º 16
0
        private void DeleteSalary()
        {
            Salary salary = SelectedSalary.CreateEntity();
            DeleteSalaryDialogViewModel deleteSalaryDialogViewModel = new DeleteSalaryDialogViewModel(salary, dialogService);

            windowService.ShowDialog(deleteSalaryDialogViewModel, ResizeMode.NoResize);
            if (deleteSalaryDialogViewModel.Result)
            {
                Salaries.Remove(SelectedSalary);
            }
        }
        public async Task <IActionResult> Create([Bind("SailaryID,SailaryMonth,SailaryAmount,OtherGifts,EmployeeID")] Salaries salaries)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salaries);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmployeeID"] = new SelectList(_context.Employee, "EmployeeID", "EmployeeID", salaries.EmployeeID);
            return(View(salaries));
        }
Exemplo n.º 18
0
    private void PopulateSalaries()
    {
        Salaries salaries = Salaries.ForOrganization(this.CurrentOrganization).WhereUnattested;

        foreach (Salary salary in salaries)
        {
            if (_attestationRights.ContainsKey(salary.PayrollItem.BudgetId) || salary.PayrollItem.Budget.OwnerPersonId == Person.NobodyId)
            {
                _items.Add(new AttestableItem("S" + salary.Identity.ToString(CultureInfo.InvariantCulture), salary.PayrollItem.PersonCanonical, salary.CostTotalCents, salary.PayrollItem.Budget, "[Loc]Financial_SalarySpecification|[Date]" + salary.PayoutDate.ToString(CultureInfo.InvariantCulture), "Financial_Salary", false, salary));
            }
        }
    }
Exemplo n.º 19
0
        private void chargerUtilisateurs()
        {
            GestionnaireContextes(Contextes.ModificationInitiale);
            salaries = new Salaries();
            ISauvegarde sauvegarde = MonApplication.DispositifSauvegarde;

            salaries.Load(sauvegarde, Settings.Default.AppData);
            foreach (Salarie item in salaries)
            {
                cbChoixSalarie.Items.Add(item.Matricule);
            }
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            Salaries team = new Salaries();

            team.Add(new Salarie("Bachelet", "Damien", "00xxx00"));
            team.Add(new Salarie("Bacheleta", "Damiena", "01xxx01"));
            team.Add(new Salarie("Bacheleta", "Damiena", "01xxx01")); // Ne sera pas ajouté : même matricul
            Console.WriteLine("Non ajout avec même matricule : {0}", team.Count == 2);


            team.Add(new Salarie("Bacheletb", "Damienb", "02xxx02"));
            Salarie test = new Salarie("Bacheletc", "Damienc", "03xxx03");

            team.Add(test);

            Console.WriteLine("List :");
            afficherSalaries(team);

            team.supprimerSalarie("01xxx01");

            afficherSalaries(team);

            team.supprimerSalarie(test);

            afficherSalaries(team);

            Console.ReadLine();
            Console.Clear();

            SalariesH team2 = new SalariesH();

            team2.Add(new Salarie("Bachelet", "Damien", "00xxx00"));
            team2.Add(new Salarie("Bacheleta", "Damiena", "01xxx01"));
            team2.Add(new Salarie("Bacheletb", "Damienb", "01xxx01"));
            team2.Add(test);

            Console.WriteLine("HashSet :");
            afficherSalariesH(team2);

            team2.supprimerSalarie("01xxx01");

            afficherSalariesH(team2);

            team2.supprimerSalarie(test);

            afficherSalariesH(team2);

            Console.ReadLine();
        }
    protected void PopulateGrid()
    {
        Salaries                     salaries         = Salaries.ForOrganization(Organization.PPSE, true);
        List <GridRow>               rows             = new List <GridRow>();
        Dictionary <int, GridRow>    yearRows         = new Dictionary <int, GridRow>();
        Dictionary <string, GridRow> yearEmployeeRows = new Dictionary <string, GridRow>();

        foreach (Salary salary in salaries)
        {
            int    yearKey         = salary.PayoutDate.Year;
            string yearEmployeeKey = salary.PayoutDate.Year.ToString() + salary.PayrollItem.PersonId.ToString();

            if (yearEmployeeRows.ContainsKey(yearEmployeeKey))
            {
                yearEmployeeRows[yearEmployeeKey].Add(salary.GrossSalaryCents / 100.0, salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }
            else
            {
                yearEmployeeRows [yearEmployeeKey] = new GridRow(salary.Identity, yearKey, salary.PayrollItem.PersonCanonical, salary.GrossSalaryCents / 100.0,
                                                                 salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }

            if (yearRows.ContainsKey(yearKey))
            {
                yearRows[yearKey].Add(salary.GrossSalaryCents / 100.0, salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }
            else
            {
                yearRows[yearKey] = new GridRow(yearKey, 0,
                                                salary.PayoutDate.ToString("yyyy", CultureInfo.InvariantCulture),
                                                salary.GrossSalaryCents / 100.0, salary.SubtractiveTaxCents / 100.0, salary.AdditiveTaxCents / 100.0);
            }
        }

        foreach (string key in yearEmployeeRows.Keys)
        {
            rows.Add(yearEmployeeRows[key]);
        }

        foreach (int key in yearRows.Keys)
        {
            rows.Add(yearRows[key]);
        }


        this.GridSalaryTaxData.DataSource = rows;
    }
Exemplo n.º 22
0
        private void LoadDependencies()
        {
            DependentExpenseClaims = new ExpenseClaims();
            DependentInvoices = new InboundInvoices();
            DependentSalariesNet = new Salaries();
            DependentSalariesTax = new Salaries();
            DependentCashAdvancesPayout = new CashAdvances();
            DependentCashAdvancesPayback = new CashAdvances();

            BasicFinancialDependency[] dependencies = SwarmDb.GetDatabaseForReading().GetPayoutDependencies(this.Identity);

            foreach (BasicFinancialDependency dependency in dependencies)
            {
                switch (dependency.DependencyType)
                {
                    case FinancialDependencyType.ExpenseClaim:
                        DependentExpenseClaims.Add(ExpenseClaim.FromIdentity(dependency.ForeignId));
                        break;
                    case FinancialDependencyType.InboundInvoice:
                        DependentInvoices.Add(InboundInvoice.FromIdentity(dependency.ForeignId));
                        break;
                    case FinancialDependencyType.Salary:
                        Salary salary = Salary.FromIdentity(dependency.ForeignId);
                        if (salary.NetSalaryCents == this.AmountCents)  // HACK: Assumes that tax total is not identical
                        {
                            DependentSalariesNet.Add(salary);
                        }
                        else
                        {
                            DependentSalariesTax.Add(salary);
                        }
                        break;

                    case FinancialDependencyType.CashAdvance:
                        DependentCashAdvancesPayout.Add(CashAdvance.FromIdentity(dependency.ForeignId));
                        break;

                    case FinancialDependencyType.CashAdvancePayback:
                        DependentCashAdvancesPayback.Add(CashAdvance.FromIdentity(dependency.ForeignId));
                        break;

                    default:
                        throw new NotImplementedException("Unknown financial dependency type in Payout.LoadDependencies(): " + dependency.ToString());
                }
            }
        }
Exemplo n.º 23
0
        public static void Serialisationv1()
        {
            #region Initialisation
            Salaries listesal = new Salaries();
            listesal.Add(new Salarie(new DateTime(1993, 11, 10), "12gty93", "CHESNE", "Sarah", 25000, 0.2));
            listesal.Add(new Salarie(new DateTime(1998, 08, 27), "12gty98", "CHESNE", "Emilie", 23000, 0.2));
            #endregion

            #region Exercice 2.1 CSV
            listesal.SaveText(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.csv");
            Salaries listesal2 = new Salaries();


            listesal2.LoadText(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.csv");
            foreach (Salarie sal in listesal2)
            {
                Console.WriteLine(sal.ToString());
            }
            #endregion

            #region XML
            listesal.SaveXML(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.xml");
            Salaries listesal3 = new Salaries();

            listesal3.LoadXML(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.xml");
            foreach (Salarie sal2 in listesal3)
            {
                Console.WriteLine(sal2.ToString());
            }
            #endregion

            #region Binaire

            listesal.SaveBinary(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.dat");
            Salaries listesal4 = new Salaries();
            listesal4.LoadBinary(@"C:\Users\CDI\Documents\Visual Studio 2015\Projects\PersitanceObjet\Salarie.dat");
            foreach (Salarie sal3 in listesal4)
            {
                Console.WriteLine(sal3.ToString());
            }
            #endregion

            

        }
Exemplo n.º 24
0
 public VMEmployeeWindow(Employee employee, Action action, EmployeeWindow employeeWindow, bool isnNew = false)
 {
     IsNew       = isnNew;
     Positions   = DataQueries.SelectPositions();
     Departments = DataQueries.SelectDepartments();
     Salaries    = DataQueries.SelectSalaries();
     UpdateInfo  = action;
     oldEmployee = employee;
     NewEmployee = new Employee();
     if (!IsNew)
     {
         HandlingObjects.CopyValueProperties(NewEmployee, employee);
         SelectedPosition   = Positions.Where(c => c.Id == employee.Position.Id).First();
         SelectedDepartment = Departments.Where(c => c.Id == employee.Department.Id).First();
         SelectedSalary     = Salaries.Where(c => c.Id == employee.Salary.Id).First();
     }
     EmployeeWindow = employeeWindow;
 }
Exemplo n.º 25
0
        public async void Query()
        {
            if (string.IsNullOrWhiteSpace(StudentID))
            {
                Services.NotityService.Notify("请输入学号");
                return;
            }
            if (string.IsNullOrWhiteSpace(Name))
            {
                Services.NotityService.Notify("请输入姓名");
                return;
            }
            IsLoading = true;
            try
            {
                var re = await Services.MyBjutService.QuerySalaries(_httpService, StudentID, Name);

                if (re == null || re.Count == 0)
                {
                    Services.NotityService.Notify("没有查询到相关的信息");
                    Salaries.Clear();

                    Total = $"没有相关的信息";
                    return;
                }
                Salaries.Clear();
                foreach (var item in re)
                {
                    Salaries.Add(item);
                }

                var salary = Salaries.Aggregate(0d, (sum, m) => { return(sum + m.Salary); });
                Total = $"参与零工 {Salaries.Count} 次,共收入 {salary } 元";
            }
            catch (Exception e)
            {
                Services.NotityService.Notify(e.Message);
                return;
            }
            finally
            {
                IsLoading = false;
            }
        }
Exemplo n.º 26
0
        public ActionResult EditPayMoney(int id, Salaries _salary, string months)
        {
            ViewBag.Month = new SelectList(_db.Month.ToList(), "id", "months");


            if (ModelState.IsValid)
            {
                _salary.Employee = Session["id"].ToString();

                _salary.empSupplyer = Session["empName"].ToString();

                _db.Entry(_salary).State = EntityState.Modified;
                _salary.Date             = DateTime.Now;
                _salary.month            = months;
                _db.SaveChanges();
                return(RedirectToAction("Salary/" + Session["id"]));
            }
            return(View(_salary));
        }
Exemplo n.º 27
0
        public ActionResult newSalaries(SalariesModel SAL)
        {
            if (ismodel)
            {
                using (context = new BPOContext())

                {
                    Salaries sal = new Salaries()
                    {
                        Date   = SAL.Date,
                        Emp_ID = SAL.Emp_ID,
                        ID     = SAL.ID,
                        Salary = SAL.Salary
                    };
                    var obj = context.Employee.ToList();
                    ViewBag.employee = obj;
                }
            }
            return(View());
        }
Exemplo n.º 28
0
        /// <summary>
        /// méthode de remplissage de la liste des salaries
        /// </summary>
        /// <param name="nomSalarie">nom ou une partie du salarié / empty ou null charge tous les salariés</param>
        private void InitListBoxSalarie(string nomSalarie)
        {
            Salaries      listeSalarie = new Salaries();
            StringBuilder sB           = new StringBuilder(Paramètres.Default.path);

            sB.Append($@"\{listeSalarie.GetType().FullName}.Xml");

            if (File.Exists(sB.ToString()))
            {
                listeSalarie.Load(new SauvegardeXML(), Paramètres.Default.path);
                if (string.IsNullOrEmpty(nomSalarie))
                {
                    ListBoxSalarie.ItemsSource = listeSalarie;
                }
                else
                {
                    ListBoxSalarie.ItemsSource = listeSalarie.SalariesNomCommencePar(nomSalarie);
                }
            }
        }
Exemplo n.º 29
0
    private SalaryTaxData GetSalaryData(int year, int month, Organization organization)
    {
        SalaryTaxData result = new SalaryTaxData();

        Salaries salaries = Salaries.ForOrganization(organization, true);

        foreach (Salary salary in salaries)
        {
            if (salary.PayoutDate.Year == year && salary.PayoutDate.Month == month)
            {
                result.SalaryTotal      += salary.GrossSalaryCents / 100.0;
                result.SalaryMain       += salary.GrossSalaryCents / 100.0;
                result.TaxSubtractive   += salary.SubtractiveTaxCents / 100.0;
                result.TaxAdditiveMain  += salary.AdditiveTaxCents / 100.0;
                result.TaxAdditiveTotal += salary.AdditiveTaxCents / 100.0;
                result.TaxTotal         += salary.TaxTotalCents / 100.0;
            }
        }

        return(result);
    }
Exemplo n.º 30
0
        private void AddSalaries(Person person, Organization organization)
        {
            TaskGroup group = new TaskGroup(TaskGroupType.AttestSalaries);

            // TODO: Loop over roles, get all open claims for roles where person can attest

            Salaries salaries = Salaries.ForOrganization(organization);

            foreach (Salary salary in salaries)
            {
                if (salary.AttestationExpectedBy.Identity == person.Identity && !salary.Attested)
                {
                    group.Tasks.Add(new TaskSalary(salary));
                }
            }

            if (group.Tasks.Count > 0)
            {
                Add(group);
            }
        }
Exemplo n.º 31
0
        public async Task <IActionResult> OnGetAsync(string returnUrl = null)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(LocalRedirect("/"));
            }

            MDMSUserServiceModel user = _userService.GetAllUsers()
                                        .Include(x => x.Salaries)
                                        .Include(x => x.ExternalRepairs)
                                        .Include(x => x.InternalRepairs)
                                        .SingleOrDefault(x => x.Id == _userManager.GetUserId(User)).To <MDMSUserServiceModel>();
            var user1 = await Task.Run((() => _userManager.GetUserAsync(User).Result.To <MDMSUserServiceModel>()));

            FirstName  = user.FirstName;
            LastName   = user.LastName;
            BaseSalary = user.BaseSalary;
            AdditionalOnHourPayment = user.AdditionalOnHourPayment;
            IsAuthorized            = user.IsAuthorized;

            foreach (var salary in user.Salaries)
            {
                Salaries.Add(salary.To <MonthlySalaryViewModel>());
            }
            foreach (var intRep in user.InternalRepairs)
            {
                InternalRepairs.Add(intRep.To <InternalRepairViewModel>());
            }
            foreach (var extRep in user.ExternalRepairs)
            {
                ExternalRepairs.Add(extRep.To <ExternalRepairViewModel>());
            }


            returnUrl = returnUrl ?? Url.Content("~/");

            ReturnUrl = returnUrl;

            return(Page());
        }
Exemplo n.º 32
0
        /// <summary>
        /// sauvegarde ou modifie le salarié
        /// </summary>
        private void SauvegardeSalarie()
        {
            if (IsVerifChamp())
            {
                Salaries listeSal = new Salaries();

                StringBuilder sB = new StringBuilder(Paramètres.Default.path);
                sB.Append($@"\{listeSal.GetType().FullName}.Xml");

                Salarie s = new Salarie(TextBoxNom.Text.Trim(), TextBoxPrenom.Text.Trim(), TextBoxMatricule.Text.Trim())
                {
                    DateNaissance = (DateTime)(DatePickerDateDeNaissance.SelectedDate),
                    SalaireBrut   = decimal.Parse(TextBoxSalaireBrut.Text.Trim()),
                    TauxCS        = decimal.Parse(TextBoxTauxCotisationSociale.Text.Trim()),
                };
                s = (bool)CheckBoxCommercial.IsChecked ? new Commercial(s) : s;

                if (s is Commercial c)
                {
                    c.ChiffreAffaire = decimal.Parse(TextBoxChiffreDAffaire.Text.Trim());
                    c.Commission     = decimal.Parse(TextBoxCommission.Text.Trim());
                    s = c;
                }

                if (File.Exists(sB.ToString()))
                {
                    listeSal.Load(new SauvegardeXML(), Paramètres.Default.path);
                }

                if (listeSal.Contains(s)) // modification
                {
                    listeSal.Remove(s);
                }
                listeSal.Add(s);

                listeSal.Save(new SauvegardeXML(), Paramètres.Default.path);
                Clear();
                InitListBoxSalarie(string.Empty);
            }
        }
Exemplo n.º 33
0
    // ReSharper restore InconsistentNaming
    /// <summary>
    /// This function returns data for dropdowns and lists
    /// </summary>
    /// <param name="control"></param>
    /// <param name="type"></param>
    /// <param name="bClear"></param>
    /// <param name="bAddEmpty"></param>
    /// <param name="jobId"></param>
    /// <param name="userId"></param>
    /// <param name="clientId"></param>
    public static void FillData(this ListControl control, Type type, bool bClear = true, bool bAddEmpty = true, int jobId = 0, int userId = 0,int clientId = 0)
    {
        if (bClear) control.Items.Clear();
        if (bAddEmpty) control.Items.Add(new ListItem("-please select-", "0"));

        switch (type)
        {
            case Type.CLIENT_USERS:
                //retrieve
                var clientUsers = new ClientUsers().GetClientUsers(clientId);
                //bind
                foreach (var item in clientUsers) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.ClientUserId.ToString()));
                break;
            case Type.USER:
                //retrieve
                var users = new Users().GetUsers(0);
                //bind
                foreach (var item in users) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.UserId.ToString()));
                break;
            case Type.SECTOR:
                //retrieve
                var sectors = new Sectors().GetSectors(clientId,true);
                //bind
                foreach (var item in sectors) control.Items.Add(new ListItem(item.SectorText, item.SectorId.ToString()));
                break;
            case Type.CLIENT_STATUS:
                //retrieve
                var clientStatuses = new ClientStatuses().GetClientStatuses();
                //bind
                foreach (var item in clientStatuses) control.Items.Add(new ListItem(item.ClientStatusText, item.ClientStatusId.ToString()));
                break;
            case Type.SOURCE:
                //retrieve
                var sources = new Sources().GetSources();
                //bind
                foreach (var item in sources) control.Items.Add(new ListItem(item.SourceText, item.SourceId.ToString()));
                break;
            case Type.COUNTRY:
                //retrieve
                var countries = new Countries().GetCountries();
                //bind
                foreach (var item in countries) control.Items.Add(new ListItem(item.Title, item.Title));
                break;
            case Type.SALARY:
                var salaries = new Salaries().GetSalaries();
                foreach (var item in salaries) control.Items.Add(new ListItem(item.SalaryValue.ToString("C0"), item.SalaryId.ToString()));
                break;
            case Type.HOURS:
                control.Items.Add(new ListItem("Full Time", "Full Time"));
                control.Items.Add(new ListItem("Part Time", "Part Time"));
                break;
            case Type.VACANCY_TYPE:
                control.Items.Add(new ListItem("Permanent", "Permanent"));
                control.Items.Add(new ListItem("Contract/Interim", "Contract/Interim"));
                control.Items.Add(new ListItem("Freelance", "Freelance"));
                control.Items.Add(new ListItem("Temporary/Seasonal", "Temporary/Seasonal"));
                break;
            case Type.USER_TYPE:
                var userTypes = new Users().GetUserTypes();
                foreach (var item in userTypes) control.Items.Add(new ListItem(item.UserTypeText, item.UserTypeId.ToString()));
                break;
            case Type.APPLICATION_STATUS:
                var appStatus = new ApplicationStatuses().GetApplicationStatuses(new ApplicationStatusFilter { JobId = jobId });
                foreach (var item in appStatus) control.Items.Add(new ListItem(item.StatusName, item.ApplicationStatusId.ToString()));
                break;

            case Type.CLIENT_GROUPS:
                var clientGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CLIENT" });
                foreach (var item in clientGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString()));
                break;

            case Type.CONTACT_GROUPS:
                var contactGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CONTACT" });
                foreach (var item in contactGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString()));
                break;
        }
    }