Esempio n. 1
0
 public void AddIncrementallyAndRound(PayFx2[] rows, PayFxA topart)
 {
     base.AddIncrementallyAndRound(rows);
     foreach (var pr in rows)
     {
         topart.Add(pr);
     }
     topart.Rows.AddRange(rows);
 }
Esempio n. 2
0
 public void AddEqally(PayFx2[] rows, PayFxA topart)
 {
     base.AddEqally(rows);
     foreach (var pr in rows)
     {
         topart.Add(pr);
     }
     topart.Rows.AddRange(rows);
 }
Esempio n. 3
0
 public void InitParts(SalaryCalcTInfo pcti)
 {
     for (int i = 0; i < pcti.LinkedSCI.Length; i++)
     {
         var lsc     = pcti.LinkedSCI[i];
         var partpfx = new PayFxA();
         partpfx.SetFrom(this);
         lsc.PFxA         = partpfx;
         partpfx.Position = lsc.PositionTitle;
         Parts.Add(partpfx);
     }
 }
Esempio n. 4
0
        public void RecalcAndRound()
        {
            PAY_TAXED        = KlonsData.RoundA(PAY_TAXED, 2);
            PAY_NOSAI        = KlonsData.RoundA(PAY_NOSAI, 2);
            PAY_NOTTAXED     = KlonsData.RoundA(PAY_NOTTAXED, 2);
            NOTPAID_TAXED    = KlonsData.RoundA(NOTPAID_TAXED, 2);
            NOTPAID_NOSAI    = KlonsData.RoundA(NOTPAID_NOSAI, 2);
            NOTPAID_NOTTAXED = KlonsData.RoundA(NOTPAID_NOTTAXED, 2);
            PFNT             = KlonsData.RoundA(PFNT, 2);
            LIT  = KlonsData.RoundA(LIT, 2);
            HIT  = KlonsData.RoundA(HIT, 2);
            PFT  = KlonsData.RoundA(PFT, 2);
            LINT = KlonsData.RoundA(LINT, 2);
            HINT = KlonsData.RoundA(HINT, 2);

            var pfx = new PayFx();

            SetTo(pfx);
            pfx.CalcAllAndRound();
            SetFrom(pfx);

            if (pfx.IinEx > 0.0M)
            {
                UNTAXED_MINIMUM  = KlonsData.RoundA(UNTAXED_MINIMUM, 2);
                IINEX_DEPENDANTS = KlonsData.RoundA(IINEX_DEPENDANTS, 2);
                IINEX2           = KlonsData.RoundA(IINEX2, 2);
                IINEX_EXP        = KlonsData.RoundA(IINEX_EXP, 2);
                var dd = new decimal[] { UNTAXED_MINIMUM, IINEX_DEPENDANTS, IINEX2, IINEX_EXP };
                PayFxA.MakeExactSum(pfx.UsedIinEx, dd);
                UNTAXED_MINIMUM  = dd[0];
                IINEX_DEPENDANTS = dd[1];
                IINEX2           = dd[2];
                IINEX_EXP        = dd[3];
            }

            CASH_NOTPAID = 0.0M;
            if (NOTPAID_TAXED == 0.0M && NOTPAID_NOSAI == 0.0M && NOTPAID_NOTTAXED == 0.0M)
            {
                return;
            }

            pfx.Pay   = Math.Min(PAY_TAXED, NOTPAID_TAXED);
            pfx.PayNs = Math.Min(PAY_NOSAI, NOTPAID_NOSAI);
            pfx.PayNt = Math.Min(PAY_NOTTAXED, NOTPAID_NOTTAXED);
            pfx.CalcAllAndRound();
            CASH_NOTPAID = pfx.Cash;
        }
Esempio n. 5
0
        public void MakeExactIINExSplit()
        {
            var dd1 = new[] {
                TotalSI._IIN_EXEMPT_UNTAXED_MINIMUM,
                TotalSI._IIN_EXEMPT_DEPENDANTS,
                TotalSI._IIN_EXEMPT_INVALIDITY,
                TotalSI._IIN_EXEMPT_NATIONAL_MOVEMENT,
                TotalSI._IIN_EXEMPT_RETALIATION,
                TotalSI._IIN_EXEMPT_EXPENSES
            };

            var dd2 = PFxB.Parts.Select(d => d.UsedIinEx).ToArray();

            var dd = PayFxA.MakeExactSplit(dd1, dd2);

            for (int i = 0; i < LinkedSCI.Length; i++)
            {
                var lsc = LinkedSCI[i];
                var si  = lsc.SI;
                si._IIN_EXEMPT_UNTAXED_MINIMUM   = dd[0, i];
                si._IIN_EXEMPT_DEPENDANTS        = dd[1, i];
                si._IIN_EXEMPT_INVALIDITY        = dd[2, i];
                si._IIN_EXEMPT_NATIONAL_MOVEMENT = dd[3, i];
                si._IIN_EXEMPT_RETALIATION       = dd[4, i];
                si._IIN_EXEMPT_EXPENSES          = dd[5, i];

                si._IIN_EXEMPT_2 =
                    si._IIN_EXEMPT_INVALIDITY +
                    si._IIN_EXEMPT_NATIONAL_MOVEMENT +
                    si._IIN_EXEMPT_RETALIATION;

                lsc.CalcR.ExDivided.SetFrom(si);
                lsc.CalcR.ExCorrect.SetFrom(lsc.CalcR.ExDivided);
                lsc.CalcR.SaveStateForFinal(CalcR.ExCorrect);
                lsc.CalcR.AddToListT();
                lsc.CalcR.PrepareList();
            }
        }
