|
@@ -69,6 +69,7 @@ type
|
|
|
procedure SetTableName(const Value: string);
|
|
|
function GetChapterStageGather(AChapter: Integer): Double;
|
|
|
function GetPriceMargin(AType, AIndex: Integer): Double;
|
|
|
+ function GetTableName: string;
|
|
|
public
|
|
|
constructor Create(APhaseData: TObject);
|
|
|
destructor Destroy; override;
|
|
@@ -104,7 +105,7 @@ type
|
|
|
procedure CopyPrePhaseData;
|
|
|
|
|
|
property Active: Boolean read GetActive;
|
|
|
- property TableName: string Write SetTableName;
|
|
|
+ property TableName: string read GetTableName Write SetTableName;
|
|
|
property MainBillsTree: TBillsIDTree read GetMainBillsTree;
|
|
|
property PhaseData: TObject read FPhaseData;
|
|
|
|
|
@@ -621,55 +622,47 @@ begin
|
|
|
Result := Rec.ValueByName(sFieldName).AsFloat;
|
|
|
end;
|
|
|
|
|
|
-procedure TStageData.CopyPrePhaseData;
|
|
|
+procedure TStageData.CopyPrePhaseData;
|
|
|
+const
|
|
|
+ sCopySql = 'Insert Into %s (' +
|
|
|
+ ' BillsID, ' +
|
|
|
+ ' PreDealQuantity, PreDealTotalPrice, ' +
|
|
|
+ ' PreQcQuantity, PreQcTotalPrice, PreQcBGLCode, PreQcBGLNum, ' +
|
|
|
+ ' PrePcQuantity, PrePcTotalPrice, PrePcBGLCode, PrePcBGLNum, ' +
|
|
|
+ ' PreGatherQuantity, PreGatherTotalPrice, ' +
|
|
|
+ ' EndDealQuantity, EndDealTotalPrice, ' +
|
|
|
+ ' EndQcQuantity, EndQcTotalPrice, EndQcBGLCode, EndQcBGLNum, ' +
|
|
|
+ ' EndPcQuantity, EndPcTotalPrice, EndPcBGLCode, EndPcBGLNum, ' +
|
|
|
+ ' EndGatherQuantity, EndGatherTotalPrice ' +
|
|
|
+ ' ) Select BillsID,' +
|
|
|
+ ' EndDealQuantity, EndDealTotalPrice, ' +
|
|
|
+ ' EndQcQuantity, EndQcTotalPrice, EndQcBGLCode, EndQcBGLNum, ' +
|
|
|
+ ' EndPcQuantity, EndPcTotalPrice, EndPcBGLCode, EndPcBGLNum, ' +
|
|
|
+ ' EndGatherQuantity, EndGatherTotalPrice, ' +
|
|
|
+ ' EndDealQuantity, EndDealTotalPrice, ' +
|
|
|
+ ' EndQcQuantity, EndQcTotalPrice, EndQcBGLCode, EndQcBGLNum, ' +
|
|
|
+ ' EndPcQuantity, EndPcTotalPrice, EndPcBGLCode, EndPcBGLNum, ' +
|
|
|
+ ' EndGatherQuantity, EndGatherTotalPrice ' +
|
|
|
+ ' From %s' +
|
|
|
+ ' In ''%s''';
|
|
|
var
|
|
|
- iRecord: Integer;
|
|
|
- Rec: TBillsRecord;
|
|
|
- NewRec: TStageRecord;
|
|
|
+ sPre, sSql: string;
|
|
|
+ FPrePhaseData: TPhaseData;
|
|
|
+ sTempFile: string;
|
|
|
begin
|
|
|
- BeforeBatchOperation;
|
|
|
+ FPrePhaseData := TPhaseData.Create(TPhaseData(FPhaseData).ProjectData);
|
|
|
+ sTempFile := GetTempFileName;
|
|
|
try
|
|
|
- with TProjectData(TPhaseData(FPhaseData).ProjectData).BillsData do
|
|
|
- for iRecord := 0 to sddBills.RecordCount - 1 do
|
|
|
- begin
|
|
|
- Rec := TBillsRecord(sddBills.Records[iRecord]);
|
|
|
- if (Rec.AddGatherTotalPrice.AsFloat = 0) and
|
|
|
- (Rec.AddDealTotalPrice.AsFloat = 0) and
|
|
|
- (Rec.AddQcTotalPrice.AsFloat = 0) and
|
|
|
- (Rec.AddPcTotalPrice.AsFloat = 0) and
|
|
|
- (Rec.PM_AddTotalPrice.AsFloat = 0) then Continue;
|
|
|
-
|
|
|
- NewRec := TStageRecord(sddStage.Add);
|
|
|
- NewRec.BillsID.AsInteger := Rec.ID.AsInteger;
|
|
|
- NewRec.EndDealQuantity.AsFloat := Rec.AddDealQuantity.AsFloat;
|
|
|
- NewRec.EndDealTotalPrice.AsFloat := Rec.AddDealTotalPrice.AsFloat;
|
|
|
- NewRec.EndQcQuantity.AsFloat := Rec.AddQcQuantity.AsFloat;
|
|
|
- NewRec.EndQcTotalPrice.AsFloat := Rec.AddQcTotalPrice.AsFloat;
|
|
|
- NewRec.EndQcBGLCode.AsString := Rec.AddQcBGLCode.AsString;
|
|
|
- NewRec.EndQcBGLNum.AsString := Rec.AddQcBGLNum.AsString;
|
|
|
- NewRec.EndPcQuantity.AsFloat := Rec.AddPcQuantity.AsFloat;
|
|
|
- NewRec.EndPcTotalPrice.AsFloat := Rec.AddPcTotalPrice.AsFloat;
|
|
|
- NewRec.EndPcBGLCode.AsString := Rec.AddPcBGLCode.AsString;
|
|
|
- NewRec.EndPcBGLNum.AsString := Rec.AddPcBGLNum.AsString;
|
|
|
- NewRec.EndGatherQuantity.AsFloat := Rec.AddGatherQuantity.AsFloat;
|
|
|
- NewRec.EndGatherTotalPrice.AsFloat := Rec.AddGatherTotalPrice.AsFloat;
|
|
|
- NewRec.PreDealQuantity.AsFloat := Rec.AddDealQuantity.AsFloat;
|
|
|
- NewRec.PreDealTotalPrice.AsFloat := Rec.AddDealTotalPrice.AsFloat;
|
|
|
- NewRec.PreQcQuantity.AsFloat := Rec.AddQcQuantity.AsFloat;
|
|
|
- NewRec.PreQcTotalPrice.AsFloat := Rec.AddQcTotalPrice.AsFloat;
|
|
|
- NewRec.PreQcBGLCode.AsString := Rec.AddQcBGLCode.AsString;
|
|
|
- NewRec.PreQcBGLNum.AsString := Rec.AddQcBGLNum.AsString;
|
|
|
- NewRec.PrePcQuantity.AsFloat := Rec.AddPcQuantity.AsFloat;
|
|
|
- NewRec.PrePcTotalPrice.AsFloat := Rec.AddPcTotalPrice.AsFloat;
|
|
|
- NewRec.PrePcBGLCode.AsString := Rec.AddPcBGLCode.AsString;
|
|
|
- NewRec.PrePcBGLNum.AsString := Rec.AddPcBGLNum.AsString;
|
|
|
- NewRec.PreGatherQuantity.AsFloat := Rec.AddGatherQuantity.AsFloat;
|
|
|
- NewRec.PreGatherTotalPrice.AsFloat := Rec.AddGatherTotalPrice.AsFloat;
|
|
|
-
|
|
|
- NewRec.PM_PreTotalPrice.AsFloat := Rec.PM_AddTotalPrice.AsFloat;
|
|
|
- end;
|
|
|
+ FPrePhaseData.SimpleOpen(Format('%s\Phase%d.dat', [
|
|
|
+ TProjectData(TPhaseData(FPhaseData).ProjectData).TempPath,
|
|
|
+ TPhaseData(FPhaseData).PhaseIndex - 1]));
|
|
|
+ FPrePhaseData.SaveDebugFile(sTempFile);
|
|
|
+ sSql := Format(sCopySql, [TableName, FPrePhaseData.StageTableName[FPrePhaseData.PhaseProperty.AuditCount], sTempFile]);
|
|
|
+ ExecuteSql(TPhaseData(FPhaseData).ADOConnection, sSql);
|
|
|
finally
|
|
|
- AfterBatchOperation;
|
|
|
+ DeleteFile(sTempFile);
|
|
|
+ FPrePhaseData.Free;
|
|
|
+ sddStage.Reload;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -1042,4 +1035,9 @@ begin
|
|
|
Result := GetTotalPrice(iPriceMarginID, AType, AIndex);
|
|
|
end;
|
|
|
|
|
|
+function TStageData.GetTableName: string;
|
|
|
+begin
|
|
|
+ Result := sdpStage.TableName;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|