📄 vendor.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "vendor.h"
#include "chmain.h"
#include "datam.h"
#include "mainform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SUIForm"
#pragma link "SUIButton"
#pragma link "SUIDBCtrls"
#pragma link "SUIEdit"
#pragma link "SUIGroupBox"
#pragma link "SUIImagePanel"
#pragma link "SUIComboBox"
#pragma resource "*.dfm"
Tvend *vend;
//---------------------------------------------------------------------------
__fastcall Tvend::Tvend(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiEdit1KeyPress(TObject *Sender, char &Key)
{
AnsiString str;
if(suiEdit1->Text.IsEmpty())
return;
dm->tmp->Filtered=false;
if(Key==VK_RETURN){
str="SELECT DISTINCT itmaster.Dept_code, itmaster.Section_code, itmaster.Article_code,vendor.Vendor_code, vendor.Vendor_name FROM vendor INNER JOIN itmaster ON vendor.Vendor_code = itmaster.Vendor_code where vendor.vendor_code like'%"+suiEdit1->Text.Trim()+"'";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
}
}
suiComboBox1->Enabled=dm->tmp->Active;
suiComboBox2->Enabled=dm->tmp->Active;
suiComboBox3->Enabled=dm->tmp->Active;
suiButton1->Enabled=dm->tmp->Active;
}
//---------------------------------------------------------------------------
void __fastcall Tvend::FormCreate(TObject *Sender)
{
dm->dept->Active=true;
dm->sect->Active=true;
dm->artcode->Active=true;
dm->dept->First();
while(!dm->dept->Eof){
suiComboBox1->Items->Add(dm->dept->FieldByName("Dept_code")->AsString);
dm->dept->Next();
}
dm->sect->First();
while(!dm->sect->Eof){
suiComboBox2->Items->Add(dm->sect->FieldByName("section_code")->AsString);
dm->sect->Next();
}
dm->artcode->First();
while(!dm->artcode->Eof){
suiComboBox3->Items->Add(dm->artcode->FieldByName("article_code")->AsString);
dm->artcode->Next();
}
}
//---------------------------------------------------------------------------
void __fastcall Tvend::FormDestroy(TObject *Sender)
{
dm->tmp->Filtered=false;
dm->tmp->Active=false;
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiPanel1DblClick(TObject *Sender)
{
AnsiString str;
dm->tmp->Filtered=false;
str="SELECT DISTINCT itmaster.Dept_code, itmaster.Section_code, itmaster.Article_code,vendor.Vendor_code, vendor.Vendor_name FROM vendor INNER JOIN itmaster ON vendor.Vendor_code = itmaster.Vendor_code ";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
}
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiButton1Click(TObject *Sender)
{
//dm->tmp->GetDetailDataSets(suiComboBox1->Items);
//dm->sect->GetFieldList(suiComboBox1->Items,"section_code");
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiComboBox1Change(TObject *Sender)
{
AnsiString str;
str="SELECT DISTINCT itmaster.Dept_code, itmaster.Section_code, itmaster.Article_code,vendor.Vendor_code, vendor.Vendor_name FROM vendor INNER JOIN itmaster ON vendor.Vendor_code = itmaster.Vendor_code where itmaster.dept_code ='"+suiComboBox1->Text.Trim()+"'";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
}
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiComboBox3Change(TObject *Sender)
{
AnsiString str;
str="SELECT DISTINCT itmaster.Dept_code, itmaster.Section_code, itmaster.Article_code,vendor.Vendor_code, vendor.Vendor_name FROM vendor INNER JOIN itmaster ON vendor.Vendor_code = itmaster.Vendor_code where itmaster.article_code ='"+suiComboBox3->Text.Trim()+"'";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
}
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiComboBox2Change(TObject *Sender)
{
AnsiString str;
str="SELECT DISTINCT itmaster.Dept_code, itmaster.Section_code, itmaster.Article_code,vendor.Vendor_code, vendor.Vendor_name FROM vendor INNER JOIN itmaster ON vendor.Vendor_code = itmaster.Vendor_code where itmaster.section_code ='"+suiComboBox2->Text.Trim()+"'";
try{
dm->tmp->Active=false;
dm->tmp->SQL->Clear();
dm->tmp->SQL->Add(str);
dm->tmp->Active=true;
}catch(...){
}
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiDBEdit3Change(TObject *Sender)
{
suiComboBox3->Text=dm->artcode->FieldByName("article_code")->AsString;
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiDBEdit2Change(TObject *Sender)
{
suiComboBox2->Text=dm->sect->FieldByName("section_code")->AsString;
}
//---------------------------------------------------------------------------
void __fastcall Tvend::suiDBEdit1Change(TObject *Sender)
{
suiComboBox1->Text=dm->dept->FieldByName("dept_code")->AsString;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -