// ProcessUnmatchedPrimary method. static void ProcessUnmatchedPrimary() { // This is where you put your processing steps for the Primary file record. //Console.WriteLine(employeeFile.Data.EmployeeNumber.ToString()); Console.WriteLine(employeeFile.Data.EmployeeNumber); if (employeeFile.Data.PayType.Equals('S')) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Employee is Salary"); PaySum p = new PaySum(); p.EmployeeNumber = employeeFile.Data.EmployeeNumber; p.RegularHours = 80; p.WeekendHours = 0; p.Shift2Hours = 0; p.Shift3Hours = 0; p.OvertimeHours = 0; paySumFile.Data = p; paySumFile.WriteRecord(); } else { Console.WriteLine("\n\n\nNo timecard found for employee: "); employeeFile.Data.DisplayData(); } Console.ForegroundColor = ConsoleColor.Yellow; // Read from the Primary file. employeeFile.ReadRecord(); }
/// <summary> /// 计算某供货商某段时间内的金额汇总 /// </summary> /// <param name="saler"></param> /// <param name="dt1"></param> /// <param name="dt2"></param> private List <PaySum> CalculatePaySum(string saler, DateTime dt1, DateTime dt2) { StringBuilder swhere = new StringBuilder(); swhere.Append("HasPaid=false AND"); swhere.Append(" Saler='" + saler + "'"); List <Buy> listbuy = bllbuy.GetModelList(swhere.ToString()); List <PaySum> listsum = new List <PaySum>(); DateTime temp = dt1; for (; temp < dt2; temp = temp.AddDays(1)) { PaySum mod = new PaySum() { 日期 = temp, 供货商 = saler, 当日金额 = listbuy.Where(o => o.LogDate == temp && o.Saler == saler).Sum(o => o.Money), 承上天金额 = listbuy.Where(o => o.LogDate < temp && o.Saler == saler).Sum(o => o.Money), 累计金额 = listbuy.Where(o => o.LogDate <= temp && o.Saler == saler).Sum(o => o.Money) }; if (mod.累计金额 == 0) { continue; } listsum.Add(mod); } return(listsum); }
// ProcessMatch method. static void ProcessMatch() { PaySum p = new PaySum(); p.EmployeeNumber = employeeFile.Data.EmployeeNumber; if (!employeeFile.Data.PayType.Equals('S')) { float[] wkOne = new float[7]; float[] wkTwo = new float[7]; Array.Copy(timecardFile.Data.GetDecElapsedTimes(), 0, wkOne, 0, 7); Array.Copy(timecardFile.Data.GetDecElapsedTimes(), 7, wkTwo, 0, 7); float wkOneTotalHours = PRLib.CalculateWeeklyHoursWorked(wkOne); float wkTwoTotalHours = PRLib.CalculateWeeklyHoursWorked(wkTwo); float totalWeekendHours = 0; float shiftTwoHours = 0; float shiftThreeHours = 0; for (int i = 0; i < 14; i++) { totalWeekendHours += PRLib.CalculateWeekendHours( timecardFile.Data.GetDecClockInTimes(i), timecardFile.Data.GetDecClockOutTimes(i), ((i % 7) + 1).ToString()[0]); shiftTwoHours += PRLib.CalculateShift(16.0f, 0.0f, timecardFile.Data.GetDecClockInTimes(i), timecardFile.Data.GetDecClockOutTimes(i)); shiftThreeHours += PRLib.CalculateShift(0.0f, 8.0f, timecardFile.Data.GetDecClockInTimes(i), timecardFile.Data.GetDecClockOutTimes(i)); } p.WeekendHours = totalWeekendHours; p.RegularHours = PRLib.CalculateRegularHours(wkOneTotalHours) + PRLib.CalculateRegularHours(wkTwoTotalHours); p.OvertimeHours = PRLib.CalculateOvertimeHours(wkOneTotalHours) + PRLib.CalculateOvertimeHours(wkTwoTotalHours); p.Shift2Hours = shiftTwoHours; p.Shift3Hours = shiftThreeHours; paySumFile.Data = p; paySumFile.WriteRecord(); //timecardFile.Data.DisplayData(); //p.DisplayData(); //p.RegularHours = PRLib.CalculateRegularHours(); //timecardFile.Data.DisplayData(); } else { p.RegularHours = 80; p.WeekendHours = 0; p.Shift2Hours = 0; p.Shift3Hours = 0; p.OvertimeHours = 0; paySumFile.Data = p; paySumFile.WriteRecord(); } employeeFile.ReadRecord(); timecardFile.ReadRecord(); }