function Main() { switch ($this->formArray["formAction"]) { case "edit": $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object"); if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) { echo "xml failed"; } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $plantsTrees = new PlantsTrees(); $plantsTrees->parseDomDocument($domDoc); foreach ($plantsTrees as $key => $value) { switch ($key) { case "propertyAdministrator": if (is_a($value, Person)) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday()); $this->formArray["personID"] = $value->getPersonID(); $this->formArray["lastName"] = $value->getLastName(); $this->formArray["firstName"] = $value->getFirstName(); $this->formArray["middleName"] = $value->getMiddleName(); $this->formArray["gender"] = $value->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $value->getMaritalStatus(); $this->formArray["tin"] = $value->getTin(); $this->formArray["addressID"] = $value->addressArray[0]->getAddressID(); $this->formArray["number"] = $value->addressArray[0]->getNumber(); $this->formArray["street"] = $value->addressArray[0]->getStreet(); $this->formArray["barangay"] = $value->addressArray[0]->getBarangay(); $this->formArray["district"] = $value->addressArray[0]->getDistrict(); $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity(); $this->formArray["province"] = $value->addressArray[0]->getProvince(); $this->formArray["telephone"] = $value->getTelephone(); $this->formArray["mobileNumber"] = $value->getMobileNumber(); $this->formArray["email"] = $value->getEmail(); } else { $this->formArray[$key] = ""; } break; case "appraisedByDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["as_year"] = removePreZero($dateArr["year"]); $this->formArray["as_month"] = removePreZero($dateArr["month"]); $this->formArray["as_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "recommendingApprovalDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["re_year"] = removePreZero($dateArr["year"]); $this->formArray["re_month"] = removePreZero($dateArr["month"]); $this->formArray["re_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } case "approvedByDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["av_year"] = removePreZero($dateArr["year"]); $this->formArray["av_month"] = removePreZero($dateArr["month"]); $this->formArray["av_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateAcquired": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["da_year"] = removePreZero($dateArr["year"]); $this->formArray["da_month"] = removePreZero($dateArr["month"]); $this->formArray["da_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateOfInstallation": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["di_year"] = removePreZero($dateArr["year"]); $this->formArray["di_month"] = removePreZero($dateArr["month"]); $this->formArray["di_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateOfOperation": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["do_year"] = removePreZero($dateArr["year"]); $this->formArray["do_month"] = removePreZero($dateArr["month"]); $this->formArray["do_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; default: $this->formArray[$key] = $value; } } } } break; case "save": if ($this->formArray["verifiedByID"] != "" && $this->formArray["verifiedByID"] != "xx" && $this->formArray["propertyID"] != "") { $this->saveVerified($this->formArray["afsID"], $this->formArray["verifiedByID"], $this->formArray["propertyID"]); } $PlantsTreesEncode = new SoapObject(NCCBIZ . "PlantsTreesEncode.php", "urn:Object"); if ($this->formArray["propertyID"] != "") { $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object"); if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($this->formArray["propertyID"]))) { $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 { $address = new Address(); $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $propertyAdministrator = new Person(); $propertyAdministrator->setPersonID($this->formArray["personID"]); $propertyAdministrator->setLastName($this->formArray["lastName"]); $propertyAdministrator->setFirstName($this->formArray["firstName"]); $propertyAdministrator->setMiddleName($this->formArray["middleName"]); //$propertyAdministrator->setGender($this->formArray["gender"]); //$propertyAdministrator->setBirthday($this->birthdate); //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]); //$propertyAdministrator->setTin($this->formArray["tin"]); $propertyAdministrator->setAddressArray($address); $propertyAdministrator->setTelephone($this->formArray["telephone"]); //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]); $propertyAdministrator->setEmail($this->formArray["email"]); $propertyAdministrator->setDomDocument(); $plantsTrees = new PlantsTrees(); $plantsTrees->parseDomDocument($domDoc); $plantsTrees->setPropertyID($this->formArray["propertyID"]); $plantsTrees->setAfsID($this->formArray["afsID"]); $plantsTrees->setArpNumber($this->formArray["arpNumber"]); $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]); $plantsTrees->setPropertyAdministrator($propertyAdministrator); $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]); $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]); $plantsTrees->setNotedBy($this->formArray["notedByID"]); $plantsTrees->setMarketValue($this->formArray["marketValue"]); $plantsTrees->setKind($this->formArray["kind"]); $plantsTrees->setActualUse($this->formArray["actualUse"]); $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]); $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]); $plantsTrees->setAssessedValue($this->formArray["assessedValue"]); $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]); $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]); $plantsTrees->setTaxability($this->formArray["taxability"]); $plantsTrees->setEffectivity($this->formArray["effectivity"]); $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]); $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]); $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]); $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]); $plantsTrees->setApprovedBy($this->formArray["approvedByID"]); $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]); $plantsTrees->setMemoranda($this->formArray["memoranda"]); $plantsTrees->setPostingDate($this->formArray["postingDate"]); $plantsTrees->setLandPin($this->formArray["landPin"]); $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]); $plantsTrees->setProductClass($this->formArray["productClass"]); $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]); $plantsTrees->setTotalNumber($this->formArray["totalNumber"]); $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]); $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]); $plantsTrees->setAge($this->formArray["age"]); $plantsTrees->setUnitPrice($this->formArray["unitPrice"]); $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]); $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]); $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]); $plantsTrees->setCreatedBy($this->userID); $plantsTrees->setModifiedBy($this->userID); $plantsTrees->setDomDocument(); $doc = $plantsTrees->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($ret = $PlantsTreesEncode->updatePlantsTrees($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); //$address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $propertyAdministrator = new Person(); //$propertyAdministrator->setPersonID($this->formArray["personID"]); $propertyAdministrator->setLastName($this->formArray["lastName"]); $propertyAdministrator->setFirstName($this->formArray["firstName"]); $propertyAdministrator->setMiddleName($this->formArray["middleName"]); //$propertyAdministrator->setGender($this->formArray["gender"]); //$propertyAdministrator->setBirthday($this->birthdate); //$propertyAdministrator->setMaritalStatus($this->formArray["maritalStatus"]); //$propertyAdministrator->setTin($this->formArray["tin"]); $propertyAdministrator->setAddressArray($address); $propertyAdministrator->setTelephone($this->formArray["telephone"]); //$propertyAdministrator->setMobileNumber($this->formArray["mobileNumber"]); $propertyAdministrator->setEmail($this->formArray["email"]); $propertyAdministrator->setDomDocument(); $plantsTrees = new PlantsTrees(); $plantsTrees->parseDomDocument($domDoc); //$plantsTrees->setPropertyID($this->formArray["propertyID"]); $plantsTrees->setAfsID($this->formArray["afsID"]); $plantsTrees->setArpNumber($this->formArray["arpNumber"]); $plantsTrees->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]); $plantsTrees->setPropertyAdministrator($propertyAdministrator); $plantsTrees->setVerifiedBy($this->formArray["verifiedByID"]); $plantsTrees->setPlottingsBy($this->formArray["plottingsByID"]); $plantsTrees->setNotedBy($this->formArray["notedByID"]); $plantsTrees->setMarketValue($this->formArray["marketValue"]); $plantsTrees->setKind($this->formArray["kind"]); $plantsTrees->setActualUse($this->formArray["actualUse"]); $plantsTrees->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]); $plantsTrees->setAssessmentLevel($this->formArray["assessmentLevel"]); $plantsTrees->setAssessedValue($this->formArray["assessedValue"]); $plantsTrees->setPreviousOwner($this->formArray["previousOwner"]); $plantsTrees->setPreviousAssessedValue($this->formArray["previousAssessedValue"]); $plantsTrees->setTaxability($this->formArray["taxability"]); $plantsTrees->setEffectivity($this->formArray["effectivity"]); $plantsTrees->setAppraisedBy($this->formArray["appraisedByID"]); $plantsTrees->setAppraisedByDate($this->formArray["appraisedByDate"]); $plantsTrees->setRecommendingApproval($this->formArray["recommendingApprovalID"]); $plantsTrees->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]); $plantsTrees->setApprovedBy($this->formArray["approvedByID"]); $plantsTrees->setApprovedByDate($this->formArray["approvedByDate"]); $plantsTrees->setMemoranda($this->formArray["memoranda"]); $plantsTrees->setPostingDate($this->formArray["postingDate"]); $plantsTrees->setLandPin($this->formArray["landPin"]); $plantsTrees->setSurveyNumber($this->formArray["surveyNumber"]); $plantsTrees->setProductClass($this->formArray["productClass"]); $plantsTrees->setAreaPlanted($this->formArray["areaPlanted"]); $plantsTrees->setTotalNumber($this->formArray["totalNumber"]); $plantsTrees->setNonFruitBearing($this->formArray["nonFruitBearing"]); $plantsTrees->setFruitBearing($this->formArray["fruitBearing"]); $plantsTrees->setAge($this->formArray["age"]); $plantsTrees->setUnitPrice($this->formArray["unitPrice"]); $plantsTrees->setAdjustmentFactor($this->formArray["adjustmentFactor"]); $plantsTrees->setPercentAdjustment($this->formArray["percentAdjustment"]); $plantsTrees->setValueAdjustment($this->formArray["valueAdjustment"]); $plantsTrees->setCreatedBy($this->userID); $plantsTrees->setModifiedBy($this->userID); $plantsTrees->setDomDocument(); $doc = $plantsTrees->getDomDocument(); $xmlStr = $doc->dump_mem(true); //exit($xmlStr); if (!($ret = $PlantsTreesEncode->savePlantsTrees($xmlStr))) { echo "ret=" . $ret; } } $this->formArray["propertyID"] = $ret; header("location: PlantsTreesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"]))); exit; break; case "cancel": header("location: PlantsTreesList.php"); exit; break; default: if (!($firstPropertyID = $this->getFirstPropertyID())) { $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock"); $this->tpl->set_var("odIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); } else { $PlantsTreesDetails = new SoapObject(NCCBIZ . "PlantsTreesDetails.php", "urn:Object"); if (!($xmlStr = $PlantsTreesDetails->getPlantsTrees($firstPropertyID))) { echo "xml failed"; } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $plantsTrees = new PlantsTrees(); $plantsTrees->parseDomDocument($domDoc); foreach ($plantsTrees as $key => $value) { switch ($key) { case "propertyID": $this->formArray["propertyID"] = ""; break; case "propertyAdministrator": if (is_a($value, Person)) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value->getBirthday()); $this->formArray["personID"] = $value->getPersonID(); $this->formArray["lastName"] = $value->getLastName(); $this->formArray["firstName"] = $value->getFirstName(); $this->formArray["middleName"] = $value->getMiddleName(); $this->formArray["gender"] = $value->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $value->getMaritalStatus(); $this->formArray["tin"] = $value->getTin(); $this->formArray["addressID"] = $value->addressArray[0]->getAddressID(); $this->formArray["number"] = $value->addressArray[0]->getNumber(); $this->formArray["street"] = $value->addressArray[0]->getStreet(); $this->formArray["barangay"] = $value->addressArray[0]->getBarangay(); $this->formArray["district"] = $value->addressArray[0]->getDistrict(); $this->formArray["municipalityCity"] = $value->addressArray[0]->getMunicipalityCity(); $this->formArray["province"] = $value->addressArray[0]->getProvince(); $this->formArray["telephone"] = $value->getTelephone(); $this->formArray["mobileNumber"] = $value->getMobileNumber(); $this->formArray["email"] = $value->getEmail(); } else { $this->formArray[$key] = ""; } break; case "appraisedByDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["as_year"] = removePreZero($dateArr["year"]); $this->formArray["as_month"] = removePreZero($dateArr["month"]); $this->formArray["as_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "recommendingApprovalDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["re_year"] = removePreZero($dateArr["year"]); $this->formArray["re_month"] = removePreZero($dateArr["month"]); $this->formArray["re_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } case "approvedByDate": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["av_year"] = removePreZero($dateArr["year"]); $this->formArray["av_month"] = removePreZero($dateArr["month"]); $this->formArray["av_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateAcquired": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["da_year"] = removePreZero($dateArr["year"]); $this->formArray["da_month"] = removePreZero($dateArr["month"]); $this->formArray["da_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateOfInstallation": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["di_year"] = removePreZero($dateArr["year"]); $this->formArray["di_month"] = removePreZero($dateArr["month"]); $this->formArray["di_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "dateOfOperation": if (true) { list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value); $this->formArray["do_year"] = removePreZero($dateArr["year"]); $this->formArray["do_month"] = removePreZero($dateArr["month"]); $this->formArray["do_day"] = removePreZero($dateArr["day"]); } else { $this->formArray[$key] = ""; } break; case "arpNumber": case "propertyIndexNumber": case "verifiedByID": case "verifiedBy": case "verifiedByName": case "plottingsByID": case "plottingsBy": case "plottingsByName": case "notedByID": case "notedBy": case "notedByName": case "marketValue": case "kind": case "actualUse": case "adjustedMarketValue": case "assessmentLevel": case "assessedValue": case "previousOwner": case "previousAssessedValue": case "taxability": case "effectivity": case "appraisedByID": case "appraisedBy": case "appraisedByName": case "appraisedByDate": case "recommendingApprovalID": case "recommendingApproval": case "recommendingApprovalName": case "recommendingApprovalDate": case "approvedByID": case "approvedBy": case "approvedByName": case "approvedByDate": case "memoranda": case "postingDate": case "landPin": case "surveyNumber": case "productClass": case "areaPlanted": case "totalNumber": case "nonFruitBearing": case "fruitBearing": case "age": case "unitPrice": case "adjustmentFactor": case "percentAdjustment": case "valueAdjustment": case "as_month": case "as_day": case "as_year": case "re_month": case "re_day": case "re_year": case "av_month": case "av_day": case "av_year": $this->formArray[$key] = $value; break; } } } } } } $this->setForm(); $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"]))); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }