Exemple #1
0
 public void Add(Paycheck pay)
 {
     this.HoursRegular    += pay.HoursRegular;
     this.HoursOT         += pay.HoursOT;
     this.HoursOther      += pay.HoursOther;
     this.EarningsRegular += pay.EarningsRegular;
     this.EarningsOT      += pay.EarningsOT;
     this.EarningsOther   += pay.EarningsOther;
     this.EarningsSick    += pay.EarningsSick;
     this.EarningsBonus   += pay.EarningsBonus;
     this.TaxFedIncome    += pay.TaxFedIncome;
     this.TaxStateIncome  += pay.TaxStateIncome;
     this.TaxFICA         += pay.TaxFICA;
     this.TaxOther        += pay.TaxOther;
 }
 private void txtPayrollData_TextChanged(object sender, EventArgs e)
 {
     lstParsedPaychecks.Items.Clear();
     string[] lines = txtPayrollData.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
     foreach (string line in lines)
     {
         string[] fields = line.Split('\t');
         if (fields.Length > 1)
         {
             if (fields.Length != 4)
             {
                 MessageBox.Show("Invalid number of fields in line");
                 return;
             }
             string fullName   = fields[0];
             int    firstSpace = fullName.IndexOf(' ');
             string firstName  = fullName.Substring(0, firstSpace);
             string lastName   = fullName.Substring(firstSpace + 1);
             int    firstDot   = lastName.IndexOf('.');
             if (firstDot > 0)
             {
                 lastName = lastName.Substring(firstDot + 2);
             }
             Paycheck check = new Paycheck();
             check.NameLastFirst = lastName + ", " + firstName;
             try
             {
                 check.HoursRegular = double.Parse(fields[1]);
                 check.HoursOT      = double.Parse(fields[2]);
                 check.HoursOther   = double.Parse(fields[3]);
                 check.TaxOther     = (decimal)((check.HoursRegular + check.HoursOT + check.HoursOther) * 0.033 / 2.0);
             }
             catch
             {
                 MessageBox.Show("Error parsing hours");
                 return;
             }
             lstParsedPaychecks.Items.Add(check);
         }
     }
 }
        private void CreatePaycheck(AutoItScript script, Paycheck check)
        {
            script.AppendLine("ControlClick($window,\"\",\"[NAME:button3]\")");  //Click the "Add" button
            script.AppendLine("$window = WinWaitActive(\"Payroll Data Input\", \"\")");
            script.AppendLine("ControlCommand($window, \"\", \"[NAME: cboEmployees]\",\"ShowDropDown\")");
            script.AppendLine("$empNameOld=\"\"");
            script.AppendLine("While -1");
            script.AppendLine("    $empName = ControlGetText($window, \"\", \"[NAME:cboEmployees]\")");
            script.AppendLine("    If $empName == $empNameOld Then");
            script.AppendLine("        MsgBox($MB_OK, \"Error\", \"Could not find employee\")");
            script.AppendLine("        Exit");
            script.AppendLine("    EndIf");
            script.AppendLine("    If $empName == \"" + check.NameLastFirst + "\" Then");
            script.AppendLine("        ExitLoop");
            script.AppendLine("    EndIf");
            script.AppendLine("    $empNameOld = $empName");
            script.AppendLine("    Send(\"{DOWN}\")");
            script.AppendLine("Wend");

            script.SetDateControl("dtpPayrollDate", check.PayDate);
            script.SetDateControl("dtpStartDate", check.PeriodStartDate);
            script.SetDateControl("dtpEndDate", check.PeriodEndDate);

            //script.SetTextBox("txtPayHourly", check.RateRegular);
            //script.SetTextBox("txtOTMultiplier", check.RateOT);
            //script.SetTextBox("txtPayHourlySick", check.RateRegular);
            //script.SetTextBox("txtPayHourlyVacation", check.RateRegular);

            script.SetTextBox("txtHrsRegular", check.HoursRegular);
            script.SetTextBox("txtHrsOT", check.HoursOT);
            script.SetTextBox("txtHrsSick", check.HoursOther);

            script.SetTextBox("txtUDPay1Val", check.EarningsBonus);
            script.SetTextBox("txtUD3Input", check.TaxOther);

            script.AppendLine("ControlClick($window,\"\",\"[NAME:btnCalculateCheck]\")");
            script.AppendLine("MsgBox($MB_OK, \"debug\", \"Paycheck entered for - \" & $empName )");
            //script.AppendLine("ControlClick($window,\"\",\"[NAME:btnSaveCheck]\")");
        }