Commit 9ac989f257bb678c2243b9f7a1698de809436ae6

Authored by Eric Fernandez
0 parents
Exists in master

first commit

... ... @@ -0,0 +1,5 @@
  1 +/node_modules
  2 +/dist
  3 +package-lock\.json
  4 +/src/etc/develop.js
  5 +tmp/
... ... @@ -0,0 +1,64 @@
  1 +{
  2 + /*
  3 + * ENVIRONMENTS
  4 + * =================
  5 + */
  6 +
  7 + // Define globals exposed by modern browsers.
  8 + "browser": true,
  9 +
  10 + // Define globals exposed by jQuery.
  11 + "jquery": true,
  12 +
  13 + // Define globals exposed by Node.js.
  14 + "node": true,
  15 +
  16 + // Allow ES6.
  17 + "esversion": 6,
  18 +
  19 + /*
  20 + * ENFORCING OPTIONS
  21 + * =================
  22 + */
  23 +
  24 + // Force all variable names to use either camelCase style or UPPER_CASE
  25 + // with underscores.
  26 + "camelcase": true,
  27 +
  28 + // Prohibit use of == and != in favor of === and !==.
  29 + "eqeqeq": true,
  30 +
  31 + // Enforce tab width of 2 spaces.
  32 + "indent": 4,
  33 +
  34 + // Prohibit use of a variable before it is defined.
  35 + "latedef": false,
  36 +
  37 + // Enforce line length to 100 characters
  38 + "maxlen": 100,
  39 +
  40 + // Require capitalized names for constructor functions.
  41 + "newcap": true,
  42 +
  43 + // Enforce use of single quotation marks for strings.
  44 + "quotmark": "single",
  45 +
  46 + // Enforce placing 'use strict' at the top function scope
  47 + "strict": false,
  48 +
  49 + // Prohibit use of explicitly undeclared variables.
  50 + "undef": true,
  51 +
  52 + // Warn when variables are defined but never used.
  53 + "unused": true,
  54 +
  55 + // Para que funcione en angular
  56 + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"],
  57 + /*
  58 + * RELAXING OPTIONS
  59 + * =================
  60 + */
  61 +
  62 + // Suppress warnings about == null comparisons.
  63 + "eqnull": true
  64 +}
... ... @@ -0,0 +1 @@
  1 +foca-crear-cobranza
... ... @@ -0,0 +1,87 @@
  1 +const templateCache = require('gulp-angular-templatecache');
  2 +const clean = require('gulp-clean');
  3 +const concat = require('gulp-concat');
  4 +const htmlmin = require('gulp-htmlmin');
  5 +const rename = require('gulp-rename');
  6 +const uglify = require('gulp-uglify');
  7 +const gulp = require('gulp');
  8 +const pump = require('pump');
  9 +const jshint = require('gulp-jshint');
  10 +const replace = require('gulp-replace');
  11 +const connect = require('gulp-connect');
  12 +
  13 +var paths = {
  14 + srcJS: 'src/js/*.js',
  15 + srcViews: 'src/views/*.html',
  16 + tmp: 'tmp',
  17 + dist: 'dist/'
  18 +};
  19 +
  20 +gulp.task('templates', ['clean'], function() {
  21 + return pump(
  22 + [
  23 + gulp.src(paths.srcViews),
  24 + htmlmin(),
  25 + templateCache('views.js', {
  26 + module: 'focaCrearCobranza',
  27 + root: ''
  28 + }),
  29 + gulp.dest(paths.tmp)
  30 + ]
  31 + );
  32 +});
  33 +
  34 +gulp.task('uglify', ['templates'], function() {
  35 + return pump(
  36 + [
  37 + gulp.src([
  38 + paths.srcJS,
  39 + 'tmp/views.js'
  40 + ]),
  41 + concat('foca-crear-cobranza.js'),
  42 + replace('src/views/', ''),
  43 + gulp.dest(paths.tmp),
  44 + rename('foca-crear-cobranza.min.js'),
  45 + uglify(),
  46 + replace('"ngRoute","ui.bootstrap","focaModal","focaModalFactura","focaBusquedaCliente",'+
  47 + '"focaDirectivas","focaModalMoneda","focaModalCotizacion"', ''),
  48 + gulp.dest(paths.dist)
  49 + ]
  50 + );
  51 +});
  52 +
  53 +gulp.task('clean', function() {
  54 + return gulp.src(['tmp', 'dist'], {read: false})
  55 + .pipe(clean());
  56 +});
  57 +
  58 +gulp.task('pre-commit', function() {
  59 + return pump(
  60 + [
  61 + gulp.src(paths.srcJS),
  62 + jshint('.jshintrc'),
  63 + jshint.reporter('default'),
  64 + jshint.reporter('fail')
  65 + ]
  66 + );
  67 +
  68 + gulp.start('uglify');
  69 +});
  70 +
  71 +gulp.task('webserver', function() {
  72 + pump [
  73 + connect.server({port: 3300, host: '0.0.0.0'})
  74 + ]
  75 +});
  76 +
  77 +gulp.task('clean-post-install', function() {
  78 + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
  79 + 'index.html'], {read: false})
  80 + .pipe(clean());
  81 +});
  82 +
  83 +gulp.task('default', ['webserver']);
  84 +
  85 +gulp.task('watch', function() {
  86 + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
  87 +});
