ProjectProperty.pas 25 KB

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