rmHaBaiCustomizedDm.pas 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527
  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. var
  797. vRec: TsdDataRecord;
  798. begin
  799. cdsCustom14.Append;
  800. cdsCustom14IndexCode.AsString := ANode.Rec.IndexCode.AsString;
  801. cdsCustom14B_Code.AsString := ANode.Rec.B_Code.AsString;
  802. cdsCustom14Name.AsString := ANode.Rec.Name.AsString;
  803. cdsCustom14Units.AsString := ANode.Rec.Units.AsString;
  804. cdsCustom14Price.AsFloat := ANode.Rec.Price.AsFloat;
  805. cdsCustom14Quantity.AsFloat := ANode.StageRec.GatherQuantity.AsFloat;
  806. cdsCustom14TotalPrice.AsFloat := ANode.StageRec.GatherTotalPrice.AsFloat;
  807. with FProjectData.PhaseData.ZJJLData do
  808. begin
  809. vRec := sddZJJL.FindKey('idxBillsID', ANode.ID);
  810. if Assigned(vRec) then
  811. cdsCustom14CertificateCode.AsString := vRec.ValueByName('CertificateCode').AsString;
  812. end;
  813. cdsCustom14.Post;
  814. end;
  815. var
  816. iIndex: Integer;
  817. vNode: TMeasureBillsIDTreeNode;
  818. begin
  819. for iIndex := 0 to FProjectData.BillsMeasureData.BillsMeasureTree.Count - 1 do
  820. begin
  821. vNode := TMeasureBillsIDTreeNode(FProjectData.BillsMeasureData.BillsMeasureTree.Items[iIndex]);
  822. if (not vNode.HasChildren) and (vNode.Rec.B_Code.AsString <> '') and
  823. Assigned(vNode.StageRec) and (vNode.StageRec.GatherTotalPrice.AsFloat <> 0) then
  824. AddNodeData(vNode);
  825. end;
  826. end;
  827. function TrmHaBaiCustomizedData.AssignAssistantData(
  828. AhbGatherType: THaBaiGatherType): TDataSet;
  829. begin
  830. Result := nil;
  831. if (AhbGatherType = hbgt_CS) and (FhbGatherType = hbgt_CS) then
  832. Result := cdsCustomCS_2;
  833. end;
  834. procedure TrmHaBaiCustomizedData.WriteReportCounterSign;
  835. procedure WriteCounterSign1;
  836. var
  837. i: Integer;
  838. PayNode: TPayNode;
  839. begin
  840. cdsCustomCS_1.Append;
  841. cdsCustomCS_1PulsPayName.AsString := '本期完成金额';
  842. cdsCustomCS_1PulsPayTotalPrice.AsFloat := FDealPayControl.CompletePayNode.CurTotalPrice;
  843. cdsCustomCS_1.Post;
  844. for i := 0 to FDealPayControl.PlusPayCount - 1 do
  845. begin
  846. PayNode := FDealPayControl.PlusPayNode[i];
  847. cdsCustomCS_1.Append;
  848. cdsCustomCS_1PulsPayName.AsString := PayNode.Name;
  849. cdsCustomCS_1PulsPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  850. cdsCustomCS_1.Post;
  851. end;
  852. cdsCustomCS_1.Append;
  853. cdsCustomCS_1PulsPayName.AsString := '迟付款利息';
  854. cdsCustomCS_1.Post;
  855. cdsCustomCS_1.First;
  856. for i := 0 to FDealPayControl.MinusPayCount - 1 do
  857. begin
  858. PayNode := FDealPayControl.MinusPayNode[i];
  859. if cdsCustomCS_1.Eof then
  860. cdsCustomCS_1.Append
  861. else
  862. cdsCustomCS_1.Edit;
  863. cdsCustomCS_1MinusPayName.AsString := PayNode.Name;
  864. cdsCustomCS_1MinusPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  865. cdsCustomCS_1.Post;
  866. cdsCustomCS_1.Next;
  867. end;
  868. end;
  869. procedure WriteCounterSign2;
  870. begin
  871. cdsCustomCS_2.Append;
  872. cdsCustomCS_2DealTotalPrice.AsFloat := FDealTotalPrice;
  873. cdsCustomCS_2EndCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.EndTotalPrice;
  874. cdsCustomCS_2PreCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.PreTotalPrice;
  875. cdsCustomCS_2CurPayTotalPrice.AsFloat := FDealPayControl.GatherPayNode.CurTotalPrice;
  876. cdsCustomCS_2.Post;
  877. end;
  878. begin
  879. WriteCounterSign1;
  880. WriteCounterSign2;
  881. end;
  882. { TGclNode }
  883. procedure TGclNode.Calculate;
  884. var
  885. i: Integer;
  886. begin
  887. // 金额模式下不重算
  888. if CalcType <> 0 then Exit;
  889. FTotalPrice := FPrice * FQuantity;
  890. FCurGatherTotalPrice := FPrice * FCurGatherQuantity;
  891. FEndGatherTotalPrice := FPrice * FEndGatherQuantity;
  892. FPreGatherTotalPrice := FPrice * FPreGatherQuantity;
  893. for i := 0 to FProjectCount - 1 do
  894. begin
  895. FP_TotalPrice[i] := FPrice * FP_Quantity[i];
  896. FP_CurGatherTotalPrice[i] := FPrice * FP_CurGatherQuantity[i];
  897. FP_EndGatherTotalPrice[i] := FPrice * FP_EndGatherQuantity[i];
  898. end;
  899. end;
  900. constructor TGclNode.Create(AProjectCount: Integer);
  901. begin
  902. FProjectCount := AProjectCount;
  903. SetLength(FP_Quantity, FProjectCount);
  904. SetLength(FP_TotalPrice, FProjectCount);
  905. SetLength(FP_CurGatherQuantity, FProjectCount);
  906. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  907. SetLength(FP_EndGatherQuantity, FProjectCount);
  908. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  909. end;
  910. function TGclNode.GetCurPercent: Double;
  911. begin
  912. if TotalPrice <> 0 then
  913. Result := CurGatherTotalPrice/TotalPrice*100
  914. else
  915. Result := 0;
  916. end;
  917. function TGclNode.GetEndPercent: Double;
  918. begin
  919. if TotalPrice <> 0 then
  920. Result := EndGatherTotalPrice/TotalPrice*100
  921. else
  922. Result := 0;
  923. end;
  924. procedure TGclNode.SetB_Code(const Value: string);
  925. begin
  926. FB_Code := Value;
  927. FIndexCode := B_CodeToIndexCode(FB_Code);
  928. end;
  929. { TGclControl }
  930. function TGclControl.AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode;
  931. begin
  932. Result := FindGclNode(ANode.Rec);
  933. if not Assigned(Result) then
  934. Result := NewGclNode(ANode.Rec);
  935. with ANode.Rec do
  936. begin
  937. Result.Quantity := Result.Quantity + Quantity.AsFloat;
  938. Result.TotalPrice := Result.TotalPrice + TotalPrice.AsFloat;
  939. Result.P_Quantity[AProjectIndex] := Result.P_Quantity[AProjectIndex] + Quantity.AsFloat;
  940. Result.P_TotalPrice[AProjectIndex] := Result.P_TotalPrice[AProjectIndex] + TotalPrice.AsFloat;
  941. end;
  942. if Assigned(ANode.StageRec) then
  943. with ANode.StageRec do
  944. begin
  945. Result.CurGatherQuantity := Result.CurGatherQuantity + GatherQuantity.AsFloat;
  946. Result.CurGatherTotalPrice := Result.CurGatherTotalPrice + GatherTotalPrice.AsFloat;
  947. Result.P_CurGatherQuantity[AProjectIndex] := Result.P_CurGatherQuantity[AProjectIndex] + GatherQuantity.AsFloat;
  948. Result.P_CurGatherTotalPrice[AProjectIndex] := Result.P_CurGatherTotalPrice[AProjectIndex] + GatherTotalPrice.AsFloat;
  949. Result.EndGatherQuantity := Result.EndGatherQuantity + EndGatherQuantity.AsFloat;
  950. Result.EndGatherTotalPrice := Result.EndGatherTotalPrice + EndGatherTotalPrice.AsFloat;
  951. Result.P_EndGatherQuantity[AProjectIndex] := Result.P_EndGatherQuantity[AProjectIndex] + EndGatherQuantity.AsFloat;
  952. Result.P_EndGatherTotalPrice[AProjectIndex] := Result.P_EndGatherTotalPrice[AProjectIndex] + EndGatherTotalPrice.AsFloat;
  953. Result.PreGatherQuantity := Result.PreGatherQuantity + PreGatherQuantity.AsFloat;
  954. Result.PreGatherTotalPrice := Result.PreGatherTotalPrice + PreGatherTotalPrice.AsFloat;
  955. end;
  956. end;
  957. function TGclControl.B_CodeToChapter(const AB_Code: string): Integer;
  958. var
  959. sgs: TStrings;
  960. iFirst, iSecond: Integer;
  961. begin
  962. Result := 0;
  963. sgs := TStringList.Create;
  964. try
  965. sgs.Delimiter := '-';
  966. sgs.DelimitedText := AB_Code;
  967. iFirst := StrToIntDef(sgs.Strings[0], 0);
  968. Result := Trunc(iFirst/100);
  969. if (Result >= 90) and (Result < 100) then
  970. Result := 9;
  971. finally
  972. sgs.Free;
  973. end;
  974. end;
  975. procedure TGclControl.CalculateChapterGather;
  976. var
  977. iIndex, iProject: Integer;
  978. vGclChapter: TGclChapter;
  979. begin
  980. FGclChapterGather.TotalPrice := 0;
  981. FGclChapterGather.CurGatherTotalPrice := 0;
  982. FGclChapterGather.EndGatherTotalPrice := 0;
  983. FGclChapterGather.PreGatherTotalPrice := 0;
  984. for iProject := 0 to FProjectCount - 1 do
  985. begin
  986. FGclChapterGather.P_TotalPrice[iProject] := 0;
  987. FGclChapterGather.P_CurGatherTotalPrice[iProject] := 0;
  988. FGclChapterGather.P_EndGatherTotalPrice[iProject] := 0;
  989. end;
  990. for iIndex := 0 to FGclChapters.Count - 1 do
  991. begin
  992. vGclChapter := TGclChapter(FGclChapters.Items[iIndex]);
  993. with FGclChapterGather do
  994. begin
  995. TotalPrice := TotalPrice + vGclChapter.TotalPrice;
  996. CurGatherTotalPrice := CurGatherTotalPrice + vGclChapter.CurGatherTotalPrice;
  997. EndGatherTotalPrice := EndGatherTotalPrice + vGclChapter.EndGatherTotalPrice;
  998. PreGatherTotalPrice := PreGatherTotalPrice + vGclChapter.PreGatherTotalPrice;
  999. for iProject := 0 to FProjectCount - 1 do
  1000. begin
  1001. P_TotalPrice[iProject] := P_TotalPrice[iProject] + vGclChapter.P_TotalPrice[iProject];
  1002. P_CurGatherTotalPrice[iProject] := P_CurGatherTotalPrice[iProject] + vGclChapter.P_CurGatherTotalPrice[iProject];
  1003. P_EndGatherTotalPrice[iProject] := P_EndGatherTotalPrice[iProject] + vGclChapter.P_EndGatherTotalPrice[iProject];
  1004. end;
  1005. end;
  1006. end;
  1007. end;
  1008. constructor TGclControl.Create(AProjectCount: Integer; AIsHaBai: Boolean);
  1009. function CreateGclChapter(AChapterID: Integer; const AName: string): TGclChapter;
  1010. begin
  1011. Result := TGclChapter.Create(AChapterID, AName, FProjectCount);
  1012. FGclChapters.Add(Result);
  1013. end;
  1014. begin
  1015. FProjectCount := AProjectCount;
  1016. SetLength(FProjectName, AProjectCount);
  1017. FGclNodes := TList.Create;
  1018. FGclChapters := TList.Create;
  1019. CreateGclChapter(1, '总 则');
  1020. CreateGclChapter(2, '路 基');
  1021. CreateGclChapter(3, '路 面');
  1022. CreateGclChapter(4, '桥梁、涵洞工程');
  1023. CreateGclChapter(5, '隧 道');
  1024. CreateGclChapter(6, '安全设计及预埋管线');
  1025. CreateGclChapter(7, '绿化及环境保护工程');
  1026. if AIsHaBai then
  1027. begin
  1028. CreateGclChapter(8, '房建工程');
  1029. CreateGclChapter(9, '机电工程');
  1030. end
  1031. else
  1032. begin
  1033. CreateGclChapter(8, '机电工程');
  1034. CreateGclChapter(9, '房建工程');
  1035. end;
  1036. FOtherGcl := TGclChapter.Create(19, '非标准清单', FProjectCount);
  1037. FGclChapterGather := TGclChapter.Create(20, '第100章至900章合计', FProjectCount);
  1038. end;
  1039. destructor TGclControl.Destroy;
  1040. begin
  1041. FOtherGcl.Free;
  1042. FGclChapterGather.Free;
  1043. ClearObjects(FGclChapters);
  1044. FGclChapters.Free;
  1045. ClearObjects(FGclNodes);
  1046. FGclNodes.Free;
  1047. end;
  1048. function TGclControl.FindGclNode(ARec: TBillsRecord): TGclNode;
  1049. var
  1050. iIndex: Integer;
  1051. vGclNode: TGclNode;
  1052. bSameCode, bSameName, bSameUnits, bSamePrice: Boolean;
  1053. begin
  1054. Result := nil;
  1055. for iIndex := 0 to FGclNodes.Count - 1 do
  1056. begin
  1057. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1058. if (vGclNode.B_Code = ARec.B_Code.AsString) and
  1059. (vGclNode.Name = ARec.Name.AsString) and
  1060. (vGclNode.Units = ARec.Units.AsString) and
  1061. (vGclNode.Price = ARec.Price.AsFloat) and
  1062. (vGclNode.CalcType = ARec.CalcType.AsInteger)then
  1063. begin
  1064. Result := vGclNode;
  1065. Break;
  1066. end;
  1067. end;
  1068. end;
  1069. function TGclControl.FindGclChapter(AChapterID: Integer): TGclChapter;
  1070. var
  1071. iIndex: Integer;
  1072. vChapter: TGclChapter;
  1073. begin
  1074. Result := nil;
  1075. for iIndex := 0 to FGclChapters.Count - 1 do
  1076. begin
  1077. vChapter := TGclChapter(FGclChapters.Items[iIndex]);
  1078. if vChapter.ChapterID = AChapterID then
  1079. begin
  1080. Result := vChapter;
  1081. Break;
  1082. end;
  1083. end;
  1084. end;
  1085. function TGclControl.GetGclChapter(AIndex: Integer): TGclChapter;
  1086. begin
  1087. Result := TGclChapter(FGclChapters.Items[AIndex]);
  1088. end;
  1089. function TGclControl.GetGclChapterCount: Integer;
  1090. begin
  1091. Result := FGclChapters.Count;
  1092. end;
  1093. procedure TGclControl.LinkGclChapter(AGclNode: TGclNode);
  1094. var
  1095. iChapterID: Integer;
  1096. vChapter: TGclChapter;
  1097. begin
  1098. iChapterID := B_CodeToChapter(AGclNode.B_Code);
  1099. vChapter := FindGclChapter(iChapterID);
  1100. if Assigned(vChapter) then
  1101. vChapter.AddGclNode(AGclNode)
  1102. else
  1103. FOtherGcl.AddGclNode(AGclNode);
  1104. end;
  1105. function TGclControl.NewGclNode(ARec: TBillsRecord): TGclNode;
  1106. begin
  1107. Result := TGclNode.Create(FProjectCount);
  1108. FGclNodes.Add(Result);
  1109. Result.B_Code := ARec.B_Code.AsString;
  1110. Result.Name := ARec.Name.AsString;
  1111. Result.Units := ARec.Units.AsString;
  1112. Result.Price := ARec.Price.AsFloat;
  1113. Result.CalcType := ARec.CalcType.AsInteger;
  1114. LinkGclChapter(Result);
  1115. end;
  1116. procedure TGclControl.Calculate;
  1117. var
  1118. i: Integer;
  1119. begin
  1120. for i := 0 to GclChapterCount - 1 do
  1121. GclChapter[i].CalculateChapter;
  1122. CalculateChapterGather;
  1123. end;
  1124. procedure TGclControl.ReCalculateTotalPrice;
  1125. var
  1126. iGcl: Integer;
  1127. begin
  1128. for iGcl := 0 to FGclNodes.Count - 1 do
  1129. TGclNode(FGclNodes[iGcl]).Calculate;
  1130. end;
  1131. { TGclChapter }
  1132. procedure TGclChapter.AddGclNode(AGclNode: TGclNode);
  1133. begin
  1134. FGclNodes.Add(AGclNode);
  1135. end;
  1136. procedure TGclChapter.CalculateChapter;
  1137. var
  1138. iIndex, iProject: Integer;
  1139. vGclNode: TGclNode;
  1140. begin
  1141. FTotalPrice := 0;
  1142. FCurGatherTotalPrice := 0;
  1143. FEndGatherTotalPrice := 0;
  1144. FPreGatherTotalPrice := 0;
  1145. for iProject := 0 to FProjectCount - 1 do
  1146. begin
  1147. FP_TotalPrice[iProject] := 0;
  1148. FP_CurGatherTotalPrice[iProject] := 0;
  1149. FP_EndGatherTotalPrice[iProject] := 0;
  1150. end;
  1151. for iIndex := 0 to FGclNodes.Count - 1 do
  1152. begin
  1153. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1154. FTotalPrice := FTotalPrice + vGclNode.TotalPrice;
  1155. FCurGatherTotalPrice := FCurGatherTotalPrice + vGclNode.FCurGatherTotalPrice;
  1156. FEndGatherTotalPrice := FEndGatherTotalPrice + vGclNode.FEndGatherTotalPrice;
  1157. FPreGatherTotalPrice := FPreGatherTotalPrice + vGclNode.FPreGatherTotalPrice;
  1158. for iProject := 0 to FProjectCount - 1 do
  1159. begin
  1160. FP_TotalPrice[iProject] := FP_TotalPrice[iProject] + vGclNode.P_TotalPrice[iProject];
  1161. FP_CurGatherTotalPrice[iProject] := FP_CurGatherTotalPrice[iProject] + vGclNode.P_CurGatherTotalPrice[iProject];
  1162. FP_EndGatherTotalPrice[iProject] := FP_EndGatherTotalPrice[iProject] + vGclNode.P_EndGatherTotalPrice[iProject];
  1163. end;
  1164. end;
  1165. end;
  1166. constructor TGclChapter.Create(AChapterID: Integer; const AName: string;
  1167. AProjectCount: Integer);
  1168. begin
  1169. FGclNodes := TList.Create;
  1170. FChapterID := AChapterID;
  1171. if FChapterID < 19 then
  1172. begin
  1173. FChapterBegin := FChapterID * 100;
  1174. FChapterEnd := FChapterBegin + 99;
  1175. FChapterName := Format('第%d章', [FChapterBegin]);
  1176. end;
  1177. FName := AName;
  1178. FProjectCount := AProjectCount;
  1179. SetLength(FP_TotalPrice, FProjectCount);
  1180. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  1181. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  1182. end;
  1183. destructor TGclChapter.Destroy;
  1184. begin
  1185. FGclNodes.Free;
  1186. inherited;
  1187. end;
  1188. function TGclChapter.GetCurPercent: Double;
  1189. begin
  1190. if TotalPrice <> 0 then
  1191. Result := CurGatherTotalPrice/TotalPrice*100
  1192. else
  1193. Result := 0;
  1194. end;
  1195. function TGclChapter.GetEndPercent: Double;
  1196. begin
  1197. if TotalPrice <> 0 then
  1198. Result := EndGatherTotalPrice/TotalPrice*100
  1199. else
  1200. Result := 0;
  1201. end;
  1202. function TGclChapter.GetGclNode(AIndex: Integer): TGclNode;
  1203. begin
  1204. Result := TGclNode(FGclNodes.Items[AIndex]);
  1205. end;
  1206. function TGclChapter.GetGclNodeCount: Integer;
  1207. begin
  1208. Result := FGclNodes.Count;
  1209. end;
  1210. { TDealPayControl }
  1211. function TDealPayControl.AddMinusPayNode(const AName: string): TPayNode;
  1212. begin
  1213. Result := FindMinusPayNode(AName);
  1214. if not Assigned(Result) then
  1215. Result := NewMinusPayNode(AName);
  1216. end;
  1217. function TDealPayControl.AddPayNode(const AName: string;
  1218. AIsMinus: Boolean): TPayNode;
  1219. begin
  1220. if AIsMinus then
  1221. Result := AddMinusPayNode(AName)
  1222. else
  1223. Result := AddPlusPayNode(AName);
  1224. end;
  1225. function TDealPayControl.AddPlusPayNode(const AName: string): TPayNode;
  1226. begin
  1227. Result := FindPlusPayNode(AName);
  1228. if not Assigned(Result) then
  1229. Result := NewPlusPayNode(AName);
  1230. end;
  1231. procedure TDealPayControl.CalculateAll;
  1232. begin
  1233. CalculateGather(FPlusGather, FPlusPayNodes);
  1234. CalculateGather(FMinusGather, FMinusPayNodes);
  1235. end;
  1236. procedure TDealPayControl.CalculateGather(AGather: TPayNode; ANodes: TList);
  1237. var
  1238. i: Integer;
  1239. vPayNode: TPayNode;
  1240. begin
  1241. AGather.CurTotalPrice := 0;
  1242. AGather.EndTotalPrice := 0;
  1243. AGather.PreTotalPrice := 0;
  1244. for i := 0 to ANodes.Count - 1 do
  1245. begin
  1246. vPayNode := TPayNode(ANodes.Items[i]);
  1247. AGather.CurTotalPrice := AGather.CurTotalPrice + vPayNode.CurTotalPrice;
  1248. AGather.EndTotalPrice := AGather.EndTotalPrice + vPayNode.EndTotalPrice;
  1249. AGather.PreTotalPrice := AGather.PreTotalPrice + vPayNode.PreTotalPrice;
  1250. end;
  1251. end;
  1252. constructor TDealPayControl.Create;
  1253. begin
  1254. FPlusPayNodes := TList.Create;
  1255. FMinusPayNodes := TList.Create;
  1256. FPlusGather := TPayNode.Create;
  1257. FMinusGather := TPayNode.Create;
  1258. FGatherPayNode := TPayNode.Create;
  1259. FGatherPayNode.Name := '本期应付';
  1260. FCompletePayNode :=TPayNode.Create;
  1261. FCompletePayNode.Name := '本期完成计量';
  1262. end;
  1263. destructor TDealPayControl.Destroy;
  1264. begin
  1265. FCompletePayNode.Free;
  1266. FGatherPayNode.Free;
  1267. FMinusGather.Free;
  1268. FPlusGather.Free;
  1269. ClearObjects(FMinusPayNodes);
  1270. FMinusPayNodes.Free;
  1271. ClearObjects(FPlusPayNodes);
  1272. FPlusPayNodes.Free;
  1273. inherited;
  1274. end;
  1275. function TDealPayControl.FindMinusPayNode(const AName: string): TPayNode;
  1276. var
  1277. iIndex: Integer;
  1278. vPayNode: TPayNode;
  1279. begin
  1280. Result := nil;
  1281. for iIndex := 0 to FMinusPayNodes.Count -1 do
  1282. begin
  1283. vPayNode := TPayNode(FMinusPayNodes.Items[iIndex]);
  1284. if (vPayNode.Name = AName) then
  1285. begin
  1286. Result := vPayNode;
  1287. Break;
  1288. end;
  1289. end;
  1290. end;
  1291. function TDealPayControl.FindPlusPayNode(const AName: string): TPayNode;
  1292. var
  1293. iIndex: Integer;
  1294. vPayNode: TPayNode;
  1295. begin
  1296. Result := nil;
  1297. for iIndex := 0 to FPlusPayNodes.Count -1 do
  1298. begin
  1299. vPayNode := TPayNode(FPlusPayNodes.Items[iIndex]);
  1300. if (vPayNode.Name = AName) then
  1301. begin
  1302. Result := vPayNode;
  1303. Break;
  1304. end;
  1305. end;
  1306. end;
  1307. function TDealPayControl.GetMinusPayCount: Integer;
  1308. begin
  1309. Result := FMinusPayNodes.Count;
  1310. end;
  1311. function TDealPayControl.GetMinusPayNode(AIndex: Integer): TPayNode;
  1312. begin
  1313. Result := TPayNode(FMinusPayNodes.Items[AIndex]);
  1314. end;
  1315. function TDealPayControl.GetPlusPayCount: Integer;
  1316. begin
  1317. Result := FPlusPayNodes.Count;
  1318. end;
  1319. function TDealPayControl.GetPlusPayNode(AIndex: Integer): TPayNode;
  1320. begin
  1321. Result := TPayNode(FPlusPayNodes.Items[AIndex]);
  1322. end;
  1323. function TDealPayControl.NewMinusPayNode(const AName: string): TPayNode;
  1324. begin
  1325. Result := TPayNode.Create;
  1326. FMinusPayNodes.Add(Result);
  1327. Result.Name := AName;
  1328. Result.IsMinus := True;
  1329. end;
  1330. function TDealPayControl.NewPlusPayNode(const AName: string): TPayNode;
  1331. begin
  1332. Result := TPayNode.Create;
  1333. FPlusPayNodes.Add(Result);
  1334. Result.Name := AName;
  1335. Result.IsMinus := False;
  1336. end;
  1337. end.