Kaynağa Gözat

详细工料,小数位数控制

MaiXinRong 10 yıl önce
ebeveyn
işleme
df82318169

+ 2 - 0
DataModules/LeafXmjGlDm.dfm

@@ -166,6 +166,8 @@ object LeafXmjGlData: TLeafXmjGlData
       item
         FieldName = 'AddPAL_Total'
       end>
+    OnGetText = sdvLeafXmjGLGetText
+    OnSetText = sdvLeafXmjGLSetText
     Left = 153
     Top = 128
   end

+ 37 - 1
DataModules/LeafXmjGlDm.pas

@@ -15,6 +15,10 @@ type
     sdvLeafXmj: TsdDataView;
     procedure sdvLeafXmjCurrentChanged(ARecord: TsdDataRecord);
     procedure sddLeafXmjGLGetRecordClass(var ARecordClass: TsdRecordClass);
+    procedure sdvLeafXmjGLSetText(var Text: String; ARecord: TsdDataRecord;
+      AValue: TsdValue; AColumn: TsdViewColumn; var Allow: Boolean);
+    procedure sdvLeafXmjGLGetText(var Text: String; ARecord: TsdDataRecord;
+      AValue: TsdValue; AColumn: TsdViewColumn; DisplayText: Boolean);
   private
     FProjectData: TObject;
 
@@ -48,7 +52,7 @@ implementation
 
 uses
   ProjectData, BillsCompileDm, BillsTree, sdIDTree, GclBillsGatherModel,
-  UtilMethods, PhaseData, StageLeafXmjGlDm, Variants;
+  UtilMethods, PhaseData, StageLeafXmjGlDm, Variants, DB;
 
 {$R *.dfm}
 
@@ -339,4 +343,36 @@ begin
     vGLs.Add(idx.Records[iRec]);
 end;
 
+procedure TLeafXmjGlData.sdvLeafXmjGLSetText(var Text: String;
+  ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
+  var Allow: Boolean);
+begin
+  if SameText(AColumn.FieldName, 'UsedQuantity') then
+  begin
+    if (Text <> AValue.AsString) and (Text <> '') then
+    begin
+      with TProjectData(FProjectData).PhaseData.StageLeafXmjGlData do
+        Text := FloatToStr(Decimal.Quantity.RoundTo(StrToFloatDef(Text, 0)));
+    end;
+  end;
+end;
+
+procedure TLeafXmjGlData.sdvLeafXmjGLGetText(var Text: String;
+  ARecord: TsdDataRecord; AValue: TsdValue; AColumn: TsdViewColumn;
+  DisplayText: Boolean);
+
+  procedure GetDisplayText;
+  begin
+    if AValue.Field.DataType = ftFloat then
+    begin
+      if AValue.AsFloat = 0 then
+        Text := '';
+    end;
+  end;
+
+begin
+  if DisplayText then
+    GetDisplayText;
+end;
+
 end.

+ 11 - 1
DataModules/StageDm.pas

@@ -651,7 +651,8 @@ procedure TStageData.CalculateNode(ANode: TsdIDTreeNode);
   function IsSpecialNode: Boolean;
   begin
     //Result := ANode.ID = iPriceMarginID;
-    Result := False;
+    //Result := False;
+    Result := ANode.ID = iMaterialID;
   end;
 
 begin
@@ -959,6 +960,14 @@ procedure TStageData.CalculateSpecialLeaf(ANode: TMeasureBillsIDTreeNode);
         ARec.PreGatherTotalPrice.AsFloat + ARec.GatherTotalPrice.AsFloat);
   end;
 
+  procedure GatherMaterial(ARec: TStageRecord);
+  begin
+    with TProjectData(TPhaseData(FPhaseData).ProjectData).ProjectGLData do
+      ARec.SetFloatValue(ARec.GatherTotalPrice, UsedTotalPrice);
+    ARec.SetFloatValue(ARec.EndGatherTotalPrice,
+        ARec.PreGatherTotalPrice.AsFloat + ARec.GatherTotalPrice.AsFloat);
+  end;
+
 var
   StageRec: TStageRecord;
 begin
@@ -967,6 +976,7 @@ begin
 
   case ANode.ID of
     iPriceMarginID: GatherPriceMargin(StageRec);
+    iMaterialID: GatherMaterial(StageRec);
   end;
 end;
 

+ 13 - 0
Units/CalcDecimal.pas

@@ -307,6 +307,19 @@ procedure TDecimalManager.ResetLinkViewColumns;
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_CurTotalPrice'));
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_EndTotalPrice'));
     end;
+
+    with TProjectData(FProjectData).LeafXmjGlData.sdvLeafXmjGL do
+    begin
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('Quantity'));
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('UsedQuantity'));
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('PAL_UsedQuantity'));
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('EndQuantity'));
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('EndUsedQuantity'));
+
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PAL_UsedTotalPrice'));
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PAL_DeltaPrice'));
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PAL_Total'));
+    end;
   end;
 
 begin