Commit c278dce2800454e974a71caeabacec5f56ebd3e7
1 parent
7b7a5ca41c
Exists in
master
and in
1 other branch
parametros, botonera checked
Showing
2 changed files
with
63 additions
and
38 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', |
4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', |
5 | '$localStorage', | 5 | '$localStorage', |
6 | function( | 6 | function( |
7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, |
8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) | 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) |
9 | { | 9 | { |
10 | config(); | 10 | config(); |
11 | 11 | ||
12 | function config() { | 12 | function config() { |
13 | $scope.tmpCantidad = Number; | 13 | $scope.tmpCantidad = Number; |
14 | $scope.tmpPrecio = Number; | 14 | $scope.tmpPrecio = Number; |
15 | $scope.botonera = crearRemitoService.getBotonera(); | 15 | $scope.botonera = crearRemitoService.getBotonera(); |
16 | $scope.isNumber = angular.isNumber; | 16 | $scope.isNumber = angular.isNumber; |
17 | $scope.datepickerAbierto = false; | 17 | $scope.datepickerAbierto = false; |
18 | $scope.show = false; | 18 | $scope.show = false; |
19 | $scope.cargando = true; | 19 | $scope.cargando = true; |
20 | $scope.now = new Date(); | 20 | $scope.now = new Date(); |
21 | $scope.puntoVenta = rellenar(0, 4); | 21 | $scope.puntoVenta = rellenar(0, 4); |
22 | $scope.comprobante = rellenar(0, 8); | 22 | $scope.comprobante = rellenar(0, 8); |
23 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
24 | maxDate: new Date(), | 24 | maxDate: new Date(), |
25 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
26 | }; | 26 | }; |
27 | 27 | ||
28 | var monedaPorDefecto; | ||
29 | var proveedorPorDefecto; | ||
30 | var promiseMoneda = crearRemitoService.getCotizacionByIdMoneda(1); | ||
31 | var promiseProveedor = crearRemitoService.getProveedorById(98); | ||
32 | 28 | ||
33 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 29 | crearRemitoService.getParametros().then(function(res) { |
34 | //Trabajo con el proveedo YPF, por eso uso siempre la primera | 30 | var parametros = JSON.parse(res.data[0].jsonText); |
35 | 31 | if ($localStorage.remito) { | |
36 | Promise.all([promiseMoneda, promiseProveedor]).then(function(res) { | 32 | $timeout(function() { getLSRemito();} ); |
37 | 33 | } else { | |
38 | monedaPorDefecto = res[0].data[0]; | 34 | for (var property in parametros) { |
39 | proveedorPorDefecto = res[1].data[0]; | 35 | $scope.remito[property] = parametros[property]; |
40 | 36 | $scope.inicial[property] = parametros[property]; | |
41 | $scope.remito.cotizacion = Object.assign( | 37 | } |
42 | {moneda: monedaPorDefecto}, | 38 | setearRemito($scope.remito); |
43 | monedaPorDefecto.cotizaciones[0] | 39 | } |
44 | ); | ||
45 | $scope.inicial.cotizacion = $scope.remito.cotizacion; | ||
46 | |||
47 | |||
48 | $scope.remito.proveedor = Object.assign( | ||
49 | {proveedor: proveedorPorDefecto} | ||
50 | ); | ||
51 | $scope.inicial.proveedor = $scope.remito.proveedor; | ||
52 | |||
53 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); | ||
54 | $scope.proveedor = angular.copy($scope.remito.proveedor); | ||
55 | |||
56 | $scope.remito.flete = false; | ||
57 | $scope.remito.fob = false; | ||
58 | $scope.remito.bomba = false; | ||
59 | |||
60 | $scope.inicial.flete = false; | ||
61 | $scope.inicial.fob = false; | ||
62 | $scope.inicial.bomba = false; | ||
63 | |||
64 | $timeout(function() { getLSRemito(); }); | ||
65 | }); | 40 | }); |
41 | |||
66 | //SETEO BOTONERA LATERAL | 42 | //SETEO BOTONERA LATERAL |
67 | $timeout(function() { | 43 | $timeout(function() { |
68 | focaBotoneraLateralService.showSalir(false); | 44 | focaBotoneraLateralService.showSalir(false); |
69 | focaBotoneraLateralService.showPausar(true); | 45 | focaBotoneraLateralService.showPausar(true); |
70 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 46 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); |
71 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 47 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
72 | }); | 48 | }); |
73 | 49 | ||
74 | init(); | 50 | init(); |
75 | 51 | ||
76 | } | 52 | } |
77 | 53 | ||
78 | function init() { | 54 | function init() { |
79 | $scope.$broadcast('cleanCabecera'); | 55 | $scope.$broadcast('cleanCabecera'); |
80 | 56 | ||
81 | $scope.remito = { | 57 | $scope.remito = { |
82 | id: 0, | 58 | id: 0, |
83 | estado: 0, | 59 | estado: 0, |
84 | vendedor: {}, | 60 | vendedor: {}, |
85 | cliente: {}, | 61 | cliente: {}, |
86 | proveedor: {}, | 62 | proveedor: {}, |
87 | domicilio: {dom: ''}, | 63 | domicilio: {dom: ''}, |
88 | moneda: {}, | 64 | moneda: {}, |
89 | cotizacion: $scope.cotizacionPorDefecto || {}, | 65 | cotizacion: $scope.cotizacionPorDefecto || {}, |
90 | articulosRemito: [] | 66 | articulosRemito: [] |
91 | }; | 67 | }; |
92 | 68 | ||
93 | $scope.notaPedido = { | 69 | $scope.notaPedido = { |
94 | id: 0 | 70 | id: 0 |
95 | }; | 71 | }; |
96 | 72 | ||
97 | $scope.remito.articulosRemito = []; | 73 | $scope.remito.articulosRemito = []; |
98 | $scope.idLista = undefined; | 74 | $scope.idLista = undefined; |
99 | 75 | ||
100 | crearRemitoService.getNumeroRemito().then( | 76 | crearRemitoService.getNumeroRemito().then( |
101 | function(res) { | 77 | function(res) { |
102 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 78 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
103 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 79 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
104 | }, | 80 | }, |
105 | function(err) { | 81 | function(err) { |
106 | focaModalService.alert('La terminal no esta configurada correctamente'); | 82 | focaModalService.alert('La terminal no esta configurada correctamente'); |
107 | console.info(err); | 83 | console.info(err); |
108 | } | 84 | } |
109 | ); | 85 | ); |
110 | 86 | ||
111 | $scope.inicial = angular.copy($scope.remito); | 87 | $scope.inicial = angular.copy($scope.remito); |
112 | } | 88 | } |
113 | 89 | ||
114 | $scope.$watch('remito', function(newValue) { | 90 | $scope.$watch('remito', function(newValue) { |
115 | focaBotoneraLateralService.setPausarData({ | 91 | focaBotoneraLateralService.setPausarData({ |
116 | label: 'remito', | 92 | label: 'remito', |
117 | val: newValue | 93 | val: newValue |
118 | }); | 94 | }); |
119 | }, true); | 95 | }, true); |
120 | 96 | ||
121 | $scope.seleccionarNotaPedido = function() { | 97 | $scope.seleccionarNotaPedido = function() { |
122 | if (varlidarRemitoFacturado()) { | 98 | if (varlidarRemitoFacturado()) { |
123 | var modalInstance = $uibModal.open( | 99 | var modalInstance = $uibModal.open( |
124 | { | 100 | { |
125 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 101 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
126 | templateUrl: 'foca-modal-nota-pedido.html', | 102 | templateUrl: 'foca-modal-nota-pedido.html', |
127 | controller: 'focaModalNotaPedidoController', | 103 | controller: 'focaModalNotaPedidoController', |
128 | size: 'lg', | 104 | size: 'lg', |
129 | resolve: { | 105 | resolve: { |
130 | usadoPor: function() { return 'remito'; }, | 106 | usadoPor: function() { return 'remito'; }, |
131 | idVendedor: function() { return null; } | 107 | idVendedor: function() { return null; } |
132 | } | 108 | } |
133 | } | 109 | } |
134 | ); | 110 | ); |
135 | modalInstance.result.then( | 111 | modalInstance.result.then( |
136 | function(notaPedido) { | 112 | function(notaPedido) { |
137 | //añado cabeceras | 113 | //añado cabeceras |
138 | $scope.notaPedido.id = notaPedido.id; | 114 | $scope.notaPedido.id = notaPedido.id; |
139 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 115 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
140 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 116 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
141 | var puntosDescarga = []; | 117 | var puntosDescarga = []; |
142 | notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedido) { | 118 | notaPedido.notaPedidoPuntoDescarga.forEach(function(notaPedido) { |
143 | puntosDescarga.push(notaPedido.puntoDescarga); | 119 | puntosDescarga.push(notaPedido.puntoDescarga); |
144 | }); | 120 | }); |
145 | var cabeceras = [ | 121 | var cabeceras = [ |
146 | { | 122 | { |
147 | label: 'Moneda:', | 123 | label: 'Moneda:', |
148 | valor: notaPedido.cotizacion.moneda.DETALLE | 124 | valor: notaPedido.cotizacion.moneda.DETALLE |
149 | }, | 125 | }, |
150 | { | 126 | { |
151 | label: 'Fecha cotizacion:', | 127 | label: 'Fecha cotizacion:', |
152 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 128 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
153 | 'dd/MM/yyyy') | 129 | 'dd/MM/yyyy') |
154 | }, | 130 | }, |
155 | { | 131 | { |
156 | label: 'Cotizacion:', | 132 | label: 'Cotizacion:', |
157 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 133 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
158 | '2') | 134 | '2') |
159 | }, | 135 | }, |
160 | { | 136 | { |
161 | label: 'Cliente:', | 137 | label: 'Cliente:', |
162 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 138 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + |
163 | ' - ' + notaPedido.cliente.NOM | 139 | ' - ' + notaPedido.cliente.NOM |
164 | }, | 140 | }, |
165 | { | 141 | { |
166 | label: 'Domicilio:', | 142 | label: 'Domicilio:', |
167 | valor: notaPedido.domicilioStamp | 143 | valor: notaPedido.domicilioStamp |
168 | }, | 144 | }, |
169 | { | 145 | { |
170 | label: 'Vendedor:', | 146 | label: 'Vendedor:', |
171 | valor: $filter('rellenarDigitos')( | 147 | valor: $filter('rellenarDigitos')( |
172 | notaPedido.vendedor.NUM, 3 | 148 | notaPedido.vendedor.NUM, 3 |
173 | ) + ' - ' + notaPedido.vendedor.NOM | 149 | ) + ' - ' + notaPedido.vendedor.NOM |
174 | }, | 150 | }, |
175 | { | 151 | { |
176 | label: 'Proveedor:', | 152 | label: 'Proveedor:', |
177 | valor: $filter('rellenarDigitos') | 153 | valor: $filter('rellenarDigitos') |
178 | (notaPedido.proveedor.COD, 5) + ' - ' + | 154 | (notaPedido.proveedor.COD, 5) + ' - ' + |
179 | notaPedido.proveedor.NOM | 155 | notaPedido.proveedor.NOM |
180 | }, | 156 | }, |
181 | { | 157 | { |
182 | label: 'Precio condicion:', | 158 | label: 'Precio condicion:', |
183 | valor: valorPrecioCondicion() + ' ' + | 159 | valor: valorPrecioCondicion() + ' ' + |
184 | remitoBusinessService | 160 | remitoBusinessService |
185 | .plazoToString(notaPedido.notaPedidoPlazo) | 161 | .plazoToString(notaPedido.notaPedidoPlazo) |
186 | }, | 162 | }, |
187 | { | 163 | { |
188 | label: 'Flete:', | 164 | label: 'Flete:', |
189 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 165 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
190 | notaPedido.flete === 1 ? 'Si' : 'No') | 166 | notaPedido.flete === 1 ? 'Si' : 'No') |
191 | }, | 167 | }, |
192 | { | 168 | { |
193 | label: 'Puntos de descarga: ', | 169 | label: 'Puntos de descarga: ', |
194 | valor: $filter('rellenarDigitos')( | 170 | valor: $filter('rellenarDigitos')( |
195 | getCabeceraPuntoDescarga(puntosDescarga)) | 171 | getCabeceraPuntoDescarga(puntosDescarga)) |
196 | } | 172 | } |
197 | ]; | 173 | ]; |
198 | 174 | ||
175 | // Seteo checked en cabeceras | ||
176 | $filter('filter')($scope.botonera, | ||
177 | { label: 'Cliente' })[0].checked = true; | ||
178 | $filter('filter')($scope.botonera, | ||
179 | { label: 'Proveedor' })[0].checked = true; | ||
180 | $filter('filter')($scope.botonera, | ||
181 | { label: 'Moneda' })[0].checked = true; | ||
182 | $filter('filter')($scope.botonera, | ||
183 | { label: 'Nota pedido' })[0].checked = true; | ||
184 | $filter('filter')($scope.botonera, | ||
185 | { label: 'Precios y condiciones' })[0].checked = true; | ||
186 | |||
187 | if (notaPedido.observaciones) { | ||
188 | $filter('filter')($scope.botonera, | ||
189 | { label: 'Observaciones' })[0].checked = true; | ||
190 | } | ||
191 | |||
199 | function valorPrecioCondicion() { | 192 | function valorPrecioCondicion() { |
200 | if (notaPedido.idPrecioCondicion > 0) { | 193 | if (notaPedido.idPrecioCondicion > 0) { |
201 | return notaPedido.precioCondicion.nombre; | 194 | return notaPedido.precioCondicion.nombre; |
202 | } else { | 195 | } else { |
203 | return 'Ingreso Manual'; | 196 | return 'Ingreso Manual'; |
204 | } | 197 | } |
205 | } | 198 | } |
206 | 199 | ||
207 | if (notaPedido.flete === 1) { | 200 | if (notaPedido.flete === 1) { |
208 | var cabeceraBomba = { | 201 | var cabeceraBomba = { |
209 | label: 'Bomba:', | 202 | label: 'Bomba:', |
210 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 203 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
211 | }; | 204 | }; |
212 | if (notaPedido.kilometros) { | 205 | if (notaPedido.kilometros) { |
213 | var cabeceraKilometros = { | 206 | var cabeceraKilometros = { |
214 | label: 'Kilometros:', | 207 | label: 'Kilometros:', |
215 | valor: notaPedido.kilometros | 208 | valor: notaPedido.kilometros |
216 | }; | 209 | }; |
217 | cabeceras.push(cabeceraKilometros); | 210 | cabeceras.push(cabeceraKilometros); |
218 | } | 211 | } |
219 | cabeceras.push(cabeceraBomba); | 212 | cabeceras.push(cabeceraBomba); |
220 | } | 213 | } |
221 | 214 | ||
222 | delete notaPedido.id; | 215 | delete notaPedido.id; |
223 | $scope.remito = notaPedido; | 216 | $scope.remito = notaPedido; |
224 | $scope.remito.id = 0; | 217 | $scope.remito.id = 0; |
225 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 218 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; |
226 | 219 | ||
227 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 220 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
228 | notaPedido.articulosNotaPedido[i].id = 0; | 221 | notaPedido.articulosNotaPedido[i].id = 0; |
229 | notaPedido.articulosNotaPedido[i].idRemito = 0; | 222 | notaPedido.articulosNotaPedido[i].idRemito = 0; |
230 | } | 223 | } |
231 | 224 | ||
232 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 225 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; |
233 | 226 | ||
234 | if (notaPedido.idPrecioCondicion > 0) { | 227 | if (notaPedido.idPrecioCondicion > 0) { |
235 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 228 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
236 | } else { | 229 | } else { |
237 | $scope.idLista = -1; | 230 | $scope.idLista = -1; |
238 | } | 231 | } |
239 | 232 | ||
240 | enableObservaciones(notaPedido.observaciones ? true : false); | 233 | enableObservaciones(notaPedido.observaciones ? true : false); |
241 | addArrayCabecera(cabeceras); | 234 | addArrayCabecera(cabeceras); |
242 | 235 | ||
243 | }, function() { | 236 | }, function() { |
244 | // funcion ejecutada cuando se cancela el modal | 237 | // funcion ejecutada cuando se cancela el modal |
245 | } | 238 | } |
246 | ); | 239 | ); |
247 | } | 240 | } |
248 | }; | 241 | }; |
249 | 242 | ||
250 | $scope.seleccionarRemito = function() { | 243 | $scope.seleccionarRemito = function() { |
251 | var modalInstance = $uibModal.open( | 244 | var modalInstance = $uibModal.open( |
252 | { | 245 | { |
253 | ariaLabelledBy: 'Busqueda de Remito', | 246 | ariaLabelledBy: 'Busqueda de Remito', |
254 | templateUrl: 'foca-modal-remito.html', | 247 | templateUrl: 'foca-modal-remito.html', |
255 | controller: 'focaModalRemitoController', | 248 | controller: 'focaModalRemitoController', |
256 | size: 'lg', | 249 | size: 'lg', |
257 | resolve: {usadoPor: function() {return 'remito';}} | 250 | resolve: {usadoPor: function() {return 'remito';}} |
258 | } | 251 | } |
259 | ); | 252 | ); |
260 | modalInstance.result.then( | 253 | modalInstance.result.then( |
261 | setearRemito, function() { | 254 | setearRemito, function() { |
262 | // funcion ejecutada cuando se cancela el modal | 255 | // funcion ejecutada cuando se cancela el modal |
263 | } | 256 | } |
264 | ); | 257 | ); |
265 | }; | 258 | }; |
266 | 259 | ||
267 | //validacion por domicilio y por plazo pago | 260 | //validacion por domicilio y por plazo pago |
268 | $scope.crearRemito = function() { | 261 | $scope.crearRemito = function() { |
269 | if (!$scope.remito.vendedor.NUM) { | 262 | if (!$scope.remito.vendedor.NUM) { |
270 | focaModalService.alert('Ingrese Vendedor'); | 263 | focaModalService.alert('Ingrese Vendedor'); |
271 | return; | 264 | return; |
272 | } else if (!$scope.remito.cliente.COD) { | 265 | } else if (!$scope.remito.cliente.COD) { |
273 | focaModalService.alert('Ingrese Cliente'); | 266 | focaModalService.alert('Ingrese Cliente'); |
274 | return; | 267 | return; |
275 | } else if (!$scope.remito.proveedor) { | 268 | } else if (!$scope.remito.proveedor) { |
276 | focaModalService.alert('Ingrese Proveedor'); | 269 | focaModalService.alert('Ingrese Proveedor'); |
277 | return; | 270 | return; |
278 | } else if (!$scope.remito.cotizacion.moneda.id && | 271 | } else if (!$scope.remito.cotizacion.moneda.id && |
279 | !$scope.remito.cotizacion.moneda.ID){ | 272 | !$scope.remito.cotizacion.moneda.ID){ |
280 | focaModalService.alert('Ingrese Moneda'); | 273 | focaModalService.alert('Ingrese Moneda'); |
281 | return; | 274 | return; |
282 | } else if (!$scope.remito.cotizacion.ID) { | 275 | } else if (!$scope.remito.cotizacion.ID) { |
283 | focaModalService.alert('Ingrese Cotización'); | 276 | focaModalService.alert('Ingrese Cotización'); |
284 | return; | 277 | return; |
285 | } else if ($scope.remito.flete === undefined || $scope.remito.flete === null){ | 278 | } else if ($scope.remito.flete === undefined || $scope.remito.flete === null){ |
286 | focaModalService.alert('Ingrese Flete'); | 279 | focaModalService.alert('Ingrese Flete'); |
287 | return; | 280 | return; |
288 | } else if ($scope.articulosFiltro().length === 0) { | 281 | } else if ($scope.articulosFiltro().length === 0) { |
289 | focaModalService.alert('Debe cargar al menos un articulo'); | 282 | focaModalService.alert('Debe cargar al menos un articulo'); |
290 | return; | 283 | return; |
291 | } | 284 | } |
292 | focaBotoneraLateralService.startGuardar(); | 285 | focaBotoneraLateralService.startGuardar(); |
293 | $scope.saveLoading = true; | 286 | $scope.saveLoading = true; |
294 | var save = { | 287 | var save = { |
295 | remito: { | 288 | remito: { |
296 | id: $scope.remito.id, | 289 | id: $scope.remito.id, |
297 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 290 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
298 | idCliente: $scope.remito.cliente.COD, | 291 | idCliente: $scope.remito.cliente.COD, |
299 | nombreCliente: $scope.remito.cliente.NOM, | 292 | nombreCliente: $scope.remito.cliente.NOM, |
300 | cuitCliente: $scope.remito.cliente.CUIT, | 293 | cuitCliente: $scope.remito.cliente.CUIT, |
301 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 294 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
302 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 295 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
303 | idVendedor: $scope.remito.idVendedor, | 296 | idVendedor: $scope.remito.idVendedor, |
304 | idProveedor: $scope.remito.idProveedor, | 297 | idProveedor: $scope.remito.idProveedor, |
305 | idDomicilio: $scope.remito.idDomicilio, | 298 | idDomicilio: $scope.remito.idDomicilio, |
306 | idCotizacion: $scope.remito.cotizacion.ID, | 299 | idCotizacion: $scope.remito.cotizacion.ID, |
307 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 300 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
308 | flete: $scope.remito.flete, | 301 | flete: $scope.remito.flete, |
309 | fob: $scope.remito.fob, | 302 | fob: $scope.remito.fob, |
310 | bomba: $scope.remito.bomba, | 303 | bomba: $scope.remito.bomba, |
311 | kilometros: $scope.remito.kilometros, | 304 | kilometros: $scope.remito.kilometros, |
312 | domicilioStamp: $scope.remito.domicilioStamp, | 305 | domicilioStamp: $scope.remito.domicilioStamp, |
313 | observaciones: $scope.remito.observaciones, | 306 | observaciones: $scope.remito.observaciones, |
314 | numeroRemito: parseInt($scope.comprobante), | 307 | numeroRemito: parseInt($scope.comprobante), |
315 | sucursal: parseInt($scope.puntoVenta), | 308 | sucursal: parseInt($scope.puntoVenta), |
316 | responsabilidadIvaCliente: $scope.remito.cliente.IVA, | 309 | responsabilidadIvaCliente: $scope.remito.cliente.IVA, |
317 | descuento: 0,//TODO, | 310 | descuento: 0,//TODO, |
318 | importeNeto: getImporte('netoUnitario'), | 311 | importeNeto: getImporte('netoUnitario'), |
319 | importeExento: getImporte('exentoUnitario'), | 312 | importeExento: getImporte('exentoUnitario'), |
320 | importeIva: getImporte('ivaUnitario'), | 313 | importeIva: getImporte('ivaUnitario'), |
321 | importeIvaServicios: 0,//TODO | 314 | importeIvaServicios: 0,//TODO |
322 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | 315 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), |
323 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | 316 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), |
324 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | 317 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), |
325 | percepcion: 0,//TODO | 318 | percepcion: 0,//TODO |
326 | percepcionIva: 0,//TODO | 319 | percepcionIva: 0,//TODO |
327 | redondeo: 0,//TODO | 320 | redondeo: 0,//TODO |
328 | anulado: false, | 321 | anulado: false, |
329 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), | 322 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), |
330 | lugar: parseInt($scope.puntoVenta), | 323 | lugar: parseInt($scope.puntoVenta), |
331 | cuentaMadre: 0,//TODO | 324 | cuentaMadre: 0,//TODO |
332 | cuentaContable: 0,//TODO | 325 | cuentaContable: 0,//TODO |
333 | asiento: 0,//TODO | 326 | asiento: 0,//TODO |
334 | e_hd: '',//TODO | 327 | e_hd: '',//TODO |
335 | c_hd: '', | 328 | c_hd: '', |
336 | numeroLiquidoProducto: 0,//TODO | 329 | numeroLiquidoProducto: 0,//TODO |
337 | estado: 0, | 330 | estado: 0, |
338 | destinoVenta: 0,//TODO | 331 | destinoVenta: 0,//TODO |
339 | operacionTipo: 0, //TODO | 332 | operacionTipo: 0, //TODO |
340 | }, | 333 | }, |
341 | notaPedido: $scope.notaPedido | 334 | notaPedido: $scope.notaPedido |
342 | }; | 335 | }; |
343 | 336 | ||
344 | crearRemitoService.crearRemito(save).then( | 337 | crearRemitoService.crearRemito(save).then( |
345 | function(data) { | 338 | function(data) { |
346 | 339 | ||
347 | focaBotoneraLateralService.endGuardar(true); | 340 | focaBotoneraLateralService.endGuardar(true); |
348 | $scope.saveLoading = false; | 341 | $scope.saveLoading = false; |
349 | 342 | ||
350 | $scope.remito.id = data.data.id; | 343 | $scope.remito.id = data.data.id; |
351 | $scope.remito.numeroRemito = data.data.numero; | 344 | $scope.remito.numeroRemito = data.data.numero; |
352 | 345 | ||
353 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | 346 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
354 | $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); | 347 | $scope.remito.id, $scope.remito.cotizacion.VENDEDOR); |
355 | 348 | ||
356 | if(data.status === 500) { | 349 | if(data.status === 500) { |
357 | focaModalService.alert(data.data); | 350 | focaModalService.alert(data.data); |
358 | return; | 351 | return; |
359 | } | 352 | } |
360 | 353 | ||
361 | // TODO: updatear plazos | 354 | // TODO: updatear plazos |
362 | if ($scope.remito.id === 0) { | 355 | if ($scope.remito.id === 0) { |
363 | var plazos = $scope.remito.remitoPlazo; | 356 | var plazos = $scope.remito.remitoPlazo; |
364 | 357 | ||
365 | for(var j = 0; j < plazos.length; j++) { | 358 | for(var j = 0; j < plazos.length; j++) { |
366 | var json = { | 359 | var json = { |
367 | idRemito: $scope.remito.id, | 360 | idRemito: $scope.remito.id, |
368 | dias: plazos[j].dias | 361 | dias: plazos[j].dias |
369 | }; | 362 | }; |
370 | crearRemitoService.crearPlazosParaRemito(json); | 363 | crearRemitoService.crearPlazosParaRemito(json); |
371 | } | 364 | } |
372 | } | 365 | } |
373 | 366 | ||
374 | abrirModalMail($scope.remito.id, | 367 | abrirModalMail($scope.remito.id, |
375 | $scope.remito.cliente, | 368 | $scope.remito.cliente, |
376 | $filter('comprobante')([ | 369 | $filter('comprobante')([ |
377 | $scope.puntoVenta, | 370 | $scope.puntoVenta, |
378 | $scope.remito.numeroRemito | 371 | $scope.remito.numeroRemito |
379 | ]) | 372 | ]) |
380 | ); | 373 | ); |
381 | 374 | ||
382 | init(); | 375 | config(); |
383 | 376 | ||
384 | }, function(error) { | 377 | }, function(error) { |
385 | focaModalService.alert(error.data || 'Hubo un error al crear el remito'); | 378 | focaModalService.alert(error.data || 'Hubo un error al crear el remito'); |
386 | focaBotoneraLateralService.endGuardar(); | 379 | focaBotoneraLateralService.endGuardar(); |
387 | $scope.saveLoading = false; | 380 | $scope.saveLoading = false; |
388 | console.info(error); | 381 | console.info(error); |
389 | } | 382 | } |
390 | ); | 383 | ); |
391 | }; | 384 | }; |
392 | 385 | ||
393 | $scope.seleccionarProductos = function() { | 386 | $scope.seleccionarProductos = function() { |
394 | if ($scope.idLista === undefined) { | 387 | if ($scope.idLista === undefined) { |
395 | focaModalService.alert( | 388 | focaModalService.alert( |
396 | 'Primero seleccione una lista de precio y condicion'); | 389 | 'Primero seleccione una lista de precio y condicion'); |
397 | return; | 390 | return; |
398 | } | 391 | } |
399 | var modalInstance = $uibModal.open( | 392 | var modalInstance = $uibModal.open( |
400 | { | 393 | { |
401 | ariaLabelledBy: 'Busqueda de Productos', | 394 | ariaLabelledBy: 'Busqueda de Productos', |
402 | templateUrl: 'modal-busqueda-productos.html', | 395 | templateUrl: 'modal-busqueda-productos.html', |
403 | controller: 'modalBusquedaProductosCtrl', | 396 | controller: 'modalBusquedaProductosCtrl', |
404 | resolve: { | 397 | resolve: { |
405 | parametroProducto: { | 398 | parametroProducto: { |
406 | idLista: $scope.idLista, | 399 | idLista: $scope.idLista, |
407 | cotizacion: $scope.remito.cotizacion.VENDEDOR, | 400 | cotizacion: $scope.remito.cotizacion.VENDEDOR, |
408 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO | 401 | simbolo: $scope.remito.cotizacion.moneda.SIMBOLO |
409 | } | 402 | } |
410 | }, | 403 | }, |
411 | size: 'lg' | 404 | size: 'lg' |
412 | } | 405 | } |
413 | ); | 406 | ); |
414 | modalInstance.result.then( | 407 | modalInstance.result.then( |
415 | function(producto) { | 408 | function(producto) { |
416 | var newArt = | 409 | var newArt = |
417 | { | 410 | { |
418 | id: 0, | 411 | id: 0, |
419 | idRemito: 0, | 412 | idRemito: 0, |
420 | codigo: producto.codigo, | 413 | codigo: producto.codigo, |
421 | sector: producto.sector, | 414 | sector: producto.sector, |
422 | sectorCodigo: producto.sector + '-' + producto.codigo, | 415 | sectorCodigo: producto.sector + '-' + producto.codigo, |
423 | descripcion: producto.descripcion, | 416 | descripcion: producto.descripcion, |
424 | item: $scope.remito.articulosRemito.length + 1, | 417 | item: $scope.remito.articulosRemito.length + 1, |
425 | nombre: producto.descripcion, | 418 | nombre: producto.descripcion, |
426 | precio: parseFloat(producto.precio.toFixed(4)), | 419 | precio: parseFloat(producto.precio.toFixed(4)), |
427 | costoUnitario: producto.costo, | 420 | costoUnitario: producto.costo, |
428 | editCantidad: false, | 421 | editCantidad: false, |
429 | editPrecio: false, | 422 | editPrecio: false, |
430 | rubro: producto.CodRub, | 423 | rubro: producto.CodRub, |
431 | exentoUnitario: producto.precio, | 424 | exentoUnitario: producto.precio, |
432 | ivaUnitario: producto.IMPIVA, | 425 | ivaUnitario: producto.IMPIVA, |
433 | impuestoInternoUnitario: producto.ImpInt, | 426 | impuestoInternoUnitario: producto.ImpInt, |
434 | impuestoInterno1Unitario: producto.ImpInt2, | 427 | impuestoInterno1Unitario: producto.ImpInt2, |
435 | impuestoInterno2Unitario: producto.ImpInt3, | 428 | impuestoInterno2Unitario: producto.ImpInt3, |
436 | precioLista: producto.precio, | 429 | precioLista: producto.precio, |
437 | combustible: 1, | 430 | combustible: 1, |
438 | facturado: 0 | 431 | facturado: 0 |
439 | }; | 432 | }; |
440 | $scope.articuloACargar = newArt; | 433 | $scope.articuloACargar = newArt; |
441 | $scope.cargando = false; | 434 | $scope.cargando = false; |
442 | }, function() { | 435 | }, function() { |
443 | // funcion ejecutada cuando se cancela el modal | 436 | // funcion ejecutada cuando se cancela el modal |
444 | } | 437 | } |
445 | ); | 438 | ); |
446 | }; | 439 | }; |
447 | 440 | ||
448 | $scope.seleccionarPuntosDeDescarga = function() { | 441 | $scope.seleccionarPuntosDeDescarga = function() { |
449 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 442 | if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { |
450 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 443 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
451 | return; | 444 | return; |
452 | } else { | 445 | } else { |
453 | var modalInstance = $uibModal.open( | 446 | var modalInstance = $uibModal.open( |
454 | { | 447 | { |
455 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 448 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
456 | templateUrl: 'modal-punto-descarga.html', | 449 | templateUrl: 'modal-punto-descarga.html', |
457 | controller: 'focaModalPuntoDescargaController', | 450 | controller: 'focaModalPuntoDescargaController', |
458 | size: 'lg', | 451 | size: 'lg', |
459 | resolve: { | 452 | resolve: { |
460 | filters: { | 453 | filters: { |
461 | idDomicilio: $scope.remito.domicilio.id, | 454 | idDomicilio: $scope.remito.domicilio.id, |
462 | idCliente: $scope.remito.cliente.COD, | 455 | idCliente: $scope.remito.cliente.COD, |
463 | articulos: $scope.remito.articulosRemito, | 456 | articulos: $scope.remito.articulosRemito, |
464 | puntosDescarga: $scope.remito.domicilio.puntosDescarga, | 457 | puntosDescarga: $scope.remito.domicilio.puntosDescarga, |
465 | domicilio: $scope.remito.domicilio | 458 | domicilio: $scope.remito.domicilio |
466 | } | 459 | } |
467 | } | 460 | } |
468 | } | 461 | } |
469 | ); | 462 | ); |
470 | modalInstance.result.then( | 463 | modalInstance.result.then( |
471 | function(puntosDescarga) { | 464 | function(puntosDescarga) { |
472 | $scope.remito.domicilio.puntosDescarga = puntosDescarga; | 465 | $scope.remito.domicilio.puntosDescarga = puntosDescarga; |
473 | 466 | ||
474 | $scope.$broadcast('addCabecera', { | 467 | $scope.$broadcast('addCabecera', { |
475 | label: 'Puntos de descarga:', | 468 | label: 'Puntos de descarga:', |
476 | valor: getCabeceraPuntoDescarga( | 469 | valor: getCabeceraPuntoDescarga( |
477 | $scope.remito.domicilio.puntosDescarga ) | 470 | $scope.remito.domicilio.puntosDescarga ) |
478 | }); | 471 | }); |
479 | }, function() { | 472 | }, function() { |
480 | $scope.abrirModalDomicilios($scope.cliente); | 473 | $scope.abrirModalDomicilios($scope.cliente); |
481 | } | 474 | } |
482 | ); | 475 | ); |
483 | } | 476 | } |
484 | }; | 477 | }; |
485 | 478 | ||
486 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { | 479 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { |
487 | if (ocultarVendedor) { | 480 | if (ocultarVendedor) { |
488 | callback(); | 481 | callback(); |
489 | return; | 482 | return; |
490 | } | 483 | } |
491 | 484 | ||
492 | if (varlidarRemitoFacturado()) { | 485 | if (varlidarRemitoFacturado()) { |
493 | var parametrosModal = { | 486 | var parametrosModal = { |
494 | titulo: 'Búsqueda vendedores', | 487 | titulo: 'Búsqueda vendedores', |
495 | query: '/vendedor', | 488 | query: '/vendedor', |
496 | columnas: [ | 489 | columnas: [ |
497 | { | 490 | { |
498 | propiedad: 'NUM', | 491 | propiedad: 'NUM', |
499 | nombre: 'Código', | 492 | nombre: 'Código', |
500 | filtro: { | 493 | filtro: { |
501 | nombre: 'rellenarDigitos', | 494 | nombre: 'rellenarDigitos', |
502 | parametro: 3 | 495 | parametro: 3 |
503 | } | 496 | } |
504 | }, | 497 | }, |
505 | { | 498 | { |
506 | propiedad: 'NOM', | 499 | propiedad: 'NOM', |
507 | nombre: 'Nombre' | 500 | nombre: 'Nombre' |
508 | } | 501 | } |
509 | ], | 502 | ], |
510 | size: 'md' | 503 | size: 'md' |
511 | }; | 504 | }; |
512 | focaModalService.modal(parametrosModal).then( | 505 | focaModalService.modal(parametrosModal).then( |
513 | function(vendedor) { | 506 | function(vendedor) { |
514 | $scope.$broadcast('addCabecera',{ | 507 | $scope.$broadcast('addCabecera',{ |
515 | label: 'Vendedor:', | 508 | label: 'Vendedor:', |
516 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 509 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
517 | vendedor.NOM | 510 | vendedor.NOM |
518 | }); | 511 | }); |
519 | $scope.remito.idVendedor = vendedor.id; | 512 | $scope.remito.idVendedor = vendedor.id; |
520 | $scope.remito.vendedor = vendedor; | 513 | $scope.remito.vendedor = vendedor; |
521 | deleteCliente(); | 514 | deleteCliente(); |
522 | callback(); | 515 | callback(); |
523 | }, function() { | 516 | }, function() { |
524 | 517 | ||
525 | } | 518 | } |
526 | ); | 519 | ); |
527 | } | 520 | } |
528 | }; | 521 | }; |
529 | 522 | ||
530 | $scope.seleccionarCliente = function(ocultarVendedor) { | 523 | $scope.seleccionarCliente = function(ocultarVendedor) { |
531 | 524 | ||
532 | $scope.seleccionarVendedor(function() { | 525 | $scope.seleccionarVendedor(function() { |
533 | if (varlidarRemitoFacturado()) { | 526 | if (varlidarRemitoFacturado()) { |
534 | var modalInstance = $uibModal.open( | 527 | var modalInstance = $uibModal.open( |
535 | { | 528 | { |
536 | ariaLabelledBy: 'Busqueda de Cliente', | 529 | ariaLabelledBy: 'Busqueda de Cliente', |
537 | templateUrl: 'foca-busqueda-cliente-modal.html', | 530 | templateUrl: 'foca-busqueda-cliente-modal.html', |
538 | controller: 'focaBusquedaClienteModalController', | 531 | controller: 'focaBusquedaClienteModalController', |
539 | resolve: { | 532 | resolve: { |
540 | vendedor: function() { return $scope.remito.vendedor; }, | 533 | vendedor: function() { return $scope.remito.vendedor; }, |
541 | cobrador: function() { return null; } | 534 | cobrador: function() { return null; } |
542 | }, | 535 | }, |
543 | size: 'lg' | 536 | size: 'lg' |
544 | } | 537 | } |
545 | ); | 538 | ); |
546 | modalInstance.result.then( | 539 | modalInstance.result.then( |
547 | function(cliente) { | 540 | function(cliente) { |
548 | $scope.abrirModalDomicilios(cliente); | 541 | $scope.abrirModalDomicilios(cliente); |
549 | $scope.cliente = cliente; | 542 | $scope.cliente = cliente; |
550 | }, function() { | 543 | }, function() { |
551 | $scope.seleccionarCliente(); | 544 | $scope.seleccionarCliente(); |
552 | } | 545 | } |
553 | ); | 546 | ); |
554 | } | 547 | } |
555 | }, ocultarVendedor); | 548 | }, ocultarVendedor); |
556 | }; | 549 | }; |
557 | 550 | ||
558 | $scope.seleccionarProveedor = function() { | 551 | $scope.seleccionarProveedor = function() { |
559 | if (varlidarRemitoFacturado()) { | 552 | if (varlidarRemitoFacturado()) { |
560 | var parametrosModal = { | 553 | var parametrosModal = { |
561 | titulo: 'Búsqueda de Proveedor', | 554 | titulo: 'Búsqueda de Proveedor', |
562 | query: '/proveedor', | 555 | query: '/proveedor', |
563 | columnas: [ | 556 | columnas: [ |
564 | { | 557 | { |
565 | nombre: 'Código', | 558 | nombre: 'Código', |
566 | propiedad: 'COD', | 559 | propiedad: 'COD', |
567 | filtro: { | 560 | filtro: { |
568 | nombre: 'rellenarDigitos', | 561 | nombre: 'rellenarDigitos', |
569 | parametro: 5 | 562 | parametro: 5 |
570 | } | 563 | } |
571 | }, | 564 | }, |
572 | { | 565 | { |
573 | nombre: 'Nombre', | 566 | nombre: 'Nombre', |
574 | propiedad: 'NOM' | 567 | propiedad: 'NOM' |
575 | }, | 568 | }, |
576 | { | 569 | { |
577 | nombre: 'CUIT', | 570 | nombre: 'CUIT', |
578 | propiedad: 'CUIT' | 571 | propiedad: 'CUIT' |
579 | } | 572 | } |
580 | ], | 573 | ], |
581 | tipo: 'POST', | 574 | tipo: 'POST', |
582 | json: {razonCuitCod: ''} | 575 | json: {razonCuitCod: ''} |
583 | }; | 576 | }; |
584 | focaModalService.modal(parametrosModal).then( | 577 | focaModalService.modal(parametrosModal).then( |
585 | function(proveedor) { | 578 | function(proveedor) { |
586 | $scope.seleccionarFlete(proveedor); | 579 | $scope.seleccionarFlete(proveedor); |
587 | }, function() { } | 580 | }, function() { } |
588 | ); | 581 | ); |
589 | } | 582 | } |
590 | }; | 583 | }; |
591 | 584 | ||
592 | $scope.abrirModalDomicilios = function(cliente) { | 585 | $scope.abrirModalDomicilios = function(cliente) { |
593 | var modalInstanceDomicilio = $uibModal.open( | 586 | var modalInstanceDomicilio = $uibModal.open( |
594 | { | 587 | { |
595 | ariaLabelledBy: 'Busqueda de Domicilios', | 588 | ariaLabelledBy: 'Busqueda de Domicilios', |
596 | templateUrl: 'modal-domicilio.html', | 589 | templateUrl: 'modal-domicilio.html', |
597 | controller: 'focaModalDomicilioController', | 590 | controller: 'focaModalDomicilioController', |
598 | size: 'lg', | 591 | size: 'lg', |
599 | resolve: { | 592 | resolve: { |
600 | idCliente: function() { return cliente.cod; }, | 593 | idCliente: function() { return cliente.cod; }, |
601 | esNuevo: function() { return cliente.esNuevo; } | 594 | esNuevo: function() { return cliente.esNuevo; } |
602 | } | 595 | } |
603 | } | 596 | } |
604 | ); | 597 | ); |
605 | modalInstanceDomicilio.result.then( | 598 | modalInstanceDomicilio.result.then( |
606 | function(domicilio) { | 599 | function(domicilio) { |
607 | $scope.remito.domicilio = domicilio; | 600 | $scope.remito.domicilio = domicilio; |
608 | console.log(cliente); | 601 | console.log(cliente); |
609 | $scope.remito.cliente = { | 602 | $scope.remito.cliente = { |
610 | COD: cliente.cod, | 603 | COD: cliente.cod, |
611 | CUIT: cliente.cuit, | 604 | CUIT: cliente.cuit, |
612 | NOM: cliente.nom, | 605 | NOM: cliente.nom, |
613 | MAIL: cliente.mail, | 606 | MAIL: cliente.mail, |
614 | MOD: cliente.mod, | 607 | MOD: cliente.mod, |
615 | IVA: cliente.iva | 608 | IVA: cliente.iva |
616 | }; | 609 | }; |
617 | 610 | ||
618 | var domicilioStamp = | 611 | var domicilioStamp = |
619 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 612 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
620 | domicilio.Localidad + ', ' + domicilio.Provincia; | 613 | domicilio.Localidad + ', ' + domicilio.Provincia; |
621 | $scope.remito.domicilioStamp = domicilioStamp; | 614 | $scope.remito.domicilioStamp = domicilioStamp; |
622 | $scope.$broadcast('addCabecera',{ | 615 | $scope.$broadcast('addCabecera',{ |
623 | label: 'Cliente:', | 616 | label: 'Cliente:', |
624 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 617 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
625 | }); | 618 | }); |
626 | $scope.$broadcast('addCabecera',{ | 619 | $scope.$broadcast('addCabecera',{ |
627 | label: 'Domicilio:', | 620 | label: 'Domicilio:', |
628 | valor: domicilioStamp | 621 | valor: domicilioStamp |
629 | }); | 622 | }); |
630 | 623 | ||
631 | if (domicilio.verPuntos) { | 624 | if (domicilio.verPuntos) { |
632 | delete $scope.remito.domicilio.verPuntos; | 625 | delete $scope.remito.domicilio.verPuntos; |
633 | $scope.seleccionarPuntosDeDescarga(); | 626 | $scope.seleccionarPuntosDeDescarga(); |
634 | } else { | 627 | } else { |
635 | crearRemitoService | 628 | crearRemitoService |
636 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 629 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
637 | .then(function(res) { | 630 | .then(function(res) { |
638 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); | 631 | if (res.data.length) $scope.seleccionarPuntosDeDescarga(); |
639 | }); | 632 | }); |
640 | } | 633 | } |
634 | |||
635 | $filter('filter')($scope.botonera, { label: 'Cliente'})[0].checked = true; | ||
641 | }, function() { | 636 | }, function() { |
642 | $scope.seleccionarCliente(true); | 637 | $scope.seleccionarCliente(true); |
643 | return; | 638 | return; |
644 | } | 639 | } |
645 | ); | 640 | ); |
646 | }; | 641 | }; |
647 | 642 | ||
648 | $scope.getTotal = function() { | 643 | $scope.getTotal = function() { |
649 | var total = 0; | 644 | var total = 0; |
650 | var arrayTempArticulos = $scope.articulosFiltro(); | 645 | var arrayTempArticulos = $scope.articulosFiltro(); |
651 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 646 | for(var i = 0; i < arrayTempArticulos.length; i++) { |
652 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 647 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
653 | } | 648 | } |
654 | return parseFloat(total.toFixed(2)); | 649 | return parseFloat(total.toFixed(2)); |
655 | }; | 650 | }; |
656 | 651 | ||
657 | $scope.getSubTotal = function() { | 652 | $scope.getSubTotal = function() { |
658 | if ($scope.articuloACargar) { | 653 | if ($scope.articuloACargar) { |
659 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 654 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
660 | } | 655 | } |
661 | }; | 656 | }; |
662 | 657 | ||
663 | $scope.seleccionarPreciosYCondiciones = function() { | 658 | $scope.seleccionarPreciosYCondiciones = function() { |
664 | if (!$scope.remito.cliente.COD) { | 659 | if (!$scope.remito.cliente.COD) { |
665 | focaModalService.alert('Primero seleccione un cliente'); | 660 | focaModalService.alert('Primero seleccione un cliente'); |
666 | return; | 661 | return; |
667 | } | 662 | } |
668 | 663 | ||
669 | if ($scope.remito.articulosRemito.length !== 0) { | 664 | if ($scope.remito.articulosRemito.length !== 0) { |
670 | focaModalService.confirm('Se perderan los productos ingresados') | 665 | focaModalService.confirm('Se perderan los productos ingresados') |
671 | .then(function(data) { | 666 | .then(function(data) { |
672 | if (data && varlidarRemitoFacturado()) { | 667 | if (data && varlidarRemitoFacturado()) { |
673 | abrirModal(); | 668 | abrirModal(); |
674 | } | 669 | } |
675 | }); | 670 | }); |
676 | } else { | 671 | } else { |
677 | abrirModal(); | 672 | abrirModal(); |
678 | } | 673 | } |
679 | 674 | ||
680 | function abrirModal() { | 675 | function abrirModal() { |
681 | var modalInstance = $uibModal.open( | 676 | var modalInstance = $uibModal.open( |
682 | { | 677 | { |
683 | ariaLabelledBy: 'Busqueda de Precio Condición', | 678 | ariaLabelledBy: 'Busqueda de Precio Condición', |
684 | templateUrl: 'modal-precio-condicion.html', | 679 | templateUrl: 'modal-precio-condicion.html', |
685 | controller: 'focaModalPrecioCondicionController', | 680 | controller: 'focaModalPrecioCondicionController', |
686 | size: 'lg', | 681 | size: 'lg', |
687 | resolve: { | 682 | resolve: { |
688 | idListaPrecio: function() { | 683 | idListaPrecio: function() { |
689 | return $scope.remito.cliente.MOD || null; | 684 | return $scope.remito.cliente.MOD || null; |
690 | } | 685 | } |
691 | } | 686 | } |
692 | } | 687 | } |
693 | ); | 688 | ); |
694 | modalInstance.result.then( | 689 | modalInstance.result.then( |
695 | function(precioCondicion) { | 690 | function(precioCondicion) { |
696 | var cabecera = ''; | 691 | var cabecera = ''; |
697 | var plazosConcat = ''; | 692 | var plazosConcat = ''; |
698 | if (!Array.isArray(precioCondicion)) { | 693 | if (!Array.isArray(precioCondicion)) { |
699 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 694 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
700 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 695 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
701 | $scope.idLista = precioCondicion.idListaPrecio; | 696 | $scope.idLista = precioCondicion.idListaPrecio; |
702 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 697 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
703 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 698 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
704 | } | 699 | } |
705 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 700 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
706 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 701 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
707 | } else { //Cuando se ingresan los plazos manualmente | 702 | } else { //Cuando se ingresan los plazos manualmente |
708 | $scope.remito.idPrecioCondicion = 0; | 703 | $scope.remito.idPrecioCondicion = 0; |
709 | //-1, el modal productos busca todos los productos | 704 | //-1, el modal productos busca todos los productos |
710 | $scope.idLista = -1; | 705 | $scope.idLista = -1; |
711 | $scope.remito.remitoPlazo = precioCondicion; | 706 | $scope.remito.remitoPlazo = precioCondicion; |
712 | for(var j = 0; j < precioCondicion.length; j++) { | 707 | for(var j = 0; j < precioCondicion.length; j++) { |
713 | plazosConcat += precioCondicion[j].dias + ' '; | 708 | plazosConcat += precioCondicion[j].dias + ' '; |
714 | } | 709 | } |
715 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 710 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
716 | } | 711 | } |
717 | $scope.remito.articulosRemito = []; | 712 | $scope.remito.articulosRemito = []; |
718 | $scope.$broadcast('addCabecera',{ | 713 | $scope.$broadcast('addCabecera',{ |
719 | label: 'Precios y condiciones:', | 714 | label: 'Precios y condiciones:', |
720 | valor: cabecera | 715 | valor: cabecera |
721 | }); | 716 | }); |
722 | $scope.remito.precioCondicion = precioCondicion; | 717 | $scope.remito.precioCondicion = precioCondicion; |
718 | |||
719 | $filter('filter')($scope.botonera, | ||
720 | { label: 'Precios y Condiciones'})[0].checked = true; | ||
723 | }, function() { | 721 | }, function() { |
724 | 722 | ||
725 | } | 723 | } |
726 | ); | 724 | ); |
727 | } | 725 | } |
728 | }; | 726 | }; |
729 | 727 | ||
730 | $scope.seleccionarFlete = function(proveedor) { | 728 | $scope.seleccionarFlete = function(proveedor) { |
731 | if (varlidarRemitoFacturado()) { | 729 | if (varlidarRemitoFacturado()) { |
732 | var modalInstance = $uibModal.open( | 730 | var modalInstance = $uibModal.open( |
733 | { | 731 | { |
734 | ariaLabelledBy: 'Busqueda de Flete', | 732 | ariaLabelledBy: 'Busqueda de Flete', |
735 | templateUrl: 'modal-flete.html', | 733 | templateUrl: 'modal-flete.html', |
736 | controller: 'focaModalFleteController', | 734 | controller: 'focaModalFleteController', |
737 | size: 'lg', | 735 | size: 'lg', |
738 | resolve: { | 736 | resolve: { |
739 | parametrosFlete: | 737 | parametrosFlete: |
740 | function() { | 738 | function() { |
741 | return { | 739 | return { |
742 | flete: $scope.remito.flete ? '1' : | 740 | flete: $scope.remito.flete ? '1' : |
743 | ($scope.remito.fob ? 'FOB' : | 741 | ($scope.remito.fob ? 'FOB' : |
744 | ($scope.remito.flete === undefined ? | 742 | ($scope.remito.flete === undefined ? |
745 | null : '0')), | 743 | null : '0')), |
746 | bomba: $scope.remito.bomba ? '1' : | 744 | bomba: $scope.remito.bomba ? '1' : |
747 | ($scope.remito.bomba === undefined ? | 745 | ($scope.remito.bomba === undefined ? |
748 | null : '0'), | 746 | null : '0'), |
749 | kilometros: $scope.remito.kilometros | 747 | kilometros: $scope.remito.kilometros |
750 | }; | 748 | }; |
751 | } | 749 | } |
752 | } | 750 | } |
753 | } | 751 | } |
754 | ); | 752 | ); |
755 | modalInstance.result.then( | 753 | modalInstance.result.then( |
756 | function(datos) { | 754 | function(datos) { |
757 | 755 | ||
758 | $scope.remito.proveedor = proveedor; | 756 | $scope.remito.proveedor = proveedor; |
759 | $scope.remito.idProveedor = proveedor.COD; | 757 | $scope.remito.idProveedor = proveedor.COD; |
760 | $scope.$broadcast('addCabecera',{ | 758 | $scope.$broadcast('addCabecera',{ |
761 | label: 'Proveedor:', | 759 | label: 'Proveedor:', |
762 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 760 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
763 | proveedor.NOM | 761 | proveedor.NOM |
764 | }); | 762 | }); |
765 | 763 | ||
766 | $scope.remito.flete = datos.flete; | 764 | $scope.remito.flete = datos.flete; |
767 | $scope.remito.fob = datos.FOB; | 765 | $scope.remito.fob = datos.FOB; |
768 | $scope.remito.bomba = datos.bomba; | 766 | $scope.remito.bomba = datos.bomba; |
769 | $scope.remito.kilometros = datos.kilometros; | 767 | $scope.remito.kilometros = datos.kilometros; |
770 | 768 | ||
771 | $scope.$broadcast('addCabecera',{ | 769 | $scope.$broadcast('addCabecera',{ |
772 | label: 'Flete:', | 770 | label: 'Flete:', |
773 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | 771 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') |
774 | }); | 772 | }); |
775 | if (datos.flete) { | 773 | if (datos.flete) { |
776 | $scope.$broadcast('addCabecera',{ | 774 | $scope.$broadcast('addCabecera',{ |
777 | label: 'Bomba:', | 775 | label: 'Bomba:', |
778 | valor: datos.bomba ? 'Si' : 'No' | 776 | valor: datos.bomba ? 'Si' : 'No' |
779 | }); | 777 | }); |
780 | $scope.$broadcast('addCabecera',{ | 778 | $scope.$broadcast('addCabecera',{ |
781 | label: 'Kilometros:', | 779 | label: 'Kilometros:', |
782 | valor: datos.kilometros | 780 | valor: datos.kilometros |
783 | }); | 781 | }); |
784 | } else { | 782 | } else { |
785 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 783 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
786 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 784 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
787 | $scope.remito.bomba = false; | 785 | $scope.remito.bomba = false; |
788 | $scope.remito.kilometros = null; | 786 | $scope.remito.kilometros = null; |
789 | } | 787 | } |
788 | |||
789 | $filter('filter')($scope.botonera, | ||
790 | { label: 'Proveedor'})[0].checked = true; | ||
790 | }, function() { | 791 | }, function() { |
791 | $scope.seleccionarTransportista(); | 792 | $scope.seleccionarTransportista(); |
792 | } | 793 | } |
793 | ); | 794 | ); |
794 | } | 795 | } |
795 | }; | 796 | }; |
796 | 797 | ||
797 | $scope.seleccionarMoneda = function() { | 798 | $scope.seleccionarMoneda = function() { |
798 | if (varlidarRemitoFacturado()) { | 799 | if (varlidarRemitoFacturado()) { |
799 | var parametrosModal = { | 800 | var parametrosModal = { |
800 | titulo: 'Búsqueda de monedas', | 801 | titulo: 'Búsqueda de monedas', |
801 | query: '/moneda', | 802 | query: '/moneda', |
802 | columnas: [ | 803 | columnas: [ |
803 | { | 804 | { |
804 | propiedad: 'DETALLE', | 805 | propiedad: 'DETALLE', |
805 | nombre: 'Nombre' | 806 | nombre: 'Nombre' |
806 | }, | 807 | }, |
807 | { | 808 | { |
808 | propiedad: 'SIMBOLO', | 809 | propiedad: 'SIMBOLO', |
809 | nombre: 'Símbolo' | 810 | nombre: 'Símbolo' |
810 | } | 811 | } |
811 | ], | 812 | ], |
812 | size: 'md' | 813 | size: 'md' |
813 | }; | 814 | }; |
814 | focaModalService.modal(parametrosModal).then( | 815 | focaModalService.modal(parametrosModal).then( |
815 | function(moneda) { | 816 | function(moneda) { |
816 | $scope.abrirModalCotizacion(moneda); | 817 | $scope.abrirModalCotizacion(moneda); |
817 | }, function() { | 818 | }, function() { |
818 | 819 | ||
819 | } | 820 | } |
820 | ); | 821 | ); |
821 | } | 822 | } |
822 | }; | 823 | }; |
823 | 824 | ||
824 | $scope.seleccionarObservaciones = function() { | 825 | $scope.seleccionarObservaciones = function() { |
825 | focaModalService | 826 | focaModalService |
826 | .prompt({ | 827 | .prompt({ |
827 | titulo: 'Observaciones', | 828 | titulo: 'Observaciones', |
828 | value: $scope.remito.observaciones, | 829 | value: $scope.remito.observaciones, |
829 | textarea: true, | 830 | textarea: true, |
830 | readonly: true | 831 | readonly: true |
831 | }) | 832 | }) |
832 | .then(function(observaciones) { | 833 | .then(function(observaciones) { |
833 | $scope.remito.observaciones = observaciones; | 834 | $scope.remito.observaciones = observaciones; |
834 | }); | 835 | }); |
835 | }; | 836 | }; |
836 | 837 | ||
837 | $scope.abrirModalCotizacion = function(moneda) { | 838 | $scope.abrirModalCotizacion = function(moneda) { |
838 | var modalInstance = $uibModal.open( | 839 | var modalInstance = $uibModal.open( |
839 | { | 840 | { |
840 | ariaLabelledBy: 'Busqueda de Cotización', | 841 | ariaLabelledBy: 'Busqueda de Cotización', |
841 | templateUrl: 'modal-cotizacion.html', | 842 | templateUrl: 'modal-cotizacion.html', |
842 | controller: 'focaModalCotizacionController', | 843 | controller: 'focaModalCotizacionController', |
843 | size: 'lg', | 844 | size: 'lg', |
844 | resolve: {idMoneda: function() {return moneda.ID;}} | 845 | resolve: {idMoneda: function() {return moneda.ID;}} |
845 | } | 846 | } |
846 | ); | 847 | ); |
847 | modalInstance.result.then( | 848 | modalInstance.result.then( |
848 | function(cotizacion) { | 849 | function(cotizacion) { |
849 | var articulosTablaTemp = $scope.remito.articulosRemito; | 850 | var articulosTablaTemp = $scope.remito.articulosRemito; |
850 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 851 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
851 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 852 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
852 | $scope.remito.cotizacion.VENDEDOR; | 853 | $scope.remito.cotizacion.VENDEDOR; |
853 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 854 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
854 | cotizacion.VENDEDOR; | 855 | cotizacion.VENDEDOR; |
855 | } | 856 | } |
856 | $scope.remito.articulosRemito = articulosTablaTemp; | 857 | $scope.remito.articulosRemito = articulosTablaTemp; |
857 | $scope.remito.cotizacion = cotizacion; | 858 | $scope.remito.cotizacion = cotizacion; |
858 | $scope.remito.cotizacion.moneda = moneda; | 859 | $scope.remito.cotizacion.moneda = moneda; |
859 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { | 860 | if (moneda.DETALLE === 'PESOS ARGENTINOS') { |
860 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 861 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
861 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 862 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
862 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 863 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
863 | } else { | 864 | } else { |
864 | $scope.$broadcast('addCabecera',{ | 865 | $scope.$broadcast('addCabecera', { |
865 | label: 'Moneda:', | 866 | label: 'Moneda:', |
866 | valor: moneda.DETALLE | 867 | valor: moneda.DETALLE |
867 | }); | 868 | }); |
868 | $scope.$broadcast('addCabecera',{ | 869 | $scope.$broadcast('addCabecera',{ |
869 | label: 'Fecha cotizacion:', | 870 | label: 'Fecha cotizacion:', |
870 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 871 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
871 | }); | 872 | }); |
872 | $scope.$broadcast('addCabecera',{ | 873 | $scope.$broadcast('addCabecera',{ |
873 | label: 'Cotizacion:', | 874 | label: 'Cotizacion:', |
874 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 875 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
875 | }); | 876 | }); |
876 | } | 877 | } |
878 | |||
879 | $filter('filter')($scope.botonera, { label: 'Moneda'})[0].checked = true; | ||
877 | }, function() { | 880 | }, function() { |
878 | 881 | ||
879 | } | 882 | } |
880 | ); | 883 | ); |
881 | }; | 884 | }; |
882 | 885 | ||
883 | $scope.agregarATabla = function(key) { | 886 | $scope.agregarATabla = function(key) { |
884 | if (key === 13) { | 887 | if (key === 13) { |
885 | if ($scope.articuloACargar.cantidad === undefined || | 888 | if ($scope.articuloACargar.cantidad === undefined || |
886 | $scope.articuloACargar.cantidad === 0 || | 889 | $scope.articuloACargar.cantidad === 0 || |
887 | $scope.articuloACargar.cantidad === null ) { | 890 | $scope.articuloACargar.cantidad === null ) { |
888 | focaModalService.alert('El valor debe ser al menos 1'); | 891 | focaModalService.alert('El valor debe ser al menos 1'); |
889 | return; | 892 | return; |
890 | } | 893 | } |
891 | delete $scope.articuloACargar.sectorCodigo; | 894 | delete $scope.articuloACargar.sectorCodigo; |
892 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 895 | $scope.remito.articulosRemito.push($scope.articuloACargar); |
893 | $scope.cargando = true; | 896 | $scope.cargando = true; |
894 | } | 897 | } |
895 | }; | 898 | }; |
896 | 899 | ||
897 | $scope.quitarArticulo = function(articulo) { | 900 | $scope.quitarArticulo = function(articulo) { |
898 | articulo.idRemito = -1; | 901 | articulo.idRemito = -1; |
899 | }; | 902 | }; |
900 | 903 | ||
901 | $scope.articulosFiltro = function() { | 904 | $scope.articulosFiltro = function() { |
902 | 905 | ||
903 | var result = $scope.remito.articulosRemito.filter(function(articulo) { | 906 | var result = $scope.remito.articulosRemito.filter(function(articulo) { |
904 | return articulo.idRemito >= 0; | 907 | return articulo.idRemito >= 0; |
905 | }); | 908 | }); |
909 | |||
910 | // Agrego checked en cabecera si hay datos | ||
911 | if (result.length) { | ||
912 | $filter('filter')($scope.botonera, { label: 'Productos'})[0].checked = true; | ||
913 | } else { | ||
914 | $filter('filter')($scope.botonera, { label: 'Productos'})[0].checked = false; | ||
915 | } | ||
906 | return result; | 916 | return result; |
907 | }; | 917 | }; |
908 | 918 | ||
909 | $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) { | 919 | $scope.editarArticulo = function(key, articulo, tmpCantidad, tmpPrecio) { |
910 | if (key === 13) { | 920 | if (key === 13) { |
911 | if (!articulo.cantidad || !articulo.precio) { | 921 | if (!articulo.cantidad || !articulo.precio) { |
912 | focaModalService.alert('Los valores deben ser al menos 1'); | 922 | focaModalService.alert('Los valores deben ser al menos 1'); |
913 | return; | 923 | return; |
914 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | 924 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { |
915 | focaModalService.alert('Los valores no pueden ser negativos'); | 925 | focaModalService.alert('Los valores no pueden ser negativos'); |
916 | return; | 926 | return; |
917 | } | 927 | } |
918 | articulo.cantidad = tmpCantidad; | 928 | articulo.cantidad = tmpCantidad; |
919 | articulo.precio = tmpPrecio; | 929 | articulo.precio = tmpPrecio; |
920 | $scope.getTotal(); | 930 | $scope.getTotal(); |
921 | articulo.editCantidad = articulo.editPrecio = false; | 931 | articulo.editCantidad = articulo.editPrecio = false; |
922 | } | 932 | } |
923 | }; | 933 | }; |
924 | 934 | ||
925 | $scope.cancelarEditar = function(articulo) { | 935 | $scope.cancelarEditar = function(articulo) { |
926 | $scope.tmpCantidad = articulo.cantidad; | 936 | $scope.tmpCantidad = articulo.cantidad; |
927 | $scope.tmpPrecio = articulo.precio; | 937 | $scope.tmpPrecio = articulo.precio; |
928 | articulo.editCantidad = articulo.editPrecio = false; | 938 | articulo.editCantidad = articulo.editPrecio = false; |
929 | }; | 939 | }; |
930 | 940 | ||
931 | $scope.cambioEdit = function(articulo, propiedad) { | 941 | $scope.cambioEdit = function(articulo, propiedad) { |
932 | if (propiedad === 'cantidad') { | 942 | if (propiedad === 'cantidad') { |
933 | articulo.editCantidad = true; | 943 | articulo.editCantidad = true; |
934 | } else if (propiedad === 'precio') { | 944 | } else if (propiedad === 'precio') { |
935 | articulo.editPrecio = true; | 945 | articulo.editPrecio = true; |
936 | } | 946 | } |
937 | }; | 947 | }; |
938 | 948 | ||
939 | $scope.resetFilter = function() { | 949 | $scope.resetFilter = function() { |
940 | $scope.articuloACargar = {}; | 950 | $scope.articuloACargar = {}; |
941 | $scope.cargando = true; | 951 | $scope.cargando = true; |
942 | }; | 952 | }; |
943 | //Recibe aviso si el teclado está en uso | 953 | //Recibe aviso si el teclado está en uso |
944 | $rootScope.$on('usarTeclado', function(event, data) { | 954 | $rootScope.$on('usarTeclado', function(event, data) { |
945 | if (data) { | 955 | if (data) { |
946 | $scope.mostrarTeclado = true; | 956 | $scope.mostrarTeclado = true; |
947 | return; | 957 | return; |
948 | } | 958 | } |
949 | $scope.mostrarTeclado = false; | 959 | $scope.mostrarTeclado = false; |
950 | }); | 960 | }); |
951 | 961 | ||
952 | $scope.selectFocus = function($event) { | 962 | $scope.selectFocus = function($event) { |
953 | // Si el teclado esta en uso no selecciona el valor | 963 | // Si el teclado esta en uso no selecciona el valor |
954 | if ($scope.mostrarTeclado) { | 964 | if ($scope.mostrarTeclado) { |
955 | return; | 965 | return; |
956 | } | 966 | } |
957 | $event.target.select(); | 967 | $event.target.select(); |
958 | }; | 968 | }; |
959 | 969 | ||
960 | function addArrayCabecera(array) { | 970 | function addArrayCabecera(array) { |
961 | for (var i = 0; i < array.length; i++) { | 971 | for (var i = 0; i < array.length; i++) { |
962 | $scope.$broadcast('addCabecera',{ | 972 | $scope.$broadcast('addCabecera',{ |
963 | label: array[i].label, | 973 | label: array[i].label, |
964 | valor: array[i].valor | 974 | valor: array[i].valor |
965 | }); | 975 | }); |
966 | } | 976 | } |
967 | } | 977 | } |
968 | 978 | ||
969 | function rellenar(relleno, longitud) { | 979 | function rellenar(relleno, longitud) { |
970 | relleno = '' + relleno; | 980 | relleno = '' + relleno; |
971 | while (relleno.length < longitud) { | 981 | while (relleno.length < longitud) { |
972 | relleno = '0' + relleno; | 982 | relleno = '0' + relleno; |
973 | } | 983 | } |
974 | return relleno; | 984 | return relleno; |
975 | } | 985 | } |
976 | 986 | ||
977 | function varlidarRemitoFacturado() { | 987 | function varlidarRemitoFacturado() { |
978 | if ($scope.remito.estado !== 5) { | 988 | if ($scope.remito.estado !== 5) { |
979 | return true; | 989 | return true; |
980 | } else { | 990 | } else { |
981 | focaModalService.alert('No se puede editar un remito facturado'); | 991 | focaModalService.alert('No se puede editar un remito facturado'); |
982 | return false(); | 992 | return false(); |
983 | } | 993 | } |
984 | } | 994 | } |
985 | 995 | ||
986 | function salir() { | 996 | function salir() { |
987 | var confirmacion = false; | 997 | var confirmacion = false; |
988 | 998 | ||
989 | if (!angular.equals($scope.remito, $scope.inicial)) { | 999 | if (!angular.equals($scope.remito, $scope.inicial)) { |
990 | confirmacion = true; | 1000 | confirmacion = true; |
991 | } | 1001 | } |
992 | 1002 | ||
993 | if (confirmacion) { | 1003 | if (confirmacion) { |
994 | focaModalService.confirm( | 1004 | focaModalService.confirm( |
995 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 1005 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
996 | ).then(function(data) { | 1006 | ).then(function(data) { |
997 | if (data) { | 1007 | if (data) { |
998 | $location.path('/'); | 1008 | $location.path('/'); |
999 | } | 1009 | } |
1000 | }); | 1010 | }); |
1001 | } else { | 1011 | } else { |
1002 | $location.path('/'); | 1012 | $location.path('/'); |
1003 | } | 1013 | } |
1004 | } | 1014 | } |
1005 | 1015 | ||
1006 | function enableObservaciones(val) { | 1016 | function enableObservaciones(val) { |
1007 | var boton = $scope.botonera.filter(function(botonObs) { | 1017 | var boton = $scope.botonera.filter(function(botonObs) { |
1008 | return botonObs.label === 'Observaciones'; | 1018 | return botonObs.label === 'Observaciones'; |
1009 | }); | 1019 | }); |
1010 | boton[0].disable = !val; | 1020 | boton[0].disable = !val; |
1011 | } | 1021 | } |
1012 | 1022 | ||
1013 | function setearRemito(remito) { | 1023 | function setearRemito(remito) { |
1014 | //añado cabeceras | 1024 | //añado cabeceras |
1015 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 1025 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
1016 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 1026 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
1017 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 1027 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
1018 | 1028 | ||
1019 | var cabeceras = []; | 1029 | var cabeceras = []; |
1020 | 1030 | ||
1021 | if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | 1031 | if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
1022 | cabeceras.push({ | 1032 | cabeceras.push({ |
1023 | label: 'Moneda:', | 1033 | label: 'Moneda:', |
1024 | valor: remito.cotizacion.moneda.DETALLE | 1034 | valor: remito.cotizacion.moneda.DETALLE |
1025 | }); | 1035 | }); |
1026 | cabeceras.push({ | 1036 | cabeceras.push({ |
1027 | label: 'Fecha cotizacion:', | 1037 | label: 'Fecha cotizacion:', |
1028 | valor: $filter('date')(remito.cotizacion.FECHA, | 1038 | valor: $filter('date')(remito.cotizacion.FECHA, |
1029 | 'dd/MM/yyyy') | 1039 | 'dd/MM/yyyy') |
1030 | }); | 1040 | }); |
1031 | cabeceras.push({ | 1041 | cabeceras.push({ |
1032 | label: 'Cotizacion:', | 1042 | label: 'Cotizacion:', |
1033 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 1043 | valor: $filter('number')(remito.cotizacion.VENDEDOR, |
1034 | '2') | 1044 | '2') |
1035 | }); | 1045 | }); |
1036 | } | 1046 | } |
1047 | |||
1048 | if (remito.cotizacion.moneda) { | ||
1049 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; | ||
1050 | } | ||
1051 | |||
1037 | if (remito.cliente.COD) { | 1052 | if (remito.cliente.COD) { |
1038 | cabeceras.push({ | 1053 | cabeceras.push({ |
1039 | label: 'Cliente:', | 1054 | label: 'Cliente:', |
1040 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 1055 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
1041 | remito.cliente.NOM | 1056 | remito.cliente.NOM |
1042 | }); | 1057 | }); |
1043 | cabeceras.push({ | 1058 | cabeceras.push({ |
1044 | label: 'Domicilio:', | 1059 | label: 'Domicilio:', |
1045 | valor: remito.domicilioStamp | 1060 | valor: remito.domicilioStamp |
1046 | }); | 1061 | }); |
1062 | |||
1063 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | ||
1047 | } | 1064 | } |
1048 | if (remito.vendedor.NUM) { | 1065 | if (remito.vendedor.NUM) { |
1049 | cabeceras.push({ | 1066 | cabeceras.push({ |
1050 | label: 'Vendedor:', | 1067 | label: 'Vendedor:', |
1051 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 1068 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
1052 | ' - ' + remito.vendedor.NOM | 1069 | ' - ' + remito.vendedor.NOM |
1053 | }); | 1070 | }); |
1054 | } | 1071 | } |
1055 | if (remito.proveedor.COD) { | 1072 | if (remito.proveedor.COD) { |
1056 | cabeceras.push({ | 1073 | cabeceras.push({ |
1057 | label: 'Proveedor:', | 1074 | label: 'Proveedor:', |
1058 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + | 1075 | valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) + |
1059 | ' - ' + remito.proveedor.NOM | 1076 | ' - ' + remito.proveedor.NOM |
1060 | }); | 1077 | }); |
1078 | |||
1079 | $filter('filter')($scope.botonera, { label: 'Proveedor' })[0].checked = true; | ||
1061 | } | 1080 | } |
1062 | if (remito.flete !== undefined && remito.fob !== undefined) { | 1081 | if (remito.flete !== undefined && remito.fob !== undefined) { |
1063 | cabeceras.push({ | 1082 | cabeceras.push({ |
1064 | label: 'Flete:', | 1083 | label: 'Flete:', |
1065 | valor: remito.fob ? 'FOB' : ( | 1084 | valor: remito.fob ? 'FOB' : ( |
1066 | remito.flete ? 'Si' : 'No') | 1085 | remito.flete ? 'Si' : 'No') |
1067 | }); | 1086 | }); |
1068 | } | 1087 | } |
1069 | if (remito.remitoPlazo) { | 1088 | if (remito.remitoPlazo) { |
1070 | cabeceras.push({ | 1089 | cabeceras.push({ |
1071 | label: 'Precio condicion:', | 1090 | label: 'Precio condicion:', |
1072 | valor: valorPrecioCondicion() + ' ' + | 1091 | valor: valorPrecioCondicion() + ' ' + |
1073 | remitoBusinessService.plazoToString(remito.remitoPlazo) | 1092 | remitoBusinessService.plazoToString(remito.remitoPlazo) |
1074 | }); | 1093 | }); |
1094 | |||
1095 | $filter('filter')($scope.botonera, | ||
1096 | { label: 'Precios y condiciones' })[0].checked = true; | ||
1075 | } | 1097 | } |
1076 | function valorPrecioCondicion() { | 1098 | function valorPrecioCondicion() { |
1077 | if (remito.idPrecioCondicion > 0) { | 1099 | if (remito.idPrecioCondicion > 0) { |
1078 | return remito.precioCondicion.nombre; | 1100 | return remito.precioCondicion.nombre; |
1079 | } else { | 1101 | } else { |
1080 | return 'Ingreso Manual'; | 1102 | return 'Ingreso Manual'; |
1081 | } | 1103 | } |
1082 | } | 1104 | } |
1083 | if (remito.flete === 1) { | 1105 | if (remito.flete === 1) { |
1084 | var cabeceraBomba = { | 1106 | var cabeceraBomba = { |
1085 | label: 'Bomba', | 1107 | label: 'Bomba', |
1086 | valor: remito.bomba === 1 ? 'Si' : 'No' | 1108 | valor: remito.bomba === 1 ? 'Si' : 'No' |
1087 | }; | 1109 | }; |
1088 | if (remito.kilometros) { | 1110 | if (remito.kilometros) { |
1089 | var cabeceraKilometros = { | 1111 | var cabeceraKilometros = { |
1090 | label: 'Kilometros', | 1112 | label: 'Kilometros', |
1091 | valor: remito.kilometros | 1113 | valor: remito.kilometros |
1092 | }; | 1114 | }; |
1093 | cabeceras.push(cabeceraKilometros); | 1115 | cabeceras.push(cabeceraKilometros); |
1094 | } | 1116 | } |
1095 | cabeceras.push(cabeceraBomba); | 1117 | cabeceras.push(cabeceraBomba); |
1096 | } | 1118 | } |
1097 | 1119 | ||
1098 | if (remito.idPrecioCondicion > 0) { | 1120 | if (remito.idPrecioCondicion > 0) { |
1099 | $scope.idLista = remito.precioCondicion.idListaPrecio; | 1121 | $scope.idLista = remito.precioCondicion.idListaPrecio; |
1100 | } else { | 1122 | } else { |
1101 | $scope.idLista = -1; | 1123 | $scope.idLista = -1; |
1102 | } | 1124 | } |
1103 | $scope.puntoVenta = rellenar(remito.sucursal, 4); | 1125 | $scope.puntoVenta = rellenar(remito.sucursal, 4); |
1104 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 1126 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
1105 | $scope.remito = remito; | 1127 | $scope.remito = remito; |
1106 | if ($scope.remito.puntosDescarga) { | 1128 | if ($scope.remito.puntosDescarga) { |
1107 | var puntosDescarga = $scope.remito.puntosDescarga; | 1129 | var puntosDescarga = $scope.remito.puntosDescarga; |
1108 | cabeceras.push({ | 1130 | cabeceras.push({ |
1109 | label: 'Puntos de descarga: ', | 1131 | label: 'Puntos de descarga: ', |
1110 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga)) | 1132 | valor: $filter('rellenarDigitos')(getCabeceraPuntoDescarga(puntosDescarga)) |
1111 | }); | 1133 | }); |
1112 | } | 1134 | } |
1113 | addArrayCabecera(cabeceras); | 1135 | addArrayCabecera(cabeceras); |
1114 | } | 1136 | } |
1115 | 1137 | ||
1116 | function getLSRemito() { | 1138 | function getLSRemito() { |
1117 | var remito = JSON.parse($localStorage.remito || null); | 1139 | var remito = JSON.parse($localStorage.remito || null); |
1118 | if (remito) { | 1140 | if (remito) { |
1119 | setearRemito(remito); | 1141 | setearRemito(remito); |
1120 | delete $localStorage.remito; | 1142 | delete $localStorage.remito; |
1121 | } | 1143 | } |
1122 | } | 1144 | } |
1123 | 1145 | ||
1124 | function deleteCliente() { | 1146 | function deleteCliente() { |
1125 | delete $scope.remito.domicilioStamp; | 1147 | delete $scope.remito.domicilioStamp; |
1126 | delete $scope.remito.puntosDescarga; | 1148 | delete $scope.remito.puntosDescarga; |
1127 | $scope.remito.domicilio = {dom: ''}; | 1149 | $scope.remito.domicilio = {dom: ''}; |
1128 | $scope.remito.cliente = {}; | 1150 | $scope.remito.cliente = {}; |
1129 | $scope.$broadcast('removeCabecera', 'Cliente:'); | 1151 | $scope.$broadcast('removeCabecera', 'Cliente:'); |
1130 | $scope.$broadcast('removeCabecera', 'Domicilio:'); | 1152 | $scope.$broadcast('removeCabecera', 'Domicilio:'); |
1131 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); | 1153 | $scope.$broadcast('removeCabecera', 'Puntos de descarga:'); |
1132 | } | 1154 | } |
1133 | 1155 | ||
1134 | function getCabeceraPuntoDescarga(puntosDescarga) { | 1156 | function getCabeceraPuntoDescarga(puntosDescarga) { |
1135 | var puntosStamp = ''; | 1157 | var puntosStamp = ''; |
1136 | puntosDescarga.forEach(function(punto, idx, arr) { | 1158 | puntosDescarga.forEach(function(punto, idx, arr) { |
1137 | puntosStamp += punto.descripcion; | 1159 | puntosStamp += punto.descripcion; |
1138 | if ((idx + 1) !== arr.length) puntosStamp += ', '; | 1160 | if ((idx + 1) !== arr.length) puntosStamp += ', '; |
1139 | }); | 1161 | }); |
1140 | return puntosStamp; | 1162 | return puntosStamp; |
1141 | } | 1163 | } |
1142 | 1164 | ||
1143 | function abrirModalMail(id, cliente, numeroRemito) { | 1165 | function abrirModalMail(id, cliente, numeroRemito) { |
1144 | focaModalService.mail( | 1166 | focaModalService.mail( |
1145 | { | 1167 | { |
1146 | titulo: 'Comprobante de remito Nº ' + numeroRemito, | 1168 | titulo: 'Comprobante de remito Nº ' + numeroRemito, |
1147 | descarga: { | 1169 | descarga: { |
1148 | nombre: numeroRemito + '.pdf', | 1170 | nombre: numeroRemito + '.pdf', |
1149 | url: '/remito/comprobante', | 1171 | url: '/remito/comprobante', |
1150 | }, | 1172 | }, |
1151 | envio: { | 1173 | envio: { |
1152 | mailCliente: cliente.MAIL, | 1174 | mailCliente: cliente.MAIL, |
1153 | url: '/remito/mail', | 1175 | url: '/remito/mail', |
1154 | }, | 1176 | }, |
1155 | options: { | 1177 | options: { |
1156 | idRemito: id | 1178 | idRemito: id |
1157 | } | 1179 | } |
1158 | } | 1180 | } |
1159 | ) | 1181 | ) |
1160 | .then(function(res) { | 1182 | .then(function(res) { |
src/js/service.js
1 | angular.module('focaCrearRemito') | 1 | angular.module('focaCrearRemito') |
2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', | 2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | 3 | function($http, API_ENDPOINT) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | crearRemito: function(remito) { | 6 | crearRemito: function(remito) { |
7 | // TODO: Cambiar para usar el servicio /remito | 7 | // TODO: Cambiar para usar el servicio /remito |
8 | return $http.post(route + '/remito', remito); | 8 | return $http.post(route + '/remito', remito); |
9 | }, | 9 | }, |
10 | getRemitoById: function(id) { | 10 | getRemitoById: function(id) { |
11 | return $http.get(route + '/remito/obtener/' + id); | 11 | return $http.get(route + '/remito/obtener/' + id); |
12 | }, | 12 | }, |
13 | obtenerRemito: function() { | 13 | obtenerRemito: function() { |
14 | return $http.get(route +'/nota-pedido'); | 14 | return $http.get(route +'/nota-pedido'); |
15 | }, | 15 | }, |
16 | setRemito: function(remito) { | 16 | setRemito: function(remito) { |
17 | this.remito = remito; | 17 | this.remito = remito; |
18 | }, | 18 | }, |
19 | clearRemito: function() { | 19 | clearRemito: function() { |
20 | this.remito = undefined; | 20 | this.remito = undefined; |
21 | }, | 21 | }, |
22 | getRemito: function() { | 22 | getRemito: function() { |
23 | return this.remito; | 23 | return this.remito; |
24 | }, | 24 | }, |
25 | getArticulosByIdRemito: function(id) { | 25 | getArticulosByIdRemito: function(id) { |
26 | return $http.get(route+'/articulos/nota-pedido/'+id); | 26 | return $http.get(route+'/articulos/nota-pedido/'+id); |
27 | }, | 27 | }, |
28 | crearArticulosParaRemito: function(articuloRemito) { | 28 | crearArticulosParaRemito: function(articuloRemito) { |
29 | return $http.post(route + '/articulos/remito', | 29 | return $http.post(route + '/articulos/remito', |
30 | {articuloRemito: articuloRemito}); | 30 | {articuloRemito: articuloRemito}); |
31 | }, | 31 | }, |
32 | getProveedorById: function(id) { | 32 | getProveedorById: function(id) { |
33 | return $http.get(API_ENDPOINT.URL + '/proveedor/' + id); | 33 | return $http.get(API_ENDPOINT.URL + '/proveedor/' + id); |
34 | }, | 34 | }, |
35 | getDomiciliosByIdRemito: function(id) { | 35 | getDomiciliosByIdRemito: function(id) { |
36 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 36 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
37 | }, | 37 | }, |
38 | getDomiciliosByIdCliente: function(id) { | 38 | getDomiciliosByIdCliente: function(id) { |
39 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 39 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
40 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 40 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
41 | }, | 41 | }, |
42 | getPrecioCondicion: function() { | 42 | getPrecioCondicion: function() { |
43 | return $http.get(route + '/precio-condicion'); | 43 | return $http.get(route + '/precio-condicion'); |
44 | }, | 44 | }, |
45 | getPrecioCondicionById: function(id) { | 45 | getPrecioCondicionById: function(id) { |
46 | return $http.get(route + '/precio-condicion/' + id); | 46 | return $http.get(route + '/precio-condicion/' + id); |
47 | }, | 47 | }, |
48 | getPlazoPagoByPrecioCondicion: function(id) { | 48 | getPlazoPagoByPrecioCondicion: function(id) { |
49 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 49 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
50 | }, | 50 | }, |
51 | crearFlete: function(flete) { | 51 | crearFlete: function(flete) { |
52 | return $http.post(route + '/flete', {flete : flete}); | 52 | return $http.post(route + '/flete', {flete : flete}); |
53 | }, | 53 | }, |
54 | crearPlazosParaRemito: function(plazos) { | 54 | crearPlazosParaRemito: function(plazos) { |
55 | return $http.post(route + '/plazo-pago/remito', plazos); | 55 | return $http.post(route + '/plazo-pago/remito', plazos); |
56 | }, | 56 | }, |
57 | getCotizacionByIdMoneda: function(id) { | 57 | getCotizacionByIdMoneda: function(id) { |
58 | return $http.get(route + '/moneda/' + id); | 58 | return $http.get(route + '/moneda/' + id); |
59 | }, | 59 | }, |
60 | crearEstadoParaRemito: function(estado) { | 60 | crearEstadoParaRemito: function(estado) { |
61 | return $http.post(route + '/estado', {estado: estado}); | 61 | return $http.post(route + '/estado', {estado: estado}); |
62 | }, | 62 | }, |
63 | getNumeroRemito: function() { | 63 | getNumeroRemito: function() { |
64 | return $http.get(route + '/remito/numero-siguiente'); | 64 | return $http.get(route + '/remito/numero-siguiente'); |
65 | }, | 65 | }, |
66 | imprimirRemitoByIdRemito: function(idRemito) { | 66 | imprimirRemitoByIdRemito: function(idRemito) { |
67 | return $http.get(route + '/remito/comprobante/' + idRemito , { | 67 | return $http.get(route + '/remito/comprobante/' + idRemito , { |
68 | responseType: 'arraybuffer' | 68 | responseType: 'arraybuffer' |
69 | }); | 69 | }); |
70 | }, | 70 | }, |
71 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 71 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { |
72 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 72 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + |
73 | idDomicilio + '/' + idCliente); | 73 | idDomicilio + '/' + idCliente); |
74 | }, | 74 | }, |
75 | enviarCorreo: function(options) { | 75 | enviarCorreo: function(options) { |
76 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); | 76 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); |
77 | }, | 77 | }, |
78 | getParametros: function() { | ||
79 | return $http.get(API_ENDPOINT.URL + '/parametros/remito'); | ||
80 | }, | ||
78 | getBotonera: function() { | 81 | getBotonera: function() { |
79 | return [ | 82 | return [ |
80 | { | 83 | { |
81 | label: 'Nota pedido', | 84 | label: 'Nota pedido', |
82 | image: 'notaDePedido.png' | 85 | image: 'notaDePedido.png' |
83 | }, | 86 | }, |
84 | { | 87 | { |
85 | label: 'Cliente', | 88 | label: 'Cliente', |
86 | image: 'cliente.png' | 89 | image: 'cliente.png' |
87 | }, | 90 | }, |
88 | { | 91 | { |
89 | label: 'Proveedor', | 92 | label: 'Proveedor', |
90 | image: 'proveedor.png' | 93 | image: 'proveedor.png' |
91 | }, | 94 | }, |
92 | { | 95 | { |
93 | label: 'Moneda', | 96 | label: 'Moneda', |
94 | image: 'moneda.png' | 97 | image: 'moneda.png' |
95 | }, | 98 | }, |
96 | { | 99 | { |
97 | label: 'Precios y condiciones', | 100 | label: 'Precios y condiciones', |
98 | image: 'precios-condiciones.png' | 101 | image: 'precios-condiciones.png' |
99 | }, | 102 | }, |
100 | { | 103 | { |
101 | label: 'Productos', | 104 | label: 'Productos', |
102 | image: 'productos.png' | 105 | image: 'productos.png' |
103 | }, | 106 | }, |
104 | { | 107 | { |
105 | label: 'Observaciones', | 108 | label: 'Observaciones', |
106 | image: 'botonObservaciones.png', | 109 | image: 'botonObservaciones.png', |
107 | disable: true | 110 | disable: true |
108 | } | 111 | } |
109 | ]; | 112 | ]; |
110 | } | 113 | } |
111 | }; | 114 | }; |
112 | }]); | 115 | }]); |
113 | 116 |