<div class="row"  id="<?php $windowid= date('YmdHis'); echo $windowid;?>">
	<div class="panel blank-panel">
		<div class="panel-body">
			<!--Informacion de la venta a cargar-->
			<div class="row">
				<!--Buscar por documento-->
				<div class="col-md-9" id="devolucion-cargar-venta-wrapper">
					<div class="row">
						<!--Documento-->
						<div class="col-sm-5">
							<select class="form-control" id="devolucion-venta-documento">
								<option selected disabled>Seleccione un documento...</option>
								<option value="1">Factura</option>
								<option value="2">Comprobante de cr&eacute;dito fiscal</option>
								<option value="3">Ticket</option>
								<option value="4">Nota de remisi&oacute;n</option>
								<option value="5">Nota de envio</option>
							</select>
						</div>
						<!--Serie-->
						<label class="control-label col-sm-1" >Serie:</label>
						<div class="col-sm-2">
							<select class="form-control" id="devolucion-venta-documento-series">
							</select>
						</div>
						<!--Numero-->
						<div class="col-sm-2">
							<input type="text" class="form-control"  id="devolucion-venta-num-doc" placeholder="N&uacute;mero">
						</div>
						<!--Boton agregar-->
						<div class="col-sm-2">
							<button type="button" id="devolucion-cargar-venta-btn" class="btn btn-info btn-md" data-mode="load">Cargar</button>
						</div>
					</div>
				</div>
				<!--Buscar por transacción-->
				<div class="col-md-3" style="border-left:solid 1px #e7eaec;" id="devolucion-cargar-venta-idtrans-wrapper">
					<div class="form-group" style="margin-bottom:0px;">				
						<div class="input-group">
							<input type="text" class="form-control"  id="devolucion-venta-idtrans-doc" placeholder="ID Venta">
							<span class="input-group-btn">
								<button type="button" id="devolucion-cargar-venta-idtrans-btn" class="btn btn-info btn-md" data-mode="load">Cargar</button>
							</span>
						</div>
					</div>
				</div>
			</div>
			<!--Informacion de la venta cargada-->
			<div style="min-height:490px;">
				<!--Mensajes informativos-->
				<div id="devolucion-msg-inf-wrapper" class="alert alert-info m-t-sm"><i class="fa fa-info-circle fa-2x"></i> <span class="p-sm">Seleccione los datos del documento de venta o ingrese el ID de la venta para poder cargar la informaci&oacute;n </span></div>
				<div class="row m-t-sm" style="display:none;" id="devolucion-venta-info-wrapper">
					<div class="ibox">
						<div class="ibox-title">
							<h5>Informaci&oacute;n de la venta</h5>
						</div>
						<div class="ibox-content" id="devolucion-venta-info-panel" >
							<div class="col-sm-4">
								<!--Fecha-->
								<p style="margin:0px;">
									<label class="control-label">Fecha:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-fecha" data-value=""></span>
								</p>
								<!--Documento-->
								<p style="margin:0px;">
									<label class="control-label">Documento:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-doc" data-value=""></span>
								</p>
								<!--Serie y numero-->
								<p style="margin:0px;">
									<label class="control-label">N&uacute;mero:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-numdoc" data-value=""></span>
									<input type="hidden" class="dev-info-venta-item" id="dev-detalles-venta-info-serie" data-value="">
									<input type="hidden" class="dev-info-venta-item" id="dev-detalles-venta-info-serieid" data-value="">
								</p>
								<!--Referencia-->
								<p style="margin:0px;">
									<label class="control-label">ID Transacci&oacute;n:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-id" data-value=""></span>
								</p>
								<!--Estado-->
								<p style="margin:0px;">
									<label class="control-label">Estado:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-estado" data-value=""></span>
								</p>
								<!--Facturacion-->
								<p style="margin:0px;">
									<label class="control-label">Estado Facturaci&oacute;n:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-tipo" data-value=""></span>
								</p>
								<!--Origen-->
								<p style="margin:0px;">
									<label class="control-label">Origen trans.:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-origen" data-value=""></span>
								</p>
							</div>
							<div class="col-sm-4">
								<!--Vendedor-->
								<p style="margin:0px;">
									<label class="control-label">Vendedor:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-vendedor" data-value=""></span>
								</p>
								<!--Cajero-->
								<p style="margin:0px;">
									<label class="control-label">Cajero:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-cajero" data-value=""></span>
								</p>
								<!--Caja-->
								<p style="margin:0px;">
									<label class="control-label">Caja:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-caja" data-value=""></span>
								</p>
								<!--Condicion-->
								<p style="margin:0px;">
									<label class="control-label">Condici&oacute;n:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-cobro"  data-value=""></span>
								</p>
								<!--forma-->
								<p style="margin:0px;">
									<label class="control-label">Forma de pago:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-forma"  data-value=""></span>
								</p>
								<!--Estado del pago-->
								<p style="margin:0px;">
									<label class="control-label">Estado del pago:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-estadocobro"  data-value=""></span>
								</p>
								<!--Credito-->
								<p style="margin:0px;">
									<label class="control-label">ID cr&eacute;dito:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-credito" data-value=""></span>
								</p>
							</div>
							<div class="col-sm-4">
								<!--Nombre-->
								<p style="margin:0px;">
									<label class="control-label">Cliente:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-cliente" data-value=""></span>
								</p>
								<!--Descargo-->
								<p style="margin:0px;">
									<label class="control-label">Descargo de inventario:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-descargo" data-value=""></span>
								</p>
								<!--ID cliente-->
								<p style="margin:0px;">
									<label class="control-label">ID Cliente:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-idcliente" data-value=""></span>
								</p>
								<!--DUI-->
								<p style="margin:0px;">
									<label class="control-label">DUI:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-dui" data-value=""></span>
								</p>
								<!--NIT-->
								<p style="margin:0px;">
									<label class="control-label">NIT:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-nit" data-value=""></span>
								</p>
								<!--NRC-->
								<p style="margin:0px;">
									<label class="control-label">NRC:</label> <span class="dev-info-venta-item" id="dev-detalles-venta-info-nrc" data-value=""></span>
								</p>
							</div>					
							<div class="clearfix"></div>
						</div>
					</div>
				</div>
				<!--Hidden info-->
				<div>
					<input type="hidden" id="devolucion-venta-cliente" value="">
					<input type="hidden" id="devolucion-venta-cliente-type" value="">
					<input type="hidden" id="devolucion-venta-doc" value="">
					<input type="hidden" id="devolucion-venta-condicion" value="">
					<input type="hidden" id="devolucion-venta-product-counter" value="">
				</div>
				<!--<div class="hr-line-dashed n-m n-p" style="display:none;" id="devolucion-venta-info-div"></div>-->
				<!--table header-->
				<div class="row" style="display:none;" id="devolucion-venta-productos-table-head">
					<table class="table table-hover" style="margin:0px;">
						<thead>
							<tr>
								<th style="width:15%">SKU</th>
								<th style="width:40%">Nombre</th>
								<th style="width:10%">Cant.</th>
								<th style="width:10%">Precio.</th>
								<th style="width:10%">Total.</th>
								<th style="width:5%"></th>
								<th style="width:10%">Quitar</th>
							</tr>
						</thead>
					</table>
				</div>
				<!--tabla body-->
				<div class="row" style="display:none;" id="devolucion-venta-productos-table-body">
					<div id="devolucion-productos-wrapper" style="height:125px;overflow:hidden;">
						<table class="table table-hover">
							<tbody>
							</tbody>
						</table>
					</div>
				</div>
				<!--totales-->
				<div class="row" style="min-height:130px;display:none;" id="devolucion-venta-totales-table-wrapper">
					<div class="col-sm-8">
						<h3 class="m-lg transacction-item-counter">Items en la devolucion: <b>0</b></h3>
						<!--Mensajes de error-->
						<div id="devolucion-msg-warning-wrapper" class="alert alert-warning m-t-sm" style="display:none;"><i class="fa fa-exclamation-triangle fa-2x"></i> <span class="p-xs"></span></div>
					</div>
					<div class="col-sm-4">
						<table class="table" id="devolucion-totales-wrapper">
							<tbody>
							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!--Hiddens-->
			<div>
				<input type="hidden" id="credito-devolucion" value="">
			</div>
			<!--Buttons-->
			<div class="form-group" style="margin:0; text-align:center;">
				<button type="button" class="btn btn-danger btn-rounded" onclick="Custombox.close();">Cancelar</button>
				<button type="button" id="guardar-devolucion-btn" class="btn btn-primary btn-rounded" disabled>Guardar [F10]</button>
			</div>
			<!--Modales-->
			<div>
				<!--Seleccion de la venta a cargar-->
				<div class="modal inmodal fade" id="nueva-devolucion-sel-venta" tabindex="-1" role="dialog"  aria-hidden="true">
					<div class="modal-dialog modal-md">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
								<h4 class="">Seleccione una venta...</h4>
							</div>
							<div class="modal-body">
								<div id="devoluciones-ventas-list" class="white-bg p-sm">
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--devolucion info-->
				<div class="modal inmodal fade" id="nueva-devolucion-cliente-info" tabindex="-1" role="dialog"  aria-hidden="true">
					<div class="modal-dialog modal-lg">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
								<h4 class="">Informaci&oacute;n de devoluci&oacute;n</h4>
							</div>
							<div class="modal-body">
								<div class="form-group">
									<label class="control-label">Motivo:</label>
									<input type="text" class="form-control" id="devolucion-motivo" value="">
								</div>
								<div class="form-group">
									<div class="col-sm-6">
										<label class="control-label">Nombre:</label>
										<input type="text" class="form-control" id="devolucion-venta-cliente-nombre" value="">
									</div>
									<div class="col-sm-3">
										<label class="control-label">DUI:</label>
										<input type="text" class="form-control" id="devolucion-venta-cliente-dui" value="">
									</div>
									<div class="col-sm-3">
										<label class="control-label">NIT:</label>
										<input type="text" class="form-control" id="devolucion-venta-cliente-nit" value="">
									</div>
									<div class="clearfix"></div>
								</div>
								<div class="hr-line-dashed"></div>
								<div class="form-group">
									<div class="col-sm-4">
										<label class="control-label">Documento:</label>
										<select class="form-control" id="devolucion-documento">
											<option value="0">Ninguno</option>
											<option value="1">Reverso de Factura</option>
											<option value="2">Reverso de Comprobante de cr&eacute;dito fiscal</option>
											<option value="3">Ticket</option>
											<option value="4">Reverso de Nota de remisi&oacute;n</option>
											<option value="5">Reverso de Nota de envio</option>
										</select>
									</div>
									<div class="col-sm-2">
										<label class="control-label">Serie:</label>
										<select class="form-control" id="devolucion-doc-ncred-serie" disabled>
										</select>
									</div>
									<div class="col-sm-2">
										<label class="control-label">No:</label>
										<input type="text" class="form-control" id="devolucion-doc-ncred-numero" value="" disabled>
									</div>
									<div class="col-sm-4">
										<label class="control-label">Forma de devoluci&oacute;n:</label>
										<select class="form-control" id="devolucion-venta-forma">
											<option value="0">Abono Autom&oacute;tico a cr&eacute;dito</option>
											<option value="1">Efectivo</option>
											<option value="2">Cheque</option>
											<option value="3">POS</option>
											<option value="4">Abono a cuenta</option>
											<option value="5">Pago elecr&oacute;nico</option>
										</select>
									</div>
									<div class="clearfix"></div>
								</div>
								<div class="form-group">
									
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" id="nueva-devolucion-doc-cancel-btn" class="btn btn-white">Cancelar</button>
								<button type="button" id="nueva-devolucion-doc-guardar-btn" class="btn btn-primary">Aceptar</button>
							</div>
						</div>
					</div>
				</div>
				<!--Credito info-->
				<div class="modal inmodal fade" id="devolucion-sel-credito" tabindex="-1" role="dialog"  aria-hidden="true">
					<div class="modal-dialog modal-md">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
								<h4 class="">Cr&eacute;dito</h4>
							</div>
							<div class="modal-body">
								<h4>Seleccione un cr&eacute;dito para realizar el abono:</h4>
								<div class="row">
									<div class="m-l-md m-r-md" id="creditos-cliente-select-list-wrapper" style="height:200px;overflow:hidden;background-color:#FFFFFF;">
										<!--Seleccionar credito existente-->
										<div class="table-responsive" id="creditos-cliente-list"></div>
									</div>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" id="devolucion-credito-cancel-btn" class="btn btn-white">Cancelar</button>
								<button type="button" id="devolucion-credito-guardar-btn" class="btn btn-primary">Aceptar</button>
							</div>
						</div>
					</div>
				</div>
				<!--Confirmar-->
				<div class="modal inmodal fade" id="devolucion-confirmar" tabindex="-1" role="dialog"  aria-hidden="true">
					<div class="modal-dialog modal-sm">
						<div class="modal-content">
							<div class="modal-header">
								<h4 class="">Confirmar devoluci&oacute;n</h4>
							</div>
							<div class="modal-body">
								<h1 class="text-center"  id="devolucion-procesar-status-icon"><i class="fa fa-question-circle fa-5x" style="color:#23C6C8;"></i></h1>
								<h3 class="text-muted text-center" id="devolucion-procesar-status-text">&iquest;Desea guardar esta devoluci&oacute;n?</h3>
								
								<div style='margin:20px'>
									<table class='table'>
										<tr>
											<td><h3 style='line-height:normal;font-weight:normal;margin:0px;'>Total</h3></td>
											<td><h3 style='line-height:normal;font-weight:normal;margin:0px;'>$</h3></td>
											<td><h3 style='line-height:normal;font-weight:normal;margin:0px; text-align:right;' id="devolucion-confirm-total"></h3></td>
										</tr>
									</table>
								</div>
							</div>
							<div class="modal-footer" id="devolucion-confirmar-buttons">
								<button type="button" id="devolucion-cancelar-guardar-btn" class="btn btn-white">Cancelar</button>
								<button type="button" id="devolucion-confirmar-guardar-btn" class="btn btn-primary">Guardar devoluci&oacute;n</button>
								<button type='button' style="display:none" id='devolucion-confirmar-salir-btn' class='btn btn-danger'>Salir</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

</div>
<script>
	var transacciones_devolucion_app = new Transacciones_devolucion_app();
	transacciones_devolucion_app.initializeEnviroment("<?php echo base_url();?>","<?php echo $windowid;?>","<?php echo $caja;?>");
</script>