示例#1
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $MachineriesDetails = new SoapObject(NCCBIZ . "MachineriesDetails.php", "urn:Object");
             if (!($xmlStr = $MachineriesDetails->getMachineries($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 {
                     $machineries = new Machineries();
                     $machineries->parseDomDocument($domDoc);
                     foreach ($machineries 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":
             $MachineriesEncode = new SoapObject(NCCBIZ . "MachineriesEncode.php", "urn:Object");
             if ($this->formArray["propertyID"] != "") {
                 $MachineriesDetails = new SoapObject(NCCBIZ . "MachineriesDetails.php", "urn:Object");
                 if (!($xmlStr = $MachineriesDetails->getMachineries($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();
                         $machineries = new Machineries();
                         $machineries->parseDomDocument($domDoc);
                         $machineries->setPropertyID($this->formArray["propertyID"]);
                         $machineries->setAfsID($this->formArray["afsID"]);
                         $machineries->setArpNumber($this->formArray["arpNumber"]);
                         $machineries->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                         $machineries->setPropertyAdministrator($propertyAdministrator);
                         $machineries->setVerifiedBy($this->formArray["verifiedByID"]);
                         $machineries->setPlottingsBy($this->formArray["plottingsByID"]);
                         $machineries->setNotedBy($this->formArray["notedByID"]);
                         $machineries->setMarketValue($this->formArray["marketValue"]);
                         $machineries->setKind($this->formArray["kind"]);
                         $machineries->setActualUse($this->formArray["actualUse"]);
                         $machineries->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                         $machineries->setAssessmentLevel($this->formArray["assessmentLevel"]);
                         $machineries->setAssessedValue($this->formArray["assessedValue"]);
                         $machineries->setPreviousOwner($this->formArray["previousOwner"]);
                         $machineries->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $machineries->setTaxability($this->formArray["taxability"]);
                         $machineries->setEffectivity($this->formArray["effectivity"]);
                         $machineries->setAppraisedBy($this->formArray["appraisedByID"]);
                         $machineries->setAppraisedByDate($this->formArray["appraisedByDate"]);
                         $machineries->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                         $machineries->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                         $machineries->setApprovedBy($this->formArray["approvedByID"]);
                         $machineries->setApprovedByDate($this->formArray["approvedByDate"]);
                         $machineries->setMemoranda($this->formArray["memoranda"]);
                         $machineries->setPostingDate($this->formArray["postingDate"]);
                         $machineries->setBuildingPin($this->formArray["buildingPin"]);
                         $machineries->setLandPin($this->formArray["landPin"]);
                         $machineries->setMachineryDescription($this->formArray["machineryDescription"]);
                         $machineries->setBrand($this->formArray["brand"]);
                         $machineries->setModelNumber($this->formArray["modelNumber"]);
                         $machineries->setCapacity($this->formArray["capacity"]);
                         $machineries->setDateAcquired($this->formArray["dateAcquired"]);
                         $machineries->setConditionWhenAcquired($this->formArray["conditionWhenAcquired"]);
                         $machineries->setEstimatedEconomicLife($this->formArray["estimatedEconomicLife"]);
                         $machineries->setRemainingEconomicLife($this->formArray["remainingEconomicLife"]);
                         $machineries->setDateOfInstallation($this->formArray["dateOfInstallation"]);
                         $machineries->setDateOfOperation($this->formArray["dateOfOperation"]);
                         $machineries->setRemarks($this->formArray["remarks"]);
                         $machineries->setNumberOfUnits($this->formArray["numberOfUnits"]);
                         $machineries->setAcquisitionCost($this->formArray["acquisitionCost"]);
                         $machineries->setFreightCost($this->formArray["freightCost"]);
                         $machineries->setInsuranceCost($this->formArray["insuranceCost"]);
                         $machineries->setInstallationCost($this->formArray["installationCost"]);
                         $machineries->setOthersCost($this->formArray["othersCost"]);
                         $machineries->setDepreciation($this->formArray["depreciation"]);
                         $machineries->setTotalDepreciation($this->formArray["totalDepreciation"]);
                         $machineries->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                         $machineries->setCreatedBy($this->userID);
                         $machineries->setModifiedBy($this->userID);
                         $machineries->setDomDocument();
                         $doc = $machineries->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //echo $xmlStr;
                         if (!($ret = $MachineriesEncode->updateMachineries($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();
                 $machineries = new Machineries();
                 $machineries->parseDomDocument($domDoc);
                 //$machineries->setPropertyID($this->formArray["propertyID"]);
                 $machineries->setAfsID($this->formArray["afsID"]);
                 $machineries->setArpNumber($this->formArray["arpNumber"]);
                 $machineries->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $machineries->setPropertyAdministrator($propertyAdministrator);
                 $machineries->setVerifiedBy($this->formArray["verifiedByID"]);
                 $machineries->setPlottingsBy($this->formArray["plottingsByID"]);
                 $machineries->setNotedBy($this->formArray["notedByID"]);
                 $machineries->setMarketValue($this->formArray["marketValue"]);
                 $machineries->setKind($this->formArray["kind"]);
                 $machineries->setActualUse($this->formArray["actualUse"]);
                 $machineries->setAdjustedMarketValue($this->formArray["adjustedMarketValue"]);
                 $machineries->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $machineries->setAssessedValue($this->formArray["assessedValue"]);
                 $machineries->setPreviousOwner($this->formArray["previousOwner"]);
                 $machineries->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $machineries->setTaxability($this->formArray["taxability"]);
                 $machineries->setEffectivity($this->formArray["effectivity"]);
                 $machineries->setAppraisedBy($this->formArray["appraisedByID"]);
                 $machineries->setAppraisedByDate($this->formArray["appraisedByDate"]);
                 $machineries->setRecommendingApproval($this->formArray["recommendingApprovalID"]);
                 $machineries->setRecommendingApprovalDate($this->formArray["recommendingApprovalDate"]);
                 $machineries->setApprovedBy($this->formArray["approvedByID"]);
                 $machineries->setApprovedByDate($this->formArray["approvedByDate"]);
                 $machineries->setMemoranda($this->formArray["memoranda"]);
                 $machineries->setPostingDate($this->formArray["postingDate"]);
                 $machineries->setBuildingPin($this->formArray["buildingPin"]);
                 $machineries->setLandPin($this->formArray["landPin"]);
                 $machineries->setMachineryDescription($this->formArray["machineryDescription"]);
                 $machineries->setBrand($this->formArray["brand"]);
                 $machineries->setModelNumber($this->formArray["modelNumber"]);
                 $machineries->setCapacity($this->formArray["capacity"]);
                 $machineries->setDateAcquired($this->formArray["dateAcquired"]);
                 $machineries->setConditionWhenAcquired($this->formArray["conditionWhenAcquired"]);
                 $machineries->setEstimatedEconomicLife($this->formArray["estimatedEconomicLife"]);
                 $machineries->setRemainingEconomicLife($this->formArray["remainingEconomicLife"]);
                 $machineries->setDateOfInstallation($this->formArray["dateOfInstallation"]);
                 $machineries->setDateOfOperation($this->formArray["dateOfOperation"]);
                 $machineries->setRemarks($this->formArray["remarks"]);
                 $machineries->setNumberOfUnits($this->formArray["numberOfUnits"]);
                 $machineries->setAcquisitionCost($this->formArray["acquisitionCost"]);
                 $machineries->setFreightCost($this->formArray["freightCost"]);
                 $machineries->setInsuranceCost($this->formArray["insuranceCost"]);
                 $machineries->setInstallationCost($this->formArray["installationCost"]);
                 $machineries->setOthersCost($this->formArray["othersCost"]);
                 $machineries->setDepreciation($this->formArray["depreciation"]);
                 $machineries->setTotalDepreciation($this->formArray["totalDepreciation"]);
                 $machineries->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                 $machineries->setCreatedBy($this->userID);
                 $machineries->setModifiedBy($this->userID);
                 $machineries->setDomDocument();
                 $doc = $machineries->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //exit($xmlStr);
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $MachineriesEncode->saveMachineries($xmlStr))) {
                     echo "ret=" . $ret;
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: MachineriesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "cancel":
             header("location: MachineriesList.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 {
                 $MachineriesDetails = new SoapObject(NCCBIZ . "MachineriesDetails.php", "urn:Object");
                 if (!($xmlStr = $MachineriesDetails->getMachineries($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 {
                         $machineries = new Machineries();
                         $machineries->parseDomDocument($domDoc);
                         foreach ($machineries 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 "buildingPin":
                                 case "landPin":
                                 case "machineryDescription":
                                 case "brand":
                                 case "modelNumber":
                                 case "capacity":
                                 case "dateAcquired":
                                 case "conditionWhenAcquired":
                                 case "estimatedEconomicLife":
                                 case "remainingEconomicLife":
                                 case "dateOfInstallation":
                                 case "dateOfOperation":
                                 case "remarks":
                                 case "numberOfUnits":
                                 case "acquisitionCost":
                                 case "freightCost":
                                 case "insuranceCost":
                                 case "installationCost":
                                 case "othersCost":
                                 case "depreciation":
                                 case "totalDepreciation":
                                 case "depreciatedMarketValue":
                                 case "da_month":
                                 case "da_day":
                                 case "da_year":
                                 case "di_month":
                                 case "di_day":
                                 case "di_year":
                                 case "do_month":
                                 case "do_day":
                                 case "do_year":
                                 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;
                             }
                         }
                     }
                 }
                 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");
 }
示例#2
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $MachineriesDetails = new SoapObject(NCCBIZ . "MachineriesDetails.php", "urn:Object");
             if (!($xmlStr = $MachineriesDetails->getMachineries($this->formArray["machineriesID"]))) {
                 $this->tpl->set_block("rptsTemplate", "FORM", "FORMBlock");
                 $this->tpl->set_var("FORMBlock", "error xmlDoc");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "FORM", "FORMBlock");
                     $this->tpl->set_var("FORMBlock", "error xmlDoc");
                 } else {
                     $machineries = new Machineries();
                     $machineries->parseDomMachineries($domDoc);
                     foreach ($machineries as $key => $value) {
                         $this->formArray[$key] = $value;
                     }
                 }
             }
             break;
         case "save":
             $MachineriesEncode = new SoapObject(NCCBIZ . "MachineriesEncode.php", "urn:Object");
             if ($this->formArray["machineriesID"] != "") {
                 $machineries = new Machineries();
                 $machineries->selectMachineries($this->formArray["machineriesID"]);
                 $machineries->setMachineriesID($this->formArray["machineriesID"]);
                 $machineries->setAfsID($this->formArray["afsID"]);
                 $machineries->setSurveyNumber($this->formArray["surveyNumber"]);
                 $machineries->setDescription($this->formArray["description"]);
                 $machineries->setBrandAndModel($this->formArray["brandAndModel"]);
                 $machineries->setCapacityHP($this->formArray["capacityHP"]);
                 $machineries->setDateAcquired($this->formArray["dateAcquired"]);
                 $machineries->setConditionWhenAcquired($this->formArray["conditionWhenAcquired"]);
                 $machineries->setEstimatedEconomicLife($this->formArray["estimatedEconomicLife"]);
                 $machineries->setRemainingEconomicLife($this->formArray["remainingEconomicLife"]);
                 $machineries->setDateOfInstallation($this->formArray["dateOfInstallation"]);
                 $machineries->setDateOfOperation($this->formArray["dateOfOperation"]);
                 $machineries->setRemarks($this->formArray["remarks"]);
                 $machineries->setNumberOfUnits($this->formArray["numberOfUnits"]);
                 $machineries->setFreightAcquisitionCost($this->formArray["freightAcquisitionCost"]);
                 $machineries->setInsuranceAcquisitionCost($this->formArray["insuranceAcquisitionCost"]);
                 $machineries->setInstallationAcquisitionCost($this->formArray["installationAcquisitionCost"]);
                 $machineries->setOthers($this->formArray["others"]);
                 $machineries->setMarketValue($this->formArray["marketValue"]);
                 $machineries->setDepreciation($this->formArray["depreciation"]);
                 $machineries->setDdepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                 $machineries->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $machineries->setAssessedValue($this->formArray["assessedValue"]);
                 $machineries->setDateAssessed($this->formArray["dateAssessed"]);
                 $machineries->setAssessor($this->formArray["assessor"]);
                 $machineries->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $machineries->setDomMachineries();
                 $doc = $machineries->getDomMachineries();
                 $xmlStr = $doc->dump_mem();
                 if (!($ret = $MachineriesEncode->updateMachineries($xmlStr))) {
                     echo "error update";
                 }
                 header("location: MachineriesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
                 //exit($this->formArray["afsID"]);
             } else {
                 $machineries = new Machineries();
                 $machineries->setAfsID($this->formArray["afsID"]);
                 $machineries->setSurveyNumber($this->formArray["surveyNumber"]);
                 $machineries->setDescription($this->formArray["description"]);
                 $machineries->setBrandAndModel($this->formArray["brandAndModel"]);
                 $machineries->setCapacityHP($this->formArray["capacityHP"]);
                 $machineries->setDateAcquired($this->formArray["dateAcquired"]);
                 $machineries->setConditionWhenAcquired($this->formArray["conditionWhenAcquired"]);
                 $machineries->setEstimatedEconomicLife($this->formArray["estimatedEconomicLife"]);
                 $machineries->setRemainingEconomicLife($this->formArray["remainingEconomicLife"]);
                 $machineries->setDateOfInstallation($this->formArray["dateOfInstallation"]);
                 $machineries->setDateOfOperation($this->formArray["dateOfOperation"]);
                 $machineries->setRemarks($this->formArray["remarks"]);
                 $machineries->setNumberOfUnits($this->formArray["numberOfUnits"]);
                 $machineries->setFreightAcquisitionCost($this->formArray["freightAcquisitionCost"]);
                 $machineries->setInsuranceAcquisitionCost($this->formArray["insuranceAcquisitionCost"]);
                 $machineries->setInstallationAcquisitionCost($this->formArray["installationAcquisitionCost"]);
                 $machineries->setOthers($this->formArray["others"]);
                 $machineries->setMarketValue($this->formArray["marketValue"]);
                 $machineries->setDepreciation($this->formArray["depreciation"]);
                 $machineries->setDepreciatedMarketValue($this->formArray["depreciatedMarketValue"]);
                 $machineries->setAssessmentLevel($this->formArray["assessmentLevel"]);
                 $machineries->setAssessedValue($this->formArray["assessedValue"]);
                 $machineries->setDateAssessed($this->formArray["dateAssessed"]);
                 $machineries->setAssessor($this->formArray["assessor"]);
                 $machineries->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $machineries->setDomMachineries();
                 $doc = $machineries->getDomMachineries();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $MachineriesEncode->saveMachineries($xmlStr))) {
                     echo "ret=" . $ret . "<br>";
                 }
                 //echo $xmlStr;
                 $this->formArray["machineriesID"] = $ret;
                 header("location: MachineriesClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
                 exit("machineriesID = {$ret}" . "<br>afsID=" . $this->formArray["afsID"]);
             }
             break;
         case "cancel":
             header("location: MachineriesList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
             $this->tpl->set_var("odIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $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");
 }