431 lines
14 KiB
ObjectPascal
431 lines
14 KiB
ObjectPascal
|
|
unit U_YSSKList_FPCX;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
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, cxPC;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmYSSKList_FPCX = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
begdate: TDateTimePicker;
|
|||
|
|
Enddate: TDateTimePicker;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
cxFactoryName: TcxGridDBColumn;
|
|||
|
|
cSQQP: TcxGridDBColumn;
|
|||
|
|
cBQKP: TcxGridDBColumn;
|
|||
|
|
cxWKP: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
V1YFName: TcxGridDBColumn;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
V2BQXKPMoney: TcxGridDBColumn;
|
|||
|
|
cxSplitter1: TcxSplitter;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
Order_Sub: TClientDataSet;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
RadioGroup1: TRadioGroup;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV1: TcxGridDBTableView;
|
|||
|
|
cxCRTime: TcxGridDBColumn;
|
|||
|
|
v2FactoryName: TcxGridDBColumn;
|
|||
|
|
v2KPNo: TcxGridDBColumn;
|
|||
|
|
v2YFName: TcxGridDBColumn;
|
|||
|
|
v2KPType: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
|
v2Price: TcxGridDBColumn;
|
|||
|
|
v2KP: TcxGridDBColumn;
|
|||
|
|
v2Note: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
V2WCStatus: TcxGridDBColumn;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure GCNameChange(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure V2JTBossPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure RadioGroup1Click(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
|||
|
|
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
|||
|
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitGridJWL();
|
|||
|
|
public
|
|||
|
|
fDParameters1:string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
RKFlag,FCYID:String;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmYSSKList_FPCX: TfrmYSSKList_FPCX;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_Fun,U_ZDYHelp,U_YSSKList_KP;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmYSSKList_FPCX.InitGridJWL();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR where 1=2');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.InitGrid();
|
|||
|
|
var i:Integer;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select *,WKP=isnull(SQQP,0)+isnull(BQXKPMoney,0)-isnull(BQKP,0) ');
|
|||
|
|
sql.Add(' from (select A.*,');
|
|||
|
|
sql.Add(' WCStatus=(select Top 1 Q.WCStatus from YF_Money_CR Q where Q.CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and Q.CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>''');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and Q.CRtime>='''+trim(FormatDateTime('yyyy-MM-dd',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and Q.CRtime<'''+trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and convert(varchar(7),Q.CRTime,120)>='''+trim(FormatDateTime('yyyy-MM',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(7),Q.CRTime,120)<='''+trim(FormatDateTime('yyyy-MM',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and convert(varchar(4),Q.CRTime,120)>='''+trim(FormatDateTime('yyyy',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(4),Q.CRTime,120)<='''+trim(FormatDateTime('yyyy',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' order by Q.WCStatus),');
|
|||
|
|
sql.Add(' SQQP=(select isnull(Sum(case when B.CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' then Money else -KPMoney end),0)');
|
|||
|
|
sql.Add(' from YF_Money_CR B');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where B.CRTime<'''+trim(FormatDateTime('yyyy-MM-dd',begdate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(7),B.CRTime,120)<'''+trim(FormatDateTime('yyyy-MM',begdate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(4),B.CRTime,120)<'''+trim(FormatDateTime('yyyy',begdate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' and B.factoryName=A.factoryName and B.YFName=A.YFName');
|
|||
|
|
sql.Add(' and B.CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and (CRType=''Ӧ<><D3A6><EFBFBD>Ʊ<EEB7A2>Ǽ<EFBFBD>'' or (CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' and B.KPType<>''<27><><EFBFBD><EFBFBD>Ʊ''))),');
|
|||
|
|
sql.Add(' BQKP=(select isnull(Sum(KPMoney),0)');
|
|||
|
|
sql.Add(' from YF_Money_CR B');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where B.CRTime>='''+trim(FormatDateTime('yyyy-MM-dd',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and B.CRTime<'''+trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(7),B.CRTime,120)>='''+trim(FormatDateTime('yyyy-MM',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(7),B.CRTime,120)<='''+trim(FormatDateTime('yyyy-MM',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(4),B.CRTime,120)>='''+trim(FormatDateTime('yyyy',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(4),B.CRTime,120)<='''+trim(FormatDateTime('yyyy',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' and B.factoryName=A.factoryName and B.YFName=A.YFName');
|
|||
|
|
sql.Add(' and B.CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and CRType in(''Ӧ<><D3A6><EFBFBD>Ʊ<EEB7A2>Ǽ<EFBFBD>'')),');
|
|||
|
|
sql.Add(' BQXKPMoney=(select isnull(Sum(Money),0)');
|
|||
|
|
sql.Add(' from YF_Money_CR B');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where B.CRTime>='''+trim(FormatDateTime('yyyy-MM-dd',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and B.CRTime<'''+trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(7),B.CRTime,120)>='''+trim(FormatDateTime('yyyy-MM',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(7),B.CRTime,120)<='''+trim(FormatDateTime('yyyy-MM',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' where convert(varchar(4),B.CRTime,120)>='''+trim(FormatDateTime('yyyy',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(4),B.CRTime,120)<='''+trim(FormatDateTime('yyyy',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' and B.CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' and isnull(B.status,''0'')<>''0''');
|
|||
|
|
sql.Add(' and B.factoryName=A.factoryName and B.YFName=A.YFName');
|
|||
|
|
sql.Add(' and B.CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and KPType<>''<27><><EFBFBD><EFBFBD>Ʊ'')');
|
|||
|
|
sql.Add(' from (select distinct factoryName,YFName from YF_Money_CR where CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'')A');
|
|||
|
|
sql.Add(' )AA where SQQP<>0 or BQXKPMoney<>0 or BQKP<>0 or isnull(SQQP,0)+isnull(BQXKPMoney,0)-isnull(BQKP,0)<>0');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
for i:=1 to 33-CDS_HZ.RecordCount do
|
|||
|
|
begin
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if CDS_HZ.FieldByName('WCStatus').AsString='' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
finally;
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmYSSKList_FPCX:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('Ӧ<><D3A6><EFBFBD>տ<EFBFBD>ͳ<EFBFBD><CDB3>1',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.FormShow(Sender: TObject);
|
|||
|
|
var fsj:string;
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('Ӧ<><D3A6><EFBFBD>տ<EFBFBD>ͳ<EFBFBD><CDB3>1',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
begdate.DateTime:=Enddate.DateTime;
|
|||
|
|
{fsj:='select distinct (A.GCName) name from YF_Money_CR A where A.CRType=''Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' ';
|
|||
|
|
SInitComBoxBySql(ADOQueryCmd,GCName,False,fsj);
|
|||
|
|
fsj:='select distinct (A.FactoryName) name from YF_Money_CR A where A.CRType=''Ӧ<>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' ';
|
|||
|
|
SInitComBoxBySql(ADOQueryCmd,FactoryName,False,fsj);}
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.TBRafreshClick(Sender: TObject);
|
|||
|
|
var i:Integer;
|
|||
|
|
begin
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
InitGridJWL();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj:string;
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
|
|||
|
|
SDofilter(ADOQueryMain,Trim(SGetFilters(Panel1,1,2)));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.GCNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
SelExportData(Tv2,ADOQueryMain,'Ӧ<><D3A6><EFBFBD>տ<EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>б<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_HZ,true);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_HZ,false);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.V2JTBossPropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='JTBoss';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('JTBoss').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.RadioGroup1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
begdate.Format:='yyyy-MM-dd';
|
|||
|
|
Enddate.Format:='yyyy-MM-dd';
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
begdate.Format:='yyyy-MM';
|
|||
|
|
Enddate.Format:='yyyy-MM';
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
begdate.Format:='yyyy';
|
|||
|
|
Enddate.Format:='yyyy';
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.TV2FocusedRecordChanged(
|
|||
|
|
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
|||
|
|
AFocusedRecord: TcxCustomGridRecord;
|
|||
|
|
ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
with ADOQuery1 do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select A.* ');
|
|||
|
|
sql.Add(' from YF_Money_CR A');
|
|||
|
|
sql.Add(' inner join YF_Money_KC B on A.CRID=B.CRID');
|
|||
|
|
sql.Add(' where A.CRType=''Ӧ<><D3A6><EFBFBD>Ʊ<EEB7A2>Ǽ<EFBFBD>'' ');
|
|||
|
|
sql.Add(' and A.YFName='''+Trim(CDS_HZ.fieldbyname('YFName').AsString)+'''');
|
|||
|
|
sql.Add(' and A.FactoryName='''+Trim(CDS_HZ.fieldbyname('FactoryName').AsString)+'''');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
|||
|
|
sql.Add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and convert(varchar(7),A.CRTime,120)>='''+FormatDateTime('yyyy-MM',begdate.DateTime)+''' ');
|
|||
|
|
sql.Add(' and convert(varchar(7),A.CRTime,120)<='''+FormatDateTime('yyyy-MM',Enddate.DateTime)+''' ');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and convert(varchar(4),A.CRTime,120)>='''+FormatDateTime('yyyy',begdate.DateTime)+''' ');
|
|||
|
|
sql.Add(' and convert(varchar(4),A.CRTime,120)<='''+FormatDateTime('yyyy',Enddate.DateTime)+''' ');
|
|||
|
|
end;
|
|||
|
|
sql.Add('Order By A.CRtime');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQuery1,Order_Sub);
|
|||
|
|
SInitCDSData20(ADOQuery1,Order_Sub);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmYSSKList_FPCX.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then exit;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR set WCStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
if RadioGroup1.ItemIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where CRtime>='''+trim(FormatDateTime('yyyy-MM-dd',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and CRtime<'''+trim(FormatDateTime('yyyy-MM-dd',enddate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where convert(varchar(7),CRTime,120)>='''+trim(FormatDateTime('yyyy-MM',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(7),CRTime,120)<='''+trim(FormatDateTime('yyyy-MM',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
if RadioGroup1.ItemIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where convert(varchar(4),CRTime,120)>='''+trim(FormatDateTime('yyyy',begdate.Date))+'''');
|
|||
|
|
sql.Add(' and convert(varchar(4),CRTime,120)<='''+trim(FormatDateTime('yyyy',enddate.Date))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' and CRFlag=''Ӧ<><D3A6><EFBFBD><EFBFBD>'' and CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|