function createdetailevents($parenteventid) { $sql = "select * from user_event where id=" . $parenteventid; mysql_query($sql); $handle = mysql_query($sql) or die(mysql_error()); /*$this->db->where('id', $parenteventid); $q = $this->db->get('user_event'); if ($q->num_rows() > 0): $row = $q->row(); endif;*/ $arr; while ($row = mysql_fetch_object($handle)) { $arr["_ID"] = $row->id; $arr["_EventName"] = $row->event_title; $arr["_Location"] = $row->event_loc; $arr["_Description"] = $row->event_desc; $arr["_StartDate"] = $row->start_date; $arr["_EndDate"] = $row->to_date; $arr["_Daily"] = $row->daily; $arr["_Weekly"] = $row->weekly; $arr["_Monthly"] = $row->monthly; $arr["_Yearly"] = $row->yearly; $arr["_Daily_interval"] = $row->daily_interval; $arr["_Weekly_interval"] = $row->weekly_interval; $arr["_Weekly_interval_day"] = $row->weekly_interval_day; $arr["_Monthly_interval"] = $row->monthly_interval; $arr["_Monthly_interval_date"] = $row->monthly_interval_date; $arr["_Yearly_interval_date"] = $row->yearly_interval_date; $arr["_Yearly_interval_month"] = $row->yearly_interval_month; $arr["_Occurence"] = $row->event_occ; $arr["repeat_start_date"] = $row->repeat_start_date; if (trim($arr["_Daily"]) == "0" && trim($arr["_Monthly"]) == "0" && trim($arr["_Weekly"]) == "0" && trim($arr["_Yearly"]) == "0") { $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $enddate = $arr['_EndDate']; $end_exp = explode("/", $enddate); $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0]; $strFieldsName = "parenteventid,startDate,endDate"; $strInsertValue = "'" . $arr["_ID"] . "','" . $arr["_StartDate"] . "','" . $arr["_EndDate"] . "'"; $this->insertdetailevent($strFieldsName, $strInsertValue); } else { $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $startdate = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $enddate = $arr['_EndDate']; $end_exp = explode("/", $enddate); $enddate = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0]; $repeat_start_date = $arr['repeat_start_date']; $repeat_exp = explode("/", $repeat_start_date); $repeat_start_date = $repeat_exp[2] . "-" . $repeat_exp[1] . "-" . $repeat_exp[0]; $date_difference = strtotime($repeat_start_date) - strtotime($startdate); if (trim($arr["_Daily"]) == "1") { // Start Code $strFieldsName = "parenteventid,startDate,endDate"; $strInsertValue = ""; $arr["_Occurence"] = $date_difference / (60 * 60 * 24); if (trim($arr["_Daily_interval"]) != "") { if (intval($arr["_Daily_interval"]) <= 0) { $arr["_Daily_interval"] = 1; } $icounter = -1; $blnloop = 1; while ($blnloop == 1) { $icounter++; $strInsertValue = "'" . $arr["_ID"] . "'"; $interval = intval(trim($arr["_Daily_interval"])) * $icounter; $startresult = mysql_fetch_array(mysql_query("SELECT ADDDATE('" . $startdate . "', INTERVAL " . $interval . " DAY) as startdate")); $endresult = mysql_fetch_array(mysql_query("SELECT ADDDATE('" . $enddate . "', INTERVAL " . $interval . " DAY) as enddate")); $strNewDate = $startresult['startdate']; $strEndDate = $endresult['enddate']; //$strNewDate=adddays($arr["_StartDate"],(intval(trim($arr["_Daily_interval"]))*$icounter),"day"); //$strEndDate=adddays($arr["_EndDate"],(intval(trim($arr["_Daily_interval"]))*$icounter),"day"); $strInsertValue .= ",'" . $strNewDate . "','" . $strEndDate . "'"; $this->insertdetailevent($strFieldsName, $strInsertValue); if ($icounter + 1 >= intval($arr["_Occurence"])) { $blnloop = 0; } } } // End Code } // weekly if (trim($arr["_Weekly"]) == "1") { $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 7); // Start Code $strFieldsName = "parenteventid,startDate,endDate"; $strInsertValue = ""; if (trim($arr["_Weekly_interval"]) == "") { $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $arr["_Weekly_interval"] = getCurrentWeeklyDay($arr["_StartDate"]); } if (trim($arr["_Weekly_interval"]) != "") { $icounter = -1; $blnloop = 1; $strNewDate = ""; $strNewEndDate = ""; $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $enddate = $arr['_EndDate']; $end_exp = explode("/", $enddate); $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0]; while ($blnloop == 1) { $strInsertValue = "'" . $arr["_ID"] . "'"; $icounter++; if ($icounter == 0) { $strNewDate = getWeeklyDay($arr["_StartDate"], trim($arr["_Weekly_interval"])); } else { $intWeekInterval = 1; if (trim($arr["_Weekly_interval_day"]) != "") { $intWeekInterval = intval(trim($arr["_Weekly_interval_day"])); } if ($intWeekInterval <= 0) { $intWeekInterval = 1; } $strNewDate = adddays($strNewDate, $intWeekInterval, "week"); } $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate); $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day"); $exp_new = explode("-", $strNewDate); if (strlen($exp_new[2]) == 1) { $exp_new[2] = "0" . $exp_new[2]; } $exp_newend = explode("-", $strNewEndDate); if (strlen($exp_newend[2]) == 1) { $exp_newend[2] = "0" . $exp_newend[2]; } $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2]; $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2]; $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'"; $this->insertdetailevent($strFieldsName, $strInsertValue); if ($icounter + 1 >= intval($arr["_Occurence"])) { $blnloop = 0; } } } // End Code } // Monthly if (trim($arr["_Monthly"]) == "1") { // Start Code $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 30); $strFieldsName = "parenteventid,startDate,endDate"; $strInsertValue = ""; $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $enddate = $arr['_EndDate']; $end_exp = explode("/", $enddate); $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0]; if (trim($arr["_Monthly_interval"]) == "") { $arr["_Monthly_interval"] = getCurrentMonthDay($arr["_StartDate"]); } if (trim($arr["_Monthly_interval"]) != "") { $icounter = -1; $blnloop = 1; $strNewDate = ""; while ($blnloop == 1) { $strInsertValue = "'" . $arr["_ID"] . "'"; $icounter++; $intMonthInterval = 1; if (trim($arr["_Monthly_interval_date"]) != "") { $intMonthInterval = intval(trim($arr["_Monthly_interval_date"])); } if ($intMonthInterval <= 0) { $intMonthInterval = 1; } if ($icounter == 0) { $strNewDate = getMonthDay($arr["_StartDate"], trim($arr["_Monthly_interval"]), $intMonthInterval, 1); } else { $strNewDate = getMonthDay($strNewDate, trim($arr["_Monthly_interval"]), $intMonthInterval); } if ($strNewDate != "") { $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate); $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day"); $exp_new = explode("-", $strNewDate); if (strlen($exp_new[2]) == 1) { $exp_new[2] = "0" . $exp_new[2]; } $exp_newend = explode("-", $strNewEndDate); if (strlen($exp_newend[2]) == 1) { $exp_newend[2] = "0" . $exp_newend[2]; } $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2]; $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2]; $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'"; $this->insertdetailevent($strFieldsName, $strInsertValue); } if ($icounter + 1 >= intval($arr["_Occurence"])) { $blnloop = 0; } } } // End Code } // Yearly if (trim($arr["_Yearly"]) == "1") { // Start Code $arr["_Occurence"] = $date_difference / (60 * 60 * 24 * 365); $startdate = $arr['_StartDate']; $start_exp = explode("/", $startdate); $arr["_StartDate"] = $start_exp[2] . "-" . $start_exp[1] . "-" . $start_exp[0]; $enddate = $arr['_EndDate']; $end_exp = explode("/", $enddate); $arr["_EndDate"] = $end_exp[2] . "-" . $end_exp[1] . "-" . $end_exp[0]; // Start Code $strFieldsName = "parenteventid,startDate,endDate"; $strInsertValue = ""; if (trim($arr["_Yearly_interval_date"]) == "" && intval(trim($arr["_Yearly_interval_date"])) <= 0) { $arr["_Yearly_interval_date"] = getCurrentMonth($arr["_StartDate"]); } if (trim($arr["_Yearly_interval_month"]) == "" && intval(trim($arr["_Yearly_interval_month"])) <= 0) { $arr["_Yearly_interval_month"] = getCurrentMonthDay($arr["_StartDate"]); } if (trim($arr["_Yearly_interval_month"]) != "") { $icounter = -1; $blnloop = 1; $strNewDate = ""; while ($blnloop == 1) { $strInsertValue = "'" . $arr["_ID"] . "'"; $icounter++; if ($icounter == 0) { $strNewDate = getYearDay($arr["_StartDate"], trim($arr["_Yearly_interval_date"]), trim($arr["_Yearly_interval_month"]), 1); } else { $strNewDate = getYearDay($strNewDate, trim($arr["_Yearly_interval_date"]), trim($arr["_Yearly_interval_month"])); } if ($strNewDate != "") { $arrTempCompare = getDateDifference($arr["_StartDate"], $strNewDate); $strNewEndDate = adddays($arr["_EndDate"], intval($arrTempCompare["days"]), "day"); $exp_new = explode("-", $strNewDate); if (strlen($exp_new[2]) == 1) { $exp_new[2] = "0" . $exp_new[2]; } $exp_newend = explode("-", $strNewEndDate); if (strlen($exp_newend[2]) == 1) { $exp_newend[2] = "0" . $exp_newend[2]; } $strNewDate = $exp_new[0] . "-" . $exp_new[1] . "-" . $exp_new[2]; $strNewEndDate = $exp_newend[0] . "-" . $exp_newend[1] . "-" . $exp_newend[2]; $strInsertValue .= ",'" . $strNewDate . "','" . $strNewEndDate . "'"; $this->insertdetailevent($strFieldsName, $strInsertValue); } if ($icounter + 1 >= intval($arr["_Occurence"])) { $blnloop = 0; } } } // End Code } } } }
/** * function to get up to the hourly difference between two dates * @param: $date1, $time1 * @param: $date2, $time2 */ function getDetailedDateDifference($date1,$time1,$date2,$time2) { if(isDateAuthentic($date1) && isDateAuthentic($date2)) { //duration $duration=0; $duration=getDateDifference($date1,$date2); if($duration) { return ($duration==1?"$duration day":"$duration days"); } else { //get the hourly difference $timeStamp1=0; $timeStamp1=strtotime("$date1 $time1"); $timeStamp2=0; $timeStamp2=strtotime("$date2 $time2"); $timeDuration=0; $timeDuration=(strftime('%H',$timeStamp1)>strftime('%H',$timeStamp2)?strftime('%H',$timeStamp1)-strftime('%H',$timeStamp2):strftime('%H',$timeStamp2)-strftime('%H',$timeStamp1)); $timeDuration=abs($timeDuration); if($timeDuration && $timeStamp1 && $timeStamp2) { return ($timeDuration==1?"$timeDuration hour":"$timeDuration hours"); } } } }
//Hub $row[]=getDetailedTableInfo2("vl_hubs","id='$q[hubID]' limit 1","hub"); //Implementing Partner $row[]=getDetailedTableInfo2("vl_ips","id='".getDetailedTableInfo2("vl_facilities","id='$q[facilityID]' limit 1","ipID")."' limit 1","ip"); //Date of Collection $row[]=getRawFormattedDateLessDay($q["collectionDate"]); //Sample Type $row[]=getDetailedTableInfo2("vl_appendix_sampletype","id='$q[sampleTypeID]' limit 1","appendix"); //Patient ART $row[]=getDetailedTableInfo2("vl_patients","id='$q[patientID]' limit 1","artNumber"); //Patient OtherID $row[]=getDetailedTableInfo2("vl_patients","id='$q[patientID]' limit 1","otherID"); //Gender $row[]=getDetailedTableInfo2("vl_patients","id='$q[patientID]' limit 1","gender"); //Age (Years) $row[]=(getDateDifference(getDetailedTableInfo2("vl_patients","id='$q[patientID]' limit 1","dateOfBirth"),$datetime)?ceil(getDateDifference(getDetailedTableInfo2("vl_patients","id='$q[patientID]' limit 1","dateOfBirth"),$datetime)/365):""); //Phone Number $row[]=getDetailedTableInfo2("vl_patients_phone","patientID='$q[patientID]' order by created desc limit 1","phone"); //Has Patient Been on treatment for at least 6 months $row[]=$q[treatmentLast6Months]; //Date of Treatment Initiation $row[]=getRawFormattedDateLessDay($q["treatmentInitiationDate"]); //Current Regimen $row[]=getDetailedTableInfo2("vl_appendix_regimen","id='$q[currentRegimenID]' limit 1","appendix"); //Other Regimen $row[]=getDetailedTableInfo2("vl_samples_otherregimen","sampleID='$q[id]' and currentRegimenID='$q[currentRegimenID]' limit 1","otherRegimen"); //Indication for Treatment Initiation $row[]=($q["treatmentInitiationID"]?getDetailedTableInfo2("vl_appendix_treatmentinitiation","id='$q[treatmentInitiationID]' limit 1","appendix"):$q["treatmentInitiationOther"]); //Which Treatment Line is Patient on $row[]=getDetailedTableInfo2("vl_appendix_treatmentstatus","id='$q[treatmentStatusID]' limit 1","appendix"); //Reason for Failure
function Main() { //echo $this->formArray["formAction"]; switch ($this->formArray["formAction"]) { case "delete": if (count($this->formArray["personID"]) > 0) { $PersonList = new SoapObject(NCCBIZ . "PersonList.php", "urn:Object"); if (!($deletedRows = $PersonList->deleteRecord($this->formArray["personID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["companyID"]) > 0) { $CompanyList = new SoapObject(NCCBIZ . "CompanyList.php", "urn:Object"); if (!($deletedRows = $CompanyList->deleteRecord($this->formArray["companyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"]))); exit; break; case "remove": if (count($this->formArray["personID"])) { $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (!($deletedRows = $OwnerList->removeOwnerPerson($this->formArray["ownerID"], $this->formArray["personID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["companyID"]) > 0) { $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (!($deletedRows = $OwnerList->removeOwnerCompany($this->formArray["ownerID"], $this->formArray["companyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"]))); exit; break; default: $this->tpl->set_var("msg", ""); } $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) { exit("xml failed"); } else { //exit($xmlStr); if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $od = new OD(); $od->parseDomDocument($domDoc); foreach ($od as $key => $value) { if ($key == "locationAddress" && is_object($value)) { foreach ($value as $lkey => $lvalue) { $this->formArray[$lkey] = $lvalue; } } else { $this->formArray[$key] = $value; } } $this->formArray["landArea"] = number_format($od->getLandArea(), 4, '.', ','); // confirmation for double transaction $this->formArray["TRANSACTION_MAX_DAYDIFFERENCE"] = TRANSACTION_MAX_DAYDIFFERENCE; $this->formArray["dayDifference"] = getDateDifference($od->getDateCreated(), strtotime("now"), "d"); $this->formArray["dayDifferenceText"] = getOnlyDays($this->formArray["dayDifference"]); $this->formArray["transactionCode"] = $od->getTransactionCode(); $this->formArray["blockDoubleTransaction"] = $od->getArchive(); $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object"); $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]); //$OwnerList = new SoapObject(NCCBIZ."OwnerList.php", "urn:Object"); $xmlStr = $od->owner->domDocument->dump_mem(true); if (!$xmlStr) { //exit(print_r($OwnerList)); $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", ""); } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $this->displayOwnerList($domDoc); } } } } $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object"); if (!($afsID = $AFSEncode->getAfsID($this->formArray["odID"]))) { //$this->tpl->set_block("rptsTemplate", "AFSDetails", "AFSDetailsBlock"); //$this->tpl->set_var("AFSDetailsBlock", ""); //echo "1afsID=".$afsID."=>".$this->formArray["odID"]; $afs = new AFS(); $afs->setOdID($this->formArray["odID"]); $afs->setDomDocument(); $doc = $afs->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($afsID = $AFSEncode->saveAFS($xmlStr))) { echo "ret=" . $afsID; } //echo "<br>afsID=".$afsID; } else { //echo "2afsID=".$afsID."=>".$this->formArray["odID"]; //$this->tpl->set_block("rptsTemplate", "AFSEncode", "AFSEncodeBlock"); //$this->tpl->set_var("AFSEncodeBlock", ""); } $this->displayODHistory(); $this->formArray["afsID"] = $afsID; $this->setForm(); $this->setPageDetailPerms(); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y")); $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"); }
function Main() { switch ($this->formArray["formAction"]) { case "remove": if (count($this->formArray["landID"])) { //print_r($this->formArray["landID"]); $LandList = new SoapObject(NCCBIZ . "LandList.php", "urn:Object"); if (!($deletedRows = $LandList->removeLand($this->formArray["landID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["plantsTreesID"])) { //print_r($this->formArray["plantsTreesID"]); $PlantsTreesList = new SoapObject(NCCBIZ . "PlantsTreesList.php", "urn:Object"); if (!($deletedRows = $PlantsTreesList->removePlantsTrees($this->formArray["plantsTreesID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["machineriesID"])) { //print_r($this->formArray["machineriesID"]); $MachineriesList = new SoapObject(NCCBIZ . "MachineriesList.php", "urn:Object"); if (!($deletedRows = $MachineriesList->removeMachineries($this->formArray["machineriesID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["improvementsBuildingsID"])) { //print_r($this->formArray["improvementsBuildingsID"]); $ImprovementsBuildingsList = new SoapObject(NCCBIZ . "ImprovementsBuildingsList.php", "urn:Object"); if (!($deletedRows = $ImprovementsBuildingsList->removeImprovementsBuildings($this->formArray["improvementsBuildingsID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["storeyID"])) { //print_r($this->formArray["storeyID"]); $StoreyList = new SoapObject(NCCBIZ . "StoreyList.php", "urn:Object"); if (!($deletedRows = $StoreyList->removeStorey($this->formArray["storeyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: AFSDetails.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"]))); exit; break; default: $this->tpl->set_var("msg", ""); } $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object"); if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) { $this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock"); $this->tpl->set_var("AFSTableBlock", "afs not found"); } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $afs = new AFS(); $afs->parseDomDocument($domDoc); //print_r($afs); foreach ($afs as $key => $value) { $this->formArray[$key] = $value; $this->formArray["totalMarketValue"] = 0; $this->formArray["totalAssessedValue"] = 0; } // RPU Identification Numbers $this->displayRPUIdentification($afs); $landList = $afs->getLandArray(); $plantsTreesList = $afs->getPlantsTreesArray(); $improvementsBuildingsList = $afs->getImprovementsBuildingsArray(); $machineriesList = $afs->getMachineriesArray(); if (count($landList)) { $hideTD = false; $this->formArray["propertyType"] = "Land"; $this->displayLandPlantsTrees($landList, $plantsTreesList); $this->displayGISTechnicalDescription($afs); $this->hideProperty('ImprovementsBuildings', 'improvementsBuildings'); $this->hideProperty('Machineries', 'machineries'); } else { if (count($plantsTreesList)) { $hideTD = false; $this->formArray["propertyType"] = "Land"; $this->displayLandPlantsTrees($landList, $plantsTreesList); $this->displayGISTechnicalDescription($afs); $this->hideProperty('ImprovementsBuildings', 'improvementsBuildings'); $this->hideProperty('Machineries', 'machineries'); } else { if (count($improvementsBuildingsList)) { $hideTD = false; $this->formArray["propertyType"] = "ImprovementsBuildings"; $this->displayImprovementsBuildingsMachineries($improvementsBuildingsList, $machineriesList); $this->hideBlock('GISTechnicalDescriptionHide'); $this->hideProperty('Land', 'land'); $this->hideProperty('PlantsTrees', 'plantsTrees'); } else { if (count($machineriesList)) { $hideTD = false; $this->formArray["propertyType"] = "Machineries"; $this->displayImprovementsBuildingsMachineries($improvementsBuildingsList, $machineriesList); $this->hideBlock('GISTechnicalDescriptionHide'); $this->hideProperty('Land', 'land'); $this->hideProperty('PlantsTrees', 'plantsTrees'); } else { $hideTD = true; $this->hideBlock('GISTechnicalDescriptionHide'); $this->displayLandPlantsTrees($landList, $plantsTreesList); $this->displayImprovementsBuildingsMachineries($improvementsBuildingsList, $machineriesList); $this->formArray["landTotalMarketValue"] = 0; $this->formArray["landTotalAssessedValue"] = 0; $this->formArray["plantTotalMarketValue"] = 0; $this->formArray["plantTotalAssessedValue"] = 0; $this->formArray["bldgTotalMarketValue"] = 0; $this->formArray["bldgTotalAssessedValue"] = 0; $this->formArray["machTotalMarketValue"] = 0; $this->formArray["machTotalAssessedValue"] = 0; } } } } if ($hideTD == false) { // Display TD $this->displayTD($afs->afsID); } else { // Hide TD $this->tpl->set_block("rptsTemplate", "DeclarationOfProperty", "DeclarationOfPropertyBlock"); $this->tpl->set_var("DeclarationOfPropertyBlock", ""); } $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) { exit("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 { $od = new OD(); $od->parseDomDocument($domDoc); foreach ($od as $key => $value) { if ($key == "locationAddress" && is_object($value)) { foreach ($value as $lkey => $lvalue) { $this->formArray[$lkey] = $lvalue; } } else { $this->formArray[$key] = $value; } } // confirmation for double transaction $this->formArray["TRANSACTION_MAX_DAYDIFFERENCE"] = TRANSACTION_MAX_DAYDIFFERENCE; $this->formArray["dayDifference"] = getDateDifference($od->getDateCreated(), strtotime("now"), "d"); $this->formArray["dayDifferenceText"] = getOnlyDays($this->formArray["dayDifference"]); $this->formArray["transactionCode"] = $od->getTransactionCode(); $this->formArray["blockDoubleTransaction"] = $od->getArchive(); $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object"); $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]); $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (!($xmlStr = $OwnerList->getOwnerList($this->formArray["ownerID"]))) { //exit(print_r($OwnerList)); $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", ""); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $this->displayOwnerList($domDoc); } } } } } } $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object"); $afs = new AFS(); $afs->selectRecord($this->formArray["afsID"]); $afs->setAfsID($this->formArray["afsID"]); $afs->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]); $afs->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]); $afs->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]); $afs->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]); $afs->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]); $afs->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]); $afs->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]); $afs->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]); $afs->setTotalMarketValue($this->formArray["totalMarketValue"]); $afs->setTotalAssessedValue($this->formArray["totalAssessedValue"]); $afs->setDomDocument(); $doc = $afs->getDomDocument(); $xmlStr = $doc->dump_mem(true); //print_r($AFSEncode); //echo $xmlStr; if (!($ret = $AFSEncode->updateAFS($xmlStr))) { echo "ret=" . $ret; } //echo $ret; $this->setForm(); $this->setPageDetailPerms(); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y")); $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"]))); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }