源码公开,与大伙的有什么区别(1分)

  • 主题发起人 主题发起人 土土
  • 开始时间 开始时间

土土

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TFormBKGL_JHD_Main.FillAsg;
var
i : Integer;
jhd : TJHDNode;
begin
jhdAsg.AddRow;
jhdAsg.RemoveRows(1, jhdAsg.RowCount - 2);
if (cur_dm <> nil) then
begin
jhddata.Filter(cur_dm.bml, ComboboxKJQJ.Text, ComboboxDJZT.Text);
for i := 0 to jhddata.disp_list.Count -1 do
begin
jhd := jhddata.disp_list.Items;
FillJHD(jhd);
end;
end;
end;

procedure TFormBKGL_JHD_Main.ToolButton8Click(Sender: TObject);
begin
Close;
end;

procedure TFormBKGL_JHD_Main.InitCombox;
begin
ComboBoxKJQJ.Clear;
//add kjqj_list
with ComboBoxKJQJ.Items do
begin
Add(C_DATE_YEAR);
Add(C_DATE_MONTH_1);
Add(C_DATE_MONTH_2);
Add(C_DATE_MONTH_3);
Add(C_DATE_MONTH_4);
Add(C_DATE_MONTH_5);
Add(C_DATE_MONTH_6);
Add(C_DATE_MONTH_7);
Add(C_DATE_MONTH_8);
Add(C_DATE_MONTH_9);
Add(C_DATE_MONTH_10);
Add(C_DATE_MONTH_11);
Add(C_DATE_MONTH_12);
end;
ComboBoxKJQJ.ItemIndex := 0;
//add zt_list
ComboBoxDJZT.Clear;
with ComboBoxDJZT.Items do
begin
Add(C_ZT_All);
Add(C_ZT_SQ);
Add(C_ZT_SH);
Add(C_ZT_ZF);
end;
ComboBoxDJZT.ItemIndex := 0;
end;

procedure TFormBKGL_JHD_Main.BtnYNJHClick(Sender: TObject);
begin
// AddNewJHD(S_YWLX_BKYW_YN);
end;

function TFormBKGL_JHD_Main.isExistJHData(ARow: Integer): Boolean;
begin
result := ((jhdAsg.Objects[C_Obj_JHDData, ARow] <> nil) and
(jhdAsg.Objects[C_Obj_JHDData, ARow] is TJHDNode));
end;

procedure TFormBKGL_JHD_Main.FillJHD(AJHDNode: TJHDNode);
var
r : Integer;
begin
if (isExistJHData(jhdAsg.RowCount - 1)) then
jhdAsg.AddRow;
r := jhdAsg.RowCount - 1;
with AJHDNode, jhdAsg do
begin
Objects[C_Obj_JHDData, r] := AJHDNode;
Cells[0, r] := InttoStr(kjqj_bh);
Cells[1, r] := ywbh;
Cells[2, r] := ywlx;
if (rq <> nil) then
Cells[3, r] := rq.ToString;
Cells[4, r] := CurrToStrF(sqje, ffNumber, 2);
Cells[5, r] := CurrToStrF(hdje, ffNumber, 2);
Cells[6, r] := GetJHDZT_MC(zt);
Cells[7, r] := bz;
end;
end;

procedure TFormBKGL_JHD_Main.jhdAsgGetCellColor(Sender: TObject;
ARow,
ACol: Integer;
AState: TGridDrawState;
ABrush: TBrush;
AFont: TFont);
var
jhdnode: TJHDNode;
begin
if (ARow >0 ) then
begin
if (isExistJHData(ARow)) then
begin
jhdnode := TJHDNode(jhdAsg.Objects[C_Obj_JHDData, ARow]);
with jhdnode do
begin
if (CheckState(zt, S_JHD_ZF)) then
begin
AFont.Color := clGray;
Exit;
end;
if (not CheckState(zt, S_JHD_HD)) then
{待处理}
ABrush.Color := $00FBF0E6;
end;
end;
end;
end;

procedure TFormBKGL_JHD_Main.flAsgGetAlignment(Sender: TObject;
ARow,
ACol: Integer;
var HAlign: TAlignment;
var VAlign: TVAlignment);
begin
if (ARow = 0) then
HAlign := taCenter
else
if ((ACol = 4) or (ACol = 5)) then
HAlign := taRightJustify;
end;

procedure TFormBKGL_JHD_Main.ComboBoxKJQJChange(Sender: TObject);
begin
FillAsg;
end;

procedure TFormBKGL_JHD_Main.ComboBoxDJZTChange(Sender: TObject);
begin
FillAsg;
end;

procedure TFormBKGL_JHD_Main.treeAfterSelectionChange(Sender: TObject);
begin
GetCurDomain(tree.Selected);
FillAsg;
end;

procedure TFormBKGL_JHD_Main.jhdAsgDblClick(Sender: TObject);
var
zt : TState;
row : Integer;
jhdNode: TJHDNode;
begin
row := jhdAsg.Row;
if (jhdAsg.Objects[C_Obj_JHDData, row] <> nil) then
begin
jhdNode := TJHDNode(jhdAsg.Objects[C_Obj_JHDData, row]);
zt := jhdNode.zt;
FormBKGL_JHD := TFormBKGL_JHD.Create(nil);
try
FormBKGL_JHD.dm := cur_dm;
FormBKGL_JHD.ywlx := jhdNode.ywlx;
FormBKGL_JHD.kjqj := jhdNode.kjqj_bh;
FormBKGL_JHD.jhdnode := jhdNode;
FormBKGL_JHD.ShowModal;
// if (not CheckState(zt, jhdnode.zt)) then
FillASG;
finally
FormBKGL_JHD.Free;
FormBKGL_JHD := nil;
end;
end;
end;

procedure TFormBKGL_JHD_Main.BtnYWJHClick(Sender: TObject);
begin
AddNewJHD(S_YWLX_BKYW_YW);
end;

procedure TFormBKGL_JHD_Main.BtnQTJHClick(Sender: TObject);
begin
AddNewJHD(S_YWLX_BKYW_QT);
end;

procedure TFormBKGL_JHD_Main.treeDblClick(Sender: TObject);
var
km : TKM;
xmys : TXMYS;
ynw : String;
begin
if (tree.Selected <> nil) then
begin
km := TKM(tree.Selected.Data);
if (km.flys <> nil) then
begin
xmys := km.flys.GetXMYS(C_XMFL_YSNW);
if (xmys <> nil) then
begin
ynw := xmys.bml;
if (ynw = C_XM_YN) then
BtnYNJH.Click
else
if (ynw = C_XM_YW) then
BtnYWJH.Click
else
if (ynw = C_XM_ZC) then
BtnQTJH.Click;
end;
end;
end;
end;

procedure TFormBKGL_JHD_Main.jhdAsgGetAlignment(Sender: TObject;
ARow,
ACol: Integer;
var HAlign: TAlignment;
var VAlign: TVAlignment);
begin
if (ARow = 0) then
HAlign := taCenter
else
if ((ACol = 4) or (ACol = 5)) then
HAlign := taRightJustify;
end;

procedure TFormBKGL_JHD_Main.ComboBoxKJQJKeyPress(Sender: TObject;
var Key: Char);
begin
Key := #0;
end;

procedure TFormBKGL_JHD_Main.FormShow(Sender: TObject);
begin
InitCombox;
if (gEnv.bkgldm_tree <> nil) then
eng_show_tree.ShowDMKMTree(gEnv.bkgldm_tree, tree);
jhddata.Refresh;
end;

procedure TFormBKGL_JHD_Main.GetCurDomain(AElTreeItem: TEltreeItem);
var
bml: string;
xmys : TXMYS;
km : TKM;
begin
cur_dm := nil;
if (AElTreeItem <> nil) then
begin
km := AElTreeItem.Data;
if (km <> nil) then
begin
xmys := km.flys.GetXMYS(C_XMFL_DW);
if (xmys <> nil) then
begin
bml := Copy(xmys.bml, 1, 4);
cur_dm := gEnv.bkgldm_tree.GetDM(bml);
end;
xmys.Free;
end;
end
end;

function TFormBKGL_JHD_Main.GetJHDZT_MC(AState: TState): string;
begin
if CheckState(AState, S_JHD_ZF) then
result := '作废'
else
if CheckState(AState, S_JHD_BK) then
result := '已拨'
else
if CheckState(AState, S_JHD_HD) then
result := '审核'
else
if CheckState(AState, S_JHD_ZZ) then
result := '制单'
else
result := '空白';
end;

function TFormBKGL_JHD_Main.AddNewJHD(AYWLX: string): boolean;
var
jhdnode : TJHDNode;
begin
result := false;
if (cur_dm = nil) then
begin
ShowMessage('请先选择科目!');
Exit;
end;
if (ComboboxKJQJ.ItemIndex <=0 ) then
begin
ShowMessage('请选择会计期间!');
Exit;
end;

FormBKGL_JHD := TFormBKGL_JHD.Create(nil);
try
FormBKGL_JHD.dm := cur_dm;
FormBKGL_JHD.ywlx := AYWLX;
FormBKGL_JHD.kjqj := ComboboxKJQJ.ItemIndex;
FormBKGL_JHD.ShowModal;
if (FormBKGL_JHD.jhdnode <> nil) then
begin
jhdnode := FormBKGL_JHD.jhdnode;
jhddata.AddNode(jhdnode);
FillJHD(jhdnode);
result := true;
end;
finally
FormBKGL_JHD.Free;
FormBKGL_JHD := nil;
end;
end;

end.
 
大佬:那是用来干什么的?
 
我只是想知道,真正用面向对象开发的代码怎样
 
解释一下
 
真正面向对象,也就是说界面与实现代码完全分离,
这首先是很难做到的,
其次,也不一定这样就好的不得了,
不过你上面的代码作为一个大公司的项目的话,
首先不太面向对象的是,资源串都还没有和界面代码分开,
如果你的系统要换一种语言,难道打开每一个窗体去翻译吗??
 
放代码不能看出问题。还请说说你的思路吧!
 
后退
顶部