📄 kcgl_frm_form1.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "KCGL_frm_form1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)//初始化
: TForm(Owner)
{
KCGL_frm_dbecmbRecordLeve->Visible=false;
KCGL_frm_dbeRecordCount->Visible=false;
KCGL_frm_dbeRecordCost->Visible=false;
KCGL_frm_dbgMedicinestoreInfo->Visible=false;
try
{
KCGL_frm_adoQuery3->Active = false;
KCGL_frm_adoQuery3->SQL->Clear();
KCGL_frm_adoQuery3->SQL->Add("select ClinicId from Clinic "); //诊所名字段查询
KCGL_frm_adoQuery3->Active = true;
KCGL_frm_adoQuery3->Open();
//ADOQuery1
ADOQuery1->Active = false;
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from ItemTable");
ADOQuery1->Active = true;
}
catch(...)
{
MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
for(int i=0;i<KCGL_frm_adoQuery3->RecordCount;i++)
{
KCGL_frm_cmbClinicId->Items->Add(KCGL_frm_adoQuery3->FieldByName("ClinicId")->AsString);
KCGL_frm_cmbClinicId1->Items->Add(KCGL_frm_adoQuery3->FieldByName("ClinicId")->AsString);
DBComboBox2->Items->Add(KCGL_frm_adoQuery3->FieldByName("ClinicId")->AsString);
DBComboBox3->Items->Add(KCGL_frm_adoQuery3->FieldByName("ClinicId")->AsString);
KCGL_frm_adoQuery3->Next() ;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_btnUpdateClick(TObject *Sender)
{
try
{
KCGL_frm_DBNavigator1->BtnClick(nbPost);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_btnDeleteClick(TObject *Sender)
{
try
{
KCGL_frm_DBNavigator1->BtnClick(nbDelete);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_btnAddClick(TObject *Sender)
{
try
{
KCGL_frm_DBNavigator1->BtnClick(nbInsert);
}
catch(...)
{MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_btnCancelClick(TObject *Sender)
{
try
{
KCGL_frm_DBNavigator1->BtnClick(nbCancel);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_cmbClinicIdChange(TObject *Sender)
{
try
{
KCGL_frm_adoQuery1->Active = false;
KCGL_frm_adoQuery1->SQL->Clear();
KCGL_frm_adoQuery1->SQL->Add("select A.* from MedicineTable as A INNER JOIN Bill as B on A.MedicineId=B.MedicineId where B.ClinicId= :id");
KCGL_frm_adoQuery1->Parameters->ParamByName("id")->Value=KCGL_frm_cmbClinicId->Text ;
KCGL_frm_adoQuery1->Active = true;
KCGL_frm_adoQuery1->Open();
if(KCGL_frm_adoQuery1->RecordCount==0)
MessageDlg("该诊所没有药品任何记录,请选择其它诊所 !",mtError,TMsgDlgButtons()<<mbOK,0);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_btnSearchClick(TObject *Sender)
{
try
{
AnsiString sql;
if(KCGL_frm_cmbSearchType->Text=="药品")
{
sql="select * from MedicineTable";
if(KCGL_frm_chbItemId->Checked&&KCGL_frm_chbItemName->Checked)
sql+=" where MedicineId= :iid and MedicineName= :iname";
if(KCGL_frm_chbItemName->Checked)
sql+=" where MedicineName= :iname";
if(KCGL_frm_chbItemId->Checked)
sql+=" where MedicineId= :iid";
}
if(KCGL_frm_cmbSearchType->Text=="用品")
{
sql="select * from ItemTable where DifferNumber=1";
if(KCGL_frm_chbItemId->Checked&&KCGL_frm_chbItemName->Checked)
sql+=" and ItemId= :iid and IteName= :iname";
if(KCGL_frm_chbItemName->Checked)
sql+=" and IteName= :iname";
if(KCGL_frm_chbItemId->Checked)
sql+=" and ItemId= :iid";
}
if(KCGL_frm_cmbSearchType->Text=="非用品")
{
sql="select * from ItemTable where DifferNumber=0";
if(KCGL_frm_chbItemId->Checked&&KCGL_frm_chbItemName->Checked)
sql+=" and ItemId= :iid and IteName= :iname";
if(KCGL_frm_chbItemName->Checked)
sql+=" and IteName= :iname";
if(KCGL_frm_chbItemId->Checked)
sql+=" and ItemId= :iid";
}
if(KCGL_frm_cmbSearchType->Text=="围栏")
{
sql="select * from FenceInfoTable";
if(KCGL_frm_chbItemId->Checked)
sql+=" where FenceId= :iid";
}
KCGL_frm_adoQuery4->Active = false;
KCGL_frm_adoQuery4->SQL->Clear();
KCGL_frm_adoQuery4->SQL->Add(sql);
if(KCGL_frm_chbItemId->Checked&&KCGL_frm_chbItemName->Checked)
{
KCGL_frm_adoQuery4->Parameters->ParamByName("iid")->Value=KCGL_frm_edtItemId->Text;
KCGL_frm_adoQuery4->Parameters->ParamByName("iname")->Value=KCGL_frm_edtItemName->Text;
}
if(KCGL_frm_chbItemName->Checked)
KCGL_frm_adoQuery4->Parameters->ParamByName("iname")->Value=KCGL_frm_edtItemName->Text;
if(KCGL_frm_chbItemId->Checked)
KCGL_frm_adoQuery4->Parameters->ParamByName("iid")->Value=KCGL_frm_edtItemId->Text;
//KCGL_frm_adoQuery4->Prepared;
KCGL_frm_adoQuery4->Active = true;
KCGL_frm_adoQuery4->Open();
if(KCGL_frm_adoQuery4->RecordCount==0)
MessageDlg("没有任何记录,请重新查询 !",mtError,TMsgDlgButtons()<<mbOK,0);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_chbItemIdClick(TObject *Sender)
{
if(KCGL_frm_chbItemId->Checked)
KCGL_frm_edtItemId->Visible =true;
else
KCGL_frm_edtItemId->Visible =false;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::KCGL_frm_chbItemNameClick(TObject *Sender)
{
if(KCGL_frm_chbItemName->Checked)
KCGL_frm_edtItemName->Visible =true;
else
KCGL_frm_edtItemName->Visible =false;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
try
{
DBNavigator1->BtnClick(nbInsert);
}
catch(...)
{MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
try
{
DBNavigator1->BtnClick(nbPost);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button3Click(TObject *Sender)
{
try
{
DBNavigator1->BtnClick(nbDelete);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button4Click(TObject *Sender)
{
try
{
DBNavigator1->BtnClick(nbCancel);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm2::DBComboBox3Change(TObject *Sender)
{
/* try
{
ADOQuery2->Open();
ADOQuery2->Active = false;
ADOQuery2->SQL->Clear();
AnsiString sql;
sql="select A.FenceId,A.FenceVolumn,A.FenceState from FenceInfoTable as A inner join Clinic as B on A.ClinicId=B.ClinicId where B.ClinicId='c00001'";
ADOQuery2->SQL->Add(sql);
ADOQuery2->Active = true;
ADOQuery2->Open();
if(KCGL_frm_adoQuery2->RecordCount==0)
MessageDlg("没有任何记录 !",mtError,TMsgDlgButtons()<<mbOK,0);
}
catch(...)
{ MessageDlg("Error:xxxx. The values of parameters have some problems. You should try your best to solve it !",
mtError,TMsgDlgButtons()<<mbOK,0);
} */ //,不实现了
}
//---------------------------------------------------------------------------
void __fastcall TForm2::CheckBox1Click(TObject *Sender)
{
if(CheckBox1->Checked)
{
KCGL_frm_dbecmbRecordLeve->Visible=true;
KCGL_frm_dbeRecordCount->Visible=true;
KCGL_frm_dbeRecordCost->Visible=true;
KCGL_frm_dbgMedicinestoreInfo->Visible=true;
}
else
{
KCGL_frm_dbecmbRecordLeve->Visible=false;
KCGL_frm_dbeRecordCount->Visible=false;
KCGL_frm_dbeRecordCost->Visible=false;
KCGL_frm_dbgMedicinestoreInfo->Visible=false;
}
//GroupBox21->Enabled =true;
KCGL_frm_adoQuery2->Active = false;
KCGL_frm_adoQuery2->SQL->Clear();
KCGL_frm_adoQuery2->SQL->Add("select * from Store where MedicineId= :mid");
KCGL_frm_adoQuery2->Parameters->ParamByName("mid")->Value=KCGL_frm_dbeMedicineId->Text ;
KCGL_frm_adoQuery2->Active = true;
KCGL_frm_adoQuery2->Open();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -