Commit 56c2677580f74459581d0af0c1c26514e86029cf

Authored by Eric Fernandez
Exists in master

Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-remito

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.idLista = notaPedido.precioCondicion[0].idListaPrecio; 163 $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio;
164 $scope.remito = notaPedido; 164 $scope.remito = notaPedido;
165 $scope.remito.vendedor = notaPedido.vendedor[0]; 165 $scope.remito.vendedor = notaPedido.vendedor[0];
166 $scope.remito.cliente = notaPedido.cliente[0]; 166 $scope.remito.cliente = notaPedido.cliente[0];
167 $scope.remito.proveedor = notaPedido.proveedor[0]; 167 $scope.remito.proveedor = notaPedido.proveedor[0];
168 $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; 168 $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0];
169 $scope.remito.cotizacion = notaPedido.cotizacion[0]; 169 $scope.remito.cotizacion = notaPedido.cotizacion[0];
170 addArrayCabecera(cabeceras); 170 addArrayCabecera(cabeceras);
171 171
172 }, function() { 172 }, function() {
173 // funcion ejecutada cuando se cancela el modal 173 // funcion ejecutada cuando se cancela el modal
174 } 174 }
175 ); 175 );
176 }; 176 };
177 177
178 $scope.seleccionarRemito = function() { 178 $scope.seleccionarRemito = function() {
179 var modalInstance = $uibModal.open( 179 var modalInstance = $uibModal.open(
180 { 180 {
181 ariaLabelledBy: 'Busqueda de Remito', 181 ariaLabelledBy: 'Busqueda de Remito',
182 templateUrl: 'foca-modal-remito.html', 182 templateUrl: 'foca-modal-remito.html',
183 controller: 'focaModalRemitoController', 183 controller: 'focaModalRemitoController',
184 size: 'lg' 184 size: 'lg'
185 } 185 }
186 ); 186 );
187 modalInstance.result.then( 187 modalInstance.result.then(
188 function() { 188 function() {
189 // TODO: Implementar carga remito 189 // TODO: Implementar carga remito
190 }, function() { 190 }, function() {
191 // funcion ejecutada cuando se cancela el modal 191 // funcion ejecutada cuando se cancela el modal
192 } 192 }
193 ); 193 );
194 }; 194 };
195 195
196 //La pantalla solo se usa para cargar remitos 196 //La pantalla solo se usa para cargar remitos
197 // if (remitoTemp !== undefined) { 197 // if (remitoTemp !== undefined) {
198 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); 198 // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga);
199 // $scope.remito = remitoTemp; 199 // $scope.remito = remitoTemp;
200 // $scope.remito.flete = ($scope.remito.flete).toString(); 200 // $scope.remito.flete = ($scope.remito.flete).toString();
201 // $scope.remito.bomba = ($scope.remito.bomba).toString(); 201 // $scope.remito.bomba = ($scope.remito.bomba).toString();
202 // $scope.idLista = $scope.remito.precioCondicion; 202 // $scope.idLista = $scope.remito.precioCondicion;
203 // crearRemitoService 203 // crearRemitoService
204 // .getArticulosByIdRemito($scope.remito.id).then( 204 // .getArticulosByIdRemito($scope.remito.id).then(
205 // function(res) { 205 // function(res) {
206 // $scope.articulosTabla = res.data; 206 // $scope.articulosTabla = res.data;
207 // } 207 // }
208 // ); 208 // );
209 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO 209 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO
210 //(NO REQUERIDO EN ESTA VERSION) 210 //(NO REQUERIDO EN ESTA VERSION)
211 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( 211 // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then(
212 // function(res) { 212 // function(res) {
213 // $scope.remito.domicilio = res.data; 213 // $scope.remito.domicilio = res.data;
214 // } 214 // }
215 // ); 215 // );
216 // } else { 216 // } else {
217 // $scope.remito.fechaCarga = new Date(); 217 // $scope.remito.fechaCarga = new Date();
218 // $scope.remito.bomba = '0'; 218 // $scope.remito.bomba = '0';
219 // $scope.remito.flete = '0'; 219 // $scope.remito.flete = '0';
220 // $scope.idLista = undefined; 220 // $scope.idLista = undefined;
221 // } 221 // }
222 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 222 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
223 // $scope.addNewDom = function() { 223 // $scope.addNewDom = function() {
224 // $scope.remito.domicilio.push({ 'id': 0 }); 224 // $scope.remito.domicilio.push({ 'id': 0 });
225 // }; 225 // };
226 // $scope.removeNewChoice = function(choice) { 226 // $scope.removeNewChoice = function(choice) {
227 // if ($scope.remito.domicilio.length > 1) { 227 // if ($scope.remito.domicilio.length > 1) {
228 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( 228 // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex(
229 // function(c) { 229 // function(c) {
230 // return c.$$hashKey === choice.$$hashKey; 230 // return c.$$hashKey === choice.$$hashKey;
231 // } 231 // }
232 // ), 1); 232 // ), 1);
233 // } 233 // }
234 // }; 234 // };
235 //validacion por domicilio y por plazo pago 235 //validacion por domicilio y por plazo pago
236 $scope.crearRemito = function() { 236 $scope.crearRemito = function() {
237 if(!$scope.remito.vendedor) { 237 if(!$scope.remito.vendedor) {
238 focaModalService.alert('Ingrese Vendedor'); 238 focaModalService.alert('Ingrese Vendedor');
239 return; 239 return;
240 } else if(!$scope.remito.cliente) { 240 } else if(!$scope.remito.cliente) {
241 focaModalService.alert('Ingrese Cliente'); 241 focaModalService.alert('Ingrese Cliente');
242 return; 242 return;
243 } else if(!$scope.remito.proveedor) { 243 } else if(!$scope.remito.proveedor) {
244 focaModalService.alert('Ingrese Proveedor'); 244 focaModalService.alert('Ingrese Proveedor');
245 return; 245 return;
246 } else if(!$scope.remito.moneda.ID) { 246 } else if(!$scope.remito.moneda.ID) {
247 focaModalService.alert('Ingrese Moneda'); 247 focaModalService.alert('Ingrese Moneda');
248 return; 248 return;
249 } else if(!$scope.remito.cotizacion.ID) { 249 } else if(!$scope.remito.cotizacion.ID) {
250 focaModalService.alert('Ingrese Cotización'); 250 focaModalService.alert('Ingrese Cotización');
251 return; 251 return;
252 } else if( 252 } else if(
253 $scope.remito.flete === undefined || $scope.remito.flete === null) 253 $scope.remito.flete === undefined || $scope.remito.flete === null)
254 { 254 {
255 focaModalService.alert('Ingrese Flete'); 255 focaModalService.alert('Ingrese Flete');
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 fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 264 fechaRemito: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
265 .toISOString().slice(0, 19).replace('T', ' '), 265 .toISOString().slice(0, 19).replace('T', ' '),
266 idCliente: $scope.remito.idCliente, 266 idCliente: $scope.remito.idCliente,
267 nombreCliente: $scope.remito.nombreCliente, 267 nombreCliente: $scope.remito.nombreCliente,
268 cuitCliente: $scope.remito.cuitCliente, 268 cuitCliente: $scope.remito.cuitCliente,
269 responsabilidadIvaCliente: 0,//TODO, 269 responsabilidadIvaCliente: 0,//TODO,
270 descuento: 0,//TODO, 270 descuento: 0,//TODO,
271 importeNeto: 0,//TODO 271 importeNeto: 0,//TODO
272 importeExento: 0,//TODO 272 importeExento: 0,//TODO
273 importeIva: 0,//TODO 273 importeIva: 0,//TODO
274 importeIvaServicios: 0,//TODO 274 importeIvaServicios: 0,//TODO
275 importeImpuestoInterno: 0,//TODO 275 importeImpuestoInterno: 0,//TODO
276 importeImpuestoInterno1: 0,//TODO 276 importeImpuestoInterno1: 0,//TODO
277 importeImpuestoInterno2: 0,//TODO 277 importeImpuestoInterno2: 0,//TODO
278 percepcion: 0,//TODO 278 percepcion: 0,//TODO
279 percepcionIva: 0,//TODO 279 percepcionIva: 0,//TODO
280 redondeo: 0,//TODO 280 redondeo: 0,//TODO
281 total: $scope.getTotal(), 281 total: $scope.getTotal(),
282 numeroNotaPedido: $scope.remito.numeroNotaPedido, 282 numeroNotaPedido: $scope.remito.numeroNotaPedido,
283 anulado: false, 283 anulado: false,
284 planilla: 0,//TODO 284 planilla: 0,//TODO
285 lugar: 0,//TODO 285 lugar: 0,//TODO
286 cuentaMadre: 0,// 286 cuentaMadre: 0,//
287 cuentaContable: 0,//TODO 287 cuentaContable: 0,//TODO
288 asiento: 0,//TODO 288 asiento: 0,//TODO
289 e_hd: '',//TODO 289 e_hd: '',//TODO
290 c_hd: '', 290 c_hd: '',
291 numeroLiquidoProducto: 0,//TODO 291 numeroLiquidoProducto: 0,//TODO
292 idVendedor: $scope.remito.idVendedor, 292 idVendedor: $scope.remito.idVendedor,
293 idProveedor: $scope.remito.idProveedor, 293 idProveedor: $scope.remito.idProveedor,
294 idDomicilio: 0,//TODO 294 idDomicilio: 0,//TODO
295 idCotizacion: $scope.remito.idCotizacion, 295 idCotizacion: $scope.remito.idCotizacion,
296 flete: $scope.remito.flete, 296 flete: $scope.remito.flete,
297 fob: $scope.remito.fob, 297 fob: $scope.remito.fob,
298 bomba: $scope.remito.bomba, 298 bomba: $scope.remito.bomba,
299 kilometros: $scope.remito.kilometros, 299 kilometros: $scope.remito.kilometros,
300 estado: 0,//TODO 300 estado: 0,//TODO
301 destinoVenta: 0,//TODO 301 destinoVenta: 0,//TODO
302 operacionTipo: 0//TODO 302 operacionTipo: 0//TODO
303 }; 303 };
304 crearRemitoService.crearRemito(remito).then( 304 crearRemitoService.crearRemito(remito).then(
305 function(data) { 305 function(data) {
306 remitoBusinessService.addArticulos($scope.articulosTabla, 306 remitoBusinessService.addArticulos($scope.articulosTabla,
307 data.data.id, $scope.remito.cotizacion.COTIZACION); 307 data.data.id, $scope.remito.cotizacion.COTIZACION);
308 308
309 focaModalService.alert('Nota remito creada'); 309 focaModalService.alert('Nota remito creada');
310 $scope.cabecera = []; 310 $scope.cabecera = [];
311 addCabecera('Moneda:', $scope.remito.moneda.detalle); 311 addCabecera('Moneda:', $scope.remito.moneda.detalle);
312 addCabecera( 312 addCabecera(
313 'Fecha cotizacion:', 313 'Fecha cotizacion:',
314 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') 314 $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy')
315 ); 315 );
316 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); 316 addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION);
317 $scope.remito.vendedor = {}; 317 $scope.remito.vendedor = {};
318 $scope.remito.cliente = {}; 318 $scope.remito.cliente = {};
319 $scope.remito.proveedor = {}; 319 $scope.remito.proveedor = {};
320 $scope.remito.domicilio = {}; 320 $scope.remito.domicilio = {};
321 $scope.remito.flete = null; 321 $scope.remito.flete = null;
322 $scope.remito.fob = null; 322 $scope.remito.fob = null;
323 $scope.remito.bomba = null; 323 $scope.remito.bomba = null;
324 $scope.remito.kilometros = null; 324 $scope.remito.kilometros = null;
325 $scope.articulosTabla = []; 325 $scope.articulosTabla = [];
326 } 326 }
327 ); 327 );
328 }; 328 };
329 329
330 $scope.seleccionarArticulo = function() { 330 $scope.seleccionarArticulo = function() {
331 if ($scope.idLista === undefined) { 331 if ($scope.idLista === undefined) {
332 focaModalService.alert( 332 focaModalService.alert(
333 'Primero seleccione una lista de precio y condicion'); 333 'Primero seleccione una lista de precio y condicion');
334 return; 334 return;
335 } 335 }
336 var modalInstance = $uibModal.open( 336 var modalInstance = $uibModal.open(
337 { 337 {
338 ariaLabelledBy: 'Busqueda de Productos', 338 ariaLabelledBy: 'Busqueda de Productos',
339 templateUrl: 'modal-busqueda-productos.html', 339 templateUrl: 'modal-busqueda-productos.html',
340 controller: 'modalBusquedaProductosCtrl', 340 controller: 'modalBusquedaProductosCtrl',
341 resolve: { 341 resolve: {
342 parametroProducto: { 342 parametroProducto: {
343 idLista: $scope.idLista, 343 idLista: $scope.idLista,
344 cotizacion: $scope.remito.cotizacion.COTIZACION, 344 cotizacion: $scope.remito.cotizacion.COTIZACION,
345 simbolo: $scope.remito.moneda.simbolo 345 simbolo: $scope.remito.moneda.simbolo
346 } 346 }
347 }, 347 },
348 size: 'lg' 348 size: 'lg'
349 } 349 }
350 ); 350 );
351 modalInstance.result.then( 351 modalInstance.result.then(
352 function(producto) { 352 function(producto) {
353 var newArt = 353 var newArt =
354 { 354 {
355 id: 0, 355 id: 0,
356 codigo: producto.codigo, 356 codigo: producto.codigo,
357 sector: producto.sector, 357 sector: producto.sector,
358 sectorCodigo: producto.sector + '-' + producto.codigo, 358 sectorCodigo: producto.sector + '-' + producto.codigo,
359 descripcion: producto.descripcion, 359 descripcion: producto.descripcion,
360 item: $scope.articulosTabla.length + 1, 360 item: $scope.articulosTabla.length + 1,
361 nombre: producto.descripcion, 361 nombre: producto.descripcion,
362 precio: parseFloat(producto.precio.toFixed(4)), 362 precio: parseFloat(producto.precio.toFixed(4)),
363 costoUnitario: producto.costo, 363 costoUnitario: producto.costo,
364 editCantidad: false, 364 editCantidad: false,
365 editPrecio: false 365 editPrecio: false
366 }; 366 };
367 $scope.articuloACargar = newArt; 367 $scope.articuloACargar = newArt;
368 $scope.cargando = false; 368 $scope.cargando = false;
369 }, function() { 369 }, function() {
370 // funcion ejecutada cuando se cancela el modal 370 // funcion ejecutada cuando se cancela el modal
371 } 371 }
372 ); 372 );
373 }; 373 };
374 374
375 $scope.seleccionarVendedor = function() { 375 $scope.seleccionarVendedor = function() {
376 var modalInstance = $uibModal.open( 376 var modalInstance = $uibModal.open(
377 { 377 {
378 ariaLabelledBy: 'Busqueda de Vendedores', 378 ariaLabelledBy: 'Busqueda de Vendedores',
379 templateUrl: 'modal-vendedores.html', 379 templateUrl: 'modal-vendedores.html',
380 controller: 'modalVendedoresCtrl', 380 controller: 'modalVendedoresCtrl',
381 size: 'lg' 381 size: 'lg'
382 } 382 }
383 ); 383 );
384 modalInstance.result.then( 384 modalInstance.result.then(
385 function(vendedor) { 385 function(vendedor) {
386 addCabecera('Vendedor:', vendedor.NomVen); 386 addCabecera('Vendedor:', vendedor.NomVen);
387 $scope.remito.vendedor.codigo = vendedor.CodVen; 387 $scope.remito.vendedor.codigo = vendedor.CodVen;
388 }, function() {
389
390 }
391 );
392 };
388 }, function() { 393
389 394 $scope.seleccionarProveedor = function() {
390 } 395 var modalInstance = $uibModal.open(
391 ); 396 {
392 }; 397 ariaLabelledBy: 'Busqueda de Proveedor',
393 398 templateUrl: 'modal-proveedor.html',
394 $scope.seleccionarProveedor = function() { 399 controller: 'focaModalProveedorCtrl',
395 var modalInstance = $uibModal.open( 400 size: 'lg',
396 { 401 resolve: {
397 ariaLabelledBy: 'Busqueda de Proveedor', 402 transportista: function() {
398 templateUrl: 'modal-proveedor.html', 403 return false;
399 controller: 'focaModalProveedorCtrl', 404 }
400 size: 'lg' 405 }
401 } 406 }
402 ); 407 );
403 modalInstance.result.then( 408 modalInstance.result.then(
404 function(proveedor) { 409 function(proveedor) {
405 $scope.remito.proveedor.codigo = proveedor.COD; 410 $scope.remito.proveedor.codigo = proveedor.COD;
406 addCabecera('Proveedor:', proveedor.NOM); 411 addCabecera('Proveedor:', proveedor.NOM);
407 }, function() { 412 }, function() {
408 413
409 } 414 }
410 ); 415 );
411 }; 416 };
412 417
413 $scope.seleccionarCliente = function() { 418 $scope.seleccionarCliente = function() {
414 419
415 var modalInstance = $uibModal.open( 420 var modalInstance = $uibModal.open(
416 { 421 {
417 ariaLabelledBy: 'Busqueda de Cliente', 422 ariaLabelledBy: 'Busqueda de Cliente',
418 templateUrl: 'foca-busqueda-cliente-modal.html', 423 templateUrl: 'foca-busqueda-cliente-modal.html',
419 controller: 'focaBusquedaClienteModalController', 424 controller: 'focaBusquedaClienteModalController',
420 size: 'lg' 425 size: 'lg'
421 } 426 }
422 ); 427 );
423 modalInstance.result.then( 428 modalInstance.result.then(
424 function(cliente) { 429 function(cliente) {
425 $scope.abrirModalDomicilios(cliente); 430 $scope.abrirModalDomicilios(cliente);
426 }, function() { 431 }, function() {
427 432
428 } 433 }
429 ); 434 );
430 }; 435 };
431 436
432 $scope.abrirModalDomicilios = function(cliente) { 437 $scope.abrirModalDomicilios = function(cliente) {
433 var modalInstanceDomicilio = $uibModal.open( 438 var modalInstanceDomicilio = $uibModal.open(
434 { 439 {
435 ariaLabelledBy: 'Busqueda de Domicilios', 440 ariaLabelledBy: 'Busqueda de Domicilios',
436 templateUrl: 'modal-domicilio.html', 441 templateUrl: 'modal-domicilio.html',
437 controller: 'focaModalDomicilioController', 442 controller: 'focaModalDomicilioController',
438 resolve: { idCliente: function() { return cliente.cod; }}, 443 resolve: { idCliente: function() { return cliente.cod; }},
439 size: 'lg', 444 size: 'lg',
440 } 445 }
441 ); 446 );
442 modalInstanceDomicilio.result.then( 447 modalInstanceDomicilio.result.then(
443 function(domicilio) { 448 function(domicilio) {
444 $scope.remito.domicilio.id = domicilio.nivel2; 449 $scope.remito.domicilio.id = domicilio.nivel2;
445 $scope.remito.cliente = cliente; 450 $scope.remito.cliente = cliente;
446 451
447 addCabecera('Cliente:', cliente.nom); 452 addCabecera('Cliente:', cliente.nom);
448 addCabecera('Domicilio:', domicilio.dom); 453 addCabecera('Domicilio:', domicilio.dom);
449 }, function() { 454 }, function() {
450 $scope.seleccionarCliente(); 455 $scope.seleccionarCliente();
451 return; 456 return;
452 } 457 }
453 ); 458 );
454 }; 459 };
455 460
456 $scope.mostrarFichaCliente = function() { 461 $scope.mostrarFichaCliente = function() {
457 $uibModal.open( 462 $uibModal.open(
458 { 463 {
459 ariaLabelledBy: 'Datos del Cliente', 464 ariaLabelledBy: 'Datos del Cliente',
460 templateUrl: 'foca-crear-remito-ficha-cliente.html', 465 templateUrl: 'foca-crear-remito-ficha-cliente.html',
461 controller: 'focaCrearRemitoFichaClienteController', 466 controller: 'focaCrearRemitoFichaClienteController',
462 size: 'lg' 467 size: 'lg'
463 } 468 }
464 ); 469 );
465 }; 470 };
466 471
467 $scope.getTotal = function() { 472 $scope.getTotal = function() {
468 var total = 0; 473 var total = 0;
469 var arrayTempArticulos = $scope.articulosTabla; 474 var arrayTempArticulos = $scope.articulosTabla;
470 for (var i = 0; i < arrayTempArticulos.length; i++) { 475 for (var i = 0; i < arrayTempArticulos.length; i++) {
471 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 476 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
472 } 477 }
473 return parseFloat(total.toFixed(2)); 478 return parseFloat(total.toFixed(2));
474 }; 479 };
475 480
476 $scope.getSubTotal = function() { 481 $scope.getSubTotal = function() {
477 if($scope.articuloACargar) { 482 if($scope.articuloACargar) {
478 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 483 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
479 } 484 }
480 }; 485 };
481 486
482 $scope.abrirModalListaPrecio = function() { 487 $scope.abrirModalListaPrecio = function() {
483 var modalInstance = $uibModal.open( 488 var modalInstance = $uibModal.open(
484 { 489 {
485 ariaLabelledBy: 'Busqueda de Precio Condición', 490 ariaLabelledBy: 'Busqueda de Precio Condición',
486 templateUrl: 'modal-precio-condicion.html', 491 templateUrl: 'modal-precio-condicion.html',
487 controller: 'focaModalPrecioCondicionController', 492 controller: 'focaModalPrecioCondicionController',
488 size: 'lg' 493 size: 'lg'
489 } 494 }
490 ); 495 );
491 modalInstance.result.then( 496 modalInstance.result.then(
492 function(precioCondicion) { 497 function(precioCondicion) {
493 var cabecera = ''; 498 var cabecera = '';
494 var plazosConcat = ''; 499 var plazosConcat = '';
495 if(!Array.isArray(precioCondicion)) { 500 if(!Array.isArray(precioCondicion)) {
496 $scope.plazosPagos = precioCondicion.plazoPago; 501 $scope.plazosPagos = precioCondicion.plazoPago;
497 $scope.idLista = precioCondicion.idListaPrecio; 502 $scope.idLista = precioCondicion.idListaPrecio;
498 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 503 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
499 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 504 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
500 } 505 }
501 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 506 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
502 } else { //Cuando se ingresan los plazos manualmente 507 } else { //Cuando se ingresan los plazos manualmente
503 $scope.idLista = -1; //-1, el modal productos busca todos los productos 508 $scope.idLista = -1; //-1, el modal productos busca todos los productos
504 $scope.plazosPagos = precioCondicion; 509 $scope.plazosPagos = precioCondicion;
505 for(var j = 0; j < precioCondicion.length; j++) { 510 for(var j = 0; j < precioCondicion.length; j++) {
506 plazosConcat += precioCondicion[j].dias + ' '; 511 plazosConcat += precioCondicion[j].dias + ' ';
507 } 512 }
508 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 513 cabecera = 'Ingreso manual ' + plazosConcat.trim();
509 } 514 }
510 $scope.articulosTabla = []; 515 $scope.articulosTabla = [];
511 addCabecera('Precios y condiciones:', cabecera); 516 addCabecera('Precios y condiciones:', cabecera);
512 }, function() { 517 }, function() {
513 518
514 } 519 }
515 ); 520 );
516 }; 521 };
517 522
518 $scope.abrirModalFlete = function() { 523 $scope.abrirModalFlete = function() {
519 var modalInstance = $uibModal.open( 524 var modalInstance = $uibModal.open(
520 { 525 {
521 ariaLabelledBy: 'Busqueda de Flete', 526 ariaLabelledBy: 'Busqueda de Flete',
522 templateUrl: 'modal-flete.html', 527 templateUrl: 'modal-flete.html',
523 controller: 'focaModalFleteController', 528 controller: 'focaModalFleteController',
524 size: 'lg', 529 size: 'lg',
525 resolve: { 530 resolve: {
526 parametrosFlete: 531 parametrosFlete:
527 function() { 532 function() {
528 return { 533 return {
529 flete: $scope.remito.flete ? '1' : 534 flete: $scope.remito.flete ? '1' :
530 ($scope.remito.fob ? 'FOB' : 535 ($scope.remito.fob ? 'FOB' :
531 ($scope.remito.flete === undefined ? null : '0')), 536 ($scope.remito.flete === undefined ? null : '0')),
532 bomba: $scope.remito.bomba ? '1' : 537 bomba: $scope.remito.bomba ? '1' :
533 ($scope.remito.bomba === undefined ? null : '0'), 538 ($scope.remito.bomba === undefined ? null : '0'),
534 kilometros: $scope.remito.kilometros 539 kilometros: $scope.remito.kilometros
535 }; 540 };
536 } 541 }
537 } 542 }
538 } 543 }
539 ); 544 );
540 modalInstance.result.then( 545 modalInstance.result.then(
541 function(datos) { 546 function(datos) {
542 $scope.remito.flete = datos.flete; 547 $scope.remito.flete = datos.flete;
543 $scope.remito.fob = datos.FOB; 548 $scope.remito.fob = datos.FOB;
544 $scope.remito.bomba = datos.bomba; 549 $scope.remito.bomba = datos.bomba;
545 $scope.remito.kilometros = datos.kilometros; 550 $scope.remito.kilometros = datos.kilometros;
546 551
547 addCabecera('Flete:', datos.flete ? 'Si' : 552 addCabecera('Flete:', datos.flete ? 'Si' :
548 ($scope.remito.fob ? 'FOB' : 'No')); 553 ($scope.remito.fob ? 'FOB' : 'No'));
549 if(datos.flete) { 554 if(datos.flete) {
550 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 555 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
551 addCabecera('Kilometros:', datos.kilometros); 556 addCabecera('Kilometros:', datos.kilometros);
552 } else { 557 } else {
553 removeCabecera('Bomba:'); 558 removeCabecera('Bomba:');
554 removeCabecera('Kilometros:'); 559 removeCabecera('Kilometros:');
555 $scope.remito.fob = false; 560 $scope.remito.fob = false;
556 $scope.remito.bomba = false; 561 $scope.remito.bomba = false;
557 $scope.remito.kilometros = null; 562 $scope.remito.kilometros = null;
558 } 563 }
559 }, function() { 564 }, function() {
560 565
561 } 566 }
562 ); 567 );
563 }; 568 };
564 569
565 $scope.abrirModalMoneda = function() { 570 $scope.abrirModalMoneda = function() {
566 var modalInstance = $uibModal.open( 571 var modalInstance = $uibModal.open(
567 { 572 {
568 ariaLabelledBy: 'Busqueda de Moneda', 573 ariaLabelledBy: 'Busqueda de Moneda',
569 templateUrl: 'modal-moneda.html', 574 templateUrl: 'modal-moneda.html',
570 controller: 'focaModalMonedaController', 575 controller: 'focaModalMonedaController',
571 size: 'lg' 576 size: 'lg'
572 } 577 }
573 ); 578 );
574 modalInstance.result.then( 579 modalInstance.result.then(
575 function(moneda) { 580 function(moneda) {
576 $scope.abrirModalCotizacion(moneda); 581 $scope.abrirModalCotizacion(moneda);
577 }, function() { 582 }, function() {
578 583
579 } 584 }
580 ); 585 );
581 }; 586 };
582 587
583 $scope.abrirModalCotizacion = function(moneda) { 588 $scope.abrirModalCotizacion = function(moneda) {
584 var modalInstance = $uibModal.open( 589 var modalInstance = $uibModal.open(
585 { 590 {
586 ariaLabelledBy: 'Busqueda de Cotización', 591 ariaLabelledBy: 'Busqueda de Cotización',
587 templateUrl: 'modal-cotizacion.html', 592 templateUrl: 'modal-cotizacion.html',
588 controller: 'focaModalCotizacionController', 593 controller: 'focaModalCotizacionController',
589 size: 'lg', 594 size: 'lg',
590 resolve: {idMoneda: function() {return moneda.ID;}} 595 resolve: {idMoneda: function() {return moneda.ID;}}
591 } 596 }
592 ); 597 );
593 modalInstance.result.then( 598 modalInstance.result.then(
594 function(cotizacion) { 599 function(cotizacion) {
595 var articulosTablaTemp = $scope.articulosTabla; 600 var articulosTablaTemp = $scope.articulosTabla;
596 for(var i = 0; i < articulosTablaTemp.length; i++) { 601 for(var i = 0; i < articulosTablaTemp.length; i++) {
597 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 602 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
598 $scope.remito.cotizacion.COTIZACION; 603 $scope.remito.cotizacion.COTIZACION;
599 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 604 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
600 cotizacion.COTIZACION; 605 cotizacion.COTIZACION;
601 } 606 }
602 $scope.articulosTabla = articulosTablaTemp; 607 $scope.articulosTabla = articulosTablaTemp;
603 $scope.remito.moneda = { 608 $scope.remito.moneda = {
604 id: moneda.ID, 609 id: moneda.ID,
605 detalle: moneda.DETALLE, 610 detalle: moneda.DETALLE,
606 simbolo: moneda.SIMBOLO 611 simbolo: moneda.SIMBOLO
607 }; 612 };
608 $scope.remito.cotizacion = { 613 $scope.remito.cotizacion = {
609 ID: cotizacion.ID, 614 ID: cotizacion.ID,
610 COTIZACION: cotizacion.COTIZACION, 615 COTIZACION: cotizacion.COTIZACION,
611 FECHA: cotizacion.FECHA 616 FECHA: cotizacion.FECHA
612 }; 617 };
613 addCabecera('Moneda:', moneda.DETALLE); 618 addCabecera('Moneda:', moneda.DETALLE);
614 addCabecera( 619 addCabecera(
615 'Fecha cotizacion:', 620 'Fecha cotizacion:',
616 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 621 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
617 ); 622 );
618 addCabecera('Cotizacion:', cotizacion.COTIZACION); 623 addCabecera('Cotizacion:', cotizacion.COTIZACION);
619 }, function() { 624 }, function() {
620 625
621 } 626 }
622 ); 627 );
623 }; 628 };
624 629
625 $scope.agregarATabla = function(key) { 630 $scope.agregarATabla = function(key) {
626 if(key === 13) { 631 if(key === 13) {
627 if($scope.articuloACargar.cantidad === undefined || 632 if($scope.articuloACargar.cantidad === undefined ||
628 $scope.articuloACargar.cantidad === 0 || 633 $scope.articuloACargar.cantidad === 0 ||
629 $scope.articuloACargar.cantidad === null ) { 634 $scope.articuloACargar.cantidad === null ) {
630 focaModalService.alert('El valor debe ser al menos 1'); 635 focaModalService.alert('El valor debe ser al menos 1');
631 return; 636 return;
632 } 637 }
633 delete $scope.articuloACargar.sectorCodigo; 638 delete $scope.articuloACargar.sectorCodigo;
634 $scope.articulosTabla.push($scope.articuloACargar); 639 $scope.articulosTabla.push($scope.articuloACargar);
635 $scope.cargando = true; 640 $scope.cargando = true;
636 } 641 }
637 }; 642 };
638 643
639 $scope.quitarArticulo = function(key) { 644 $scope.quitarArticulo = function(key) {
640 $scope.articulosTabla.splice(key, 1); 645 $scope.articulosTabla.splice(key, 1);
641 }; 646 };
642 647
643 $scope.editarArticulo = function(key, articulo) { 648 $scope.editarArticulo = function(key, articulo) {
644 if(key === 13) { 649 if(key === 13) {
645 if(articulo.cantidad === null || articulo.cantidad === 0 || 650 if(articulo.cantidad === null || articulo.cantidad === 0 ||
646 articulo.cantidad === undefined) { 651 articulo.cantidad === undefined) {
647 focaModalService.alert('El valor debe ser al menos 1'); 652 focaModalService.alert('El valor debe ser al menos 1');
648 return; 653 return;
649 } 654 }
650 articulo.editCantidad = false; 655 articulo.editCantidad = false;
651 articulo.editPrecio = false; 656 articulo.editPrecio = false;
652 } 657 }
653 }; 658 };
654 659
655 $scope.cambioEdit = function(articulo, propiedad) { 660 $scope.cambioEdit = function(articulo, propiedad) {
656 if(propiedad === 'cantidad') { 661 if(propiedad === 'cantidad') {
657 articulo.editCantidad = true; 662 articulo.editCantidad = true;
658 } else if(propiedad === 'precio') { 663 } else if(propiedad === 'precio') {
659 articulo.editPrecio = true; 664 articulo.editPrecio = true;
660 } 665 }
661 }; 666 };
662 667
663 $scope.limpiarFlete = function() { 668 $scope.limpiarFlete = function() {
664 $scope.remito.fleteNombre = ''; 669 $scope.remito.fleteNombre = '';
665 $scope.remito.chofer = ''; 670 $scope.remito.chofer = '';
666 $scope.remito.vehiculo = ''; 671 $scope.remito.vehiculo = '';
667 $scope.remito.kilometros = ''; 672 $scope.remito.kilometros = '';
668 $scope.remito.costoUnitarioKmFlete = ''; 673 $scope.remito.costoUnitarioKmFlete = '';
669 $scope.choferes = ''; 674 $scope.choferes = '';
670 $scope.vehiculos = ''; 675 $scope.vehiculos = '';
671 }; 676 };
672 677
673 $scope.limpiarPantalla = function() { 678 $scope.limpiarPantalla = function() {
674 $scope.limpiarFlete(); 679 $scope.limpiarFlete();
675 $scope.remito.flete = '0'; 680 $scope.remito.flete = '0';
676 $scope.remito.bomba = '0'; 681 $scope.remito.bomba = '0';
677 $scope.remito.precioCondicion = ''; 682 $scope.remito.precioCondicion = '';
678 $scope.articulosTabla = []; 683 $scope.articulosTabla = [];
679 $scope.remito.vendedor.nombre = ''; 684 $scope.remito.vendedor.nombre = '';
680 $scope.remito.cliente = {nombre: ''}; 685 $scope.remito.cliente = {nombre: ''};
681 $scope.remito.domicilio = {dom: ''}; 686 $scope.remito.domicilio = {dom: ''};
682 $scope.domiciliosCliente = []; 687 $scope.domiciliosCliente = [];
683 }; 688 };
684 689
685 $scope.resetFilter = function() { 690 $scope.resetFilter = function() {
686 $scope.articuloACargar = {}; 691 $scope.articuloACargar = {};
687 $scope.cargando = true; 692 $scope.cargando = true;
688 }; 693 };
689 694
690 $scope.selectFocus = function($event) { 695 $scope.selectFocus = function($event) {
691 $event.target.select(); 696 $event.target.select();
692 }; 697 };
693 698
694 $scope.salir = function() { 699 $scope.salir = function() {
695 $location.path('/'); 700 $location.path('/');
696 }; 701 };
697 function addArrayCabecera(array) { 702 function addArrayCabecera(array) {
698 for(var i = 0; i < array.length; i++) { 703 for(var i = 0; i < array.length; i++) {
699 addCabecera(array[i].label, array[i].valor); 704 addCabecera(array[i].label, array[i].valor);
700 } 705 }
701 } 706 }
702 707
703 function addCabecera(label, valor) { 708 function addCabecera(label, valor) {
704 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 709 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
705 if(propiedad.length === 1) { 710 if(propiedad.length === 1) {
706 propiedad[0].valor = valor; 711 propiedad[0].valor = valor;
707 } else { 712 } else {
708 $scope.cabecera.push({label: label, valor: valor}); 713 $scope.cabecera.push({label: label, valor: valor});
709 } 714 }
710 } 715 }
711 716
712 function removeCabecera(label) { 717 function removeCabecera(label) {
713 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 718 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
714 if(propiedad.length === 1) { 719 if(propiedad.length === 1) {
715 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 720 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
716 } 721 }
717 } 722 }
718 723
719 function rellenar(relleno, longitud) { 724 function rellenar(relleno, longitud) {
720 relleno = '' + relleno; 725 relleno = '' + relleno;
721 while (relleno.length < longitud) { 726 while (relleno.length < longitud) {
722 relleno = '0' + relleno; 727 relleno = '0' + relleno;
723 } 728 }
724 729
725 return relleno; 730 return relleno;
726 } 731 }
727 } 732 }
728 ] 733 ]
729 ) 734 )
730 .controller('remitoListaCtrl', [ 735 .controller('remitoListaCtrl', [
731 '$scope', 736 '$scope',
732 'crearRemitoService', 737 'crearRemitoService',
733 '$location', 738 '$location',
734 function($scope, crearRemitoService, $location) { 739 function($scope, crearRemitoService, $location) {
735 crearRemitoService.obtenerRemito().then(function(datos) { 740 crearRemitoService.obtenerRemito().then(function(datos) {
736 $scope.remitos = datos.data; 741 $scope.remitos = datos.data;
737 }); 742 });
738 $scope.editar = function(remito) { 743 $scope.editar = function(remito) {
739 crearRemitoService.setRemito(remito); 744 crearRemitoService.setRemito(remito);
740 $location.path('/venta-nota-remito/abm/'); 745 $location.path('/venta-nota-remito/abm/');
741 }; 746 };
742 $scope.crearRemito = function() { 747 $scope.crearRemito = function() {
743 crearRemitoService.clearRemito(); 748 crearRemitoService.clearRemito();
744 $location.path('/venta-nota-remito/abm/'); 749 $location.path('/venta-nota-remito/abm/');
745 }; 750 };
746 } 751 }
747 ]) 752 ])
748 .controller('focaCrearRemitoFichaClienteController', [ 753 .controller('focaCrearRemitoFichaClienteController', [
749 '$scope', 754 '$scope',
750 'crearRemitoService', 755 'crearRemitoService',
751 '$location', 756 '$location',
752 function($scope, crearRemitoService, $location) { 757 function($scope, crearRemitoService, $location) {
753 crearRemitoService.obtenerRemito().then(function(datos) { 758 crearRemitoService.obtenerRemito().then(function(datos) {
754 $scope.remitos = datos.data; 759 $scope.remitos = datos.data;
755 }); 760 });
756 $scope.editar = function(remito) { 761 $scope.editar = function(remito) {
757 crearRemitoService.setRemito(remito); 762 crearRemitoService.setRemito(remito);
758 $location.path('/venta-nota-remito/abm/'); 763 $location.path('/venta-nota-remito/abm/');
759 }; 764 };
760 $scope.crearRemito = function() { 765 $scope.crearRemito = function() {
761 crearRemitoService.clearRemito(); 766 crearRemitoService.clearRemito();
762 $location.path('/venta-nota-remito/abm/'); 767 $location.path('/venta-nota-remito/abm/');
763 }; 768 };
764 } 769 }
765 ]); 770 ]);
766 771
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