function updateImprovementsBuildingsDepreciation($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
     $improvementsBuildingsDepreciation->parseDomDocument($domDoc);
     $ret = $improvementsBuildingsDepreciation->updateRecord();
     return $ret;
 }
 function parseDomDocument($domDoc)
 {
     $baseNode = $domDoc->document_element();
     if ($baseNode->has_child_nodes()) {
         $child = $baseNode->first_child();
         while ($child) {
             //if ($child->tagname=="ImprovementsBuildingsDepreciation") {
             if ($child->tagname) {
                 $tempXmlStr = $domDoc->dump_node($child);
                 $tempDomDoc = domxml_open_mem($tempXmlStr);
                 $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
                 $improvementsBuildingsDepreciation->parseDomDocument($tempDomDoc);
                 $this->arrayList[] = $improvementsBuildingsDepreciation;
             }
             $child = $child->next_sibling();
         }
     } else {
         return false;
     }
     return $this->setDomDocument();
 }
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $this->tpl->set_var("MessageBlock", "");
             $ImprovementsBuildingsDepreciationDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDepreciationDetails.php", "urn:Object");
             if (!($xmlStr = $ImprovementsBuildingsDepreciationDetails->getImprovementsBuildingsDepreciationDetails($this->formArray["improvementsBuildingsDepreciationID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
                     $improvementsBuildingsDepreciation->parseDomDocument($domDoc);
                     $this->formArray["improvementsBuildingsDepreciationID"] = $improvementsBuildingsDepreciation->getImprovementsBuildingsDepreciationID();
                     $this->formArray["code"] = $improvementsBuildingsDepreciation->getCode();
                     $this->formArray["reportCode"] = $improvementsBuildingsDepreciation->getReportCode();
                     $this->formArray["description"] = $improvementsBuildingsDepreciation->getDescription();
                     $this->formArray["rangeLowerBound"] = $improvementsBuildingsDepreciation->getRangeLowerBound();
                     $this->formArray["rangeUpperBound"] = $improvementsBuildingsDepreciation->getRangeUpperBound();
                     $this->formArray["value"] = $improvementsBuildingsDepreciation->getValue();
                     $this->formArray["status"] = $improvementsBuildingsDepreciation->getStatus();
                 }
             }
             break;
         case "save":
             if ($this->codeAlreadyExists() == true) {
                 $this->message = "Error. Cannot Save. Code already exists.";
                 $this->tpl->set_var("message", $this->message);
                 $this->tpl->parse("MessageBlock", "Message", true);
                 break;
             } else {
                 $this->tpl->set_var("MessageBlock", "");
             }
             $ImprovementsBuildingsDepreciationEncode = new SoapObject(NCCBIZ . "ImprovementsBuildingsDepreciationEncode.php", "urn:Object");
             if ($this->formArray["improvementsBuildingsDepreciationID"] != "") {
                 $ImprovementsBuildingsDepreciationDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsDepreciationDetails.php", "urn:Object");
                 if (!($xmlStr = $ImprovementsBuildingsDepreciationDetails->getImprovementsBuildingsDepreciationDetails($this->formArray["improvementsBuildingsDepreciationID"]))) {
                     exit("record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
                         $improvementsBuildingsDepreciation->parseDomDocument($domDoc);
                         $improvementsBuildingsDepreciation->setImprovementsBuildingsDepreciationID($this->formArray["improvementsBuildingsDepreciationID"]);
                         $improvementsBuildingsDepreciation->setCode($this->formArray["code"]);
                         $improvementsBuildingsDepreciation->setReportCode($this->formArray["reportCode"]);
                         $improvementsBuildingsDepreciation->setDescription($this->formArray["description"]);
                         $improvementsBuildingsDepreciation->setRangeLowerBound($this->formArray["rangeLowerBound"]);
                         $improvementsBuildingsDepreciation->setRangeUpperBound($this->formArray["rangeUpperBound"]);
                         $improvementsBuildingsDepreciation->setValue($this->formArray["value"]);
                         $improvementsBuildingsDepreciation->setStatus($this->formArray["status"]);
                         $improvementsBuildingsDepreciation->setDomDocument();
                         $doc = $improvementsBuildingsDepreciation->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $ImprovementsBuildingsDepreciationEncode->updateImprovementsBuildingsDepreciation($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
                 $improvementsBuildingsDepreciation->setImprovementsBuildingsDepreciationID($this->formArray["improvementsBuildingsDepreciationID"]);
                 $improvementsBuildingsDepreciation->setCode($this->formArray["code"]);
                 $improvementsBuildingsDepreciation->setReportCode($this->formArray["reportCode"]);
                 $improvementsBuildingsDepreciation->setDescription($this->formArray["description"]);
                 $improvementsBuildingsDepreciation->setRangeLowerBound($this->formArray["rangeLowerBound"]);
                 $improvementsBuildingsDepreciation->setRangeUpperBound($this->formArray["rangeUpperBound"]);
                 $improvementsBuildingsDepreciation->setValue($this->formArray["value"]);
                 $improvementsBuildingsDepreciation->setStatus($this->formArray["status"]);
                 $improvementsBuildingsDepreciation->setDomDocument();
                 $doc = $improvementsBuildingsDepreciation->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $ImprovementsBuildingsDepreciationEncode->saveImprovementsBuildingsDepreciation($xmlStr))) {
                     exit("error save");
                 }
             }
             $this->formArray["improvementsBuildingsDepreciationID"] = $ret;
             header("location: ImprovementsBuildingsDepreciationClose.php" . $this->sess->url("") . $this->sess->add_query(array("improvementsBuildingsDepreciationID" => $ret)));
             //header("location: ImprovementsBuildingsDepreciationEncode.php");
             exit;
             break;
         case "cancel":
             header("location: ImprovementsBuildingsDepreciationClose.php" . $this->sess->url("") . $this->sess->add_query(array("improvementsBuildingsDepreciationID" => $ret)));
             //header("location: ImprovementsBuildingsDepreciationList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "ImprovementsBuildingsDepreciationID", "ImprovementsBuildingsDepreciationIDBlock");
             $this->tpl->set_var("ImprovementsBuildingsDepreciationIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
             $this->tpl->set_var("MessageBlock", "");
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }