📄 lingshou.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "lingshou.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_lingshou_gl *fm_lingshou_gl;
static int danju0,shuliang0;
static float jine0;
//---------------------------------------------------------------------------
__fastcall Tfm_lingshou_gl::Tfm_lingshou_gl(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::FormShow(TObject *Sender)
{
Left=10;
Top=100;
dt->Enabled=true;
code->Enabled=false;
RadioButton1->Checked=true;
dt->DateTime=Now();
dt->SetFocus();
dtChange(Sender);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::dtChange(TObject *Sender)
{
int danju1;
dm_data->ds_xiaoshou_lb->Close();
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt"]=dt->Date.FormatString("yyyy-mm-dd")+" 0:0:0";
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt0"]=dt->Date.FormatString("yyyy-mm-dd")+" 23:59:59";
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["code"]="%";
dm_data->ds_xiaoshou_lb->Open();
danju0=0;
danju1=0;
shuliang0=0;
jine0=0;
dm_data->ds_xiaoshou_lb->First();
while(!dm_data->ds_xiaoshou_lb->Eof)
{
if(danju1!=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger)
{
danju1=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger;
danju0++;
}
shuliang0+=dm_data->ds_xiaoshou_lb->FieldByName("shuliang")->AsInteger;
jine0+=dm_data->ds_xiaoshou_lb->FieldByName("jine")->AsFloat;
dm_data->ds_xiaoshou_lb->Next();
}
danju->Text=IntToStr(danju0);
shuliang->Text=IntToStr(shuliang0);
jine->Text=FormatFloat("0.00",jine0);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::Button1Click(TObject *Sender)
{
AnsiString ids;
if(Application->MessageBoxA((dm_data->ds_xiaoshou_lb->FieldByName("code")->AsString+"删除吗?").c_str(),"提示",MB_OKCANCEL)==ID_CANCEL)
return;
ids=dm_data->ds_xiaoshou_lb->FieldValues["id"];
dm_data->ds_xiaoshou_lb->Close();
dm_data->ds_guest->Close();
dm_data->ds_guest->CommandText="select * from xiaoshou where id="+ids;
dm_data->ds_guest->Open();
dm_data->ds_guest->DeleteRecords(arCurrent);
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt"]=dt->Date.FormatString("yyyy-mm-dd")+" 0:0:0";
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt0"]=dt->Date.FormatString("yyyy-mm-dd")+" 23:59:59";
dm_data->ds_xiaoshou_lb->Open();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::FormClose(TObject *Sender,
TCloseAction &Action)
{
dm_data->ds_xiaoshou_lb->Cancel();
dm_data->ds_xiaoshou_lb->Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::RadioButton1Click(TObject *Sender)
{
code->Enabled=false;
dt->Enabled=true;
dt->SetFocus();
dtChange(Sender);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::RadioButton2Click(TObject *Sender)
{
dt->Enabled=false;
code->Enabled=true;
code->SetFocus();
char Key=VK_RETURN;
codeKeyPress(Sender,Key);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::codeKeyPress(TObject *Sender, char &Key)
{
if(Key!=VK_RETURN)
return;
int danju1;
code->SelectAll();
dm_data->ds_xiaoshou_lb->Close();
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt"]="1900-01-01 0:0:0";
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt0"]="3000-12-31 23:59:59";
dm_data->ds_xiaoshou_lb->Parameters->ParamValues["code"]=code->Text.Trim();
dm_data->ds_xiaoshou_lb->Open();
danju0=0;
danju1=0;
shuliang0=0;
jine0=0;
dm_data->ds_xiaoshou_lb->First();
while(!dm_data->ds_xiaoshou_lb->Eof)
{
if(danju1!=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger)
{
danju1=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger;
danju0++;
}
shuliang0+=dm_data->ds_xiaoshou_lb->FieldByName("shuliang")->AsInteger;
jine0+=dm_data->ds_xiaoshou_lb->FieldByName("jine")->AsFloat;
dm_data->ds_xiaoshou_lb->Next();
}
danju->Text=IntToStr(danju0);
shuliang->Text=IntToStr(shuliang0);
jine->Text=FormatFloat("0.00",jine0);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -