コード例 #1
0
ファイル: Form1.cs プロジェクト: Precigus/Salary-Calculator
        private void HandSalary()
        {
            Calcs calc = new Calcs();


            double.TryParse(txt2HandSalary.Text, out double salary);
            double.TryParse(mtxtMinSalary.Text, out double minSalary);
            double.TryParse(mtxtIncomeTaxInput.Text, out double incTaxInput);
            double.TryParse(mtxtNpdInput.Text, out double npdInput);
            double.TryParse(mtxtPnpdInput.Text, out double pnpdInput);
            double.TryParse(mtxtHealthInsInput.Text, out double healthInsInput);
            double.TryParse(mtxtSocInsInput.Text, out double socInsInput);
            double.TryParse(mtxtEmployerTaxInput.Text, out double employerTaxInput);
            double.TryParse(mtxtAuthRightsInput.Text, out double authRightsInput);
            int.TryParse(cbox2ChildCount.Text, out int childCount);
            double.TryParse(mtxt2AuthRightsIncome.Text, out double authRights);


            calc.SetSalary(salary);
            calc.SetMinSalary(minSalary);
            calc.SetIncomeTaxInput(incTaxInput);
            calc.SetNpdInput(npdInput);
            calc.SetPnpdInput(pnpdInput);
            calc.SetHealthInsuranceInput(healthInsInput);
            calc.SetSocInsuranceInput(socInsInput);
            calc.SetEmployerTaxInput(employerTaxInput);
            calc.SetAuthRightsTaxInput(authRightsInput);
            calc.SetChild(childCount);
            calc.SetParents(rbtn2OneParent.Checked);
            calc.SetAuthRightsCheckbox(chk2AuthRightsIncome.Checked);
            calc.SetAuthRightsIncome(authRights);


            Calcs handSalary = new CalcsHand(calc.GetSalary(), calc.GetChild(), calc.GetParents(), calc.GetIncomeTaxInput(), calc.GetNpdInput(),
                                             calc.GetPnpdInput(), calc.GetMinSalary(), calc.GetHealthInsuranceInput(), calc.GetSocInsuranceInput(),
                                             calc.GetEmployerTaxInput(), calc.GetAuthRightsCheckbox(), calc.GetAuthRightsIncome(), calc.GetAuthRightsTaxInput());

            handSalary.CalculateSalary();

            mtxt2Npd.Text             = handSalary.GetNpd().ToString("N2");
            mtxt2Pnpd.Text            = handSalary.GetPnpd().ToString("N2");
            mtxt2IncomeTax.Text       = handSalary.GetIncomeTax().ToString("N2");
            mtxt2HealthInsurance.Text = handSalary.GetHealthInsurance().ToString("N2");
            mtxt2SocInsurance.Text    = handSalary.GetSocInsurance().ToString("N2");
            mtxt2EmployerTax.Text     = handSalary.GetEmployerTax().ToString("N2");
            mtxt2WorkCost.Text        = handSalary.GetWorkCost().ToString("N2");
            if (chk2AuthRightsIncome.Checked)
            {
                mtxt2AuthRightsIncomeTax.Text = handSalary.GetAuthRightsTax().ToString("N2");
            }
            mtxt2PaperSalary.Text = handSalary.GetSalaryOnPaper().ToString("N2");
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Precigus/Salary-Calculator
        private void PaperSalary()
        {
            double.TryParse(txt1PaperSalary.Text, out double salary);
            double.TryParse(mtxtMinSalary.Text, out double minSalary);
            double.TryParse(mtxtIncomeTaxInput.Text, out double incTaxInput);
            double.TryParse(mtxtNpdInput.Text, out double npdInput);
            double.TryParse(mtxtPnpdInput.Text, out double pnpdInput);
            double.TryParse(mtxtHealthInsInput.Text, out double healthInsInput);
            double.TryParse(mtxtSocInsInput.Text, out double socInsInput);
            double.TryParse(mtxtEmployerTaxInput.Text, out double employerTaxInput);
            double.TryParse(mtxtAuthRightsInput.Text, out double authRightsInput);
            int.TryParse(cbox1ChildCount.Text, out int childCount);
            double.TryParse(mtxt1AuthRightsIncome.Text, out double authRights);

            Calcs calc = new Calcs();

            calc.SetSalary(salary);
            calc.SetMinSalary(minSalary);
            calc.SetIncomeTaxInput(incTaxInput);
            calc.SetNpdInput(npdInput);
            calc.SetPnpdInput(pnpdInput);
            calc.SetHealthInsuranceInput(healthInsInput);
            calc.SetSocInsuranceInput(socInsInput);
            calc.SetEmployerTaxInput(employerTaxInput);
            calc.SetAuthRightsTaxInput(authRightsInput);
            calc.SetChild(childCount);
            calc.SetParents(rbtn1OneParent.Checked);
            calc.SetAuthRightsCheckbox(chk1AuthRightsIncome.Checked);
            calc.SetAuthRightsIncome(authRights);

            calc.CalculateSalary();

            mtxt1Npd.Text             = calc.GetNpd().ToString("N2");
            mtxt1Pnpd.Text            = calc.GetPnpd().ToString("N2");
            mtxt1IncomeTax.Text       = calc.GetIncomeTax().ToString("N2");
            mtxt1HealthInsurance.Text = calc.GetHealthInsurance().ToString("N2");
            mtxt1SocInsurance.Text    = calc.GetSocInsurance().ToString("N2");
            mtxt1EmployerTax.Text     = calc.GetEmployerTax().ToString("N2");
            mtxt1WorkCost.Text        = calc.GetWorkCost().ToString("N2");
            if (chk1AuthRightsIncome.Checked)
            {
                mtxt1AuthRightsIncomeTax.Text = calc.GetAuthRightsTax().ToString("N2");
            }
            mtxt1InHandSalary.Text = calc.GetSalary().ToString("N2");
        }