... ... @@ -0,0 +1,38 @@
  1 +<html ng-app="focaCrearCobranza">
  2 + <head>
  3 + <meta charset="UTF-8"/>
  4 + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  5 +
  6 + <!--CSS-->
  7 + <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
  8 + <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
  9 + <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet">
  10 +
  11 + <!--VENDOR JS-->
  12 + <script src="node_modules/jquery/dist/jquery.min.js"></script>
  13 + <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
  14 + <script src="node_modules/angular/angular.min.js"></script>
  15 + <script src="node_modules/angular-route/angular-route.min.js"></script>
  16 + <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
  17 + <script src="node_modules/ladda/dist/spin.min.js"></script>
  18 + <script src="node_modules/ladda/dist/ladda.min.js"></script>
  19 + <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script>
  20 +
  21 + <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
  22 + <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script>
  23 + <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
  24 + <script src="node_modules/foca-modal-factura/dist/foca-modal-factura.min.js"></script>
  25 + <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script>
  26 +
  27 + <script src="src/js/app.js"></script>
  28 + <script src="src/js/controller.js"></script>
  29 + <script src="src/js/service.js"></script>
  30 + <script src="src/js/businessService.js"></script>
  31 + <script src="src/js/route.js"></script>
  32 +
  33 + <script src="src/etc/develop.js"></script>
  34 + </head>
  35 + <body>
  36 + <div ng-view class="container-fluid"></div>
  37 + </body>
  38 +</html>
... ... @@ -0,0 +1,52 @@
  1 +{
  2 + "name": "foca-crear-cobranza",
  3 + "version": "0.0.1",
  4 + "description": "sistema de cobranzas a partir de facturas",
  5 + "main": "index.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1",
  8 + "compile": "gulp uglify",
  9 + "gulp-pre-commit": "gulp pre-commit",
  10 + "postinstall": "npm run compile && gulp clean-post-install",
  11 + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-factura.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-directivas.git"
  12 + },
  13 + "pre-commit": [
  14 + "gulp-pre-commit"
  15 + ],
  16 + "repository": {
  17 + "type": "git",
  18 + "url": "http://git.focasoftware.com/npm/foca-crear-cobranza.git"
  19 + },
  20 + "author": "Foca Software",
  21 + "license": "ISC",
  22 + "devDependencies": {
  23 + "angular": "^1.7.5",
  24 + "angular-ladda": "^0.4.3",
  25 + "angular-route": "^1.7.5",
  26 + "bootstrap": "^4.1.3",
  27 + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git",
  28 + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  29 + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git",
  30 + "foca-modal-factura": "git+http://git.focasoftware.com/npm/foca-modal-factura.git",
  31 + "font-awesome": "^4.7.0",
  32 + "gulp": "^3.9.1",
  33 + "gulp-angular-templatecache": "^2.2.5",
  34 + "gulp-clean": "^0.4.0",
  35 + "gulp-concat": "^2.6.1",
  36 + "gulp-connect": "^5.6.1",
  37 + "gulp-htmlmin": "^5.0.1",
  38 + "gulp-jshint": "^2.1.0",
  39 + "gulp-rename": "^1.4.0",
  40 + "gulp-replace": "^1.0.0",
  41 + "gulp-sequence": "^1.0.0",
  42 + "gulp-uglify": "^3.0.1",
  43 + "gulp-uglify-es": "^1.0.4",
  44 + "jasmine-core": "^3.3.0",
  45 + "jquery": "^3.3.1",
  46 + "jshint": "^2.9.6",
  47 + "ladda": "1.0.6",
  48 + "pre-commit": "^1.2.2",
  49 + "pump": "^3.0.0",
  50 + "ui-bootstrap4": "^3.0.5"
  51 + }
  52 +}
src/etc/develop.js.ejemplo
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaCrearCobranza')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
... ... @@ -0,0 +1,10 @@
  1 +angular.module('focaCrearCobranza', [
  2 + 'ngRoute',
  3 + 'ui.bootstrap',
  4 + 'focaModal',
  5 + 'focaModalFactura',
  6 + 'focaBusquedaCliente',
  7 + 'focaDirectivas',
  8 + 'focaModalMoneda',
  9 + 'focaModalCotizacion'
  10 +]);
src/js/controller.js
... ... @@ -0,0 +1,335 @@
  1 +angular.module('focaCrearCobranza') .controller('cobranzaController',
  2 + [
  3 + '$scope',
  4 + '$uibModal',
  5 + '$location',
  6 + '$filter',
  7 + 'focaCrearCobranzaService',
  8 + 'focaModalService',
  9 + function($scope, $uibModal, $location, $filter, focaCrearCobranzaService, focaModalService)
  10 + {
  11 + $scope.botonera = [
  12 + {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
  13 + {texto: 'Cobrador', accion: function() {$scope.seleccionarCobrador();}},
  14 + {texto: 'Deuda', accion: function() {$scope.swichDeuda();}},
  15 + {texto: 'Cobros', accion: function() {$scope.swichCobro();}},
  16 + {texto: 'Moneda', accion: function() {$scope.seleccionarMoneda();}},
  17 + {texto: '', accion: function() {}},
  18 + {texto: '', accion: function() {}},
  19 + {texto: '', accion: function() {}}
  20 + ];
  21 + $scope.datepickerAbierto = false;
  22 + $scope.cobroDeuda = true;
  23 + $scope.show = false;
  24 + $scope.cargando = true;
  25 + $scope.dateOptions = {
  26 + maxDate: new Date(),
  27 + minDate: new Date(2010, 0, 1)
  28 + };
  29 +
  30 + $scope.cobranza = {
  31 + fecha: new Date()
  32 + };
  33 +
  34 + $scope.cabecera = [];
  35 + $scope.showCabecera = true;
  36 +
  37 + $scope.now = new Date();
  38 + $scope.puntoVenta = '0000';
  39 + $scope.comprobante = '00000000';
  40 + $scope.facturaTabla = [];
  41 + $scope.cobrosTabla = [];
  42 +
  43 + var monedaPorDefecto;
  44 + //Trabajo con la cotizaciรณn mรกs reciente, por eso uso siempre la primera '[0]'
  45 + focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) {
  46 + monedaPorDefecto = res.data[0];
  47 + addCabecera('Moneda:', monedaPorDefecto.DETALLE);
  48 + addCabecera('Fecha cotizacion:',
  49 + new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString());
  50 + addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR);
  51 + $scope.cobranza.moneda = monedaPorDefecto;
  52 + $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0];
  53 + });
  54 +
  55 + focaCrearCobranzaService.getNumeroRecibo().then(
  56 + function(res) {
  57 + $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4);
  58 + $scope.comprobante = $scope.rellenar(res.data.numeroRecibo, 8);
  59 + },
  60 + function(err) {
  61 + focaModalService.alert('La terminal no esta configurada correctamente');
  62 + console.info(err);
  63 + }
  64 + );
  65 + $scope.crearCobranza = function() {
  66 + if(!$scope.cliente.COD) {
  67 + focaModalService.alert('Ingrese Cliente');
  68 + return;
  69 + }else if($scope.facturaTabla.length < 1) {
  70 + focaModalService.alert('Ingrese al menos una factura');
  71 + return;
  72 + }
  73 + //TODO: Guarda cobranza
  74 + // var date = new Date();
  75 + // var cobranza = {
  76 + // };
  77 + };
  78 +
  79 + $scope.swichCobro = function() {
  80 + $scope.cobroDeuda = false;
  81 + };
  82 +
  83 + $scope.swichDeuda = function() {
  84 + $scope.cobroDeuda = true;
  85 + };
  86 +
  87 + $scope.seleccionarCliente = function() {
  88 +
  89 + var modalInstance = $uibModal.open(
  90 + {
  91 + ariaLabelledBy: 'Busqueda de Cliente',
  92 + templateUrl: 'foca-busqueda-cliente-modal.html',
  93 + controller: 'focaBusquedaClienteModalController',
  94 + size: 'lg'
  95 + }
  96 + );
  97 + modalInstance.result.then(
  98 + function(cliente) {
  99 + addCabecera('Cliente:', cliente.nom);
  100 + $scope.cobranza.cliente = {
  101 + COD: cliente.cod,
  102 + CUIT: cliente.cuit,
  103 + NOM: cliente.nom
  104 + };
  105 + }, function() {
  106 +
  107 + }
  108 + );
  109 + };
  110 +
  111 + $scope.seleccionarFactura = function() {
  112 + if(!$scope.cobranza.cliente) {
  113 + focaModalService.alert('Seleccione primero un cliente');
  114 + return;
  115 + }
  116 + var modalInstance = $uibModal.open(
  117 + {
  118 + ariaLabelledBy: 'Busqueda de Facturas',
  119 + templateUrl: 'foca-modal-factura.html',
  120 + controller: 'focaModalFacturaController',
  121 + size: 'lg',
  122 + resolve: {
  123 + cliente: function() {return $scope.cobranza.cliente.COD;}
  124 + }
  125 + }
  126 + );
  127 + modalInstance.result.then(
  128 + function(facturas) {
  129 + $scope.facturaTabla = $scope.facturaTabla.concat(facturas);
  130 + }, function() {
  131 +
  132 + }
  133 + );
  134 + };
  135 +
  136 + $scope.seleccionarCheque = function() {
  137 + var modalInstance = $uibModal.open(
  138 + {
  139 + ariaLabelledBy: 'Carga de cheques',
  140 + templateUrl: 'modal-cheque.html',
  141 + controller: 'focaModalChequeController',
  142 + size: 'lg'
  143 + }
  144 + );
  145 + modalInstance.result.then(
  146 + function(cheque) {
  147 + var cobro = {
  148 + tipo: 'Cheque',
  149 + fecha: cheque.fechaValor,
  150 + importe: cheque.importe
  151 + };
  152 + $scope.cobrosTabla.push(cobro);
  153 + }, function() {
  154 +
  155 + }
  156 + );
  157 + };
  158 +
  159 + $scope.seleccionarEfectivo = function() {
  160 + var modalInstance = $uibModal.open(
  161 + {
  162 + ariaLabelledBy: 'Carga de cheques',
  163 + templateUrl: 'modal-efectivo.html',
  164 + controller: 'focaModalEfectivoController',
  165 + size: 'sm'
  166 + }
  167 + );
  168 + modalInstance.result.then(
  169 + function(efectivo) {
  170 + var cobro = {
  171 + tipo: 'Efectivo',
  172 + fecha: new Date(),
  173 + importe: efectivo
  174 + };
  175 + $scope.cobrosTabla.push(cobro);
  176 + }, function() {
  177 +
  178 + }
  179 + );
  180 + };
  181 +
  182 + $scope.seleccionarMoneda = function() {
  183 + var modalInstance = $uibModal.open(
  184 + {
  185 + ariaLabelledBy: 'Busqueda de Moneda',
  186 + templateUrl: 'modal-moneda.html',
  187 + controller: 'focaModalMonedaController',
  188 + size: 'lg'
  189 + }
  190 + );
  191 + modalInstance.result.then(
  192 + function(moneda) {
  193 + $scope.seleccionarCotizacion(moneda);
  194 + }, function() {
  195 +
  196 + }
  197 + );
  198 + };
  199 +
  200 + $scope.seleccionarCobrador = function() {
  201 + var modalInstance = $uibModal.open(
  202 + {
  203 + ariaLabelledBy: 'Busqueda de Cobradores',
  204 + templateUrl: 'modal-cobradores.html',
  205 + controller: 'focaModalCobradoresController',
  206 + size: 'lg'
  207 + }
  208 + );
  209 + modalInstance.result.then(
  210 + function(cobrador) {
  211 + addCabecera('Cobrador:', cobrador.nombre);
  212 + $scope.cobranza.cobrador = cobrador;
  213 + }, function() {
  214 +
  215 + }
  216 + );
  217 + };
  218 +
  219 + $scope.seleccionarCotizacion = function(moneda) {
  220 + var modalInstance = $uibModal.open(
  221 + {
  222 + ariaLabelledBy: 'Busqueda de Cotizaciรณn',
  223 + templateUrl: 'modal-cotizacion.html',
  224 + controller: 'focaModalCotizacionController',
  225 + size: 'lg',
  226 + resolve: {idMoneda: function() {return moneda.ID;}}
  227 + }
  228 + );
  229 + modalInstance.result.then(
  230 + function(cotizacion) {
  231 + $scope.cobranza.moneda = moneda;
  232 + $scope.cobranza.cotizacion = cotizacion;
  233 + addCabecera('Moneda:', moneda.DETALLE);
  234 + addCabecera(
  235 + 'Fecha cotizacion:',
  236 + $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
  237 + );
  238 + addCabecera('Cotizacion:', cotizacion.VENDEDOR);
  239 + }, function() {
  240 +
  241 + }
  242 + );
  243 + };
  244 +
  245 + $scope.agregarCobro = function(key) {
  246 + if(key === 13) {
  247 + var cobro = {
  248 + cobro: 'Efectivo',
  249 + fecha: new Date(),
  250 + importe: $scope.cobroEfectivo
  251 + };
  252 + $scope.cobrosTabla.push(cobro);
  253 + }
  254 + };
  255 +
  256 + $scope.getTotalDeuda = function() {
  257 + var total = 0;
  258 + for (var i = 0; i < $scope.facturaTabla.length; i++) {
  259 + total += $scope.facturaTabla[i].IPA;
  260 + }
  261 + return parseFloat(total.toFixed(2));
  262 + };
  263 +
  264 + $scope.getTotalCobrado = function() {
  265 + var total = 0;
  266 + for (var i = 0; i < $scope.cobrosTabla.length; i++) {
  267 + total += $scope.cobrosTabla[i].importe;
  268 + }
  269 + return parseFloat(total.toFixed(2));
  270 + };
  271 +
  272 + $scope.getSubTotal = function() {
  273 + if($scope.articuloACargar) {
  274 + return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
  275 + }
  276 + };
  277 + //Recibe aviso si el teclado estรก en uso
  278 + // $rootScope.$on('usarTeclado', function(event, data) {
  279 + // if(data) {
  280 + // $scope.mostrarTeclado = true;
  281 + // return;
  282 + // }
  283 + // $scope.mostrarTeclado = false;
  284 + // })
  285 + $scope.selectFocus = function($event) {
  286 + //Si el teclado esta en uso no selecciona el valor
  287 + // if($scope.mostrarTeclado) {
  288 + // return;
  289 + // }
  290 + $event.target.select();
  291 + };
  292 +
  293 + $scope.salir = function() {
  294 + $location.path('/');
  295 + };
  296 +
  297 + $scope.parsearATexto = function(articulo) {
  298 + articulo.cantidad = parseFloat(articulo.cantidad);
  299 + articulo.precio = parseFloat(articulo.precio);
  300 + };
  301 +
  302 + $scope.rellenar = function(relleno, longitud) {
  303 + relleno = '' + relleno;
  304 + while (relleno.length < longitud) {
  305 + relleno = '0' + relleno;
  306 + }
  307 +
  308 + return relleno;
  309 + };
  310 +
  311 + $scope.quitarFactura = function(key) {
  312 + $scope.facturaTabla.splice(key, 1);
  313 + };
  314 +
  315 + $scope.quitarCobro = function(key) {
  316 + $scope.cobrosTabla.splice(key, 1);
  317 + };
  318 +
  319 + function addCabecera(label, valor) {
  320 + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
  321 + if(propiedad.length === 1) {
  322 + propiedad[0].valor = valor;
  323 + } else {
  324 + $scope.cabecera.push({label: label, valor: valor});
  325 + }
  326 + }
  327 + // TODO: descomentar cuando se use
  328 + /*function removeCabecera(label) {
  329 + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
  330 + if(propiedad.length === 1){
  331 + $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
  332 + }
  333 + }*/
  334 + }
  335 + ]);
