Commit 47d08ee7f211e32e6ac255f0c796b013533a3d9c
1 parent
55e586763f
Exists in
master
and in
1 other branch
Borrado if.
Showing
1 changed file
with
0 additions
and
17 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearFactura').controller('facturaController', [ | 1 | angular.module('focaCrearFactura').controller('facturaController', [ |
2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', | 2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', |
3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', | 3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', |
4 | '$localStorage', 'APP', | 4 | '$localStorage', 'APP', |
5 | function ( | 5 | function ( |
6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, |
7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP) { | 7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP) { |
8 | 8 | ||
9 | config(); | 9 | config(); |
10 | 10 | ||
11 | function config() { | 11 | function config() { |
12 | $scope.tmpCantidad = Number; | 12 | $scope.tmpCantidad = Number; |
13 | $scope.tmpPrecio = Number; | 13 | $scope.tmpPrecio = Number; |
14 | $scope.botonera = crearFacturaService.getBotonera(); | 14 | $scope.botonera = crearFacturaService.getBotonera(); |
15 | $scope.isNumber = angular.isNumber; | 15 | $scope.isNumber = angular.isNumber; |
16 | $scope.datepickerAbierto = false; | 16 | $scope.datepickerAbierto = false; |
17 | $scope.show = false; | 17 | $scope.show = false; |
18 | $scope.cargando = true; | 18 | $scope.cargando = true; |
19 | $scope.now = new Date(); | 19 | $scope.now = new Date(); |
20 | $scope.puntoVenta = rellenar(0, 4); | 20 | $scope.puntoVenta = rellenar(0, 4); |
21 | $scope.comprobante = rellenar(0, 8); | 21 | $scope.comprobante = rellenar(0, 8); |
22 | $scope.dateOptions = { | 22 | $scope.dateOptions = { |
23 | maxDate: new Date(), | 23 | maxDate: new Date(), |
24 | minDate: new Date(2010, 0, 1) | 24 | minDate: new Date(2010, 0, 1) |
25 | }; | 25 | }; |
26 | $scope.cabeceras = []; | 26 | $scope.cabeceras = []; |
27 | crearFacturaService.getParametros().then(function (res) { | 27 | crearFacturaService.getParametros().then(function (res) { |
28 | 28 | ||
29 | var parametros = JSON.parse(res.data[0].jsonText); | 29 | var parametros = JSON.parse(res.data[0].jsonText); |
30 | 30 | ||
31 | if ($localStorage.factura) { | 31 | if ($localStorage.factura) { |
32 | 32 | ||
33 | $timeout(function () { getLSFactura(); }); | 33 | $timeout(function () { getLSFactura(); }); |
34 | } else { | 34 | } else { |
35 | 35 | ||
36 | for (var property in parametros) { | 36 | for (var property in parametros) { |
37 | $scope.factura[property] = parametros[property]; | 37 | $scope.factura[property] = parametros[property]; |
38 | $scope.inicial[property] = parametros[property]; | 38 | $scope.inicial[property] = parametros[property]; |
39 | } | 39 | } |
40 | 40 | ||
41 | setearFactura($scope.factura); | 41 | setearFactura($scope.factura); |
42 | } | 42 | } |
43 | 43 | ||
44 | }); | 44 | }); |
45 | 45 | ||
46 | //SETEO BOTONERA LATERAL | 46 | //SETEO BOTONERA LATERAL |
47 | $timeout(function () { | 47 | $timeout(function () { |
48 | focaBotoneraLateralService.showSalir(false); | 48 | focaBotoneraLateralService.showSalir(false); |
49 | focaBotoneraLateralService.showPausar(true); | 49 | focaBotoneraLateralService.showPausar(true); |
50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); | 50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); |
51 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 51 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
52 | }); | 52 | }); |
53 | 53 | ||
54 | init(); | 54 | init(); |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | function init() { | 58 | function init() { |
59 | 59 | ||
60 | $scope.$broadcast('cleanCabecera'); | 60 | $scope.$broadcast('cleanCabecera'); |
61 | 61 | ||
62 | $scope.factura = { | 62 | $scope.factura = { |
63 | id: 0, | 63 | id: 0, |
64 | estado: 0, | 64 | estado: 0, |
65 | vendedor: {}, | 65 | vendedor: {}, |
66 | cliente: {}, | 66 | cliente: {}, |
67 | proveedor: {}, | 67 | proveedor: {}, |
68 | domicilio: { dom: '' }, | 68 | domicilio: { dom: '' }, |
69 | moneda: {}, | 69 | moneda: {}, |
70 | cotizacion: $scope.cotizacionPorDefecto || {}, | 70 | cotizacion: $scope.cotizacionPorDefecto || {}, |
71 | articulosFactura: [], | 71 | articulosFactura: [], |
72 | despachos: [] | 72 | despachos: [] |
73 | }; | 73 | }; |
74 | 74 | ||
75 | $scope.factura.articulosFactura = []; | 75 | $scope.factura.articulosFactura = []; |
76 | $scope.idLista = undefined; | 76 | $scope.idLista = undefined; |
77 | 77 | ||
78 | crearRemitoService.getNumeroRemito().then( | 78 | crearRemitoService.getNumeroRemito().then( |
79 | function (res) { | 79 | function (res) { |
80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
82 | }, | 82 | }, |
83 | function (err) { | 83 | function (err) { |
84 | focaModalService.alert('La terminal no esta configurada correctamente'); | 84 | focaModalService.alert('La terminal no esta configurada correctamente'); |
85 | console.info(err); | 85 | console.info(err); |
86 | } | 86 | } |
87 | ); | 87 | ); |
88 | 88 | ||
89 | $scope.inicial = angular.copy($scope.factura); | 89 | $scope.inicial = angular.copy($scope.factura); |
90 | if (APP === 'facturador') { | ||
91 | var modalInstance = $uibModal.open( | ||
92 | { | ||
93 | templateUrl: 'modal-estado-cuenta.html', | ||
94 | controller: 'focaModalEstadoCuentaController', | ||
95 | size: 'lg' | ||
96 | } | ||
97 | ); | ||
98 | modalInstance.result | ||
99 | .then(function (data) { | ||
100 | $scope.$broadcast('addCabecera', { | ||
101 | label: 'Tipo de pago: ', | ||
102 | valor: data | ||
103 | }); | ||
104 | }) | ||
105 | .catch(function (e) { console.error(e); }); | ||
106 | } | ||
107 | } | 90 | } |
108 | 91 | ||
109 | $scope.$watch('factura', function (newValue) { | 92 | $scope.$watch('factura', function (newValue) { |
110 | focaBotoneraLateralService.setPausarData({ | 93 | focaBotoneraLateralService.setPausarData({ |
111 | label: 'factura', | 94 | label: 'factura', |
112 | val: newValue | 95 | val: newValue |
113 | }); | 96 | }); |
114 | }, true); | 97 | }, true); |
115 | 98 | ||
116 | $scope.seleccionarFormaDePago = function () { | 99 | $scope.seleccionarFormaDePago = function () { |
117 | if (!validarGuardar()) return; | 100 | if (!validarGuardar()) return; |
118 | var modalInstance = $uibModal.open( | 101 | var modalInstance = $uibModal.open( |
119 | { | 102 | { |
120 | templateUrl: 'modal-forma-pago.html', | 103 | templateUrl: 'modal-forma-pago.html', |
121 | controller: 'focaModalFormaPagoController', | 104 | controller: 'focaModalFormaPagoController', |
122 | resolve: { | 105 | resolve: { |
123 | filters: function () { return null; }, | 106 | filters: function () { return null; }, |
124 | }, | 107 | }, |
125 | size: 'lg', | 108 | size: 'lg', |
126 | } | 109 | } |
127 | ); | 110 | ); |
128 | modalInstance.result | 111 | modalInstance.result |
129 | .then(function (data) { | 112 | .then(function (data) { |
130 | console.log(data); | 113 | console.log(data); |
131 | $scope.crearFactura(); | 114 | $scope.crearFactura(); |
132 | }) | 115 | }) |
133 | .catch(function (e) { console.error(e); }); | 116 | .catch(function (e) { console.error(e); }); |
134 | }; | 117 | }; |
135 | 118 | ||
136 | $scope.crearFactura = function () { | 119 | $scope.crearFactura = function () { |
137 | 120 | ||
138 | var save = { | 121 | var save = { |
139 | factura: { | 122 | factura: { |
140 | 123 | ||
141 | BONIF: 0, | 124 | BONIF: 0, |
142 | CLI: $scope.factura.cliente.cod, | 125 | CLI: $scope.factura.cliente.cod, |
143 | CUI: $scope.factura.cliente.cuit, | 126 | CUI: $scope.factura.cliente.cuit, |
144 | CTA: $scope.factura.cliente.cod, | 127 | CTA: $scope.factura.cliente.cod, |
145 | DC1: '', | 128 | DC1: '', |
146 | DC2: '', | 129 | DC2: '', |
147 | DE1: '', | 130 | DE1: '', |
148 | DOM: $scope.factura.cliente.DOM, | 131 | DOM: $scope.factura.cliente.DOM, |
149 | FACAUT: 0, | 132 | FACAUT: 0, |
150 | DTO: 0, | 133 | DTO: 0, |
151 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), | 134 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), |
152 | FEC_ANT: '19000101', | 135 | FEC_ANT: '19000101', |
153 | FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente | 136 | FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente |
154 | IDEXCEPCION: 0, | 137 | IDEXCEPCION: 0, |
155 | IDLP: $scope.factura.cliente.mod.trim() || 0, | 138 | IDLP: $scope.factura.cliente.mod.trim() || 0, |
156 | IDPERSONERIA: 0, | 139 | IDPERSONERIA: 0, |
157 | IMI: 0, // TODO | 140 | IMI: 0, // TODO |
158 | IMI2: 0, // TODO | 141 | IMI2: 0, // TODO |
159 | IMI3: 0, // TODO | 142 | IMI3: 0, // TODO |
160 | IMP_LEY: 0, | 143 | IMP_LEY: 0, |
161 | IRI: 0, // TODO | 144 | IRI: 0, // TODO |
162 | IRS: 0, | 145 | IRS: 0, |
163 | LEG: '', | 146 | LEG: '', |
164 | LUG: $scope.factura.vendedor.LugVen, | 147 | LUG: $scope.factura.vendedor.LugVen, |
165 | MK_M: 0, | 148 | MK_M: 0, |
166 | NEE: 0, // TODO | 149 | NEE: 0, // TODO |
167 | NET: 0, // TODO | 150 | NET: 0, // TODO |
168 | NFI: '', | 151 | NFI: '', |
169 | NNP: 0, | 152 | NNP: 0, |
170 | NOM: $scope.factura.cliente.nom, | 153 | NOM: $scope.factura.cliente.nom, |
171 | OPE: $scope.factura.vendedor.CodVen, | 154 | OPE: $scope.factura.vendedor.CodVen, |
172 | PAG: $scope.getTotal(), | 155 | PAG: $scope.getTotal(), |
173 | PER: 0, | 156 | PER: 0, |
174 | PER_IVA: 0, | 157 | PER_IVA: 0, |
175 | PLA: $scope.factura.vendedor.NplVen, | 158 | PLA: $scope.factura.vendedor.NplVen, |
176 | PRO: '', | 159 | PRO: '', |
177 | REC_ANT: 0, | 160 | REC_ANT: 0, |
178 | SUC: parseInt($scope.puntoVenta), | 161 | SUC: parseInt($scope.puntoVenta), |
179 | TCA: 1, | 162 | TCA: 1, |
180 | TCO: 'FT', | 163 | TCO: 'FT', |
181 | TFI: '', | 164 | TFI: '', |
182 | TIP: $scope.factura.cliente.tipoFactura, | 165 | TIP: $scope.factura.cliente.tipoFactura, |
183 | TIV: 0, // TODO | 166 | TIV: 0, // TODO |
184 | TOT: $scope.getTotal(), | 167 | TOT: $scope.getTotal(), |
185 | TUR: 0, // TODO | 168 | TUR: 0, // TODO |
186 | VEN: $scope.factura.vendedor.CodVen, | 169 | VEN: $scope.factura.vendedor.CodVen, |
187 | VTO_CLI: '', | 170 | VTO_CLI: '', |
188 | ZON: 1, // TODO | 171 | ZON: 1, // TODO |
189 | OBSERVACIONES: $scope.factura.observaciones | 172 | OBSERVACIONES: $scope.factura.observaciones |
190 | }, | 173 | }, |
191 | cuerpo: $scope.articulosFiltro(), | 174 | cuerpo: $scope.articulosFiltro(), |
192 | despachos: $scope.factura.despachos | 175 | despachos: $scope.factura.despachos |
193 | }; | 176 | }; |
194 | 177 | ||
195 | crearFacturaService.guardarFactura(save).then(function (res) { | 178 | crearFacturaService.guardarFactura(save).then(function (res) { |
196 | 179 | ||
197 | focaBotoneraLateralService.endGuardar(true); | 180 | focaBotoneraLateralService.endGuardar(true); |
198 | 181 | ||
199 | focaModalService.alert('Comprobante guardado con éxito'); | 182 | focaModalService.alert('Comprobante guardado con éxito'); |
200 | 183 | ||
201 | config(); | 184 | config(); |
202 | 185 | ||
203 | }).catch(function (err) { | 186 | }).catch(function (err) { |
204 | focaModalService.alert('Hubo un error al guardar la factura'); | 187 | focaModalService.alert('Hubo un error al guardar la factura'); |
205 | console.log(err); | 188 | console.log(err); |
206 | }); | 189 | }); |
207 | 190 | ||
208 | }; | 191 | }; |
209 | 192 | ||
210 | $scope.seleccionarCliente = function () { | 193 | $scope.seleccionarCliente = function () { |
211 | 194 | ||
212 | var modalInstance = $uibModal.open( | 195 | var modalInstance = $uibModal.open( |
213 | { | 196 | { |
214 | ariaLabelledBy: 'Busqueda de Cliente', | 197 | ariaLabelledBy: 'Busqueda de Cliente', |
215 | templateUrl: 'foca-busqueda-cliente-modal.html', | 198 | templateUrl: 'foca-busqueda-cliente-modal.html', |
216 | controller: 'focaBusquedaClienteModalController', | 199 | controller: 'focaBusquedaClienteModalController', |
217 | resolve: { | 200 | resolve: { |
218 | vendedor: function () { return null; }, | 201 | vendedor: function () { return null; }, |
219 | cobrador: function () { return null; } | 202 | cobrador: function () { return null; } |
220 | }, | 203 | }, |
221 | size: 'lg' | 204 | size: 'lg' |
222 | } | 205 | } |
223 | ); | 206 | ); |
224 | modalInstance.result.then( | 207 | modalInstance.result.then( |
225 | function (cliente) { | 208 | function (cliente) { |
226 | var modalInstance = $uibModal.open( | 209 | var modalInstance = $uibModal.open( |
227 | { | 210 | { |
228 | templateUrl: 'modal-estado-cuenta.html', | 211 | templateUrl: 'modal-estado-cuenta.html', |
229 | controller: 'focaModalEstadoCuentaController', | 212 | controller: 'focaModalEstadoCuentaController', |
230 | size: 'lg', | 213 | size: 'lg', |
231 | resolve: { | 214 | resolve: { |
232 | parametros: function () { return { idCliente: cliente.cod }; }, | 215 | parametros: function () { return { idCliente: cliente.cod }; }, |
233 | } | 216 | } |
234 | } | 217 | } |
235 | ); | 218 | ); |
236 | modalInstance.result | 219 | modalInstance.result |
237 | .then(function (data) { | 220 | .then(function (data) { |
238 | 221 | ||
239 | $scope.factura.cliente = cliente; | 222 | $scope.factura.cliente = cliente; |
240 | 223 | ||
241 | $scope.$broadcast('addCabecera', { | 224 | $scope.$broadcast('addCabecera', { |
242 | label: 'Cliente:', | 225 | label: 'Cliente:', |
243 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + | 226 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + |
244 | ' - ' + cliente.nom | 227 | ' - ' + cliente.nom |
245 | }); | 228 | }); |
246 | 229 | ||
247 | $filter('filter')($scope.botonera, | 230 | $filter('filter')($scope.botonera, |
248 | { label: 'Cliente' })[0].checked = true; | 231 | { label: 'Cliente' })[0].checked = true; |
249 | 232 | ||
250 | $scope.$broadcast('addCabecera', { | 233 | $scope.$broadcast('addCabecera', { |
251 | label: 'Tipo de pago: ', | 234 | label: 'Tipo de pago: ', |
252 | valor: data | 235 | valor: data |
253 | }); | 236 | }); |
254 | }) | 237 | }) |
255 | .catch(function () { | 238 | .catch(function () { |
256 | 239 | ||
257 | $scope.seleccionarCliente(); | 240 | $scope.seleccionarCliente(); |
258 | }); | 241 | }); |
259 | 242 | ||
260 | }, function () { | 243 | }, function () { |
261 | } | 244 | } |
262 | ); | 245 | ); |
263 | 246 | ||
264 | }; | 247 | }; |
265 | 248 | ||
266 | $scope.seleccionarVendedor = function () { | 249 | $scope.seleccionarVendedor = function () { |
267 | var parametrosModal = { | 250 | var parametrosModal = { |
268 | titulo: 'Búsqueda vendedores', | 251 | titulo: 'Búsqueda vendedores', |
269 | query: '/vendedor-playa', | 252 | query: '/vendedor-playa', |
270 | columnas: [ | 253 | columnas: [ |
271 | { | 254 | { |
272 | propiedad: 'CodVen', | 255 | propiedad: 'CodVen', |
273 | nombre: 'Código', | 256 | nombre: 'Código', |
274 | filtro: { | 257 | filtro: { |
275 | nombre: 'rellenarDigitos', | 258 | nombre: 'rellenarDigitos', |
276 | parametro: 3 | 259 | parametro: 3 |
277 | } | 260 | } |
278 | }, | 261 | }, |
279 | { | 262 | { |
280 | propiedad: 'NomVen', | 263 | propiedad: 'NomVen', |
281 | nombre: 'Nombre' | 264 | nombre: 'Nombre' |
282 | } | 265 | } |
283 | ], | 266 | ], |
284 | size: 'md' | 267 | size: 'md' |
285 | }; | 268 | }; |
286 | focaModalService.modal(parametrosModal).then( | 269 | focaModalService.modal(parametrosModal).then( |
287 | function (vendedor) { | 270 | function (vendedor) { |
288 | 271 | ||
289 | indicarPassword(vendedor) | 272 | indicarPassword(vendedor) |
290 | .then(function () { | 273 | .then(function () { |
291 | validarPlanillaVendedor(vendedor) | 274 | validarPlanillaVendedor(vendedor) |
292 | .then(function () { | 275 | .then(function () { |
293 | 276 | ||
294 | $filter('filter')($scope.botonera, { | 277 | $filter('filter')($scope.botonera, { |
295 | label: 'Vendedor' | 278 | label: 'Vendedor' |
296 | })[0].checked = true; | 279 | })[0].checked = true; |
297 | 280 | ||
298 | $scope.$broadcast('addCabecera', { | 281 | $scope.$broadcast('addCabecera', { |
299 | label: 'Vendedor:', | 282 | label: 'Vendedor:', |
300 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + | 283 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + |
301 | ' - ' + | 284 | ' - ' + |
302 | vendedor.NomVen | 285 | vendedor.NomVen |
303 | }); | 286 | }); |
304 | 287 | ||
305 | $scope.factura.vendedor = vendedor; | 288 | $scope.factura.vendedor = vendedor; |
306 | 289 | ||
307 | getProductosByPlanilla(vendedor.NplVen); | 290 | getProductosByPlanilla(vendedor.NplVen); |
308 | }) | 291 | }) |
309 | .catch($scope.seleccionarVendedor); | 292 | .catch($scope.seleccionarVendedor); |
310 | }) | 293 | }) |
311 | .catch(function (err) { | 294 | .catch(function (err) { |
312 | console.log(err) | 295 | console.log(err) |
313 | }); | 296 | }); |
314 | 297 | ||
315 | }, function () { } | 298 | }, function () { } |
316 | ); | 299 | ); |
317 | }; | 300 | }; |
318 | 301 | ||
319 | $scope.seleccionarMoneda = function () { | 302 | $scope.seleccionarMoneda = function () { |
320 | 303 | ||
321 | var parametrosModal = { | 304 | var parametrosModal = { |
322 | titulo: 'Búsqueda de monedas', | 305 | titulo: 'Búsqueda de monedas', |
323 | query: '/moneda', | 306 | query: '/moneda', |
324 | columnas: [ | 307 | columnas: [ |
325 | { | 308 | { |
326 | propiedad: 'DETALLE', | 309 | propiedad: 'DETALLE', |
327 | nombre: 'Nombre' | 310 | nombre: 'Nombre' |
328 | }, | 311 | }, |
329 | { | 312 | { |
330 | propiedad: 'SIMBOLO', | 313 | propiedad: 'SIMBOLO', |
331 | nombre: 'Símbolo' | 314 | nombre: 'Símbolo' |
332 | } | 315 | } |
333 | ], | 316 | ], |
334 | size: 'md' | 317 | size: 'md' |
335 | }; | 318 | }; |
336 | focaModalService.modal(parametrosModal).then( | 319 | focaModalService.modal(parametrosModal).then( |
337 | function (moneda) { | 320 | function (moneda) { |
338 | 321 | ||
339 | if (moneda.ID !== 1) { | 322 | if (moneda.ID !== 1) { |
340 | $scope.abrirModalCotizacion(moneda); | 323 | $scope.abrirModalCotizacion(moneda); |
341 | return; | 324 | return; |
342 | } | 325 | } |
343 | 326 | ||
344 | crearRemitoService.getCotizacionByIdMoneda(1) | 327 | crearRemitoService.getCotizacionByIdMoneda(1) |
345 | .then(function (res) { | 328 | .then(function (res) { |
346 | 329 | ||
347 | cotizacionPArgentino = res.data[0].cotizaciones[0]; | 330 | cotizacionPArgentino = res.data[0].cotizaciones[0]; |
348 | cotizacionPArgentino.moneda = moneda; | 331 | cotizacionPArgentino.moneda = moneda; |
349 | 332 | ||
350 | actualizarCabeceraMoneda(cotizacionPArgentino); | 333 | actualizarCabeceraMoneda(cotizacionPArgentino); |
351 | 334 | ||
352 | $scope.remito.cotizacion = cotizacionPArgentino; | 335 | $scope.remito.cotizacion = cotizacionPArgentino; |
353 | }); | 336 | }); |
354 | }, function () { | 337 | }, function () { |
355 | 338 | ||
356 | } | 339 | } |
357 | ); | 340 | ); |
358 | }; | 341 | }; |
359 | 342 | ||
360 | $scope.abrirModalCotizacion = function (moneda) { | 343 | $scope.abrirModalCotizacion = function (moneda) { |
361 | var modalInstance = $uibModal.open( | 344 | var modalInstance = $uibModal.open( |
362 | { | 345 | { |
363 | ariaLabelledBy: 'Busqueda de Cotización', | 346 | ariaLabelledBy: 'Busqueda de Cotización', |
364 | templateUrl: 'modal-cotizacion.html', | 347 | templateUrl: 'modal-cotizacion.html', |
365 | controller: 'focaModalCotizacionController', | 348 | controller: 'focaModalCotizacionController', |
366 | size: 'lg', | 349 | size: 'lg', |
367 | resolve: { idMoneda: function () { return moneda.ID; } } | 350 | resolve: { idMoneda: function () { return moneda.ID; } } |
368 | } | 351 | } |
369 | ); | 352 | ); |
370 | modalInstance.result.then( | 353 | modalInstance.result.then( |
371 | function (cotizacion) { | 354 | function (cotizacion) { |
372 | 355 | ||
373 | cotizacion.moneda = moneda; | 356 | cotizacion.moneda = moneda; |
374 | actualizarCabeceraMoneda(cotizacion); | 357 | actualizarCabeceraMoneda(cotizacion); |
375 | $scope.factura.cotizacion = cotizacion; | 358 | $scope.factura.cotizacion = cotizacion; |
376 | 359 | ||
377 | }, function () { | 360 | }, function () { |
378 | 361 | ||
379 | } | 362 | } |
380 | ); | 363 | ); |
381 | }; | 364 | }; |
382 | 365 | ||
383 | $scope.seleccionarObservaciones = function () { | 366 | $scope.seleccionarObservaciones = function () { |
384 | var observacion = { | 367 | var observacion = { |
385 | titulo: 'Ingrese Observaciones', | 368 | titulo: 'Ingrese Observaciones', |
386 | value: $scope.factura.observaciones, | 369 | value: $scope.factura.observaciones, |
387 | maxlength: 155, | 370 | maxlength: 155, |
388 | textarea: true | 371 | textarea: true |
389 | }; | 372 | }; |
390 | 373 | ||
391 | focaModalService | 374 | focaModalService |
392 | .prompt(observacion) | 375 | .prompt(observacion) |
393 | .then(function (observaciones) { | 376 | .then(function (observaciones) { |
394 | $scope.factura.observaciones = observaciones; | 377 | $scope.factura.observaciones = observaciones; |
395 | }); | 378 | }); |
396 | }; | 379 | }; |
397 | 380 | ||
398 | $scope.articulosFiltro = function () { | 381 | $scope.articulosFiltro = function () { |
399 | return $scope.factura.articulosFactura.filter(function (articulo) { | 382 | return $scope.factura.articulosFactura.filter(function (articulo) { |
400 | return !articulo.desactivado; | 383 | return !articulo.desactivado; |
401 | }); | 384 | }); |
402 | }; | 385 | }; |
403 | 386 | ||
404 | $scope.getTotal = function () { | 387 | $scope.getTotal = function () { |
405 | 388 | ||
406 | var total = 0; | 389 | var total = 0; |
407 | 390 | ||
408 | $scope.articulosFiltro().forEach(function (articulo) { | 391 | $scope.articulosFiltro().forEach(function (articulo) { |
409 | total += articulo.PUN * articulo.CAN; | 392 | total += articulo.PUN * articulo.CAN; |
410 | }); | 393 | }); |
411 | 394 | ||
412 | return parseFloat(total.toFixed(2)); | 395 | return parseFloat(total.toFixed(2)); |
413 | }; | 396 | }; |
414 | 397 | ||
415 | $scope.quitarDespacho = function (articulo, index) { | 398 | $scope.quitarDespacho = function (articulo, index) { |
416 | 399 | ||
417 | crearFacturaService | 400 | crearFacturaService |
418 | .setearDespachoDesocupado({ | 401 | .setearDespachoDesocupado({ |
419 | surtidor: $scope.factura.despachos[index].SUR, | 402 | surtidor: $scope.factura.despachos[index].SUR, |
420 | producto: $scope.factura.despachos[index].PRO, | 403 | producto: $scope.factura.despachos[index].PRO, |
421 | carga: $scope.factura.despachos[index].CAR, | 404 | carga: $scope.factura.despachos[index].CAR, |
422 | planilla: $scope.factura.despachos[index].PLA | 405 | planilla: $scope.factura.despachos[index].PLA |
423 | }) | 406 | }) |
424 | .then(function () { | 407 | .then(function () { |
425 | articulo.desactivado = true; | 408 | articulo.desactivado = true; |
426 | $scope.factura.despachos.splice(index, 1); | 409 | $scope.factura.despachos.splice(index, 1); |
427 | }) | 410 | }) |
428 | .catch(function () { | 411 | .catch(function () { |
429 | focaModalService.alert('Hubo un error al desasociar este despacho'); | 412 | focaModalService.alert('Hubo un error al desasociar este despacho'); |
430 | }); | 413 | }); |
431 | }; | 414 | }; |
432 | 415 | ||
433 | function getProductosByPlanilla(numeroPlanilla) { | 416 | function getProductosByPlanilla(numeroPlanilla) { |
434 | 417 | ||
435 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { | 418 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { |
436 | 419 | ||
437 | res.data.forEach(function (producto) { | 420 | res.data.forEach(function (producto) { |
438 | 421 | ||
439 | $scope.botonera.push({ | 422 | $scope.botonera.push({ |
440 | label: producto.DetArt, | 423 | label: producto.DetArt, |
441 | image: 'productos.png' | 424 | image: 'productos.png' |
442 | }); | 425 | }); |
443 | 426 | ||
444 | 427 | ||
445 | crearFuncionesProductos(producto); | 428 | crearFuncionesProductos(producto); |
446 | 429 | ||
447 | }); | 430 | }); |
448 | }); | 431 | }); |
449 | } | 432 | } |
450 | 433 | ||
451 | function crearFuncionesProductos(producto) { | 434 | function crearFuncionesProductos(producto) { |
452 | 435 | ||
453 | $scope[nombreFuncion(producto.DetArt)] = function () { | 436 | $scope[nombreFuncion(producto.DetArt)] = function () { |
454 | 437 | ||
455 | if (angular.equals($scope.factura.cliente, {})) { | 438 | if (angular.equals($scope.factura.cliente, {})) { |
456 | focaModalService.alert('Seleccione cliente'); | 439 | focaModalService.alert('Seleccione cliente'); |
457 | return; | 440 | return; |
458 | } | 441 | } |
459 | 442 | ||
460 | var modalInstance = $uibModal.open( | 443 | var modalInstance = $uibModal.open( |
461 | { | 444 | { |
462 | templateUrl: 'modal-combustibles.html', | 445 | templateUrl: 'modal-combustibles.html', |
463 | controller: 'focaModalCombustiblesController', | 446 | controller: 'focaModalCombustiblesController', |
464 | resolve: { | 447 | resolve: { |
465 | parametros: function () { | 448 | parametros: function () { |
466 | return { | 449 | return { |
467 | despachos: producto.despachos, | 450 | despachos: producto.despachos, |
468 | nombreProducto: producto.DetArt | 451 | nombreProducto: producto.DetArt |
469 | } | 452 | } |
470 | } | 453 | } |
471 | }, | 454 | }, |
472 | size: 'md' | 455 | size: 'md' |
473 | } | 456 | } |
474 | ); | 457 | ); |
475 | 458 | ||
476 | modalInstance.result.then(function (despacho) { | 459 | modalInstance.result.then(function (despacho) { |
477 | 460 | ||
478 | var articulo = { | 461 | var articulo = { |
479 | TIP: $scope.factura.cliente.tipoFactura, | 462 | TIP: $scope.factura.cliente.tipoFactura, |
480 | TCO: 'FT', | 463 | TCO: 'FT', |
481 | SUC: parseInt($scope.puntoVenta), | 464 | SUC: parseInt($scope.puntoVenta), |
482 | ORD: $scope.articulosFiltro().length + 1, | 465 | ORD: $scope.articulosFiltro().length + 1, |
483 | SEC: despacho.SEC, | 466 | SEC: despacho.SEC, |
484 | ART: despacho.PRO, | 467 | ART: despacho.PRO, |
485 | RUB: producto.CodRub, | 468 | RUB: producto.CodRub, |
486 | DES: producto.DetArt, | 469 | DES: producto.DetArt, |
487 | CAN: despacho.LTS, | 470 | CAN: despacho.LTS, |
488 | PUN: producto.PreVen, // TODO | 471 | PUN: producto.PreVen, // TODO |
489 | IVA: producto.IMPIVA, // TODO | 472 | IVA: producto.IMPIVA, // TODO |
490 | NET: 0, // TODO | 473 | NET: 0, // TODO |
491 | NEX: 0, // TODO | 474 | NEX: 0, // TODO |
492 | IMI: producto.ImpInt, // TODO | 475 | IMI: producto.ImpInt, // TODO |
493 | IMI2: producto.ImpInt2, // TODO | 476 | IMI2: producto.ImpInt2, // TODO |
494 | IMI3: producto.ImpInt3, // TODO | 477 | IMI3: producto.ImpInt3, // TODO |
495 | PUT: producto.PreNet, // TODO | 478 | PUT: producto.PreNet, // TODO |
496 | SUR: despacho.SUR, | 479 | SUR: despacho.SUR, |
497 | PLA: despacho.PLA, | 480 | PLA: despacho.PLA, |
498 | LUG: despacho.LUG, | 481 | LUG: despacho.LUG, |
499 | LEG: $scope.factura.vendedor.CodVen, | 482 | LEG: $scope.factura.vendedor.CodVen, |
500 | TUR: $scope.factura.vendedor.TurVen, | 483 | TUR: $scope.factura.vendedor.TurVen, |
501 | ORDEN_PRECOMPRA: '', | 484 | ORDEN_PRECOMPRA: '', |
502 | ESC: producto.tipoFactura == 'L' ? 1 : 0, | 485 | ESC: producto.tipoFactura == 'L' ? 1 : 0, |
503 | CMF: 0, | 486 | CMF: 0, |
504 | PTA: 0, | 487 | PTA: 0, |
505 | IVS: 0, | 488 | IVS: 0, |
506 | TIVA: 0, | 489 | TIVA: 0, |
507 | CON: 0, | 490 | CON: 0, |
508 | SINO: '', | 491 | SINO: '', |
509 | ORD_TRA: 0, | 492 | ORD_TRA: 0, |
510 | IMP_DESP: 0, | 493 | IMP_DESP: 0, |
511 | PCD: 0, | 494 | PCD: 0, |
512 | RTO: '' | 495 | RTO: '' |
513 | }; | 496 | }; |
514 | 497 | ||
515 | crearFacturaService.setearDespachoOcupado({ | 498 | crearFacturaService.setearDespachoOcupado({ |
516 | surtidor: despacho.SUR, | 499 | surtidor: despacho.SUR, |
517 | producto: despacho.PRO, | 500 | producto: despacho.PRO, |
518 | carga: despacho.CAR | 501 | carga: despacho.CAR |
519 | }) | 502 | }) |
520 | .then(function () { | 503 | .then(function () { |
521 | $scope.factura.articulosFactura.push(articulo); | 504 | $scope.factura.articulosFactura.push(articulo); |
522 | $scope.factura.despachos.push(despacho); | 505 | $scope.factura.despachos.push(despacho); |
523 | }) | 506 | }) |
524 | .catch(function (err) { | 507 | .catch(function (err) { |
525 | 508 | ||
526 | focaModalService.alert('El despacho esta en uso'); | 509 | focaModalService.alert('El despacho esta en uso'); |
527 | }); | 510 | }); |
528 | 511 | ||
529 | }) | 512 | }) |
530 | .catch(function (err) { | 513 | .catch(function (err) { |
531 | console.log(err); | 514 | console.log(err); |
532 | }); | 515 | }); |
533 | 516 | ||
534 | }; | 517 | }; |
535 | } | 518 | } |
536 | 519 | ||
537 | function nombreFuncion(string) { | 520 | function nombreFuncion(string) { |
538 | var texto = 'seleccionar'; | 521 | var texto = 'seleccionar'; |
539 | var arr = string.split(' '); | 522 | var arr = string.split(' '); |
540 | arr.forEach(function (palabra) { | 523 | arr.forEach(function (palabra) { |
541 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 524 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); |
542 | texto += palabra; | 525 | texto += palabra; |
543 | }); | 526 | }); |
544 | return texto; | 527 | return texto; |
545 | } | 528 | } |
546 | 529 | ||
547 | function indicarPassword(vendedor) { | 530 | function indicarPassword(vendedor) { |
548 | 531 | ||
549 | return new Promise(function (resolve, reject) { | 532 | return new Promise(function (resolve, reject) { |
550 | 533 | ||
551 | focaModalService | 534 | focaModalService |
552 | .prompt({ | 535 | .prompt({ |
553 | titulo: 'Indique Contraseña', | 536 | titulo: 'Indique Contraseña', |
554 | value: '' | 537 | value: '' |
555 | }) | 538 | }) |
556 | .then(function (contraseña) { | 539 | .then(function (contraseña) { |
557 | 540 | ||
558 | if (contraseña != vendedor.ClaVen.trim()) { | 541 | if (contraseña != vendedor.ClaVen.trim()) { |
559 | 542 | ||
560 | focaModalService.alert('Clave incorrecta').then(function () { | 543 | focaModalService.alert('Clave incorrecta').then(function () { |
561 | indicarPassword(vendedor); | 544 | indicarPassword(vendedor); |
562 | }); | 545 | }); |
563 | } else { | 546 | } else { |
564 | resolve(); | 547 | resolve(); |
565 | } | 548 | } |
566 | }) | 549 | }) |
567 | .catch(reject); | 550 | .catch(reject); |
568 | }); | 551 | }); |
569 | } | 552 | } |
570 | 553 | ||
571 | function validarPlanillaVendedor(vendedor) { | 554 | function validarPlanillaVendedor(vendedor) { |
572 | 555 | ||
573 | return new Promise(function (resolve, reject) { | 556 | return new Promise(function (resolve, reject) { |
574 | 557 | ||
575 | crearFacturaService | 558 | crearFacturaService |
576 | .validarPlanillaVendedor(vendedor.CodVen.trim()) | 559 | .validarPlanillaVendedor(vendedor.CodVen.trim()) |
577 | .then(function (res) { | 560 | .then(function (res) { |
578 | 561 | ||
579 | if (!res.data.length) { | 562 | if (!res.data.length) { |
580 | 563 | ||
581 | focaModalService | 564 | focaModalService |
582 | .alert('No se encontró planilla abierta para el vendedor') | 565 | .alert('No se encontró planilla abierta para el vendedor') |
583 | .then(reject); | 566 | .then(reject); |
584 | 567 | ||
585 | } else { | 568 | } else { |
586 | resolve(); | 569 | resolve(); |
587 | } | 570 | } |
588 | 571 | ||
589 | }) | 572 | }) |
590 | .catch(reject); | 573 | .catch(reject); |
591 | }); | 574 | }); |
592 | } | 575 | } |
593 | 576 | ||
594 | function rellenar(relleno, longitud) { | 577 | function rellenar(relleno, longitud) { |
595 | relleno = '' + relleno; | 578 | relleno = '' + relleno; |
596 | while (relleno.length < longitud) { | 579 | while (relleno.length < longitud) { |
597 | relleno = '0' + relleno; | 580 | relleno = '0' + relleno; |
598 | } | 581 | } |
599 | return relleno; | 582 | return relleno; |
600 | } | 583 | } |
601 | 584 | ||
602 | function salir() { | 585 | function salir() { |
603 | var confirmacion = false; | 586 | var confirmacion = false; |
604 | 587 | ||
605 | if (!angular.equals($scope.factura, $scope.inicial)) { | 588 | if (!angular.equals($scope.factura, $scope.inicial)) { |
606 | confirmacion = true; | 589 | confirmacion = true; |
607 | } | 590 | } |
608 | 591 | ||
609 | if (confirmacion) { | 592 | if (confirmacion) { |
610 | focaModalService.confirm( | 593 | focaModalService.confirm( |
611 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 594 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
612 | ).then(function (data) { | 595 | ).then(function (data) { |
613 | if (data) { | 596 | if (data) { |
614 | $location.path('/'); | 597 | $location.path('/'); |
615 | } | 598 | } |
616 | }); | 599 | }); |
617 | } else { | 600 | } else { |
618 | $location.path('/'); | 601 | $location.path('/'); |
619 | } | 602 | } |
620 | } | 603 | } |
621 | 604 | ||
622 | function setearFactura(factura) { | 605 | function setearFactura(factura) { |
623 | 606 | ||
624 | $scope.$broadcast('cleanCabecera'); | 607 | $scope.$broadcast('cleanCabecera'); |
625 | 608 | ||
626 | $scope.cabeceras = []; | 609 | $scope.cabeceras = []; |
627 | 610 | ||
628 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | 611 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
629 | $scope.cabeceras.push({ | 612 | $scope.cabeceras.push({ |
630 | label: 'Moneda:', | 613 | label: 'Moneda:', |
631 | valor: factura.cotizacion.moneda.DETALLE | 614 | valor: factura.cotizacion.moneda.DETALLE |
632 | }); | 615 | }); |
633 | $scope.cabeceras.push({ | 616 | $scope.cabeceras.push({ |
634 | label: 'Fecha cotizacion:', | 617 | label: 'Fecha cotizacion:', |
635 | valor: $filter('date')(factura.cotizacion.FECHA, | 618 | valor: $filter('date')(factura.cotizacion.FECHA, |
636 | 'dd/MM/yyyy') | 619 | 'dd/MM/yyyy') |
637 | }); | 620 | }); |
638 | $scope.cabeceras.push({ | 621 | $scope.cabeceras.push({ |
639 | label: 'Cotizacion:', | 622 | label: 'Cotizacion:', |
640 | valor: $filter('number')(factura.cotizacion.VENDEDOR, | 623 | valor: $filter('number')(factura.cotizacion.VENDEDOR, |
641 | '2') | 624 | '2') |
642 | }); | 625 | }); |
643 | } | 626 | } |
644 | 627 | ||
645 | if (factura.cotizacion && factura.cotizacion.moneda) { | 628 | if (factura.cotizacion && factura.cotizacion.moneda) { |
646 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; | 629 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
647 | } | 630 | } |
648 | 631 | ||
649 | if (factura.cliente && factura.cliente.cod) { | 632 | if (factura.cliente && factura.cliente.cod) { |
650 | $scope.cabeceras.push({ | 633 | $scope.cabeceras.push({ |
651 | label: 'Cliente:', | 634 | label: 'Cliente:', |
652 | valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + | 635 | valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + |
653 | factura.cliente.nom | 636 | factura.cliente.nom |
654 | }); | 637 | }); |
655 | 638 | ||
656 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 639 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
657 | } | 640 | } |
658 | 641 | ||
659 | $scope.puntoVenta = rellenar(factura.sucursal, 4); | 642 | $scope.puntoVenta = rellenar(factura.sucursal, 4); |
660 | $scope.comprobante = rellenar(factura.numerofactura, 8); | 643 | $scope.comprobante = rellenar(factura.numerofactura, 8); |
661 | $scope.factura = factura; | 644 | $scope.factura = factura; |
662 | 645 | ||
663 | addArrayCabecera($scope.cabeceras); | 646 | addArrayCabecera($scope.cabeceras); |
664 | } | 647 | } |
665 | 648 | ||
666 | function getLSFactura() { | 649 | function getLSFactura() { |
667 | var factura = JSON.parse($localStorage.factura || null); | 650 | var factura = JSON.parse($localStorage.factura || null); |
668 | if (factura) { | 651 | if (factura) { |
669 | setearFactura(factura); | 652 | setearFactura(factura); |
670 | delete $localStorage.factura; | 653 | delete $localStorage.factura; |
671 | } | 654 | } |
672 | } | 655 | } |
673 | 656 | ||
674 | function addArrayCabecera(array) { | 657 | function addArrayCabecera(array) { |
675 | for (var i = 0; i < array.length; i++) { | 658 | for (var i = 0; i < array.length; i++) { |
676 | $scope.$broadcast('addCabecera', { | 659 | $scope.$broadcast('addCabecera', { |
677 | label: array[i].label, | 660 | label: array[i].label, |
678 | valor: array[i].valor | 661 | valor: array[i].valor |
679 | }); | 662 | }); |
680 | } | 663 | } |
681 | } | 664 | } |
682 | 665 | ||
683 | function actualizarCabeceraMoneda(cotizacion) { | 666 | function actualizarCabeceraMoneda(cotizacion) { |
684 | 667 | ||
685 | $scope.factura.articulosFactura.forEach(function (art) { | 668 | $scope.factura.articulosFactura.forEach(function (art) { |
686 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); | 669 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); |
687 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); | 670 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); |
688 | }); | 671 | }); |
689 | 672 | ||
690 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { | 673 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { |
691 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 674 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
692 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 675 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
693 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 676 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
694 | } else { | 677 | } else { |
695 | $scope.$broadcast('addCabecera', { | 678 | $scope.$broadcast('addCabecera', { |
696 | label: 'Moneda:', | 679 | label: 'Moneda:', |
697 | valor: cotizacion.moneda.DETALLE | 680 | valor: cotizacion.moneda.DETALLE |
698 | }); | 681 | }); |
699 | $scope.$broadcast('addCabecera', { | 682 | $scope.$broadcast('addCabecera', { |
700 | label: 'Fecha cotizacion:', | 683 | label: 'Fecha cotizacion:', |
701 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 684 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
702 | }); | 685 | }); |
703 | $scope.$broadcast('addCabecera', { | 686 | $scope.$broadcast('addCabecera', { |
704 | label: 'Cotizacion:', | 687 | label: 'Cotizacion:', |
705 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 688 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
706 | }); | 689 | }); |
707 | } | 690 | } |
708 | } | 691 | } |
709 | 692 | ||
710 | function validarGuardar() { | 693 | function validarGuardar() { |
711 | 694 | ||
712 | if (angular.equals({}, $scope.factura.vendedor)) { | 695 | if (angular.equals({}, $scope.factura.vendedor)) { |
713 | 696 | ||
714 | focaModalService.alert('Seleccione Vendedor'); | 697 | focaModalService.alert('Seleccione Vendedor'); |
715 | return false; | 698 | return false; |
716 | } else if (angular.equals({}, $scope.factura.cliente)) { | 699 | } else if (angular.equals({}, $scope.factura.cliente)) { |
717 | 700 | ||
718 | focaModalService.alert('Seleccione Cliente') | 701 | focaModalService.alert('Seleccione Cliente') |
719 | return false; | 702 | return false; |
720 | } else if (!$scope.articulosFiltro().length) { | 703 | } else if (!$scope.articulosFiltro().length) { |
721 | 704 | ||
722 | focaModalService.alert('Seleccione al menos un Articulo'); | 705 | focaModalService.alert('Seleccione al menos un Articulo'); |
723 | return false; | 706 | return false; |
724 | } | 707 | } |
725 | 708 | ||
726 | return true; | 709 | return true; |
727 | } | 710 | } |
728 | } | 711 | } |
729 | ]); | 712 | ]); |
730 | 713 |