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