Viewing file: pedido_new_view.php (89.64 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<style> .btn-circle.btn-xl { width: 70px; height: 70px; 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: 50%; width: 850px; 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:50%; float: left; } #derecha{ width:50%; float: right; } #izquierda2{ width:70%; float: left; } #derecha2{ width:30%; float: right; } .cuadrado{ witdth: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"> <div class="form-inline" style="width:100%;"> <div class="row"> <div class="col-md-12"> <div class="span4"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;">NRO PEDIDO: </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 class="span4"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;">COND/PAGO: </strong> <select style="font-family: Arial; font-size: 16pt;height: 40px;" name="comboCondPago" id="comboCondPago" onchange="aplicarIva(document.getElementById('comboCondPago').value);"> <option><?php echo ($condPago[0]->condicion); ?></option> <?php $respuestaCombo3 = $this->consultas_model->getCondPago();foreach ($respuestaCombo3 as $file): ?> <option><?=$file->condicion?></option> <?php endforeach;?> </select> </div> <div class="span4"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;"> MEDIO DE PAGO: </strong> <select style="font-family: Arial; font-size: 16pt;height: 40px;" name="comboMedioPago" id="comboMedioPago" onchange="aplicarAumento(document.getElementById('comboMedioPago').value);"> <option><?php echo ($medioPago[0]->medio); ?></option> <?php $respuestaCombo2 = $this->consultas_model->getMedioPago();foreach ($respuestaCombo2 as $file): ?> <option><?=$file->medio?></option> <?php endforeach;?> </select> </div> </div> </div> <br><br> <div class="row"> <div class="col-md-12"> <div class="span4"> <form method="post" action="<?php echo base_url() ?>pedido/paginacionClientes/"> <div id="buscador"> <input style="font-family: Arial; font-size: 16pt;height: 40px;" placeholder="RAZON SOCIAL..." type="text" name="buscando" class="med" id="buscando" /> <input type="button" class="btn btn-success btn-md" value="SELECCIONAR" onclick="agregarCliente()"/> </div> </form> </div> <div class="span4"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;">Vendedor: </strong> <select style="font-family: Arial; font-size: 16pt;height: 40px;" name="comboVendedor" id="comboVendedor" > <option><?php echo ($datosPedido[0]->vendedor); ?></option> <?php $respuestaCombo = $this->consultas_model->getVendedores();foreach ($respuestaCombo as $file): ?> <option><?=$file->nombre?></option> <?php endforeach;?> </select> </div> <div class="span4"> <strong style="font-family: Arial; font-size: 12pt;height: 40px;">PAGADO: </strong> <select style="font-family: Arial; font-size: 16pt;height: 40px;" name="comboPagado" id="comboPagado" > <option><?php echo ($checkPago[0]->pagado); ?></option> <?php $respuestaCombo4 = $this->consultas_model->getCheck();foreach ($respuestaCombo4 as $file): ?> <option><?=$file->pagado?></option> <?php endforeach;?> </select> </div> </div> </div> <br><br><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;width: 200px;" type="text" name="nombre" id="nombre" value="<?php echo ($datosCliente->nombre) ?>" readonly> <b>RAZON SOCIAL </b> <input class="form-control input-sm" style="height: 40px;width: 200px; " type="text" name="razon_social" id="razon_social" value="<?php echo ($datosCliente->razon_social) ?>" 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>PROVINCIA </b> <input class="form-control input-sm" style="height: 40px;" type="text" name="provincia" id="provincia" value="<?php echo ($datosCliente->provincia) ?>"readonly> <br> <br> <b>LOCALIDAD </b> <input class="form-control input-sm" style="height: 40px;" type="text" name="localidad" id="localidad" value="<?php echo ($datosCliente->localidad) ?>" readonly> <b>TEL </b> <input class="form-control input-sm" style="height: 40px;width: 170px;" type="text" name="telefonoCliente" id="telefonoCliente" value="<?php echo ($datosCliente->telefono) ?>" readonly> <b>CUIT</b> <input class="form-control input-sm" style="height: 40px;font-size:20px;" type="text" name="CuitCliente" id="CuitCliente" value="<?php echo ($datosCliente->cuit) ?>"readonly> <b>EXPRESO </b> <input class="form-control input-sm" style="height: 40px;" type="text" name="expreso" id="expreso" value="<?php echo ($datosCliente->expreso) ?>" readonly> <b>IVA </b> <input class="form-control input-sm" style="height: 40px;color:rgb(255,0,0);font-size:20px;" type="text" name="expreso" id="expreso" value="<?php echo (strtoupper($datosCliente->iva)) ?>" readonly> </div> </div> </div> <br> <div> <div class="panel-group" id="accordion"> <b>COMENTARIO: </b> <br> <div class="col-md-12"> <textarea class="form-control input-sm" style="margin: 0px; width: 100%; height: 100px;font-size: 16px;" type="text" name="observacion" id="observacion" ><?php echo ($datosPedido[0]->observacion); ?></textarea> </div> <br> <div class="col-md-12" align="right"> <input class="btn btn-default" type="button" name="observ" id="observ" value="REGISTRAR COMENTARIO" onclick="registraComentario();"> </div> </div> <div id="buscador2"> <div class="row" style="padding-left: 40px;"> <div class="col-md-12" > <h2>AGREGAR PRODUCTOS</h2> <div id="izquierda" align="left"> <form method="post" action="<?php echo base_url() ?>pedido/paginacionProductos/"> <strong>BUSQUEDA ARTICULO: </strong> <input type="text" name="buscandoProductos" style="height: 30px;" id="buscandoProductos" onchange="eventoEnter()";/> <input type="button" class="btn btn-primary btn-md" value="BUSCAR" onclick="busquedaProductos()"/> <button type="button" class="btn btn-danger btn-circle btn-xl" data-toggle="modal" data-target="#modalArticulos"><i class="fa fa-plus"></i> </form> </div> <div id="derecha" > <a class="boton_personalizado" href="#final"> <span class="glyphicon glyphicon-chevron-down"></span> </a> </div> </div> <div id="div_noticias"> </div> </div> </div> <br> <div class="row" style="padding-left: 40px;"> <div class="col-md-12" > <h2>PRODUCTOS AGREGADOS AL CARRITO</h2> <div id="tablaPrincipal3" width="100%"> <?php $array = array(); $subtotal1 = 0; $total = 0; $iva = 0; $totalNeto = 0; $cantidadItems = 0; $descuento = 0; $subtotalConStock = 0; $totalConStock = 0; $subtotalSinStock = 0; $subTotalNetoConStock = 0; $subTotalNetoSinStock = 0; $totalSinStock = 0; $puedeEditar = false; if (($this->session->userdata('perfil') == 'AUTORIZADOR') || ($this->session->userdata('perfil') == 'ADMINISTRADOR')) { $puedeEditar = true; } if ($datosPedido[0]->descuento != null) { $descuento = $datosPedido[0]->descuento; } $this->table->set_heading('Chequeo', 'Producto', 'Descripcion', 'Cantidad', 'Precio', 'Parcial', '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="100%">'); $this->table->set_template($tmp); if ($nroPedido != null) { $detallesPedido = $this->consultas_model->getDetallesPedidoById($nroPedido); if ($detallesPedido != null) { foreach ($detallesPedido as $file): $cantidadProdTabla = $cantidadProdTabla + 1; if ($puedeEditar) { $this->table->add_row('<input type="checkbox" name="seleccionar">', $file->nombre, $file->descripcion, $file->cantidad, $file->precio, round($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 . "'" . ');"> '); } else { $this->table->add_row('<input type="checkbox" name="seleccionar">', $file->nombre, $file->descripcion, $file->cantidad, $file->precio, round($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; $valorParcialSinDesc = round($file->cantidad * $file->precio, 2); $subtotal1 += $valorParcialSinDesc; $valorParcial = ($valorParcialSinDesc - ($valorParcialSinDesc * $descuento / 100)); if ($file->estado == "PEND INGRESO") { $subtotalSinStock += $valorParcialSinDesc; $subTotalNetoSinStock += round($valorParcial, 2); } else { $subtotalConStock += $valorParcialSinDesc; $subTotalNetoConStock += round($valorParcial, 2); } $totalNeto += round($valorParcial, 2); endforeach; $iva = round($totalNeto * ($ivaMultiplicador), 2); $ivaConStock = round($subTotalNetoConStock * ($ivaMultiplicador), 2); $ivaSinStock = round($subTotalNetoSinStock * ($ivaMultiplicador), 2); $totalConStock = round($subTotalNetoConStock + $ivaConStock, 2); $totalSinStock = round($subTotalNetoSinStock + $ivaSinStock, 2); $total = round($totalNeto + $iva, 2); } echo $this->table->generate(); } ?> </div> </div> </div> <div class="row" style="padding-left:20px;"> <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" > <label><b style="font-family: Arial; font-size: 16pt;height: 40px;"> Sub: $</b></label><input type="text" style="font-family: Arial; font-size: 20pt;height: 40px;"name="subtotal" id="subtotal" value="<?php echo ($subtotal1); ?>"readonly> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="inputSubTotalSinStock" id="inputSubTotalSinStock" value="<?php echo ($subtotalSinStock); ?>"readonly> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="inputSubTotalConStock" id="inputSubTotalConStock" value="<?php echo ($subtotalConStock); ?>"readonly> </div> <br> </div> </div> <div class="row" style="padding-left:20px;"> <div class="col-md-12" align="right"> <br><label><b style="font-family: Arial; font-size: 16pt;height: 40px;"> Sub C/DESCUENTO: $</b></label><input type="text" style="font-family: Arial; font-size: 20pt;height: 40px;" name="totalAlternativo" id="totalAlternativo" value="<?php echo ($totalNeto); ?>"readonly> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="inputSubTotNetoSinStock" id="inputSubTotNetoSinStock" value="<?php echo ($subTotalNetoSinStock); ?>"readonly> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="inputSubtotNetoConStock" id="inputSubtotNetoConStock" value="<?php echo ($subTotalNetoConStock); ?>"readonly> <br> </div> </div> <div class="row" style="padding-left:20px;"> <div class="col-md-12"> <div class="content" > <div id="izquierda" align="left"> <div class="cuadrado" > <br> <h2>REGISTRACION DE PAGOS</h2> <br> <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#modalRecibos">+ RECIBOS DISPONIBLES</button> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">+ NUEVO RECIBO</button> <br><br> <button type="button" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#modalArticulosExistentes">ARTICULOS CON STOCK</button> <button type="button" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#modalArticulosInexistentes">ARTICULOS SIN STOCK</button> <br><br> </div> </div> <div id="derecha" align="right"> <div id="final"> <label><b style="font-family: Arial; font-size: 16pt;height: 40px;">Descuento:</b></label> <select name="comboDescuentos" id="comboDescuentos" style="font-family: Arial; font-size: 16pt;height: 40px;" class="form-control"> <option><?php if ($datosPedido[0]->descuento != null) { echo ($datosPedido[0]->descuento . "%"); } ?></option> <option></option> <?php $respuestaCombo = $this->consultas_model->getDescuentos();foreach ($respuestaCombo as $file): ?> <option><?=$file?>%</option> <?php endforeach;?> </select> <br> <br> <?php if (($this->session->userdata('perfil') == 'vendedor_externo') || ($this->session->userdata('perfil') == 'CLIENTE') || ($this->session->userdata('perfil') == 'vendedor')) { echo "<input class='btn btn-primary btn-lg' type='button' name='descuentoBoton' id='descuentoBoton' value='Aplicar Descuento' onclick='aplicarDescuento()' disabled >"; } else { echo "<input class='btn btn-primary btn-lg' type='button' name='descuentoBoton' id='descuentoBoton' value='Aplicar Descuento' onclick='aplicarDescuento()'>"; } ?> <br> <br> <label><b style="font-family: Arial; font-size: 16pt;height: 40px;">IVA: $</b></label><input type="text" style="font-family: Arial; font-size: 20pt;height: 40px;"name="iva" id="iva" value="<?php echo ($iva); ?>" readonly> <br><br> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="ivaSinStock" id="ivaSinStock" value="<?php echo ($ivaSinStock); ?>" readonly> <input type="hidden" style="font-family: Arial; font-size: 20pt;height: 40px;"name="ivaConStock" id="ivaConStock" value="<?php echo ($ivaConStock); ?>" readonly> <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> <input type="hidden" pattern="[0-9]+([,\.][0-9]+)?" style="font-family: Arial; font-size: 20pt;height: 40px;" name="totalfinalConStock" id="totalfinalConStock" value="<?php echo ($totalConStock); ?>"readonly> <input type="hidden" pattern="[0-9]+([,\.][0-9]+)?" style="font-family: Arial; font-size: 20pt;height: 40px;" name="totalfinalSinStock" id="totalfinalSinStock" value="<?php echo ($totalSinStock); ?>"readonly> </div> </div> </div> </div> </div> <br><br> <input type="hidden" name="multiplicadorIva" id="multiplicadorIva" value="<?php echo ($ivaMultiplicador); ?>"> <input type="hidden" name="bdIva" id="bdIva" value="<?php echo ($datosPedido[0]->iva); ?>"> <input type="hidden" name="cotizador" id="cotizador" value="<?php echo ($datosPedido[0]->cotizador); ?>"> <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="row" style="padding-left:20px;"> <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> <!-- Modal --> <div ng-app="menuRecibos" style="margin-left:20px;"> <div class="modal fade" id="modalRecibos" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" 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" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">RECIBOS REGISTRADOS AL PEDIDO </h4> </div> <div class="modal-body"> <form ng-submit="confirm()" name="pedidos" id="pedidos" action="<?php echo base_url(); ?>recibo/verRecibos/" method="POST" ng-controller="MyCtrl"> <input type="text" autofocus ng-model="search" ng-change="filter()" style="width: 600px;height :40px;" placeholder="BUSCAR" class="form-control" /> <button type="button" class="btn btn-primary btn-lg" title="ACTUALIZAR RECIBOS" ng-click="refresh()" aria-label="Left Align"> <span class="glyphicon glyphicon-refresh"></span> </button> <div class="row"> <div class="col-md-12" ng-show="filteredItems > 0"> <table class="table table-striped table-bordered"> <thead> <th>RECIBO <a ng-click="sort_by('id_recibo');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>NRO PEDIDO <a ng-click="sort_by('numero_pedido');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>FECHA <a ng-click="sort_by('fecha');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>VENDEDOR <a ng-click="sort_by('COTIZADOR');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>RAZON SOCIAL <a ng-click="sort_by('razon_social');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>PAGADOR <a ng-click="sort_by('pagador');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>TOTAL <a ng-click="sort_by('total');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>ACCION </th> </thead> <tbody> <tr ng-repeat="data in filtered = (list | filter:search) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit"> <td ><b>{{data.id_recibo}}</b></td> <td ><b>{{data.numero_pedido}}</b></td> <td><b>{{data.fecha}}</b></td> <td><b>{{data.vendedor}}</b></td> <td><b>{{data.razon_social}}</b></td> <td><b>{{data.pagador}}</b></td> <td><b>{{data.total}}</b></td> <td> <div class="input-group"> <button type="submit" class="btn btn-warning btn-md" title="IMPRIMIR EN PDF" ng-click='ponerDatos(data.id_recibo,data.id_cliente,3)' aria-label="Left Align"> <span class="glyphicon glyphicon-print"></span> </button> </div> </td> </tr> </tbody> </table> </div> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY RECIBOS DISPONIBLES</h4> </div> </div> <div class="col-md-10" ng-show="filteredItems > 0"> <div class="col-md-4"> <h5>Obtenidos {{ filtered.length }} De {{ totalItems}} RECIBOS </h5> </div> <div class="col-md-8" pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div> </div> <input type="hidden" name="accion" id="accion" ng-init="tipoOp = '0'" ng-model="model.accion" value="{{accion}}"> </input> <input type="hidden" name="numClienteRecibo" id="numeroCliente" ng-init="tipoOp = '0'" ng-model="model.numClienteRecibo" value="{{numClienteRecibo}}"> </input> <input type="hidden" name="numeroRecibo" id="numeroRecibo" ng-init="tipoOp = '0'" ng-model="model.numeroRecibo" value="{{numeroRecibo}}"> </input> </form> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">CERRAR</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </div> <!-- FIN PRIMER MODAL --> <!-- Modal GENERACION DE RECIBOS --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div style="margin-left:0px;" ng-controller="MyCtrl2" > <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">CREACION DE RECIBO</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> <div class="inline"> <div class="row"> <div class="content" > <div id="izquierda" align="left"> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">ARTICULOS SIN STOCK</b></label> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalSinStock" id="SubtotalSinStock" ng-model="SubtotalSinStock" value="SubtotalSinStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB NETO: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalNetoSinStock" id="SubtotalNetoSinStock" ng-model="SubtotalNetoSinStock" value="SubtotalNetoSinStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">IVA: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="ivaSinStock" id="ivaSinStock" ng-model="ivaSinStock" value="ivaSinStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">TOTAL: $</b></label> </label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalFinalSinStock" id="SubtotalFinalSinStock" ng-model="SubtotalFinalSinStock" value="SubtotalFinalSinStock" readonly> <br> </div> <div id="derecha" align="right"> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">ARTICULOS CON STOCK</b></label> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalConStock" id="SubtotalConStock" ng-model="SubtotalConStock" value="SubtotalConStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB NETO: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalNetoConStock" id="SubtotalNetoConStock" ng-model="SubtotalNetoConStock" value="SubtotalNetoConStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">IVA: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="ivaConStock" id="ivaConStock" ng-model="ivaConStock" value="ivaConStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">TOTAL: $</b></label> </label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="SubtotalFinalConStock" id="SubtotalFinalConStock" ng-model="SubtotalFinalConStock" value="SubtotalFinalConStock" readonly> <br> </div> </div> </div> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">ARTICULOS TOTALES</b></label><br><br> <div class="row"> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUBTOTAL: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="subForm" id="subForm" ng-model="subForm" value="subForm" readonly> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">TOTAL: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :160px;" name="totalForm" id="totalForm" ng-model="totalForm" value="totalForm" readonly> <button type="button" class="btn btn-primary btn-lg" title="ACTUALIZAR" ng-click="refresh()" aria-label="Left Align"> <span class="glyphicon glyphicon-refresh"></span> </div> </div> <br> <div> <label><b>PAGADOR:</b></label> <input type="text" style="font-family: Arial; font-size: 12pt;height: 40px;width: 250px;" placeholder="PAGADOR" id="pagador" name="pagador" ng-model="pagador" value="" /> <label><b>OBSERVACION:</b></label> <input type="text" style="font-family: Arial; font-size: 12pt;height: 40px;width: 250px;" placeholder="OBSERVACION" id="observacion" name="observacion" ng-model="observacion" value="" /> </div> <div class="col-mod-12 form-inline"> <div> <label><b>TIPO PAGO:</b></label> <select style="font-family: Arial; font-size: 12pt;width: 160px;"name="comboTipoPago" id="comboTipoPago" ng-model="combo" class="form-control"> <option></option> <?php $respuestaCombo = $this->consultas_model->getTiposPagos();foreach ($respuestaCombo as $file): ?> <option><?=$file?></option> <?php endforeach;?> </select> <label><b>IMPORTE:</b></label> <input type="number" style="font-family: Arial; font-size: 12pt;height: 40px;width: 130px;" placeholder="MONTO" id="valor" ng-model="valor" name="valor" value="" /> </div> <br><br> <div> <label><b>NRO CHEQUE:</b></label> <input type="text" style="font-family: Arial; font-size: 12pt;height: 40px;width: 130px;" placeholder="NRO CHEQUE" id="numeroCheque" ng-model="numeroCheque" name="numeroCheque" value="" /> <label><b>BANCO:</b></label> <input type="text" style="font-family: Arial; font-size: 12pt;height: 40px;width: 150px;" placeholder="BANCO" id="banco" name="banco" ng-model="banco" value="" /> <label><b>FECHA COBRO:</b></label> <input style="font-family: Arial; font-size: 12pt;height: 40px;width: 120px;" name="datapicker1" id="datepicker1" ng-model="datepicker1" placeholder="FECHA COBRO" value=""> <button class="btn btn-primary btn-lg" title="AGREGAR ITEM" ng-click="putData(combo,valor,numeroCheque,banco,datepicker1)" aria-label="Left Align"> <span class="glyphicon glyphicon-plus"></span> </button> <button type="button" class="btn btn-danger btn-lg" title="ACTUALIZAR" ng-click="refresh()" aria-label="Left Align"> <span class="glyphicon glyphicon-trash"></span> </button> </div> </div> <br><br> <div class="row"> <div class="col-md-10" ng-show="filteredItems >= 0"> <table class="table table-striped table-bordered"> <thead> <th>TIPO PAGO <a ng-click="sort_by('tipoPago');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>MONTO <a ng-click="sort_by('monto');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>NUMERO CHEQUE <a ng-click="sort_by('numeroCheque');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>BANCO <a ng-click="sort_by('banco');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>FECHA COBRO <a ng-click="sort_by('fechaCobro');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>ACCION </th> </thead> <tbody> <tr ng-repeat="data2 in listItems"> <td ><b>{{data2.tipoPago}}</b></td> <td><b>{{data2.valor}}</b></td> <td><b>{{data2.nro_cheque}}</b></td> <td><b>{{data2.banco}}</b></td> <td><b>{{data2.fechaCobro}}</b></td> <td> <div class="input-group"> <button type="submit" class="btn btn-danger btn-md" title="ELIMINAR ITEM" ng-click="sacarItems(data2)" aria-label="Left Align"> <span class="glyphicon glyphicon-trash"></span> </button> </div> </td> </tr> </tbody> </table> </div> </div> </div> <div class="modal-footer"> <div class="inline"> <form ng-submit="confirm()" name="pedidos2" id="pedidos2" action="<?php echo base_url(); ?>recibo/procesarRecibo/" method="POST" > <button type="button" class="btn btn-default btn-lg " data-dismiss="modal">CERRAR</button> <input type="hidden" name="nroPedido" id="nroPedido" ng-model="nroPedido" value="{{nroPedido}}"> </input> <input type="hidden" name="arrayDatosItems" id="arrayDatosItems" ng-model="arrayDatosItems" value="{{listItems}}"> </input> <input type="hidden" name="observacion2" id="observacion2" ng-model="observacion2" value="{{observacion}}"> </input> <input type="hidden" name="pagador2" id="pagador2" ng-model="pagador2" value="{{pagador}}"> </input> <input type="hidden" name="id_cliente" id="id_cliente" ng-model="id_cliente" value="{{id_cliente}}"> </input> <input type="submit" class="btn btn-success btn-lg" id="registrar2" value="GENERAR RECIBO" /> </form> </div> </div> </div> </div> </div> </div> <!-- termina el segundo modal --> <div 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="../../../../imagenesAlmazen_new/{{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> <!-- termina el tercer modal --> <div class="modal fade" id="modalArticulosExistentes" 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">ARTICULOS CON STOCK </h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" > <div style="margin-left:5px;" ng-controller="MostrarStock" > <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> <button type="button" class="btn btn-primary btn-lg" title="ACTUALIZAR" ng-click="refresh()" aria-label="Left Align"> <span class="glyphicon glyphicon-refresh"></span> </button> </div> <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');"><i class="glyphicon glyphicon-sort"></i></a></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>CANTIDAD <a ng-click="sort_by('categoria');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>PRECIO VENTA <a ng-click="sort_by('precio');"><i class="glyphicon glyphicon-sort"></i></a></th> </thead> <tbody> <tr ng-repeat="productos in filtered = (items | filter:searchText | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit"> <td >{{productos.nombre}}</td> <td ><b>{{productos.descripcion}}</b></td> <td ><b>{{productos.estado}}</b></td> <td ><b>{{productos.cantidad}}</b></td> <td > <b>{{productos.precio}}</b></td> </tr> </tbody> </table> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY ITEMS INGRESADOS</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-12" 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 class="content"> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">ARTICULOS CON STOCK</b></label> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalConStock" id="SubtotalConStock" ng-model="SubtotalConStock" value="SubtotalConStock" readonly> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB NETO: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalNetoConStock" id="SubtotalNetoConStock" ng-model="SubtotalNetoConStock" value="SubtotalNetoConStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">IVA: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="ivaConStock" id="ivaConStock" ng-model="ivaConStock" value="ivaConStock" readonly> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">TOTAL: $</b></label> </label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalFinalConStock" id="SubtotalFinalConStock" ng-model="SubtotalFinalConStock" value="SubtotalFinalConStock" readonly> </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> <!-- termina el cuarto modal --> <div class="modal fade" id="modalArticulosInexistentes" 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">ARTICULOS PENDIENTES DE INGRESO </h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" > <div style="margin-left:5px;" ng-controller="MostrarSinStock" > <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> <button type="button" class="btn btn-primary btn-lg" title="ACTUALIZAR" ng-click="refresh()" aria-label="Left Align"> <span class="glyphicon glyphicon-refresh"></span> </button> </div> <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');"><i class="glyphicon glyphicon-sort"></i></a></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>CANTIDAD <a ng-click="sort_by('categoria');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>PRECIO VENTA <a ng-click="sort_by('precio');"><i class="glyphicon glyphicon-sort"></i></a></th> </thead> <tbody> <tr ng-repeat="productos in items track by productos.id"> <td >{{productos.nombre}}</td> <td ><b>{{productos.descripcion}}</b></td> <td ><b>{{productos.estado}}</b></td> <td ><b>{{productos.cantidad}}</b></td> <td > <b>{{productos.precio}}</b></td> </tr> </tbody> </table> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY ITEMS DISPONIBLES</h4> </div> </div> <div class="col-md-10" ng-show="filteredItems > 0"> <div class="col-md-4"> <h5> {{ filtered.length }} De {{ totalItems}} ITEMS 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 class="content"> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">ARTICULOS SIN STOCK</b></label> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalSinStock" id="SubtotalSinStock" ng-model="SubtotalSinStock" value="SubtotalSinStock" readonly> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">SUB NETO: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalNetoSinStock" id="SubtotalNetoSinStock" ng-model="SubtotalNetoSinStock" value="SubtotalNetoSinStock" readonly> <br> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">IVA: $</b></label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="ivaSinStock" id="ivaSinStock" ng-model="ivaSinStock" value="ivaSinStock" readonly> <label><b style="font-family: Arial; font-size: 18pt;height: 30px;">TOTAL: $</b></label> </label> <input type="text" style="font-family: Arial; font-size:20pt;height: 40px;width :180px;" name="SubtotalFinalSinStock" id="SubtotalFinalSinStock" ng-model="SubtotalFinalSinStock" value="SubtotalFinalSinStock" readonly> </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"> $("modalArticulos").modal('show'); $(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); } }); }); $( "#datepicker1" ).datepicker({ dateFormat: "yy-m-dd", // Primer dia de la semana El lunes firstDay: 1, // Dias Largo en castellano // Cuando seleccionamos la fecha esta se pone en el campo Input onSelect: function(dateText) { } }); 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('MyCtrl', function ($scope, $http, $location) { $scope.accion=''; $scope.numClienteRecibo=''; $scope.numeroRecibo=''; $nroPedido=document.getElementById("numeroPedido").value; $scope.list=[]; $http({ url: "<?php echo site_url("pedido/getPedidosPuntualesAajax"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.list = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.list.length; //Initially for no filter $scope.totalItems = $scope.list.length; }); $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; $scope.refresh = function() { $http({ url: "<?php echo site_url("pedido/getPedidosPuntualesAajax"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.list = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.list.length; //Initially for no filter $scope.totalItems = $scope.list.length; }); }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; }; $scope.ponerDatos= function (id,numeroCliente,accion){ $scope.accion=accion; $scope.numClienteRecibo=numeroCliente; $scope.numeroRecibo=id; }; $scope.confirm = function() { if (confirm('Estas seguro de esta accion?')){ event.returnValue=true; } else{ event.returnValue=false; } }; }); app.controller('MyCtrl2', function ($scope, $http, $location) { $scope.accion=''; $scope.observacion=''; $scope.pagador=''; $scope.numeroRecibo=''; $scope.totalForm=document.getElementById("totalfinal").value; $scope.subForm=document.getElementById("totalAlternativo").value; $scope.id_cliente=document.getElementById("id_cliente").value; $scope.nroPedido=document.getElementById("numeroPedido").value; $scope.SubtotalConStock=document.getElementById("inputSubTotalConStock").value; $scope.SubtotalSinStock=document.getElementById("inputSubTotalSinStock").value; $scope.SubtotalNetoConStock=document.getElementById("inputSubtotNetoConStock").value; $scope.SubtotalNetoSinStock=document.getElementById("inputSubTotNetoSinStock").value; $scope.ivaConStock=document.getElementById("ivaConStock").value; $scope.ivaSinStock=document.getElementById("ivaSinStock").value; $scope.SubtotalFinalConStock=document.getElementById("totalfinalConStock").value; $scope.SubtotalFinalSinStock=document.getElementById("totalfinalSinStock").value; $scope.listItems=[]; $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.refresh = function() { $scope.totalForm=document.getElementById("totalfinal").value; $scope.subForm=document.getElementById("totalAlternativo").value; $scope.id_cliente=document.getElementById("id_cliente").value; $scope.nroPedido=document.getElementById("numeroPedido").value; $scope.SubtotalConStock=document.getElementById("inputSubTotalConStock").value; $scope.SubtotalSinStock=document.getElementById("inputSubTotalSinStock").value; $scope.SubtotalNetoConStock=document.getElementById("inputSubtotNetoConStock").value; $scope.SubtotalNetoSinStock=document.getElementById("inputSubTotNetoSinStock").value; $scope.ivaConStock=document.getElementById("ivaConStock").value; $scope.ivaSinStock=document.getElementById("ivaSinStock").value; $scope.SubtotalFinalConStock=document.getElementById("totalfinalConStock").value; $scope.SubtotalFinalSinStock=document.getElementById("totalfinalSinStock").value; }; $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; }; $scope.sacarItems= function(item){ var index = $scope.listItems.indexOf(item); $scope.listItems.splice(index, 1); }; $scope.refresh = function() { $scope.listItems=[]; }; $scope.putData= function (a,b,c,d,e){ error="0"; var datetime = $("#datepicker1").val(); if(b){}else{b="";} if(c){}else{c="";} if(d){}else{d="";} if(datetime){}else{datetime="";} //validacion items //valido si es efectivo if(a ==="EFECTIVO"){ if(b != ""){ } else{ error="1"; alert("debe completar el monto"); } } //valido si es cheque if(a==="CHEQUE"){ if(b != ""){ if(c != ""){ if(d!= ""){ if(datetime!= ""){ }else{ error="1"; alert("debe completar FECHA COBRO"); } }else{ error="1"; alert("debe completar el BANCO"); } }else{ error="1"; alert("debe completar el numero de cheque"); } } else{ error="1"; alert("debe completar el monto"); } } if(a==="OTROS"){ error="1"; alert("no se inputa este tipo de pago"); } if(error === "0"){ $scope.listItems.push({ 'tipoPago':a, 'valor':b, 'nro_cheque':c, 'banco':d, 'fechaCobro':datetime }); //vacio los campos $scope.numeroCheque=""; $scope.combo=""; $scope.valor=""; $scope.banco=""; $("#datepicker1").val(""); } }; $scope.confirm = function() { if ($scope.listItems.length > 0){ event.returnValue=true; } else{ alert("FORMULARIO VACIO"); event.returnValue=false; } }; }); app.controller('SearchArticulo', function ($scope, $http, $location) { $scope.articulos=[]; $http({ url: "<?php echo site_url("productos/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(); }; }); app.controller('MostrarStock', function ($scope, $http, $location) { $scope.items=[]; $nroPedido=document.getElementById("numeroPedido").value; $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.SubtotalConStock=document.getElementById("inputSubTotalConStock").value; $scope.SubtotalNetoConStock=document.getElementById("inputSubtotNetoConStock").value; $scope.ivaConStock=document.getElementById("ivaConStock").value; $scope.SubtotalFinalConStock=document.getElementById("totalfinalConStock").value; $http({ url: "<?php echo site_url("pedido/getProductosConStock"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.items = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.items.length; //Initially for no filter $scope.totalItems = $scope.items.length; }); $scope.refresh = function() { $http({ url: "<?php echo site_url("pedido/getProductosConStock"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.items = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.items.length; //Initially for no filter $scope.totalItems = $scope.items.length; }); }; $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; }; $scope.getTotal = function(){ var total = 0; for(var i = 0; i < $scope.items.length; i++){ var product = $scope.items[i]; total += (product.precio * product.cantidad); } return total; }; }); app.controller('MostrarSinStock', function ($scope, $http, $location) { $scope.items=[]; $nroPedido=document.getElementById("numeroPedido").value; $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.SubtotalSinStock=document.getElementById("inputSubTotalSinStock").value; $scope.SubtotalNetoSinStock=document.getElementById("inputSubTotNetoSinStock").value; $scope.ivaSinStock=document.getElementById("ivaSinStock").value; $scope.SubtotalFinalSinStock=document.getElementById("totalfinalSinStock").value; $http({ url: "<?php echo site_url("pedido/getProductosSinStock"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.items = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.items.length; //Initially for no filter $scope.totalItems = $scope.items.length; }); $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; $scope.refresh = function() { $http({ url: "<?php echo site_url("pedido/getProductosSinStock"); ?>", method: "GET", params: {id_pedido: $nroPedido} }).success(function(data){ $scope.items = data; $scope.currentPage = 1; //current page $scope.entryLimit = 10; //max no of items to display in a page $scope.filteredItems = $scope.items.length; //Initially for no filter $scope.totalItems = $scope.items.length; }); }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; }; $scope.getTotal = function(){ var total = 0; for(var i = 0; i < $scope.items.length; i++){ var product = $scope.items[i]; total += (product.precio * product.cantidad); } return total; }; }); $(document).ready(function() { $("#busquedaRecibo .deleteLink").on("click",function() { var tr = $(this).closest('tr'); tr.css("background-color","#FF3700"); tr.fadeOut(400, function(){ tr.remove(); }); return false; }); }); $(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){ buscando=document.getElementById("buscandoProductos").value; if(buscando!= ""){ $("#div_noticias").html(data); } eventoEnter(); } }); } }); }); $().ready(function(){ $.ajax({ type: 'POST', url: '<?=base_url("pedido/paginacionProductos")?>', success: function(data){ buscando=document.getElementById("buscandoProductos").value; if(buscando!= ""){ $("#div_noticias").html(data); } } }); }); function busquedaProductos(){ buscando=document.getElementById("buscandoProductos").value; $.ajax({ type: 'POST', url: '<?=base_url("pedido/paginacionProductos")?>', data: {buscando:buscando}, success: function(data){ $("#div_noticias").html(data); } }); } function volver(){ location.href='<?php if (($this->session->userdata('perfil') == "vendedor_externo") || ($this->session->userdata('perfil') == 'CLIENTE') || ($this->session->userdata('perfil') == 'vendedor')) { 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(); } //funcion que actualiza el campo multiplicador iva function aplicarIva(iva){ subTotal=document.getElementById('subtotal').value; total=document.getElementById('totalAlternativo').value; nroPedido=document.getElementById("numeroPedido").value; if( iva !=null){ $.ajax({ type: 'POST', url: '<?=base_url("pedido/actualizarIva")?>', data: {nroPedido:nroPedido,iva:iva,total:total,subTotal:subTotal}, success: function(data){ //parseo el valor devuelto calculo=data.split(';'); //traigo los totales valorParcial=parseFloat(document.getElementById('totalAlternativo').value); total=parseFloat(document.getElementById("totalfinal").value); //traigo los totales con stock. valorParcialConStock=parseFloat(document.getElementById('inputSubtotNetoConStock').value); totalConStock=parseFloat(document.getElementById('totalfinalConStock').value); // traigo los totales sin stock. valorParcialSinStock=parseFloat(document.getElementById('inputSubTotNetoSinStock').value); totalSinStock=parseFloat(document.getElementById('totalfinalSinStock').value); $('#multiplicadorIva').val(calculo[1]); $('#bdIva').val(calculo[0]); //agrego correcion iva multiplicadorIva=calculo[1]; iva=parseFloat(valorParcial*multiplicadorIva).toFixed(2); totalFinal=parseFloat(parseFloat(valorParcial) + parseFloat(iva)).toFixed(2); ivaConStock=parseFloat(valorParcialConStock*multiplicadorIva).toFixed(2); totalFinalConStock=parseFloat(parseFloat(valorParcialConStock) + parseFloat(iva)).toFixed(2); ivaSinStock=parseFloat(valorParcialSinStock*multiplicadorIva).toFixed(2); totalFinalSinStock=parseFloat(parseFloat(valorParcialSinStock) + parseFloat(iva)).toFixed(2); $('#iva').val(iva); $('#totalfinal').val(totalFinal); $('#ivaConStock').val(ivaConStock); $('#totalfinalConStock').val(totalFinalConStock); $('#ivaSinStock').val(ivaSinStock); $('#totalfinalSinStock').val(totalFinalSinStock); nroPedido=document.getElementById("numeroPedido").value; window.location.reload(); } }); } } function aplicarAumento(value){ if(value =="MERCADOPAGO"){ alert("si"); } if(value =="AUMENTO 10%"){ alert("si"); } } function registrarPago(){ nroPedido=document.getElementById("nroPedido").value; total=document.getElementById('totalfinal').value; tipo=document.getElementById("comboTipoPago").value; dato=document.getElementById("datoOperacion").value; recibo=document.getElementById("recibo").value; valor=document.getElementById("valor").value; if(tipo != null){ if( valor !=null){ $.ajax({ type: 'POST', // url: '?= base_url("pedido/registrarPagoWeb")?>', url: '<?=base_url("recibo/procesarRecibo")?>', data: {nroPedido:nroPedido,tipo:tipo,dato:dato,valor:valor,total:total,recibo:recibo}, success: function(data){ if(data != "Faltan Datos"){ respuesta=data.split(';'); $('#pagadoPopup').val(parseFloat(parseFloat(document.getElementById("pagadoPopup").value)+parseFloat(valor))); $('#saldoPopup').val(parseFloat(parseFloat(document.getElementById("saldoPopup").value)-parseFloat(valor))); $("#busquedaRecibo").prepend("<tr><td>" + tipo + "</td><td>" + respuesta[0] + "</td><td>" + dato + "</td><td>" + valor+ "</td><td>" + recibo+ "</td><td><input class='deleteLink btn btn-danger' type='button' name='eliminar' id='eliminar' value='Eliminar' onclick='elinminarRegistroPago("+respuesta[1]+"," + valor+");'></td></tr>"); alert("PAGO REGISTRADO"); } else{ alert("Datos incompletos"); } } }); } else{ alert("Monto mayor a cero, por favor"); } } else{ alert("Debe Ingresar tipo de Pago"); } } function aplicarDescuento(){ descuento=document.getElementById('comboDescuentos').value; if(descuento.length !=0){ descuento1=descuento.split('%'); subTotal=document.getElementById('subtotal').value; subTotalSinStock=document.getElementById('inputSubTotalSinStock').value; subTotalConStock=document.getElementById('inputSubTotalConStock').value; valor=subTotal; valor2=subTotalSinStock; valor3=subTotalConStock; //correccion iva para registrar las posibilidades del iva. multiplicadorIva=document.getElementById('multiplicadorIva').value; descuentoFinal=parseFloat(descuento1); descuentoF=descuentoFinal*valor*0.01; descuentoFSS=descuentoFinal*valor2*0.01; descuentoFCS=descuentoFinal*valor3*0.01; valorFinal=(valor-descuentoF); valorFinal2=(valor2-descuentoFSS); valorFinal3=(valor3-descuentoFCS); //subtotal con descuento $('#totalAlternativo').val(valorFinal.toFixed(2)); $('#inputSubTotalNetoSinStock').val(valorFinal2.toFixed(2)); $('#inputSubTotalNetoConStock').val(valorFinal3.toFixed(2)); valorIva=parseFloat((parseFloat(valorFinal).toFixed(2)*multiplicadorIva)).toFixed(2); valorIva2=parseFloat((parseFloat(valorFinal2).toFixed(2)*multiplicadorIva)).toFixed(2); valorIva3=parseFloat((parseFloat(valorFinal3).toFixed(2)*multiplicadorIva)).toFixed(2); $('#iva').val(valorIva); $('#ivaSinStock').val(valorIva2); $('#ivaConStok').val(valorIva3); total=(parseFloat(valorIva) + parseFloat(valorFinal)); total2=(parseFloat(valorIva2) + parseFloat(valorFinal2)); total3=(parseFloat(valorIva3) + parseFloat(valorFinal3)); $('#totalfinal').val(total.toFixed(2)); $('#totalfinalSinStock').val(total.toFixed(2)); $('#totalfinalConStock').val(total.toFixed(2)); $('#comboDescuentos').val(descuento); vendedor=document.getElementById("comboVendedor").value; nroPedido=document.getElementById("numeroPedido").value; $.ajax({ type: 'POST', url: '<?=base_url("pedido/registrarDescuento")?>', data: {descuentoFinal:descuentoFinal,nroPedido:nroPedido,total:total,vendedor:vendedor,subTotal:subTotal}, success: function(data){ } }); } } function registraComentario() { comentario=document.getElementById('observacion').value; nroPedido=document.getElementById('numeroPedido').value; $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/registrarComentario"); ?>', data: {comentario:comentario,nroPedido:nroPedido}, success:function(data){ alert("Comentario Registrado"); } }); } 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]); $('#razon_social').val(calculo[2]); $('#DireccionCliente').val(calculo[3]); $('#telefonoCliente').val(calculo[5]); $('#id_cliente').val(calculo[0]); $('#CuitCliente').val(calculo[7]); $('#mail').val(calculo[8]); $('#expreso').val(calculo[12]); } }); } function ingresarCarrito(producto,i,precio,estado){ confirmado=false; subTotal=document.getElementById('subtotal').value; total=document.getElementById('totalfinal').value; cliente=document.getElementById("id_cliente").value; vendedor=document.getElementById("comboVendedor").value; desc=document.getElementById("comboDescuentos").value; descto=desc.split('%'); descuento=descto[0]; cant="cantidadProd_"+i; nombre="ingresado_"+i; document.getElementById(nombre).checked = true; // document.getElementById('busquedaProductos').getElementsByTagName('input')[i].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 descuentoBase=document.getElementById("descuentoBase").value; multiplicadorIva=document.getElementById('multiplicadorIva').value; if (cantidad>0){ $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/registrarDetalle"); ?>', data: {pedido:pedido,producto:producto, cantidad:cantidad,precio:precio,cliente:cliente,vendedor:vendedor,total:total,subTotal:subTotal,descuento:descuento,multiplicadorIva:multiplicadorIva,estado:estado}, success:function(data){ //chequeo si esta repetido, en caso de estarlo pido confirmacion. if(data !='repetido'){ respuesta=data.split(';'); valorSinDesc=parseFloat(cantidad*precio); valorParcial=(parseFloat(cantidad*precio)-parseFloat(cantidad*precio*descuentoBase/100)); $('#totalAlternativo').val(parseFloat(parseFloat(document.getElementById("totalAlternativo").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#subtotal').val(parseFloat(parseFloat(document.getElementById("subtotal").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); //agrego correcion iva multiplicadorIva=document.getElementById('multiplicadorIva').value; $('#iva').val(parseFloat(parseFloat(document.getElementById("iva").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinal').val((parseFloat(document.getElementById("totalfinal").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+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>"); if(respuesta[4] =="PEND INGRESO"){ //actualizo el tema del sin stock inputs para sumar por sin stock $('#inputSubTotNetoSinStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotNetoSinStock").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#inputSubTotalSinStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalSinStock").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); $('#ivaSinStock').val(parseFloat(parseFloat(document.getElementById("ivaSinStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinalSinStock').val((parseFloat(document.getElementById("totalfinalSinStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); }else{ //actualizo el tema del stock inputs para sumar por stock $('#inputSubtotNetoConStock').val(parseFloat(parseFloat(document.getElementById("inputSubtotNetoConStock").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#inputSubTotalConStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalConStock").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); $('#ivaConStock').val(parseFloat(parseFloat(document.getElementById("ivaConStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinalConStock').val((parseFloat(document.getElementById("totalfinalConStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); } document.getElementById("cantidadRegistros").value=(cantProd+cantidadSumafinal); }else{ var r=confirm("ARTICULO REPETIDO DESEA AGREGARLO IGUAL?"); if (r == true) { $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/registrarDetalleConfirmado"); ?>', data: {pedido:pedido,producto:producto, cantidad:cantidad,precio:precio,cliente:cliente,vendedor:vendedor,total:total,subTotal:subTotal,descuento:descuento,estado:estado}, success:function(data){ respuesta=data.split(';'); valorSinDesc=parseFloat(cantidad*precio); valorParcial=(parseFloat(cantidad*precio)-parseFloat(cantidad*precio*descuentoBase/100)); $('#totalAlternativo').val(parseFloat(parseFloat(document.getElementById("totalAlternativo").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#subtotal').val(parseFloat(parseFloat(document.getElementById("subtotal").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); //agrego correcion iva multiplicadorIva=document.getElementById('multiplicadorIva').value; $('#iva').val(parseFloat(parseFloat(document.getElementById("iva").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinal').val((parseFloat(document.getElementById("totalfinal").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+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); if(respuesta[4] =="PEND INGRESO"){ //actualizo el tema del sin stock inputs para sumar por sin stock $('#inputSubTotNetoSinStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotNetoSinStock").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#inputSubTotalSinStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalSinStock").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); $('#ivaSinStock').val(parseFloat(parseFloat(document.getElementById("ivaSinStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinalSinStock').val((parseFloat(document.getElementById("totalfinalSinStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); }else{ //actualizo el tema del stock inputs para sumar por stock $('#inputSubtotNetoConStock').val(parseFloat(parseFloat(document.getElementById("inputSubtotNetoConStock").value)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); $('#inputSubTotalConStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalConStock").value)+parseFloat(valorSinDesc.toFixed(2))).toFixed(2)); $('#ivaConStock').val(parseFloat(parseFloat(document.getElementById("ivaConStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)).toFixed(2)); $('#totalfinalConStock').val((parseFloat(document.getElementById("totalfinalConStock").value)+parseFloat(valorParcial.toFixed(2)*multiplicadorIva)+parseFloat(valorParcial.toFixed(2))).toFixed(2)); } } }); } } } }); } else{ alert("Debe ingresar un valor mayor a 0 para poder ingresar al carrito"); } } function elinminarRegistroPago(id,valor){ $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/eliminarRegistroPago"); ?>', data: {id:id}, success:function(data){ $('#pagadoPopup').val(parseFloat(parseFloat(document.getElementById("pagadoPopup").value)-parseFloat(valor))); $('#saldoPopup').val(parseFloat(parseFloat(document.getElementById("saldoPopup").value)+parseFloat(valor))); alert("REGISTRO BORRADO"); }, error: function () { alert("ERROR AL BORRAR"); } }); } function elinminarRegistro(id,cantidad,estado) { numeroPedido=document.getElementById("numeroPedido").value; subTotal=document.getElementById('subtotal').value; total=document.getElementById('totalfinal').value; cliente=document.getElementById("id_cliente").value; vendedor=document.getElementById("comboVendedor").value; desc=document.getElementById("comboDescuentos").value; descto=desc.split('%'); descuento=descto[0]; cantidadProductos=document.getElementById("cantidadRegistros").value; cantProd=parseInt(cantidadProductos,10); cantidadSumafinal=parseInt(cantidad,10); cantProd=parseInt(cantidadProductos,10); cantidadSumafinal=parseInt(cantidad,10); descuentoBase=document.getElementById("descuentoBase").value; //tengo que averiguar el registro que estoy borrando de la tabla y de la base de datos document.getElementById("cantidadRegistros").value=(cantProd-cantidadSumafinal); multiplicadorIva=document.getElementById('multiplicadorIva').value; $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/eliminar"); ?>', data: {id:id,numeroPedido:numeroPedido,cliente:cliente,vendedor:vendedor,total:total,descuento:descuento,subTotal:subTotal,multiplicadorIva:multiplicadorIva}, success:function(data){ respuesta=data.split(';'); valorSinDto=parseFloat(respuesta[0]*respuesta[1]); valorParcial=(parseFloat(respuesta[0]*respuesta[1])-parseFloat(respuesta[0]*respuesta[1]*descuentoBase/100)); $('#subtotal').val(parseFloat(parseFloat(document.getElementById("subtotal").value)-parseFloat(valorSinDto.toFixed(2))).toFixed(2)); $('#totalAlternativo').val((parseFloat(parseFloat(document.getElementById("totalAlternativo").value))-parseFloat(valorParcial))); //agrego correcion iva multiplicadorIva=document.getElementById('multiplicadorIva').value; $('#iva').val((parseFloat(parseFloat(document.getElementById("iva").value))-parseFloat(valorParcial*multiplicadorIva))); $('#totalfinal').val((parseFloat(document.getElementById("totalfinal").value)-parseFloat(valorParcial*multiplicadorIva)-parseFloat(valorParcial))); if(respuesta[4] =="PEND INGRESO"){ //actualizo el tema del sin stock inputs para sumar por $('#inputSubTotalSinStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalSinStock").value)-parseFloat(valorSinDto.toFixed(2))).toFixed(2)); $('#inputSubTotNetoSinStock').val((parseFloat(parseFloat(document.getElementById("inputSubTotNetoSinStock").value))-parseFloat(valorParcial))); $('#ivaSinStock').val((parseFloat(parseFloat(document.getElementById("ivaSinStock").value))-parseFloat(valorParcial*multiplicadorIva))); $('#totalfinalSinStock').val((parseFloat(document.getElementById("totalfinalSinStock").value)-parseFloat(valorParcial*multiplicadorIva)-parseFloat(valorParcial))); }else{ //actualizo el tema del stock inputs para sumar por stock $('#inputSubTotalConStock').val(parseFloat(parseFloat(document.getElementById("inputSubTotalConStock").value)-parseFloat(valorSinDto.toFixed(2))).toFixed(2)); $('#inputSubtotNetoConStock').val((parseFloat(parseFloat(document.getElementById("inputSubtotNetoConStock").value))-parseFloat(valorParcial))); $('#ivaConStock').val((parseFloat(parseFloat(document.getElementById("ivaConStock").value))-parseFloat(valorParcial*multiplicadorIva))); $('#totalfinalConStock').val((parseFloat(document.getElementById("totalfinalConStock").value)-parseFloat(valorParcial*multiplicadorIva)-parseFloat(valorParcial))); } 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; subtotal=document.getElementById('subtotal').value; cliente=document.getElementById("id_cliente").value; vendedor=document.getElementById("comboVendedor").value; cond=document.getElementById("comboCondPago").value; medioPago=document.getElementById("comboMedioPago").value; checkPago=document.getElementById("comboPagado").value; cotizador=document.getElementById("cotizador").value; if(total != '0'){ if(cliente != ''){ if(numeroPedido != ""){ location.href='<?php echo base_url() ?>pedido/guardarPedido?nroPedido='+numeroPedido+'&total='+total+'&vendedor='+vendedor+'&subTotal='+subtotal+'&medioPago='+medioPago+'&cond='+cond+'&checkPago='+checkPago+'&cotizador='+cotizador; } } 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>
|