|
@@ -84,7 +84,7 @@ implementation
|
|
|
|
|
|
uses
|
|
|
ProjectData, PhaseData, Math, ZhAPI, BillsCommand, BGLSelectFrm,
|
|
|
- BGLDm, UtilMethods, mDataRecord, ConstUnit;
|
|
|
+ BGLDm, UtilMethods, mDataRecord, ConstUnit, Variants;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
@@ -274,35 +274,33 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
DataSetErrorMessage(Allow, '变更单价已被锁定,不允许修改!');
|
|
|
end;
|
|
|
|
|
|
- procedure CheckNodeWritable;
|
|
|
+ procedure CheckNodeWritable(ANode: TBillsIDTreeNode);
|
|
|
var
|
|
|
- vNode: TBillsIDTreeNode;
|
|
|
iCreatePhase: Integer;
|
|
|
begin
|
|
|
- vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(GetBillsID));
|
|
|
- iCreatePhase := vNode.Rec.ValueByName('CreatePhaseID').AsInteger;
|
|
|
+ iCreatePhase := ANode.Rec.ValueByName('CreatePhaseID').AsInteger;
|
|
|
|
|
|
- if vNode.ID = iPriceMarginID then
|
|
|
+ if ANode.ID = iPriceMarginID then
|
|
|
DataSetErrorMessage(Allow, sBills_PMHint);
|
|
|
|
|
|
if SameText('B_Code', AColumn.FieldName) or
|
|
|
SameText('Name', AColumn.FieldName) or
|
|
|
SameText('Units', AColumn.FieldName) then
|
|
|
- if vNode.Rec.ValueByName('AddQcQuantity').AsFloat <> 0 then
|
|
|
+ if ANode.Rec.ValueByName('AddQcQuantity').AsFloat <> 0 then
|
|
|
DataSetErrorMessage(Allow, '该清单已进行过变更,不可修改清单编号、名称、单位!');
|
|
|
if not Allow then Exit;
|
|
|
|
|
|
if SameText('Price', AColumn.FieldName) then
|
|
|
- if vNode.Rec.ValueByName('AddGatherTotalPrice').AsFloat <> 0 then
|
|
|
+ if ANode.Rec.ValueByName('AddGatherTotalPrice').AsFloat <> 0 then
|
|
|
DataSetErrorMessage(Allow, '该清单已经计量,不可修改清单单价!');
|
|
|
if not Allow then Exit;
|
|
|
|
|
|
if SameText('NewPrice', AColumn.FieldName) then
|
|
|
- if vNode.Rec.ValueByName('AddPcTotalPrice').AsFloat <> 0 then
|
|
|
+ if ANode.Rec.ValueByName('AddPcTotalPrice').AsFloat <> 0 then
|
|
|
DataSetErrorMessage(Allow, '该清单已经计量,不可修改清单变更单价!');
|
|
|
if not Allow then Exit;
|
|
|
|
|
|
- if vNode.HasChildren then
|
|
|
+ if ANode.HasChildren then
|
|
|
begin
|
|
|
if Text = '' then
|
|
|
Exit
|
|
@@ -317,7 +315,7 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
// 目前仅允许本期合同计量,可直接输入金额
|
|
|
if SameText('CurDealTotalPrice', AColumn.FieldName) then
|
|
|
begin
|
|
|
- if not vNode.TotalPriceEnable then
|
|
|
+ if not ANode.TotalPriceEnable then
|
|
|
DataSetErrorMessage(Allow, '该清单不可直接输入金额,如需直接输入金额,请先清空所有数量、单价!');
|
|
|
end
|
|
|
else if SameText('CurDealQuantity', AColumn.FieldName) or
|
|
@@ -325,7 +323,7 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
SameText('CurPcQuantity', AColumn.FieldName) or
|
|
|
SameText('Price', AColumn.FieldName) then
|
|
|
begin
|
|
|
- if not vNode.CountPriceEnable then
|
|
|
+ if not ANode.CountPriceEnable then
|
|
|
DataSetErrorMessage(Allow, '该清单不可输入数量单价,如需使用数量×单价计算,请先清空所有直接输入的金额!');
|
|
|
end;
|
|
|
end;
|
|
@@ -337,7 +335,7 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
DataSetErrorMessage(Allow, Format('该清单为第%d期新增清单,不可填写本期合同计量数据!', [iCreatePhase]));}
|
|
|
end;
|
|
|
|
|
|
- procedure SetQuantity(const AField: string);
|
|
|
+ procedure SetQuantity(ANode: TBillsIDTreeNode; const AField: string);
|
|
|
var
|
|
|
vNode: TBillsIDTreeNode;
|
|
|
begin
|
|
@@ -358,15 +356,11 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
AValue.Owner.ValueByName(AField + 'Formula').AsString := Text;
|
|
|
Text := FloatToStr(QuantityRoundTo(EvaluateExprs(Text)));
|
|
|
end;
|
|
|
-
|
|
|
- vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(GetBillsID));
|
|
|
- if vNode.Rec.CalcType.AsInteger <> 0 then
|
|
|
- vNode.Rec.CalcType.AsInteger := 0;
|
|
|
+
|
|
|
+ ANode.Rec.SetIntValue(ANode.Rec.CalcType, 0);
|
|
|
end;
|
|
|
|
|
|
- procedure SetTotalPrice(const AField: string);
|
|
|
- var
|
|
|
- vNode: TBillsIDTreeNode;
|
|
|
+ procedure SetTotalPrice(ANode: TBillsIDTreeNode; const AField: string);
|
|
|
begin
|
|
|
// 变更应选择变更令
|
|
|
if SameText(AField , 'Qc') or SameText(AField , 'Pc') then
|
|
@@ -386,31 +380,33 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
Text := FloatToStr(TotalPriceRoundTo(EvaluateExprs(Text)));
|
|
|
end;
|
|
|
|
|
|
- vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(GetBillsID));
|
|
|
- if vNode.Rec.CalcType.AsInteger <> 1 then
|
|
|
- vNode.Rec.CalcType.AsInteger := 1;
|
|
|
+ ANode.Rec.SetIntValue(ANode.Rec.CalcType, 1);
|
|
|
end;
|
|
|
|
|
|
- procedure DoCurChanged;
|
|
|
+ procedure DoCurChanged(ANode: TBillsIDTreeNode);
|
|
|
begin
|
|
|
if SameText(AColumn.FieldName, 'CurDealQuantity') then
|
|
|
- SetQuantity('Deal')
|
|
|
+ SetQuantity(ANode, 'Deal')
|
|
|
else if SameText(AColumn.FieldName, 'CurQcQuantity') then
|
|
|
- SetQuantity('Qc')
|
|
|
+ SetQuantity(ANode, 'Qc')
|
|
|
else if SameText(AColumn.FieldName, 'CurPcQuantity') then
|
|
|
- SetQuantity('Pc')
|
|
|
+ SetQuantity(ANode, 'Pc')
|
|
|
else if SameText(AColumn.FieldName, 'CurDealTotalPrice') then
|
|
|
- SetTotalPrice('Deal')
|
|
|
+ SetTotalPrice(ANode, 'Deal')
|
|
|
else if SameText(AColumn.FieldName, 'CurQcTotalPrice') then
|
|
|
- SetTotalPrice('Qc')
|
|
|
+ SetTotalPrice(ANode, 'Qc')
|
|
|
else if SameText(AColumn.FieldName, 'CurPcTotalPrice') then
|
|
|
- SetTotalPrice('Pc')
|
|
|
+ SetTotalPrice(ANode, 'Pc')
|
|
|
else if (Pos('DgnQuantity', AColumn.FieldName) > 0) or
|
|
|
SameText(AColumn.FieldName, 'Quantity') then
|
|
|
Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)))
|
|
|
else if SameText(AColumn.FieldName, 'NewPrice') or
|
|
|
SameText(AColumn.FieldName, 'Price') then
|
|
|
- Text := FloatToStr(PriceRoundTo(StrToFloatDef(Text, 0)));
|
|
|
+ Text := FloatToStr(PriceRoundTo(StrToFloatDef(Text, 0)))
|
|
|
+ else if SameText(AColumn.FieldName, 'Code') then
|
|
|
+ BillsMeasureTree.RecodeChildrenCode(ANode, AValue.AsString, Text)
|
|
|
+ else if SameText(AColumn.FieldName, 'B_Code') then
|
|
|
+ BillsMeasureTree.RecodeChildrenB_Code(ANode, AValue.AsString, Text);
|
|
|
end;
|
|
|
|
|
|
function CheckValidData: Boolean;
|
|
@@ -424,23 +420,28 @@ procedure TBillsMeasureData.sdvBillsMeasureSetText(var Text: String;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+var
|
|
|
+ vNode: TBillsIDTreeNode;
|
|
|
begin
|
|
|
if not Assigned(AValue) then Exit;
|
|
|
// 修改后数据与原数据相同则不提交
|
|
|
if not CheckValidData then
|
|
|
Allow := False;
|
|
|
if not Allow then Exit;
|
|
|
+
|
|
|
+ vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(GetBillsID));
|
|
|
|
|
|
CheckLockedData;
|
|
|
if not Allow then Exit;
|
|
|
|
|
|
- CheckNodeWritable;
|
|
|
+ CheckNodeWritable(vNode);
|
|
|
if not Allow then Exit;
|
|
|
|
|
|
Text := Trim(Text);
|
|
|
if Pos('=', Text) = 1 then
|
|
|
Text := Copy(Text, 2, Length(Text) - 1);
|
|
|
- DoCurChanged;
|
|
|
+
|
|
|
+ DoCurChanged(vNode);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureData.sdvBillsMeasureNeedLookupRecord(
|
|
@@ -804,8 +805,10 @@ end;
|
|
|
procedure TBillsMeasureData.sdvBillsMeasureAfterValueChanged(
|
|
|
AValue: TsdValue);
|
|
|
var
|
|
|
- stnNode: TsdIDTreeNode;
|
|
|
+ vNode: TBillsIDTreeNode;
|
|
|
begin
|
|
|
+ vNode := TBillsIDTreeNode(BillsMeasureTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger));
|
|
|
+
|
|
|
if TProjectData(FProjectData).PhaseData.Active then
|
|
|
begin
|
|
|
if AValue.FieldName = 'Price' then
|
|
@@ -814,10 +817,12 @@ begin
|
|
|
StageData.ReCalculate(AValue.Owner.ValueByName('ID').AsInteger);
|
|
|
end;
|
|
|
if Pos('DgnQuantity1', AValue.FieldName) > 0 then
|
|
|
- begin
|
|
|
- stnNode := BillsMeasureTree.FindNode(AValue.Owner.ValueByName('ID').AsInteger);
|
|
|
- CalcAddDgnPrice(stnNode);
|
|
|
- end;
|
|
|
+ CalcAddDgnPrice(vNode);
|
|
|
+
|
|
|
+ if (AValue.FieldName = 'Code') then
|
|
|
+ BillsMeasureTree.RecodeChildrenCode(vNode, VarToStrDef(AValue.OldValue, ''), AValue.AsString)
|
|
|
+ else if (AValue.FieldName = 'B_Code') then
|
|
|
+ BillsMeasureTree.RecodeChildrenB_Code(vNode, VarToStrDef(AValue.OldValue, ''), AValue.AsString);
|
|
|
end;
|
|
|
|
|
|
procedure TBillsMeasureData.ExpandCurPhase;
|