1633 lines
46 KiB
ObjectPascal
1633 lines
46 KiB
ObjectPascal
![]() |
unit U_JHDMAKELIST;
|
|||
|
|
|||
|
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, Registry, frxExportRTF, frxExportImage,
|
|||
|
frxExportPDF, frxExportXLSX, frxExportDOCX, frxClass, frxExportBIFF, frxDBSet,
|
|||
|
dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
|||
|
|
|||
|
type
|
|||
|
TfrmJHDMAKEList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
TBDel: TToolButton;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
ClientDataSet1: TClientDataSet;
|
|||
|
Label6: TLabel;
|
|||
|
A4FPNO: TEdit;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
DataSource2: TDataSource;
|
|||
|
ClientDataSet2: TClientDataSet;
|
|||
|
Label5: TLabel;
|
|||
|
BGTAITOU: TEdit;
|
|||
|
TBCopy: TToolButton;
|
|||
|
CDS_Print: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
TBView: TToolButton;
|
|||
|
Label4: TLabel;
|
|||
|
hZORDERNO: TEdit;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Panel2: TPanel;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
CDS_LABEL: TClientDataSet;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
frxReport1: TfrxReport;
|
|||
|
frxDBDataset2: TfrxDBDataset;
|
|||
|
frxBIFFExport1: TfrxBIFFExport;
|
|||
|
frxDOCXExport1: TfrxDOCXExport;
|
|||
|
frxXLSXExport1: TfrxXLSXExport;
|
|||
|
frxPDFExport1: TfrxPDFExport;
|
|||
|
frxJPEGExport1: TfrxJPEGExport;
|
|||
|
frxRTFExport1: TfrxRTFExport;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
TV1: TcxGridDBTableView;
|
|||
|
tv2Column1: TcxGridDBColumn;
|
|||
|
TV1Column12: TcxGridDBColumn;
|
|||
|
tv2Column3: TcxGridDBColumn;
|
|||
|
TV1Column11: TcxGridDBColumn;
|
|||
|
TV1Column10: TcxGridDBColumn;
|
|||
|
TV1Column9: TcxGridDBColumn;
|
|||
|
TV1Column7: TcxGridDBColumn;
|
|||
|
tv2Column2: TcxGridDBColumn;
|
|||
|
TV1Column2: TcxGridDBColumn;
|
|||
|
TV1Column3: TcxGridDBColumn;
|
|||
|
TV1Column5: TcxGridDBColumn;
|
|||
|
TV1Column1: TcxGridDBColumn;
|
|||
|
TV1Column4: TcxGridDBColumn;
|
|||
|
TV1Column6: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
frxDBDataset1: TfrxDBDataset;
|
|||
|
frxDBDataset3: TfrxDBDataset;
|
|||
|
frxDBDataset4: TfrxDBDataset;
|
|||
|
TV1Column8: TcxGridDBColumn;
|
|||
|
TV1Column13: TcxGridDBColumn;
|
|||
|
ComboBox2: TComboBox;
|
|||
|
TV1Column14: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
ywy: TEdit;
|
|||
|
Panel3: TPanel;
|
|||
|
Label10: TLabel;
|
|||
|
YWYNAME: TComboBox;
|
|||
|
Button1: TButton;
|
|||
|
Button2: TButton;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
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 TBDelClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure TBEditClick(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 BGTAITOUKeyPress(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 TBSSClick(Sender: TObject);
|
|||
|
procedure TBSSCXClick(Sender: TObject);
|
|||
|
procedure TBHDClick(Sender: TObject);
|
|||
|
procedure TBHDCXClick(Sender: TObject);
|
|||
|
procedure TBSHClick(Sender: TObject);
|
|||
|
procedure TBSHCXClick(Sender: TObject);
|
|||
|
procedure TBAllClick(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure huodaiBtnClick(Sender: TObject);
|
|||
|
procedure B7DaoHuoGangBtnClick(Sender: TObject);
|
|||
|
procedure BtnEditA1BtnClick(Sender: TObject);
|
|||
|
procedure Button7Click(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ZordernoChange(Sender: TObject);
|
|||
|
procedure ZordernoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ComboBox2Change(Sender: TObject);
|
|||
|
procedure YWYNAMEDropDown(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure TV1Column13PropertiesChange(Sender: TObject);
|
|||
|
|
|||
|
|
|||
|
// procedure img1Click(Sender: TObject);
|
|||
|
private
|
|||
|
canshu2: string;
|
|||
|
FDate: TDateTime;
|
|||
|
procedure InitGrid();
|
|||
|
function DelData(): Boolean;
|
|||
|
function GetShellFolders(strDir: string): string;
|
|||
|
procedure InitSubGrid();
|
|||
|
procedure InitGridSql(var fsj: string);
|
|||
|
procedure InitPrtData();
|
|||
|
procedure PrintMD(MStatus: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
canshu1, canshu3: string;
|
|||
|
FDY: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
//frmBaoGuanList: TfrmBaoGuanList;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_Fun, U_JHDInPut;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmJHDMAKEList.PrintMD(MStatus: string);
|
|||
|
var
|
|||
|
fImagePath2, fPrintFile, fPrintFile10, FMainID, FKHName, FFPNo: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
// FMainID := '';
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
if CDS_Label.Locate('LMName', trim(ComboBox1.Text), []) then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @FPNO=' + quotedstr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_PRINT);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_PRINT);
|
|||
|
end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CWMD3 @FPNO=' + quotedstr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_hz);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_hz);
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['ZDR'] := trim(DName);
|
|||
|
RM1.ShowReport;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
//frmBaoGuanList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Application := MainApplication;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
canshu1 := Trim(DParameters1);
|
|||
|
canshu2 := Trim(DParameters2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 * from (');
|
|||
|
sql.Add('select A.* ');
|
|||
|
SQL.Add(',hZORDERNO=cast((select DISTINCT B.ORDERNO+'';'' from JHD_SUB B where A.JHID=B.JHID AND SVALID=''Y'' for xml path('''')) as varchar(200))');
|
|||
|
sql.Add(',C4BGQtyHZ=(select Sum(C4BGQty) from JHD_SUB B where B.JHID=A.JHID and B.SValid=''Y'' )');
|
|||
|
sql.Add(',BGTJHZ=(select Sum(BGTJ) from JHD_SUB B where B.JHID=A.JHID and B.SValid=''Y'' )');
|
|||
|
// SQL.Add(',ZGCNAME=cast((select B.GCNAME+'';'' from JYOrder_BaoGuan_SUB B where B.BGID=A.BGID AND SVALID=''Y'' for xml path('''')) as varchar(200))');
|
|||
|
// SQL.Add(',ZC3BGNameEng=cast((select B.C3BGNameEng+'';'' from JYOrder_BaoGuan_SUB B where B.BGID=A.BGID AND SVALID=''Y'' for xml path('''')) as varchar(200))');
|
|||
|
// SQL.Add(',ZBGCODENAME=cast((select B.BGCODENAME+'';'' from JYOrder_BaoGuan_SUB B where B.BGID=A.BGID AND SVALID=''Y'' for xml path('''')) as varchar(200))');
|
|||
|
|
|||
|
sql.Add(' from JHD_MAIN A ');
|
|||
|
sql.Add(' where A.Valid=''Y'' ');
|
|||
|
// sql.Add(fwhere);
|
|||
|
|
|||
|
|
|||
|
sql.Add(')AA WHERE 1=1');
|
|||
|
sql.Add(fwhere);
|
|||
|
if ComboBox2.Text = '<27>Ƶ<EFBFBD>ʱ<EFBFBD><CAB1>' then
|
|||
|
begin
|
|||
|
sql.Add(' and filltime>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
sql.Add(' and filltime<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
SQL.Add('ORDER BY CHUANDATE ,htdate DESC');
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
sql.Add(' and CHUANDATE>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + '''');
|
|||
|
sql.Add(' and CHUANDATE<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + '''');
|
|||
|
SQL.Add('ORDER BY CHUANDATE ,FILLTIME DESC');
|
|||
|
end;
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + self.Caption, Tv1, '<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>7');
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.FormShow(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := 'select distinct(LMName) name from Lbael_Map where LMType=''<27><>֤'' ';
|
|||
|
SInitComBoxBySql(ADOQueryCmd, ComboBox1, true, fsj);
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
Sql.Add('select * from Lbael_Map where LMType=''<27><>֤''');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_Label);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_Label);
|
|||
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + self.Caption, Tv1, '<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>7');
|
|||
|
//
|
|||
|
// canshu1 := Trim(DParameters1);
|
|||
|
//// ShowMessage(canshu1);
|
|||
|
//
|
|||
|
// InitGrid();
|
|||
|
// RM1.CanExport := true;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
SelExportData(Tv1, ADOQueryMain, '<27><><EFBFBD>㵥<EFBFBD>б<EFBFBD>');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.InitSubGrid();
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty = False then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JHD_SUB where JHID=''' + Trim(CDS_Main.fieldbyname('JHID').AsString) + '''');
|
|||
|
sql.Add(' and SValid=''Y'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JHD_SUB where 1=2');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
SCreateCDS20(ADOQueryTemp, ClientDataSet2);
|
|||
|
SInitCDSData20(ADOQueryTemp, ClientDataSet2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
if DelData() then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmJHDMAKEList.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 JHD_MAIN Set Valid=''N'',C7BGMoneyHZ=Null,E1BZQtyHZ=Null, E2ChiMaQtyHZ=Null,E3MaoZHZ=Null,E4JingZHZ=Null');
|
|||
|
sql.Add(',Editer=''' + Trim(DName) + ''',EditTime=getdate()');
|
|||
|
sql.Add(' where JHId=''' + Trim(CDS_Main.fieldbyname('JHId').AsString) + '''');
|
|||
|
sql.Add('UPdate JHD_SUB Set SValid=''N'',SEditer=''' + Trim(DName) + ''',SEditTime=getdate() where JHId=''' + Trim(CDS_Main.fieldbyname('JHId').AsString) + '''');
|
|||
|
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>㵥ɾ<E3B5A5><C9BE>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>Ʊ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('A4FPNO').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
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 TfrmJHDMAKEList.TBAddClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmJHDInPut := tfrmJHDInPut.Create(Application);
|
|||
|
with frmJHDInPut do
|
|||
|
begin
|
|||
|
FBCId := '';
|
|||
|
canshu3 := self.canshu3;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmJHDInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('select * from YF_Money_CR_Sub A INNER JOIN YF_Money_CR B ON A.YFID=B.YFID WHERE SUBWXFPNO=' + QuotedStr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmJHDInPut := tfrmJHDInPut.Create(Application);
|
|||
|
with frmJHDInPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('JHID').AsString);
|
|||
|
|
|||
|
canshu3 := self.canshu3;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmJHDInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.FactoryNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.CRTypeChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.A4FPNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if Trim(A4FPNO.Text) = '' then
|
|||
|
Exit;
|
|||
|
fsj := ' and isnull(A.A4FPNO,'''') like ''' + '%' + Trim(A4FPNO.Text) + '%' + '''';
|
|||
|
InitGridSql(fsj);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.Tv1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.BGTAITOUKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.TBCopyClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
try
|
|||
|
frmJHDInPut := tfrmJHDInPut.Create(Application);
|
|||
|
with frmJHDInPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('JHID').AsString);
|
|||
|
CopyStr := '99';
|
|||
|
//TBDel.Visible:=False;
|
|||
|
//TBAdd.Visible:=False;
|
|||
|
canshu3 := self.canshu3;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmJHDInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.TBViewClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
//if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
try
|
|||
|
frmJHDInPut := tfrmJHDInPut.Create(Application);
|
|||
|
with frmJHDInPut do
|
|||
|
begin
|
|||
|
FBCId := Trim(CDS_Main.fieldbyname('JHID').AsString);
|
|||
|
TBSave.Visible := False;
|
|||
|
ToolBar2.Visible := False;
|
|||
|
Panel1.Enabled := False;
|
|||
|
Tv1.OptionsData.Editing := False;
|
|||
|
canshu3 := self.canshu3;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmJHDInPut.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.TBSSClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SStime=getdate(),SChker=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBSSCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_BaoGuan_Main ');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('OKPerson').AsString) <> '' then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox('<27>Ѻ˶Բ<CBB6><D4B2>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SStime=Null,SChker=Null');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBHDClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>к˶Բ<CBB6><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27>Ѻ˶<D1BA>'',OKTime=getdate(),OKPerson=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBHDCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('SSel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from JYOrder_BaoGuan_Main ');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryTemp.fieldbyname('Chker').AsString) <> '' then
|
|||
|
begin
|
|||
|
CDS_Main.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ܳ<EFBFBD><DCB3><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>к˶Գ<CBB6><D4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',OKtime=Null,OKPerson=Null');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBSHClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',ChkTime=getdate(),Chker=''' + Trim(DName) + '''');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TBSHCXClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
CDS_Main.DisableControls;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while Locate('SSel', True, []) = True do
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JYOrder_BaoGuan_Main Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',ChkTime=Null,Chker=Null');
|
|||
|
sql.Add(' where BGID=''' + Trim(CDS_Main.fieldbyname('BGID').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSubGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
PrintMD('Report');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.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 TfrmJHDMAKEList.Button7Click(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;
|
|||
|
|
|||
|
if canshu3 = 'ҵ<><D2B5>Ա' then
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '(ҵ<><D2B5>).rmf';
|
|||
|
ExportFtErpFile(Trim(LBName) + '(ҵ<><D2B5>).rmf', ADOQueryPrint);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
|||
|
ExportFtErpFile(Trim(LBName) + '.rmf', ADOQueryPrint);
|
|||
|
end;
|
|||
|
|
|||
|
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('bgid').AsString);
|
|||
|
ADOQueryCmd.fieldbyname('Dname').Value := Trim(DCode);
|
|||
|
ADOQueryCmd.post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
if LBName = '<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Print_BGD4 ');
|
|||
|
|
|||
|
SQL.ADD('@DCODE=''' + Trim(DCode) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Print_BGD2 ');
|
|||
|
|
|||
|
SQL.ADD('@DCODE=''' + Trim(DCode) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_Print);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_Print);
|
|||
|
end;
|
|||
|
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
if FDY = '0' then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
Sleep(1000);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else if FDY = '1' then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
|||
|
if FileExists(fImagePath2) then
|
|||
|
DeleteFile(fImagePath2); //label.xls
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\' + Trim(CDS_Main.fieldbyname('orderno').AsString) + '.xls';
|
|||
|
ShowMessage(fImagePath2);
|
|||
|
RM1.PrepareReport;
|
|||
|
Sleep(1000);
|
|||
|
RM1.ExportTo(RMXLSExport1, fImagePath2);
|
|||
|
end;
|
|||
|
|
|||
|
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 TfrmJHDMAKEList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fImagePath2, fPrintFile, fPrintFile10, FMainID, FKHName, FFPNo: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
FMainID := '';
|
|||
|
|
|||
|
// ExportFtErpFile(trim(ComboBox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
|
|||
|
if CDS_Label.Locate('LMName', trim(ComboBox1.Text), []) then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @FPNO=' + quotedstr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_PRINT);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_PRINT);
|
|||
|
end;
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec P_Print_CWMD3 @FPNO=' + quotedstr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_hz);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_hz);
|
|||
|
frxDOCXExport1.FileName := '(' + Trim(CDS_Main.fieldbyname('A4FPNO').AsString) + ') INVOICE';
|
|||
|
|
|||
|
frxRTFExport1.FileName := '(' + Trim(CDS_Main.fieldbyname('A4FPNO').AsString) + ') INVOICE';
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.fr3';
|
|||
|
ExportFtErpFile(trim(ComboBox1.Text) + '.fr3', ADOQueryTemp);
|
|||
|
|
|||
|
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\P.fr3';
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
|
|||
|
frxReport1.LoadFromFile(fPrintFile);
|
|||
|
frxReport1.ShowReport;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ZordernoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ZordernoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
// 2123
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile, FTaiTou: string;
|
|||
|
EngMoney, LBName, fImagePath2: string;
|
|||
|
begin
|
|||
|
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ComboBox1.Text) + '.rmf';
|
|||
|
ExportFtErpFile(Trim(ComboBox1.Text) + '.rmf', ADOQueryPrint);
|
|||
|
|
|||
|
if CDS_Label.Locate('LMName', trim(ComboBox1.Text), []) then
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @FPNO=' + quotedstr(Trim(CDS_Main.fieldbyname('A4FPNO').AsString)));
|
|||
|
// sql.add('exec ' + trim(CDS_Label.fieldbyname('LMSql').AsString) + ' @CKOrdNo=' + quotedstr(Trim(CDS_Main.fieldbyname('CKOrdNo').AsString)));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryPrint, CDS_PRINT);
|
|||
|
SInitCDSData20(ADOQueryPrint, CDS_PRINT);
|
|||
|
end;
|
|||
|
RMXLSExport1 := TRMXLSExport.Create(RMXLSExport1);
|
|||
|
RMXLSExport1.ShowDialog := False;
|
|||
|
// RMXLSExport1.ShowAfterExport := False;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
|||
|
if FileExists(fImagePath2) then
|
|||
|
DeleteFile(fImagePath2); //label.xls
|
|||
|
fImagePath2 := GetShellFolders('Desktop') + '\(' + Trim(CDS_Main.fieldbyname('A4FPNO').AsString) + ') INVOICE' + '.xls';
|
|||
|
// ShowMessage(fImagePath2);
|
|||
|
RM1.PrepareReport;
|
|||
|
Sleep(1000);
|
|||
|
RM1.ExportTo(RMXLSExport1, fImagePath2);
|
|||
|
|
|||
|
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 TfrmJHDMAKEList.TV1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if (AViewInfo.GridRecord.Values[TV1Column13.Index] = NULL) then
|
|||
|
begin
|
|||
|
|
|||
|
ACanvas.font.Color := clRed;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ComboBox2Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.YWYNAMEDropDown(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('SELECT * FROM SY_User WHERE Udept LIKE ''%<25>ͷ<EFBFBD>%'' ');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
YWYname.Items.Clear;
|
|||
|
while not ADOQueryTemp.eof do
|
|||
|
begin
|
|||
|
YWYname.Items.Add(Trim(ADOQueryTemp.fieldbyname('username').AsString));
|
|||
|
ADOQueryTemp.next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel3.Visible := False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
|
|||
|
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 JHD_MAIN Set ywy=' + QuotedStr(Trim(ywyname.Text)));
|
|||
|
sql.Add(' where JHId=''' + Trim(CDS_Main.fieldbyname('JHId').AsString) + '''');
|
|||
|
|
|||
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
sql.Add(',getdate() ');
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD>㵥<EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ա')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>Ʊ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('A4FPNO').AsString) + ';ԭҵ<D4AD><D2B5>Ա<EFBFBD><D4B1>' + trim(CDS_Main.FieldByName('ywy').AsString) + ';<3B><>ҵ<EFBFBD><D2B5>Ա<EFBFBD><D4B1>' + trim(ywyname.Text))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
CDS_Main.Delete;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
Application.MessageBox('<27>ijɹ<C4B3><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
InitGrid();
|
|||
|
panel3.Visible := false;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
|||
|
Application.MessageBox('<27><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
Panel3.Visible := True;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJHDMAKEList.TV1Column13PropertiesChange(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('UPdate JHD_MAIN Set ' + FFieldName + '=' + QuotedStr(Trim(mvalue)));
|
|||
|
// sql.add(',KPDATE=' + quotedstr(FormatDateTime('yyyy-MM-dd', kpdate.DateTime)));
|
|||
|
sql.Add(' where jhid=''' + Trim(CDS_Main.fieldbyname('JHID').AsString) + '''');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
ExecSQL;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|