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