Commit 575f00760e81e8b25be31f93fcdb5d4b4e01df41
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !88
Showing
1 changed file
Show diff stats
src/js/controller.js
... | ... | @@ -358,7 +358,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
358 | 358 | }, |
359 | 359 | notaPedido: $scope.notaPedido |
360 | 360 | }; |
361 | - | |
361 | + | |
362 | 362 | crearRemitoService.crearRemito(save).then( |
363 | 363 | function (data) { |
364 | 364 | |
... | ... | @@ -494,9 +494,9 @@ angular.module('focaCrearRemito').controller('remitoController', |
494 | 494 | } |
495 | 495 | ); |
496 | 496 | modalInstance.result.then( |
497 | - function(puntosDescarga) { | |
497 | + function (puntosDescarga) { | |
498 | 498 | |
499 | - puntosDescarga.forEach(function(punto) { | |
499 | + puntosDescarga.forEach(function (punto) { | |
500 | 500 | $scope.remito.remitoPuntoDescarga.push( |
501 | 501 | { |
502 | 502 | puntoDescarga: punto |
... | ... | @@ -604,7 +604,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
604 | 604 | $scope.$broadcast('addCabecera', { |
605 | 605 | label: 'Vendedor:', |
606 | 606 | valor: $filter('rellenarDigitos')($scope.remito.vendedor |
607 | - .NUM, 3) +' - ' + $scope.remito.vendedor.NOM | |
607 | + .NUM, 3) + ' - ' + $scope.remito.vendedor.NOM | |
608 | 608 | }); |
609 | 609 | } |
610 | 610 | var domicilioStamp = |
... | ... | @@ -1044,10 +1044,11 @@ angular.module('focaCrearRemito').controller('remitoController', |
1044 | 1044 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
1045 | 1045 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
1046 | 1046 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
1047 | + $scope.$broadcast('removeCabecera', 'Vendedor:'); | |
1047 | 1048 | |
1048 | 1049 | var cabeceras = []; |
1049 | 1050 | |
1050 | - if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | |
1051 | + if (remito.cotizacion && remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | |
1051 | 1052 | cabeceras.push({ |
1052 | 1053 | label: 'Moneda:', |
1053 | 1054 | valor: remito.cotizacion.moneda.DETALLE |
... | ... | @@ -1064,11 +1065,11 @@ angular.module('focaCrearRemito').controller('remitoController', |
1064 | 1065 | }); |
1065 | 1066 | } |
1066 | 1067 | |
1067 | - if (remito.cotizacion.moneda) { | |
1068 | + if (remito.cotizacion && remito.cotizacion.moneda) { | |
1068 | 1069 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
1069 | 1070 | } |
1070 | 1071 | |
1071 | - if (remito.cliente.COD) { | |
1072 | + if (remito.cliente && remito.cliente.COD) { | |
1072 | 1073 | cabeceras.push({ |
1073 | 1074 | label: 'Cliente:', |
1074 | 1075 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
... | ... | @@ -1081,14 +1082,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
1081 | 1082 | |
1082 | 1083 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
1083 | 1084 | } |
1084 | - if (remito.vendedor.NUM) { | |
1085 | + if (remito.vendedor && remito.vendedor.NUM) { | |
1085 | 1086 | cabeceras.push({ |
1086 | 1087 | label: 'Vendedor:', |
1087 | 1088 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
1088 | 1089 | ' - ' + remito.vendedor.NOM |
1089 | 1090 | }); |
1090 | 1091 | } |
1091 | - if (remito.proveedor.COD) { | |
1092 | + if (remito.proveedor && remito.proveedor.COD) { | |
1092 | 1093 | cabeceras.push({ |
1093 | 1094 | label: 'Proveedor:', |
1094 | 1095 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + |
... | ... | @@ -1147,7 +1148,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
1147 | 1148 | if ($scope.remito.remitoPuntoDescarga.length) { |
1148 | 1149 | var puntoDescarga = []; |
1149 | 1150 | |
1150 | - $scope.remito.remitoPuntoDescarga.forEach(function(remitoPuntoDescarga) { | |
1151 | + $scope.remito.remitoPuntoDescarga.forEach(function (remitoPuntoDescarga) { | |
1151 | 1152 | puntoDescarga.push(remitoPuntoDescarga.puntoDescarga); |
1152 | 1153 | }); |
1153 | 1154 | |
... | ... | @@ -1158,7 +1159,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
1158 | 1159 | } |
1159 | 1160 | $scope.remitoIsDirty = false; |
1160 | 1161 | |
1161 | - if ($scope.remito.articulosRemito.length) { | |
1162 | + if (remito.articulosRemito && $scope.remito.articulosRemito.length) { | |
1162 | 1163 | $scope.remito.articulosRemito.forEach(function (articulo) { |
1163 | 1164 | articulo.precio = |
1164 | 1165 | (articulo.precio / $scope.remito.cotizacion.VENDEDOR).toFixed(4); |