public double[] CalcTeaDutyInfoForGraphic(DateTime getBegDate,DateTime getEndDate,string getDept,string getDuty,string getName, string getNumber) { int getShouldAttendTimes = 0; double[] getStat = new double[6]; int[] getValue = new DutyStatistics().TeaDutyStatistics(getBegDate,getEndDate,getDept,getDuty,getName,getNumber,ref getShouldAttendTimes); if ( getShouldAttendTimes == 0 ) { for ( int i=0; i<=5; i++ ) getStat[i] = 0; } else { getStat[0] = (float)getValue[0]/(float)getShouldAttendTimes; getStat[1] = (float)getValue[1]/(float)getShouldAttendTimes; getStat[2] = 1 - (float)getValue[2]/(float)getShouldAttendTimes; getStat[3] = (float)getValue[2]/(float)getShouldAttendTimes; } return getStat; }
public DataSet BuildDutySummary(DateTime getBegDate,DateTime getEndDate,string getDept,string getDuty,string getName,string getNumber) { using ( DutyInfoDA dutyInfo = new DutyInfoDA() ) { DataSet buildDutySummary = dutyInfo.GetTeaListForDutySummary(getDept,getDuty,getName,getNumber); if ( buildDutySummary.Tables[0].Rows.Count > 0 ) { buildDutySummary.Tables[0].Columns.AddRange(new DataColumn[]{new DataColumn("Late"),new DataColumn("OffTime"), new DataColumn("Absence"),new DataColumn("Attend"), new DataColumn("ShouldAttend"),new DataColumn("Out")}); for ( int numberRow=0; numberRow<buildDutySummary.Tables[0].Rows.Count; numberRow++ ) { int getShouldAttendTimes = 0; int[] getValue = new DutyStatistics().TeaDutyStatistics(getBegDate,getEndDate,"","","",buildDutySummary.Tables[0].Rows[numberRow][1].ToString(),ref getShouldAttendTimes); if ( getShouldAttendTimes != 0 ) { buildDutySummary.Tables[0].Rows[numberRow]["Late"] = getValue[0].ToString() + " (" + ((float)getValue[0]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; buildDutySummary.Tables[0].Rows[numberRow]["OffTime"] = getValue[1].ToString() + "(" + ((float)getValue[1]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; buildDutySummary.Tables[0].Rows[numberRow]["Absence"] = getShouldAttendTimes-getValue[2] < 0 ? "0(0.00%)" : (getShouldAttendTimes-getValue[2]).ToString() + "(" + (1-(float)getValue[2]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; buildDutySummary.Tables[0].Rows[numberRow]["Attend"] = (float)getValue[2]/(float)getShouldAttendTimes > 1 ? getValue[2].ToString() + "(100%)" : getValue[2].ToString() + "(" + ((float)getValue[2]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; buildDutySummary.Tables[0].Rows[numberRow]["ShouldAttend"] = SetAttendDays(getBegDate, getEndDate);//不考虑多班次问题 buildDutySummary.Tables[0].Rows[numberRow]["Out"] = getValue[3]; } else { buildDutySummary.Tables[0].Rows[numberRow]["Late"] = 0; buildDutySummary.Tables[0].Rows[numberRow]["OffTime"] = 0; buildDutySummary.Tables[0].Rows[numberRow]["Absence"] = 0; buildDutySummary.Tables[0].Rows[numberRow]["Attend"] = 0; buildDutySummary.Tables[0].Rows[numberRow]["ShouldAttend"] = 0; buildDutySummary.Tables[0].Rows[numberRow]["Out"] = 0; } } } return buildDutySummary; } }
public string[] CalcTeaDutyInfo(DateTime getBegDate,DateTime getEndDate,string getDept,string getDuty,string getName, string getNumber) { int getShouldAttendTimes = 0; string[] getStat = new string[6]; int[] getValue = new DutyStatistics().TeaDutyStatistics(getBegDate,getEndDate,getDept,getDuty,getName,getNumber,ref getShouldAttendTimes); if ( getShouldAttendTimes == 0 ) { for ( int i=0; i<=5; i++ ) getStat[i] = "\t" + "0"; } else { getStat[0] = " " + getValue[0].ToString() + " (" + ((float)getValue[0]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; getStat[1] = " " + getValue[1].ToString() + " (" + ((float)getValue[1]/(float)getShouldAttendTimes).ToString("0.00%") + ")"; getStat[2] = " " + (string)(getShouldAttendTimes-getValue[2] < 0 ? "0(0.00%)" : (getShouldAttendTimes-getValue[2]).ToString() + " (" + (1-(float)getValue[2]/(float)getShouldAttendTimes).ToString("0.00%") + ")"); getStat[3] = " " + (string)((float)getValue[2]/(float)getShouldAttendTimes > 1 ? getValue[2].ToString() + "(100%)" : getValue[2].ToString() + " (" + ((float)getValue[2]/(float)getShouldAttendTimes).ToString("0.00%") + " )"); getStat[4] = " " + SetAttendDays(getBegDate, getEndDate).ToString(); //getShouldAttendTimes.ToString(); 不考虑多班次问题 getStat[5] = " " + getValue[3].ToString(); } return getStat; }