?? mrwx_bjxxllkd.~pas
字號:
end;
procedure TMR_WXBJXX_LLKD.BitBtn11Click(Sender: TObject);
begin
tabsheet1.show;
end;
procedure TMR_WXBJXX_LLKD.TabSheet3Show(Sender: TObject);
begin
bitbtn1.Click;
Dbgrid3.Visible:=False;
end;
procedure TMR_WXBJXX_LLKD.BitBtn3Click(Sender: TObject);
begin
if adotable1.RecordCount=0 then begin
messagedlg('系統無領料單記錄',mterror,[mbok],0);
end else begin
adotable2.filter:=format('單號'+'='+'''%s''',[adotable1.fieldbyname('單號').asstring]);
tabsheet2.show;
Edit1.Text:=AdoTable1.FieldByname('單號').Asstring;
Edit2.Text:=DateToStr(AdoTable1.FieldByname('日期').asdatetime);
Edit3.Text:=AdoTable1.Fieldbyname('發料單位').asstring;
end;
end;
procedure TMR_WXBJXX_LLKD.ComboBox1Exit(Sender: TObject);
begin
if combobox1.text<>'' then begin
if not adotable3.Locate('商家名稱',combobox1.text,[loCaseInsensitive]) then begin
// adotable3.AppendRecord([combobox1.text]);
adotable3.Insert;
adotable3.FieldByName('商家名稱').asstring:=combobox1.text;
adotable3.post;
combobox1.items.add(combobox1.text);
end;
end;
end;
procedure TMR_WXBJXX_LLKD.ComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then begin
combobox2.setfocus;
end;
end;
procedure TMR_WXBJXX_LLKD.BitBtn10Click(Sender: TObject);
begin
TAbSheet1.Show;
end;
procedure TMR_WXBJXX_LLKD.BitBtn4Click(Sender: TObject);
var dan:integer;
begin
adotable1.Append;
adotable1.fieldbyname('日期').asdatetime:=date;
adotable1.FieldByName('單號').asstring:=edit4.text;
adotable1.fieldbyname('發料單位').asstring:=combobox1.text;
adotable1.fieldbyname('是否入庫').asstring:='否';
adotable1.fieldbyname('申請人').asstring:=combobox2.text;
adotable1.Post;
for dan:=1 to 50 do begin
if stringgrid1.Cells[1,dan]<>'' then begin
adotable2.Append;
AdoTable2.FieldByname('單號').Asstring:=edit4.text;
adotable2.fieldbyname('名稱').asstring:=stringgrid1.cells[1,dan];
adotable2.fieldbyname('數量').asstring:=stringgrid1.cells[2,dan];
adotable2.fieldbyname('物料編碼').asstring:=stringgrid1.cells[3,dan];
adotable2.fieldbyname('規格型號').asstring:=stringgrid1.cells[4,dan];
adotable2.fieldbyname('單位').asstring:=stringgrid1.Cells[5,dan];
AdoTAble2.FieldByname('機型').Asstring:=StringGrid1.Cells[6,Dan];
AdoTable2.FieldByname('位號').Asstring:=StringGrid1.Cells[7,dan];
AdoTAble2.FieldByname('備注').Asstring:=StringGrid1.Cells[8,dan];
AdoTable2.Post;
end;
end;
TabSheet1.Show;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1KeyPress(Sender: TObject;
var Key: Char);
begin
if (length(StringGrid1.Cells[1,Stry-1])<>0) then begin
case strx of
1:begin
if key<>#27 then begin
Dbgrid3.Visible:=true;
if StringGrid1.Cells[Strx,Stry]<>'' then begin
if key=#13 then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('備件編號').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('備件型號').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('單位').Asstring;
StringGrid1.Col:=StringGrid1.Col+1;
Dbgrid3.Visible:=false;
end else begin
AdoTable4.Locate('備件名稱',StringGrid1.Cells[1,Stry],[LoPartialKey]);
end;
end;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
key:=#0;
end else begin
dbgrid3.Visible:=false;
stringgrid1.Cells[1,stry]:='';
stringgrid1.Cells[2,stry]:='';
stringgrid1.Cells[3,stry]:='';
stringgrid1.Cells[4,stry]:='';
stringgrid1.Cells[5,stry]:='';
stringgrid1.Cells[6,stry]:='';
stringgrid1.Cells[7,stry]:='';
stringgrid1.Cells[8,stry]:='';
end;
end;
2:begin
if key=#13 then begin
if Length(StringGrid1.Cells[Strx-1,Stry])=0 then begin
key:=#0;
messagedlg('請添加備件名稱.',mterror,[mbok],0);
end else begin
StringGrid1.Col:=6;
end;
end;
if (key>'9') or (key<'0') then begin
key:=#0;
end;
end;
6:begin
if key=#13 then begin
StringGrid1.Col:=StringGrid1.Col+1;
end;
end;
7:begin
if key=#13 then begin
StringGrid1.Col:=StringGrid1.Col+1;
end;
end;
8:begin
if key=#13 then begin
Stringgrid1.Row:=StringGrid1.Row+1;
StringGrid1.Col:=1;
end;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1KeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
case strx of
1:begin
if DbGrid3.Visible then begin
if key=$26 then begin
key:=$0;
AdoTable4.Prior;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
end;
if key=$28 then begin
key:=$0;
AdoTable4.Next;
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
end;
if key=$27 then begin
key:=$0;
dbgrid3.visible:=false;
stringgrid1.cells[1,stry]:='';
end;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.DBGrid3DblClick(Sender: TObject);
begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('備件編號').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('備件規格').Asstring+' '+
AdoTable4.FieldByname('備件型號').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('單位').Asstring;
StringGrid1.Col:=StringGrid1.Col+1;
Dbgrid3.Visible:=false;
StringGrid1.SetFocus;
StringGrid1.Col:=2;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1DblClick(Sender: TObject);
begin
if(length( StringGrid1.Cells[1,Stry-1])<>0) then begin
case Strx of
1:begin
DbGrid3.Visible:=True;
end;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.DBGrid1DblClick(Sender: TObject);
begin
Bitbtn3.Click;
end;
procedure TMR_WXBJXX_LLKD.BitBtn8Click(Sender: TObject);
begin
if Adotable2.RecordCount<>0 then begin
if messagedlg('您確定要刪除該記錄嗎?',mtInformation,[mbyes,mbok],0)=mryes then begin
AdoTable2.Delete;
end;
end else begin
if messagedlg('系統無紀錄,是否將該單號廢除',mterror,[mbyes,mbno],0)=mryes then begin
adotable1.Delete;
tabsheet1.Show;
end;
end;
end;
procedure TMR_WXBJXX_LLKD.BitBtn6Click(Sender: TObject);
begin
Adotable2.append;
adotable2.fieldbyname('單號').asstring:=edit1.text;
MRWX_BJXXLLD.ShowModal;
end;
procedure TMR_WXBJXX_LLKD.BitBtn7Click(Sender: TObject);
begin
Adotable2.edit;
MRWX_BJXXLLD.ShowModal;
end;
procedure TMR_WXBJXX_LLKD.DBGrid2DblClick(Sender: TObject);
begin
bitbtn7.Click;
end;
procedure TMR_WXBJXX_LLKD.QuickRep1Preview(Sender: TObject);
begin
qrlabel18.Caption:=mr_wxform.ADOTable1.fieldbyname('公司名稱').asstring;
qrlabel15.Caption:=mr_wxform.ADOTable1.fieldbyname('公司名稱').asstring;
qrlabel19.caption:=mr_wxform.adotable1.fieldbyname('地址').asstring;
qrlabel20.caption:=mr_wxform.ADOTable1.fieldbyname('電話').asstring;
qrlabel21.caption:=mr_wxform.ADOTable1.fieldbyname('傳真').asstring;
qrlabel23.caption:=edit1.text;
mr_wxbb.qrpreview1.qrprinter:=quickrep1.qrprinter;
end;
procedure TMR_WXBJXX_LLKD.BitBtn9Click(Sender: TObject);
begin
if not assigned(mr_wxbb) then begin
mr_wxbb:=tmr_wxbb.create(self);
end;
mr_wxbb.show;
QuickRep1.Preview;
end;
procedure TMR_WXBJXX_LLKD.ComboBox2KeyPress(Sender: TObject;
var Key: Char);
begin
if key=#13 then begin
bitbtn2.setfocus;
end;
end;
procedure TMR_WXBJXX_LLKD.StringGrid1GetEditMask(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
if (stry=arow-1) and (stringgrid1.Cells[1,stry]<>'') and (stry<>0) then begin
if (stringgrid1.Cells[2,stry]='') or (strtoint(stringgrid1.Cells[2,stry])=0) then begin
stringgrid1.Row:=stry;
stringgrid1.Col:=2;
messagedlg('數量不能為空或為"0",請添加.',mterror,[mbok],0);
exit;
end;
end;
strx:=acol;
stry:=arow;
end;
procedure TMR_WXBJXX_LLKD.DBGrid3KeyPress(Sender: TObject; var Key: Char);
begin
if key<>#27 then begin
if key=#13 then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
StringGrid1.Cells[3,Stry]:=AdoTable4.FieldByname('備件編號').Asstring;
StringGrid1.Cells[4,Stry]:=AdoTable4.FieldByname('備件型號').Asstring;
StringGrid1.Cells[5,Stry]:=AdoTable4.Fieldbyname('單位').Asstring;
Dbgrid3.Visible:=false;
StringGrid1.Col:=2;
stringgrid1.SetFocus;
exit;
end;
key:=#0;
end else begin
dbgrid3.Visible:=false;
stringgrid1.Cells[1,stry]:='';
stringgrid1.Cells[2,stry]:='';
stringgrid1.Cells[3,stry]:='';
stringgrid1.Cells[4,stry]:='';
stringgrid1.Cells[5,stry]:='';
stringgrid1.Cells[6,stry]:='';
stringgrid1.Cells[7,stry]:='';
stringgrid1.Cells[8,stry]:='';
end;
end;
procedure TMR_WXBJXX_LLKD.DataSource3DataChange(Sender: TObject;
Field: TField);
begin
if dbgrid3.Visible then begin
StringGrid1.Cells[1,Stry]:=AdoTable4.FieldByname('備件名稱').Asstring;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -