Commit b2e4038d7350aaf29be0191f18aaa2c446ee46cb

Authored by Pablo Marco del Pont
Exists in master and in 1 other branch develop

Merge branch 'master' into 'master'

Master

See merge request modulos-npm/foca-crear-remito!8
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', 4 'focaModalService', 'remitoBusinessService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, 6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService,
7 remitoBusinessService 7 remitoBusinessService
8 ) { 8 ) {
9 $scope.botonera = [ 9 $scope.botonera = [
10 {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, 10 {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}},
11 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, 11 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
12 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, 12 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
13 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, 13 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}},
14 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, 14 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
15 { 15 {
16 texto: 'Precios y condiciones', 16 texto: 'Precios y condiciones',
17 accion: function() {$scope.abrirModalListaPrecio();}}, 17 accion: function() {$scope.abrirModalListaPrecio();}},
18 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, 18 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
19 {texto: '', accion: function() {}} 19 {texto: '', accion: function() {}}
20 ]; 20 ];
21 $scope.datepickerAbierto = false; 21 $scope.datepickerAbierto = false;
22 22
23 $scope.show = false; 23 $scope.show = false;
24 $scope.cargando = true; 24 $scope.cargando = true;
25 $scope.dateOptions = { 25 $scope.dateOptions = {
26 maxDate: new Date(), 26 maxDate: new Date(),
27 minDate: new Date(2010, 0, 1) 27 minDate: new Date(2010, 0, 1)
28 }; 28 };
29 29
30 $scope.remito = { 30 $scope.remito = {
31 vendedor: {}, 31 vendedor: {},
32 cliente: {}, 32 cliente: {},
33 proveedor: {}, 33 proveedor: {},
34 domicilio: {dom: ''}, 34 domicilio: {dom: ''},
35 moneda: {}, 35 moneda: {},
36 cotizacion: {} 36 cotizacion: {}
37 }; 37 };
38 var monedaPorDefecto; 38 var monedaPorDefecto;
39 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 39 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
40 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { 40 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) {
41 monedaPorDefecto = { 41 monedaPorDefecto = {
42 id: res.data[0].ID, 42 id: res.data[0].ID,
43 detalle: res.data[0].DETALLE, 43 detalle: res.data[0].DETALLE,
44 simbolo: res.data[0].SIMBOLO, 44 simbolo: res.data[0].SIMBOLO,
45 cotizaciones: res.data[0].cotizaciones 45 cotizaciones: res.data[0].cotizaciones
46 }; 46 };
47 addCabecera('Moneda:', monedaPorDefecto.detalle); 47 addCabecera('Moneda:', monedaPorDefecto.detalle);
48 addCabecera('Fecha cotizacion:', 48 addCabecera('Fecha cotizacion:',
49 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); 49 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString());
50 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); 50 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION);
51 $scope.remito.moneda = monedaPorDefecto; 51 $scope.remito.moneda = monedaPorDefecto;
52 $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; 52 $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0];
53 }); 53 });
54 54
55 $scope.cabecera = []; 55 $scope.cabecera = [];
56 $scope.showCabecera = true; 56 $scope.showCabecera = true;
57 57
58 $scope.now = new Date(); 58 $scope.now = new Date();
59 $scope.puntoVenta = Math.round(Math.random() * 10000); 59 $scope.puntoVenta = Math.round(Math.random() * 10000);
60 $scope.comprobante = Math.round(Math.random() * 1000000); 60 $scope.comprobante = Math.round(Math.random() * 1000000);
61 61
62 $scope.articulosTabla = []; 62 $scope.articulosTabla = [];
63 $scope.idLista = undefined; 63 $scope.idLista = undefined;
64 //La pantalla solo se usa para cargar remitos 64 //La pantalla solo se usa para cargar remitos
65 //var remitoTemp = crearRemitoService.getRemito(); 65 //var remitoTemp = crearRemitoService.getRemito();
66 66
67 crearRemitoService.getPrecioCondicion().then( 67 crearRemitoService.getPrecioCondicion().then(
68 function(res) { 68 function(res) {
69 $scope.precioCondiciones = res.data; 69 $scope.precioCondiciones = res.data;
70 } 70 }
71 ); 71 );
72 72
73 crearRemitoService.getNumeroRemito().then( 73 crearRemitoService.getNumeroRemito().then(
74 function(res) { 74 function(res) {
75 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 75 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); 76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8);
77 }, 77 },
78 function(err) { 78 function(err) {
79 focaModalService.alert('La terminal no esta configurada correctamente'); 79 focaModalService.alert('La terminal no esta configurada correctamente');
80 console.info(err); 80 console.info(err);
81 } 81 }
82 ); 82 );
83 83
84 $scope.seleccionarNotaPedido = function() { 84 $scope.seleccionarNotaPedido = function() {
85 var modalInstance = $uibModal.open( 85 var modalInstance = $uibModal.open(
86 { 86 {
87 ariaLabelledBy: 'Busqueda de Nota de Pedido', 87 ariaLabelledBy: 'Busqueda de Nota de Pedido',
88 templateUrl: 'foca-modal-nota-pedido.html', 88 templateUrl: 'foca-modal-nota-pedido.html',
89 controller: 'focaModalNotaPedidoController', 89 controller: 'focaModalNotaPedidoController',
90 size: 'lg' 90 size: 'lg'
91 } 91 }
92 ); 92 );
93 modalInstance.result.then( 93 modalInstance.result.then(
94 function(notaPedido) { 94 function(notaPedido) {
95 //añado cabeceras 95 //añado cabeceras
96 removeCabecera('Moneda:'); 96 removeCabecera('Moneda:');
97 removeCabecera('Fecha cotizacion:'); 97 removeCabecera('Fecha cotizacion:');
98 removeCabecera('Cotizacion:'); 98 removeCabecera('Cotizacion:');
99 var cabeceras = [ 99 var cabeceras = [
100 { 100 {
101 label: 'Moneda', 101 label: 'Moneda',
102 valor: notaPedido.cotizacion[0].moneda[0].DETALLE 102 valor: notaPedido.cotizacion[0].moneda[0].DETALLE
103 }, 103 },
104 { 104 {
105 label: 'Fecha cotizacion', 105 label: 'Fecha cotizacion',
106 valor: $filter('date')(notaPedido.cotizacion[0].FECHA, 106 valor: $filter('date')(notaPedido.cotizacion[0].FECHA,
107 'dd/MM/yyyy') 107 'dd/MM/yyyy')
108 }, 108 },
109 { 109 {
110 label: 'Cotizacion', 110 label: 'Cotizacion',
111 valor: notaPedido.cotizacion[0].VENDEDOR 111 valor: notaPedido.cotizacion[0].VENDEDOR
112 }, 112 },
113 { 113 {
114 label: 'Cliente:', 114 label: 'Cliente:',
115 valor: notaPedido.cliente[0].NOM 115 valor: notaPedido.cliente[0].NOM
116 }, 116 },
117 { 117 {
118 label: 'Vendedor:', 118 label: 'Vendedor:',
119 valor: notaPedido.vendedor[0].NomVen 119 valor: notaPedido.vendedor[0].NomVen
120 }, 120 },
121 { 121 {
122 label: 'Proveedor:', 122 label: 'Proveedor:',
123 valor: notaPedido.proveedor[0].NOM 123 valor: notaPedido.proveedor[0].NOM
124 }, 124 },
125 { 125 {
126 label: 'Flete:', 126 label: 'Flete:',
127 valor: notaPedido.flete === 1 ? 'Si' : 'No' 127 valor: notaPedido.flete === 1 ? 'Si' : 'No'
128 }, 128 },
129 { 129 {
130 label: 'FOB:', 130 label: 'FOB:',
131 valor: notaPedido.fob === 1 ? 'Si' : 'No' 131 valor: notaPedido.fob === 1 ? 'Si' : 'No'
132 }, 132 },
133 { 133 {
134 label: 'Precio condicion:', 134 label: 'Precio condicion:',
135 valor: valorPrecioCondicion() 135 valor: valorPrecioCondicion()
136 } 136 }
137 ]; 137 ];
138 //TO DO CUANDO MOSTRAR PLAZOS 138 //TO DO CUANDO MOSTRAR PLAZOS
139 function valorPrecioCondicion() { 139 function valorPrecioCondicion() {
140 if(notaPedido.idPrecioCondicion > 0) { 140 if(notaPedido.idPrecioCondicion > 0) {
141 return notaPedido.precioCondicion[0].nombre; 141 return notaPedido.precioCondicion[0].nombre;
142 } else { 142 } else {
143 return 'Ingreso Manual'; 143 return 'Ingreso Manual';
144 } 144 }
145 145
146 } 146 }
147 147
148 if(notaPedido.flete === 1) { 148 if(notaPedido.flete === 1) {
149 var cabeceraBomba = { 149 var cabeceraBomba = {
150 label: 'Bomba', 150 label: 'Bomba',
151 valor: notaPedido.bomba === 1 ? 'Si' : 'No' 151 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
152 }; 152 };
153 if(notaPedido.kilometros) { 153 if(notaPedido.kilometros) {
154 var cabeceraKilometros = { 154 var cabeceraKilometros = {
155 label: 'Kilometros', 155 label: 'Kilometros',
156 valor: notaPedido.kilometros 156 valor: notaPedido.kilometros
157 }; 157 };
158 cabeceras.push(cabeceraKilometros); 158 cabeceras.push(cabeceraKilometros);
159 } 159 }
160 cabeceras.push(cabeceraBomba); 160 cabeceras.push(cabeceraBomba);
161 } 161 }
162 $scope.articulosTabla = notaPedido.articulosNotaPedido; 162 $scope.articulosTabla = notaPedido.articulosNotaPedido;
163 $scope.remito = notaPedido; 163 $scope.remito = notaPedido;
164 addArrayCabecera(cabeceras); 164 addArrayCabecera(cabeceras);
165 165
166 }, function() { 166 }, function() {
167 // funcion ejecutada cuando se cancela el modal 167 // funcion ejecutada cuando se cancela el modal
168 } 168 }
169 ); 169 );
170 }; 170 };
171 171
172 $scope.seleccionarRemito = function() { 172 $scope.seleccionarRemito = function() {
173 var modalInstance = $uibModal.open( 173 var modalInstance = $uibModal.open(
174 { 174 {
175 ariaLabelledBy: 'Busqueda de Remito', 175 ariaLabelledBy: 'Busqueda de Remito',
176 templateUrl: 'foca-modal-remito.html', 176 templateUrl: 'foca-modal-remito.html',
177 controller: 'focaModalRemitoController', 177 controller: 'focaModalRemitoController',
178 size: 'lg' 178 size: 'lg'
179 } 179 }
180 ); 180 );
181 modalInstance.result.then( 181 modalInstance.result.then(
182 function() { 182 function() {
183 // TODO: Implementar carga remito 183 // TODO: Implementar carga remito
184 }, function() { 184 }, function() {
185 // funcion ejecutada cuando se cancela el modal 185 // funcion ejecutada cuando se cancela el modal
186 } 186 }
187 ); 187 );
188 }; 188 };
189 189
190 //La pantalla solo se usa para cargar remitos 190 //La pantalla solo se usa para cargar remitos
191 // if (remitoTemp !== undefined) { 191 // if (remitoTemp !== undefined) {
192 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); 192 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga);
193 // $scope.remito = remitoTemp; 193 // $scope.remito = remitoTemp;
194 // $scope.remito.flete = ($scope.remito.flete).toString(); 194 // $scope.remito.flete = ($scope.remito.flete).toString();
195 // $scope.remito.bomba = ($scope.remito.bomba).toString(); 195 // $scope.remito.bomba = ($scope.remito.bomba).toString();
196 // $scope.idLista = $scope.remito.precioCondicion; 196 // $scope.idLista = $scope.remito.precioCondicion;
197 // crearRemitoService 197 // crearRemitoService
198 // .getArticulosByIdRemito($scope.remito.id).then( 198 // .getArticulosByIdRemito($scope.remito.id).then(
199 // function(res) { 199 // function(res) {
200 // $scope.articulosTabla = res.data; 200 // $scope.articulosTabla = res.data;
201 // } 201 // }
202 // ); 202 // );
203 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO 203 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO
204 //(NO REQUERIDO EN ESTA VERSION) 204 //(NO REQUERIDO EN ESTA VERSION)
205 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( 205 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then(
206 // function(res) { 206 // function(res) {
207 // $scope.remito.domicilio = res.data; 207 // $scope.remito.domicilio = res.data;
208 // } 208 // }
209 // ); 209 // );
210 // } else { 210 // } else {
211 // $scope.remito.fechaCarga = new Date(); 211 // $scope.remito.fechaCarga = new Date();
212 // $scope.remito.bomba = '0'; 212 // $scope.remito.bomba = '0';
213 // $scope.remito.flete = '0'; 213 // $scope.remito.flete = '0';
214 // $scope.idLista = undefined; 214 // $scope.idLista = undefined;
215 // } 215 // }
216 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 216 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
217 // $scope.addNewDom = function() { 217 // $scope.addNewDom = function() {
218 // $scope.remito.domicilio.push({ 'id': 0 }); 218 // $scope.remito.domicilio.push({ 'id': 0 });
219 // }; 219 // };
220 // $scope.removeNewChoice = function(choice) { 220 // $scope.removeNewChoice = function(choice) {
221 // if ($scope.remito.domicilio.length > 1) { 221 // if ($scope.remito.domicilio.length > 1) {
222 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( 222 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex(
223 // function(c) { 223 // function(c) {
224 // return c.$$hashKey === choice.$$hashKey; 224 // return c.$$hashKey === choice.$$hashKey;
225 // } 225 // }
226 // ), 1); 226 // ), 1);
227 // } 227 // }
228 // }; 228 // };
229 229
230 $scope.crearRemito = function() { 230 $scope.crearRemito = function() {
231 if(!$scope.remito.vendedor.codigo) { 231 if(!$scope.remito.vendedor.codigo) {
232 focaModalService.alert('Ingrese Vendedor'); 232 focaModalService.alert('Ingrese Vendedor');
233 return; 233 return;
234 } else if(!$scope.remito.cliente.cod) { 234 } else if(!$scope.remito.cliente.cod) {
235 focaModalService.alert('Ingrese Cliente'); 235 focaModalService.alert('Ingrese Cliente');
236 return; 236 return;
237 } else if(!$scope.remito.proveedor.codigo) { 237 } else if(!$scope.remito.proveedor.codigo) {
238 focaModalService.alert('Ingrese Proveedor'); 238 focaModalService.alert('Ingrese Proveedor');
239 return; 239 return;
240 } else if(!$scope.remito.moneda.id) { 240 } else if(!$scope.remito.moneda.id) {
241 focaModalService.alert('Ingrese Moneda'); 241 focaModalService.alert('Ingrese Moneda');
242 return; 242 return;
243 } else if(!$scope.remito.cotizacion.ID) { 243 } else if(!$scope.remito.cotizacion.ID) {
244 focaModalService.alert('Ingrese Cotización'); 244 focaModalService.alert('Ingrese Cotización');
245 return; 245 return;
246 } else if(!$scope.plazosPagos) { 246 } else if(!$scope.plazosPagos) {
247 focaModalService.alert('Ingrese Precios y Condiciones'); 247 focaModalService.alert('Ingrese Precios y Condiciones');
248 return; 248 return;
249 } else if( 249 } else if(
250 $scope.remito.flete === undefined || $scope.remito.flete === null) 250 $scope.remito.flete === undefined || $scope.remito.flete === null)
251 { 251 {
252 focaModalService.alert('Ingrese Flete'); 252 focaModalService.alert('Ingrese Flete');
253 return; 253 return;
254 } else if(!$scope.remito.domicilio.id) { 254 } else if(!$scope.remito.domicilio.id) {
255 focaModalService.alert('Ingrese Domicilio'); 255 focaModalService.alert('Ingrese Domicilio');
256 return; 256 return;
257 } else if($scope.articulosTabla.length === 0) { 257 } else if($scope.articulosTabla.length === 0) {
258 focaModalService.alert('Debe cargar al menos un articulo'); 258 focaModalService.alert('Debe cargar al menos un articulo');
259 return; 259 return;
260 } 260 }
261 var date = new Date(); 261 var date = new Date();
262 var remito = { 262 var remito = {
263 id: 0, 263 id: 0,
264 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 264 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
265 .toISOString().slice(0, 19).replace('T', ' '), 265 .toISOString().slice(0, 19).replace('T', ' '),
266 idVendedor: $scope.remito.vendedor.codigo, 266 idVendedor: $scope.remito.vendedor.codigo,
267 idCliente: $scope.remito.cliente.cod, 267 idCliente: $scope.remito.cliente.cod,
268 nombreCliente: $scope.remito.cliente.nom, 268 nombreCliente: $scope.remito.cliente.nom,
269 cuitCliente: $scope.remito.cliente.cuit, 269 cuitCliente: $scope.remito.cliente.cuit,
270 idProveedor: $scope.remito.proveedor.codigo, 270 idProveedor: $scope.remito.proveedor.codigo,
271 idDomicilio: $scope.remito.domicilio.id, 271 idDomicilio: $scope.remito.domicilio.id,
272 idCotizacion: $scope.remito.cotizacion.ID, 272 idCotizacion: $scope.remito.cotizacion.ID,
273 cotizacion: $scope.remito.cotizacion.COTIZACION, 273 cotizacion: $scope.remito.cotizacion.COTIZACION,
274 flete: $scope.remito.flete, 274 flete: $scope.remito.flete,
275 fob: $scope.remito.fob, 275 fob: $scope.remito.fob,
276 bomba: $scope.remito.bomba, 276 bomba: $scope.remito.bomba,
277 kilometros: $scope.remito.kilometros, 277 kilometros: $scope.remito.kilometros,
278 estado: 0, 278 estado: 0,
279 total: $scope.getTotal() 279 total: $scope.getTotal()
280 }; 280 };
281 crearRemitoService.crearRemito(remito).then( 281 crearRemitoService.crearRemito(remito).then(
282 function(data) { 282 function(data) {
283 remitoBusinessService.addArticulos($scope.articulosTabla, 283 remitoBusinessService.addArticulos($scope.articulosTabla,
284 data.data.id, $scope.remito.cotizacion.COTIZACION); 284 data.data.id, $scope.remito.cotizacion.COTIZACION);
285 var plazos = $scope.plazosPagos; 285 var plazos = $scope.plazosPagos;
286 for(var j = 0; j < plazos.length; j++) { 286 for(var j = 0; j < plazos.length; j++) {
287 var json = { 287 var json = {
288 idRemito: data.data.id, 288 idRemito: data.data.id,
289 dias: plazos[j].dias 289 dias: plazos[j].dias
290 }; 290 };
291 crearRemitoService.crearPlazosParaRemito(json); 291 crearRemitoService.crearPlazosParaRemito(json);
292 } 292 }
293 remitoBusinessService.addEstado(data.data.id, 293 remitoBusinessService.addEstado(data.data.id,
294 $scope.remito.vendedor.codigo); 294 $scope.remito.vendedor.codigo);
295 295
296 focaModalService.alert('Nota remito creada'); 296 focaModalService.alert('Nota remito creada');
297 $scope.cabecera = []; 297 $scope.cabecera = [];
298 addCabecera('Moneda:', $scope.remito.moneda.detalle); 298 addCabecera('Moneda:', $scope.remito.moneda.detalle);
299 addCabecera( 299 addCabecera(
300 'Fecha cotizacion:', 300 'Fecha cotizacion:',
301 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') 301 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
302 ); 302 );
303 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); 303 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION);
304 $scope.remito.vendedor = {}; 304 $scope.remito.vendedor = {};
305 $scope.remito.cliente = {}; 305 $scope.remito.cliente = {};
306 $scope.remito.proveedor = {}; 306 $scope.remito.proveedor = {};
307 $scope.remito.domicilio = {}; 307 $scope.remito.domicilio = {};
308 $scope.remito.flete = null; 308 $scope.remito.flete = null;
309 $scope.remito.fob = null; 309 $scope.remito.fob = null;
310 $scope.remito.bomba = null; 310 $scope.remito.bomba = null;
311 $scope.remito.kilometros = null; 311 $scope.remito.kilometros = null;
312 $scope.articulosTabla = []; 312 $scope.articulosTabla = [];
313 } 313 }
314 ); 314 );
315 }; 315 };
316 316
317 $scope.seleccionarArticulo = function() { 317 $scope.seleccionarArticulo = function() {
318 if ($scope.idLista === undefined) { 318 if ($scope.idLista === undefined) {
319 focaModalService.alert( 319 focaModalService.alert(
320 'Primero seleccione una lista de precio y condicion'); 320 'Primero seleccione una lista de precio y condicion');
321 return; 321 return;
322 } 322 }
323 var modalInstance = $uibModal.open( 323 var modalInstance = $uibModal.open(
324 { 324 {
325 ariaLabelledBy: 'Busqueda de Productos', 325 ariaLabelledBy: 'Busqueda de Productos',
326 templateUrl: 'modal-busqueda-productos.html', 326 templateUrl: 'modal-busqueda-productos.html',
327 controller: 'modalBusquedaProductosCtrl', 327 controller: 'modalBusquedaProductosCtrl',
328 resolve: { 328 resolve: {
329 parametroProducto: { 329 parametroProducto: {
330 idLista: $scope.idLista, 330 idLista: $scope.idLista,
331 cotizacion: $scope.remito.cotizacion.COTIZACION, 331 cotizacion: $scope.remito.cotizacion.COTIZACION,
332 simbolo: $scope.remito.moneda.simbolo 332 simbolo: $scope.remito.moneda.simbolo
333 } 333 }
334 }, 334 },
335 size: 'lg' 335 size: 'lg'
336 } 336 }
337 ); 337 );
338 modalInstance.result.then( 338 modalInstance.result.then(
339 function(producto) { 339 function(producto) {
340 var newArt = 340 var newArt =
341 { 341 {
342 id: 0, 342 id: 0,
343 codigo: producto.codigo, 343 codigo: producto.codigo,
344 sector: producto.sector, 344 sector: producto.sector,
345 sectorCodigo: producto.sector + '-' + producto.codigo, 345 sectorCodigo: producto.sector + '-' + producto.codigo,
346 descripcion: producto.descripcion, 346 descripcion: producto.descripcion,
347 item: $scope.articulosTabla.length + 1, 347 item: $scope.articulosTabla.length + 1,
348 nombre: producto.descripcion, 348 nombre: producto.descripcion,
349 precio: parseFloat(producto.precio.toFixed(4)), 349 precio: parseFloat(producto.precio.toFixed(4)),
350 costoUnitario: producto.costo, 350 costoUnitario: producto.costo,
351 editCantidad: false, 351 editCantidad: false,
352 editPrecio: false 352 editPrecio: false
353 }; 353 };
354 $scope.articuloACargar = newArt; 354 $scope.articuloACargar = newArt;
355 $scope.cargando = false; 355 $scope.cargando = false;
356 }, function() { 356 }, function() {
357 // funcion ejecutada cuando se cancela el modal 357 // funcion ejecutada cuando se cancela el modal
358 } 358 }
359 ); 359 );
360 }; 360 };
361 361
362 $scope.seleccionarVendedor = function() { 362 $scope.seleccionarVendedor = function() {
363 var modalInstance = $uibModal.open( 363 var modalInstance = $uibModal.open(
364 { 364 {
365 ariaLabelledBy: 'Busqueda de Vendedores', 365 ariaLabelledBy: 'Busqueda de Vendedores',
366 templateUrl: 'modal-vendedores.html', 366 templateUrl: 'modal-vendedores.html',
367 controller: 'modalVendedoresCtrl', 367 controller: 'modalVendedoresCtrl',
368 size: 'lg' 368 size: 'lg'
369 } 369 }
370 ); 370 );
371 modalInstance.result.then( 371 modalInstance.result.then(
372 function(vendedor) { 372 function(vendedor) {
373 addCabecera('Vendedor:', vendedor.NomVen); 373 addCabecera('Vendedor:', vendedor.NomVen);
374 $scope.remito.vendedor.codigo = vendedor.CodVen; 374 $scope.remito.vendedor.codigo = vendedor.CodVen;
375 }, function() { 375 }, function() {
376 376
377 } 377 }
378 ); 378 );
379 }; 379 };
380 380
381 $scope.seleccionarProveedor = function() { 381 $scope.seleccionarProveedor = function() {
382 var modalInstance = $uibModal.open( 382 var modalInstance = $uibModal.open(
383 { 383 {
384 ariaLabelledBy: 'Busqueda de Proveedor', 384 ariaLabelledBy: 'Busqueda de Proveedor',
385 templateUrl: 'modal-proveedor.html', 385 templateUrl: 'modal-proveedor.html',
386 controller: 'focaModalProveedorCtrl', 386 controller: 'focaModalProveedorCtrl',
387 size: 'lg' 387 size: 'lg',
388 resolve: {
389 transportista: function() {
390 return false;
391 }
392 }
388 } 393 }
389 ); 394 );
390 modalInstance.result.then( 395 modalInstance.result.then(
391 function(proveedor) { 396 function(proveedor) {
392 $scope.remito.proveedor.codigo = proveedor.COD; 397 $scope.remito.proveedor.codigo = proveedor.COD;
393 addCabecera('Proveedor:', proveedor.NOM); 398 addCabecera('Proveedor:', proveedor.NOM);
394 }, function() { 399 }, function() {
395 400
396 } 401 }
397 ); 402 );
398 }; 403 };
399 404
400 $scope.seleccionarCliente = function() { 405 $scope.seleccionarCliente = function() {
401 406
402 var modalInstance = $uibModal.open( 407 var modalInstance = $uibModal.open(
403 { 408 {
404 ariaLabelledBy: 'Busqueda de Cliente', 409 ariaLabelledBy: 'Busqueda de Cliente',
405 templateUrl: 'foca-busqueda-cliente-modal.html', 410 templateUrl: 'foca-busqueda-cliente-modal.html',
406 controller: 'focaBusquedaClienteModalController', 411 controller: 'focaBusquedaClienteModalController',
407 size: 'lg' 412 size: 'lg'
408 } 413 }
409 ); 414 );
410 modalInstance.result.then( 415 modalInstance.result.then(
411 function(cliente) { 416 function(cliente) {
412 $scope.abrirModalDomicilios(cliente); 417 $scope.abrirModalDomicilios(cliente);
413 }, function() { 418 }, function() {
414 419
415 } 420 }
416 ); 421 );
417 }; 422 };
418 423
419 $scope.abrirModalDomicilios = function(cliente) { 424 $scope.abrirModalDomicilios = function(cliente) {
420 var modalInstanceDomicilio = $uibModal.open( 425 var modalInstanceDomicilio = $uibModal.open(
421 { 426 {
422 ariaLabelledBy: 'Busqueda de Domicilios', 427 ariaLabelledBy: 'Busqueda de Domicilios',
423 templateUrl: 'modal-domicilio.html', 428 templateUrl: 'modal-domicilio.html',
424 controller: 'focaModalDomicilioController', 429 controller: 'focaModalDomicilioController',
425 resolve: { idCliente: function() { return cliente.cod; }}, 430 resolve: { idCliente: function() { return cliente.cod; }},
426 size: 'lg', 431 size: 'lg',
427 } 432 }
428 ); 433 );
429 modalInstanceDomicilio.result.then( 434 modalInstanceDomicilio.result.then(
430 function(domicilio) { 435 function(domicilio) {
431 $scope.remito.domicilio.id = domicilio.nivel2; 436 $scope.remito.domicilio.id = domicilio.nivel2;
432 $scope.remito.cliente = cliente; 437 $scope.remito.cliente = cliente;
433 438
434 addCabecera('Cliente:', cliente.nom); 439 addCabecera('Cliente:', cliente.nom);
435 addCabecera('Domicilio:', domicilio.dom); 440 addCabecera('Domicilio:', domicilio.dom);
436 }, function() { 441 }, function() {
437 $scope.seleccionarCliente(); 442 $scope.seleccionarCliente();
438 return; 443 return;
439 } 444 }
440 ); 445 );
441 }; 446 };
442 447
443 $scope.mostrarFichaCliente = function() { 448 $scope.mostrarFichaCliente = function() {
444 $uibModal.open( 449 $uibModal.open(
445 { 450 {
446 ariaLabelledBy: 'Datos del Cliente', 451 ariaLabelledBy: 'Datos del Cliente',
447 templateUrl: 'foca-crear-remito-ficha-cliente.html', 452 templateUrl: 'foca-crear-remito-ficha-cliente.html',
448 controller: 'focaCrearRemitoFichaClienteController', 453 controller: 'focaCrearRemitoFichaClienteController',
449 size: 'lg' 454 size: 'lg'
450 } 455 }
451 ); 456 );
452 }; 457 };
453 458
454 $scope.getTotal = function() { 459 $scope.getTotal = function() {
455 var total = 0; 460 var total = 0;
456 var arrayTempArticulos = $scope.articulosTabla; 461 var arrayTempArticulos = $scope.articulosTabla;
457 for (var i = 0; i < arrayTempArticulos.length; i++) { 462 for (var i = 0; i < arrayTempArticulos.length; i++) {
458 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 463 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
459 } 464 }
460 return parseFloat(total.toFixed(2)); 465 return parseFloat(total.toFixed(2));
461 }; 466 };
462 467
463 $scope.getSubTotal = function() { 468 $scope.getSubTotal = function() {
464 if($scope.articuloACargar) { 469 if($scope.articuloACargar) {
465 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 470 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
466 } 471 }
467 }; 472 };
468 473
469 $scope.abrirModalListaPrecio = function() { 474 $scope.abrirModalListaPrecio = function() {
470 var modalInstance = $uibModal.open( 475 var modalInstance = $uibModal.open(
471 { 476 {
472 ariaLabelledBy: 'Busqueda de Precio Condición', 477 ariaLabelledBy: 'Busqueda de Precio Condición',
473 templateUrl: 'modal-precio-condicion.html', 478 templateUrl: 'modal-precio-condicion.html',
474 controller: 'focaModalPrecioCondicionController', 479 controller: 'focaModalPrecioCondicionController',
475 size: 'lg' 480 size: 'lg'
476 } 481 }
477 ); 482 );
478 modalInstance.result.then( 483 modalInstance.result.then(
479 function(precioCondicion) { 484 function(precioCondicion) {
480 var cabecera = ''; 485 var cabecera = '';
481 var plazosConcat = ''; 486 var plazosConcat = '';
482 if(!Array.isArray(precioCondicion)) { 487 if(!Array.isArray(precioCondicion)) {
483 $scope.plazosPagos = precioCondicion.plazoPago; 488 $scope.plazosPagos = precioCondicion.plazoPago;
484 $scope.idLista = precioCondicion.idListaPrecio; 489 $scope.idLista = precioCondicion.idListaPrecio;
485 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 490 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
486 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 491 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
487 } 492 }
488 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 493 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
489 } else { //Cuando se ingresan los plazos manualmente 494 } else { //Cuando se ingresan los plazos manualmente
490 $scope.idLista = -1; //-1, el modal productos busca todos los productos 495 $scope.idLista = -1; //-1, el modal productos busca todos los productos
491 $scope.plazosPagos = precioCondicion; 496 $scope.plazosPagos = precioCondicion;
492 for(var j = 0; j < precioCondicion.length; j++) { 497 for(var j = 0; j < precioCondicion.length; j++) {
493 plazosConcat += precioCondicion[j].dias + ' '; 498 plazosConcat += precioCondicion[j].dias + ' ';
494 } 499 }
495 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 500 cabecera = 'Ingreso manual ' + plazosConcat.trim();
496 } 501 }
497 $scope.articulosTabla = []; 502 $scope.articulosTabla = [];
498 addCabecera('Precios y condiciones:', cabecera); 503 addCabecera('Precios y condiciones:', cabecera);
499 }, function() { 504 }, function() {
500 505
501 } 506 }
502 ); 507 );
503 }; 508 };
504 509
505 $scope.abrirModalFlete = function() { 510 $scope.abrirModalFlete = function() {
506 var modalInstance = $uibModal.open( 511 var modalInstance = $uibModal.open(
507 { 512 {
508 ariaLabelledBy: 'Busqueda de Flete', 513 ariaLabelledBy: 'Busqueda de Flete',
509 templateUrl: 'modal-flete.html', 514 templateUrl: 'modal-flete.html',
510 controller: 'focaModalFleteController', 515 controller: 'focaModalFleteController',
511 size: 'lg', 516 size: 'lg',
512 resolve: { 517 resolve: {
513 parametrosFlete: 518 parametrosFlete:
514 function() { 519 function() {
515 return { 520 return {
516 flete: $scope.remito.flete ? '1' : 521 flete: $scope.remito.flete ? '1' :
517 ($scope.remito.fob ? 'FOB' : 522 ($scope.remito.fob ? 'FOB' :
518 ($scope.remito.flete === undefined ? null : '0')), 523 ($scope.remito.flete === undefined ? null : '0')),
519 bomba: $scope.remito.bomba ? '1' : 524 bomba: $scope.remito.bomba ? '1' :
520 ($scope.remito.bomba === undefined ? null : '0'), 525 ($scope.remito.bomba === undefined ? null : '0'),
521 kilometros: $scope.remito.kilometros 526 kilometros: $scope.remito.kilometros
522 }; 527 };
523 } 528 }
524 } 529 }
525 } 530 }
526 ); 531 );
527 modalInstance.result.then( 532 modalInstance.result.then(
528 function(datos) { 533 function(datos) {
529 $scope.remito.flete = datos.flete; 534 $scope.remito.flete = datos.flete;
530 $scope.remito.fob = datos.FOB; 535 $scope.remito.fob = datos.FOB;
531 $scope.remito.bomba = datos.bomba; 536 $scope.remito.bomba = datos.bomba;
532 $scope.remito.kilometros = datos.kilometros; 537 $scope.remito.kilometros = datos.kilometros;
533 538
534 addCabecera('Flete:', datos.flete ? 'Si' : 539 addCabecera('Flete:', datos.flete ? 'Si' :
535 ($scope.remito.fob ? 'FOB' : 'No')); 540 ($scope.remito.fob ? 'FOB' : 'No'));
536 if(datos.flete) { 541 if(datos.flete) {
537 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 542 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
538 addCabecera('Kilometros:', datos.kilometros); 543 addCabecera('Kilometros:', datos.kilometros);
539 } else { 544 } else {
540 removeCabecera('Bomba:'); 545 removeCabecera('Bomba:');
541 removeCabecera('Kilometros:'); 546 removeCabecera('Kilometros:');
542 $scope.remito.fob = false; 547 $scope.remito.fob = false;
543 $scope.remito.bomba = false; 548 $scope.remito.bomba = false;
544 $scope.remito.kilometros = null; 549 $scope.remito.kilometros = null;
545 } 550 }
546 }, function() { 551 }, function() {
547 552
548 } 553 }
549 ); 554 );
550 }; 555 };
551 556
552 $scope.abrirModalMoneda = function() { 557 $scope.abrirModalMoneda = function() {
553 var modalInstance = $uibModal.open( 558 var modalInstance = $uibModal.open(
554 { 559 {
555 ariaLabelledBy: 'Busqueda de Moneda', 560 ariaLabelledBy: 'Busqueda de Moneda',
556 templateUrl: 'modal-moneda.html', 561 templateUrl: 'modal-moneda.html',
557 controller: 'focaModalMonedaController', 562 controller: 'focaModalMonedaController',
558 size: 'lg' 563 size: 'lg'
559 } 564 }
560 ); 565 );
561 modalInstance.result.then( 566 modalInstance.result.then(
562 function(moneda) { 567 function(moneda) {
563 $scope.abrirModalCotizacion(moneda); 568 $scope.abrirModalCotizacion(moneda);
564 }, function() { 569 }, function() {
565 570
566 } 571 }
567 ); 572 );
568 }; 573 };
569 574
570 $scope.abrirModalCotizacion = function(moneda) { 575 $scope.abrirModalCotizacion = function(moneda) {
571 var modalInstance = $uibModal.open( 576 var modalInstance = $uibModal.open(
572 { 577 {
573 ariaLabelledBy: 'Busqueda de Cotización', 578 ariaLabelledBy: 'Busqueda de Cotización',
574 templateUrl: 'modal-cotizacion.html', 579 templateUrl: 'modal-cotizacion.html',
575 controller: 'focaModalCotizacionController', 580 controller: 'focaModalCotizacionController',
576 size: 'lg', 581 size: 'lg',
577 resolve: {idMoneda: function() {return moneda.ID;}} 582 resolve: {idMoneda: function() {return moneda.ID;}}
578 } 583 }
579 ); 584 );
580 modalInstance.result.then( 585 modalInstance.result.then(
581 function(cotizacion) { 586 function(cotizacion) {
582 var articulosTablaTemp = $scope.articulosTabla; 587 var articulosTablaTemp = $scope.articulosTabla;
583 for(var i = 0; i < articulosTablaTemp.length; i++) { 588 for(var i = 0; i < articulosTablaTemp.length; i++) {
584 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 589 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
585 $scope.remito.cotizacion.COTIZACION; 590 $scope.remito.cotizacion.COTIZACION;
586 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 591 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
587 cotizacion.COTIZACION; 592 cotizacion.COTIZACION;
588 } 593 }
589 $scope.articulosTabla = articulosTablaTemp; 594 $scope.articulosTabla = articulosTablaTemp;
590 $scope.remito.moneda = { 595 $scope.remito.moneda = {
591 id: moneda.ID, 596 id: moneda.ID,
592 detalle: moneda.DETALLE, 597 detalle: moneda.DETALLE,
593 simbolo: moneda.SIMBOLO 598 simbolo: moneda.SIMBOLO
594 }; 599 };
595 $scope.remito.cotizacion = { 600 $scope.remito.cotizacion = {
596 ID: cotizacion.ID, 601 ID: cotizacion.ID,
597 COTIZACION: cotizacion.COTIZACION, 602 COTIZACION: cotizacion.COTIZACION,
598 FECHA: cotizacion.FECHA 603 FECHA: cotizacion.FECHA
599 }; 604 };
600 addCabecera('Moneda:', moneda.DETALLE); 605 addCabecera('Moneda:', moneda.DETALLE);
601 addCabecera( 606 addCabecera(
602 'Fecha cotizacion:', 607 'Fecha cotizacion:',
603 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 608 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
604 ); 609 );
605 addCabecera('Cotizacion:', cotizacion.COTIZACION); 610 addCabecera('Cotizacion:', cotizacion.COTIZACION);
606 }, function() { 611 }, function() {
607 612
608 } 613 }
609 ); 614 );
610 }; 615 };
611 616
612 $scope.agregarATabla = function(key) { 617 $scope.agregarATabla = function(key) {
613 if(key === 13) { 618 if(key === 13) {
614 if($scope.articuloACargar.cantidad === undefined || 619 if($scope.articuloACargar.cantidad === undefined ||
615 $scope.articuloACargar.cantidad === 0 || 620 $scope.articuloACargar.cantidad === 0 ||
616 $scope.articuloACargar.cantidad === null ) { 621 $scope.articuloACargar.cantidad === null ) {
617 focaModalService.alert('El valor debe ser al menos 1'); 622 focaModalService.alert('El valor debe ser al menos 1');
618 return; 623 return;
619 } 624 }
620 delete $scope.articuloACargar.sectorCodigo; 625 delete $scope.articuloACargar.sectorCodigo;
621 $scope.articulosTabla.push($scope.articuloACargar); 626 $scope.articulosTabla.push($scope.articuloACargar);
622 $scope.cargando = true; 627 $scope.cargando = true;
623 } 628 }
624 }; 629 };
625 630
626 $scope.quitarArticulo = function(key) { 631 $scope.quitarArticulo = function(key) {
627 $scope.articulosTabla.splice(key, 1); 632 $scope.articulosTabla.splice(key, 1);
628 }; 633 };
629 634
630 $scope.editarArticulo = function(key, articulo) { 635 $scope.editarArticulo = function(key, articulo) {
631 if(key === 13) { 636 if(key === 13) {
632 if(articulo.cantidad === null || articulo.cantidad === 0 || 637 if(articulo.cantidad === null || articulo.cantidad === 0 ||
633 articulo.cantidad === undefined) { 638 articulo.cantidad === undefined) {
634 focaModalService.alert('El valor debe ser al menos 1'); 639 focaModalService.alert('El valor debe ser al menos 1');
635 return; 640 return;
636 } 641 }
637 articulo.editCantidad = false; 642 articulo.editCantidad = false;
638 articulo.editPrecio = false; 643 articulo.editPrecio = false;
639 } 644 }
640 }; 645 };
641 646
642 $scope.cambioEdit = function(articulo, propiedad) { 647 $scope.cambioEdit = function(articulo, propiedad) {
643 if(propiedad === 'cantidad') { 648 if(propiedad === 'cantidad') {
644 articulo.editCantidad = true; 649 articulo.editCantidad = true;
645 } else if(propiedad === 'precio') { 650 } else if(propiedad === 'precio') {
646 articulo.editPrecio = true; 651 articulo.editPrecio = true;
647 } 652 }
648 }; 653 };
649 654
650 $scope.limpiarFlete = function() { 655 $scope.limpiarFlete = function() {
651 $scope.remito.fleteNombre = ''; 656 $scope.remito.fleteNombre = '';
652 $scope.remito.chofer = ''; 657 $scope.remito.chofer = '';
653 $scope.remito.vehiculo = ''; 658 $scope.remito.vehiculo = '';
654 $scope.remito.kilometros = ''; 659 $scope.remito.kilometros = '';
655 $scope.remito.costoUnitarioKmFlete = ''; 660 $scope.remito.costoUnitarioKmFlete = '';
656 $scope.choferes = ''; 661 $scope.choferes = '';
657 $scope.vehiculos = ''; 662 $scope.vehiculos = '';
658 }; 663 };
659 664
660 $scope.limpiarPantalla = function() { 665 $scope.limpiarPantalla = function() {
661 $scope.limpiarFlete(); 666 $scope.limpiarFlete();
662 $scope.remito.flete = '0'; 667 $scope.remito.flete = '0';
663 $scope.remito.bomba = '0'; 668 $scope.remito.bomba = '0';
664 $scope.remito.precioCondicion = ''; 669 $scope.remito.precioCondicion = '';
665 $scope.articulosTabla = []; 670 $scope.articulosTabla = [];
666 $scope.remito.vendedor.nombre = ''; 671 $scope.remito.vendedor.nombre = '';
667 $scope.remito.cliente = {nombre: ''}; 672 $scope.remito.cliente = {nombre: ''};
668 $scope.remito.domicilio = {dom: ''}; 673 $scope.remito.domicilio = {dom: ''};
669 $scope.domiciliosCliente = []; 674 $scope.domiciliosCliente = [];
670 }; 675 };
671 676
672 $scope.resetFilter = function() { 677 $scope.resetFilter = function() {
673 $scope.articuloACargar = {}; 678 $scope.articuloACargar = {};
674 $scope.cargando = true; 679 $scope.cargando = true;
675 }; 680 };
676 681
677 $scope.selectFocus = function($event) { 682 $scope.selectFocus = function($event) {
678 $event.target.select(); 683 $event.target.select();
679 }; 684 };
680 685
681 $scope.salir = function() { 686 $scope.salir = function() {
682 $location.path('/'); 687 $location.path('/');
683 }; 688 };
684 function addArrayCabecera(array) { 689 function addArrayCabecera(array) {
685 for(var i = 0; i < array.length; i++) { 690 for(var i = 0; i < array.length; i++) {
686 addCabecera(array[i].label, array[i].valor); 691 addCabecera(array[i].label, array[i].valor);
687 } 692 }
688 } 693 }
689 694
690 function addCabecera(label, valor) { 695 function addCabecera(label, valor) {
691 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 696 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
692 if(propiedad.length === 1) { 697 if(propiedad.length === 1) {
693 propiedad[0].valor = valor; 698 propiedad[0].valor = valor;
694 } else { 699 } else {
695 $scope.cabecera.push({label: label, valor: valor}); 700 $scope.cabecera.push({label: label, valor: valor});
696 } 701 }
697 } 702 }
698 703
699 function removeCabecera(label) { 704 function removeCabecera(label) {
700 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 705 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
701 if(propiedad.length === 1) { 706 if(propiedad.length === 1) {
702 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 707 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
703 } 708 }
704 } 709 }
705 710
706 function rellenar(relleno, longitud) { 711 function rellenar(relleno, longitud) {
707 relleno = '' + relleno; 712 relleno = '' + relleno;
708 while (relleno.length < longitud) { 713 while (relleno.length < longitud) {
709 relleno = '0' + relleno; 714 relleno = '0' + relleno;
710 } 715 }
711 716
712 return relleno; 717 return relleno;
713 } 718 }
714 } 719 }
715 ] 720 ]
716 ) 721 )
717 .controller('remitoListaCtrl', [ 722 .controller('remitoListaCtrl', [
718 '$scope', 723 '$scope',
719 'crearRemitoService', 724 'crearRemitoService',
720 '$location', 725 '$location',
721 function($scope, crearRemitoService, $location) { 726 function($scope, crearRemitoService, $location) {
722 crearRemitoService.obtenerRemito().then(function(datos) { 727 crearRemitoService.obtenerRemito().then(function(datos) {
723 $scope.remitos = datos.data; 728 $scope.remitos = datos.data;
724 }); 729 });
725 $scope.editar = function(remito) { 730 $scope.editar = function(remito) {
726 crearRemitoService.setRemito(remito); 731 crearRemitoService.setRemito(remito);
727 $location.path('/venta-nota-remito/abm/'); 732 $location.path('/venta-nota-remito/abm/');
728 }; 733 };
729 $scope.crearRemito = function() { 734 $scope.crearRemito = function() {
730 crearRemitoService.clearRemito(); 735 crearRemitoService.clearRemito();
731 $location.path('/venta-nota-remito/abm/'); 736 $location.path('/venta-nota-remito/abm/');
732 }; 737 };
733 } 738 }
734 ]) 739 ])
735 .controller('focaCrearRemitoFichaClienteController', [ 740 .controller('focaCrearRemitoFichaClienteController', [
736 '$scope', 741 '$scope',
737 'crearRemitoService', 742 'crearRemitoService',
738 '$location', 743 '$location',
739 function($scope, crearRemitoService, $location) { 744 function($scope, crearRemitoService, $location) {
740 crearRemitoService.obtenerRemito().then(function(datos) { 745 crearRemitoService.obtenerRemito().then(function(datos) {
741 $scope.remitos = datos.data; 746 $scope.remitos = datos.data;
742 }); 747 });
743 $scope.editar = function(remito) { 748 $scope.editar = function(remito) {
744 crearRemitoService.setRemito(remito); 749 crearRemitoService.setRemito(remito);
745 $location.path('/venta-nota-remito/abm/'); 750 $location.path('/venta-nota-remito/abm/');
746 }; 751 };
747 $scope.crearRemito = function() { 752 $scope.crearRemito = function() {
748 crearRemitoService.clearRemito(); 753 crearRemitoService.clearRemito();
749 $location.path('/venta-nota-remito/abm/'); 754 $location.path('/venta-nota-remito/abm/');
750 }; 755 };
751 } 756 }
752 ]); 757 ]);
753 758
src/views/remito.html
1 <div class="crear-nota-remito"> 1 <div class="crear-nota-remito">
2 <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0"> 2 <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0">
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 offset-md-1 col-lg-8 offset-lg-2">
5 <div class="row p-1 panel-informativo"> 5 <div class="row p-1 panel-informativo">
6 <div class="col-12"> 6 <div class="col-12">
7 <div class="row"> 7 <div class="row">
8 <div class="col-12 col-sm-4 nota-remito"> 8 <div class="col-12 col-sm-4 nota-remito">
9 <h5>REMITO</h5> 9 <h5>REMITO</h5>
10 </div> 10 </div>
11 <div class="col-5 col-sm-4 numero-remito" 11 <div class="col-5 col-sm-4 numero-remito"
12 > 12 >
13 Nº {{puntoVenta}}-{{comprobante}} 13 Nº {{puntoVenta}}-{{comprobante}}
14 <button 14 <button
15 class="btn btn-xs" 15 class="btn btn-xs btn-outline-dark"
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-4 text-right">
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 HH:mm'"
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> 41 </div>
42 <div class="row"> 42 <div class="row">
43 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 43 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
44 <span class="label" ng-bind="cab.label"></span> 44 <span class="label" ng-bind="cab.label"></span>
45 <span class="valor" ng-bind="cab.valor"></span> 45 <span class="valor" ng-bind="cab.valor"></span>
46 </div> 46 </div>
47 <a 47 <a
48 class="btn col-12 btn-secondary d-sm-none" 48 class="btn col-12 btn-secondary d-sm-none"
49 ng-show="cabecera.length > 0" 49 ng-show="cabecera.length > 0"
50 ng-click="showCabecera = !showCabecera" 50 ng-click="showCabecera = !showCabecera"
51 > 51 >
52 <i 52 <i
53 class="fa fa-chevron-down" 53 class="fa fa-chevron-down"
54 ng-hide="showCabecera" 54 ng-hide="showCabecera"
55 aria-hidden="true" 55 aria-hidden="true"
56 > 56 >
57 </i> 57 </i>
58 <i 58 <i
59 class="fa fa-chevron-up" 59 class="fa fa-chevron-up"
60 ng-show="showCabecera" 60 ng-show="showCabecera"
61 aria-hidden="true"> 61 aria-hidden="true">
62 </i> 62 </i>
63 </a> 63 </a>
64 </div> 64 </div>
65 </div> 65 </div>
66 </div> 66 </div>
67 <div class="row p-1 botonera-secundaria"> 67 <div class="row p-1 botonera-secundaria">
68 <div class="col-12"> 68 <div class="col-12">
69 <div class="row"> 69 <div class="row">
70 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 70 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
71 <button 71 <button
72 type="button" 72 type="button"
73 class="btn btn-default btn-block btn-xs text-left py-2" 73 class="btn btn-default btn-block btn-xs text-left py-2"
74 ng-click="boton.accion()" 74 ng-click="boton.accion()"
75 ng-class="{'d-none d-sm-block': boton.texto == ''}" 75 ng-class="{'d-none d-sm-block': boton.texto == ''}"
76 > 76 >
77 <i 77 <i
78 class="fa fa-arrow-circle-right" 78 class="fa fa-arrow-circle-right"
79 ng-show="boton.texto != ''" 79 ng-show="boton.texto != ''"
80 ></i> 80 ></i>
81 &nbsp; 81 &nbsp;
82 {{boton.texto}} 82 {{boton.texto}}
83 </button> 83 </button>
84 </div> 84 </div>
85 </div> 85 </div>
86 </div> 86 </div>
87 </div> 87 </div>
88 </div> 88 </div>
89 </div> 89 </div>
90 </form> 90 </form>
91 <div class="row"> 91 <div class="row">
92 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 92 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
93 <!-- PC --> 93 <!-- PC -->
94 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 94 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
95 <table class="table tabla-articulo table-striped table-sm table-dark"> 95 <table class="table tabla-articulo table-striped table-sm table-dark">
96 <thead> 96 <thead>
97 <tr class="d-flex"> 97 <tr class="d-flex">
98 <th class="">#</th> 98 <th class="">#</th>
99 <th class="col">Código</th> 99 <th class="col">Código</th>
100 <th class="col-4">Descripción</th> 100 <th class="col-4">Descripción</th>
101 <th class="col text-right">Cantidad</th> 101 <th class="col text-right">Cantidad</th>
102 <th class="col text-right">Precio Unitario</th> 102 <th class="col text-right">Precio Unitario</th>
103 <th class="col text-right">SubTotal</th> 103 <th class="col text-right">SubTotal</th>
104 <th class="text-right"> 104 <th class="text-right">
105 <button 105 <button
106 class="btn btn-outline-secondary selectable" 106 class="btn btn-outline-secondary selectable"
107 ng-click="show = !show; masMenos()" 107 ng-click="show = !show; masMenos()"
108 > 108 >
109 <i 109 <i
110 class="fa fa-chevron-down" 110 class="fa fa-chevron-down"
111 ng-show="show" 111 ng-show="show"
112 aria-hidden="true" 112 aria-hidden="true"
113 > 113 >
114 </i> 114 </i>
115 <i 115 <i
116 class="fa fa-chevron-up" 116 class="fa fa-chevron-up"
117 ng-hide="show" 117 ng-hide="show"
118 aria-hidden="true"> 118 aria-hidden="true">
119 </i> 119 </i>
120 </button> 120 </button>
121 </th> 121 </th>
122 </tr> 122 </tr>
123 </thead> 123 </thead>
124 <tbody class="tabla-articulo-body"> 124 <tbody class="tabla-articulo-body">
125 <tr 125 <tr
126 ng-repeat="(key, articulo) in articulosTabla" 126 ng-repeat="(key, articulo) in articulosTabla"
127 ng-show="show || key == (articulosTabla.length - 1)" 127 ng-show="show || key == (articulosTabla.length - 1)"
128 class="d-flex" 128 class="d-flex"
129 > 129 >
130 <td ng-bind="key + 1"></td> 130 <td ng-bind="key + 1"></td>
131 <td 131 <td
132 class="col" 132 class="col"
133 ng-bind="articulo.sector + '-' + articulo.codigo" 133 ng-bind="articulo.sector + '-' + articulo.codigo"
134 ></td> 134 ></td>
135 <td 135 <td
136 class="col-4" 136 class="col-4"
137 ng-bind="articulo.descripcion" 137 ng-bind="articulo.descripcion"
138 ></td> 138 ></td>
139 <td class="col text-right"> 139 <td class="col text-right">
140 <input 140 <input
141 ng-show="articulo.editCantidad" 141 ng-show="articulo.editCantidad"
142 ng-model="articulo.cantidad" 142 ng-model="articulo.cantidad"
143 class="form-control" 143 class="form-control"
144 type="number" 144 type="number"
145 min="1" 145 min="1"
146 foca-focus="articulo.editCantidad" 146 foca-focus="articulo.editCantidad"
147 ng-keypress="editarArticulo($event.keyCode, articulo)" 147 ng-keypress="editarArticulo($event.keyCode, articulo)"
148 ng-focus="selectFocus($event)" 148 ng-focus="selectFocus($event)"
149 > 149 >
150 <i 150 <i
151 class="selectable" 151 class="selectable"
152 ng-click="cambioEdit(articulo, 'cantidad')" 152 ng-click="cambioEdit(articulo, 'cantidad')"
153 ng-hide="articulo.editCantidad" 153 ng-hide="articulo.editCantidad"
154 ng-bind="articulo.cantidad"> 154 ng-bind="articulo.cantidad">
155 </i> 155 </i>
156 </td> 156 </td>
157 <td class="col text-right"> 157 <td class="col text-right">
158 <input 158 <input
159 ng-show="articulo.editPrecio" 159 ng-show="articulo.editPrecio"
160 ng-model="articulo.precio" 160 ng-model="articulo.precio"
161 class="form-control" 161 class="form-control"
162 type="number" 162 type="number"
163 min="1" 163 min="1"
164 step="0.0001" 164 step="0.0001"
165 foca-focus="articulo.editPrecio" 165 foca-focus="articulo.editPrecio"
166 ng-keypress="editarArticulo($event.keyCode, articulo)" 166 ng-keypress="editarArticulo($event.keyCode, articulo)"
167 ng-focus="selectFocus($event)" 167 ng-focus="selectFocus($event)"
168 > 168 >
169 <i 169 <i
170 class="selectable" 170 class="selectable"
171 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" 171 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
172 ng-hide="articulo.editPrecio" 172 ng-hide="articulo.editPrecio"
173 ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> 173 ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4">
174 </i> 174 </i>
175 </td> 175 </td>
176 <td 176 <td
177 class="col text-right" 177 class="col text-right"
178 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> 178 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo">
179 </td> 179 </td>
180 <td class="text-center"> 180 <td class="text-center">
181 <button 181 <button
182 class="btn btn-outline-secondary" 182 class="btn btn-outline-secondary"
183 ng-click="quitarArticulo(key)" 183 ng-click="quitarArticulo(key)"
184 > 184 >
185 <i class="fa fa-trash"></i> 185 <i class="fa fa-trash"></i>
186 </button> 186 </button>
187 </td> 187 </td>
188 </tr> 188 </tr>
189 </tbody> 189 </tbody>
190 <tfoot> 190 <tfoot>
191 <tr ng-show="!cargando" class="d-flex"> 191 <tr ng-show="!cargando" class="d-flex">
192 <td 192 <td
193 class="align-middle" 193 class="align-middle"
194 ng-bind="articulosTabla.length + 1" 194 ng-bind="articulosTabla.length + 1"
195 ></td> 195 ></td>
196 <td class="col"> 196 <td class="col">
197 <input 197 <input
198 class="form-control" 198 class="form-control"
199 ng-model="articuloACargar.sectorCodigo" 199 ng-model="articuloACargar.sectorCodigo"
200 readonly 200 readonly
201 > 201 >
202 </td> 202 </td>
203 <td class="col-4 tabla-articulo-descripcion"> 203 <td class="col-4 tabla-articulo-descripcion">
204 <input 204 <input
205 class="form-control" 205 class="form-control"
206 ng-model="articuloACargar.descripcion" 206 ng-model="articuloACargar.descripcion"
207 readonly 207 readonly
208 > 208 >
209 </td> 209 </td>
210 <td class="col text-right"> 210 <td class="col text-right">
211 <input 211 <input
212 class="form-control" 212 class="form-control"
213 type="number" 213 type="number"
214 min="1" 214 min="1"
215 ng-model="articuloACargar.cantidad" 215 ng-model="articuloACargar.cantidad"
216 foca-focus="!cargando" 216 foca-focus="!cargando"
217 esc-key="resetFilter()" 217 esc-key="resetFilter()"
218 ng-keypress="agregarATabla($event.keyCode)" 218 ng-keypress="agregarATabla($event.keyCode)"
219 > 219 >
220 </td> 220 </td>
221 <td class="col text-right"> 221 <td class="col text-right">
222 <input 222 <input
223 class="form-control" 223 class="form-control"
224 ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" 224 ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4"
225 ng-show="idLista != -1" 225 ng-show="idLista != -1"
226 readonly 226 readonly
227 > 227 >
228 <input 228 <input
229 class="form-control" 229 class="form-control"
230 type="number" 230 type="number"
231 step="0.0001" 231 step="0.0001"
232 ng-model="articuloACargar.precio" 232 ng-model="articuloACargar.precio"
233 esc-key="resetFilter()" 233 esc-key="resetFilter()"
234 ng-keypress="agregarATabla($event.keyCode)" 234 ng-keypress="agregarATabla($event.keyCode)"
235 ng-show="idLista == -1" 235 ng-show="idLista == -1"
236 > 236 >
237 </td> 237 </td>
238 <td class="col text-right"> 238 <td class="col text-right">
239 <input 239 <input
240 class="form-control" 240 class="form-control"
241 ng-value="getSubTotal() | currency: remito.moneda.simbolo" 241 ng-value="getSubTotal() | currency: remito.moneda.simbolo"
242 readonly 242 readonly
243 ></td> 243 ></td>
244 <td class="text-center align-middle"> 244 <td class="text-center align-middle">
245 <button 245 <button
246 class="btn btn-outline-secondary" 246 class="btn btn-outline-secondary"
247 ng-click="agregarATabla(13)" 247 ng-click="agregarATabla(13)"
248 > 248 >
249 <i class="fa fa-save"></i> 249 <i class="fa fa-save"></i>
250 </button> 250 </button>
251 </td> 251 </td>
252 </tr> 252 </tr>
253 <tr ng-show="cargando" class="d-flex"> 253 <tr ng-show="cargando" class="d-flex">
254 <td colspan="7" class="col-12"> 254 <td colspan="7" class="col-12">
255 <input 255 <input
256 placeholder="Seleccione Articulo" 256 placeholder="Seleccione Articulo"
257 class="form-control form-control-sm" 257 class="form-control form-control-sm"
258 readonly 258 readonly
259 ng-click="seleccionarArticulo()" 259 ng-click="seleccionarArticulo()"
260 /> 260 />
261 </td> 261 </td>
262 </tr> 262 </tr>
263 <tr class="d-flex"> 263 <tr class="d-flex">
264 <td colspan="4" class="no-border-top"> 264 <td colspan="4" class="no-border-top">
265 <strong>Items:</strong> 265 <strong>Items:</strong>
266 <a ng-bind="articulosTabla.length"></a> 266 <a ng-bind="articulosTabla.length"></a>
267 </td> 267 </td>
268 <td class="text-right ml-auto table-celda-total no-border-top"> 268 <td class="text-right ml-auto table-celda-total no-border-top">
269 <h3>Total:</h3> 269 <h3>Total:</h3>
270 </td> 270 </td>
271 <td class="table-celda-total text-right no-border-top" colspan="1"> 271 <td class="table-celda-total text-right no-border-top" colspan="1">
272 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> 272 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3>
273 </td> 273 </td>
274 <td class="text-right no-border-top"> 274 <td class="text-right no-border-top">
275 <button 275 <button
276 type="button" 276 type="button"
277 class="btn btn-default btn-sm" 277 class="btn btn-default btn-sm"
278 > 278 >
279 Totales 279 Totales
280 </button> 280 </button>
281 </td> 281 </td>
282 </tr> 282 </tr>
283 </tfoot> 283 </tfoot>
284 </table> 284 </table>
285 </div> 285 </div>
286 286
287 <!-- MOBILE --> 287 <!-- MOBILE -->
288 <div class="row d-sm-none"> 288 <div class="row d-sm-none">
289 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 289 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
290 <thead> 290 <thead>
291 <tr class="d-flex"> 291 <tr class="d-flex">
292 <th class="">#</th> 292 <th class="">#</th>
293 <th class="col px-0"> 293 <th class="col px-0">
294 <div class="d-flex"> 294 <div class="d-flex">
295 <div class="col-4 px-1">Código</div> 295 <div class="col-4 px-1">Código</div>
296 <div class="col-8 px-1">Descripción</div> 296 <div class="col-8 px-1">Descripción</div>
297 </div> 297 </div>
298 <div class="d-flex"> 298 <div class="d-flex">
299 <div class="col-3 px-1">Cantidad</div> 299 <div class="col-3 px-1">Cantidad</div>
300 <div class="col px-1 text-right">P. Uni.</div> 300 <div class="col px-1 text-right">P. Uni.</div>
301 <div class="col px-1 text-right">Subtotal</div> 301 <div class="col px-1 text-right">Subtotal</div>
302 </div> 302 </div>
303 </th> 303 </th>
304 <th class="text-center tamaño-boton"> 304 <th class="text-center tamaño-boton">
305 &nbsp; 305 &nbsp;
306 </th> 306 </th>
307 </tr> 307 </tr>
308 </thead> 308 </thead>
309 <tbody> 309 <tbody>
310 <tr 310 <tr
311 ng-repeat="(key, articulo) in articulosTabla" 311 ng-repeat="(key, articulo) in articulosTabla"
312 ng-show="show || key == articulosTabla.length - 1" 312 ng-show="show || key == articulosTabla.length - 1"
313 > 313 >
314 <td class="w-100 align-middle d-flex p-0"> 314 <td class="w-100 align-middle d-flex p-0">
315 <div class="align-middle p-1"> 315 <div class="align-middle p-1">
316 <span ng-bind="key+1" class="align-middle"></span> 316 <span ng-bind="key+1" class="align-middle"></span>
317 </div> 317 </div>
318 <div class="col px-0"> 318 <div class="col px-0">
319 <div class="d-flex"> 319 <div class="d-flex">
320 <div class="col-4 px-1"> 320 <div class="col-4 px-1">
321 <span 321 <span
322 ng-bind="articulo.sector + '-' + articulo.codigo" 322 ng-bind="articulo.sector + '-' + articulo.codigo"
323 ></span> 323 ></span>
324 </div> 324 </div>
325 <div class="col-8 px-1"> 325 <div class="col-8 px-1">
326 <span ng-bind="articulo.descripcion"></span> 326 <span ng-bind="articulo.descripcion"></span>
327 </div> 327 </div>
328 </div> 328 </div>
329 <div class="d-flex"> 329 <div class="d-flex">
330 <div class="col-3 px-1"> 330 <div class="col-3 px-1">
331 <span ng-bind="'x' + articulo.cantidad"></span> 331 <span ng-bind="'x' + articulo.cantidad"></span>
332 </div> 332 </div>
333 <div class="col-3 px-1 text-right"> 333 <div class="col-3 px-1 text-right">
334 <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> 334 <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span>
335 </div> 335 </div>
336 <div class="col px-1 text-right"> 336 <div class="col px-1 text-right">
337 <span 337 <span
338 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" 338 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"
339 > 339 >
340 </span> 340 </span>
341 </div> 341 </div>
342 </div> 342 </div>
343 </div> 343 </div>
344 <div class="align-middle p-1"> 344 <div class="align-middle p-1">
345 <button 345 <button
346 class="btn btn-outline-secondary" 346 class="btn btn-outline-secondary"
347 ng-click="quitarArticulo(key)" 347 ng-click="quitarArticulo(key)"
348 > 348 >
349 <i class="fa fa-trash"></i> 349 <i class="fa fa-trash"></i>
350 </button> 350 </button>
351 </div> 351 </div>
352 </td> 352 </td>
353 </tr> 353 </tr>
354 </tbody> 354 </tbody>
355 <tfoot> 355 <tfoot>
356 <!-- CARGANDO ITEM --> 356 <!-- CARGANDO ITEM -->
357 <tr ng-show="!cargando" class="d-flex"> 357 <tr ng-show="!cargando" class="d-flex">
358 <td 358 <td
359 class="align-middle p-1" 359 class="align-middle p-1"
360 ng-bind="articulosTabla.length + 1" 360 ng-bind="articulosTabla.length + 1"
361 ></td> 361 ></td>
362 <td class="col p-0"> 362 <td class="col p-0">
363 <div class="d-flex"> 363 <div class="d-flex">
364 <div class="col-4 px-1"> 364 <div class="col-4 px-1">
365 <span 365 <span
366 ng-bind="articuloACargar.sectorCodigo" 366 ng-bind="articuloACargar.sectorCodigo"
367 ></span> 367 ></span>
368 </div> 368 </div>
369 <div class="col-8 px-1"> 369 <div class="col-8 px-1">
370 <span ng-bind="articuloACargar.descripcion"></span> 370 <span ng-bind="articuloACargar.descripcion"></span>
371 </div> 371 </div>
372 </div> 372 </div>
373 <div class="d-flex"> 373 <div class="d-flex">
374 <div class="col-3 px-1 m-1"> 374 <div class="col-3 px-1 m-1">
375 <input 375 <input
376 class="form-control p-1" 376 class="form-control p-1"
377 type="number" 377 type="number"
378 min="1" 378 min="1"
379 ng-model="articuloACargar.cantidad" 379 ng-model="articuloACargar.cantidad"
380 foca-focus="!cargando" 380 foca-focus="!cargando"
381 ng-keypress="agregarATabla($event.keyCode)" 381 ng-keypress="agregarATabla($event.keyCode)"
382 style="height: auto; line-height: 1.1em" 382 style="height: auto; line-height: 1.1em"
383 > 383 >
384 </div> 384 </div>
385 <div class="col-3 px-1 text-right"> 385 <div class="col-3 px-1 text-right">
386 <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> 386 <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span>
387 </div> 387 </div>
388 <div class="col px-1 text-right"> 388 <div class="col px-1 text-right">
389 <span 389 <span
390 ng-bind="getSubTotal() | currency: remito.moneda.simbolo" 390 ng-bind="getSubTotal() | currency: remito.moneda.simbolo"
391 > 391 >
392 </span> 392 </span>
393 </div> 393 </div>
394 </div> 394 </div>
395 </td> 395 </td>
396 <td class="text-center align-middle"> 396 <td class="text-center align-middle">
397 <button 397 <button
398 class="btn btn-outline-secondary" 398 class="btn btn-outline-secondary"
399 ng-click="agregarATabla(13)" 399 ng-click="agregarATabla(13)"
400 > 400 >
401 <i class="fa fa-save"></i> 401 <i class="fa fa-save"></i>
402 </button> 402 </button>
403 </td> 403 </td>
404 </tr> 404 </tr>
405 <!-- SELECCIONAR PRODUCTO --> 405 <!-- SELECCIONAR PRODUCTO -->
406 <tr ng-show="cargando" class="d-flex"> 406 <tr ng-show="cargando" class="d-flex">
407 <td class="col-12"> 407 <td class="col-12">
408 <input 408 <input
409 placeholder="Seleccione Articulo" 409 placeholder="Seleccione Articulo"
410 class="form-control form-control-sm" 410 class="form-control form-control-sm"
411 readonly 411 readonly
412 ng-click="seleccionarArticulo()" 412 ng-click="seleccionarArticulo()"
413 /> 413 />
414 </td> 414 </td>
415 </tr> 415 </tr>
416 <!-- TOOGLE EXPANDIR --> 416 <!-- TOOGLE EXPANDIR -->
417 <tr> 417 <tr>
418 <td class="col"> 418 <td class="col">
419 <button 419 <button
420 class="btn btn-outline-secondary selectable w-100" 420 class="btn btn-outline-secondary selectable w-100"
421 ng-click="show = !show; masMenos()" 421 ng-click="show = !show; masMenos()"
422 ng-show="articulosTabla.length > 0" 422 ng-show="articulosTabla.length > 0"
423 > 423 >
424 <i 424 <i
425 class="fa fa-chevron-down" 425 class="fa fa-chevron-down"
426 ng-hide="show" 426 ng-hide="show"
427 aria-hidden="true" 427 aria-hidden="true"
428 > 428 >
429 </i> 429 </i>
430 <i 430 <i
431 class="fa fa-chevron-up" 431 class="fa fa-chevron-up"
432 ng-show="show" 432 ng-show="show"
433 aria-hidden="true"> 433 aria-hidden="true">
434 </i> 434 </i>
435 </button> 435 </button>
436 </td> 436 </td>
437 </tr> 437 </tr>
438 <!-- FOOTER --> 438 <!-- FOOTER -->
439 <tr class="d-flex"> 439 <tr class="d-flex">
440 <td class="align-middle no-border-top" colspan="2"> 440 <td class="align-middle no-border-top" colspan="2">
441 <strong>Cantidad Items:</strong> 441 <strong>Cantidad Items:</strong>
442 <a ng-bind="articulosTabla.length"></a> 442 <a ng-bind="articulosTabla.length"></a>
443 </td> 443 </td>
444 <td class="text-right ml-auto table-celda-total no-border-top"> 444 <td class="text-right ml-auto table-celda-total no-border-top">
445 <h3>Total:</h3> 445 <h3>Total:</h3>
446 </td> 446 </td>
447 <td class="table-celda-total text-right no-border-top"> 447 <td class="table-celda-total text-right no-border-top">
448 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> 448 <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3>
449 </td> 449 </td>
450 </tr> 450 </tr>
451 </tfoot> 451 </tfoot>
452 </table> 452 </table>
453 </div> 453 </div>
454 </div> 454 </div>
455 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> 455 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block">
456 <div class="row align-items-end"> 456 <div class="row align-items-end">
457 <div class="col-12"> 457 <div class="col-12">
458 <button 458 <button
459 ng-click="crearRemito()" 459 ng-click="crearRemito()"
460 type="submit" 460 type="submit"
461 title="Crear nota remito" 461 title="Crear nota remito"
462 class="btn btn-default btn-block mb-2"> 462 class="btn btn-default btn-block mb-2">
463 Guardar 463 Guardar
464 </button> 464 </button>
465 <button 465 <button
466 ng-click="salir()" 466 ng-click="salir()"
467 type="button" 467 type="button"
468 title="Salir" 468 title="Salir"
469 class="btn btn-default btn-block"> 469 class="btn btn-default btn-block">
470 Salir 470 Salir
471 </button> 471 </button>
472 </div> 472 </div>
473 </div> 473 </div>
474 </div> 474 </div>
475 </div> 475 </div>
476 <div class="row d-md-none fixed-bottom"> 476 <div class="row d-md-none fixed-bottom">
477 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 477 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
478 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 478 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
479 <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> 479 <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span>
480 </div> 480 </div>
481 </div> 481 </div>
482 </div> 482 </div>
483 483