Commit 17f4aa76b4b3a54ca8851ce63ce9a77046be7900

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master

See merge request modulos-npm/foca-crear-remito!26
src/js/businessService.js
... ... @@ -28,6 +28,13 @@ angular.module('focaCrearRemito')
28 28 for(var i = 0; i < articulos.length; i++) {
29 29 articulos[i].precio = articulos[i].precio / cotizacion;
30 30 }
  31 + },
  32 + plazoToString: function(plazos) {
  33 + var result = '';
  34 + for(var i = 0; i < plazos.length; i++) {
  35 + result += plazos[i].dias + ' ';
  36 + }
  37 + return result.trim();
31 38 }
32 39 };
33 40 }]);
src/js/controller.js
... ... @@ -4,8 +4,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
4 4 'focaModalService', 'remitoBusinessService',
5 5 function(
6 6 $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService,
7   - remitoBusinessService
8   - ) {
  7 + remitoBusinessService)
  8 + {
9 9 $scope.botonera = [
10 10 {texto: 'Nota Pedido', accion: function() {
11 11 varlidarRemitoFacturado($scope.seleccionarNotaPedido);}},
... ... @@ -67,8 +67,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
67 67  
68 68 $scope.articulosTabla = [];
69 69 $scope.idLista = undefined;
70   - //La pantalla solo se usa para cargar remitos
71   - //var remitoTemp = crearRemitoService.getRemito();
72 70  
73 71 crearRemitoService.getPrecioCondicion().then(
74 72 function(res) {
... ... @@ -105,9 +103,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
105 103 function(notaPedido) {
106 104 //añado cabeceras
107 105 $scope.notaPedido.id = notaPedido.id;
108   - removeCabecera('Moneda:');
109   - removeCabecera('Fecha cotizacion:');
110   - removeCabecera('Cotizacion:');
  106 + removeCabecera('Bomba:');
  107 + removeCabecera('Kilometros:');
111 108 var cabeceras = [
112 109 {
113 110 label: 'Moneda:',
... ... @@ -139,16 +136,17 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
139 136 valor: notaPedido.proveedor[0].NOM
140 137 },
141 138 {
  139 + label: 'Precio condicion:',
  140 + valor: valorPrecioCondicion() + ' ' +
  141 + remitoBusinessService.plazoToString(notaPedido.plazoPago)
  142 + },
  143 + {
142 144 label: 'Flete:',
143 145 valor: notaPedido.fob === 1 ? 'FOB' : (
144 146 notaPedido.flete === 1 ? 'Si' : 'No')
145   - },
146   - {
147   - label: 'Precio condicion:',
148   - valor: valorPrecioCondicion()
149 147 }
150 148 ];
151   - //TODO: CUANDO MOSTRAR PLAZOS
  149 +
152 150 function valorPrecioCondicion() {
153 151 if(notaPedido.idPrecioCondicion > 0) {
154 152 return notaPedido.precioCondicion[0].nombre;
... ... @@ -159,12 +157,12 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
159 157  
160 158 if(notaPedido.flete === 1) {
161 159 var cabeceraBomba = {
162   - label: 'Bomba',
  160 + label: 'Bomba:',
163 161 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
164 162 };
165 163 if(notaPedido.kilometros) {
166 164 var cabeceraKilometros = {
167   - label: 'Kilometros',
  165 + label: 'Kilometros:',
168 166 valor: notaPedido.kilometros
169 167 };
170 168 cabeceras.push(cabeceraKilometros);
... ... @@ -175,11 +173,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
175 173 for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
176 174 notaPedido.articulosNotaPedido[i].id = 0;
177 175 }
178   -
  176 +
179 177 $scope.articulosTabla = notaPedido.articulosNotaPedido;
180 178 remitoBusinessService.calcularArticulos($scope.articulosTabla,
181 179 notaPedido.cotizacion[0].VENDEDOR);
182   -
  180 +
183 181 if(notaPedido.precioCondicion.length > 0) {
184 182 $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio;
185 183 } else {
... ... @@ -264,7 +262,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
264 262 } else {
265 263 return 'Ingreso Manual';
266 264 }
267   -
268 265 }
269 266  
270 267 if(remito.flete === 1) {
... ... @@ -303,45 +300,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
303 300 );
304 301 };
305 302  
306   - //La pantalla solo se usa para cargar remitos
307   - // if (remitoTemp !== undefined) {
308   - // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga);
309   - // $scope.remito = remitoTemp;
310   - // $scope.remito.flete = ($scope.remito.flete).toString();
311   - // $scope.remito.bomba = ($scope.remito.bomba).toString();
312   - // $scope.idLista = $scope.remito.precioCondicion;
313   - // crearRemitoService
314   - // .getArticulosByIdRemito($scope.remito.id).then(
315   - // function(res) {
316   - // $scope.articulosTabla = res.data;
317   - // }
318   - // );
319   - //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO
320   - //(NO REQUERIDO EN ESTA VERSION)
321   - // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then(
322   - // function(res) {
323   - // $scope.remito.domicilio = res.data;
324   - // }
325   - // );
326   - // } else {
327   - // $scope.remito.fechaCarga = new Date();
328   - // $scope.remito.bomba = '0';
329   - // $scope.remito.flete = '0';
330   - // $scope.idLista = undefined;
331   - // }
332   - //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
333   - // $scope.addNewDom = function() {
334   - // $scope.remito.domicilio.push({ 'id': 0 });
335   - // };
336   - // $scope.removeNewChoice = function(choice) {
337   - // if ($scope.remito.domicilio.length > 1) {
338   - // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex(
339   - // function(c) {
340   - // return c.$$hashKey === choice.$$hashKey;
341   - // }
342   - // ), 1);
343   - // }
344   - // };
345 303 //validacion por domicilio y por plazo pago
346 304 $scope.crearRemito = function() {
347 305 if(!$scope.remito.vendedor) {
... ... @@ -367,14 +325,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
367 325 } else if($scope.articulosTabla.length === 0) {
368 326 focaModalService.alert('Debe cargar al menos un articulo');
369 327 return;
370   - }
371   - var date = new Date();
  328 + }
372 329 var save = {
373 330 remito: {
374 331 id: $scope.remito.id,
375   - fechaRemito:
376   - new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
377   - .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter
  332 + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '),
378 333 idCliente: $scope.remito.cliente.COD,
379 334 nombreCliente: $scope.remito.cliente.NOM,
380 335 cuitCliente: $scope.remito.cliente.CUIT,
... ... @@ -881,41 +836,4 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
881 836 }
882 837 }
883 838 }
884   - ]
885   -)
886   -.controller('remitoListaCtrl', [
887   - '$scope',
888   - 'crearRemitoService',
889   - '$location',
890   - function($scope, crearRemitoService, $location) {
891   - crearRemitoService.obtenerRemito().then(function(datos) {
892   - $scope.remitos = datos.data;
893   - });
894   - $scope.editar = function(remito) {
895   - crearRemitoService.setRemito(remito);
896   - $location.path('/venta-nota-remito/abm/');
897   - };
898   - $scope.crearRemito = function() {
899   - crearRemitoService.clearRemito();
900   - $location.path('/venta-nota-remito/abm/');
901   - };
902   - }
903   -])
904   -.controller('focaCrearRemitoFichaClienteController', [
905   - '$scope',
906   - 'crearRemitoService',
907   - '$location',
908   - function($scope, crearRemitoService, $location) {
909   - crearRemitoService.obtenerRemito().then(function(datos) {
910   - $scope.remitos = datos.data;
911   - });
912   - $scope.editar = function(remito) {
913   - crearRemitoService.setRemito(remito);
914   - $location.path('/venta-nota-remito/abm/');
915   - };
916   - $scope.crearRemito = function() {
917   - crearRemitoService.clearRemito();
918   - $location.path('/venta-nota-remito/abm/');
919   - };
920   - }
921   -]);
  839 + ]);
src/views/foca-crear-remito-ficha-cliente.html
... ... @@ -1,78 +0,0 @@
1   -<div class="modal-header">
2   - <h3 class="modal-title"></h3>
3   -</div>
4   -<div class="modal-body" id="modal-body">
5   - <div class="input-group mb-3">
6   - <input
7   - type="text"
8   - class="form-control"
9   - placeholder="Busqueda"
10   - ng-model="filters"
11   - ng-change="search()"
12   - ng-keydown="busquedaDown($event.keyCode)"
13   - ng-keypress="busquedaPress($event.keyCode)"
14   - foca-focus="selectedVendedor == -1"
15   - ng-focus="selectedVendedor = -1"
16   - >
17   - <table class="table table-striped table-sm">
18   - <thead>
19   - <tr>
20   - <th>Código</th>
21   - <th>Nombre</th>
22   - <th></th>
23   - </tr>
24   - </thead>
25   - <tbody>
26   - <tr ng-repeat="(key, vendedor) in currentPageVendedores">
27   - <td ng-bind="vendedor.CodVen"></td>
28   - <td ng-bind="vendedor.NomVen"></td>
29   - <td>
30   - <button
31   - type="button"
32   - class="btn p-2 float-right btn-sm"
33   - ng-class="{
34   - 'btn-secondary': selectedVendedor != key,
35   - 'btn-primary': selectedVendedor == key
36   - }"
37   - ng-click="select(vendedor)"
38   - foca-focus="selectedVendedor == {{key}}"
39   - ng-keydown="itemVendedor($event.keyCode)">
40   - <i class="fa fa-arrow-right" aria-hidden="true"></i>
41   - </button>
42   - </td>
43   - </tr>
44   - </tbody>
45   - </table>
46   - <nav>
47   - <ul class="pagination justify-content-end">
48   - <li class="page-item" ng-class="{'disabled': currentPage == 1}">
49   - <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)">
50   - <span aria-hidden="true">&laquo;</span>
51   - <span class="sr-only">Anterior</span>
52   - </a>
53   - </li>
54   - <li
55   - class="page-item"
56   - ng-repeat="pagina in paginas"
57   - ng-class="{'active': pagina == currentPage}"
58   - >
59   - <a
60   - class="page-link"
61   - href="#"
62   - ng-click="selectPage(pagina)"
63   - ng-bind="pagina"
64   - ></a>
65   - </li>
66   - <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
67   - <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)">
68   - <span aria-hidden="true">&raquo;</span>
69   - <span class="sr-only">Siguiente</span>
70   - </a>
71   - </li>
72   - </ul>
73   - </nav>
74   - </div>
75   -</div>
76   -<div class="modal-footer">
77   - <button class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
78   -</div>
src/views/remito-lista.html
... ... @@ -1,25 +0,0 @@
1   -<table class="table table-sm table-hover table-nonfluid">
2   - <thead>
3   - <tr>
4   - <th>Código</th>
5   - <th>Vendedor</th>
6   - <th>Cliente</th>
7   - <th>Proveedor</th>
8   - <th>Total</th>
9   - <th><button class="btn btn-primary" ng-click="crearRemito()">Crear</button></th>
10   - </tr>
11   - </thead>
12   - <tbody>
13   - <tr ng-repeat="item in remitos">
14   - <td ng-bind="item.id"></td>
15   - <td ng-bind="item.vendedor"></td>
16   - <td ng-bind="item.cliente"></td>
17   - <td ng-bind="item.proveedor"></td>
18   - <td ng-bind="(item.total | 0) | currency"></td>
19   - <td>
20   - <button class="btn btn-info" ng-show="false" ng-click="editar(item)"><i class="fa fa-edit"></i></button>
21   - <!-- <button class="btn btn-danger" ng-click="borrar(item.id)"><i class="fa fa-trash"></i></button> -->
22   - </td>
23   - </tr>
24   - </tbody>
25   -</table>