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