📄 gysjs.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ShFwMain.h"
#include "gysjs.h"
#include "gysjsqd.h"
#include "gysjshzb.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ColorButton"
#pragma resource "*.dfm"
TGysJsForm *GysJsForm;
//---------------------------------------------------------------------------
__fastcall TGysJsForm::TGysJsForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TGysJsForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
MainForm->ADOConnection1->Close();
}
//---------------------------------------------------------------------------
void __fastcall TGysJsForm::dxfColorButton2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TGysJsForm::dxfColorButton1Click(TObject *Sender)
{
AnsiString msql,sql;
if(DBLookupComboBox1->Text.Trim()=="") {
Application->MessageBox("请选择供应商","错误",MB_OK+MB_ICONERROR);
Abort();
}
ADOQuery1->Close();
DataSource2->Enabled = false;
switch( RadioGroup2->ItemIndex ) {
case 0:
MainForm->MyPjBh ="0";
if( RadioGroup1->ItemIndex != 3 && RadioGroup1->ItemIndex != 4 ) { //非回访,全部
msql = "select distinct flbh,flmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and jsflag='是' and zxfwlx ='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and gysbh=:P_gysbh order by flbh";
} else if ( RadioGroup1->ItemIndex == 3) { //回访
msql = "select distinct flbh,flmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and hfflag='是' and gysbh=:P_gysbh order by flbh";
} else {
msql = "select distinct flbh,flmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and ( jsflag='是' or hfflag='是' ) and gysbh=:P_gysbh order by flbh";
}
ADOQuerytmp->Close();
ADOQuerytmp->SQL->Clear();
ADOQuerytmp->SQL->Add(msql);
ADOQuerytmp->Parameters->ParamByName("P_startrq")->Value = DateTimePicker1->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_endrq")->Value = DateTimePicker2->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_gysbh")->Value = DBLookupComboBox1->KeyValue;
ADOQuerytmp->Open();
if(ADOQuerytmp->RecordCount < 1 ) {
ADOQuerytmp->Close();
Application->MessageBox("没有符合条件的记录可打印","错误",MB_OK+MB_ICONERROR);
return;
}
if( RadioGroup1->ItemIndex != 3 && RadioGroup1->ItemIndex != 4 ) { //非回访
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh ";
sql += " and fwsl.jsflag='是' and fwjs.dabh = fwsl.dabh and fwsl.zxfwlx ='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and fwjs.jslx='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
} else if ( RadioGroup1->ItemIndex == 3) { //回访
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh ";
sql += " and fwsl.hfflag='是' and fwjs.dabh = fwsl.dabh and fwjs.jslx='回访' and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
} else {
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh ";
sql += " and ( fwsl.jsflag='是' or fwsl.hfflag='是' ) and fwjs.dabh = fwsl.dabh and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
}
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(sql);
ADOQuery1->Parameters->ParamByName("P_startrq")->Value = DateTimePicker1->DateTime;
ADOQuery1->Parameters->ParamByName("P_endrq")->Value = DateTimePicker2->DateTime;
ADOQuery1->Parameters->ParamByName("P_gysbh")->Value = DBLookupComboBox1->KeyValue;
ADOQuery1->Open();
DataSource2->Enabled = true;
break;
case 1:
MainForm->MyPjBh ="1";
if( RadioGroup1->ItemIndex != 3 && RadioGroup1->ItemIndex != 4 ) { //非回访
msql = "select distinct flbh,ppbh,flmc,ppmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and jsflag='是' and zxfwlx ='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and gysbh=:P_gysbh order by flbh";
} else if ( RadioGroup1->ItemIndex == 3) { //回访
msql = "select distinct flbh,ppbh,flmc,ppmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and hfflag='是' and gysbh=:P_gysbh order by flbh";
}else {
msql = "select distinct flbh,ppbh,flmc,ppmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and ( jsflag='是' or hfflag='是' ) and gysbh=:P_gysbh order by flbh";
}
ADOQuerytmp->Close();
ADOQuerytmp->SQL->Clear();
ADOQuerytmp->SQL->Add(msql);
ADOQuerytmp->Parameters->ParamByName("P_startrq")->Value = DateTimePicker1->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_endrq")->Value = DateTimePicker2->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_gysbh")->Value = DBLookupComboBox1->KeyValue;
ADOQuerytmp->Open();
if(ADOQuerytmp->RecordCount < 1 ) {
ADOQuerytmp->Close();
Application->MessageBox("没有符合条件的记录可打印","错误",MB_OK+MB_ICONERROR);
return;
}
if( RadioGroup1->ItemIndex != 3 && RadioGroup1->ItemIndex != 4 ) { //非回访
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh and fwsl.ppbh =:ppbh ";
sql += " and fwsl.jsflag='是' and fwjs.dabh = fwsl.dabh and fwsl.zxfwlx ='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and fwjs.jslx='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
} else if ( RadioGroup1->ItemIndex == 3) { //回访
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh and fwsl.ppbh =:ppbh ";
sql += " and fwsl.hfflag='是' and fwjs.dabh = fwsl.dabh and fwjs.jslx='回访' and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
} else {
sql = "select * from fwsl,fwjs where fwsl.delflag='否' and fwsl.slrq >=:P_startrq and fwsl.slrq <=:P_endrq and fwsl.flbh =:flbh and fwsl.ppbh =:ppbh ";
sql += " and ( fwsl.jsflag='是' or fwsl.hfflag='是') and fwjs.dabh = fwsl.dabh and fwsl.gysbh=:P_gysbh order by fwjs.dabh";
}
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(sql);
ADOQuery1->Parameters->ParamByName("P_startrq")->Value = DateTimePicker1->DateTime;
ADOQuery1->Parameters->ParamByName("P_endrq")->Value = DateTimePicker2->DateTime;
ADOQuery1->Parameters->ParamByName("P_gysbh")->Value = DBLookupComboBox1->KeyValue;
ADOQuery1->Open();
DataSource2->Enabled = true;
break;
case 2:
MainForm->MyPjBh ="2";
if( RadioGroup1->ItemIndex != 3 && RadioGroup1->ItemIndex != 4 ) { //非回访
msql = "select distinct flbh,ppbh,ggbh,flmc,ppmc,ggmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and jsflag='是' and zxfwlx ='"+RadioGroup1->Items->Strings[RadioGroup1->ItemIndex]+"' and gysbh=:P_gysbh order by flbh";
} else if ( RadioGroup1->ItemIndex == 3) { //回访
msql = "select distinct flbh,ppbh,ggbh,flmc,ppmc,ggmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and hfflag='是' and gysbh=:P_gysbh order by flbh";
} else {
msql = "select distinct flbh,ppbh,ggbh,flmc,ppmc,ggmc from fwsl where delflag='否' and slrq >=:P_startrq and slrq <=:P_endrq ";
msql += " and ( jsflag='是' or hfflag='是') and gysbh=:P_gysbh order by flbh";
}
ADOQuerytmp->Close();
ADOQuerytmp->SQL->Clear();
ADOQuerytmp->SQL->Add(msql);
ADOQuerytmp->Parameters->ParamByName("P_startrq")->Value = DateTimePicker1->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_endrq")->Value = DateTimePicker2->DateTime;
ADOQuerytmp->Parameters->ParamByName("P_gysbh")->Value = DBLookupComboBox1->KeyValue;
ADOQuerytmp->Open();
if(ADOQuerytmp->RecordCount < 1 ) {
ADOQuerytmp->Close();
Application->MessageBox("没有符合条件的记录可打印","错误",MB_OK+MB_ICONERROR);
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -