Commit 9f7c38f9a56183f73275b21f7c638bc0ef31030a
1 parent
a19ec3a878
Exists in
master
and in
1 other branch
si tiene puntos de descarga, abrir modal
Showing
3 changed files
with
11 additions
and
14 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | '$timeout', | 7 | '$timeout', |
8 | 'crearNotaPedidoService', | 8 | 'crearNotaPedidoService', |
9 | 'focaBotoneraLateralService', | 9 | 'focaBotoneraLateralService', |
10 | 'focaModalService', | 10 | 'focaModalService', |
11 | 'notaPedidoBusinessService', | 11 | 'notaPedidoBusinessService', |
12 | '$rootScope', | 12 | '$rootScope', |
13 | 'focaSeguimientoService', | 13 | 'focaSeguimientoService', |
14 | function( | 14 | function( |
15 | $scope, $uibModal, $location, $filter, $timeout, | 15 | $scope, $uibModal, $location, $filter, $timeout, |
16 | crearNotaPedidoService, focaBotoneraLateralService, | 16 | crearNotaPedidoService, focaBotoneraLateralService, |
17 | focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) | 17 | focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) |
18 | { | 18 | { |
19 | 19 | ||
20 | $scope.botonera = crearNotaPedidoService.getBotonera(); | 20 | $scope.botonera = crearNotaPedidoService.getBotonera(); |
21 | 21 | ||
22 | $scope.isNumber = angular.isNumber; | 22 | $scope.isNumber = angular.isNumber; |
23 | $scope.datepickerAbierto = false; | 23 | $scope.datepickerAbierto = false; |
24 | $scope.show = false; | 24 | $scope.show = false; |
25 | $scope.cargando = true; | 25 | $scope.cargando = true; |
26 | $scope.dateOptions = { | 26 | $scope.dateOptions = { |
27 | maxDate: new Date(), | 27 | maxDate: new Date(), |
28 | minDate: new Date(2010, 0, 1) | 28 | minDate: new Date(2010, 0, 1) |
29 | }; | 29 | }; |
30 | 30 | ||
31 | $scope.notaPedido = { | 31 | $scope.notaPedido = { |
32 | id: 0, | 32 | id: 0, |
33 | vendedor: {}, | 33 | vendedor: {}, |
34 | cliente: {}, | 34 | cliente: {}, |
35 | proveedor: {}, | 35 | proveedor: {}, |
36 | domicilio: {dom: ''}, | 36 | domicilio: {dom: ''}, |
37 | moneda: {}, | 37 | moneda: {}, |
38 | cotizacion: {} | 38 | cotizacion: {} |
39 | }; | 39 | }; |
40 | var monedaPorDefecto; | 40 | var monedaPorDefecto; |
41 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 41 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
42 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | 42 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
43 | monedaPorDefecto = res.data[0]; | 43 | monedaPorDefecto = res.data[0]; |
44 | $scope.notaPedido.moneda = monedaPorDefecto; | 44 | $scope.notaPedido.moneda = monedaPorDefecto; |
45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | 45 | $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; |
46 | }); | 46 | }); |
47 | 47 | ||
48 | $scope.cabecera = []; | 48 | $scope.cabecera = []; |
49 | $scope.showCabecera = true; | 49 | $scope.showCabecera = true; |
50 | 50 | ||
51 | $scope.now = new Date(); | 51 | $scope.now = new Date(); |
52 | $scope.puntoVenta = '0000'; | 52 | $scope.puntoVenta = '0000'; |
53 | $scope.comprobante = '00000000'; | 53 | $scope.comprobante = '00000000'; |
54 | $scope.articulosTabla = []; | 54 | $scope.articulosTabla = []; |
55 | $scope.idLista = undefined; | 55 | $scope.idLista = undefined; |
56 | 56 | ||
57 | //SETEO BOTONERA LATERAL | 57 | //SETEO BOTONERA LATERAL |
58 | $timeout(function() { | 58 | $timeout(function() { |
59 | focaBotoneraLateralService.showSalir(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 | data.data.id, | 134 | data.data.id, |
141 | 'Nota de pedido', | 135 | 'Nota de pedido', |
142 | 'Nº: ' + $filter('comprobante')([ | 136 | 'Nº: ' + $filter('comprobante')([ |
143 | $scope.puntoVenta, | 137 | $scope.puntoVenta, |
144 | $scope.comprobante | 138 | $scope.comprobante |
145 | ]) + '<br/>' + | 139 | ]) + '<br/>' + |
146 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + | 140 | 'Vendedor: ' + $scope.notaPedido.vendedor.NomVen + '<br/>' + |
147 | 'Total: ' + $filter('currency')($scope.getTotal()) | 141 | 'Total: ' + $filter('currency')($scope.getTotal()) |
148 | ); | 142 | ); |
149 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, | 143 | notaPedidoBusinessService.addArticulos($scope.articulosTabla, |
150 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); | 144 | data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); |
151 | 145 | ||
152 | if($scope.notaPedido.puntosDescarga) { | 146 | if($scope.notaPedido.puntosDescarga) { |
153 | notaPedidoBusinessService.addPuntosDescarga(data.data.id, | 147 | notaPedidoBusinessService.addPuntosDescarga(data.data.id, |
154 | $scope.notaPedido.puntosDescarga); | 148 | $scope.notaPedido.puntosDescarga); |
155 | } | 149 | } |
156 | 150 | ||
157 | var plazos = $scope.plazosPagos; | 151 | var plazos = $scope.plazosPagos; |
158 | var plazosACrear = []; | 152 | var plazosACrear = []; |
159 | plazos.forEach(function(plazo) { | 153 | plazos.forEach(function(plazo) { |
160 | plazosACrear.push({ | 154 | plazosACrear.push({ |
161 | idNotaPedido: data.data.id, | 155 | idNotaPedido: data.data.id, |
162 | dias: plazo.dias | 156 | dias: plazo.dias |
163 | }); | 157 | }); |
164 | }); | 158 | }); |
165 | if(plazosACrear.length){ | 159 | if(plazosACrear.length){ |
166 | crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); | 160 | crearNotaPedidoService.crearPlazosParaNotaPedido(plazosACrear); |
167 | } | 161 | } |
168 | 162 | ||
169 | notaPedidoBusinessService.addEstado(data.data.id, | 163 | notaPedidoBusinessService.addEstado(data.data.id, |
170 | $scope.notaPedido.vendedor.CodVen); | 164 | $scope.notaPedido.vendedor.CodVen); |
171 | 165 | ||
172 | focaModalService.alert('Nota pedido creada'); | 166 | focaModalService.alert('Nota pedido creada'); |
173 | $scope.saveLoading = false; | 167 | $scope.saveLoading = false; |
174 | $scope.$broadcast('cleanCabecera'); | 168 | $scope.$broadcast('cleanCabecera'); |
175 | $scope.$broadcast('addCabecera', { | 169 | $scope.$broadcast('addCabecera', { |
176 | label: 'Moneda:', | 170 | label: 'Moneda:', |
177 | valor: $scope.notaPedido.moneda.DETALLE | 171 | valor: $scope.notaPedido.moneda.DETALLE |
178 | }); | 172 | }); |
179 | $scope.$broadcast('addCabecera', { | 173 | $scope.$broadcast('addCabecera', { |
180 | label: 'Fecha cotizacion:', | 174 | label: 'Fecha cotizacion:', |
181 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | 175 | valor: $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
182 | }); | 176 | }); |
183 | $scope.$broadcast('addCabecera', { | 177 | $scope.$broadcast('addCabecera', { |
184 | label: 'Moneda:', | 178 | label: 'Moneda:', |
185 | valor: $scope.notaPedido.moneda.DETALLE | 179 | valor: $scope.notaPedido.moneda.DETALLE |
186 | }); | 180 | }); |
187 | $scope.$broadcast('addCabecera', { | 181 | $scope.$broadcast('addCabecera', { |
188 | label: 'Cotizacion:', | 182 | label: 'Cotizacion:', |
189 | valor: $filter('number')($scope.notaPedido.cotizacion.VENDEDOR, '2') | 183 | valor: $filter('number')($scope.notaPedido.cotizacion.VENDEDOR, '2') |
190 | }); | 184 | }); |
191 | crearNotaPedidoService.getNumeroNotaPedido().then( | 185 | crearNotaPedidoService.getNumeroNotaPedido().then( |
192 | function(res) { | 186 | function(res) { |
193 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 187 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
194 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 188 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
195 | }, | 189 | }, |
196 | function(err) { | 190 | function(err) { |
197 | focaModalService.alert( | 191 | focaModalService.alert( |
198 | 'La terminal no esta configurada correctamente'); | 192 | 'La terminal no esta configurada correctamente'); |
199 | console.info(err); | 193 | console.info(err); |
200 | } | 194 | } |
201 | ); | 195 | ); |
202 | $scope.notaPedido.vendedor = {}; | 196 | $scope.notaPedido.vendedor = {}; |
203 | $scope.notaPedido.cliente = {}; | 197 | $scope.notaPedido.cliente = {}; |
204 | $scope.notaPedido.proveedor = {}; | 198 | $scope.notaPedido.proveedor = {}; |
205 | $scope.notaPedido.domicilio = {}; | 199 | $scope.notaPedido.domicilio = {}; |
206 | $scope.notaPedido.flete = null; | 200 | $scope.notaPedido.flete = null; |
207 | $scope.notaPedido.fob = null; | 201 | $scope.notaPedido.fob = null; |
208 | $scope.notaPedido.bomba = null; | 202 | $scope.notaPedido.bomba = null; |
209 | $scope.notaPedido.kilometros = null; | 203 | $scope.notaPedido.kilometros = null; |
210 | $scope.articulosTabla = []; | 204 | $scope.articulosTabla = []; |
211 | }, | 205 | }, |
212 | function(error) { | 206 | function(error) { |
213 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 207 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
214 | $scope.saveLoading = false; | 208 | $scope.saveLoading = false; |
215 | console.info(error); | 209 | console.info(error); |
216 | } | 210 | } |
217 | ); | 211 | ); |
218 | }; | 212 | }; |
219 | 213 | ||
220 | $scope.seleccionarNotaPedido = function() { | 214 | $scope.seleccionarNotaPedido = function() { |
221 | var modalInstance = $uibModal.open( | 215 | var modalInstance = $uibModal.open( |
222 | { | 216 | { |
223 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 217 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
224 | templateUrl: 'foca-modal-nota-pedido.html', | 218 | templateUrl: 'foca-modal-nota-pedido.html', |
225 | controller: 'focaModalNotaPedidoController', | 219 | controller: 'focaModalNotaPedidoController', |
226 | size: 'lg', | 220 | size: 'lg', |
227 | resolve: {usadoPor: function() {return 'notaPedido';}} | 221 | resolve: {usadoPor: function() {return 'notaPedido';}} |
228 | } | 222 | } |
229 | ); | 223 | ); |
230 | modalInstance.result.then( | 224 | modalInstance.result.then( |
231 | function(notaPedido) { | 225 | function(notaPedido) { |
232 | $scope.now = new Date(notaPedido.fechaCarga); | 226 | $scope.now = new Date(notaPedido.fechaCarga); |
233 | //añado cabeceras | 227 | //añado cabeceras |
234 | $scope.notaPedido.id = notaPedido.id; | 228 | $scope.notaPedido.id = notaPedido.id; |
235 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 229 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
236 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 230 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
237 | var cabeceras = [ | 231 | var cabeceras = [ |
238 | { | 232 | { |
239 | label: 'Moneda:', | 233 | label: 'Moneda:', |
240 | valor: notaPedido.cotizacion.moneda.DETALLE | 234 | valor: notaPedido.cotizacion.moneda.DETALLE |
241 | }, | 235 | }, |
242 | { | 236 | { |
243 | label: 'Fecha cotizacion:', | 237 | label: 'Fecha cotizacion:', |
244 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 238 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
245 | 'dd/MM/yyyy') | 239 | 'dd/MM/yyyy') |
246 | }, | 240 | }, |
247 | { | 241 | { |
248 | label: 'Cotizacion:', | 242 | label: 'Cotizacion:', |
249 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 243 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
250 | '2') | 244 | '2') |
251 | }, | 245 | }, |
252 | { | 246 | { |
253 | label: 'Cliente:', | 247 | label: 'Cliente:', |
254 | valor: notaPedido.cliente.NOM | 248 | valor: notaPedido.cliente.NOM |
255 | }, | 249 | }, |
256 | { | 250 | { |
257 | label: 'Domicilio:', | 251 | label: 'Domicilio:', |
258 | valor: notaPedido.domicilioStamp | 252 | valor: notaPedido.domicilioStamp |
259 | }, | 253 | }, |
260 | { | 254 | { |
261 | label: 'Vendedor:', | 255 | label: 'Vendedor:', |
262 | valor: notaPedido.vendedor.NomVen | 256 | valor: notaPedido.vendedor.NomVen |
263 | }, | 257 | }, |
264 | { | 258 | { |
265 | label: 'Proveedor:', | 259 | label: 'Proveedor:', |
266 | valor: notaPedido.proveedor.NOM | 260 | valor: notaPedido.proveedor.NOM |
267 | }, | 261 | }, |
268 | { | 262 | { |
269 | label: 'Precios y condiciones:', | 263 | label: 'Precios y condiciones:', |
270 | valor: valorPrecioCondicion() + ' ' + | 264 | valor: valorPrecioCondicion() + ' ' + |
271 | notaPedidoBusinessService | 265 | notaPedidoBusinessService |
272 | .plazoToString(notaPedido.notaPedidoPlazo) | 266 | .plazoToString(notaPedido.notaPedidoPlazo) |
273 | }, | 267 | }, |
274 | { | 268 | { |
275 | label: 'Flete:', | 269 | label: 'Flete:', |
276 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 270 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
277 | notaPedido.flete === 1 ? 'Si' : 'No') | 271 | notaPedido.flete === 1 ? 'Si' : 'No') |
278 | } | 272 | } |
279 | ]; | 273 | ]; |
280 | 274 | ||
281 | function valorPrecioCondicion() { | 275 | function valorPrecioCondicion() { |
282 | if(notaPedido.idPrecioCondicion > 0) { | 276 | if(notaPedido.idPrecioCondicion > 0) { |
283 | return notaPedido.precioCondicion.nombre; | 277 | return notaPedido.precioCondicion.nombre; |
284 | } else { | 278 | } else { |
285 | return 'Ingreso Manual'; | 279 | return 'Ingreso Manual'; |
286 | } | 280 | } |
287 | } | 281 | } |
288 | 282 | ||
289 | if(notaPedido.flete === 1) { | 283 | if(notaPedido.flete === 1) { |
290 | var cabeceraBomba = { | 284 | var cabeceraBomba = { |
291 | label: 'Bomba:', | 285 | label: 'Bomba:', |
292 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 286 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
293 | }; | 287 | }; |
294 | if(notaPedido.kilometros) { | 288 | if(notaPedido.kilometros) { |
295 | var cabeceraKilometros = { | 289 | var cabeceraKilometros = { |
296 | label: 'Kilometros:', | 290 | label: 'Kilometros:', |
297 | valor: notaPedido.kilometros | 291 | valor: notaPedido.kilometros |
298 | }; | 292 | }; |
299 | cabeceras.push(cabeceraKilometros); | 293 | cabeceras.push(cabeceraKilometros); |
300 | } | 294 | } |
301 | cabeceras.push(cabeceraBomba); | 295 | cabeceras.push(cabeceraBomba); |
302 | } | 296 | } |
303 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 297 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
304 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, | 298 | notaPedidoBusinessService.calcularArticulos($scope.articulosTabla, |
305 | notaPedido.cotizacion.VENDEDOR); | 299 | notaPedido.cotizacion.VENDEDOR); |
306 | if(notaPedido.idPrecioCondicion > 0) { | 300 | if(notaPedido.idPrecioCondicion > 0) { |
307 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 301 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
308 | } else { | 302 | } else { |
309 | $scope.idLista = -1; | 303 | $scope.idLista = -1; |
310 | } | 304 | } |
311 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); | 305 | $scope.puntoVenta = rellenar(notaPedido.sucursal, 4); |
312 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); | 306 | $scope.comprobante = rellenar(notaPedido.numeroNotaPedido, 8); |
313 | $scope.notaPedido = notaPedido; | 307 | $scope.notaPedido = notaPedido; |
314 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; | 308 | $scope.notaPedido.moneda = notaPedido.cotizacion.moneda; |
315 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; | 309 | $scope.plazosPagos = notaPedido.notaPedidoPlazo; |
316 | $scope.notaPedido.puntosDescarga = | 310 | $scope.notaPedido.puntosDescarga = |
317 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga); | 311 | formatearPuntosDescarga(notaPedido.notaPedidoPuntoDescarga); |
318 | addArrayCabecera(cabeceras); | 312 | addArrayCabecera(cabeceras); |
319 | 313 | ||
320 | }, function() { | 314 | }, function() { |
321 | // funcion ejecutada cuando se cancela el modal | 315 | // funcion ejecutada cuando se cancela el modal |
322 | } | 316 | } |
323 | ); | 317 | ); |
324 | }; | 318 | }; |
325 | 319 | ||
326 | $scope.seleccionarProductos = function() { | 320 | $scope.seleccionarProductos = function() { |
327 | if ($scope.idLista === undefined) { | 321 | if ($scope.idLista === undefined) { |
328 | focaModalService.alert( | 322 | focaModalService.alert( |
329 | 'Primero seleccione una lista de precio y condicion'); | 323 | 'Primero seleccione una lista de precio y condicion'); |
330 | return; | 324 | return; |
331 | } | 325 | } |
332 | var modalInstance = $uibModal.open( | 326 | var modalInstance = $uibModal.open( |
333 | { | 327 | { |
334 | ariaLabelledBy: 'Busqueda de Productos', | 328 | ariaLabelledBy: 'Busqueda de Productos', |
335 | templateUrl: 'modal-busqueda-productos.html', | 329 | templateUrl: 'modal-busqueda-productos.html', |
336 | controller: 'modalBusquedaProductosCtrl', | 330 | controller: 'modalBusquedaProductosCtrl', |
337 | resolve: { | 331 | resolve: { |
338 | parametroProducto: { | 332 | parametroProducto: { |
339 | idLista: $scope.idLista, | 333 | idLista: $scope.idLista, |
340 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, | 334 | cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, |
341 | simbolo: $scope.notaPedido.moneda.SIMBOLO | 335 | simbolo: $scope.notaPedido.moneda.SIMBOLO |
342 | } | 336 | } |
343 | }, | 337 | }, |
344 | size: 'lg' | 338 | size: 'lg' |
345 | } | 339 | } |
346 | ); | 340 | ); |
347 | modalInstance.result.then( | 341 | modalInstance.result.then( |
348 | function(producto) { | 342 | function(producto) { |
349 | var newArt = | 343 | var newArt = |
350 | { | 344 | { |
351 | id: 0, | 345 | id: 0, |
352 | codigo: producto.codigo, | 346 | codigo: producto.codigo, |
353 | sector: producto.sector, | 347 | sector: producto.sector, |
354 | sectorCodigo: producto.sector + '-' + producto.codigo, | 348 | sectorCodigo: producto.sector + '-' + producto.codigo, |
355 | descripcion: producto.descripcion, | 349 | descripcion: producto.descripcion, |
356 | item: $scope.articulosTabla.length + 1, | 350 | item: $scope.articulosTabla.length + 1, |
357 | nombre: producto.descripcion, | 351 | nombre: producto.descripcion, |
358 | precio: parseFloat(producto.precio.toFixed(4)), | 352 | precio: parseFloat(producto.precio.toFixed(4)), |
359 | costoUnitario: producto.costo, | 353 | costoUnitario: producto.costo, |
360 | editCantidad: false, | 354 | editCantidad: false, |
361 | editPrecio: false, | 355 | editPrecio: false, |
362 | rubro: producto.CodRub, | 356 | rubro: producto.CodRub, |
363 | exentoUnitario: producto.precio, | 357 | exentoUnitario: producto.precio, |
364 | ivaUnitario: producto.IMPIVA, | 358 | ivaUnitario: producto.IMPIVA, |
365 | impuestoInternoUnitario: producto.ImpInt, | 359 | impuestoInternoUnitario: producto.ImpInt, |
366 | impuestoInterno1Unitario: producto.ImpInt2, | 360 | impuestoInterno1Unitario: producto.ImpInt2, |
367 | impuestoInterno2Unitario: producto.ImpInt3, | 361 | impuestoInterno2Unitario: producto.ImpInt3, |
368 | precioLista: producto.precio, | 362 | precioLista: producto.precio, |
369 | combustible: 1, | 363 | combustible: 1, |
370 | facturado: 0 | 364 | facturado: 0 |
371 | }; | 365 | }; |
372 | $scope.articuloACargar = newArt; | 366 | $scope.articuloACargar = newArt; |
373 | $scope.cargando = false; | 367 | $scope.cargando = false; |
374 | }, function() { | 368 | }, function() { |
375 | // funcion ejecutada cuando se cancela el modal | 369 | // funcion ejecutada cuando se cancela el modal |
376 | } | 370 | } |
377 | ); | 371 | ); |
378 | }; | 372 | }; |
379 | 373 | ||
380 | $scope.seleccionarPuntosDeDescarga = function() { | 374 | $scope.seleccionarPuntosDeDescarga = function() { |
381 | if(!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) { | 375 | if(!$scope.notaPedido.cliente.COD || !$scope.notaPedido.domicilio.id) { |
382 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 376 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
383 | return; | 377 | return; |
384 | }else { | 378 | }else { |
385 | var modalInstance = $uibModal.open( | 379 | var modalInstance = $uibModal.open( |
386 | { | 380 | { |
387 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 381 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
388 | templateUrl: 'modal-punto-descarga.html', | 382 | templateUrl: 'modal-punto-descarga.html', |
389 | controller: 'focaModalPuntoDescargaController', | 383 | controller: 'focaModalPuntoDescargaController', |
390 | size: 'lg', | 384 | size: 'lg', |
391 | resolve: { | 385 | resolve: { |
392 | filters: { | 386 | filters: { |
393 | /*TODO: al traer nota de pedido ya creada | 387 | /*TODO: al traer nota de pedido ya creada |
394 | obtener idDomicilio correctamente*/ | 388 | obtener idDomicilio correctamente*/ |
395 | idDomicilio: $scope.notaPedido.domicilio.id, | 389 | idDomicilio: $scope.notaPedido.domicilio.id, |
396 | idCliente: $scope.notaPedido.cliente.COD, | 390 | idCliente: $scope.notaPedido.cliente.COD, |
397 | articulos: $scope.articulosTabla, | 391 | articulos: $scope.articulosTabla, |
398 | puntosDescarga: $scope.notaPedido.puntosDescarga | 392 | puntosDescarga: $scope.notaPedido.puntosDescarga |
399 | } | 393 | } |
400 | } | 394 | } |
401 | } | 395 | } |
402 | ); | 396 | ); |
403 | modalInstance.result.then( | 397 | modalInstance.result.then( |
404 | function(puntosDescarga) { | 398 | function(puntosDescarga) { |
405 | $scope.notaPedido.puntosDescarga = puntosDescarga; | 399 | $scope.notaPedido.puntosDescarga = puntosDescarga; |
406 | }, function() { | 400 | }, function() { |
407 | 401 | ||
408 | } | 402 | } |
409 | ); | 403 | ); |
410 | } | 404 | } |
411 | }; | 405 | }; |
412 | 406 | ||
413 | $scope.seleccionarVendedor = function() { | 407 | $scope.seleccionarVendedor = function() { |
414 | if(validarNotaRemitada()) { | 408 | if(validarNotaRemitada()) { |
415 | var modalInstance = $uibModal.open( | 409 | var modalInstance = $uibModal.open( |
416 | { | 410 | { |
417 | ariaLabelledBy: 'Busqueda de Vendedores', | 411 | ariaLabelledBy: 'Busqueda de Vendedores', |
418 | templateUrl: 'modal-vendedores.html', | 412 | templateUrl: 'modal-vendedores.html', |
419 | controller: 'modalVendedoresCtrl', | 413 | controller: 'modalVendedoresCtrl', |
420 | size: 'lg' | 414 | size: 'lg' |
421 | } | 415 | } |
422 | ); | 416 | ); |
423 | modalInstance.result.then( | 417 | modalInstance.result.then( |
424 | function(vendedor) { | 418 | function(vendedor) { |
425 | $scope.$broadcast('addCabecera', { | 419 | $scope.$broadcast('addCabecera', { |
426 | label: 'Vendedor:', | 420 | label: 'Vendedor:', |
427 | valor: vendedor.NomVen | 421 | valor: vendedor.NomVen |
428 | }); | 422 | }); |
429 | $scope.notaPedido.vendedor = vendedor; | 423 | $scope.notaPedido.vendedor = vendedor; |
430 | }, function() { | 424 | }, function() { |
431 | 425 | ||
432 | } | 426 | } |
433 | ); | 427 | ); |
434 | } | 428 | } |
435 | }; | 429 | }; |
436 | 430 | ||
437 | $scope.seleccionarProveedor = function() { | 431 | $scope.seleccionarProveedor = function() { |
438 | if(validarNotaRemitada()) { | 432 | if(validarNotaRemitada()) { |
439 | var modalInstance = $uibModal.open( | 433 | var modalInstance = $uibModal.open( |
440 | { | 434 | { |
441 | ariaLabelledBy: 'Busqueda de Proveedor', | 435 | ariaLabelledBy: 'Busqueda de Proveedor', |
442 | templateUrl: 'modal-proveedor.html', | 436 | templateUrl: 'modal-proveedor.html', |
443 | controller: 'focaModalProveedorCtrl', | 437 | controller: 'focaModalProveedorCtrl', |
444 | size: 'lg', | 438 | size: 'lg', |
445 | resolve: { | 439 | resolve: { |
446 | transportista: function() { | 440 | transportista: function() { |
447 | return false; | 441 | return false; |
448 | } | 442 | } |
449 | } | 443 | } |
450 | } | 444 | } |
451 | ); | 445 | ); |
452 | modalInstance.result.then( | 446 | modalInstance.result.then( |
453 | function(proveedor) { | 447 | function(proveedor) { |
454 | $scope.notaPedido.proveedor = proveedor; | 448 | $scope.notaPedido.proveedor = proveedor; |
455 | $scope.$broadcast('addCabecera', { | 449 | $scope.$broadcast('addCabecera', { |
456 | label: 'Proveedor:', | 450 | label: 'Proveedor:', |
457 | valor: proveedor.NOM | 451 | valor: proveedor.NOM |
458 | }); | 452 | }); |
459 | }, function() { | 453 | }, function() { |
460 | 454 | ||
461 | } | 455 | } |
462 | ); | 456 | ); |
463 | } | 457 | } |
464 | }; | 458 | }; |
465 | 459 | ||
466 | $scope.seleccionarCliente = function() { | 460 | $scope.seleccionarCliente = function() { |
467 | if(validarNotaRemitada()) { | 461 | if(validarNotaRemitada()) { |
468 | var modalInstance = $uibModal.open( | 462 | var modalInstance = $uibModal.open( |
469 | { | 463 | { |
470 | ariaLabelledBy: 'Busqueda de Cliente', | 464 | ariaLabelledBy: 'Busqueda de Cliente', |
471 | templateUrl: 'foca-busqueda-cliente-modal.html', | 465 | templateUrl: 'foca-busqueda-cliente-modal.html', |
472 | controller: 'focaBusquedaClienteModalController', | 466 | controller: 'focaBusquedaClienteModalController', |
473 | size: 'lg' | 467 | size: 'lg' |
474 | } | 468 | } |
475 | ); | 469 | ); |
476 | modalInstance.result.then( | 470 | modalInstance.result.then( |
477 | function(cliente) { | 471 | function(cliente) { |
478 | $scope.abrirModalDomicilios(cliente); | 472 | $scope.abrirModalDomicilios(cliente); |
479 | }, function() { | 473 | }, function() {} |
480 | |||
481 | } | ||
482 | ); | 474 | ); |
483 | } | 475 | } |
484 | }; | 476 | }; |
485 | 477 | ||
486 | $scope.abrirModalDomicilios = function(cliente) { | 478 | $scope.abrirModalDomicilios = function(cliente) { |
487 | var modalInstanceDomicilio = $uibModal.open( | 479 | var modalInstanceDomicilio = $uibModal.open( |
488 | { | 480 | { |
489 | ariaLabelledBy: 'Busqueda de Domicilios', | 481 | ariaLabelledBy: 'Busqueda de Domicilios', |
490 | templateUrl: 'modal-domicilio.html', | 482 | templateUrl: 'modal-domicilio.html', |
491 | controller: 'focaModalDomicilioController', | 483 | controller: 'focaModalDomicilioController', |
492 | resolve: { | 484 | resolve: { |
493 | idCliente: function() { | 485 | idCliente: function() { |
494 | return cliente.cod; | 486 | return cliente.cod; |
495 | }, | 487 | }, |
496 | esNuevo: function() { return cliente.esNuevo; }, | 488 | esNuevo: function() { return cliente.esNuevo; }, |
497 | articulos: function() { | 489 | articulos: function() { |
498 | return $scope.articulosTabla; | 490 | return $scope.articulosTabla; |
499 | } | 491 | } |
500 | }, | 492 | }, |
501 | size: 'lg', | 493 | size: 'lg', |
502 | } | 494 | } |
503 | ); | 495 | ); |
504 | modalInstanceDomicilio.result.then( | 496 | modalInstanceDomicilio.result.then( |
505 | function(domicilio) { | 497 | function(domicilio) { |
506 | $scope.notaPedido.domicilio = domicilio; | 498 | $scope.notaPedido.domicilio = domicilio; |
507 | $scope.notaPedido.cliente = { | 499 | $scope.notaPedido.cliente = { |
508 | COD: cliente.cod, | 500 | COD: cliente.cod, |
509 | CUIT: cliente.cuit, | 501 | CUIT: cliente.cuit, |
510 | NOM: cliente.nom | 502 | NOM: cliente.nom |
511 | }; | 503 | }; |
512 | var domicilioStamp = | 504 | var domicilioStamp = |
513 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 505 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
514 | domicilio.Localidad + ', ' + domicilio.Provincia; | 506 | domicilio.Localidad + ', ' + domicilio.Provincia; |
515 | $scope.notaPedido.domicilioStamp = domicilioStamp; | 507 | $scope.notaPedido.domicilioStamp = domicilioStamp; |
516 | 508 | ||
517 | $scope.notaPedido.puntosDescarga = domicilio.puntosDescarga; | 509 | $scope.notaPedido.puntosDescarga = domicilio.puntosDescarga; |
518 | 510 | ||
519 | $scope.$broadcast('addCabecera', { | 511 | $scope.$broadcast('addCabecera', { |
520 | label: 'Cliente:', | 512 | label: 'Cliente:', |
521 | valor: cliente.nom | 513 | valor: cliente.nom |
522 | }); | 514 | }); |
523 | $scope.$broadcast('addCabecera', { | 515 | $scope.$broadcast('addCabecera', { |
524 | label: 'Domicilio:', | 516 | label: 'Domicilio:', |
525 | valor: domicilioStamp | 517 | valor: domicilioStamp |
526 | }); | 518 | }); |
519 | crearNotaPedidoService | ||
520 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | ||
521 | .then(function(res) { | ||
522 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); | ||
523 | }); | ||
527 | }, function() { | 524 | }, function() { |
528 | $scope.seleccionarCliente(); | 525 | $scope.seleccionarCliente(); |
529 | return; | 526 | return; |
530 | } | 527 | } |
531 | ); | 528 | ); |
532 | }; | 529 | }; |
533 | 530 | ||
534 | $scope.getTotal = function() { | 531 | $scope.getTotal = function() { |
535 | var total = 0; | 532 | var total = 0; |
536 | var arrayTempArticulos = $scope.articulosTabla; | 533 | var arrayTempArticulos = $scope.articulosTabla; |
537 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 534 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
538 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 535 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
539 | } | 536 | } |
540 | return parseFloat(total.toFixed(2)); | 537 | return parseFloat(total.toFixed(2)); |
541 | }; | 538 | }; |
542 | 539 | ||
543 | $scope.getSubTotal = function() { | 540 | $scope.getSubTotal = function() { |
544 | if($scope.articuloACargar) { | 541 | if($scope.articuloACargar) { |
545 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 542 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
546 | } | 543 | } |
547 | }; | 544 | }; |
548 | 545 | ||
549 | $scope.seleccionarPreciosYCondiciones = function() { | 546 | $scope.seleccionarPreciosYCondiciones = function() { |
550 | if(validarNotaRemitada()) { | 547 | if(validarNotaRemitada()) { |
551 | var modalInstance = $uibModal.open( | 548 | var modalInstance = $uibModal.open( |
552 | { | 549 | { |
553 | ariaLabelledBy: 'Busqueda de Precio Condición', | 550 | ariaLabelledBy: 'Busqueda de Precio Condición', |
554 | templateUrl: 'modal-precio-condicion.html', | 551 | templateUrl: 'modal-precio-condicion.html', |
555 | controller: 'focaModalPrecioCondicionController', | 552 | controller: 'focaModalPrecioCondicionController', |
556 | size: 'lg' | 553 | size: 'lg' |
557 | } | 554 | } |
558 | ); | 555 | ); |
559 | modalInstance.result.then( | 556 | modalInstance.result.then( |
560 | function(precioCondicion) { | 557 | function(precioCondicion) { |
561 | var cabecera = ''; | 558 | var cabecera = ''; |
562 | var plazosConcat = ''; | 559 | var plazosConcat = ''; |
563 | if(!Array.isArray(precioCondicion)) { | 560 | if(!Array.isArray(precioCondicion)) { |
564 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | 561 | $scope.notaPedido.idPrecioCondicion = precioCondicion.id; |
565 | $scope.plazosPagos = precioCondicion.plazoPago; | 562 | $scope.plazosPagos = precioCondicion.plazoPago; |
566 | $scope.idLista = precioCondicion.idListaPrecio; | 563 | $scope.idLista = precioCondicion.idListaPrecio; |
567 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 564 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
568 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 565 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
569 | } | 566 | } |
570 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 567 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
571 | } else { //Cuando se ingresan los plazos manualmente | 568 | } else { //Cuando se ingresan los plazos manualmente |
572 | $scope.notaPedido.idPrecioCondicion = 0; | 569 | $scope.notaPedido.idPrecioCondicion = 0; |
573 | //-1, el modal productos busca todos los productos | 570 | //-1, el modal productos busca todos los productos |
574 | $scope.idLista = -1; | 571 | $scope.idLista = -1; |
575 | $scope.plazosPagos = precioCondicion; | 572 | $scope.plazosPagos = precioCondicion; |
576 | for(var j = 0; j < precioCondicion.length; j++) { | 573 | for(var j = 0; j < precioCondicion.length; j++) { |
577 | plazosConcat += precioCondicion[j].dias + ' '; | 574 | plazosConcat += precioCondicion[j].dias + ' '; |
578 | } | 575 | } |
579 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 576 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
580 | } | 577 | } |
581 | $scope.articulosTabla = []; | 578 | $scope.articulosTabla = []; |
582 | $scope.$broadcast('addCabecera', { | 579 | $scope.$broadcast('addCabecera', { |
583 | label: 'Precios y condiciones:', | 580 | label: 'Precios y condiciones:', |
584 | valor: cabecera | 581 | valor: cabecera |
585 | }); | 582 | }); |
586 | }, function() { | 583 | }, function() { |
587 | 584 | ||
588 | } | 585 | } |
589 | ); | 586 | ); |
590 | } | 587 | } |
591 | }; | 588 | }; |
592 | 589 | ||
593 | $scope.seleccionarFlete = function() { | 590 | $scope.seleccionarFlete = function() { |
594 | if(validarNotaRemitada()) { | 591 | if(validarNotaRemitada()) { |
595 | var modalInstance = $uibModal.open( | 592 | var modalInstance = $uibModal.open( |
596 | { | 593 | { |
597 | ariaLabelledBy: 'Busqueda de Flete', | 594 | ariaLabelledBy: 'Busqueda de Flete', |
598 | templateUrl: 'modal-flete.html', | 595 | templateUrl: 'modal-flete.html', |
599 | controller: 'focaModalFleteController', | 596 | controller: 'focaModalFleteController', |
600 | size: 'lg', | 597 | size: 'lg', |
601 | resolve: { | 598 | resolve: { |
602 | parametrosFlete: | 599 | parametrosFlete: |
603 | function() { | 600 | function() { |
604 | return { | 601 | return { |
605 | flete: $scope.notaPedido.fob ? 'FOB' : | 602 | flete: $scope.notaPedido.fob ? 'FOB' : |
606 | ( $scope.notaPedido.flete ? '1' : | 603 | ( $scope.notaPedido.flete ? '1' : |
607 | ($scope.notaPedido.flete === undefined ? | 604 | ($scope.notaPedido.flete === undefined ? |
608 | null : '0')), | 605 | null : '0')), |
609 | bomba: $scope.notaPedido.bomba ? '1' : | 606 | bomba: $scope.notaPedido.bomba ? '1' : |
610 | ($scope.notaPedido.bomba === undefined ? | 607 | ($scope.notaPedido.bomba === undefined ? |
611 | null : '0'), | 608 | null : '0'), |
612 | kilometros: $scope.notaPedido.kilometros | 609 | kilometros: $scope.notaPedido.kilometros |
613 | }; | 610 | }; |
614 | } | 611 | } |
615 | } | 612 | } |
616 | } | 613 | } |
617 | ); | 614 | ); |
618 | modalInstance.result.then( | 615 | modalInstance.result.then( |
619 | function(datos) { | 616 | function(datos) { |
620 | $scope.notaPedido.flete = datos.flete; | 617 | $scope.notaPedido.flete = datos.flete; |
621 | $scope.notaPedido.fob = datos.FOB; | 618 | $scope.notaPedido.fob = datos.FOB; |
622 | $scope.notaPedido.bomba = datos.bomba; | 619 | $scope.notaPedido.bomba = datos.bomba; |
623 | $scope.notaPedido.kilometros = datos.kilometros; | 620 | $scope.notaPedido.kilometros = datos.kilometros; |
624 | $scope.$broadcast('addCabecera', { | 621 | $scope.$broadcast('addCabecera', { |
625 | label: 'Flete:', | 622 | label: 'Flete:', |
626 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') | 623 | valor: datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No') |
627 | }); | 624 | }); |
628 | if(datos.flete) { | 625 | if(datos.flete) { |
629 | $scope.$broadcast('addCabecera', { | 626 | $scope.$broadcast('addCabecera', { |
630 | label: 'Bomba:', | 627 | label: 'Bomba:', |
631 | valor: datos.bomba ? 'Si' : 'No' | 628 | valor: datos.bomba ? 'Si' : 'No' |
632 | }); | 629 | }); |
633 | $scope.$broadcast('addCabecera', { | 630 | $scope.$broadcast('addCabecera', { |
634 | label: 'Kilometros:', | 631 | label: 'Kilometros:', |
635 | valor: datos.kilometros | 632 | valor: datos.kilometros |
636 | }); | 633 | }); |
637 | } else { | 634 | } else { |
638 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 635 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
639 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 636 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
640 | $scope.notaPedido.bomba = false; | 637 | $scope.notaPedido.bomba = false; |
641 | $scope.notaPedido.kilometros = null; | 638 | $scope.notaPedido.kilometros = null; |
642 | } | 639 | } |
643 | }, function() { | 640 | }, function() { |
644 | 641 | ||
645 | } | 642 | } |
646 | ); | 643 | ); |
647 | } | 644 | } |
648 | }; | 645 | }; |
649 | 646 | ||
650 | $scope.seleccionarMoneda = function() { | 647 | $scope.seleccionarMoneda = function() { |
651 | if(validarNotaRemitada()) { | 648 | if(validarNotaRemitada()) { |
652 | var modalInstance = $uibModal.open( | 649 | var modalInstance = $uibModal.open( |
653 | { | 650 | { |
654 | ariaLabelledBy: 'Busqueda de Moneda', | 651 | ariaLabelledBy: 'Busqueda de Moneda', |
655 | templateUrl: 'modal-moneda.html', | 652 | templateUrl: 'modal-moneda.html', |
656 | controller: 'focaModalMonedaController', | 653 | controller: 'focaModalMonedaController', |
657 | size: 'lg' | 654 | size: 'lg' |
658 | } | 655 | } |
659 | ); | 656 | ); |
660 | modalInstance.result.then( | 657 | modalInstance.result.then( |
661 | function(moneda) { | 658 | function(moneda) { |
662 | $scope.abrirModalCotizacion(moneda); | 659 | $scope.abrirModalCotizacion(moneda); |
663 | }, function() { | 660 | }, function() { |
664 | 661 | ||
665 | } | 662 | } |
666 | ); | 663 | ); |
667 | } | 664 | } |
668 | }; | 665 | }; |
669 | 666 | ||
670 | $scope.abrirModalCotizacion = function(moneda) { | 667 | $scope.abrirModalCotizacion = function(moneda) { |
671 | var modalInstance = $uibModal.open( | 668 | var modalInstance = $uibModal.open( |
672 | { | 669 | { |
673 | ariaLabelledBy: 'Busqueda de Cotización', | 670 | ariaLabelledBy: 'Busqueda de Cotización', |
674 | templateUrl: 'modal-cotizacion.html', | 671 | templateUrl: 'modal-cotizacion.html', |
675 | controller: 'focaModalCotizacionController', | 672 | controller: 'focaModalCotizacionController', |
676 | size: 'lg', | 673 | size: 'lg', |
677 | resolve: {idMoneda: function() {return moneda.ID;}} | 674 | resolve: {idMoneda: function() {return moneda.ID;}} |
678 | } | 675 | } |
679 | ); | 676 | ); |
680 | modalInstance.result.then( | 677 | modalInstance.result.then( |
681 | function(cotizacion) { | 678 | function(cotizacion) { |
682 | var articulosTablaTemp = $scope.articulosTabla; | 679 | var articulosTablaTemp = $scope.articulosTabla; |
683 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 680 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
684 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 681 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
685 | $scope.notaPedido.cotizacion.VENDEDOR; | 682 | $scope.notaPedido.cotizacion.VENDEDOR; |
686 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 683 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
687 | cotizacion.VENDEDOR; | 684 | cotizacion.VENDEDOR; |
688 | } | 685 | } |
689 | $scope.articulosTabla = articulosTablaTemp; | 686 | $scope.articulosTabla = articulosTablaTemp; |
690 | $scope.notaPedido.moneda = moneda; | 687 | $scope.notaPedido.moneda = moneda; |
691 | $scope.notaPedido.cotizacion = cotizacion; | 688 | $scope.notaPedido.cotizacion = cotizacion; |
692 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 689 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
693 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 690 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
694 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 691 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
695 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 692 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
696 | }else { | 693 | }else { |
697 | $scope.$broadcast('addCabecera', { | 694 | $scope.$broadcast('addCabecera', { |
698 | label: 'Moneda:', | 695 | label: 'Moneda:', |
699 | valor: moneda.DETALLE | 696 | valor: moneda.DETALLE |
700 | }); | 697 | }); |
701 | $scope.$broadcast('addCabecera', { | 698 | $scope.$broadcast('addCabecera', { |
702 | label: 'Fecha cotizacion:', | 699 | label: 'Fecha cotizacion:', |
703 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 700 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
704 | }); | 701 | }); |
705 | $scope.$broadcast('addCabecera', { | 702 | $scope.$broadcast('addCabecera', { |
706 | label: 'Cotizacion:', | 703 | label: 'Cotizacion:', |
707 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 704 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
708 | }); | 705 | }); |
709 | } | 706 | } |
710 | }, function() { | 707 | }, function() { |
711 | 708 | ||
712 | } | 709 | } |
713 | ); | 710 | ); |
714 | }; | 711 | }; |
715 | 712 | ||
716 | $scope.agregarATabla = function(key) { | 713 | $scope.agregarATabla = function(key) { |
717 | if(key === 13) { | 714 | if(key === 13) { |
718 | if($scope.articuloACargar.cantidad === undefined || | 715 | if($scope.articuloACargar.cantidad === undefined || |
719 | $scope.articuloACargar.cantidad === 0 || | 716 | $scope.articuloACargar.cantidad === 0 || |
720 | $scope.articuloACargar.cantidad === null ) { | 717 | $scope.articuloACargar.cantidad === null ) { |
721 | focaModalService.alert('El valor debe ser al menos 1'); | 718 | focaModalService.alert('El valor debe ser al menos 1'); |
722 | return; | 719 | return; |
723 | } | 720 | } |
724 | delete $scope.articuloACargar.sectorCodigo; | 721 | delete $scope.articuloACargar.sectorCodigo; |
725 | $scope.articulosTabla.push($scope.articuloACargar); | 722 | $scope.articulosTabla.push($scope.articuloACargar); |
726 | $scope.cargando = true; | 723 | $scope.cargando = true; |
727 | } | 724 | } |
728 | }; | 725 | }; |
729 | 726 | ||
730 | $scope.quitarArticulo = function(key) { | 727 | $scope.quitarArticulo = function(key) { |
731 | $scope.articulosTabla.splice(key, 1); | 728 | $scope.articulosTabla.splice(key, 1); |
732 | }; | 729 | }; |
733 | 730 | ||
734 | $scope.editarArticulo = function(key, articulo) { | 731 | $scope.editarArticulo = function(key, articulo) { |
735 | if(key === 13) { | 732 | if(key === 13) { |
736 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 733 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
737 | articulo.cantidad === undefined) { | 734 | articulo.cantidad === undefined) { |
738 | focaModalService.alert('El valor debe ser al menos 1'); | 735 | focaModalService.alert('El valor debe ser al menos 1'); |
739 | return; | 736 | return; |
740 | } | 737 | } |
741 | articulo.editCantidad = false; | 738 | articulo.editCantidad = false; |
742 | articulo.editPrecio = false; | 739 | articulo.editPrecio = false; |
743 | } | 740 | } |
744 | }; | 741 | }; |
745 | 742 | ||
746 | $scope.cambioEdit = function(articulo, propiedad) { | 743 | $scope.cambioEdit = function(articulo, propiedad) { |
747 | if(propiedad === 'cantidad') { | 744 | if(propiedad === 'cantidad') { |
748 | articulo.editCantidad = true; | 745 | articulo.editCantidad = true; |
749 | } else if(propiedad === 'precio') { | 746 | } else if(propiedad === 'precio') { |
750 | articulo.editPrecio = true; | 747 | articulo.editPrecio = true; |
751 | } | 748 | } |
752 | }; | 749 | }; |
753 | 750 | ||
754 | $scope.resetFilter = function() { | 751 | $scope.resetFilter = function() { |
755 | $scope.articuloACargar = {}; | 752 | $scope.articuloACargar = {}; |
756 | $scope.cargando = true; | 753 | $scope.cargando = true; |
757 | }; | 754 | }; |
758 | //Recibe aviso si el teclado está en uso | 755 | //Recibe aviso si el teclado está en uso |
759 | $rootScope.$on('usarTeclado', function(event, data) { | 756 | $rootScope.$on('usarTeclado', function(event, data) { |
760 | if(data) { | 757 | if(data) { |
761 | $scope.mostrarTeclado = true; | 758 | $scope.mostrarTeclado = true; |
762 | return; | 759 | return; |
763 | } | 760 | } |
764 | $scope.mostrarTeclado = false; | 761 | $scope.mostrarTeclado = false; |
765 | }); | 762 | }); |
766 | 763 | ||
767 | $scope.selectFocus = function($event) { | 764 | $scope.selectFocus = function($event) { |
768 | // Si el teclado esta en uso no selecciona el valor | 765 | // Si el teclado esta en uso no selecciona el valor |
769 | if($scope.mostrarTeclado) { | 766 | if($scope.mostrarTeclado) { |
770 | return; | 767 | return; |
771 | } | 768 | } |
772 | $event.target.select(); | 769 | $event.target.select(); |
773 | }; | 770 | }; |
774 | 771 | ||
775 | $scope.salir = function() { | 772 | $scope.salir = function() { |
776 | $location.path('/'); | 773 | $location.path('/'); |
777 | }; | 774 | }; |
778 | 775 | ||
779 | $scope.parsearATexto = function(articulo) { | 776 | $scope.parsearATexto = function(articulo) { |
780 | articulo.cantidad = parseFloat(articulo.cantidad); | 777 | articulo.cantidad = parseFloat(articulo.cantidad); |
781 | articulo.precio = parseFloat(articulo.precio); | 778 | articulo.precio = parseFloat(articulo.precio); |
782 | }; | 779 | }; |
783 | 780 | ||
784 | function addArrayCabecera(array) { | 781 | function addArrayCabecera(array) { |
785 | for(var i = 0; i < array.length; i++) { | 782 | for(var i = 0; i < array.length; i++) { |
786 | $scope.$broadcast('addCabecera', { | 783 | $scope.$broadcast('addCabecera', { |
787 | label: array[i].label, | 784 | label: array[i].label, |
788 | valor: array[i].valor | 785 | valor: array[i].valor |
789 | }); | 786 | }); |
790 | } | 787 | } |
791 | } | 788 | } |
792 | 789 | ||
793 | function rellenar(relleno, longitud) { | 790 | function rellenar(relleno, longitud) { |
794 | relleno = '' + relleno; | 791 | relleno = '' + relleno; |
795 | while (relleno.length < longitud) { | 792 | while (relleno.length < longitud) { |
796 | relleno = '0' + relleno; | 793 | relleno = '0' + relleno; |
797 | } | 794 | } |
798 | 795 | ||
799 | return relleno; | 796 | return relleno; |
800 | } | 797 | } |
801 | 798 | ||
802 | function validarNotaRemitada() { | 799 | function validarNotaRemitada() { |
803 | if(!$scope.notaPedido.idRemito) { | 800 | if(!$scope.notaPedido.idRemito) { |
804 | return true; | 801 | return true; |
805 | }else{ | 802 | }else{ |
806 | focaModalService.alert('No se puede editar una nota de pedido remitada'); | 803 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
807 | return false; | 804 | return false; |
808 | } | 805 | } |
809 | } | 806 | } |
810 | function formatearPuntosDescarga(puntosDescarga) { | 807 | function formatearPuntosDescarga(puntosDescarga) { |
811 | var result = []; | 808 | var result = []; |
812 | 809 | ||
813 | puntosDescarga.forEach(function(el) { | 810 | puntosDescarga.forEach(function(el) { |
814 | var puntoDescarga = result.filter(function(resultPunto) { | 811 | var puntoDescarga = result.filter(function(resultPunto) { |
815 | return resultPunto.id == el.idPuntoDescarga; | 812 | return resultPunto.id == el.idPuntoDescarga; |
816 | }); | 813 | }); |
817 | 814 | ||
818 | if(puntoDescarga.length) { | 815 | if(puntoDescarga.length) { |
819 | puntoDescarga[0].articulosAgregados.push({ | 816 | puntoDescarga[0].articulosAgregados.push({ |
820 | cantidad: el.cantidad, | 817 | cantidad: el.cantidad, |
821 | descripcion: el.producto.descripcion, | 818 | descripcion: el.producto.descripcion, |
822 | id: el.producto.id | 819 | id: el.producto.id |
823 | }); | 820 | }); |
824 | }else { | 821 | }else { |
825 | result.push({ | 822 | result.push({ |
826 | id: el.puntoDescarga.id, | 823 | id: el.puntoDescarga.id, |
827 | id_cliente: el.puntoDescarga.id_cliente, | 824 | id_cliente: el.puntoDescarga.id_cliente, |
828 | id_da_config_0: el.puntoDescarga.id_da_config_0, | 825 | id_da_config_0: el.puntoDescarga.id_da_config_0, |
829 | latitud: el.puntoDescarga.latitud, | 826 | latitud: el.puntoDescarga.latitud, |
830 | longitud: el.puntoDescarga.longitud, | 827 | longitud: el.puntoDescarga.longitud, |
831 | descripcion: el.puntoDescarga.descripcion, | 828 | descripcion: el.puntoDescarga.descripcion, |
832 | articulosAgregados: [ | 829 | articulosAgregados: [ |
833 | { | 830 | { |
834 | cantidad: el.cantidad, | 831 | cantidad: el.cantidad, |
835 | descripcion: el.producto.descripcion, | 832 | descripcion: el.producto.descripcion, |
836 | id: el.producto.id | 833 | id: el.producto.id |
837 | } | 834 | } |
838 | ] | 835 | ] |
839 | }); | 836 | }); |
840 | } | 837 | } |
841 | }); | 838 | }); |
842 | return result; | 839 | return result; |
843 | } | 840 | } |
844 | 841 | ||
845 | function salir() { | 842 | function salir() { |
846 | var notaPedido = { | 843 | var notaPedido = { |
847 | id: 0, | 844 | id: 0, |
848 | vendedor: {}, | 845 | vendedor: {}, |
849 | cliente: {}, | 846 | cliente: {}, |
850 | proveedor: {}, | 847 | proveedor: {}, |
851 | domicilio: {dom: ''}, | 848 | domicilio: {dom: ''}, |
852 | moneda: $scope.notaPedido.moneda, | 849 | moneda: $scope.notaPedido.moneda, |
853 | cotizacion: $scope.notaPedido.cotizacion | 850 | cotizacion: $scope.notaPedido.cotizacion |
854 | }; | 851 | }; |
855 | if(JSON.stringify($scope.notaPedido) !== JSON.stringify(notaPedido)) { | 852 | if(JSON.stringify($scope.notaPedido) !== JSON.stringify(notaPedido)) { |
856 | focaModalService | 853 | focaModalService |
857 | .confirm('¿Esta seguro de que desea salir? ' + | 854 | .confirm('¿Esta seguro de que desea salir? ' + |
858 | 'Se perderán todos los datos cargados.') | 855 | 'Se perderán todos los datos cargados.') |
859 | .then(function(data) { | 856 | .then(function(data) { |
860 | if(data) $location.path('/'); | 857 | if(data) $location.path('/'); |
861 | }); | 858 | }); |
862 | }else { | 859 | }else { |
863 | $location.path('/'); | 860 | $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 |