?? dwyjfrm.pas
字號:
unit dwyjfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons,db, Grids, DBGridEh, StdCtrls, ExtCtrls, dxdbtrel,
ImgList;
type
Tdwyj = class(TForm)
Panel1: TPanel;
Label1: TLabel;
DBGridEh1: TDBGridEh;
DBGridEh2: TDBGridEh;
Panel2: TPanel;
SpeedButton3: TSpeedButton;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton4: TSpeedButton;
Label2: TLabel;
ImageList1: TImageList;
dxLookupTreeView1: TdxLookupTreeView;
Edit1: TEdit;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
Label3: TLabel;
Edit2: TEdit;
SpeedButton13: TSpeedButton;
SpeedButton5: TSpeedButton;
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure DBGridEh2KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBGridEh2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DBGridEh2DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure DBGridEh2CellClick(Column: TColumnEh);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
dwyj: Tdwyj;
implementation
uses datafrm,yjxgfrm,yjczfrm,bbdcfrm,dwyjhzfrm;
{$R *.dfm}
procedure Tdwyj.SpeedButton3Click(Sender: TObject);
begin
yfgldata.Qdwyj1.Filter:='';
yfgldata.Qdwyj1.Filtered:=false;
close;
end;
procedure Tdwyj.SpeedButton2Click(Sender: TObject);
begin
if yfgldata.Qdwyj.RecordCount>0 then
begin
application.CreateForm(tyjxg,yjxg);
with yjxg do
begin
edit1.Text:=yfgldata.Qdwyj.FieldByName('編號').AsString;
edit2.Text:=yfgldata.Qdwyj.FieldByName('營具名稱').AsString;
try
ShowModal;
finally
free;
end;
end;
end
else
messagebox(dwyj.handle,'沒有營具可以修改。','營房工作管理系統',16);
end;
procedure Tdwyj.SpeedButton1Click(Sender: TObject);
var
bh,dm:string;
begin
if messagebox(dwyj.Handle,'確認要刪除本營具嗎?','營房工作管理系統',33)=1 then
begin
bh:=yfgldata.Qdwyj.FieldByName('編號').AsString;
dm:=yfgldata.Qdwyj.FieldByName('代碼').AsString;
yfgldata.yj.Locate('編號',bh,[loCaseInsensitive]);
yfgldata.yj.Delete;
yfgldata.yj1.Locate('代碼',dm,[loCaseInsensitive]);
yfgldata.yj1.edit;
yfgldata.yj1.FieldByName('數量').AsInteger:=yfgldata.yj1.FieldByName('數量').AsInteger-1;
yfgldata.yj1.FieldByName('合計金額').AsCurrency:=yfgldata.yj1.FieldByName('數量').AsInteger*yfgldata.yj1.FieldByName('單價').AsFloat;
yfgldata.yj1.Post;
if yfgldata.yj1.FieldByName('數量').AsInteger=0 then
yfgldata.yj1.Delete;
if yfgldata.kcyj.Locate('編號',bh,[loCaseInsensitive]) then
begin
yfgldata.kcyj.Delete;
yfgldata.kcyj1.Locate('代碼',dm,[loCaseInsensitive]);
yfgldata.kcyj1.Edit;
yfgldata.kcyj1.FieldByName('數量').AsInteger:=yfgldata.kcyj1.FieldByName('數量').AsInteger-1;
yfgldata.kcyj1.FieldByName('合計金額').AsCurrency:=yfgldata.kcyj1.FieldByName('數量').AsInteger*yfgldata.kcyj1.FieldByName('單價').AsFloat;
yfgldata.kcyj1.Post;
if yfgldata.kcyj1.FieldByName('數量').AsInteger=0 then
yfgldata.kcyj1.Delete;
end;
if yfgldata.dwyj.Locate('編號',bh,[loCaseInsensitive]) then
begin
yfgldata.dwyj.Delete;
yfgldata.dwyj1.Locate('代碼',dm,[loCaseInsensitive]);
yfgldata.dwyj1.Edit;
yfgldata.dwyj1.FieldByName('數量').AsInteger:=yfgldata.dwyj1.FieldByName('數量').AsInteger-1;
yfgldata.dwyj1.FieldByName('合計金額').AsCurrency:=yfgldata.dwyj1.FieldByName('數量').AsInteger*yfgldata.dwyj1.FieldByName('單價').AsFloat;
yfgldata.dwyj1.Post;
if yfgldata.dwyj1.FieldByName('數量').AsInteger=0 then
yfgldata.dwyj1.Delete;
end;
if yfgldata.grjyyj.Locate('編號',bh,[loCaseInsensitive]) then
begin
yfgldata.grjyyj1.Filter:='代碼='''+dm+''' and 借用人='''+yfgldata.grjyyj.FieldByName('借用人').AsString+'''';
yfgldata.grjyyj1.Filtered:=true;
yfgldata.grjyyj1.Edit;
yfgldata.grjyyj1.FieldByName('數量').AsInteger:=yfgldata.grjyyj1.FieldByName('數量').AsInteger-1;
yfgldata.grjyyj1.FieldByName('合計金額').AsFloat:=yfgldata.grjyyj1.FieldByName('數量').AsFloat*yfgldata.grjyyj1.FieldByName('單價').AsFloat;
yfgldata.grjyyj1.Post;
if yfgldata.grjyyj1.FieldByName('數量').AsInteger=0 then
yfgldata.grjyyj1.Delete;
yfgldata.grjyyj1.Filtered:=false;
yfgldata.grjyyj.Delete;
end;
yfgldata.Qdwyj.Active:=false;
yfgldata.Qdwyj.Active:=true;
yfgldata.Qdwyj1.Active:=false;
yfgldata.Qdwyj1.Active:=true;
end;
end;
procedure Tdwyj.FormShow(Sender: TObject);
begin
yfgldata.Qdwyj.Active:=false;
yfgldata.Qdwyj.Active:=true;
yfgldata.Qdwyj1.Active:=false;
yfgldata.Qdwyj1.Active:=true;
if yfgldata.qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.DBGridEh2KeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if yfgldata.Qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.DBGridEh2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if yfgldata.Qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.DBGridEh2DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if yfgldata.Qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.DBGridEh2CellClick(Column: TColumnEh);
begin
if yfgldata.Qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.SpeedButton7Click(Sender: TObject);
begin
dwyj.dxLookupTreeView1.Text:='';
dwyj.Edit2.Text:='';
yfgldata.Qdwyj1.Filtered:=false;
end;
procedure Tdwyj.SpeedButton6Click(Sender: TObject);
begin
yfgldata.Qdwyj1.Filter:='';
if dwyj.dxLookupTreeView1.Text<>'' then
yfgldata.Qdwyj1.Filter:=yfgldata.Qdwyj1.Filter+'使用單位='''+dwyj.dxLookupTreeView1.Text+'''';
if dwyj.Edit2.Text<>'' then
if yfgldata.Qdwyj1.Filter<>'' then
yfgldata.Qdwyj1.Filter:=yfgldata.Qdwyj1.Filter+' and 營具名稱='''+dwyj.Edit2.Text+''''
else
yfgldata.Qdwyj1.Filter:=yfgldata.Qdwyj1.Filter+'營具名稱='''+dwyj.Edit2.Text+'''';
yfgldata.Qdwyj1.Filtered:=true;
if yfgldata.Qdwyj1.RecordCount>0 then
dwyj.Edit1.Text:=yfgldata.dw.Lookup('單位代碼',yfgldata.Qdwyj1.FieldByName('使用單位').AsString,'單位名稱');
end;
procedure Tdwyj.SpeedButton4Click(Sender: TObject);
begin
application.CreateForm(tyjcz,yjcz);
yjcz.vps_name:='yfgldata.ddwyj';
try
yjcz.ShowModal;
finally
yjcz.Free;
end;
end;
procedure Tdwyj.SpeedButton13Click(Sender: TObject);
begin
application.CreateForm(tbbdc,bbdc);
with bbdc do
begin
listbox1.Items.Add('代碼');
listbox1.Items.Add('營具名稱');
listbox1.Items.Add('單位');
listbox1.Items.Add('單價');
listbox1.Items.Add('數量');
listbox1.Items.Add('合計金額');
listbox1.Items.Add('使用單位');
vps_filter:='';
if dwyj.dxLookupTreeView1.Text<>'' then
vps_filter:=vps_filter+'使用單位='''+dwyj.dxLookupTreeView1.Text+'''';
if dwyj.Edit2.Text<>'' then
if vps_filter<>'' then
vps_filter:=vps_filter+' and 營具名稱='''+dwyj.Edit2.Text+''''
else
vps_filter:=vps_filter+'營具名稱='''+dwyj.Edit2.Text+'''';
vps_name:='yfgl_dwyj1';
if dwyj.dxLookupTreeView1.Text<>'' then
edit1.Text:=yfgldata.dw.Lookup('單位代碼',dwyj.dxLookupTreeView1.Text,'單位名稱')+'營具報表'
else
edit1.text:='所有單位營具報表';
try
ShowModal;
finally
free;
end;
end;
end;
procedure Tdwyj.SpeedButton5Click(Sender: TObject);
begin
application.CreateForm(tdwyjhz,dwyjhz);
try
yfgldata.Qdwyj1.Filter:='';
yfgldata.Qdwyj1.Filtered:=false;
dwyjhz.ShowModal;
finally
dwyjhz.Free;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -