📄 requisitionunit.pas
字号:
unit RequisitionUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, RzGrids, ComCtrls, RzDTP, cxControls, cxContainer,
cxEdit, cxLabel, StdCtrls, cxTextEdit, ImgList, ActnList, ADODB, DB,
RzPanel, RzButton, ExtCtrls, cxMaskEdit, cxButtonEdit, cxDropDownEdit,
cxCalc, cxGroupBox, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
cxDBLookupComboBox, cxGridCardView, RzDBGrid, DBGrids, cxLookupEdit,
cxDBLookupEdit, DBClient, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
Wwdbigrd, Wwdbgrid;
type
TRequisitionForm = class(TForm)
Toolbar: TRzToolbar;
BtnNew: TRzToolButton;
RzSpacer1: TRzSpacer;
BtnFirst: TRzToolButton;
BtnPrior: TRzToolButton;
BtnNext: TRzToolButton;
BtnLast: TRzToolButton;
BtnEdit: TRzToolButton;
BtnSave: TRzToolButton;
BtnDelete: TRzToolButton;
BtnRefresh: TRzToolButton;
RzSpacer2: TRzSpacer;
BtnQuery: TRzToolButton;
DetailsR: TADOQuery;
MainR: TADOQuery;
ExeSQL: TADOCommand;
TranList: TActionList;
Query: TAction;
Add: TAction;
Edit: TAction;
Save: TAction;
Refresh: TAction;
Delete: TAction;
First: TAction;
Prior: TAction;
Next: TAction;
Last: TAction;
ImageList: TImageList;
GB: TcxGroupBox;
L08: TcxLabel;
D08: TcxTextEdit;
L04: TcxLabel;
D04: TcxButtonEdit;
L05: TcxLabel;
D05: TcxButtonEdit;
L06: TcxLabel;
D06: TcxButtonEdit;
L07: TcxLabel;
D07: TcxButtonEdit;
D03: TcxButtonEdit;
L03: TcxLabel;
D02: TcxButtonEdit;
L02: TcxLabel;
D01: TRzDateTimePicker;
L01: TcxLabel;
L00: TcxLabel;
D00: TcxButtonEdit;
Update: TAction;
ShowForm: TAction;
DS_Details: TDataSource;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
AddINV: TAction;
ClientDataSet1: TClientDataSet;
DetailsRDSDesigner: TWideStringField;
DetailsRDSDesigner2: TWideStringField;
DetailsRDSDesigner3: TWideStringField;
DetailsRDSDesigner4: TWideStringField;
DetailsRDSDesigner5: TFloatField;
DetailsRDSDesigner6: TFloatField;
DetailsRDSDesigner7: TBCDField;
DetailsRDSDesigner8: TDateTimeField;
cxStyle2: TcxStyle;
cxStyleRepository2: TcxStyleRepository;
cxStyle3: TcxStyle;
SQL: TADOQuery;
wwDGDetail: TwwDBGrid;
dxDGSumFooter: TdxDBGrid;
dxDGSumFooterColumn: TdxDBGridColumn;
dxDGSumFooterQty: TdxDBGridColumn;
dxDGSumFooterSum: TdxDBGridColumn;
Labelheader: TLabel;
cxGroupBox1: TcxGroupBox;
L09: TcxLabel;
D09: TcxLabel;
L10: TcxLabel;
D10: TcxLabel;
L11: TcxLabel;
D11: TcxLabel;
procedure FirstExecute(Sender: TObject);
procedure PriorExecute(Sender: TObject);
procedure NextExecute(Sender: TObject);
procedure LastExecute(Sender: TObject);
procedure UpdateExecute(Sender: TObject);
procedure ShowFormExecute(Sender: TObject);
procedure EditExecute(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
RequisitionForm: TRequisitionForm;
implementation
uses
DataModule;
{$R *.dfm}
procedure TRequisitionForm.FirstExecute(Sender: TObject);
begin
GB.Enabled := True;
MainR.First;
D00.Text := MainR.Fields[0].AsString;
GB.Enabled := False;
end;
procedure TRequisitionForm.PriorExecute(Sender: TObject);
begin
GB.Enabled := True;
BtnPrior.Enabled := False;
MainR.Prior;
D00.Text := MainR.Fields[0].AsString;
GB.Enabled := False;
BtnPrior.Enabled := True;
end;
procedure TRequisitionForm.NextExecute(Sender: TObject);
begin
GB.Enabled := True;
MainR.Next;
D00.Text := MainR.Fields[0].AsString;
GB.Enabled := False;
end;
procedure TRequisitionForm.LastExecute(Sender: TObject);
begin
GB.Enabled := True;
MainR.Last;
D00.Text := MainR.Fields[0].AsString;
GB.Enabled := False;
end;
procedure TRequisitionForm.UpdateExecute(Sender: TObject);
begin
D01.Date := MainR.Fields[1].Value;
D02.Text := MainR.Fields[2].AsString;
D03.Text := MainR.Fields[3].AsString;
D04.Text := MainR.Fields[4].AsString;
D05.Text := MainR.Fields[5].AsString;
D06.Text := MainR.Fields[6].AsString;
D07.Text := MainR.Fields[7].AsString;
D08.Text := MainR.Fields[8].AsString;
D09.Caption := MainR.Fields[9].AsString;
D10.Caption := MainR.Fields[10].AsString;
D11.Caption := MainR.Fields[11].AsString;
SQL.close;
SQL.SQL.Clear;
SQL.SQL.Add('SELECT tPO_Main.cPOID AS ID, tPO_Details.cInvCode AS 商品代码,');
SQL.SQL.Add('tInventory.cInvName AS 商品名称, tInventory.cInvStd AS 规格,');
SQL.SQL.Add('tUnit.cComUnitName AS 单位, tPO_Details.iQuantity AS 数量,');
SQL.SQL.Add('CONVERT(Decimal(12,3),tPO_Details.iUnitPrice) AS 单价, tPO_Details.iMoney AS 金额,');
SQL.SQL.Add('tPO_Details.dArriveDate AS 计划到货');
SQL.SQL.Add('FROM tInventory INNER JOIN');
SQL.SQL.Add('tPO_Details ON tInventory.cInvCode = tPO_Details.cInvCode INNER JOIN');
SQL.SQL.Add('tUnit ON tInventory.cComUnitCode = tUnit.cComunitCode INNER JOIN');
SQL.SQL.Add('tPO_Main ON tPO_Details.POID = tPO_Main.POID');
SQL.SQL.Add('WHERE tPO_Main.cPOID = '+ D00.Text +'');
SQL.Open;
end;
procedure TRequisitionForm.ShowFormExecute(Sender: TObject);
begin
MainR.close;
MainR.SQL.Clear;
MainR.SQL.Add('SELECT tPO_Main.cPOID AS 单据编号, tPO_Main.dPODate AS 单据日期,tPO_Main.cPTCode AS 采购类型,');
MainR.SQL.Add('tPO_Main.cPersonCode AS 业务人员, tVendor.cVenName AS 供应商,');
MainR.SQL.Add('tVendor.cVenLPerson AS 联系人, tVendor.cVenPhone AS 供方电话,');
MainR.SQL.Add('tVendor.cVenFax AS 供方传真, tPO_Main.cMemo AS 备注,');
MainR.SQL.Add('tPO_Main.cMaker AS 制单人, tPO_Main.cVerifier AS 审核人,');
MainR.SQL.Add('tPO_Main.cCloser AS 结案人, tPO_Main.cVenCode, tPO_Main.cState,');
MainR.SQL.Add('tPO_Main.POID AS ID');
MainR.SQL.Add('FROM tPO_Main INNER JOIN');
MainR.SQL.Add('tPO_Details ON tPO_Main.POID = tPO_Details.POID INNER JOIN');
MainR.SQL.Add('tVendor ON tPO_Main.cVenCode = tVendor.cVenCode');
MainR.SQL.Add('ORDER BY tPO_Main.POID ');
MainR.Open;
MainR.Last;
L00.Caption := MainR.Fields[0].DisplayName;
L01.Caption := MainR.Fields[1].DisplayName;
L02.Caption := MainR.Fields[2].DisplayName;
L03.Caption := MainR.Fields[3].DisplayName;
L04.Caption := MainR.Fields[4].DisplayName;
L05.Caption := MainR.Fields[5].DisplayName;
L06.Caption := MainR.Fields[6].DisplayName;
L07.Caption := MainR.Fields[7].DisplayName;
L08.Caption := MainR.Fields[8].DisplayName;
L09.Caption := MainR.Fields[9].DisplayName;
L10.Caption := MainR.Fields[10].DisplayName;
L11.Caption := MainR.Fields[11].DisplayName;
D00.Text := MainR.Fields[0].AsString;
D01.Date := MainR.Fields[1].Value;
D02.Text := MainR.Fields[2].AsString;
D03.Text := MainR.Fields[3].AsString;
D04.Text := MainR.Fields[4].AsString;
D05.Text := MainR.Fields[5].AsString;
D06.Text := MainR.Fields[6].AsString;
D07.Text := MainR.Fields[7].AsString;
D08.Text := MainR.Fields[8].AsString;
D09.Caption := MainR.Fields[9].AsString;
D10.Caption := MainR.Fields[10].AsString;
D11.Caption := MainR.Fields[11].AsString;
end;
procedure TRequisitionForm.EditExecute(Sender: TObject);
begin
GB.Enabled := True ;
Details.OptionsData.Appending := True ;
Details.OptionsData.Editing := True ;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -