public function __construct($id = ID_UNDEFINED) { global $ari; if ($id > ID_MINIMAL && OOB_numeric::isValid($id)) { $this->id = $id; if (!$this->fill()) { throw new OOB_exception("Invalid " . static::getClass() . " id: " . $id, "814", "Invalid class", true); } } }
public function getFormatedValue() { return OOB_numeric::formatPrint($this->value); }
/** Valida que sea un numero, utiliza localidad, por lo q difiere en puntos y comas segun LOCALE */ public static function isNumeric($v) { return OOB_numeric::isValid($v); }
} $where .= " AND C.{$filtro['field']} {$operador_inicio}{$filtro['value']}{$operador_fin} "; } } //FIN DE FILTROS //SE OBTIENE EL LISTADO DE MONEDAS $i = 0; $return = array(); if ($currencies = currency_currency::listCurrenciesForLanguage(USED, 'name', OPERATOR_EQUAL, $language, $where)) { foreach ($currencies as $c) { $return[$i]['id'] = $c->get('id'); $return[$i]['name'] = $c->get('name') . " (" . $c->get('sign') . ")"; $return[$i]['default'] = $c->get('default') == YES ? "SI" : "NO"; $return[$i]['type'] = $c->get('type') == '1' ? "Fija" : "Flotante"; if ($lastValue = $c->getLastChange()) { $return[$i]['cotizacion'] = OOB_numeric::formatPrint($lastValue['value']); } if ($c->get('type') == '1') { $return[$i]['cotizacion'] = OOB_numeric::formatPrint($c->get('value')); } $i++; } } //ARRAY CON LOS RESULTADOS $result = array(); $result["totalCount"] = $i; $result["topics"] = $return; //RESULTADO $obj_comunication = new OOB_ext_comunication(); $obj_comunication->set_data($result); $obj_comunication->send(true, true);
/** * Returns true if successful, false if not. */ public function addChange($value, $date = false) { global $ari; $flagStore = true; if (!OOB_numeric::isValid($value)) { $flagStore = false; $ari->error->addError("currency_currency", "INVALID_VALUE"); } if (!$date) { $date = new Date(); } //valid and clean Date if (!OOB_validatetext::isValidDate($date)) { $flagStore = false; $ari->error->addError("currency_currency", "INVALID_DATE"); } else { $date = $ari->db->qMagic($date->format("%Y-%m-%d %H:%M:%S")); } $value = OOB_numeric::formatMySQL(trim($value)); if ($flagStore) { $value = $ari->db->qMagic($value); $id = $ari->db->qMagic($this->id); $ari->db->StartTrans(); $sql = "INSERT INTO Currency_Change\n\t\t\t\t ( Date, Value, CurrencyID)\n\t\t\t\t VALUES \n\t\t\t\t ( {$date},{$value},{$id} )\n\t\t\t\t "; //echo $sql; exit; $ari->db->Execute($sql); if (!$ari->db->CompleteTrans()) { throw new OOB_exception("Error en DB: {$ari->db}->ErrorMsg()", "010", "Error en la Base de Datos", false); //return false; } else { return true; } } else { return false; } }
if ($desde && $hasta) { //comparar las fechas desde y hasta //return int 0 if the dates are equal, -1 if d1 is before d2, 1 if d1 is after d2 $res = Date::compare($desde, $hasta); if ($res == 1) { $errores[] = "INVALID_INTERVAL"; } } if (count($errores) == 0) { $array_currencies = array(); if ($values = $moneda->getChanges($desde, $hasta)) { //var_dump($values); $changes = array(); $i = 0; foreach ($values as $v) { $changes[$i]['value'] = OOB_numeric::formatPrint($v['value']); $changes[$i]['date'] = $v['date']; $i++; } $ari->t->assign("changes", $changes); } $ari->t->assign("mostrar", true); //var_dump($changes);exit; } else { $ari->t->assign('error', true); foreach ($errores as $e) { $ari->t->assign($e, true); } } } $ari->t->assign("formElement", $sp->FormElement());