Commit c715b4d4c1cf7b83f97d2bb8538a2bf908d3a6f6
1 parent
0994b282cc
Exists in
master
cc abre solo si cliente posee cc
Showing
2 changed files
with
96 additions
and
84 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', 'focaLoginService', | 4 | '$localStorage', 'APP', 'focaLoginService', |
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, loginServ) { | 7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage, APP, loginServ) { |
8 | 8 | ||
9 | config(); | 9 | config(); |
10 | 10 | ||
11 | function config() { | 11 | function config() { |
12 | $scope.tmpCantidad = '0'; | 12 | $scope.tmpCantidad = '0'; |
13 | $scope.botonera = crearFacturaService.getBotonera(); | 13 | $scope.botonera = crearFacturaService.getBotonera(); |
14 | $scope.botoneraProductos = []; | 14 | $scope.botoneraProductos = []; |
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.showPagar(true, $scope.seleccionarFormaDePago); | 50 | focaBotoneraLateralService.showPagar(true, $scope.seleccionarFormaDePago); |
51 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); | 51 | focaBotoneraLateralService.addCustomButton('Salir', $scope.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 | formaPago: 1, // Por defecto paga contado | 70 | formaPago: 1, // Por defecto paga contado |
71 | cotizacion: $scope.cotizacionPorDefecto || {}, | 71 | cotizacion: $scope.cotizacionPorDefecto || {}, |
72 | articulosFactura: [], | 72 | articulosFactura: [], |
73 | despachos: [] | 73 | despachos: [] |
74 | }; | 74 | }; |
75 | 75 | ||
76 | $scope.estadoCuenta = { | ||
77 | autorizado: 0.0, | ||
78 | extracciones: 0.0, | ||
79 | saldo: 0.0, | ||
80 | situacion: false, | ||
81 | facturasVencidas: 0.0 | ||
82 | }; | ||
83 | |||
76 | $scope.factura.articulosFactura = []; | 84 | $scope.factura.articulosFactura = []; |
77 | $scope.idLista = undefined; | 85 | $scope.idLista = undefined; |
78 | 86 | ||
79 | $scope.inicial = angular.copy($scope.factura); | 87 | $scope.inicial = angular.copy($scope.factura); |
80 | 88 | ||
81 | getNumeroFactura('B'); | 89 | getNumeroFactura('B'); |
82 | 90 | ||
83 | if (APP === 'facturador') { | 91 | if (APP === 'facturador') { |
84 | crearFacturaService | 92 | crearFacturaService |
85 | .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya) | 93 | .getVendedorPlayaById(loginServ.getLoginData().vendedorPlaya) |
86 | .then(function (res) { | 94 | .then(function (res) { |
87 | 95 | ||
88 | validarPlanillaVendedor(res.data) | 96 | validarPlanillaVendedor(res.data) |
89 | .then(function () { | 97 | .then(function () { |
90 | 98 | ||
91 | $scope.$broadcast('addCabecera', { | 99 | $scope.$broadcast('addCabecera', { |
92 | label: 'Vendedor:', | 100 | label: 'Vendedor:', |
93 | valor: $filter('rellenarDigitos')(res.data.CodVen, 3) + | 101 | valor: $filter('rellenarDigitos')(res.data.CodVen, 3) + |
94 | ' - ' + | 102 | ' - ' + |
95 | res.data.NomVen | 103 | res.data.NomVen |
96 | }); | 104 | }); |
97 | $scope.$broadcast('addCabecera', { | 105 | $scope.$broadcast('addCabecera', { |
98 | label: 'Planilla:', | 106 | label: 'Planilla:', |
99 | valor: res.data.NplVen | 107 | valor: res.data.NplVen |
100 | }); | 108 | }); |
101 | 109 | ||
102 | $scope.factura.vendedor = res.data; | 110 | $scope.factura.vendedor = res.data; |
103 | $scope.inicial.vendedor = res.data; | 111 | $scope.inicial.vendedor = res.data; |
104 | 112 | ||
105 | getProductosByPlanilla(res.data.NplVen); | 113 | getProductosByPlanilla(res.data.NplVen); |
106 | }) | 114 | }) |
107 | .catch(function (err) { | 115 | .catch(function (err) { |
108 | console.log(err); | 116 | console.log(err); |
109 | focaModalService.alert('Ocurrió un error al intentar recuperar' + | 117 | focaModalService.alert('Ocurrió un error al intentar recuperar' + |
110 | 'el vendedor logeado'); | 118 | 'el vendedor logeado'); |
111 | }); | 119 | }); |
112 | }); | 120 | }); |
113 | } | 121 | } |
114 | } | 122 | } |
115 | 123 | ||
116 | $scope.$watch('factura', function (newValue) { | 124 | $scope.$watch('factura', function (newValue) { |
117 | focaBotoneraLateralService.setPausarData({ | 125 | focaBotoneraLateralService.setPausarData({ |
118 | label: 'factura', | 126 | label: 'factura', |
119 | val: newValue | 127 | val: newValue |
120 | }); | 128 | }); |
121 | }, true); | 129 | }, true); |
122 | 130 | ||
123 | $scope.seleccionarFormaDePago = function () { | 131 | $scope.seleccionarFormaDePago = function () { |
124 | 132 | ||
125 | if (!validarGuardar()) return; | 133 | if (!validarGuardar()) return; |
126 | 134 | ||
127 | if ($scope.factura.formaPago === 2) { | 135 | if ($scope.factura.formaPago === 2) { |
128 | $scope.crearFactura(); | 136 | $scope.crearFactura(); |
129 | return; | 137 | return; |
130 | } | 138 | } |
131 | 139 | ||
132 | var modalInstance = $uibModal.open( | 140 | var modalInstance = $uibModal.open( |
133 | { | 141 | { |
134 | templateUrl: 'modal-forma-pago.html', | 142 | templateUrl: 'modal-forma-pago.html', |
135 | controller: 'focaModalFormaPagoController', | 143 | controller: 'focaModalFormaPagoController', |
136 | resolve: { | 144 | resolve: { |
137 | parametros: function () { | 145 | parametros: function () { |
138 | return { | 146 | return { |
139 | importe: $scope.getTotal() | 147 | importe: $scope.getTotal() |
140 | }; | 148 | }; |
141 | }, | 149 | }, |
142 | }, | 150 | }, |
143 | size: 'lg', | 151 | size: 'lg', |
144 | } | 152 | } |
145 | ); | 153 | ); |
146 | modalInstance.result | 154 | modalInstance.result |
147 | .then(function (data) { | 155 | .then(function (data) { |
148 | 156 | ||
149 | if (data.tipo === 'tarjeta') { | 157 | if (data.tipo === 'tarjeta') { |
150 | $scope.factura.formaPago = 4; | 158 | $scope.factura.formaPago = 4; |
151 | } else { | 159 | } else { |
152 | $scope.factura.formaPago = 1; | 160 | $scope.factura.formaPago = 1; |
153 | } | 161 | } |
154 | 162 | ||
155 | $scope.crearFactura(data); | 163 | $scope.crearFactura(data); |
156 | }) | 164 | }) |
157 | .catch(function (e) { console.error(e); }); | 165 | .catch(function (e) { console.error(e); }); |
158 | }; | 166 | }; |
159 | 167 | ||
160 | $scope.crearFactura = function (formaPago) { | 168 | $scope.crearFactura = function (formaPago) { |
161 | 169 | ||
162 | var save = { | 170 | var save = { |
163 | factura: { | 171 | factura: { |
164 | 172 | ||
165 | BONIF: 0, | 173 | BONIF: 0, |
166 | CLI: $scope.factura.cliente.COD, | 174 | CLI: $scope.factura.cliente.COD, |
167 | CUI: $scope.factura.cliente.CUIT, | 175 | CUI: $scope.factura.cliente.CUIT, |
168 | CTA: $scope.factura.cliente.COD, | 176 | CTA: $scope.factura.cliente.COD, |
169 | DC1: '', | 177 | DC1: '', |
170 | DC2: '', | 178 | DC2: '', |
171 | DE1: '', | 179 | DE1: '', |
172 | DOM: $scope.factura.cliente.DOM, | 180 | DOM: $scope.factura.cliente.DOM, |
173 | FACAUT: 0, | 181 | FACAUT: 0, |
174 | DTO: 0, | 182 | DTO: 0, |
175 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), | 183 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), |
176 | FEC_ANT: '19000101', | 184 | FEC_ANT: '19000101', |
177 | FPA: $scope.factura.formaPago, | 185 | FPA: $scope.factura.formaPago, |
178 | IDEXCEPCION: 0, | 186 | IDEXCEPCION: 0, |
179 | IDLP: $scope.factura.cliente.MOD.trim() || 0, | 187 | IDLP: $scope.factura.cliente.MOD.trim() || 0, |
180 | IDPERSONERIA: 0, | 188 | IDPERSONERIA: 0, |
181 | IMI: getImporte('IMI'), | 189 | IMI: getImporte('IMI'), |
182 | IMI2: getImporte('IMI2'), | 190 | IMI2: getImporte('IMI2'), |
183 | IMI3: getImporte('IMI3'), | 191 | IMI3: getImporte('IMI3'), |
184 | IMP_LEY: 0, | 192 | IMP_LEY: 0, |
185 | IRI: getImporte('IVA'), | 193 | IRI: getImporte('IVA'), |
186 | IRS: 0, | 194 | IRS: 0, |
187 | LEG: '', | 195 | LEG: '', |
188 | LUG: $scope.factura.vendedor.LugVen, | 196 | LUG: $scope.factura.vendedor.LugVen, |
189 | MK_M: 0, | 197 | MK_M: 0, |
190 | NEE: getImporte('NEX'), | 198 | NEE: getImporte('NEX'), |
191 | NET: getImporte('NET'), | 199 | NET: getImporte('NET'), |
192 | NFI: '', | 200 | NFI: '', |
193 | NNP: 0, | 201 | NNP: 0, |
194 | NOM: $scope.factura.cliente.NOM, | 202 | NOM: $scope.factura.cliente.NOM, |
195 | OPE: $scope.factura.vendedor.CodVen, | 203 | OPE: $scope.factura.vendedor.CodVen, |
196 | PAG: $scope.getTotal(), | 204 | PAG: $scope.getTotal(), |
197 | PER: 0, | 205 | PER: 0, |
198 | PER_IVA: 0, | 206 | PER_IVA: 0, |
199 | PLA: $scope.factura.vendedor.NplVen, | 207 | PLA: $scope.factura.vendedor.NplVen, |
200 | PRO: '', | 208 | PRO: '', |
201 | REC_ANT: 0, | 209 | REC_ANT: 0, |
202 | SUC: parseInt($scope.puntoVenta), | 210 | SUC: parseInt($scope.puntoVenta), |
203 | TCA: 1, | 211 | TCA: 1, |
204 | TCO: 'FT', | 212 | TCO: 'FT', |
205 | TFI: '', | 213 | TFI: '', |
206 | TIP: $scope.factura.cliente.TIP, | 214 | TIP: $scope.factura.cliente.TIP, |
207 | TIV: $scope.factura.cliente.IVA, | 215 | TIV: $scope.factura.cliente.IVA, |
208 | TOT: $scope.getTotal(), | 216 | TOT: $scope.getTotal(), |
209 | TUR: $scope.factura.vendedor.TurVen, | 217 | TUR: $scope.factura.vendedor.TurVen, |
210 | VEN: $scope.factura.vendedor.CodVen, | 218 | VEN: $scope.factura.vendedor.CodVen, |
211 | VTO_CLI: '', | 219 | VTO_CLI: '', |
212 | ZON: 1, // TODO: ZON DE APAREMP | 220 | ZON: 1, // TODO: ZON DE APAREMP |
213 | OBSERVACIONES: $scope.factura.observaciones | 221 | OBSERVACIONES: $scope.factura.observaciones |
214 | }, | 222 | }, |
215 | cuerpo: $scope.articulosFiltro(), | 223 | cuerpo: $scope.articulosFiltro(), |
216 | despachos: $scope.factura.despachos, | 224 | despachos: $scope.factura.despachos, |
217 | formaPago: formaPago | 225 | formaPago: formaPago |
218 | }; | 226 | }; |
219 | 227 | ||
220 | crearFacturaService.guardarFactura(save).then(function () { | 228 | crearFacturaService.guardarFactura(save).then(function () { |
221 | 229 | ||
222 | focaBotoneraLateralService.endGuardar(true); | 230 | focaBotoneraLateralService.endGuardar(true); |
223 | 231 | ||
224 | focaModalService.alert('Comprobante guardado con éxito'); | 232 | focaModalService.alert('Comprobante guardado con éxito'); |
225 | 233 | ||
226 | config(); | 234 | config(); |
227 | 235 | ||
228 | }).catch(function (err) { | 236 | }).catch(function (err) { |
229 | focaModalService.alert('Hubo un error al guardar la factura'); | 237 | focaModalService.alert('Hubo un error al guardar la factura'); |
230 | console.error(err); | 238 | console.error(err); |
231 | }); | 239 | }); |
232 | 240 | ||
233 | }; | 241 | }; |
234 | 242 | ||
235 | $scope.seleccionarCliente = function () { | 243 | $scope.seleccionarCliente = function () { |
236 | 244 | ||
237 | var modalInstance = $uibModal.open( | 245 | var modalInstance = $uibModal.open( |
238 | { | 246 | { |
239 | ariaLabelledBy: 'Busqueda de Cliente', | 247 | ariaLabelledBy: 'Busqueda de Cliente', |
240 | templateUrl: 'foca-busqueda-cliente-modal.html', | 248 | templateUrl: 'foca-busqueda-cliente-modal.html', |
241 | controller: 'focaBusquedaClienteModalController', | 249 | controller: 'focaBusquedaClienteModalController', |
242 | resolve: { | 250 | resolve: { |
243 | parametros: function () { | 251 | parametros: function () { |
244 | return { | 252 | return { |
245 | vendedor: function () { return null; }, | 253 | vendedor: function () { return null; }, |
246 | cobrador: function () { return null; } | 254 | cobrador: function () { return null; } |
247 | }; | 255 | }; |
248 | } | 256 | } |
249 | }, | 257 | }, |
250 | size: 'lg' | 258 | size: 'lg' |
251 | } | 259 | } |
252 | ); | 260 | ); |
253 | modalInstance.result.then( | 261 | modalInstance.result.then( |
254 | function (cliente) { | 262 | function (cliente) { |
255 | var modalInstance = $uibModal.open( | 263 | crearFacturaService.getResumenCuenta(cliente.COD) |
256 | { | 264 | .then(function (res) { |
257 | templateUrl: 'modal-estado-cuenta.html', | 265 | $scope.estadoCuenta = res.data[0]; |
258 | controller: 'focaModalEstadoCuentaController', | 266 | if ($scope.estadoCuenta.autorizado > 0) { |
259 | size: 'lg', | 267 | var modalInstance = $uibModal.open( |
260 | resolve: { | 268 | { |
261 | parametros: function () { | 269 | templateUrl: 'modal-estado-cuenta.html', |
262 | return { | 270 | controller: 'focaModalEstadoCuentaController', |
263 | idCliente: cliente.COD, | 271 | size: 'lg', |
264 | nombreCliente: cliente.NOM | 272 | resolve: { |
265 | }; | 273 | parametros: function () { |
266 | }, | 274 | return { |
267 | } | 275 | idCliente: cliente.COD, |
268 | } | 276 | nombreCliente: cliente.NOM |
269 | ); | 277 | }; |
278 | }, | ||
279 | } | ||
280 | } | ||
281 | ) | ||
282 | }; | ||
283 | |||
284 | }) | ||
285 | .catch(function (err) { console.error(err); }) | ||
286 | |||
287 | |||
270 | modalInstance.result | 288 | modalInstance.result |
271 | .then(function (data) { | 289 | .then(function (data) { |
272 | 290 | ||
273 | $scope.factura.formaPago = data.formaDePago; | 291 | $scope.factura.formaPago = data.formaDePago; |
274 | $scope.factura.cliente = cliente; | 292 | $scope.factura.cliente = cliente; |
275 | 293 | ||
276 | getNumeroFactura(cliente.TIP); | 294 | getNumeroFactura(cliente.TIP); |
277 | 295 | ||
278 | $scope.$broadcast('addCabecera', { | 296 | $scope.$broadcast('addCabecera', { |
279 | label: 'Cliente:', | 297 | label: 'Cliente:', |
280 | valor: $filter('rellenarDigitos')(cliente.COD, 3) + | 298 | valor: $filter('rellenarDigitos')(cliente.COD, 3) + |
281 | ' - ' + cliente.NOM | 299 | ' - ' + cliente.NOM |
282 | }); | 300 | }); |
283 | 301 | ||
284 | $filter('filter')($scope.botonera, | 302 | $filter('filter')($scope.botonera, |
285 | { label: 'Cliente' })[0].checked = true; | 303 | { label: 'Cliente' })[0].checked = true; |
286 | 304 | ||
287 | $scope.$broadcast('addCabecera', { | 305 | $scope.$broadcast('addCabecera', { |
288 | label: 'Forma de pago: ', | 306 | label: 'Forma de pago: ', |
289 | valor: data.tipo | 307 | valor: data.tipo |
290 | }); | 308 | }); |
291 | }) | 309 | }) |
292 | .catch($scope.seleccionarCliente); | 310 | .catch($scope.seleccionarCliente); |
293 | 311 | ||
294 | }, function () { | 312 | }, function () { |
295 | } | 313 | } |
296 | ); | 314 | ); |
297 | 315 | ||
298 | }; | 316 | }; |
299 | 317 | ||
300 | $scope.seleccionarVendedor = function () { | 318 | $scope.seleccionarVendedor = function () { |
301 | var parametrosModal = { | 319 | var parametrosModal = { |
302 | titulo: 'Búsqueda vendedores', | 320 | titulo: 'Búsqueda vendedores', |
303 | query: '/vendedor-playa', | 321 | query: '/vendedor-playa', |
304 | columnas: [ | 322 | columnas: [ |
305 | { | 323 | { |
306 | propiedad: 'CodVen', | 324 | propiedad: 'CodVen', |
307 | nombre: 'Código', | 325 | nombre: 'Código', |
308 | filtro: { | 326 | filtro: { |
309 | nombre: 'rellenarDigitos', | 327 | nombre: 'rellenarDigitos', |
310 | parametro: 3 | 328 | parametro: 3 |
311 | } | 329 | } |
312 | }, | 330 | }, |
313 | { | 331 | { |
314 | propiedad: 'NomVen', | 332 | propiedad: 'NomVen', |
315 | nombre: 'Nombre' | 333 | nombre: 'Nombre' |
316 | } | 334 | } |
317 | ], | 335 | ], |
318 | size: 'md' | 336 | size: 'md' |
319 | }; | 337 | }; |
320 | focaModalService.modal(parametrosModal).then( | 338 | focaModalService.modal(parametrosModal).then( |
321 | function (vendedor) { | 339 | function (vendedor) { |
322 | 340 | ||
323 | indicarPassword(vendedor) | 341 | indicarPassword(vendedor) |
324 | .then(function () { | 342 | .then(function () { |
325 | validarPlanillaVendedor(vendedor) | 343 | validarPlanillaVendedor(vendedor) |
326 | .then(function () { | 344 | .then(function () { |
327 | 345 | ||
328 | $filter('filter')($scope.botonera, { | 346 | $filter('filter')($scope.botonera, { |
329 | label: 'Vendedor' | 347 | label: 'Vendedor' |
330 | })[0].checked = true; | 348 | })[0].checked = true; |
331 | 349 | ||
332 | $scope.$broadcast('addCabecera', { | 350 | $scope.$broadcast('addCabecera', { |
333 | label: 'Vendedor:', | 351 | label: 'Vendedor:', |
334 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + | 352 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + |
335 | ' - ' + | 353 | ' - ' + |
336 | vendedor.NomVen | 354 | vendedor.NomVen |
337 | }); | 355 | }); |
338 | $scope.$broadcast('addCabecera', { | 356 | $scope.$broadcast('addCabecera', { |
339 | label: 'Planilla:', | 357 | label: 'Planilla:', |
340 | valor: vendedor.NplVen | 358 | valor: vendedor.NplVen |
341 | }); | 359 | }); |
342 | 360 | ||
343 | $scope.factura.vendedor = vendedor; | 361 | $scope.factura.vendedor = vendedor; |
344 | 362 | ||
345 | getProductosByPlanilla(vendedor.NplVen); | 363 | getProductosByPlanilla(vendedor.NplVen); |
346 | }) | 364 | }) |
347 | .catch($scope.seleccionarVendedor); | 365 | .catch($scope.seleccionarVendedor); |
348 | }) | 366 | }) |
349 | .catch(function (err) { | 367 | .catch(function (err) { |
350 | console.error(err); | 368 | console.error(err); |
351 | }); | 369 | }); |
352 | 370 | ||
353 | }, function () { } | 371 | }, function () { } |
354 | ); | 372 | ); |
355 | }; | 373 | }; |
356 | 374 | ||
357 | $scope.seleccionarMoneda = function () { | 375 | $scope.seleccionarMoneda = function () { |
358 | 376 | ||
359 | var parametrosModal = { | 377 | var parametrosModal = { |
360 | titulo: 'Búsqueda de monedas', | 378 | titulo: 'Búsqueda de monedas', |
361 | query: '/moneda', | 379 | query: '/moneda', |
362 | columnas: [ | 380 | columnas: [ |
363 | { | 381 | { |
364 | propiedad: 'DETALLE', | 382 | propiedad: 'DETALLE', |
365 | nombre: 'Nombre' | 383 | nombre: 'Nombre' |
366 | }, | 384 | }, |
367 | { | 385 | { |
368 | propiedad: 'SIMBOLO', | 386 | propiedad: 'SIMBOLO', |
369 | nombre: 'Símbolo' | 387 | nombre: 'Símbolo' |
370 | } | 388 | } |
371 | ], | 389 | ], |
372 | size: 'md' | 390 | size: 'md' |
373 | }; | 391 | }; |
374 | focaModalService.modal(parametrosModal).then( | 392 | focaModalService.modal(parametrosModal).then( |
375 | function (moneda) { | 393 | function (moneda) { |
376 | 394 | ||
377 | if (moneda.ID !== 1) { | 395 | if (moneda.ID !== 1) { |
378 | $scope.abrirModalCotizacion(moneda); | 396 | $scope.abrirModalCotizacion(moneda); |
379 | return; | 397 | return; |
380 | } | 398 | } |
381 | 399 | ||
382 | crearRemitoService.getCotizacionByIdMoneda(1) | 400 | crearRemitoService.getCotizacionByIdMoneda(1) |
383 | .then(function (res) { | 401 | .then(function (res) { |
384 | 402 | ||
385 | var cotizacionPArgentino = res.data[0].cotizaciones[0]; | 403 | var cotizacionPArgentino = res.data[0].cotizaciones[0]; |
386 | cotizacionPArgentino.moneda = moneda; | 404 | cotizacionPArgentino.moneda = moneda; |
387 | 405 | ||
388 | actualizarCabeceraMoneda(cotizacionPArgentino); | 406 | actualizarCabeceraMoneda(cotizacionPArgentino); |
389 | 407 | ||
390 | $scope.remito.cotizacion = cotizacionPArgentino; | 408 | $scope.remito.cotizacion = cotizacionPArgentino; |
391 | }); | 409 | }); |
392 | }, function () { | 410 | }, function () { |
393 | 411 | ||
394 | } | 412 | } |
395 | ); | 413 | ); |
396 | }; | 414 | }; |
397 | 415 | ||
398 | $scope.abrirModalCotizacion = function (moneda) { | 416 | $scope.abrirModalCotizacion = function (moneda) { |
399 | var modalInstance = $uibModal.open( | 417 | var modalInstance = $uibModal.open( |
400 | { | 418 | { |
401 | ariaLabelledBy: 'Busqueda de Cotización', | 419 | ariaLabelledBy: 'Busqueda de Cotización', |
402 | templateUrl: 'modal-cotizacion.html', | 420 | templateUrl: 'modal-cotizacion.html', |
403 | controller: 'focaModalCotizacionController', | 421 | controller: 'focaModalCotizacionController', |
404 | size: 'lg', | 422 | size: 'lg', |
405 | resolve: { idMoneda: function () { return moneda.ID; } } | 423 | resolve: { idMoneda: function () { return moneda.ID; } } |
406 | } | 424 | } |
407 | ); | 425 | ); |
408 | modalInstance.result.then( | 426 | modalInstance.result.then( |
409 | function (cotizacion) { | 427 | function (cotizacion) { |
410 | 428 | ||
411 | cotizacion.moneda = moneda; | 429 | cotizacion.moneda = moneda; |
412 | actualizarCabeceraMoneda(cotizacion); | 430 | actualizarCabeceraMoneda(cotizacion); |
413 | $scope.factura.cotizacion = cotizacion; | 431 | $scope.factura.cotizacion = cotizacion; |
414 | 432 | ||
415 | }, function () { | 433 | }, function () { |
416 | 434 | ||
417 | } | 435 | } |
418 | ); | 436 | ); |
419 | }; | 437 | }; |
420 | 438 | ||
421 | $scope.seleccionarObservaciones = function () { | 439 | $scope.seleccionarObservaciones = function () { |
422 | var observacion = { | 440 | var observacion = { |
423 | titulo: 'Ingrese Observaciones', | 441 | titulo: 'Ingrese Observaciones', |
424 | value: $scope.factura.observaciones, | 442 | value: $scope.factura.observaciones, |
425 | maxlength: 155, | 443 | maxlength: 155, |
426 | textarea: true | 444 | textarea: true |
427 | }; | 445 | }; |
428 | 446 | ||
429 | focaModalService | 447 | focaModalService |
430 | .prompt(observacion) | 448 | .prompt(observacion) |
431 | .then(function (observaciones) { | 449 | .then(function (observaciones) { |
432 | $scope.factura.observaciones = observaciones; | 450 | $scope.factura.observaciones = observaciones; |
433 | }); | 451 | }); |
434 | }; | 452 | }; |
435 | 453 | ||
436 | $scope.articulosFiltro = function () { | 454 | $scope.articulosFiltro = function () { |
437 | return $scope.factura.articulosFactura.filter(function (articulo) { | 455 | return $scope.factura.articulosFactura.filter(function (articulo) { |
438 | return !articulo.desactivado; | 456 | return !articulo.desactivado; |
439 | }); | 457 | }); |
440 | }; | 458 | }; |
441 | 459 | ||
442 | $scope.getTotal = function () { | 460 | $scope.getTotal = function () { |
443 | 461 | ||
444 | var total = 0; | 462 | var total = 0; |
445 | 463 | ||
446 | $scope.articulosFiltro().forEach(function (articulo) { | 464 | $scope.articulosFiltro().forEach(function (articulo) { |
447 | total += articulo.PUN * articulo.CAN; | 465 | total += articulo.PUN * articulo.CAN; |
448 | }); | 466 | }); |
449 | 467 | ||
450 | return parseFloat(total.toFixed(2)); | 468 | return parseFloat(total.toFixed(2)); |
451 | }; | 469 | }; |
452 | 470 | ||
453 | $scope.quitarDespacho = function (articulo, index) { | 471 | $scope.quitarDespacho = function (articulo, index) { |
454 | 472 | ||
455 | if (articulo.SUR === 0) { | 473 | if (articulo.SUR === 0) { |
456 | articulo.desactivado = true; | 474 | articulo.desactivado = true; |
457 | return; | 475 | return; |
458 | } | 476 | } |
459 | 477 | ||
460 | crearFacturaService | 478 | crearFacturaService |
461 | .setearDespachoDesocupado({ | 479 | .setearDespachoDesocupado({ |
462 | surtidor: $scope.factura.despachos[index].SUR, | 480 | surtidor: $scope.factura.despachos[index].SUR, |
463 | producto: $scope.factura.despachos[index].PRO, | 481 | producto: $scope.factura.despachos[index].PRO, |
464 | carga: $scope.factura.despachos[index].CAR, | 482 | carga: $scope.factura.despachos[index].CAR, |
465 | planilla: $scope.factura.despachos[index].PLA | 483 | planilla: $scope.factura.despachos[index].PLA |
466 | }) | 484 | }) |
467 | .then(function () { | 485 | .then(function () { |
468 | articulo.desactivado = true; | 486 | articulo.desactivado = true; |
469 | $scope.factura.despachos.splice(index, 1); | 487 | $scope.factura.despachos.splice(index, 1); |
470 | }) | 488 | }) |
471 | .catch(function () { | 489 | .catch(function () { |
472 | focaModalService.alert('Hubo un error al desasociar este despacho'); | 490 | focaModalService.alert('Hubo un error al desasociar este despacho'); |
473 | }); | 491 | }); |
474 | }; | 492 | }; |
475 | 493 | ||
476 | //Recibe aviso si el teclado está en uso | 494 | //Recibe aviso si el teclado está en uso |
477 | $rootScope.$on('usarTeclado', function (event, data) { | 495 | $rootScope.$on('usarTeclado', function (event, data) { |
478 | if (data) { | 496 | if (data) { |
479 | $scope.mostrarTeclado = true; | 497 | $scope.mostrarTeclado = true; |
480 | return; | 498 | return; |
481 | } | 499 | } |
482 | $scope.mostrarTeclado = false; | 500 | $scope.mostrarTeclado = false; |
483 | }); | 501 | }); |
484 | 502 | ||
485 | $scope.selectFocus = function ($event) { | 503 | $scope.selectFocus = function ($event) { |
486 | // Si el teclado esta en uso no selecciona el valor | 504 | // Si el teclado esta en uso no selecciona el valor |
487 | if ($scope.mostrarTeclado) { | 505 | if ($scope.mostrarTeclado) { |
488 | return; | 506 | return; |
489 | } | 507 | } |
490 | $event.target.select(); | 508 | $event.target.select(); |
491 | }; | 509 | }; |
492 | 510 | ||
493 | 511 | ||
494 | function getProductosByPlanilla(numeroPlanilla) { | 512 | function getProductosByPlanilla(numeroPlanilla) { |
495 | 513 | ||
496 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { | 514 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function (res) { |
497 | 515 | ||
498 | if (!res.data.length) { | 516 | if (!res.data.length) { |
499 | 517 | ||
500 | focaModalService.alert('No hay despachos disponibles por el momento'); | 518 | focaModalService.alert('No hay despachos disponibles por el momento'); |
501 | return; | 519 | return; |
502 | } | 520 | } |
503 | 521 | ||
504 | $scope.botoneraProductos.length = 0; | 522 | $scope.botoneraProductos.length = 0; |
505 | $scope.topDespachos = res.data[0][0].CID; | 523 | $scope.topDespachos = res.data[0][0].CID; |
506 | 524 | ||
507 | res.data.slice(1, res.data.length).forEach(function (producto) { | 525 | res.data.slice(1, res.data.length).forEach(function (producto) { |
508 | 526 | ||
509 | $scope.botoneraProductos.push({ | 527 | $scope.botoneraProductos.push({ |
510 | label: producto.DetArt, | 528 | label: producto.DetArt, |
511 | image: producto.nombreImagen, | 529 | image: producto.nombreImagen, |
512 | imageDefault: 'productoDefault.png' | 530 | imageDefault: 'productoDefault.png' |
513 | }); | 531 | }); |
514 | 532 | ||
515 | crearFuncionesProductos(producto); | 533 | crearFuncionesProductos(producto); |
516 | }); | 534 | }); |
517 | 535 | ||
518 | $scope.botonera.push({ | 536 | $scope.botonera.push({ |
519 | label: 'Ultimos despachos', | 537 | label: 'Ultimos despachos', |
520 | image: 'ultimos-despachos.png', | 538 | image: 'ultimos-despachos.png', |
521 | imageDefault: 'productoDefault.png' | 539 | imageDefault: 'productoDefault.png' |
522 | }); | 540 | }); |
523 | }); | 541 | }); |
524 | } | 542 | } |
525 | 543 | ||
526 | $scope.seleccionarBusquedaProductos = function () { | 544 | $scope.seleccionarBusquedaProductos = function () { |
527 | 545 | ||
528 | if (angular.equals({}, $scope.factura.vendedor)) { | 546 | if (angular.equals({}, $scope.factura.vendedor)) { |
529 | 547 | ||
530 | focaModalService.alert('Seleccione Vendedor'); | 548 | focaModalService.alert('Seleccione Vendedor'); |
531 | return false; | 549 | return false; |
532 | } | 550 | } |
533 | 551 | ||
534 | var modalInstance = $uibModal.open( | 552 | var modalInstance = $uibModal.open( |
535 | { | 553 | { |
536 | ariaLabelledBy: 'Busqueda de Productos', | 554 | ariaLabelledBy: 'Busqueda de Productos', |
537 | templateUrl: 'modal-busqueda-productos.html', | 555 | templateUrl: 'modal-busqueda-productos.html', |
538 | controller: 'modalBusquedaProductosCtrl', | 556 | controller: 'modalBusquedaProductosCtrl', |
539 | resolve: { | 557 | resolve: { |
540 | parametroProducto: { | 558 | parametroProducto: { |
541 | idLista: null, | 559 | idLista: null, |
542 | cotizacion: $scope.factura.cotizacion.VENDEDOR, | 560 | cotizacion: $scope.factura.cotizacion.VENDEDOR, |
543 | simbolo: $scope.factura.cotizacion.moneda.SIMBOLO, | 561 | simbolo: $scope.factura.cotizacion.moneda.SIMBOLO, |
544 | buscarTodos: true | 562 | buscarTodos: true |
545 | } | 563 | } |
546 | }, | 564 | }, |
547 | size: 'lg' | 565 | size: 'lg' |
548 | } | 566 | } |
549 | ); | 567 | ); |
550 | 568 | ||
551 | modalInstance.result | 569 | modalInstance.result |
552 | .then(function (producto) { | 570 | .then(function (producto) { |
553 | 571 | ||
554 | var articulo = { | 572 | var articulo = { |
555 | TIP: $scope.factura.cliente.TIP, | 573 | TIP: $scope.factura.cliente.TIP, |
556 | TCO: 'FT', | 574 | TCO: 'FT', |
557 | SUC: parseInt($scope.puntoVenta), | 575 | SUC: parseInt($scope.puntoVenta), |
558 | ORD: $scope.articulosFiltro().length + 1, | 576 | ORD: $scope.articulosFiltro().length + 1, |
559 | SEC: producto.sector, | 577 | SEC: producto.sector, |
560 | ART: producto.codigo, | 578 | ART: producto.codigo, |
561 | RUB: producto.CodRub, | 579 | RUB: producto.CodRub, |
562 | DES: producto.descripcionLarga, | 580 | DES: producto.descripcionLarga, |
563 | PUN: producto.precio, | 581 | PUN: producto.precio, |
564 | IVA: producto.IMPIVA, | 582 | IVA: producto.IMPIVA, |
565 | NET: producto.IvaCO !== 0 ? parseFloat(producto.neto) : 0, | 583 | NET: producto.IvaCO !== 0 ? parseFloat(producto.neto) : 0, |
566 | NEX: producto.IvaCO === 0 ? parseFloat(producto.neto) : 0, | 584 | NEX: producto.IvaCO === 0 ? parseFloat(producto.neto) : 0, |
567 | IMI: producto.ImpInt, | 585 | IMI: producto.ImpInt, |
568 | IMI2: producto.ImpInt2, | 586 | IMI2: producto.ImpInt2, |
569 | IMI3: producto.ImpInt3, | 587 | IMI3: producto.ImpInt3, |
570 | PUT: producto.precio, | 588 | PUT: producto.precio, |
571 | SUR: 0, | 589 | SUR: 0, |
572 | PLA: $scope.factura.vendedor.NplVen, | 590 | PLA: $scope.factura.vendedor.NplVen, |
573 | LUG: $scope.factura.vendedor.LugVen, | 591 | LUG: $scope.factura.vendedor.LugVen, |
574 | LEG: $scope.factura.vendedor.CodVen, | 592 | LEG: $scope.factura.vendedor.CodVen, |
575 | TUR: $scope.factura.vendedor.TurVen, | 593 | TUR: $scope.factura.vendedor.TurVen, |
576 | ORDEN_PRECOMPRA: '', | 594 | ORDEN_PRECOMPRA: '', |
577 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | 595 | ESC: producto.tipoFactura === 'L' ? 1 : 0, |
578 | CMF: 0, | 596 | CMF: 0, |
579 | PTA: 0, | 597 | PTA: 0, |
580 | IVS: 0, | 598 | IVS: 0, |
581 | TIVA: 0, | 599 | TIVA: 0, |
582 | CON: 0, | 600 | CON: 0, |
583 | SINO: '', | 601 | SINO: '', |
584 | ORD_TRA: 0, | 602 | ORD_TRA: 0, |
585 | IMP_DESP: 0, | 603 | IMP_DESP: 0, |
586 | PCD: 0, | 604 | PCD: 0, |
587 | RTO: '', | 605 | RTO: '', |
588 | }; | 606 | }; |
589 | 607 | ||
590 | $scope.factura.articulosFactura.push(articulo); | 608 | $scope.factura.articulosFactura.push(articulo); |
591 | $scope.cambioEdit(articulo, 'cantidad'); | 609 | $scope.cambioEdit(articulo, 'cantidad'); |
592 | 610 | ||
593 | }) | 611 | }) |
594 | .catch(function (e) { console.error(e); }); | 612 | .catch(function (e) { console.error(e); }); |
595 | }; | 613 | }; |
596 | 614 | ||
597 | $scope.seleccionarUltimosDespachos = function () { | 615 | $scope.seleccionarUltimosDespachos = function () { |
598 | 616 | ||
599 | if (angular.equals($scope.factura.cliente, {})) { | 617 | if (angular.equals($scope.factura.cliente, {})) { |
600 | focaModalService.alert('Seleccione cliente'); | 618 | focaModalService.alert('Seleccione cliente'); |
601 | return; | 619 | return; |
602 | } | 620 | } |
603 | 621 | ||
604 | var modalInstance = $uibModal.open( | 622 | var modalInstance = $uibModal.open( |
605 | { | 623 | { |
606 | templateUrl: 'modal-ultimos-despachos.html', | 624 | templateUrl: 'modal-ultimos-despachos.html', |
607 | controller: 'ultimosDespachosController', | 625 | controller: 'ultimosDespachosController', |
608 | resolve: { | 626 | resolve: { |
609 | parametros: function () { | 627 | parametros: function () { |
610 | return { | 628 | return { |
611 | planilla: $scope.factura.vendedor.NplVen, | 629 | planilla: $scope.factura.vendedor.NplVen, |
612 | }; | 630 | }; |
613 | } | 631 | } |
614 | }, | 632 | }, |
615 | size: 'md' | 633 | size: 'md' |
616 | } | 634 | } |
617 | ); | 635 | ); |
618 | 636 | ||
619 | modalInstance.result.then(function (producto) { | 637 | modalInstance.result.then(function (producto) { |
620 | 638 | ||
621 | var articulo = { | 639 | var articulo = { |
622 | TIP: $scope.factura.cliente.TIP, | 640 | TIP: $scope.factura.cliente.TIP, |
623 | TCO: 'FT', | 641 | TCO: 'FT', |
624 | SUC: parseInt($scope.puntoVenta), | 642 | SUC: parseInt($scope.puntoVenta), |
625 | ORD: $scope.articulosFiltro().length + 1, | 643 | ORD: $scope.articulosFiltro().length + 1, |
626 | SEC: producto.despachos[0].SEC, | 644 | SEC: producto.despachos[0].SEC, |
627 | ART: producto.despachos[0].PRO, | 645 | ART: producto.despachos[0].PRO, |
628 | RUB: producto.CodRub, | 646 | RUB: producto.CodRub, |
629 | DES: producto.DetArt, | 647 | DES: producto.DetArt, |
630 | CAN: producto.despachos[0].LTS, | 648 | CAN: producto.despachos[0].LTS, |
631 | PUN: producto.PreVen, | 649 | PUN: producto.PreVen, |
632 | IVA: producto.IMPIVA, | 650 | IVA: producto.IMPIVA, |
633 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, | 651 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, |
634 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, | 652 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, |
635 | IMI: producto.ImpInt, | 653 | IMI: producto.ImpInt, |
636 | IMI2: producto.ImpInt2, | 654 | IMI2: producto.ImpInt2, |
637 | IMI3: producto.ImpInt3, | 655 | IMI3: producto.ImpInt3, |
638 | PUT: producto.PreVen, | 656 | PUT: producto.PreVen, |
639 | SUR: producto.despachos[0].SUR, | 657 | SUR: producto.despachos[0].SUR, |
640 | PLA: producto.despachos[0].PLA, | 658 | PLA: producto.despachos[0].PLA, |
641 | LUG: producto.despachos[0].LUG, | 659 | LUG: producto.despachos[0].LUG, |
642 | LEG: $scope.factura.vendedor.CodVen, | 660 | LEG: $scope.factura.vendedor.CodVen, |
643 | TUR: $scope.factura.vendedor.TurVen, | 661 | TUR: $scope.factura.vendedor.TurVen, |
644 | ORDEN_PRECOMPRA: '', | 662 | ORDEN_PRECOMPRA: '', |
645 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | 663 | ESC: producto.tipoFactura === 'L' ? 1 : 0, |
646 | CMF: 0, | 664 | CMF: 0, |
647 | PTA: 0, | 665 | PTA: 0, |
648 | IVS: 0, | 666 | IVS: 0, |
649 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO | 667 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO |
650 | CON: 0, | 668 | CON: 0, |
651 | SINO: '', | 669 | SINO: '', |
652 | ORD_TRA: 0, | 670 | ORD_TRA: 0, |
653 | IMP_DESP: 0, | 671 | IMP_DESP: 0, |
654 | PCD: 0, | 672 | PCD: 0, |
655 | RTO: '', | 673 | RTO: '', |
656 | }; | 674 | }; |
657 | 675 | ||
658 | crearFacturaService.setearDespachoOcupado({ | 676 | crearFacturaService.setearDespachoOcupado({ |
659 | surtidor: producto.despachos[0].SUR, | 677 | surtidor: producto.despachos[0].SUR, |
660 | producto: producto.despachos[0].PRO, | 678 | producto: producto.despachos[0].PRO, |
661 | carga: producto.despachos[0].CAR | 679 | carga: producto.despachos[0].CAR |
662 | }) | 680 | }) |
663 | .then(function () { | 681 | .then(function () { |
664 | $scope.factura.articulosFactura.push(articulo); | 682 | $scope.factura.articulosFactura.push(articulo); |
665 | $scope.factura.despachos.push(producto.despachos[0]); | 683 | $scope.factura.despachos.push(producto.despachos[0]); |
666 | }) | 684 | }) |
667 | .catch(function (err) { | 685 | .catch(function (err) { |
668 | 686 | ||
669 | console.error(err); | 687 | console.error(err); |
670 | focaModalService.alert('El despacho esta en uso'); | 688 | focaModalService.alert('El despacho esta en uso'); |
671 | }); | 689 | }); |
672 | 690 | ||
673 | }) | 691 | }) |
674 | .catch(function (err) { | 692 | .catch(function (err) { |
675 | console.error(err); | 693 | console.error(err); |
676 | }); | 694 | }); |
677 | 695 | ||
678 | }; | 696 | }; |
679 | 697 | ||
680 | function crearFuncionesProductos(producto) { | 698 | function crearFuncionesProductos(producto) { |
681 | 699 | ||
682 | $scope[nombreFuncion(producto.DetArt)] = function () { | 700 | $scope[nombreFuncion(producto.DetArt)] = function () { |
683 | 701 | ||
684 | if (angular.equals($scope.factura.cliente, {})) { | 702 | if (angular.equals($scope.factura.cliente, {})) { |
685 | focaModalService.alert('Seleccione cliente'); | 703 | focaModalService.alert('Seleccione cliente'); |
686 | return; | 704 | return; |
687 | } | 705 | } |
688 | 706 | ||
689 | var modalInstance = $uibModal.open( | 707 | var modalInstance = $uibModal.open( |
690 | { | 708 | { |
691 | templateUrl: 'modal-combustibles.html', | 709 | templateUrl: 'modal-combustibles.html', |
692 | controller: 'focaModalCombustiblesController', | 710 | controller: 'focaModalCombustiblesController', |
693 | resolve: { | 711 | resolve: { |
694 | parametros: function () { | 712 | parametros: function () { |
695 | return { | 713 | return { |
696 | despachos: producto.despachos, | 714 | despachos: producto.despachos, |
697 | nombreProducto: producto.DetArt, | 715 | nombreProducto: producto.DetArt, |
698 | topDespachos: $scope.topDespachos | 716 | topDespachos: $scope.topDespachos |
699 | }; | 717 | }; |
700 | } | 718 | } |
701 | }, | 719 | }, |
702 | size: 'md' | 720 | size: 'md' |
703 | } | 721 | } |
704 | ); | 722 | ); |
705 | 723 | ||
706 | modalInstance.result.then(function (despacho) { | 724 | modalInstance.result.then(function (despacho) { |
707 | 725 | ||
708 | var articulo = { | 726 | var articulo = { |
709 | TIP: $scope.factura.cliente.TIP, | 727 | TIP: $scope.factura.cliente.TIP, |
710 | TCO: 'FT', | 728 | TCO: 'FT', |
711 | SUC: parseInt($scope.puntoVenta), | 729 | SUC: parseInt($scope.puntoVenta), |
712 | ORD: $scope.articulosFiltro().length + 1, | 730 | ORD: $scope.articulosFiltro().length + 1, |
713 | SEC: despacho.SEC, | 731 | SEC: despacho.SEC, |
714 | ART: despacho.PRO, | 732 | ART: despacho.PRO, |
715 | RUB: producto.CodRub, | 733 | RUB: producto.CodRub, |
716 | DES: producto.DetArt, | 734 | DES: producto.DetArt, |
717 | CAN: despacho.LTS, | 735 | CAN: despacho.LTS, |
718 | PUN: producto.PreVen, | 736 | PUN: producto.PreVen, |
719 | IVA: producto.IMPIVA, | 737 | IVA: producto.IMPIVA, |
720 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, | 738 | NET: producto.IvaCO !== 0 ? producto.PreNet : 0, |
721 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, | 739 | NEX: producto.IvaCO === 0 ? producto.PreNet : 0, |
722 | IMI: producto.ImpInt, | 740 | IMI: producto.ImpInt, |
723 | IMI2: producto.ImpInt2, | 741 | IMI2: producto.ImpInt2, |
724 | IMI3: producto.ImpInt3, | 742 | IMI3: producto.ImpInt3, |
725 | PUT: producto.PreVen, | 743 | PUT: producto.PreVen, |
726 | SUR: despacho.SUR, | 744 | SUR: despacho.SUR, |
727 | PLA: despacho.PLA, | 745 | PLA: despacho.PLA, |
728 | LUG: despacho.LUG, | 746 | LUG: despacho.LUG, |
729 | LEG: $scope.factura.vendedor.CodVen, | 747 | LEG: $scope.factura.vendedor.CodVen, |
730 | TUR: $scope.factura.vendedor.TurVen, | 748 | TUR: $scope.factura.vendedor.TurVen, |
731 | ORDEN_PRECOMPRA: '', | 749 | ORDEN_PRECOMPRA: '', |
732 | ESC: producto.tipoFactura === 'L' ? 1 : 0, | 750 | ESC: producto.tipoFactura === 'L' ? 1 : 0, |
733 | CMF: 0, | 751 | CMF: 0, |
734 | PTA: 0, | 752 | PTA: 0, |
735 | IVS: 0, | 753 | IVS: 0, |
736 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO | 754 | TIVA: 21, // TODO traer POR de la tabla ACODIVA where ID = IvaCO |
737 | CON: 0, | 755 | CON: 0, |
738 | SINO: '', | 756 | SINO: '', |
739 | ORD_TRA: 0, | 757 | ORD_TRA: 0, |
740 | IMP_DESP: 0, | 758 | IMP_DESP: 0, |
741 | PCD: 0, | 759 | PCD: 0, |
742 | RTO: '', | 760 | RTO: '', |
743 | }; | 761 | }; |
744 | 762 | ||
745 | crearFacturaService.setearDespachoOcupado({ | 763 | crearFacturaService.setearDespachoOcupado({ |
746 | surtidor: despacho.SUR, | 764 | surtidor: despacho.SUR, |
747 | producto: despacho.PRO, | 765 | producto: despacho.PRO, |
748 | carga: despacho.CAR | 766 | carga: despacho.CAR |
749 | }) | 767 | }) |
750 | .then(function () { | 768 | .then(function () { |
751 | $scope.factura.articulosFactura.push(articulo); | 769 | $scope.factura.articulosFactura.push(articulo); |
752 | $scope.factura.despachos.push(despacho); | 770 | $scope.factura.despachos.push(despacho); |
753 | }) | 771 | }) |
754 | .catch(function (err) { | 772 | .catch(function (err) { |
755 | 773 | ||
756 | console.error(err); | 774 | console.error(err); |
757 | focaModalService.alert('El despacho esta en uso'); | 775 | focaModalService.alert('El despacho esta en uso'); |
758 | }); | 776 | }); |
759 | 777 | ||
760 | }) | 778 | }) |
761 | .catch(function (err) { | 779 | .catch(function (err) { |
762 | console.error(err); | 780 | console.error(err); |
763 | }); | 781 | }); |
764 | 782 | ||
765 | }; | 783 | }; |
766 | } | 784 | } |
767 | 785 | ||
768 | function nombreFuncion(string) { | 786 | function nombreFuncion(string) { |
769 | var texto = 'seleccionar'; | 787 | var texto = 'seleccionar'; |
770 | var arr = string.split(' '); | 788 | var arr = string.split(' '); |
771 | arr.forEach(function (palabra) { | 789 | arr.forEach(function (palabra) { |
772 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 790 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); |
773 | texto += palabra; | 791 | texto += palabra; |
774 | }); | 792 | }); |
775 | return texto; | 793 | return texto; |
776 | } | 794 | } |
777 | 795 | ||
778 | function indicarPassword(vendedor) { | 796 | function indicarPassword(vendedor) { |
779 | 797 | ||
780 | return new Promise(function (resolve, reject) { | 798 | return new Promise(function (resolve, reject) { |
781 | 799 | ||
782 | function openPrompt() { | 800 | function openPrompt() { |
783 | return focaModalService | 801 | return focaModalService |
784 | .prompt({ | 802 | .prompt({ |
785 | titulo: 'Indique Contraseña', | 803 | titulo: 'Indique Contraseña', |
786 | value: '', | 804 | value: '', |
787 | tipo: 'password' | 805 | tipo: 'password' |
788 | }) | 806 | }) |
789 | .then(function (contraseña) { | 807 | .then(function (contraseña) { |
790 | 808 | ||
791 | if (contraseña !== vendedor.ClaVen.trim()) { | 809 | if (contraseña !== vendedor.ClaVen.trim()) { |
792 | 810 | ||
793 | focaModalService.alert('Clave incorrecta').then(function () { | 811 | focaModalService.alert('Clave incorrecta').then(function () { |
794 | openPrompt(vendedor); | 812 | openPrompt(vendedor); |
795 | }); | 813 | }); |
796 | } else { | 814 | } else { |
797 | resolve(); | 815 | resolve(); |
798 | } | 816 | } |
799 | }) | 817 | }) |
800 | .catch(reject); | 818 | .catch(reject); |
801 | } | 819 | } |
802 | 820 | ||
803 | openPrompt(); | 821 | openPrompt(); |
804 | }); | 822 | }); |
805 | } | 823 | } |
806 | 824 | ||
807 | function validarPlanillaVendedor(vendedor) { | 825 | function validarPlanillaVendedor(vendedor) { |
808 | 826 | ||
809 | return new Promise(function (resolve, reject) { | 827 | return new Promise(function (resolve, reject) { |
810 | 828 | ||
811 | crearFacturaService | 829 | crearFacturaService |
812 | .validarPlanillaVendedor(vendedor.CodVen.toString().trim()) | 830 | .validarPlanillaVendedor(vendedor.CodVen.toString().trim()) |
813 | .then(function (res) { | 831 | .then(function (res) { |
814 | 832 | ||
815 | if (!res.data.length) { | 833 | if (!res.data.length) { |
816 | 834 | ||
817 | focaModalService | 835 | focaModalService |
818 | .alert('No se encontró planilla abierta para el vendedor') | 836 | .alert('No se encontró planilla abierta para el vendedor') |
819 | .then(reject); | 837 | .then(reject); |
820 | 838 | ||
821 | } else { | 839 | } else { |
822 | resolve(); | 840 | resolve(); |
823 | } | 841 | } |
824 | 842 | ||
825 | }) | 843 | }) |
826 | .catch(function (err) { | 844 | .catch(function (err) { |
827 | console.log(err); | 845 | console.log(err); |
828 | reject(); | 846 | reject(); |
829 | }); | 847 | }); |
830 | }); | 848 | }); |
831 | } | 849 | } |
832 | 850 | ||
833 | function rellenar(relleno, longitud) { | 851 | function rellenar(relleno, longitud) { |
834 | relleno = '' + relleno; | 852 | relleno = '' + relleno; |
835 | while (relleno.length < longitud) { | 853 | while (relleno.length < longitud) { |
836 | relleno = '0' + relleno; | 854 | relleno = '0' + relleno; |
837 | } | 855 | } |
838 | return relleno; | 856 | return relleno; |
839 | } | 857 | } |
840 | 858 | ||
841 | $scope.salir = function () { | 859 | $scope.salir = function () { |
842 | var confirmacion = false; | 860 | var confirmacion = false; |
843 | 861 | ||
844 | if (!angular.equals($scope.factura, $scope.inicial)) { | 862 | if (!angular.equals($scope.factura, $scope.inicial)) { |
845 | confirmacion = true; | 863 | confirmacion = true; |
846 | } | 864 | } |
847 | 865 | ||
848 | if (confirmacion) { | 866 | if (confirmacion) { |
849 | focaModalService.confirm( | 867 | focaModalService.confirm( |
850 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 868 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
851 | ).then(function (data) { | 869 | ).then(function (data) { |
852 | if (data) { | 870 | if (data) { |
853 | $location.path('/'); | 871 | $location.path('/'); |
854 | } | 872 | } |
855 | }); | 873 | }); |
856 | } else { | 874 | } else { |
857 | $location.path('/'); | 875 | $location.path('/'); |
858 | } | 876 | } |
859 | }; | 877 | }; |
860 | 878 | ||
861 | function setearFactura(factura) { | 879 | function setearFactura(factura) { |
862 | 880 | ||
863 | $scope.$broadcast('cleanCabecera'); | 881 | $scope.$broadcast('cleanCabecera'); |
864 | 882 | ||
865 | $scope.cabeceras = []; | 883 | $scope.cabeceras = []; |
866 | 884 | ||
867 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | 885 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
868 | $scope.cabeceras.push({ | 886 | $scope.cabeceras.push({ |
869 | label: 'Moneda:', | 887 | label: 'Moneda:', |
870 | valor: factura.cotizacion.moneda.DETALLE | 888 | valor: factura.cotizacion.moneda.DETALLE |
871 | }); | 889 | }); |
872 | $scope.cabeceras.push({ | 890 | $scope.cabeceras.push({ |
873 | label: 'Fecha cotizacion:', | 891 | label: 'Fecha cotizacion:', |
874 | valor: $filter('date')(factura.cotizacion.FECHA, | 892 | valor: $filter('date')(factura.cotizacion.FECHA, |
875 | 'dd/MM/yyyy') | 893 | 'dd/MM/yyyy') |
876 | }); | 894 | }); |
877 | $scope.cabeceras.push({ | 895 | $scope.cabeceras.push({ |
878 | label: 'Cotizacion:', | 896 | label: 'Cotizacion:', |
879 | valor: $filter('number')(factura.cotizacion.VENDEDOR, | 897 | valor: $filter('number')(factura.cotizacion.VENDEDOR, |
880 | '2') | 898 | '2') |
881 | }); | 899 | }); |
882 | } | 900 | } |
883 | 901 | ||
884 | if (factura.cotizacion && factura.cotizacion.moneda) { | 902 | if (factura.cotizacion && factura.cotizacion.moneda) { |
885 | // $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; | 903 | // $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
886 | } | 904 | } |
887 | 905 | ||
888 | if (factura.cliente && factura.cliente.COD) { | 906 | if (factura.cliente && factura.cliente.COD) { |
889 | $scope.cabeceras.push({ | 907 | $scope.cabeceras.push({ |
890 | label: 'Cliente:', | 908 | label: 'Cliente:', |
891 | valor: $filter('rellenarDigitos')(factura.cliente.COD, 3) + ' - ' + | 909 | valor: $filter('rellenarDigitos')(factura.cliente.COD, 3) + ' - ' + |
892 | factura.cliente.NOM | 910 | factura.cliente.NOM |
893 | }); | 911 | }); |
894 | 912 | ||
895 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 913 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
896 | } | 914 | } |
897 | 915 | ||
898 | $scope.puntoVenta = rellenar(factura.sucursal, 4); | 916 | $scope.puntoVenta = rellenar(factura.sucursal, 4); |
899 | $scope.comprobante = rellenar(factura.numerofactura, 8); | 917 | $scope.comprobante = rellenar(factura.numerofactura, 8); |
900 | $scope.factura = factura; | 918 | $scope.factura = factura; |
901 | 919 | ||
902 | addArrayCabecera($scope.cabeceras); | 920 | addArrayCabecera($scope.cabeceras); |
903 | } | 921 | } |
904 | 922 | ||
905 | function getLSFactura() { | 923 | function getLSFactura() { |
906 | var factura = JSON.parse($localStorage.factura || null); | 924 | var factura = JSON.parse($localStorage.factura || null); |
907 | if (factura) { | 925 | if (factura) { |
908 | setearFactura(factura); | 926 | setearFactura(factura); |
909 | delete $localStorage.factura; | 927 | delete $localStorage.factura; |
910 | } | 928 | } |
911 | } | 929 | } |
912 | 930 | ||
913 | function addArrayCabecera(array) { | 931 | function addArrayCabecera(array) { |
914 | for (var i = 0; i < array.length; i++) { | 932 | for (var i = 0; i < array.length; i++) { |
915 | $scope.$broadcast('addCabecera', { | 933 | $scope.$broadcast('addCabecera', { |
916 | label: array[i].label, | 934 | label: array[i].label, |
917 | valor: array[i].valor | 935 | valor: array[i].valor |
918 | }); | 936 | }); |
919 | } | 937 | } |
920 | } | 938 | } |
921 | 939 | ||
922 | $scope.cambioEdit = function (articulo, propiedad) { | 940 | $scope.cambioEdit = function (articulo, propiedad) { |
923 | if (propiedad === 'cantidad' && articulo.SUR === 0) { | 941 | if (propiedad === 'cantidad' && articulo.SUR === 0) { |
924 | articulo.editCantidad = true; | 942 | articulo.editCantidad = true; |
925 | } | 943 | } |
926 | }; | 944 | }; |
927 | 945 | ||
928 | $scope.editarArticulo = function (key, articulo, tmpCantidad) { | 946 | $scope.editarArticulo = function (key, articulo, tmpCantidad) { |
929 | if (key === 13) { | 947 | if (key === 13) { |
930 | if (!articulo.cantidad && tmpCantidad.length === 0) { | 948 | if (!articulo.cantidad && tmpCantidad.length === 0) { |
931 | focaModalService.alert('Los valores deben ser al menos 1'); | 949 | focaModalService.alert('Los valores deben ser al menos 1'); |
932 | return; | 950 | return; |
933 | } else if (tmpCantidad === '0') { | 951 | } else if (tmpCantidad === '0') { |
934 | focaModalService.alert('Esta ingresando un producto con valor 0'); | 952 | focaModalService.alert('Esta ingresando un producto con valor 0'); |
935 | return; | 953 | return; |
936 | } else if (parseInt(tmpCantidad) < 0) { | 954 | } else if (parseInt(tmpCantidad) < 0) { |
937 | focaModalService.alert('Los valores no pueden ser negativos'); | 955 | focaModalService.alert('Los valores no pueden ser negativos'); |
938 | return; | 956 | return; |
939 | } | 957 | } |
940 | articulo.CAN = parseInt(tmpCantidad); | 958 | articulo.CAN = parseInt(tmpCantidad); |
941 | $scope.getTotal(); | 959 | $scope.getTotal(); |
942 | articulo.editCantidad = false; | 960 | articulo.editCantidad = false; |
943 | } | 961 | } |
944 | }; | 962 | }; |
945 | 963 | ||
946 | $scope.cancelarEditar = function (articulo) { | 964 | $scope.cancelarEditar = function (articulo) { |
947 | $scope.tmpCantidad = articulo.CAN; | 965 | $scope.tmpCantidad = articulo.CAN; |
948 | articulo.editCantidad = false; | 966 | articulo.editCantidad = false; |
949 | }; | 967 | }; |
950 | 968 | ||
951 | function actualizarCabeceraMoneda(cotizacion) { | 969 | function actualizarCabeceraMoneda(cotizacion) { |
952 | 970 | ||
953 | $scope.factura.articulosFactura.forEach(function (art) { | 971 | $scope.factura.articulosFactura.forEach(function (art) { |
954 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); | 972 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); |
955 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); | 973 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); |
956 | }); | 974 | }); |
957 | 975 | ||
958 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { | 976 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { |
959 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 977 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
960 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 978 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
961 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 979 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
962 | } else { | 980 | } else { |
963 | $scope.$broadcast('addCabecera', { | 981 | $scope.$broadcast('addCabecera', { |
964 | label: 'Moneda:', | 982 | label: 'Moneda:', |
965 | valor: cotizacion.moneda.DETALLE | 983 | valor: cotizacion.moneda.DETALLE |
966 | }); | 984 | }); |
967 | $scope.$broadcast('addCabecera', { | 985 | $scope.$broadcast('addCabecera', { |
968 | label: 'Fecha cotizacion:', | 986 | label: 'Fecha cotizacion:', |
969 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 987 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
970 | }); | 988 | }); |
971 | $scope.$broadcast('addCabecera', { | 989 | $scope.$broadcast('addCabecera', { |
972 | label: 'Cotizacion:', | 990 | label: 'Cotizacion:', |
973 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 991 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
974 | }); | 992 | }); |
975 | } | 993 | } |
976 | } | 994 | } |
977 | 995 | ||
978 | function validarGuardar() { | 996 | function validarGuardar() { |
979 | 997 | ||
980 | if (angular.equals({}, $scope.factura.vendedor)) { | 998 | if (angular.equals({}, $scope.factura.vendedor)) { |
981 | 999 | ||
982 | focaModalService.alert('Seleccione Vendedor'); | 1000 | focaModalService.alert('Seleccione Vendedor'); |
983 | return false; | 1001 | return false; |
984 | } else if (angular.equals({}, $scope.factura.cliente)) { | 1002 | } else if (angular.equals({}, $scope.factura.cliente)) { |
985 | 1003 | ||
986 | focaModalService.alert('Seleccione Cliente'); | 1004 | focaModalService.alert('Seleccione Cliente'); |
987 | return false; | 1005 | return false; |
988 | } else if (!$scope.articulosFiltro().length) { | 1006 | } else if (!$scope.articulosFiltro().length) { |
989 | 1007 | ||
990 | focaModalService.alert('Seleccione al menos un Articulo'); | 1008 | focaModalService.alert('Seleccione al menos un Articulo'); |
991 | return false; | 1009 | return false; |
992 | } | 1010 | } |
993 | 1011 | ||
994 | return true; | 1012 | return true; |
995 | } | 1013 | } |
996 | 1014 | ||
997 | //recibo la propiedad por la cual quiero obtener el valor | 1015 | //recibo la propiedad por la cual quiero obtener el valor |
998 | function getImporte(propiedad) { | 1016 | function getImporte(propiedad) { |
999 | var importe = 0; | 1017 | var importe = 0; |
1000 | 1018 | ||
1001 | $scope.articulosFiltro().forEach(function (articulo) { | 1019 | $scope.articulosFiltro().forEach(function (articulo) { |
1002 | 1020 | ||
1003 | if (articulo[propiedad]) { | 1021 | if (articulo[propiedad]) { |
1004 | importe += articulo[propiedad] * articulo.CAN; | 1022 | importe += articulo[propiedad] * articulo.CAN; |
1005 | } | 1023 | } |
1006 | return; | 1024 | return; |
1007 | 1025 | ||
1008 | }); | 1026 | }); |
1009 | 1027 | ||
1010 | return importe; | 1028 | return importe; |
1011 | } | 1029 | } |
1012 | 1030 | ||
1013 | function getNumeroFactura(tipoFactura) { | 1031 | function getNumeroFactura(tipoFactura) { |
1014 | 1032 | ||
1015 | crearRemitoService.getNumeroRemito(tipoFactura).then( | 1033 | crearRemitoService.getNumeroRemito(tipoFactura).then( |
1016 | function (res) { | 1034 | function (res) { |
1017 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 1035 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
1018 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 1036 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
1019 | }, | 1037 | }, |
1020 | function (err) { | 1038 | function (err) { |
1021 | focaModalService.alert('La terminal no esta configurada correctamente'); | 1039 | focaModalService.alert('La terminal no esta configurada correctamente'); |
1022 | console.info(err); | 1040 | console.info(err); |
1023 | } | 1041 | } |
1024 | ); | 1042 | ); |
1025 | } | 1043 | } |
1026 | } | 1044 | } |
1027 | ]); | 1045 | ]); |
1028 | 1046 |
src/views/modal-estado-cuenta.html
1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
2 | <div class="row w-100"> | 2 | <div class="row w-100"> |
3 | <div class="col-lg-6"> | 3 | <div class="col-lg-6"> |
4 | <h5 class="modal-title text-center my-1">Estado cuenta corriente</h5> | 4 | <h5 class="modal-title text-center my-1">Estado cuenta corriente</h5> |
5 | </div> | 5 | </div> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | <div class="modal-body" id="modal-body"> | 8 | <div class="modal-body" id="modal-body"> |
9 | <div class="row m-3"> | 9 | <div class="row m-3"> |
10 | <div class="col"> | 10 | <div class="col"> |
11 | <!-- <div class="row mb-2"> | ||
12 | <div class="col text-center"> | ||
13 | <p class="m-0">Autorizado</p> | ||
14 | <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | ||
15 | </div> | ||
16 | </div> --> | ||
17 | <div class="row mb-2"> | 11 | <div class="row mb-2"> |
18 | <div class="col text-center"> | 12 | <div class="col text-center"> |
19 | <p class="m-0">Cliente</p> | 13 | <p class="m-0">Cliente</p> |
20 | <label class="h5" ng-bind="cliente.idCliente"></label> | 14 | <label class="h5" ng-bind="cliente.idCliente"></label> |
21 | <label class="h5"> - </label> | 15 | <label class="h5"> - </label> |
22 | <label class="h5" ng-bind="cliente.nombreCliente"></label> | 16 | <label class="h5" ng-bind="cliente.nombreCliente"></label> |
23 | </div> | 17 | </div> |
24 | </div> | 18 | </div> |
25 | <div class="row border-top mb-2"> | 19 | <div class="row border-top mb-2"> |
26 | <div class="col text-center"> | 20 | <div class="col text-center"> |
27 | <p class="m-0">Autorizado</p> | 21 | <p class="m-0">Autorizado</p> |
28 | <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> | 22 | <p class="h5 m-0" ng-bind="estadoCuenta.autorizado | currency"></p> |
23 | </div> | ||
29 | </div> | 24 | </div> |
30 | </div> | 25 | <div class="row border-top mb-2"> |
31 | <div class="row border-top mb-2"> | 26 | <div class="col text-center"> |
32 | <div class="col text-center"> | 27 | <p class="m-0">Extracciones</p> |
33 | <p class="m-0">Extracciones</p> | 28 | <p class="h5 m-0" ng-bind="estadoCuenta.extracciones | currency"></p> |
34 | <p class="h5 m-0" ng-bind="estadoCuenta.extracciones | currency"></p> | 29 | </div> |
35 | </div> | 30 | </div> |
36 | </div> | 31 | <div class="row border-top mb-2"> |
37 | <div class="row border-top mb-2"> | 32 | <div class="col text-center"> |
38 | <div class="col text-center"> | 33 | <p class="m-0">Saldo</p> |
39 | <p class="m-0">Saldo</p> | 34 | <p class="h5 m-0" ng-bind="estadoCuenta.saldo | currency"></p> |
40 | <p class="h5 m-0" ng-bind="estadoCuenta.saldo | currency"></p> | 35 | </div> |
41 | </div> | 36 | </div> |
42 | </div> | 37 | <div class="row border-top mb-2"> |
43 | <div class="row border-top mb-2"> | 38 | <div class="col text-center"> |
44 | <div class="col text-center"> | 39 | <p class="m-0">Situacion</p> |
45 | <p class="m-0">Situacion</p> | 40 | <h4> |
46 | <h4> | 41 | <p |
47 | <p | 42 | ng-show="estadoCuenta.situacion" |
48 | ng-show="estadoCuenta.situacion" | 43 | class="badge badge-success m-0 px-3">Permitido |
49 | class="badge badge-success m-0 px-3">Permitido | 44 | </p> |
50 | </p> | 45 | <p |
51 | <p | 46 | ng-show="!estadoCuenta.situacion" |
52 | ng-show="!estadoCuenta.situacion" | 47 | class="badge badge-danger m-0 px-3">No permitido |
53 | class="badge badge-danger m-0 px-3">No permitido | 48 | </p> |
54 | </p> | 49 | </h4> |
55 | </h4> | 50 | </div> |
56 | </div> | 51 | </div> |
57 | </div> | 52 | <div class="row border-top mb-2"> |
58 | <div class="row border-top mb-2"> | 53 | <div class="col text-center"> |
59 | <div class="col text-center"> | 54 | <p class="m-0">Facturas Vencidas</p> |
60 | <p class="m-0">Facturas Vencidas</p> | 55 | <p class="h5 m-0" ng-bind="estadoCuenta.facturasvencidas | currency"></p> |
61 | <p class="h5 m-0" ng-bind="estadoCuenta.facturasvencidas | currency"></p> | 56 | </div> |
62 | </div> | 57 | </div> |
63 | </div> | 58 | <!-- <div class="row border-top"> |
64 | <!-- <div class="row border-top"> | 59 | <div class="col text-center"> |
65 | <div class="col text-center"> | 60 | <p class="m-0">Situacion</p> |
66 | <p class="m-0">Situacion</p> | 61 | <h4> |
67 | <h4> | 62 | <p |
68 | <p | ||
69 | ng-show="estadoCuenta.situacion" | 63 | ng-show="estadoCuenta.situacion" |
70 | class="badge badge-success m-0 px-3">Permitido | 64 | class="badge badge-success m-0 px-3">Permitido |
71 | </p> | 65 | </p> |
72 | <p | 66 | <p |
73 | ng-show="!estadoCuenta.situacion" | 67 | ng-show="!estadoCuenta.situacion" |
74 | class="badge badge-danger m-0 px-3">No permitido | 68 | class="badge badge-danger m-0 px-3">No permitido |
75 | </p> | 69 | </p> |
76 | </h4> | 70 | </h4> |
77 | </div> | 71 | </div> |
78 | </div> | 72 | </div> |
79 | <div class="row border-top mb-2"> | 73 | <div class="row border-top mb-2"> |
80 | <div class="col text-center"> | 74 | <div class="col text-center"> |
81 | <p class="m-0">Facturas Vencidas</p> | 75 | <p class="m-0">Facturas Vencidas</p> |
82 | <p class="h5 m-0" ng-bind="estadoCuenta.facturasVencidas | currency"></p> | 76 | <p class="h5 m-0" ng-bind="estadoCuenta.facturasVencidas | currency"></p> |
83 | </div> | 77 | </div> |
84 | </div> --> | 78 | </div> --> |
85 | </div> | 79 | </div> |
86 | </div> | 80 | </div> |
87 | <div class="row h-25 align-items-center mx-0 botonera-secundaria"> | 81 | <div class="row h-25 align-items-center mx-0 botonera-secundaria"> |
88 | <div class="col-6 col-sm-4 offset-sm-2"> | 82 | <div class="col-6 col-sm-4 offset-sm-2"> |
89 | <button | 83 | <button |
90 | type="button" | 84 | type="button" |
91 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | 85 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" |
92 | ng-disabled="!estadoCuenta.situacion" | 86 | ng-disabled="!estadoCuenta.situacion" |
93 | ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})" | 87 | ng-click="elegirTipoDePago({tipo: 'Contado', formaDePago: 1})" |
94 | > | 88 | > |
95 | <img ng-src="./img/contado.png" alt=""> | 89 | <img ng-src="./img/contado.png" alt=""> |
96 | <p class="m-0">Contado</p> | 90 | <p class="m-0">Contado</p> |
97 | </button> | 91 | </button> |
98 | </div> | 92 | </div> |
99 | <div class="col-6 col-sm-4"> | 93 | <div class="col-6 col-sm-4"> |
100 | <button | 94 | <button |
101 | type="button" | 95 | type="button" |
102 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" | 96 | class="btn btn-sm btn-block btn-tarjeta rounded border p-1" |
103 | ng-disabled="!estadoCuenta.situacion" | 97 | ng-disabled="!estadoCuenta.situacion" |
104 | foca-focus="true" | 98 | foca-focus="true" |
105 | ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" | 99 | ng-click="elegirTipoDePago({tipo: 'Cuenta Corriente', formaDePago: 2})" |
106 | > | 100 | > |
107 | <img ng-src="./img/cuentaCorriente.png" alt=""> | 101 | <img ng-src="./img/cuentaCorriente.png" alt=""> |
108 | <p class="m-0">Cta. Corriente</p> | 102 | <p class="m-0">Cta. Corriente</p> |
109 | </button> | 103 | </button> |
110 | </div> | ||
111 | </div> | 104 | </div> |
112 | </div> | 105 | </div> |
106 | </div> | ||
113 | <div class="modal-footer py-2"> | 107 | <div class="modal-footer py-2"> |
114 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 108 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |