关注DELPHI_LOBBY的成长-招聘版 ( 积分: 300 )

  • 主题发起人 主题发起人 Delphi_lobby
  • 开始时间 开始时间
没诚意!
dfw的骗子公司太多了!
大家要小心!
 
看过网站,接分
 
呵呵!
晕!
你们那里到处是视频!机箱用铁箱锁起来!
你们是不是招一批人然后又照一批人!
在开除一批人呢!?
 
我六年工作经验!
我水平不够吗?
我写的代码比你吃的饭还做!
 
哦,我终于记起你是谁来了!
你所谓的难题可是:写个函数输出乘法口诀或者是找出指定节点的所有子节点呢?
你扪心自问一下,这么多年的Delphi经验,被两个这样的问题抓破头~然后跑来这里发骚扰!,我还记得你当时的回答是一下子转不过弯来。我能当时告诉你,你太笨吗?对不起我心情比较XXXX。我也是年轻人,年轻人就会有脾气,有话直说。
redbird2006 我不知道你什么时候来面试的。我们公司早期一直只有一个小姑娘。而且她只负责接待,现在多了两个测试。而她们从来不用负责这方面的事情。她如果真的是要作品,也许是她不知道如何证明你是有能力的。留个东西给我们专业的人看,更能证明你是否真的有能力。如果我们一家投资这么多资金的公司,靠这个来做产品?你想像后果是怎么样的。
我无法忍受别人的误解,所以在这个原本不该说这些话的地方说这些话!
 
打住,我们开帖另聊!
试想,在小溪里面呆六年的鱼,和在江河里呆一年的鱼有区别吗?
 
我还带做团队!
你们老板就是在忽悠别人!
我也做过项目经理!
你们的鬼把戏我怎么不知道!
 
看帖:http://www.delphibbs.com/delphibbs/DispQ.asp?LID=3720766
 
1: 乘法口诀 是下面这个东西吗?
procedure TForm4.Button4Click(Sender: TObject);
var
I, J, vTmpResult: Integer;
vTmpStr, vResult: String;
begin
for I := 1 to 9do
begin
vTmpStr := '';
for J := 1 to Ido
begin

vTmpResult := I * J;
if vTmpStr = '' then
vTmpStr := inttoStr(I) + 'X' + inttoStr(J) + '=' + IntToStr(vTmpResult)
else
vTmpStr := vTmpStr + ', ' + inttoStr(I) + 'X' + inttoStr(J) + '=' + IntToStr(vTmpResult) ;
end;
vResult := vResult + vTmpStr + #10#13;
end;
Memo1.Lines.Clear;
Memo1.Lines.Text := vResult;
end;
2: 获取某个节点的全部节点使用递归就可以了
procedure TForm4.GetSubNode(ANode: TTreeNode);
var
vNode: TTreeNode;
begin
if ANode = nil then
Exit;
vNode := ANode.getFirstChild;
while vNode <> nildo
begin
GetSubNode(vNode);
vNode := vNode.getNextSibling;
end;
end;

这两个问题应该就是这样吧! 不是很难
 
某个节点的全部节点:是在程序中实现在呀,以前我在SQLSERVER 中实现过,太久了,不记得了
 
具体是做什么内容,可以透露吗?
本人程序水平应该算得上高手,更主要是本人办事
效率很高,通俗点就是出活快,通常我写一个大的程序
就不会超过一个月,中型程序不超过10天,小程序就2--3日,
至于简单的窗口,过程,很快就解决。
我的老板就是看中我这点,才没有从外面招聘人,多次
提出帮我找个帮手,后来都没有必要了。
我的另一个特点是工作作风塌实,办事不讲条件,解决问题
速站速决,从不拖拖拉拉。
如果有意,请联系我
电话:83983415
QQ号:31869179
 
你们老板是不是姓梁!
呵呵!
你们公司是不是刚刚成立!
 
公司和程序员当是好聚好散,何苦在分手之后你挤兑我我挖苦你。
其实这种招人的方法蛮新颖的,俺没想着换工作,只是抱着好玩的态度加了上面的qq,做了他们的一些题目。
对这个公司不了解,谈且仅谈一下对题目和考官的体会(个人体会,不代表其他人):题目出的还是不错的,难度适中,没有什么难为人的偏题怪题,从基本理论到实际应用都有所含盖。考官也还行,不是机械的给题目对答案,在结果与标准答案不同时还能跟面试的人探讨探讨,做到这一点的面试官已经算不错了。
ps: 没有发生问俺要代码的事情。
 
这公司我 也去过!
也是要代码!
呵呵!
老板的人......
 
这里真的是非常之地呀,也写了乘法口诀看大家能不能用上。
// 业务处理层(接口)
function GetNum(StrI: Integer): string;
var
I, M: Integer;
X, T, S: string;
begin
result := '';
// 返回值
X := ' X ';
// 格式中X号
T := ' = ';
// 等式
S := ' ';
// 跳格
for I := 1 to StrIdo
begin
M := I * StrI;
if M < 10 then
// 计算结果小于2位,前面加2个空格。
result := result + inttoStr(I) + X + inttoStr(StrI) + T + ' ' + inttoStr(M) + S
else
result := result + inttoStr(I) + X + inttoStr(StrI) + T + inttoStr(M) + S;
end;
end;

// 调用接口
procedure TForm1.Button2Click(Sender: TObject);
var
I: Integer;
begin
Memo1.Lines.Clear;
for I := 1 to 9do
Memo1.Lines.Add(GetNum(I));
end;
 
我们并非因为接了大单而狂招人,
如果有某些人真的在公司呆过,
应该明白我们定位,明白我们的一直努力为的是什么!
谢谢,此帖过后,本人不对非聘人方面的问题作任何回答。
只想告诉大家,我们是真心求才!谢谢各位FW的捧场!
 
to LeeChange
谢谢这件事还是我错了,我不该这么冲动。。。
 
发外包给我如何?
 
//------------------------------------------------------------------//
// //
// 单元名: SubjectList //
// //
// 作者: guo //
// //
// 版本: V0.1 //
// //
// 日期: 2007-2-6 //
// //
// 用途与描述:会计科目 //
// 0.1只作界面 //
// //
//------------------------------------------------------------------//
{ 修改日期 2007-3-9
完成功能 }
unit SubjectList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ExtCtrls, Buttons, Menus, DB, ImgList, StdCtrls,
ToolWin, ADODB,WinSkinData, ActnList;
type
TEditStatus = (Add,AddChild,Edit,Look);
PNodeData = ^TNodeData;
TNodeData = record
Subject_no: string;
Parent_no: string;
essential: Integer;
Subject_name: string;
Subject_Code: string;
//Subject_Type: Integer;
Money_Type: Integer;
Balance_flag: Boolean;
Branch_flag: Boolean;
Employee_flag: Boolean;
Deal_flag: Boolean;
item_flag: Boolean;
Number_flag: Boolean;
Number_unit: Integer;
Delete_Flag: Boolean;
end;

TfrmSubjectList = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
tv1: TTreeView;
tv2: TTreeView;
tv3: TTreeView;
tv4: TTreeView;
tv5: TTreeView;
ImageList1: TImageList;
ToolBar: TToolBar;
tbtNew: TToolButton;
tbtModify: TToolButton;
tbtDelete: TToolButton;
tbtDivider1: TToolButton;
tbtPrior: TToolButton;
tbtFind: TToolButton;
tbtDivider3: TToolButton;
tbtExit: TToolButton;
ToolButton5: TToolButton;
ToolButton7: TToolButton;
StatusBar2: TStatusBar;
Panel1: TPanel;
Label1: TLabel;
edtNo: TEdit;
edtChildNo: TEdit;
Label2: TLabel;
edtSubjectCode: TEdit;
Label4: TLabel;
edtSubjectName: TEdit;
Label5: TLabel;
GroupBox1: TGroupBox;
chkBalance0: TRadioButton;
chkBalance1: TRadioButton;
GroupBox2: TGroupBox;
chkBranch: TCheckBox;
chkEmployee: TCheckBox;
chkDeal: TCheckBox;
chkItem: TCheckBox;
chkNumber: TCheckBox;
cbNumberUnit: TComboBox;
cbMoneyType: TComboBox;
Label7: TLabel;
Button1: TButton;
Button2: TButton;
ToolButton1: TToolButton;
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure tv1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure tbtNewClick(Sender: TObject);
procedure tbtModifyClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure tv1Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
procedure tv2Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
procedure tv3Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
procedure tv4Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
procedure tv5Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
procedure ToolButton1Click(Sender: TObject);
procedure tbtExitClick(Sender: TObject);
procedure tbtPriorClick(Sender: TObject);
procedure tv1KeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
procedure PageControl1Change(Sender: TObject);
private
FEditStatus: TEditStatus;
FNode:TTreeNode;
procedure LoadCombo;
//初始化窗体COMBO组件
procedure LoadTV;
//初始化窗体TREEVIEW组件
procedure LoadEdit;
//初始化EDIT与check组件
function FindNode(aSubject_no:string;aTV : TTreeView):TTreeNode;
//查找NODE
function GetSelected: TTreeNode;
function GetTV: TTreeView;
procedure SetEditStatus(const Value: TEditStatus);
public
property EditStatus:TEditStatus read FEditStatus write SetEditStatus;
function GetMax(aEssential,aLen: integer;aParentNo: string = ''): string;
end;

var
frmSubjectList: TfrmSubjectList;
implementation
uses dataModule,Global,Main;
{$R *.dfm}

function TfrmSubjectList.FindNode(aSubject_no: string;
aTV: TTreeView): TTreeNode;
var
i:Integer;
begin
Result := nil;
for i:= 0 to aTV.Items.Count -1do
if PNodeData(aTV.Items.Item.Data)^.Subject_no = aSubject_no then
begin
Result := aTV.Items.Item;
Exit;
end;
end;

procedure TfrmSubjectList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action := caFree;
end;

procedure TfrmSubjectList.FormDestroy(Sender: TObject);
begin
frmSubjectList := nil;
end;

procedure TfrmSubjectList.LoadCombo;
var
Query : TadoQuery;
i:Integer;
begin
try
//cbSubjectType.Clear;
cbNumberUnit.Clear;
cbMoneyType.Clear;
//cbSubjectType.Items.Add('');
cbNumberUnit.Items.Add('');
cbMoneyType.Items.Add('');

Query := TadoQuery.Create(nil);
Query.Connection := Main.frmMain.Conn;
Query.Close;
Query.SQL.Text := 'select * from CW_Accountant_code where Nindex=3';
Query.Open;
{for i:= 0 to Query.RecordCount -1do
begin
cbSubjectType.Items.Add(Query.fieldbyname('sm1').Value);
cbSubjectType.ItemIndex := 0;
Query.Next;
end;
}
//科目类型列表
Query.Close;
Query.SQL.Text := 'select * from CW_Accountant_code where Nindex=2';
Query.Open;
for i:= 0 to Query.RecordCount -1do
begin
cbMoneyType.Items.Add(Query.fieldbyname('sm1').Value);
cbMoneyType.ItemIndex := 0;
Query.Next;
end;
//货币种类列表
Query.Close;
Query.SQL.Text := 'select * from CW_Accountant_code where Nindex=4';
Query.Open;
for i:= 0 to Query.RecordCount -1do
begin
cbNumberUnit.Items.Add(Query.fieldbyname('sm1').Value);
cbNumberUnit.ItemIndex := 0;
Query.Next;
end;
//数量单位列表
finally
Query.Free;
end;
end;

procedure TfrmSubjectList.LoadTV;
var
Query : TadoQuery;
i : Integer;
P : PNodeData;
Node:TTreeNode;
begin
try
tv1.Items.Clear;
tv2.Items.Clear;
tv3.Items.Clear;
tv4.Items.Clear;
tv5.Items.Clear;
Query := TadoQuery.Create(nil);
Query.Connection := Main.frmMain.Conn;
Query.Close;
Query.SQL.Text := 'select * from CW_Accountant_Subject';
Query.Open;
for i := 0 to Query.RecordCount -1do
begin
New(p);
p^.Subject_no := Query.FieldByName('Subject_no').Value;
p^.Parent_no := Query.FieldByName('Parent_no').Value;
p^.essential := Query.FieldByName('essential').Value;
p^.Subject_name := Query.FieldByName('Subject_name').Value;
p^.Subject_Code := Query.FieldByName('Subject_Code').Value;
//p^.Subject_Type := Query.FieldByName('Subject_Type').Value;
p^.Money_Type := Query.FieldByName('Money_Type').Value;
p^.Balance_flag := Query.FieldByName('Balance_flag').Value;
p^.Branch_flag := Query.FieldByName('Branch_flag').Value;
p^.Employee_flag := Query.FieldByName('Employee_flag').Value;
p^.Deal_flag := Query.FieldByName('Deal_flag').Value;
p^.item_flag := Query.FieldByName('item_flag').Value;
p^.Number_flag := Query.FieldByName('Number_flag').Value;
p^.Number_unit := Query.FieldByName('Number_unit').Value;
p^.Delete_Flag := Query.FieldByName('Delete_Flag').Value;

case p^.essential of
0 : //资产类
begin
Node := tv1.Items.AddChildObject(FindNode(p^.Parent_no,tv1),
p^.Subject_no + ' ' + P^.Subject_name,p);
Node.StateIndex := 0;
Node.ImageIndex := 0;
Node.EndEdit(False);

end;
1 : //负债类
begin
Node := tv2.Items.AddChildObject(FindNode(p^.Parent_no,tv2),
p^.Subject_no + ' ' + P^.Subject_name,p);
Node.StateIndex := 0;
Node.ImageIndex := 0;
Node.EndEdit(False);
end;
2 : //权益类
begin
Node := tv3.Items.AddChildObject(FindNode(p^.Parent_no,tv3),
p^.Subject_no + ' ' + P^.Subject_name,p);
Node.StateIndex := 0;
Node.ImageIndex := 0;
Node.EndEdit(False);
end;
3 : //成本类
begin
Node := tv4.Items.AddChildObject(FindNode(p^.Parent_no,tv4),
p^.Subject_no + ' ' + P^.Subject_name,p);
Node.StateIndex := 0;
Node.ImageIndex := 0;
Node.EndEdit(False);
end;
4 : //损益类
begin
Node := tv5.Items.AddChildObject(FindNode(p^.Parent_no,tv5),
p^.Subject_no + ' ' + P^.Subject_name,p);
Node.StateIndex := 0;
Node.ImageIndex := 0;
Node.EndEdit(False);
end;
end;
Query.Next;
end;

finally
Query.Free;
end;
end;

procedure TfrmSubjectList.FormCreate(Sender: TObject);
begin
LoadCombo;
LoadTV;
EditStatus :=Look;
end;
//TV单击事件
procedure TfrmSubjectList.tv1Click(Sender: TObject);
var
i: Integer;
P: PNodeData;
Node: TTreeNode;
Subject_no: string;
begin
LoadEdit;
Node := GetSelected;
if Node = nil then
Exit;
case Node.Level of
0 :
begin
Label7.Visible := False;
edtChildNo.Visible := False;
edtNo.Text := PNodeData(Node.Data)^.Subject_no;
end;
else
begin
Label7.Visible := True;
edtChildNo.Visible := True;
edtNo.Enabled := False;
edtNo.Text := PNodeData(Node.Data)^.Parent_no;
edtChildNo.Text := Copy(PNodeData(Node.Data)^.Subject_no,Length(PNodeData(Node.Data)^.Parent_no) + 1,Length(PNodeData(Node.Data)^.Subject_no));
end;
end;
edtSubjectName.Text := PNodeData(Node.Data)^.Subject_Name;
edtSubjectCode.Text := PNodeData(Node.Data)^.Subject_Code;
//cbSubjectType.Text := Main.frmMain.GetData(PNodeData(Node.Data)^.Subject_Type,1);
cbMoneyType.Text := Main.frmMain.GetData(PNodeData(Node.Data)^.Money_Type,1);
if PNodeData(Node.Data)^.Balance_flag then
chkBalance0.Checked := True
else
chkBalance1.Checked := True;
chkBranch.Checked := PNodeData(Node.Data)^.Branch_flag;
chkEmployee.Checked := PNodeData(Node.Data)^.Employee_flag;
chkDeal.Checked := PNodeData(Node.Data)^.Deal_flag;
chkItem.Checked := PNodeData(Node.Data)^.item_flag;
chkNumber.Checked := PNodeData(Node.Data)^.Number_flag;
cbNumberUnit.Text :=frmMain.GetData(PNodeData(Node.Data)^.Number_unit,1);

end;

procedure TfrmSubjectList.SetEditStatus(const Value: TEditStatus);
procedure SetEnabled(b:Boolean);
var
i:Integer;
begin
for i := 0 to Panel1.ControlCount -1do
begin
Panel1.Controls.Enabled := b;
end;
end;

procedure setToolBar(B:Boolean);
var
i:Integer;
begin
for i := 0 to ToolBar.ControlCount -1do
TToolButton(ToolBar.Controls).Enabled := b;
end;
var
p: PNodeData;
begin
FEditStatus := Value;
case FEditStatus of
Add :
begin
LoadEdit;
SetEnabled(True);
SetToolBar(False);
New(p);
p^.essential := PageControl1.ActivePageIndex;

Label7.Visible := False;
edtChildNo.Visible := False;
p^.Parent_no := '0';
p^.Delete_Flag :=False;
FNode := gettv.Items.AddObject(Nil,'新建一级科目',p);
PageControl1.Enabled := False;
edtNo.Text := GetMax(PageControl1.ActivePageIndex,lvl1);
edtSubjectName.Text := '新建一级科目';
FNode.Selected := True;
end;

AddChild :
begin
if GetSelected = nil then
begin
ShowMessage('你要添加子科目前必须先选择父科目!');
Exit;
end;
LoadEdit;
SetEnabled(True);
SetToolBar(False);
New(p);
p^.essential := PageControl1.ActivePageIndex;
GroupBox1.Enabled := False;
chkBalance0.Checked :=PNodeData(GetSelected.Data)^.Balance_flag;
chkBalance1.Checked := not PNodeData(GetSelected.Data)^.Balance_flag;
Label7.Visible := True;
edtChildNo.Visible := True;
p^.Parent_no := PNodeData(GetSelected.Data)^.Subject_no;
p^.Delete_Flag :=False;
FNode := gettv.Items.AddChildObject(GetSelected,'新建科目',p);
FNode.Selected := True;
FNode.Expand(True);
PageControl1.Enabled := False;
edtNo.Text := PNodeData(GetSelected.Data)^.Parent_no;//更改LVL2为动态获取LVL的函数可以动态设置下级科目的代码长度
edtNo.Enabled := false;
edtChildNo.Text := GetMax(PageControl1.ActivePageIndex,lvl2,PNodeData(GetSelected.Data)^.Parent_no);//更改LVL2为动态获取LVL的函数可以动态设置下级科目的代码长度
edtSubjectName.Text := '新建科目';
FNode.Selected := True;
end;

Edit :
begin
SetEnabled(True);
SetToolBar(False);
edtNo.Enabled := not edtChildNo.Visible;
if FNode.Parent <> nil then
GroupBox1.Enabled :=False;
if GetSelected.getFirstChild <> nil then
begin
edtChildNo.Enabled := False;
edtNo.Enabled := False;
GroupBox1.Enabled :=False;
end;

PageControl1.Enabled := False;
end;
Look :
begin
LoadEdit;
SetEnabled(False);
SetToolBar(True);
PageControl1.Enabled := True;
end;
end;

end;

function TfrmSubjectList.GetSelected: TTreeNode;
begin
Result := nil;
case PageControl1.ActivePageIndex of
0: Result := tv1.Selected;
1: Result := tv2.Selected;
2: Result := tv3.Selected;
3: Result := tv4.Selected;
4: Result := tv5.Selected;
end;

end;

function TfrmSubjectList.GetTV: TTreeView;
begin
case PageControl1.ActivePageIndex of
0: Result := tv1;
1: Result := tv2;
2: Result := tv3;
3: Result := tv4;
4: Result := tv5;
end;
end;

//保存科目
procedure TfrmSubjectList.Button1Click(Sender: TObject);
function isSubject_No(aSubject_No:string):Boolean;
var
Query: TADOQuery;
begin
try
Result := true;
Query := TADOQuery.Create(nil);
Query.Connection := frmMain.Conn;
Query.SQL.Text := 'select * from CW_Accountant_Subject where Subject_No =' +
'''' + aSubject_No + '''';
Query.Open;
if Query.Bof then
Result := False;

