<?php global $ari; $ari->popup = 1; // no mostrar el main_frame $language = $ari->get('agent')->getLang(); //CAMBIO EL VALOR DE LAS MONEDAS if (isset($_POST['NewsValuesData'])) { $news_values = json_decode($_POST['NewsValuesData'], true); foreach ($news_values['items'] as $item) { $currency = new currency_currency($item['id']); if ($currency->get("type") == 2) { $date = new Date(date('Y-m-d', strtotime($news_values['fecha'])) . " " . date('H:i:s')); $separador = trim($ari->locale->get('decimal', 'numbers')); $currency->addChange(number_format(1 / $item['value'], 6, $separador, ""), $date); } } } //SE OBTIENE EL LISTADO DE CAMBIOS DE MONEDAS $i = 0; $return = array(); //para que no muestre las monedas de cambio fijo $where = ' AND type = 2'; if ($currencies = currency_currency::listCurrenciesForLanguage(USED, 'name', OPERATOR_EQUAL, $language, $where)) { foreach ($currencies as $c) { $return[$i]['id'] = $c->get('id'); $return[$i]['currency'] = $c->get('name') . " (" . $c->get('sign') . ")"; if ($lastValue = $c->getLastChange()) { $return[$i]['value'] = round(1 / $lastValue['value'], 2); $return[$i]['date'] = $lastValue['date']; }
$separador_decimal = trim($ari->locale->get('decimal', 'numbers')); $page_size = PAGE_SIZE; $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //CREO EL OBJECTO MONEDA CON EL ID QUE ME PASAN if (isset($_POST['id'])) { $currency = new currency_currency($_POST["id"]); } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } PhpExt_Javascript::sendContentType(); //CREACION DE LOS CONTROLES //MONEDA $txt_moneda = PhpExt_Form_TextField::createTextField("txt_moneda", "Moneda")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setValue($currency->get("name")); //SIGNO $txt_signo = PhpExt_Form_TextField::createTextField("txt_signo", "Signo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setValue($currency->get("sign")); //TIPO DE CAMBIO $opt_tipo_fijo = new PhpExt_Form_Radio(); $opt_tipo_fijo->setBoxLabel("Fijo")->setInputValue("fixed")->setName("opt-tipo-cambio"); if ($currency->get("type") == "1") { $opt_tipo_fijo->setChecked(true); } $opt_tipo_flotante = new PhpExt_Form_Radio(); $opt_tipo_flotante->setBoxLabel("Flotante")->setInputValue("float")->setName("opt-tipo-cambio"); $opt_group_tipo_cambio = new PhpExt_Form_RadioGroup(); $opt_group_tipo_cambio->setfieldLabel("Tipo de cambio"); $opt_group_tipo_cambio->addItem($opt_tipo_fijo); $opt_group_tipo_cambio->addItem($opt_tipo_flotante); $group_render = "\n\nvar formulario = this.findParentByType('form');\nvar group = formulario.findBy( function(c){ return ( c.xtype == 'radiogroup' );} );\nvar opt = this.items.items[0];\t\nvar opt2 = this.items.items[1];\t\n\nopt.on( 'check' , function(t,n,o){\n\n\tvar field = formulario.getForm().findField('txt_valor');\n\tif( !group[1].items.items[0].getValue() ){ \n\t\tif( t.getValue() )\n\t\t{\n\t\t\tfield.enable();\n\t\t\tfield.focus(true);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfield.setValue('1');\n\t\t\tfield.disable();\t\t\n\t\t\t\n\t\t}\n\t}\n\t\n});\n\n\nopt2.on( 'check', function(t,n,o){\n\nif( group[1].items.items[0].getValue() ){ \n\tt.setValue(false);\n\topt.setValue(true);\n}\n\n});\n\n";