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