finally
Query.Free;
end;
end;

function CheckIn: string;
begin
Result := '';
if edtNo.Text ='' then
begin
Result := '科目编号不能为空!';
edtNo.SetFocus;
Exit;
end else
begin
if edtChildNo.Visible then
begin
if isSubject_No(Trim(edtNo.Text) + Trim(edtChildNo.Text))then
begin
Result := '科目编号为 ' + Trim(edtNo.Text) + Trim(edtChildNo.Text) + ' 的编号已经存在,请另外输入其它编号!';
edtChildNo.SetFocus;
Exit;
end;
end
else
begin
if isSubject_No(Trim(edtNo.Text)) then
begin
Result := '科目编号为 ' + Trim(edtNo.Text) + ' 的编号已经存在,请另外输入其它编号!';
edtNo.SetFocus;
Exit;
end;
end;

end;

if edtChildNo.Visible and (edtChildNo.Text ='') then
begin
Result := '科目编号不完整!';
edtChildNo.SetFocus;
Exit;
end;

if edtSubjectName.Text ='' then
begin
Result := '科目名称不能为空!';
edtSubjectName.SetFocus;
Exit;
end;

{ if cbSubjectType.Text ='' then
begin
Result := '科目类型不能为空!';
cbSubjectType.SetFocus;
Exit;
end;
}
if cbMoneyType.Text ='' then
begin
Result := '货币种类不能为空!';
cbMoneyType.SetFocus;
Exit;
end;

if chkNumber.Checked and (cbNumberUnit.Text = '') then
begin
Result := '数量单位不能为空!';
cbNumberUnit.SetFocus;
Exit;
end;

end;

var
Query: TADOQuery;
ErrStr:string;
Subject_no:string;
begin

ErrStr := CheckIn ;
if ErrStr <>'' then
begin
ShowMessage(ErrStr);
Exit;
end;

try
Query := TADOQuery.Create(nil);
Query.Connection := frmMain.Conn;
if FNode <> nil then
Subject_no := PNodeData(FNode.data)^.Subject_no
else
Subject_no :='';
if edtChildNo.Visible then
PNodeData(FNode.data)^.Subject_no := Trim(edtNo.Text) + Trim(edtChildNo.Text)
else
PNodeData(FNode.data)^.Subject_no := Trim(edtNo.Text);
PNodeData(FNode.data)^.Subject_name := Trim(edtSubjectName.Text);
PNodeData(FNode.data)^.Subject_Code := Trim(edtSubjectCode.Text);
PNodeData(FNode.data)^.Money_Type := frmMain.GetValue(Trim(cbMoneyType.Text),2,1);
PNodeData(FNode.data)^.Balance_flag := chkBalance0.Checked;
PNodeData(FNode.data).Branch_flag := chkBranch.Checked;
PNodeData(FNode.data)^.Employee_flag := chkEmployee.Checked;
PNodeData(FNode.data)^.Deal_flag := chkDeal.Checked;
PNodeData(FNode.data)^.item_flag := chkItem.Checked;
PNodeData(FNode.data)^.Number_flag := chkNumber.Checked;
if chkItem.Checked then
PNodeData(FNode.data)^.Number_unit := frmMain.GetValue(Trim(cbNumberUnit.Text),4,1)
else
PNodeData(FNode.data)^.Number_unit := 0;
PNodeData(FNode.data)^.Delete_Flag := True;
FNode.Text := PNodeData(FNode.data)^.Subject_no + ' ' + PNodeData(FNode.data)^.Subject_name;
Query.SQL.Text := 'INSERT INTO CW_Accountant_Subject(' +
'Subject_No, Parent_No, Essential, Subject_Name, Subject_Code, '+
'Money_Type, Balance_Flag, Branch_Flag, Employee_Flag, Deal_Flag, Item_Flag,'+
'Number_Flag,Number_unit, Delete_Flag) ' +
'VALUES(:Subject_No, :Parent_No, :Essential, :Subject_Name, :Subject_Code, '+
':Money_Type, :Balance_Flag, :Branch_Flag, :Employee_Flag, :Deal_Flag, :Item_Flag,'+
':Number_Flag,:Number_unit, :Delete_Flag)';


case EditStatus of
Add:
begin

