PdcCalculation.UpdateChargesAll: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == Show == Description == Shows the form of the calculation object == Notes == This method shows the calculation. As this does enables the user to change th..."
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Declaration ==
== Declaration ==
Show
UpdateChargesAll


== Description ==
== Description ==
Shows the form of the calculation object
Update all the charges of a calculation.


== Notes ==
== Notes ==
This method shows the calculation.
This method update all the charges of a calculation. The rates, surcharges, waste percentages, process times and all the sub items (Look at the update charges PdC screen) are updated by calling this method.
 
As this does enables the user to change the calculation while the script may not yet be finished, this method needs to be used with extreme care!


== Code example ==
== Code example ==
This code example creates a calculation, lets the user select the correct customer and contact, saves and shows it.
This code example updates calculation "1403-00005".
While the message box is shown the user can change the calculation, once closed the script adds a material and saves and shows the calculation.
As there is no refresh in this code, the calculation on screen will not show the added material and will appear unsaved. Upon closing and opening the calculation the user can see that both the manual changes and the script changes have been maintained.


<source lang="vb">
<source lang="vb">
dim objCalc
dim objCalc
dim strRelNr
dim strCPID
  set objCalc = pdc.NewCalculation
  strRelNr = pdc.ChooseRecord(0,"", "")
  strCPID = pdc.ChooseRecord(8,"", "CP_DEBNR = '" & strRelNr & "'")
  objCalc.SetCustomerID(strRelNr)
  objCalc.SetContactID(strCPID)
  objCalc.Save
  objCalc.Show
  msgbox "Script continues"


   objCalc.MaterialList.Add("12345")
   set objCalc = pdc.Calculations.Open("1403-00005")
   objCalc.Save
   if objCalc.UpdateChargesAll then
  objCalc.Show
    objCalc.Save
    objCalc.Show
  else
    msgbox "The calculation is in production."
  end if
</source>
</source>


== Availability ==
== Availability ==
Available since april 2014 (version 4.3 onwards)

Latest revision as of 13:15, 15 April 2014

Declaration

UpdateChargesAll

Description

Update all the charges of a calculation.

Notes

This method update all the charges of a calculation. The rates, surcharges, waste percentages, process times and all the sub items (Look at the update charges PdC screen) are updated by calling this method.

Code example

This code example updates calculation "1403-00005".

dim objCalc

  set objCalc = pdc.Calculations.Open("1403-00005")
  if objCalc.UpdateChargesAll then
    objCalc.Save
    objCalc.Show
  else
    msgbox "The calculation is in production."
  end if

Availability

Available since april 2014 (version 4.3 onwards)