ProjectProperty.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. unit ProjectProperty;
  2. interface
  3. uses
  4. Classes, SysUtils, Variants, DB, ADODB, ZhAPI, CalcDecimal;
  5. type
  6. TPropertyInquiry = class
  7. private
  8. FInquriyQuery: TADOQuery;
  9. FConnection: TADOConnection;
  10. FTableName: string;
  11. FSql: string;
  12. function GetValue(const AName: string): Variant;
  13. procedure SetValue(const AName: string; const Value: Variant);
  14. function GetNewID: Integer;
  15. procedure ExecuteSql(AIsSelect: Boolean = True);
  16. function CheckPropertyExist(const AName: string): Boolean;
  17. public
  18. constructor Create(AConnection: TADOConnection);
  19. destructor Destroy; override;
  20. property TableName: string read FTableName write FTableName;
  21. property Value[const AName: string]: Variant read GetValue write SetValue; default;
  22. end;
  23. TProjProperties = class
  24. private
  25. FProjectData: TObject;
  26. FPropertyInqurity: TPropertyInquiry;
  27. FShowPriceChange: Boolean;
  28. FPhaseCount: Integer;
  29. FLockedLedgerData: Boolean;
  30. FStartedSubsist: Double;
  31. FContractPrice: Double;
  32. FMaterialSubsist: Double;
  33. FBLegal: string;
  34. FDealName: string;
  35. FDealIndex: string;
  36. FCLegal: string;
  37. FCDate: string;
  38. FBName: string;
  39. FProjectName: string;
  40. FBDate: string;
  41. FCName: string;
  42. FSDate: string;
  43. FSName: string;
  44. FSLegal: string;
  45. FLoadLength: Double;
  46. FLaneCount: Integer;
  47. FLoadLevel: Integer;
  48. FEndPeg: string;
  49. FStartPeg: string;
  50. FShowBGLCode: Boolean;
  51. FZJJLPreText: string;
  52. FUnlockInfoPassword: string;
  53. FPhaseIndex: Integer;
  54. FShowDesignQuantity: Boolean;
  55. FDealType: string;
  56. FShowAlias: Boolean;
  57. FDecimalManager: TDecimalManager;
  58. FTotalPriceDigit: Integer;
  59. FTotalPriceFormat: string;
  60. FQuantityDigit: Integer;
  61. FQuantityFormat: string;
  62. FPriceDigit: Integer;
  63. FPriceFormat: string;
  64. FUpdateFlag: Integer;
  65. FPriceMarginStartPhaseID: Integer;
  66. FShowReportShading: Boolean;
  67. FReportShading: string;
  68. FBaseline: string;
  69. FDeadline: string;
  70. FDealPayAloneDigit: Boolean;
  71. FReportShowState: Boolean;
  72. FReportShowStateWithoutReply: Boolean;
  73. FReportShowStateText: string;
  74. FDealPhase: string;
  75. FSLegal_2: string;
  76. FCName_2: string;
  77. FCDate_2: string;
  78. FCLegal_2: string;
  79. FSName_2: string;
  80. FSDate_2: string;
  81. FShowOverRange: Boolean;
  82. FShowApprovalCode: Boolean;
  83. FSubsistStart: Integer;
  84. function GetDisplayFormat(ADigit: Integer): string;
  85. procedure LoadBaseProperties;
  86. procedure LoadViewProperties;
  87. procedure LoadDealInfo;
  88. procedure LoadTechParameters;
  89. procedure LoadCalcParameters;
  90. procedure LoadDateTime;
  91. procedure SaveDealInfo;
  92. procedure SaveTechParameters;
  93. procedure SaveCalcParameters;
  94. procedure SetShowPriceChange(const Value: Boolean);
  95. procedure SetPhaseCount(const Value: Integer);
  96. procedure SetLockedLedgerData(const Value: Boolean);
  97. function GetFinalAuditCount: Integer;
  98. procedure SetFinalAuditCount(const Value: Integer);
  99. function GetAuditStatus: Integer;
  100. procedure SetAuditStatus(const Value: Integer);
  101. function GetAuditStatusStr: string;
  102. procedure SetContractPrice(const Value: Double);
  103. procedure SetMaterialSubsist(const Value: Double);
  104. procedure SetStartedSubsist(const Value: Double);
  105. function GetAuditCompany: string;
  106. procedure SetAuditCompany(const Value: string);
  107. procedure SetShowBGLCode(const Value: Boolean);
  108. procedure SetZJJLPreText(const Value: string);
  109. procedure SetUnlockInfoPassword(const Value: string);
  110. procedure SetPhaseIndex(const Value: Integer);
  111. procedure SetShowDesignQuantity(const Value: Boolean);
  112. procedure SetShowAlias(const Value: Boolean);
  113. procedure SetQuantityDigit(const Value: Integer);
  114. procedure SetTotalPriceDigit(const Value: Integer);
  115. procedure SetUpdateFlag(const Value: Integer);
  116. procedure SetReportShading(const Value: string);
  117. procedure SetShowReportShading(const Value: Boolean);
  118. procedure SetBaseline(const Value: string);
  119. procedure SetDeadline(const Value: string);
  120. procedure SetDealPayAloneDigit(const Value: Boolean);
  121. procedure SetReportShowState(const Value: Boolean);
  122. procedure SetReportShowStateText(const Value: string);
  123. procedure SetReportShowStateWithoutReply(const Value: Boolean);
  124. procedure SetShowOverRange(const Value: Boolean);
  125. procedure SetShowApprovalCode(const Value: Boolean);
  126. procedure SetSubsistStart(const Value: Integer);
  127. public
  128. constructor Create(AProjectData: TObject);
  129. destructor Destroy; override;
  130. procedure Open(AConnection: TADOConnection);
  131. procedure Save;
  132. procedure Reload;
  133. function GetBoolPropertyDef(const AName: string; ADef: Boolean): Boolean;
  134. function GetIntPropertyDef(const AName: string; ADef: Integer): Integer;
  135. function GetStrPropertyDef(const AName, ADef: string): string;
  136. function GetFloatPropertyDef(const AName: string; ADef: Double): Double;
  137. {Submit-Audit-Reply}
  138. // 共计终审计量期数
  139. property FinalAuditCount: Integer read GetFinalAuditCount write SetFinalAuditCount;
  140. // 当前审核状态
  141. property AuditStatus: Integer read GetAuditStatus write SetAuditStatus;
  142. property AuditStatusStr: string read GetAuditStatusStr;
  143. property AuditCompany: string read GetAuditCompany write SetAuditCompany;
  144. {合同信息}
  145. // 建设项目名称
  146. property ProjectName: string read FProjectName write FProjectName;
  147. // 合同名称
  148. property DealName: string read FDealName write FDealName;
  149. // 合同编号
  150. property DealIndex: string read FDealIndex write FDealIndex;
  151. // 合同类别
  152. property DealType: string read FDealType write FDealType;
  153. // 建设单位
  154. // 名称
  155. property BName: string read FBName write FBName;
  156. // 法人代表
  157. property BLegal: string read FBLegal write FBLegal;
  158. // 签订日期
  159. property BDate: string read FBDate write FBDate;
  160. // 施工单位: 后改为承包单位1
  161. // 名称
  162. property CName: string read FCName write FCName;
  163. // 法人代表
  164. property CLegal: string read FCLegal write FCLegal;
  165. // 签订日期
  166. property CDate: string read FCDate write FCDate;
  167. // 承包单位2
  168. // 名称
  169. property CName_2: string read FCName_2 write FCName_2;
  170. // 法人代表
  171. property CLegal_2: string read FCLegal_2 write FCLegal_2;
  172. // 签订日期
  173. property CDate_2: string read FCDate_2 write FCDate_2;
  174. // 监理单位:改为监理单位1
  175. // 名称
  176. property SName: string read FSName write FSName;
  177. // 法人代表
  178. property SLegal: string read FSLegal write FSLegal;
  179. // 签订日期
  180. property SDate: string read FSDate write FSDate;
  181. // 监理单位2
  182. // 名称
  183. property SName_2: string read FSName_2 write FSName_2;
  184. // 法人代表
  185. property SLegal_2: string read FSLegal_2 write FSLegal_2;
  186. // 签订日期
  187. property SDate_2: string read FSDate_2 write FSDate_2;
  188. {技术参数}
  189. // 公路等级
  190. property LoadLevel: Integer read FLoadLevel write FLoadLevel;
  191. // 起点桩号
  192. property StartPeg: string read FStartPeg write FStartPeg;
  193. // 终点桩号
  194. property EndPeg: string read FEndPeg write FEndPeg;
  195. // 长度
  196. property LoadLength: Double read FLoadLength write FLoadLength;
  197. // 车道数
  198. property LaneCount: Integer read FLaneCount write FLaneCount;
  199. // 合同工期
  200. property DealPhase: string read FDealPhase write FDealPhase;
  201. {合同支付}
  202. property ContractPrice: Double read FContractPrice write SetContractPrice;
  203. property MaterialSubsist: Double read FMaterialSubsist write SetMaterialSubsist;
  204. property StartedSubsisit: Double read FStartedSubsist write SetStartedSubsist;
  205. //property SubsistStart: Integer read FSubsistStart write SetSubsistStart;
  206. property SubsistStart: Integer read FSubsistStart write SetSubsistStart;
  207. {密码}
  208. // 解锁台账编辑节点密码
  209. property UnlockInfoPassword: string read FUnlockInfoPassword write SetUnlockInfoPassword;
  210. {小数位数}
  211. // 是否单独设置合同支付小数位数
  212. property DealPayAloneDigit: Boolean read FDealPayAloneDigit write SetDealPayAloneDigit;
  213. property DecimalManager: TDecimalManager read FDecimalManager;
  214. // 数量
  215. property QuantityDigit: Integer read FQuantityDigit write SetQuantityDigit;
  216. property QuantityFormat: string read FQuantityFormat;
  217. // 金额
  218. property TotalPriceDigit: Integer read FTotalPriceDigit write SetTotalPriceDigit;
  219. property TotalPriceFormat: string read FTotalPriceFormat;
  220. // 单价
  221. property PriceDigit: Integer read FPriceDigit;
  222. property PriceFormat: string read FPriceFormat;
  223. {时间}
  224. // 起始时间
  225. property Baseline: string read FBaseline write SetBaseline;
  226. // 结束时间
  227. property Deadline: string read FDeadline write SetDeadline;
  228. {升级标记}
  229. property UpdateFlag: Integer read FUpdateFlag write SetUpdateFlag;
  230. {Base}
  231. // 计量期数
  232. property PhaseIndex: Integer read FPhaseIndex write SetPhaseIndex;
  233. property PhaseCount: Integer read FPhaseCount write SetPhaseCount;
  234. property ZJJLPreText: string read FZJJLPreText write SetZJJLPreText;
  235. {View}
  236. // Can Modify In ProjectPropertiesFrm
  237. property ShowPriceChange: Boolean read FShowPriceChange write SetShowPriceChange;
  238. property ShowBGLCode: Boolean read FShowBGLCode write SetShowBGLCode;
  239. property ShowDesignQuantity: Boolean read FShowDesignQuantity write SetShowDesignQuantity;
  240. property ShowAlias: Boolean read FShowAlias write SetShowAlias;
  241. property ShowOverRange: Boolean read FShowOverRange write SetShowOverRange;
  242. property ShowApprovalCode: Boolean read FShowApprovalCode write SetShowApprovalCode;
  243. property ShowReportShading: Boolean read FShowReportShading write SetShowReportShading;
  244. property ReportShading: string read FReportShading write SetReportShading;
  245. property ReportShowState: Boolean read FReportShowState write SetReportShowState;
  246. property ReportShowStateText: string read FReportShowStateText write SetReportShowStateText;
  247. property ReportShowStateWithoutReply: Boolean read FReportShowStateWithoutReply write SetReportShowStateWithoutReply;
  248. end;
  249. implementation
  250. { TPropertyInquiry }
  251. function TPropertyInquiry.CheckPropertyExist(const AName: string): Boolean;
  252. begin
  253. Result := False;
  254. FSql := Format('Select * From %s Where Name = ''%s''', [TableName, UpperCase(AName)]);
  255. ExecuteSql;
  256. Result := FInquriyQuery.RecordCount > 0;
  257. FInquriyQuery.Close;
  258. end;
  259. constructor TPropertyInquiry.Create(AConnection: TADOConnection);
  260. begin
  261. FConnection := AConnection;
  262. FInquriyQuery := TADOQuery.Create(nil);
  263. FInquriyQuery.Connection := FConnection;
  264. end;
  265. destructor TPropertyInquiry.Destroy;
  266. begin
  267. FInquriyQuery.Free;
  268. inherited;
  269. end;
  270. procedure TPropertyInquiry.ExecuteSql(AIsSelect: Boolean);
  271. begin
  272. FInquriyQuery.Close;
  273. FInquriyQuery.SQL.Clear;
  274. FInquriyQuery.SQL.Add(FSql);
  275. if AIsSelect then
  276. FInquriyQuery.Open
  277. else
  278. FInquriyQuery.ExecSQL;
  279. end;
  280. function TPropertyInquiry.GetNewID: Integer;
  281. begin
  282. FSql := Format('Select Max(ID) As MaxID From %s', [TableName]);
  283. ExecuteSql;
  284. if FInquriyQuery.RecordCount > 0 then
  285. Result := FInquriyQuery.FieldByName('MaxID').AsInteger + 1
  286. else
  287. Result := 0;
  288. FInquriyQuery.Close;
  289. end;
  290. function TPropertyInquiry.GetValue(const AName: string): Variant;
  291. begin
  292. FSql := Format('Select * From %s Where Name = ''%s''', [TableName, UpperCase(AName)]);
  293. ExecuteSql;
  294. if FInquriyQuery.RecordCount > 0 then
  295. Result := FInquriyQuery.FieldByName('PropValue').AsVariant
  296. else
  297. Result := Null;
  298. FInquriyQuery.Close;
  299. end;
  300. procedure TPropertyInquiry.SetValue(const AName: string;
  301. const Value: Variant);
  302. function GetUpdateSql: string;
  303. begin
  304. if VarIsNull(Value) then
  305. Result := Format('Delete From %s Where Name = ''%s''', [TableName, UpperCase(AName)])
  306. else
  307. begin
  308. if CheckPropertyExist(AName) then
  309. Result := Format('Update %s Set PropValue = ''%s'' Where Name = ''%s''',
  310. [TableName, VarToStr(Value), UpperCase(AName)])
  311. else
  312. Result := Format('Insert Into %s (ID, Name, PropValue) Values (%d, ''%s'', ''%s'')',
  313. [TableName, GetNewID, UpperCase(AName), VarToStr(Value)]);
  314. end;
  315. end;
  316. begin
  317. FSql := GetUpdateSql;
  318. ExecuteSql(False);
  319. FInquriyQuery.Close;
  320. end;
  321. { TProjProperties }
  322. constructor TProjProperties.Create(AProjectData: TObject);
  323. begin
  324. FProjectData := AProjectData;
  325. FDecimalManager := TDecimalManager.Create(AProjectData);
  326. end;
  327. destructor TProjProperties.Destroy;
  328. begin
  329. FPropertyInqurity.Free;
  330. FDecimalManager.Free;
  331. inherited;
  332. end;
  333. function TProjProperties.GetAuditCompany: string;
  334. begin
  335. Result := GetStrPropertyDef('AuditCompany', '');
  336. end;
  337. function TProjProperties.GetAuditStatus: Integer;
  338. begin
  339. Result := GetIntPropertyDef('AuditStatus', -1);
  340. end;
  341. function TProjProperties.GetAuditStatusStr: string;
  342. begin
  343. case AuditStatus of
  344. -1:
  345. if PhaseCount = 0 then
  346. Result := '原报'
  347. else
  348. Result := '批复';
  349. 0:
  350. Result := '原报';
  351. else
  352. Result := Format('%d 审', [AuditStatus]);
  353. end;
  354. end;
  355. function TProjProperties.GetBoolPropertyDef(const AName: string;
  356. ADef: Boolean): Boolean;
  357. var
  358. vProperty: Variant;
  359. begin
  360. vProperty := FPropertyInqurity.Value[AName];
  361. if VarIsNull(vProperty) then
  362. Result := ADef
  363. else
  364. Result := Boolean(vProperty);
  365. end;
  366. function TProjProperties.GetDisplayFormat(ADigit: Integer): string;
  367. begin
  368. case ADigit of
  369. 0: Result := '0';
  370. 1: Result := '0.#';
  371. 2: Result := '0.##';
  372. 3: Result := '0.###';
  373. 4: Result := '0.####';
  374. 5: Result := '0.#####';
  375. 6: Result := '0.######';
  376. 7: Result := '0.#######';
  377. 8: Result := '0.########';
  378. 9: Result := '0.#########';
  379. else
  380. Result := '0.##########';
  381. end;
  382. end;
  383. function TProjProperties.GetFinalAuditCount: Integer;
  384. begin
  385. Result := GetIntPropertyDef('FinalAuditCount', 0);
  386. end;
  387. function TProjProperties.GetFloatPropertyDef(const AName: string;
  388. ADef: Double): Double;
  389. var
  390. sValue: Variant;
  391. begin
  392. sValue := GetStrPropertyDef(AName, FloatToStr(ADef));
  393. Result := StrToFloatDef(sValue, ADef);
  394. end;
  395. function TProjProperties.GetIntPropertyDef(const AName: string;
  396. ADef: Integer): Integer;
  397. var
  398. sValue: Variant;
  399. begin
  400. sValue := GetStrPropertyDef(AName, IntToStr(ADef));
  401. Result := StrToIntDef(sValue, ADef);
  402. end;
  403. function TProjProperties.GetStrPropertyDef(const AName,
  404. ADef: string): string;
  405. var
  406. vProperty: Variant;
  407. begin
  408. vProperty := FPropertyInqurity.Value[AName];
  409. Result := VarToStrDef(vProperty, ADef);
  410. end;
  411. procedure TProjProperties.LoadBaseProperties;
  412. begin
  413. FPhaseCount := GetIntPropertyDef('PhaseCount', 0);
  414. FLockedLedgerData := GetBoolPropertyDef('LockedLedgerData', False);
  415. FContractPrice := GetFloatPropertyDef('ContractPrice', 0);
  416. FStartedSubsist := GetFloatPropertyDef('StartedSubsist', 0);
  417. FMaterialSubsist := GetFloatPropertyDef('MaterialSubsist', 0);
  418. FSubsistStart := GetIntPropertyDef('SubsistStart', 0);
  419. FZJJLPreText := GetStrPropertyDef('ZJJLPreText', '');
  420. end;
  421. procedure TProjProperties.LoadCalcParameters;
  422. begin
  423. FDealPayAloneDigit := GetBoolPropertyDef('DealPayAloneDigit', False);
  424. FQuantityDigit := GetIntPropertyDef('QuantityDigit', 3);
  425. FQuantityFormat := GetDisplayFormat(FQuantityDigit);
  426. FTotalPriceDigit := GetIntPropertyDef('TotalPriceDigit', 0);
  427. FTotalPriceFormat := GetDisplayFormat(FTotalPriceDigit);
  428. FPriceDigit := 2;
  429. FPriceFormat := GetDisplayFormat(FPriceDigit);
  430. with FDecimalManager.Common do
  431. begin
  432. Quantity.Digit := GetIntPropertyDef('QuantityDigit', 3);
  433. TotalPrice.Digit := GetIntPropertyDef('TotalPriceDigit', 0);
  434. Price.Digit := 2;
  435. end;
  436. with FDecimalManager do
  437. begin
  438. Compile.Quantity.Digit := GetIntPropertyDef('QuantityDigit1', Common.Quantity.Digit);
  439. Compile.TotalPrice.Digit := GetIntPropertyDef('TotalPriceDigit1', Common.TotalPrice.Digit);
  440. Compile.Price.Digit := 2;
  441. end;
  442. with FDecimalManager do
  443. begin
  444. PriceMargin.Quantity.Digit := Common.Quantity.Digit;
  445. PriceMargin.TotalPrice.Digit := Common.TotalPrice.Digit;
  446. PriceMargin.Price.Digit := 3;//GetIntPropertyDef('PM_PriceDigit', Common.Price.Digit);
  447. end;
  448. with FDecimalManager do
  449. begin
  450. DealPay.TotalPrice.Digit := GetIntPropertyDef('DealPayTPDigit', Common.TotalPrice.Digit);
  451. if FDealPayAloneDigit then
  452. DealPay.RelaCalcDecimal := nil
  453. else
  454. DealPay.RelaCalcDecimal := Common;
  455. end;
  456. end;
  457. procedure TProjProperties.LoadDateTime;
  458. begin
  459. FBaseline := GetStrPropertyDef('Baseline', '');
  460. FDeadline := GetStrPropertyDef('Deadline', '');
  461. end;
  462. procedure TProjProperties.LoadDealInfo;
  463. begin
  464. FProjectName := GetStrPropertyDef('ProjectName', '');
  465. FDealName := GetStrPropertyDef('DealName', '');
  466. FDealIndex := GetStrPropertyDef('DealIndex', '');
  467. FDealType := GetStrPropertyDef('DealType', '');
  468. FBName := GetStrPropertyDef('BName', '');
  469. FBLegal := GetStrPropertyDef('BLegal', '');
  470. FBDate := GetStrPropertyDef('BDate', '');
  471. FCName := GetStrPropertyDef('CName', '');
  472. FCLegal := GetStrPropertyDef('CLegal', '');
  473. FCDate := GetStrPropertyDef('CDate', '');
  474. FCName_2 := GetStrPropertyDef('CName_2', '');
  475. FCLegal_2 := GetStrPropertyDef('CLegal_2', '');
  476. FCDate_2 := GetStrPropertyDef('CDate_2', '');
  477. FSName := GetStrPropertyDef('SName', '');
  478. FSLegal := GetStrPropertyDef('SLegal', '');
  479. FSDate := GetStrPropertyDef('SDate', '');
  480. FSName_2 := GetStrPropertyDef('SName_2', '');
  481. FSLegal_2 := GetStrPropertyDef('SLegal_2', '');
  482. FSDate_2 := GetStrPropertyDef('SDate_2', '');
  483. end;
  484. procedure TProjProperties.LoadTechParameters;
  485. begin
  486. FLoadLevel := GetIntPropertyDef('LoadLevel', 0);
  487. FStartPeg := GetStrPropertyDef('StartPeg', '');
  488. FEndPeg := GetStrPropertyDef('EndPeg', '');
  489. FLoadLength := GetFloatPropertyDef('LoadLength', 0);
  490. FLaneCount := GetIntPropertyDef('LaneCount', 0);
  491. FDealPhase := GetStrPropertyDef('DealPhase', '');
  492. end;
  493. procedure TProjProperties.LoadViewProperties;
  494. begin
  495. FShowPriceChange := GetBoolPropertyDef('ShowPriceChange', False);
  496. FShowBGLCode := GetBoolPropertyDef('ShowBGLCode', True);
  497. FShowDesignQuantity := GetBoolPropertyDef('ShowDesignQuantity', False);
  498. FShowAlias := GetBoolPropertyDef('ShowAlias', False);
  499. FShowOverRange := GetBoolPropertyDef('ShowOverRange', True);
  500. FShowApprovalCode := GetBoolPropertyDef('ShowApprovalCode', False);
  501. FShowReportShading := GetBoolPropertyDef('ShowReportShading', False);
  502. FReportShading := GetStrPropertyDef('ReportShading', '');
  503. FReportShowState := GetBoolPropertyDef('ReportShowState', True);
  504. FReportShowStateText := GetStrPropertyDef('ReportShowStateText', '标段未批复');
  505. FReportShowStateWithoutReply := GetBoolPropertyDef('ReportShowStateWithoutReply', True);
  506. end;
  507. procedure TProjProperties.Open(AConnection: TADOConnection);
  508. begin
  509. FPropertyInqurity := TPropertyInquiry.Create(AConnection);
  510. FPropertyInqurity.TableName := 'ProjProperties';
  511. LoadBaseProperties;
  512. LoadViewProperties;
  513. LoadDealInfo;
  514. LoadTechParameters;
  515. LoadCalcParameters;
  516. LoadDateTime;
  517. FUnlockInfoPassword := GetStrPropertyDef('UnlockInfoPassword', '');
  518. FUpdateFlag := GetIntPropertyDef('UpdateFlag', 0);
  519. end;
  520. procedure TProjProperties.Reload;
  521. begin
  522. LoadBaseProperties;
  523. LoadViewProperties;
  524. LoadDealInfo;
  525. LoadTechParameters;
  526. LoadCalcParameters;
  527. FUnlockInfoPassword := GetStrPropertyDef('UnlockInfoPassword', '');
  528. end;
  529. procedure TProjProperties.Save;
  530. begin
  531. SaveDealInfo;
  532. SaveTechParameters;
  533. SaveCalcParameters;
  534. // 无意义,不可删除,Sql最后一句不执行,写多一句,以保证完整执行
  535. FPropertyInqurity.Value['Complete'] := True;
  536. end;
  537. procedure TProjProperties.SaveCalcParameters;
  538. begin
  539. if FPhaseCount > 0 then Exit;
  540. FPropertyInqurity.Value['DealPayAloneDigit'] := FDealPayAloneDigit;
  541. with FDecimalManager do
  542. begin
  543. {FPropertyInqurity.Value['QuantityDigit'] := Common.Quantity.Digit;
  544. FPropertyInqurity.Value['TotalPriceDigit'] := Common.TotalPrice.Digit;
  545. FPropertyInqurity.Value['QuantityDigit1'] := Compile.Quantity.Digit;
  546. FPropertyInqurity.Value['TotalPriceDigit1'] := Compile.TotalPrice.Digit;}
  547. //FPropertyInqurity.Value['PM_PriceDigit'] := PriceMargin.Price.Digit;
  548. FPropertyInqurity.Value['DealPayTPDigit'] := DealPay.TotalPrice.Digit;
  549. end;
  550. end;
  551. procedure TProjProperties.SaveDealInfo;
  552. begin
  553. FPropertyInqurity.Value['ProjectName'] := FProjectName;
  554. FPropertyInqurity.Value['DealName'] := FDealName;
  555. FPropertyInqurity.Value['DealIndex'] := FDealIndex;
  556. FPropertyInqurity.Value['DealType'] := FDealType;
  557. FPropertyInqurity.Value['BName'] := FBName;
  558. FPropertyInqurity.Value['BLegal'] := FBLegal;
  559. FPropertyInqurity.Value['BDate'] := FBDate;
  560. FPropertyInqurity.Value['CName'] := FCName;
  561. FPropertyInqurity.Value['CLegal'] := FCLegal;
  562. FPropertyInqurity.Value['CDate'] := FCDate;
  563. FPropertyInqurity.Value['CName_2'] := FCName_2;
  564. FPropertyInqurity.Value['CLegal_2'] := FCLegal_2;
  565. FPropertyInqurity.Value['CDate_2'] := FCDate_2;
  566. FPropertyInqurity.Value['SName'] := FSName;
  567. FPropertyInqurity.Value['SLegal'] := FSLegal;
  568. FPropertyInqurity.Value['SDate'] := FSDate;
  569. FPropertyInqurity.Value['SName_2'] := FSName_2;
  570. FPropertyInqurity.Value['SLegal_2'] := FSLegal_2;
  571. FPropertyInqurity.Value['SDate_2'] := FSDate_2;
  572. end;
  573. procedure TProjProperties.SaveTechParameters;
  574. begin
  575. FPropertyInqurity.Value['LoadLevel'] := FLoadLevel;
  576. FPropertyInqurity.Value['StartPeg'] := FStartPeg;
  577. FPropertyInqurity.Value['EndPeg'] := FEndPeg;
  578. FPropertyInqurity.Value['LoadLength'] := FLoadLength;
  579. FPropertyInqurity.Value['LaneCount'] := FLaneCount;
  580. FPropertyInqurity.Value['DealPhase'] := FDealPhase;
  581. end;
  582. procedure TProjProperties.SetAuditCompany(const Value: string);
  583. begin
  584. FPropertyInqurity.Value['AuditCompany'] := Value;
  585. end;
  586. procedure TProjProperties.SetAuditStatus(const Value: Integer);
  587. begin
  588. FPropertyInqurity.Value['AuditStatus'] := Value;
  589. end;
  590. procedure TProjProperties.SetBaseline(const Value: string);
  591. begin
  592. FBaseline := Value;
  593. FPropertyInqurity.Value['Baseline'] := Value;
  594. end;
  595. procedure TProjProperties.SetContractPrice(const Value: Double);
  596. begin
  597. FContractPrice := Value;
  598. FPropertyInqurity.Value['ContractPrice'] := Value;
  599. end;
  600. procedure TProjProperties.SetDeadline(const Value: string);
  601. begin
  602. FDeadline := Value;
  603. FPropertyInqurity.Value['Deadline'] := Value;
  604. end;
  605. procedure TProjProperties.SetDealPayAloneDigit(const Value: Boolean);
  606. begin
  607. FDealPayAloneDigit := Value;
  608. if Value then
  609. DecimalManager.DealPay.RelaCalcDecimal := nil
  610. else
  611. DecimalManager.DealPay.RelaCalcDecimal := DecimalManager.Common;
  612. end;
  613. procedure TProjProperties.SetFinalAuditCount(const Value: Integer);
  614. begin
  615. FPropertyInqurity.Value['FinalAuditCount'] := Value;
  616. end;
  617. procedure TProjProperties.SetLockedLedgerData(const Value: Boolean);
  618. begin
  619. FLockedLedgerData := Value;
  620. FPropertyInqurity.Value['LockedLedgerData'] := Value;
  621. end;
  622. procedure TProjProperties.SetMaterialSubsist(const Value: Double);
  623. begin
  624. FMaterialSubsist := Value;
  625. FPropertyInqurity.Value['MaterialSubsist'] := Value;
  626. end;
  627. procedure TProjProperties.SetPhaseCount(const Value: Integer);
  628. begin
  629. FPhaseCount := Value;
  630. FPropertyInqurity.Value['PhaseCount'] := Value;
  631. end;
  632. procedure TProjProperties.SetPhaseIndex(const Value: Integer);
  633. begin
  634. FPhaseIndex := Value;
  635. FPropertyInqurity.Value['PhaseIndex'] := Value;
  636. end;
  637. procedure TProjProperties.SetQuantityDigit(const Value: Integer);
  638. begin
  639. FQuantityDigit := Value;
  640. FPropertyInqurity.Value['QuantityDigit'] := Value;
  641. FQuantityFormat := GetDisplayFormat(FQuantityDigit);
  642. end;
  643. procedure TProjProperties.SetReportShading(const Value: string);
  644. begin
  645. FReportShading := Value;
  646. FPropertyInqurity.Value['ReportShading'] := Value;
  647. end;
  648. procedure TProjProperties.SetReportShowState(const Value: Boolean);
  649. begin
  650. FReportShowState := Value;
  651. FPropertyInqurity.Value['ReportShowState'] := Value;
  652. end;
  653. procedure TProjProperties.SetReportShowStateText(const Value: string);
  654. begin
  655. FReportShowStateText := Value;
  656. FPropertyInqurity.Value['ReportShowStateText'] := Value;
  657. end;
  658. procedure TProjProperties.SetReportShowStateWithoutReply(
  659. const Value: Boolean);
  660. begin
  661. FReportShowStateWithoutReply := Value;
  662. FPropertyInqurity.Value['ReportShowStateWithoutReply'] := Value;
  663. end;
  664. procedure TProjProperties.SetShowAlias(const Value: Boolean);
  665. begin
  666. FShowAlias := Value;
  667. FPropertyInqurity.Value['ShowAlias'] := Value;
  668. end;
  669. procedure TProjProperties.SetShowApprovalCode(const Value: Boolean);
  670. begin
  671. FShowApprovalCode := Value;
  672. FPropertyInqurity.Value['ShowApprovalCode'] := Value;
  673. end;
  674. procedure TProjProperties.SetShowBGLCode(const Value: Boolean);
  675. begin
  676. FShowBGLCode := Value;
  677. FPropertyInqurity.Value['ShowBGLCode'] := Value;
  678. end;
  679. procedure TProjProperties.SetShowDesignQuantity(const Value: Boolean);
  680. begin
  681. FShowDesignQuantity := Value;
  682. FPropertyInqurity.Value['ShowDesignQuantity'] := Value;
  683. end;
  684. procedure TProjProperties.SetShowOverRange(const Value: Boolean);
  685. begin
  686. FShowOverRange := Value;
  687. FPropertyInqurity.Value['ShowOverRange'] := Value;
  688. end;
  689. procedure TProjProperties.SetShowPriceChange(const Value: Boolean);
  690. begin
  691. FShowPriceChange := Value;
  692. FPropertyInqurity.Value['ShowPriceChange'] := Value;
  693. end;
  694. procedure TProjProperties.SetShowReportShading(const Value: Boolean);
  695. begin
  696. FShowReportShading := Value;
  697. FPropertyInqurity.Value['ShowReportShading'] := Value;
  698. end;
  699. procedure TProjProperties.SetStartedSubsist(const Value: Double);
  700. begin
  701. FStartedSubsist := Value;
  702. FPropertyInqurity.Value['StartedSubsist'] := Value;
  703. end;
  704. procedure TProjProperties.SetSubsistStart(const Value: Integer);
  705. begin
  706. FSubsistStart := Value;
  707. FPropertyInqurity.Value['SubsistStart'] := Value;
  708. end;
  709. procedure TProjProperties.SetTotalPriceDigit(const Value: Integer);
  710. begin
  711. FTotalPriceDigit := Value;
  712. FPropertyInqurity.Value['TotalPriceDigit'] := Value;
  713. FTotalPriceFormat := GetDisplayFormat(FTotalPriceDigit);
  714. end;
  715. procedure TProjProperties.SetUnlockInfoPassword(const Value: string);
  716. begin
  717. FUnlockInfoPassword := Value;
  718. FPropertyInqurity.Value['UnlockInfoPassword'] := Value;
  719. end;
  720. procedure TProjProperties.SetUpdateFlag(const Value: Integer);
  721. begin
  722. FUpdateFlag := Value;
  723. FPropertyInqurity.Value['UpdateFlag'] := Value;
  724. end;
  725. procedure TProjProperties.SetZJJLPreText(const Value: string);
  726. begin
  727. FZJJLPreText := Value;
  728. FPropertyInqurity.Value['ZJJLPreText'] := Value;
  729. end;
  730. end.