rmHaBaiCustomizedDm.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  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);
  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);
  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);
  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);
  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);
  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. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
  419. DealPay := FDealPayControl.AddPayNode(Rec.ValueByName('Name').AsString, Rec.ValueByName('IsMinus').AsBoolean);
  420. if Assigned(StageRec) then
  421. begin
  422. DealPay.CurTotalPrice := DealPay.CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  423. DealPay.PreTotalPrice := DealPay.PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  424. DealPay.EndTotalPrice := DealPay.EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  425. end;
  426. end;
  427. end;
  428. end;
  429. procedure GatherCompletePayData;
  430. var
  431. Rec, StageRec: TsdDataRecord;
  432. begin
  433. Rec := FProjectData.DealPaymentData.DealPayRecord('本期完成计量');
  434. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
  435. if not Assigned(StageRec) then Exit;
  436. with FDealPayControl.CompletePayNode do
  437. begin
  438. CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  439. PreTotalPrice := PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  440. EndTotalPrice := EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  441. end;
  442. end;
  443. procedure GatherPayData;
  444. var
  445. Rec, StageRec: TsdDataRecord;
  446. begin
  447. Rec := FProjectData.DealPaymentData.DealPayRecord('本期应付');
  448. StageRec := FProjectData.PhaseData.PhasePayData.PayRecord(Rec.ValueByName('ID').AsInteger);
  449. if not Assigned(StageRec) then Exit;
  450. with FDealPayControl.GatherPayNode do
  451. begin
  452. CurTotalPrice := CurTotalPrice + StageRec.ValueByName(sCurField).AsFloat;
  453. PreTotalPrice := PreTotalPrice + StageRec.ValueByName(sPreField).AsFloat;
  454. EndTotalPrice := EndTotalPrice + StageRec.ValueByName(sEndField).AsFloat;
  455. end;
  456. end;
  457. begin
  458. sCurField := 'TotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  459. sPreField := 'PreTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  460. sEndField := 'EndTotalPrice' + IntToStr(FProjectData.PhaseData.AuditCount);
  461. GatherCommonDealPayData;
  462. GatherCompletePayData;
  463. GatherPayData;
  464. FDealPayControl.CalculateAll;
  465. end;
  466. procedure TrmHaBaiCustomizedData.WriteData;
  467. begin
  468. case FhbGatherType of
  469. hbgt2: WriteReport2;
  470. hbgt3: WriteReport3;
  471. hbgt3_1: WriteReport3_1;
  472. hbgt4_1: WriteReport4_1;
  473. hbgt_CS: WriteReportCounterSign;
  474. end;
  475. end;
  476. procedure TrmHaBaiCustomizedData.WriteReport2;
  477. procedure WriteGclChapter(AGclChapter: TGclChapter; const AName: string = '');
  478. begin
  479. cdsCustom2.Append;
  480. if AGclChapter.ChapterBegin > 0 then
  481. cdsCustom2Chapter.AsInteger := AGclChapter.ChapterBegin;
  482. if AName = '' then
  483. cdsCustom2Name.AsString := AGclChapter.Name
  484. else
  485. cdsCustom2Name.AsString := AName;
  486. cdsCustom2TotalPrice.AsFloat := AGclChapter.TotalPrice;
  487. cdsCustom2GTotalPrice.AsFloat := AGclChapter.TotalPrice;
  488. cdsCustom2EndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  489. cdsCustom2PreGatherTotalPrice.AsFloat := AGclChapter.PreGatherTotalPrice;
  490. cdsCustom2CurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  491. cdsCustom2Percent.AsFloat := AGclChapter.EndPercent;
  492. cdsCustom2.Post;
  493. end;
  494. procedure WriteBlankRecord(const AName: string);
  495. begin
  496. cdsCustom2.Append;
  497. cdsCustom2Name.AsString := AName;
  498. cdsCustom2.Post;
  499. end;
  500. procedure WritePayNode(APayNode: TPayNode; const AName: string = '');
  501. begin
  502. cdsCustom2.Append;
  503. if AName = '' then
  504. cdsCustom2Name.AsString := APayNode.Name
  505. else
  506. cdsCustom2Name.AsString := AName;
  507. cdsCustom2EndGatherTotalPrice.AsFloat := APayNode.EndTotalPrice;
  508. cdsCustom2PreGatherTotalPrice.AsFloat := APayNode.PreTotalPrice;
  509. cdsCustom2CurGatherTotalPrice.AsFloat := APayNode.CurTotalPrice;
  510. cdsCustom2.Post;
  511. end;
  512. procedure WriteSpecialRecord;
  513. begin
  514. cdsCustom2.Append;
  515. cdsCustom2Name.AsString := '合 计';
  516. cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice;
  517. cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice;
  518. cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice;
  519. cdsCustom2.Post;
  520. end;
  521. procedure WriteMentalNode;
  522. begin
  523. cdsCustom2.Append;
  524. cdsCustom2Name.AsString := '支 付';
  525. cdsCustom2EndGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.EndGatherTotalPrice + FDealPayControl.PlusGather.EndTotalPrice
  526. - FDealPayControl.MinusGather.EndTotalPrice;
  527. cdsCustom2PreGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.PreGatherTotalPrice + FDealPayControl.PlusGather.PreTotalPrice
  528. - FDealPayControl.MinusGather.PreTotalPrice;
  529. cdsCustom2CurGatherTotalPrice.AsFloat := FGclControl.GclChapterGather.CurGatherTotalPrice + FDealPayControl.PlusGather.CurTotalPrice
  530. - FDealPayControl.MinusGather.CurTotalPrice;
  531. cdsCustom2.Post;
  532. end;
  533. var
  534. iIndex: Integer;
  535. begin
  536. for iIndex := 0 to FGclControl.GclChapterCount - 1 do
  537. WriteGclChapter(FGclControl.GclChapter[iIndex]);
  538. WriteGclChapter(FGclControl.GclChapterGather);
  539. WriteGclChapter(FGclControl.GclChapterGather, '小 计');
  540. WriteBlankRecord('价格调整');
  541. WriteBlankRecord('违约罚金');
  542. WriteBlankRecord('迟付款利息');
  543. for iIndex := 0 to FDealPayControl.PlusPayCount - 1 do
  544. WritePayNode(FDealPayControl.PlusPayNode[iIndex]);
  545. WriteSpecialRecord;
  546. for iIndex := 0 to FDealPayControl.MinusPayCount - 1 do
  547. WritePayNode(FDealPayControl.MinusPayNode[iIndex]);
  548. //WritePayNode(FDealPayControl.GatherPayNode, '支 付');
  549. // 神经病有毛病
  550. WriteMentalNode;
  551. end;
  552. procedure TrmHaBaiCustomizedData.WriteReport3;
  553. procedure WriteChapterName(AGclChapter: TGclChapter);
  554. begin
  555. cdsCustom3.Append;
  556. cdsCustom3ChapterID.AsInteger := AGclChapter.ChapterID;
  557. cdsCustom3InnerPartID.AsInteger := 1;
  558. cdsCustom3B_Code.AsString := AGclChapter.ChapterName;
  559. cdsCustom3Name.AsString := AGclChapter.Name;
  560. cdsCustom3.Post;
  561. end;
  562. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  563. begin
  564. cdsCustom3.Append;
  565. cdsCustom3ChapterID.AsInteger := AChapterID;
  566. cdsCustom3InnerPartID.AsInteger := 2;
  567. cdsCustom3IndexCode.AsString := AGclNode.IndexCode;
  568. cdsCustom3B_Code.AsString := AGclNode.B_Code;
  569. cdsCustom3Name.AsString := AGclNode.Name;
  570. cdsCustom3Units.AsString := AGclNode.Units;
  571. cdsCustom3Price.AsFloat := AGclNode.Price;
  572. cdsCustom3Quantity.AsFloat := AGclNode.Quantity;
  573. cdsCustom3TotalPrice.AsFloat := AGclNode.TotalPrice;
  574. cdsCustom3CurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  575. cdsCustom3CurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  576. cdsCustom3EndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  577. cdsCustom3EndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  578. cdsCustom3PreGatherQuantity.AsFloat := AGclNode.PreGatherQuantity;
  579. cdsCustom3PreGatherTotalPrice.AsFloat := AGclNode.PreGatherTotalPrice;
  580. cdsCustom3Percent.AsFloat := AGclNode.EndPercent;
  581. cdsCustom3.Post;
  582. end;
  583. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  584. begin
  585. cdsCustom3.Append;
  586. cdsCustom3ChapterID.AsInteger := AGclChapter.ChapterID;
  587. cdsCustom3InnerPartID.AsInteger := 3;
  588. if AName = '' then
  589. cdsCustom3Name.AsString := AGclChapter.Name
  590. else
  591. cdsCustom3Name.AsString := AName;
  592. cdsCustom3TotalPrice.AsFloat := AGclChapter.TotalPrice;
  593. cdsCustom3CurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  594. cdsCustom3EndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  595. cdsCustom3PreGatherTotalPrice.AsFloat := AGclChapter.PreGatherTotalPrice;
  596. cdsCustom3Percent.AsFloat := AGclChapter.EndPercent;
  597. cdsCustom3.Post;
  598. end;
  599. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  600. var
  601. iGcl: Integer;
  602. begin
  603. if AGclChapter.GclNodeCount = 0 then Exit;
  604. WriteChapterName(AGclChapter);
  605. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  606. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  607. WriteChapterGather(AGclChapter, Format('%s 小计', [AGclChapter.ChapterName]));
  608. end;
  609. var
  610. iIndex: Integer;
  611. begin
  612. for iIndex := 0 to FGclControl.GclChapterCount - 1 do
  613. WriteGclChapterData(FGclControl.GclChapter[iIndex]);
  614. WriteChapterGather(FGclControl.GclChapterGather, '第100章~第900章 合计');
  615. end;
  616. procedure TrmHaBaiCustomizedData.WriteReport3_1;
  617. var
  618. iProject, iChapter: Integer;
  619. sProjectName: string;
  620. procedure WriteChapterName(AGclChapter: TGclChapter);
  621. begin
  622. cdsCustomProj.Append;
  623. cdsCustomProjProjectID.AsInteger := iProject;
  624. cdsCustomProjProjectName.AsString := sProjectName;
  625. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  626. cdsCustomProjInnerPartID.AsInteger := 1;
  627. cdsCustomProjB_Code.AsString := AGclChapter.ChapterName;
  628. cdsCustomProjName.AsString := AGclChapter.Name;
  629. cdsCustomProj.Post;
  630. end;
  631. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  632. begin
  633. cdsCustomProj.Append;
  634. cdsCustomProjProjectID.AsInteger := iProject;
  635. cdsCustomProjProjectName.AsString := sProjectName;
  636. cdsCustomProjChapterID.AsInteger := AChapterID;
  637. cdsCustomProjInnerPartID.AsInteger := 2;
  638. cdsCustomProjIndexCode.AsString := AGclNode.IndexCode;
  639. cdsCustomProjB_Code.AsString := AGclNode.B_Code;
  640. cdsCustomProjName.AsString := AGclNode.Name;
  641. cdsCustomProjUnits.AsString := AGclNode.Units;
  642. cdsCustomProjPrice.AsFloat := AGclNode.Price;
  643. cdsCustomProjQuantity.AsFloat := AGclNode.Quantity;
  644. cdsCustomProjTotalPrice.AsFloat := AGclNode.TotalPrice;
  645. cdsCustomProjCurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  646. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  647. cdsCustomProjEndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  648. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  649. cdsCustomProjP_CurGatherQuantity.AsFloat := AGclNode.P_CurGatherQuantity[iProject];
  650. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclNode.P_CurGatherTotalPrice[iProject];
  651. cdsCustomProjP_EndGatherQuantity.AsFloat := AGclNode.P_EndGatherQuantity[iProject];
  652. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclNode.P_EndGatherTotalPrice[iProject];
  653. cdsCustomProjCurPercent.AsFloat := AGclNode.CurPercent;
  654. cdsCustomProjEndPercent.AsFloat := AGclNode.EndPercent;
  655. cdsCustomProj.Post;
  656. end;
  657. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  658. begin
  659. cdsCustomProj.Append;
  660. cdsCustomProjProjectID.AsInteger := iProject;
  661. cdsCustomProjProjectName.AsString := sProjectName;
  662. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  663. cdsCustomProjInnerPartID.AsInteger := 3;
  664. if AName = '' then
  665. cdsCustomProjName.AsString := AGclChapter.Name
  666. else
  667. cdsCustomProjName.AsString := AName;
  668. cdsCustomProjTotalPrice.AsFloat := AGclChapter.TotalPrice;
  669. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  670. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  671. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclChapter.P_CurGatherTotalPrice[iProject];
  672. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclChapter.P_EndGatherTotalPrice[iProject];
  673. cdsCustomProjCurPercent.AsFloat := AGclChapter.CurPercent;
  674. cdsCustomProjEndPercent.AsFloat := AGclChapter.EndPercent;
  675. cdsCustomProj.Post;
  676. end;
  677. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  678. var
  679. iGcl: Integer;
  680. begin
  681. if AGclChapter.GclNodeCount = 0 then Exit;
  682. WriteChapterName(AGclChapter);
  683. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  684. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  685. WriteChapterGather(AGclChapter, Format('%s 小计', [AGclChapter.ChapterName]));
  686. end;
  687. begin
  688. for iProject := 0 to FGclControl.ProjectCount - 1 do
  689. begin
  690. sProjectName := FGclControl.ProjectName[iProject];
  691. for iChapter := 0 to FGclControl.GclChapterCount - 1 do
  692. WriteGclChapterData(FGclControl.GclChapter[iChapter]);
  693. WriteChapterGather(FGclControl.GclChapterGather, '第100章至第900章 合计');
  694. end;
  695. end;
  696. procedure TrmHaBaiCustomizedData.WriteReport4_1;
  697. var
  698. iProject, iChapter, iSerial: Integer;
  699. sProjectName: string;
  700. procedure WriteGclNodeData(AGclNode: TGclNode; AChapterID: Integer);
  701. begin
  702. cdsCustomProj.Append;
  703. cdsCustomProjProjectID.AsInteger := iProject;
  704. cdsCustomProjProjectName.AsString := sProjectName;
  705. cdsCustomProjChapterID.AsInteger := AChapterID;
  706. cdsCustomProjInnerPartID.AsInteger := 2;
  707. cdsCustomProjIndexCode.AsString := AGclNode.IndexCode;
  708. cdsCustomProjB_Code.AsString := AGclNode.B_Code;
  709. cdsCustomProjName.AsString := AGclNode.Name;
  710. cdsCustomProjUnits.AsString := AGclNode.Units;
  711. cdsCustomProjPrice.AsFloat := AGclNode.Price;
  712. cdsCustomProjQuantity.AsFloat := AGclNode.Quantity;
  713. cdsCustomProjTotalPrice.AsFloat := AGclNode.TotalPrice;
  714. cdsCustomProjCurGatherQuantity.AsFloat := AGclNode.CurGatherQuantity;
  715. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclNode.CurGatherTotalPrice;
  716. cdsCustomProjEndGatherQuantity.AsFloat := AGclNode.EndGatherQuantity;
  717. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclNode.EndGatherTotalPrice;
  718. cdsCustomProjP_CurGatherQuantity.AsFloat := AGclNode.P_CurGatherQuantity[iProject];
  719. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclNode.P_CurGatherTotalPrice[iProject];
  720. cdsCustomProjP_EndGatherQuantity.AsFloat := AGclNode.P_EndGatherQuantity[iProject];
  721. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclNode.P_EndGatherTotalPrice[iProject];
  722. cdsCustomProjCurPercent.AsFloat := AGclNode.CurPercent;
  723. cdsCustomProjEndPercent.AsFloat := AGclNode.EndPercent;
  724. cdsCustomProj.Post;
  725. end;
  726. procedure WriteGclChapterData(AGclChapter: TGclChapter);
  727. var
  728. iGcl: Integer;
  729. begin
  730. if AGclChapter.GclNodeCount = 0 then Exit;
  731. for iGcl := 0 to AGclChapter.GclNodeCount - 1 do
  732. WriteGclNodeData(AGclChapter.GclNode[iGcl], AGclChapter.ChapterID);
  733. end;
  734. procedure WriteChapterGather(AGclChapter: TGclChapter; const AName: string = '');
  735. begin
  736. cdsCustomProj.Append;
  737. cdsCustomProjProjectID.AsInteger := iProject;
  738. cdsCustomProjProjectName.AsString := sProjectName;
  739. cdsCustomProjChapterID.AsInteger := AGclChapter.ChapterID;
  740. cdsCustomProjInnerPartID.AsInteger := 3;
  741. if AName = '' then
  742. cdsCustomProjName.AsString := AGclChapter.Name
  743. else
  744. cdsCustomProjName.AsString := AName;
  745. cdsCustomProjTotalPrice.AsFloat := AGclChapter.TotalPrice;
  746. cdsCustomProjCurGatherTotalPrice.AsFloat := AGclChapter.CurGatherTotalPrice;
  747. cdsCustomProjEndGatherTotalPrice.AsFloat := AGclChapter.EndGatherTotalPrice;
  748. cdsCustomProjP_CurGatherTotalPrice.AsFloat := AGclChapter.P_CurGatherTotalPrice[iProject];
  749. cdsCustomProjP_EndGatherTotalPrice.AsFloat := AGclChapter.P_EndGatherTotalPrice[iProject];
  750. cdsCustomProjCurPercent.AsFloat := AGclChapter.CurPercent;
  751. cdsCustomProjEndPercent.AsFloat := AGclChapter.EndPercent;
  752. cdsCustomProj.Post;
  753. end;
  754. procedure ResortSerialNo;
  755. var
  756. iSerialNo, iProject: Integer;
  757. begin
  758. iSerialNo := 1;
  759. cdsCustomProj.First;
  760. iProject := cdsCustomProjProjectID.AsInteger;
  761. while not cdsCustomProj.Eof do
  762. begin
  763. if iProject <> cdsCustomProjProjectID.AsInteger then
  764. begin
  765. iProject := cdsCustomProjProjectID.AsInteger;
  766. iSerialNo := 1;
  767. end;
  768. cdsCustomProj.Edit;
  769. cdsCustomProjSerialNo.AsInteger := iSerialNo;
  770. cdsCustomProj.Post;
  771. Inc(iSerialNo);
  772. cdsCustomProj.Next;
  773. end;
  774. end;
  775. begin
  776. for iProject := 0 to FGclControl.ProjectCount - 1 do
  777. begin
  778. sProjectName := FGclControl.ProjectName[iProject];
  779. for iChapter := 0 to FGclControl.GclChapterCount - 1 do
  780. WriteGclChapterData(FGclControl.GclChapter[iChapter]);
  781. WriteChapterGather(FGclControl.GclChapterGather, '第100章至第900章 合计');
  782. end;
  783. ResortSerialNo;
  784. end;
  785. procedure TrmHaBaiCustomizedData.WriteFlowData;
  786. procedure AddNodeData(ANode: TMeasureBillsIDTreeNode);
  787. begin
  788. cdsCustom14.Append;
  789. cdsCustom14IndexCode.AsString := ANode.Rec.IndexCode.AsString;
  790. cdsCustom14B_Code.AsString := ANode.Rec.B_Code.AsString;
  791. cdsCustom14Name.AsString := ANode.Rec.Name.AsString;
  792. cdsCustom14Units.AsString := ANode.Rec.Units.AsString;
  793. cdsCustom14Price.AsFloat := ANode.Rec.Price.AsFloat;
  794. cdsCustom14Quantity.AsFloat := ANode.StageRec.GatherQuantity.AsFloat;
  795. cdsCustom14TotalPrice.AsFloat := ANode.StageRec.GatherTotalPrice.AsFloat;
  796. with FProjectData.PhaseData.ZJJLData do
  797. if cdsZJJL.Locate('BillsID', ANode.ID, []) then
  798. cdsCustom14CertificateCode.AsString := cdsZJJLCertificateCode.AsString;
  799. cdsCustom14.Post;
  800. end;
  801. var
  802. iIndex: Integer;
  803. vNode: TMeasureBillsIDTreeNode;
  804. begin
  805. for iIndex := 0 to FProjectData.BillsMeasureData.BillsMeasureTree.Count - 1 do
  806. begin
  807. vNode := TMeasureBillsIDTreeNode(FProjectData.BillsMeasureData.BillsMeasureTree.Items[iIndex]);
  808. if (not vNode.HasChildren) and (vNode.Rec.B_Code.AsString <> '') and
  809. Assigned(vNode.StageRec) and (vNode.StageRec.GatherTotalPrice.AsFloat <> 0) then
  810. AddNodeData(vNode);
  811. end;
  812. end;
  813. function TrmHaBaiCustomizedData.AssignAssistantData(
  814. AhbGatherType: THaBaiGatherType): TDataSet;
  815. begin
  816. Result := nil;
  817. if (AhbGatherType = hbgt_CS) and (FhbGatherType = hbgt_CS) then
  818. Result := cdsCustomCS_2;
  819. end;
  820. procedure TrmHaBaiCustomizedData.WriteReportCounterSign;
  821. procedure WriteCounterSign1;
  822. var
  823. i: Integer;
  824. PayNode: TPayNode;
  825. begin
  826. cdsCustomCS_1.Append;
  827. cdsCustomCS_1PulsPayName.AsString := '本期完成金额';
  828. cdsCustomCS_1PulsPayTotalPrice.AsFloat := FDealPayControl.CompletePayNode.CurTotalPrice;
  829. cdsCustomCS_1.Post;
  830. for i := 0 to FDealPayControl.PlusPayCount - 1 do
  831. begin
  832. PayNode := FDealPayControl.PlusPayNode[i];
  833. cdsCustomCS_1.Append;
  834. cdsCustomCS_1PulsPayName.AsString := PayNode.Name;
  835. cdsCustomCS_1PulsPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  836. cdsCustomCS_1.Post;
  837. end;
  838. cdsCustomCS_1.Append;
  839. cdsCustomCS_1PulsPayName.AsString := '迟付款利息';
  840. cdsCustomCS_1.Post;
  841. cdsCustomCS_1.First;
  842. for i := 0 to FDealPayControl.MinusPayCount - 1 do
  843. begin
  844. PayNode := FDealPayControl.MinusPayNode[i];
  845. if cdsCustomCS_1.Eof then
  846. cdsCustomCS_1.Append
  847. else
  848. cdsCustomCS_1.Edit;
  849. cdsCustomCS_1MinusPayName.AsString := PayNode.Name;
  850. cdsCustomCS_1MinusPayTotalPrice.AsFloat := PayNode.CurTotalPrice;
  851. cdsCustomCS_1.Post;
  852. cdsCustomCS_1.Next;
  853. end;
  854. end;
  855. procedure WriteCounterSign2;
  856. begin
  857. cdsCustomCS_2.Append;
  858. cdsCustomCS_2DealTotalPrice.AsFloat := FDealTotalPrice;
  859. cdsCustomCS_2EndCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.EndTotalPrice;
  860. cdsCustomCS_2PreCompleteTotalPrice.AsFloat := FDealPayControl.CompletePayNode.PreTotalPrice;
  861. cdsCustomCS_2CurPayTotalPrice.AsFloat := FDealPayControl.GatherPayNode.CurTotalPrice;
  862. cdsCustomCS_2.Post;
  863. end;
  864. begin
  865. WriteCounterSign1;
  866. WriteCounterSign2;
  867. end;
  868. { TGclNode }
  869. procedure TGclNode.Calculate;
  870. var
  871. i: Integer;
  872. begin
  873. // 金额模式下不重算
  874. if CalcType <> 0 then Exit;
  875. FTotalPrice := FPrice * FQuantity;
  876. FCurGatherTotalPrice := FPrice * FCurGatherQuantity;
  877. FEndGatherTotalPrice := FPrice * FEndGatherQuantity;
  878. FPreGatherTotalPrice := FPrice * FPreGatherQuantity;
  879. for i := 0 to FProjectCount - 1 do
  880. begin
  881. FP_TotalPrice[i] := FPrice * FP_Quantity[i];
  882. FP_CurGatherTotalPrice[i] := FPrice * FP_CurGatherQuantity[i];
  883. FP_EndGatherTotalPrice[i] := FPrice * FP_EndGatherQuantity[i];
  884. end;
  885. end;
  886. constructor TGclNode.Create(AProjectCount: Integer);
  887. begin
  888. FProjectCount := AProjectCount;
  889. SetLength(FP_Quantity, FProjectCount);
  890. SetLength(FP_TotalPrice, FProjectCount);
  891. SetLength(FP_CurGatherQuantity, FProjectCount);
  892. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  893. SetLength(FP_EndGatherQuantity, FProjectCount);
  894. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  895. end;
  896. function TGclNode.GetCurPercent: Double;
  897. begin
  898. if TotalPrice <> 0 then
  899. Result := CurGatherTotalPrice/TotalPrice*100
  900. else
  901. Result := 0;
  902. end;
  903. function TGclNode.GetEndPercent: Double;
  904. begin
  905. if TotalPrice <> 0 then
  906. Result := EndGatherTotalPrice/TotalPrice*100
  907. else
  908. Result := 0;
  909. end;
  910. procedure TGclNode.SetB_Code(const Value: string);
  911. begin
  912. FB_Code := Value;
  913. FIndexCode := B_CodeToIndexCode(FB_Code);
  914. end;
  915. { TGclControl }
  916. function TGclControl.AddGclNode(ANode: TMeasureBillsIDTreeNode; AProjectIndex: Integer): TGclNode;
  917. begin
  918. Result := FindGclNode(ANode.Rec);
  919. if not Assigned(Result) then
  920. Result := NewGclNode(ANode.Rec);
  921. with ANode.Rec do
  922. begin
  923. Result.Quantity := Result.Quantity + Quantity.AsFloat;
  924. Result.TotalPrice := Result.TotalPrice + TotalPrice.AsFloat;
  925. Result.P_Quantity[AProjectIndex] := Result.P_Quantity[AProjectIndex] + Quantity.AsFloat;
  926. Result.P_TotalPrice[AProjectIndex] := Result.P_TotalPrice[AProjectIndex] + TotalPrice.AsFloat;
  927. end;
  928. if Assigned(ANode.StageRec) then
  929. with ANode.StageRec do
  930. begin
  931. Result.CurGatherQuantity := Result.CurGatherQuantity + GatherQuantity.AsFloat;
  932. Result.CurGatherTotalPrice := Result.CurGatherTotalPrice + GatherTotalPrice.AsFloat;
  933. Result.P_CurGatherQuantity[AProjectIndex] := Result.P_CurGatherQuantity[AProjectIndex] + GatherQuantity.AsFloat;
  934. Result.P_CurGatherTotalPrice[AProjectIndex] := Result.P_CurGatherTotalPrice[AProjectIndex] + GatherTotalPrice.AsFloat;
  935. Result.EndGatherQuantity := Result.EndGatherQuantity + EndGatherQuantity.AsFloat;
  936. Result.EndGatherTotalPrice := Result.EndGatherTotalPrice + EndGatherTotalPrice.AsFloat;
  937. Result.P_EndGatherQuantity[AProjectIndex] := Result.P_EndGatherQuantity[AProjectIndex] + EndGatherQuantity.AsFloat;
  938. Result.P_EndGatherTotalPrice[AProjectIndex] := Result.P_EndGatherTotalPrice[AProjectIndex] + EndGatherTotalPrice.AsFloat;
  939. Result.PreGatherQuantity := Result.PreGatherQuantity + PreGatherQuantity.AsFloat;
  940. Result.PreGatherTotalPrice := Result.PreGatherTotalPrice + PreGatherTotalPrice.AsFloat;
  941. end;
  942. end;
  943. function TGclControl.B_CodeToChapter(const AB_Code: string): Integer;
  944. var
  945. sgs: TStrings;
  946. iFirst, iSecond: Integer;
  947. begin
  948. Result := 0;
  949. sgs := TStringList.Create;
  950. try
  951. sgs.Delimiter := '-';
  952. sgs.DelimitedText := AB_Code;
  953. iFirst := StrToIntDef(sgs.Strings[0], 0);
  954. Result := Trunc(iFirst/100);
  955. if (Result >= 90) and (Result < 100) then
  956. Result := 9;
  957. finally
  958. sgs.Free;
  959. end;
  960. end;
  961. procedure TGclControl.CalculateChapterGather;
  962. var
  963. iIndex, iProject: Integer;
  964. vGclChapter: TGclChapter;
  965. begin
  966. FGclChapterGather.TotalPrice := 0;
  967. FGclChapterGather.CurGatherTotalPrice := 0;
  968. FGclChapterGather.EndGatherTotalPrice := 0;
  969. FGclChapterGather.PreGatherTotalPrice := 0;
  970. for iProject := 0 to FProjectCount - 1 do
  971. begin
  972. FGclChapterGather.P_TotalPrice[iProject] := 0;
  973. FGclChapterGather.P_CurGatherTotalPrice[iProject] := 0;
  974. FGclChapterGather.P_EndGatherTotalPrice[iProject] := 0;
  975. end;
  976. for iIndex := 0 to FGclChapters.Count - 1 do
  977. begin
  978. vGclChapter := TGclChapter(FGclChapters.Items[iIndex]);
  979. with FGclChapterGather do
  980. begin
  981. TotalPrice := TotalPrice + vGclChapter.TotalPrice;
  982. CurGatherTotalPrice := CurGatherTotalPrice + vGclChapter.CurGatherTotalPrice;
  983. EndGatherTotalPrice := EndGatherTotalPrice + vGclChapter.EndGatherTotalPrice;
  984. PreGatherTotalPrice := PreGatherTotalPrice + vGclChapter.PreGatherTotalPrice;
  985. for iProject := 0 to FProjectCount - 1 do
  986. begin
  987. P_TotalPrice[iProject] := P_TotalPrice[iProject] + vGclChapter.P_TotalPrice[iProject];
  988. P_CurGatherTotalPrice[iProject] := P_CurGatherTotalPrice[iProject] + vGclChapter.P_CurGatherTotalPrice[iProject];
  989. P_EndGatherTotalPrice[iProject] := P_EndGatherTotalPrice[iProject] + vGclChapter.P_EndGatherTotalPrice[iProject];
  990. end;
  991. end;
  992. end;
  993. end;
  994. constructor TGclControl.Create(AProjectCount: Integer);
  995. function CreateGclChapter(AChapterID: Integer; const AName: string): TGclChapter;
  996. begin
  997. Result := TGclChapter.Create(AChapterID, AName, FProjectCount);
  998. FGclChapters.Add(Result);
  999. end;
  1000. begin
  1001. FProjectCount := AProjectCount;
  1002. SetLength(FProjectName, AProjectCount);
  1003. FGclNodes := TList.Create;
  1004. FGclChapters := TList.Create;
  1005. CreateGclChapter(1, '总 则');
  1006. CreateGclChapter(2, '路 基');
  1007. CreateGclChapter(3, '路 面');
  1008. CreateGclChapter(4, '桥梁、涵洞工程');
  1009. CreateGclChapter(5, '隧 道');
  1010. CreateGclChapter(6, '安全设计及预埋管线');
  1011. CreateGclChapter(7, '绿化及环境保护工程');
  1012. CreateGclChapter(8, '房建工程');
  1013. CreateGclChapter(9, '机电工程');
  1014. FOtherGcl := TGclChapter.Create(19, '非标准清单', FProjectCount);
  1015. FGclChapterGather := TGclChapter.Create(20, '第100章至900章合计', FProjectCount);
  1016. end;
  1017. destructor TGclControl.Destroy;
  1018. begin
  1019. FOtherGcl.Free;
  1020. FGclChapterGather.Free;
  1021. ClearObjects(FGclChapters);
  1022. FGclChapters.Free;
  1023. ClearObjects(FGclNodes);
  1024. FGclNodes.Free;
  1025. end;
  1026. function TGclControl.FindGclNode(ARec: TBillsRecord): TGclNode;
  1027. var
  1028. iIndex: Integer;
  1029. vGclNode: TGclNode;
  1030. bSameCode, bSameName, bSameUnits, bSamePrice: Boolean;
  1031. begin
  1032. Result := nil;
  1033. for iIndex := 0 to FGclNodes.Count - 1 do
  1034. begin
  1035. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1036. if (vGclNode.B_Code = ARec.B_Code.AsString) and
  1037. (vGclNode.Name = ARec.Name.AsString) and
  1038. (vGclNode.Units = ARec.Units.AsString) and
  1039. (vGclNode.Price = ARec.Price.AsFloat) and
  1040. (vGclNode.CalcType = ARec.CalcType.AsInteger)then
  1041. begin
  1042. Result := vGclNode;
  1043. Break;
  1044. end;
  1045. end;
  1046. end;
  1047. function TGclControl.FindGclChapter(AChapterID: Integer): TGclChapter;
  1048. var
  1049. iIndex: Integer;
  1050. vChapter: TGclChapter;
  1051. begin
  1052. Result := nil;
  1053. for iIndex := 0 to FGclChapters.Count - 1 do
  1054. begin
  1055. vChapter := TGclChapter(FGclChapters.Items[iIndex]);
  1056. if vChapter.ChapterID = AChapterID then
  1057. begin
  1058. Result := vChapter;
  1059. Break;
  1060. end;
  1061. end;
  1062. end;
  1063. function TGclControl.GetGclChapter(AIndex: Integer): TGclChapter;
  1064. begin
  1065. Result := TGclChapter(FGclChapters.Items[AIndex]);
  1066. end;
  1067. function TGclControl.GetGclChapterCount: Integer;
  1068. begin
  1069. Result := FGclChapters.Count;
  1070. end;
  1071. procedure TGclControl.LinkGclChapter(AGclNode: TGclNode);
  1072. var
  1073. iChapterID: Integer;
  1074. vChapter: TGclChapter;
  1075. begin
  1076. iChapterID := B_CodeToChapter(AGclNode.B_Code);
  1077. vChapter := FindGclChapter(iChapterID);
  1078. if Assigned(vChapter) then
  1079. vChapter.AddGclNode(AGclNode)
  1080. else
  1081. FOtherGcl.AddGclNode(AGclNode);
  1082. end;
  1083. function TGclControl.NewGclNode(ARec: TBillsRecord): TGclNode;
  1084. begin
  1085. Result := TGclNode.Create(FProjectCount);
  1086. FGclNodes.Add(Result);
  1087. Result.B_Code := ARec.B_Code.AsString;
  1088. Result.Name := ARec.Name.AsString;
  1089. Result.Units := ARec.Units.AsString;
  1090. Result.Price := ARec.Price.AsFloat;
  1091. Result.CalcType := ARec.CalcType.AsInteger;
  1092. LinkGclChapter(Result);
  1093. end;
  1094. procedure TGclControl.Calculate;
  1095. var
  1096. i: Integer;
  1097. begin
  1098. for i := 0 to GclChapterCount - 1 do
  1099. GclChapter[i].CalculateChapter;
  1100. CalculateChapterGather;
  1101. end;
  1102. procedure TGclControl.ReCalculateTotalPrice;
  1103. var
  1104. iGcl: Integer;
  1105. begin
  1106. for iGcl := 0 to FGclNodes.Count - 1 do
  1107. TGclNode(FGclNodes[iGcl]).Calculate;
  1108. end;
  1109. { TGclChapter }
  1110. procedure TGclChapter.AddGclNode(AGclNode: TGclNode);
  1111. begin
  1112. FGclNodes.Add(AGclNode);
  1113. end;
  1114. procedure TGclChapter.CalculateChapter;
  1115. var
  1116. iIndex, iProject: Integer;
  1117. vGclNode: TGclNode;
  1118. begin
  1119. FTotalPrice := 0;
  1120. FCurGatherTotalPrice := 0;
  1121. FEndGatherTotalPrice := 0;
  1122. FPreGatherTotalPrice := 0;
  1123. for iProject := 0 to FProjectCount - 1 do
  1124. begin
  1125. FP_TotalPrice[iProject] := 0;
  1126. FP_CurGatherTotalPrice[iProject] := 0;
  1127. FP_EndGatherTotalPrice[iProject] := 0;
  1128. end;
  1129. for iIndex := 0 to FGclNodes.Count - 1 do
  1130. begin
  1131. vGclNode := TGclNode(FGclNodes.Items[iIndex]);
  1132. FTotalPrice := FTotalPrice + vGclNode.TotalPrice;
  1133. FCurGatherTotalPrice := FCurGatherTotalPrice + vGclNode.FCurGatherTotalPrice;
  1134. FEndGatherTotalPrice := FEndGatherTotalPrice + vGclNode.FEndGatherTotalPrice;
  1135. FPreGatherTotalPrice := FPreGatherTotalPrice + vGclNode.FPreGatherTotalPrice;
  1136. for iProject := 0 to FProjectCount - 1 do
  1137. begin
  1138. FP_TotalPrice[iProject] := FP_TotalPrice[iProject] + vGclNode.P_TotalPrice[iProject];
  1139. FP_CurGatherTotalPrice[iProject] := FP_CurGatherTotalPrice[iProject] + vGclNode.P_CurGatherTotalPrice[iProject];
  1140. FP_EndGatherTotalPrice[iProject] := FP_EndGatherTotalPrice[iProject] + vGclNode.P_EndGatherTotalPrice[iProject];
  1141. end;
  1142. end;
  1143. end;
  1144. constructor TGclChapter.Create(AChapterID: Integer; const AName: string;
  1145. AProjectCount: Integer);
  1146. begin
  1147. FGclNodes := TList.Create;
  1148. FChapterID := AChapterID;
  1149. if FChapterID < 19 then
  1150. begin
  1151. FChapterBegin := FChapterID * 100;
  1152. FChapterEnd := FChapterBegin + 99;
  1153. FChapterName := Format('第%d章', [FChapterBegin]);
  1154. end;
  1155. FName := AName;
  1156. FProjectCount := AProjectCount;
  1157. SetLength(FP_TotalPrice, FProjectCount);
  1158. SetLength(FP_CurGatherTotalPrice, FProjectCount);
  1159. SetLength(FP_EndGatherTotalPrice, FProjectCount);
  1160. end;
  1161. destructor TGclChapter.Destroy;
  1162. begin
  1163. FGclNodes.Free;
  1164. inherited;
  1165. end;
  1166. function TGclChapter.GetCurPercent: Double;
  1167. begin
  1168. if TotalPrice <> 0 then
  1169. Result := CurGatherTotalPrice/TotalPrice*100
  1170. else
  1171. Result := 0;
  1172. end;
  1173. function TGclChapter.GetEndPercent: Double;
  1174. begin
  1175. if TotalPrice <> 0 then
  1176. Result := EndGatherTotalPrice/TotalPrice*100
  1177. else
  1178. Result := 0;
  1179. end;
  1180. function TGclChapter.GetGclNode(AIndex: Integer): TGclNode;
  1181. begin
  1182. Result := TGclNode(FGclNodes.Items[AIndex]);
  1183. end;
  1184. function TGclChapter.GetGclNodeCount: Integer;
  1185. begin
  1186. Result := FGclNodes.Count;
  1187. end;
  1188. { TDealPayControl }
  1189. function TDealPayControl.AddMinusPayNode(const AName: string): TPayNode;
  1190. begin
  1191. Result := FindMinusPayNode(AName);
  1192. if not Assigned(Result) then
  1193. Result := NewMinusPayNode(AName);
  1194. end;
  1195. function TDealPayControl.AddPayNode(const AName: string;
  1196. AIsMinus: Boolean): TPayNode;
  1197. begin
  1198. if AIsMinus then
  1199. Result := AddMinusPayNode(AName)
  1200. else
  1201. Result := AddPlusPayNode(AName);
  1202. end;
  1203. function TDealPayControl.AddPlusPayNode(const AName: string): TPayNode;
  1204. begin
  1205. Result := FindPlusPayNode(AName);
  1206. if not Assigned(Result) then
  1207. Result := NewPlusPayNode(AName);
  1208. end;
  1209. procedure TDealPayControl.CalculateAll;
  1210. begin
  1211. CalculateGather(FPlusGather, FPlusPayNodes);
  1212. CalculateGather(FMinusGather, FMinusPayNodes);
  1213. end;
  1214. procedure TDealPayControl.CalculateGather(AGather: TPayNode; ANodes: TList);
  1215. var
  1216. i: Integer;
  1217. vPayNode: TPayNode;
  1218. begin
  1219. AGather.CurTotalPrice := 0;
  1220. AGather.EndTotalPrice := 0;
  1221. AGather.PreTotalPrice := 0;
  1222. for i := 0 to ANodes.Count - 1 do
  1223. begin
  1224. vPayNode := TPayNode(ANodes.Items[i]);
  1225. AGather.CurTotalPrice := AGather.CurTotalPrice + vPayNode.CurTotalPrice;
  1226. AGather.EndTotalPrice := AGather.EndTotalPrice + vPayNode.EndTotalPrice;
  1227. AGather.PreTotalPrice := AGather.PreTotalPrice + vPayNode.PreTotalPrice;
  1228. end;
  1229. end;
  1230. constructor TDealPayControl.Create;
  1231. begin
  1232. FPlusPayNodes := TList.Create;
  1233. FMinusPayNodes := TList.Create;
  1234. FPlusGather := TPayNode.Create;
  1235. FMinusGather := TPayNode.Create;
  1236. FGatherPayNode := TPayNode.Create;
  1237. FGatherPayNode.Name := '本期应付';
  1238. FCompletePayNode :=TPayNode.Create;
  1239. FCompletePayNode.Name := '本期完成计量';
  1240. end;
  1241. destructor TDealPayControl.Destroy;
  1242. begin
  1243. FCompletePayNode.Free;
  1244. FGatherPayNode.Free;
  1245. FMinusGather.Free;
  1246. FPlusGather.Free;
  1247. ClearObjects(FMinusPayNodes);
  1248. FMinusPayNodes.Free;
  1249. ClearObjects(FPlusPayNodes);
  1250. FPlusPayNodes.Free;
  1251. inherited;
  1252. end;
  1253. function TDealPayControl.FindMinusPayNode(const AName: string): TPayNode;
  1254. var
  1255. iIndex: Integer;
  1256. vPayNode: TPayNode;
  1257. begin
  1258. Result := nil;
  1259. for iIndex := 0 to FMinusPayNodes.Count -1 do
  1260. begin
  1261. vPayNode := TPayNode(FMinusPayNodes.Items[iIndex]);
  1262. if (vPayNode.Name = AName) then
  1263. begin
  1264. Result := vPayNode;
  1265. Break;
  1266. end;
  1267. end;
  1268. end;
  1269. function TDealPayControl.FindPlusPayNode(const AName: string): TPayNode;
  1270. var
  1271. iIndex: Integer;
  1272. vPayNode: TPayNode;
  1273. begin
  1274. Result := nil;
  1275. for iIndex := 0 to FPlusPayNodes.Count -1 do
  1276. begin
  1277. vPayNode := TPayNode(FPlusPayNodes.Items[iIndex]);
  1278. if (vPayNode.Name = AName) then
  1279. begin
  1280. Result := vPayNode;
  1281. Break;
  1282. end;
  1283. end;
  1284. end;
  1285. function TDealPayControl.GetMinusPayCount: Integer;
  1286. begin
  1287. Result := FMinusPayNodes.Count;
  1288. end;
  1289. function TDealPayControl.GetMinusPayNode(AIndex: Integer): TPayNode;
  1290. begin
  1291. Result := TPayNode(FMinusPayNodes.Items[AIndex]);
  1292. end;
  1293. function TDealPayControl.GetPlusPayCount: Integer;
  1294. begin
  1295. Result := FPlusPayNodes.Count;
  1296. end;
  1297. function TDealPayControl.GetPlusPayNode(AIndex: Integer): TPayNode;
  1298. begin
  1299. Result := TPayNode(FPlusPayNodes.Items[AIndex]);
  1300. end;
  1301. function TDealPayControl.NewMinusPayNode(const AName: string): TPayNode;
  1302. begin
  1303. Result := TPayNode.Create;
  1304. FMinusPayNodes.Add(Result);
  1305. Result.Name := AName;
  1306. Result.IsMinus := True;
  1307. end;
  1308. function TDealPayControl.NewPlusPayNode(const AName: string): TPayNode;
  1309. begin
  1310. Result := TPayNode.Create;
  1311. FPlusPayNodes.Add(Result);
  1312. Result.Name := AName;
  1313. Result.IsMinus := False;
  1314. end;
  1315. end.