📄 rptmain.cpp
字号:
}
else
{
Grid->Cells[LastPos+iTimePos][Index] = QurFree->FieldByName("InTime")->AsString;
}
}
}
//==========返回偶数是下班时间
else if (iTimePos % 2 == 0)
{
//===========如果后为空,放后,,否则判断时间,是否放入前则。
if (Trim(Grid->Cells[LastPos+iTimePos-1][Index]) == "")
{
if (Trim(Grid->Cells[LastPos+iTimePos][Index]) != "")
Grid->Cells[LastPos+iTimePos][Index] = QurFree->FieldByName("InTime")->AsString;
else
{
iTimeState = GetTimeState(QurFree->FieldByName("InTime")->AsString, iTimePos, 0, 0);
if (iTimeState==1 && iTimeState==2)
{
Grid->Cells[LastPos+iTimePos-1][Index] = Grid->Cells[LastPos+iTimePos][Index];
Grid->Cells[LastPos+iTimePos][Index] = QurFree->FieldByName("InTime")->AsString;
}
}
}
else
{
//========如果当前为满,判断当前格内的值是否原本属于前则,如果是,那把该前移。
if (Trim(Grid->Cells[LastPos+iTimePos][Index]) != "")
{
iTmpTimePos = GetTimePos(Grid->Cells[LastPos+iTimePos][Index]);
if (iTmpTimePos == iTimePos - 1)
{
Grid->Cells[LastPos+iTimePos-1][Index] = Grid->Cells[LastPos+iTimePos][Index];
Grid->Cells[LastPos+iTimePos][Index] = QurFree->FieldByName("InTime")->AsString;
}
}
else
{
Grid->Cells[LastPos+iTimePos][Index] = QurFree->FieldByName("InTime")->AsString;
}
}
}
QurFree->Next();
}
//==============================================================================
if (iCardCount != 0 || iCardCount != -1)
{
AnsiString sTime;
//======循环至刷卡次数
for (int j=1;j<iCardCount;j+=2)
{
if (j % 2 == 1)
iTmpTimePos = (j + 1) / 2;
else if (j % 2 == 0)
iTmpTimePos = j / 2;
//=========在一个时间段内,有个时间为空,查寻是否为休假或请假。
if ( Trim(Grid->Cells[LastPos+j][Index])=="" || Trim(Grid->Cells[LastPos+j+1][Index])=="")
{
//=====格内为满,将值改为时间格式。
if (Trim(Grid->Cells[LastPos+j][Index]) !="")
{
sTime = LeftStr(Trim( Grid->Cells[LastPos+j][Index] ), 2)
+ ":" + RightStr(Trim( Grid->Cells[LastPos+j][Index] ), 2);
Grid->Cells[LastPos+j][Index] = sTime;
}
if (Trim(Grid->Cells[LastPos+j+1][Index]) !="")
{
sTime = LeftStr(Trim( Grid->Cells[LastPos+j+1][Index] ), 2)
+ ":" + RightStr(Trim( Grid->Cells[LastPos+j+1][Index] ), 2);
Grid->Cells[LastPos+j+1][Index] = sTime;
}
if ( AnsiPos( Trim("时间段" + IntToStr(iTmpTimePos)), Grid->Cells[MemoPos][Index] ) != 0 )
{
if (GetYesNoLeave(EmployeeArr[i].EmployeeID, iTmpTimePos, dBeginDate))
{
Grid->Cells[LastPos+j][Index]= "请" ;
Grid->Cells[LastPos+j+1][Index]= "假";
Grid->Cells[AddClassPos][Index]=
IntToStr( StrToInt( Trim( Grid->Cells[AddClassPos][Index] ) ) - 1 );
}
else
Grid->Cells[AbsentPos][Index] =
IntToStr(StrToInt(Trim(Grid->Cells[AbsentPos][Index])) + 1);
}
else
{
//=====格内为空,先判断是否为休假。
if (GetYesNoVac(EmployeeArr[i].EmployeeID, iTmpTimePos, EmployeeArr[i].DefVacID, dBeginDate))
{
Grid->Cells[LastPos+j][Index]= "休" ;
Grid->Cells[LastPos+j+1][Index]= "假";
}
else
{
if (GetYesNoLeave(EmployeeArr[i].EmployeeID, iTmpTimePos, dBeginDate))
{
Grid->Cells[LastPos+j][Index]= "请" ;
Grid->Cells[LastPos+j+1][Index]= "假";
}
else
Grid->Cells[AbsentPos][Index] =
IntToStr(StrToInt(Trim(Grid->Cells[AbsentPos][Index])) + 1);
}
}
}
else
{
//==========判断时间是否迟到或旷工。返回1迟到,返回2旷工。
iTimeState = GetTimeState(Grid->Cells[LastPos+j][Index], j, StrToInt(Trim(EdtLate->Text)), StrToInt(Trim(EdtAbsent->Text)));
iTimeState2 = GetTimeState(Grid->Cells[LastPos+j+1][Index], j+1 ,StrToInt(Trim(EdtLate->Text)), StrToInt(Trim(EdtAbsent->Text)));
if (iTimeState == 2 || iTimeState2 == 2)
Grid->Cells[AbsentPos][Index]=
IntToStr(StrToInt(Trim(Grid->Cells[AbsentPos][Index])) + 1);
else
{
if (iTimeState == 1)
Grid->Cells[LatePos][Index]=
IntToStr(StrToInt(Trim(Grid->Cells[LatePos][Index])) + 1);
if (iTimeState2 == 1)
Grid->Cells[LatePos][Index]=
IntToStr(StrToInt(Trim(Grid->Cells[LatePos][Index])) + 1);
}
//==========将值改为时间格式。
if (Trim(Grid->Cells[LastPos+j][Index]) !="")
{
sTime = LeftStr(Trim( Grid->Cells[LastPos+j][Index] ), 2)
+ ":" + RightStr(Trim( Grid->Cells[LastPos+j][Index] ), 2);
Grid->Cells[LastPos+j][Index] = sTime;
}
if (Trim(Grid->Cells[LastPos+j+1][Index]) !="")
{
sTime = LeftStr(Trim( Grid->Cells[LastPos+j+1][Index] ), 2)
+ ":" + RightStr(Trim( Grid->Cells[LastPos+j+1][Index] ), 2);
Grid->Cells[LastPos+j+1][Index] = sTime;
}
}
}
}
//}
//===============================================================================
dBeginDate=dBeginDate+1;
Grid->RowCount=Grid->RowCount+1;
}
}
}
char* __fastcall TfrmRptMain::GetWeek(TDate Date)
{
switch (DayOfWeek(Date))
{
case 1:
return "日";
case 2:
return "一";
case 3:
return "二";
case 4:
return "三";
case 5:
return "四";
case 6:
return "五";
case 7:
return "六";
}
return "";
}
void __fastcall TfrmRptMain::Label1Click(TObject *Sender)
{
DBGrid1->Visible = !DBGrid1->Visible ;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -