368 lines
10 KiB
ObjectPascal
368 lines
10 KiB
ObjectPascal
|
|
unit U_YFCRWTS_HZQD_CX;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, ComCtrls, ToolWin, StdCtrls, ExtCtrls, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
|
|||
|
|
cxCheckBox, cxCalendar, cxButtonEdit, cxTextEdit, cxDropDownEdit,
|
|||
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxPC, DBClient,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Common, RM_Class,
|
|||
|
|
RM_GridReport, Menus, RM_System, RM_Dataset, ADODB;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TFrmYFCRWTS_HZQD_CX = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
ToolButton6: TToolButton;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
QDFactoryName: TEdit;
|
|||
|
|
QDInvoiceNo: TEdit;
|
|||
|
|
begdate: TDateTimePicker;
|
|||
|
|
Enddate: TDateTimePicker;
|
|||
|
|
QDOrderNo: TEdit;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
v2SSel: TcxGridDBColumn;
|
|||
|
|
V1OrderNo: TcxGridDBColumn;
|
|||
|
|
v2QDFactoryName: TcxGridDBColumn;
|
|||
|
|
VQDNLMoney: TcxGridDBColumn;
|
|||
|
|
v2QDNote: TcxGridDBColumn;
|
|||
|
|
v2QDChuanQiDate: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
v2QDHYMoney: TcxGridDBColumn;
|
|||
|
|
v2InvoiceNo: TcxGridDBColumn;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
TPrint: TToolButton;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
RMDB_Main: TRMDBDataSet;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
CDS_HZ: TClientDataSet;
|
|||
|
|
DS_HZ: TDataSource;
|
|||
|
|
Order_Print: TClientDataSet;
|
|||
|
|
v2QDChkStatus: TcxGridDBColumn;
|
|||
|
|
ADOQueryTMP: TADOQuery;
|
|||
|
|
ADOQueryCMD: TADOQuery;
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure QDOrderNoChange(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure TPrintClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure Setstatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
FrmYFCRWTS_HZQD_CX: TFrmYFCRWTS_HZQD_CX;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses U_Fun,U_DataLink,U_ZDYHelpSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.setstatus();
|
|||
|
|
begin
|
|||
|
|
ToolButton5.Visible:=False;
|
|||
|
|
toolbutton6.Visible:=False;
|
|||
|
|
case cxtabControl1.TabIndex of
|
|||
|
|
0:begin
|
|||
|
|
ToolButton5.Visible:=True;
|
|||
|
|
end;
|
|||
|
|
1:begin
|
|||
|
|
toolbutton6.Visible:=True;
|
|||
|
|
end;
|
|||
|
|
2:begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.InitGrid();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR_ZQD ');
|
|||
|
|
sql.add('where QDChuanQiDate>='''+formatdatetime('yyyy-MM-dd',Begdate.DateTime)+''' ');
|
|||
|
|
sql.add('and QDChuanQiDate<'''+formatdatetime('yyyy-MM-dd',Enddate.DateTime)+''' ');
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.add('and (QDChkStatus='''' or QDChkStatus=''<27><>ͨ<EFBFBD><CDA8>'')');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.add('and QDChkStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
|
end;
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
setstatus();
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FrmYFCRWTS_HZQD:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.ToolButton5Click(Sender: TObject);
|
|||
|
|
var maxno: string;
|
|||
|
|
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><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('Ssel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.FieldByName('QDNote').AsString='' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from YF_Money_CR ');
|
|||
|
|
sql.add('where OrderNo='''+trim(CDS_HZ.fieldbyname('OrderNo').asstring)+'''');
|
|||
|
|
sql.add('and ChkStatus<>''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryMain.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ͬ<EFBFBD>Ż<EFBFBD><C5BB><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
|||
|
|
with frmZDYHelpSel do
|
|||
|
|
begin
|
|||
|
|
flag:='OrdConChkerYFK';
|
|||
|
|
flagname:='<27><><EFBFBD>嵥<EFBFBD><E5B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
MainType:=Trim(DName);
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with ClientDataSet1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('SSEl').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTmp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from SY_User where UserName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTmp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQuerycmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OrdConDanZH_Chk where MainID='''+trim(CDS_HZ.fieldbyname('QDID').AsString)+'''');
|
|||
|
|
sql.add('and Chker='''+trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQuerycmd.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryTmp,maxno,'ZQD','OrdConDanZH_Chk',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
fieldbyname('CKID').Value:=Trim(maxno);
|
|||
|
|
fieldbyname('Chker').value:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
fieldbyname('Mainid').Value:=trim(CDS_HZ.fieldbyname('QDID').AsString);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' Update YF_Money_CR_ZQD Set QDChkstatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',QDchktime=getdate(),QDChker='''+Trim(DName)+''',');
|
|||
|
|
sql.add(' QDNote='''+trim(CDS_HZ.fieldbyname('QDNote').AsString)+'''');
|
|||
|
|
sql.add(' where QDID='''+Trim(CDS_HZ.fieldbyname('QDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.ToolButton6Click(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><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_HZ do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.fieldbyname('Ssel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.FieldByName('QDChkStatus').AsString<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ܳ<EFBFBD><DCB3><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' Update YF_Money_CR_ZQD Set QDChkstatus='''',QDchktime=null,QDChker=''''');
|
|||
|
|
sql.add(' where QDID='''+Trim(CDS_HZ.fieldbyname('QDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from OrdConDanZH_Chk ');
|
|||
|
|
sql.add('where Mainid='''+trim(CDS_HZ.fieldbyname('QDID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
initgrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.QDOrderNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
if ADOQueryMain.Active then
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
|||
|
|
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
SelExportData(Tv2,ADOQueryMain,'<27><><EFBFBD>嵥<EFBFBD>б<EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmYFCRWTS_HZQD_CX.TPrintClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_HZ.IsEmpty then exit;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * ');
|
|||
|
|
SQL.Add(' from YF_Money_CR_ZQD ');
|
|||
|
|
sql.add(' where QDID='''+trim(CDS_HZ.fieldbyname('QDID').asstring)+''' ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryCmd,Order_Print);
|
|||
|
|
SInitCDSData20(ADOQueryCmd,Order_Print);
|
|||
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>嵥.rmf';
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RM1.ShowReport;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|