Commit d4c36c663d8014bee2725f512a95e020697ca237

Authored by Jose Pinto
1 parent b09c4c16e2
Exists in master

agrego clase, arreglo responsive

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