rmHaBaiCustomizedDm.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522
  1. unit rmHaBaiCustomizedDm;
  2. // 内蒙古 哈白项目/国道306定制汇总表 严禁任何其他项目或标表调用该单元
  3. // 包括支表2/3/14/3-1/4-1
  4. interface
  5. uses
  6. SysUtils, Classes, DB, rmSelectProjectFrm, ProjectData, mDataRecord,
  7. BillsTree, DBClient;
  8. type
  9. TDoubleArray = array of Double;
  10. TStringArray = array of string;
  11. TGclNode = class
  12. private
  13. FProjectCount: Integer;
  14. FB_Code: string;
  15. FIndexCode: string;
  16. FName: string;
  17. FUnits: string;
  18. FPrice: Double;
  19. FCalcType: Integer;
  20. FQuantity: Double;
  21. FTotalPrice: Double;
  22. FCurGatherQuantity: Double;
  23. FCurGatherTotalPrice: Double;
  24. FEndGatherQuantity: Double;
  25. FEndGatherTotalPrice: Double;
  26. FPreGatherQuantity: Double;
  27. FPreGatherTotalPrice: Double;
  28. FP_Quantity: TDoubleArray;
  29. FP_TotalPrice: TDoubleArray;
  30. FP_CurGatherQuantity: TDoubleArray;
  31. FP_CurGatherTotalPrice: TDoubleArray;
  32. FP_EndGatherQuantity: TDoubleArray;
  33. FP_EndGatherTotalPrice: TDoubleArray;
  34. procedure SetB_Code(const Value: string);
  35. function GetCurPercent: Double;
  36. function GetEndPercent: Double;
  37. public
  38. constructor Create(AProjectCount: Integer);
  39. procedure Calculate;
  40. property B_Code: string read FB_Code write SetB_Code;
  41. property IndexCode: string read FIndexCode;
  42. property Name: string read FName write FName;
  43. property Units: string read FUnits write FUnits;
  44. property Price: Double read FPrice write FPrice;
  45. property CalcType: Integer read FCalcType write FCalcType;
  46. property Quantity: Double read FQuantity write FQuantity;
  47. property TotalPrice: Double read FTotalPrice write FTotalPrice;
  48. property CurGatherQuantity: Double read FCurGatherQuantity write FCurGatherQuantity;
  49. property CurGatherTotalPrice: Double read FCurGatherTotalPrice write FCurGatherTotalPrice;
  50. property EndGatherQuantity: Double read FEndGatherQuantity write FEndGatherQuantity;
  51. property EndGatherTotalPrice: Double read FEndGatherTotalPrice write FEndGatherTotalPrice;
  52. property PreGatherQuantity: Double read FPreGatherQuantity write FPreGatherQuantity;
  53. property PreGatherTotalPrice: Double read FPreGatherTotalPrice write FPreGatherTotalPrice;
  54. property P_Quantity: TDoubleArray read FP_Quantity write FP_Quantity;
  55. property P_TotalPrice: TDoubleArray read FP_TotalPrice write FP_TotalPrice;
  56. property P_CurGatherQuantity: TDoubleArray read FP_CurGatherQuantity write FP_CurGatherQuantity;
  57. property P_CurGatherTotalPrice: TDoubleArray read FP_CurGatherTotalPrice write FP_CurGatherTotalPrice;
  58. property P_EndGatherQuantity: TDoubleArray read FP_EndGatherQuantity write FP_EndGatherQuantity;
  59. property P_EndGatherTotalPrice: TDoubleArray read FP_EndGatherTotalPrice write FP_EndGatherTotalPrice;
  60. property CurPercent: Double read GetCurPercent;
  61. property EndPercent: Double read GetEndPercent;
  62. end;
  63. TGclChapter = class
  64. private
  65. FProjectCount: Integer;
  66. FGclNodes: TList;
  67. FChapterID: Integer;
  68. FChapterBegin: Integer;
  69. FChapterEnd: Integer;
  70. FChapterName: string;
  71. FName: string;
  72. FTotalPrice: Double;
  73. FCurGatherTotalPrice: Double;
  74. FEndGatherTotalPrice: Double;
  75. FPreGatherTotalPrice: Double;
  76. FP_TotalPrice: TDoubleArray;
  77. FP_CurGatherTotalPrice: TDoubleArray;
  78. FP_EndGatherTotalPrice: TDoubleArray;
  79. function GetGclNode(AIndex: Integer): TGclNode;
  80. function GetGclNodeCount: Integer;
  81. function GetCurPercent: Double;
  82. function GetEndPercent: Double;
  83. public
  84. constructor Create(AChapterID: Integer; const AName: string; AProjectCount: Integer);
  85. destructor Destroy; override;
  86. procedure AddGclNode(AGclNode: TGclNode);
  87. procedure CalculateChapter;
  88. property ChapterID: Integer read FChapterID;
  89. property ChapterBegin: Integer read FChapterBegin;
  90. property ChapterEnd: Integer read FChapterEnd;
  91. property ChapterName: string read FChapterName;
  92. property Name: string read FName;
  93. property TotalPrice: Double read FTotalPrice write FTotalPrice;
  94. property CurGatherTotalPrice: Double read FCurGatherTotalPrice write FCurGatherTotalPrice;
  95. property EndGatherTotalPrice: Double read FEndGatherTotalPrice write FEndGatherTotalPrice;
  96. property PreGatherTotalPrice: Double read FPreGatherTotalPrice write FPreGatherTotalPrice;
  97. property P_TotalPrice: TDoubleArray read FP_TotalPrice write FP_TotalPrice;
  98. property P_CurGatherTotalPrice: TDoubleArray read FP_CurGatherTotalPrice write FP_CurGatherTotalPrice;
  99. property P_EndGatherTotalPrice: TDoubleArray read FP_EndGatherTotalPrice write FP_EndGatherTotalPrice;
  100. property CurPercent: Double read GetCurPercent;
  101. property EndPercent: Double read GetEndPercent;
  102. property GclNodeCount: Integer read GetGclNodeCount;
  103. property GclNode[AIndex: Integer]: TGclNode read GetGclNode;
  104. end;
  105. TGclControl = class
  106. private
  107. FProjectCount: Integer;
  108. FProjectName: TStringArray;
  109. FGclNodes: TList;
  110. FGclChapters: TList;
  111. FGclChapterGather: TGclChapter;
  112. FOtherGcl: TGclChapter;
  113. function FindGclNode(ARec: TBillsRecord): TGclNode;
  114. function NewGclNode(ARec: TBillsRecord): TGclNode;
  115. function B_CodeToChapter(const AB_Code: string): Integer;
  116. procedure LinkGclChapter(AGclNode: TGclNode);
  117. function FindGclChapter(AChapterID: Integer): TGclChapter;
  118. procedure CalculateChapterGather;
  119. function GetGclChapterCount: Integer;
  120. function GetGclChapter(AIndex: Integer): TGclChapter;
  121. public
  122. constructor Create(AProjectCount: Integer; AIsHaBai: Boolean);
  123. destructor Destroy;
  124. function AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode;
  125. procedure ReCalculateTotalPrice;
  126. procedure Calculate;
  127. property GclChapterCount: Integer read GetGclChapterCount;
  128. property GclChapter[AIndex: Integer]: TGclChapter read GetGclChapter;
  129. property GclChapterGather: TGclChapter read FGclChapterGather;
  130. property ProjectName: TStringArray read FProjectName write FProjectName;
  131. property ProjectCount: Integer read FProjectCount;
  132. end;
  133. TPayNode = class
  134. private
  135. FName: string;
  136. FIsMinus: Boolean;
  137. FCurTotalPrice: Double;
  138. FEndTotalPrice: Double;
  139. FPreTotalPrice: Double;
  140. public
  141. property Name: string read FName write FName;
  142. property IsMinus: Boolean read FIsMinus write FisMinus;
  143. property CurTotalPrice: Double read FCurTotalPrice write FCurTotalPrice;
  144. property EndTotalPrice: Double read FEndTotalPrice write FEndTotalPrice;
  145. property PreTotalPrice: Double read FPreTotalPrice write FPreTotalPrice;
  146. end;
  147. TDealPayControl = class
  148. private
  149. FPlusPayNodes: TList;
  150. FMinusPayNodes: TList;
  151. FPlusGather: TPayNode;
  152. FMinusGather: TPayNode;
  153. FGatherPayNode: TPayNode;
  154. FCompletePayNode: TPayNode;
  155. function FindPlusPayNode(const AName: string): TPayNode;
  156. function NewPlusPayNode(const AName: string): TPayNode;
  157. function AddPlusPayNode(const AName: string): TPayNode;
  158. function FindMinusPayNode(const AName: string): TPayNode;
  159. function NewMinusPayNode(const AName: string): TPayNode;
  160. function AddMinusPayNode(const AName: string): TPayNode;
  161. procedure CalculateGather(AGather: TPayNode; ANodes: TList);
  162. function GetMinusPayCount: Integer;
  163. function GetMinusPayNode(AIndex: Integer): TPayNode;
  164. function GetPlusPayCount: Integer;
  165. function GetPlusPayNode(AIndex: Integer): TPayNode;
  166. public
  167. constructor Create;
  168. destructor Destroy; override;
  169. function AddPayNode(const AName: string; AIsMinus: Boolean): TPayNode;
  170. procedure CalculateAll;
  171. property PlusPayCount: Integer read GetPlusPayCount;
  172. property PlusPayNode[AIndex: Integer]: TPayNode read GetPlusPayNode;
  173. property PlusGather: TPayNode read FPlusGather;
  174. property MinusPayCount: Integer read GetMinusPayCount;
  175. property MinusPayNode[AIndex: Integer]:TPayNode read GetMinusPayNode;
  176. property MinusGather: TPayNode read FMinusGather;
  177. property GatherPayNode: TPayNode read FGatherPayNode;
  178. property CompletePayNode: TPayNode read FCompletePayNode;
  179. end;
  180. // 分别对应5张定制汇总表的编号,详见文档
  181. THaBaiGatherType = (hbgt2, hbgt3, hbgt14, hbgt3_1, hbgt4_1, hbgt_CS);
  182. // CS: Counter Sign 会签
  183. TrmHaBaiCustomizedData = class(TDataModule)
  184. cdsCustom2: TClientDataSet;
  185. cdsCustom2Chapter: TIntegerField;
  186. cdsCustom2Name: TWideStringField;
  187. cdsCustom2TotalPrice: TFloatField;
  188. cdsCustom2CTotalPrice: TFloatField;
  189. cdsCustom2GTotalPrice: TFloatField;
  190. cdsCustom2EndGatherTotalPrice: TFloatField;
  191. cdsCustom2PreGatherTotalPrice: TFloatField;
  192. cdsCustom2CurGatherTotalPrice: TFloatField;
  193. cdsCustom2Percent: TFloatField;
  194. cdsCustom3: TClientDataSet;
  195. cdsCustom3ChapterID: TIntegerField;
  196. cdsCustom3InnerPartID: TIntegerField;
  197. cdsCustom3IndexCode: TStringField;
  198. cdsCustom3B_Code: TWideStringField;
  199. cdsCustom3Name: TWideStringField;
  200. cdsCustom3Units: TWideStringField;
  201. cdsCustom3Price: TFloatField;
  202. cdsCustom3Quantity: TFloatField;
  203. cdsCustom3TotalPrice: TFloatField;
  204. cdsCustom3PreGatherQuantity: TFloatField;
  205. cdsCustom3PreGatherTotalPrice: TFloatField;
  206. cdsCustom3EndGatherQuantity: TFloatField;
  207. cdsCustom3EndGatherTotalPrice: TFloatField;
  208. cdsCustom3CurGatherQuantity: TFloatField;
  209. cdsCustom3CurGatherTotalPrice: TFloatField;
  210. cdsCustom3Percent: TFloatField;
  211. cdsCustom14: TClientDataSet;
  212. cdsCustom14IndexCode: TWideStringField;
  213. cdsCustom14B_Code: TWideStringField;
  214. cdsCustom14Name: TWideStringField;
  215. cdsCustom14Units: TWideStringField;
  216. cdsCustom14Price: TFloatField;
  217. cdsCustom14Quantity: TFloatField;
  218. cdsCustom14TotalPrice: TFloatField;
  219. cdsCustom14CertificateCode: TWideStringField;
  220. cdsCustomProj: TClientDataSet;
  221. cdsCustomProjProjectID: TIntegerField;
  222. cdsCustomProjProjectName: TWideStringField;
  223. cdsCustomProjChapterID: TIntegerField;
  224. cdsCustomProjInnerPartID: TIntegerField;
  225. cdsCustomProjIndexCode: TWideStringField;
  226. cdsCustomProjB_Code: TWideStringField;
  227. cdsCustomProjName: TWideStringField;
  228. cdsCustomProjUnits: TWideStringField;
  229. cdsCustomProjPrice: TFloatField;
  230. cdsCustomProjQuantity: TFloatField;
  231. cdsCustomProjTotalPrice: TFloatField;
  232. cdsCustomProjCurGatherQuantity: TFloatField;
  233. cdsCustomProjCurGatherTotalPrice: TFloatField;
  234. cdsCustomProjEndGatherQuantity: TFloatField;
  235. cdsCustomProjEndGatherTotalPrice: TFloatField;
  236. cdsCustomProjP_CurGatherQuantity: TFloatField;
  237. cdsCustomProjP_CurGatherTotalPrice: TFloatField;
  238. cdsCustomProjP_EndGatherQuantity: TFloatField;
  239. cdsCustomProjP_EndGatherTotalPrice: TFloatField;
  240. cdsCustomProjCurPercent: TFloatField;
  241. cdsCustomProjEndPercent: TFloatField;
  242. cdsCustomProjSerialNo: TIntegerField;
  243. // 会签表
  244. // 流水
  245. cdsCustomCS_1: TClientDataSet;
  246. cdsCustomCS_1PulsPayName: TWideStringField;
  247. cdsCustomCS_1PulsPayTotalPrice: TFloatField;
  248. cdsCustomCS_1MinusPayName: TWideStringField;
  249. cdsCustomCS_1MinusPayTotalPrice: TFloatField;
  250. // 账单
  251. cdsCustomCS_2: TClientDataSet;
  252. cdsCustomCS_2DealTotalPrice: TFloatField;
  253. cdsCustomCS_2EndCompleteTotalPrice: TFloatField;
  254. cdsCustomCS_2PreCompleteTotalPrice: TFloatField;
  255. cdsCustomCS_2CurPayTotalPrice: TFloatField;
  256. private
  257. FhbGatherType: THaBaiGatherType;
  258. FProjectData: TProjectData;
  259. FProjectName: string;
  260. FGclControl: TGclControl;
  261. FDealPayControl: TDealPayControl;
  262. FDealTotalPrice: Double;
  263. procedure BeforeGather(AProjectCount: Integer; AIsHaBai: Boolean);
  264. procedure AfterGather;
  265. procedure OpenProjectData(AProject: TSelectProject);
  266. procedure FreeProjectData;
  267. procedure GatherProject(AProject: TSelectProject; AProjectIndex: Integer);
  268. procedure FilterGcl(AProjectIndex: Integer);
  269. procedure FilterDealPay;
  270. procedure WriteFlowData;
  271. procedure WriteReport2;
  272. procedure WriteReport3;
  273. procedure WriteReport3_1;
  274. procedure WriteReport4_1;
  275. procedure WriteReportCounterSign;
  276. procedure WriteData;
  277. public
  278. function AssignData(AProjects: TList; AhbGatherType: THaBaiGatherType; AReCalc: Boolean): TDataSet;
  279. function AssignAssistantData(AhbGatherType: THaBaiGatherType): TDataSet;
  280. property hbGatherType: THaBaiGatherType read FhbGatherType;
  281. end;
  282. implementation
  283. uses
  284. UtilMethods, ZhAPI, BillsCompileDm, sdDB, Globals, Math, BillsMeasureDm,
  285. ZJJLDm, BillsDm;
  286. {$R *.dfm}
  287. { TrmHaBaiCustomizedData }
  288. function TrmHaBaiCustomizedData.AssignData(AProjects: TList;
  289. AhbGatherType: THaBaiGatherType; AReCalc: Boolean): TDataSet;
  290. var
  291. iProject: Integer;
  292. begin
  293. FhbGatherType := AhbGatherType;
  294. BeforeGather(AProjects.Count, AReCalc);
  295. try
  296. for iProject := 0 to AProjects.Count - 1 do
  297. GatherProject(TSelectProject(AProjects.Items[iProject]), iProject);
  298. if AReCalc then
  299. FGclControl.ReCalculateTotalPrice;
  300. FGclControl.Calculate;
  301. WriteData;
  302. finally
  303. AfterGather;
  304. case FhbGatherType of
  305. hbgt2: Result := cdsCustom2;
  306. hbgt3: Result := cdsCustom3;
  307. hbgt14: Result := cdsCustom14;
  308. hbgt3_1, hbgt4_1: Result := cdsCustomProj;
  309. hbgt_CS: Result := cdsCustomCS_1;
  310. end;
  311. end;
  312. end;
  313. procedure TrmHaBaiCustomizedData.BeforeGather(AProjectCount: Integer; AIsHaBai: Boolean);
  314. begin
  315. cdsCustom2.DisableControls;
  316. cdsCustom2.Active := True;
  317. cdsCustom2.EmptyDataSet;
  318. cdsCustom3.DisableControls;
  319. cdsCustom3.Active := True;
  320. cdsCustom3.EmptyDataSet;
  321. cdsCustom14.DisableControls;
  322. cdsCustom14.Active := True;
  323. cdsCustom14.EmptyDataSet;
  324. cdsCustomProj.DisableControls;
  325. cdsCustomProj.Active := True;
  326. cdsCustomProj.EmptyDataSet;
  327. cdsCustomCS_1.DisableControls;
  328. cdsCustomCS_1.Active := True;
  329. cdsCustomCS_1.EmptyDataSet;
  330. cdsCustomCS_2.DisableControls;
  331. cdsCustomCS_2.Active := True;
  332. cdsCustomCS_2.EmptyDataSet;
  333. FGclControl := TGclControl.Create(AProjectCount, AIsHaBai);
  334. FDealPayControl := TDealPayControl.Create;
  335. FDealTotalPrice := 0;
  336. end;
  337. procedure TrmHaBaiCustomizedData.AfterGather;
  338. begin
  339. FDealPayControl.Free;
  340. FGclControl.Free;
  341. cdsCustomCS_2.EnableControls;
  342. cdsCustomCS_1.EnableControls;
  343. cdsCustomProj.EnableControls;
  344. cdsCustom14.EnableControls;
  345. cdsCustom3.EnableControls;
  346. cdsCustom2.EnableControls;
  347. end;
  348. procedure TrmHaBaiCustomizedData.FreeProjectData;
  349. begin
  350. if not Assigned(OpenProjectManager.FindProjectData(FProjectData.ProjectID)) then
  351. FProjectData.Free;
  352. end;
  353. procedure TrmHaBaiCustomizedData.OpenProjectData(AProject: TSelectProject);
  354. var
  355. Rec: TsdDataRecord;
  356. begin
  357. FProjectData := OpenProjectManager.FindProjectData(AProject.ProjectID);
  358. Rec := ProjectManager.sddProjectsInfo.FindKey('idxID', AProject.ProjectID);
  359. if not Assigned(FProjectData) then
  360. begin
  361. FProjectData := TProjectData.Create;
  362. FProjectData.OpenForReport3(GetMyProjectsFilePath + Rec.ValueByName('FileName').AsString);
  363. end;
  364. FProjectName := Rec.ValueByName('Name').AsString;
  365. end;
  366. procedure TrmHaBaiCustomizedData.GatherProject(AProject: TSelectProject;
  367. AProjectIndex: Integer);
  368. begin
  369. OpenProjectData(AProject);
  370. try
  371. FGclControl.ProjectName[AProjectIndex] := FProjectName;
  372. if FhbGatherType in [hbgt2, hbgt3, hbgt3_1, hbgt4_1] then
  373. FilterGcl(AProjectIndex);
  374. if FhbGatherType in [hbgt2, hbgt_CS] then
  375. FilterDealPay;
  376. if FhbGatherType = hbgt14 then
  377. WriteFlowData;
  378. if FhbGatherType = hbgt_CS then
  379. FDealTotalPrice := FDealTotalPrice + FProjectData.BillsData.Settlement[0];
  380. finally
  381. FreeProjectData;
  382. end;
  383. end;
  384. procedure TrmHaBaiCustomizedData.FilterGcl(AProjectIndex: Integer);
  385. var
  386. i: Integer;
  387. vNode: TMeasureBillsIDTreeNode;
  388. GclNode: TGclNode;
  389. begin
  390. with FProjectData.BillsMeasureData do
  391. begin
  392. for i := 0 to BillsMeasureTree.Count - 1 do
  393. begin
  394. vNode := TMeasureBillsIDTreeNode(BillsMeasureTree.Items[i]);
  395. if not vNode.HasChildren and (vNode.Rec.B_Code.AsString <> '') then
  396. GclNode := FGclControl.AddGclNode(vNode, AProjectIndex);
  397. end;
  398. end;
  399. end;
  400. procedure TrmHaBaiCustomizedData.FilterDealPay;
  401. var
  402. sCurField, sPreField, sEndField: string;
  403. procedure GatherCommonDealPayData;
  404. var
  405. iRec: Integer;
  406. Rec, StageRec: TsdDataRecord;
  407. DealPay: TPayNode;
  408. begin
  409. with FProjectData.DealPaymentData do
  410. begin
  411. for iRec := 0 to sddDealPayment.RecordCount - 1 do
  412. begin
  413. Rec := sddDealPayment.Records[iRec];
  414. if SameText(Rec.ValueByName('Name').AsString, '本期完成计量') or
  415. SameText(Rec.ValueByName('Name').AsString, '本期应付') or
  416. SameText(Rec.ValueByName('Name').AsString, '本期实付') then
  417. Continue;
  418. if FProjectData.PhaseData.Active then
  419. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger)
  420. else
  421. StageRec := nil;
  422. DealPay := FDealPayControl.AddPayNode(Rec.ValueByName('Name').AsString, Rec.ValueByName('IsMinus').AsBoolean);
  423. if Assigned(StageRec) then
  424. begin
  425. DealPay.CurTotalPrice := DealPay.CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  426. DealPay.PreTotalPrice := DealPay.PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  427. DealPay.EndTotalPrice := DealPay.EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  428. end;
  429. end;
  430. end;
  431. end;
  432. procedure GatherCompletePayData;
  433. var
  434. Rec, StageRec: TsdDataRecord;
  435. begin
  436. Rec := FProjectData.DealPaymentData.DealPayRecord('本期完成计量');
  437. if FProjectData.PhaseData.Active then
  438. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger)
  439. else
  440. StageRec := nil;
  441. if not Assigned(StageRec) then Exit;
  442. with FDealPayControl.CompletePayNode do
  443. begin
  444. CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  445. PreTotalPrice := PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  446. EndTotalPrice := EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  447. end;
  448. end;
  449. procedure GatherPayData;
  450. var
  451. Rec, StageRec: TsdDataRecord;
  452. begin
  453. Rec := FProjectData.DealPaymentData.DealPayRecord('本期应付');
  454. if FProjectData.PhaseData.Active then
  455. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger)
  456. else
  457. StageRec := nil;
  458. if not Assigned(StageRec) then Exit;
  459. with FDealPayControl.GatherPayNode do
  460. begin
  461. CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  462. PreTotalPrice := PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  463. EndTotalPrice := EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  464. end;
  465. end;
  466. begin
  467. sCurField := 'TotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  468. sPreField := 'PreTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  469. sEndField := 'EndTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  470. GatherCommonDealPayData;
  471. GatherCompletePayData;
  472. GatherPayData;
  473. FDealPayControl.CalculateAll;
  474. end;
  475. procedure TrmHaBaiCustomizedData.WriteData;
  476. begin
  477. case FhbGatherType of
  478. hbgt2: WriteReport2;
  479. hbgt3: WriteReport3;
  480. hbgt3_1: WriteReport3_1;
  481. hbgt4_1: WriteReport4_1;
  482. hbgt_CS: WriteReportCounterSign;
  483. end;
  484. end;
  485. procedure TrmHaBaiCustomizedData.WriteReport2;
  486. procedure WriteGclChapter(AGclChapter: TGclChapter; const AName: string = '');
  487. begin
  488. cdsCustom2.Append;
  489. if AGclChapter.ChapterBegin > 0 then
  490. cdsCustom2Chapter.AsInteger := AGclChapter.ChapterBegin;
  491. if AName = '' then
  492. cdsCustom2Name.AsString := AGclChapter.Name
  493. else
  494. cdsCustom2Name.AsString := AName;
  495. cdsCustom2TotalPrice.AsFloat := AGclChapter.TotalPrice;
  496. cdsCustom2GTotalPrice.AsFloat := AGclChapter.TotalPrice;
  497. cdsCustom2EndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  498. cdsCustom2PreGatherTotalPrice.AsFloat := AGclChapter.PreGatherTotalPrice;
  499. cdsCustom2CurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  500. cdsCustom2Percent.AsFloat := AGclChapter.EndPercent;
  501. cdsCustom2.Post;
  502. end;
  503. procedure WriteBlankRecord(const AName: string);
  504. begin
  505. cdsCustom2.Append;
  506. cdsCustom2Name.AsString := AName;
  507. cdsCustom2.Post;
  508. end;
  509. procedure WritePayNode(APayNode: TPayNode; const AName: string = '');
  510. begin
  511. cdsCustom2.Append;
  512. if AName = '' then
  513. cdsCustom2Name.AsString := APayNode.Name
  514. else
  515. cdsCustom2Name.AsString := AName;
  516. cdsCustom2EndGatherTotalPrice.AsFloat := APayNode.EndTotalPrice;
  517. cdsCustom2PreGatherTotalPrice.AsFloat := APayNode.PreTotalPrice;
  518. cdsCustom2CurGatherTotalPrice.AsFloat := APayNode.CurTotalPrice;
  519. cdsCustom2.Post;
  520. end;
  521. procedure WriteSpecialRecord;
  522. begin
  523. cdsCustom2.Append;
  524. cdsCustom2Name.AsString := '合 计';
  525. cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice;
  526. cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice;
  527. cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice;
  528. cdsCustom2.Post;
  529. end;
  530. procedure WriteMentalNode;
  531. begin
  532. cdsCustom2.Append;
  533. cdsCustom2Name.AsString := '支 付';
  534. cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice
  535. - FDealPayControl.MinusGather.EndTotalPrice;
  536. cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice
  537. - FDealPayControl.MinusGather.PreTotalPrice;
  538. cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice
  539. - FDealPayControl.MinusGather.CurTotalPrice;
  540. cdsCustom2.Post;
  541. end;
  542. var
  543. iIndex: Integer;
  544. begin
  545. for iIndex := 0 to FGclControl.GclChapterCount - 1 do
  546. WriteGclChapter(FGclControl.GclChapter[iIndex]);
  547. WriteGclChapter(FGclControl.GclChapterGather);
  548. WriteGclChapter(FGclControl.GclChapterGather, '小 计');
  549. WriteBlankRecord('价格调整');
  550. WriteBlankRecord('违约罚金');
  551. WriteBlankRecord('迟付款利息');
  552. for iIndex := 0 to FDealPayControl.PlusPayCount - 1 do
  553. WritePayNode(FDealPayControl.PlusPayNode[iIndex]);
  554. WriteSpecialRecord;
  555. for iIndex := 0 to FDealPayControl.MinusPayCount - 1 do
  556. WritePayNode(FDealPayControl.MinusPayNode[iIndex]);
  557. //WritePayNode(FDealPayControl.GatherPayNode, '支 付');
  558. // 神经病有毛病
  559. WriteMentalNode;
  560. end;
  561. procedure TrmHaBaiCustomizedData.WriteReport3;
  562. procedure WriteChapterName(AGclChapter: TGclChapter);
  563. begin
  564. cdsCustom3.Append;
  565. cdsCustom3ChapterID.AsInteger := AGclChapter.ChapterID;
  566. cdsCustom3InnerPartID.AsInteger := 1;
  567. cdsCustom3B_Code.AsString := AGclChapter.ChapterName;
  568. cdsCustom3Name.AsString := AGclChapter.Name;
  569. cdsCustom3.Post;
  570. end;
  571. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  572. begin
  573. cdsCustom3.Append;
  574. cdsCustom3ChapterID.AsInteger := AChapterID;
  575. cdsCustom3InnerPartID.AsInteger := 2;
  576. cdsCustom3IndexCode.AsString := AGclNode.IndexCode;
  577. cdsCustom3B_Code.AsString := AGclNode.B_Code;
  578. cdsCustom3Name.AsString := AGclNode.Name;
  579. cdsCustom3Units.AsString := AGclNode.Units;
  580. cdsCustom3Price.AsFloat := AGclNode.Price;
  581. cdsCustom3Quantity.AsFloat := AGclNode.Quantity;
  582. cdsCustom3TotalPrice.AsFloat := AGclNode.TotalPrice;
  583. cdsCustom3CurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  584. cdsCustom3CurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  585. cdsCustom3EndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  586. cdsCustom3EndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  587. cdsCustom3PreGatherQuantity.AsFloat := AGclNode.PreGatherQuantity;
  588. cdsCustom3PreGatherTotalPrice.AsFloat := AGclNode.PreGatherTotalPrice;
  589. cdsCustom3Percent.AsFloat := AGclNode.EndPercent;
  590. cdsCustom3.Post;
  591. end;
  592. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  593. begin
  594. cdsCustom3.Append;
  595. cdsCustom3ChapterID.AsInteger := AGclChapter.ChapterID;
  596. cdsCustom3InnerPartID.AsInteger := 3;
  597. if AName = '' then
  598. cdsCustom3Name.AsString := AGclChapter.Name
  599. else
  600. cdsCustom3Name.AsString := AName;
  601. cdsCustom3TotalPrice.AsFloat := AGclChapter.TotalPrice;
  602. cdsCustom3CurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  603. cdsCustom3EndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  604. cdsCustom3PreGatherTotalPrice.AsFloat := AGclChapter.PreGatherTotalPrice;
  605. cdsCustom3Percent.AsFloat := AGclChapter.EndPercent;
  606. cdsCustom3.Post;
  607. end;
  608. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  609. var
  610. iGcl: Integer;
  611. begin
  612. if AGclChapter.GclNodeCount = 0 then Exit;
  613. WriteChapterName(AGclChapter);
  614. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  615. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  616. WriteChapterGather(AGclChapter, Format('%s 小计', [AGclChapter.ChapterName]));
  617. end;
  618. var
  619. iIndex: Integer;
  620. begin
  621. for iIndex := 0 to FGclControl.GclChapterCount - 1 do
  622. WriteGclChapterData(FGclControl.GclChapter[iIndex]);
  623. WriteChapterGather(FGclControl.GclChapterGather, '第100章~第900章 合计');
  624. end;
  625. procedure TrmHaBaiCustomizedData.WriteReport3_1;
  626. var
  627. iProject, iChapter: Integer;
  628. sProjectName: string;
  629. procedure WriteChapterName(AGclChapter: TGclChapter);
  630. begin
  631. cdsCustomProj.Append;
  632. cdsCustomProjProjectID.AsInteger := iProject;
  633. cdsCustomProjProjectName.AsString := sProjectName;
  634. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  635. cdsCustomProjInnerPartID.AsInteger := 1;
  636. cdsCustomProjB_Code.AsString := AGclChapter.ChapterName;
  637. cdsCustomProjName.AsString := AGclChapter.Name;
  638. cdsCustomProj.Post;
  639. end;
  640. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  641. begin
  642. cdsCustomProj.Append;
  643. cdsCustomProjProjectID.AsInteger := iProject;
  644. cdsCustomProjProjectName.AsString := sProjectName;
  645. cdsCustomProjChapterID.AsInteger := AChapterID;
  646. cdsCustomProjInnerPartID.AsInteger := 2;
  647. cdsCustomProjIndexCode.AsString := AGclNode.IndexCode;
  648. cdsCustomProjB_Code.AsString := AGclNode.B_Code;
  649. cdsCustomProjName.AsString := AGclNode.Name;
  650. cdsCustomProjUnits.AsString := AGclNode.Units;
  651. cdsCustomProjPrice.AsFloat := AGclNode.Price;
  652. cdsCustomProjQuantity.AsFloat := AGclNode.Quantity;
  653. cdsCustomProjTotalPrice.AsFloat := AGclNode.TotalPrice;
  654. cdsCustomProjCurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  655. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  656. cdsCustomProjEndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  657. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  658. cdsCustomProjP_CurGatherQuantity.AsFloat := AGclNode.P_CurGatherQuantity[iProject];
  659. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclNode.P_CurGatherTotalPrice[iProject];
  660. cdsCustomProjP_EndGatherQuantity.AsFloat := AGclNode.P_EndGatherQuantity[iProject];
  661. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclNode.P_EndGatherTotalPrice[iProject];
  662. cdsCustomProjCurPercent.AsFloat := AGclNode.CurPercent;
  663. cdsCustomProjEndPercent.AsFloat := AGclNode.EndPercent;
  664. cdsCustomProj.Post;
  665. end;
  666. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  667. begin
  668. cdsCustomProj.Append;
  669. cdsCustomProjProjectID.AsInteger := iProject;
  670. cdsCustomProjProjectName.AsString := sProjectName;
  671. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  672. cdsCustomProjInnerPartID.AsInteger := 3;
  673. if AName = '' then
  674. cdsCustomProjName.AsString := AGclChapter.Name
  675. else
  676. cdsCustomProjName.AsString := AName;
  677. cdsCustomProjTotalPrice.AsFloat := AGclChapter.TotalPrice;
  678. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  679. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  680. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclChapter.P_CurGatherTotalPrice[iProject];
  681. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclChapter.P_EndGatherTotalPrice[iProject];
  682. cdsCustomProjCurPercent.AsFloat := AGclChapter.CurPercent;
  683. cdsCustomProjEndPercent.AsFloat := AGclChapter.EndPercent;
  684. cdsCustomProj.Post;
  685. end;
  686. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  687. var
  688. iGcl: Integer;
  689. begin
  690. if AGclChapter.GclNodeCount = 0 then Exit;
  691. WriteChapterName(AGclChapter);
  692. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  693. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  694. WriteChapterGather(AGclChapter, Format('%s 小计', [AGclChapter.ChapterName]));
  695. end;
  696. begin
  697. for iProject := 0 to FGclControl.ProjectCount - 1 do
  698. begin
  699. sProjectName := FGclControl.ProjectName[iProject];
  700. for iChapter := 0 to FGclControl.GclChapterCount - 1 do
  701. WriteGclChapterData(FGclControl.GclChapter[iChapter]);
  702. WriteChapterGather(FGclControl.GclChapterGather, '第100章至第900章 合计');
  703. end;
  704. end;
  705. procedure TrmHaBaiCustomizedData.WriteReport4_1;
  706. var
  707. iProject, iChapter, iSerial: Integer;
  708. sProjectName: string;
  709. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  710. begin
  711. cdsCustomProj.Append;
  712. cdsCustomProjProjectID.AsInteger := iProject;
  713. cdsCustomProjProjectName.AsString := sProjectName;
  714. cdsCustomProjChapterID.AsInteger := AChapterID;
  715. cdsCustomProjInnerPartID.AsInteger := 2;
  716. cdsCustomProjIndexCode.AsString := AGclNode.IndexCode;
  717. cdsCustomProjB_Code.AsString := AGclNode.B_Code;
  718. cdsCustomProjName.AsString := AGclNode.Name;
  719. cdsCustomProjUnits.AsString := AGclNode.Units;
  720. cdsCustomProjPrice.AsFloat := AGclNode.Price;
  721. cdsCustomProjQuantity.AsFloat := AGclNode.Quantity;
  722. cdsCustomProjTotalPrice.AsFloat := AGclNode.TotalPrice;
  723. cdsCustomProjCurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  724. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  725. cdsCustomProjEndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  726. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  727. cdsCustomProjP_CurGatherQuantity.AsFloat := AGclNode.P_CurGatherQuantity[iProject];
  728. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclNode.P_CurGatherTotalPrice[iProject];
  729. cdsCustomProjP_EndGatherQuantity.AsFloat := AGclNode.P_EndGatherQuantity[iProject];
  730. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclNode.P_EndGatherTotalPrice[iProject];
  731. cdsCustomProjCurPercent.AsFloat := AGclNode.CurPercent;
  732. cdsCustomProjEndPercent.AsFloat := AGclNode.EndPercent;
  733. cdsCustomProj.Post;
  734. end;
  735. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  736. var
  737. iGcl: Integer;
  738. begin
  739. if AGclChapter.GclNodeCount = 0 then Exit;
  740. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  741. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  742. end;
  743. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  744. begin
  745. cdsCustomProj.Append;
  746. cdsCustomProjProjectID.AsInteger := iProject;
  747. cdsCustomProjProjectName.AsString := sProjectName;
  748. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  749. cdsCustomProjInnerPartID.AsInteger := 3;
  750. if AName = '' then
  751. cdsCustomProjName.AsString := AGclChapter.Name
  752. else
  753. cdsCustomProjName.AsString := AName;
  754. cdsCustomProjTotalPrice.AsFloat := AGclChapter.TotalPrice;
  755. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  756. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  757. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclChapter.P_CurGatherTotalPrice[iProject];
  758. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclChapter.P_EndGatherTotalPrice[iProject];
  759. cdsCustomProjCurPercent.AsFloat := AGclChapter.CurPercent;
  760. cdsCustomProjEndPercent.AsFloat := AGclChapter.EndPercent;
  761. cdsCustomProj.Post;
  762. end;
  763. procedure ResortSerialNo;
  764. var
  765. iSerialNo, iProject: Integer;
  766. begin
  767. iSerialNo := 1;
  768. cdsCustomProj.First;
  769. iProject := cdsCustomProjProjectID.AsInteger;
  770. while not cdsCustomProj.Eof do
  771. begin
  772. if iProject <> cdsCustomProjProjectID.AsInteger then
  773. begin
  774. iProject := cdsCustomProjProjectID.AsInteger;
  775. iSerialNo := 1;
  776. end;
  777. cdsCustomProj.Edit;
  778. cdsCustomProjSerialNo.AsInteger := iSerialNo;
  779. cdsCustomProj.Post;
  780. Inc(iSerialNo);
  781. cdsCustomProj.Next;
  782. end;
  783. end;
  784. begin
  785. for iProject := 0 to FGclControl.ProjectCount - 1 do
  786. begin
  787. sProjectName := FGclControl.ProjectName[iProject];
  788. for iChapter := 0 to FGclControl.GclChapterCount - 1 do
  789. WriteGclChapterData(FGclControl.GclChapter[iChapter]);
  790. WriteChapterGather(FGclControl.GclChapterGather, '第100章至第900章 合计');
  791. end;
  792. ResortSerialNo;
  793. end;
  794. procedure TrmHaBaiCustomizedData.WriteFlowData;
  795. procedure AddNodeData(ANode: TMeasureBillsIDTreeNode);
  796. begin
  797. cdsCustom14.Append;
  798. cdsCustom14IndexCode.AsString := ANode.Rec.IndexCode.AsString;
  799. cdsCustom14B_Code.AsString := ANode.Rec.B_Code.AsString;
  800. cdsCustom14Name.AsString := ANode.Rec.Name.AsString;
  801. cdsCustom14Units.AsString := ANode.Rec.Units.AsString;
  802. cdsCustom14Price.AsFloat := ANode.Rec.Price.AsFloat;
  803. cdsCustom14Quantity.AsFloat := ANode.StageRec.GatherQuantity.AsFloat;
  804. cdsCustom14TotalPrice.AsFloat := ANode.StageRec.GatherTotalPrice.AsFloat;
  805. with FProjectData.PhaseData.ZJJLData do
  806. if cdsZJJL.Locate('BillsID', ANode.ID, []) then
  807. cdsCustom14CertificateCode.AsString := cdsZJJLCertificateCode.AsString;
  808. cdsCustom14.Post;
  809. end;
  810. var
  811. iIndex: Integer;
  812. vNode: TMeasureBillsIDTreeNode;
  813. begin
  814. for iIndex := 0 to FProjectData.BillsMeasureData.BillsMeasureTree.Count - 1 do
  815. begin
  816. vNode := TMeasureBillsIDTreeNode(FProjectData.BillsMeasureData.BillsMeasureTree.Items[iIndex]);
  817. if (not vNode.HasChildren) and (vNode.Rec.B_Code.AsString <> '') and
  818. Assigned(vNode.StageRec) and (vNode.StageRec.GatherTotalPrice.AsFloat <> 0) then
  819. AddNodeData(vNode);
  820. end;
  821. end;
  822. function TrmHaBaiCustomizedData.AssignAssistantData(
  823. AhbGatherType: THaBaiGatherType): TDataSet;
  824. begin
  825. Result := nil;
  826. if (AhbGatherType = hbgt_CS) and (FhbGatherType = hbgt_CS) then
  827. Result := cdsCustomCS_2;
  828. end;
  829. procedure TrmHaBaiCustomizedData.WriteReportCounterSign;
  830. procedure WriteCounterSign1;
  831. var
  832. i: Integer;
  833. PayNode: TPayNode;
  834. begin
  835. cdsCustomCS_1.Append;
  836. cdsCustomCS_1PulsPayName.AsString := '本期完成金额';
  837. cdsCustomCS_1PulsPayTotalPrice.AsFloat := FDealPayControl.CompletePayNode.CurTotalPrice;
  838. cdsCustomCS_1.Post;
  839. for i := 0 to FDealPayControl.PlusPayCount - 1 do
  840. begin
  841. PayNode := FDealPayControl.PlusPayNode[i];
  842. cdsCustomCS_1.Append;
  843. cdsCustomCS_1PulsPayName.AsString := PayNode.Name;
  844. cdsCustomCS_1PulsPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  845. cdsCustomCS_1.Post;
  846. end;
  847. cdsCustomCS_1.Append;
  848. cdsCustomCS_1PulsPayName.AsString := '迟付款利息';
  849. cdsCustomCS_1.Post;
  850. cdsCustomCS_1.First;
  851. for i := 0 to FDealPayControl.MinusPayCount - 1 do
  852. begin
  853. PayNode := FDealPayControl.MinusPayNode[i];
  854. if cdsCustomCS_1.Eof then
  855. cdsCustomCS_1.Append
  856. else
  857. cdsCustomCS_1.Edit;
  858. cdsCustomCS_1MinusPayName.AsString := PayNode.Name;
  859. cdsCustomCS_1MinusPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  860. cdsCustomCS_1.Post;
  861. cdsCustomCS_1.Next;
  862. end;
  863. end;
  864. procedure WriteCounterSign2;
  865. begin
  866. cdsCustomCS_2.Append;
  867. cdsCustomCS_2DealTotalPrice.AsFloat := FDealTotalPrice;
  868. cdsCustomCS_2EndCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.EndTotalPrice;
  869. cdsCustomCS_2PreCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.PreTotalPrice;
  870. cdsCustomCS_2CurPayTotalPrice.AsFloat := FDealPayControl.GatherPayNode.CurTotalPrice;
  871. cdsCustomCS_2.Post;
  872. end;
  873. begin
  874. WriteCounterSign1;
  875. WriteCounterSign2;
  876. end;
  877. { TGclNode }
  878. procedure TGclNode.Calculate;
  879. var
  880. i: Integer;
  881. begin
  882. // 金额模式下不重算
  883. if CalcType <> 0 then Exit;
  884. FTotalPrice := FPrice * FQuantity;
  885. FCurGatherTotalPrice := FPrice * FCurGatherQuantity;
  886. FEndGatherTotalPrice := FPrice * FEndGatherQuantity;
  887. FPreGatherTotalPrice := FPrice * FPreGatherQuantity;
  888. for i := 0 to FProjectCount - 1 do
  889. begin
  890. FP_TotalPrice[i] := FPrice * FP_Quantity[i];
  891. FP_CurGatherTotalPrice[i] := FPrice * FP_CurGatherQuantity[i];
  892. FP_EndGatherTotalPrice[i] := FPrice * FP_EndGatherQuantity[i];
  893. end;
  894. end;
  895. constructor TGclNode.Create(AProjectCount: Integer);
  896. begin
  897. FProjectCount := AProjectCount;
  898. SetLength(FP_Quantity, FProjectCount);
  899. SetLength(FP_TotalPrice, FProjectCount);
  900. SetLength(FP_CurGatherQuantity, FProjectCount);
  901. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  902. SetLength(FP_EndGatherQuantity, FProjectCount);
  903. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  904. end;
  905. function TGclNode.GetCurPercent: Double;
  906. begin
  907. if TotalPrice <> 0 then
  908. Result := CurGatherTotalPrice/TotalPrice*100
  909. else
  910. Result := 0;
  911. end;
  912. function TGclNode.GetEndPercent: Double;
  913. begin
  914. if TotalPrice <> 0 then
  915. Result := EndGatherTotalPrice/TotalPrice*100
  916. else
  917. Result := 0;
  918. end;
  919. procedure TGclNode.SetB_Code(const Value: string);
  920. begin
  921. FB_Code := Value;
  922. FIndexCode := B_CodeToIndexCode(FB_Code);
  923. end;
  924. { TGclControl }
  925. function TGclControl.AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode;
  926. begin
  927. Result := FindGclNode(ANode.Rec);
  928. if not Assigned(Result) then
  929. Result := NewGclNode(ANode.Rec);
  930. with ANode.Rec do
  931. begin
  932. Result.Quantity := Result.Quantity + Quantity.AsFloat;
  933. Result.TotalPrice := Result.TotalPrice + TotalPrice.AsFloat;
  934. Result.P_Quantity[AProjectIndex] := Result.P_Quantity[AProjectIndex] + Quantity.AsFloat;
  935. Result.P_TotalPrice[AProjectIndex] := Result.P_TotalPrice[AProjectIndex] + TotalPrice.AsFloat;
  936. end;
  937. if Assigned(ANode.StageRec) then
  938. with ANode.StageRec do
  939. begin
  940. Result.CurGatherQuantity := Result.CurGatherQuantity + GatherQuantity.AsFloat;
  941. Result.CurGatherTotalPrice := Result.CurGatherTotalPrice + GatherTotalPrice.AsFloat;
  942. Result.P_CurGatherQuantity[AProjectIndex] := Result.P_CurGatherQuantity[AProjectIndex] + GatherQuantity.AsFloat;
  943. Result.P_CurGatherTotalPrice[AProjectIndex] := Result.P_CurGatherTotalPrice[AProjectIndex] + GatherTotalPrice.AsFloat;
  944. Result.EndGatherQuantity := Result.EndGatherQuantity + EndGatherQuantity.AsFloat;
  945. Result.EndGatherTotalPrice := Result.EndGatherTotalPrice + EndGatherTotalPrice.AsFloat;
  946. Result.P_EndGatherQuantity[AProjectIndex] := Result.P_EndGatherQuantity[AProjectIndex] + EndGatherQuantity.AsFloat;
  947. Result.P_EndGatherTotalPrice[AProjectIndex] := Result.P_EndGatherTotalPrice[AProjectIndex] + EndGatherTotalPrice.AsFloat;
  948. Result.PreGatherQuantity := Result.PreGatherQuantity + PreGatherQuantity.AsFloat;
  949. Result.PreGatherTotalPrice := Result.PreGatherTotalPrice + PreGatherTotalPrice.AsFloat;
  950. end;
  951. end;
  952. function TGclControl.B_CodeToChapter(const AB_Code: string): Integer;
  953. var
  954. sgs: TStrings;
  955. iFirst, iSecond: Integer;
  956. begin
  957. Result := 0;
  958. sgs := TStringList.Create;
  959. try
  960. sgs.Delimiter := '-';
  961. sgs.DelimitedText := AB_Code;
  962. iFirst := StrToIntDef(sgs.Strings[0], 0);
  963. Result := Trunc(iFirst/100);
  964. if (Result >= 90) and (Result < 100) then
  965. Result := 9;
  966. finally
  967. sgs.Free;
  968. end;
  969. end;
  970. procedure TGclControl.CalculateChapterGather;
  971. var
  972. iIndex, iProject: Integer;
  973. vGclChapter: TGclChapter;
  974. begin
  975. FGclChapterGather.TotalPrice := 0;
  976. FGclChapterGather.CurGatherTotalPrice := 0;
  977. FGclChapterGather.EndGatherTotalPrice := 0;
  978. FGclChapterGather.PreGatherTotalPrice := 0;
  979. for iProject := 0 to FProjectCount - 1 do
  980. begin
  981. FGclChapterGather.P_TotalPrice[iProject] := 0;
  982. FGclChapterGather.P_CurGatherTotalPrice[iProject] := 0;
  983. FGclChapterGather.P_EndGatherTotalPrice[iProject] := 0;
  984. end;
  985. for iIndex := 0 to FGclChapters.Count - 1 do
  986. begin
  987. vGclChapter := TGclChapter(FGclChapters.Items[iIndex]);
  988. with FGclChapterGather do
  989. begin
  990. TotalPrice := TotalPrice + vGclChapter.TotalPrice;
  991. CurGatherTotalPrice := CurGatherTotalPrice + vGclChapter.CurGatherTotalPrice;
  992. EndGatherTotalPrice := EndGatherTotalPrice + vGclChapter.EndGatherTotalPrice;
  993. PreGatherTotalPrice := PreGatherTotalPrice + vGclChapter.PreGatherTotalPrice;
  994. for iProject := 0 to FProjectCount - 1 do
  995. begin
  996. P_TotalPrice[iProject] := P_TotalPrice[iProject] + vGclChapter.P_TotalPrice[iProject];
  997. P_CurGatherTotalPrice[iProject] := P_CurGatherTotalPrice[iProject] + vGclChapter.P_CurGatherTotalPrice[iProject];
  998. P_EndGatherTotalPrice[iProject] := P_EndGatherTotalPrice[iProject] + vGclChapter.P_EndGatherTotalPrice[iProject];
  999. end;
  1000. end;
  1001. end;
  1002. end;
  1003. constructor TGclControl.Create(AProjectCount: Integer; AIsHaBai: Boolean);
  1004. function CreateGclChapter(AChapterID: Integer; const AName: string): TGclChapter;
  1005. begin
  1006. Result := TGclChapter.Create(AChapterID, AName, FProjectCount);
  1007. FGclChapters.Add(Result);
  1008. end;
  1009. begin
  1010. FProjectCount := AProjectCount;
  1011. SetLength(FProjectName, AProjectCount);
  1012. FGclNodes := TList.Create;
  1013. FGclChapters := TList.Create;
  1014. CreateGclChapter(1, '总 则');
  1015. CreateGclChapter(2, '路 基');
  1016. CreateGclChapter(3, '路 面');
  1017. CreateGclChapter(4, '桥梁、涵洞工程');
  1018. CreateGclChapter(5, '隧 道');
  1019. CreateGclChapter(6, '安全设计及预埋管线');
  1020. CreateGclChapter(7, '绿化及环境保护工程');
  1021. if AIsHaBai then
  1022. begin
  1023. CreateGclChapter(8, '房建工程');
  1024. CreateGclChapter(9, '机电工程');
  1025. end
  1026. else
  1027. begin
  1028. CreateGclChapter(8, '机电工程');
  1029. CreateGclChapter(9, '房建工程');
  1030. end;
  1031. FOtherGcl := TGclChapter.Create(19, '非标准清单', FProjectCount);
  1032. FGclChapterGather := TGclChapter.Create(20, '第100章至900章合计', FProjectCount);
  1033. end;
  1034. destructor TGclControl.Destroy;
  1035. begin
  1036. FOtherGcl.Free;
  1037. FGclChapterGather.Free;
  1038. ClearObjects(FGclChapters);
  1039. FGclChapters.Free;
  1040. ClearObjects(FGclNodes);
  1041. FGclNodes.Free;
  1042. end;
  1043. function TGclControl.FindGclNode(ARec: TBillsRecord): TGclNode;
  1044. var
  1045. iIndex: Integer;
  1046. vGclNode: TGclNode;
  1047. bSameCode, bSameName, bSameUnits, bSamePrice: Boolean;
  1048. begin
  1049. Result := nil;
  1050. for iIndex := 0 to FGclNodes.Count - 1 do
  1051. begin
  1052. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1053. if (vGclNode.B_Code = ARec.B_Code.AsString) and
  1054. (vGclNode.Name = ARec.Name.AsString) and
  1055. (vGclNode.Units = ARec.Units.AsString) and
  1056. (vGclNode.Price = ARec.Price.AsFloat) and
  1057. (vGclNode.CalcType = ARec.CalcType.AsInteger)then
  1058. begin
  1059. Result := vGclNode;
  1060. Break;
  1061. end;
  1062. end;
  1063. end;
  1064. function TGclControl.FindGclChapter(AChapterID: Integer): TGclChapter;
  1065. var
  1066. iIndex: Integer;
  1067. vChapter: TGclChapter;
  1068. begin
  1069. Result := nil;
  1070. for iIndex := 0 to FGclChapters.Count - 1 do
  1071. begin
  1072. vChapter := TGclChapter(FGclChapters.Items[iIndex]);
  1073. if vChapter.ChapterID = AChapterID then
  1074. begin
  1075. Result := vChapter;
  1076. Break;
  1077. end;
  1078. end;
  1079. end;
  1080. function TGclControl.GetGclChapter(AIndex: Integer): TGclChapter;
  1081. begin
  1082. Result := TGclChapter(FGclChapters.Items[AIndex]);
  1083. end;
  1084. function TGclControl.GetGclChapterCount: Integer;
  1085. begin
  1086. Result := FGclChapters.Count;
  1087. end;
  1088. procedure TGclControl.LinkGclChapter(AGclNode: TGclNode);
  1089. var
  1090. iChapterID: Integer;
  1091. vChapter: TGclChapter;
  1092. begin
  1093. iChapterID := B_CodeToChapter(AGclNode.B_Code);
  1094. vChapter := FindGclChapter(iChapterID);
  1095. if Assigned(vChapter) then
  1096. vChapter.AddGclNode(AGclNode)
  1097. else
  1098. FOtherGcl.AddGclNode(AGclNode);
  1099. end;
  1100. function TGclControl.NewGclNode(ARec: TBillsRecord): TGclNode;
  1101. begin
  1102. Result := TGclNode.Create(FProjectCount);
  1103. FGclNodes.Add(Result);
  1104. Result.B_Code := ARec.B_Code.AsString;
  1105. Result.Name := ARec.Name.AsString;
  1106. Result.Units := ARec.Units.AsString;
  1107. Result.Price := ARec.Price.AsFloat;
  1108. Result.CalcType := ARec.CalcType.AsInteger;
  1109. LinkGclChapter(Result);
  1110. end;
  1111. procedure TGclControl.Calculate;
  1112. var
  1113. i: Integer;
  1114. begin
  1115. for i := 0 to GclChapterCount - 1 do
  1116. GclChapter[i].CalculateChapter;
  1117. CalculateChapterGather;
  1118. end;
  1119. procedure TGclControl.ReCalculateTotalPrice;
  1120. var
  1121. iGcl: Integer;
  1122. begin
  1123. for iGcl := 0 to FGclNodes.Count - 1 do
  1124. TGclNode(FGclNodes[iGcl]).Calculate;
  1125. end;
  1126. { TGclChapter }
  1127. procedure TGclChapter.AddGclNode(AGclNode: TGclNode);
  1128. begin
  1129. FGclNodes.Add(AGclNode);
  1130. end;
  1131. procedure TGclChapter.CalculateChapter;
  1132. var
  1133. iIndex, iProject: Integer;
  1134. vGclNode: TGclNode;
  1135. begin
  1136. FTotalPrice := 0;
  1137. FCurGatherTotalPrice := 0;
  1138. FEndGatherTotalPrice := 0;
  1139. FPreGatherTotalPrice := 0;
  1140. for iProject := 0 to FProjectCount - 1 do
  1141. begin
  1142. FP_TotalPrice[iProject] := 0;
  1143. FP_CurGatherTotalPrice[iProject] := 0;
  1144. FP_EndGatherTotalPrice[iProject] := 0;
  1145. end;
  1146. for iIndex := 0 to FGclNodes.Count - 1 do
  1147. begin
  1148. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1149. FTotalPrice := FTotalPrice + vGclNode.TotalPrice;
  1150. FCurGatherTotalPrice := FCurGatherTotalPrice + vGclNode.FCurGatherTotalPrice;
  1151. FEndGatherTotalPrice := FEndGatherTotalPrice + vGclNode.FEndGatherTotalPrice;
  1152. FPreGatherTotalPrice := FPreGatherTotalPrice + vGclNode.FPreGatherTotalPrice;
  1153. for iProject := 0 to FProjectCount - 1 do
  1154. begin
  1155. FP_TotalPrice[iProject] := FP_TotalPrice[iProject] + vGclNode.P_TotalPrice[iProject];
  1156. FP_CurGatherTotalPrice[iProject] := FP_CurGatherTotalPrice[iProject] + vGclNode.P_CurGatherTotalPrice[iProject];
  1157. FP_EndGatherTotalPrice[iProject] := FP_EndGatherTotalPrice[iProject] + vGclNode.P_EndGatherTotalPrice[iProject];
  1158. end;
  1159. end;
  1160. end;
  1161. constructor TGclChapter.Create(AChapterID: Integer; const AName: string;
  1162. AProjectCount: Integer);
  1163. begin
  1164. FGclNodes := TList.Create;
  1165. FChapterID := AChapterID;
  1166. if FChapterID < 19 then
  1167. begin
  1168. FChapterBegin := FChapterID * 100;
  1169. FChapterEnd := FChapterBegin + 99;
  1170. FChapterName := Format('第%d章', [FChapterBegin]);
  1171. end;
  1172. FName := AName;
  1173. FProjectCount := AProjectCount;
  1174. SetLength(FP_TotalPrice, FProjectCount);
  1175. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  1176. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  1177. end;
  1178. destructor TGclChapter.Destroy;
  1179. begin
  1180. FGclNodes.Free;
  1181. inherited;
  1182. end;
  1183. function TGclChapter.GetCurPercent: Double;
  1184. begin
  1185. if TotalPrice <> 0 then
  1186. Result := CurGatherTotalPrice/TotalPrice*100
  1187. else
  1188. Result := 0;
  1189. end;
  1190. function TGclChapter.GetEndPercent: Double;
  1191. begin
  1192. if TotalPrice <> 0 then
  1193. Result := EndGatherTotalPrice/TotalPrice*100
  1194. else
  1195. Result := 0;
  1196. end;
  1197. function TGclChapter.GetGclNode(AIndex: Integer): TGclNode;
  1198. begin
  1199. Result := TGclNode(FGclNodes.Items[AIndex]);
  1200. end;
  1201. function TGclChapter.GetGclNodeCount: Integer;
  1202. begin
  1203. Result := FGclNodes.Count;
  1204. end;
  1205. { TDealPayControl }
  1206. function TDealPayControl.AddMinusPayNode(const AName: string): TPayNode;
  1207. begin
  1208. Result := FindMinusPayNode(AName);
  1209. if not Assigned(Result) then
  1210. Result := NewMinusPayNode(AName);
  1211. end;
  1212. function TDealPayControl.AddPayNode(const AName: string;
  1213. AIsMinus: Boolean): TPayNode;
  1214. begin
  1215. if AIsMinus then
  1216. Result := AddMinusPayNode(AName)
  1217. else
  1218. Result := AddPlusPayNode(AName);
  1219. end;
  1220. function TDealPayControl.AddPlusPayNode(const AName: string): TPayNode;
  1221. begin
  1222. Result := FindPlusPayNode(AName);
  1223. if not Assigned(Result) then
  1224. Result := NewPlusPayNode(AName);
  1225. end;
  1226. procedure TDealPayControl.CalculateAll;
  1227. begin
  1228. CalculateGather(FPlusGather, FPlusPayNodes);
  1229. CalculateGather(FMinusGather, FMinusPayNodes);
  1230. end;
  1231. procedure TDealPayControl.CalculateGather(AGather: TPayNode; ANodes: TList);
  1232. var
  1233. i: Integer;
  1234. vPayNode: TPayNode;
  1235. begin
  1236. AGather.CurTotalPrice := 0;
  1237. AGather.EndTotalPrice := 0;
  1238. AGather.PreTotalPrice := 0;
  1239. for i := 0 to ANodes.Count - 1 do
  1240. begin
  1241. vPayNode := TPayNode(ANodes.Items[i]);
  1242. AGather.CurTotalPrice := AGather.CurTotalPrice + vPayNode.CurTotalPrice;
  1243. AGather.EndTotalPrice := AGather.EndTotalPrice + vPayNode.EndTotalPrice;
  1244. AGather.PreTotalPrice := AGather.PreTotalPrice + vPayNode.PreTotalPrice;
  1245. end;
  1246. end;
  1247. constructor TDealPayControl.Create;
  1248. begin
  1249. FPlusPayNodes := TList.Create;
  1250. FMinusPayNodes := TList.Create;
  1251. FPlusGather := TPayNode.Create;
  1252. FMinusGather := TPayNode.Create;
  1253. FGatherPayNode := TPayNode.Create;
  1254. FGatherPayNode.Name := '本期应付';
  1255. FCompletePayNode :=TPayNode.Create;
  1256. FCompletePayNode.Name := '本期完成计量';
  1257. end;
  1258. destructor TDealPayControl.Destroy;
  1259. begin
  1260. FCompletePayNode.Free;
  1261. FGatherPayNode.Free;
  1262. FMinusGather.Free;
  1263. FPlusGather.Free;
  1264. ClearObjects(FMinusPayNodes);
  1265. FMinusPayNodes.Free;
  1266. ClearObjects(FPlusPayNodes);
  1267. FPlusPayNodes.Free;
  1268. inherited;
  1269. end;
  1270. function TDealPayControl.FindMinusPayNode(const AName: string): TPayNode;
  1271. var
  1272. iIndex: Integer;
  1273. vPayNode: TPayNode;
  1274. begin
  1275. Result := nil;
  1276. for iIndex := 0 to FMinusPayNodes.Count -1 do
  1277. begin
  1278. vPayNode := TPayNode(FMinusPayNodes.Items[iIndex]);
  1279. if (vPayNode.Name = AName) then
  1280. begin
  1281. Result := vPayNode;
  1282. Break;
  1283. end;
  1284. end;
  1285. end;
  1286. function TDealPayControl.FindPlusPayNode(const AName: string): TPayNode;
  1287. var
  1288. iIndex: Integer;
  1289. vPayNode: TPayNode;
  1290. begin
  1291. Result := nil;
  1292. for iIndex := 0 to FPlusPayNodes.Count -1 do
  1293. begin
  1294. vPayNode := TPayNode(FPlusPayNodes.Items[iIndex]);
  1295. if (vPayNode.Name = AName) then
  1296. begin
  1297. Result := vPayNode;
  1298. Break;
  1299. end;
  1300. end;
  1301. end;
  1302. function TDealPayControl.GetMinusPayCount: Integer;
  1303. begin
  1304. Result := FMinusPayNodes.Count;
  1305. end;
  1306. function TDealPayControl.GetMinusPayNode(AIndex: Integer): TPayNode;
  1307. begin
  1308. Result := TPayNode(FMinusPayNodes.Items[AIndex]);
  1309. end;
  1310. function TDealPayControl.GetPlusPayCount: Integer;
  1311. begin
  1312. Result := FPlusPayNodes.Count;
  1313. end;
  1314. function TDealPayControl.GetPlusPayNode(AIndex: Integer): TPayNode;
  1315. begin
  1316. Result := TPayNode(FPlusPayNodes.Items[AIndex]);
  1317. end;
  1318. function TDealPayControl.NewMinusPayNode(const AName: string): TPayNode;
  1319. begin
  1320. Result := TPayNode.Create;
  1321. FMinusPayNodes.Add(Result);
  1322. Result.Name := AName;
  1323. Result.IsMinus := True;
  1324. end;
  1325. function TDealPayControl.NewPlusPayNode(const AName: string): TPayNode;
  1326. begin
  1327. Result := TPayNode.Create;
  1328. FPlusPayNodes.Add(Result);
  1329. Result.Name := AName;
  1330. Result.IsMinus := False;
  1331. end;
  1332. end.