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