private static List <PayStub> RetrievePayStubsTodayRepackage(DataTable myTable) { List <PayStub> paystubs = new List <PayStub>(); foreach (DataRow tempRow in myTable.Rows) { PayStub tmpPayStub = new PayStub(); tmpPayStub.PayStubID = Convert.ToInt32(tempRow["empId"]); tmpPayStub.GrossPay = Convert.ToDouble(tempRow["grossPay"]); tmpPayStub.Deductions = Convert.ToDouble(tempRow["deductions"]); tmpPayStub.CPP = Convert.ToDouble(tempRow["cPP"]); tmpPayStub.EI = Convert.ToDouble(tempRow["eI"]); tmpPayStub.CompanyPensionDeduction = Convert.ToDouble(tempRow["companyPensionDeduction"]); tmpPayStub.Netpay = Convert.ToDouble(tempRow["netPay"]); tmpPayStub.EmpID = Convert.ToInt32(tempRow["empID"]); tmpPayStub.CreationDate = Convert.ToDateTime(tempRow["creationDate"]); tmpPayStub.YTDGrossPay = Convert.ToDouble(tempRow["ytdGrossPay"]); tmpPayStub.YTDDeductions = Convert.ToDouble(tempRow["ytdDeductions"]); tmpPayStub.YTDCPP = Convert.ToDouble(tempRow["ytdCPP"]); tmpPayStub.YTDEI = Convert.ToDouble(tempRow["ytdEI"]); tmpPayStub.YTDCompanyPensionDeduction = Convert.ToDouble(tempRow["ytdCompanyPensionDeductions"]); tmpPayStub.YTDNetpay = Convert.ToDouble(tempRow["ytdNetPay"]); tmpPayStub.BiWeeklyRate = Math.Round(Convert.ToDouble(tempRow["biWeeklyRate"]), 2); paystubs.Add(tmpPayStub); } return(paystubs); }
public static PayStub RetrievePayStubByID(int ID) { DataTable tmpTable = SqlLayer.HRSQL.RetrieveTodaysPaystubByID(ID); PayStub employeeList = RetrievePayStubByIDRepackage(tmpTable); return(employeeList); }
private void AddToPayroll(PayStub payStub, List <PayStub> payroll) { var existing = payroll.Find(x => x.EmployeeId.Equals(payStub.EmployeeId)); if (existing == null) { payroll.Add(payStub); } else { existing.HolidayHours += payStub.HolidayHours; existing.NormalHours += payStub.NormalHours; existing.Earnings += payStub.Earnings; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AuthLevel"] == null) { Response.Redirect("Login.aspx?ref=ViewPayStub", true); } //Create the paystub object var stubId = Convert.ToInt32(Request.QueryString["id"]); var paystub = PayStub.Create(stubId); if (Convert.ToInt32(Session["EmployeeId"]) == paystub.EmployeeId) { lblEmpName.Text = Session["EmployeeName"].ToString(); lblEmpId.Text = paystub.EmployeeId.ToString(); lblDept.Text = Session["Department"].ToString(); lblPeriodEnd.Text = paystub.PayPeriod.ToShortDateString(); lblJobAssignment.Text = Session["JobTitle"].ToString(); lblSalaryAmt.Text = paystub.GrossPay.ToString("n"); lblSalaryYTDAmt.Text = paystub.YTDGrossPay.ToString("n"); lblBonusAmt.Text = paystub.BonusPay.ToString("n"); lblBonusYTDAmt.Text = paystub.YTDBonusPay.ToString("n"); lblIncomeTax.Text = paystub.IncomeTaxDeduction.ToString("n"); lblIncomeTaxYTD.Text = paystub.YTDIncomeTaxDeduction.ToString("n"); lblEI.Text = paystub.EIDeduction.ToString("n"); lblEIYTD.Text = paystub.YTDEIDeduction.ToString("n"); lblCPP.Text = paystub.CPPDeduction.ToString("n"); lblCPPYTD.Text = paystub.YTDCPPDeduction.ToString("n"); lblPension.Text = paystub.PensionDeduction.ToString("n"); lblPensionYTD.Text = paystub.YTDPensionDeduction.ToString("n"); lblCurrGross.Text = (paystub.GrossPay + paystub.BonusPay).ToString("n"); lblCurrDed.Text = (paystub.IncomeTaxDeduction + paystub.EIDeduction + paystub.CPPDeduction + paystub.PensionDeduction).ToString("n"); lblCurrNet.Text = paystub.NetPay.ToString("n"); lblYTDGross.Text = (paystub.YTDGrossPay + paystub.YTDBonusPay).ToString("n"); lblYTDDed.Text = (paystub.YTDIncomeTaxDeduction + paystub.YTDEIDeduction + paystub.YTDCPPDeduction + paystub.YTDPensionDeduction).ToString("n"); lblYTDNet.Text = paystub.YTDNetPay.ToString("n"); lblAllocationAmt.Text = paystub.NetPay.ToString("n"); } }
private void CalculateEarnings(PayStub payStub) { var wage = payStub.Wage; payStub.NormalHours = Math.Round(payStub.NormalHours, 2); payStub.HolidayHours = Math.Round(payStub.HolidayHours, 2); var normalHours = payStub.NormalHours; if (normalHours > 40) { normalHours = (1.5 * (payStub.NormalHours - 40)) + 40; } var earnings = Convert.ToDecimal(normalHours + 2 * payStub.HolidayHours) * wage; payStub.Earnings = Math.Round(earnings, 2); }
private static PayStub RetrievePayStubByIDRepackage(DataTable myTable) { PayStub tmpPayStub = new PayStub(); tmpPayStub.PayStubID = Convert.ToInt32(myTable.Rows[0]["empId"]); tmpPayStub.GrossPay = Convert.ToDouble(myTable.Rows[0]["grossPay"]); tmpPayStub.Deductions = Convert.ToDouble(myTable.Rows[0]["deductions"]); tmpPayStub.CPP = Convert.ToDouble(myTable.Rows[0]["cPP"]); tmpPayStub.EI = Convert.ToDouble(myTable.Rows[0]["eI"]); tmpPayStub.CompanyPensionDeduction = Convert.ToDouble(myTable.Rows[0]["companyPensionDeduction"]); tmpPayStub.Netpay = Convert.ToDouble(myTable.Rows[0]["netPay"]); tmpPayStub.EmpID = Convert.ToInt32(myTable.Rows[0]["empID"]); tmpPayStub.CreationDate = Convert.ToDateTime(myTable.Rows[0]["creationDate"]); tmpPayStub.YTDGrossPay = Convert.ToDouble(myTable.Rows[0]["ytdGrossPay"]); tmpPayStub.YTDDeductions = Convert.ToDouble(myTable.Rows[0]["ytdDeductions"]); tmpPayStub.YTDCPP = Convert.ToDouble(myTable.Rows[0]["ytdCPP"]); tmpPayStub.YTDEI = Convert.ToDouble(myTable.Rows[0]["ytdEI"]); tmpPayStub.YTDCompanyPensionDeduction = Convert.ToDouble(myTable.Rows[0]["ytdCompanyPensionDeductions"]); tmpPayStub.YTDNetpay = Convert.ToDouble(myTable.Rows[0]["ytdNetPay"]); return(tmpPayStub); }
private PayStub FindPayStubMatch(string content) { foreach (var e in _settingsService.Employees) { if (string.IsNullOrEmpty(e.UniqueIdentifier) || string.IsNullOrEmpty(e.Name)) { continue; } if (!content.ToLower().Contains(e.UniqueIdentifier.ToLower())) { continue; } var paystub = new PayStub { Name = e.Name, Password = e.Password, Email = e.Email }; return(paystub); } return(null); }
public PayStub Update(PayStub item) { return(PayStubs.Update(item)); }
public PayStub Create(PayStub item) { return(PayStubs.Create(item)); }
public Task <PayStub> UpdateAsync(PayStub item) { return(PayStubs.UpdateAsync(item)); }
public Task <PayStub> CreateAsync(PayStub item) { return(PayStubs.CreateAsync(item)); }
private string createPayStub(Employee emp) { PayStub payStub = PaystubFactory.RetrievePayStubByID(emp.EmpID); using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter hw = new HtmlTextWriter(sw)) { StringBuilder sb = new StringBuilder(); //HEADER sb.Append("<table width='100%' cellspacing='0' cellpadding='2'>"); sb.Append("<tr><td align='center' style='background-color: #18B5F0' colspan = '2'><b>Paystub</b></td></tr>"); sb.Append("<tr><td colspan = '2'></td></tr>"); sb.Append("<tr><td><b>Employee ID: </b>"); sb.Append(payStub.EmpID); sb.Append("</td><td><b>Date: </b>"); sb.Append(payStub.CreationDate); sb.Append(" </td></tr>"); sb.Append("<tr><td colspan = '2'><b>Employee Name : </b>"); sb.Append(emp.FirstName + ' ' + emp.LastName); sb.Append("</td></tr>"); sb.Append("</table>"); sb.Append("<br />"); sb.Append("<table border = '1'>"); sb.Append("<tr>"); //COLUMN HEADERS sb.Append("<th>Employee ID</th>"); sb.Append("<th>Bi-Weekly Rate</th>"); sb.Append("</tr>"); sb.Append("<tr>"); sb.Append("<td>"); sb.Append(payStub.EmpID); sb.Append("</td>"); sb.Append("<td>"); sb.Append(emp.BiWeeklyRate); sb.Append("</td>"); sb.Append("</tr>"); sb.Append("</table>"); sb.Append("<br />"); sb.Append("<table border = '1'>"); sb.Append("<tr>"); sb.Append("<th>NetPay</th>"); sb.Append("<th>Gross Pay</th>"); sb.Append("<th>"); sb.Append("Deductions"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("CPP"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("EI"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("Company Pension Deductions"); sb.Append("</th>"); sb.Append("</tr>"); //BODY sb.Append("<tr>"); sb.Append("<td>"); sb.Append(payStub.Netpay); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.GrossPay); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.Deductions); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.CPP); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.EI); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.CompanyPensionDeduction); sb.Append("</td>"); sb.Append("</tr>"); sb.Append("</table>"); sb.Append("<br />"); // YTD sb.Append("<table border = '1'>"); sb.Append("<tr>"); sb.Append("<th>"); sb.Append("YTD NetPay"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("YTD Gross Pay"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("YTD Deductions"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("YTD CPP"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("YTD EI"); sb.Append("</th>"); sb.Append("<th>"); sb.Append("YTD Company Pension Deductions"); sb.Append("</th>"); sb.Append("</tr>"); //BODY sb.Append("<tr>"); sb.Append("<td>"); sb.Append(payStub.YTDNetpay); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.YTDGrossPay); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.YTDDeductions); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.YTDCPP); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.YTDEI); sb.Append("</td>"); sb.Append("<td>"); sb.Append(payStub.YTDCompanyPensionDeduction); sb.Append("</td>"); sb.Append("</tr>"); sb.Append("</table>"); return(sb.ToString()); } } }