Commit 69d514eff12318cf1d888fe6035f88bb083c0ee8
1 parent
7170485c76
Exists in
master
agrego foca-botonera-lateral
Showing
3 changed files
with
13 additions
and
33 deletions
Show diff stats
src/js/app.js
| 1 | angular.module('focaCrearRemito', [ | 1 | angular.module('focaCrearRemito', [ |
| 2 | 'ngRoute', | 2 | 'ngRoute', |
| 3 | 'ui.bootstrap', | 3 | 'ui.bootstrap', |
| 4 | 'focaModalVendedores', | 4 | 'focaModalVendedores', |
| 5 | 'focaBusquedaProductos', | 5 | 'focaBusquedaProductos', |
| 6 | 'focaModalProveedor', | 6 | 'focaModalProveedor', |
| 7 | 'focaBusquedaCliente', | 7 | 'focaBusquedaCliente', |
| 8 | 'focaModalPrecioCondicion', | 8 | 'focaModalPrecioCondicion', |
| 9 | 'focaModalFlete', | 9 | 'focaModalFlete', |
| 10 | 'focaDirectivas', | 10 | 'focaDirectivas', |
| 11 | 'focaModal', | 11 | 'focaModal', |
| 12 | 'focaModalDomicilio', | 12 | 'focaModalDomicilio', |
| 13 | 'focaModalMoneda', | 13 | 'focaModalMoneda', |
| 14 | 'focaModalCotizacion', | 14 | 'focaModalCotizacion', |
| 15 | 'focaConfiguracion', | 15 | 'focaConfiguracion', |
| 16 | 'angular-ladda', | 16 | 'angular-ladda', |
| 17 | 'focaModalNotaPedido' | 17 | 'focaModalNotaPedido', |
| 18 | 'focaBotoneraLateral' | ||
| 18 | ]); | 19 | ]); |
| 19 | 20 |
src/js/controller.js
| 1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', |
| 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', |
| 5 | function( | 5 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, |
| 7 | remitoBusinessService, $rootScope) | 7 | remitoBusinessService, $rootScope, focaBotoneraLateralService) |
| 8 | { | 8 | { |
| 9 | $scope.botonera = crearRemitoService.getBotonera(); | 9 | $scope.botonera = crearRemitoService.getBotonera(); |
| 10 | $scope.isNumber = angular.isNumber; | 10 | $scope.isNumber = angular.isNumber; |
| 11 | $scope.datepickerAbierto = false; | 11 | $scope.datepickerAbierto = false; |
| 12 | $scope.show = false; | 12 | $scope.show = false; |
| 13 | $scope.cargando = true; | 13 | $scope.cargando = true; |
| 14 | $scope.dateOptions = { | 14 | $scope.dateOptions = { |
| 15 | maxDate: new Date(), | 15 | maxDate: new Date(), |
| 16 | minDate: new Date(2010, 0, 1) | 16 | minDate: new Date(2010, 0, 1) |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | $scope.remito = { | 19 | $scope.remito = { |
| 20 | id: 0, | 20 | id: 0, |
| 21 | estado: 0, | 21 | estado: 0, |
| 22 | vendedor: {}, | 22 | vendedor: {}, |
| 23 | cliente: {}, | 23 | cliente: {}, |
| 24 | proveedor: {}, | 24 | proveedor: {}, |
| 25 | domicilio: {dom: ''}, | 25 | domicilio: {dom: ''}, |
| 26 | moneda: {}, | 26 | moneda: {}, |
| 27 | cotizacion: {} | 27 | cotizacion: {} |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | $scope.notaPedido = { | 30 | $scope.notaPedido = { |
| 31 | id: 0 | 31 | id: 0 |
| 32 | }; | 32 | }; |
| 33 | var monedaPorDefecto; | 33 | var monedaPorDefecto; |
| 34 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 34 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 35 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 35 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
| 36 | monedaPorDefecto = res.data[0]; | 36 | monedaPorDefecto = res.data[0]; |
| 37 | $scope.remito.moneda = monedaPorDefecto; | 37 | $scope.remito.moneda = monedaPorDefecto; |
| 38 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | 38 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; |
| 39 | }); | 39 | }); |
| 40 | 40 | ||
| 41 | $scope.cabecera = []; | 41 | $scope.cabecera = []; |
| 42 | $scope.showCabecera = true; | 42 | $scope.showCabecera = true; |
| 43 | 43 | ||
| 44 | $scope.now = new Date(); | 44 | $scope.now = new Date(); |
| 45 | $scope.puntoVenta = rellenar(0, 4); | 45 | $scope.puntoVenta = rellenar(0, 4); |
| 46 | $scope.comprobante = rellenar(0, 8); | 46 | $scope.comprobante = rellenar(0, 8); |
| 47 | 47 | ||
| 48 | $scope.articulosTabla = []; | 48 | $scope.articulosTabla = []; |
| 49 | $scope.idLista = undefined; | 49 | $scope.idLista = undefined; |
| 50 | 50 | ||
| 51 | //SETEO BOTONERA LATERAL | ||
| 52 | $timeout(function() { | ||
| 53 | focaBotoneraLateralService.showSalir(true); | ||
| 54 | focaBotoneraLateralService.showPausar(true); | ||
| 55 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | ||
| 56 | }); | ||
| 57 | |||
| 51 | crearRemitoService.getPrecioCondicion().then( | 58 | crearRemitoService.getPrecioCondicion().then( |
| 52 | function(res) { | 59 | function(res) { |
| 53 | $scope.precioCondiciones = res.data; | 60 | $scope.precioCondiciones = res.data; |
| 54 | } | 61 | } |
| 55 | ); | 62 | ); |
| 56 | 63 | ||
| 57 | crearRemitoService.getNumeroRemito().then( | 64 | crearRemitoService.getNumeroRemito().then( |
| 58 | function(res) { | 65 | function(res) { |
| 59 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 66 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 60 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 67 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
| 61 | }, | 68 | }, |
| 62 | function(err) { | 69 | function(err) { |
| 63 | focaModalService.alert('La terminal no esta configurada correctamente'); | 70 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 64 | console.info(err); | 71 | console.info(err); |
| 65 | } | 72 | } |
| 66 | ); | 73 | ); |
| 67 | 74 | ||
| 68 | $scope.seleccionarNotaPedido = function() { | 75 | $scope.seleccionarNotaPedido = function() { |
| 69 | if(varlidarRemitoFacturado()) { | 76 | if(varlidarRemitoFacturado()) { |
| 70 | var modalInstance = $uibModal.open( | 77 | var modalInstance = $uibModal.open( |
| 71 | { | 78 | { |
| 72 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 79 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| 73 | templateUrl: 'foca-modal-nota-pedido.html', | 80 | templateUrl: 'foca-modal-nota-pedido.html', |
| 74 | controller: 'focaModalNotaPedidoController', | 81 | controller: 'focaModalNotaPedidoController', |
| 75 | size: 'lg', | 82 | size: 'lg', |
| 76 | resolve: { | 83 | resolve: { |
| 77 | usadoPor: function() { | 84 | usadoPor: function() { |
| 78 | return 'remito'; | 85 | return 'remito'; |
| 79 | } | 86 | } |
| 80 | } | 87 | } |
| 81 | } | 88 | } |
| 82 | ); | 89 | ); |
| 83 | modalInstance.result.then( | 90 | modalInstance.result.then( |
| 84 | function(notaPedido) { | 91 | function(notaPedido) { |
| 85 | //añado cabeceras | 92 | //añado cabeceras |
| 86 | $scope.notaPedido.id = notaPedido.id; | 93 | $scope.notaPedido.id = notaPedido.id; |
| 87 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 94 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 88 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 95 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 89 | var cabeceras = [ | 96 | var cabeceras = [ |
| 90 | { | 97 | { |
| 91 | label: 'Moneda:', | 98 | label: 'Moneda:', |
| 92 | valor: notaPedido.cotizacion.moneda.DETALLE | 99 | valor: notaPedido.cotizacion.moneda.DETALLE |
| 93 | }, | 100 | }, |
| 94 | { | 101 | { |
| 95 | label: 'Fecha cotizacion:', | 102 | label: 'Fecha cotizacion:', |
| 96 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 103 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
| 97 | 'dd/MM/yyyy') | 104 | 'dd/MM/yyyy') |
| 98 | }, | 105 | }, |
| 99 | { | 106 | { |
| 100 | label: 'Cotizacion:', | 107 | label: 'Cotizacion:', |
| 101 | valor: notaPedido.cotizacion.VENDEDOR | 108 | valor: notaPedido.cotizacion.VENDEDOR |
| 102 | }, | 109 | }, |
| 103 | { | 110 | { |
| 104 | label: 'Cliente:', | 111 | label: 'Cliente:', |
| 105 | valor: notaPedido.cliente.NOM | 112 | valor: notaPedido.cliente.NOM |
| 106 | }, | 113 | }, |
| 107 | { | 114 | { |
| 108 | label: 'Domicilio:', | 115 | label: 'Domicilio:', |
| 109 | valor: notaPedido.domicilioStamp | 116 | valor: notaPedido.domicilioStamp |
| 110 | }, | 117 | }, |
| 111 | { | 118 | { |
| 112 | label: 'Vendedor:', | 119 | label: 'Vendedor:', |
| 113 | valor: notaPedido.vendedor.NomVen | 120 | valor: notaPedido.vendedor.NomVen |
| 114 | }, | 121 | }, |
| 115 | { | 122 | { |
| 116 | label: 'Proveedor:', | 123 | label: 'Proveedor:', |
| 117 | valor: notaPedido.proveedor.NOM | 124 | valor: notaPedido.proveedor.NOM |
| 118 | }, | 125 | }, |
| 119 | { | 126 | { |
| 120 | label: 'Precio condicion:', | 127 | label: 'Precio condicion:', |
| 121 | valor: valorPrecioCondicion() + ' ' + | 128 | valor: valorPrecioCondicion() + ' ' + |
| 122 | remitoBusinessService | 129 | remitoBusinessService |
| 123 | .plazoToString(notaPedido.notaPedidoPlazo) | 130 | .plazoToString(notaPedido.notaPedidoPlazo) |
| 124 | }, | 131 | }, |
| 125 | { | 132 | { |
| 126 | label: 'Flete:', | 133 | label: 'Flete:', |
| 127 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 134 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
| 128 | notaPedido.flete === 1 ? 'Si' : 'No') | 135 | notaPedido.flete === 1 ? 'Si' : 'No') |
| 129 | } | 136 | } |
| 130 | ]; | 137 | ]; |
| 131 | 138 | ||
| 132 | function valorPrecioCondicion() { | 139 | function valorPrecioCondicion() { |
| 133 | if(notaPedido.idPrecioCondicion > 0) { | 140 | if(notaPedido.idPrecioCondicion > 0) { |
| 134 | return notaPedido.precioCondicion.nombre; | 141 | return notaPedido.precioCondicion.nombre; |
| 135 | }else { | 142 | }else { |
| 136 | return 'Ingreso Manual'; | 143 | return 'Ingreso Manual'; |
| 137 | } | 144 | } |
| 138 | } | 145 | } |
| 139 | 146 | ||
| 140 | if(notaPedido.flete === 1) { | 147 | if(notaPedido.flete === 1) { |
| 141 | var cabeceraBomba = { | 148 | var cabeceraBomba = { |
| 142 | label: 'Bomba:', | 149 | label: 'Bomba:', |
| 143 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 150 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
| 144 | }; | 151 | }; |
| 145 | if(notaPedido.kilometros) { | 152 | if(notaPedido.kilometros) { |
| 146 | var cabeceraKilometros = { | 153 | var cabeceraKilometros = { |
| 147 | label: 'Kilometros:', | 154 | label: 'Kilometros:', |
| 148 | valor: notaPedido.kilometros | 155 | valor: notaPedido.kilometros |
| 149 | }; | 156 | }; |
| 150 | cabeceras.push(cabeceraKilometros); | 157 | cabeceras.push(cabeceraKilometros); |
| 151 | } | 158 | } |
| 152 | cabeceras.push(cabeceraBomba); | 159 | cabeceras.push(cabeceraBomba); |
| 153 | } | 160 | } |
| 154 | 161 | ||
| 155 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 162 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
| 156 | notaPedido.articulosNotaPedido[i].id = 0; | 163 | notaPedido.articulosNotaPedido[i].id = 0; |
| 157 | } | 164 | } |
| 158 | 165 | ||
| 159 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 166 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
| 160 | remitoBusinessService.calcularArticulos($scope.articulosTabla, | 167 | remitoBusinessService.calcularArticulos($scope.articulosTabla, |
| 161 | notaPedido.cotizacion.VENDEDOR); | 168 | notaPedido.cotizacion.VENDEDOR); |
| 162 | 169 | ||
| 163 | if(notaPedido.idPrecioCondicion > 0) { | 170 | if(notaPedido.idPrecioCondicion > 0) { |
| 164 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 171 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
| 165 | }else { | 172 | }else { |
| 166 | $scope.idLista = -1; | 173 | $scope.idLista = -1; |
| 167 | } | 174 | } |
| 168 | 175 | ||
| 169 | delete notaPedido.id; | 176 | delete notaPedido.id; |
| 170 | $scope.remito = notaPedido; | 177 | $scope.remito = notaPedido; |
| 171 | $scope.remito.id = 0; | 178 | $scope.remito.id = 0; |
| 172 | $scope.remito.moneda = notaPedido.cotizacion.moneda; | 179 | $scope.remito.moneda = notaPedido.cotizacion.moneda; |
| 173 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 180 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
| 174 | addArrayCabecera(cabeceras); | 181 | addArrayCabecera(cabeceras); |
| 175 | 182 | ||
| 176 | }, function() { | 183 | }, function() { |
| 177 | // funcion ejecutada cuando se cancela el modal | 184 | // funcion ejecutada cuando se cancela el modal |
| 178 | } | 185 | } |
| 179 | ); | 186 | ); |
| 180 | } | 187 | } |
| 181 | }; | 188 | }; |
| 182 | 189 | ||
| 183 | $scope.seleccionarRemito = function() { | 190 | $scope.seleccionarRemito = function() { |
| 184 | var modalInstance = $uibModal.open( | 191 | var modalInstance = $uibModal.open( |
| 185 | { | 192 | { |
| 186 | ariaLabelledBy: 'Busqueda de Remito', | 193 | ariaLabelledBy: 'Busqueda de Remito', |
| 187 | templateUrl: 'foca-modal-remito.html', | 194 | templateUrl: 'foca-modal-remito.html', |
| 188 | controller: 'focaModalRemitoController', | 195 | controller: 'focaModalRemitoController', |
| 189 | size: 'lg', | 196 | size: 'lg', |
| 190 | resolve: {usadoPor: function() {return 'remito';}} | 197 | resolve: {usadoPor: function() {return 'remito';}} |
| 191 | } | 198 | } |
| 192 | ); | 199 | ); |
| 193 | modalInstance.result.then( | 200 | modalInstance.result.then( |
| 194 | function(remito) { | 201 | function(remito) { |
| 195 | //añado cabeceras | 202 | //añado cabeceras |
| 196 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 203 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
| 197 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 204 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
| 198 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 205 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 199 | var cabeceras = [ | 206 | var cabeceras = [ |
| 200 | { | 207 | { |
| 201 | label: 'Moneda:', | 208 | label: 'Moneda:', |
| 202 | valor: remito.cotizacion.moneda.DETALLE | 209 | valor: remito.cotizacion.moneda.DETALLE |
| 203 | }, | 210 | }, |
| 204 | { | 211 | { |
| 205 | label: 'Fecha cotizacion:', | 212 | label: 'Fecha cotizacion:', |
| 206 | valor: $filter('date')(remito.cotizacion.FECHA, | 213 | valor: $filter('date')(remito.cotizacion.FECHA, |
| 207 | 'dd/MM/yyyy') | 214 | 'dd/MM/yyyy') |
| 208 | }, | 215 | }, |
| 209 | { | 216 | { |
| 210 | label: 'Cotizacion:', | 217 | label: 'Cotizacion:', |
| 211 | valor: remito.cotizacion.VENDEDOR | 218 | valor: remito.cotizacion.VENDEDOR |
| 212 | }, | 219 | }, |
| 213 | { | 220 | { |
| 214 | label: 'Cliente:', | 221 | label: 'Cliente:', |
| 215 | valor: remito.cliente.NOM | 222 | valor: remito.cliente.NOM |
| 216 | }, | 223 | }, |
| 217 | { | 224 | { |
| 218 | label: 'Domicilio:', | 225 | label: 'Domicilio:', |
| 219 | valor: remito.domicilioStamp | 226 | valor: remito.domicilioStamp |
| 220 | }, | 227 | }, |
| 221 | { | 228 | { |
| 222 | label: 'Vendedor:', | 229 | label: 'Vendedor:', |
| 223 | valor: remito.vendedor.NomVen | 230 | valor: remito.vendedor.NomVen |
| 224 | }, | 231 | }, |
| 225 | { | 232 | { |
| 226 | label: 'Proveedor:', | 233 | label: 'Proveedor:', |
| 227 | valor: remito.proveedor.NOM | 234 | valor: remito.proveedor.NOM |
| 228 | }, | 235 | }, |
| 229 | { | 236 | { |
| 230 | label: 'Flete:', | 237 | label: 'Flete:', |
| 231 | valor: remito.fob === 1 ? 'FOB' : ( | 238 | valor: remito.fob === 1 ? 'FOB' : ( |
| 232 | remito.flete === 1 ? 'Si' : 'No') | 239 | remito.flete === 1 ? 'Si' : 'No') |
| 233 | }, | 240 | }, |
| 234 | { | 241 | { |
| 235 | label: 'Precio condicion:', | 242 | label: 'Precio condicion:', |
| 236 | valor: valorPrecioCondicion() + ' ' + | 243 | valor: valorPrecioCondicion() + ' ' + |
| 237 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 244 | remitoBusinessService.plazoToString(remito.remitoPlazo) |
| 238 | } | 245 | } |
| 239 | ]; | 246 | ]; |
| 240 | function valorPrecioCondicion() { | 247 | function valorPrecioCondicion() { |
| 241 | if(remito.idPrecioCondicion > 0) { | 248 | if(remito.idPrecioCondicion > 0) { |
| 242 | return remito.precioCondicion.nombre; | 249 | return remito.precioCondicion.nombre; |
| 243 | }else { | 250 | }else { |
| 244 | return 'Ingreso Manual'; | 251 | return 'Ingreso Manual'; |
| 245 | } | 252 | } |
| 246 | } | 253 | } |
| 247 | 254 | ||
| 248 | if(remito.flete === 1) { | 255 | if(remito.flete === 1) { |
| 249 | var cabeceraBomba = { | 256 | var cabeceraBomba = { |
| 250 | label: 'Bomba', | 257 | label: 'Bomba', |
| 251 | valor: remito.bomba === 1 ? 'Si' : 'No' | 258 | valor: remito.bomba === 1 ? 'Si' : 'No' |
| 252 | }; | 259 | }; |
| 253 | if(remito.kilometros) { | 260 | if(remito.kilometros) { |
| 254 | var cabeceraKilometros = { | 261 | var cabeceraKilometros = { |
| 255 | label: 'Kilometros', | 262 | label: 'Kilometros', |
| 256 | valor: remito.kilometros | 263 | valor: remito.kilometros |
| 257 | }; | 264 | }; |
| 258 | cabeceras.push(cabeceraKilometros); | 265 | cabeceras.push(cabeceraKilometros); |
| 259 | } | 266 | } |
| 260 | cabeceras.push(cabeceraBomba); | 267 | cabeceras.push(cabeceraBomba); |
| 261 | } | 268 | } |
| 262 | $scope.articulosTabla = remito.articulosRemito; | 269 | $scope.articulosTabla = remito.articulosRemito; |
| 263 | remitoBusinessService.calcularArticulos($scope.articulosTabla, | 270 | remitoBusinessService.calcularArticulos($scope.articulosTabla, |
| 264 | remito.cotizacion.VENDEDOR); | 271 | remito.cotizacion.VENDEDOR); |
| 265 | if(remito.idPrecioCondicion > 0) { | 272 | if(remito.idPrecioCondicion > 0) { |
| 266 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 273 | $scope.idLista = remito.precioCondicion.idListaPrecio; |
| 267 | }else { | 274 | }else { |
| 268 | $scope.idLista = -1; | 275 | $scope.idLista = -1; |
| 269 | } | 276 | } |
| 270 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 277 | $scope.puntoVenta = rellenar(remito.sucursal, 4); |
| 271 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 278 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
| 272 | $scope.remito = remito; | 279 | $scope.remito = remito; |
| 273 | $scope.remito.moneda = remito.cotizacion.moneda; | 280 | $scope.remito.moneda = remito.cotizacion.moneda; |
| 274 | $scope.plazosPagos = remito.remitoPlazo; | 281 | $scope.plazosPagos = remito.remitoPlazo; |
| 275 | addArrayCabecera(cabeceras); | 282 | addArrayCabecera(cabeceras); |
| 276 | }, function() { | 283 | }, function() { |
| 277 | // funcion ejecutada cuando se cancela el modal | 284 | // funcion ejecutada cuando se cancela el modal |
| 278 | } | 285 | } |
| 279 | ); | 286 | ); |
| 280 | }; | 287 | }; |
| 281 | 288 | ||
| 282 | //validacion por domicilio y por plazo pago | 289 | //validacion por domicilio y por plazo pago |
| 283 | $scope.crearRemito = function() { | 290 | $scope.crearRemito = function() { |
| 284 | if(!$scope.remito.vendedor) { | 291 | if(!$scope.remito.vendedor) { |
| 285 | focaModalService.alert('Ingrese Vendedor'); | 292 | focaModalService.alert('Ingrese Vendedor'); |
| 286 | return; | 293 | return; |
| 287 | }else if(!$scope.remito.cliente) { | 294 | }else if(!$scope.remito.cliente) { |
| 288 | focaModalService.alert('Ingrese Cliente'); | 295 | focaModalService.alert('Ingrese Cliente'); |
| 289 | return; | 296 | return; |
| 290 | }else if(!$scope.remito.proveedor) { | 297 | }else if(!$scope.remito.proveedor) { |
| 291 | focaModalService.alert('Ingrese Proveedor'); | 298 | focaModalService.alert('Ingrese Proveedor'); |
| 292 | return; | 299 | return; |
| 293 | }else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { | 300 | }else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { |
| 294 | focaModalService.alert('Ingrese Moneda'); | 301 | focaModalService.alert('Ingrese Moneda'); |
| 295 | return; | 302 | return; |
| 296 | }else if(!$scope.remito.cotizacion.ID) { | 303 | }else if(!$scope.remito.cotizacion.ID) { |
| 297 | focaModalService.alert('Ingrese Cotización'); | 304 | focaModalService.alert('Ingrese Cotización'); |
| 298 | return; | 305 | return; |
| 299 | }else if( | 306 | }else if( |
| 300 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 307 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
| 301 | { | 308 | { |
| 302 | focaModalService.alert('Ingrese Flete'); | 309 | focaModalService.alert('Ingrese Flete'); |
| 303 | return; | 310 | return; |
| 304 | }else if($scope.articulosTabla.length === 0) { | 311 | }else if($scope.articulosTabla.length === 0) { |
| 305 | focaModalService.alert('Debe cargar al menos un articulo'); | 312 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 306 | return; | 313 | return; |
| 307 | } | 314 | } |
| 308 | $scope.saveLoading = true; | 315 | $scope.saveLoading = true; |
| 309 | var save = { | 316 | var save = { |
| 310 | remito: { | 317 | remito: { |
| 311 | id: $scope.remito.id, | 318 | id: $scope.remito.id, |
| 312 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 319 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
| 313 | idCliente: $scope.remito.cliente.COD, | 320 | idCliente: $scope.remito.cliente.COD, |
| 314 | nombreCliente: $scope.remito.cliente.NOM, | 321 | nombreCliente: $scope.remito.cliente.NOM, |
| 315 | cuitCliente: $scope.remito.cliente.CUIT, | 322 | cuitCliente: $scope.remito.cliente.CUIT, |
| 316 | responsabilidadIvaCliente: 0,//TODO, | 323 | responsabilidadIvaCliente: 0,//TODO, |
| 317 | descuento: 0,//TODO, | 324 | descuento: 0,//TODO, |
| 318 | importeNeto: 0,//TODO | 325 | importeNeto: 0,//TODO |
| 319 | importeExento: 0,//TODO | 326 | importeExento: 0,//TODO |
| 320 | importeIva: 0,//TODO | 327 | importeIva: 0,//TODO |
| 321 | importeIvaServicios: 0,//TODO | 328 | importeIvaServicios: 0,//TODO |
| 322 | importeImpuestoInterno: 0,//TODO | 329 | importeImpuestoInterno: 0,//TODO |
| 323 | importeImpuestoInterno1: 0,//TODO | 330 | importeImpuestoInterno1: 0,//TODO |
| 324 | importeImpuestoInterno2: 0,//TODO | 331 | importeImpuestoInterno2: 0,//TODO |
| 325 | percepcion: 0,//TODO | 332 | percepcion: 0,//TODO |
| 326 | percepcionIva: 0,//TODO | 333 | percepcionIva: 0,//TODO |
| 327 | redondeo: 0,//TODO | 334 | redondeo: 0,//TODO |
| 328 | total: $scope.getTotal(), | 335 | total: $scope.getTotal(), |
| 329 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 336 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
| 330 | anulado: false, | 337 | anulado: false, |
| 331 | planilla: 0,//TODO | 338 | planilla: 0,//TODO |
| 332 | lugar: 0,//TODO | 339 | lugar: 0,//TODO |
| 333 | cuentaMadre: 0,// | 340 | cuentaMadre: 0,// |
| 334 | cuentaContable: 0,//TODO | 341 | cuentaContable: 0,//TODO |
| 335 | asiento: 0,//TODO | 342 | asiento: 0,//TODO |
| 336 | e_hd: '',//TODO | 343 | e_hd: '',//TODO |
| 337 | c_hd: '', | 344 | c_hd: '', |
| 338 | numeroLiquidoProducto: 0,//TODO | 345 | numeroLiquidoProducto: 0,//TODO |
| 339 | idVendedor: $scope.remito.idVendedor, | 346 | idVendedor: $scope.remito.idVendedor, |
| 340 | idProveedor: $scope.remito.idProveedor, | 347 | idProveedor: $scope.remito.idProveedor, |
| 341 | idDomicilio: 0,//TODO | 348 | idDomicilio: 0,//TODO |
| 342 | idCotizacion: $scope.remito.cotizacion.ID, | 349 | idCotizacion: $scope.remito.cotizacion.ID, |
| 343 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 350 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
| 344 | flete: $scope.remito.flete, | 351 | flete: $scope.remito.flete, |
| 345 | fob: $scope.remito.fob, | 352 | fob: $scope.remito.fob, |
| 346 | bomba: $scope.remito.bomba, | 353 | bomba: $scope.remito.bomba, |
| 347 | kilometros: $scope.remito.kilometros, | 354 | kilometros: $scope.remito.kilometros, |
| 348 | domicilioStamp: $scope.remito.domicilioStamp, | 355 | domicilioStamp: $scope.remito.domicilioStamp, |
| 349 | estado: 0,//TODO | 356 | estado: 0,//TODO |
| 350 | destinoVenta: 0,//TODO | 357 | destinoVenta: 0,//TODO |
| 351 | operacionTipo: 0//TODO | 358 | operacionTipo: 0//TODO |
| 352 | }, | 359 | }, |
| 353 | notaPedido: $scope.notaPedido | 360 | notaPedido: $scope.notaPedido |
| 354 | }; | 361 | }; |
| 355 | crearRemitoService.crearRemito(save).then( | 362 | crearRemitoService.crearRemito(save).then( |
| 356 | function(data) { | 363 | function(data) { |
| 357 | remitoBusinessService.addArticulos($scope.articulosTabla, | 364 | remitoBusinessService.addArticulos($scope.articulosTabla, |
| 358 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 365 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
| 359 | 366 | ||
| 360 | focaModalService.alert('Remito creado'); | 367 | focaModalService.alert('Remito creado'); |
| 361 | $scope.saveLoading = false; | 368 | $scope.saveLoading = false; |
| 362 | //TODO: updatear plazos | 369 | //TODO: updatear plazos |
| 363 | if($scope.remito.id === 0) { | 370 | if($scope.remito.id === 0) { |
| 364 | var plazos = $scope.plazosPagos; | 371 | var plazos = $scope.plazosPagos; |
| 365 | 372 | ||
| 366 | for(var j = 0; j < plazos.length; j++) { | 373 | for(var j = 0; j < plazos.length; j++) { |
| 367 | var json = { | 374 | var json = { |
| 368 | idRemito: data.data.id, | 375 | idRemito: data.data.id, |
| 369 | dias: plazos[j].dias | 376 | dias: plazos[j].dias |
| 370 | }; | 377 | }; |
| 371 | crearRemitoService.crearPlazosParaRemito(json); | 378 | crearRemitoService.crearPlazosParaRemito(json); |
| 372 | } | 379 | } |
| 373 | } | 380 | } |
| 374 | 381 | ||
| 375 | $scope.$broadcast('cleanCabecera'); | 382 | $scope.$broadcast('cleanCabecera'); |
| 376 | $scope.$broadcast('addCabecera',{ | 383 | $scope.$broadcast('addCabecera',{ |
| 377 | label: 'Moneda:', | 384 | label: 'Moneda:', |
| 378 | valor: $scope.remito.moneda.DETALLE | 385 | valor: $scope.remito.moneda.DETALLE |
| 379 | }); | 386 | }); |
| 380 | $scope.$broadcast('addCabecera',{ | 387 | $scope.$broadcast('addCabecera',{ |
| 381 | label: 'Fecha cotizacion:', | 388 | label: 'Fecha cotizacion:', |
| 382 | valor: $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 389 | valor: $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
| 383 | }); | 390 | }); |
| 384 | $scope.$broadcast('addCabecera',{ | 391 | $scope.$broadcast('addCabecera',{ |
| 385 | label: 'Cotizacion:', | 392 | label: 'Cotizacion:', |
| 386 | valor: $scope.remito.cotizacion.COTIZACION | 393 | valor: $scope.remito.cotizacion.COTIZACION |
| 387 | }); | 394 | }); |
| 388 | $scope.remito.vendedor = {}; | 395 | $scope.remito.vendedor = {}; |
| 389 | $scope.remito.cliente = {}; | 396 | $scope.remito.cliente = {}; |
| 390 | $scope.remito.proveedor = {}; | 397 | $scope.remito.proveedor = {}; |
| 391 | $scope.remito.domicilio = {}; | 398 | $scope.remito.domicilio = {}; |
| 392 | $scope.remito.flete = null; | 399 | $scope.remito.flete = null; |
| 393 | $scope.remito.fob = null; | 400 | $scope.remito.fob = null; |
| 394 | $scope.remito.bomba = null; | 401 | $scope.remito.bomba = null; |
| 395 | $scope.remito.kilometros = null; | 402 | $scope.remito.kilometros = null; |
| 396 | $scope.articulosTabla = []; | 403 | $scope.articulosTabla = []; |
| 397 | crearRemitoService.getNumeroRemito().then( | 404 | crearRemitoService.getNumeroRemito().then( |
| 398 | function(res) { | 405 | function(res) { |
| 399 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 406 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 400 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 407 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
| 401 | }, | 408 | }, |
| 402 | function(err) { | 409 | function(err) { |
| 403 | focaModalService | 410 | focaModalService |
| 404 | .alert('La terminal no esta configurada correctamente'); | 411 | .alert('La terminal no esta configurada correctamente'); |
| 405 | console.info(err); | 412 | console.info(err); |
| 406 | } | 413 | } |
| 407 | ); | 414 | ); |
| 408 | $scope.notaPedido = { | 415 | $scope.notaPedido = { |
| 409 | id: 0 | 416 | id: 0 |
| 410 | }; | 417 | }; |
| 411 | }, function(error) { | 418 | }, function(error) { |
| 412 | focaModalService.alert('Hubo un error al crear el remito'); | 419 | focaModalService.alert('Hubo un error al crear el remito'); |
| 413 | $scope.saveLoading = false; | 420 | $scope.saveLoading = false; |
| 414 | console.info(error); | 421 | console.info(error); |
| 415 | } | 422 | } |
| 416 | ); | 423 | ); |
| 417 | }; | 424 | }; |
| 418 | 425 | ||
| 419 | $scope.seleccionarProductos = function() { | 426 | $scope.seleccionarProductos = function() { |
| 420 | if($scope.idLista === undefined) { | 427 | if($scope.idLista === undefined) { |
| 421 | focaModalService.alert( | 428 | focaModalService.alert( |
| 422 | 'Primero seleccione una lista de precio y condicion'); | 429 | 'Primero seleccione una lista de precio y condicion'); |
| 423 | return; | 430 | return; |
| 424 | } | 431 | } |
| 425 | var modalInstance = $uibModal.open( | 432 | var modalInstance = $uibModal.open( |
| 426 | { | 433 | { |
| 427 | ariaLabelledBy: 'Busqueda de Productos', | 434 | ariaLabelledBy: 'Busqueda de Productos', |
| 428 | templateUrl: 'modal-busqueda-productos.html', | 435 | templateUrl: 'modal-busqueda-productos.html', |
| 429 | controller: 'modalBusquedaProductosCtrl', | 436 | controller: 'modalBusquedaProductosCtrl', |
| 430 | resolve: { | 437 | resolve: { |
| 431 | parametroProducto: { | 438 | parametroProducto: { |
| 432 | idLista: $scope.idLista, | 439 | idLista: $scope.idLista, |
| 433 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 440 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 434 | simbolo: $scope.remito.moneda.simbolo | 441 | simbolo: $scope.remito.moneda.simbolo |
| 435 | } | 442 | } |
| 436 | }, | 443 | }, |
| 437 | size: 'lg' | 444 | size: 'lg' |
| 438 | } | 445 | } |
| 439 | ); | 446 | ); |
| 440 | modalInstance.result.then( | 447 | modalInstance.result.then( |
| 441 | function(producto) { | 448 | function(producto) { |
| 442 | var newArt = | 449 | var newArt = |
| 443 | { | 450 | { |
| 444 | id: 0, | 451 | id: 0, |
| 445 | codigo: producto.codigo, | 452 | codigo: producto.codigo, |
| 446 | sector: producto.sector, | 453 | sector: producto.sector, |
| 447 | sectorCodigo: producto.sector + '-' + producto.codigo, | 454 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 448 | descripcion: producto.descripcion, | 455 | descripcion: producto.descripcion, |
| 449 | item: $scope.articulosTabla.length + 1, | 456 | item: $scope.articulosTabla.length + 1, |
| 450 | nombre: producto.descripcion, | 457 | nombre: producto.descripcion, |
| 451 | precio: parseFloat(producto.precio.toFixed(4)), | 458 | precio: parseFloat(producto.precio.toFixed(4)), |
| 452 | costoUnitario: producto.costo, | 459 | costoUnitario: producto.costo, |
| 453 | editCantidad: false, | 460 | editCantidad: false, |
| 454 | editPrecio: false, | 461 | editPrecio: false, |
| 455 | rubro: producto.CodRub, | 462 | rubro: producto.CodRub, |
| 456 | exentoUnitario: producto.precio, | 463 | exentoUnitario: producto.precio, |
| 457 | ivaUnitario: producto.IMPIVA, | 464 | ivaUnitario: producto.IMPIVA, |
| 458 | impuestoInternoUnitario: producto.ImpInt, | 465 | impuestoInternoUnitario: producto.ImpInt, |
| 459 | impuestoInterno1Unitario: producto.ImpInt2, | 466 | impuestoInterno1Unitario: producto.ImpInt2, |
| 460 | impuestoInterno2Unitario: producto.ImpInt3, | 467 | impuestoInterno2Unitario: producto.ImpInt3, |
| 461 | precioLista: producto.precio, | 468 | precioLista: producto.precio, |
| 462 | combustible: 1, | 469 | combustible: 1, |
| 463 | facturado: 0 | 470 | facturado: 0 |
| 464 | }; | 471 | }; |
| 465 | $scope.articuloACargar = newArt; | 472 | $scope.articuloACargar = newArt; |
| 466 | $scope.cargando = false; | 473 | $scope.cargando = false; |
| 467 | }, function() { | 474 | }, function() { |
| 468 | // funcion ejecutada cuando se cancela el modal | 475 | // funcion ejecutada cuando se cancela el modal |
| 469 | } | 476 | } |
| 470 | ); | 477 | ); |
| 471 | }; | 478 | }; |
| 472 | 479 | ||
| 473 | $scope.seleccionarVendedor = function() { | 480 | $scope.seleccionarVendedor = function() { |
| 474 | if(varlidarRemitoFacturado()) { | 481 | if(varlidarRemitoFacturado()) { |
| 475 | var modalInstance = $uibModal.open( | 482 | var modalInstance = $uibModal.open( |
| 476 | { | 483 | { |
| 477 | ariaLabelledBy: 'Busqueda de Vendedores', | 484 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 478 | templateUrl: 'modal-vendedores.html', | 485 | templateUrl: 'modal-vendedores.html', |
| 479 | controller: 'modalVendedoresCtrl', | 486 | controller: 'modalVendedoresCtrl', |
| 480 | size: 'lg' | 487 | size: 'lg' |
| 481 | } | 488 | } |
| 482 | ); | 489 | ); |
| 483 | modalInstance.result.then( | 490 | modalInstance.result.then( |
| 484 | function(vendedor) { | 491 | function(vendedor) { |
| 485 | $scope.$broadcast('addCabecera',{ | 492 | $scope.$broadcast('addCabecera',{ |
| 486 | label: 'Vendedor:', | 493 | label: 'Vendedor:', |
| 487 | valor: vendedor.NomVen | 494 | valor: vendedor.NomVen |
| 488 | }); | 495 | }); |
| 489 | $scope.remito.idVendedor = vendedor.CodVen; | 496 | $scope.remito.idVendedor = vendedor.CodVen; |
| 490 | }, function() { | 497 | }, function() { |
| 491 | 498 | ||
| 492 | } | 499 | } |
| 493 | ); | 500 | ); |
| 494 | } | 501 | } |
| 495 | }; | 502 | }; |
| 496 | 503 | ||
| 497 | $scope.seleccionarProveedor = function() { | 504 | $scope.seleccionarProveedor = function() { |
| 498 | if(varlidarRemitoFacturado()) { | 505 | if(varlidarRemitoFacturado()) { |
| 499 | var modalInstance = $uibModal.open( | 506 | var modalInstance = $uibModal.open( |
| 500 | { | 507 | { |
| 501 | ariaLabelledBy: 'Busqueda de Proveedor', | 508 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 502 | templateUrl: 'modal-proveedor.html', | 509 | templateUrl: 'modal-proveedor.html', |
| 503 | controller: 'focaModalProveedorCtrl', | 510 | controller: 'focaModalProveedorCtrl', |
| 504 | size: 'lg', | 511 | size: 'lg', |
| 505 | resolve: { | 512 | resolve: { |
| 506 | transportista: function() { | 513 | transportista: function() { |
| 507 | return false; | 514 | return false; |
| 508 | } | 515 | } |
| 509 | } | 516 | } |
| 510 | } | 517 | } |
| 511 | ); | 518 | ); |
| 512 | modalInstance.result.then( | 519 | modalInstance.result.then( |
| 513 | function(proveedor) { | 520 | function(proveedor) { |
| 514 | $scope.remito.idProveedor = proveedor.COD; | 521 | $scope.remito.idProveedor = proveedor.COD; |
| 515 | $scope.$broadcast('addCabecera',{ | 522 | $scope.$broadcast('addCabecera',{ |
| 516 | label: 'Proveedor:', | 523 | label: 'Proveedor:', |
| 517 | valor: proveedor.NOM | 524 | valor: proveedor.NOM |
| 518 | }); | 525 | }); |
| 519 | }, function() { | 526 | }, function() { |
| 520 | 527 | ||
| 521 | } | 528 | } |
| 522 | ); | 529 | ); |
| 523 | } | 530 | } |
| 524 | }; | 531 | }; |
| 525 | 532 | ||
| 526 | $scope.seleccionarCliente = function() { | 533 | $scope.seleccionarCliente = function() { |
| 527 | if(varlidarRemitoFacturado()) { | 534 | if(varlidarRemitoFacturado()) { |
| 528 | var modalInstance = $uibModal.open( | 535 | var modalInstance = $uibModal.open( |
| 529 | { | 536 | { |
| 530 | ariaLabelledBy: 'Busqueda de Cliente', | 537 | ariaLabelledBy: 'Busqueda de Cliente', |
| 531 | templateUrl: 'foca-busqueda-cliente-modal.html', | 538 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 532 | controller: 'focaBusquedaClienteModalController', | 539 | controller: 'focaBusquedaClienteModalController', |
| 533 | size: 'lg' | 540 | size: 'lg' |
| 534 | } | 541 | } |
| 535 | ); | 542 | ); |
| 536 | modalInstance.result.then( | 543 | modalInstance.result.then( |
| 537 | function(cliente) { | 544 | function(cliente) { |
| 538 | $scope.abrirModalDomicilios(cliente); | 545 | $scope.abrirModalDomicilios(cliente); |
| 539 | }, function() { | 546 | }, function() { |
| 540 | 547 | ||
| 541 | } | 548 | } |
| 542 | ); | 549 | ); |
| 543 | } | 550 | } |
| 544 | }; | 551 | }; |
| 545 | 552 | ||
| 546 | $scope.abrirModalDomicilios = function(cliente) { | 553 | $scope.abrirModalDomicilios = function(cliente) { |
| 547 | var modalInstanceDomicilio = $uibModal.open( | 554 | var modalInstanceDomicilio = $uibModal.open( |
| 548 | { | 555 | { |
| 549 | ariaLabelledBy: 'Busqueda de Domicilios', | 556 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 550 | templateUrl: 'modal-domicilio.html', | 557 | templateUrl: 'modal-domicilio.html', |
| 551 | controller: 'focaModalDomicilioController', | 558 | controller: 'focaModalDomicilioController', |
| 552 | size: 'lg', | 559 | size: 'lg', |
| 553 | resolve: { idCliente: function() { return cliente.cod; }} | 560 | resolve: { idCliente: function() { return cliente.cod; }} |
| 554 | } | 561 | } |
| 555 | ); | 562 | ); |
| 556 | modalInstanceDomicilio.result.then( | 563 | modalInstanceDomicilio.result.then( |
| 557 | function(domicilio) { | 564 | function(domicilio) { |
| 558 | //$scope.remito.domicilio.id = domicilio.nivel2; | 565 | //$scope.remito.domicilio.id = domicilio.nivel2; |
| 559 | $scope.remito.cliente = { | 566 | $scope.remito.cliente = { |
| 560 | COD: cliente.cod, | 567 | COD: cliente.cod, |
| 561 | CUIT: cliente.cuit, | 568 | CUIT: cliente.cuit, |
| 562 | NOM: cliente.nom | 569 | NOM: cliente.nom |
| 563 | }; | 570 | }; |
| 564 | 571 | ||
| 565 | 572 | ||
| 566 | var domicilioStamp = | 573 | var domicilioStamp = |
| 567 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 574 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
| 568 | domicilio.Localidad + ', ' + domicilio.Provincia; | 575 | domicilio.Localidad + ', ' + domicilio.Provincia; |
| 569 | $scope.remito.domicilioStamp = domicilioStamp; | 576 | $scope.remito.domicilioStamp = domicilioStamp; |
| 570 | 577 | ||
| 571 | $scope.$broadcast('addCabecera',{ | 578 | $scope.$broadcast('addCabecera',{ |
| 572 | label: 'Cliente:', | 579 | label: 'Cliente:', |
| 573 | valor: cliente.nom | 580 | valor: cliente.nom |
| 574 | }); | 581 | }); |
| 575 | $scope.$broadcast('addCabecera',{ | 582 | $scope.$broadcast('addCabecera',{ |
| 576 | label: 'Domicilio:', | 583 | label: 'Domicilio:', |
| 577 | valor: domicilioStamp | 584 | valor: domicilioStamp |
| 578 | }); | 585 | }); |
| 579 | }, function() { | 586 | }, function() { |
| 580 | $scope.seleccionarCliente(); | 587 | $scope.seleccionarCliente(); |
| 581 | return; | 588 | return; |
| 582 | } | 589 | } |
| 583 | ); | 590 | ); |
| 584 | }; | 591 | }; |
| 585 | 592 | ||
| 586 | $scope.mostrarFichaCliente = function() { | 593 | $scope.mostrarFichaCliente = function() { |
| 587 | $uibModal.open( | 594 | $uibModal.open( |
| 588 | { | 595 | { |
| 589 | ariaLabelledBy: 'Datos del Cliente', | 596 | ariaLabelledBy: 'Datos del Cliente', |
| 590 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 597 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
| 591 | controller: 'focaCrearRemitoFichaClienteController', | 598 | controller: 'focaCrearRemitoFichaClienteController', |
| 592 | size: 'lg' | 599 | size: 'lg' |
| 593 | } | 600 | } |
| 594 | ); | 601 | ); |
| 595 | }; | 602 | }; |
| 596 | 603 | ||
| 597 | $scope.getTotal = function() { | 604 | $scope.getTotal = function() { |
| 598 | var total = 0; | 605 | var total = 0; |
| 599 | var arrayTempArticulos = $scope.articulosTabla; | 606 | var arrayTempArticulos = $scope.articulosTabla; |
| 600 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 607 | for(var i = 0; i < arrayTempArticulos.length; i++) { |
| 601 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 608 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 602 | } | 609 | } |
| 603 | return parseFloat(total.toFixed(2)); | 610 | return parseFloat(total.toFixed(2)); |
| 604 | }; | 611 | }; |
| 605 | 612 | ||
| 606 | $scope.getSubTotal = function() { | 613 | $scope.getSubTotal = function() { |
| 607 | if($scope.articuloACargar) { | 614 | if($scope.articuloACargar) { |
| 608 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 615 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 609 | } | 616 | } |
| 610 | }; | 617 | }; |
| 611 | 618 | ||
| 612 | $scope.seleccionarPreciosYCondiciones = function() { | 619 | $scope.seleccionarPreciosYCondiciones = function() { |
| 613 | if(varlidarRemitoFacturado()) { | 620 | if(varlidarRemitoFacturado()) { |
| 614 | var modalInstance = $uibModal.open( | 621 | var modalInstance = $uibModal.open( |
| 615 | { | 622 | { |
| 616 | ariaLabelledBy: 'Busqueda de Precio Condición', | 623 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 617 | templateUrl: 'modal-precio-condicion.html', | 624 | templateUrl: 'modal-precio-condicion.html', |
| 618 | controller: 'focaModalPrecioCondicionController', | 625 | controller: 'focaModalPrecioCondicionController', |
| 619 | size: 'lg' | 626 | size: 'lg' |
| 620 | } | 627 | } |
| 621 | ); | 628 | ); |
| 622 | modalInstance.result.then( | 629 | modalInstance.result.then( |
| 623 | function(precioCondicion) { | 630 | function(precioCondicion) { |
| 624 | var cabecera = ''; | 631 | var cabecera = ''; |
| 625 | var plazosConcat = ''; | 632 | var plazosConcat = ''; |
| 626 | if(!Array.isArray(precioCondicion)) { | 633 | if(!Array.isArray(precioCondicion)) { |
| 627 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 634 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
| 628 | $scope.plazosPagos = precioCondicion.plazoPago; | 635 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 629 | $scope.idLista = precioCondicion.idListaPrecio; | 636 | $scope.idLista = precioCondicion.idListaPrecio; |
| 630 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 637 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 631 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 638 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 632 | } | 639 | } |
| 633 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 640 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 634 | }else { //Cuando se ingresan los plazos manualmente | 641 | }else { //Cuando se ingresan los plazos manualmente |
| 635 | $scope.remito.idPrecioCondicion = 0; | 642 | $scope.remito.idPrecioCondicion = 0; |
| 636 | //-1, el modal productos busca todos los productos | 643 | //-1, el modal productos busca todos los productos |
| 637 | $scope.idLista = -1; | 644 | $scope.idLista = -1; |
| 638 | $scope.plazosPagos = precioCondicion; | 645 | $scope.plazosPagos = precioCondicion; |
| 639 | for(var j = 0; j < precioCondicion.length; j++) { | 646 | for(var j = 0; j < precioCondicion.length; j++) { |
| 640 | plazosConcat += precioCondicion[j].dias + ' '; | 647 | plazosConcat += precioCondicion[j].dias + ' '; |
| 641 | } | 648 | } |
| 642 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 649 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 643 | } | 650 | } |
| 644 | $scope.articulosTabla = []; | 651 | $scope.articulosTabla = []; |
| 645 | $scope.$broadcast('addCabecera',{ | 652 | $scope.$broadcast('addCabecera',{ |
| 646 | label: 'Precios y condiciones:', | 653 | label: 'Precios y condiciones:', |
| 647 | valor: cabecera | 654 | valor: cabecera |
| 648 | }); | 655 | }); |
| 649 | }, function() { | 656 | }, function() { |
| 650 | 657 | ||
| 651 | } | 658 | } |
| 652 | ); | 659 | ); |
| 653 | } | 660 | } |
| 654 | }; | 661 | }; |
| 655 | 662 | ||
| 656 | $scope.seleccionarFlete = function() { | 663 | $scope.seleccionarFlete = function() { |
| 657 | if(varlidarRemitoFacturado()) { | 664 | if(varlidarRemitoFacturado()) { |
| 658 | var modalInstance = $uibModal.open( | 665 | var modalInstance = $uibModal.open( |
| 659 | { | 666 | { |
| 660 | ariaLabelledBy: 'Busqueda de Flete', | 667 | ariaLabelledBy: 'Busqueda de Flete', |
| 661 | templateUrl: 'modal-flete.html', | 668 | templateUrl: 'modal-flete.html', |
| 662 | controller: 'focaModalFleteController', | 669 | controller: 'focaModalFleteController', |
| 663 | size: 'lg', | 670 | size: 'lg', |
| 664 | resolve: { | 671 | resolve: { |
| 665 | parametrosFlete: | 672 | parametrosFlete: |
| 666 | function() { | 673 | function() { |
| 667 | return { | 674 | return { |
| 668 | flete: $scope.remito.flete ? '1' : | 675 | flete: $scope.remito.flete ? '1' : |
| 669 | ($scope.remito.fob ? 'FOB' : | 676 | ($scope.remito.fob ? 'FOB' : |
| 670 | ($scope.remito.flete === undefined ? null : '0')), | 677 | ($scope.remito.flete === undefined ? null : '0')), |
| 671 | bomba: $scope.remito.bomba ? '1' : | 678 | bomba: $scope.remito.bomba ? '1' : |
| 672 | ($scope.remito.bomba === undefined ? null : '0'), | 679 | ($scope.remito.bomba === undefined ? null : '0'), |
| 673 | kilometros: $scope.remito.kilometros | 680 | kilometros: $scope.remito.kilometros |
| 674 | }; | 681 | }; |
| 675 | } | 682 | } |
| 676 | } | 683 | } |
| 677 | } | 684 | } |
| 678 | ); | 685 | ); |
| 679 | modalInstance.result.then( | 686 | modalInstance.result.then( |
| 680 | function(datos) { | 687 | function(datos) { |
| 681 | $scope.remito.flete = datos.flete; | 688 | $scope.remito.flete = datos.flete; |
| 682 | $scope.remito.fob = datos.FOB; | 689 | $scope.remito.fob = datos.FOB; |
| 683 | $scope.remito.bomba = datos.bomba; | 690 | $scope.remito.bomba = datos.bomba; |
| 684 | $scope.remito.kilometros = datos.kilometros; | 691 | $scope.remito.kilometros = datos.kilometros; |
| 685 | 692 | ||
| 686 | $scope.$broadcast('addCabecera',{ | 693 | $scope.$broadcast('addCabecera',{ |
| 687 | label: 'Flete:', | 694 | label: 'Flete:', |
| 688 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 695 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') |
| 689 | }); | 696 | }); |
| 690 | if(datos.flete) { | 697 | if(datos.flete) { |
| 691 | $scope.$broadcast('addCabecera',{ | 698 | $scope.$broadcast('addCabecera',{ |
| 692 | label: 'Bomba:', | 699 | label: 'Bomba:', |
| 693 | valor: datos.bomba ? 'Si' : 'No' | 700 | valor: datos.bomba ? 'Si' : 'No' |
| 694 | }); | 701 | }); |
| 695 | $scope.$broadcast('addCabecera',{ | 702 | $scope.$broadcast('addCabecera',{ |
| 696 | label: 'Kilometros:', | 703 | label: 'Kilometros:', |
| 697 | valor: datos.kilometros | 704 | valor: datos.kilometros |
| 698 | }); | 705 | }); |
| 699 | }else { | 706 | }else { |
| 700 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 707 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
| 701 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 708 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
| 702 | $scope.remito.fob = false; | 709 | $scope.remito.fob = false; |
| 703 | $scope.remito.bomba = false; | 710 | $scope.remito.bomba = false; |
| 704 | $scope.remito.kilometros = null; | 711 | $scope.remito.kilometros = null; |
| 705 | } | 712 | } |
| 706 | }, function() { | 713 | }, function() { |
| 707 | 714 | ||
| 708 | } | 715 | } |
| 709 | ); | 716 | ); |
| 710 | } | 717 | } |
| 711 | }; | 718 | }; |
| 712 | 719 | ||
| 713 | $scope.seleccionarMoneda = function() { | 720 | $scope.seleccionarMoneda = function() { |
| 714 | if(varlidarRemitoFacturado()) { | 721 | if(varlidarRemitoFacturado()) { |
| 715 | var modalInstance = $uibModal.open( | 722 | var modalInstance = $uibModal.open( |
| 716 | { | 723 | { |
| 717 | ariaLabelledBy: 'Busqueda de Moneda', | 724 | ariaLabelledBy: 'Busqueda de Moneda', |
| 718 | templateUrl: 'modal-moneda.html', | 725 | templateUrl: 'modal-moneda.html', |
| 719 | controller: 'focaModalMonedaController', | 726 | controller: 'focaModalMonedaController', |
| 720 | size: 'lg' | 727 | size: 'lg' |
| 721 | } | 728 | } |
| 722 | ); | 729 | ); |
| 723 | modalInstance.result.then( | 730 | modalInstance.result.then( |
| 724 | function(moneda) { | 731 | function(moneda) { |
| 725 | $scope.abrirModalCotizacion(moneda); | 732 | $scope.abrirModalCotizacion(moneda); |
| 726 | }, function() { | 733 | }, function() { |
| 727 | 734 | ||
| 728 | } | 735 | } |
| 729 | ); | 736 | ); |
| 730 | } | 737 | } |
| 731 | }; | 738 | }; |
| 732 | 739 | ||
| 733 | $scope.abrirModalCotizacion = function(moneda) { | 740 | $scope.abrirModalCotizacion = function(moneda) { |
| 734 | var modalInstance = $uibModal.open( | 741 | var modalInstance = $uibModal.open( |
| 735 | { | 742 | { |
| 736 | ariaLabelledBy: 'Busqueda de Cotización', | 743 | ariaLabelledBy: 'Busqueda de Cotización', |
| 737 | templateUrl: 'modal-cotizacion.html', | 744 | templateUrl: 'modal-cotizacion.html', |
| 738 | controller: 'focaModalCotizacionController', | 745 | controller: 'focaModalCotizacionController', |
| 739 | size: 'lg', | 746 | size: 'lg', |
| 740 | resolve: {idMoneda: function() {return moneda.ID;}} | 747 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 741 | } | 748 | } |
| 742 | ); | 749 | ); |
| 743 | modalInstance.result.then( | 750 | modalInstance.result.then( |
| 744 | function(cotizacion) { | 751 | function(cotizacion) { |
| 745 | var articulosTablaTemp = $scope.articulosTabla; | 752 | var articulosTablaTemp = $scope.articulosTabla; |
| 746 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 753 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 747 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 754 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 748 | $scope.remito.cotizacion.COTIZACION; | 755 | $scope.remito.cotizacion.COTIZACION; |
| 749 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 756 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 750 | cotizacion.COTIZACION; | 757 | cotizacion.COTIZACION; |
| 751 | } | 758 | } |
| 752 | $scope.articulosTabla = articulosTablaTemp; | 759 | $scope.articulosTabla = articulosTablaTemp; |
| 753 | $scope.remito.moneda = moneda; | 760 | $scope.remito.moneda = moneda; |
| 754 | $scope.remito.cotizacion = cotizacion; | 761 | $scope.remito.cotizacion = cotizacion; |
| 755 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 762 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
| 756 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 763 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
| 757 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 764 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
| 758 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 765 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
| 759 | }else { | 766 | }else { |
| 760 | $scope.$broadcast('addCabecera',{ | 767 | $scope.$broadcast('addCabecera',{ |
| 761 | label: 'Moneda:', | 768 | label: 'Moneda:', |
| 762 | valor: moneda.DETALLE | 769 | valor: moneda.DETALLE |
| 763 | }); | 770 | }); |
| 764 | $scope.$broadcast('addCabecera',{ | 771 | $scope.$broadcast('addCabecera',{ |
| 765 | label: 'Fecha cotizacion:', | 772 | label: 'Fecha cotizacion:', |
| 766 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 773 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 767 | }); | 774 | }); |
| 768 | $scope.$broadcast('addCabecera',{ | 775 | $scope.$broadcast('addCabecera',{ |
| 769 | label: 'Cotizacion:', | 776 | label: 'Cotizacion:', |
| 770 | valor: cotizacion.COTIZACION | 777 | valor: cotizacion.COTIZACION |
| 771 | }); | 778 | }); |
| 772 | } | 779 | } |
| 773 | }, function() { | 780 | }, function() { |
| 774 | 781 | ||
| 775 | } | 782 | } |
| 776 | ); | 783 | ); |
| 777 | }; | 784 | }; |
| 778 | 785 | ||
| 779 | $scope.agregarATabla = function(key) { | 786 | $scope.agregarATabla = function(key) { |
| 780 | if(key === 13) { | 787 | if(key === 13) { |
| 781 | if($scope.articuloACargar.cantidad === undefined || | 788 | if($scope.articuloACargar.cantidad === undefined || |
| 782 | $scope.articuloACargar.cantidad === 0 || | 789 | $scope.articuloACargar.cantidad === 0 || |
| 783 | $scope.articuloACargar.cantidad === null ) { | 790 | $scope.articuloACargar.cantidad === null ) { |
| 784 | focaModalService.alert('El valor debe ser al menos 1'); | 791 | focaModalService.alert('El valor debe ser al menos 1'); |
| 785 | return; | 792 | return; |
| 786 | } | 793 | } |
| 787 | delete $scope.articuloACargar.sectorCodigo; | 794 | delete $scope.articuloACargar.sectorCodigo; |
| 788 | $scope.articulosTabla.push($scope.articuloACargar); | 795 | $scope.articulosTabla.push($scope.articuloACargar); |
| 789 | $scope.cargando = true; | 796 | $scope.cargando = true; |
| 790 | } | 797 | } |
| 791 | }; | 798 | }; |
| 792 | 799 | ||
| 793 | $scope.quitarArticulo = function(key) { | 800 | $scope.quitarArticulo = function(key) { |
| 794 | $scope.articulosTabla.splice(key, 1); | 801 | $scope.articulosTabla.splice(key, 1); |
| 795 | }; | 802 | }; |
| 796 | 803 | ||
| 797 | $scope.editarArticulo = function(key, articulo) { | 804 | $scope.editarArticulo = function(key, articulo) { |
| 798 | if(key === 13) { | 805 | if(key === 13) { |
| 799 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 806 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 800 | articulo.cantidad === undefined) { | 807 | articulo.cantidad === undefined) { |
| 801 | focaModalService.alert('El valor debe ser al menos 1'); | 808 | focaModalService.alert('El valor debe ser al menos 1'); |
| 802 | return; | 809 | return; |
| 803 | } | 810 | } |
| 804 | articulo.editCantidad = false; | 811 | articulo.editCantidad = false; |
| 805 | articulo.editPrecio = false; | 812 | articulo.editPrecio = false; |
| 806 | } | 813 | } |
| 807 | }; | 814 | }; |
| 808 | 815 | ||
| 809 | $scope.cambioEdit = function(articulo, propiedad) { | 816 | $scope.cambioEdit = function(articulo, propiedad) { |
| 810 | if(propiedad === 'cantidad') { | 817 | if(propiedad === 'cantidad') { |
| 811 | articulo.editCantidad = true; | 818 | articulo.editCantidad = true; |
| 812 | }else if(propiedad === 'precio') { | 819 | }else if(propiedad === 'precio') { |
| 813 | articulo.editPrecio = true; | 820 | articulo.editPrecio = true; |
| 814 | } | 821 | } |
| 815 | }; | 822 | }; |
| 816 | 823 | ||
| 817 | $scope.limpiarFlete = function() { | 824 | $scope.limpiarFlete = function() { |
| 818 | $scope.remito.fleteNombre = ''; | 825 | $scope.remito.fleteNombre = ''; |
| 819 | $scope.remito.chofer = ''; | 826 | $scope.remito.chofer = ''; |
| 820 | $scope.remito.vehiculo = ''; | 827 | $scope.remito.vehiculo = ''; |
| 821 | $scope.remito.kilometros = ''; | 828 | $scope.remito.kilometros = ''; |
| 822 | $scope.remito.costoUnitarioKmFlete = ''; | 829 | $scope.remito.costoUnitarioKmFlete = ''; |
| 823 | $scope.choferes = ''; | 830 | $scope.choferes = ''; |
| 824 | $scope.vehiculos = ''; | 831 | $scope.vehiculos = ''; |
| 825 | }; | 832 | }; |
| 826 | 833 | ||
| 827 | $scope.limpiarPantalla = function() { | 834 | $scope.limpiarPantalla = function() { |
| 828 | $scope.limpiarFlete(); | 835 | $scope.limpiarFlete(); |
| 829 | $scope.remito.flete = '0'; | 836 | $scope.remito.flete = '0'; |
| 830 | $scope.remito.bomba = '0'; | 837 | $scope.remito.bomba = '0'; |
| 831 | $scope.remito.precioCondicion = ''; | 838 | $scope.remito.precioCondicion = ''; |
| 832 | $scope.articulosTabla = []; | 839 | $scope.articulosTabla = []; |
| 833 | $scope.remito.vendedor.nombre = ''; | 840 | $scope.remito.vendedor.nombre = ''; |
| 834 | $scope.remito.cliente = {nombre: ''}; | 841 | $scope.remito.cliente = {nombre: ''}; |
| 835 | $scope.remito.domicilio = {dom: ''}; | 842 | $scope.remito.domicilio = {dom: ''}; |
| 836 | $scope.domiciliosCliente = []; | 843 | $scope.domiciliosCliente = []; |
| 837 | }; | 844 | }; |
| 838 | 845 | ||
| 839 | $scope.resetFilter = function() { | 846 | $scope.resetFilter = function() { |
| 840 | $scope.articuloACargar = {}; | 847 | $scope.articuloACargar = {}; |
| 841 | $scope.cargando = true; | 848 | $scope.cargando = true; |
| 842 | }; | 849 | }; |
| 843 | //Recibe aviso si el teclado está en uso | 850 | //Recibe aviso si el teclado está en uso |
| 844 | $rootScope.$on('usarTeclado', function(event, data) { | 851 | $rootScope.$on('usarTeclado', function(event, data) { |
| 845 | if(data) { | 852 | if(data) { |
| 846 | $scope.mostrarTeclado = true; | 853 | $scope.mostrarTeclado = true; |
| 847 | return; | 854 | return; |
| 848 | } | 855 | } |
| 849 | $scope.mostrarTeclado = false; | 856 | $scope.mostrarTeclado = false; |
| 850 | }); | 857 | }); |
| 851 | 858 | ||
| 852 | $scope.selectFocus = function($event) { | 859 | $scope.selectFocus = function($event) { |
| 853 | // Si el teclado esta en uso no selecciona el valor | 860 | // Si el teclado esta en uso no selecciona el valor |
| 854 | if($scope.mostrarTeclado) { | 861 | if($scope.mostrarTeclado) { |
| 855 | return; | 862 | return; |
| 856 | } | 863 | } |
| 857 | $event.target.select(); | 864 | $event.target.select(); |
| 858 | }; | 865 | }; |
| 859 | 866 | ||
| 860 | $scope.salir = function() { | ||
| 861 | $location.path('/'); | ||
| 862 | }; | ||
| 863 | function addArrayCabecera(array) { | 867 | function addArrayCabecera(array) { |
| 864 | for(var i = 0; i < array.length; i++) { | 868 | for(var i = 0; i < array.length; i++) { |
| 865 | $scope.$broadcast('addCabecera',{ | 869 | $scope.$broadcast('addCabecera',{ |
| 866 | label: array[i].label, | 870 | label: array[i].label, |
| 867 | valor: array[i].valor | 871 | valor: array[i].valor |
| 868 | }); | 872 | }); |
| 869 | } | 873 | } |
| 870 | } | 874 | } |
| 871 | 875 | ||
| 872 | function rellenar(relleno, longitud) { | 876 | function rellenar(relleno, longitud) { |
| 873 | relleno = '' + relleno; | 877 | relleno = '' + relleno; |
| 874 | while (relleno.length < longitud) { | 878 | while (relleno.length < longitud) { |
| 875 | relleno = '0' + relleno; | 879 | relleno = '0' + relleno; |
| 876 | } | 880 | } |
| 877 | 881 | ||
| 878 | return relleno; | 882 | return relleno; |
| 879 | } | 883 | } |
| 880 | 884 | ||
| 881 | function varlidarRemitoFacturado() { | 885 | function varlidarRemitoFacturado() { |
| 882 | if($scope.remito.estado !== 5) { | 886 | if($scope.remito.estado !== 5) { |
| 883 | return true; | 887 | return true; |
| 884 | }else { | 888 | }else { |
| 885 | focaModalService.alert('No se puede editar un remito facturado'); | 889 | focaModalService.alert('No se puede editar un remito facturado'); |
| 886 | return false(); | 890 | return false(); |
| 887 | } | 891 | } |
| 888 | } | 892 | } |
src/views/remito.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="'REMITO'" | 3 | titulo="'REMITO'" |
| 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 | <div class="col-lg-12"> | 9 | <div class="col-lg-12"> |
| 10 | <div class="row mt-4"> | 10 | <div class="row mt-4"> |
| 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> | 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
| 12 | <div class="row p-1 botonera-secundaria px-5 py-2"> | 12 | <div class="row p-1 botonera-secundaria px-5 py-2"> |
| 13 | <div class="col-12"> | 13 | <div class="col-12"> |
| 14 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> |
| 15 | </div> | 15 | </div> |
| 16 | </div> | 16 | </div> |
| 17 | <!-- PC --> | 17 | <!-- PC --> |
| 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
| 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
| 20 | <thead> | 20 | <thead> |
| 21 | <tr class="d-flex"> | 21 | <tr class="d-flex"> |
| 22 | <th class="">#</th> | 22 | <th class="">#</th> |
| 23 | <th class="col">Código</th> | 23 | <th class="col">Código</th> |
| 24 | <th class="col-4">Descripción</th> | 24 | <th class="col-4">Descripción</th> |
| 25 | <th class="col text-right">Cantidad</th> | 25 | <th class="col text-right">Cantidad</th> |
| 26 | <th class="col text-right">Precio Unitario</th> | 26 | <th class="col text-right">Precio Unitario</th> |
| 27 | <th class="col text-right">SubTotal</th> | 27 | <th class="col text-right">SubTotal</th> |
| 28 | <th class="text-right"> | 28 | <th class="text-right"> |
| 29 | <button | 29 | <button |
| 30 | class="btn btn-outline-light selectable" | 30 | class="btn btn-outline-light selectable" |
| 31 | ng-click="show = !show; masMenos()" | 31 | ng-click="show = !show; masMenos()" |
| 32 | > | 32 | > |
| 33 | <i | 33 | <i |
| 34 | class="fa fa-chevron-down" | 34 | class="fa fa-chevron-down" |
| 35 | ng-show="show" | 35 | ng-show="show" |
| 36 | aria-hidden="true" | 36 | aria-hidden="true" |
| 37 | > | 37 | > |
| 38 | </i> | 38 | </i> |
| 39 | <i | 39 | <i |
| 40 | class="fa fa-chevron-up" | 40 | class="fa fa-chevron-up" |
| 41 | ng-hide="show" | 41 | ng-hide="show" |
| 42 | aria-hidden="true"> | 42 | aria-hidden="true"> |
| 43 | </i> | 43 | </i> |
| 44 | </button> | 44 | </button> |
| 45 | </th> | 45 | </th> |
| 46 | </tr> | 46 | </tr> |
| 47 | </thead> | 47 | </thead> |
| 48 | <tbody class="tabla-articulo-body"> | 48 | <tbody class="tabla-articulo-body"> |
| 49 | <tr | 49 | <tr |
| 50 | ng-repeat="(key, articulo) in articulosTabla" | 50 | ng-repeat="(key, articulo) in articulosTabla" |
| 51 | ng-show="show || key == (articulosTabla.length - 1)" | 51 | ng-show="show || key == (articulosTabla.length - 1)" |
| 52 | class="d-flex" | 52 | class="d-flex" |
| 53 | > | 53 | > |
| 54 | <td ng-bind="key + 1"></td> | 54 | <td ng-bind="key + 1"></td> |
| 55 | <td | 55 | <td |
| 56 | class="col" | 56 | class="col" |
| 57 | ng-bind="articulo.sector + '-' + articulo.codigo" | 57 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 58 | ></td> | 58 | ></td> |
| 59 | <td | 59 | <td |
| 60 | class="col-4" | 60 | class="col-4" |
| 61 | ng-bind="articulo.descripcion" | 61 | ng-bind="articulo.descripcion" |
| 62 | ></td> | 62 | ></td> |
| 63 | <td class="col text-right"> | 63 | <td class="col text-right"> |
| 64 | <input | 64 | <input |
| 65 | ng-show="articulo.editCantidad" | 65 | ng-show="articulo.editCantidad" |
| 66 | ng-model="articulo.cantidad" | 66 | ng-model="articulo.cantidad" |
| 67 | class="form-control" | 67 | class="form-control" |
| 68 | foca-tipo-input | 68 | foca-tipo-input |
| 69 | min="1" | 69 | min="1" |
| 70 | foca-focus="articulo.editCantidad" | 70 | foca-focus="articulo.editCantidad" |
| 71 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 71 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 72 | ng-focus="selectFocus($event)" | 72 | ng-focus="selectFocus($event)" |
| 73 | teclado-virtual | 73 | teclado-virtual |
| 74 | > | 74 | > |
| 75 | <i | 75 | <i |
| 76 | class="selectable" | 76 | class="selectable" |
| 77 | ng-click="cambioEdit(articulo, 'cantidad')" | 77 | ng-click="cambioEdit(articulo, 'cantidad')" |
| 78 | ng-hide="articulo.editCantidad" | 78 | ng-hide="articulo.editCantidad" |
| 79 | ng-bind="articulo.cantidad"> | 79 | ng-bind="articulo.cantidad"> |
| 80 | </i> | 80 | </i> |
| 81 | </td> | 81 | </td> |
| 82 | <td class="col text-right"> | 82 | <td class="col text-right"> |
| 83 | <input | 83 | <input |
| 84 | ng-show="articulo.editPrecio" | 84 | ng-show="articulo.editPrecio" |
| 85 | ng-model="articulo.precio" | 85 | ng-model="articulo.precio" |
| 86 | class="form-control" | 86 | class="form-control" |
| 87 | foca-tipo-input | 87 | foca-tipo-input |
| 88 | min="1" | 88 | min="1" |
| 89 | step="0.0001" | 89 | step="0.0001" |
| 90 | foca-focus="articulo.editPrecio" | 90 | foca-focus="articulo.editPrecio" |
| 91 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 91 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 92 | ng-focus="selectFocus($event)" | 92 | ng-focus="selectFocus($event)" |
| 93 | teclado-virtual | 93 | teclado-virtual |
| 94 | > | 94 | > |
| 95 | <i | 95 | <i |
| 96 | class="selectable" | 96 | class="selectable" |
| 97 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 97 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
| 98 | ng-hide="articulo.editPrecio" | 98 | ng-hide="articulo.editPrecio" |
| 99 | ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"> | 99 | ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"> |
| 100 | </i> | 100 | </i> |
| 101 | </td> | 101 | </td> |
| 102 | <td | 102 | <td |
| 103 | class="col text-right" | 103 | class="col text-right" |
| 104 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO"> | 104 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO"> |
| 105 | </td> | 105 | </td> |
| 106 | <td class="text-center"> | 106 | <td class="text-center"> |
| 107 | <button | 107 | <button |
| 108 | class="btn btn-outline-light" | 108 | class="btn btn-outline-light" |
| 109 | ng-click="quitarArticulo(key)" | 109 | ng-click="quitarArticulo(key)" |
| 110 | > | 110 | > |
| 111 | <i class="fa fa-trash"></i> | 111 | <i class="fa fa-trash"></i> |
| 112 | </button> | 112 | </button> |
| 113 | </td> | 113 | </td> |
| 114 | </tr> | 114 | </tr> |
| 115 | </tbody> | 115 | </tbody> |
| 116 | <tfoot> | 116 | <tfoot> |
| 117 | <tr ng-show="!cargando" class="d-flex"> | 117 | <tr ng-show="!cargando" class="d-flex"> |
| 118 | <td | 118 | <td |
| 119 | class="align-middle" | 119 | class="align-middle" |
| 120 | ng-bind="articulosTabla.length + 1" | 120 | ng-bind="articulosTabla.length + 1" |
| 121 | ></td> | 121 | ></td> |
| 122 | <td class="col"> | 122 | <td class="col"> |
| 123 | <input | 123 | <input |
| 124 | class="form-control" | 124 | class="form-control" |
| 125 | ng-model="articuloACargar.sectorCodigo" | 125 | ng-model="articuloACargar.sectorCodigo" |
| 126 | readonly | 126 | readonly |
| 127 | > | 127 | > |
| 128 | </td> | 128 | </td> |
| 129 | <td class="col-4 tabla-articulo-descripcion"> | 129 | <td class="col-4 tabla-articulo-descripcion"> |
| 130 | <input | 130 | <input |
| 131 | class="form-control" | 131 | class="form-control" |
| 132 | ng-model="articuloACargar.descripcion" | 132 | ng-model="articuloACargar.descripcion" |
| 133 | readonly | 133 | readonly |
| 134 | > | 134 | > |
| 135 | </td> | 135 | </td> |
| 136 | <td class="col text-right"> | 136 | <td class="col text-right"> |
| 137 | <input | 137 | <input |
| 138 | class="form-control" | 138 | class="form-control" |
| 139 | foca-tipo-input | 139 | foca-tipo-input |
| 140 | min="1" | 140 | min="1" |
| 141 | ng-model="articuloACargar.cantidad" | 141 | ng-model="articuloACargar.cantidad" |
| 142 | foca-focus="!cargando" | 142 | foca-focus="!cargando" |
| 143 | esc-key="resetFilter()" | 143 | esc-key="resetFilter()" |
| 144 | ng-keypress="agregarATabla($event.keyCode)" | 144 | ng-keypress="agregarATabla($event.keyCode)" |
| 145 | teclado-virtual | 145 | teclado-virtual |
| 146 | > | 146 | > |
| 147 | </td> | 147 | </td> |
| 148 | <td class="col text-right"> | 148 | <td class="col text-right"> |
| 149 | <input | 149 | <input |
| 150 | class="form-control" | 150 | class="form-control" |
| 151 | ng-value="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4" | 151 | ng-value="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4" |
| 152 | ng-show="idLista != -1" | 152 | ng-show="idLista != -1" |
| 153 | readonly | 153 | readonly |
| 154 | > | 154 | > |
| 155 | <input | 155 | <input |
| 156 | class="form-control" | 156 | class="form-control" |
| 157 | foca-tipo-input | 157 | foca-tipo-input |
| 158 | step="0.0001" | 158 | step="0.0001" |
| 159 | ng-model="articuloACargar.precio" | 159 | ng-model="articuloACargar.precio" |
| 160 | esc-key="resetFilter()" | 160 | esc-key="resetFilter()" |
| 161 | ng-keypress="agregarATabla($event.keyCode)" | 161 | ng-keypress="agregarATabla($event.keyCode)" |
| 162 | ng-show="idLista == -1" | 162 | ng-show="idLista == -1" |
| 163 | teclado-virtual | 163 | teclado-virtual |
| 164 | > | 164 | > |
| 165 | </td> | 165 | </td> |
| 166 | <td class="col text-right"> | 166 | <td class="col text-right"> |
| 167 | <input | 167 | <input |
| 168 | class="form-control" | 168 | class="form-control" |
| 169 | ng-value="getSubTotal() | currency: remito.moneda.SIMBOLO" | 169 | ng-value="getSubTotal() | currency: remito.moneda.SIMBOLO" |
| 170 | readonly | 170 | readonly |
| 171 | ></td> | 171 | ></td> |
| 172 | <td class="text-center align-middle"> | 172 | <td class="text-center align-middle"> |
| 173 | <button | 173 | <button |
| 174 | class="btn btn-outline-light" | 174 | class="btn btn-outline-light" |
| 175 | ng-click="agregarATabla(13)" | 175 | ng-click="agregarATabla(13)" |
| 176 | > | 176 | > |
| 177 | <i class="fa fa-save"></i> | 177 | <i class="fa fa-save"></i> |
| 178 | </button> | 178 | </button> |
| 179 | </td> | 179 | </td> |
| 180 | </tr> | 180 | </tr> |
| 181 | 181 | ||
| 182 | <tr class="d-flex"> | 182 | <tr class="d-flex"> |
| 183 | <td colspan="4" class="no-border-top"> | 183 | <td colspan="4" class="no-border-top"> |
| 184 | <strong>Items:</strong> | 184 | <strong>Items:</strong> |
| 185 | <a ng-bind="articulosTabla.length"></a> | 185 | <a ng-bind="articulosTabla.length"></a> |
| 186 | </td> | 186 | </td> |
| 187 | <td class="text-right ml-auto table-celda-total no-border-top"> | 187 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 188 | <h3>Total:</h3> | 188 | <h3>Total:</h3> |
| 189 | </td> | 189 | </td> |
| 190 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 190 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 191 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | 191 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> |
| 192 | </td> | 192 | </td> |
| 193 | <td class="text-right no-border-top"> | 193 | <td class="text-right no-border-top"> |
| 194 | <button | 194 | <button |
| 195 | type="button" | 195 | type="button" |
| 196 | class="btn btn-default btn-sm" | 196 | class="btn btn-default btn-sm" |
| 197 | > | 197 | > |
| 198 | Totales | 198 | Totales |
| 199 | </button> | 199 | </button> |
| 200 | </td> | 200 | </td> |
| 201 | </tr> | 201 | </tr> |
| 202 | </tfoot> | 202 | </tfoot> |
| 203 | </table> | 203 | </table> |
| 204 | </div> | 204 | </div> |
| 205 | 205 | ||
| 206 | <!-- MOBILE --> | 206 | <!-- MOBILE --> |
| 207 | <div class="row d-sm-none"> | 207 | <div class="row d-sm-none"> |
| 208 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | 208 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> |
| 209 | <thead> | 209 | <thead> |
| 210 | <tr class="d-flex"> | 210 | <tr class="d-flex"> |
| 211 | <th class="">#</th> | 211 | <th class="">#</th> |
| 212 | <th class="col px-0"> | 212 | <th class="col px-0"> |
| 213 | <div class="d-flex"> | 213 | <div class="d-flex"> |
| 214 | <div class="col-4 px-1">Código</div> | 214 | <div class="col-4 px-1">Código</div> |
| 215 | <div class="col-8 px-1">Descripción</div> | 215 | <div class="col-8 px-1">Descripción</div> |
| 216 | </div> | 216 | </div> |
| 217 | <div class="d-flex"> | 217 | <div class="d-flex"> |
| 218 | <div class="col-3 px-1">Cantidad</div> | 218 | <div class="col-3 px-1">Cantidad</div> |
| 219 | <div class="col px-1 text-right">P. Uni.</div> | 219 | <div class="col px-1 text-right">P. Uni.</div> |
| 220 | <div class="col px-1 text-right">Subtotal</div> | 220 | <div class="col px-1 text-right">Subtotal</div> |
| 221 | </div> | 221 | </div> |
| 222 | </th> | 222 | </th> |
| 223 | <th class="text-center tamaño-boton"> | 223 | <th class="text-center tamaño-boton"> |
| 224 | | 224 | |
| 225 | </th> | 225 | </th> |
| 226 | </tr> | 226 | </tr> |
| 227 | </thead> | 227 | </thead> |
| 228 | <tbody> | 228 | <tbody> |
| 229 | <tr | 229 | <tr |
| 230 | ng-repeat="(key, articulo) in articulosTabla" | 230 | ng-repeat="(key, articulo) in articulosTabla" |
| 231 | ng-show="show || key == articulosTabla.length - 1" | 231 | ng-show="show || key == articulosTabla.length - 1" |
| 232 | > | 232 | > |
| 233 | <td class="w-100 align-middle d-flex p-0"> | 233 | <td class="w-100 align-middle d-flex p-0"> |
| 234 | <div class="align-middle p-1"> | 234 | <div class="align-middle p-1"> |
| 235 | <span ng-bind="key+1" class="align-middle"></span> | 235 | <span ng-bind="key+1" class="align-middle"></span> |
| 236 | </div> | 236 | </div> |
| 237 | <div class="col px-0"> | 237 | <div class="col px-0"> |
| 238 | <div class="d-flex"> | 238 | <div class="d-flex"> |
| 239 | <div class="col-4 px-1"> | 239 | <div class="col-4 px-1"> |
| 240 | <span | 240 | <span |
| 241 | ng-bind="articulo.sector + '-' + articulo.codigo" | 241 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 242 | ></span> | 242 | ></span> |
| 243 | </div> | 243 | </div> |
| 244 | <div class="col-8 px-1"> | 244 | <div class="col-8 px-1"> |
| 245 | <span | 245 | <span |
| 246 | ng-bind="'x' + articulo.cantidad" | 246 | ng-bind="'x' + articulo.cantidad" |
| 247 | ng-hide="articulo.editCantidad" | 247 | ng-hide="articulo.editCantidad" |
| 248 | ></span> | 248 | ></span> |
| 249 | <i | 249 | <i |
| 250 | class="fa fa-pencil text-white-50" | 250 | class="fa fa-pencil text-white-50" |
| 251 | aria-hidden="true" | 251 | aria-hidden="true" |
| 252 | ng-hide="articulo.editCantidad" | 252 | ng-hide="articulo.editCantidad" |
| 253 | ng-click="articulo.editCantidad = true" | 253 | ng-click="articulo.editCantidad = true" |
| 254 | ></i> | 254 | ></i> |
| 255 | <input | 255 | <input |
| 256 | ng-show="articulo.editCantidad" | 256 | ng-show="articulo.editCantidad" |
| 257 | ng-model="articulo.cantidad" | 257 | ng-model="articulo.cantidad" |
| 258 | class="form-control" | 258 | class="form-control" |
| 259 | foca-tipo-input | 259 | foca-tipo-input |
| 260 | min="1" | 260 | min="1" |
| 261 | step="0.001" | 261 | step="0.001" |
| 262 | foca-focus="articulo.editCantidad" | 262 | foca-focus="articulo.editCantidad" |
| 263 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 263 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 264 | ng-focus="selectFocus($event)" | 264 | ng-focus="selectFocus($event)" |
| 265 | > | 265 | > |
| 266 | </div> | 266 | </div> |
| 267 | </div> | 267 | </div> |
| 268 | <div class="d-flex"> | 268 | <div class="d-flex"> |
| 269 | <div class="col-3 px-1"> | 269 | <div class="col-3 px-1"> |
| 270 | <span ng-bind="'x' + articulo.cantidad"></span> | 270 | <span ng-bind="'x' + articulo.cantidad"></span> |
| 271 | </div> | 271 | </div> |
| 272 | <div class="col px-1 text-right"> | 272 | <div class="col px-1 text-right"> |
| 273 | <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> | 273 | <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> |
| 274 | </div> | 274 | </div> |
| 275 | <div class="col px-1 text-right"> | 275 | <div class="col px-1 text-right"> |
| 276 | <span | 276 | <span |
| 277 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" | 277 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" |
| 278 | > | 278 | > |
| 279 | </span> | 279 | </span> |
| 280 | </div> | 280 | </div> |
| 281 | </div> | 281 | </div> |
| 282 | </div> | 282 | </div> |
| 283 | <div class="align-middle p-1"> | 283 | <div class="align-middle p-1"> |
| 284 | <button | 284 | <button |
| 285 | class="btn btn-outline-light" | 285 | class="btn btn-outline-light" |
| 286 | ng-click="quitarArticulo(key)" | 286 | ng-click="quitarArticulo(key)" |
| 287 | > | 287 | > |
| 288 | <i class="fa fa-trash"></i> | 288 | <i class="fa fa-trash"></i> |
| 289 | </button> | 289 | </button> |
| 290 | </div> | 290 | </div> |
| 291 | </td> | 291 | </td> |
| 292 | </tr> | 292 | </tr> |
| 293 | </tbody> | 293 | </tbody> |
| 294 | <tfoot> | 294 | <tfoot> |
| 295 | <!-- CARGANDO ITEM --> | 295 | <!-- CARGANDO ITEM --> |
| 296 | <tr ng-show="!cargando" class="d-flex"> | 296 | <tr ng-show="!cargando" class="d-flex"> |
| 297 | <td | 297 | <td |
| 298 | class="align-middle p-1" | 298 | class="align-middle p-1" |
| 299 | ng-bind="articulosTabla.length + 1" | 299 | ng-bind="articulosTabla.length + 1" |
| 300 | ></td> | 300 | ></td> |
| 301 | <td class="col p-0"> | 301 | <td class="col p-0"> |
| 302 | <div class="d-flex"> | 302 | <div class="d-flex"> |
| 303 | <div class="col-4 px-1"> | 303 | <div class="col-4 px-1"> |
| 304 | <span | 304 | <span |
| 305 | ng-bind="articuloACargar.sectorCodigo" | 305 | ng-bind="articuloACargar.sectorCodigo" |
| 306 | ></span> | 306 | ></span> |
| 307 | </div> | 307 | </div> |
| 308 | <div class="col-8 px-1"> | 308 | <div class="col-8 px-1"> |
| 309 | <span ng-bind="articuloACargar.descripcion"></span> | 309 | <span ng-bind="articuloACargar.descripcion"></span> |
| 310 | </div> | 310 | </div> |
| 311 | </div> | 311 | </div> |
| 312 | <div class="d-flex"> | 312 | <div class="d-flex"> |
| 313 | <div class="col-3 px-1 m-1"> | 313 | <div class="col-3 px-1 m-1"> |
| 314 | <input | 314 | <input |
| 315 | class="form-control p-1" | 315 | class="form-control p-1" |
| 316 | foca-tipo-input | 316 | foca-tipo-input |
| 317 | min="1" | 317 | min="1" |
| 318 | ng-model="articuloACargar.cantidad" | 318 | ng-model="articuloACargar.cantidad" |
| 319 | foca-focus="!cargando" | 319 | foca-focus="!cargando" |
| 320 | ng-keypress="agregarATabla($event.keyCode)" | 320 | ng-keypress="agregarATabla($event.keyCode)" |
| 321 | style="height: auto; line-height: 1.1em" | 321 | style="height: auto; line-height: 1.1em" |
| 322 | > | 322 | > |
| 323 | </div> | 323 | </div> |
| 324 | <div class="col px-1 text-right"> | 324 | <div class="col px-1 text-right"> |
| 325 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> | 325 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> |
| 326 | </div> | 326 | </div> |
| 327 | <div class="col px-1 text-right"> | 327 | <div class="col px-1 text-right"> |
| 328 | <span | 328 | <span |
| 329 | ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" | 329 | ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" |
| 330 | > | 330 | > |
| 331 | </span> | 331 | </span> |
| 332 | </div> | 332 | </div> |
| 333 | </div> | 333 | </div> |
| 334 | </td> | 334 | </td> |
| 335 | <td class="text-center align-middle"> | 335 | <td class="text-center align-middle"> |
| 336 | <button | 336 | <button |
| 337 | class="btn btn-outline-light" | 337 | class="btn btn-outline-light" |
| 338 | ng-click="agregarATabla(13)" | 338 | ng-click="agregarATabla(13)" |
| 339 | > | 339 | > |
| 340 | <i class="fa fa-save"></i> | 340 | <i class="fa fa-save"></i> |
| 341 | </button> | 341 | </button> |
| 342 | </td> | 342 | </td> |
| 343 | </tr> | 343 | </tr> |
| 344 | <!-- TOOGLE EXPANDIR --> | 344 | <!-- TOOGLE EXPANDIR --> |
| 345 | <tr> | 345 | <tr> |
| 346 | <td class="col"> | 346 | <td class="col"> |
| 347 | <button | 347 | <button |
| 348 | class="btn btn-outline-light selectable w-100" | 348 | class="btn btn-outline-light selectable w-100" |
| 349 | ng-click="show = !show; masMenos()" | 349 | ng-click="show = !show; masMenos()" |
| 350 | ng-show="articulosTabla.length > 0" | 350 | ng-show="articulosTabla.length > 0" |
| 351 | > | 351 | > |
| 352 | <i | 352 | <i |
| 353 | class="fa fa-chevron-down" | 353 | class="fa fa-chevron-down" |
| 354 | ng-hide="show" | 354 | ng-hide="show" |
| 355 | aria-hidden="true" | 355 | aria-hidden="true" |
| 356 | > | 356 | > |
| 357 | </i> | 357 | </i> |
| 358 | <i | 358 | <i |
| 359 | class="fa fa-chevron-up" | 359 | class="fa fa-chevron-up" |
| 360 | ng-show="show" | 360 | ng-show="show" |
| 361 | aria-hidden="true"> | 361 | aria-hidden="true"> |
| 362 | </i> | 362 | </i> |
| 363 | </button> | 363 | </button> |
| 364 | </td> | 364 | </td> |
| 365 | </tr> | 365 | </tr> |
| 366 | <!-- FOOTER --> | 366 | <!-- FOOTER --> |
| 367 | <tr class="d-flex"> | 367 | <tr class="d-flex"> |
| 368 | <td class="align-middle no-border-top" colspan="2"> | 368 | <td class="align-middle no-border-top" colspan="2"> |
| 369 | <strong>Cantidad Items:</strong> | 369 | <strong>Cantidad Items:</strong> |
| 370 | <a ng-bind="articulosTabla.length"></a> | 370 | <a ng-bind="articulosTabla.length"></a> |
| 371 | </td> | 371 | </td> |
| 372 | <td class="text-right ml-auto table-celda-total no-border-top"> | 372 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 373 | <h3>Total:</h3> | 373 | <h3>Total:</h3> |
| 374 | </td> | 374 | </td> |
| 375 | <td class="table-celda-total text-right no-border-top"> | 375 | <td class="table-celda-total text-right no-border-top"> |
| 376 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | 376 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> |
| 377 | </td> | 377 | </td> |
| 378 | </tr> | 378 | </tr> |
| 379 | </tfoot> | 379 | </tfoot> |
| 380 | </table> | 380 | </table> |
| 381 | </div> | 381 | </div> |
| 382 | </div> | 382 | </div> |
| 383 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> | ||
| 384 | <div class="col-12 mt-auto"> | ||
| 385 | <button | ||
| 386 | ng-click="crearRemito()" | ||
| 387 | type="submit" | ||
| 388 | title="Crear nota remito" | ||
| 389 | class="btn btn-default btn-block mb-2 border border-dark" | ||
| 390 | ng-disabled="remito.estado === 5 || saveLoading" | ||
| 391 | ><strong>GUARDAR</strong> | ||
| 392 | </button> | ||
| 393 | <button | ||
| 394 | type="button" | ||
| 395 | title="Pausar" | ||
| 396 | class="btn btn-default btn-block border border-dark"> | ||
| 397 | <strong>PAUSAR</strong> | ||
| 398 | </button> | ||
| 399 | <button | ||
| 400 | ng-click="salir()" | ||
| 401 | type="button" | ||
| 402 | title="Salir" | ||
| 403 | class="btn btn-default btn-block border border-dark"> | ||
| 404 | <strong>SALIR</strong> | ||
| 405 | </button> | ||
| 406 | </div> | ||
| 407 | </div> | ||
| 408 | </div> | 383 | </div> |
| 409 | </div> | 384 | </div> |
| 410 | <div class="row d-md-none fixed-bottom"> | 385 | <div class="row d-md-none fixed-bottom"> |
| 411 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 386 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 412 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 387 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 413 | <span | 388 | <span |
| 414 | class="mr-3 ml-auto" | 389 | class="mr-3 ml-auto" |
| 415 | ng-class="saveLoading ? 'text-muted' : ''" | 390 | ng-class="saveLoading ? 'text-muted' : ''" |
| 416 | ng-click="crearRemito()" | 391 | ng-click="crearRemito()" |
| 417 | ladda="saveLoading" | 392 | ladda="saveLoading" |
| 418 | data-style="expand-left" | 393 | data-style="expand-left" |
| 419 | >Guardar</span> | 394 | >Guardar</span> |
| 420 | </div> | 395 | </div> |
| 421 | </div> | 396 | </div> |
| 422 | </div> | 397 | </div> |
| 423 | 398 |