433 lines
11 KiB
ObjectPascal
433 lines
11 KiB
ObjectPascal
|
|
unit U_SKCR_SH;
|
|||
|
|
|
|||
|
|
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, cxPC, Menus;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmSKCR_SH = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
YFName: TEdit;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
FactoryName: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
begdate: TDateTimePicker;
|
|||
|
|
Enddate: TDateTimePicker;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Money: TEdit;
|
|||
|
|
tchk: TToolButton;
|
|||
|
|
tnochk: TToolButton;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
nochk: TToolButton;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
ChkNote: TEdit;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
CheckBox1: TCheckBox;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
note: TEdit;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
v2Ssel: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
v2Column6: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
VYB: TcxGridDBColumn;
|
|||
|
|
VBZ: TcxGridDBColumn;
|
|||
|
|
v2ComTaitou: TcxGridDBColumn;
|
|||
|
|
v2IFSD: TcxGridDBColumn;
|
|||
|
|
v2chkstatus: TcxGridDBColumn;
|
|||
|
|
v2chknote: TcxGridDBColumn;
|
|||
|
|
v2Column1: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
v2GCName: TcxGridDBColumn;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
GCName: TEdit;
|
|||
|
|
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 FactoryNameChange(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure MoneyChange(Sender: TObject);
|
|||
|
|
procedure v2DerateMoneyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure tchkClick(Sender: TObject);
|
|||
|
|
procedure tnochkClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure nochkClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure v2SselPropertiesChange(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
procedure InitGrid();
|
|||
|
|
Procedure SetStatus();
|
|||
|
|
|
|||
|
|
public
|
|||
|
|
fflag:integer;
|
|||
|
|
{ Public declarations }
|
|||
|
|
RKFlag,FCYID,fmanage:String;
|
|||
|
|
end;
|
|||
|
|
var
|
|||
|
|
frmSKCR_SH: TfrmSKCR_SH;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_Fun,U_RTFun;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
Procedure TfrmSKCR_SH.SetStatus();
|
|||
|
|
var
|
|||
|
|
i:integer;
|
|||
|
|
begin
|
|||
|
|
Tchk.Enabled:=false;
|
|||
|
|
TNochk.Enabled:=false;
|
|||
|
|
for i:=0 to tv2.ColumnCount-1 do
|
|||
|
|
begin
|
|||
|
|
IF uppercase(tv2.Columns[i].DataBinding.FieldName)<>'SSEL' then
|
|||
|
|
tv2.Columns[i].Options.Editing:=false;
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
Tchk.Enabled:=true;
|
|||
|
|
for i:=1 to tv2.ColumnCount-1 do
|
|||
|
|
begin
|
|||
|
|
tv2.Columns[i].Options.Editing:=true;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
TNochk.Enabled:=true;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.add(',IFSD=cast((case when isnull((select T.TFID from TP_File T where T.WBID=A.YFID and T.TFType=''SD''),'''')='''' then 0 else 1 end) as bit)');
|
|||
|
|
sql.Add(' from YF_Money_CR A');
|
|||
|
|
sql.Add(' left join YF_Money_KC B on A.CRID=B.CRID');
|
|||
|
|
sql.Add('where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.DateTime)+''' ');
|
|||
|
|
sql.Add(' and CRTime<'''+FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1)+''' ');
|
|||
|
|
sql.Add(' and A.CRType=''<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>'' ');
|
|||
|
|
IF cxTabControl1.TabIndex=0 then
|
|||
|
|
sql.Add(' and A.status=''1'' ');
|
|||
|
|
IF cxTabControl1.TabIndex=1 then
|
|||
|
|
sql.Add(' and A.status=''2'' ');
|
|||
|
|
if Money.Text<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.add('and A.Money like '''+'%'+trim(Money.Text)+'%'+'''');
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
Label12.Caption:='0';
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
//ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmSKCR_SH:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>Chk',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmSKCR_SH.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
fflag:=0;
|
|||
|
|
ReadCxGrid('<27>տ<EFBFBD><D5BF>Ǽ<EFBFBD>Chk',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
begdate.DateTime:=SGetServerDateMBeg(ADOQueryTemp);
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
toolbar1.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Label12.Caption:='0';
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.FactoryNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
SelExportData(Tv2,ADOQueryMain,'<27>տ<EFBFBD><D5BF>б<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.MoneyChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Money.SetFocus;
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.v2DerateMoneyPropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue:string;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
|
|||
|
|
if Trim(mvalue)='' then mvalue:='0';
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('DerateMoney').Value:=StrToFloatdef(mvalue,0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate YF_Money_CR ');
|
|||
|
|
sql.Add(' set DerateMoney='+mvalue);
|
|||
|
|
SQL.Add(' where YFId='''+Trim(CDS_HZ.fieldbyname('YFId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
tv2.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.tchkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.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_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''2'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.tnochkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.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_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''1'' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.nochkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
|
|||
|
|
if CDS_HZ.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_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
IF Fieldbyname('ssel').AsBoolean=true then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update YF_Money_CR SET status=''0'',chkstatus=''<27><>ͨ<EFBFBD><CDA8>'',chknote='''+trim(chknote.Text)+''' ');
|
|||
|
|
sql.Add('where YFID ='+quotedstr(trim(CDS_HZ.fieldbyname('YFID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
InitGrid();
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_HZ,True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_HZ,false);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.v2SselPropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
toolbar1.SetFocus;
|
|||
|
|
HJ(CDS_HZ,Label12,CDS_HZ.fieldbyname('Money').AsCurrency);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSKCR_SH.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Label12.Caption:='0';
|
|||
|
|
IF CDS_HZ.IsEmpty then exit;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('ssel').Value:=checkbox1.Checked;
|
|||
|
|
if checkbox1.Checked=true then
|
|||
|
|
begin
|
|||
|
|
Label12.Caption:=floattostr(strtofloat(Label12.Caption)+fieldbyname('Money').AsCurrency);
|
|||
|
|
end;
|
|||
|
|
post;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
First;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|