1199 lines
34 KiB
ObjectPascal
1199 lines
34 KiB
ObjectPascal
![]() |
unit U_ContractListNX;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
|||
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter, RM_Dataset, RM_System,
|
|||
|
RM_Common, RM_Class, RM_GridReport, RM_e_Xls, Menus, cxPC, cxButtonEdit,
|
|||
|
cxTextEdit, cxDropDownEdit, cxImage, cxImageComboBox, ImgList, cxContainer,
|
|||
|
cxDBEdit, cxBlobEdit, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxSkinscxPCPainter,
|
|||
|
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, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
|||
|
dxSkinXmas2008Blue;
|
|||
|
|
|||
|
type
|
|||
|
TfrmContractListNX = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBAdd: TToolButton;
|
|||
|
TBEdit: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DS_Main: TDataSource;
|
|||
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
v1DeliveryDate: TcxGridDBColumn;
|
|||
|
v1OrdPerson1: TcxGridDBColumn;
|
|||
|
v1ConNo: TcxGridDBColumn;
|
|||
|
CDS_Sub: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
PopupMenu2: TPopupMenu;
|
|||
|
N11: TMenuItem;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
BuyName: TEdit;
|
|||
|
HZname: TEdit;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
ConNo: TEdit;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
MPRTMF: TEdit;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
tchk: TToolButton;
|
|||
|
Tnochk: TToolButton;
|
|||
|
DS_Sub: TDataSource;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
Tqx: TToolButton;
|
|||
|
Tnoqx: TToolButton;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv2: TcxGridDBTableView;
|
|||
|
v1XHNo: TcxGridDBColumn;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
v1PRTPrice: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
btnTijiao: TToolButton;
|
|||
|
btnCXTijiao: TToolButton;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
Label3: TLabel;
|
|||
|
Filler: TEdit;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
V2Column3: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
V2Column1: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
V2Column2: TcxGridDBColumn;
|
|||
|
V2Column4: TcxGridDBColumn;
|
|||
|
V2Column5: TcxGridDBColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
Label6: TLabel;
|
|||
|
P_Code: TEdit;
|
|||
|
v2Column9: TcxGridDBColumn;
|
|||
|
Tv2Column1: TcxGridDBColumn;
|
|||
|
ToolButton7: TToolButton;
|
|||
|
Tv2Column2: TcxGridDBColumn;
|
|||
|
Tv2Column3: TcxGridDBColumn;
|
|||
|
Tv2Column4: TcxGridDBColumn;
|
|||
|
Tv2Column5: TcxGridDBColumn;
|
|||
|
Tv2Column6: TcxGridDBColumn;
|
|||
|
Tv2Column7: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
ToolButton8: TToolButton;
|
|||
|
Tv2Column8: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
cxSplitter2: TcxSplitter;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure TBEditClick(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure TBAddClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure BuyNameChange(Sender: TObject);
|
|||
|
procedure tchkClick(Sender: TObject);
|
|||
|
procedure TnochkClick(Sender: TObject);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
procedure TqxClick(Sender: TObject);
|
|||
|
procedure TnoqxClick(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure btnTijiaoClick(Sender: TObject);
|
|||
|
procedure btnCXTijiaoClick(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure Tv2DblClick(Sender: TObject);
|
|||
|
procedure P_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
procedure Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
procedure ToolButton10Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure SetStatus();
|
|||
|
procedure InitSub();
|
|||
|
procedure InitGridSub();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt, FCloth: Integer;
|
|||
|
canshu1, FGSTT: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
//var
|
|||
|
// frmContractListNX: TfrmContractListNX;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_ConInPutNX, U_Fun, U_ZDYHelp, U_FjList_RZ, U_SysLogHelp,
|
|||
|
U_ContractOldList, U_JHFXLIST;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmContractListNX.InitGridSub();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,C.*');
|
|||
|
sql.Add(',ISSC=cast((case when isnull((select count(WBID) from TP_File X where X.WBID=A.ConMainId and X.TFType=''<27><>ͬ''),0)>0 then 1 else 0 end) as bit)');
|
|||
|
sql.Add(',ZJinE=(select sum(Money) Money from Contract_sub B where B.ConMainId=A.ConMainId group by B.ConMainId)');
|
|||
|
sql.Add(',ZJinUnit=(select TOP 1 BZType from Contract_sub B where B.ConMainId=A.ConMainId)');
|
|||
|
sql.Add(',ZShuL=(select sum(Qty) Qty from Contract_sub B where B.ConMainId=A.ConMainId group by B.ConMainId)');
|
|||
|
sql.Add(',ZShuUnit=(select TOP 1 QtyUnit from Contract_sub B where B.ConMainId=A.ConMainId)');
|
|||
|
sql.Add(' from Contract_Main A inner join Contract_sub C ON C.ConMainId=A.ConMainId ');
|
|||
|
SQL.Add('where A.ConDate>=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
|||
|
SQL.Add('and A.ConDate<''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
|||
|
sql.Add(' and A.ConType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
sql.Add(' and C.P_Code like ''%' + Trim(P_Code.Text) + '%''');
|
|||
|
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''-1''');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''0''');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''1''');
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''2''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.InitSub();
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
// sql.Add('select * ');
|
|||
|
// SQL.Add(',fhqty=(select sum(fhqty) from SQ_FH_Sub e inner join SQ_FH_Main f on e.fhmainid=f.FHMainId where e.p_code=b.p_code ');
|
|||
|
// SQL.Add('and f.ToCONNO=' + quotedstr((CDS_Main.fieldbyname('ConNo').AsString)));
|
|||
|
// SQL.Add('),fhPS=(select sum(fhPIqty) from SQ_FH_Sub e inner join SQ_FH_Main f on e.fhmainid=f.FHMainId where e.p_code=b.p_code ');
|
|||
|
// SQL.Add('and f.ToCONNO=' + quotedstr((CDS_Main.fieldbyname('ConNo').AsString)));
|
|||
|
// sql.Add(')from Contract_sub B where conmainID =' + quotedstr((CDS_Main.fieldbyname('conmainID').AsString)));
|
|||
|
|
|||
|
SQL.Add('EXEC P_HT_SUB @ConNo=' + quotedstr((CDS_Main.fieldbyname('ConNo').AsString)));
|
|||
|
SQL.Add(',@conmainID=' + quotedstr((CDS_Main.fieldbyname('conmainID').AsString)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.SetStatus();
|
|||
|
begin
|
|||
|
TBAdd.Visible := false;
|
|||
|
tbedit.Visible := false;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
tchk.Visible := false;
|
|||
|
tnochk.Visible := false;
|
|||
|
Tqx.Visible := false;
|
|||
|
TNoqx.Visible := false;
|
|||
|
TBPrint.Visible := False;
|
|||
|
btnTijiao.Visible := False;
|
|||
|
btnCXTijiao.Visible := False;
|
|||
|
|
|||
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
ToolButton2.Visible := true;
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBPrint.Visible := True;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tbedit.Visible := true;
|
|||
|
Tqx.Visible := True;
|
|||
|
btnTijiao.Visible := True;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
|
|||
|
btnCXTijiao.Visible := True;
|
|||
|
tchk.Visible := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
tnochk.Visible := True;
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
TNoqx.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
ToolButton2.Visible := true;
|
|||
|
TBAdd.Visible := true;
|
|||
|
TBPrint.Visible := True;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
tbedit.Visible := true;
|
|||
|
Tqx.Visible := true;
|
|||
|
btnTijiao.Visible := True;
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
btnCXTijiao.Visible := True;
|
|||
|
tchk.Visible := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
tnochk.Visible := True;
|
|||
|
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
TNoqx.Visible := true;
|
|||
|
|
|||
|
end;
|
|||
|
4:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
// frmContractListNX:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// sql.Add('select A.*');
|
|||
|
// sql.Add(',HZname=CAST((select distinct(p_name) + '' '' from Contract_sub B where B.ConMainId=A.ConMainId for xml path('''') ) AS VARCHAR(2000))');
|
|||
|
//
|
|||
|
// sql.Add(',ISSC=cast((case when isnull((select count(WBID) from TP_File X where X.WBID=A.ConMainId and X.TFType=''<27><>ͬ''),0)>0 then 1 else 0 end) as bit)');
|
|||
|
// sql.Add(',ZJinE=(select sum(MxMoney) Money from Contract_sub B where B.ConMainId=A.ConMainId group by B.ConMainId)');
|
|||
|
// sql.Add(',ZJinUnit=(select TOP 1 BZType from Contract_sub B where B.ConMainId=A.ConMainId)');
|
|||
|
// sql.Add(',ZShuL=(select sum(Qty) Qty from Contract_sub B where B.ConMainId=A.ConMainId group by B.ConMainId)');
|
|||
|
// sql.Add(',ZShuUnit=(select TOP 1 QtyUnit from Contract_sub B where B.ConMainId=A.ConMainId)');
|
|||
|
// sql.Add(' from Contract_Main A ');
|
|||
|
// SQL.Add('where A.ConDate>=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
|||
|
// SQL.Add('and A.ConDate<''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
|||
|
// sql.Add(' and A.ConType=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
SQL.Add('EXEC P_HT_MAIN @begdate=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
|||
|
SQL.Add(',@ENDDATE=''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
SQL.Add(',@STATUS=''-1'' ');
|
|||
|
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
SQL.Add(',@STATUS=''0'' ');
|
|||
|
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
SQL.Add(',@STATUS=''1'' ');
|
|||
|
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
SQL.Add(',@STATUS=''2'' ');
|
|||
|
|
|||
|
end;
|
|||
|
4:
|
|||
|
begin
|
|||
|
SQL.Add(',@STATUS=''99'' ');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
// / SQL.Add(' order by A.ConDate desc');
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.InitForm();
|
|||
|
begin
|
|||
|
readCxGrid(Trim(Self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ');
|
|||
|
readCxGrid(Trim(Self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ');
|
|||
|
|
|||
|
if FCloth = 1 then
|
|||
|
begin
|
|||
|
v1Column4.Visible := True;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
v1Column4.Visible := False;
|
|||
|
end;
|
|||
|
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
|||
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
// if Trim(CDS_Main.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
// begin
|
|||
|
// Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
// Exit;
|
|||
|
// end;
|
|||
|
try
|
|||
|
frmConInPutNX := TfrmConInPutNX.Create(Application);
|
|||
|
with frmConInPutNX do
|
|||
|
begin
|
|||
|
PState := '<27><EFBFBD>';
|
|||
|
FMainId := Trim(Self.CDS_Main.fieldbyname('conMainId').AsString);
|
|||
|
canshu1 := self.canshu1;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutNX.Free;
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>ۺ<EFBFBD>ͬ.rmf';
|
|||
|
ExportFtErpFile('<27><><EFBFBD>ۺ<EFBFBD>ͬ', ADOQueryPrint);
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,MXNote=B.Note ');
|
|||
|
sql.Add(' from Contract_Main A inner join Contract_Sub B on A.ConMainId=B.ConMainId ');
|
|||
|
sql.Add(' where A.ConMainId=''' + Trim(CDS_Main.fieldbyname('ConMainId').AsString) + '''');
|
|||
|
sql.Add(' order by B.XHNo ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
// RMVariables['EngMoney']:=EngMoney;
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
P_Code.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
FDataCode: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmConInPutNX := TfrmConInPutNX.Create(Application);
|
|||
|
with frmConInPutNX do
|
|||
|
begin
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FMainId := '';
|
|||
|
canshu1 := self.canshu1;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FDataCode := BuyName.TxtCode;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutNX.Free;
|
|||
|
Self.TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
SetStatus();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
if ToolButton1.Visible = False then
|
|||
|
Exit;
|
|||
|
ToolButton1.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmConInPutNX := TfrmConInPutNX.Create(Application);
|
|||
|
with frmConInPutNX do
|
|||
|
begin
|
|||
|
PState := '<27>鿴';
|
|||
|
FMainId := Trim(Self.CDS_Main.fieldbyname('conMainId').AsString);
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
ToolBar2.Visible := False;
|
|||
|
TBSave.Visible := False;
|
|||
|
ScrollBox1.Enabled := False;
|
|||
|
Tv1.OptionsSelection.CellSelect := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutNX.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmConInPutNX := TfrmConInPutNX.Create(Application);
|
|||
|
with frmConInPutNX do
|
|||
|
begin
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FMainId := Trim(Self.CDS_Main.fieldbyname('conMainId').AsString);
|
|||
|
canshu1 := self.canshu1;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutNX.Free;
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.BuyNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active = False then
|
|||
|
Exit;
|
|||
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.tchkClick(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''1'',Chktime=getdate(),ChkCode=' + quotedstr(trim(DCode)) + ',Chker=' + quotedstr(trim(DName)));
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TnochkClick(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''0'',Chktime=null,Chker=null,ChkCode=null ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSub();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TqxClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''2'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('ConmainID').AsString)));
|
|||
|
sql.Add('update PD_Plan_Main SET ConNoStatu=''<27><>ȡ<EFBFBD><C8A1>'' ');
|
|||
|
sql.Add('where ConNo=' + quotedstr(trim(CDS_Main.fieldbyname('ConNo').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>ͬȡ<CDAC><C8A1>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><>ͬȡ<CDAC><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ͬȡ<CDAC><C8A1>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.TnoqxClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''-1'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').AsString)));
|
|||
|
sql.Add('update PD_Plan_Main SET ConNoStatu='''' ');
|
|||
|
sql.Add('where ConNo=' + quotedstr(trim(CDS_Main.fieldbyname('ConNo').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><CDAC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬȡ<CDAC><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬȡ<CDAC><C8A1>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmFjList_RZ := TfrmFjList_RZ.Create(Application);
|
|||
|
with frmFjList_RZ do
|
|||
|
begin
|
|||
|
fkeyNO := Trim(Self.CDS_Main.fieldbyname('ConMainId').AsString);
|
|||
|
fType := '<27><>ͬ';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFjList_RZ.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('iswc').Index] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
ACanvas.Brush.Color := $0080FF80;
|
|||
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('status').Index] = '2' then
|
|||
|
ACanvas.Brush.Color := $008080FF;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.btnTijiaoClick(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''0'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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>ύ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.btnCXTijiaoClick(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''-1'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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><CDAC><EFBFBD><EFBFBD><EFBFBD>ύ')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogHelp := TfrmSysLogHelp.create(self);
|
|||
|
with frmSysLogHelp do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET TChuang=''<27>Ѳ鿴'' ');
|
|||
|
sql.Add('where TChuang=''δ<>鿴'' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton6Click(Sender: TObject);
|
|||
|
begin
|
|||
|
writeCxGrid(Trim(Self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ');
|
|||
|
writeCxGrid(Trim(Self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ');
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.Tv2DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmContractOldList := TfrmContractOldList.Create(Application);
|
|||
|
with frmContractOldList do
|
|||
|
begin
|
|||
|
|
|||
|
FP_Code := Trim(Self.CDS_Sub.fieldbyname('P_Code').AsString);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmContractOldList.Free;
|
|||
|
;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.P_CodeKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
if P_Code.Text <> '' then
|
|||
|
InitGridSub();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton7Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C>ն<EFBFBD><D5B6><EFBFBD><EFBFBD>뵥.rmf';
|
|||
|
ExportFtErpFile('<27>ն<EFBFBD><D5B6><EFBFBD><EFBFBD>뵥.RMF', ADOQueryPrint);
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.*,MXNote=B.Note ');
|
|||
|
sql.Add(' from Contract_Main A inner join Contract_Sub B on A.ConMainId=B.ConMainId where 1=1');
|
|||
|
// sql.Add(' where A.ConMainId=''' + Trim(CDS_Main.fieldbyname('ConMainId').AsString) + '''');
|
|||
|
SQL.Add(' AND A.ConDate>=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
|||
|
SQL.Add(' and A.ConDate<''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''1''');
|
|||
|
sql.Add(' order by A.ConMainId,B.XHNo ');
|
|||
|
// ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
// RMVariables['EngMoney']:=EngMoney;
|
|||
|
RMVariables['enddate'] := enddate.DateTime;
|
|||
|
RMVariables['begdate'] := begdate.DateTime;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton8Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
Exit;
|
|||
|
|
|||
|
try
|
|||
|
frmjhfxlist := Tfrmjhfxlist.Create(Application);
|
|||
|
with frmjhfxlist do
|
|||
|
begin
|
|||
|
|
|||
|
FMainId := Trim(Self.CDS_Sub.fieldbyname('consubid').AsString);
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmjhfxlist.Free;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.Tv2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
begin
|
|||
|
if AViewInfo.GridRecord.Values[tv2.GetColumnByFieldName('iswc').Index] = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
ACanvas.Brush.Color := $0080FF80;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton9Click(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''3'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListNX.ToolButton10Click(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;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if Fieldbyname('ssel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update Contract_Main SET status=''1'' ');
|
|||
|
sql.Add('where conmainID=' + quotedstr(trim(CDS_Main.fieldbyname('conmainID').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><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
InitGrid();
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
CDS_Main.EnableControls;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|