【delphi开源代码栏目提醒】:网学会员为广大网友收集整理了,U_gzda.pas,希望对大家有所帮助!
unit U_gzda;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, DB, ExtCtrls, RpCon, RpConDS,
RpDefine, RpRave;
type
Tfrm_gzll = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
ComboBox1: TComboBox;
BitBtn1: TBitBtn;
RvDataSetConnection1: TRvDataSetConnection;
RvProject1: TRvProject;
BitBtn2: TBitBtn;
procedure FormShow(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_gzll: Tfrm_gzll;
implementation
uses U_data;
{$R *.dfm}
procedure Tfrm_gzll.FormShow(Sender: TObject);
begin
combobox1.Clear;
with data1.ADOpublic do
begin
close;
sql.Clear;
sql.Add('select distinct gzyf from 工资表');
open;
end;
while not data1.ADOpublic.Eof do
begin
combobox1.Items.Add(data1.ADOpublic.FieldByName('gzyf').Value);
data1.ADOpublic.Next;
end;
with data1.gzt do
begin
close;
sql.Clear;
sql.Add('select * from 工资表');
open;
end;
data1.gzt.Active:=true;
end;
procedure Tfrm_gzll.ComboBox1Change(Sender: TObject);
begin
with data1.gzt do
begin
close;
sql.Clear;
sql.Add('select * from 工资表 where gzyf=:a');
parameters.ParamByName('a').Value:=combobox1.Text;
open;
end;
end;
procedure Tfrm_gzll.BitBtn2Click(Sender: TObject);
begin
if trim(combobox1.Text)<>'' then
begin
with data1.gzt do
begin
close;
sql.Clear;
sql.Add('select * from 工资表 where gzyf=:aaa');
parameters.ParamByName('aaa').Value:=trim(combobox1.Text);
open;
end;
if data1.gzt.FieldByName('yfgz').Value=null then
application.MessageBox('该月工资没有结算,请结算后再打印','提示',64)
else
begin
rvproject1.ProjectFile:=ExtractFilePath(Application.ExeName)+'gzt';
rvproject1.Execute;
end;
end
else
rvproject1.ProjectFile:=ExtractFilePath(Application.ExeName)+'gzt';
rvproject1.Execute;
end;
end.