1270 lines
37 KiB
ObjectPascal
1270 lines
37 KiB
ObjectPascal
unit U_BaoGuanList;
|
||
|
||
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,ShellAPI, dxBarBuiltInMenu,
|
||
RM_e_Graphic, RM_e_Jpeg, dxSkinsCore, dxSkinBlack, dxSkinBlue,
|
||
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
|
||
dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
|
||
dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
|
||
dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
||
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
||
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
||
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
||
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
||
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
||
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
||
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine,
|
||
dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter;
|
||
|
||
type
|
||
TfrmBaoGuanList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label1: TLabel;
|
||
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;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column2: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column14: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
v1B6ChuYunGang: TcxGridDBColumn;
|
||
v1B7DaoHuoGang: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
cxSplitter1: TcxSplitter;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DataSource2: TDataSource;
|
||
ClientDataSet2: TClientDataSet;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
A6PONO: TEdit;
|
||
Label8: TLabel;
|
||
A5ConNO: TEdit;
|
||
v1Column15: TcxGridDBColumn;
|
||
Label3: TLabel;
|
||
A1ChuKouShang: TEdit;
|
||
v1Column16: TcxGridDBColumn;
|
||
v1Column17: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column19: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column21: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
v1Column23: TcxGridDBColumn;
|
||
v1Column24: TcxGridDBColumn;
|
||
v1Column25: TcxGridDBColumn;
|
||
v1Column26: TcxGridDBColumn;
|
||
v1Column27: TcxGridDBColumn;
|
||
v1Column28: TcxGridDBColumn;
|
||
v1Column29: TcxGridDBColumn;
|
||
v1Column30: TcxGridDBColumn;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridDBColumn12: TcxGridDBColumn;
|
||
cxGridDBColumn13: TcxGridDBColumn;
|
||
cxGridDBColumn14: TcxGridDBColumn;
|
||
cxGridDBColumn15: TcxGridDBColumn;
|
||
cxGridDBColumn16: TcxGridDBColumn;
|
||
cxGridDBColumn17: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
TBCopy: TToolButton;
|
||
TBBGZL: TToolButton;
|
||
RMXLSExport1: TRMXLSExport;
|
||
CDS_Print: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBDataSet1: TRMDBDataSet;
|
||
ADOQueryPrint: TADOQuery;
|
||
TBHT: TToolButton;
|
||
TBFP: TToolButton;
|
||
TBZXD: TToolButton;
|
||
TBBGD: TToolButton;
|
||
TBView: TToolButton;
|
||
TBSBYS: TToolButton;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column3: TcxGridDBColumn;
|
||
TBSS: TToolButton;
|
||
TBSSCX: TToolButton;
|
||
TBHD: TToolButton;
|
||
TBHDCX: TToolButton;
|
||
TBSH: TToolButton;
|
||
TBSHCX: TToolButton;
|
||
v1Column31: TcxGridDBColumn;
|
||
v1Column32: TcxGridDBColumn;
|
||
v1Column33: TcxGridDBColumn;
|
||
v1Column34: TcxGridDBColumn;
|
||
v1Column35: TcxGridDBColumn;
|
||
v1Column36: TcxGridDBColumn;
|
||
v1Column37: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
TBAll: TToolButton;
|
||
Label2: TLabel;
|
||
C3BGName: TEdit;
|
||
RMDataDictionary1: TRMDataDictionary;
|
||
RMJPEGExport1: TRMJPEGExport;
|
||
ToolButton1: 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 A6PONOKeyPress(Sender: TObject; var Key: Char);
|
||
procedure A5ConNOKeyPress(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 C3BGNameChange(Sender: TObject);
|
||
procedure C3BGNameKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
private
|
||
canshu1:string;
|
||
canshu2:string;
|
||
FDate:TDateTime;
|
||
procedure InitGrid();
|
||
function DelData():Boolean;
|
||
procedure InitSubGrid();
|
||
procedure InitGridSql(var fsj:String);
|
||
procedure InitButton();
|
||
procedure InitPrtData();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
//frmBaoGuanList: TfrmBaoGuanList;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_ZDYHelp,U_BaoGuanInPut,U_FjList_BG;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmBaoGuanList.FormDestroy(Sender: TObject);
|
||
begin
|
||
//frmBaoGuanList:=nil;
|
||
end;
|
||
procedure TfrmBaoGuanList.InitButton();
|
||
begin
|
||
if Trim(Self.Caption)='<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>' then //<2F><><EFBFBD><EFBFBD>
|
||
begin
|
||
TBAdd.Visible:=True;TBEdit.Visible:=True;TBDel.Visible:=True;TBCopy.Visible:=True;
|
||
TBSS.Visible:=False; TBSSCX.Visible:=False;TBAll.Visible:=True;
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=0;
|
||
cxTabControl1.Visible:=False;
|
||
v1Column31.Visible:=False;
|
||
v1Column31.Hidden:=True;
|
||
v1Column32.Visible:=False;
|
||
v1Column32.Hidden:=True;
|
||
v1Column33.Visible:=False;
|
||
v1Column33.Hidden:=True;
|
||
v1Column34.Visible:=False;
|
||
v1Column34.Hidden:=True;
|
||
v1Column35.Visible:=False;
|
||
v1Column35.Hidden:=True;
|
||
v1Column36.Visible:=False;
|
||
v1Column36.Hidden:=True;
|
||
v1Column37.Visible:=False;
|
||
v1Column37.Hidden:=True;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>' then
|
||
begin
|
||
TBAdd.Visible:=True;TBEdit.Visible:=True;TBDel.Visible:=True;TBCopy.Visible:=True;
|
||
TBSS.Visible:=True; TBSSCX.Visible:=True;TBAll.Visible:=True;
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=0;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>Ȩ<EFBFBD><C8A8>)' then
|
||
begin
|
||
TBAdd.Visible:=True;TBEdit.Visible:=True;TBDel.Visible:=True;TBCopy.Visible:=True;
|
||
TBSS.Visible:=True; TBSSCX.Visible:=True;TBAll.Visible:=True;
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=0;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ(<28><>Ȩ<EFBFBD><C8A8>)' then
|
||
begin
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True; TBAll.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBBGZL.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD>غ<EFBFBD>ͬ<EFBFBD><CDAC>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBHT.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD>ط<EFBFBD>Ʊ<EFBFBD><C6B1>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBFP.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD>װ<EFBFBD>䵥<EFBFBD><E4B5A5>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBZXD.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBBGD.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27>걨Ҫ<EAB1A8>ش<EFBFBD>ӡ<EFBFBD><D3A1>ѯ' then
|
||
begin
|
||
TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=4;
|
||
cxTabControl1.Visible:=False;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ˶<CFBA>' then
|
||
begin
|
||
TBHD.Visible:=True; TBHDCX.Visible:=True; TBAll.Visible:=True;
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=1;
|
||
end else
|
||
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TBSH.Visible:=True; TBSHCX.Visible:=True; TBAll.Visible:=True;
|
||
TBBGZL.Visible:=True;TBHT.Visible:=True;TBFP.Visible:=True;
|
||
TBZXD.Visible:=True;TBBGD.Visible:=True;TBSBYS.Visible:=True;
|
||
cxTabControl1.TabIndex:=2;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Application:=MainApplication;
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime:=SGetServerDateMBeg(ADOQueryTemp);
|
||
canshu1:=Trim(DParameters1);
|
||
canshu2:=Trim(DParameters2);
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.InitGrid();
|
||
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 Valid=''Y'' ');
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
SQL.Add(' and Filler='''+Trim(DName)+'''');
|
||
end;
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add(' and isnull(SChker,'''')='''' ');
|
||
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add(' and isnull(OKPerson,'''')='''' and isnull(SChker,'''')<>'''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add(' and isnull(Chker,'''')='''' and isnull(OKPerson,'''')<>'''' ');
|
||
end else
|
||
begin
|
||
sql.Add(' and A7FPDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
||
sql.Add(' and A7FPDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
||
if cxTabControl1.TabIndex=3 then
|
||
begin
|
||
sql.Add(' and isnull(Chker,'''')<>'''' ');
|
||
end else
|
||
begin
|
||
if cxTabControl1.Visible=False then
|
||
begin
|
||
// sql.Add(' and isnull(OKPerson,'''')<>'''' ');
|
||
end;
|
||
end;
|
||
end;
|
||
// ShowMessage(SQL.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
BegDate.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+self.Caption,Tv1,'<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>');
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ'+self.Caption,Tv2,'<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+self.Caption,Tv1,'<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>');
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ'+self.Caption,Tv2,'<27><><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>');
|
||
InitButton();
|
||
InitGrid();
|
||
RM1.CanExport:=true;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,True);
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,False);
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.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;
|
||
|
||
procedure TfrmBaoGuanList.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>0 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
|
||
InitSubGrid();
|
||
end;
|
||
end;
|
||
function TfrmBaoGuanList.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 TfrmBaoGuanList.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmBaoGuanInPut:=TfrmBaoGuanInPut.Create(Application);
|
||
with frmBaoGuanInPut do
|
||
begin
|
||
FBCId:='';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmBaoGuanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBEditClick(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);
|
||
//TBDel.Visible:=False;
|
||
//TBAdd.Visible:=False;
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmBaoGuanInPut.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
|
||
|
||
procedure TfrmBaoGuanList.CRTypeChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.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 TfrmBaoGuanList.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;
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add(' and isnull(SChker,'''')='''' ');
|
||
end else
|
||
begin
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add(' and isnull(SChker,'''')<>'''' and isnull(Chker,'''')='''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add(' and isnull(Chker,'''')<>'''' ');
|
||
end;
|
||
end;
|
||
sql.Add(fsj);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.Tv1CellClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
InitSubGrid();
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.A6PONOKeyPress(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 TfrmBaoGuanList.A5ConNOKeyPress(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 TfrmBaoGuanList.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 TfrmBaoGuanList.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;
|
||
// ShowMessage(CDS_Main.fieldbyname('BGId').AsString);
|
||
SCreateCDS20(ADOQueryPrint,CDS_Print);
|
||
SInitCDSData20(ADOQueryPrint,CDS_Print);
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.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 TfrmBaoGuanList.TBSSClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>0 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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBSSCXClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>1 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=Null,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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBHDClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>1 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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBHDCXClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>2 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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBSHClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>2 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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.TBSHCXClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if cxTabControl1.TabIndex<>3 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>Ѻ˶<D1BA>'',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;
|
||
InitSubGrid();
|
||
except
|
||
CDS_Main.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.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';
|
||
|
||
// ShellExecute(Handle, 'open',PChar(FimageFile),'', '', SW_SHOWNORMAL);
|
||
//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);
|
||
RMVariables['FC2HSNOHZ']:=Trim(CDS_Print.fieldbyname('C2HSNOHZ').AsString);
|
||
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 TfrmBaoGuanList.C3BGNameChange(Sender: TObject);
|
||
begin
|
||
SDofilter(ADOQueryTemp,SGetFilters(Panel1,3,4));
|
||
SCreateCDS20(ADOQueryTemp,ClientDataSet2);
|
||
SInitCDSData20(ADOQueryTemp,ClientDataSet2);
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.C3BGNameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(' from JYOrder_BaoGuan_Main A ');
|
||
sql.Add(' where Valid=''Y'' ');
|
||
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
SQL.Add(' and Filler='''+Trim(DName)+'''');
|
||
end;
|
||
if cxTabControl1.TabIndex=0 then
|
||
begin
|
||
sql.Add(' and isnull(SChker,'''')='''' ');
|
||
|
||
end else
|
||
if cxTabControl1.TabIndex=1 then
|
||
begin
|
||
sql.Add(' and isnull(OKPerson,'''')='''' and isnull(SChker,'''')<>'''' ');
|
||
end else
|
||
if cxTabControl1.TabIndex=2 then
|
||
begin
|
||
sql.Add(' and isnull(Chker,'''')='''' and isnull(OKPerson,'''')<>'''' ');
|
||
end else
|
||
begin
|
||
if cxTabControl1.TabIndex=3 then
|
||
begin
|
||
sql.Add(' and isnull(Chker,'''')<>'''' ');
|
||
end else
|
||
begin
|
||
// if cxTabControl1.Visible=False then
|
||
// begin
|
||
// sql.Add(' and isnull(OKPerson,'''')<>'''' ');
|
||
// end;
|
||
end;
|
||
end;
|
||
sql.Add(' and exists (select B.C3BGName from JYOrder_BaoGuan_Sub B where B.BGID=A.BGID');
|
||
sql.Add(' and B.SValid=''Y'' and B.C3BGName like '''+'%'+trim(C3BGName.Text)+'%'+''')');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBaoGuanList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
// if Order_Main.IsEmpty then Exit;
|
||
try
|
||
frmFjList_BG:=TfrmFjList_BG.Create(Application);
|
||
with frmFjList_BG do
|
||
begin
|
||
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then cxButton1.Visible:=false;
|
||
// fkeyNO:=Trim(Self.Order_Main.fieldbyname('MainId').AsString);
|
||
fType:='<27><><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList_BG.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|