216 lines
5.3 KiB
ObjectPascal
216 lines
5.3 KiB
ObjectPascal
unit U_Company;
|
||
|
||
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, cxDBLookupComboBox, ComObj, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
||
dxBarBuiltInMenu, cxContainer;
|
||
|
||
type
|
||
TfrmCompany = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
GPM_1: TcxGridPopupMenu;
|
||
DS_1: TDataSource;
|
||
CDS_1: TClientDataSet;
|
||
btnAdd: TToolButton;
|
||
v2Column6: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column10: TcxGridDBColumn;
|
||
btnEdit: TToolButton;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label3: TLabel;
|
||
Label1: TLabel;
|
||
ToolButton2: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
CoName: TcxTextEdit;
|
||
CoCode: TcxTextEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure btnEditClick(Sender: TObject);
|
||
procedure btnAddClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure CoCodeChange(Sender: TObject);
|
||
private
|
||
fFlileFlag: string;
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
FAuthority: string;
|
||
end;
|
||
|
||
var
|
||
frmCompany: TfrmCompany;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_CustomerInput, U_AttachmentUpload;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmCompany.InitGrid();
|
||
var
|
||
SqlStr, FilterStr: string;
|
||
begin
|
||
FilterStr := SGetFilters(Panel1, 1, 2);
|
||
SqlStr := ' select * from BS_Company where CoType=''<27><>˾'' and Valid=''Y'' ';
|
||
InitCDSData(ADOQueryMain, CDS_1, Tv1, SqlStr, FilterStr, 'CoCode');
|
||
end;
|
||
|
||
procedure TfrmCompany.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
// frmCustomer:=nil;
|
||
end;
|
||
|
||
procedure TfrmCompany.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmCompany.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCompany.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
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('exec P_BS_Com_Del @COID=' + quotedstr(trim(CDS_1.fieldbyname('COID').AsString)));
|
||
sql.Add(',@DCode=' + quotedstr(trim(DCode)));
|
||
sql.Add(',@DName=' + quotedstr(trim(DName)));
|
||
ExecSQL;
|
||
end;
|
||
|
||
CDS_1.Delete;
|
||
|
||
end;
|
||
|
||
procedure TfrmCompany.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid(trim(self.Caption), Tv1, '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCompany.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCompany.btnEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
exit;
|
||
try
|
||
frmCustomerInput := TfrmCustomerInput.Create(Application);
|
||
with frmCustomerInput do
|
||
begin
|
||
fFlileFlag := self.fFlileFlag;
|
||
FCOID := Trim(Self.CDS_1.fieldbyname('COID').AsString);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
end;
|
||
finally
|
||
frmCustomerInput.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCompany.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
||
with frmAttachmentUpload do
|
||
begin
|
||
// FEditAuthority := True;
|
||
if (Trim(FAuthority) = '¼<><C2BC>') or (Trim(FAuthority) = '<27><><EFBFBD><EFBFBD>') then
|
||
FEditAuthority := True;
|
||
fkeyNO := Trim(Self.CDS_1.fieldbyname('Coid').AsString);
|
||
fType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmAttachmentUpload.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCompany.CoCodeChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_1);
|
||
SInitCDSData(ADOQueryMain, CDS_1);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmCompany.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.caption), Tv1, '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
end;
|
||
|
||
procedure TfrmCompany.btnAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCustomerInput := TfrmCustomerInput.Create(Application);
|
||
with frmCustomerInput do
|
||
begin
|
||
FCOID := '';
|
||
fFlileFlag := self.fFlileFlag;
|
||
if ShowModal = 1 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmCustomerInput.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|