Viewing file: pedido_new_view.php (24.98 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<style>
.btn-circle.btn-xl { width: 50px; height: 50px; padding: 10px 16px; border-radius: 35px;
font-size: 24px; line-height: 1.33; } .boton_personalizado { text-decoration: none; padding: 10px; font-weight: 600; font-size: 20px; color: #ffffff; background-color: #1883ba; border-radius: 6px; float: left; border: 2px solid #0016b0; } .ir-arriba { display: none; padding: 20px; background: #1883ba; font-size: 20px; color: #fff; cursor: pointer; position: fixed; bottom: 20px; border-radius: 50%; right: 20px; z-index: 100; border: 1px solid #0016b0; }
div.scrall{ overflow:auto; width:100%; height:250px; }
.modal { top: 10%; left: 40%; width: 1050px; margin-left: -380px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); *border: 1px solid #999; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; outline: none; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box; } .modal.fade.in { top: 5%; }
img { max-width: 100%; display: block; }
#content { margin: 0 auto; width: auto; height: auto;
}
#izquierda{ width:70%; float: left; }
#derecha{ width:30%; float: right; }
#izquierda2{ width:70%; float: left; }
#derecha2{ width:30%; float: right; }
#izquierda4{ width:40%; float: left; }
#derecha4{ width:60%; float: right; }
.cuadrado{ width:auto; height:auto; background-color: #999999; border: solid 1px #000000; color: white; } .image { width: 100%; height: 100%; }
.image img { -webkit-transition: all 1s ease; /* Safari and Chrome */ -moz-transition: all 1s ease; /* Firefox */ -o-transition: all 1s ease; /* IE 9 */ -ms-transition: all 1s ease; /* Opera */ transition: all 1s ease; }
.image:hover img { -webkit-transform:scale(1.25); /* Safari and Chrome */ -moz-transform:scale(1.25); /* Firefox */ -ms-transform:scale(1.25); /* IE 9 */ -o-transform:scale(1.25); /* Opera */ transform:scale(1.25); }
.form-inline label { display: -ms-flexbox; display: inline; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; margin-bottom: 0; } </style>
<div class="content-wrapper" style="min-height: auto;"> <div style="margin-left:10px;"> <span class="ir-arriba"><i class="glyphicon glyphicon-chevron-up" ></i></span> <!-- Main content --> <section class="content"> <form method="post" name="gestionPedido" class="form-inline"> <br> <div class="tab-content"> <div class="col-md-12">
<div id="izquierda4" align="left"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;">NUMERO DE VENTA: </strong> <input style="font-family: Arial; font-size: 16pt;height: 40px;" type="text" name="numeroPedido" id="numeroPedido" value="<?php echo ($nroPedido)?>" readonly> <input type="hidden" name="vieneNuevo" id="vieneNuevo" value="0"> </div> <div id="derecha4" align="right"> <form method="post" action="<?php echo base_url()?>pedido/paginacionClientes/"> <div id="buscador"> <input style="font-family: Arial; font-size: 16pt;height: 40px;" placeholder="NOMBRE CLIENTE..." type="text" name="buscando" class="med" id="buscando" /> <input type="button" class="btn btn-success btn-lg" value="ELEGIR CLIENTE" onclick="agregarCliente()"/> </div> </form> </div>
</div> <br><br> <div role="tabpanel" class="tab-pane active estiloForm" id="home"> <div class="estiloForm" > <input class="form-control input-sm" type="hidden" name="id_cliente" id="id_cliente" value="<?php echo ($datosCliente->id)?>" readonly> <b>Nombre:</b> <input class="form-control input-sm" style="height: 40px;" type="text" name="nombre" id="nombre" value="<?php echo ($datosCliente->nombre)?>" readonly> <b>Mail:</b> <input class="form-control input-sm" style="height: 40px;" type="text" name="mail" id="mail" value="<?php echo ($datosCliente->mail)?>" readonly> <b>Direccion:</b> <input class="form-control input-sm " style="height: 40px;" type="text" name="DireccionCliente" id="DireccionCliente" value="<?php echo ($datosCliente->direccion)?>" readonly> <b>Telefono:</b> <input class="form-control input-sm" style="height: 30px;" type="text" name="telefonoCliente" id="telefonoCliente" value="<?php echo ($datosCliente->telefono)?>" readonly> <b>Cuit:</b> <input class="form-control input-sm" style="height: 40px;" type="text" name="CuitCliente" id="CuitCliente" value="<?php echo ($datosCliente->cuit)?>"readonly> </div> </div> <div> <div id="buscador2"> <div class="col-md-12"> <h2>AGREGAR PRODUCTOS</h2> <div id="izquierda" align="left"> <form method="post" name="buscandoProducts"> <strong>BUSCAR: </strong> <input type="text" name="buscandoProductosCodigo" style="height: 50px;width: 200px;" id="buscandoProductosCodigo" onchange="eventoEnter()"; placeholder=" CODIGO DE BARRA"/> <input type="text" name="buscandoProductos" style="height: 50px;width: 200px;" id="buscandoProductos" onchange="eventoEnter()"; placeholder=" NOMBRE "/> <input type="button" class="btn btn-primary btn-lg" value="BUSCAR" onclick="busquedaProductos()" class="remove-discount-button"/> <button type="button" class="btn btn-danger btn-circle btn-xl" data-toggle="modal" data-backdrop="false" data-target="#modalArticulos"><i class="fa fa-plus"></i> </form> </div> <div id="derecha" align="right" > <a class="boton_personalizado" href="#final"> <span class="glyphicon glyphicon-chevron-down"></span> </a> </div> </div> <br><br><br><br><br><br> <div id="div_noticias"> </div> </div> <br> <h2>PRODUCTOS AGREGADOS AL CARRITO</h2> <div id="tablaPrincipal3" width="60%"> <?php $array=array(); $subtotal1=0; $total=0; $totalNeto=0; $cantidadItems=0; $this->table->set_heading('Chequeo','Producto', 'Descripcion', 'Cantidad','Precio','Accion'); //crea la primera fila de la tabla con el encabezado $tmp = array ( 'table_open' => '<table class="table table-bordered table-striped" border="0" cellpadding="2" cellspacing="1" id="detalleTabla" width="60%">' ); $this->table->set_template($tmp); if($nroPedido !=NULL){ $detallesPedido=$this->consultas_model->getDetallesPedidoById($nroPedido); if($detallesPedido !=null){ foreach($detallesPedido as $file): $cantidadProdTabla=$cantidadProdTabla+1; $this->table->add_row('<input type="checkbox" name="seleccionar">',$file->nombre,$file->descripcion,$file->cantidad,$file->precio,'<input class="btn btn-danger" type="button" name="eliminar" id="eliminar" value="Eliminar" onclick="elinminarRegistro('. $file->id.','.$file->cantidad.','."'".$file->estado ."'".');">'); //agregamos la celda a la tabla por cada iteracion $cantidadItems +=$file->cantidad; $valorParcial=round($file->cantidad*$file->precio,2);
$totalNeto +=round($valorParcial,2); endforeach; $total=round($totalNeto,2); } echo $this->table->generate(); } ?> </div> <div class="col-md-12 form-inline" align="right"> <div id="izquierda2" align="left"> <b style="font-family: Arial; font-size: 16pt;height: 40px;">PRODUCTOS AGREGADOS (CANT. TOTALES):</b> <input style="font-family: Arial; font-size: 16pt;height: 40px;" type="text" name="cantidadRegistros" id="cantidadRegistros" value="<?php echo ($cantidadItems);?>" readonly> </div> <div id="derecha2" align="right" >
</div> <br> </div> <div class="col-md-12"> <div class="content" > <div id="derecha" align="right"> <div id="final">
<label><b style="font-family: Arial; font-size: 16pt;height: 40px;">TOTAL: $</b></label> <input type="text" pattern="[0-9]+([,\.][0-9]+)?" style="font-family: Arial; font-size: 20pt;height: 40px;" name="totalfinal" id="totalfinal" value="<?php echo ($total);?>"readonly> </div> </div> </div> </div> <br><br> <input type="hidden" name="cantidadRegistros" id="cantidadRegistros" value="<?php echo ($cantidadProdTabla);?>"> <input type="hidden" name="descuentoBase" id="descuentoBase" value="<?php echo ($datosPedido[0]->descuento);?>"> <input type="hidden" name="vieneDentro" id="vieneDentro" value=""> </input> <div class="col-md-12" align="center"> <input class="btn btn-info btn-lg" type="button" value="VOLVER" onclick="volver();"> <input class="btn btn-success btn-lg" type="button" name="guardar" id="guardar" value="GUARDAR" onclick="guardarPedido();"> </div> </div> </div> </form> <!-- termina el segundo modal --> <div ng-app="menuRecibos" class="modal fade" id="modalArticulos" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="padding-left: -17px;" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel">BUSQUEDA DE ARTICULOS </h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" > <div style="margin-left:20px;" ng-controller="SearchArticulo" > <div class="row"> <div class="col-md-12">CANTIDAD POR PAGINA: <select ng-model="entryLimit" class="form-control"> <option>5</option> <option>10</option> <option>20</option> <option>50</option> </select> </div> <br><br> <div class="col-md-12">BUSQUEDA ARTICULO: <input type="text" autofocus style="font-family: Arial; font-size: 16pt;height: 40px;" ng-model='searchText' ng-keyup='fechArticulos()' ng-click='searchboxClicked($event);' ng-change="filter()" placeholder="Buscar..." class="form-control" /> <ul class="container" id='searchResult' > <li ng-click='setValue($index,$event)' ng-repeat="result in searchResult" > {{ result.nombre }} </li> </ul> </div> </div> <div class="row"> <div class="scrall"> <div class="col-md-12" ng-show="filteredItems > 0"> <table class="table table-striped table-bordered"> <thead> <th>ARTICULO <a ng-click="sort_by('nombre_producto');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>IMAGEN ACTUAL</th> <th>DESCRIPCION <a ng-click="sort_by('descripcion');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>ESTADO <a ng-click="sort_by('estado');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>CATEGORIA <a ng-click="sort_by('categoria');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>PRECIO VENTA <a ng-click="sort_by('precio_venta');"><i class="glyphicon glyphicon-sort"></i></a></th> </thead> <tbody> <tr ng-repeat="productos in filtered = (articulos | filter:searchText | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit" data-ng-click="salvar(productos.nombre)" > <td data-dismiss="modal">{{productos.nombre}}</td> <td data-dismiss="modal"><center> <ul class="enlarge"> <img id="imagen" ng-mouseover="zoom()" ng-src="../../../../images/{{productos.imagen}}" style="width:65px; height:65px;" class="img-circle"> </ul> </center> </td> <td data-dismiss="modal"><b>{{productos.descripcion}}</b></td> <td data-dismiss="modal"><b>{{productos.estado}}</b></td> <td data-dismiss="modal"><b>{{productos.categoria}}</b></td> <td data-dismiss="modal"> <b>{{productos.precio_venta}}</b></td> </tr> </tbody> </table> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY PRODUCTOS DISPONIBLES</h4> </div> </div> <div class="col-md-10" ng-show="filteredItems > 0"> <div class="col-md-4"> <h5>Obtenidos {{ filtered.length }} De {{ totalItems}} Productos Totales</h5> </div> <div class="col-md-16" pagination="" max-size="10" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"> </div> </div> </div><!-- /.modal-content --> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">CERRAR</button> </div> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </div> </div>
</section><!-- /.content --> </div><!-- /.content-wrapper --> </div> <script type="text/javascript">
$().ready(function(){ $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductos")?>', success: function(data){ $("#div_noticias").html(data); } }); });
$(this).ready( function() { $("#buscando").autocomplete({ minLength: 1, source:'<?php echo site_url("pedido/autocompletar");?>', }); $("#buscandoProductos").autocomplete({ minLength: 1, source:'<?php echo site_url("pedido/autocompletarProductos");?>', select: function(event, ui) { buscando=ui.item.value; $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductos")?>', data: {buscando:buscando}, success: function(data){ $("#div_noticias").html(data); eventoEnter(); } }); } });
$("#buscandoProductosCodigo").autocomplete({ minLength: 1, source:'<?php echo site_url("pedido/autocompletarProductosNumero");?>', select: function(event, ui) { buscando=ui.item.value; $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductosNumero")?>', data: {buscando:buscando}, success: function(data){ $("#div_noticias").html(data); eventoEnter(); } }); } }); }); $(document).ready(function(){ $('a[href^="#"]').click(function() { var destino = $(this.hash); //this.hash lee el atributo href de este $('html, body').animate({ scrollTop: destino.offset().top }, 700); //Llega a su destino con el tiempo deseado return false; }); $('.ir-arriba').click(function(){ $('body, html').animate({ scrollTop: '0px' }, 300); }); $(window).scroll(function(){ if( $(this).scrollTop() > 0 ){ $('.ir-arriba').slideDown(300); } else { $('.ir-arriba').slideUp(300); } }); });
var app = angular.module('menuRecibos', ['ui.bootstrap']);
app.filter('startFrom', function() { return function(input, start) { if(input) { start = +start; //parse to int return input.slice(start); } return []; } });
app.controller('SearchArticulo', function ($scope, $http, $location) { $scope.articulos=[]; $http({ url: "<?php echo site_url("producto/getProductosBusqueda");?>", method: "GET" }).success(function(data){ $scope.articulos = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.articulos.length; //Initially for no filter $scope.totalItems = $scope.articulos.length; }); $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = ""; //Initially for no filter $scope.totalItems =0; $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; };
$scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; };
$scope.salvar= function(item){ $('#buscandoProductos').val(item); busquedaProductos(); }; });
function busquedaProductos(){
buscandoNombre=document.getElementById("buscandoProductos").value; buscandoNumero=document.getElementById("buscandoProductosCodigo").value;
if(buscandoNombre != ''){ $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductos")?>', data: {buscando:buscandoNombre}, success: function(data){ $("#div_noticias").html(data); eventoEnter(); } }); }
if(buscandoNumero != ''){ $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductosNumero")?>', data: {buscando:buscandoNumero}, success: function(data){ $("#div_noticias").html(data); eventoEnter(); } }); } if((buscandoNombre =='') &&(buscandoNumero =='')){ $.ajax({ type: 'POST', url: '<?= base_url("pedido/paginacionProductos")?>', success: function(data){ $("#div_noticias").html(data); } }); }
}
function volver(){ location.href='<?php if ($this->session->userdata('perfil') =="vendedor_ext"){ echo base_url().'pedido/externos'; } else { echo base_url().'pedido/index'; } ?>'; }
//funcion q se posiciona en el input de cantidades function eventoEnter(){
document.getElementById("cantidadProd_1").focus(); }
function agregarCliente(){ cliente=document.getElementById("buscando").value; pedido=document.getElementById("numeroPedido").value; $.ajax({ type: 'POST', url: '<?= base_url("pedido/getCliente")?>', data: {cliente:cliente,pedido:pedido}, success: function(data){ calculo=data.split(';'); $('#nombre').val(calculo[2]); $('#DireccionCliente').val(calculo[3]); $('#telefonoCliente').val(calculo[5]); $('#id_cliente').val(calculo[0]); $('#CuitCliente').val(calculo[7]); $('#mail').val(calculo[8]); } }); }
function ingresarCarrito(producto,i,precio,estado){ confirmado=false; total=document.getElementById('totalfinal').value; cliente=document.getElementById("id_cliente").value; numeroPedido=document.getElementById("numeroPedido").value; cant="cantidadProd_"+i; nombre="ingresado_"+i; document.getElementById(nombre).checked = true; cantidad=document.getElementById(cant).value; pedido=document.getElementById("numeroPedido").value; suma=(cantidad*precio); cantidadProductos=document.getElementById("cantidadRegistros").value; cantProd=parseInt(cantidadProductos,10); cantidadSumafinal=parseInt(cantidad,10); //descuento aplicado en teoria desde php if (cantidad>0){ $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/registrarDetalle");?>', data: {pedido:pedido,producto:producto, cantidad:cantidad,precio:precio,numeroPedido:numeroPedido,total:total}, success:function(data){
respuesta=data.split(';'); valorParcial=parseFloat(cantidad*precio); $('#totalfinal').val((parseFloat(document.getElementById("totalfinal").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $("#detalleTabla").prepend("<tr><td><input type='checkbox' name='seleccionar'></td>"+"<td>" + respuesta[0] + "</td><td>" + respuesta[1] + "</td><td>" + cantidad + "</td><td>" + precio+ "</td><td><input class='btn btn-danger' type='button' name='eliminar' id='eliminar' value='Eliminar' onclick='elinminarRegistro("+respuesta[2]+","+respuesta[3]+","+"\""+respuesta[4]+"\""+")'></td></tr>");
document.getElementById("cantidadRegistros").value=(cantProd+cantidadSumafinal); document.getElementById("buscandoProductos").focus(); document.getElementById("buscandoProductos").value= ''; } }); } else{ alert("Debe ingresar un valor mayor a 0 para poder ingresar al carrito"); } }
function elinminarRegistro(id,cantidad,estado) {
numeroPedido=document.getElementById("numeroPedido").value; total=document.getElementById('totalfinal').value; cliente=document.getElementById("id_cliente").value; cantidadProductos=document.getElementById("cantidadRegistros").value; cantProd=parseInt(cantidadProductos,10); cantidadSumafinal=parseInt(cantidad,10); cantProd=parseInt(cantidadProductos,10); cantidadSumafinal=parseInt(cantidad,10); //tengo que averiguar el registro que estoy borrando de la tabla y de la base de datos document.getElementById("cantidadRegistros").value=(cantProd-cantidadSumafinal);
$.ajax({ type: 'POST', url: '<?php echo site_url("pedido/eliminar");?>', data: {id:id,numeroPedido:numeroPedido,total:total,subtotal:total}, success:function(data){ respuesta=data.split(';'); valorSinDto=parseFloat(respuesta[0]*respuesta[1]); $('#totalfinal').val((parseFloat(document.getElementById("totalfinal").value)-parseFloat(valorSinDto)));
window.location.reload(); } }); // sacar el redirect // window.location.reload(); }
function guardarPedido(){ var r=confirm("Desea guardar el Pedido Creado?"); if (r == true) { numeroPedido=document.getElementById("numeroPedido").value; total=document.getElementById('totalfinal').value; cliente=document.getElementById("id_cliente").value;
if(total != '0'){ if(cliente != ''){ if(numeroPedido != ""){ location.href='<?php echo base_url()?>pedido/guardarPedido?nroPedido='+numeroPedido+'&total='+total; } } else{ alert('Ingrese un Cliente'); } } else{ alert('Ingrese Productos al pedido'); } } }
document.onkeydown = function(){
//evento enter if (window.event && (window.event.keyCode == 13)) { return false; } if (window.event && (window.event.keyCode == 8)) { valor = document.activeElement.value; if (valor==undefined) { return false; } //Evita Back en página. else { if (document.activeElement.getAttribute('type')=='sel ect-one') { return false; } //Evita Back en select. if (document.activeElement.getAttribute('type')=='but ton') { return false; } //Evita Back en button. if (document.activeElement.getAttribute('type')=='rad io') { return false; } //Evita Back en radio. if (document.activeElement.getAttribute('type')=='che ckbox') { return false; } //Evita Back en checkbox. if (document.activeElement.getAttribute('type')=='fil e') { return false; } //Evita Back en file. if (document.activeElement.getAttribute('type')=='res et') { return false; } //Evita Back en reset. if (document.activeElement.getAttribute('type')=='sub mit') { return false; } //Evita Back en submit. else //Text, textarea o password { if (document.activeElement.value.length==0) { return false; } //No realiza el backspace(largo igual a 0). else { document.activeElement.value.keyCode = 8; } //Realiza el backspace. } } } if(window.event && window.event.keyCode == 505){ window.event.keyCode = 505; } } </script>
|