ProjectProperty.pas 26 KB

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