Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

GetJobTotal

...

Function: GetJobTotal(const Propertyname: WideStringconst ItemType: WideString ''): Double;

Code Reference:

  • 1. Create a New Form application
  • 2. Add a button to the form
  • 3. Add Planswift to reference (Planswift9_tlb in the uses)
  • 4. Copy code to button onclick event

API

...

Calls

Delphi

Code Block
languagedelphi
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue
collapsetrue
procedure TForm1.psGetJobTotal(Sender: TObject);
var
  ps: IPlanSwift;
  est: IItem;
  folder: IItem;
  i: Integer;
  itm: IItem;
  CostEachTotal,QtyTotal: Extended;
begin
//Create the Planswift Interface
  ps := coPlanswift.Create;
//Begin Update Procedure
  ps.BeginUpdate;
//Get the Takeoff item (Estimating Tab in Planswift)
  est := ps.GetItem('Job\Takeoff');
//Create a New Folder in Estimating
  folder := est.NewItem('Folder','Material Items');
// Add 20 Material Part Items to the folder
  for i := 0 to 20 - 1 do begin
    itm := folder.NewItem('Material','Job Total Demo Material ' + intToStr(i));
//Set their Qty and Cost Each
    itm.SetPropertyFormula('Qty','20');
    itm.SetPropertyFormula('Cost Each','1.50');
  end;
//get Cost Each Total
  CostEachTotal := ps.GetJobTotal('Cost Each','Material');
//get Qty Total
  QtyTotal := ps.GetJobTotal('Qty','Material');
//Show the values
  ShowMessage('Qty Total: ' + FloatToStr(QtyTotal) + ' Cost Each Total: ' + FloatToStr(CostEachTotal));
//End Update Procedure
  ps.EndUpdate;
//Free Planswift
  ps := nil;
end;


Code Block
languagedelphi
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

C#

Code Block
languagec#
themeRDark
firstline1
titleUsing IItem Object Model
linenumberstrue


Code Block
languagec#
themeRDark
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

VB/VBA (OLE)

Code Block
languagevb
firstline1
titleUsing IItem Object Model
linenumberstrue


Code Block
languagevb
firstline1
titleUsing PlanSwift Object Model
linenumberstrue

Pascal Scripting (OLE)

Code Block
firstline1
titleItem Object Model
linenumberstrue


Code Block
titleRoot Object Model
linenumberstrue

Pascal Scripting

Code Block
firstline1
titleItem Object Model
linenumberstrue


Code Block
titleUsing the PlanSwift Object Model
linenumberstrue