ProjectProperty.pas 25 KB

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