📄 frmdssu01rp.pas
字号:
unit FrmDsSu01RP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FrmBaseFormP, DB, ADODB, StdCtrls, Buttons, ExtCtrls,ComObj, Menus;
type
TFrmDsSu01R = class(TFrmBaseForm)
Img1: TImage;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
ADOQ_DsSu01: TADOQuery;
Label3: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Label5: TLabel;
Label6: TLabel;
Edit5: TEdit;
Edit6: TEdit;
RG1: TRadioGroup;
RB3: TRadioButton;
RB2: TRadioButton;
RB1: TRadioButton;
procedure FormCreate(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
Function GetSqlData():Boolean;
{ Public declarations }
end;
var
FrmDsSu01R: TFrmDsSu01R;
SqlStr:String;
implementation
uses SysPub, DataM1P, QR_DsSu01P;
{$R *.dfm}
procedure TFrmDsSu01R.FormCreate(Sender: TObject);
begin
// inherited;
Img1.Picture.LoadFromFile(_AppPath+'Bmp\Tao.Bmp');
IF ADOQ_DsSu01.Active =False Then
ADOQ_DsSu01.Active :=True;
SqlStr:='True';
end;
procedure TFrmDsSu01R.BitBtn2Click(Sender: TObject);
begin
inherited;
close ;
end;
Function TFrmDsSu01R.GetSqlData():Boolean;
Var SqlStr1:string;
begin
IF Edit1.Text<>'' Then
SqlStr:=SqlStr+' And DsSu02.SU_ID>='+''''+Edit1.Text+'''';
IF Edit2.Text <>'' Then
SqlStr:=SqlStr+' And DsSu02.SU_ID<='+''''+Edit2.Text+'''';
IF Edit3.Text<>'' Then
SqlStr:=SqlStr+' And DsSu02.SU_No>='+''''+Edit3.Text+'''';
IF Edit4.Text<>'' Then
SqlStr:=SqlStr+' ANd DsSu02.SU_No<='+''''+Edit4.Text+'''';
IF Edit5.Text<>'' Then
SqlStr:=SqlStr+' And DsSu02.EL_NO>='+''''+Edit5.Text+'''';
IF Edit6.Text<>'' Then
SqlStr:=SqlStr+' And DsSu02.EL_No<='+''''+Edit6.Text+'''';
IF RB1.Checked Then
SqlStr:=SqlStr+' And DsSu01.SU_Sure='+''''+'Y'+'''';
IF RB2.Checked Then
SqlStr:=SqlStr+' And DsSu01.SU_Sure<>'+''''+'Y'+'''';
SqlStr1:='Select DsSu02.Su_ID,DsSu02.Su_No,DsSu02.Su_SNO,DsSu02.EL_NO,DsSu02.EL_Price,DsSu02.EL_Unit,DsSu01.OD_ID,DsSu01.SU_Cdate,DsSu01.SU_Edate,DsSu02.SU_Note From DsSu01,DsSu02 Where DsSu01.SU_ID=DsSU02.SU_ID And '+SqlStr+' order By DsSu02.SU_NO,DsSu02.SU_ID,DsSu02.Su_SNO';
Screen.Cursor:=crHourGlass;
ADOQ_DsSu01.Active :=False;
ADOQ_DsSu01.SQL.Clear ;
ADOQ_DsSu01.SQL.Add(SqlStr1);
ADOQ_DsSu01.Active :=True;
ADOQ_DsSu01.ExecSQL ;
SqlStr:='True';
IF ADOQ_DsSu01.RecordCount<1 Then
Result:=False
Else
Result:=True;
end;
procedure TFrmDsSu01R.BitBtn1Click(Sender: TObject);
Var Return:boolean;
begin
inherited;
Return:=GetSqlData ;
Screen.Cursor:=crDefault;
IF Return=False Then
Begin
Application.MessageBox('无符合条件的任何记录!','提示信息',48);
Exit;
End;
Application.CreateForm(TQR_DsSu01,QR_DsSu01);
QR_DsSu01.QR_User.Caption :=_UserID;
QR_DsSu01.Preview ;
QR_DsSu01.Show ;
QR_DsSu01.Destroy ;
end;
procedure TFrmDsSu01R.BitBtn3Click(Sender: TObject);
Var
icount,jcount:Integer;
XlApp,Sheet,Range:Variant;
Return:boolean;
begin
inherited;
Return:=GetSqlData ;
Screen.Cursor:=crHourGlass;
IF Return=False Then
Begin
Application.MessageBox('无符合条件的任何记录!','提示信息',48);
Screen.Cursor:=crDefault;
Exit;
End;
Try
If Not VarIsEmpty(XlApp) Then
Begin
XlApp.DisplayAlerts:=False;
XlApp.WorkBooks.Close;
XlApp.Quit;
XlApp:=UnAssigned;
End;
Try
XlApp:=CreateOleObject('Excel.Application');
Except
Application.MessageBox('生成EXCEL对象出错,可能是EXCEL未正确安装!','提示信息',32);
Screen.Cursor:=crDefault;
Exit;
End;
Sheet:=CreateOleObject('Excel.Sheet');
Sheet:=XlApp.WorkBooks.Add;
XlApp.WorkSheets[1].Activate;
Range:=XlApp.Activesheet.Range['A1:J1'];
Range.Merge;
Range.FormulaR1C1:='厂商报价资料明细表';
Range.HorizontalAlignment:=$FFFFEFF4; //
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -