📄 fmtssalereturnu.pas
字号:
unit FMTsSaleReturnU;
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
TFMTsSaleReturn = class(TFMBizMul)
Label6: TLabel;
cdsSupplier: TADODataSet;
cdsEmp: TADODataSet;
dbfCustNo: TRxDBComboEdit;
cdsMainfEmpId: TSmallintField;
Label7: TLabel;
dbfEmpId: TRxDBComboEdit;
dbfCustName: TDBEdit;
dbfEmpName: TDBEdit;
cdsMainfEmpName: TStringField;
cdsMainfCustNo: TWideStringField;
cdsMainfCustName: TStringField;
cdsDetailfBuyPrice: TFloatField;
cdsDetailfSellPrice: TFloatField;
procedure btnQueryClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure dbfCustNoButtonClick(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
FMTsSaleReturn: TFMTsSaleReturn;
implementation
{$R *.dfm}
uses RepTsReceiveU,FmSearchU ;
function TFMTsSaleReturn.CheckHead:boolean ;
begin
result :=true ;
if cdsMain.FieldByName('fCustNo').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 TFMTsSaleReturn.btnQueryClick(Sender: TObject);
begin
PTableName :='ts_salereturn_head';
inherited;
end;
procedure TFMTsSaleReturn.FormCreate(Sender: TObject);
begin
inherited;
aPriceType := 3;
aNumType :=1 ;
aMainTable :='ts_salereturn_head';
aDetailTable :='ts_salereturn_detail';
aKeyField :='fBillId';
aBillNo :='fBillNo';
Style :='TL';
cdsSupplier.Active :=false ;cdsSupplier.Active := true ;
cdsEmp.Active :=false ;cdsEmp.Active := true ;
end;
procedure TFMTsSaleReturn.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.fCustNo as fsupno, d.fCustName as fsupname, e.fempname, u.fusername '
+' FROM ts_salereturn_head AS a, ts_salereturn_detail AS b, ts_item AS c, ts_customer AS d, ts_employee AS e, ts_User AS u '
+' WHERE a.fBillId=b.fBillId And b.fProductId=c.fProductId and a.fCustNo=d.fCustNo 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 TFMTsSaleReturn.dbfCustNoButtonClick(Sender: TObject);
begin
inherited;
if Application.FindComponent('FmSearch')=nil then
FmSearch:=TFmSearch.create(self);
FmSearch.Caption :='客户资料查询' ;
FmSearch.UTableName :='ts_customer';
FMSearch.UFieldName :='fCustNo';
FmSearch.USQL :='select * from ts_customer where 1=1 ' ;
if FmSearch.ShowModal=mrOK then
begin
if trim(FmSearch.UValue)<>'' then
begin
cdsMain.FieldByName('fCustNo').AsString :=FmSearch.UValue ;
end ;
end;
end;
procedure TFMTsSaleReturn.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
cdsSupplier.Active :=false ;cdsEmp.Active :=false ;
inherited;
end;
procedure TFMTsSaleReturn.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 TFMTsSaleReturn.cdsMainNewRecord(DataSet: TDataSet);
begin
inherited;
dbfCustName.ReadOnly :=true ;
dbfEmpName.ReadOnly :=true ;
end;
procedure TFMTsSaleReturn.btnModifyClick(Sender: TObject);
begin
inherited;
dbfCustName.ReadOnly :=true ;
dbfEmpName.ReadOnly :=true ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -