484 lines
13 KiB
ObjectPascal
484 lines
13 KiB
ObjectPascal
unit U_PKInPutQT;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxDropDownEdit, cxCalendar, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, cxSplitter;
|
||
|
||
type
|
||
TfrmPKInPutQT = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
ADOQuery1: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column22: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
v1Column12: TcxGridDBColumn;
|
||
v1Column13: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure v1Column11PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1Column7PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure v1Column8PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1Column6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
private
|
||
FXS:Integer;
|
||
procedure InitData();
|
||
procedure ZDYHelp(FButn:TcxButtonEdit;LType:string);
|
||
function SaveData():Boolean;
|
||
procedure GetMaxConNO();
|
||
{ Private declarations }
|
||
public
|
||
PState,PCopyInt:Integer;
|
||
FMainId,FConNo,FConType,FYLType:String;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmPKInPutQT: TfrmPKInPutQT;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_GYSList,U_ZDYHelpSel, U_ModuleNote,
|
||
U_GYSSelList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmPKInPutQT.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.InitData();
|
||
var
|
||
fsj:String;
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select A.* ');
|
||
SQL.Add(' from YF_Money_PaiKuan A ');
|
||
sql.Add(' where A.PKId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.ZDYHelp(FButn:TcxButtonEdit;LType:string);
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
InitData();
|
||
end;
|
||
procedure TfrmPKInPutQT.GetMaxConNO();
|
||
begin
|
||
|
||
end;
|
||
function TfrmPKInPutQT.SaveData():Boolean;
|
||
var
|
||
maxno,FSQID:String;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
ADOCmd.Connection.BeginTrans;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
Order_Sub.DisableControls;
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_PaiKuan where PKID='''+Trim(Order_Sub.fieldbyname('PKID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FSQID:=Trim(ADOTemp.fieldbyname('PKID').AsString);
|
||
if Trim(FSQID)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'SS','YF_Money_PaiKuan',4,1)=False then
|
||
begin
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(FSQID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_PaiKuan where PKID='''+Trim(maxno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FSQID)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('PKID').Value:=Trim(maxno);
|
||
RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'YF_Money_PaiKuan',0) ;
|
||
FieldByName('HZType').Value:='<27><><EFBFBD><EFBFBD>';
|
||
if Trim(Order_Sub.fieldbyname('BZType').AsString)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
FieldByName('HuiLv').Value:=1;
|
||
end;
|
||
FieldByName('FactoryNo').Value:=Order_Sub.fieldbyname('FactoryNo').Value;
|
||
if PState=1 then
|
||
begin
|
||
FieldByName('Chker').Value:=Null;
|
||
FieldByName('ChkStatus').Value:=Null;
|
||
FieldByName('ChkNote').Value:=Null;
|
||
FieldByName('ChkTime').Value:=Null;
|
||
end;
|
||
|
||
if Trim(FSQID)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_PaiKuan where PKNO='+Trim(Order_Sub.fieldbyname('PKNO').AsString));
|
||
sql.Add(' and Convert(varchar(4),PKDate,120)='''+Trim(FormatDateTime('yyyy',Order_Sub.fieldbyname('PKDate').AsDateTime))+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.RecordCount>1 then
|
||
begin
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Order_Sub.EnableControls;
|
||
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>: '+
|
||
Trim(Order_Sub.fieldbyname('PKNO').AsString)+
|
||
' <20><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>¼<EFBFBD><C2BC>!'),'<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_PaiKuan where ');
|
||
sql.Add(' FactoryName='''+Trim(Order_Sub.fieldbyname('FactoryName').AsString)+'''');
|
||
sql.Add(' and isnull(ComTaiTou,'''')='''+Trim(Order_Sub.fieldbyname('ComTaiTou').AsString)+'''');
|
||
sql.Add(' and isnull(FactoryNameOther,'''')='''+Trim(Order_Sub.fieldbyname('FactoryNameOther').AsString)+'''');
|
||
sql.Add(' and isnull(PayMent,'''')='''+Trim(Order_Sub.fieldbyname('PayMent').AsString)+'''');
|
||
sql.Add(' and PKDate='''+Trim(Order_Sub.fieldbyname('PKDate').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.RecordCount>1 then
|
||
begin
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Order_Sub.EnableControls;
|
||
Application.MessageBox(PChar('<27><>Ӧ<EFBFBD><D3A6>:'+
|
||
Trim(Order_Sub.fieldbyname('FactoryName').AsString)+
|
||
Trim(FormatDateTime('yyyy-MM-dd',Order_Sub.fieldbyname('FactoryName').AsDateTime))+
|
||
'<27><><EFBFBD>ڵ<EFBFBD><DAB5>ſ<EFBFBD><C5BF><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ظ<EFBFBD>¼<EFBFBD><C2BC>!'),'<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Edit;
|
||
FieldByName('PKID').Value:=Trim(maxno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.TBSaveClick(Sender: TObject);
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if Order_Sub.Locate('PKNO',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('PKDate',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('FactoryName',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('PKName',null,[]) then
|
||
begin
|
||
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('PayMent',null,[]) then
|
||
begin
|
||
Application.MessageBox('֧<><D6A7><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('PKMoney',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('ComTaiTou',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>λ<EEB5A5><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('BZType',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('JBPerson',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Append;
|
||
FieldByName('PKDate').Value:=Trim(FormatDateTime('yyyy-MM-dd',Now));
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then Exit;
|
||
if Trim(Order_Sub.fieldbyname('PKId').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YF_Money_PaiKuan where PKId='''+Trim(Order_Sub.fieldbyname('PKId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Order_Sub.Delete;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.v1Column11PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GSTT';
|
||
flagname:='<27><>˾̧ͷ';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
frmZDYHelp.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('ComTaiTou').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.v1Column7PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PKPayMent';
|
||
flagname:='֧<><D6A7><EFBFBD><EFBFBD>ʽ';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('PayMent').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmModuleNote:=TfrmModuleNote.Create(Application);
|
||
with frmModuleNote do
|
||
begin
|
||
flag:='<27>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)';
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmModuleNote.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.v1Column8PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PKName';
|
||
flagname:='Ʒ<><C6B7>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('PKName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.v1Column6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSSelList:=TfrmGYSSelList.Create(Application);
|
||
with frmGYSSelList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('FactoryNo').Value:=Trim(frmGYSSelList.Order_Main.fieldbyname('ZKID').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(frmGYSSelList.Order_Main.fieldbyname('KHName').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSSelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmPKInPutQT.v1Column2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='JBPerson';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('JBPerson').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|