640 lines
16 KiB
ObjectPascal
640 lines
16 KiB
ObjectPascal
|
|
unit U_CustInRC;
|
|||
|
|
|
|||
|
|
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, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
cxNavigator, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
|
dxBarBuiltInMenu, U_BaseList, JPEG, U_SLT;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
Mach: array of TfrmSlt;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmCustInRC = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
CDS_LXR: TClientDataSet;
|
|||
|
|
DSLXR: TDataSource;
|
|||
|
|
ScrollBox1: TScrollBox;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
CoName: TEdit;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
CoAbbrName: TEdit;
|
|||
|
|
CoCode: TEdit;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
COID: TEdit;
|
|||
|
|
adoqueryPicture: TADOQuery;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
ToolButton8: TToolButton;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
CDS_1: TClientDataSet;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
DS_1: TDataSource;
|
|||
|
|
Tv1Column4: 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 ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure cocountryBtnDnClick(Sender: TObject);
|
|||
|
|
procedure cocountryBtnUpClick(Sender: TObject);
|
|||
|
|
procedure ParentCoNameBtnUpClick(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitImg();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
public
|
|||
|
|
fkhType: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
FCOID: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmCustInRC: TfrmCustInRC;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_ZDYHelpSelX, U_YGSel, U_CompanySel, U_CustFileUp;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from BS_Company where CoType=''<27>ͻ<EFBFBD>'' and COID=''' + Trim(FCOID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCSHData(ADOQueryMain, ScrollBox1, 2);
|
|||
|
|
// ParentCoName.TxtCode := ADOQueryMain.FieldByName('ParentCoCode').AsString;
|
|||
|
|
|
|||
|
|
// with ADOQueryMain do
|
|||
|
|
// begin
|
|||
|
|
// Filtered := False;
|
|||
|
|
// Close;
|
|||
|
|
// SQL.Clear;
|
|||
|
|
// sql.Add(' select * from BS_Company_contact where COID=' + quotedstr(Trim(FCOID)));
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(ADOQueryMain, CDS_LXR);
|
|||
|
|
// SInitCDSData(ADOQueryMain, CDS_LXR);
|
|||
|
|
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add(' select * from BS_Company_RC where COID=' + quotedstr(Trim(FCOID)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
|
|||
|
|
|
|||
|
|
// InitImg(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>FromClose<73><65><EFBFBD>ͷ<EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.InitImg();
|
|||
|
|
var
|
|||
|
|
i, j: integer;
|
|||
|
|
jpg: TJpegImage;
|
|||
|
|
myStream: TADOBlobStream;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
// j := length(Mach);
|
|||
|
|
// if j > 0 then
|
|||
|
|
// begin
|
|||
|
|
// for i := 0 to j - 1 do
|
|||
|
|
// begin
|
|||
|
|
// Mach[i].free;
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// SetLength(Mach, 0);
|
|||
|
|
// if trim(FCOID) = '' then
|
|||
|
|
// exit;
|
|||
|
|
// try
|
|||
|
|
// with adoqueryPicture do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add(' select A.TFID,A.WBID,A.FilesOther,A.FileName from TP_File A ');
|
|||
|
|
// sql.add('where A.WBID=' + quotedstr(trim(FCoID)));
|
|||
|
|
//// if Trim(cbbHX.Text) <> '' then
|
|||
|
|
//// sql.add(' and A.HXName=' + quotedstr(trim(cbbHX.Text)));
|
|||
|
|
//// ShowMessage(SQL.text) ;
|
|||
|
|
// open;
|
|||
|
|
// end;
|
|||
|
|
// j := adoqueryPicture.RecordCount;
|
|||
|
|
// if j < 1 then
|
|||
|
|
// exit;
|
|||
|
|
// adoqueryPicture.DisableControls;
|
|||
|
|
// adoqueryPicture.First;
|
|||
|
|
// SetLength(Mach, j);
|
|||
|
|
// jpg := TJpegImage.Create();
|
|||
|
|
// for i := 0 to j - 1 do
|
|||
|
|
// begin
|
|||
|
|
// if triM(adoqueryPicture.fieldbyname('FilesOther').AsString) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// myStream := tadoblobstream.Create(tblobfield(adoqueryPicture.fieldbyname('FilesOther')), bmread);
|
|||
|
|
// jpg.LoadFromStream(myStream);
|
|||
|
|
// Mach[i] := TfrmSlt.Create(Self);
|
|||
|
|
// Mach[i].Name := trim(adoqueryPicture.fieldbyname('TFID').AsString);
|
|||
|
|
// Mach[i].Parent := ScrollBox2;
|
|||
|
|
// Mach[i].Left := 0 + i * 165;
|
|||
|
|
// Mach[i].Init(adoqueryPicture.fieldbyname('TFID').AsString, adoqueryPicture.fieldbyname('FileName').AsString, jpg);
|
|||
|
|
// end;
|
|||
|
|
// adoqueryPicture.Next;
|
|||
|
|
// end;
|
|||
|
|
// adoqueryPicture.EnableControls;
|
|||
|
|
// finally
|
|||
|
|
// jpg.free;
|
|||
|
|
// application.ProcessMessages;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ParentCoNameBtnUpClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// try
|
|||
|
|
// frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
// with frmCompanySel do
|
|||
|
|
// begin
|
|||
|
|
// FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
// ParentCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
// ParentCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// finally
|
|||
|
|
// frmCompanySel.Free;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frmCustInRC := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.cocountryBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBtnEditC(Sender).Text := '';
|
|||
|
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.cocountryBtnUpClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj,zysc: string;
|
|||
|
|
FWZ: Integer;
|
|||
|
|
begin
|
|||
|
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
|
FWZ := Pos('/', fsj);
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
frmZDYHelpSelX := TfrmZDYHelpSelX.Create(Application);
|
|||
|
|
with frmZDYHelpSelX do
|
|||
|
|
begin
|
|||
|
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
while frmZDYHelpSelX.ClientDataSet1.Locate('SSel', true, []) do
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if trim(zysc) = '' then
|
|||
|
|
zysc := trim(ClientDataSet1.fieldbyname('ZDYName').AsString)
|
|||
|
|
else
|
|||
|
|
zysc := zysc + ',' + trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
|
|||
|
|
TEdit(Sender).Text := zysc;
|
|||
|
|
frmZDYHelpSelX.ClientDataSet1.delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelpSelX.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'position';
|
|||
|
|
flagname := 'ְλ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
CDS_LXR.Edit;
|
|||
|
|
CDS_LXR.fieldbyname('position').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
// Order_Sub.fieldbyname('PRTCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
|||
|
|
CDS_LXR.Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
// tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
var
|
|||
|
|
i, j: integer;
|
|||
|
|
begin
|
|||
|
|
//<2F>ͷ<EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>
|
|||
|
|
j := length(Mach);
|
|||
|
|
if j > 0 then
|
|||
|
|
begin
|
|||
|
|
for i := 0 to j - 1 do
|
|||
|
|
begin
|
|||
|
|
Mach[i].free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
SetLength(Mach, 0);
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(trim(self.Caption) + 'TV1', Tv1, '<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
|||
|
|
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: integer;
|
|||
|
|
a: string;
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid(trim(self.Caption) + 'TV1', Tv1, '<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
|||
|
|
InitGrid();
|
|||
|
|
// InitImg();
|
|||
|
|
if trim(FCOID) = '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Com_Get_No @Str=''K'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
CoCode.Text := trim(ADOQueryTemp.FieldByName('NewCoCode').asstring);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>ҲҪ<D2B2><D2AA><EFBFBD>ı<DEB8><C4B1>棬<EFBFBD><E6A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ֻ<EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select * from BS_Company where CoId=' + quotedstr(FCoId));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if trim(ADOQueryTemp.FieldByName('Status').asstring) = '1' then
|
|||
|
|
begin
|
|||
|
|
ScrollBox1.Enabled := False;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmCustInRC.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
MaxId, MaxSubId, MaxRCId, FCoCode, FCCID, FCRID: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
|
|||
|
|
////////////// <20>ճ<EFBFBD> ///////////////////
|
|||
|
|
if not CDS_1.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
CDS_1.First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
FCRID := Trim(CDS_1.fieldbyname('CRID').AsString);
|
|||
|
|
if Trim(FCRID) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, MaxRCId, 'CR', 'BS_Company_RC', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
MaxRCId := trim(FCRID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from BS_Company_RC where CRID=' + quotedstr(Trim(MaxRCId)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FCRID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('CRID').Value := Trim(MaxRCId);
|
|||
|
|
FieldByName('COID').Value := Trim(FCoId);
|
|||
|
|
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'BS_Company_RC', 0);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('CRID').Value := Trim(MaxRCId);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
CDS_1.Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
////////////// <20>ճ<EFBFBD> ///////////////////
|
|||
|
|
|
|||
|
|
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////////
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('exec P_Com_Up_Code @COID=' + quotedstr(Trim(MaxId)));
|
|||
|
|
// ExecSQL;
|
|||
|
|
// end;
|
|||
|
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////////
|
|||
|
|
// FCOID := MaxId;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
FCCID := Trim(MaxSubId);
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := false;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
// if Trim(CoAbbrName.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if Trim(CoBusinessType.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if Trim(CoName.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton5Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
maxno: string;
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, maxno, 'CR', 'BS_Company_RC', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('RCType').Value := '<27>ճ<EFBFBD><D5B3><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
fieldbyname('CRID').Value := trim(maxno);
|
|||
|
|
FieldByName('FillId').Value := trim(DCode);
|
|||
|
|
fieldbyname('FIller').Value := trim(DName);
|
|||
|
|
FieldByName('Date').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
// fieldbyname('IsDefault').Value := true;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton6Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
maxno: string;
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, maxno, 'CC', 'BS_Company_contact', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡϵ<C8A1><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IDʧ<44><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_LXR.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with CDS_LXR do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
fieldbyname('CCID').Value := trim(maxno);
|
|||
|
|
fieldbyname('IsDefault').Value := true;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with CDS_LXR do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
fieldbyname('CCID').Value := trim(maxno);
|
|||
|
|
fieldbyname('IsDefault').Value := false;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton7Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_LXR.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(CDS_LXR.fieldbyname('CCID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from BS_Company_contact where CCID=''' + Trim(CDS_LXR.fieldbyname('CCID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_LXR.Delete;
|
|||
|
|
if CDS_LXR.IsEmpty = false then
|
|||
|
|
begin
|
|||
|
|
if CDS_LXR.Locate('IsDefault', true, []) = false then
|
|||
|
|
begin
|
|||
|
|
CDS_LXR.first;
|
|||
|
|
CDS_LXR.edit;
|
|||
|
|
CDS_LXR.FieldByName('IsDefault').value := true;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton8Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(CDS_1.fieldbyname('CRID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from BS_Company_RC where CRID=''' + Trim(CDS_1.fieldbyname('CRID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_1.Delete;
|
|||
|
|
// if CDS_1.IsEmpty = false then
|
|||
|
|
// begin
|
|||
|
|
// if CDS_LXR.Locate('IsDefault', true, []) = false then
|
|||
|
|
// begin
|
|||
|
|
// CDS_LXR.first;
|
|||
|
|
// CDS_LXR.edit;
|
|||
|
|
// CDS_LXR.FieldByName('IsDefault').value := true;
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// if self.FCOID = '' then
|
|||
|
|
// begin
|
|||
|
|
// if Trim(CoAbbrName.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if Trim(CoBusinessType.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if Trim(CoName.Text) = '' then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if SaveData() then
|
|||
|
|
// begin
|
|||
|
|
//
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
try
|
|||
|
|
frmCustFileUp := TfrmCustFileUp.Create(Application);
|
|||
|
|
with frmCustFileUp do
|
|||
|
|
begin
|
|||
|
|
frmCustFileUp.Code.Text := self.CoCode.Text;
|
|||
|
|
frmCustFileUp.FBCIID := self.FCOID;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.InitGrid();
|
|||
|
|
// Self.CDS_1.Locate('BCIID', BCIID, []);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCustFileUp.Free;
|
|||
|
|
end;
|
|||
|
|
// InitImage();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmCustInRC.ToolButton2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
DwFlag: string;
|
|||
|
|
begin
|
|||
|
|
DwFlag := trim(CDS_LXR.FieldByName('CCID').AsString);
|
|||
|
|
if CDS_LXR.Locate('IsDefault', true, []) then
|
|||
|
|
begin
|
|||
|
|
CDS_LXR.edit;
|
|||
|
|
CDS_LXR.FieldByName('IsDefault').value := false;
|
|||
|
|
end;
|
|||
|
|
if CDS_LXR.Locate('CCID', DwFlag, []) then
|
|||
|
|
begin
|
|||
|
|
CDS_LXR.edit;
|
|||
|
|
CDS_LXR.FieldByName('IsDefault').value := true;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|