2025-03-01 10:55:52 +08:00
|
|
|
|
unit U_TradeSalesContractSel;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|
|
|
|
|
cxEdit, DB, cxDBData, ToolWin, ComCtrls, U_BaseHelp, cxGridCustomTableView,
|
|
|
|
|
|
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
|
|
|
|
|
|
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
|
|
|
|
|
|
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
|
|
|
|
|
cxLookAndFeelPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
|
|
|
|
|
System.ImageList, U_BaseInput, cxButtonEdit, cxDropDownEdit, cxCheckBox,
|
|
|
|
|
|
Vcl.Menus, dxScrollbarAnnotations, dxSkinsCore, dxSkinsDefaultPainters, cxPC,
|
2025-07-18 15:42:53 +08:00
|
|
|
|
dxSkinOffice2013White, dxSkinSharpPlus, dxSkinWXI;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmTradeSalesContractSel = class(TfrmBaseHelp)
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
DS_1: TDataSource;
|
|
|
|
|
|
CDS_1: TClientDataSet;
|
|
|
|
|
|
TBSave: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
ADOConnection1: TADOConnection;
|
|
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
|
ConNo: TEdit;
|
|
|
|
|
|
GPM_1: TcxGridPopupMenu;
|
|
|
|
|
|
ImageList1: TImageList;
|
|
|
|
|
|
cxStyleRepository1: TcxStyleRepository;
|
|
|
|
|
|
cxStyle1: TcxStyle;
|
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
TV1: TcxGridDBTableView;
|
|
|
|
|
|
VC_SCSCode: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|
|
|
|
|
v1Column5: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|
|
|
|
|
cxGridDBColumn8: TcxGridDBColumn;
|
|
|
|
|
|
v1Column6: TcxGridDBColumn;
|
|
|
|
|
|
v1Column7: TcxGridDBColumn;
|
|
|
|
|
|
v1PRTOrderQty: TcxGridDBColumn;
|
|
|
|
|
|
v1OrderUnit: TcxGridDBColumn;
|
|
|
|
|
|
v1Column2: TcxGridDBColumn;
|
|
|
|
|
|
cxGridLevel1: TcxGridLevel;
|
|
|
|
|
|
TV1Column1: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column2: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column3: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column4: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column5: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column6: TcxGridDBColumn;
|
|
|
|
|
|
ThreeColorBase: TcxStyleRepository;
|
|
|
|
|
|
SHuangSe: TcxStyle;
|
|
|
|
|
|
SkyBlue: TcxStyle;
|
|
|
|
|
|
Default: TcxStyle;
|
|
|
|
|
|
QHuangSe: TcxStyle;
|
|
|
|
|
|
Red: TcxStyle;
|
|
|
|
|
|
FontBlue: TcxStyle;
|
|
|
|
|
|
TextSHuangSe: TcxStyle;
|
|
|
|
|
|
FonePurple: TcxStyle;
|
|
|
|
|
|
FoneClMaroon: TcxStyle;
|
|
|
|
|
|
FoneRed: TcxStyle;
|
|
|
|
|
|
RowColor: TcxStyle;
|
|
|
|
|
|
handBlack: TcxStyle;
|
|
|
|
|
|
cxBlue: TcxStyle;
|
|
|
|
|
|
SHuangSeCu: TcxStyle;
|
|
|
|
|
|
PM_1: TPopupMenu;
|
|
|
|
|
|
N1: TMenuItem;
|
|
|
|
|
|
N2: TMenuItem;
|
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
|
C_Name: TEdit;
|
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
|
BuyName: TEdit;
|
|
|
|
|
|
TV1Column9: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column10: TcxGridDBColumn;
|
|
|
|
|
|
TV1Column13: TcxGridDBColumn;
|
|
|
|
|
|
cxTabControl1: TcxTabControl;
|
|
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure FormDestroy(Sender: TObject);
|
|
|
|
|
|
procedure TBSaveClick(Sender: TObject);
|
|
|
|
|
|
procedure TV1DblClick(Sender: TObject);
|
|
|
|
|
|
procedure TBCloseClick(Sender: TObject);
|
|
|
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
|
|
|
procedure N2Click(Sender: TObject);
|
|
|
|
|
|
procedure ConNoChange(Sender: TObject);
|
|
|
|
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
procedure InitGrid();
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
public
|
|
|
|
|
|
FCoType, FAuthority, FConNo, FC_Code, FLX: string;
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frmTradeSalesContractSel: TfrmTradeSalesContractSel;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink, U_RTFun;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.FormCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
try
|
|
|
|
|
|
with ADOConnection1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Connected := false;
|
|
|
|
|
|
ConnectionString := DConString;
|
|
|
|
|
|
Connected := true;
|
|
|
|
|
|
end;
|
|
|
|
|
|
ADOQueryBaseCmd.Connection := ADOConnection1;
|
|
|
|
|
|
ADOQueryBaseTemp.Connection := ADOConnection1;
|
|
|
|
|
|
except
|
|
|
|
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.ConNoChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ADOQueryMain.Active = False then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
ConNo.SetFocus;
|
|
|
|
|
|
|
|
|
|
|
|
Action := cahide;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.InitGrid();
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryMain.DisableControls;
|
|
|
|
|
|
with ADOQueryMain do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select A.*,B.* from BS_Contract_Main A inner join BS_Contract_Sub B on A.ConMId=B.ConMId ');
|
|
|
|
|
|
sql.Add(' where isnull(A.status,''0'')=''9''');
|
|
|
|
|
|
sql.Add(' and A.ConType in (''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') ');
|
|
|
|
|
|
|
|
|
|
|
|
// if FLX = 'ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add(' and isnull(B.ISXT,''0'')=''11''');
|
|
|
|
|
|
//
|
|
|
|
|
|
// case cxTabControl1.TabIndex of
|
|
|
|
|
|
// 0:
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add('and not EXISTS (select * from Trade_Plan_Sub X where X.ConSId =B.ConSId) ');
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// 1:
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add('and EXISTS (select * from Trade_Plan_Sub X where X.ConSId =B.ConSId) ');
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
//
|
|
|
|
|
|
// end
|
|
|
|
|
|
// else if FLX = '<27><>֯<EFBFBD><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add(' and isnull(B.ISXT,''0'')=''2''');
|
|
|
|
|
|
//
|
|
|
|
|
|
// case cxTabControl1.TabIndex of
|
|
|
|
|
|
// 0:
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add('and not EXISTS (select * from Tat_Plan_Sub X where X.ConSId =B.ConSId) ');
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// 1:
|
|
|
|
|
|
// begin
|
|
|
|
|
|
// sql.Add('and EXISTS (select * from Tat_Plan_Sub X where X.ConSId =B.ConSId) ');
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
// end;
|
|
|
|
|
|
|
|
|
|
|
|
// if trim(fconNo) <> '' then
|
|
|
|
|
|
// sql.Add(' and conNo=' + quotedstr(fconNo));
|
|
|
|
|
|
// if trim(fC_Code) <> '' then
|
|
|
|
|
|
// sql.Add(' and C_Code=' + quotedstr(fC_Code));
|
|
|
|
|
|
|
|
|
|
|
|
if FAuthority = '¼<><C2BC>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
sql.Add(' and Filler =''' + Trim(DName) + '''');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
// showmessage(Sql.text);
|
|
|
|
|
|
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|
|
|
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|
|
|
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|
|
|
|
|
finally
|
|
|
|
|
|
ADOQueryMain.EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.N1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
SelOKNo(CDS_1, True);
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.N2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
SelOKNo(CDS_1, False);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
|
|
|
|
|
|
ReadCxGrid(Trim(self.Caption), TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.TBSaveClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid(Trim(self.Caption), TV1, '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ConNo.SetFocus;
|
|
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.TV1DblClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ModalResult := 1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeSalesContractSel.FormDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frmTradeSalesContractSel := nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|