|
@@ -96,6 +96,8 @@ type
|
|
|
cdsBGBillsViewQuantity: TFloatField;
|
|
|
cdsBGBillsViewTotalPrice: TFloatField;
|
|
|
cdsBGBillsViewUsedQuantity: TFloatField;
|
|
|
+ cdsBGLIsCloud: TBooleanField;
|
|
|
+ cdsBGLWebID: TIntegerField;
|
|
|
procedure cdsBGBillsViewAfterInsert(DataSet: TDataSet);
|
|
|
procedure cdsBGBillsViewAfterPost(DataSet: TDataSet);
|
|
|
procedure cdsBGBillsViewQuantityChange(Sender: TField);
|
|
@@ -136,6 +138,9 @@ type
|
|
|
|
|
|
function AllBGLTotalPrice: Double;
|
|
|
|
|
|
+ function AllCloudBGLWebID: string;
|
|
|
+ procedure LoadCloudBGL(const ABGLs: string);
|
|
|
+
|
|
|
procedure AddBGL(const sCode: string);
|
|
|
procedure ApplyBGL(AOrgBGL, ANewBGL: TBGLSelectInfo); overload;
|
|
|
|
|
@@ -147,7 +152,7 @@ type
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
|
- ZhAPI, Math, ProjectData, BillsDm, Variants, UtilMethods;
|
|
|
+ ZhAPI, Math, ProjectData, BillsDm, Variants, UtilMethods, superobject;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
@@ -652,4 +657,82 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+function TBGLData.AllCloudBGLWebID: string;
|
|
|
+begin
|
|
|
+ Result := '';
|
|
|
+ cdsBGL.First;
|
|
|
+ while not cdsBGL.Eof do
|
|
|
+ begin
|
|
|
+ if cdsBGLIsCloud.AsBoolean then
|
|
|
+ begin
|
|
|
+ if Result = '' then
|
|
|
+ Result := IntToStr(cdsBGLWebID.AsInteger)
|
|
|
+ else
|
|
|
+ Result := Result + ',' + IntToStr(cdsBGLWebID.AsInteger);
|
|
|
+ end;
|
|
|
+ cdsBGL.Next;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TBGLData.LoadCloudBGL(const ABGLs: string);
|
|
|
+
|
|
|
+ procedure AddCloudBGLBills(ABGLID: Integer; ABGBills: ISuperObject);
|
|
|
+ var
|
|
|
+ i, iNewID: Integer;
|
|
|
+ vJ: ISuperObject;
|
|
|
+ begin
|
|
|
+ for i := 0 to ABGBills.AsArray.Length - 1 do
|
|
|
+ begin
|
|
|
+ iNewID := GetNewIDOfIndex(cdsBGBills);
|
|
|
+ vJ := ABGBills.AsArray.O[i];
|
|
|
+ cdsBGBills.Append;
|
|
|
+ cdsBGBillsID.AsInteger := iNewID;
|
|
|
+ cdsBGBillsBGID.AsInteger := ABGLID;
|
|
|
+ cdsBGBillsB_Code.AsString := vJ.S['lnum'];
|
|
|
+ cdsBGBillsName.AsString := vJ.S['lname'];
|
|
|
+ cdsBGBillsUnits.AsString := vJ.S['unit'];
|
|
|
+ cdsBGBillsPrice.AsFloat := vJ.D['unitprice'];
|
|
|
+ cdsBGBillsQuantity.AsFloat := vJ.D['samount'];
|
|
|
+ cdsBGBillsTotalPrice.AsFloat := TotalPriceRoundTo(cdsBGBillsPrice.AsFloat * cdsBGBillsQuantity.AsFloat);
|
|
|
+ cdsBGBills.Post;
|
|
|
+ UpdateBGLTotalPrice(ABGLID, cdsBGBillsTotalPrice.AsFloat);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+ procedure AddCloudBGL(ABGL: ISuperObject);
|
|
|
+ var
|
|
|
+ iNewID, iCreatePhaseID: Integer;
|
|
|
+ vBGBills: ISuperObject;
|
|
|
+ begin
|
|
|
+ iNewID := GetNewIDOfIndex(cdsBGL);
|
|
|
+ iCreatePhaseID := TProjectData(FProjectData).PhaseIndex;
|
|
|
+ cdsBGL.Append;
|
|
|
+ cdsBGLID.AsInteger := iNewID;
|
|
|
+ cdsBGLCode.AsString := ABGL.S['pnum'];
|
|
|
+ cdsBGLName.AsString := ABGL.S['pname'];
|
|
|
+ cdsBGLPos_Reason.AsString := ABGL.S['description'];
|
|
|
+ cdsBGLDirection.AsString := ABGL.S['basis'];
|
|
|
+ cdsBGLDrawingCode.AsString := ABGL.S['cnum'];
|
|
|
+ cdsBGLApprovalCode.AsString := '';
|
|
|
+ cdsBGLCreatePhaseID.AsInteger := iCreatePhaseID;
|
|
|
+ cdsBGLBGLType.AsString := ABGL.S['changeNature'];
|
|
|
+ cdsBGLIsCloud.AsBoolean := True;
|
|
|
+ cdsBGLWebID.AsInteger := ABGL.I['cid'];
|
|
|
+ cdsBGL.Post;
|
|
|
+ AddCloudBGLBills(iNewID, ABGL.O['changeBills']);
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ vJ: ISuperObject;
|
|
|
+ i: Integer;
|
|
|
+begin
|
|
|
+ vJ := SO(ABGLs);
|
|
|
+ try
|
|
|
+ for i := 0 to vJ.AsArray.Length - 1 do
|
|
|
+ AddCloudBGL(vJ.AsArray.O[i]);
|
|
|
+ finally
|
|
|
+ vJ := nil;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|