$xFRM = new cHForm("frm", "poliza_movimientos.frm.php");
$msg = "";
$xPol = new cPoliza(false);
$xPol->setPorCodigo($poliza);
$xPol->init();
$xFRM->addHElem($xPol->getFicha());
$comp = "<table class='mvtoscontables'><td class=\"cuenta\"><input type='text' id='idcuenta' onkeyup='jsKeyAction(event, this)' list='listadocuentas' placeholder='numero de cuenta' autocomplete='off'  onfocus='this.select()' onblur='jsaGetNombreCuenta()' /></td>";
$comp .= "<th class=\"nombrecuenta\"><input type='text' id='idnombrecuenta' disabled /></td>";
$comp .= "<td class=\"cargos\"><input type='number' id='idcargo' value='0' onfocus='this.select()' onchange='setFMonto(this)' onfocus='setFMonto(this)' /></td>";
$comp .= "<td class=\"abonos\"><input type='number' id='idabono' value='0' onfocus='this.select()' onchange='setFMonto(this)' onfocus='setFMonto(this)' /></td>";
$comp .= "<td class=\"referencia\"><input type='text' id='idreferencia' onfocus='this.select()' /></td>";
$comp .= "<td class=\"concepto\"><input type='text' id='idconcepto' onfocus='this.select()' onblur='jsSaveMvto()' /></td></table>";
$xFRM->addDivSolo($comp, "", "tx34", "txt14", array(1 => array("id" => "idagregados")));
$xFRM->addDivSolo(" ", "", "tx34", "txt14", array(1 => array("id" => "idlistado")));
$xFRM->addCerrar();
$xFRM->addRefrescar("jsaGetListadoDeMovimientos()");
$xFRM->OButton("TR.Eliminar", "jsEliminarPoliza()", $xFRM->ic()->ELIMINAR);
$xFRM->OButton("TR.Imprimir", "jsImprimirPoliza()", "imprimir");
$xFRM->OButton("TR.Finalizar", "jsFinalizarPoliza()", "guardar");
$xFRM->addAviso($poliza);
$xFRM->addFootElement("<input type='hidden' id='idpoliza' value='{$poliza}' />");
$xFRM->addFootElement("<datalist id='listadocuentas'></datalist>");
echo $xFRM->get();
?>
<script>
var xCont	= new ContGen();
var xG		= new Gen();
function setFMonto(obj){
	obj.select();
	var oMod	= null;
	if(obj.id == "idcargo"){ oMod = $("#idabono"); } else { oMod = $("#idcargo"); }	
$xHS = new cHSelect();
$xDiv = new cHDiv();
$xHS->addEvent("jsaGetPolizas()", "onchange");
//`contable_polizasdiarios`
$xHF->addEvents(" onchange=\"jsaGetPolizas()\" ");
$xFRM->addHElem($xHF->get("TR.Fecha"));
$xSelPol = $xHS->getListaDeTiposDePolizas();
$xSelPol->addEspOption(SYS_TODAS, $xFRM->lang("Todas"));
$xSelPol->setOptionSelect(SYS_TODAS);
$xFRM->addHElem($xSelPol->get(true));
$xFRM->addDivSolo(jsaGetPolizas(false, false), "", "tx34", "txt14", array(1 => array("id" => "idlistadopolizas")));
//fecha tipo
$xFRM->OHidden("idpolizaactiva", "", "");
$xFRM->OButton("TR.Agregar", "jsAgregarPoliza()", "agregar");
$xFRM->addCerrar();
$xFRM->addRefrescar("jsaGetPolizas()");
$xFRM->addAviso(" ");
echo $xFRM->get();
?>
<script>
var xG = new Gen();
function jsAgregarPoliza(){ xG.w({ url : "../frmcontabilidad/nueva_poliza.frm.php?", w : 640, h: 480, tiny : true  }); }
function jsAgregarMovimientos(id){	xG.w({ url : "../frmcontabilidad/poliza_movimientos.frm.php?codigo=" + id, w : 800, h: 600, tiny : true  });}
function jsImprimirPoliza(id){ var xCont	= new ContGen(); xCont.ImprimirPoliza(id);}
function jsEliminarPoliza(id){
	$("#idpolizaactiva").val(id);
	xG.confirmar({ msg: "Desea ELiminar la Poliza Contable?", callback: jsaEliminarPoliza});
}
</script>
<?php 
$jxc->drawJavaScript(false, true);