Commit 2e6999d1342da82b594d517b27ebbf94aa103088
1 parent
8d8b289fd4
Exists in
master
fuera simbolos moneda
Showing
2 changed files
with
8 additions
and
8 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | '$timeout', | 7 | '$timeout', |
8 | 'crearNotaPedidoService', | 8 | 'crearNotaPedidoService', |
9 | 'focaBotoneraLateralService', | 9 | 'focaBotoneraLateralService', |
10 | 'focaModalService', | 10 | 'focaModalService', |
11 | 'notaPedidoBusinessService', | 11 | 'notaPedidoBusinessService', |
12 | '$rootScope', | 12 | '$rootScope', |
13 | 'focaSeguimientoService', | 13 | 'focaSeguimientoService', |
14 | function( | 14 | function( |
15 | $scope, $uibModal, $location, $filter, $timeout, | 15 | $scope, $uibModal, $location, $filter, $timeout, |
16 | crearNotaPedidoService, focaBotoneraLateralService, | 16 | crearNotaPedidoService, focaBotoneraLateralService, |
17 | focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) | 17 | focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) |
18 | { | 18 | { |
19 | 19 | ||
20 | $scope.botonera = crearNotaPedidoService.getBotonera(); | 20 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
21 | 21 | ||
22 | $scope.isNumber = angular.isNumber; | 22 | $scope.isNumber = angular.isNumber; |
23 | $scope.datepickerAbierto = false; | 23 | $scope.datepickerAbierto = false; |
24 | $scope.show = false; | 24 | $scope.show = false; |
25 | $scope.cargando = true; | 25 | $scope.cargando = true; |
26 | $scope.dateOptions = { | 26 | $scope.dateOptions = { |
27 | maxDate: new Date(), | 27 | maxDate: new Date(), |
28 | minDate: new Date(2010, 0, 1) | 28 | minDate: new Date(2010, 0, 1) |
29 | }; | 29 | }; |
30 | 30 | ||
31 | $scope.notaPedido = { | 31 | $scope.notaPedido = { |
32 | id: 0, | 32 | id: 0, |
33 | vendedor: {}, | 33 | vendedor: {}, |
34 | cliente: {}, | 34 | cliente: {}, |
35 | proveedor: {}, | 35 | proveedor: {}, |
36 | domicilio: {dom: ''}, | 36 | domicilio: {dom: ''}, |
37 | moneda: {}, | 37 | moneda: {}, |
38 | cotizacion: {} | 38 | cotizacion: {} |
39 | }; | 39 | }; |
40 | var monedaPorDefecto; | 40 | var monedaPorDefecto; |
41 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 41 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
42 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 42 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
43 | monedaPorDefecto = res.data[0]; | 43 | monedaPorDefecto = res.data[0]; |
44 | $scope.notaPedido.moneda = monedaPorDefecto; | 44 | $scope.notaPedido.moneda = monedaPorDefecto; |
45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
46 | }); | 46 | }); |
47 | 47 | ||
48 | $scope.cabecera = []; | 48 | $scope.cabecera = []; |
49 | $scope.showCabecera = true; | 49 | $scope.showCabecera = true; |
50 | 50 | ||
51 | $scope.now = new Date(); | 51 | $scope.now = new Date(); |
52 | $scope.puntoVenta = '0000'; | 52 | $scope.puntoVenta = '0000'; |
53 | $scope.comprobante = '00000000'; | 53 | $scope.comprobante = '00000000'; |
54 | $scope.articulosTabla = []; | 54 | $scope.articulosTabla = []; |
55 | $scope.idLista = undefined; | 55 | $scope.idLista = undefined; |
56 | 56 | ||
57 | //SETEO BOTONERA LATERAL | 57 | //SETEO BOTONERA LATERAL |
58 | $timeout(function() { | 58 | $timeout(function() { |
59 | focaBotoneraLateralService.showSalir(true); | 59 | focaBotoneraLateralService.showSalir(true); |
60 | focaBotoneraLateralService.showPausar(true); | 60 | focaBotoneraLateralService.showPausar(true); |
61 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); | 61 | focaBotoneraLateralService.showGuardar(true, $scope.crearNotaPedido); |
62 | }); | 62 | }); |
63 | 63 | ||
64 | crearNotaPedidoService.getPrecioCondicion().then( | 64 | crearNotaPedidoService.getPrecioCondicion().then( |
65 | function(res) { | 65 | function(res) { |
66 | $scope.precioCondiciones = res.data; | 66 | $scope.precioCondiciones = res.data; |
67 | } | 67 | } |
68 | ); | 68 | ); |
69 | 69 | ||
70 | crearNotaPedidoService.getNumeroNotaPedido().then( | 70 | crearNotaPedidoService.getNumeroNotaPedido().then( |
71 | function(res) { | 71 | function(res) { |
72 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 72 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
73 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 73 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
74 | }, | 74 | }, |
75 | function(err) { | 75 | function(err) { |
76 | focaModalService.alert('La terminal no esta configurada correctamente'); | 76 | focaModalService.alert('La terminal no esta configurada correctamente'); |
77 | console.info(err); | 77 | console.info(err); |
78 | } | 78 | } |
79 | ); | 79 | ); |
80 | 80 | ||
81 | $scope.crearNotaPedido = function() { | 81 | $scope.crearNotaPedido = function() { |
82 | if(!$scope.notaPedido.vendedor.CodVen) { | 82 | if(!$scope.notaPedido.vendedor.CodVen) { |
83 | focaModalService.alert('Ingrese Vendedor'); | 83 | focaModalService.alert('Ingrese Vendedor'); |
84 | return; | 84 | return; |
85 | } else if(!$scope.notaPedido.cliente.COD) { | 85 | } else if(!$scope.notaPedido.cliente.COD) { |
86 | focaModalService.alert('Ingrese Cliente'); | 86 | focaModalService.alert('Ingrese Cliente'); |
87 | return; | 87 | return; |
88 | } else if(!$scope.notaPedido.proveedor.COD) { | 88 | } else if(!$scope.notaPedido.proveedor.COD) { |
89 | focaModalService.alert('Ingrese Proveedor'); | 89 | focaModalService.alert('Ingrese Proveedor'); |
90 | return; | 90 | return; |
91 | } else if(!$scope.notaPedido.moneda.ID) { | 91 | } else if(!$scope.notaPedido.moneda.ID) { |
92 | focaModalService.alert('Ingrese Moneda'); | 92 | focaModalService.alert('Ingrese Moneda'); |
93 | return; | 93 | return; |
94 | } else if(!$scope.notaPedido.cotizacion.ID) { | 94 | } else if(!$scope.notaPedido.cotizacion.ID) { |
95 | focaModalService.alert('Ingrese Cotización'); | 95 | focaModalService.alert('Ingrese Cotización'); |
96 | return; | 96 | return; |
97 | } else if(!$scope.plazosPagos) { | 97 | } else if(!$scope.plazosPagos) { |
98 | focaModalService.alert('Ingrese Precios y Condiciones'); | 98 | focaModalService.alert('Ingrese Precios y Condiciones'); |
99 | return; | 99 | return; |
100 | } else if( | 100 | } else if( |
101 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | 101 | $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) |
102 | { | 102 | { |
103 | focaModalService.alert('Ingrese Flete'); | 103 | focaModalService.alert('Ingrese Flete'); |
104 | return; | 104 | return; |
105 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto | 105 | } else if(!$scope.notaPedido.domicilioStamp) {//TODO validar domicilio correcto |
106 | focaModalService.alert('Ingrese Domicilio'); | 106 | focaModalService.alert('Ingrese Domicilio'); |
107 | return; | 107 | return; |
108 | } else if($scope.articulosTabla.length === 0) { | 108 | } else if($scope.articulosTabla.length === 0) { |
109 | focaModalService.alert('Debe cargar al menos un articulo'); | 109 | focaModalService.alert('Debe cargar al menos un articulo'); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | $scope.saveLoading = true; | 112 | $scope.saveLoading = true; |
113 | var notaPedido = { | 113 | var notaPedido = { |
114 | id: $scope.notaPedido.id, | 114 | id: $scope.notaPedido.id, |
115 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 115 | fechaCarga: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
116 | idVendedor: $scope.notaPedido.vendedor.CodVen, | 116 | idVendedor: $scope.notaPedido.vendedor.CodVen, |
117 | idCliente: $scope.notaPedido.cliente.COD, | 117 | idCliente: $scope.notaPedido.cliente.COD, |
118 | nombreCliente: $scope.notaPedido.cliente.NOM, | 118 | nombreCliente: $scope.notaPedido.cliente.NOM, |
119 | cuitCliente: $scope.notaPedido.cliente.CUIT, | 119 | cuitCliente: $scope.notaPedido.cliente.CUIT, |
120 | idProveedor: $scope.notaPedido.proveedor.COD, | 120 | idProveedor: $scope.notaPedido.proveedor.COD, |
121 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID | 121 | //idDomicilio: $scope.notaPedido.domicilio.id,TODO GUARDAR DOMICILIO ID |
122 | idCotizacion: $scope.notaPedido.cotizacion.ID, | 122 | idCotizacion: $scope.notaPedido.cotizacion.ID, |
123 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, | 123 | idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, |
124 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 124 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
125 | flete: $scope.notaPedido.flete, | 125 | flete: $scope.notaPedido.flete, |
126 | fob: $scope.notaPedido.fob, | 126 | fob: $scope.notaPedido.fob, |
127 | bomba: $scope.notaPedido.bomba, | 127 | bomba: $scope.notaPedido.bomba, |
128 | kilometros: $scope.notaPedido.kilometros, | 128 | kilometros: $scope.notaPedido.kilometros, |
129 | domicilioStamp: $scope.notaPedido.domicilioStamp, | 129 | domicilioStamp: $scope.notaPedido.domicilioStamp, |
130 | estado: 0, | 130 | estado: 0, |
131 | total: $scope.getTotal() | 131 | total: $scope.getTotal() |
132 | }; | 132 | }; |
133 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 133 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
134 | function(data) { | 134 | function(data) { |
135 | // Al guardar los datos de la nota de pedido logueamos la | 135 | // Al guardar los datos de la nota de pedido logueamos la |
136 | // actividad para su seguimiento. | 136 | // actividad para su seguimiento. |
137 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? | 137 | //TODO: GUARDAR POSISIONAMIENTO AL EDITAR? |
138 | focaSeguimientoService.guardarPosicion( | 138 | focaSeguimientoService.guardarPosicion( |
139 | data.data.id, | 139 | data.data.id, |
140 | 'Nota de pedido', | 140 | 'Nota de pedido', |
141 | 'Nº: ' + $filter('comprobante')([ | 141 | 'Nº: ' + $filter('comprobante')([ |
142 | $scope.puntoVenta, | 142 | $scope.puntoVenta, |
143 | $scope.comprobante | 143 | $scope.comprobante |
144 | ]) + '<br/>' + | 144 | ]) + '<br/>' + |
145 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + | 145 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + |
146 | 'Total: ' + $filter('currency')($scope.getTotal()) | 146 | 'Total: ' + $filter('currency')($scope.getTotal()) |
147 | ); | 147 | ); |
148 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 148 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
149 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 149 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
150 | var plazos = $scope.plazosPagos; | 150 | var plazos = $scope.plazosPagos; |
151 | 151 | ||
152 | for(var j = 0; j < plazos.length; j++) { | 152 | for(var j = 0; j < plazos.length; j++) { |
153 | var json = { | 153 | var json = { |
154 | idPedido: data.data.id, | 154 | idPedido: data.data.id, |
155 | dias: plazos[j].dias | 155 | dias: plazos[j].dias |
156 | }; | 156 | }; |
157 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); | 157 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
158 | } | 158 | } |
159 | notaPedidoBusinessService.addEstado(data.data.id, | 159 | notaPedidoBusinessService.addEstado(data.data.id, |
160 | $scope.notaPedido.vendedor.CodVen); | 160 | $scope.notaPedido.vendedor.CodVen); |
161 | 161 | ||
162 | focaModalService.alert('Nota pedido creada'); | 162 | focaModalService.alert('Nota pedido creada'); |
163 | $scope.saveLoading = false; | 163 | $scope.saveLoading = false; |
164 | $scope.$broadcast('cleanCabecera'); | 164 | $scope.$broadcast('cleanCabecera'); |
165 | $scope.$broadcast('addCabecera', { | 165 | $scope.$broadcast('addCabecera', { |
166 | label: 'Moneda:', | 166 | label: 'Moneda:', |
167 | valor: $scope.notaPedido.moneda.DETALLE | 167 | valor: $scope.notaPedido.moneda.DETALLE |
168 | }); | 168 | }); |
169 | $scope.$broadcast('addCabecera', { | 169 | $scope.$broadcast('addCabecera', { |
170 | label: 'Fecha cotizacion:', | 170 | label: 'Fecha cotizacion:', |
171 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 171 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
172 | }); | 172 | }); |
173 | $scope.$broadcast('addCabecera', { | 173 | $scope.$broadcast('addCabecera', { |
174 | label: 'Moneda:', | 174 | label: 'Moneda:', |
175 | valor: $scope.notaPedido.moneda.DETALLE | 175 | valor: $scope.notaPedido.moneda.DETALLE |
176 | }); | 176 | }); |
177 | $scope.$broadcast('addCabecera', { | 177 | $scope.$broadcast('addCabecera', { |
178 | label: 'Cotizacion:', | 178 | label: 'Cotizacion:', |
179 | valor: $scope.notaPedido.cotizacion.VENDEDOR | 179 | valor: $filter('number')($scope.notaPedido.cotizacion.VENDEDOR, '2') |
180 | }); | 180 | }); |
181 | crearNotaPedidoService.getNumeroNotaPedido().then( | 181 | crearNotaPedidoService.getNumeroNotaPedido().then( |
182 | function(res) { | 182 | function(res) { |
183 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 183 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
184 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 184 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
185 | }, | 185 | }, |
186 | function(err) { | 186 | function(err) { |
187 | focaModalService.alert( | 187 | focaModalService.alert( |
188 | 'La terminal no esta configurada correctamente'); | 188 | 'La terminal no esta configurada correctamente'); |
189 | console.info(err); | 189 | console.info(err); |
190 | } | 190 | } |
191 | ); | 191 | ); |
192 | $scope.notaPedido.vendedor = {}; | 192 | $scope.notaPedido.vendedor = {}; |
193 | $scope.notaPedido.cliente = {}; | 193 | $scope.notaPedido.cliente = {}; |
194 | $scope.notaPedido.proveedor = {}; | 194 | $scope.notaPedido.proveedor = {}; |
195 | $scope.notaPedido.domicilio = {}; | 195 | $scope.notaPedido.domicilio = {}; |
196 | $scope.notaPedido.flete = null; | 196 | $scope.notaPedido.flete = null; |
197 | $scope.notaPedido.fob = null; | 197 | $scope.notaPedido.fob = null; |
198 | $scope.notaPedido.bomba = null; | 198 | $scope.notaPedido.bomba = null; |
199 | $scope.notaPedido.kilometros = null; | 199 | $scope.notaPedido.kilometros = null; |
200 | $scope.articulosTabla = []; | 200 | $scope.articulosTabla = []; |
201 | }, | 201 | }, |
202 | function(error) { | 202 | function(error) { |
203 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 203 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
204 | $scope.saveLoading = false; | 204 | $scope.saveLoading = false; |
205 | console.info(error); | 205 | console.info(error); |
206 | } | 206 | } |
207 | ); | 207 | ); |
208 | }; | 208 | }; |
209 | 209 | ||
210 | $scope.seleccionarNotaPedido = function() { | 210 | $scope.seleccionarNotaPedido = function() { |
211 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
212 | { | 212 | { |
213 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 213 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
214 | templateUrl: 'foca-modal-nota-pedido.html', | 214 | templateUrl: 'foca-modal-nota-pedido.html', |
215 | controller: 'focaModalNotaPedidoController', | 215 | controller: 'focaModalNotaPedidoController', |
216 | size: 'lg', | 216 | size: 'lg', |
217 | resolve: {usadoPor: function() {return 'notaPedido';}} | 217 | resolve: {usadoPor: function() {return 'notaPedido';}} |
218 | } | 218 | } |
219 | ); | 219 | ); |
220 | modalInstance.result.then( | 220 | modalInstance.result.then( |
221 | function(notaPedido) { | 221 | function(notaPedido) { |
222 | $scope.now = new Date(notaPedido.fechaCarga); | 222 | $scope.now = new Date(notaPedido.fechaCarga); |
223 | //añado cabeceras | 223 | //añado cabeceras |
224 | $scope.notaPedido.id = notaPedido.id; | 224 | $scope.notaPedido.id = notaPedido.id; |
225 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 225 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
226 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 226 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
227 | var cabeceras = [ | 227 | var cabeceras = [ |
228 | { | 228 | { |
229 | label: 'Moneda:', | 229 | label: 'Moneda:', |
230 | valor: notaPedido.cotizacion.moneda.DETALLE | 230 | valor: notaPedido.cotizacion.moneda.DETALLE |
231 | }, | 231 | }, |
232 | { | 232 | { |
233 | label: 'Fecha cotizacion:', | 233 | label: 'Fecha cotizacion:', |
234 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 234 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
235 | 'dd/MM/yyyy') | 235 | 'dd/MM/yyyy') |
236 | }, | 236 | }, |
237 | { | 237 | { |
238 | label: 'Cotizacion:', | 238 | label: 'Cotizacion:', |
239 | valor: notaPedido.cotizacion.VENDEDOR | 239 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
240 | '2') | ||
240 | }, | 241 | }, |
241 | { | 242 | { |
242 | label: 'Cliente:', | 243 | label: 'Cliente:', |
243 | valor: notaPedido.cliente.NOM | 244 | valor: notaPedido.cliente.NOM |
244 | }, | 245 | }, |
245 | { | 246 | { |
246 | label: 'Domicilio:', | 247 | label: 'Domicilio:', |
247 | valor: notaPedido.domicilioStamp | 248 | valor: notaPedido.domicilioStamp |
248 | }, | 249 | }, |
249 | { | 250 | { |
250 | label: 'Vendedor:', | 251 | label: 'Vendedor:', |
251 | valor: notaPedido.vendedor.NomVen | 252 | valor: notaPedido.vendedor.NomVen |
252 | }, | 253 | }, |
253 | { | 254 | { |
254 | label: 'Proveedor:', | 255 | label: 'Proveedor:', |
255 | valor: notaPedido.proveedor.NOM | 256 | valor: notaPedido.proveedor.NOM |
256 | }, | 257 | }, |
257 | { | 258 | { |
258 | label: 'Precio condicion:', | 259 | label: 'Precio condicion:', |
259 | valor: valorPrecioCondicion() + ' ' + | 260 | valor: valorPrecioCondicion() + ' ' + |
260 | notaPedidoBusinessService | 261 | notaPedidoBusinessService |
261 | .plazoToString(notaPedido.notaPedidoPlazo) | 262 | .plazoToString(notaPedido.notaPedidoPlazo) |
262 | }, | 263 | }, |
263 | { | 264 | { |
264 | label: 'Flete:', | 265 | label: 'Flete:', |
265 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 266 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
266 | notaPedido.flete === 1 ? 'Si' : 'No') | 267 | notaPedido.flete === 1 ? 'Si' : 'No') |
267 | } | 268 | } |
268 | ]; | 269 | ]; |
269 | 270 | ||
270 | function valorPrecioCondicion() { | 271 | function valorPrecioCondicion() { |
271 | if(notaPedido.idPrecioCondicion > 0) { | 272 | if(notaPedido.idPrecioCondicion > 0) { |
272 | return notaPedido.precioCondicion.nombre; | 273 | return notaPedido.precioCondicion.nombre; |
273 | } else { | 274 | } else { |
274 | return 'Ingreso Manual'; | 275 | return 'Ingreso Manual'; |
275 | } | 276 | } |
276 | } | 277 | } |
277 | 278 | ||
278 | if(notaPedido.flete === 1) { | 279 | if(notaPedido.flete === 1) { |
279 | var cabeceraBomba = { | 280 | var cabeceraBomba = { |
280 | label: 'Bomba:', | 281 | label: 'Bomba:', |
281 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 282 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
282 | }; | 283 | }; |
283 | if(notaPedido.kilometros) { | 284 | if(notaPedido.kilometros) { |
284 | var cabeceraKilometros = { | 285 | var cabeceraKilometros = { |
285 | label: 'Kilometros:', | 286 | label: 'Kilometros:', |
286 | valor: notaPedido.kilometros | 287 | valor: notaPedido.kilometros |
287 | }; | 288 | }; |
288 | cabeceras.push(cabeceraKilometros); | 289 | cabeceras.push(cabeceraKilometros); |
289 | } | 290 | } |
290 | cabeceras.push(cabeceraBomba); | 291 | cabeceras.push(cabeceraBomba); |
291 | } | 292 | } |
292 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 293 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
293 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 294 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
294 | notaPedido.cotizacion.VENDEDOR); | 295 | notaPedido.cotizacion.VENDEDOR); |
295 | if(notaPedido.idPrecioCondicion > 0) { | 296 | if(notaPedido.idPrecioCondicion > 0) { |
296 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 297 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
297 | } else { | 298 | } else { |
298 | $scope.idLista = -1; | 299 | $scope.idLista = -1; |
299 | } | 300 | } |
300 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | 301 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); |
301 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | 302 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); |
302 | $scope.notaPedido = notaPedido; | 303 | $scope.notaPedido = notaPedido; |
303 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 304 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
304 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 305 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
305 | addArrayCabecera(cabeceras); | 306 | addArrayCabecera(cabeceras); |
306 | 307 | ||
307 | }, function() { | 308 | }, function() { |
308 | // funcion ejecutada cuando se cancela el modal | 309 | // funcion ejecutada cuando se cancela el modal |
309 | } | 310 | } |
310 | ); | 311 | ); |
311 | }; | 312 | }; |
312 | 313 | ||
313 | $scope.seleccionarProductos = function() { | 314 | $scope.seleccionarProductos = function() { |
314 | if ($scope.idLista === undefined) { | 315 | if ($scope.idLista === undefined) { |
315 | focaModalService.alert( | 316 | focaModalService.alert( |
316 | 'Primero seleccione una lista de precio y condicion'); | 317 | 'Primero seleccione una lista de precio y condicion'); |
317 | return; | 318 | return; |
318 | } | 319 | } |
319 | var modalInstance = $uibModal.open( | 320 | var modalInstance = $uibModal.open( |
320 | { | 321 | { |
321 | ariaLabelledBy: 'Busqueda de Productos', | 322 | ariaLabelledBy: 'Busqueda de Productos', |
322 | templateUrl: 'modal-busqueda-productos.html', | 323 | templateUrl: 'modal-busqueda-productos.html', |
323 | controller: 'modalBusquedaProductosCtrl', | 324 | controller: 'modalBusquedaProductosCtrl', |
324 | resolve: { | 325 | resolve: { |
325 | parametroProducto: { | 326 | parametroProducto: { |
326 | idLista: $scope.idLista, | 327 | idLista: $scope.idLista, |
327 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 328 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
328 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 329 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
329 | } | 330 | } |
330 | }, | 331 | }, |
331 | size: 'lg' | 332 | size: 'lg' |
332 | } | 333 | } |
333 | ); | 334 | ); |
334 | modalInstance.result.then( | 335 | modalInstance.result.then( |
335 | function(producto) { | 336 | function(producto) { |
336 | var newArt = | 337 | var newArt = |
337 | { | 338 | { |
338 | id: 0, | 339 | id: 0, |
339 | codigo: producto.codigo, | 340 | codigo: producto.codigo, |
340 | sector: producto.sector, | 341 | sector: producto.sector, |
341 | sectorCodigo: producto.sector + '-' + producto.codigo, | 342 | sectorCodigo: producto.sector + '-' + producto.codigo, |
342 | descripcion: producto.descripcion, | 343 | descripcion: producto.descripcion, |
343 | item: $scope.articulosTabla.length + 1, | 344 | item: $scope.articulosTabla.length + 1, |
344 | nombre: producto.descripcion, | 345 | nombre: producto.descripcion, |
345 | precio: parseFloat(producto.precio.toFixed(4)), | 346 | precio: parseFloat(producto.precio.toFixed(4)), |
346 | costoUnitario: producto.costo, | 347 | costoUnitario: producto.costo, |
347 | editCantidad: false, | 348 | editCantidad: false, |
348 | editPrecio: false, | 349 | editPrecio: false, |
349 | rubro: producto.CodRub, | 350 | rubro: producto.CodRub, |
350 | exentoUnitario: producto.precio, | 351 | exentoUnitario: producto.precio, |
351 | ivaUnitario: producto.IMPIVA, | 352 | ivaUnitario: producto.IMPIVA, |
352 | impuestoInternoUnitario: producto.ImpInt, | 353 | impuestoInternoUnitario: producto.ImpInt, |
353 | impuestoInterno1Unitario: producto.ImpInt2, | 354 | impuestoInterno1Unitario: producto.ImpInt2, |
354 | impuestoInterno2Unitario: producto.ImpInt3, | 355 | impuestoInterno2Unitario: producto.ImpInt3, |
355 | precioLista: producto.precio, | 356 | precioLista: producto.precio, |
356 | combustible: 1, | 357 | combustible: 1, |
357 | facturado: 0 | 358 | facturado: 0 |
358 | }; | 359 | }; |
359 | $scope.articuloACargar = newArt; | 360 | $scope.articuloACargar = newArt; |
360 | $scope.cargando = false; | 361 | $scope.cargando = false; |
361 | }, function() { | 362 | }, function() { |
362 | // funcion ejecutada cuando se cancela el modal | 363 | // funcion ejecutada cuando se cancela el modal |
363 | } | 364 | } |
364 | ); | 365 | ); |
365 | }; | 366 | }; |
366 | 367 | ||
367 | $scope.seleccionarVendedor = function() { | 368 | $scope.seleccionarVendedor = function() { |
368 | if(validarNotaRemitada()) { | 369 | if(validarNotaRemitada()) { |
369 | var modalInstance = $uibModal.open( | 370 | var modalInstance = $uibModal.open( |
370 | { | 371 | { |
371 | ariaLabelledBy: 'Busqueda de Vendedores', | 372 | ariaLabelledBy: 'Busqueda de Vendedores', |
372 | templateUrl: 'modal-vendedores.html', | 373 | templateUrl: 'modal-vendedores.html', |
373 | controller: 'modalVendedoresCtrl', | 374 | controller: 'modalVendedoresCtrl', |
374 | size: 'lg' | 375 | size: 'lg' |
375 | } | 376 | } |
376 | ); | 377 | ); |
377 | modalInstance.result.then( | 378 | modalInstance.result.then( |
378 | function(vendedor) { | 379 | function(vendedor) { |
379 | $scope.$broadcast('addCabecera', { | 380 | $scope.$broadcast('addCabecera', { |
380 | label: 'Vendedor:', | 381 | label: 'Vendedor:', |
381 | valor: vendedor.NomVen | 382 | valor: vendedor.NomVen |
382 | }); | 383 | }); |
383 | $scope.notaPedido.vendedor = vendedor; | 384 | $scope.notaPedido.vendedor = vendedor; |
384 | }, function() { | 385 | }, function() { |
385 | 386 | ||
386 | } | 387 | } |
387 | ); | 388 | ); |
388 | } | 389 | } |
389 | }; | 390 | }; |
390 | 391 | ||
391 | $scope.seleccionarProveedor = function() { | 392 | $scope.seleccionarProveedor = function() { |
392 | if(validarNotaRemitada()) { | 393 | if(validarNotaRemitada()) { |
393 | var modalInstance = $uibModal.open( | 394 | var modalInstance = $uibModal.open( |
394 | { | 395 | { |
395 | ariaLabelledBy: 'Busqueda de Proveedor', | 396 | ariaLabelledBy: 'Busqueda de Proveedor', |
396 | templateUrl: 'modal-proveedor.html', | 397 | templateUrl: 'modal-proveedor.html', |
397 | controller: 'focaModalProveedorCtrl', | 398 | controller: 'focaModalProveedorCtrl', |
398 | size: 'lg', | 399 | size: 'lg', |
399 | resolve: { | 400 | resolve: { |
400 | transportista: function() { | 401 | transportista: function() { |
401 | return false; | 402 | return false; |
402 | } | 403 | } |
403 | } | 404 | } |
404 | } | 405 | } |
405 | ); | 406 | ); |
406 | modalInstance.result.then( | 407 | modalInstance.result.then( |
407 | function(proveedor) { | 408 | function(proveedor) { |
408 | $scope.notaPedido.proveedor = proveedor; | 409 | $scope.notaPedido.proveedor = proveedor; |
409 | $scope.$broadcast('addCabecera', { | 410 | $scope.$broadcast('addCabecera', { |
410 | label: 'Proveedor:', | 411 | label: 'Proveedor:', |
411 | valor: proveedor.NOM | 412 | valor: proveedor.NOM |
412 | }); | 413 | }); |
413 | }, function() { | 414 | }, function() { |
414 | 415 | ||
415 | } | 416 | } |
416 | ); | 417 | ); |
417 | } | 418 | } |
418 | }; | 419 | }; |
419 | 420 | ||
420 | $scope.seleccionarCliente = function() { | 421 | $scope.seleccionarCliente = function() { |
421 | if(validarNotaRemitada()) { | 422 | if(validarNotaRemitada()) { |
422 | var modalInstance = $uibModal.open( | 423 | var modalInstance = $uibModal.open( |
423 | { | 424 | { |
424 | ariaLabelledBy: 'Busqueda de Cliente', | 425 | ariaLabelledBy: 'Busqueda de Cliente', |
425 | templateUrl: 'foca-busqueda-cliente-modal.html', | 426 | templateUrl: 'foca-busqueda-cliente-modal.html', |
426 | controller: 'focaBusquedaClienteModalController', | 427 | controller: 'focaBusquedaClienteModalController', |
427 | size: 'lg' | 428 | size: 'lg' |
428 | } | 429 | } |
429 | ); | 430 | ); |
430 | modalInstance.result.then( | 431 | modalInstance.result.then( |
431 | function(cliente) { | 432 | function(cliente) { |
432 | $scope.abrirModalDomicilios(cliente); | 433 | $scope.abrirModalDomicilios(cliente); |
433 | }, function() { | 434 | }, function() { |
434 | 435 | ||
435 | } | 436 | } |
436 | ); | 437 | ); |
437 | } | 438 | } |
438 | }; | 439 | }; |
439 | 440 | ||
440 | $scope.abrirModalDomicilios = function(cliente) { | 441 | $scope.abrirModalDomicilios = function(cliente) { |
441 | var modalInstanceDomicilio = $uibModal.open( | 442 | var modalInstanceDomicilio = $uibModal.open( |
442 | { | 443 | { |
443 | ariaLabelledBy: 'Busqueda de Domicilios', | 444 | ariaLabelledBy: 'Busqueda de Domicilios', |
444 | templateUrl: 'modal-domicilio.html', | 445 | templateUrl: 'modal-domicilio.html', |
445 | controller: 'focaModalDomicilioController', | 446 | controller: 'focaModalDomicilioController', |
446 | resolve: { idCliente: function() { return cliente.cod; }}, | 447 | resolve: { idCliente: function() { return cliente.cod; }}, |
447 | size: 'lg', | 448 | size: 'lg', |
448 | } | 449 | } |
449 | ); | 450 | ); |
450 | modalInstanceDomicilio.result.then( | 451 | modalInstanceDomicilio.result.then( |
451 | function(domicilio) { | 452 | function(domicilio) { |
452 | $scope.notaPedido.domicilio = domicilio; | 453 | $scope.notaPedido.domicilio = domicilio; |
453 | $scope.notaPedido.cliente = { | 454 | $scope.notaPedido.cliente = { |
454 | COD: cliente.cod, | 455 | COD: cliente.cod, |
455 | CUIT: cliente.cuit, | 456 | CUIT: cliente.cuit, |
456 | NOM: cliente.nom | 457 | NOM: cliente.nom |
457 | }; | 458 | }; |
458 | var domicilioStamp = | 459 | var domicilioStamp = |
459 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 460 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
460 | domicilio.Localidad + ', ' + domicilio.Provincia; | 461 | domicilio.Localidad + ', ' + domicilio.Provincia; |
461 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 462 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
462 | 463 | ||
463 | $scope.$broadcast('addCabecera', { | 464 | $scope.$broadcast('addCabecera', { |
464 | label: 'Cliente:', | 465 | label: 'Cliente:', |
465 | valor: cliente.nom | 466 | valor: cliente.nom |
466 | }); | 467 | }); |
467 | $scope.$broadcast('addCabecera', { | 468 | $scope.$broadcast('addCabecera', { |
468 | label: 'Domicilio:', | 469 | label: 'Domicilio:', |
469 | valor: domicilioStamp | 470 | valor: domicilioStamp |
470 | }); | 471 | }); |
471 | }, function() { | 472 | }, function() { |
472 | $scope.seleccionarCliente(); | 473 | $scope.seleccionarCliente(); |
473 | return; | 474 | return; |
474 | } | 475 | } |
475 | ); | 476 | ); |
476 | }; | 477 | }; |
477 | 478 | ||
478 | $scope.getTotal = function() { | 479 | $scope.getTotal = function() { |
479 | var total = 0; | 480 | var total = 0; |
480 | var arrayTempArticulos = $scope.articulosTabla; | 481 | var arrayTempArticulos = $scope.articulosTabla; |
481 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 482 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
482 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 483 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
483 | } | 484 | } |
484 | return parseFloat(total.toFixed(2)); | 485 | return parseFloat(total.toFixed(2)); |
485 | }; | 486 | }; |
486 | 487 | ||
487 | $scope.getSubTotal = function() { | 488 | $scope.getSubTotal = function() { |
488 | if($scope.articuloACargar) { | 489 | if($scope.articuloACargar) { |
489 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 490 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
490 | } | 491 | } |
491 | }; | 492 | }; |
492 | 493 | ||
493 | $scope.seleccionarPreciosYCondiciones = function() { | 494 | $scope.seleccionarPreciosYCondiciones = function() { |
494 | if(validarNotaRemitada()) { | 495 | if(validarNotaRemitada()) { |
495 | var modalInstance = $uibModal.open( | 496 | var modalInstance = $uibModal.open( |
496 | { | 497 | { |
497 | ariaLabelledBy: 'Busqueda de Precio Condición', | 498 | ariaLabelledBy: 'Busqueda de Precio Condición', |
498 | templateUrl: 'modal-precio-condicion.html', | 499 | templateUrl: 'modal-precio-condicion.html', |
499 | controller: 'focaModalPrecioCondicionController', | 500 | controller: 'focaModalPrecioCondicionController', |
500 | size: 'lg' | 501 | size: 'lg' |
501 | } | 502 | } |
502 | ); | 503 | ); |
503 | modalInstance.result.then( | 504 | modalInstance.result.then( |
504 | function(precioCondicion) { | 505 | function(precioCondicion) { |
505 | var cabecera = ''; | 506 | var cabecera = ''; |
506 | var plazosConcat = ''; | 507 | var plazosConcat = ''; |
507 | if(!Array.isArray(precioCondicion)) { | 508 | if(!Array.isArray(precioCondicion)) { |
508 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 509 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
509 | $scope.plazosPagos = precioCondicion.plazoPago; | 510 | $scope.plazosPagos = precioCondicion.plazoPago; |
510 | $scope.idLista = precioCondicion.idListaPrecio; | 511 | $scope.idLista = precioCondicion.idListaPrecio; |
511 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 512 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
512 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 513 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
513 | } | 514 | } |
514 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 515 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
515 | } else { //Cuando se ingresan los plazos manualmente | 516 | } else { //Cuando se ingresan los plazos manualmente |
516 | $scope.notaPedido.idPrecioCondicion = 0; | 517 | $scope.notaPedido.idPrecioCondicion = 0; |
517 | //-1, el modal productos busca todos los productos | 518 | //-1, el modal productos busca todos los productos |
518 | $scope.idLista = -1; | 519 | $scope.idLista = -1; |
519 | $scope.plazosPagos = precioCondicion; | 520 | $scope.plazosPagos = precioCondicion; |
520 | for(var j = 0; j < precioCondicion.length; j++) { | 521 | for(var j = 0; j < precioCondicion.length; j++) { |
521 | plazosConcat += precioCondicion[j].dias + ' '; | 522 | plazosConcat += precioCondicion[j].dias + ' '; |
522 | } | 523 | } |
523 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 524 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
524 | } | 525 | } |
525 | $scope.articulosTabla = []; | 526 | $scope.articulosTabla = []; |
526 | $scope.$broadcast('addCabecera', { | 527 | $scope.$broadcast('addCabecera', { |
527 | label: 'Precios y condiciones:', | 528 | label: 'Precios y condiciones:', |
528 | valor: cabecera | 529 | valor: cabecera |
529 | }); | 530 | }); |
530 | }, function() { | 531 | }, function() { |
531 | 532 | ||
532 | } | 533 | } |
533 | ); | 534 | ); |
534 | } | 535 | } |
535 | }; | 536 | }; |
536 | 537 | ||
537 | $scope.seleccionarFlete = function() { | 538 | $scope.seleccionarFlete = function() { |
538 | if(validarNotaRemitada()) { | 539 | if(validarNotaRemitada()) { |
539 | var modalInstance = $uibModal.open( | 540 | var modalInstance = $uibModal.open( |
540 | { | 541 | { |
541 | ariaLabelledBy: 'Busqueda de Flete', | 542 | ariaLabelledBy: 'Busqueda de Flete', |
542 | templateUrl: 'modal-flete.html', | 543 | templateUrl: 'modal-flete.html', |
543 | controller: 'focaModalFleteController', | 544 | controller: 'focaModalFleteController', |
544 | size: 'lg', | 545 | size: 'lg', |
545 | resolve: { | 546 | resolve: { |
546 | parametrosFlete: | 547 | parametrosFlete: |
547 | function() { | 548 | function() { |
548 | return { | 549 | return { |
549 | flete: $scope.notaPedido.fob ? 'FOB' : | 550 | flete: $scope.notaPedido.fob ? 'FOB' : |
550 | ( $scope.notaPedido.flete ? '1' : | 551 | ( $scope.notaPedido.flete ? '1' : |
551 | ($scope.notaPedido.flete === undefined ? | 552 | ($scope.notaPedido.flete === undefined ? |
552 | null : '0')), | 553 | null : '0')), |
553 | bomba: $scope.notaPedido.bomba ? '1' : | 554 | bomba: $scope.notaPedido.bomba ? '1' : |
554 | ($scope.notaPedido.bomba === undefined ? | 555 | ($scope.notaPedido.bomba === undefined ? |
555 | null : '0'), | 556 | null : '0'), |
556 | kilometros: $scope.notaPedido.kilometros | 557 | kilometros: $scope.notaPedido.kilometros |
557 | }; | 558 | }; |
558 | } | 559 | } |
559 | } | 560 | } |
560 | } | 561 | } |
561 | ); | 562 | ); |
562 | modalInstance.result.then( | 563 | modalInstance.result.then( |
563 | function(datos) { | 564 | function(datos) { |
564 | $scope.notaPedido.flete = datos.flete; | 565 | $scope.notaPedido.flete = datos.flete; |
565 | $scope.notaPedido.fob = datos.FOB; | 566 | $scope.notaPedido.fob = datos.FOB; |
566 | $scope.notaPedido.bomba = datos.bomba; | 567 | $scope.notaPedido.bomba = datos.bomba; |
567 | $scope.notaPedido.kilometros = datos.kilometros; | 568 | $scope.notaPedido.kilometros = datos.kilometros; |
568 | $scope.$broadcast('addCabecera', { | 569 | $scope.$broadcast('addCabecera', { |
569 | label: 'Flete:', | 570 | label: 'Flete:', |
570 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') | 571 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') |
571 | }); | 572 | }); |
572 | if(datos.flete) { | 573 | if(datos.flete) { |
573 | $scope.$broadcast('addCabecera', { | 574 | $scope.$broadcast('addCabecera', { |
574 | label: 'Bomba:', | 575 | label: 'Bomba:', |
575 | valor: datos.bomba ? 'Si' : 'No' | 576 | valor: datos.bomba ? 'Si' : 'No' |
576 | }); | 577 | }); |
577 | $scope.$broadcast('addCabecera', { | 578 | $scope.$broadcast('addCabecera', { |
578 | label: 'Kilometros:', | 579 | label: 'Kilometros:', |
579 | valor: datos.kilometros | 580 | valor: datos.kilometros |
580 | }); | 581 | }); |
581 | } else { | 582 | } else { |
582 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 583 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
583 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 584 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
584 | $scope.notaPedido.bomba = false; | 585 | $scope.notaPedido.bomba = false; |
585 | $scope.notaPedido.kilometros = null; | 586 | $scope.notaPedido.kilometros = null; |
586 | } | 587 | } |
587 | }, function() { | 588 | }, function() { |
588 | 589 | ||
589 | } | 590 | } |
590 | ); | 591 | ); |
591 | } | 592 | } |
592 | }; | 593 | }; |
593 | 594 | ||
594 | $scope.seleccionarMoneda = function() { | 595 | $scope.seleccionarMoneda = function() { |
595 | if(validarNotaRemitada()) { | 596 | if(validarNotaRemitada()) { |
596 | var modalInstance = $uibModal.open( | 597 | var modalInstance = $uibModal.open( |
597 | { | 598 | { |
598 | ariaLabelledBy: 'Busqueda de Moneda', | 599 | ariaLabelledBy: 'Busqueda de Moneda', |
599 | templateUrl: 'modal-moneda.html', | 600 | templateUrl: 'modal-moneda.html', |
600 | controller: 'focaModalMonedaController', | 601 | controller: 'focaModalMonedaController', |
601 | size: 'lg' | 602 | size: 'lg' |
602 | } | 603 | } |
603 | ); | 604 | ); |
604 | modalInstance.result.then( | 605 | modalInstance.result.then( |
605 | function(moneda) { | 606 | function(moneda) { |
606 | $scope.abrirModalCotizacion(moneda); | 607 | $scope.abrirModalCotizacion(moneda); |
607 | }, function() { | 608 | }, function() { |
608 | 609 | ||
609 | } | 610 | } |
610 | ); | 611 | ); |
611 | } | 612 | } |
612 | }; | 613 | }; |
613 | 614 | ||
614 | $scope.abrirModalCotizacion = function(moneda) { | 615 | $scope.abrirModalCotizacion = function(moneda) { |
615 | var modalInstance = $uibModal.open( | 616 | var modalInstance = $uibModal.open( |
616 | { | 617 | { |
617 | ariaLabelledBy: 'Busqueda de Cotización', | 618 | ariaLabelledBy: 'Busqueda de Cotización', |
618 | templateUrl: 'modal-cotizacion.html', | 619 | templateUrl: 'modal-cotizacion.html', |
619 | controller: 'focaModalCotizacionController', | 620 | controller: 'focaModalCotizacionController', |
620 | size: 'lg', | 621 | size: 'lg', |
621 | resolve: {idMoneda: function() {return moneda.ID;}} | 622 | resolve: {idMoneda: function() {return moneda.ID;}} |
622 | } | 623 | } |
623 | ); | 624 | ); |
624 | modalInstance.result.then( | 625 | modalInstance.result.then( |
625 | function(cotizacion) { | 626 | function(cotizacion) { |
626 | var articulosTablaTemp = $scope.articulosTabla; | 627 | var articulosTablaTemp = $scope.articulosTabla; |
627 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 628 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
628 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 629 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
629 | $scope.notaPedido.cotizacion.VENDEDOR; | 630 | $scope.notaPedido.cotizacion.VENDEDOR; |
630 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 631 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
631 | cotizacion.VENDEDOR; | 632 | cotizacion.VENDEDOR; |
632 | } | 633 | } |
633 | $scope.articulosTabla = articulosTablaTemp; | 634 | $scope.articulosTabla = articulosTablaTemp; |
634 | $scope.notaPedido.moneda = moneda; | 635 | $scope.notaPedido.moneda = moneda; |
635 | $scope.notaPedido.cotizacion = cotizacion; | 636 | $scope.notaPedido.cotizacion = cotizacion; |
636 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 637 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
637 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 638 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
638 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 639 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
639 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 640 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
640 | }else { | 641 | }else { |
641 | $scope.$broadcast('addCabecera', { | 642 | $scope.$broadcast('addCabecera', { |
642 | label: 'Moneda:', | 643 | label: 'Moneda:', |
643 | valor: moneda.DETALLE | 644 | valor: moneda.DETALLE |
644 | }); | 645 | }); |
645 | $scope.$broadcast('addCabecera', { | 646 | $scope.$broadcast('addCabecera', { |
646 | label: 'Fecha cotizacion:', | 647 | label: 'Fecha cotizacion:', |
647 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 648 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
648 | }); | 649 | }); |
649 | $scope.$broadcast('addCabecera', { | 650 | $scope.$broadcast('addCabecera', { |
650 | label: 'Cotizacion:', | 651 | label: 'Cotizacion:', |
651 | valor: cotizacion.VENDEDOR | 652 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
652 | }); | 653 | }); |
653 | } | 654 | } |
654 | }, function() { | 655 | }, function() { |
655 | 656 | ||
656 | } | 657 | } |
657 | ); | 658 | ); |
658 | }; | 659 | }; |
659 | 660 | ||
660 | $scope.agregarATabla = function(key) { | 661 | $scope.agregarATabla = function(key) { |
661 | if(key === 13) { | 662 | if(key === 13) { |
662 | if($scope.articuloACargar.cantidad === undefined || | 663 | if($scope.articuloACargar.cantidad === undefined || |
663 | $scope.articuloACargar.cantidad === 0 || | 664 | $scope.articuloACargar.cantidad === 0 || |
664 | $scope.articuloACargar.cantidad === null ) { | 665 | $scope.articuloACargar.cantidad === null ) { |
665 | focaModalService.alert('El valor debe ser al menos 1'); | 666 | focaModalService.alert('El valor debe ser al menos 1'); |
666 | return; | 667 | return; |
667 | } | 668 | } |
668 | delete $scope.articuloACargar.sectorCodigo; | 669 | delete $scope.articuloACargar.sectorCodigo; |
669 | $scope.articulosTabla.push($scope.articuloACargar); | 670 | $scope.articulosTabla.push($scope.articuloACargar); |
670 | $scope.cargando = true; | 671 | $scope.cargando = true; |
671 | } | 672 | } |
672 | }; | 673 | }; |
673 | 674 | ||
674 | $scope.quitarArticulo = function(key) { | 675 | $scope.quitarArticulo = function(key) { |
675 | $scope.articulosTabla.splice(key, 1); | 676 | $scope.articulosTabla.splice(key, 1); |
676 | }; | 677 | }; |
677 | 678 | ||
678 | $scope.editarArticulo = function(key, articulo) { | 679 | $scope.editarArticulo = function(key, articulo) { |
679 | if(key === 13) { | 680 | if(key === 13) { |
680 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 681 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
681 | articulo.cantidad === undefined) { | 682 | articulo.cantidad === undefined) { |
682 | focaModalService.alert('El valor debe ser al menos 1'); | 683 | focaModalService.alert('El valor debe ser al menos 1'); |
683 | return; | 684 | return; |
684 | } | 685 | } |
685 | articulo.editCantidad = false; | 686 | articulo.editCantidad = false; |
686 | articulo.editPrecio = false; | 687 | articulo.editPrecio = false; |
687 | } | 688 | } |
688 | }; | 689 | }; |
689 | 690 | ||
690 | $scope.cambioEdit = function(articulo, propiedad) { | 691 | $scope.cambioEdit = function(articulo, propiedad) { |
691 | if(propiedad === 'cantidad') { | 692 | if(propiedad === 'cantidad') { |
692 | articulo.editCantidad = true; | 693 | articulo.editCantidad = true; |
693 | } else if(propiedad === 'precio') { | 694 | } else if(propiedad === 'precio') { |
694 | articulo.editPrecio = true; | 695 | articulo.editPrecio = true; |
695 | } | 696 | } |
696 | }; | 697 | }; |
697 | 698 | ||
698 | $scope.resetFilter = function() { | 699 | $scope.resetFilter = function() { |
699 | $scope.articuloACargar = {}; | 700 | $scope.articuloACargar = {}; |
700 | $scope.cargando = true; | 701 | $scope.cargando = true; |
701 | }; | 702 | }; |
702 | //Recibe aviso si el teclado está en uso | 703 | //Recibe aviso si el teclado está en uso |
703 | $rootScope.$on('usarTeclado', function(event, data) { | 704 | $rootScope.$on('usarTeclado', function(event, data) { |
704 | if(data) { | 705 | if(data) { |
705 | $scope.mostrarTeclado = true; | 706 | $scope.mostrarTeclado = true; |
706 | return; | 707 | return; |
707 | } | 708 | } |
708 | $scope.mostrarTeclado = false; | 709 | $scope.mostrarTeclado = false; |
709 | }); | 710 | }); |
710 | 711 | ||
711 | $scope.selectFocus = function($event) { | 712 | $scope.selectFocus = function($event) { |
712 | // Si el teclado esta en uso no selecciona el valor | 713 | // Si el teclado esta en uso no selecciona el valor |
713 | if($scope.mostrarTeclado) { | 714 | if($scope.mostrarTeclado) { |
714 | return; | 715 | return; |
715 | } | 716 | } |
716 | $event.target.select(); | 717 | $event.target.select(); |
717 | }; | 718 | }; |
718 | 719 | ||
719 | $scope.salir = function() { | 720 | $scope.salir = function() { |
720 | $location.path('/'); | 721 | $location.path('/'); |
721 | }; | 722 | }; |
722 | 723 | ||
723 | $scope.parsearATexto = function(articulo) { | 724 | $scope.parsearATexto = function(articulo) { |
724 | articulo.cantidad = parseFloat(articulo.cantidad); | 725 | articulo.cantidad = parseFloat(articulo.cantidad); |
725 | articulo.precio = parseFloat(articulo.precio); | 726 | articulo.precio = parseFloat(articulo.precio); |
726 | }; | 727 | }; |
727 | 728 | ||
728 | function addArrayCabecera(array) { | 729 | function addArrayCabecera(array) { |
729 | for(var i = 0; i < array.length; i++) { | 730 | for(var i = 0; i < array.length; i++) { |
730 | $scope.$broadcast('addCabecera', { | 731 | $scope.$broadcast('addCabecera', { |
731 | label: array[i].label, | 732 | label: array[i].label, |
732 | valor: array[i].valor | 733 | valor: array[i].valor |
733 | }); | 734 | }); |
734 | } | 735 | } |
735 | } | 736 | } |
736 | 737 | ||
737 | function rellenar(relleno, longitud) { | 738 | function rellenar(relleno, longitud) { |
738 | relleno = '' + relleno; | 739 | relleno = '' + relleno; |
739 | while (relleno.length < longitud) { | 740 | while (relleno.length < longitud) { |
740 | relleno = '0' + relleno; | 741 | relleno = '0' + relleno; |
741 | } | 742 | } |
742 | 743 | ||
743 | return relleno; | 744 | return relleno; |
744 | } | 745 | } |
745 | 746 | ||
746 | function validarNotaRemitada() { | 747 | function validarNotaRemitada() { |
747 | if(!$scope.notaPedido.idRemito) { | 748 | if(!$scope.notaPedido.idRemito) { |
748 | return true; | 749 | return true; |
749 | }else{ | 750 | }else{ |
750 | focaModalService.alert('No se puede editar una nota de pedido remitada'); | 751 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
751 | return false; | 752 | return false; |
752 | } | 753 | } |
753 | } | 754 | } |
754 | } | 755 | } |
755 | ]); | 756 | ]); |
756 | 757 |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido foca-crear row"> | 1 | <div class="crear-nota-pedido foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Nota de pedido'" | 3 | titulo="'Nota de pedido'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
5 | fecha="now" | 5 | fecha="now" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | busqueda="seleccionarNotaPedido" | 7 | busqueda="seleccionarNotaPedido" |
8 | ></foca-cabecera-facturador> | 8 | ></foca-cabecera-facturador> |
9 | <div class="col-lg-12"> | 9 | <div class="col-lg-12"> |
10 | <div class="row mt-4"> | 10 | <div class="row mt-4"> |
11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> | 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
12 | <div class="row px-5 py-2 botonera-secundaria"> | 12 | <div class="row px-5 py-2 botonera-secundaria"> |
13 | <div class="col-12"> | 13 | <div class="col-12"> |
14 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | <!-- PC --> | 17 | <!-- PC --> |
18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
20 | <thead> | 20 | <thead> |
21 | <tr class="d-flex"> | 21 | <tr class="d-flex"> |
22 | <th valign="middle" class="">#</th> | 22 | <th valign="middle" class="">#</th> |
23 | <th valign="middle" class="col">Código</th> | 23 | <th valign="middle" class="col">Código</th> |
24 | <th valign="middle" class="col-4">Descripción</th> | 24 | <th valign="middle" class="col-4">Descripción</th> |
25 | <th valign="middle" class="col text-right">Cantidad</th> | 25 | <th valign="middle" class="col text-right">Cantidad</th> |
26 | <th valign="middle" class="col text-right">Precio Unitario</th> | 26 | <th valign="middle" class="col text-right">Precio Unitario</th> |
27 | <th valign="middle" class="col text-right">SubTotal</th> | 27 | <th valign="middle" class="col text-right">SubTotal</th> |
28 | <th valign="middle" class="text-right"> | 28 | <th valign="middle" class="text-right"> |
29 | <button | 29 | <button |
30 | class="btn btn-outline-light selectable" | 30 | class="btn btn-outline-light selectable" |
31 | ng-click="show = !show; masMenos()" | 31 | ng-click="show = !show; masMenos()" |
32 | > | 32 | > |
33 | <i | 33 | <i |
34 | class="fa fa-chevron-down" | 34 | class="fa fa-chevron-down" |
35 | ng-show="show" | 35 | ng-show="show" |
36 | aria-hidden="true" | 36 | aria-hidden="true" |
37 | > | 37 | > |
38 | </i> | 38 | </i> |
39 | <i | 39 | <i |
40 | class="fa fa-chevron-up" | 40 | class="fa fa-chevron-up" |
41 | ng-hide="show" | 41 | ng-hide="show" |
42 | aria-hidden="true"> | 42 | aria-hidden="true"> |
43 | </i> | 43 | </i> |
44 | </button> | 44 | </button> |
45 | </th> | 45 | </th> |
46 | </tr> | 46 | </tr> |
47 | </thead> | 47 | </thead> |
48 | <tbody class="tabla-articulo-body"> | 48 | <tbody class="tabla-articulo-body"> |
49 | <tr | 49 | <tr |
50 | ng-repeat="(key, articulo) in articulosTabla" | 50 | ng-repeat="(key, articulo) in articulosTabla" |
51 | ng-show="show || key == (articulosTabla.length - 1)" | 51 | ng-show="show || key == (articulosTabla.length - 1)" |
52 | class="d-flex" | 52 | class="d-flex" |
53 | > | 53 | > |
54 | <td ng-bind="key + 1"></td> | 54 | <td ng-bind="key + 1"></td> |
55 | <td | 55 | <td |
56 | class="col" | 56 | class="col" |
57 | ng-bind="articulo.sector + '-' + articulo.codigo" | 57 | ng-bind="articulo.sector + '-' + articulo.codigo" |
58 | ></td> | 58 | ></td> |
59 | <td | 59 | <td |
60 | class="col-4" | 60 | class="col-4" |
61 | ng-bind="articulo.descripcion" | 61 | ng-bind="articulo.descripcion" |
62 | ></td> | 62 | ></td> |
63 | <td class="col text-right"> | 63 | <td class="col text-right"> |
64 | <input | 64 | <input |
65 | ng-show="articulo.editCantidad" | 65 | ng-show="articulo.editCantidad" |
66 | ng-model="articulo.cantidad" | 66 | ng-model="articulo.cantidad" |
67 | class="form-control" | 67 | class="form-control" |
68 | foca-tipo-input | 68 | foca-tipo-input |
69 | min="1" | 69 | min="1" |
70 | step="0.001" | 70 | step="0.001" |
71 | foca-focus="articulo.editCantidad" | 71 | foca-focus="articulo.editCantidad" |
72 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 72 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
73 | ng-focus="selectFocus($event)" | 73 | ng-focus="selectFocus($event)" |
74 | teclado-virtual | 74 | teclado-virtual |
75 | > | 75 | > |
76 | <i | 76 | <i |
77 | class="selectable" | 77 | class="selectable" |
78 | ng-click="cambioEdit(articulo, 'cantidad')" | 78 | ng-click="cambioEdit(articulo, 'cantidad')" |
79 | ng-hide="articulo.editCantidad" | 79 | ng-hide="articulo.editCantidad" |
80 | ng-bind="articulo.cantidad"> | 80 | ng-bind="articulo.cantidad"> |
81 | </i> | 81 | </i> |
82 | </td> | 82 | </td> |
83 | <td class="col text-right"> | 83 | <td class="col text-right"> |
84 | <input | 84 | <input |
85 | ng-show="articulo.editPrecio" | 85 | ng-show="articulo.editPrecio" |
86 | ng-model="articulo.precio" | 86 | ng-model="articulo.precio" |
87 | class="form-control" | 87 | class="form-control" |
88 | foca-tipo-input | 88 | foca-tipo-input |
89 | min="0" | 89 | min="0" |
90 | step="0.0001" | 90 | step="0.0001" |
91 | foca-focus="articulo.editPrecio" | 91 | foca-focus="articulo.editPrecio" |
92 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 92 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
93 | ng-focus="selectFocus($event)" | 93 | ng-focus="selectFocus($event)" |
94 | teclado-virtual | 94 | teclado-virtual |
95 | > | 95 | > |
96 | <i | 96 | <i |
97 | class="selectable" | 97 | class="selectable" |
98 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 98 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
99 | ng-hide="articulo.editPrecio" | 99 | ng-hide="articulo.editPrecio" |
100 | ng-bind="articulo.precio | | 100 | ng-bind="articulo.precio | |
101 | currency: notaPedido.moneda.SIMBOLO : 4"> | 101 | number : 4"> |
102 | </i> | 102 | </i> |
103 | </td> | 103 | </td> |
104 | <td | 104 | <td |
105 | class="col text-right" | 105 | class="col text-right" |
106 | ng-bind="(articulo.precio * articulo.cantidad) | | 106 | ng-bind="(articulo.precio * articulo.cantidad) | |
107 | currency: notaPedido.moneda.SIMBOLO"> | 107 | number: 2"> |
108 | </td> | 108 | </td> |
109 | <td class="text-center"> | 109 | <td class="text-center"> |
110 | <button | 110 | <button |
111 | ng-show="articulo.editCantidad || articulo.editPrecio" | 111 | ng-show="articulo.editCantidad || articulo.editPrecio" |
112 | class="btn btn-outline-light" | 112 | class="btn btn-outline-light" |
113 | ng-click="editarArticulo(13, articulo)" | 113 | ng-click="editarArticulo(13, articulo)" |
114 | > | 114 | > |
115 | <i class="fa fa-save"></i> | 115 | <i class="fa fa-save"></i> |
116 | </button> | 116 | </button> |
117 | <button | 117 | <button |
118 | class="btn btn-outline-light" | 118 | class="btn btn-outline-light" |
119 | ng-click="quitarArticulo(key)" | 119 | ng-click="quitarArticulo(key)" |
120 | > | 120 | > |
121 | <i class="fa fa-trash"></i> | 121 | <i class="fa fa-trash"></i> |
122 | </button> | 122 | </button> |
123 | </td> | 123 | </td> |
124 | </tr> | 124 | </tr> |
125 | </tbody> | 125 | </tbody> |
126 | <tfoot> | 126 | <tfoot> |
127 | <tr ng-show="!cargando" class="d-flex"> | 127 | <tr ng-show="!cargando" class="d-flex"> |
128 | <td | 128 | <td |
129 | class="align-middle" | 129 | class="align-middle" |
130 | ng-bind="articulosTabla.length + 1" | 130 | ng-bind="articulosTabla.length + 1" |
131 | ></td> | 131 | ></td> |
132 | <td class="col"> | 132 | <td class="col"> |
133 | <input | 133 | <input |
134 | class="form-control" | 134 | class="form-control" |
135 | ng-model="articuloACargar.sectorCodigo" | 135 | ng-model="articuloACargar.sectorCodigo" |
136 | readonly | 136 | readonly |
137 | > | 137 | > |
138 | </td> | 138 | </td> |
139 | <td class="col-4 tabla-articulo-descripcion"> | 139 | <td class="col-4 tabla-articulo-descripcion"> |
140 | <input | 140 | <input |
141 | class="form-control" | 141 | class="form-control" |
142 | ng-model="articuloACargar.descripcion" | 142 | ng-model="articuloACargar.descripcion" |
143 | readonly | 143 | readonly |
144 | > | 144 | > |
145 | </td> | 145 | </td> |
146 | <td class="col text-right"> | 146 | <td class="col text-right"> |
147 | <input | 147 | <input |
148 | class="form-control" | 148 | class="form-control" |
149 | foca-tipo-input | 149 | foca-tipo-input |
150 | min="1" | 150 | min="1" |
151 | step="0.001" | 151 | step="0.001" |
152 | ng-model="articuloACargar.cantidad" | 152 | ng-model="articuloACargar.cantidad" |
153 | foca-focus="!cargando" | 153 | foca-focus="!cargando" |
154 | esc-key="resetFilter()" | 154 | esc-key="resetFilter()" |
155 | ng-keypress="agregarATabla($event.keyCode)" | 155 | ng-keypress="agregarATabla($event.keyCode)" |
156 | teclado-virtual | 156 | teclado-virtual |
157 | > | 157 | > |
158 | </td> | 158 | </td> |
159 | <td class="col text-right"> | 159 | <td class="col text-right"> |
160 | <input | 160 | <input |
161 | class="form-control" | 161 | class="form-control" |
162 | ng-value="articuloACargar.precio | | 162 | ng-value="articuloACargar.precio | number: 2" |
163 | currency: notaPedido.moneda.SIMBOLO : 4" | ||
164 | ng-show="idLista != -1" | 163 | ng-show="idLista != -1" |
165 | readonly | 164 | readonly |
166 | > | 165 | > |
167 | <input | 166 | <input |
168 | class="form-control" | 167 | class="form-control" |
169 | foca-tipo-input | 168 | foca-tipo-input |
170 | min="0" | 169 | min="0" |
171 | step="0.0001" | 170 | step="0.0001" |
172 | ng-model="articuloACargar.precio" | 171 | ng-model="articuloACargar.precio" |
173 | esc-key="resetFilter()" | 172 | esc-key="resetFilter()" |
174 | ng-keypress="agregarATabla($event.keyCode)" | 173 | ng-keypress="agregarATabla($event.keyCode)" |
175 | ng-show="idLista == -1" | 174 | ng-show="idLista == -1" |
176 | teclado-virtual | 175 | teclado-virtual |
177 | > | 176 | > |
178 | </td> | 177 | </td> |
179 | <td class="col text-right"> | 178 | <td class="col text-right"> |
180 | <input | 179 | <input |
181 | class="form-control" | 180 | class="form-control" |
182 | ng-value="getSubTotal() | currency: notaPedido.moneda.SIMBOLO" | 181 | ng-value="getSubTotal() | number: 2" |
183 | readonly | 182 | readonly |
184 | ></td> | 183 | ></td> |
185 | <td class="text-center align-middle"> | 184 | <td class="text-center align-middle"> |
186 | <button | 185 | <button |
187 | class="btn btn-outline-light" | 186 | class="btn btn-outline-light" |
188 | ng-click="agregarATabla(13)" | 187 | ng-click="agregarATabla(13)" |
189 | > | 188 | > |
190 | <i class="fa fa-save"></i> | 189 | <i class="fa fa-save"></i> |
191 | </button> | 190 | </button> |
192 | </td> | 191 | </td> |
193 | </tr> | 192 | </tr> |
194 | <tr class="d-flex"> | 193 | <tr class="d-flex"> |
195 | <td colspan="4" class="no-border-top"> | 194 | <td colspan="4" class="no-border-top"> |
196 | <strong>Items:</strong> | 195 | <strong>Items:</strong> |
197 | <a ng-bind="articulosTabla.length"></a> | 196 | <a ng-bind="articulosTabla.length"></a> |
198 | </td> | 197 | </td> |
199 | <td class="text-right ml-auto table-celda-total no-border-top"> | 198 | <td class="text-right ml-auto table-celda-total no-border-top"> |
200 | <h3>Total:</h3> | 199 | <h3>Total:</h3> |
201 | </td> | 200 | </td> |
202 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 201 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
203 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 202 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
204 | </td> | 203 | </td> |
205 | <td class="text-right no-border-top"> | 204 | <td class="text-right no-border-top"> |
206 | <button | 205 | <button |
207 | type="button" | 206 | type="button" |
208 | class="btn btn-default btn-sm" | 207 | class="btn btn-default btn-sm" |
209 | > | 208 | > |
210 | Totales | 209 | Totales |
211 | </button> | 210 | </button> |
212 | </td> | 211 | </td> |
213 | </tr> | 212 | </tr> |
214 | </tfoot> | 213 | </tfoot> |
215 | </table> | 214 | </table> |
216 | </div> | 215 | </div> |
217 | <!-- MOBILE --> | 216 | <!-- MOBILE --> |
218 | <div class="row d-sm-none"> | 217 | <div class="row d-sm-none"> |
219 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | 218 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> |
220 | <thead> | 219 | <thead> |
221 | <tr class="d-flex"> | 220 | <tr class="d-flex"> |
222 | <th class="">#</th> | 221 | <th class="">#</th> |
223 | <th class="col px-0"> | 222 | <th class="col px-0"> |
224 | <div class="d-flex"> | 223 | <div class="d-flex"> |
225 | <div class="col-4 px-1">Código</div> | 224 | <div class="col-4 px-1">Código</div> |
226 | <div class="col-8 px-1">Descripción</div> | 225 | <div class="col-8 px-1">Descripción</div> |
227 | </div> | 226 | </div> |
228 | <div class="d-flex"> | 227 | <div class="d-flex"> |
229 | <div class="col-3 px-1">Cantidad</div> | 228 | <div class="col-3 px-1">Cantidad</div> |
230 | <div class="col px-1 text-right">P. Uni.</div> | 229 | <div class="col px-1 text-right">P. Uni.</div> |
231 | <div class="col px-1 text-right">Subtotal</div> | 230 | <div class="col px-1 text-right">Subtotal</div> |
232 | </div> | 231 | </div> |
233 | </th> | 232 | </th> |
234 | <th class="text-center tamaño-boton"> | 233 | <th class="text-center tamaño-boton"> |
235 | | 234 | |
236 | </th> | 235 | </th> |
237 | </tr> | 236 | </tr> |
238 | </thead> | 237 | </thead> |
239 | <tbody> | 238 | <tbody> |
240 | <tr | 239 | <tr |
241 | ng-repeat="(key, articulo) in articulosTabla" | 240 | ng-repeat="(key, articulo) in articulosTabla" |
242 | ng-show="show || key == articulosTabla.length - 1" | 241 | ng-show="show || key == articulosTabla.length - 1" |
243 | > | 242 | > |
244 | <td class="w-100 align-middle d-flex p-0"> | 243 | <td class="w-100 align-middle d-flex p-0"> |
245 | <div class="align-middle p-1"> | 244 | <div class="align-middle p-1"> |
246 | <span ng-bind="key+1" class="align-middle"></span> | 245 | <span ng-bind="key+1" class="align-middle"></span> |
247 | </div> | 246 | </div> |
248 | <div class="col px-0"> | 247 | <div class="col px-0"> |
249 | <div class="d-flex"> | 248 | <div class="d-flex"> |
250 | <div class="col-4 px-1"> | 249 | <div class="col-4 px-1"> |
251 | <span | 250 | <span |
252 | ng-bind="articulo.sector + '-' + articulo.codigo" | 251 | ng-bind="articulo.sector + '-' + articulo.codigo" |
253 | ></span> | 252 | ></span> |
254 | </div> | 253 | </div> |
255 | <div class="col-8 px-1"> | 254 | <div class="col-8 px-1"> |
256 | <span ng-bind="articulo.descripcion"></span> | 255 | <span ng-bind="articulo.descripcion"></span> |
257 | </div> | 256 | </div> |
258 | </div> | 257 | </div> |
259 | <div class="d-flex"> | 258 | <div class="d-flex"> |
260 | <div class="col-3 px-1"> | 259 | <div class="col-3 px-1"> |
261 | <span | 260 | <span |
262 | ng-bind="'x' + articulo.cantidad" | 261 | ng-bind="'x' + articulo.cantidad" |
263 | ng-hide="articulo.editCantidad" | 262 | ng-hide="articulo.editCantidad" |
264 | ></span> | 263 | ></span> |
265 | <i | 264 | <i |
266 | class="fa fa-pencil text-white-50" | 265 | class="fa fa-pencil text-white-50" |
267 | aria-hidden="true" | 266 | aria-hidden="true" |
268 | ng-hide="articulo.editCantidad" | 267 | ng-hide="articulo.editCantidad" |
269 | ng-click="articulo.editCantidad = true" | 268 | ng-click="articulo.editCantidad = true" |
270 | ></i> | 269 | ></i> |
271 | <input | 270 | <input |
272 | ng-show="articulo.editCantidad" | 271 | ng-show="articulo.editCantidad" |
273 | ng-model="articulo.cantidad" | 272 | ng-model="articulo.cantidad" |
274 | class="form-control" | 273 | class="form-control" |
275 | foca-tipo-input | 274 | foca-tipo-input |
276 | min="1" | 275 | min="1" |
277 | step="0.001" | 276 | step="0.001" |
278 | foca-focus="articulo.editCantidad" | 277 | foca-focus="articulo.editCantidad" |
279 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 278 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
280 | ng-focus="selectFocus($event)" | 279 | ng-focus="selectFocus($event)" |
281 | > | 280 | > |
282 | </div> | 281 | </div> |
283 | <div class="col px-1 text-right"> | 282 | <div class="col px-1 text-right"> |
284 | <span ng-bind="articulo.precio | | 283 | <span ng-bind="articulo.precio | |
285 | currency: notaPedido.moneda.SIMBOLO : 4"></span> | 284 | currency: notaPedido.moneda.SIMBOLO : 4"></span> |
286 | ></span> | 285 | ></span> |
287 | </div> | 286 | </div> |
288 | <div class="col px-1 text-right"> | 287 | <div class="col px-1 text-right"> |
289 | <span | 288 | <span |
290 | ng-bind="(articulo.precio * articulo.cantidad) | | 289 | ng-bind="(articulo.precio * articulo.cantidad) | |
291 | currency: notaPedido.moneda.SIMBOLO" | 290 | currency: notaPedido.moneda.SIMBOLO" |
292 | > | 291 | > |
293 | </span> | 292 | </span> |
294 | </div> | 293 | </div> |
295 | </div> | 294 | </div> |
296 | </div> | 295 | </div> |
297 | <div class="align-middle p-1"> | 296 | <div class="align-middle p-1"> |
298 | <button | 297 | <button |
299 | class="btn btn-outline-light" | 298 | class="btn btn-outline-light" |
300 | ng-click="quitarArticulo(key)" | 299 | ng-click="quitarArticulo(key)" |
301 | > | 300 | > |
302 | <i class="fa fa-trash"></i> | 301 | <i class="fa fa-trash"></i> |
303 | </button> | 302 | </button> |
304 | </div> | 303 | </div> |
305 | </td> | 304 | </td> |
306 | </tr> | 305 | </tr> |
307 | </tbody> | 306 | </tbody> |
308 | <tfoot> | 307 | <tfoot> |
309 | <!-- CARGANDO ITEM --> | 308 | <!-- CARGANDO ITEM --> |
310 | <tr ng-show="!cargando" class="d-flex"> | 309 | <tr ng-show="!cargando" class="d-flex"> |
311 | <td | 310 | <td |
312 | class="align-middle p-1" | 311 | class="align-middle p-1" |
313 | ng-bind="articulosTabla.length + 1" | 312 | ng-bind="articulosTabla.length + 1" |
314 | ></td> | 313 | ></td> |
315 | <td class="col p-0"> | 314 | <td class="col p-0"> |
316 | <div class="d-flex"> | 315 | <div class="d-flex"> |
317 | <div class="col-4 px-1"> | 316 | <div class="col-4 px-1"> |
318 | <span | 317 | <span |
319 | ng-bind="articuloACargar.sectorCodigo" | 318 | ng-bind="articuloACargar.sectorCodigo" |
320 | ></span> | 319 | ></span> |
321 | </div> | 320 | </div> |
322 | <div class="col-8 px-1"> | 321 | <div class="col-8 px-1"> |
323 | <span ng-bind="articuloACargar.descripcion"></span> | 322 | <span ng-bind="articuloACargar.descripcion"></span> |
324 | </div> | 323 | </div> |
325 | </div> | 324 | </div> |
326 | <div class="d-flex"> | 325 | <div class="d-flex"> |
327 | <div class="col-3 px-1 m-1"> | 326 | <div class="col-3 px-1 m-1"> |
328 | <input | 327 | <input |
329 | class="form-control p-1" | 328 | class="form-control p-1" |
330 | foca-tipo-input | 329 | foca-tipo-input |
331 | min="1" | 330 | min="1" |
332 | ng-model="articuloACargar.cantidad" | 331 | ng-model="articuloACargar.cantidad" |
333 | foca-focus="!cargando" | 332 | foca-focus="!cargando" |
334 | ng-keypress="agregarATabla($event.keyCode)" | 333 | ng-keypress="agregarATabla($event.keyCode)" |
335 | style="height: auto; line-height: 1.1em" | 334 | style="height: auto; line-height: 1.1em" |
336 | > | 335 | > |
337 | </div> | 336 | </div> |
338 | <div class="col px-1 text-right"> | 337 | <div class="col px-1 text-right"> |
339 | <span ng-bind="articuloACargar.precio | | 338 | <span ng-bind="articuloACargar.precio | |
340 | currency: notaPedido.moneda.SIMBOLO : 4" | 339 | currency: notaPedido.moneda.SIMBOLO : 4" |
341 | ></span> | 340 | ></span> |
342 | </div> | 341 | </div> |
343 | <div class="col px-1 text-right"> | 342 | <div class="col px-1 text-right"> |
344 | <span | 343 | <span |
345 | ng-bind="getSubTotal() | | 344 | ng-bind="getSubTotal() | |
346 | currency: notaPedido.moneda.SIMBOLO" | 345 | currency: notaPedido.moneda.SIMBOLO" |
347 | > | 346 | > |
348 | </span> | 347 | </span> |
349 | </div> | 348 | </div> |
350 | </div> | 349 | </div> |
351 | </td> | 350 | </td> |
352 | <td class="text-center align-middle"> | 351 | <td class="text-center align-middle"> |
353 | <button | 352 | <button |
354 | class="btn btn-outline-light" | 353 | class="btn btn-outline-light" |
355 | ng-click="agregarATabla(13)" | 354 | ng-click="agregarATabla(13)" |
356 | > | 355 | > |
357 | <i class="fa fa-save"></i> | 356 | <i class="fa fa-save"></i> |
358 | </button> | 357 | </button> |
359 | </td> | 358 | </td> |
360 | </tr> | 359 | </tr> |
361 | <!-- SELECCIONAR PRODUCTO --> | 360 | <!-- SELECCIONAR PRODUCTO --> |
362 | <tr ng-show="cargando" class="d-flex"> | 361 | <tr ng-show="cargando" class="d-flex"> |
363 | <td class="col-12"> | 362 | <td class="col-12"> |
364 | <input | 363 | <input |
365 | placeholder="Seleccione Articulo" | 364 | placeholder="Seleccione Articulo" |
366 | class="form-control form-control-sm" | 365 | class="form-control form-control-sm" |
367 | readonly | 366 | readonly |
368 | ng-click="seleccionarArticulo()" | 367 | ng-click="seleccionarArticulo()" |
369 | /> | 368 | /> |
370 | </td> | 369 | </td> |
371 | </tr> | 370 | </tr> |
372 | <!-- TOOGLE EXPANDIR --> | 371 | <!-- TOOGLE EXPANDIR --> |
373 | <tr> | 372 | <tr> |
374 | <td class="col"> | 373 | <td class="col"> |
375 | <button | 374 | <button |
376 | class="btn btn-outline-light selectable w-100" | 375 | class="btn btn-outline-light selectable w-100" |
377 | ng-click="show = !show; masMenos()" | 376 | ng-click="show = !show; masMenos()" |
378 | ng-show="articulosTabla.length > 0" | 377 | ng-show="articulosTabla.length > 0" |
379 | > | 378 | > |
380 | <i | 379 | <i |
381 | class="fa fa-chevron-down" | 380 | class="fa fa-chevron-down" |
382 | ng-hide="show" | 381 | ng-hide="show" |
383 | aria-hidden="true" | 382 | aria-hidden="true" |
384 | > | 383 | > |
385 | </i> | 384 | </i> |
386 | <i | 385 | <i |
387 | class="fa fa-chevron-up" | 386 | class="fa fa-chevron-up" |
388 | ng-show="show" | 387 | ng-show="show" |
389 | aria-hidden="true"> | 388 | aria-hidden="true"> |
390 | </i> | 389 | </i> |
391 | </button> | 390 | </button> |
392 | </td> | 391 | </td> |
393 | </tr> | 392 | </tr> |
394 | <!-- FOOTER --> | 393 | <!-- FOOTER --> |
395 | <tr class="d-flex"> | 394 | <tr class="d-flex"> |
396 | <td class="align-middle no-border-top" colspan="2"> | 395 | <td class="align-middle no-border-top" colspan="2"> |
397 | <strong>Cantidad Items:</strong> | 396 | <strong>Cantidad Items:</strong> |
398 | <a ng-bind="articulosTabla.length"></a> | 397 | <a ng-bind="articulosTabla.length"></a> |
399 | </td> | 398 | </td> |
400 | <td class="text-right ml-auto table-celda-total no-border-top"> | 399 | <td class="text-right ml-auto table-celda-total no-border-top"> |
401 | <h3>Total:</h3> | 400 | <h3>Total:</h3> |
402 | </td> | 401 | </td> |
403 | <td class="table-celda-total text-right no-border-top"> | 402 | <td class="table-celda-total text-right no-border-top"> |
404 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> | 403 | <h3>{{getTotal() | currency: notaPedido.moneda.SIMBOLO}}</h3> |
405 | </td> | 404 | </td> |
406 | </tr> | 405 | </tr> |
407 | </tfoot> | 406 | </tfoot> |
408 | </table> | 407 | </table> |
409 | </div> | 408 | </div> |
410 | </div> | 409 | </div> |
411 | </div> | 410 | </div> |
412 | </div> | 411 | </div> |
413 | <div class="row d-md-none fixed-bottom"> | 412 | <div class="row d-md-none fixed-bottom"> |
414 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 413 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
415 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 414 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
416 | <span | 415 | <span |
417 | class="mr-3 ml-auto" | 416 | class="mr-3 ml-auto" |
418 | ng-class="saveLoading ? 'text-muted' : ''" | 417 | ng-class="saveLoading ? 'text-muted' : ''" |
419 | ng-click="crearNotaPedido()" | 418 | ng-click="crearNotaPedido()" |
420 | ladda="saveLoading" | 419 | ladda="saveLoading" |
421 | data-style="expand-left" | 420 | data-style="expand-left" |
422 | >Guardar</span> | 421 | >Guardar</span> |
423 | </div> | 422 | </div> |
424 | </div> | 423 | </div> |
425 | </div> | 424 | </div> |
426 | 425 |