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