Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $section = $newQuote->getSection("1");
- for ($i = 0; $i < sizeof($prebuildIDs); $i++){
- $departments = $section->getDepartments();
- $deptExists = false;
- $id = $prebuildIDs[$i];
- $name = $prebuildNames[$i];
- $department = $prebuildDepartments[$i];
- $qty = $prebuildQTYs[$i];
- if ($qty != 0){
- foreach ($departments as $dept){
- if ($department == $dept->getDepartmentID()){
- $depSecID = $dept->getDepSecID();
- $costCentre = $dept;
- break;
- } else {
- $deptExists = false;
- }
- }
- if (!$deptExists){
- $costCentre = $section->addDepartment($department);
- $costCentre->clearLabour();
- } else {
- $section->getDepartment($depSecID);
- }
- //Now add the prebuild to the department
- $item = new DepartmentPrebuildItem($id);
- $item->setQuantity($qty);
- $costCentre->addItem($item);
- }
- }
Add Comment
Please, Sign In to add comment