예제 #1
0
        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");
        }