📄 sdqctr.pas
字号:
unit SDQCTR;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ExtCtrls, StdCtrls, DB, DBCtrls;
type
TFormSDQCTR = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Shape1: TShape;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
Label2: TLabel;
Edit2: TEdit;
Shape2: TShape;
Label3: TLabel;
Edit3: TEdit;
Shape3: TShape;
DBGrid3: TDBGrid;
Button1: TButton;
Label4: TLabel;
DataSource1: TDataSource;
Image1: TImage;
DBText1: TDBText;
procedure Button1Click(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure DBGrid1DblClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormSDQCTR: TFormSDQCTR;
implementation
uses DataHj, mpub, SDOCRD, SDOCTR,
PPOWKO, SDODLN;
{$R *.dfm}
procedure TFormSDQCTR.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TFormSDQCTR.Edit1Exit(Sender: TObject);
begin
try
DataModHJ.ADOQuP0.Close;
DataModHJ.ADOQuP0.SQL.Clear;
DataModHJ.ADOQuP0.SQL.Add('select * from SDOSLP where SlpName=:P0');
DataModHJ.ADOQuP0.Parameters[0].Value:=Trim(Edit1.Text);
DataModHJ.ADOQuP0.Prepared;
DataModHJ.ADOQuP0.Open;
if DataModHJ.ADOQuP0.RecordCount>0 then
begin
Edit2.Text:=Floattostr(DataModHJ.ADOQuP0.FieldValues['slsum']);
Edit3.Text:=Floattostr(DataModHJ.ADOQuP0.FieldValues['Commission']);
end;
DataModHJ.ADOQuP0.Close;
DataModHJ.ADOQP0.Close;
DataModHJ.ADOQP0.SQL.Clear;
DataModHJ.ADOQP0.SQL.Add('execute Ms_CTRTotal '+trim(Edit1.Text));
DataModHJ.ADOQP0.Prepared;
DataModHJ.ADOQP0.Open;
except
exit;
end;
end;
procedure TFormSDQCTR.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DataSource1.DataSet.Close;
Action:=caFree;
FormSDQCTR:=nil;
end;
procedure TFormSDQCTR.DBGrid1DblClick(Sender: TObject);
begin
try
if DataSource1.DataSet.RecordCount>0 then
begin
if DBGrid1.SelectedIndex=2 then
ShowModalForm(TFormSDOCRD,DBGrid1.Fields[1].Value);
if DBGrid1.SelectedIndex=3 then
ShowModalForm(TFormSDOCTR,DBGrid1.Fields[3].Value);
if DBGrid1.SelectedIndex=4 then
ShowModalForm(TFormPPOWKO,DBGrid1.Fields[4].Value);
if DBGrid1.SelectedIndex=10 then
ShowModalForm(TFormSDODLN,DBGrid1.Fields[15].Value);
end;
except
exit;
end;
end;
procedure TFormSDQCTR.FormShow(Sender: TObject);
var
str:string;
begin
try
DataModHJ.ADOQuP0.Close;
DataModHJ.ADOQuP0.SQL.Clear;
DataModHJ.ADOQuP0.SQL.Add('select * from EPMUSR where UserID=:P0');
DataModHJ.ADOQuP0.Parameters[0].Value:=(CurrentParam.userAliasName);
DataModHJ.ADOQuP0.Prepared;
DataModHJ.ADOQuP0.Open;
if DataModHJ.ADOQuP0.RecordCount>0 then
begin
str:=trim(DataModHJ.ADOQuP0.FieldValues['privNa']);
end;
DataModHJ.ADOQuP0.Close;
if str='销售' then
begin
DBGrid2.Visible:=False;
DBGrid3.Visible:=False;
end;
if str='财务' then
begin
DBGrid2.Visible:=true;
DBGrid3.Visible:=False;
end;
if str='审核' then
begin
DBGrid2.Visible:=False;
DBGrid3.Visible:=true;
end;
except
exit;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -