<?php session_start(); include 'wsdls.php'; include 'Bapi.php'; try { $Bapi = new Bapi(); $Bapi->bapiCall($bapiname['dropdown']); $Receive = new Receive(); $Receive->getResult(); $ResponseTable = new ResponseTable(); $rp = $ResponseTable->getTable('TDROPDOWN'); } catch (Exception $e) { echo $msg = 'Message:- ' . $e->getMessage(); exit; } //print_r($r); $json_en = json_encode($rp); $json_de = json_decode($json_en, true); //var_dump($json_de); foreach ($json_de as $keys => $values) { $options[$values['TYPE']] = "<option value=''></option>"; } foreach ($json_de as $keys => $values) { $options[$values['TYPE']] .= "<option value='" . $values['VALUE'] . "'>" . $values['TEXT'] . "</option>"; } $_SESSION['options'] = $options; header('location:../html/registration.php');
/** * @param sfWebRequest $request * @return sfView */ public function executeSave(sfWebRequest $request) { $this->forward404Unless($request->isXmlHttpRequest()); $measurement = $request->getParameter('measurement'); $decision_id = $request->getParameter('decision_id'); $user = $this->getUser()->getGuardUser(); $keys = array_keys($measurement); $alternative_id = array_shift($keys); $keys = array_keys($measurement[$alternative_id]); $criterion_id = array_shift($keys); $value = $measurement[$alternative_id][$criterion_id]; $alternativeMeasurement = AlternativeMeasurementTable::getInstance()->getOneForDashboard($user, $decision_id, $alternative_id, $criterion_id); if (is_object($alternativeMeasurement)) { $alternativeMeasurement->score = $value; $alternativeMeasurement->save(); } else { $response = ResponseTable::getInstance()->getOneForDashboard($user, $decision_id); if (is_object($response)) { $alternativeMeasurement = new AlternativeMeasurement(); $alternativeMeasurement->score = $value; $alternativeMeasurement->alternative_head_id = $alternative_id; $alternativeMeasurement->criterion_id = $criterion_id; $alternativeMeasurement->Response = $response; $alternativeMeasurement->save(); } } Doctrine_Query::create()->delete()->from('Graph')->where('decision_id = ?', $decision_id)->execute(); $criteriaAnalyze = new CriteriaAnalyze(); $criteriaAnalyze->setDecisionId($decision_id); $criteriaAnalyze->load(); $stackedBarChart = new StackedBarChart(); $stackedBarChart->setDecisionId($decision_id); $stackedBarChart->setCriteriaValues($criteriaAnalyze->getCriteriaValues()); $stackedBarChart->load(); $costAnalyze = new CostAnalyze(); $costAnalyze->setDecisionId($decision_id); $costAnalyze->setSortedAlternativeIds($stackedBarChart->getSortedAlternativeIds()); $costAnalyze->setCumulativeData($stackedBarChart->getCumulativeData()); $costAnalyze->load(); $cumulativeChart = new CumulativeGainChart(); $cumulativeChart->setDecisionId($decision_id); $cumulativeChart->setSortedAlternativeIds($stackedBarChart->getSortedAlternativeIds()); $cumulativeChart->setMeasurement($stackedBarChart->getCumulativeData()); $cumulativeChart->setCostData($costAnalyze->getData()); $cumulativeChart->setAlternativeNames($costAnalyze->getAlternativeNames()); $cumulativeChart->setCriterionNames($costAnalyze->getCriteria()); $cumulativeChart->load(); $stacked_bar_chart[] = '"data":' . $stackedBarChart->getJsonData(); $stacked_bar_chart[] = '"alternatives":' . $stackedBarChart->getAlternativesJson(); $stacked_bar_chart[] = '"criteria":' . $stackedBarChart->getCriteriaJson(); $cumulative_chart[] = '"costData":' . $cumulativeChart->getJsonCostData(); $cumulative_chart[] = '"benefitData":' . $cumulativeChart->getJsonData(); $cumulative_chart[] = '"criteria":' . json_encode($costAnalyze->getCriteria()); $cumulative_chart[] = '"alternatives":' . $cumulativeChart->getAlternativesJson(); $response = array(); $response[] = '"cumulativeChart":{' . implode(',', $cumulative_chart) . '}'; $response[] = '"stackedBarChart":{' . implode(',', $stacked_bar_chart) . '}'; $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); return $this->renderText('{' . implode(',', $response) . '}'); }
/** * Return the values from the database or empty array */ public function getValues() { $return = array(); if ($this->role and $this->role->Response->count() and $this->role->updateable and !$this->role->anonymous) { $context = sfContext::getInstance(); $user = $context->getUser(); // find response by user_id if ($user->isAuthenticated()) { $response = ResponseTable::getInstance()->findByRoleIdAndUserId($this->role->id, $user->getGuardUser()->id)->getFirst(); } else { $email = $user->getAttribute('email_address', null, 'measurement/email/' . $this->role->id); $response = ResponseTable::getInstance()->findByRoleIdAndEmailAddress($this->role->id, $email)->getFirst(); } if ($response instanceof Response) { $values = CriterionPrioritizationTable::getInstance()->findByResponseId($response->id); /** @var CriterionPrioritization $object */ foreach ($values as $object) { $return[$object->criterion_head_id] = $object->score; } } } return $return; }
Input validations must be done here as follows: $response = array( "success" => false, "error" => "Error message" ); */ $response = array(); if (empty($response)) { try { $bapi = new Bapi(); $bapi->bapiCall($bapiname['query']); $bapiImport = new BapiImport(); $bapiImport->setImport('TOKEN', $_SESSION['TOKEN']); $bapiImport->setImport('MATNR', $part); $bapiImport->setImport('ORT01', $city); $bapiImport->setImport('REGIO', $state); $bapiImport->setImport('PSTLZ', $zip); $bapiImport->setImport('DATE', $date); $bapiImport->setImport('STORE', $store); $receive = new Receive(); $receive->getResult(); $responseTable = new ResponseTable(); $results = $responseTable->getTable('TLIST'); $response = array("success" => true, "data" => $results); } catch (Exception $e) { $response = array("success" => false, "error" => $e->getMessage()); } } header("Content-Type: application/json"); echo json_encode($response);
include 'Bapi.php'; $cust_id = $_REQUEST['id']; $data = file_get_contents('../data/stockreport.json'); $json = json_decode($data, true); if (isset($json[$cust_id])) { $jsondata = $json[$cust_id][0]; try { $Bapi = new Bapi(); $Bapi->bapiCall($bapiname['stockreport']); $BapiImport = new BapiImport(); $BapiImport->setImport('I_PLANT', $jsondata['I_PLANT']); $BapiImport->setImport('I_MRP_AREA', $jsondata['I_MRP_AREA']); $BapiImport->setImport('I_STORAGE', $jsondata['I_STORAGE']); $Receive = new Receive(); $Receive->getResult(); $ResponseTable = new ResponseTable(); $rp = $ResponseTable->getTable('T_STATUS'); $array_str[] = array('MATNR' => 'Material', 'MAKTX' => 'Description', 'UNRES' => 'On hand', 'RSRVS' => 'Reserved', 'OPENS' => 'Incoming PO', 'AVAIL' => 'Available'); foreach ($rp as $values) { unset($values['MTART']); unset($values['WERKS']); unset($values['LGORT']); unset($values['BERID']); unset($values['KUNNR']); unset($values['EISBE']); unset($values['STATS']); unset($values['BSTMI']); unset($values['EINDT']); unset($values['KIT']); unset($values['PRICE']); unset($values['TOTVAL']);
public function getResponseListResponse(sfGuardUser $user) { /** @var sfWebRequest $request */ $request = $this->getRequest(); return array('status' => 'success', 'result' => ResponseTable::getInstance()->getListForAPI($user, $request->getParameter('decision_id'))); }
public function save() { $context = sfContext::getInstance(); $user = $context->getUser(); // When the role marked as "updateable" anyone with the link can enter the response and update it. /** @var Response $response */ if ($this->role->updateable) { if ($this->role->Response->count() && !$this->role->anonymous) { // find response by user_id if ($user->isAuthenticated()) { $response = ResponseTable::getInstance()->findByRoleIdAndUserId($this->role->id, $user->getGuardUser()->id)->getFirst(); } else { $email = $user->getAttribute('email_address', null, 'measurement/email/' . $this->role->id); $response = ResponseTable::getInstance()->findByRoleIdAndEmailAddress($this->role->id, $email)->getFirst(); } if (!$response instanceof Response) { $response = new Response(); $response->role_id = $this->role->id; } } else { $response = new Response(); $response->role_id = $this->role->id; } } else { $response = new Response(); $response->role_id = $this->role->id; } $response->decision_id = $this->role->decision_id; $response->ip_address = $context->getRequest()->getHttpHeader('addr', 'remote'); if ($user->isAuthenticated()) { $response->user_id = $user->getGuardUser()->id; } else { if ($this->role->anonymous) { $response->email_address = 'anonymous'; } else { $response->email_address = $user->getAttribute('email_address', null, 'measurement/email/' . $this->role->id); } if (!$this->role->continue_url) { $user->getAttributeHolder()->remove('email_address', 0, 'measurement/email/' . $this->role->id); } } $response->save(); // Saves data from the last step $this->methodObject->setResponseId($response->id); $this->methodObject->save(); $this->methodObject->clean(); // Saves data from the previous steps while ($this->map->hasPreviousStep()) { $this->map->back(); list($methodClassName, $data) = $this->map->getCurrentStep(); /** @var MeasurementMethod $methodObjectName */ $methodObjectName = new $methodClassName($data); $methodObjectName->setRole($this->role); $methodObjectName->setResponseId($response->id); $methodObjectName->save(); $methodObjectName->clean(); } // Update charts in "Analyze" tab Doctrine_Query::create()->delete()->from('Graph')->where('decision_id = ?', $response->decision_id)->execute(); $this->map->clean(); }
} } return $output; } $po = trim($_REQUEST['po']); include 'wsdls.php'; include 'Bapi.php'; $Bapi = new Bapi(); $Bapi->bapiCall($bapiname['orders']); $BapiImport = new BapiImport(); $BapiImport->setImport('TOKEN', $_SESSION['TOKEN']); $BapiImport->setImport('ACTION', 'PACKINGBYPO'); $BapiImport->setImport('ACTION_KEY', $po); $Receive = new Receive(); $Receive->getResult(); $ResponseTable = new ResponseTable(); $rp = $ResponseTable->getTable('TTEXT'); //echo 'E387B1F6E77CB2F197B300219BA1B6E0=='.$_SESSION['TOKEN']; //$rp=$_SESSION['Ttext']; //var_dump($rp); $json_en = json_encode($rp); $table_as = json_decode($json_en, true); //var_dump($table_as); if (!empty($table_as)) { $i = 0; foreach ($table_as as $keys => $values) { if ($values['TYPE'] == 'PACKING') { $hr = $po; if ($i == 0) { $hr = 'PO Number'; }