|
@@ -4,7 +4,7 @@ unit GclBillsGatherModel;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- Classes, mDataRecord, BillsTree;
|
|
|
+ Classes, mDataRecord, BillsTree, CalcDecimal;
|
|
|
|
|
|
type
|
|
|
TGatherDataWriteEvent = procedure (AGcls, AXmjs: TList) of object;
|
|
@@ -248,6 +248,7 @@ type
|
|
|
FDeal_BGLQuantity: Double;
|
|
|
FDeal_BGLTotalPrice: Double;
|
|
|
FDeal_BGLPercent: Double;
|
|
|
+ FDecimal: TCalcDecimal;
|
|
|
|
|
|
procedure InitCalculate;
|
|
|
procedure GatherDetailGcl;
|
|
@@ -265,7 +266,7 @@ type
|
|
|
function GetLeafXmjCount: Integer;
|
|
|
function GetLeafXmj(AIndex: Integer): TLeafXmjNode;
|
|
|
public
|
|
|
- constructor Create(AID: Integer);
|
|
|
+ constructor Create(AID: Integer; ADecimal: TCalcDecimal);
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
procedure AddLeafXmj(ALeafXmj: TLeafXmjNode);
|
|
@@ -343,6 +344,8 @@ type
|
|
|
|
|
|
property DetailBGLCount: Integer read GetDetailBGLCount;
|
|
|
property DetailBGL[AIndex: Integer]: TDetailBGLNode read GetDetailBGL;
|
|
|
+
|
|
|
+ property Decimal: TCalcDecimal read FDecimal;
|
|
|
end;
|
|
|
|
|
|
TGclGatherModel = class
|
|
@@ -361,6 +364,7 @@ type
|
|
|
FNewDetailBGLID: Integer;
|
|
|
|
|
|
FWriteGatherData: TGatherDataWriteEvent;
|
|
|
+ FDecimal: TCalcDecimal;
|
|
|
|
|
|
procedure BeginGather;
|
|
|
procedure EndGather;
|
|
@@ -399,6 +403,8 @@ type
|
|
|
|
|
|
// 在使用汇总模型的数据单元创建数据库写入方法,并赋值,否则汇总数据不写入
|
|
|
property WriteGatherData: TGatherDataWriteEvent read FWriteGatherData write FWriteGatherData;
|
|
|
+
|
|
|
+ property Decimal: TCalcDecimal read FDecimal;
|
|
|
end;
|
|
|
|
|
|
implementation
|
|
@@ -488,6 +494,7 @@ begin
|
|
|
FBillsTree := TProjectData(FProjectData).BillsMeasureData.BillsMeasureTree;
|
|
|
FGatherDeal := False;
|
|
|
FGatherBGL := False;
|
|
|
+ FDecimal := TProjectData(FProjectData).ProjProperties.DecimalManager.Common;
|
|
|
end;
|
|
|
|
|
|
destructor TGclGatherModel.Destroy;
|
|
@@ -681,7 +688,7 @@ end;
|
|
|
function TGclGatherModel.NewGclNode(const AB_Code, AName, AUnits: string;
|
|
|
APrice: Double): TGclNode;
|
|
|
begin
|
|
|
- Result := TGclNode.Create(FNewGclID);
|
|
|
+ Result := TGclNode.Create(FNewGclID, FDecimal);
|
|
|
FGcls.Add(Result);
|
|
|
Result.B_Code := TrimRight(AB_Code);
|
|
|
Result.Name := TrimRight(AName);
|
|
@@ -748,21 +755,22 @@ end;
|
|
|
|
|
|
procedure TGclNode.CalculateOther;
|
|
|
begin
|
|
|
- FDeal_BGLQuantity := FQuantity + FBGLQuantity;
|
|
|
- FDeal_BGLTotalPrice := FTotalPrice + FBGLTotalPrice;
|
|
|
+ FDeal_BGLQuantity := Decimal.Quantity.RoundTo(FQuantity + FBGLQuantity);
|
|
|
+ FDeal_BGLTotalPrice := Decimal.TotalPrice.RoundTo(FTotalPrice + FBGLTotalPrice);
|
|
|
if FDeal_BGLTotalPrice <> 0 then
|
|
|
FDeal_BGLPercent := CommonRoundTo(FEndGatherTotalPrice/FDeal_BGLTotalPrice*100, -2)
|
|
|
else
|
|
|
FDeal_BGLPercent := 0;
|
|
|
end;
|
|
|
|
|
|
-constructor TGclNode.Create(AID: Integer);
|
|
|
+constructor TGclNode.Create(AID: Integer; ADecimal: TCalcDecimal);
|
|
|
begin
|
|
|
FID := AID;
|
|
|
FDetailGcls := TList.Create;
|
|
|
FDetailDeals := TList.Create;
|
|
|
FDetailBGLs := TList.Create;
|
|
|
FLeafXmjs := TList.Create;
|
|
|
+ FDecimal := ADecimal;
|
|
|
end;
|
|
|
|
|
|
destructor TGclNode.Destroy;
|