266 lines
6.9 KiB
ObjectPascal
266 lines
6.9 KiB
ObjectPascal
unit U_FZCMain_cx;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||
cxButtonEdit, cxTextEdit, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmFZCMain_cx = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label3: TLabel;
|
||
CustomerNoName: TEdit;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
Label1: TLabel;
|
||
CustomerNo: TEdit;
|
||
ToolButton4: TToolButton;
|
||
Label2: TLabel;
|
||
ConNo: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1CustomerNo: TcxGridDBColumn;
|
||
v1CustomerNoName: TcxGridDBColumn;
|
||
v1CustomerJC: TcxGridDBColumn;
|
||
v1ConNo: TcxGridDBColumn;
|
||
v1KHConNO: TcxGridDBColumn;
|
||
v1styleno: TcxGridDBColumn;
|
||
v1PrtCodeName: TcxGridDBColumn;
|
||
v1PRTspec: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
v1FHPrice: TcxGridDBColumn;
|
||
v1BZType: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
styleno: TEdit;
|
||
KHConNO: TEdit;
|
||
Label9: TLabel;
|
||
PrtCodeName: TEdit;
|
||
Label10: TLabel;
|
||
PRTspec: TEdit;
|
||
Label11: TLabel;
|
||
PRTColor: TEdit;
|
||
TSel: TToolButton;
|
||
TSSEl: TToolButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure CustomerNoNameChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure TSelClick(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure TSSElClick(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
|
||
public
|
||
fkhType:string;
|
||
end;
|
||
|
||
var
|
||
frmFZCMain_cx: TfrmFZCMain_cx;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_Fun,U_ZDYHelp,U_FZCInput;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmFZCMain_cx.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from JYOrderFH_Main ');
|
||
sql.add(' where OrdDate>='''+trim(formatdatetime('yyyy-MM-dd',begdate.DateTime))+'''');
|
||
sql.add(' and ordDate<'''+trim(formatdatetime('yyyy-MM-dd',enddate.DateTime+1))+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmFZCMain_cx.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmFZCMain_cx:=nil;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>',Tv1,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmFZCMain_cx.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if Trim(CDS_HZ.fieldbyname('Mainid').AsString)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete JYOrderFH_Main where Mainid='''+Trim(CDS_HZ.fieldbyname('Mainid').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>',Tv1,'<27>ͻ<EFBFBD><CDBB>Զ<EFBFBD><D4B6><EFBFBD>');
|
||
begDate.DateTime:=SGetServerDate10(ADOQueryCmd)-7;
|
||
EndDate.DateTime:=SGetServerDate10(ADOQueryCmd);
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.CustomerNoNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
|
||
procedure TfrmFZCMain_cx.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
SelExportData(Tv1,ADOQueryMain,'<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE>');
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if CDS_HZ.IsEmpty then exit;
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
frmFHXXInPut:=TfrmFHXXInPut.create(self);
|
||
with frmFHXXInPut do
|
||
begin
|
||
FMainId:='';
|
||
if showmodal=1 then
|
||
begin
|
||
initGrid();
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
frmFHXXInPut:=TfrmFHXXInPut.create(self);
|
||
with frmFHXXInPut do
|
||
begin
|
||
FMainId:=trim(CDS_HZ.fieldbyname('Mainid').AsString);
|
||
if showmodal=1 then
|
||
begin
|
||
initGrid();
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.TSelClick(Sender: TObject);
|
||
begin
|
||
frmFHXXInPut:=TfrmFHXXInPut.create(self);
|
||
with frmFHXXInPut do
|
||
begin
|
||
FMainId:=trim(CDS_HZ.fieldbyname('Mainid').AsString);
|
||
ToolBar1.Visible:=False;
|
||
if showmodal=1 then
|
||
begin
|
||
initGrid();
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
TSsel.Click;
|
||
end;
|
||
|
||
procedure TfrmFZCMain_cx.TSSElClick(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.isempty then exit;
|
||
modalResult:=1;
|
||
end;
|
||
|
||
end.
|
||
|
||
|