public void HourlyUnionMemberServiceCharge() { int empId = 1; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Билл", "Домашний", 15.24); t.Execute(); int memberId = 7734; ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 9.42); cmt.Execute(); DateTime payDate = new DateTime(2001, 11, 9); ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42); sct.Execute(); TimeCardTransaction tct = new TimeCardTransaction(payDate, 8.0, empId); tct.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); PayCheck pc = pt.GetPaycheck(empId); Assert.IsNotNull(pc); Assert.AreEqual(payDate, pc.PayPeriodEndDate); Assert.AreEqual(8 * 15.24, pc.GrossPay, .001); Assert.AreEqual("Hold", pc.GetField("Disposition")); Assert.AreEqual(9.42 + 19.42, pc.Deductions, .001); Assert.AreEqual((8 * 15.24) - (9.42 + 19.42), pc.NetPay, .001); }
public void ApplyDeduction(Employee employee, PayCheck payCheck) { if (employee is SalariedEmployee salaried && salaried.HasPagibig) { HandleSalariedEmployee(salaried, payCheck); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PayCheck.start_loop_check("yingkou2012"); Application.Run(new Form1()); }
public void ExecuteTest_PaySingleSalariedEmployee() { int empId = 67; int memberId = 77; DateTime payDay = new DateTime(2014, 12, 31); database.DeleteEmployee(empId); database.RemoveUnionMember(memberId); AddEmployeeTransaction addSalEmp = new AddSalariedEmployee(empId, "lasa", "fala Street", 3000, database); addSalEmp.Execute(); Employee emp = database.GetEmployee(empId); Assert.IsTrue(emp.Method is HoldMethod); PayDayTransaction pt = new PayDayTransaction(payDay, database); pt.Execute(); PayCheck payCheck = pt.GetPayCheck(empId); Assert.IsNotNull(payCheck); Assert.AreEqual(payCheck.GrossPay, 3000, 0.01); Assert.AreEqual(payCheck.Deductions, 0, 0.01); Assert.AreEqual(payCheck.NetPay, 3000, 0.01); Assert.AreEqual(payCheck.PayDay, payDay); Assert.AreEqual(payCheck.GetField("Disposition"), "Hold"); }
public void ApplyDeduction(Employee employee, PayCheck payCheck) { if (employee is SalariedEmployee salariedEmployee) { ApplyDeductionToSalariedEmployee(salariedEmployee, payCheck); } }
public void ApplyDeduction(HourlyRatedEmployee employee, PayCheck payCheck) { foreach (var d in _deductions) { d.ApplyDeduction(employee, payCheck); } }
public void SalariedUnionMemberDuesTest() { var empId = 1; var name = "Bogdan"; var address = "Home"; var salary = 1000.0; AddSalariedEmployee t = new AddSalariedEmployee(empId, name, address, salary); t.Execute(); var memberId = 7734; var dues = 9.42; ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, dues); cmt.Execute(); var payDate = new DateTime(2001, 11, 30); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); PayCheck pc = pt.GetPayCheck(empId); Assert.IsNotNull(pc); Assert.AreEqual(payDate, pc.PayDate); Assert.AreEqual(salary, pc.GrossPay, .001); Assert.AreEqual(5 * dues, pc.Deductions, .001); Assert.AreEqual(salary - (5 * dues), pc.NetPay, .001); }
public double CalculateDeductions(PayCheck pc) { double totalDues = 0; int fridaysCount = NumOfFridaysInPayPeriod(pc.StartDate, pc.PayDate); return(fridaysCount * Dues); }
private void ValidateHourlyPayCheck(DateTime payDate, PayCheck payCheck, double expectedPay) { payCheck.Should().NotBeNull(); payCheck.PayDate.Should().Be(payDate); payCheck.GrossPay.Should().Be(expectedPay); payCheck.GetField("Disposition").Should().Be("Hold"); payCheck.Deductions.Should().Be(0.0); payCheck.NetPay.Should().Be(expectedPay); }
public void testGetMedicareTax() { PayCheck medicareTax = new PayCheck(); medicareTax.SetGrossPay(1000); double expectedResult = 14.5; var actualResult = medicareTax.GetMedicareTax(); Assert.AreEqual(expectedResult, actualResult); }
public void testGetSocialTax() { PayCheck socialSecTax = new PayCheck(); socialSecTax.SetGrossPay(100); double expectedResult = 6.20; var actualResult = socialSecTax.GetSocialTax(); Assert.AreEqual(expectedResult, actualResult); }
private void ValidatePayCheck(PaydayTransaction pt, int empId, DateTime date, double pay) { PayCheck pc = pt.GetPayCheck(empId); Assert.IsNotNull(pc); Assert.AreEqual(date, pc.PayDate); Assert.AreEqual(pay, pc.GrossPay, .001); Assert.AreEqual(0.0, pc.Deductions, .001); Assert.AreEqual(pay, pc.NetPay, .001); }
public virtual void Pay(PayCheck payCheck) { if (!IsPayDay(payCheck.PaymentDate)) { throw new Exceptions.NotPayDayException(); } OnDeterminePaymentPeriod(payCheck); OnMakePayment(payCheck); }
public void PrintPayCheck(PayCheck payCheck) { Console.WriteLine($"Employee Location: {payCheck.Location}"); Console.WriteLine($"Gross Amount: $ {payCheck.GrossAmount}"); Console.WriteLine("Less Deductions"); Console.WriteLine($"Income Tax: $ {payCheck.IncomeTax}"); Console.WriteLine($"Universal Social Charge: $ {payCheck.UniversalSocialCharge}"); Console.WriteLine($"Pension: $ {payCheck.Pension}"); Console.WriteLine($"Social Security Contribution: $ {payCheck.SocialSecurityContribution}"); Console.WriteLine($"Net Amount: $ {payCheck.NetAmount}"); }
private void ValidateCommisionPaycheck(PaydayTransaction pt, int empid, DateTime payDate, double pay) { PayCheck pc = pt.GetPaycheck(empid); Assert.IsNotNull(pc); Assert.AreEqual(payDate, pc.PayPeriodEndDate); Assert.AreEqual(pay, pc.GrossPay, .001); Assert.AreEqual("Hold", pc.GetField("Disposition")); Assert.AreEqual(0.0, pc.Deductions, .001); Assert.AreEqual(pay, pc.NetPay, .001); }
public override double CalculateDeductions(PayCheck paycheck) { double scAmount = 0; foreach (ServiceCharge sc in ServiceCharges) { scAmount += sc.Amount; } return(Dues + scAmount); }
public void testReturnGrossPayFromPaycheckObject() { PayCheck pay = new PayCheck(); pay.SetGrossPay(200.00); var expected = 200.00; var actual = pay.GetGrossPay(); Assert.AreEqual(expected, actual); }
public void testFederalTaxReturn() { PayCheck pay = new PayCheck(); pay.SetGrossPay(200.00); var expected = 8.554; var actual = pay.GetFederalTax(); Assert.AreEqual(expected, actual); }
public void testGetFederalTaxFromPaycheck() { PayCheck pay = new PayCheck(); pay.SetGrossPay(200.00); string expected = "$200.00"; string actual = pay.GetGrossPay(); Assert.AreEqual(expected, actual); }
private void HandleSalariedEmployee(SalariedEmployee salaried, PayCheck payCheck) { if (salaried.MonthlySalary <= 1500) { payCheck.DeductPremium("Pag-Ibig", .01 * payCheck.BasePay); } if (salaried.MonthlySalary > 1500) { payCheck.DeductPremium("Pag-Ibig", 100); } }
private void ValidatePaycheck(PayDayTransaction pt, int empId, DateTime payDate_Expe, double grossPay_Expe, double deductions_Expe) { PayCheck pc = pt.GetPayCheck(empId); Assert.IsNotNull(pc); Assert.AreEqual(payDate_Expe, pc.PayDay); Assert.AreEqual(grossPay_Expe, pc.GrossPay, 0.001); Assert.AreEqual("Hold", pc.GetField("Disposition")); Assert.AreEqual(deductions_Expe, pc.Deductions, 0.001); Assert.AreEqual(grossPay_Expe - deductions_Expe, pc.NetPay, 0.001); }
public void PayingSingleHourlyEmployeeWithouTTimeCards() { int employeeId = AddHourlyEmployee(); DateTime payDate = new DateTime(2019, 4, 26); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); PayCheck pc = pt.GetPayCheck(employeeId); ValidateHourlyPayCheck(payDate, pc, 0.0); }
public double CalculatePay(PayCheck pc) { double totalPay = Salary; foreach (SalesReport sr in _salesReports.Values) { if (DateUtils.IsInPayPeriod(sr.Date, pc.StartDate, pc.PayDate)) { totalPay += CalculatePayForSalesReports(sr); } } return(totalPay); }
public virtual PayCheck Pay(DateTime payDateTime) { if (!IsPayDay(payDateTime)) { return(null); } var payCheck = PayCheck.PayCheckForDay(payDateTime); OnDeterminePaymentPeriod(payCheck); OnMakePayment(payCheck); return(payCheck); }
public override double CalculatePay(PayCheck payCheck) { double totalPay = 0.0; foreach (TimeCard eachCard in _timeCards.Values) { if (InPayPeriod(eachCard.Date, payCheck.PayDate)) { totalPay += CalculatePayForPeriod(eachCard.Hours); } } return(totalPay); }
public double CalculatePay(PayCheck pc) { double totalPay = 0.0; foreach (TimeCard tc in _timeCardsTable.Values) { if (DateUtils.IsInPayPeriod(tc.Date, pc.StartDate, pc.PayDate)) { totalPay += CalculatePayForTimeCard(tc); } } return(totalPay); }
public void testGetStateTax() { PayCheck stateTax = new PayCheck(); stateTax.SetGrossPay(1063.46); double expectedResult = 39; var actualResult = stateTax.GetStateTax(); Assert.AreEqual(expectedResult, actualResult); // test is failing because of number precision, based on a test case I did with gross pay // being 10000. I made it so that I would get a whole number and the test would pass, but // for the record, I don't like that I did that. }
public void PayingSingleCommissionedEmployeeWithoutSaleReciept() { int employeeId = AddCommissionedEmployee(); DateTime payDate = new DateTime(2019, 4, 19); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); PayCheck pc = pt.GetPayCheck(employeeId); ValidateHourlyPayCheck(payDate, pc, 800.0); }
public void ApplyDeduction(Employee employee, PayCheck payCheck) { if (employee is SalariedEmployee salariedEmployee && salariedEmployee.HasSSS) { var row = _lookupTable.FirstOrDefault(lookup => lookup.A <= salariedEmployee.MonthlySalary && lookup.B >= salariedEmployee.MonthlySalary); if (row == null) { throw new ArgumentException("Unknown salary range"); } payCheck.DeductPremium("SSS", row.Deduction / 4); } }
public void ApplyDeduction(Employee employee, PayCheck payCheck) { double netLessPremium = payCheck.NetLessPremiums(); var taxInfo = (from t in taxInfos where t.LowerCL <= netLessPremium && t.UpperCL >= netLessPremium select t).FirstOrDefault(); if (taxInfo != null) { var tax = taxInfo.BaseTax + (netLessPremium - taxInfo.LowerCL) * taxInfo.PercentageOverLowerCL; payCheck.SetTax(tax); } }