Commit dba9dc4e49e4d526a44178817a5aa0e06cdf4629
1 parent
2beeeb906b
Exists in
master
and in
1 other branch
muestro pdf
Showing
2 changed files
with
28 additions
and
14 deletions
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -2,9 +2,10 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 2 | 2 | [ | 
| 3 | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 
| 4 | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 
| 5 | + '$window', | |
| 5 | 6 | function( | 
| 6 | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 
| 7 | - remitoBusinessService, $rootScope, focaBotoneraLateralService) | |
| 8 | + remitoBusinessService, $rootScope, focaBotoneraLateralService, $window) | |
| 8 | 9 | { | 
| 9 | 10 | config(); | 
| 10 | 11 | |
| ... | ... | @@ -153,7 +154,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 153 | 154 | notaPedido.flete === 1 ? 'Si' : 'No') | 
| 154 | 155 | } | 
| 155 | 156 | ]; | 
| 156 | - | |
| 157 | + | |
| 157 | 158 | function valorPrecioCondicion() { | 
| 158 | 159 | if(notaPedido.idPrecioCondicion > 0) { | 
| 159 | 160 | return notaPedido.precioCondicion.nombre; | 
| ... | ... | @@ -161,7 +162,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 161 | 162 | return 'Ingreso Manual'; | 
| 162 | 163 | } | 
| 163 | 164 | } | 
| 164 | - | |
| 165 | + | |
| 165 | 166 | if(notaPedido.flete === 1) { | 
| 166 | 167 | var cabeceraBomba = { | 
| 167 | 168 | label: 'Bomba:', | 
| ... | ... | @@ -176,21 +177,21 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 176 | 177 | } | 
| 177 | 178 | cabeceras.push(cabeceraBomba); | 
| 178 | 179 | } | 
| 179 | - | |
| 180 | + | |
| 180 | 181 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 
| 181 | 182 | notaPedido.articulosNotaPedido[i].id = 0; | 
| 182 | 183 | } | 
| 183 | - | |
| 184 | + | |
| 184 | 185 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 
| 185 | 186 | remitoBusinessService.calcularArticulos($scope.articulosTabla, | 
| 186 | 187 | notaPedido.cotizacion.VENDEDOR); | 
| 187 | - | |
| 188 | + | |
| 188 | 189 | if(notaPedido.idPrecioCondicion > 0) { | 
| 189 | 190 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 
| 190 | 191 | }else { | 
| 191 | 192 | $scope.idLista = -1; | 
| 192 | 193 | } | 
| 193 | - | |
| 194 | + | |
| 194 | 195 | delete notaPedido.id; | 
| 195 | 196 | $scope.remito = notaPedido; | 
| 196 | 197 | $scope.remito.id = 0; | 
| ... | ... | @@ -198,7 +199,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 198 | 199 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 
| 199 | 200 | enableObservaciones(notaPedido.observaciones ? true : false); | 
| 200 | 201 | addArrayCabecera(cabeceras); | 
| 201 | - | |
| 202 | + | |
| 202 | 203 | }, function() { | 
| 203 | 204 | // funcion ejecutada cuando se cancela el modal | 
| 204 | 205 | } | 
| ... | ... | @@ -402,7 +403,16 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 402 | 403 | crearRemitoService.crearPlazosParaRemito(json); | 
| 403 | 404 | } | 
| 404 | 405 | } | 
| 405 | - | |
| 406 | + crearRemitoService.imprimirRemitoByIdRemito(data.data.id).then( | |
| 407 | + function(res) { | |
| 408 | + | |
| 409 | + var printWindow = $window.open('', '', 'height=1000,width=800'); | |
| 410 | + printWindow.document.write(res.data); | |
| 411 | + printWindow.document.close(); | |
| 412 | + printWindow.print(); | |
| 413 | + | |
| 414 | + } | |
| 415 | + ); | |
| 406 | 416 | init(); | 
| 407 | 417 | }, function(error) { | 
| 408 | 418 | focaModalService.alert('Hubo un error al crear el remito'); | 
| ... | ... | @@ -498,7 +508,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 498 | 508 | $scope.remito.idVendedor = vendedor.id; | 
| 499 | 509 | $scope.vendedor = vendedor; | 
| 500 | 510 | }, function() { | 
| 501 | - | |
| 511 | + | |
| 502 | 512 | } | 
| 503 | 513 | ); | 
| 504 | 514 | } | 
| ... | ... | @@ -681,7 +691,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 681 | 691 | valor: cabecera | 
| 682 | 692 | }); | 
| 683 | 693 | }, function() { | 
| 684 | - | |
| 694 | + | |
| 685 | 695 | } | 
| 686 | 696 | ); | 
| 687 | 697 | } | 
| ... | ... | @@ -716,7 +726,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 716 | 726 | $scope.remito.fob = datos.FOB; | 
| 717 | 727 | $scope.remito.bomba = datos.bomba; | 
| 718 | 728 | $scope.remito.kilometros = datos.kilometros; | 
| 719 | - | |
| 729 | + | |
| 720 | 730 | $scope.$broadcast('addCabecera',{ | 
| 721 | 731 | label: 'Flete:', | 
| 722 | 732 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 
| ... | ... | @@ -738,7 +748,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 738 | 748 | $scope.remito.kilometros = null; | 
| 739 | 749 | } | 
| 740 | 750 | }, function() { | 
| 741 | - | |
| 751 | + | |
| 742 | 752 | } | 
| 743 | 753 | ); | 
| 744 | 754 | } | 
| ... | ... | @@ -765,7 +775,7 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 765 | 775 | function(moneda) { | 
| 766 | 776 | $scope.abrirModalCotizacion(moneda); | 
| 767 | 777 | }, function() { | 
| 768 | - | |
| 778 | + | |
| 769 | 779 | } | 
| 770 | 780 | ); | 
| 771 | 781 | } | 
src/js/service.js
| ... | ... | @@ -56,6 +56,10 @@ angular.module('focaCrearRemito') | 
| 56 | 56 | getNumeroRemito: function() { | 
| 57 | 57 | return $http.get(route + '/remito/numero-siguiente'); | 
| 58 | 58 | }, | 
| 59 | + imprimirRemitoByIdRemito: function(idRemito, original) { | |
| 60 | + var tipo = original ? '/original' : ''; | |
| 61 | + return $http.get(route + '/remito/comprobante/' + idRemito + tipo); | |
| 62 | + }, | |
| 59 | 63 | getBotonera: function() { | 
| 60 | 64 | return [ | 
| 61 | 65 | { |