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