Commit be6c6ca48f15cd44d5f9a0a5ab54dc46bddd3df8

Authored by Eric Fernandez
1 parent 8b16db8d67

primera versión estable

1 1 /node_modules
2   -/package-lock.json
3 2 \ No newline at end of file
  3 +/package-lock.json
  4 +/dist
  5 +/tmp
... ... @@ -20,7 +20,7 @@
20 20 "angular-route": "^1.7.8",
21 21 "bootstrap": "^4.3.1",
22 22 "font-awesome": "^4.7.0",
23   - "gulp": "^4.0.2",
  23 + "gulp": "^3.9.1",
24 24 "gulp-angular-templatecache": "^3.0.0",
25 25 "gulp-clean": "^0.4.0",
26 26 "gulp-connect": "^5.7.0",
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaCrearRemito')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//localhost:9900'
  4 + });
src/etc/develop.js.ejemplo
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaCrearRemito')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
... ... @@ -0,0 +1 @@
  1 +angular.module('focaCrearFactura', ['ngRoute']);
src/js/controller.js
... ... @@ -0,0 +1,643 @@
  1 +angular.module('focaCrearFactura').controller('facturaController', [
  2 + '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout',
  3 + 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService',
  4 + '$localStorage',
  5 + function (
  6 + $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService,
  7 + crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage) {
  8 +
  9 + config();
  10 +
  11 + function config() {
  12 + $scope.tmpCantidad = Number;
  13 + $scope.tmpPrecio = Number;
  14 + $scope.botonera = crearFacturaService.getBotonera();
  15 + $scope.isNumber = angular.isNumber;
  16 + $scope.datepickerAbierto = false;
  17 + $scope.show = false;
  18 + $scope.cargando = true;
  19 + $scope.now = new Date();
  20 + $scope.puntoVenta = rellenar(0, 4);
  21 + $scope.comprobante = rellenar(0, 8);
  22 + $scope.dateOptions = {
  23 + maxDate: new Date(),
  24 + minDate: new Date(2010, 0, 1)
  25 + };
  26 + $scope.cabeceras = [];
  27 + crearFacturaService.getParametros().then(function (res) {
  28 +
  29 + var parametros = JSON.parse(res.data[0].jsonText);
  30 +
  31 + if ($localStorage.factura) {
  32 +
  33 + $timeout(function () { getLSFactura(); });
  34 + } else {
  35 +
  36 + for (var property in parametros) {
  37 + $scope.factura[property] = parametros[property];
  38 + $scope.inicial[property] = parametros[property];
  39 + }
  40 +
  41 + setearFactura($scope.factura);
  42 + }
  43 +
  44 + });
  45 +
  46 + //SETEO BOTONERA LATERAL
  47 + $timeout(function () {
  48 + focaBotoneraLateralService.showSalir(false);
  49 + focaBotoneraLateralService.showPausar(true);
  50 + focaBotoneraLateralService.showGuardar(true, $scope.crearFactura);
  51 + focaBotoneraLateralService.addCustomButton('Salir', salir);
  52 + });
  53 +
  54 + init();
  55 +
  56 + }
  57 +
  58 + function init() {
  59 +
  60 + $scope.$broadcast('cleanCabecera');
  61 +
  62 + $scope.factura = {
  63 + id: 0,
  64 + estado: 0,
  65 + vendedor: {},
  66 + cliente: {},
  67 + proveedor: {},
  68 + domicilio: { dom: '' },
  69 + moneda: {},
  70 + cotizacion: $scope.cotizacionPorDefecto || {},
  71 + articulosFactura: []
  72 + };
  73 +
  74 + $scope.factura.articulosFactura = [];
  75 + $scope.idLista = undefined;
  76 +
  77 + crearRemitoService.getNumeroRemito().then(
  78 + function (res) {
  79 + $scope.puntoVenta = rellenar(res.data.sucursal, 4);
  80 + $scope.comprobante = rellenar(res.data.numeroRemito, 8);
  81 + },
  82 + function (err) {
  83 + focaModalService.alert('La terminal no esta configurada correctamente');
  84 + console.info(err);
  85 + }
  86 + );
  87 +
  88 + $scope.inicial = angular.copy($scope.factura);
  89 + }
  90 +
  91 + $scope.$watch('factura', function (newValue) {
  92 + focaBotoneraLateralService.setPausarData({
  93 + label: 'factura',
  94 + val: newValue
  95 + });
  96 + }, true);
  97 +
  98 + $scope.crearFactura = function () {
  99 +
  100 + if (!validarGuardar()) return;
  101 +
  102 + var save = {
  103 + factura: {
  104 +
  105 + BONIF: 0,
  106 + CLI: $scope.factura.cliente.cod,
  107 + CUI: $scope.factura.cliente.cuit,
  108 + CTA: $scope.factura.cliente.cod,
  109 + DC1: '',
  110 + DC2: '',
  111 + DE1: '',
  112 + DOM: $scope.factura.cliente.DOM,
  113 + FACAUT: 0,
  114 + DTO: 0,
  115 + FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'),
  116 + FEC_ANT: '19000101',
  117 + FPA: 2,
  118 + IDEXCEPCION: 0,
  119 + IDLP: $scope.factura.cliente.mod.trim() || 0,
  120 + IDPERSONERIA: 0,
  121 + IMI: 0, // TODO
  122 + IMI2: 0, // TODO
  123 + IMI3: 0, // TODO
  124 + IMP_LEY: 0,
  125 + IRI: 0, // TODO
  126 + IRS: 0,
  127 + LEG: '',
  128 + LUG: $scope.factura.vendedor.LugVen,
  129 + MK_M: 0,
  130 + NEE: 0, // TODO
  131 + NET: 0, // TODO
  132 + NFI: '',
  133 + NNP: 0,
  134 + NOM: $scope.factura.cliente.nom,
  135 + OPE: $scope.factura.vendedor.CodVen,
  136 + PAG: $scope.getTotal(),
  137 + PER: 0,
  138 + PER_IVA: 0,
  139 + PLA: $scope.factura.vendedor.NplVen,
  140 + PRO: '',
  141 + REC_ANT: 0,
  142 + SUC: parseInt($scope.puntoVenta),
  143 + TCA: 1,
  144 + TCO: 'FT',
  145 + TFI: '',
  146 + TIP: $scope.factura.cliente.tipoFactura,
  147 + TIV: 0, // TODO
  148 + TOT: $scope.getTotal(),
  149 + TUR: 0, // TODO
  150 + VEN: $scope.factura.vendedor.CodVen,
  151 + VTO_CLI: '',
  152 + ZON: 1, // TODO
  153 + OBSERVACIONES: $scope.factura.observaciones
  154 + },
  155 + cuerpo: $scope.articulosFiltro()
  156 + };
  157 +
  158 + crearFacturaService.guardarFactura(save).then(function(res) {
  159 +
  160 + focaBotoneraLateralService.endGuardar(true);
  161 +
  162 + focaModalService.alert('Comprobante guardado con éxito');
  163 +
  164 + config();
  165 +
  166 + }).catch(function(err) {
  167 + focaModalService.alert('Hubo un error al guardar la factura');
  168 + console.log(err);
  169 + });
  170 +
  171 + };
  172 +
  173 + $scope.seleccionarCliente = function () {
  174 +
  175 + var modalInstance = $uibModal.open(
  176 + {
  177 + ariaLabelledBy: 'Busqueda de Cliente',
  178 + templateUrl: 'foca-busqueda-cliente-modal.html',
  179 + controller: 'focaBusquedaClienteModalController',
  180 + resolve: {
  181 + vendedor: function () { return null; },
  182 + cobrador: function () { return null; }
  183 + },
  184 + size: 'lg'
  185 + }
  186 + );
  187 + modalInstance.result.then(
  188 + function (cliente) {
  189 + $scope.factura.cliente = cliente;
  190 +
  191 + $scope.$broadcast('addCabecera', {
  192 + label: 'Cliente:',
  193 + valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
  194 + });
  195 +
  196 + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
  197 +
  198 + }, function () {
  199 + }
  200 + );
  201 +
  202 + };
  203 +
  204 + $scope.seleccionarVendedor = function() {
  205 + var parametrosModal = {
  206 + titulo: 'Búsqueda vendedores',
  207 + query: '/vendedor-playa',
  208 + columnas: [
  209 + {
  210 + propiedad: 'CodVen',
  211 + nombre: 'Código',
  212 + filtro: {
  213 + nombre: 'rellenarDigitos',
  214 + parametro: 3
  215 + }
  216 + },
  217 + {
  218 + propiedad: 'NomVen',
  219 + nombre: 'Nombre'
  220 + }
  221 + ],
  222 + size: 'md'
  223 + };
  224 + focaModalService.modal(parametrosModal).then(
  225 + function (vendedor) {
  226 +
  227 + indicarPassword(vendedor)
  228 + .then(function() {
  229 + validarPlanillaVendedor(vendedor)
  230 + .then(function() {
  231 +
  232 + $filter('filter')($scope.botonera, {
  233 + label: 'Vendedor'
  234 + })[0].checked = true;
  235 +
  236 + $scope.$broadcast('addCabecera', {
  237 + label: 'Vendedor:',
  238 + valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) +
  239 + ' - ' +
  240 + vendedor.NomVen
  241 + });
  242 +
  243 + $scope.factura.vendedor = vendedor;
  244 +
  245 + getProductosByPlanilla(vendedor.NplVen);
  246 + })
  247 + .catch($scope.seleccionarVendedor);
  248 + })
  249 + .catch(function(err) {
  250 + console.log(err)
  251 + });
  252 +
  253 + }, function () { }
  254 + );
  255 + };
  256 +
  257 + $scope.seleccionarMoneda = function () {
  258 +
  259 + var parametrosModal = {
  260 + titulo: 'Búsqueda de monedas',
  261 + query: '/moneda',
  262 + columnas: [
  263 + {
  264 + propiedad: 'DETALLE',
  265 + nombre: 'Nombre'
  266 + },
  267 + {
  268 + propiedad: 'SIMBOLO',
  269 + nombre: 'Símbolo'
  270 + }
  271 + ],
  272 + size: 'md'
  273 + };
  274 + focaModalService.modal(parametrosModal).then(
  275 + function (moneda) {
  276 +
  277 + if (moneda.ID !== 1) {
  278 + $scope.abrirModalCotizacion(moneda);
  279 + return;
  280 + }
  281 +
  282 + crearRemitoService.getCotizacionByIdMoneda(1)
  283 + .then(function (res) {
  284 +
  285 + cotizacionPArgentino = res.data[0].cotizaciones[0];
  286 + cotizacionPArgentino.moneda = moneda;
  287 +
  288 + actualizarCabeceraMoneda(cotizacionPArgentino);
  289 +
  290 + $scope.remito.cotizacion = cotizacionPArgentino;
  291 + });
  292 + }, function () {
  293 +
  294 + }
  295 + );
  296 + };
  297 +
  298 + $scope.abrirModalCotizacion = function (moneda) {
  299 + var modalInstance = $uibModal.open(
  300 + {
  301 + ariaLabelledBy: 'Busqueda de Cotización',
  302 + templateUrl: 'modal-cotizacion.html',
  303 + controller: 'focaModalCotizacionController',
  304 + size: 'lg',
  305 + resolve: { idMoneda: function () { return moneda.ID; } }
  306 + }
  307 + );
  308 + modalInstance.result.then(
  309 + function (cotizacion) {
  310 +
  311 + cotizacion.moneda = moneda;
  312 + actualizarCabeceraMoneda(cotizacion);
  313 + $scope.factura.cotizacion = cotizacion;
  314 +
  315 + }, function () {
  316 +
  317 + }
  318 + );
  319 + };
  320 +
  321 + $scope.seleccionarObservaciones = function () {
  322 + var observacion = {
  323 + titulo: 'Ingrese Observaciones',
  324 + value: $scope.factura.observaciones,
  325 + maxlength: 155,
  326 + textarea: true
  327 + };
  328 +
  329 + focaModalService
  330 + .prompt(observacion)
  331 + .then(function (observaciones) {
  332 + $scope.factura.observaciones = observaciones;
  333 + });
  334 + };
  335 +
  336 +
  337 + $scope.articulosFiltro = function () {
  338 + return $scope.factura.articulosFactura;
  339 + };
  340 +
  341 + $scope.getTotal = function () {
  342 +
  343 + var total = 0;
  344 +
  345 + $scope.articulosFiltro().forEach(function (articulo) {
  346 + total += articulo.PUN * articulo.CAN;
  347 + });
  348 +
  349 + return parseFloat(total.toFixed(2));
  350 + };
  351 +
  352 + function getProductosByPlanilla(numeroPlanilla) {
  353 +
  354 + crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) {
  355 +
  356 + res.data.forEach(function (producto) {
  357 +
  358 + $scope.botonera.push({
  359 + label: producto.DetArt,
  360 + image: 'productos.png'
  361 + });
  362 +
  363 +
  364 + crearFuncionesProductos(producto);
  365 +
  366 + });
  367 + });
  368 + }
  369 +
  370 + function crearFuncionesProductos(producto) {
  371 +
  372 + $scope[nombreFuncion(producto.DetArt)] = function() {
  373 +
  374 + if (angular.equals($scope.factura.cliente, {})) {
  375 + focaModalService.alert('Seleccione cliente');
  376 + return;
  377 + }
  378 +
  379 + var parametrosModal = {
  380 + titulo: 'Despachos ' + producto.DetArt,
  381 + data: producto.despachos,
  382 + columnas: [
  383 + {
  384 + propiedad: 'FEC',
  385 + nombre: 'Fecha',
  386 + filtro: {
  387 + nombre: 'date',
  388 + parametro: 'dd/MM/yyyy HH:mm'
  389 + }
  390 + },
  391 + {
  392 + propiedad: 'IMP',
  393 + nombre: 'Importe'
  394 + },
  395 + {
  396 + propiedad: 'LTS',
  397 + nombre: 'Litros'
  398 + }
  399 + ],
  400 + size: 'md'
  401 + };
  402 +
  403 + focaModalService.modal(parametrosModal).then(function(despacho) {
  404 +
  405 + var articulo = {
  406 + TIP: $scope.factura.cliente.tipoFactura,
  407 + TCO: 'FT',
  408 + SUC: parseInt($scope.puntoVenta),
  409 + ORD: $scope.articulosFiltro().length + 1,
  410 + SEC: despacho.SEC,
  411 + ART: despacho.PRO,
  412 + RUB: producto.CodRub,
  413 + DES: producto.DetArt,
  414 + CAN: despacho.LTS,
  415 + PUN: producto.PreVen, // TODO
  416 + IVA: producto.IMPIVA, // TODO
  417 + NET: 0, // TODO
  418 + NEX: 0, // TODO
  419 + IMI: producto.ImpInt, // TODO
  420 + IMI2: producto.ImpInt2, // TODO
  421 + IMI3: producto.ImpInt3, // TODO
  422 + PUT: producto.PreNet, // TODO
  423 + SUR: despacho.SUR,
  424 + PLA: despacho.PLA,
  425 + LUG: despacho.LUG,
  426 + LEG: $scope.factura.vendedor.CodVen,
  427 + TUR: $scope.factura.vendedor.TurVen,
  428 + ORDEN_PRECOMPRA: '',
  429 + ESC: producto.tipoFactura == 'L' ? 1 : 0,
  430 + CMF: 0,
  431 + PTA: 0,
  432 + IVS: 0,
  433 + TIVA: 0,
  434 + CON: 0,
  435 + SINO: '',
  436 + ORD_TRA: 0,
  437 + IMP_DESP: 0,
  438 + PCD: 0,
  439 + RTO: ''
  440 + };
  441 +
  442 + $scope.factura.articulosFactura.push(articulo);
  443 + })
  444 + .catch(function (err) {
  445 + console.log(err)
  446 + });
  447 +
  448 + };
  449 + }
  450 +
  451 + function nombreFuncion(string) {
  452 + var texto = 'seleccionar';
  453 + var arr = string.split(' ');
  454 + arr.forEach(function(palabra) {
  455 + palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1);
  456 + texto += palabra;
  457 + });
  458 + return texto;
  459 + }
  460 +
  461 + function indicarPassword(vendedor) {
  462 +
  463 + return new Promise(function(resolve, reject) {
  464 +
  465 + focaModalService
  466 + .prompt({
  467 + titulo: 'Indique Contraseña',
  468 + value: ''
  469 + })
  470 + .then(function (contraseña) {
  471 +
  472 + if (contraseña != vendedor.ClaVen.trim()) {
  473 +
  474 + focaModalService.alert('Clave incorrecta').then(function() {
  475 + indicarPassword(vendedor);
  476 + });
  477 + } else {
  478 + resolve();
  479 + }
  480 + })
  481 + .catch(reject);
  482 + });
  483 + }
  484 +
  485 + function validarPlanillaVendedor(vendedor) {
  486 +
  487 + return new Promise(function(resolve, reject) {
  488 +
  489 + crearFacturaService
  490 + .validarPlanillaVendedor(vendedor.CodVen.trim())
  491 + .then(function (res) {
  492 +
  493 + if (!res.data.length) {
  494 +
  495 + focaModalService
  496 + .alert('No se encontró planilla abierta para el vendedor')
  497 + .then(reject);
  498 +
  499 + } else {
  500 + resolve();
  501 + }
  502 +
  503 + })
  504 + .catch(reject);
  505 + });
  506 + }
  507 +
  508 + function rellenar(relleno, longitud) {
  509 + relleno = '' + relleno;
  510 + while (relleno.length < longitud) {
  511 + relleno = '0' + relleno;
  512 + }
  513 + return relleno;
  514 + }
  515 +
  516 + function salir() {
  517 + var confirmacion = false;
  518 +
  519 + if (!angular.equals($scope.factura, $scope.inicial)) {
  520 + confirmacion = true;
  521 + }
  522 +
  523 + if (confirmacion) {
  524 + focaModalService.confirm(
  525 + '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
  526 + ).then(function (data) {
  527 + if (data) {
  528 + $location.path('/');
  529 + }
  530 + });
  531 + } else {
  532 + $location.path('/');
  533 + }
  534 + }
  535 +
  536 + function setearFactura(factura) {
  537 +
  538 + $scope.$broadcast('cleanCabecera');
  539 +
  540 + $scope.cabeceras = [];
  541 +
  542 + if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
  543 + $scope.cabeceras.push({
  544 + label: 'Moneda:',
  545 + valor: factura.cotizacion.moneda.DETALLE
  546 + });
  547 + $scope.cabeceras.push({
  548 + label: 'Fecha cotizacion:',
  549 + valor: $filter('date')(factura.cotizacion.FECHA,
  550 + 'dd/MM/yyyy')
  551 + });
  552 + $scope.cabeceras.push({
  553 + label: 'Cotizacion:',
  554 + valor: $filter('number')(factura.cotizacion.VENDEDOR,
  555 + '2')
  556 + });
  557 + }
  558 +
  559 + if (factura.cotizacion && factura.cotizacion.moneda) {
  560 + $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true;
  561 + }
  562 +
  563 + if (factura.cliente && factura.cliente.cod) {
  564 + $scope.cabeceras.push({
  565 + label: 'Cliente:',
  566 + valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' +
  567 + factura.cliente.nom
  568 + });
  569 +
  570 + $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true;
  571 + }
  572 +
  573 + $scope.puntoVenta = rellenar(factura.sucursal, 4);
  574 + $scope.comprobante = rellenar(factura.numerofactura, 8);
  575 + $scope.factura = factura;
  576 +
  577 + addArrayCabecera($scope.cabeceras);
  578 + }
  579 +
  580 + function getLSFactura() {
  581 + var factura = JSON.parse($localStorage.factura || null);
  582 + if (factura) {
  583 + setearFactura(factura);
  584 + delete $localStorage.factura;
  585 + }
  586 + }
  587 +
  588 + function addArrayCabecera(array) {
  589 + for (var i = 0; i < array.length; i++) {
  590 + $scope.$broadcast('addCabecera', {
  591 + label: array[i].label,
  592 + valor: array[i].valor
  593 + });
  594 + }
  595 + }
  596 +
  597 + function actualizarCabeceraMoneda(cotizacion) {
  598 +
  599 + $scope.factura.articulosFactura.forEach(function (art) {
  600 + art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4);
  601 + art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4);
  602 + });
  603 +
  604 + if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') {
  605 + $scope.$broadcast('removeCabecera', 'Moneda:');
  606 + $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
  607 + $scope.$broadcast('removeCabecera', 'Cotizacion:');
  608 + } else {
  609 + $scope.$broadcast('addCabecera', {
  610 + label: 'Moneda:',
  611 + valor: cotizacion.moneda.DETALLE
  612 + });
  613 + $scope.$broadcast('addCabecera', {
  614 + label: 'Fecha cotizacion:',
  615 + valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
  616 + });
  617 + $scope.$broadcast('addCabecera', {
  618 + label: 'Cotizacion:',
  619 + valor: $filter('number')(cotizacion.VENDEDOR, '2')
  620 + });
  621 + }
  622 + }
  623 +
  624 + function validarGuardar() {
  625 +
  626 + if (angular.equals({}, $scope.factura.vendedor)) {
  627 +
  628 + focaModalService.alert('Seleccione Vendedor');
  629 + return false;
  630 + } else if (angular.equals({}, $scope.factura.cliente)) {
  631 +
  632 + focaModalService.alert('Seleccione Cliente')
  633 + return false;
  634 + } else if (!$scope.articulosFiltro().length) {
  635 +
  636 + focaModalService.alert('Seleccione al menos un Articulo');
  637 + return false;
  638 + }
  639 +
  640 + return true;
  641 + }
  642 + }
  643 +]);
... ... @@ -0,0 +1,7 @@
  1 +angular.module('focaCrearFactura')
  2 + .config(['$routeProvider', function($routeProvider) {
  3 + $routeProvider.when('/venta-factura/crear', {
  4 + controller: 'facturaController',
  5 + templateUrl: 'src/views/factura.html'
  6 + });
  7 + }]);
... ... @@ -0,0 +1,39 @@
  1 +angular.module('focaCrearFactura')
  2 + .service('crearFacturaService', ['$http', 'API_ENDPOINT',
  3 + function($http, API_ENDPOINT) {
  4 + var route = API_ENDPOINT.URL;
  5 + return {
  6 + guardarFactura: function (factura) {
  7 + return $http.post(route + '/factura/guardar', factura)
  8 + },
  9 + getParametros: function() {
  10 + return $http.get(API_ENDPOINT.URL + '/parametros/factura');
  11 + },
  12 + validarPlanillaVendedor: function(idVendedor) {
  13 + return $http.get(route + '/turnos/validar-planilla/' + idVendedor);
  14 + },
  15 + getProductosByPlanilla: function (numeroPlanilla) {
  16 + return $http.get(route + '/turnos/productos/' + numeroPlanilla);
  17 + },
  18 + getBotonera: function() {
  19 + return [
  20 + {
  21 + label: 'Vendedor',
  22 + image: 'vendedor.png'
  23 + },
  24 + {
  25 + label: 'Cliente',
  26 + image: 'cliente.png'
  27 + },
  28 + {
  29 + label: 'Moneda',
  30 + image: 'moneda.png'
  31 + },
  32 + {
  33 + label: 'Observaciones',
  34 + image: 'botonObservaciones.png'
  35 + }
  36 + ];
  37 + }
  38 + };
  39 + }]);
src/views/factura.html
... ... @@ -0,0 +1,172 @@
  1 +<div class="crear-nota-remito foca-crear row">
  2 + <foca-cabecera-facturador
  3 + titulo="'Factura'"
  4 + numero="puntoVenta + '-' + comprobante"
  5 + fecha="now"
  6 + class="mb-0 col-lg-12"
  7 + busqueda="seleccionarRemito"
  8 + ></foca-cabecera-facturador>
  9 + <marquee
  10 + bgcolor="#FF9900"
  11 + behavior="scroll"
  12 + direction="left"
  13 + ng-bind="factura.observaciones"
  14 + ></marquee>
  15 + <div class="col-lg-12">
  16 + <div class="row mt-4">
  17 + <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
  18 + <div class="row p-1 botonera-secundaria px-5 py-2">
  19 + <div class="col-12">
  20 + <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador>
  21 + </div>
  22 + </div>
  23 + <!-- PC -->
  24 + <div class="row grilla-articulo align-items-end d-none d-sm-flex">
  25 + <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
  26 + <thead>
  27 + <tr class="d-flex">
  28 + <th class="">#</th>
  29 + <th class="col">Código</th>
  30 + <th class="col-4">Descripción</th>
  31 + <th class="col text-right">Cantidad</th>
  32 + <th class="col text-right">Precio Unitario</th>
  33 + <th class="col text-right">SubTotal</th>
  34 + <th class="text-right">
  35 + <button
  36 + class="btn btn-outline-light selectable"
  37 + ng-click="show = !show; masMenos()"
  38 + >
  39 + <i
  40 + class="fa fa-chevron-down"
  41 + ng-show="show"
  42 + aria-hidden="true"
  43 + >
  44 + </i>
  45 + <i
  46 + class="fa fa-chevron-up"
  47 + ng-hide="show"
  48 + aria-hidden="true">
  49 + </i>
  50 + </button>
  51 + </th>
  52 + </tr>
  53 + </thead>
  54 + <tbody class="tabla-articulo-body">
  55 + <tr
  56 + ng-repeat="(key, articulo) in articulosFiltro()"
  57 + ng-show="show || key == (articulosFiltro().length - 1)"
  58 + class="d-flex"
  59 + >
  60 + <td ng-bind="key + 1"></td>
  61 + <td
  62 + class="col"
  63 + ng-bind="articulo.SEC + '-' + articulo.ART"
  64 + ></td>
  65 + <td
  66 + class="col-4"
  67 + ng-bind="articulo.DES"
  68 + ></td>
  69 + <td class="col text-right">
  70 + <input
  71 + ng-show="articulo.editCantidad"
  72 + ng-model="tmpCantidad"
  73 + class="form-control"
  74 + foca-tipo-input
  75 + min="1"
  76 + foca-focus="articulo.editCantidad"
  77 + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
  78 + esc-key="cancelarEditar(articulo)"
  79 + ng-focus="selectFocus($event); tmpCantidad = articulo.CAN; tmpPrecio = articulo.PUN"
  80 + teclado-virtual
  81 + >
  82 + <i
  83 + class="selectable"
  84 + ng-click="cambioEdit(articulo, 'cantidad')"
  85 + ng-hide="articulo.editCantidad"
  86 + ng-bind="articulo.CAN">
  87 + </i>
  88 + </td>
  89 + <td class="col text-right">
  90 + <input
  91 + ng-show="articulo.editPrecio"
  92 + ng-model="tmpPrecio"
  93 + class="form-control"
  94 + foca-tipo-input
  95 + min="1"
  96 + step="0.0001"
  97 + foca-focus="articulo.editPrecio"
  98 + ng-keypress="editarArticulo($event.keyCode, articulo, tmpCantidad, tmpPrecio);"
  99 + esc-key="cancelarEditar(articulo)"
  100 + ng-focus="selectFocus($event);
  101 + tmpCantidad = articulo.CAN;
  102 + tmpPrecio = articulo.PUN"
  103 + teclado-virtual
  104 + >
  105 + <i
  106 + class="selectable"
  107 + ng-click="cambioEdit(articulo, 'precio')"
  108 + ng-hide="articulo.editPrecio"
  109 + ng-bind="articulo.PUN | number: 4">
  110 + </i>
  111 + </td>
  112 + <td
  113 + class="col text-right"
  114 + ng-bind="(articulo.PUN * articulo.CAN) | number: 2">
  115 + </td>
  116 + <td class="text-center">
  117 + <button
  118 + class="btn btn-outline-light"
  119 + ng-click="quitarArticulo(articulo)"
  120 + >
  121 + <i class="fa fa-trash"></i>
  122 + </button>
  123 + <button
  124 + class="btn btn-outline-light"
  125 + ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);"
  126 + ng-show="articulo.editCantidad || articulo.editPrecio"
  127 + >
  128 + <i class="fa fa-save"></i>
  129 + </button>
  130 + </td>
  131 + </tr>
  132 + </tbody>
  133 + <tfoot>
  134 + <tr class="d-flex">
  135 + <td colspan="4" class="no-border-top">
  136 + <strong>Items:</strong>
  137 + <a ng-bind="articulosFiltro().length"></a>
  138 + </td>
  139 + <td class="text-right ml-auto table-celda-total no-border-top">
  140 + <h3>Total:</h3>
  141 + </td>
  142 + <td class="table-celda-total text-right no-border-top" colspan="1">
  143 + <h3>{{getTotal() | currency: factura.cotizacion.moneda.SIMBOLO}}</h3>
  144 + </td>
  145 + <td class="text-right no-border-top">
  146 + <button
  147 + type="button"
  148 + class="btn btn-sm"
  149 + >
  150 + Totales
  151 + </button>
  152 + </td>
  153 + </tr>
  154 + </tfoot>
  155 + </table>
  156 + </div>
  157 + </div>
  158 + </div>
  159 + </div>
  160 + <div class="row d-md-none fixed-bottom">
  161 + <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
  162 + <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
  163 + <span
  164 + class="mr-3 ml-auto"
  165 + ng-class="saveLoading ? 'text-muted' : ''"
  166 + ng-click="crearRemito()"
  167 + ladda="saveLoading"
  168 + data-style="expand-left"
  169 + >Guardar</span>
  170 + </div>
  171 + </div>
  172 +</div>