Guest User

Untitled

a guest
May 21st, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. $section = $newQuote->getSection("1");
  2.  
  3. for ($i = 0; $i < sizeof($prebuildIDs); $i++){
  4.     $departments = $section->getDepartments();
  5.     $deptExists = false;
  6.     $id = $prebuildIDs[$i];
  7.     $name = $prebuildNames[$i];
  8.     $department = $prebuildDepartments[$i];
  9.     $qty = $prebuildQTYs[$i];
  10.     if ($qty != 0){
  11.         foreach ($departments as $dept){
  12.             if ($department == $dept->getDepartmentID()){
  13.                 $depSecID = $dept->getDepSecID();
  14.                 $costCentre = $dept;
  15.                 break;
  16.             } else {
  17.                 $deptExists = false;
  18.             }
  19.         }
  20.         if (!$deptExists){
  21.             $costCentre = $section->addDepartment($department);
  22.             $costCentre->clearLabour();
  23.         } else {
  24.             $section->getDepartment($depSecID);
  25.         }
  26.         //Now add the prebuild to the department
  27.         $item = new DepartmentPrebuildItem($id);
  28.         $item->setQuantity($qty);
  29.         $costCentre->addItem($item);
  30.     }
  31. }
Add Comment
Please, Sign In to add comment