end;
AddChild:
begin


end;
Edit:
begin
if Subject_no ='' then
begin
ShowMessage('数据错误,无法更改!');
EditStatus := Look;
Query.Free;
PageControl1.Enabled := True;
end;
Query.SQL.Text := 'UPDATE CW_Accountant_Subject ' +
'SET Subject_no = :Subject_no, Parent_no = :Parent_no, '+
'essential = :essential, Subject_name = :Subject_name, '+
'Subject_Code = :Subject_Code,Balance_flag = :Balance_flag,'+
'Money_Type = :Money_Type, Branch_flag = :Branch_flag,' +
'Employee_flag = :Employee_flag,Deal_flag = :Deal_flag,'+
'item_flag = :item_flag, Number_flag = :Number_flag,' +
'Number_unit = :Number_unit,Delete_Flag = :Delete_Flag ' +
'WHERE (Subject_no =' + '''' + Subject_no + '''' + ')';
end;

end;

Query.Parameters.ParamByName('Subject_No').Value := PNodeData(FNode.data)^.Subject_no;
Query.Parameters.ParamByName('Parent_No').Value :=PNodeData(FNode.data)^.Parent_no;
Query.Parameters.ParamByName('Essential').Value :=PNodeData(FNode.data)^.Essential;
Query.Parameters.ParamByName('Subject_name').Value :=PNodeData(FNode.data)^.Subject_name;
Query.Parameters.ParamByName('Subject_Code').Value := PNodeData(FNode.data)^.Subject_Code;
Query.Parameters.ParamByName('Money_Type').Value := PNodeData(FNode.data)^.Money_Type;
Query.Parameters.ParamByName('Balance_flag').Value := PNodeData(FNode.data)^.Balance_flag;
Query.Parameters.ParamByName('Branch_flag').Value := PNodeData(FNode.data)^.Branch_flag;
Query.Parameters.ParamByName('Employee_flag').Value := PNodeData(FNode.data)^.Employee_flag;
Query.Parameters.ParamByName('Deal_flag').Value := PNodeData(FNode.data)^.Deal_flag;
Query.Parameters.ParamByName('item_flag').Value := PNodeData(FNode.data)^.item_flag;
Query.Parameters.ParamByName('Number_flag').Value := PNodeData(FNode.data)^.Number_flag;
Query.Parameters.ParamByName('Number_unit').Value := PNodeData(FNode.data)^.Number_unit;
Query.Parameters.ParamByName('Delete_Flag').Value := PNodeData(FNode.data)^.Delete_Flag;
try
if Query.ExecSQL = 0 then
if EditStatus = edit then
LoadTV
else
begin
FNode.Free;
FNode :=nil;
end;

except
if EditStatus = edit then
LoadTV
else
begin
FNode.Free;
FNode :=nil;
end;
end;

EditStatus := Look;

finally
Query.Free;
PageControl1.Enabled := True;
frmSubjectList.tv1Click(nil);
GetTV.SetFocus;
end;
end;

procedure TfrmSubjectList.tbtNewClick(Sender: TObject);
begin
EditStatus := Add;
end;

// 获取下一个科目编号
function TfrmSubjectList.GetMax(aEssential,aLen: integer;aParentNo: string = ''): string;
var
Query:TADOQuery;
Tmpstr:string;
i: Integer;
begin
try
Query := TADOQuery.Create(nil);
Query.Connection := frmMain.Conn;
Tmpstr := '';
for i := 0 to aLen -1do
Tmpstr := Tmpstr + '_';
if aParentNo = '' then
begin
Query.SQL.Text := 'select Max(Subject_No) + 1 as Max from CW_Accountant_Subject where Essential =' +
IntToStr(aEssential);
Query.Open;
if Query.FieldByName('max').IsNull then
begin
Result := IntToStr(aEssential + 1) + '001';
end
else
Result :=inttostr(strtoint(Copy(Query.FieldByName('max').value,1,aLen)));
end
else
begin
Query.SQL.Text := 'select Max(Subject_No) + 1 as Max from CW_Accountant_Subject where Essential =' +
IntToStr(aEssential) + ' And Subject_No like ' +'''' + aParentNo + Tmpstr + '''';
Query.Open;
if Query.FieldByName('max').IsNull then
begin
Tmpstr := '';
for i := 0 to aLen -2do
Tmpstr := Tmpstr + '0';
Result := Tmpstr + '1';
end else
Result := Copy(inttostr(Query.FieldByName('max').value) ,Length(Query.FieldByName('max').value)-alen + 1,Length(Query.FieldByName('max').value));
end;

