D7szChenfeng/合同管理(ContractManagement.dll)/U_ZdyAttachSX.pas
DESKTOP-E401PHE\Administrator ccdaa90a0f 移交
2025-07-22 15:51:47 +08:00

833 lines
22 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_ZdyAttachSX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ComObj,
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
cxButtonEdit, cxTextEdit, Menus, cxLookAndFeelPainters, cxButtons,
cxContainer, cxImage, cxDBEdit;
type
FdDy=record
inc: integer; //客户端套接字句柄
FDdys:string[32]; //客户端套接字
FdDysName:string[32]; //客户端套接字
end;
TfrmZdyAttachSX = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBDel: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
ADOQueryMain: TADOQuery;
ToolButton1: TToolButton;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
DEFstr6: TEdit;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
ToolButton3: TToolButton;
Label1: TLabel;
ZdyName: TEdit;
ToolButton4: TToolButton;
Label2: TLabel;
OpenDialog1: TOpenDialog;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
v2Column2: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v2DEFstr3: TcxGridDBColumn;
v2Column16: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
v2Mrate: TcxGridDBColumn;
v2defflt1: TcxGridDBColumn;
v2Column14: TcxGridDBColumn;
v2Column15: TcxGridDBColumn;
v2Column8: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Pan_image: TPanel;
Picture4: TcxDBImage;
DSImage: TDataSource;
ADOQueryImage: TADOQuery;
Label5: TLabel;
Filler: TEdit;
DEFstr3: TEdit;
Label9: TLabel;
DEFstr2: TEdit;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
Panel2: TPanel;
Label4: TLabel;
RadioGroup1: TRadioGroup;
cxButton1: TcxButton;
cxButton2: TcxButton;
ToYJ: TToolButton;
TFZ: TToolButton;
v2Ssel: TcxGridDBColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
cxGrid1: TcxGrid;
TV1: TcxGridDBTableView;
V2Column1: TcxGridDBColumn;
cxGridDBColumn1: TcxGridDBColumn;
V2Column10: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Label6: TLabel;
Label7: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
CP_Sub: TClientDataSet;
DS_CP: TDataSource;
ADOQueryTmp: TADOQuery;
V1Column1: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure DEFstr6Change(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure cxButton2Click(Sender: TObject);
procedure cxButton1Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure Tv2CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure FormResize(Sender: TObject);
procedure ToYJClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TFZClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView;
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
ANewItemRecordFocusingChanged: Boolean);
private
fFlileFlag:string;
procedure InitImage();
procedure InitSub();
{ Private declarations }
procedure InitGrid();
public
canshu1:string;
fkhType:string;
dFdDy: array[0..20] of FdDy;
end;
//var
// frmZdyAttachSX: TfrmZdyAttachSX;
implementation
uses
U_DataLink,U_Fun,U_ZDYHelp,U_ZdyAttInputCP, U_ZdyAttInputCP_other;
{$R *.dfm}
procedure TfrmZdyAttachSX.InitImage();
begin
with ADOQueryImage do
begin
close;
sql.Clear;
sql.Add('select * from TP_File A');
sql.Add('where WBID='+quotedstr(trim(CDS_HZ.fieldbyname('ATID').AsString)));
open;
end;
end;
procedure TfrmZdyAttachSX.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add(' select A.* ');
sql.Add(',RKQty=(select Sum(B.Qty) from CK_BanCP_CR B where B.CRFlag=''入库'' and B.C_Color=A.DEFstr3 ');
sql.Add(' and (B.C_CodeName=A.ZdyName or B.C_CodeName=A.defNote3) and B.CRType=''检验入库'' and convert(varchar(4),B.CRTime,120)=convert(varchar(4),getdate(),120))');
sql.Add(' from KH_Zdy_Attachment A ');
SQL.Add(' where A.Type=''CP'' ');
sql.Add(' and A.FillTIme>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)) + '''');
sql.Add(' and A.FillTIme<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.DateTime + 1)) + '''');
sql.Add(' order by zdyName,dbo.getNum(Defstr3) ');
//ShowMessage(SQL.Text);
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmZdyAttachSX.InitSub();
begin
if CDS_HZ.IsEmpty then
exit;
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment_Sub ');
sql.Add('where ATID =' + quotedstr((CDS_HZ.fieldbyname('ATID').AsString)));
open;
// ShowMessage(SQL.Text);
end;
SCreateCDS20(ADOQueryTmp, CP_Sub);
SInitCDSData20(ADOQueryTmp, CP_Sub);
end;
procedure TfrmZdyAttachSX.FormDestroy(Sender: TObject);
begin
// frmZdyAttachCP:=nil;
end;
procedure TfrmZdyAttachSX.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmZdyAttachSX.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('产品资料13',Tv2,'客户自定义');
Close;
end;
procedure TfrmZdyAttachSX.TBDelClick(Sender: TObject);
begin
if CDS_HZ.IsEmpty then Exit;
if CDS_HZ.Locate('Ssel',True,[])=false then
begin
application.MessageBox('没有选择数据','提示');
exit;
end;
if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit;
CDS_HZ.DisableControls;
with CDS_HZ do
begin
First;
while not eof do
begin
if FieldByName('Ssel').AsBoolean=True then
begin
if Trim(CDS_HZ.fieldbyname('ATID').AsString)<>'' then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('delete KH_Zdy_Attachment where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
sql.Add('delete KH_Zdy_Attachment_Sub where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
sql.Add('delete KH_Zdy where ZdyNo='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
ExecSQL;
end;
end;
CDS_HZ.Delete;
end
else
next;
end;
end;
CDS_HZ.EnableControls;
end;
procedure TfrmZdyAttachSX.FormShow(Sender: TObject);
begin
ReadCxGrid('产品资料13',Tv2,'客户自定义');
ToolButton4.Visible:=false;
TBDel.Visible:=false;
ToYJ.Visible:=false;
BegDate.DateTime := SGetServerDate10(ADOQueryTemp) - 90;
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
if canshu1='高权限' then
begin
ToolButton4.Visible:=true;
TBDel.Visible:=true;
ToYJ.Visible:=true;
end;
fFlileFlag:=UserDataFlag+'YP';
//InitGrid();
end;
procedure TfrmZdyAttachSX.TBRafreshClick(Sender: TObject);
begin
Panel1.SetFocus;
InitGrid();
end;
procedure TfrmZdyAttachSX.ToolButton2Click(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_HZ);
SInitCDSData20(ADOQueryMain,CDS_HZ);
end;
end;
procedure TfrmZdyAttachSX.DEFstr6Change(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure TfrmZdyAttachSX.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then Exit;
TcxGridToExcel(self.Caption,cxgrid2);
// SelExportData(Tv2,ADOQueryMain,'产品资料列表');
end;
procedure TfrmZdyAttachSX.ToolButton4Click(Sender: TObject);
begin
if CDS_HZ.IsEmpty then
Exit;
if CDS_HZ.Locate('SSel',True,[])=False then
begin
Application.MessageBox('请先选择数据!','提示',0);
Exit;
end;
try
frmZdyAttInputCP_other:=TfrmZdyAttInputCP_other.Create(Application);
with frmZdyAttInputCP_other do
begin
FFlag:=1;
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
fkhType:=self.fkhType;
fFlileFlag:=self.fFlileFlag;
if ShowModal=1 then
begin
TBRafresh.Click;
end;
end;
finally
frmZdyAttInputCP_other.Free;
end;
{
try
frmZdyAttInputCP:=TfrmZdyAttInputCP.Create(Application);
with frmZdyAttInputCP do
begin
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
fkhType:=self.fkhType;
if ShowModal=1 then
begin
TBRafresh.Click;
end;
end;
finally
frmZdyAttInputCP.Free;
end;}
end;
procedure TfrmZdyAttachSX.ToolButton3Click(Sender: TObject);
begin
try
frmZdyAttInputCP_other:=TfrmZdyAttInputCP_other.Create(Application);
with frmZdyAttInputCP_other do
begin
FFlag:=0;
FCYID:='';
fkhType:=self.fkhType;
fFlileFlag:=self.fFlileFlag;
if ShowModal=1 then
begin
TBRafresh.Click;
end;
end;
finally
frmZdyAttInputCP_other.Free;
end;
{
try
frmZdyAttInputCP:=TfrmZdyAttInputCP.Create(Application);
with frmZdyAttInputCP do
begin
FCYID:='';
fkhType:=self.fkhType;
if ShowModal=1 then
begin
TBRafresh.Click;
end;
end;
finally
frmZdyAttInputCP.Free;
end; }
end;
procedure TfrmZdyAttachSX.ToolButton5Click(Sender: TObject);
var
excelApp,WorkBook:Variant;
i,j,k,ExcelRowCount:integer;
maxId: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('加载EXCEL错误','错误信息',MB_ICONERROR);
exit;
end;
try
k:=0;
for i:=1 to 20 do
begin
if trim(excelapp.Cells[1,i].value)='' then break;
if trim(excelapp.Cells[1,i].value)='系统编号' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='ZdyCode';
dFdDy[k].FdDysName:='系统编号';
end;
if trim(excelapp.Cells[1,i].value)='花型编号' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='ZdyName';
dFdDy[k].FdDysName:='花型编号';
end;
if trim(excelapp.Cells[1,i].value)='跟单同花型' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='defNote3';
dFdDy[k].FdDysName:='defNote3';
end;
if trim(excelapp.Cells[1,i].value)='色号' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr3';
dFdDy[k].FdDysName:='色号';
end;
if trim(excelapp.Cells[1,i].value)='中英文颜色' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr6';
dFdDy[k].FdDysName:='中英文颜色';
end;
if trim(excelapp.Cells[1,i].value)='规格' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr1';
dFdDy[k].FdDysName:='规格';
end;
if trim(excelapp.Cells[1,i].value)='成份' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr2';
dFdDy[k].FdDysName:='成份';
end;
if trim(excelapp.Cells[1,i].value)='门幅' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr7';
dFdDy[k].FdDysName:='门幅';
end;
if trim(excelapp.Cells[1,i].value)='克重' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFstr8';
dFdDy[k].FdDysName:='克重';
end;
if trim(excelapp.Cells[1,i].value)='操作员' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='Filler';
dFdDy[k].FdDysName:='操作员';
end;
if trim(excelapp.Cells[1,i].value)='操作时间' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='FillTime';
dFdDy[k].FdDysName:='操作时间';
end;
if trim(excelapp.Cells[1,i].value)='成本' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DEFFlt2';
dFdDy[k].FdDysName:='成本';
end;
if trim(excelapp.Cells[1,i].value)='制卡代号' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='defstr9';
dFdDy[k].FdDysName:='制卡代号';
end;
if trim(excelapp.Cells[1,i].value)='价格A' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='Price1';
dFdDy[k].FdDysName:='价格A';
end;
if trim(excelapp.Cells[1,i].value)='价格B' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='Price2';
dFdDy[k].FdDysName:='价格B';
end;
if trim(excelapp.Cells[1,i].value)='价格C' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='Price3';
dFdDy[k].FdDysName:='价格C';
end;
if trim(excelapp.Cells[1,i].value)='初次市场' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='CCShiChang';
dFdDy[k].FdDysName:='初次市场';
end;
if trim(excelapp.Cells[1,i].value)='客户唛头' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='KHMaiTou';
dFdDy[k].FdDysName:='客户唛头';
end;
if trim(excelapp.Cells[1,i].value)='客户代号' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='KHDaiMa';
dFdDy[k].FdDysName:='客户代号';
end;
if trim(excelapp.Cells[1,i].value)='中间商' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='ZJSName';
dFdDy[k].FdDysName:='中间商';
end;
if trim(excelapp.Cells[1,i].value)='头距' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='TouJu';
dFdDy[k].FdDysName:='头距';
end;
if trim(excelapp.Cells[1,i].value)='网布' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='DBName';
dFdDy[k].FdDysName:='网布';
end;
if trim(excelapp.Cells[1,i].value)='针数' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='ZhenQty';
dFdDy[k].FdDysName:='针数';
end;
if trim(excelapp.Cells[1,i].value)='前道风格' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='FengGe';
dFdDy[k].FdDysName:='前道风格';
end;
if trim(excelapp.Cells[1,i].value)='后道风格' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='HDFengGe';
dFdDy[k].FdDysName:='后道风格';
end;
if trim(excelapp.Cells[1,i].value)='前道价格' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='QDPrice';
dFdDy[k].FdDysName:='前道价格';
end;
if trim(excelapp.Cells[1,i].value)='后道价格' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='HDPrice';
dFdDy[k].FdDysName:='后道价格';
end;
if trim(excelapp.Cells[1,i].value)='前道加工厂' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='QDJGName';
dFdDy[k].FdDysName:='前道加工厂';
end;
if trim(excelapp.Cells[1,i].value)='后道加工厂' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='HDJGName';
dFdDy[k].FdDysName:='后道加工厂';
end;
if trim(excelapp.Cells[1,i].value)='辅料备注' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='FLNote';
dFdDy[k].FdDysName:='辅料备注';
end;
if trim(excelapp.Cells[1,i].value)='YM' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='Note';
dFdDy[k].FdDysName:='YM';
end;
if trim(excelapp.Cells[1,i].value)='备注' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='CPNote';
dFdDy[k].FdDysName:='备注';
end;
if trim(excelapp.Cells[1,i].value)='样品位置' then
begin
dFdDy[k].inc:=i;
dFdDy[k].FDdys:='YPPlace';
dFdDy[k].FdDysName:='样品位置';
end;
k:=k+1;
end;
except
end;
ADOQueryCmd.Connection.BeginTrans;
try
for i := 2 to excelrowcount do
begin
if GetLSNo(ADOQueryCmd,maxId,'AT','KH_Zdy_Attachment',4,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('取最大号失败!','提示',0);
Exit;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('select * from KH_Zdy_Attachment where 1=2');
open;
end;
ADOQueryCmd.Append;
for j:=0 to k-1 do
begin
ADOQueryCmd.fieldbyname(dFdDy[j].FDdys).Value:=excelapp.Cells[i,dFdDy[j].inc].Value;
end;
ADOQueryCmd.FieldByName('ATID').Value:=Trim(maxId);
ADOQueryCmd.FieldByName('zdyCode').Value:=Trim(maxId);
ADOQueryCmd.FieldByName('khType').Value:=Trim(fkhType);
ADOQueryCmd.FieldByName('Type').Value:='CP';
ADOQueryCmd.FieldByName('Filler').Value:=Trim(DName);
ADOQueryCmd.Post;
end;
WorkBook.Close;
ExcelApp.Quit;
ExcelApp := Unassigned;
WorkBook := Unassigned;
ADOQueryCmd.Connection.CommitTrans;
InitGrid();
except
WorkBook.Close;
ExcelApp.Quit;
ExcelApp := Unassigned;
WorkBook := Unassigned;
ADOQueryCmd.Connection.RollbackTrans;
end;
end;
procedure TfrmZdyAttachSX.cxButton2Click(Sender: TObject);
begin
Panel2.Visible:=false;
end;
procedure TfrmZdyAttachSX.cxButton1Click(Sender: TObject);
var
fPrintFile:string;
Txt,fImagePath:string;
Moudle: THandle;
Makebar:TMakebar;
Mixtext:TMixtext;
begin
IF CDS_HZ.IsEmpty then exit;
try
Moudle:=LoadLibrary('MakeQRBarcode.dll');
@Makebar:=GetProcAddress(Moudle,'Make');
@Mixtext:=GetProcAddress(Moudle,'MixText');
Txt:=Trim(CDS_HZ.fieldbyname('ZDYCODE').AsString);
fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp' ;
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
if FileExists(fImagePath) then DeleteFile(fImagePath);
Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
except
application.MessageBox('条形码生成失败!','提示信息',MB_ICONERROR);
exit;
end;
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\'+trim(RadioGroup1.Items[RadioGroup1.ItemIndex])+'.rmf' ;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE']:=fImagePath;
RM1.LoadFromFile(fPrintFile);
// Rm2.DefaultCopies:=strtointdef(trim(ComboBox1.Text),1);
// RM1.ShowReport;
RM1.PrintReport;
end
else
Application.MessageBox(PChar('没有找到文件'+fPrintFile),'提示',0);
end;
procedure TfrmZdyAttachSX.ToolButton6Click(Sender: TObject);
begin
Panel2.Left:=(self.Width-Panel2.Width) div 2;
Panel2.Top:=(self.Height-Panel2.Height) div 2 -100;
Panel2.Visible:=true;
end;
procedure TfrmZdyAttachSX.Tv2CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
InitImage();
end;
procedure TfrmZdyAttachSX.FormResize(Sender: TObject);
begin
Pan_image.Left:=self.Width-Pan_image.Width-30;
Pan_image.Top:=self.Height-Pan_image.Height-80;
end;
procedure TfrmZdyAttachSX.ToYJClick(Sender: TObject);
var
FValue,FFValue,FColumn,FFColumn,FZdyName:String;
begin
FColumn:=Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
FFColumn:=Tv2.Controller.FocusedColumn.Summary.GroupFormat;
FValue:=Trim(CDS_HZ.fieldbyname(FColumn).AsString);
if Trim(FFColumn)<>'' then
begin
FFValue:=Trim(CDS_HZ.fieldbyname(FFColumn).AsString);
end;
if FValue='' then
begin
FValue:='0';
end;
FZdyName:=Trim(CDS_HZ.fieldbyname('ZdyName').AsString);
with CDS_HZ do
begin
DisableControls;
First;
while not Eof do
begin
if FZdyName=Trim(CDS_HZ.fieldbyname('ZdyName').AsString) then
begin
Edit;
if FValue='' then
begin
CDS_HZ.FieldByName(FColumn).Value:=null;
end else
begin
CDS_HZ.FieldByName(FColumn).Value:=FValue;
end;
if Trim(FFColumn)<>'' then
begin
if FFValue='' then
begin
CDS_HZ.FieldByName(FFColumn).Value:=null;
end else
begin
CDS_HZ.FieldByName(FFColumn).Value:=FFValue;
end;
end;
with ADOQueryCmd do
begin
close;
sql.Clear;
sql.Add('update KH_Zdy_Attachment set ');
sql.Add( FColumn+'='+trim(FValue));
sql.Add(' where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
ExecSQL;
end;
end;
Next;
end;
EnableControls;
end;
end;
procedure TfrmZdyAttachSX.FormCreate(Sender: TObject);
begin
canshu1:=Trim(DParameters1);
end;
procedure TfrmZdyAttachSX.TFZClick(Sender: TObject);
begin
if CDS_HZ.IsEmpty then
Exit;
try
frmZdyAttInputCP_other:=TfrmZdyAttInputCP_other.Create(Application);
with frmZdyAttInputCP_other do
begin
FFlag:=2;
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
fkhType:=self.fkhType;
fFlileFlag:=self.fFlileFlag;
if ShowModal=1 then
begin
TBRafresh.Click;
end;
end;
finally
frmZdyAttInputCP_other.Free;
end;
end;
procedure TfrmZdyAttachSX.N1Click(Sender: TObject);
begin
SelOKNo(CDS_HZ,True);
end;
procedure TfrmZdyAttachSX.N2Click(Sender: TObject);
begin
SelOKNo(CDS_HZ,false);
end;
procedure TfrmZdyAttachSX.Tv2FocusedRecordChanged(
Sender: TcxCustomGridTableView; APrevFocusedRecord,
AFocusedRecord: TcxCustomGridRecord;
ANewItemRecordFocusingChanged: Boolean);
begin
InitSub();
end;
end.