📄 fmtsreturnu.pas
字号:
unit FMTsReturnU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FMBizMulU, DB, Menus, ADODB, Grids, DBGrids, dxDBGrid, dxDBTLCl,
dxGrClms, dxTL, dxDBCtrl, dxCntner, ComCtrls, DBCtrls, StdCtrls, Mask,
Buttons, ExtCtrls, ToolEdit, RXDBCtrl;
type
TFMTsReturn = class(TFMBizMul)
cdsMainfSupNo: TWideStringField;
Label6: TLabel;
cdsDetailfBuyPrice: TFloatField;
cdsSupplier: TADODataSet;
cdsEmp: TADODataSet;
dbfSupNo: TRxDBComboEdit;
cdsMainfEmpId: TSmallintField;
Label7: TLabel;
dbfEmpId: TRxDBComboEdit;
dbfSupName: TDBEdit;
dbfEmpName: TDBEdit;
cdsMainfSupName: TStringField;
cdsMainfEmpName: TStringField;
procedure btnQueryClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure dbfSupNoButtonClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure dbfEmpIdButtonClick(Sender: TObject);
procedure cdsMainNewRecord(DataSet: TDataSet);
procedure btnModifyClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function CheckHead:boolean ; override ;
end;
var
FMTsReturn: TFMTsReturn;
implementation
{$R *.dfm}
uses RepTsReceiveU,FmSearchU ;
function TFMTsReturn.CheckHead:boolean ;
begin
result :=true ;
if cdsMain.FieldByName('fSupName').AsString ='' then
begin
MessageBox(handle,'请输入供商资料.','提示',MB_OK+MB_ICONWARNING);
result :=false ;
exit ;
end ;
if cdsMain.FieldByName('fEmpName').AsString ='' then
begin
MessageBox(handle,'请输入经办人.','提示',MB_OK+MB_ICONWARNING);
result :=false ;
exit ;
end ;
end ;
procedure TFMTsReturn.btnQueryClick(Sender: TObject);
begin
PTableName :='ts_return_head';
inherited;
end;
procedure TFMTsReturn.FormCreate(Sender: TObject);
begin
inherited;
aZeroStock :=1 ;
aPriceType := 1 ;
aNumType :=-1 ;
aMainTable :='ts_return_head';
aDetailTable :='ts_return_detail';
aKeyField :='fBillId';
aBillNo :='fBillNo';
Style :='TH';
cdsSupplier.Active :=false ;cdsSupplier.Active := true ;
cdsEmp.Active :=false ;cdsEmp.Active := true ;
end;
procedure TFMTsReturn.btnPrintClick(Sender: TObject);
begin
inherited;
if Application.FindComponent('RepTsReceive')=nil then
RepTsReceive:=TRepTsReceive.create(self);
RepTsReceive.Caption :=Self.Caption ;
RepTsReceive.idtCompany.Caption :=aCompany ;
RepTsReceive.idtTitle.Caption :=Self.Caption;
RepTsReceive.cdsRep.Active :=false ;
RepTsReceive.cdsRep.CommandText :='SELECT a.*, b.fProductId, b.fqty, c.fProductNo, c.fProductName, c.fSpec, c.fSaleUnit, b.fBuyPrice, d.fsupno, d.fsupname, e.fempname, u.fusername '
+' FROM ts_return_head AS a, ts_return_detail AS b, ts_item AS c, ts_supplier AS d, ts_employee AS e, ts_User AS u '
+' WHERE a.fBillId=b.fBillId And b.fProductId=c.fProductId and a.fsupno=d.fsupno and a.fempid=e.fempid '
+' and a.fcreuser=u.fuserno and a.fBillId in '+GetPrintList
+' order by a.fbillid,b.fProductId ' ;
RepTsReceive.cdsRep.Active :=true ;
RepTsReceive.idtCust.Caption :='厂商名称:';
RepTsReceive.Show ;
RepTsReceive.Visible :=false ;
RepTsReceive.QRep.Preview ;
end;
{选择供商}
procedure TFMTsReturn.dbfSupNoButtonClick(Sender: TObject);
begin
inherited;
if Application.FindComponent('FmSearch')=nil then
FmSearch:=TFmSearch.create(self);
FmSearch.Caption :='供商资料查询' ;
FmSearch.UTableName :='ts_supplier';
FMSearch.UFieldName :='fSupNo';
FmSearch.USQL :='select * from ts_supplier where 1=1 ' ;
if FmSearch.ShowModal=mrOK then
begin
if trim(FmSearch.UValue)<>'' then
begin
cdsMain.FieldByName('fSupNo').AsString :=FmSearch.UValue ;
end ;
end;
end;
procedure TFMTsReturn.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
cdsSupplier.Active :=false ;cdsEmp.Active :=false ;
inherited;
end;
procedure TFMTsReturn.dbfEmpIdButtonClick(Sender: TObject);
begin
inherited;
if Application.FindComponent('FmSearch')=nil then
FmSearch:=TFmSearch.create(self);
FmSearch.Caption :='员工资料查询' ;
FmSearch.UTableName :='ts_employee';
FMSearch.UFieldName :='fEmpId';
FmSearch.USQL :='select * from ts_employee where 1=1 ' ;
if FmSearch.ShowModal=mrOK then
begin
if trim(FmSearch.UValue)<>'' then
begin
cdsMain.FieldByName('fEmpId').AsString :=FmSearch.UValue ;
end ;
end;
end;
procedure TFMTsReturn.cdsMainNewRecord(DataSet: TDataSet);
begin
inherited;
dbfSupName.ReadOnly :=true ;
dbfEmpName.ReadOnly :=true ;
end;
procedure TFMTsReturn.btnModifyClick(Sender: TObject);
begin
inherited;
dbfSupName.ReadOnly :=true ;
dbfEmpName.ReadOnly :=true ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -