浏览代码

合同支付,新增一期,保留公式策略调整

MaiXinRong 4 年之前
父节点
当前提交
a194774847
共有 1 个文件被更改,包括 16 次插入2 次删除
  1. 16 2
      DataModules/PhasePayDm.pas

+ 16 - 2
DataModules/PhasePayDm.pas

@@ -183,7 +183,8 @@ begin
     Rec := sddPhasePay.Records[iIndex];
     if GetCalcType(Rec.ValueByName('ID').AsInteger) in [0, 3] then
       Calculate(Rec.ValueByName('ID').AsInteger);
-  end;  CalculateCurPay;
+  end;
+  CalculateCurPay;
 end;
 
 procedure TPhasePayData.Calculate(AID: Integer);
@@ -477,6 +478,19 @@ end;
 
 procedure TPhasePayData.CopyPrePhasePayData(const APreFile: string;
   APreFinalIndex: Integer);
+
+  function CheckFormulaWithBase(AFormula: string): Boolean;
+  var
+    sFormula: string;
+  begin
+    sFormula := StringReplace(AFormula, 'htj', '', [rfReplaceAll, rfIgnoreCase]);
+    sFormula := StringReplace(sFormula, 'kgyfk', '', [rfReplaceAll, rfIgnoreCase]);
+    sFormula := StringReplace(sFormula, 'clyfk', '', [rfReplaceAll, rfIgnoreCase]);
+    sFormula := StringReplace(sFormula, 'ybbqwc', '', [rfReplaceAll, rfIgnoreCase]);
+    sFormula := StringReplace(sFormula, 'bqwc', '', [rfReplaceAll, rfIgnoreCase]);
+    Result := Length(sFormula) < Length(AFormula);
+  end;
+
 const
   sCopySql = 'Insert Into %s (' +
              '    ID, PreTotalPrice0, EndTotalPrice0, Formula0, StopCalc' +
@@ -498,7 +512,7 @@ begin
     for i := 0 to sddPhasePay.RecordCount - 1 do
     begin
       vRec := sddPhasePay.Records[i];
-      if TryStrToFloat(vRec.ValueByName('Formula0').AsString, fValue) then
+      if not CheckFormulaWithBase(vRec.ValueByName('Formula0').AsString) and GetCalcType(Rec.ValueByName('ID').AsInteger) = 2 then
         vRec.ValueByName('Formula0').AsString := '';
     end;
   end;