... ... @@ -0,0 +1,7 @@
  1 +angular.module('focaCrearCobranza')
  2 + .config(['$routeProvider', function($routeProvider) {
  3 + $routeProvider.when('/cobranza/crear', {
  4 + controller: 'cobranzaController',
  5 + templateUrl: 'src/views/cobranza.html'
  6 + });
  7 + }]);
... ... @@ -0,0 +1,11 @@
  1 +angular.module('focaCrearCobranza')
  2 + .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
  3 + return {
  4 + getNumeroRecibo: function() {
  5 + return $http.get(API_ENDPOINT.URL + '/cobranza/numero-siguiente');
  6 + },
  7 + getCotizacionByIdMoneda: function(id) {
  8 + return $http.get(API_ENDPOINT.URL + '/moneda/' + id);
  9 + }
  10 + };
  11 + }]);
src/views/cobranza.html
... ... @@ -0,0 +1,535 @@
  1 +<div class="crear-nota-pedido">
  2 + <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0">
  3 + <div class="row">
  4 + <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
  5 + <div class="row p-1 panel-informativo">
  6 + <div class="col-12">
  7 + <div class="row">
  8 + <div class="col-12 col-sm-4 nota-pedido">
  9 + <strong>Cobranza</strong>
  10 + </div>
  11 + <div class="col-5 col-sm-4 numero-pedido"
  12 + >Nยบ {{puntoVenta}}-{{comprobante}}
  13 + </div>
  14 + <div class="col-7 col-sm-4 text-right">
  15 + Fecha:
  16 + <span
  17 + ng-show="!datepickerAbierto"
  18 + ng-bind="now | date:'dd/MM/yyyy HH:mm'"
  19 + ng-click="datepickerAbierto = true"
  20 + >
  21 + </span>
  22 + <input
  23 + ng-show="datepickerAbierto"
  24 + type="date"
  25 + ng-model="now"
  26 + ng-change="datepickerAbierto = false"
  27 + ng-blur="datepickerAbierto = false"
  28 + class="form-control form-control-sm col-8 float-right"
  29 + foca-focus="datepickerAbierto"
  30 + hasta-hoy
  31 + />
  32 + </div>
  33 + </div>
  34 + <div class="row">
  35 + <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
  36 + <span class="label" ng-bind="cab.label"></span>
  37 + <span class="valor" ng-bind="cab.valor"></span>
  38 + </div>
  39 + <a
  40 + class="btn col-12 btn-secondary d-sm-none"
  41 + ng-show="cabecera.length > 0"
  42 + ng-click="showCabecera = !showCabecera"
  43 + >
  44 + <i
  45 + class="fa fa-chevron-down"
  46 + ng-hide="showCabecera"
  47 + aria-hidden="true"
  48 + >
  49 + </i>
  50 + <i
  51 + class="fa fa-chevron-up"
  52 + ng-show="showCabecera"
  53 + aria-hidden="true">
  54 + </i>
  55 + </a>
  56 + </div>
  57 + </div>
  58 + </div>
  59 + <div class="row p-1 botonera-secundaria">
  60 + <div class="col-12">
  61 + <div class="row">
  62 + <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
  63 + <button
  64 + type="button"
  65 + class="btn btn-default btn-block btn-xs text-left py-2"
  66 + ng-click="boton.accion()"
  67 + ng-class="{'d-none d-sm-block': boton.texto == ''}"
  68 + >
  69 + <i
  70 + class="fa fa-arrow-circle-right"
  71 + ng-show="boton.texto != ''"
  72 + ></i>
  73 + &nbsp;
  74 + {{boton.texto}}
  75 + </button>
  76 + </div>
  77 + </div>
  78 + </div>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + </form>
  83 + <div class="row">
  84 + <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
  85 + <!-- PC -->
  86 + <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda">
  87 + <table class="table tabla-articulo table-striped table-sm table-dark">
  88 + <thead>
  89 + <tr class="d-flex">
  90 + <th class="col-auto">#</th>
  91 + <th class="col">Factura</th>
  92 + <th class="col">Cliente</th>
  93 + <th class="col">Fecha</th>
  94 + <th class="col">Importe</th>
  95 + <th class="col-auto">
  96 + <button
  97 + class="btn btn-outline-secondary selectable"
  98 + ng-click="show = !show; masMenos()"
  99 + >
  100 + <i
  101 + class="fa fa-chevron-down"
  102 + ng-show="show"
  103 + aria-hidden="true"
  104 + >
  105 + </i>
  106 + <i
  107 + class="fa fa-chevron-up"
  108 + ng-hide="show"
  109 + aria-hidden="true">
  110 + </i>
  111 + </button>
  112 + </th>
  113 + </th>
  114 + </tr>
  115 + </thead>
  116 + <tbody class="tabla-articulo-body">
  117 + <tr
  118 + ng-repeat="(key, factura) in facturaTabla"
  119 + class="d-flex"
  120 + ng-show="show || key == facturaTabla.length - 1"
  121 + >
  122 + <td ng-bind="key + 1" class="col-auto"></td>
  123 + <td class="col"
  124 + ng-bind=
  125 + "(factura.TCO + '-' + factura.TIP + '-' +
  126 + factura.SUC + '-' + factura.NCO)"
  127 + ></td>
  128 + <td class="col" ng-bind="factura.cliente.NOM"></td>
  129 + <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td>
  130 + <td
  131 + class="col"
  132 + ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
  133 + currency: cobranza.moneda.SIMBOLO"></td>
  134 + <td class="text-center col-auto">
  135 + <button
  136 + class="btn btn-outline-secondary"
  137 + ng-click="quitarFactura(key)"
  138 + >
  139 + <i class="fa fa-trash"></i>
  140 + </button>
  141 + </td>
  142 + </tr>
  143 + </tbody>
  144 + <tfoot>
  145 + <tr ng-show="cargando" class="d-flex">
  146 + <td class="col-2">
  147 + <a
  148 + class="form-control form-control-sm btn btn-secondary"
  149 + ng-click="seleccionarFactura()"
  150 + >Factura</a>
  151 + </td>
  152 + </tr>
  153 + <tr class="d-flex">
  154 + <td class="col-auto px-1">
  155 + <strong>Comprobantes:</strong>
  156 + <a ng-bind="facturaTabla.length"></a>
  157 + </td>
  158 + <td class="text-right ml-auto table-celda-total no-border-top">
  159 + <strong>Total Deuda:</strong>
  160 + </td>
  161 + <td class="table-celda-total text-right no-border-top">
  162 + <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
  163 + currency: cobranza.moneda.SIMBOLO}}</strong>
  164 + </td>
  165 + <td class="text-right ml-auto table-celda-total no-border-top">
  166 + <strong>Total Cobrado:</strong>
  167 + </td>
  168 + <td class="table-celda-total text-right no-border-top">
  169 + <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
  170 + currency: cobranza.moneda.SIMBOLO}}</strong>
  171 + </td>
  172 + <td class="text-right ml-auto table-celda-total no-border-top">
  173 + <strong>DF:</strong>
  174 + </td>
  175 + <td class="table-celda-total text-right no-border-top">
  176 + <strong>{{((getTotalCobrado() - getTotalDeuda()) /
  177 + cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
  178 + </strong>
  179 + </td>
  180 + </tr>
  181 + </tfoot>
  182 + </table>
  183 + </div>
  184 + <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda">
  185 + <table class="table tabla-articulo table-striped table-sm table-dark">
  186 + <thead>
  187 + <tr class="d-flex">
  188 + <th class="col-auto">#</th>
  189 + <th class="col">Cobro</th>
  190 + <th class="col">Fecha</th>
  191 + <th class="col">Importe</th>
  192 + <th class="col-auto">
  193 + <button
  194 + class="btn btn-outline-secondary selectable"
  195 + ng-click="show = !show; masMenos()"
  196 + >
  197 + <i
  198 + class="fa fa-chevron-down"
  199 + ng-show="show"
  200 + aria-hidden="true"
  201 + >
  202 + </i>
  203 + <i
  204 + class="fa fa-chevron-up"
  205 + ng-hide="show"
  206 + aria-hidden="true">
  207 + </i>
  208 + </button>
  209 + </th>
  210 + </th>
  211 + </tr>
  212 + </thead>
  213 + <tbody class="tabla-articulo-body">
  214 + <tr
  215 + ng-repeat="(key, cobro) in cobrosTabla"
  216 + class="d-flex"
  217 + ng-show="show || key == cobrosTabla.length - 1"
  218 + >
  219 + <td ng-bind="key + 1" class="col-auto"></td>
  220 + <td class="col" ng-bind="cobro.tipo"></td>
  221 + <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td>
  222 + <td
  223 + class="col"
  224 + ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
  225 + currency: cobranza.moneda.SIMBOLO"></td>
  226 + <td class="text-center col-auto">
  227 + <button
  228 + class="btn btn-outline-secondary"
  229 + ng-click="quitarCobro(key)"
  230 + >
  231 + <i class="fa fa-trash"></i>
  232 + </button>
  233 + </td>
  234 + </tr>
  235 + </tbody>
  236 + <tfoot>
  237 + <tr ng-show="cargando" class="d-flex">
  238 + <td class="col-2">
  239 + <a
  240 + class="form-control form-control-sm btn btn-secondary"
  241 + ng-click="seleccionarCheque()"
  242 + >Cheque</a>
  243 + </td>
  244 + <td class="col-2">
  245 + <a
  246 + class="form-control form-control-sm btn btn-secondary"
  247 + ng-click="seleccionarEfectivo()"
  248 + >Efectivo</a>
  249 + </td>
  250 + </tr>
  251 + <tr class="d-flex">
  252 + <td class="col-auto px-1">
  253 + <strong>Cobros:</strong>
  254 + <a ng-bind="cobrosTabla.length"></a>
  255 + </td>
  256 + <td class="text-right ml-auto table-celda-total no-border-top">
  257 + <strong>Total Deuda:</strong>
  258 + </td>
  259 + <td class="table-celda-total text-right no-border-top">
  260 + <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
  261 + currency: cobranza.moneda.SIMBOLO}}</strong>
  262 + </td>
  263 + <td class="text-right ml-auto table-celda-total no-border-top">
  264 + <strong>Total Cobrado:</strong>
  265 + </td>
  266 + <td class="table-celda-total text-right no-border-top">
  267 + <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
  268 + currency: cobranza.moneda.SIMBOLO}}</strong>
  269 + </td>
  270 + <td class="text-right ml-auto table-celda-total no-border-top">
  271 + <strong>DF:</strong>
  272 + </td>
  273 + <td class="table-celda-total text-right no-border-top">
  274 + <strong>{{((getTotalCobrado() - getTotalDeuda()) /
  275 + cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
  276 + </strong>
  277 + </td>
  278 + </tr>
  279 + </tfoot>
  280 + </table>
  281 + </div>
  282 + <!-- MOBILE -->
  283 + <div class="row d-sm-none">
  284 + <table class="table table-sm table-striped table-dark" ng-show="cobroDeuda">
  285 + <thead>
  286 + <tr class="d-flex">
  287 + <th class="">#</th>
  288 + <th class="col px-0">
  289 + <div class="d-flex">
  290 + <div class="col-4 px-1">Factura</div>
  291 + <div class="col-4 px-1">Fecha</div>
  292 + <div class="col-4 px-1">Importe</div>
  293 + </div>
  294 + </th>
  295 + <th class="text-center tamaรฑo-boton">
  296 + &nbsp;
  297 + </th>
  298 + </tr>
  299 + </thead>
  300 + <tbody>
  301 + <tr
  302 + ng-repeat="(key, factura) in facturaTabla"
  303 + ng-show="show || key == facturaTabla.length - 1"
  304 + >
  305 + <td class="w-100 align-middle d-flex p-0">
  306 + <div class="align-middle p-1">
  307 + <span ng-bind="key+1" class="align-middle"></span>
  308 + </div>
  309 + <div class="col px-0">
  310 + <div class="d-flex">
  311 + <div class="col-4 px-1">
  312 + <span ng-bind=
  313 + "(factura.TCO + '-' + factura.TIP + '-' +
  314 + factura.SUC + '-' + factura.NCO)"
  315 + ></span>
  316 + </div>
  317 + <div class="col-4 px-1">
  318 + <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span>
  319 + </div>
  320 + <div class="col-4 px-1">
  321 + <span
  322 + ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
  323 + currency:cobranza.moneda.SIMBOLO"></span>
  324 + </div>
  325 + </div>
  326 + </div>
  327 + <div class="align-middle p-1">
  328 + <button
  329 + class="btn btn-outline-secondary"
  330 + ng-click="quitarFactura(key)"
  331 + >
  332 + <i class="fa fa-trash"></i>
  333 + </button>
  334 + </div>
  335 + </td>
  336 + </tr>
  337 + </tbody>
  338 + <tfoot>
  339 + <!-- SELECCIONAR PRODUCTO -->
  340 + <tr ng-show="cargando" class="d-flex">
  341 + <td class="col-12">
  342 + <input
  343 + placeholder="Seleccione Factura"
  344 + class="form-control form-control-sm"
  345 + readonly
  346 + ng-click="seleccionarFactura()"
  347 + />
  348 + </td>
  349 + </tr>
  350 + <!-- TOOGLE EXPANDIR -->
  351 + <tr>
  352 + <td class="col">
  353 + <button
  354 + class="btn btn-outline-secondary selectable w-100"
  355 + ng-click="show = !show; masMenos()"
  356 + ng-show="facturaTabla.length > 0"
  357 + >
  358 + <i
  359 + class="fa fa-chevron-down"
  360 + ng-hide="show"
  361 + aria-hidden="true"
  362 + >
  363 + </i>
  364 + <i
  365 + class="fa fa-chevron-up"
  366 + ng-show="show"
  367 + aria-hidden="true">
  368 + </i>
  369 + </button>
  370 + </td>
  371 + </tr>
  372 + <!-- FOOTER -->
  373 + <tr class="d-flex">
  374 + <td class="align-middle no-border-top" colspan="2">
  375 + <strong>Cantidad Items:</strong>
  376 + <a ng-bind="facturaTabla.length"></a>
  377 + </td>
  378 + </tr>
  379 + </tfoot>
  380 + </table>
  381 + <table class="table table-sm table-striped table-dark" ng-show="!cobroDeuda">
  382 + <thead>
  383 + <tr class="d-flex">
  384 + <th class="">#</th>
  385 + <th class="col px-0">
  386 + <div class="d-flex">
  387 + <div class="col-4 px-1">Cobro</div>
  388 + <div class="col-4 px-1">Fecha</div>
  389 + <div class="col-4 px-1">Importe</div>
  390 + </div>
  391 + </th>
  392 + <th class="text-center tamaรฑo-boton">
  393 + &nbsp;
  394 + </th>
  395 + </tr>
  396 + </thead>
  397 + <tbody>
  398 + <tr
  399 + ng-repeat="(key, cobro) in cobrosTabla"
  400 + ng-show="show || key == cobrosTabla.length - 1"
  401 + >
  402 + <td class="w-100 align-middle d-flex p-0">
  403 + <div class="align-middle p-1">
  404 + <span ng-bind="key+1" class="align-middle"></span>
  405 + </div>
  406 + <div class="col px-0">
  407 + <div class="d-flex">
  408 + <div class="col-4 px-1">
  409 + <span ng-bind="cobro.tipo"
  410 + ></span>
  411 + </div>
  412 + <div class="col-4 px-1">
  413 + <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span>
  414 + </div>
  415 + <div class="col-4 px-1">
  416 + <span
  417 + ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
  418 + currency: cobranza.moneda.SIMBOLO"></span>
  419 + </div>
  420 + </div>
  421 + </div>
  422 + <div class="align-middle p-1">
  423 + <button
  424 + class="btn btn-outline-secondary"
  425 + ng-click="quitarCobro(key)"
  426 + >
  427 + <i class="fa fa-trash"></i>
  428 + </button>
  429 + </div>
  430 + </td>
  431 + </tr>
  432 + </tbody>
  433 + <tfoot>
  434 + <!-- SELECCIONAR PRODUCTO -->
  435 + <tr ng-show="cargando" class="d-flex">
  436 + <td class="col-6">
  437 + <input
  438 + placeholder="Cheque"
  439 + class="form-control form-control-sm"
  440 + readonly
  441 + ng-click="seleccionarCheque()"
  442 + />
  443 + </td>
  444 + <td class="col-6">
  445 + <input
  446 + placeholder="Efectivo"
  447 + class="form-control form-control-sm"
  448 + readonly
  449 + ng-click="seleccionarEfectivo()"
  450 + />
  451 + </td>
  452 + </tr>
  453 + <!-- TOOGLE EXPANDIR -->
  454 + <tr>
  455 + <td class="col">
  456 + <button
  457 + class="btn btn-outline-secondary selectable w-100"
  458 + ng-click="show = !show; masMenos()"
  459 + ng-show="cobrosTabla.length > 0"
  460 + >
  461 + <i
  462 + class="fa fa-chevron-down"
  463 + ng-hide="show"
  464 + aria-hidden="true"
  465 + >
  466 + </i>
  467 + <i
  468 + class="fa fa-chevron-up"
  469 + ng-show="show"
  470 + aria-hidden="true">
  471 + </i>
  472 + </button>
  473 + </td>
  474 + </tr>
  475 + <!-- FOOTER -->
  476 + <tr class="d-flex">
  477 + <td class="align-middle no-border-top col-6">
  478 + <strong>Cantidad Items:</strong>
  479 + <a ng-bind="cobrosTabla.length"></a>
  480 + </td>
  481 + </tfoot>
  482 + </table>
  483 + </tr>
  484 + <table class="table-responsive">
  485 + <tr class="d-flex row">
  486 + <td class="text-center ml-auto table-celda-total no-border-top col-4">
  487 + <strong>Deuda:</strong>
  488 + </td>
  489 + <td class="text-center ml-auto table-celda-total no-border-top col-4">
  490 + <strong>Cobrado:</strong>
  491 + </td>
  492 + <td class="text-center ml-auto table-celda-total no-border-top col-4">
  493 + <strong>Diferencia:</strong>
  494 + </td>
  495 + <td class="table-celda-total text-center no-border-top col-4">
  496 + <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
  497 + </td>
  498 + <td class="table-celda-total text-center no-border-top col-4">
  499 + <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
  500 + </td>
  501 + <td class="table-celda-total text-center no-border-top col-4">
  502 + <strong>{{((getTotalCobrado() - getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
  503 + </td>
  504 + </tr>
  505 + </table>
  506 + </div>
  507 + </div>
  508 + <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block">
  509 + <div class="row align-items-end">
  510 + <div class="col-12">
  511 + <button
  512 + ng-click="crearHojaRuta()"
  513 + type="submit"
  514 + title="Crear nota pedido"
  515 + class="btn btn-default btn-block mb-2">
  516 + Guardar
  517 + </button>
  518 + <button
  519 + ng-click="salir()"
  520 + type="button"
  521 + title="Salir"
  522 + class="btn btn-default btn-block">
  523 + Salir
  524 + </button>
  525 + </div>
  526 + </div>
  527 + </div>
  528 + </div>
  529 + <div class="row d-md-none fixed-bottom">
  530 + <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
  531 + <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
  532 + <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span>
  533 + </div>
  534 + </div>
  535 +</div>