📄 uas.~cpp
字号:
CaptionRect.Top = GetSystemMetrics(SM_CYFRAME);
CaptionRect.Bottom=CaptionRect.Top + GetSystemMetrics(SM_CYCAPTION)-1;
}
void TFMain::DrawGradient(void)
{
int BlueIncrement = (FinalBlueIntensity+1) / 32;
int GreenIncrement= (FinalGreenIntensity+1)/32;
int RedIncrement = (FinalRedIntensity+1)/32;
TRect Section = CaptionRect;
int SectionWidth = (CaptionRect.Right - CaptionRect.Left)/36;
TColor FillColor(clBlack);
/*
Section.Right = Section.Left + 5*SectionWidth;
WindowCanvas->Brush->Color = FillColor;
WindowCanvas->Brush->Style = bsSolid;
WindowCanvas->FillRect(Section);
Section.Left+=5*SectionWidth;
*/
for (int j=1;j<=37;j++)
{
if(j==37)
Section.Right = Section.Left + 2*SectionWidth+SectionWidth*0.6;
else
Section.Right = Section.Left + SectionWidth;
FillColor = (TColor) RGB(((RedIncrement+7)*(j-j/30)),
((GreenIncrement+2)*(j+200)),
((BlueIncrement+2)*(j/2)));
WindowCanvas->Brush->Color = FillColor;
WindowCanvas->FillRect(Section);
Section.Left += SectionWidth;
}
}
void TFMain::DrawIcon(void)
{
int IconWidth = GetSystemMetrics(SM_CXSMICON);
int IconHeight= GetSystemMetrics(SM_CYSMICON);
TRect Section;
Section.Left=CaptionRect.Left+2;
Section.Top =CaptionRect.Top +1;
Section.Right=Section.Left + IconWidth;
Section.Bottom=Section.Top + IconHeight;
DrawIconEx(WindowCanvas->Handle, Section.Left, Section.Top, // api call
FMain->Icon->Handle,IconWidth,IconHeight,0,NULL,DI_NORMAL);
// Application->Icon->Handle,IconWidth,IconHeight,0,NULL,DI_NORMAL);
}
void TFMain::DrawCaptionString(void)
{
RECT r;
r.left=CaptionRect.Left + 2 + 16 + 4;
r.right=CaptionRect.Right-20;
r.top = CaptionRect.Top;
r.bottom = CaptionRect.Bottom;
SetBkMode(WindowCanvas->Handle,TRANSPARENT);
WindowCanvas->Font->Color=(TColor) RGB(255,255,0);
WindowCanvas->Font->Name="宋体";
WindowCanvas->Font->Size=9;
DrawText(WindowCanvas->Handle,CustomCaption.c_str(),CustomCaption.Length(),
&r,DT_SINGLELINE|DT_VCENTER);
}
/*
void TFMain::DrawHeartBeatLight(void)
{
/*
static int i=0;
TRect Section = CaptionRect;
int cYCaption = GetSystemMetrics(SM_CYCAPTION);
if(HeartBeat == true)
WindowCanvas->Brush->Color = (TColor) RGB(0,255,0); // bright green
else
WindowCanvas->Brush->Color = clBlack;
WindowCanvas->Pen->Color=clBlack;
WindowCanvas->Ellipse(Section.Right-cYCaption/2,
Section.Top +cYCaption/4,
Section.Right,
Section.Bottom-cYCaption/4);
ILPhoto->Draw(WindowCanvas,Section.Right-i,Section.Top+2,1);
i+=10;
if(i>620)
i=0; */
//}
__fastcall TFMain::~TFMain(void)
{
delete WindowCanvas;
WindowCanvas = 0;
}
//---------------------------------------------------------------------------
void __fastcall TFMain::FormResize(TObject *Sender)
{
Perform(WM_NCPAINT,1,0);
}
//---------------------------------------------------------------------------
void __fastcall TFMain::pTitleResize(TObject *Sender)
{
pTitle->Width=cbTitle->Width;
}
//---------------------------------------------------------------------------
void __fastcall TFMain::tbTitleResize(TObject *Sender)
{
tbTitle->Width=cbTitle->Width;
}
//---------------------------------------------------------------------------
void __fastcall TFMain::FormCloseQuery(TObject *Sender, bool &CanClose)
{
CanClose=false;
Hide();
OutFace->Show();
}
//---------------------------------------------------------------------------
void __fastcall TFMain::BitBtn14Click(TObject *Sender)
{
if(Application->MessageBox("是否清空这张入库单","警告",0x00000021)!=ID_OK)
return;
dsData->qLKda->Close();
String file1=DataPath+"LKDA.dbf",file2=DataPath+"LKTEMP.dbf";
if(CopyFile(file2.c_str(),file1.c_str(),0))
ShowMessage("ok");
dsData->qLKda->Open();
}
//---------------------------------------------------------------------------
void __fastcall TFMain::BitBtn15Click(TObject *Sender)
{
if(Application->MessageBox("是否清空这张出库单","警告",0x00000021)!=ID_OK)
return;
dsData->qCKda->First();
while(!dsData->qCKda->Eof)
{
dsData->qCKda->Delete();
dsData->qCKda->Next();
}
dsData->qCKda->Refresh();
}
//---------------------------------------------------------------------------
void __fastcall TFMain::BitBtn20Click(TObject *Sender)
{
DM->qBDbak->First();
while(!DM->qBDbak->Eof)
{
String KM;
String sName;
int FD=0;
int LK=0;
int KC=0;
int BD=0;
DM->qPH->Edit();
DM->qPH->Append();
KM=DM->qBDbak->FieldByName("KM")->AsString;
DM->qPH->FieldByName("KM")->Value=KM;
DM->qPH->FieldByName("MC")->Value=DM->qBDbak->FieldByName("MC")->AsString;
DM->qPH->FieldByName("GG")->Value=DM->qBDbak->FieldByName("GG")->AsString;
DM->qPH->FieldByName("DW")->Value=DM->qBDbak->FieldByName("DW")->AsString;
BD=DM->qBDbak->FieldByName("SL")->AsInteger;
DM->qPH->FieldByName("BDSL")->Value=BD;
sName= "'Kc.dbf' Kc";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SL");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
KC=DM->qSumSL->FieldByName("SL")->AsInteger;
DM->qPH->FieldByName("KCSL")->Value=KC;
sName= "'Lk.dbf' Lk";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
LK=DM->qSumSL->FieldByName("HE")->AsInteger;
DM->qPH->FieldByName("LKSL")->Value=LK;
sName= "'Ck01.dbf' Ck01";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=DM->qSumSL->FieldByName("HE")->AsInteger;
sName= "'Ck02.dbf' Ck02";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=FD+DM->qSumSL->FieldByName("HE")->AsInteger;
sName= "'Ck03.dbf' Ck03";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=FD+DM->qSumSL->FieldByName("HE")->AsInteger;
sName= "'Ck04.dbf' Ck04";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=FD+DM->qSumSL->FieldByName("HE")->AsInteger;
sName= "'Ck05.dbf' Ck05";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=FD+DM->qSumSL->FieldByName("HE")->AsInteger;
sName= "'Ck06.dbf' Ck06";
DM->qSumSL->Close();
DM->qSumSL->SQL->Clear();
DM->qSumSL->SQL->Add("SELECT SUM(SL) HE ");
DM->qSumSL->SQL->Add(" FROM "+sName);
DM->qSumSL->SQL->Add(" WHERE KM='"+KM+"'");
FD=FD+DM->qSumSL->FieldByName("HE")->AsInteger;
DM->qPH->FieldByName("CKSL")->Value=FD;
if(BD==(KC-LK+FD))
DM->qPH->FieldByName("PH")->Value="平衡";
else
DM->qPH->FieldByName("PH")->Value="不平衡";
DM->qPH->FieldByName("LQ")->Value=Now().FormatString("yy-mm-dd");
DM->qPH->Post();
DM->qBDbak->Next();
}
}
//---------------------------------------------------------------------------
void __fastcall TFMain::dbgKCModiKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key==VK_ESCAPE)
dbnBD->BtnClick(nbCancel);
if(Key==VK_F2)
dbnBD->BtnClick(nbPost);
if(Key==VK_F5)
dbnBD->BtnClick(nbLast);
if(Key==VK_F12)
dbnBD->BtnClick(nbDelete);
}
//---------------------------------------------------------------------------
void __fastcall TFMain::SB4Click(TObject *Sender)
{
pFind->BringToFront();
if(!DM->qFIELD->Active)
{
DM->qFIELD->SQL->Clear();
DM->qFIELD->SQL->Add("SELECT *");
DM->qFIELD->SQL->Add("FROM 'FIELDICT.DBF'Fieldict");
DM->qFIELD->Open();
DM->qFIELD->First();
int index=0;
while(!DM->qFIELD->Eof)
{
dbgJG->Columns->Add();
dbgJG->Columns->Items[index]->FieldName=DM->qFIELD->FieldByName("FIEL")->AsString;
dbgJG->Columns->Items[index]->Title->Caption=DM->qFIELD->FieldByName("DISP")->AsString;
dbgJG->Columns->Items[index]->Title->Color=(TColor)0x00BB9F04;
dbgJG->Columns->Items[index]->Title->Font->Color=clAqua;
DM->qFIELD->Next();
index++;
}
}
if(!DM->qJG->Active)
{
DM->qJG->SQL->Clear();
DM->qJG->SQL->Add("SELECT *");
// FROM "DJS.DBF" Djs
DM->qJG->SQL->Add("FROM 'DJS.DBF' Djs");
DM->qJG->Open();
}
if(!DM->qJGL->Active)
{
DM->qJGL->SQL->Clear();
DM->qJGL->SQL->Add("SELECT GH");
DM->qJGL->SQL->Add("FROM 'DJS.DBF' Djs");
DM->qJGL->SQL->Add("GROUP BY GH");
DM->qJGL->Open();
DM->qJGL->First();
tcJG->Tabs->Clear();
while(!DM->qJGL->Eof)
{
tcJG->Tabs->Add(DM->qJGL->FieldByName("GH")->AsString);
DM->qJGL->Next();
}
}
}
//---------------------------------------------------------------------------
void __fastcall TFMain::SB3Click(TObject *Sender)
{
pSys->BringToFront();
}
//---------------------------------------------------------------------------
void __fastcall TFMain::BitBtn6Click(TObject *Sender)
{
if(S1->Checked)
{
Hide();
Close();
}
if(S2->Checked)
{
if(IDOK==MessageBox(Handle,"真的要重新登录计算机吗?","警告",MB_ICONSTOP|MB_OKCANCEL))
ExitWindowsEx(EWX_LOGOFF,0);
}
if(S3->Checked)
{
if(IDOK==MessageBox(Handle,"真的要重新启动计算机吗?","警告",MB_ICONSTOP|MB_OKCANCEL))
ExitWindowsEx(EWX_REBOOT,0);
}
if(S4->Checked)
{
if(IDOK==MessageBox(Handle,"真的要关闭计算机吗?","警告",MB_ICONSTOP|MB_OKCANCEL))
ExitWindowsEx(EWX_SHUTDOWN,0);
}
MessageBeep(0);
}
//---------------------------------------------------------------------------
void __fastcall TFMain::FormDestroy(TObject *Sender)
{
delete sbImage;
}
//---------------------------------------------------------------------------
void __fastcall TFMain::FormActivate(TObject *Sender)
{
Top=-5;
}
//---------------------------------------------------------------------------
void __fastcall TFMain::tcJGChange(TObject *Sender)
{
DM->qJG->SQL->Clear();
DM->qJG->SQL->Add("SELECT *");
DM->qJG->SQL->Add("FROM 'DJS.DBF' Djs");
DM->qJG->SQL->Add(" Where GH='"+tcJG->Tabs->Strings[tcJG->TabIndex]+"'");
DM->qJG->Open();
}
//---------------------------------------------------------------------------
void __fastcall TFMain::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key==VK_F2)
{
String sTemp;
GetWindowsDirectory(sTemp.c_str(),sTemp.Length());
sTemp=sTemp+"Calc.exe";
WinExec(sTemp.c_str(),SW_SHOW);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -