Exemplo n.º 1
0
        public string INSS()
        {
            tb_financial financial = DB.tb_financial.First(t => t.id_emp == id);

            double bruto = Convert.ToDouble(financial.vl_grossSalary);

            if (bruto <= 1659.38)
            {
                inss = bruto * 0.08;
            }
            if (bruto > 1659.38 && bruto <= 2765.66)
            {
                inss = bruto * 0.09;
            }
            if (bruto >= 2765.67 && bruto <= 5531.31)
            {
                inss = bruto * 0.11;
            }
            if (bruto > 5531.31)
            {
                inss = 00.00;
            }

            SL = SL - inss;
            return("R$ " + inss.ToString());
        }
Exemplo n.º 2
0
        public string FGTS()
        {
            tb_financial F    = DB.tb_financial.First(t => t.id_emp == id);
            double       fgts = Convert.ToDouble(F.vl_grossSalary) * 0.08;

            return("R$ " + fgts.ToString());
        }
Exemplo n.º 3
0
 public void Remover(tb_employees emp, tb_deptfunction defu, tb_timecard ticd,
                     tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis)
 {
     defuB.Remover(defu);
     ticdB.Remover(ticd);
     finB.Remover(fin);
     benB.Remover(ben);
     bankB.Remover(bank);
     disB.Remover(dis);
     db.Remover(emp);
 }
Exemplo n.º 4
0
        private void LoadControls()
        {
            int id = EmployeesModel.ID;

            EmployeesDatabase    DBemp  = new EmployeesDatabase();
            DeptFunctionDatabase DBdefu = new DeptFunctionDatabase();
            TimeCardDatabase     DBticd = new TimeCardDatabase();
            FinancialDatabase    DBfin  = new FinancialDatabase();
            BenefitsDatabase     DBben  = new BenefitsDatabase();
            BankAccountDatabase  DBbank = new BankAccountDatabase();
            DiscountsDatabase    DBdis  = new DiscountsDatabase();

            tb_employees    emp  = DBemp.ConsultarPorID(id);
            tb_deptfunction defu = DBdefu.ConsultarPorID(id);
            tb_timecard     ticd = DBticd.ConsultarPorID(id);
            tb_financial    fin  = DBfin.ConsultarPorID(id);
            tb_benefits     ben  = DBben.ConsultarPorID(id);
            tb_bankaccount  bank = DBbank.ConsultarPorID(id);
            tb_discounts    dis  = DBdis.ConsultarPorID(id);

            if (emp == null)
            {
                return;
            }

            dtpContratação.Value       = Convert.ToDateTime(emp.dt_hiring);
            dtpDemissão.Value          = Convert.ToDateTime(emp.dt_resignation);
            cboDepartamento.Text       = defu.nm_department;
            cboCargo.Text              = defu.nm_function;
            nudSalárioBruto.Value      = fin.vl_grossSalary;
            chkValeTransporte.Checked  = ben.bt_transport;
            chkValeAlimentação.Checked = ben.bt_food;
            chkValeRefeição.Checked    = ben.bt_meal;
            chkSeguroDeVida.Checked    = ben.bt_lifeSafe;
            chkPlanoDeSáude.Checked    = ben.bt_planHealth;
            chkPlanoDental.Checked     = ben.bt_planDental;
            nudTarifa.Value            = Convert.ToDecimal(ben.vl_transport);
            nudValeAlimentação.Value   = Convert.ToDecimal(ben.vl_food);
            nudValeRefeição.Value      = Convert.ToDecimal(ben.vl_meal);
            nudSeguroDeVida.Value      = Convert.ToDecimal(ben.vl_lifeSafe);
            nudPlanoDeSáude.Value      = Convert.ToDecimal(ben.vl_planHealth);
            nudPlanoDental.Value       = Convert.ToDecimal(ben.vl_planDental);
            txtNomeDoBanco.Text        = bank.nm_bank;
            mtxtAgência.Text           = bank.nr_agency.ToString();
            mtxtConta.Text             = bank.nr_account;
            cboTipoDePessoa.Text       = bank.ds_typePerson;
            nudPensãoAlimentícia.Value = Convert.ToDecimal(dis.vl_foodPension);
            cboTipoDeSalário.Text      = fin.ds_typeSalary;
            mtxtEntrada.Text           = ticd.hr_fixedInput;
            mtxtSaída.Text             = ticd.hr_fixedOutput;
            mtxtInícioInt.Text         = ticd.hr_fixedIntInput;
            mtxtFinalInt.Text          = ticd.hr_fixedIntOutput;
        }
Exemplo n.º 5
0
        private void Insirir(tb_employees emp, tb_deptfunction defu, tb_timecard ticd,
                             tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis)
        {
            int id = db.Insirir(emp);

            defuB.Insirir(defu, id);
            ticdB.Insirir(ticd, id);
            finB.insirir(fin, id);
            benB.Insirir(ben, id);
            bankB.Insirir(bank, id);
            disB.insirir(dis, id);
        }
Exemplo n.º 6
0
        public string VericarParametros(tb_financial fin)
        {
            if (fin.vl_grossSalary == Convert.ToDecimal(0.0))
            {
                return("Salário Obrigatório!");
            }
            if (fin.ds_typeSalary == string.Empty)
            {
                return("Tipo de Salário Obrigatório!");
            }

            return(string.Empty);
        }
Exemplo n.º 7
0
        private tb_financial ReadFinancial()
        {
            tb_financial fin = new tb_financial();

            fin.vl_grossSalary = nudSalárioBruto.Value;
            fin.dt_fromDate    = DateTime.Now.ToShortDateString();
            fin.dt_toDate      = "01/01/9998";
            fin.ds_typeSalary  = cboTipoDeSalário.Text;
            fin.dt_fromDate    = DateTime.Now.ToString("dd/MM/yyyy");
            fin.dt_toDate      = "01/01/9998";

            return(fin);
        }
Exemplo n.º 8
0
        private void Alterar(tb_employees emp, tb_deptfunction defu, tb_timecard ticd,
                             tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis)
        {
            int id = EmployeesModel.ID;

            defuB.Alterar(defu, id);
            ticdB.Alterar(ticd, id);
            finB.Alterar(fin, id);
            benB.Alterar(ben, id);
            bankB.Alterar(bank, id);
            disB.Alterar(dis, id);
            db.Alterar(emp, id);
        }
Exemplo n.º 9
0
        public string UpdateEmployee(tb_employees emp, tb_deptfunction defu, tb_timecard ticd,
                                     tb_financial fin, tb_benefits ben, tb_bankaccount bank, tb_discounts dis)
        {
            string error = string.Empty;

            if (error == string.Empty)
            {
                error = this.VericarParametros(emp);
            }

            if (error == string.Empty)
            {
                error = defuB.VericarParametros(defu);
            }

            if (error == string.Empty)
            {
                error = ticdB.VericarParametros(ticd);
            }

            if (error == string.Empty)
            {
                error = finB.VericarParametros(fin);
            }

            if (error == string.Empty)
            {
                error = benB.VericarParametros(ben);
            }

            if (error == string.Empty)
            {
                error = bankB.VericarParametros(bank);
            }

            if (error == string.Empty)
            {
                error = disB.VericarParametros(dis);
            }

            if (error == string.Empty)
            {
                this.Alterar(emp, defu, ticd, fin, ben, bank, dis);
                return("Alterado com sucesso!");
            }
            else
            {
                return(error);
            }
        }
Exemplo n.º 10
0
        public void SaveFinancials(TurnKeyBrokerSignUpDataContext dataContext, int accountId,
                                   string annual_income,
                                   string tax_rate,
                                   string net_worth,
                                   string liquid_net_worth,
                                   string annual_expense,
                                   string special_expense,
                                   string special_expense_time, bool isDebug)
        {
            if (dataContext == null)
            {
                dataContext = new TurnKeyBrokerSignUpDataContext();
            }
            tb_financial financial;
            int          update       = 0;
            var          tb_financial = dataContext.tb_financials.Where(t => t.account_id == accountId).FirstOrDefault();

            if (tb_financial != null)
            {
                financial = tb_financial;
                update    = 1;
            }
            else
            {
                financial = new tb_financial();
            }

            financial.account_id           = accountId;
            financial.annual_income        = annual_income;
            financial.tax_rate             = tax_rate;
            financial.net_worth            = net_worth;
            financial.liquid_net_worth     = liquid_net_worth;
            financial.annual_expense       = annual_expense;
            financial.special_expense      = special_expense;
            financial.special_expense_time = special_expense_time;
            financial.date_created         = DateTime.Now;
            if (update == 0)
            {
                dataContext.tb_financials.InsertOnSubmit(financial);
            }
            if (!isDebug)
            {
                dataContext.SubmitChanges();
            }
        }
