1195 lines
32 KiB
ObjectPascal
1195 lines
32 KiB
ObjectPascal
![]() |
unit U_GJKDList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses,
|
|||
|
cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls,
|
|||
|
ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient,
|
|||
|
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
|||
|
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
|||
|
BtnEdit, cxSplitter, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, MovePanel, cxCalc, Registry, ComObj, cxContainer, cxMaskEdit;
|
|||
|
|
|||
|
type
|
|||
|
FdDy = record
|
|||
|
inc: integer; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD>־<EFBFBD><D6BE><EFBFBD>
|
|||
|
FDdys: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
FdDysName: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
end;
|
|||
|
|
|||
|
TfrmGJKDList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ClientDataSet1: TClientDataSet;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ClientDataSet2: TClientDataSet;
|
|||
|
Label5: TLabel;
|
|||
|
DANNO: TEdit;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
CDS_Print: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV1: TcxGridDBTableView;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
tv2Column1: TcxGridDBColumn;
|
|||
|
Label4: TLabel;
|
|||
|
TOCOUNTRY: TEdit;
|
|||
|
TV1Column1: TcxGridDBColumn;
|
|||
|
TV1Column2: TcxGridDBColumn;
|
|||
|
TV1Column3: TcxGridDBColumn;
|
|||
|
TV1Column4: TcxGridDBColumn;
|
|||
|
TV1Column5: TcxGridDBColumn;
|
|||
|
TV1Column15: TcxGridDBColumn;
|
|||
|
TV1Column16: TcxGridDBColumn;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
RM2: TRMGridReport;
|
|||
|
RMDB_2: TRMDBDataSet;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
OpenDialog1: TOpenDialog;
|
|||
|
Panel6: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
JJREN: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
TV1Column6: TcxGridDBColumn;
|
|||
|
cxButtonEdit1: TcxButtonEdit;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
TV1Column7: TcxGridDBColumn;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure FactoryNameChange(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure CRTypeChange(Sender: TObject);
|
|||
|
procedure A4FPNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure huodaiKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure KHNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure TBCopyClick(Sender: TObject);
|
|||
|
procedure TBBGZLClick(Sender: TObject);
|
|||
|
procedure TBHTClick(Sender: TObject);
|
|||
|
procedure TBFPClick(Sender: TObject);
|
|||
|
procedure TBZXDClick(Sender: TObject);
|
|||
|
procedure TBBGDClick(Sender: TObject);
|
|||
|
procedure TBViewClick(Sender: TObject);
|
|||
|
procedure TBSBYSClick(Sender: TObject);
|
|||
|
procedure TBAllClick(Sender: TObject);
|
|||
|
procedure YWYChange(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure huodaiBtnClick(Sender: TObject);
|
|||
|
procedure B7DaoHuoGangBtnClick(Sender: TObject);
|
|||
|
procedure BtnEditA1BtnClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ComboBox1Change(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure TOCOUNTRYKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure cxButtonEdit1Click(Sender: TObject);
|
|||
|
procedure TV1Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
private
|
|||
|
canshu2: string;
|
|||
|
FDate: TDateTime;
|
|||
|
procedure InitGrid();
|
|||
|
function DelData(): Boolean;
|
|||
|
procedure InitSubGrid();
|
|||
|
procedure InitGridSql(var fsj: string);
|
|||
|
function GetShellFolders(strDir: string): string;
|
|||
|
procedure InitPrtData();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1: string;
|
|||
|
dFdDy: array[0..50] of FdDy;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
//frmBaoGuanList: TfrmBaoGuanList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_BaoGuanInPut, U_Fun, U_YFGLInPut;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
function TfrmGJKDList.GetShellFolders(strDir: string): string;
|
|||
|
const
|
|||
|
regPath = '\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders';
|
|||
|
var
|
|||
|
Reg: TRegistry;
|
|||
|
strFolders: string;
|
|||
|
begin
|
|||
|
Reg := TRegistry.Create;
|
|||
|
try
|
|||
|
Reg.RootKey := HKEY_CURRENT_USER;
|
|||
|
if Reg.OpenKey(regPath, false) then
|
|||
|
begin
|
|||
|
strFolders := Reg.ReadString(strDir);
|
|||
|
end;
|
|||
|
finally
|
|||
|
Reg.Free;
|
|||
|
end;
|
|||
|
result := strFolders;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
//frmBaoGuanList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Application := MainApplication;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := SGetServerDateMBeg(ADOQueryTemp);
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.InitGrid();
|
|||
|
var
|
|||
|
fwhere, Pwhere: string;
|
|||
|
begin
|
|||
|
Pwhere := SGetFilters(Panel1, 1, 2);
|
|||
|
|
|||
|
begin
|
|||
|
if trim(Pwhere) <> '' then
|
|||
|
fwhere := fwhere + ' and ' + trim(Pwhere);
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.* from KD_Main A ');
|
|||
|
|
|||
|
sql.Add(' WHERE FILLTIME>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
sql.Add(' and FILLTIME<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
|
|||
|
SQL.Add(fwhere);
|
|||
|
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + self.Caption, Tv1, '<27><><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD>');
|
|||
|
// WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' + self.Caption, Tv2, '<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>8');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + self.Caption, Tv1, '<27><><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD>');
|
|||
|
// ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ' + self.Caption, Tv2, '<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>8');
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
// ShowMessage(canshu1);
|
|||
|
|
|||
|
InitGrid();
|
|||
|
RM1.CanExport := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
exit;
|
|||
|
// TcxGridToExcel(Trim(CDS_Main.fieldbyname('A4FPNO').AsString) + Trim(CDS_Main.fieldbyname('A5ConNO').AsString), cxGrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.InitSubGrid();
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty = False then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_BaoGuan_Sub where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
sql.Add(' and SValid=''Y'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_BaoGuan_Sub where 1=2');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
SCreateCDS20(ADOQueryTemp, ClientDataSet2);
|
|||
|
SInitCDSData20(ADOQueryTemp, ClientDataSet2);
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmGJKDList.DelData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result := false;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while CDS_Main.Locate('SSel', True, []) do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Valid=''N'',C7BGMoneyHZ=Null,E1BZQtyHZ=Null, E2ChiMaQtyHZ=Null,E3MaoZHZ=Null,E4JingZHZ=Null');
|
|||
|
sql.Add(',Editer=''' + Trim(DName) + ''',EditTime=getdate()');
|
|||
|
sql.Add(' where BGId=''' + Trim(CDS_Main.fieldbyname('BGId').AsString) + '''');
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Sub Set SValid=''N'',SEditer=''' + Trim(DName) + ''',SEditTime=getdate() where BGId=''' + Trim(CDS_Main.fieldbyname('BGId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Result := False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.FactoryNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.CRTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.A4FPNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.InitGridSql(var fsj: string);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.* ');
|
|||
|
sql.Add(' from JYOrder_BaoGuan_Main A ');
|
|||
|
sql.Add(' where 1=1 ');
|
|||
|
if Trim(canshu1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
begin
|
|||
|
SQL.Add(' and FillerCode=''' + Trim(DCode) + '''');
|
|||
|
end;
|
|||
|
|
|||
|
sql.Add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.huodaiKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
// if Key = #13 then
|
|||
|
// begin
|
|||
|
// if Trim(A6PONO.Text) = '' then
|
|||
|
// Exit;
|
|||
|
// fsj := ' and isnull(A.A6PONO,'''') like ''' + '%' + Trim(A6PONO.Text) + '%' + '''';
|
|||
|
// InitGridSql(fsj);
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.KHNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
// if Key = #13 then
|
|||
|
// begin
|
|||
|
// if Trim(A5ConNO.Text) = '' then
|
|||
|
// Exit;
|
|||
|
// fsj := ' and isnull(A.A5ConNO,'''') like ''' + '%' + Trim(A5ConNO.Text) + '%' + '''';
|
|||
|
// InitGridSql(fsj);
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBCopyClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
try
|
|||
|
frmBaoGuanInPut := TfrmBaoGuanInPut.Create(Application);
|
|||
|
with frmBaoGuanInPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('BGID').AsString);
|
|||
|
CopyStr := '99';
|
|||
|
//TBDel.Visible:=False;
|
|||
|
//TBAdd.Visible:=False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBaoGuanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.InitPrtData();
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' exec P_View_BaoGuanData :BGID ');
|
|||
|
Parameters.ParamByName('BGID').Value := Trim(CDS_Main.fieldbyname('BGId').AsString);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBBGZLClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBHTClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>غ<EFBFBD>ͬ.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>غ<EFBFBD>ͬ.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBFPClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ط<EFBFBD>Ʊ.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ط<EFBFBD>Ʊ.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBZXDClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>װ<EFBFBD>䵥.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>װ<EFBFBD>䵥.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBBGDClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ص<EFBFBD>.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ص<EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBViewClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
//if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
try
|
|||
|
frmBaoGuanInPut := TfrmBaoGuanInPut.Create(Application);
|
|||
|
with frmBaoGuanInPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('BGID').AsString);
|
|||
|
TBSave.Visible := False;
|
|||
|
ToolBar2.Visible := False;
|
|||
|
Panel1.Enabled := False;
|
|||
|
Tv1.OptionsData.Editing := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBaoGuanInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBSBYSClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>걨Ҫ<EAB1A8><D2AA>.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
//RMVariables['printtime']:=Now;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C>걨Ҫ<EAB1A8><D2AA>.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TBAllClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney, BZZH, FimageFile, FZMFile: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf';
|
|||
|
InitPrtData();
|
|||
|
FimageFile := ExtractFilePath(Application.ExeName) + 'Image\' + Trim(CDS_Print.FieldByName('A1ChuKouShang').AsString) + '.jpg';
|
|||
|
//RMXLSExport1:= TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
if RM1.CanExport = true then
|
|||
|
begin
|
|||
|
FZMFile := 'C:\Users\Administrator\Desktop';
|
|||
|
if not DirectoryExists(FZMFile) then
|
|||
|
begin
|
|||
|
FZMFile := 'C:\Documents and Settings\Administrator\<5C><><EFBFBD><EFBFBD>\' + trim(CDS_Main.fieldbyname('A4FPNO').AsString) + ' ' + trim(CDS_Main.fieldbyname('A5ConNO').AsString) + '.xls';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
FZMFile := 'C:\Users\Administrator\Desktop\' + trim(CDS_Main.fieldbyname('A4FPNO').AsString) + ' ' + trim(CDS_Main.fieldbyname('A5ConNO').AsString) + '.XLS';
|
|||
|
end;
|
|||
|
RM1.ExportTo(RMXLSExport1, FZMFile);
|
|||
|
end;
|
|||
|
RM1.CanExport := true;
|
|||
|
RMVariables['ImageFile'] := trim(FimageFile);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
RM1.CanExport := False;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.YWYChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.huodaiBtnClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.B7DaoHuoGangBtnClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.BtnEditA1BtnClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
excelApp, WorkBook: Variant;
|
|||
|
i, j, k, LX, ExcelRowCount: integer;
|
|||
|
maxId, FCPID, FCPName, t1, t2, t3: string;
|
|||
|
MAXNO: string;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
excelApp := CreateOleObject('Excel.Application');
|
|||
|
openDialog1.Filter := '*.CSV;*.xls';
|
|||
|
if opendialog1.Execute then
|
|||
|
begin
|
|||
|
|
|||
|
WorkBook := excelApp.WorkBooks.Open(OpenDialog1.FileName);
|
|||
|
end
|
|||
|
else
|
|||
|
exit;
|
|||
|
|
|||
|
excelApp.Visible := false;
|
|||
|
ExcelRowCount := WorkBook.WorkSheets[1].UsedRange.Rows.Count;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>EXCEL<45><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
|
|||
|
k := 0;
|
|||
|
for i := 1 to 50 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = '' then
|
|||
|
continue;
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6A8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֶκ<D6B6><CEBA><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for j := 0 to Tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = trim(Tv1.Columns[j].Caption) then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := trim(Tv1.Columns[j].DataBinding.FieldName);
|
|||
|
dFdDy[k].FdDysName := trim(Tv1.Columns[j].Caption);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
k := k + 1;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if GetLSNo(ADOQueryCmd, MAXNO, 'KD', 'KD_MAIN', 3, 1) = False then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
try
|
|||
|
panel6.Visible := True;
|
|||
|
for i := 2 to ExcelRowCount do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from KD_Main where 1=2');
|
|||
|
open;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Append;
|
|||
|
//<2F><><EFBFBD>ӵ<EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for j := 1 to k - 1 do
|
|||
|
begin
|
|||
|
|
|||
|
if trim(dFdDy[j].FDdys) <> '' then
|
|||
|
begin
|
|||
|
|
|||
|
ADOQueryCmd.fieldbyname(dFdDy[j].FDdys).Value := excelApp.Cells[i, dFdDy[j].inc].Value;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.FieldByName('FILLER').Value := TRIM(DNAME);
|
|||
|
ADOQueryCmd.FieldByName('KDNO').Value := TRIM(MAXNO);
|
|||
|
ADOQueryCmd.FieldByName('FACTORYNAME').Value := TRIM(cxButtonEdit1.TEXT);
|
|||
|
// Trim(maxId) + inttostr(i);
|
|||
|
ADOQueryCmd.FieldByName('filltime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPDATE KD_Main SET CRTIME2=convert(varchar(10),CAST(CRTIME2 AS DATETIME),120) ');
|
|||
|
SQL.Add('WHERE KDNO=' + QuotedStr(Trim(MAXNO)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
panel6.Visible := False;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if cds_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete KD_Main where KDID=''' + Trim(CDS_Main.fieldbyname('KDID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
CDS_Main.Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ComboBox1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
jjren.SetFocus;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into KD_MAIN(Filler) values(' + quotedstr(Trim(dname)) + ')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update fp_main Set fkstatus=''<27>Ѹ<EFBFBD><D1B8><EFBFBD>'' ');
|
|||
|
|
|||
|
SQL.Add(' where fpid=''' + Trim(CDS_Main.fieldbyname('fpid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
// Order_Main.Delete;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
initgrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update fp_main Set fkstatus=''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
|||
|
|
|||
|
SQL.Add(' where fpid=''' + Trim(CDS_Main.fieldbyname('fpid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
// Order_Main.Delete;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
initgrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[TV1Column4.Index] = null) then
|
|||
|
begin
|
|||
|
ACanvas.font.Color := clred;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton6Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, FTaiTou: string;
|
|||
|
EngMoney, LBName, fImagePath2: string;
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf';
|
|||
|
ExportFtErpFile('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥.rmf', ADOQueryPrint);
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete TBSubID where DName=''' + Trim(DCode) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM TBSubID where 1=2 ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
|
|||
|
CDS_Main.DisableControls;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
begin
|
|||
|
|
|||
|
ADOQueryCmd.append;
|
|||
|
ADOQueryCmd.fieldbyname('SubId').Value := Trim(CDS_Main.fieldbyname('FPID').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update fp_main Set fkstatus=''<27>Ѹ<EFBFBD><D1B8><EFBFBD>'' ');
|
|||
|
|
|||
|
SQL.Add(' where fpid=''' + Trim(CDS_Main.fieldbyname('fpid').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
// Order_Main.Delete;
|
|||
|
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Print_FKSQD ');
|
|||
|
|
|||
|
SQL.ADD('@DCODE=''' + Trim(DCode) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
Sleep(1000);
|
|||
|
RM1.ShowReport;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
// Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ص<EFBFBD>.rmf'), '<27><>ʾ', 0);
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + trim(fPrintFile)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TOCOUNTRYKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.ToolButton7Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, fImagePath2: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
LBName := '<27>˷ѵ<CBB7><D1B5><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
ExportFtErpFile(Trim(LBName) + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM2.LoadFromFile(fPrintFile);
|
|||
|
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
|||
|
if FileExists(fImagePath2) then
|
|||
|
DeleteFile(fImagePath2);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
|
|||
|
RM2.PrepareReport;
|
|||
|
RM2.ExportTo(RMXLSExport1, fImagePath2);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf'), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.cxButtonEdit1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'KDFACTORYNAME';
|
|||
|
flagname := '<27><><EFBFBD>ݹ<EFBFBD>˾';
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmGJKDList.TV1Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate KD_MAIN ');
|
|||
|
sql.Add(' Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
|||
|
sql.Add(' where KDID=' + CDS_Main.fieldbyname('KDID').AsString);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
except
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|