finally
Query.Free;
end;
end;

procedure TfrmSubjectList.tbtModifyClick(Sender: TObject);
begin

EditStatus :=AddChild;
end;

procedure TfrmSubjectList.Button2Click(Sender: TObject);
begin
if EditStatus <> Edit then
begin
FNode.Free;
FNode := nil;
end;
EditStatus := look;
frmSubjectList.tv1Click(nil);
GetTV.SetFocus;
end;

procedure TfrmSubjectList.LoadEdit;
var
i:integer;
begin
for i := 0 to Panel1.ControlCount -1do
begin
if Panel1.Controls.ClassName = 'TEdit' then
TEdit(Panel1.Controls).Text :='';
if Panel1.Controls.ClassName = 'TCheckBox' then
TCheckBox(Panel1.Controls).Checked := False;
if Panel1.Controls.ClassName = 'TComboBox' then
TComboBox(Panel1.Controls).ItemIndex := 0;
end;
end;

procedure TfrmSubjectList.tv1Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;

procedure TfrmSubjectList.tv2Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;

procedure TfrmSubjectList.tv3Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;

procedure TfrmSubjectList.tv4Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;

procedure TfrmSubjectList.tv5Editing(Sender: TObject;
Node: TTreeNode;
var AllowEdit: Boolean);
begin
AllowEdit := False;
end;

procedure TfrmSubjectList.ToolButton1Click(Sender: TObject);
begin
FNode := GetSelected;
if FNode = nil then
begin
ShowMessage('请选择要修改的科目!');
Exit;
end;
EditStatus := Edit;
frmSubjectList.tv1Click(nil);
end;

procedure TfrmSubjectList.tbtExitClick(Sender: TObject);
var
Query: TADOQuery;
begin
FNode := GetSelected;
if FNode = nil then
begin
ShowMessage('请选择要删除的科目后再进行删除操作!');
Exit;
end;
if not PNodeData(FNode.Data)^.Delete_Flag then
begin
ShowMessage('该科目是系统内置科目,不允许删除!');
Exit;
end;

if FNode.getFirstChild <> nil then
begin
ShowMessage('该科目下面有子科目,不能进行删除操作!');
Exit;
end;

if MessageBox(Self.Handle,PChar('是否删除科目编号为 ' + PNodeData(FNode.Data)^.Subject_no + ' 的科目?'),PChar('删除科目:'), MB_YESNO) = mrNo then
Exit;

try
Query := TADOQuery.Create(nil);
Query.Connection := frmMain.Conn;
Query.SQL.Text := 'Delete from CW_Accountant_Subject where Subject_no =' +
'''' + PNodeData(FNode.Data)^.Subject_no + '''';
if Query.ExecSQL = 0 then
begin
ShowMessage('删除失败!');
Exit;
end;
FNode.Free;
EditStatus := Look;
MessageBox(Self.Handle,PChar('删除成功!'),PChar('删除科目:'), MB_OK);
frmSubjectList.tv1Click(nil);
finally
Query.Free;
end;

end;

procedure TfrmSubjectList.tbtPriorClick(Sender: TObject);
begin

// if FNode <> nil then
// begin

FNode := nil;
//end;
frmSubjectList.FormCreate(nil);
EditStatus := Look;
frmSubjectList.tv1Click(nil);
end;

procedure TfrmSubjectList.tv1KeyUp(Sender: TObject;
var Key: Word;
Shift: TShiftState);
begin

if not ((Key = 40) or (Key = 39) or (Key = 38) or (Key = 37)) then
Exit;
frmSubjectList.tv1Click(nil);
end;

procedure TfrmSubjectList.PageControl1Change(Sender: TObject);
begin
frmSubjectList.tv1Click(nil);
end;

end.

树的操作..
乘法表 应该是嵌套2个1-9的for循环...
6年写不出这样的东西确实有点那个了..
 
后退
顶部