D7myzhenyong/客户供应商管理(Company.dll)/U_ourcompany.pas
DESKTOP-E401PHE\Administrator 237de1c308 0
2025-08-26 15:25:51 +08:00

222 lines
5.7 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_OURcompany;
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, cxLookAndFeels, cxLookAndFeelPainters,
cxNavigator, cxRichEdit, cxMemo;
type
Tfrmourcompany = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBDel: TToolButton;
TBClose: TToolButton;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Panel1: TPanel;
ToolButton2: TToolButton;
ADOQueryMain: TADOQuery;
RM1: TRMGridReport;
RMDB_Main: TRMDBDataSet;
Label3: TLabel;
CoName: TEdit;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
cxGridPopupMenu2: TcxGridPopupMenu;
DS_HZ: TDataSource;
CDS_HZ: TClientDataSet;
ToolButton3: TToolButton;
v2Column6: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
Label1: TLabel;
CoCode: TEdit;
ToolButton4: TToolButton;
v2Column15: TcxGridDBColumn;
CDS_LXR: TClientDataSet;
DSLXR: TDataSource;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
Tv1Column1: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Tv1Column2: TcxGridDBColumn;
Tv2Column1: TcxGridDBColumn;
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 ToolButton2Click(Sender: TObject);
procedure CoNameChange(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure TBuserClick(Sender: TObject);
procedure Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
private
{ Private declarations }
procedure InitGrid();
public
end;
var
frmourcompany: Tfrmourcompany;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_OURcompanyInput;
{$R *.dfm}
procedure Tfrmourcompany.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered := False;
Close;
SQL.Clear;
sql.Add(' select * from Company where CoType=''<27><>˾'' and Valid=''Y'' ');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_HZ);
SInitCDSData20(ADOQueryMain, CDS_HZ);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure Tfrmourcompany.FormDestroy(Sender: TObject);
begin
frmourcompany := nil;
end;
procedure Tfrmourcompany.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure Tfrmourcompany.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(trim(self.caption), Tv2, '<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>');
Close;
end;
procedure Tfrmourcompany.TBDelClick(Sender: TObject);
begin
if CDS_HZ.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
if Trim(CDS_HZ.fieldbyname('COID').AsString) <> '' then
begin
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('update Company set Valid=''N'' where COID=''' + Trim(CDS_HZ.fieldbyname('COID').AsString) + '''');
ExecSQL;
end;
end;
CDS_HZ.Delete;
end;
procedure Tfrmourcompany.FormShow(Sender: TObject);
begin
ReadCxGrid(trim(self.Caption), Tv2, '<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>');
InitGrid();
end;
procedure Tfrmourcompany.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure Tfrmourcompany.ToolButton2Click(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
SCreateCDS20(ADOQueryMain, CDS_HZ);
SInitCDSData20(ADOQueryMain, CDS_HZ);
end;
end;
procedure Tfrmourcompany.CoNameChange(Sender: TObject);
begin
ToolButton2.Click;
end;
procedure Tfrmourcompany.ToolButton4Click(Sender: TObject);
begin
if CDS_HZ.IsEmpty then
exit;
try
frmOurcompanyInput := TfrmOurcompanyInput.Create(Application);
with frmOurcompanyInput do
begin
FCOID := Trim(Self.CDS_HZ.fieldbyname('COID').AsString);
if ShowModal = 1 then
begin
TBRafresh.Click;
end;
end;
finally
frmOurcompanyInput.Free;
end;
end;
procedure Tfrmourcompany.ToolButton3Click(Sender: TObject);
begin
try
frmOurcompanyInput := TfrmOurcompanyInput.Create(Application);
with frmOurcompanyInput do
begin
FCOID := '';
if ShowModal = 1 then
begin
InitGrid();
end;
end;
finally
frmOurcompanyInput.Free;
end;
end;
procedure Tfrmourcompany.TBuserClick(Sender: TObject);
var
FuserName: string;
begin
end;
procedure Tfrmourcompany.Tv2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
begin
with ADOQueryTemp do
begin
Filtered := False;
Close;
SQL.Clear;
sql.Add(' select * from Company_Account where COID=' + quotedstr(Trim(CDS_HZ.FieldByName('COID').AsString)));
Open;
end;
SCreateCDS20(ADOQueryTemp, CDS_LXR);
SInitCDSData20(ADOQueryTemp, CDS_LXR);
end;
end.