|
@@ -558,22 +558,33 @@ procedure TBillsCompileData.sdvBillsCompileSetText(var Text: String;
|
|
|
Allow := False;
|
|
|
end;
|
|
|
|
|
|
- procedure SetQuantity(const APre: string);
|
|
|
+ procedure SetQuantity(const AFieldName: string);
|
|
|
+ var
|
|
|
+ sPre: string;
|
|
|
begin
|
|
|
- // 0号台账改为三项合计后,不记录输入的公式,但允许公式计算
|
|
|
+ sPre := StringReplace(AFieldName, 'Quantity', '', [rfIgnoreCase, rfReplaceAll]);
|
|
|
if CheckStringNull(Text) or CheckNumeric(Text) then
|
|
|
Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)))
|
|
|
else
|
|
|
begin
|
|
|
- ARecord.ValueByName(APre + 'Formula').AsString := Text;
|
|
|
+ ARecord.ValueByName(sPre + 'Formula').AsString := Text;
|
|
|
Text := FloatToStr(QuantityRoundTo(EvaluateExprs(Text)));
|
|
|
end;
|
|
|
ARecord.ValueByName('CalcType').AsInteger := 0;
|
|
|
end;
|
|
|
|
|
|
- procedure SetTotalPrice;
|
|
|
+ procedure SetTotalPrice(const AFieldName: string);
|
|
|
+ var
|
|
|
+ sPre: string;
|
|
|
begin
|
|
|
- Text := FloatToStr(TotalPriceRoundTo(StrToFloatDef(Text, 0)));
|
|
|
+ sPre := StringReplace(AFieldName, 'TotalPrice', '', [rfIgnoreCase, rfReplaceAll]);
|
|
|
+ if CheckStringNull(Text) or CheckNumeric(Text) then
|
|
|
+ Text := FloatToStr(TotalPriceRoundTo(StrToFloatDef(Text, 0)))
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ ARecord.ValueByName(sPre + 'Formula').AsString := Text;
|
|
|
+ Text := FloatToStr(TotalPriceRoundTo(EvaluateExprs(Text)));
|
|
|
+ end;
|
|
|
ARecord.ValueByName('CalcType').AsInteger := 1;
|
|
|
end;
|
|
|
|
|
@@ -589,16 +600,14 @@ procedure TBillsCompileData.sdvBillsCompileSetText(var Text: String;
|
|
|
|
|
|
procedure DoCurChanged;
|
|
|
begin
|
|
|
- if SameText(AColumn.FieldName, 'OrgQuantity') then
|
|
|
- SetQuantity('Org')
|
|
|
- else if SameText(AColumn.FieldName, 'MisQuantity') then
|
|
|
- SetQuantity('Mis')
|
|
|
- else if SameText(AColumn.FieldName, 'OthQuantity') then
|
|
|
- SetQuantity('Oth')
|
|
|
+ if SameText(AColumn.FieldName, 'OrgQuantity') or
|
|
|
+ SameText(AColumn.FieldName, 'MisQuantity') or
|
|
|
+ SameText(AColumn.FieldName, 'OthQuantity')then
|
|
|
+ SetQuantity(AColumn.FieldName)
|
|
|
else if SameText(AColumn.FieldName, 'OrgTotalPrice') or
|
|
|
SameText(AColumn.FieldName, 'MisTotalPrice') or
|
|
|
SameText(AColumn.FieldName, 'OthTotalPrice') then
|
|
|
- SetTotalPrice
|
|
|
+ SetTotalPrice(AColumn.FieldName)
|
|
|
else if Pos('DgnQuantity', AColumn.FieldName) = 1 then
|
|
|
SetDgnQuantity
|
|
|
else if SameText(AColumn.FieldName, 'Price') then
|