PdcMaterialList.AddComposedMaterial: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:
* The first parameter determines the materialkind.
* The first parameter determines the materialkind.
* The second parameter is composed material type, with the following options:
* The second parameter is composed material type, with the following options:
0 - Piece
0 - Piece<br />
1 - Meter (M)
1 - Meter (M)<br />
2 - Kg (KG)
2 - Kg (KG)<br />
4 - Surface (M2)
4 - Surface (M2)<br />
5 - Volume (M3)
5 - Volume (M3)
* The third parameter can be used to give the volume.
* The third parameter can be used to give the volume.

Revision as of 11:11, 21 November 2013

Declaration

AddComposedMaterial(MaterialKind as String,ComposedMaterialType as Integer, Volume as String, Surface as String) as PdcMaterial

Description

Returns an new added composed material object.

Notes

This method add an material to the materiallist.

  • The first parameter determines the materialkind.
  • The second parameter is composed material type, with the following options:

0 - Piece
1 - Meter (M)
2 - Kg (KG)
4 - Surface (M2)
5 - Volume (M3)

  • The third parameter can be used to give the volume.
  • The fourth parameter can be used to give the surface.

Code example

Sub AddMaterialType
dim objCalc
dim objMat
dim thickness
dim volume
dim objTable
dim weightfac
dim weight
  set objTable = pdc.Database.OpenTable(pdcCondata,"SGMAT","SG_MATNR")
  if objTable.Locate("SG_MATNR","RVS306") then
    set objCalc = pdc.NewCalculation
    set objMat = objCalc.MaterialList.AddComposedMaterial("RVS306",4) 'RVS306 added as sheet
    thickness = 20 'mm
    objMat.Description = "PLAAT-" & thickness &  "MM"
    objMat.Length = 1 'm
    objMat.Width = 1 'm
    volume = thickness / 1000 ' volume per m2
    objMat.CostKind = objTable.GetField("SG_KSTSRT")
    weigthfac = objTable.GetField("SG_SGEW")
    weigth = 1000 * volume * weigthfac
    objMat.PricePerUnit =  volume * weigthfac * 1000 * objTable.GetField("SG_PRIJS")
    objMat.SurfaceFactor = 2 '2 for sheets
    objMat.Weight = weigth
    objMat.WeightFact = weigth
    objMat.UseStandardSize = false 'Sheet and block should be false, others are true
    objMat.DefaultSize = "" 'Nothing for sheets
    objMat.Scrap = objTable.GetField("SG_AFP")
    objMat.SurCharge = objTable.GetField("SG_TSLP")
    objMat.GrossPurPrice = objMat.PricePerUnit
    objMat.PurDiscount = 0

    objCalc.Save
    set objMat = nothing
    set objCalc = nothing
  end if
  set objTable = nothing
End Sub

Availability