Exemplo n.º 11
0
        public string DeleteEmployee(int id)
        {
            tb_employees    emp  = ConsultarPorID(id);
            tb_deptfunction defu = defuB.ConsultarPorID(id);
            tb_timecard     ticd = ticdB.ConsultarPorID(id);
            tb_financial    fin  = finB.ConsultarPorID(id);
            tb_benefits     ben  = benB.ConsultarPorID(id);
            tb_bankaccount  bank = bankB.ConsultarPorID(id);
            tb_discounts    dis  = disB.ConsultarPorID(id);

            if (emp != null && defu != null && ticd != null && fin != null && ben != null && bank != null && dis != null)
            {
                this.Remover(emp, defu, ticd, fin, ben, bank, dis);
                return("Funcionário Removido com Sucesso!");
            }
            else
            {
                return("Funcionário Inexistente!");
            }
        }
Exemplo n.º 12
0
        public string ImpostoDeRenda()
        {
            tb_financial financial = DB.tb_financial.First(t => t.id_emp == id);
            tb_employees tb        = DB.tb_employees.First(t => t.id_emp == id);

            double bruto    = Convert.ToDouble(financial.vl_grossSalary);
            double IR       = 00.00;
            double aliquota = 00.00;
            double dedução  = 00.00;

            if (bruto <= 1903.98)
            {
                aliquota = 0.0;
                dedução  = 0.0;
            }
            if (bruto >= 1903.99 && bruto <= 2826.65)
            {
                aliquota = 0.075;
                dedução  = 142.80;
            }
            if (bruto >= 2826.66 && bruto <= 3751.05)
            {
                aliquota = 0.15;
                dedução  = 354.80;
            }
            if (bruto >= 3751.06 && bruto <= 4664.68)
            {
                aliquota = 0.225;
                dedução  = 636.13;
            }
            if (bruto >= 4664.69)
            {
                aliquota = 0.275;
                dedução  = 869.36;
            }

            double dependentes = tb.nr_dependents * 189.59;

            IR = ((bruto - dependentes - inss) * aliquota) - dedução;
            return("R$ " + IR.ToString());
        }
Exemplo n.º 13
0
        public string ValeTransporte(int ano, int mes)
        {
            Model.PayrollModel.Tarifa = Convert.ToDecimal(8.60);

            tb_benefits  tb = DB.tb_benefits.First(t => t.id_emp == id);
            tb_financial F  = DB.tb_financial.First(t => t.id_emp == id);

            if (tb.bt_transport == true)
            {
                int    qtdDiasUteis = this.QtdDeDiasUteis(ano, mes);
                double VL           = Convert.ToDouble(Model.PayrollModel.Tarifa) * qtdDiasUteis;
                double bruto        = Convert.ToDouble(F.vl_grossSalary);

                SL = bruto - (bruto * 0.06);
                return("R$ " + VL.ToString());
            }
            else
            {
                return("R$ 00,00");
            }
        }
Exemplo n.º 14
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                tb_employees    emp  = this.ReadEmployees();
                tb_deptfunction defu = this.ReadDeptFunction();
                tb_timecard     ticd = this.ReadTimeCard();
                tb_financial    fin  = this.ReadFinancial();
                tb_benefits     ben  = this.ReadBenefits();
                tb_bankaccount  bank = this.ReadBankAccount();
                tb_discounts    dis  = this.ReadDiscounts();

                EmployeesBusiness EB  = new EmployeesBusiness();
                string            res = EB.UpdateEmployee(emp, defu, ticd, fin, ben, bank, dis);

                MessageBox.Show(res, "liriou's Burguer", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ocorreu um erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 15
0
        public string SalárioFamília()
        {
            tb_employees tb        = DB.tb_employees.First(t => t.id_emp == id);
            tb_financial financial = DB.tb_financial.First(t => t.id_emp == id);

            double bruto = Convert.ToDouble(financial.vl_grossSalary);
            double SF;

            if (bruto <= 907.77)
            {
                SF = tb.nr_dependents * 46.54;
            }
            else if (bruto > 907.77 && bruto < 1364.43)
            {
                SF = tb.nr_dependents * 32.80;
            }
            else
            {
                SF = 00.00;
            }

            SL = SL + SF;
            return("R$ " + SL.ToString());
        }
Exemplo n.º 16
0
        public void insirir(tb_financial fin, int id)
        {
            fin.id_emp = id;

            db.Inserir(fin);
        }
Exemplo n.º 17
0
        public string Bruto()
        {
            tb_financial tb = DB.tb_financial.First(t => t.id_emp == id);

            return("R$ " + tb.vl_grossSalary);
        }
Exemplo n.º 18
0
 public void Remover(tb_financial fin)
 {
     db.Remover(fin);
 }
Exemplo n.º 19
0
        public void Alterar(tb_financial fin, int id)
        {
            fin.id_emp = id;

            db.Alterar(fin);
        }