Commit 05d879f7030d7109bfb7e32c597fc619072a3eda
1 parent
bccae4161b
Exists in
master
aplico modal mail
Showing
4 changed files
with
56 additions
and
140 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', |
4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', |
5 | '$localStorage', | 5 | '$localStorage', |
6 | function( | 6 | function( |
7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, |
8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) | 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) |
9 | { | 9 | { |
10 | config(); | 10 | config(); |
11 | 11 | ||
12 | function config() { | 12 | function config() { |
13 | $scope.botonera = crearRemitoService.getBotonera(); | 13 | $scope.botonera = crearRemitoService.getBotonera(); |
14 | $scope.isNumber = angular.isNumber; | 14 | $scope.isNumber = angular.isNumber; |
15 | $scope.datepickerAbierto = false; | 15 | $scope.datepickerAbierto = false; |
16 | $scope.show = false; | 16 | $scope.show = false; |
17 | $scope.cargando = true; | 17 | $scope.cargando = true; |
18 | $scope.now = new Date(); | 18 | $scope.now = new Date(); |
19 | $scope.puntoVenta = rellenar(0, 4); | 19 | $scope.puntoVenta = rellenar(0, 4); |
20 | $scope.comprobante = rellenar(0, 8); | 20 | $scope.comprobante = rellenar(0, 8); |
21 | $scope.dateOptions = { | 21 | $scope.dateOptions = { |
22 | maxDate: new Date(), | 22 | maxDate: new Date(), |
23 | minDate: new Date(2010, 0, 1) | 23 | minDate: new Date(2010, 0, 1) |
24 | }; | 24 | }; |
25 | 25 | ||
26 | var monedaPorDefecto; | 26 | var monedaPorDefecto; |
27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
29 | monedaPorDefecto = res.data[0]; | 29 | monedaPorDefecto = res.data[0]; |
30 | 30 | ||
31 | $scope.remito.cotizacion = Object.assign( | 31 | $scope.remito.cotizacion = Object.assign( |
32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] | 32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] |
33 | ); | 33 | ); |
34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; | 34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; |
35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); | 35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); |
36 | }); | 36 | }); |
37 | 37 | ||
38 | //SETEO BOTONERA LATERAL | 38 | //SETEO BOTONERA LATERAL |
39 | $timeout(function() { | 39 | $timeout(function() { |
40 | focaBotoneraLateralService.showSalir(false); | 40 | focaBotoneraLateralService.showSalir(false); |
41 | focaBotoneraLateralService.showPausar(true); | 41 | focaBotoneraLateralService.showPausar(true); |
42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); |
43 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 43 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
44 | }); | 44 | }); |
45 | 45 | ||
46 | init(); | 46 | init(); |
47 | $timeout(function() {getLSRemito();}); | 47 | $timeout(function() {getLSRemito();}); |
48 | } | 48 | } |
49 | 49 | ||
50 | function init() { | 50 | function init() { |
51 | $scope.$broadcast('cleanCabecera'); | 51 | $scope.$broadcast('cleanCabecera'); |
52 | 52 | ||
53 | $scope.remito = { | 53 | $scope.remito = { |
54 | id: 0, | 54 | id: 0, |
55 | estado: 0, | 55 | estado: 0, |
56 | vendedor: {}, | 56 | vendedor: {}, |
57 | cliente: {}, | 57 | cliente: {}, |
58 | proveedor: {}, | 58 | proveedor: {}, |
59 | domicilio: {dom: ''}, | 59 | domicilio: {dom: ''}, |
60 | moneda: {}, | 60 | moneda: {}, |
61 | cotizacion: $scope.cotizacionPorDefecto || {}, | 61 | cotizacion: $scope.cotizacionPorDefecto || {}, |
62 | articulosRemito: [] | 62 | articulosRemito: [] |
63 | }; | 63 | }; |
64 | 64 | ||
65 | $scope.notaPedido = { | 65 | $scope.notaPedido = { |
66 | id: 0 | 66 | id: 0 |
67 | }; | 67 | }; |
68 | 68 | ||
69 | $scope.remito.articulosRemito = []; | 69 | $scope.remito.articulosRemito = []; |
70 | $scope.idLista = undefined; | 70 | $scope.idLista = undefined; |
71 | 71 | ||
72 | crearRemitoService.getNumeroRemito().then( | 72 | crearRemitoService.getNumeroRemito().then( |
73 | function(res) { | 73 | function(res) { |
74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
76 | }, | 76 | }, |
77 | function(err) { | 77 | function(err) { |
78 | focaModalService.alert('La terminal no esta configurada correctamente'); | 78 | focaModalService.alert('La terminal no esta configurada correctamente'); |
79 | console.info(err); | 79 | console.info(err); |
80 | } | 80 | } |
81 | ); | 81 | ); |
82 | 82 | ||
83 | $scope.inicial = angular.copy($scope.remito); | 83 | $scope.inicial = angular.copy($scope.remito); |
84 | } | 84 | } |
85 | 85 | ||
86 | $scope.$watch('remito', function(newValue) { | 86 | $scope.$watch('remito', function(newValue) { |
87 | focaBotoneraLateralService.setPausarData({ | 87 | focaBotoneraLateralService.setPausarData({ |
88 | label: 'remito', | 88 | label: 'remito', |
89 | val: newValue | 89 | val: newValue |
90 | }); | 90 | }); |
91 | }, true); | 91 | }, true); |
92 | 92 | ||
93 | $scope.seleccionarNotaPedido = function() { | 93 | $scope.seleccionarNotaPedido = function() { |
94 | if(varlidarRemitoFacturado()) { | 94 | if (varlidarRemitoFacturado()) { |
95 | var modalInstance = $uibModal.open( | 95 | var modalInstance = $uibModal.open( |
96 | { | 96 | { |
97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
98 | templateUrl: 'foca-modal-nota-pedido.html', | 98 | templateUrl: 'foca-modal-nota-pedido.html', |
99 | controller: 'focaModalNotaPedidoController', | 99 | controller: 'focaModalNotaPedidoController', |
100 | size: 'lg', | 100 | size: 'lg', |
101 | resolve: { | 101 | resolve: { |
102 | usadoPor: function() { return 'remito'; }, | 102 | usadoPor: function() { return 'remito'; }, |
103 | idVendedor: function() { return null; } | 103 | idVendedor: function() { return null; } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | ); | 106 | ); |
107 | modalInstance.result.then( | 107 | modalInstance.result.then( |
108 | function(notaPedido) { | 108 | function(notaPedido) { |
109 | //añado cabeceras | 109 | //añado cabeceras |
110 | $scope.notaPedido.id = notaPedido.id; | 110 | $scope.notaPedido.id = notaPedido.id; |
111 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 111 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
113 | var cabeceras = [ | 113 | var cabeceras = [ |
114 | { | 114 | { |
115 | label: 'Moneda:', | 115 | label: 'Moneda:', |
116 | valor: notaPedido.cotizacion.moneda.DETALLE | 116 | valor: notaPedido.cotizacion.moneda.DETALLE |
117 | }, | 117 | }, |
118 | { | 118 | { |
119 | label: 'Fecha cotizacion:', | 119 | label: 'Fecha cotizacion:', |
120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
121 | 'dd/MM/yyyy') | 121 | 'dd/MM/yyyy') |
122 | }, | 122 | }, |
123 | { | 123 | { |
124 | label: 'Cotizacion:', | 124 | label: 'Cotizacion:', |
125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
126 | '2') | 126 | '2') |
127 | }, | 127 | }, |
128 | { | 128 | { |
129 | label: 'Cliente:', | 129 | label: 'Cliente:', |
130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + |
131 | ' - ' + notaPedido.cliente.NOM | 131 | ' - ' + notaPedido.cliente.NOM |
132 | }, | 132 | }, |
133 | { | 133 | { |
134 | label: 'Domicilio:', | 134 | label: 'Domicilio:', |
135 | valor: notaPedido.domicilioStamp | 135 | valor: notaPedido.domicilioStamp |
136 | }, | 136 | }, |
137 | { | 137 | { |
138 | label: 'Vendedor:', | 138 | label: 'Vendedor:', |
139 | valor: $filter('rellenarDigitos')( | 139 | valor: $filter('rellenarDigitos')( |
140 | notaPedido.vendedor.NUM, 3 | 140 | notaPedido.vendedor.NUM, 3 |
141 | ) + ' - ' + notaPedido.vendedor.NOM | 141 | ) + ' - ' + notaPedido.vendedor.NOM |
142 | }, | 142 | }, |
143 | { | 143 | { |
144 | label: 'Proveedor:', | 144 | label: 'Proveedor:', |
145 | valor: $filter('rellenarDigitos') | 145 | valor: $filter('rellenarDigitos') |
146 | (notaPedido.proveedor.COD, 5) + ' - ' + | 146 | (notaPedido.proveedor.COD, 5) + ' - ' + |
147 | notaPedido.proveedor.NOM | 147 | notaPedido.proveedor.NOM |
148 | }, | 148 | }, |
149 | { | 149 | { |
150 | label: 'Precio condicion:', | 150 | label: 'Precio condicion:', |
151 | valor: valorPrecioCondicion() + ' ' + | 151 | valor: valorPrecioCondicion() + ' ' + |
152 | remitoBusinessService | 152 | remitoBusinessService |
153 | .plazoToString(notaPedido.notaPedidoPlazo) | 153 | .plazoToString(notaPedido.notaPedidoPlazo) |
154 | }, | 154 | }, |
155 | { | 155 | { |
156 | label: 'Flete:', | 156 | label: 'Flete:', |
157 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 157 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
158 | notaPedido.flete === 1 ? 'Si' : 'No') | 158 | notaPedido.flete === 1 ? 'Si' : 'No') |
159 | } | 159 | } |
160 | ]; | 160 | ]; |
161 | 161 | ||
162 | if (notaPedido.observaciones) { | 162 | if (notaPedido.observaciones) { |
163 | cabeceras.push({ | 163 | cabeceras.push({ |
164 | label: 'Observaciones:', | 164 | label: 'Observaciones:', |
165 | valor: notaPedido.observaciones | 165 | valor: notaPedido.observaciones |
166 | }); | 166 | }); |
167 | } | 167 | } |
168 | 168 | ||
169 | function valorPrecioCondicion() { | 169 | function valorPrecioCondicion() { |
170 | if (notaPedido.idPrecioCondicion > 0) { | 170 | if (notaPedido.idPrecioCondicion > 0) { |
171 | return notaPedido.precioCondicion.nombre; | 171 | return notaPedido.precioCondicion.nombre; |
172 | } else { | 172 | } else { |
173 | return 'Ingreso Manual'; | 173 | return 'Ingreso Manual'; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | if (notaPedido.flete === 1) { | 177 | if (notaPedido.flete === 1) { |
178 | var cabeceraBomba = { | 178 | var cabeceraBomba = { |
179 | label: 'Bomba:', | 179 | label: 'Bomba:', |
180 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 180 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
181 | }; | 181 | }; |
182 | if (notaPedido.kilometros) { | 182 | if (notaPedido.kilometros) { |
183 | var cabeceraKilometros = { | 183 | var cabeceraKilometros = { |
184 | label: 'Kilometros:', | 184 | label: 'Kilometros:', |
185 | valor: notaPedido.kilometros | 185 | valor: notaPedido.kilometros |
186 | }; | 186 | }; |
187 | cabeceras.push(cabeceraKilometros); | 187 | cabeceras.push(cabeceraKilometros); |
188 | } | 188 | } |
189 | cabeceras.push(cabeceraBomba); | 189 | cabeceras.push(cabeceraBomba); |
190 | } | 190 | } |
191 | 191 | ||
192 | delete notaPedido.id; | 192 | delete notaPedido.id; |
193 | $scope.remito = notaPedido; | 193 | $scope.remito = notaPedido; |
194 | $scope.remito.id = 0; | 194 | $scope.remito.id = 0; |
195 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 195 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; |
196 | 196 | ||
197 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 197 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
198 | notaPedido.articulosNotaPedido[i].id = 0; | 198 | notaPedido.articulosNotaPedido[i].id = 0; |
199 | } | 199 | } |
200 | 200 | ||
201 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 201 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; |
202 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 202 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, |
203 | notaPedido.cotizacion.VENDEDOR); | 203 | notaPedido.cotizacion.VENDEDOR); |
204 | 204 | ||
205 | if(notaPedido.idPrecioCondicion > 0) { | 205 | if (notaPedido.idPrecioCondicion > 0) { |
206 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 206 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
207 | }else { | 207 | }else { |
208 | $scope.idLista = -1; | 208 | $scope.idLista = -1; |
209 | } | 209 | } |
210 | 210 | ||
211 | enableObservaciones(notaPedido.observaciones ? true : false); | 211 | enableObservaciones(notaPedido.observaciones ? true : false); |
212 | addArrayCabecera(cabeceras); | 212 | addArrayCabecera(cabeceras); |
213 | 213 | ||
214 | }, function() { | 214 | }, function() { |
215 | // funcion ejecutada cuando se cancela el modal | 215 | // funcion ejecutada cuando se cancela el modal |
216 | } | 216 | } |
217 | ); | 217 | ); |
218 | } | 218 | } |
219 | }; | 219 | }; |
220 | 220 | ||
221 | $scope.seleccionarRemito = function() { | 221 | $scope.seleccionarRemito = function() { |
222 | var modalInstance = $uibModal.open( | 222 | var modalInstance = $uibModal.open( |
223 | { | 223 | { |
224 | ariaLabelledBy: 'Busqueda de Remito', | 224 | ariaLabelledBy: 'Busqueda de Remito', |
225 | templateUrl: 'foca-modal-remito.html', | 225 | templateUrl: 'foca-modal-remito.html', |
226 | controller: 'focaModalRemitoController', | 226 | controller: 'focaModalRemitoController', |
227 | size: 'lg', | 227 | size: 'lg', |
228 | resolve: {usadoPor: function() {return 'remito';}} | 228 | resolve: {usadoPor: function() {return 'remito';}} |
229 | } | 229 | } |
230 | ); | 230 | ); |
231 | modalInstance.result.then( | 231 | modalInstance.result.then( |
232 | setearRemito, function() { | 232 | setearRemito, function() { |
233 | // funcion ejecutada cuando se cancela el modal | 233 | // funcion ejecutada cuando se cancela el modal |
234 | } | 234 | } |
235 | ); | 235 | ); |
236 | }; | 236 | }; |
237 | 237 | ||
238 | //validacion por domicilio y por plazo pago | 238 | //validacion por domicilio y por plazo pago |
239 | $scope.crearRemito = function() { | 239 | $scope.crearRemito = function() { |
240 | if (!$scope.remito.vendedor.NUM) { | 240 | if (!$scope.remito.vendedor.NUM) { |
241 | focaModalService.alert('Ingrese Vendedor'); | 241 | focaModalService.alert('Ingrese Vendedor'); |
242 | return; | 242 | return; |
243 | } else if (!$scope.remito.cliente.COD) { | 243 | } else if (!$scope.remito.cliente.COD) { |
244 | focaModalService.alert('Ingrese Cliente'); | 244 | focaModalService.alert('Ingrese Cliente'); |
245 | return; | 245 | return; |
246 | } else if (!$scope.remito.proveedor) { | 246 | } else if (!$scope.remito.proveedor) { |
247 | focaModalService.alert('Ingrese Proveedor'); | 247 | focaModalService.alert('Ingrese Proveedor'); |
248 | return; | 248 | return; |
249 | } else if (!$scope.remito.cotizacion.moneda.id && | 249 | } else if (!$scope.remito.cotizacion.moneda.id && |
250 | !$scope.remito.cotizacion.moneda.ID) | 250 | !$scope.remito.cotizacion.moneda.ID) |
251 | { | 251 | { |
252 | focaModalService.alert('Ingrese Moneda'); | 252 | focaModalService.alert('Ingrese Moneda'); |
253 | return; | 253 | return; |
254 | } else if (!$scope.remito.cotizacion.ID) { | 254 | } else if (!$scope.remito.cotizacion.ID) { |
255 | focaModalService.alert('Ingrese Cotización'); | 255 | focaModalService.alert('Ingrese Cotización'); |
256 | return; | 256 | return; |
257 | } else if ( | 257 | } else if ( |
258 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 258 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
259 | { | 259 | { |
260 | focaModalService.alert('Ingrese Flete'); | 260 | focaModalService.alert('Ingrese Flete'); |
261 | return; | 261 | return; |
262 | } else if ($scope.remito.articulosRemito.length === 0) { | 262 | } else if ($scope.remito.articulosRemito.length === 0) { |
263 | focaModalService.alert('Debe cargar al menos un articulo'); | 263 | focaModalService.alert('Debe cargar al menos un articulo'); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | focaBotoneraLateralService.startGuardar(); | 266 | focaBotoneraLateralService.startGuardar(); |
267 | $scope.saveLoading = true; | 267 | $scope.saveLoading = true; |
268 | var save = { | 268 | var save = { |
269 | remito: { | 269 | remito: { |
270 | id: $scope.remito.id, | 270 | id: $scope.remito.id, |
271 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 271 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
272 | idCliente: $scope.remito.cliente.COD, | 272 | idCliente: $scope.remito.cliente.COD, |
273 | nombreCliente: $scope.remito.cliente.NOM, | 273 | nombreCliente: $scope.remito.cliente.NOM, |
274 | cuitCliente: $scope.remito.cliente.CUIT, | 274 | cuitCliente: $scope.remito.cliente.CUIT, |
275 | responsabilidadIvaCliente: 0,//TODO, | 275 | responsabilidadIvaCliente: 0,//TODO, |
276 | descuento: 0,//TODO, | 276 | descuento: 0,//TODO, |
277 | importeNeto: 0,//TODO | 277 | importeNeto: 0,//TODO |
278 | importeExento: 0,//TODO | 278 | importeExento: 0,//TODO |
279 | importeIva: 0,//TODO | 279 | importeIva: 0,//TODO |
280 | importeIvaServicios: 0,//TODO | 280 | importeIvaServicios: 0,//TODO |
281 | importeImpuestoInterno: 0,//TODO | 281 | importeImpuestoInterno: 0,//TODO |
282 | importeImpuestoInterno1: 0,//TODO | 282 | importeImpuestoInterno1: 0,//TODO |
283 | importeImpuestoInterno2: 0,//TODO | 283 | importeImpuestoInterno2: 0,//TODO |
284 | percepcion: 0,//TODO | 284 | percepcion: 0,//TODO |
285 | percepcionIva: 0,//TODO | 285 | percepcionIva: 0,//TODO |
286 | redondeo: 0,//TODO | 286 | redondeo: 0,//TODO |
287 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 287 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
288 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 288 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
289 | anulado: false, | 289 | anulado: false, |
290 | planilla: 0,//TODO | 290 | planilla: 0,//TODO |
291 | lugar: 0,//TODO | 291 | lugar: 0,//TODO |
292 | cuentaMadre: 0,// | 292 | cuentaMadre: 0,// |
293 | cuentaContable: 0,//TODO | 293 | cuentaContable: 0,//TODO |
294 | asiento: 0,//TODO | 294 | asiento: 0,//TODO |
295 | e_hd: '',//TODO | 295 | e_hd: '',//TODO |
296 | c_hd: '', | 296 | c_hd: '', |
297 | numeroLiquidoProducto: 0,//TODO | 297 | numeroLiquidoProducto: 0,//TODO |
298 | idVendedor: $scope.remito.idVendedor, | 298 | idVendedor: $scope.remito.idVendedor, |
299 | idProveedor: $scope.remito.idProveedor, | 299 | idProveedor: $scope.remito.idProveedor, |
300 | idDomicilio: $scope.remito.idDomicilio, | 300 | idDomicilio: $scope.remito.idDomicilio, |
301 | idCotizacion: $scope.remito.cotizacion.ID, | 301 | idCotizacion: $scope.remito.cotizacion.ID, |
302 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 302 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
303 | flete: $scope.remito.flete, | 303 | flete: $scope.remito.flete, |
304 | fob: $scope.remito.fob, | 304 | fob: $scope.remito.fob, |
305 | bomba: $scope.remito.bomba, | 305 | bomba: $scope.remito.bomba, |
306 | kilometros: $scope.remito.kilometros, | 306 | kilometros: $scope.remito.kilometros, |
307 | domicilioStamp: $scope.remito.domicilioStamp, | 307 | domicilioStamp: $scope.remito.domicilioStamp, |
308 | estado: 0,//TODO | 308 | estado: 0,//TODO |
309 | destinoVenta: 0,//TODO | 309 | destinoVenta: 0,//TODO |
310 | operacionTipo: 0//TODO | 310 | operacionTipo: 0//TODO |
311 | }, | 311 | }, |
312 | notaPedido: $scope.notaPedido | 312 | notaPedido: $scope.notaPedido |
313 | }; | 313 | }; |
314 | 314 | ||
315 | crearRemitoService.crearRemito(save).then( | 315 | crearRemitoService.crearRemito(save).then( |
316 | function(data) { | 316 | function(data) { |
317 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | 317 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
318 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 318 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
319 | 319 | ||
320 | focaBotoneraLateralService.endGuardar(true); | 320 | focaBotoneraLateralService.endGuardar(true); |
321 | $scope.saveLoading = false; | 321 | $scope.saveLoading = false; |
322 | 322 | ||
323 | //TODO: updatear plazos | 323 | //TODO: updatear plazos |
324 | if($scope.remito.id === 0) { | 324 | if ($scope.remito.id === 0) { |
325 | var plazos = $scope.remito.remitoPlazo; | 325 | var plazos = $scope.remito.remitoPlazo; |
326 | 326 | ||
327 | for(var j = 0; j < plazos.length; j++) { | 327 | for(var j = 0; j < plazos.length; j++) { |
328 | var json = { | 328 | var json = { |
329 | idRemito: $scope.remito.id, | 329 | idRemito: $scope.remito.id, |
330 | dias: plazos[j].dias | 330 | dias: plazos[j].dias |
331 | }; | 331 | }; |
332 | crearRemitoService.crearPlazosParaRemito(json); | 332 | crearRemitoService.crearPlazosParaRemito(json); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | abrirModalMail(data.data.id, $scope.remito.cliente, $filter('comprobante')([ | |
336 | $uibModal.open({ | 336 | data.data.sucursal, |
337 | templateUrl: 'remito-comprobante.html', | 337 | data.data.numero |
338 | controller: 'focaRemitoComprobanteController', | 338 | ])); |
339 | resolve: { | ||
340 | parametros: { | ||
341 | idRemito: data.data.id | ||
342 | } | ||
343 | } | ||
344 | }); | ||
345 | 339 | ||
346 | init(); | 340 | init(); |
347 | 341 | ||
348 | }, function(error) { | 342 | }, function(error) { |
349 | focaModalService.alert('Hubo un error al crear el remito'); | 343 | focaModalService.alert('Hubo un error al crear el remito'); |
350 | focaBotoneraLateralService.endGuardar(); | 344 | focaBotoneraLateralService.endGuardar(); |
351 | $scope.saveLoading = false; | 345 | $scope.saveLoading = false; |
352 | console.info(error); | 346 | console.info(error); |
353 | } | 347 | } |
354 | ); | 348 | ); |
355 | }; | 349 | }; |
356 | 350 | ||
357 | $scope.seleccionarProductos = function() { | 351 | $scope.seleccionarProductos = function() { |
358 | if($scope.idLista === undefined) { | 352 | if ($scope.idLista === undefined) { |
359 | focaModalService.alert( | 353 | focaModalService.alert( |
360 | 'Primero seleccione una lista de precio y condicion'); | 354 | 'Primero seleccione una lista de precio y condicion'); |
361 | return; | 355 | return; |
362 | } | 356 | } |
363 | var modalInstance = $uibModal.open( | 357 | var modalInstance = $uibModal.open( |
364 | { | 358 | { |
365 | ariaLabelledBy: 'Busqueda de Productos', | 359 | ariaLabelledBy: 'Busqueda de Productos', |
366 | templateUrl: 'modal-busqueda-productos.html', | 360 | templateUrl: 'modal-busqueda-productos.html', |
367 | controller: 'modalBusquedaProductosCtrl', | 361 | controller: 'modalBusquedaProductosCtrl', |
368 | resolve: { | 362 | resolve: { |
369 | parametroProducto: { | 363 | parametroProducto: { |
370 | idLista: $scope.idLista, | 364 | idLista: $scope.idLista, |
371 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 365 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
372 | simbolo: $scope.remito.cotizacion.moneda.simbolo | 366 | simbolo: $scope.remito.cotizacion.moneda.simbolo |
373 | } | 367 | } |
374 | }, | 368 | }, |
375 | size: 'lg' | 369 | size: 'lg' |
376 | } | 370 | } |
377 | ); | 371 | ); |
378 | modalInstance.result.then( | 372 | modalInstance.result.then( |
379 | function(producto) { | 373 | function(producto) { |
380 | var newArt = | 374 | var newArt = |
381 | { | 375 | { |
382 | id: 0, | 376 | id: 0, |
383 | codigo: producto.codigo, | 377 | codigo: producto.codigo, |
384 | sector: producto.sector, | 378 | sector: producto.sector, |
385 | sectorCodigo: producto.sector + '-' + producto.codigo, | 379 | sectorCodigo: producto.sector + '-' + producto.codigo, |
386 | descripcion: producto.descripcion, | 380 | descripcion: producto.descripcion, |
387 | item: $scope.remito.articulosRemito.length + 1, | 381 | item: $scope.remito.articulosRemito.length + 1, |
388 | nombre: producto.descripcion, | 382 | nombre: producto.descripcion, |
389 | precio: parseFloat(producto.precio.toFixed(4)), | 383 | precio: parseFloat(producto.precio.toFixed(4)), |
390 | costoUnitario: producto.costo, | 384 | costoUnitario: producto.costo, |
391 | editCantidad: false, | 385 | editCantidad: false, |
392 | editPrecio: false, | 386 | editPrecio: false, |
393 | rubro: producto.CodRub, | 387 | rubro: producto.CodRub, |
394 | exentoUnitario: producto.precio, | 388 | exentoUnitario: producto.precio, |
395 | ivaUnitario: producto.IMPIVA, | 389 | ivaUnitario: producto.IMPIVA, |
396 | impuestoInternoUnitario: producto.ImpInt, | 390 | impuestoInternoUnitario: producto.ImpInt, |
397 | impuestoInterno1Unitario: producto.ImpInt2, | 391 | impuestoInterno1Unitario: producto.ImpInt2, |
398 | impuestoInterno2Unitario: producto.ImpInt3, | 392 | impuestoInterno2Unitario: producto.ImpInt3, |
399 | precioLista: producto.precio, | 393 | precioLista: producto.precio, |
400 | combustible: 1, | 394 | combustible: 1, |
401 | facturado: 0 | 395 | facturado: 0 |
402 | }; | 396 | }; |
403 | $scope.articuloACargar = newArt; | 397 | $scope.articuloACargar = newArt; |
404 | $scope.cargando = false; | 398 | $scope.cargando = false; |
405 | }, function() { | 399 | }, function() { |
406 | // funcion ejecutada cuando se cancela el modal | 400 | // funcion ejecutada cuando se cancela el modal |
407 | } | 401 | } |
408 | ); | 402 | ); |
409 | }; | 403 | }; |
410 | 404 | ||
411 | $scope.seleccionarPuntosDeDescarga = function() { | 405 | $scope.seleccionarPuntosDeDescarga = function() { |
412 | if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 406 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { |
413 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 407 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
414 | return; | 408 | return; |
415 | }else { | 409 | }else { |
416 | var modalInstance = $uibModal.open( | 410 | var modalInstance = $uibModal.open( |
417 | { | 411 | { |
418 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 412 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
419 | templateUrl: 'modal-punto-descarga.html', | 413 | templateUrl: 'modal-punto-descarga.html', |
420 | controller: 'focaModalPuntoDescargaController', | 414 | controller: 'focaModalPuntoDescargaController', |
421 | size: 'lg', | 415 | size: 'lg', |
422 | resolve: { | 416 | resolve: { |
423 | filters: { | 417 | filters: { |
424 | idDomicilio: $scope.remito.domicilio.id, | 418 | idDomicilio: $scope.remito.domicilio.id, |
425 | idCliente: $scope.remito.cliente.COD, | 419 | idCliente: $scope.remito.cliente.COD, |
426 | articulos: $scope.remito.articulosRemito, | 420 | articulos: $scope.remito.articulosRemito, |
427 | puntosDescarga: $scope.remito.domicilio.puntosDescarga | 421 | puntosDescarga: $scope.remito.domicilio.puntosDescarga |
428 | } | 422 | } |
429 | } | 423 | } |
430 | } | 424 | } |
431 | ); | 425 | ); |
432 | modalInstance.result.then( | 426 | modalInstance.result.then( |
433 | function(puntosDescarga) { | 427 | function(puntosDescarga) { |
434 | $scope.remito.puntosDescarga = puntosDescarga; | 428 | $scope.remito.puntosDescarga = puntosDescarga; |
435 | 429 | ||
436 | //AGREGO PUNTOS DE DESCARGA A CABECERA | 430 | //AGREGO PUNTOS DE DESCARGA A CABECERA |
437 | var puntosStamp = ''; | 431 | var puntosStamp = ''; |
438 | puntosDescarga.forEach(function(punto, idx, arr) { | 432 | puntosDescarga.forEach(function(punto, idx, arr) { |
439 | puntosStamp += punto.descripcion; | 433 | puntosStamp += punto.descripcion; |
440 | if((idx + 1) !== arr.length) puntosStamp += ', '; | 434 | if ((idx + 1) !== arr.length) puntosStamp += ', '; |
441 | }); | 435 | }); |
442 | 436 | ||
443 | $scope.$broadcast('addCabecera', { | 437 | $scope.$broadcast('addCabecera', { |
444 | label: 'Puntos de descarga:', | 438 | label: 'Puntos de descarga:', |
445 | valor: puntosStamp | 439 | valor: puntosStamp |
446 | }); | 440 | }); |
447 | }, function() { | 441 | }, function() { |
448 | $scope.abrirModalDomicilios($scope.cliente); | 442 | $scope.abrirModalDomicilios($scope.cliente); |
449 | } | 443 | } |
450 | ); | 444 | ); |
451 | } | 445 | } |
452 | }; | 446 | }; |
453 | 447 | ||
454 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { | 448 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { |
455 | if (ocultarVendedor) { | 449 | if (ocultarVendedor) { |
456 | callback(); | 450 | callback(); |
457 | return; | 451 | return; |
458 | } | 452 | } |
459 | 453 | ||
460 | if(varlidarRemitoFacturado()) { | 454 | if (varlidarRemitoFacturado()) { |
461 | var parametrosModal = { | 455 | var parametrosModal = { |
462 | titulo: 'Búsqueda vendedores', | 456 | titulo: 'Búsqueda vendedores', |
463 | query: '/vendedor', | 457 | query: '/vendedor', |
464 | columnas: [ | 458 | columnas: [ |
465 | { | 459 | { |
466 | propiedad: 'NUM', | 460 | propiedad: 'NUM', |
467 | nombre: 'Código', | 461 | nombre: 'Código', |
468 | filtro: { | 462 | filtro: { |
469 | nombre: 'rellenarDigitos', | 463 | nombre: 'rellenarDigitos', |
470 | parametro: 3 | 464 | parametro: 3 |
471 | } | 465 | } |
472 | }, | 466 | }, |
473 | { | 467 | { |
474 | propiedad: 'NOM', | 468 | propiedad: 'NOM', |
475 | nombre: 'Nombre' | 469 | nombre: 'Nombre' |
476 | } | 470 | } |
477 | ], | 471 | ], |
478 | size: 'md' | 472 | size: 'md' |
479 | }; | 473 | }; |
480 | focaModalService.modal(parametrosModal).then( | 474 | focaModalService.modal(parametrosModal).then( |
481 | function(vendedor) { | 475 | function(vendedor) { |
482 | $scope.$broadcast('addCabecera',{ | 476 | $scope.$broadcast('addCabecera',{ |
483 | label: 'Vendedor:', | 477 | label: 'Vendedor:', |
484 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 478 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
485 | vendedor.NOM | 479 | vendedor.NOM |
486 | }); | 480 | }); |
487 | $scope.remito.idVendedor = vendedor.id; | 481 | $scope.remito.idVendedor = vendedor.id; |
488 | $scope.remito.vendedor = vendedor; | 482 | $scope.remito.vendedor = vendedor; |
489 | deleteCliente(); | 483 | deleteCliente(); |
490 | callback(); | 484 | callback(); |
491 | }, function() { | 485 | }, function() { |
492 | 486 | ||
493 | } | 487 | } |
494 | ); | 488 | ); |
495 | } | 489 | } |
496 | }; | 490 | }; |
497 | 491 | ||
498 | $scope.seleccionarCliente = function(ocultarVendedor) { | 492 | $scope.seleccionarCliente = function(ocultarVendedor) { |
499 | 493 | ||
500 | $scope.seleccionarVendedor(function() { | 494 | $scope.seleccionarVendedor(function() { |
501 | if (varlidarRemitoFacturado()) { | 495 | if (varlidarRemitoFacturado()) { |
502 | var modalInstance = $uibModal.open( | 496 | var modalInstance = $uibModal.open( |
503 | { | 497 | { |
504 | ariaLabelledBy: 'Busqueda de Cliente', | 498 | ariaLabelledBy: 'Busqueda de Cliente', |
505 | templateUrl: 'foca-busqueda-cliente-modal.html', | 499 | templateUrl: 'foca-busqueda-cliente-modal.html', |
506 | controller: 'focaBusquedaClienteModalController', | 500 | controller: 'focaBusquedaClienteModalController', |
507 | resolve: { | 501 | resolve: { |
508 | vendedor: function() { return $scope.remito.vendedor; }, | 502 | vendedor: function() { return $scope.remito.vendedor; }, |
509 | cobrador: function() { return null; } | 503 | cobrador: function() { return null; } |
510 | }, | 504 | }, |
511 | size: 'lg' | 505 | size: 'lg' |
512 | } | 506 | } |
513 | ); | 507 | ); |
514 | modalInstance.result.then( | 508 | modalInstance.result.then( |
515 | function(cliente) { | 509 | function(cliente) { |
516 | $scope.abrirModalDomicilios(cliente); | 510 | $scope.abrirModalDomicilios(cliente); |
517 | $scope.cliente = cliente; | 511 | $scope.cliente = cliente; |
518 | }, function() { | 512 | }, function() { |
519 | $scope.seleccionarCliente(); | 513 | $scope.seleccionarCliente(); |
520 | } | 514 | } |
521 | ); | 515 | ); |
522 | } | 516 | } |
523 | }, ocultarVendedor); | 517 | }, ocultarVendedor); |
524 | }; | 518 | }; |
525 | 519 | ||
526 | $scope.seleccionarProveedor = function(callback) { | 520 | $scope.seleccionarProveedor = function(callback) { |
527 | if(varlidarRemitoFacturado()) { | 521 | if (varlidarRemitoFacturado()) { |
528 | var parametrosModal = { | 522 | var parametrosModal = { |
529 | titulo: 'Búsqueda de Proveedor', | 523 | titulo: 'Búsqueda de Proveedor', |
530 | query: '/proveedor', | 524 | query: '/proveedor', |
531 | columnas: [ | 525 | columnas: [ |
532 | { | 526 | { |
533 | nombre: 'Código', | 527 | nombre: 'Código', |
534 | propiedad: 'COD', | 528 | propiedad: 'COD', |
535 | filtro: { | 529 | filtro: { |
536 | nombre: 'rellenarDigitos', | 530 | nombre: 'rellenarDigitos', |
537 | parametro: 5 | 531 | parametro: 5 |
538 | } | 532 | } |
539 | }, | 533 | }, |
540 | { | 534 | { |
541 | nombre: 'Nombre', | 535 | nombre: 'Nombre', |
542 | propiedad: 'NOM' | 536 | propiedad: 'NOM' |
543 | }, | 537 | }, |
544 | { | 538 | { |
545 | nombre: 'CUIT', | 539 | nombre: 'CUIT', |
546 | propiedad: 'CUIT' | 540 | propiedad: 'CUIT' |
547 | } | 541 | } |
548 | ], | 542 | ], |
549 | tipo: 'POST', | 543 | tipo: 'POST', |
550 | json: {razonCuitCod: ''} | 544 | json: {razonCuitCod: ''} |
551 | }; | 545 | }; |
552 | focaModalService.modal(parametrosModal).then( | 546 | focaModalService.modal(parametrosModal).then( |
553 | function(proveedor) { | 547 | function(proveedor) { |
554 | $scope.remito.proveedor = proveedor; | 548 | $scope.remito.proveedor = proveedor; |
555 | $scope.remito.idProveedor = proveedor.COD; | 549 | $scope.remito.idProveedor = proveedor.COD; |
556 | 550 | ||
557 | $scope.$broadcast('addCabecera',{ | 551 | $scope.$broadcast('addCabecera',{ |
558 | label: 'Proveedor:', | 552 | label: 'Proveedor:', |
559 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 553 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
560 | proveedor.NOM | 554 | proveedor.NOM |
561 | }); | 555 | }); |
562 | callback(); | 556 | callback(); |
563 | }, function() { } | 557 | }, function() { } |
564 | ); | 558 | ); |
565 | } | 559 | } |
566 | }; | 560 | }; |
567 | 561 | ||
568 | $scope.abrirModalDomicilios = function(cliente) { | 562 | $scope.abrirModalDomicilios = function(cliente) { |
569 | var modalInstanceDomicilio = $uibModal.open( | 563 | var modalInstanceDomicilio = $uibModal.open( |
570 | { | 564 | { |
571 | ariaLabelledBy: 'Busqueda de Domicilios', | 565 | ariaLabelledBy: 'Busqueda de Domicilios', |
572 | templateUrl: 'modal-domicilio.html', | 566 | templateUrl: 'modal-domicilio.html', |
573 | controller: 'focaModalDomicilioController', | 567 | controller: 'focaModalDomicilioController', |
574 | size: 'lg', | 568 | size: 'lg', |
575 | resolve: { | 569 | resolve: { |
576 | idCliente: function() { return cliente.cod; }, | 570 | idCliente: function() { return cliente.cod; }, |
577 | esNuevo: function() { return cliente.esNuevo; } | 571 | esNuevo: function() { return cliente.esNuevo; } |
578 | } | 572 | } |
579 | } | 573 | } |
580 | ); | 574 | ); |
581 | modalInstanceDomicilio.result.then( | 575 | modalInstanceDomicilio.result.then( |
582 | function(domicilio) { | 576 | function(domicilio) { |
583 | $scope.remito.domicilio = domicilio; | 577 | $scope.remito.domicilio = domicilio; |
584 | $scope.remito.cliente = { | 578 | $scope.remito.cliente = { |
585 | COD: cliente.cod, | 579 | COD: cliente.cod, |
586 | CUIT: cliente.cuit, | 580 | CUIT: cliente.cuit, |
587 | NOM: cliente.nom, | 581 | NOM: cliente.nom, |
588 | MAIL: cliente.mail, | 582 | MAIL: cliente.mail, |
589 | MOD: cliente.mod | 583 | MOD: cliente.mod |
590 | }; | 584 | }; |
591 | 585 | ||
592 | 586 | ||
593 | var domicilioStamp = | 587 | var domicilioStamp = |
594 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 588 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
595 | domicilio.Localidad + ', ' + domicilio.Provincia; | 589 | domicilio.Localidad + ', ' + domicilio.Provincia; |
596 | $scope.remito.domicilioStamp = domicilioStamp; | 590 | $scope.remito.domicilioStamp = domicilioStamp; |
597 | 591 | ||
598 | $scope.$broadcast('addCabecera',{ | 592 | $scope.$broadcast('addCabecera',{ |
599 | label: 'Cliente:', | 593 | label: 'Cliente:', |
600 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 594 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
601 | }); | 595 | }); |
602 | $scope.$broadcast('addCabecera',{ | 596 | $scope.$broadcast('addCabecera',{ |
603 | label: 'Domicilio:', | 597 | label: 'Domicilio:', |
604 | valor: domicilioStamp | 598 | valor: domicilioStamp |
605 | }); | 599 | }); |
606 | 600 | ||
607 | if(domicilio.verPuntos) { | 601 | if (domicilio.verPuntos) { |
608 | delete $scope.remito.domicilio.verPuntos; | 602 | delete $scope.remito.domicilio.verPuntos; |
609 | $scope.seleccionarPuntosDeDescarga(); | 603 | $scope.seleccionarPuntosDeDescarga(); |
610 | }else { | 604 | }else { |
611 | crearRemitoService | 605 | crearRemitoService |
612 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 606 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
613 | .then(function(res) { | 607 | .then(function(res) { |
614 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); | 608 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); |
615 | }); | 609 | }); |
616 | } | 610 | } |
617 | }, function() { | 611 | }, function() { |
618 | $scope.seleccionarCliente(true); | 612 | $scope.seleccionarCliente(true); |
619 | return; | 613 | return; |
620 | } | 614 | } |
621 | ); | 615 | ); |
622 | }; | 616 | }; |
623 | 617 | ||
624 | $scope.mostrarFichaCliente = function() { | 618 | $scope.mostrarFichaCliente = function() { |
625 | $uibModal.open( | 619 | $uibModal.open( |
626 | { | 620 | { |
627 | ariaLabelledBy: 'Datos del Cliente', | 621 | ariaLabelledBy: 'Datos del Cliente', |
628 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 622 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
629 | controller: 'focaCrearRemitoFichaClienteController', | 623 | controller: 'focaCrearRemitoFichaClienteController', |
630 | size: 'lg' | 624 | size: 'lg' |
631 | } | 625 | } |
632 | ); | 626 | ); |
633 | }; | 627 | }; |
634 | 628 | ||
635 | $scope.getTotal = function() { | 629 | $scope.getTotal = function() { |
636 | var total = 0; | 630 | var total = 0; |
637 | var arrayTempArticulos = $scope.remito.articulosRemito; | 631 | var arrayTempArticulos = $scope.remito.articulosRemito; |
638 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 632 | for(var i = 0; i < arrayTempArticulos.length; i++) { |
639 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 633 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
640 | } | 634 | } |
641 | return parseFloat(total.toFixed(2)); | 635 | return parseFloat(total.toFixed(2)); |
642 | }; | 636 | }; |
643 | 637 | ||
644 | $scope.getSubTotal = function() { | 638 | $scope.getSubTotal = function() { |
645 | if($scope.articuloACargar) { | 639 | if ($scope.articuloACargar) { |
646 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 640 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
647 | } | 641 | } |
648 | }; | 642 | }; |
649 | 643 | ||
650 | $scope.seleccionarPreciosYCondiciones = function() { | 644 | $scope.seleccionarPreciosYCondiciones = function() { |
651 | if (!$scope.remito.cliente.COD) { | 645 | if (!$scope.remito.cliente.COD) { |
652 | focaModalService.alert('Primero seleccione un cliente'); | 646 | focaModalService.alert('Primero seleccione un cliente'); |
653 | return; | 647 | return; |
654 | } | 648 | } |
655 | if(varlidarRemitoFacturado()) { | 649 | if (varlidarRemitoFacturado()) { |
656 | var modalInstance = $uibModal.open( | 650 | var modalInstance = $uibModal.open( |
657 | { | 651 | { |
658 | ariaLabelledBy: 'Busqueda de Precio Condición', | 652 | ariaLabelledBy: 'Busqueda de Precio Condición', |
659 | templateUrl: 'modal-precio-condicion.html', | 653 | templateUrl: 'modal-precio-condicion.html', |
660 | controller: 'focaModalPrecioCondicionController', | 654 | controller: 'focaModalPrecioCondicionController', |
661 | size: 'lg', | 655 | size: 'lg', |
662 | resolve: { | 656 | resolve: { |
663 | idListaPrecio: function() { | 657 | idListaPrecio: function() { |
664 | return $scope.remito.cliente.MOD || null; | 658 | return $scope.remito.cliente.MOD || null; |
665 | } | 659 | } |
666 | } | 660 | } |
667 | } | 661 | } |
668 | ); | 662 | ); |
669 | modalInstance.result.then( | 663 | modalInstance.result.then( |
670 | function(precioCondicion) { | 664 | function(precioCondicion) { |
671 | var cabecera = ''; | 665 | var cabecera = ''; |
672 | var plazosConcat = ''; | 666 | var plazosConcat = ''; |
673 | if(!Array.isArray(precioCondicion)) { | 667 | if (!Array.isArray(precioCondicion)) { |
674 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 668 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
675 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 669 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
676 | $scope.idLista = precioCondicion.idListaPrecio; | 670 | $scope.idLista = precioCondicion.idListaPrecio; |
677 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 671 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
678 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 672 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
679 | } | 673 | } |
680 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 674 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
681 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 675 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
682 | }else { //Cuando se ingresan los plazos manualmente | 676 | }else { //Cuando se ingresan los plazos manualmente |
683 | $scope.remito.idPrecioCondicion = 0; | 677 | $scope.remito.idPrecioCondicion = 0; |
684 | //-1, el modal productos busca todos los productos | 678 | //-1, el modal productos busca todos los productos |
685 | $scope.idLista = -1; | 679 | $scope.idLista = -1; |
686 | $scope.remito.remitoPlazo = precioCondicion; | 680 | $scope.remito.remitoPlazo = precioCondicion; |
687 | for(var j = 0; j < precioCondicion.length; j++) { | 681 | for(var j = 0; j < precioCondicion.length; j++) { |
688 | plazosConcat += precioCondicion[j].dias + ' '; | 682 | plazosConcat += precioCondicion[j].dias + ' '; |
689 | } | 683 | } |
690 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 684 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
691 | } | 685 | } |
692 | $scope.remito.articulosRemito = []; | 686 | $scope.remito.articulosRemito = []; |
693 | $scope.$broadcast('addCabecera',{ | 687 | $scope.$broadcast('addCabecera',{ |
694 | label: 'Precios y condiciones:', | 688 | label: 'Precios y condiciones:', |
695 | valor: cabecera | 689 | valor: cabecera |
696 | }); | 690 | }); |
697 | 691 | ||
698 | $scope.remito.precioCondicion = precioCondicion; | 692 | $scope.remito.precioCondicion = precioCondicion; |
699 | }, function() { | 693 | }, function() { |
700 | 694 | ||
701 | } | 695 | } |
702 | ); | 696 | ); |
703 | } | 697 | } |
704 | }; | 698 | }; |
705 | 699 | ||
706 | $scope.seleccionarTransportista = function() { | 700 | $scope.seleccionarTransportista = function() { |
707 | $scope.seleccionarProveedor(function() { | 701 | $scope.seleccionarProveedor(function() { |
708 | if (varlidarRemitoFacturado()) { | 702 | if (varlidarRemitoFacturado()) { |
709 | var modalInstance = $uibModal.open( | 703 | var modalInstance = $uibModal.open( |
710 | { | 704 | { |
711 | ariaLabelledBy: 'Busqueda de Flete', | 705 | ariaLabelledBy: 'Busqueda de Flete', |
712 | templateUrl: 'modal-flete.html', | 706 | templateUrl: 'modal-flete.html', |
713 | controller: 'focaModalFleteController', | 707 | controller: 'focaModalFleteController', |
714 | size: 'lg', | 708 | size: 'lg', |
715 | resolve: { | 709 | resolve: { |
716 | parametrosFlete: | 710 | parametrosFlete: |
717 | function() { | 711 | function() { |
718 | return { | 712 | return { |
719 | flete: $scope.remito.flete ? '1' : | 713 | flete: $scope.remito.flete ? '1' : |
720 | ($scope.remito.fob ? 'FOB' : | 714 | ($scope.remito.fob ? 'FOB' : |
721 | ($scope.remito.flete === undefined ? | 715 | ($scope.remito.flete === undefined ? |
722 | null : '0')), | 716 | null : '0')), |
723 | bomba: $scope.remito.bomba ? '1' : | 717 | bomba: $scope.remito.bomba ? '1' : |
724 | ($scope.remito.bomba === undefined ? | 718 | ($scope.remito.bomba === undefined ? |
725 | null : '0'), | 719 | null : '0'), |
726 | kilometros: $scope.remito.kilometros | 720 | kilometros: $scope.remito.kilometros |
727 | }; | 721 | }; |
728 | } | 722 | } |
729 | } | 723 | } |
730 | } | 724 | } |
731 | ); | 725 | ); |
732 | modalInstance.result.then( | 726 | modalInstance.result.then( |
733 | function(datos) { | 727 | function(datos) { |
734 | $scope.remito.flete = datos.flete; | 728 | $scope.remito.flete = datos.flete; |
735 | $scope.remito.fob = datos.FOB; | 729 | $scope.remito.fob = datos.FOB; |
736 | $scope.remito.bomba = datos.bomba; | 730 | $scope.remito.bomba = datos.bomba; |
737 | $scope.remito.kilometros = datos.kilometros; | 731 | $scope.remito.kilometros = datos.kilometros; |
738 | 732 | ||
739 | $scope.$broadcast('addCabecera',{ | 733 | $scope.$broadcast('addCabecera',{ |
740 | label: 'Flete:', | 734 | label: 'Flete:', |
741 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 735 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') |
742 | }); | 736 | }); |
743 | if (datos.flete) { | 737 | if (datos.flete) { |
744 | $scope.$broadcast('addCabecera',{ | 738 | $scope.$broadcast('addCabecera',{ |
745 | label: 'Bomba:', | 739 | label: 'Bomba:', |
746 | valor: datos.bomba ? 'Si' : 'No' | 740 | valor: datos.bomba ? 'Si' : 'No' |
747 | }); | 741 | }); |
748 | $scope.$broadcast('addCabecera',{ | 742 | $scope.$broadcast('addCabecera',{ |
749 | label: 'Kilometros:', | 743 | label: 'Kilometros:', |
750 | valor: datos.kilometros | 744 | valor: datos.kilometros |
751 | }); | 745 | }); |
752 | } else { | 746 | } else { |
753 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 747 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
754 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 748 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
755 | $scope.remito.fob = false; | 749 | $scope.remito.fob = false; |
756 | $scope.remito.bomba = false; | 750 | $scope.remito.bomba = false; |
757 | $scope.remito.kilometros = null; | 751 | $scope.remito.kilometros = null; |
758 | } | 752 | } |
759 | }, function() { | 753 | }, function() { |
760 | $scope.seleccionarTransportista(); | 754 | $scope.seleccionarTransportista(); |
761 | } | 755 | } |
762 | ); | 756 | ); |
763 | } | 757 | } |
764 | }); | 758 | }); |
765 | }; | 759 | }; |
766 | 760 | ||
767 | $scope.seleccionarMoneda = function() { | 761 | $scope.seleccionarMoneda = function() { |
768 | if(varlidarRemitoFacturado()) { | 762 | if (varlidarRemitoFacturado()) { |
769 | var parametrosModal = { | 763 | var parametrosModal = { |
770 | titulo: 'Búsqueda de monedas', | 764 | titulo: 'Búsqueda de monedas', |
771 | query: '/moneda', | 765 | query: '/moneda', |
772 | columnas: [ | 766 | columnas: [ |
773 | { | 767 | { |
774 | propiedad: 'DETALLE', | 768 | propiedad: 'DETALLE', |
775 | nombre: 'Nombre' | 769 | nombre: 'Nombre' |
776 | }, | 770 | }, |
777 | { | 771 | { |
778 | propiedad: 'SIMBOLO', | 772 | propiedad: 'SIMBOLO', |
779 | nombre: 'Símbolo' | 773 | nombre: 'Símbolo' |
780 | } | 774 | } |
781 | ], | 775 | ], |
782 | size: 'md' | 776 | size: 'md' |
783 | }; | 777 | }; |
784 | focaModalService.modal(parametrosModal).then( | 778 | focaModalService.modal(parametrosModal).then( |
785 | function(moneda) { | 779 | function(moneda) { |
786 | $scope.abrirModalCotizacion(moneda); | 780 | $scope.abrirModalCotizacion(moneda); |
787 | }, function() { | 781 | }, function() { |
788 | 782 | ||
789 | } | 783 | } |
790 | ); | 784 | ); |
791 | } | 785 | } |
792 | }; | 786 | }; |
793 | 787 | ||
794 | $scope.seleccionarObservaciones = function() { | 788 | $scope.seleccionarObservaciones = function() { |
795 | focaModalService | 789 | focaModalService |
796 | .prompt({ | 790 | .prompt({ |
797 | titulo: 'Observaciones', | 791 | titulo: 'Observaciones', |
798 | value: $scope.remito.observaciones, | 792 | value: $scope.remito.observaciones, |
799 | textarea: true, | 793 | textarea: true, |
800 | readonly: true | 794 | readonly: true |
801 | }) | 795 | }) |
802 | .then(function(observaciones) { | 796 | .then(function(observaciones) { |
803 | $scope.remito.observaciones = observaciones; | 797 | $scope.remito.observaciones = observaciones; |
804 | }); | 798 | }); |
805 | }; | 799 | }; |
806 | 800 | ||
807 | $scope.abrirModalCotizacion = function(moneda) { | 801 | $scope.abrirModalCotizacion = function(moneda) { |
808 | var modalInstance = $uibModal.open( | 802 | var modalInstance = $uibModal.open( |
809 | { | 803 | { |
810 | ariaLabelledBy: 'Busqueda de Cotización', | 804 | ariaLabelledBy: 'Busqueda de Cotización', |
811 | templateUrl: 'modal-cotizacion.html', | 805 | templateUrl: 'modal-cotizacion.html', |
812 | controller: 'focaModalCotizacionController', | 806 | controller: 'focaModalCotizacionController', |
813 | size: 'lg', | 807 | size: 'lg', |
814 | resolve: {idMoneda: function() {return moneda.ID;}} | 808 | resolve: {idMoneda: function() {return moneda.ID;}} |
815 | } | 809 | } |
816 | ); | 810 | ); |
817 | modalInstance.result.then( | 811 | modalInstance.result.then( |
818 | function(cotizacion) { | 812 | function(cotizacion) { |
819 | var articulosTablaTemp = $scope.remito.articulosRemito; | 813 | var articulosTablaTemp = $scope.remito.articulosRemito; |
820 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 814 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
821 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 815 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
822 | $scope.remito.cotizacion.COTIZACION; | 816 | $scope.remito.cotizacion.COTIZACION; |
823 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 817 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
824 | cotizacion.COTIZACION; | 818 | cotizacion.COTIZACION; |
825 | } | 819 | } |
826 | $scope.remito.articulosRemito = articulosTablaTemp; | 820 | $scope.remito.articulosRemito = articulosTablaTemp; |
827 | $scope.remito.cotizacion.moneda = moneda; | 821 | $scope.remito.cotizacion.moneda = moneda; |
828 | $scope.remito.cotizacion = cotizacion; | 822 | $scope.remito.cotizacion = cotizacion; |
829 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 823 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { |
830 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 824 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
831 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 825 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
832 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 826 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
833 | }else { | 827 | }else { |
834 | $scope.$broadcast('addCabecera',{ | 828 | $scope.$broadcast('addCabecera',{ |
835 | label: 'Moneda:', | 829 | label: 'Moneda:', |
836 | valor: moneda.DETALLE | 830 | valor: moneda.DETALLE |
837 | }); | 831 | }); |
838 | $scope.$broadcast('addCabecera',{ | 832 | $scope.$broadcast('addCabecera',{ |
839 | label: 'Fecha cotizacion:', | 833 | label: 'Fecha cotizacion:', |
840 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 834 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
841 | }); | 835 | }); |
842 | $scope.$broadcast('addCabecera',{ | 836 | $scope.$broadcast('addCabecera',{ |
843 | label: 'Cotizacion:', | 837 | label: 'Cotizacion:', |
844 | valor: $filter('number')(cotizacion.COTIZACION, '2') | 838 | valor: $filter('number')(cotizacion.COTIZACION, '2') |
845 | }); | 839 | }); |
846 | } | 840 | } |
847 | }, function() { | 841 | }, function() { |
848 | 842 | ||
849 | } | 843 | } |
850 | ); | 844 | ); |
851 | }; | 845 | }; |
852 | 846 | ||
853 | $scope.agregarATabla = function(key) { | 847 | $scope.agregarATabla = function(key) { |
854 | if(key === 13) { | 848 | if (key === 13) { |
855 | if($scope.articuloACargar.cantidad === undefined || | 849 | if ($scope.articuloACargar.cantidad === undefined || |
856 | $scope.articuloACargar.cantidad === 0 || | 850 | $scope.articuloACargar.cantidad === 0 || |
857 | $scope.articuloACargar.cantidad === null ) { | 851 | $scope.articuloACargar.cantidad === null ) { |
858 | focaModalService.alert('El valor debe ser al menos 1'); | 852 | focaModalService.alert('El valor debe ser al menos 1'); |
859 | return; | 853 | return; |
860 | } | 854 | } |
861 | delete $scope.articuloACargar.sectorCodigo; | 855 | delete $scope.articuloACargar.sectorCodigo; |
862 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 856 | $scope.remito.articulosRemito.push($scope.articuloACargar); |
863 | $scope.cargando = true; | 857 | $scope.cargando = true; |
864 | } | 858 | } |
865 | }; | 859 | }; |
866 | 860 | ||
867 | $scope.quitarArticulo = function(key) { | 861 | $scope.quitarArticulo = function(key) { |
868 | $scope.remito.articulosRemito.splice(key, 1); | 862 | $scope.remito.articulosRemito.splice(key, 1); |
869 | }; | 863 | }; |
870 | 864 | ||
871 | $scope.editarArticulo = function(key, articulo) { | 865 | $scope.editarArticulo = function(key, articulo) { |
872 | if (key === 13) { | 866 | if (key === 13) { |
873 | if (!articulo.cantidad || !articulo.precio) { | 867 | if (!articulo.cantidad || !articulo.precio) { |
874 | focaModalService.alert('Los valores deben ser al menos 1'); | 868 | focaModalService.alert('Los valores deben ser al menos 1'); |
875 | return; | 869 | return; |
876 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | 870 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
877 | focaModalService.alert('Los valores no pueden ser negativos'); | 871 | focaModalService.alert('Los valores no pueden ser negativos'); |
878 | return; | 872 | return; |
879 | } | 873 | } |
880 | articulo.editCantidad = articulo.editPrecio = false; | 874 | articulo.editCantidad = articulo.editPrecio = false; |
881 | } | 875 | } |
882 | }; | 876 | }; |
883 | 877 | ||
884 | $scope.cambioEdit = function(articulo, propiedad) { | 878 | $scope.cambioEdit = function(articulo, propiedad) { |
885 | if(propiedad === 'cantidad') { | 879 | if (propiedad === 'cantidad') { |
886 | articulo.editCantidad = true; | 880 | articulo.editCantidad = true; |
887 | }else if(propiedad === 'precio') { | 881 | } else if (propiedad === 'precio') { |
888 | articulo.editPrecio = true; | 882 | articulo.editPrecio = true; |
889 | } | 883 | } |
890 | }; | 884 | }; |
891 | 885 | ||
892 | $scope.limpiarFlete = function() { | 886 | $scope.limpiarFlete = function() { |
893 | $scope.remito.fleteNombre = ''; | 887 | $scope.remito.fleteNombre = ''; |
894 | $scope.remito.chofer = ''; | 888 | $scope.remito.chofer = ''; |
895 | $scope.remito.vehiculo = ''; | 889 | $scope.remito.vehiculo = ''; |
896 | $scope.remito.kilometros = ''; | 890 | $scope.remito.kilometros = ''; |
897 | $scope.remito.costoUnitarioKmFlete = ''; | 891 | $scope.remito.costoUnitarioKmFlete = ''; |
898 | $scope.choferes = ''; | 892 | $scope.choferes = ''; |
899 | $scope.vehiculos = ''; | 893 | $scope.vehiculos = ''; |
900 | }; | 894 | }; |
901 | 895 | ||
902 | $scope.limpiarPantalla = function() { | 896 | $scope.limpiarPantalla = function() { |
903 | $scope.limpiarFlete(); | 897 | $scope.limpiarFlete(); |
904 | $scope.remito.flete = '0'; | 898 | $scope.remito.flete = '0'; |
905 | $scope.remito.bomba = '0'; | 899 | $scope.remito.bomba = '0'; |
906 | $scope.remito.precioCondicion = ''; | 900 | $scope.remito.precioCondicion = ''; |
907 | $scope.remito.articulosRemito = []; | 901 | $scope.remito.articulosRemito = []; |
908 | $scope.remito.vendedor.nombre = ''; | 902 | $scope.remito.vendedor.nombre = ''; |
909 | $scope.remito.cliente = {nombre: ''}; | 903 | $scope.remito.cliente = {nombre: ''}; |
910 | $scope.remito.domicilio = {dom: ''}; | 904 | $scope.remito.domicilio = {dom: ''}; |
911 | $scope.domiciliosCliente = []; | 905 | $scope.domiciliosCliente = []; |
912 | }; | 906 | }; |
913 | 907 | ||
914 | $scope.resetFilter = function() { | 908 | $scope.resetFilter = function() { |
915 | $scope.articuloACargar = {}; | 909 | $scope.articuloACargar = {}; |
916 | $scope.cargando = true; | 910 | $scope.cargando = true; |
917 | }; | 911 | }; |
918 | //Recibe aviso si el teclado está en uso | 912 | //Recibe aviso si el teclado está en uso |
919 | $rootScope.$on('usarTeclado', function(event, data) { | 913 | $rootScope.$on('usarTeclado', function(event, data) { |
920 | if(data) { | 914 | if (data) { |
921 | $scope.mostrarTeclado = true; | 915 | $scope.mostrarTeclado = true; |
922 | return; | 916 | return; |
923 | } | 917 | } |
924 | $scope.mostrarTeclado = false; | 918 | $scope.mostrarTeclado = false; |
925 | }); | 919 | }); |
926 | 920 | ||
927 | $scope.selectFocus = function($event) { | 921 | $scope.selectFocus = function($event) { |
928 | // Si el teclado esta en uso no selecciona el valor | 922 | // Si el teclado esta en uso no selecciona el valor |
929 | if($scope.mostrarTeclado) { | 923 | if ($scope.mostrarTeclado) { |
930 | return; | 924 | return; |
931 | } | 925 | } |
932 | $event.target.select(); | 926 | $event.target.select(); |
933 | }; | 927 | }; |
934 | 928 | ||
935 | function addArrayCabecera(array) { | 929 | function addArrayCabecera(array) { |
936 | for(var i = 0; i < array.length; i++) { | 930 | for (var i = 0; i < array.length; i++) { |
937 | $scope.$broadcast('addCabecera',{ | 931 | $scope.$broadcast('addCabecera',{ |
938 | label: array[i].label, | 932 | label: array[i].label, |
939 | valor: array[i].valor | 933 | valor: array[i].valor |
940 | }); | 934 | }); |
941 | } | 935 | } |
942 | } | 936 | } |
943 | 937 | ||
944 | function rellenar(relleno, longitud) { | 938 | function rellenar(relleno, longitud) { |
945 | relleno = '' + relleno; | 939 | relleno = '' + relleno; |
946 | while (relleno.length < longitud) { | 940 | while (relleno.length < longitud) { |
947 | relleno = '0' + relleno; | 941 | relleno = '0' + relleno; |
948 | } | 942 | } |
949 | 943 | ||
950 | return relleno; | 944 | return relleno; |
951 | } | 945 | } |
952 | 946 | ||
953 | function varlidarRemitoFacturado() { | 947 | function varlidarRemitoFacturado() { |
954 | if($scope.remito.estado !== 5) { | 948 | if ($scope.remito.estado !== 5) { |
955 | return true; | 949 | return true; |
956 | }else { | 950 | } else { |
957 | focaModalService.alert('No se puede editar un remito facturado'); | 951 | focaModalService.alert('No se puede editar un remito facturado'); |
958 | return false(); | 952 | return false(); |
959 | } | 953 | } |
960 | } | 954 | } |
961 | 955 | ||
962 | function salir() { | 956 | function salir() { |
963 | var confirmacion = false; | 957 | var confirmacion = false; |
964 | 958 | ||
965 | if (!angular.equals($scope.remito, $scope.inicial)) { | 959 | if (!angular.equals($scope.remito, $scope.inicial)) { |
966 | confirmacion = true; | 960 | confirmacion = true; |
967 | } | 961 | } |
968 | 962 | ||
969 | if (confirmacion) { | 963 | if (confirmacion) { |
970 | focaModalService.confirm( | 964 | focaModalService.confirm( |
971 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 965 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
972 | ).then(function(data) { | 966 | ).then(function(data) { |
973 | if (data) { | 967 | if (data) { |
974 | $location.path('/'); | 968 | $location.path('/'); |
975 | } | 969 | } |
976 | }); | 970 | }); |
977 | } else { | 971 | } else { |
978 | $location.path('/'); | 972 | $location.path('/'); |
979 | } | 973 | } |
980 | } | 974 | } |
981 | 975 | ||
982 | function enableObservaciones(val) { | 976 | function enableObservaciones(val) { |
983 | var boton = $scope.botonera.filter(function(botonObs) { | 977 | var boton = $scope.botonera.filter(function(botonObs) { |
984 | return botonObs.label === 'Observaciones'; | 978 | return botonObs.label === 'Observaciones'; |
985 | }); | 979 | }); |
986 | 980 | ||
987 | boton[0].disable = !val; | 981 | boton[0].disable = !val; |
988 | } | 982 | } |
989 | 983 | ||
990 | function setearRemito(remito) { | 984 | function setearRemito(remito) { |
991 | //añado cabeceras | 985 | //añado cabeceras |
992 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 986 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
993 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 987 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
994 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 988 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
995 | 989 | ||
996 | var cabeceras = []; | 990 | var cabeceras = []; |
997 | 991 | ||
998 | if (remito.cotizacion.ID) { | 992 | if (remito.cotizacion.ID) { |
999 | cabeceras.push({ | 993 | cabeceras.push({ |
1000 | label: 'Moneda:', | 994 | label: 'Moneda:', |
1001 | valor: remito.cotizacion.moneda.DETALLE | 995 | valor: remito.cotizacion.moneda.DETALLE |
1002 | }); | 996 | }); |
1003 | cabeceras.push({ | 997 | cabeceras.push({ |
1004 | label: 'Fecha cotizacion:', | 998 | label: 'Fecha cotizacion:', |
1005 | valor: $filter('date')(remito.cotizacion.FECHA, | 999 | valor: $filter('date')(remito.cotizacion.FECHA, |
1006 | 'dd/MM/yyyy') | 1000 | 'dd/MM/yyyy') |
1007 | }); | 1001 | }); |
1008 | cabeceras.push({ | 1002 | cabeceras.push({ |
1009 | label: 'Cotizacion:', | 1003 | label: 'Cotizacion:', |
1010 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 1004 | valor: $filter('number')(remito.cotizacion.VENDEDOR, |
1011 | '2') | 1005 | '2') |
1012 | }); | 1006 | }); |
1013 | } | 1007 | } |
1014 | if (remito.cliente.COD) { | 1008 | if (remito.cliente.COD) { |
1015 | cabeceras.push({ | 1009 | cabeceras.push({ |
1016 | label: 'Cliente:', | 1010 | label: 'Cliente:', |
1017 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 1011 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
1018 | remito.cliente.NOM | 1012 | remito.cliente.NOM |
1019 | }); | 1013 | }); |
1020 | cabeceras.push({ | 1014 | cabeceras.push({ |
1021 | label: 'Domicilio:', | 1015 | label: 'Domicilio:', |
1022 | valor: remito.domicilioStamp | 1016 | valor: remito.domicilioStamp |
1023 | }); | 1017 | }); |
1024 | } | 1018 | } |
1025 | if (remito.vendedor.NUM) { | 1019 | if (remito.vendedor.NUM) { |
1026 | cabeceras.push({ | 1020 | cabeceras.push({ |
1027 | label: 'Vendedor:', | 1021 | label: 'Vendedor:', |
1028 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 1022 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
1029 | ' - ' + remito.vendedor.NOM | 1023 | ' - ' + remito.vendedor.NOM |
1030 | }); | 1024 | }); |
1031 | } | 1025 | } |
1032 | if (remito.proveedor.COD) { | 1026 | if (remito.proveedor.COD) { |
1033 | cabeceras.push({ | 1027 | cabeceras.push({ |
1034 | label: 'Proveedor:', | 1028 | label: 'Proveedor:', |
1035 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + | 1029 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + |
1036 | ' - ' + remito.proveedor.NOM | 1030 | ' - ' + remito.proveedor.NOM |
1037 | }); | 1031 | }); |
1038 | } | 1032 | } |
1039 | if (remito.flete !== undefined) { | 1033 | if (remito.flete !== undefined) { |
1040 | cabeceras.push({ | 1034 | cabeceras.push({ |
1041 | label: 'Flete:', | 1035 | label: 'Flete:', |
1042 | valor: remito.fob === 1 ? 'FOB' : ( | 1036 | valor: remito.fob === 1 ? 'FOB' : ( |
1043 | remito.flete === 1 ? 'Si' : 'No') | 1037 | remito.flete === 1 ? 'Si' : 'No') |
1044 | }); | 1038 | }); |
1045 | } | 1039 | } |
1046 | if (remito.remitoPlazo) { | 1040 | if (remito.remitoPlazo) { |
1047 | cabeceras.push({ | 1041 | cabeceras.push({ |
1048 | label: 'Precio condicion:', | 1042 | label: 'Precio condicion:', |
1049 | valor: valorPrecioCondicion() + ' ' + | 1043 | valor: valorPrecioCondicion() + ' ' + |
1050 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 1044 | remitoBusinessService.plazoToString(remito.remitoPlazo) |
1051 | }); | 1045 | }); |
1052 | } | 1046 | } |
1053 | 1047 | ||
1054 | function valorPrecioCondicion() { | 1048 | function valorPrecioCondicion() { |
1055 | if (remito.idPrecioCondicion > 0) { | 1049 | if (remito.idPrecioCondicion > 0) { |
1056 | return remito.precioCondicion.nombre; | 1050 | return remito.precioCondicion.nombre; |
1057 | } else { | 1051 | } else { |
1058 | return 'Ingreso Manual'; | 1052 | return 'Ingreso Manual'; |
1059 | } | 1053 | } |
1060 | } | 1054 | } |
1061 | 1055 | ||
1062 | if (remito.flete === 1) { | 1056 | if (remito.flete === 1) { |
1063 | var cabeceraBomba = { | 1057 | var cabeceraBomba = { |
1064 | label: 'Bomba', | 1058 | label: 'Bomba', |
1065 | valor: remito.bomba === 1 ? 'Si' : 'No' | 1059 | valor: remito.bomba === 1 ? 'Si' : 'No' |
1066 | }; | 1060 | }; |
1067 | if (remito.kilometros) { | 1061 | if (remito.kilometros) { |
1068 | var cabeceraKilometros = { | 1062 | var cabeceraKilometros = { |
1069 | label: 'Kilometros', | 1063 | label: 'Kilometros', |
1070 | valor: remito.kilometros | 1064 | valor: remito.kilometros |
1071 | }; | 1065 | }; |
1072 | cabeceras.push(cabeceraKilometros); | 1066 | cabeceras.push(cabeceraKilometros); |
1073 | } | 1067 | } |
1074 | cabeceras.push(cabeceraBomba); | 1068 | cabeceras.push(cabeceraBomba); |
1075 | } | 1069 | } |
1076 | $scope.remito.articulosRemito = remito.articulosRemito; | 1070 | $scope.remito.articulosRemito = remito.articulosRemito; |
1077 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 1071 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, |
1078 | remito.cotizacion.VENDEDOR); | 1072 | remito.cotizacion.VENDEDOR); |
1079 | if (remito.idPrecioCondicion > 0) { | 1073 | if (remito.idPrecioCondicion > 0) { |
1080 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 1074 | $scope.idLista = remito.precioCondicion.idListaPrecio; |
1081 | } else { | 1075 | } else { |
1082 | $scope.idLista = -1; | 1076 | $scope.idLista = -1; |
1083 | } | 1077 | } |
1084 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 1078 | $scope.puntoVenta = rellenar(remito.sucursal, 4); |
1085 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 1079 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
1086 | $scope.remito = remito; | 1080 | $scope.remito = remito; |
1087 | addArrayCabecera(cabeceras); | 1081 | addArrayCabecera(cabeceras); |
1088 | } | 1082 | } |
1089 | 1083 | ||
1090 | function getLSRemito() { | 1084 | function getLSRemito() { |
1091 | var remito = JSON.parse($localStorage.remito || null); | 1085 | var remito = JSON.parse($localStorage.remito || null); |
1092 | if (remito) { | 1086 | if (remito) { |
1093 | setearRemito(remito); | 1087 | setearRemito(remito); |
1094 | delete $localStorage.remito; | 1088 | delete $localStorage.remito; |
1095 | } | 1089 | } |
1096 | } | 1090 | } |
1097 | 1091 | ||
1098 | function deleteCliente() { | 1092 | function deleteCliente() { |
1099 | delete $scope.remito.domicilioStamp; | 1093 | delete $scope.remito.domicilioStamp; |
1100 | delete $scope.remito.puntosDescarga; | 1094 | delete $scope.remito.puntosDescarga; |
1101 | $scope.remito.domicilio = {dom: ''}; | 1095 | $scope.remito.domicilio = {dom: ''}; |
1102 | $scope.remito.cliente = {}; | 1096 | $scope.remito.cliente = {}; |
1103 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 1097 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
1104 | $scope.$broadcast('removeCabecera', 'Domicilio:'); | 1098 | $scope.$broadcast('removeCabecera', 'Domicilio:'); |
1105 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | 1099 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); |
1106 | } | 1100 | } |
1101 | |||
1102 | function abrirModalMail(id, cliente, numeroRemito) { | ||
1103 | focaModalService.mail( | ||
1104 | { | ||
1105 | titulo: 'Comprobante de remito Nº ' + numeroRemito, | ||
1106 | descarga: { | ||
1107 | nombre: numeroRemito + '.pdf', | ||
1108 | url: '/remito/comprobante', | ||
1109 | }, | ||
1110 | envio: { | ||
1111 | mailCliente: cliente.MAIL, | ||
1112 | url: '/remito/mail', | ||
1113 | }, | ||
1114 | options: { | ||
1115 | idRemito: id | ||
1116 | } | ||
1117 | } | ||
1118 | ) | ||
1119 | .then(function(res) { | ||
1120 | if (res === false) { | ||
1121 | abrirModalMail(id); | ||
1122 | focaModalService.alert('Descarga o envíe su remito ' + | ||
1123 | 'antes de cerrar esta ventana'); |
src/js/controllerComprobante.js
1 | angular.module('focaCrearRemito') | File was deleted | |
2 | .controller('focaRemitoComprobanteController', [ | ||
3 | '$scope', | ||
4 | '$uibModalInstance', | ||
5 | 'crearRemitoService', | ||
6 | '$filter', | ||
7 | 'parametros', | ||
8 | 'FileSaver', | ||
9 | 'Blob', | ||
10 | function( | ||
11 | $scope, $uibModalInstance, crearRemitoService, $filter, | ||
12 | parametros, FileSaver, Blob | ||
13 | ) { | ||
14 | crearRemitoService.getRemitoById(parametros.idRemito).then(function(res) { | ||
15 | |||
16 | $scope.remito = res.data; | ||
17 | }); | ||
18 | $scope.correoEnviado = false; | ||
19 | $scope.correoNoEnviado = false; | ||
20 | $scope.esperando = false; | ||
21 | |||
22 | $scope.aceptar = function() { | ||
23 | $uibModalInstance.close(); | ||
24 | }; | ||
25 | |||
26 | $scope.imprimir = function () { | ||
27 | $scope.esperando = true; | ||
28 | crearRemitoService.imprimirRemitoByIdRemito($scope.remito.id).then( | ||
29 | function(res) { | ||
30 | var data = new Blob([res.data], {type: 'application/pdf'}); | ||
31 | |||
32 | FileSaver.saveAs( | ||
33 | data, | ||
34 | 'RE-R-' + $filter('comprobante')([ | ||
35 | $scope.remito.sucursal, | ||
36 | $scope.remito.numeroRemito | ||
37 | ]) + '.pdf' | ||
38 | ); | ||
39 | $scope.esperando = false; | ||
40 | } | ||
41 | ); | ||
42 | }; | ||
43 | |||
44 | $scope.enviarCorreo = function(key) { | ||
45 | if(key !== 13) return; | ||
46 | $scope.esperando = true; | ||
47 | var options = { | ||
48 | para: $scope.remito.cliente.MAIL, | ||
49 | remito: $scope.remito.id | ||
50 | }; | ||
51 | |||
52 | crearRemitoService.enviarCorreo(options).then(function() { | ||
53 | $scope.correoEnviado = true; | ||
54 | $scope.esperando = false; | ||
55 | }, function() { | ||
56 | $scope.esperando = false; | ||
57 | $scope.correoNoEnviado = true; | ||
58 | }); | ||
59 | }; | ||
60 | } | ||
61 | ]); | ||
62 | 1 | angular.module('focaCrearRemito') |
src/js/service.js
1 | angular.module('focaCrearRemito') | 1 | angular.module('focaCrearRemito') |
2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', | 2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | 3 | function($http, API_ENDPOINT) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | crearRemito: function(remito) { | 6 | crearRemito: function(remito) { |
7 | // TODO: Cambiar para usar el servicio /remito | 7 | // TODO: Cambiar para usar el servicio /remito |
8 | return $http.post(route + '/remito', remito); | 8 | return $http.post(route + '/remito', remito); |
9 | }, | 9 | }, |
10 | getRemitoById: function(id) { | 10 | getRemitoById: function(id) { |
11 | return $http.get(route + '/remito/obtener/' + id); | 11 | return $http.get(route + '/remito/obtener/' + id); |
12 | }, | 12 | }, |
13 | obtenerRemito: function() { | 13 | obtenerRemito: function() { |
14 | return $http.get(route +'/nota-pedido'); | 14 | return $http.get(route +'/nota-pedido'); |
15 | }, | 15 | }, |
16 | setRemito: function(remito) { | 16 | setRemito: function(remito) { |
17 | this.remito = remito; | 17 | this.remito = remito; |
18 | }, | 18 | }, |
19 | clearRemito: function() { | 19 | clearRemito: function() { |
20 | this.remito = undefined; | 20 | this.remito = undefined; |
21 | }, | 21 | }, |
22 | getRemito: function() { | 22 | getRemito: function() { |
23 | return this.remito; | 23 | return this.remito; |
24 | }, | 24 | }, |
25 | getArticulosByIdRemito: function(id) { | 25 | getArticulosByIdRemito: function(id) { |
26 | return $http.get(route+'/articulos/nota-pedido/'+id); | 26 | return $http.get(route+'/articulos/nota-pedido/'+id); |
27 | }, | 27 | }, |
28 | crearArticulosParaRemito: function(articuloRemito) { | 28 | crearArticulosParaRemito: function(articuloRemito) { |
29 | return $http.post(route + '/articulos/remito', | 29 | return $http.post(route + '/articulos/remito', |
30 | {articuloRemito: articuloRemito}); | 30 | {articuloRemito: articuloRemito}); |
31 | }, | 31 | }, |
32 | getDomiciliosByIdRemito: function(id) { | 32 | getDomiciliosByIdRemito: function(id) { |
33 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 33 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
34 | }, | 34 | }, |
35 | getDomiciliosByIdCliente: function(id) { | 35 | getDomiciliosByIdCliente: function(id) { |
36 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 36 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
37 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 37 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
38 | }, | 38 | }, |
39 | getPrecioCondicion: function() { | 39 | getPrecioCondicion: function() { |
40 | return $http.get(route + '/precio-condicion'); | 40 | return $http.get(route + '/precio-condicion'); |
41 | }, | 41 | }, |
42 | getPrecioCondicionById: function(id) { | 42 | getPrecioCondicionById: function(id) { |
43 | return $http.get(route + '/precio-condicion/' + id); | 43 | return $http.get(route + '/precio-condicion/' + id); |
44 | }, | 44 | }, |
45 | getPlazoPagoByPrecioCondicion: function(id) { | 45 | getPlazoPagoByPrecioCondicion: function(id) { |
46 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 46 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
47 | }, | 47 | }, |
48 | crearFlete: function(flete) { | 48 | crearFlete: function(flete) { |
49 | return $http.post(route + '/flete', {flete : flete}); | 49 | return $http.post(route + '/flete', {flete : flete}); |
50 | }, | 50 | }, |
51 | crearPlazosParaRemito: function(plazos) { | 51 | crearPlazosParaRemito: function(plazos) { |
52 | return $http.post(route + '/plazo-pago/remito', plazos); | 52 | return $http.post(route + '/plazo-pago/remito', plazos); |
53 | }, | 53 | }, |
54 | getCotizacionByIdMoneda: function(id) { | 54 | getCotizacionByIdMoneda: function(id) { |
55 | return $http.get(route + '/moneda/' + id); | 55 | return $http.get(route + '/moneda/' + id); |
56 | }, | 56 | }, |
57 | crearEstadoParaRemito: function(estado) { | 57 | crearEstadoParaRemito: function(estado) { |
58 | return $http.post(route + '/estado', {estado: estado}); | 58 | return $http.post(route + '/estado', {estado: estado}); |
59 | }, | 59 | }, |
60 | getNumeroRemito: function() { | 60 | getNumeroRemito: function() { |
61 | return $http.get(route + '/remito/numero-siguiente'); | 61 | return $http.get(route + '/remito/numero-siguiente'); |
62 | }, | 62 | }, |
63 | imprimirRemitoByIdRemito: function(idRemito, original) { | 63 | imprimirRemitoByIdRemito: function(idRemito) { |
64 | var tipo = original ? '/original' : ''; | 64 | return $http.get(route + '/remito/comprobante/' + idRemito , { |
65 | return $http.get(route + '/remito/comprobante/' + idRemito + tipo, { | ||
66 | responseType: 'arraybuffer' | 65 | responseType: 'arraybuffer' |
67 | }); | 66 | }); |
68 | }, | 67 | }, |
69 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 68 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { |
70 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 69 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + |
71 | idDomicilio + '/' + idCliente); | 70 | idDomicilio + '/' + idCliente); |
72 | }, | 71 | }, |
73 | enviarCorreo: function(options) { | 72 | enviarCorreo: function(options) { |
74 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); | 73 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); |
75 | }, | 74 | }, |
76 | getBotonera: function() { | 75 | getBotonera: function() { |
77 | return [ | 76 | return [ |
78 | { | 77 | { |
79 | label: 'Nota pedido', | 78 | label: 'Nota pedido', |
80 | image: 'notaDePedido.png' | 79 | image: 'notaDePedido.png' |
81 | }, | 80 | }, |
82 | { | 81 | { |
83 | label: 'Cliente', | 82 | label: 'Cliente', |
84 | image: 'cliente.png' | 83 | image: 'cliente.png' |
85 | }, | 84 | }, |
86 | { | 85 | { |
87 | label: 'Transportista', | 86 | label: 'Transportista', |
88 | image: 'proveedor.png' | 87 | image: 'proveedor.png' |
89 | }, | 88 | }, |
90 | { | 89 | { |
91 | label: 'Moneda', | 90 | label: 'Moneda', |
92 | image: 'moneda.png' | 91 | image: 'moneda.png' |
93 | }, | 92 | }, |
94 | { | 93 | { |
95 | label: 'Precios y condiciones', | 94 | label: 'Precios y condiciones', |
96 | image: 'precios-condiciones.png' | 95 | image: 'precios-condiciones.png' |
97 | }, | 96 | }, |
98 | { | 97 | { |
99 | label: 'Productos', | 98 | label: 'Productos', |
100 | image: 'productos.png' | 99 | image: 'productos.png' |
101 | }, | 100 | }, |
102 | { | 101 | { |
103 | label: 'Observaciones', | 102 | label: 'Observaciones', |
104 | image: 'botonObservaciones.png', | 103 | image: 'botonObservaciones.png', |
105 | disable: true | 104 | disable: true |
106 | } | 105 | } |
107 | ]; | 106 | ]; |
108 | } | 107 | } |
109 | }; | 108 | }; |
110 | }]); | 109 | }]); |
111 | 110 |
src/views/remito-comprobante.html
1 | <div class="modal-header"> | File was deleted | |
2 | <h5>Comprobante de remito Nº | ||
3 | <span | ||
4 | ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"> | ||
5 | </span> | ||
6 | </h5> | ||
7 | </div> | ||
8 | <div class="modal-body"> | ||
9 | <div class="col-12"> | ||
10 | <label | ||
11 | class="col-12 bg-success text-white" | ||
12 | ng-show="correoEnviado">Correo enviado con éxito</label> | ||
13 | <label | ||
14 | class="col-12 bg-danger text-white" | ||
15 | ng-show="correoNoEnviado">Hubo un error al enviar el correo</label> | ||
16 | <label>Enviar correo a </label> | ||
17 | <input | ||
18 | class="form-control" | ||
19 | ng-model="remito.cliente.MAIL" | ||
20 | ng-click="enviarCorreo($event.keyCode)"/> | ||
21 | </div> | ||
22 | </div> | ||
23 | <div class="modal-footer"> | ||
24 | <button | ||
25 | type="button" | ||
26 | class="btn btn-info" | ||
27 | ng-click="imprimir()" | ||
28 | ladda="esperando" | ||
29 | >Imprimir</button> | ||
30 | <button | ||
31 | type="button" | ||
32 | class="btn btn-primary" | ||
33 | ng-click="aceptar()" | ||
34 | ladda="esperando" | ||
35 | >Aceptar</button> | ||
36 | <button | ||
37 | type="button" | ||
38 | class="btn btn-primary" | ||
39 | ng-click="enviarCorreo(13)" | ||
40 | ladda="esperando" | ||
41 | >Enviar</button> | ||
42 | </div> | ||
43 | 1 | <div class="modal-header"> |