1117 lines
30 KiB
ObjectPascal
1117 lines
30 KiB
ObjectPascal
|
|
unit U_KDList;
|
|||
|
|
|
|||
|
|
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, cxCalendar, cxButtonEdit, cxSplitter,
|
|||
|
|
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
|||
|
|
cxTextEdit, cxPC, cxCheckBox, Menus;
|
|||
|
|
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmKDList = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBEdit: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
v1Column16: TcxGridDBColumn;
|
|||
|
|
ComboBox2: TComboBox;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
v1Column18: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
v1Column11: TcxGridDBColumn;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
v1Column13: TcxGridDBColumn;
|
|||
|
|
v1Column15: TcxGridDBColumn;
|
|||
|
|
v1Column17: TcxGridDBColumn;
|
|||
|
|
v1Column19: TcxGridDBColumn;
|
|||
|
|
v1Column21: TcxGridDBColumn;
|
|||
|
|
v1Column22: TcxGridDBColumn;
|
|||
|
|
ToolButton6: TToolButton;
|
|||
|
|
ToolButton7: TToolButton;
|
|||
|
|
v1Column23: TcxGridDBColumn;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
KDNO: TEdit;
|
|||
|
|
Country: TEdit;
|
|||
|
|
KHName: TEdit;
|
|||
|
|
KDType: TEdit;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
FKType: TEdit;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
v1Column14: TcxGridDBColumn;
|
|||
|
|
v1Column24: TcxGridDBColumn;
|
|||
|
|
v1Column25: TcxGridDBColumn;
|
|||
|
|
v1Column26: TcxGridDBColumn;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
ClientDataSet2: TClientDataSet;
|
|||
|
|
cxSplitter1: TcxSplitter;
|
|||
|
|
CDS_Chker: TClientDataSet;
|
|||
|
|
CDS_Chk: TClientDataSet;
|
|||
|
|
DS_Chk: TDataSource;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
cxGridDBTableView1: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv2: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
v2Column2: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn17: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
EditNote: TMemo;
|
|||
|
|
v1EditSQTime: TcxGridDBColumn;
|
|||
|
|
v1EditNote: TcxGridDBColumn;
|
|||
|
|
TEditSQ: TToolButton;
|
|||
|
|
TQS: TToolButton;
|
|||
|
|
v1QSDate: TcxGridDBColumn;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Panel10: TPanel;
|
|||
|
|
Image2: TImage;
|
|||
|
|
Button1: TButton;
|
|||
|
|
QSDate: TDateTimePicker;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
JYPerson: TEdit;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
KDComName: TEdit;
|
|||
|
|
v1ConNo: TcxGridDBColumn;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
ConNO: TEdit;
|
|||
|
|
v1IFDS: TcxGridDBColumn;
|
|||
|
|
v1HKMoney: TcxGridDBColumn;
|
|||
|
|
v1FKName: TcxGridDBColumn;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBEditClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure cxPageControl1Change(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure WorkerChange(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure KDNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure TEditSQClick(Sender: TObject);
|
|||
|
|
procedure Image2Click(Sender: TObject);
|
|||
|
|
procedure TQSClick(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
FInt,PFInt:Integer;
|
|||
|
|
canshu1,canshu2:string;
|
|||
|
|
FNowDate:TDateTime;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelData():Boolean;
|
|||
|
|
procedure InitGridWsql(fsj:string);
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmKDList: TfrmKDList;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_KDInPut,U_ModuleNote, U_ZDYHelp, U_ZDYHelpSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmKDList:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ǽ<EFBFBD>',Tv1,'<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.InitGrid();
|
|||
|
|
var
|
|||
|
|
fsj:String;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
SQL.Add(' from KuaiDi_Money A where 1=1 ');
|
|||
|
|
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
//sql.Add(' and Filler='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(' and( isnull(JYPerson,'''')='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(' or isnull(YWZhuLi,'''')='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(' or isnull(FillCode,'''')='''+Trim(DCode)+''')');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex<>0 then
|
|||
|
|
begin
|
|||
|
|
fsj:=TA(ComboBox2.Items.Objects[ComboBox2.Items.IndexOf(Trim(ComboBox2.Text))]).S;
|
|||
|
|
sql.Add(' and A.'+Trim(fsj)+'>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and A.'+Trim(fsj)+'<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and (isnull(A.Status,'''')='''' or isnull(A.Status,'''')=''<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>'')');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and (isnull(A.Status,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' or isnull(A.Status,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' or isnull(A.Status,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.Status,'''')=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=3 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.Status,'''')=''<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>'' ');
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.InitForm();
|
|||
|
|
begin
|
|||
|
|
FNowDate:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
EndDate.Date:=SGetServerDateMEnd(ADOQueryTemp);
|
|||
|
|
BegDate.Date:=SGetServerDateMBeg(ADOQueryTemp);
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ǽ<EFBFBD>',Tv1,'<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
TQS.Visible:=False;
|
|||
|
|
if canshu1='<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
TQS.Visible:=true;
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBEditClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if (cxTabControl1.TabIndex<>0) and (cxTabControl1.TabIndex<>3) then Exit;
|
|||
|
|
if Trim(DCode)<>Trim(Order_Main.fieldbyname('FillCode').AsString) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(MoneyPerson,'''')<>'''' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Ѷ<EFBFBD><D1B6>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmKDInPut:=TfrmKDInPut.Create(Application);
|
|||
|
|
with frmKDInPut do
|
|||
|
|
begin
|
|||
|
|
PState:=1;
|
|||
|
|
FMainId:=Trim(Self.Order_Main.fieldbyname('KDID').AsString);
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmKDInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
|
if Trim(DCode)<>Trim(Order_Main.fieldbyname('FillCode').AsString) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
{with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(Chker,'''')<>'''' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end; }
|
|||
|
|
if Order_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
|
|||
|
|
//Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmKDList.DelData():Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result:=false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
while Locate('SSel',True,[]) do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete KuaiDi_Money where KDId='''+Trim(Order_Main.fieldbyname('KDId').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result:=True;
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Result:=False;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel('<27>ļ<EFBFBD><C4BC><EFBFBD>Ϣ',cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TBAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmKDInPut:=TfrmKDInPut.Create(Application);
|
|||
|
|
with frmKDInPut do
|
|||
|
|
begin
|
|||
|
|
frmKDInPut.canshu1:=Self.canshu1;
|
|||
|
|
PState:=0;
|
|||
|
|
FMainId:='';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmKDInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i:Integer;
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
SInitComBoxByTvColumns(ComboBox2,Tv1,999,True,True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.cxPageControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmModuleNote:=TfrmModuleNote.Create(Application);
|
|||
|
|
with frmModuleNote do
|
|||
|
|
begin
|
|||
|
|
flag:='<27>ļ<EFBFBD><C4BC><EFBFBD>Ϣ<EFBFBD>Ǽ<EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmModuleNote.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
canshu1:=Trim(DParameters1);
|
|||
|
|
canshu2:=Trim(DParameters2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.InitGridWsql(fsj:string);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
SQL.Add(' from KuaiDi_Money A');
|
|||
|
|
sql.Add(' where isnull(HZType,'''')='''' ');
|
|||
|
|
if Trim(canshu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and (FillCode in(select UserID from SY_User where DPID in');
|
|||
|
|
sql.Add(' (select DPID from SY_User where UserID='''+Trim(DCode)+'''))');
|
|||
|
|
SQL.Add(' )');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.Status,'''')='''' ');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.Status,'''')<>'''' and isnull(A.MoneyPerson,'''')='''' ');
|
|||
|
|
end else
|
|||
|
|
if cxTabControl1.TabIndex=2 then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(A.MoneyPerson,'''')<>'''' ');
|
|||
|
|
end;
|
|||
|
|
sql.Add(fsj);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.WorkerChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile:String;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if Order_Main.FieldByName('SSel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.OrderNo,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,C.PRTHX,C.PRTColorNo,C.PRTColor,GangNo=A.GangNo,A.PS,A.Qty,A.QtyUnit,A.MDID ');
|
|||
|
|
SQL.Add(',B.MPRTCode,B.MPRTGY,C.PRTColorEng,A.SelfGangNo');
|
|||
|
|
sql.Add('from JYOrder_Main_MD A');
|
|||
|
|
sql.Add('inner join JYOrder_Main B on A.OrdMainid=B.Mainid');
|
|||
|
|
sql.Add(' inner join JYOrder_Sub C on A.OrdSubid=C.SubId');
|
|||
|
|
sql.Add(' where A.MDID='''+Trim(Order_Main.fieldbyname('MDID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
//RM1.ShowReport;
|
|||
|
|
RM1.PrintReport;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.KDNOKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
var
|
|||
|
|
fsj:String;
|
|||
|
|
begin
|
|||
|
|
if Key<>#13 then Exit;
|
|||
|
|
if Length(Trim(KDNo.Text))<3 then Exit;
|
|||
|
|
fsj:=' and A.KDNo like '''+'%'+Trim(KDNo.Text)+'%'+'''';
|
|||
|
|
InitGridWsql(fsj);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(Order_Main,True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(Order_Main,False);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
maxno,FCKID:string;
|
|||
|
|
FCount:Integer;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Chker=Cast('''' as varchar(20))');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_Chker);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_Chker);
|
|||
|
|
while CDS_Chker.IsEmpty=False do
|
|||
|
|
begin
|
|||
|
|
CDS_Chker.Delete;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmZDYHelpSel:=TfrmZDYHelpSel.Create(Application);
|
|||
|
|
with frmZDYHelpSel do
|
|||
|
|
begin
|
|||
|
|
flag:='OAChker';
|
|||
|
|
flagname:='OA<4F><41><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
|
|||
|
|
CDS_Chker.Append;
|
|||
|
|
CDS_Chker.FieldByName('Chker').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
CDS_Chker.Post;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if CDS_Chker.IsEmpty then FCount:=9
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelpSel.Free;
|
|||
|
|
end;
|
|||
|
|
if FCount=9 then
|
|||
|
|
begin
|
|||
|
|
if CDS_Chker.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if CDS_Chker.IsEmpty then Exit;
|
|||
|
|
CDS_Chker.DisableControls;
|
|||
|
|
with CDS_Chker do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from SY_User where UserName='''+Trim(CDS_Chker.fieldbyname('Chker').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
CDS_Chker.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Chker.EnableControls;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Order_Main.Locate('SSel',True,[]) do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('UPdate KuaiDi_Money Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SSTime=getdate(),SSPerson='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with CDS_Chker do
|
|||
|
|
begin
|
|||
|
|
CDS_Chker.First;
|
|||
|
|
while not CDS_Chker.Eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where MainId='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27>ļ<EFBFBD>'' ');
|
|||
|
|
sql.Add(' and isnull(Chker,'''')='''+Trim(CDS_Chker.fieldbyname('Chker').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
FCKID:=Trim(ADOQueryTemp.fieldbyname('CKID').AsString);
|
|||
|
|
ADOQueryTemp.Close;
|
|||
|
|
if Trim(FCKID)='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd,maxno,'CK','OA_Chk',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where 1=2');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('CKID').Value:=Trim(maxno);
|
|||
|
|
FieldByName('MainID').Value:=Trim(Order_Main.fieldbyname('KDID').AsString);
|
|||
|
|
FieldByName('OAType').Value:='<27>ļ<EFBFBD>';
|
|||
|
|
FieldByName('Chker').Value:=Trim(CDS_Chker.fieldbyname('Chker').AsString);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Chker.Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Exit;
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
{if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>0 then Exit;
|
|||
|
|
if Order_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>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Locate('SSel',True,[])=True do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate KuaiDi_Money Set Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',SSTime=getdate(),SSPerson='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;}
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>1 then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Order_Main.FieldByName('SSel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(Status,'''')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and isnull(Status,'''')<>''<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
|
begin
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Order_Main.Locate('SSel',True,[]) do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('Update KuaiDi_Money Set ');
|
|||
|
|
sql.Add(' SSPerson=NUll,SSTime=NUll,Status='''',ChkStatus='''' ');
|
|||
|
|
sql.Add(' where KDID='''+Order_Main.fieldbyname('KDID').AsString+'''');
|
|||
|
|
sql.Add(' delete OA_Chk where MainId='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27>ļ<EFBFBD>'' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where 1=2');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_Chk);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_Chk);
|
|||
|
|
Exit;
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
{if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>1 then Exit;
|
|||
|
|
if Order_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>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Locate('SSel',True,[])=True do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate KuaiDi_Money Set Status=Null,SSTime=Null,SSPerson=Null');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end; }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton6Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>2 then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Order_Main.Locate('SSel;KDNO',VarArrayOf([True,Null]),[loPartialKey])=True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>浥<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Locate('SSel',True,[])=True do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate KuaiDi_Money Set Status=''<27><><EFBFBD>µ<EFBFBD>'',XDTime=getdate(),XDPerson='''+Trim(DName)+'''');
|
|||
|
|
sql.Add(',XDStatus=''<27><><EFBFBD>µ<EFBFBD>'',KDNO='''+Trim(Order_Main.fieldbyname('KDNO').AsString)+'''');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.ToolButton7Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if cxTabControl1.TabIndex<>4 then Exit;
|
|||
|
|
if Order_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>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Locate('SSel',True,[])=True do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('UPdate KuaiDi_Money Set Status=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'',XDTime=Null,XDPerson=Null');
|
|||
|
|
sql.Add(',XDStatus=Null,KDNO=Null');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
|
|||
|
|
except
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from KuaiDi_Money_Sub ');
|
|||
|
|
sql.Add('where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,ClientDataSet2);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,ClientDataSet2);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where MainId='''+Trim(Order_Main.fieldbyname('KDId').AsString)+'''');
|
|||
|
|
sql.Add(' and OAType=''<27>ļ<EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,CDS_Chk);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,CDS_Chk);
|
|||
|
|
EditNote.Text:=trim(Order_Main.fieldbyname('EditNote').AsString);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TEditSQClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
if cxTabControl1.TabIndex=0 then exit;
|
|||
|
|
if EditNote.Text='' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
frmZDYHelpSel:=TfrmZDYHelpSel.Create(self);
|
|||
|
|
with frmZDYHelpSel do
|
|||
|
|
begin
|
|||
|
|
flag:='OAChker';
|
|||
|
|
flagname:='OA<4F><41><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
|
|||
|
|
if CDS_Chk.Locate('Chker',Trim(fieldbyname('ZdyName').AsString),[])=False then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('û<>иú<D0B8>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update OA_Chk Set ChkStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',chknote='''',ChkTime=getdate()');
|
|||
|
|
sql.Add(' where Mainid='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
sql.Add(' and Chker='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27>ļ<EFBFBD>'' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update KuaiDi_Money Set EditNote='''+Trim(EditNote.Text)+'''');
|
|||
|
|
sql.Add(',Status=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',EditFlag=''1'',EditSQTime=getDate()');
|
|||
|
|
sql.Add(' where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
fieldbyname('Status').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('EditNote').Value:=Trim(EditNote.Text);
|
|||
|
|
fieldbyname('EditSQTime').Value:=SGetServerDate10(ADOQueryTemp);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
EditNote.Text:='';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.Image2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
panel4.Visible:=false;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.TQSClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
if order_Main.Locate('Ssel',true,[])=false then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
panel4.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmKDList.Button1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD>','<27><>ʾ',1)=2 then exit;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update KuaiDi_Money set QSDate='''+trim(formatdatetime('yyyy-MM-dd',QSDate.DateTime))+''' ');
|
|||
|
|
sql.add('where KDID='''+trim(Order_Main.fieldbyname('KDID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('QSDate').Value:=QSDate.DateTime;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
first;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|