Esempio n. 6
0
        public ErrorList FillRow()
        {
            if (SR.Row.XType == ESalarySheetRowType.Total)
            {
                return(SR.FillRowX());
            }

            if (PreparingReport)
            {
                SI._CALC_VER = SR.Row.CALC_VER;
            }
            else
            {
                SI._CALC_VER = 2;
            }

            var dt1 = SR.SalarySheet.DT1;
            var dt2 = SR.SalarySheet.DT2;

            var err_list = new ErrorList();

            SR.CheckAlgasPS();

            MakeWorkTime();
            CalcRR(dt1, dt2, SI._CALC_VER);

            if (SR.IsSingleRow())
            {
                BonusCalc = new BonusCalcInfo(CalcR, SR.GetAlgasAllPSRows(), PreparingReport);
            }
            else
            {
                BonusCalc = new BonusCalcInfo(CalcR, SR.GetAlgasPSRowsX(SR.Row.IDAM), PreparingReport);
            }

            PFxA          = new PayFxA();
            PFxA.Position = PositionTitle;
            PFxA.SetFrom(CalcR);

            var pfxs1 = BonusCalc.CalcNotProc(SI, 0, 1);

            BonusCalc.CalcFromEndA(1);

            var pfxs2 = BonusCalc.CalcProc(SI, EBonusFrom.FromMonthSalary, SI.PlanedWorkPay);
            var pfxs3 = BonusCalc.CalcProc(SI, EBonusFrom.FromPay, SI._SALARY);

            SI._FORAVPAYCALC_BRUTO += BonusCalc.ForAvpayCalc;

            PFxA.TempRows0.AddRange(pfxs1);
            PFxA.TempRows0.AddRange(pfxs2);
            PFxA.TempRows0.AddRange(pfxs3);

            decimal avpay1 =
                SI._SALARY_AVPAY_FREE_DAYS +
                SI._SALARY_AVPAY_WORK_DAYS +
                SI._SALARY_AVPAY_WORK_DAYS_OVERTIME +
                SI._SALARY_AVPAY_HOLIDAYS +
                SI._SALARY_AVPAY_HOLIDAYS_OVERTIME;

            //vid.izpeïòas dienas, slimîbas, atvaïinājuma nauda
            var err = FillRowVcSdc();

            if (err.HasErrors)
            {
                return(err_list);
            }

            decimal avpay2 =
                SI._SALARY_AVPAY_FREE_DAYS +
                SI._SALARY_AVPAY_WORK_DAYS +
                SI._SALARY_AVPAY_WORK_DAYS_OVERTIME +
                SI._SALARY_AVPAY_HOLIDAYS +
                SI._SALARY_AVPAY_HOLIDAYS_OVERTIME;

            //PFxA.DoPayFxA_AvPay(avpay2 - avpay1);

            decimal pay1 =
                SI._SALARY +
                SI._SALARY_AVPAY_FREE_DAYS +
                SI._SICKDAYS_PAY +
                SI._VACATION_PAY_CURRENT;

            pfxs1 = BonusCalc.CalcProc(SI, EBonusFrom.FromPayAndVacSick, pay1);

            decimal payBeforeSAI =
                pay1 +
                SI._PLUS_TAXED;

            SI._AMOUNT_BEFORE_SN = payBeforeSAI;

            pfxs2 = BonusCalc.CalcProc(SI, EBonusFrom.FromPayBeforeSAI, payBeforeSAI);

            PFxA.TempRows1.AddRange(pfxs1);
            PFxA.TempRows1.AddRange(pfxs2);

            CalcSAI();

            decimal payAfterSAI =
                SI._AMOUNT_BEFORE_SN -
                SI._DNSN_AMOUNT;

            pfxs3 = BonusCalc.CalcProc(SI, EBonusFrom.FromPayAfterSAI, payAfterSAI);
            PFxA.TempRows1.AddRange(pfxs3);

            payAfterSAI =
                payAfterSAI +
                SI._PLUS_NOSAI +
                SI._PLUS_AUTHORS_FEES -
                SI._MINUS_BEFORE_IIN;

            SI._AMOUNT_BEFORE_IIN = payAfterSAI; // pay before iin exempts


            //neto bonus -> bruto
            decimal curbruto =
                SI._AMOUNT_BEFORE_SN -
                SI._PLUS_NOSAI +
                SI._PLUS_AUTHORS_FEES -
                SI._MINUS_BEFORE_IIN;

            decimal iinexempts1  = SI.SumIINExemptsAll();
            decimal payBeforeIIN = payAfterSAI - iinexempts1;

            SI._AMOUNT_BEFORE_IIN = payBeforeIIN;

            //-- useless
            //BonusCalc.CalcProc(SI, EBonusFrom.FromPayBeforeIIN, payBeforeIIN);

            decimal iinexempts1a = iinexempts1;

            decimal iinexempts1b = iinexempts1;

            List <PayFx2> rpfx             = null;
            var           plusfromendbruto = BonusCalc.CalcFromEndC(si: SI,
                                                                    totalinex: iinexempts1,
                                                                    curbruto: curbruto,
                                                                    brutonosai: SI._PLUS_NOSAI,
                                                                    brutomargin: CalcR.IINMargin,
                                                                    useprogressiveiin: CalcR.UseProgresiveIINRate,
                                                                    hastaxdoc: CalcR.HasTaxDoc,
                                                                    iinrate1: SI._RATE_IIN,
                                                                    iinrate2: SI._RATE_IIN2,
                                                                    dnsrate: SI._RATE_DNSN,
                                                                    divby: SR.GetLinkedRowsCount(),
                                                                    rpfx: out rpfx);

            PFxA.TempRows1.AddRange(rpfx);

            if (plusfromendbruto != 0.0M)
            {
                CalcSAI();

                payAfterSAI =
                    SI._AMOUNT_BEFORE_SN -
                    SI._DNSN_AMOUNT +
                    SI._PLUS_NOSAI +
                    SI._PLUS_AUTHORS_FEES -
                    SI._MINUS_BEFORE_IIN;
            }

            CalcIIN();

            SI._TOTAL_BEFORE_TAXES =
                SI._AMOUNT_BEFORE_SN +
                SI._PLUS_NOTTAXED +
                SI._PLUS_NOSAI +
                SI._PLUS_AUTHORS_FEES;

            SI._PAY =
                SI._TOTAL_BEFORE_TAXES -
                SI._DNSN_AMOUNT -
                SI._IIN_AMOUNT;

            pfxs1 = BonusCalc.CalcNotProc(SI, 1, 1);
            pfxs2 = BonusCalc.CalcProc(SI, EBonusFrom.FromPayAfterIIN, SI._PAY);

            PFxA.TempRows2.AddRange(pfxs1);
            PFxA.TempRows2.AddRange(pfxs2);


            PFxA.IinEx = SI.SumIINExemptsAll();

            PFxA.DoPayFxA_Salary(SI._SALARY);
            PFxA.DoPayFxA_Bonus(PFxA.TempRows0);
            PFxA.DoPayFxA_AvPay(SI._SALARY_AVPAY_FREE_DAYS);
            PFxA.DoPayFxA_SickPay(SI._SICKDAYS_PAY);
            PFxA.DoPayFxA_Vacation(SI._VACATION_PAY_CURRENT, SI._VACATION_PAY_PREV);
            CorrectVacCash();
            PFxA.DoPayFxA_Bonus(PFxA.TempRows1);
            PFxA.DoPayFxA_BonusSimpleAdd(PFxA.TempRows2);

            var cashNotPaid = BonusCalc.CalcCashNotPaid(SI, SI._RATE_IIN, SI._RATE_DNSN);

            BonusCalc.CalcCash();


            //viens no diviem variantiem
            //SI._MINUS_AFTER_IIN += cashNotPaid;
            SI._MINUS_AFTER_IIN +=
                SI._PLUS_NP_TAXED +
                SI._PLUS_NP_NOTTAXED +
                SI._PLUS_NP_NOSAI;

            //---Negatîva izmaksājamā summa ir OK
            SI._VACATION_ADVANCE_CURRENT = -SI._VACATION_ADVANCE_PREV;

            SI._VACATION_ADVANCE_NEXT =
                SI._VACATION_ADVANCE_PREV +
                SI._VACATION_ADVANCE_CURRENT +
                SI._VACATION_CASH_NEXT;

            SI._ADVANCE = SI._VACATION_CASH_NEXT + SI._VACATION_ADVANCE_CURRENT;

            SI._PAYT =
                SI._PAY +
                SI._ADVANCE -
                SI._MINUS_AFTER_IIN;

            SI._FORAVPAYCALC_PAYOUT = SI._PAY;

            SI._PAY0 = CalcPay0();

            SI._URVN_AMAOUNT = CalcURVN();


            return(err_list);
        }
Esempio n. 7
0
 public virtual void SetFrom(PayFxA from)
 {
     base.SetFrom(from);
     Position = from.Position;
 }