Commit df5db9d1485ae68900fc8ae0587479306d7c85a6

Authored by Eric Fernandez
1 parent 0fb9e9af2f
Exists in master

Todos los precios usan simbolo elegido por moneda

los articulos se guardan con el precio original
src/js/controller.js
... ... @@ -155,15 +155,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
155 155 };
156 156 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
157 157 function(data) {
  158 + crearNotaPedidoService.addArticulos($scope.articulosTabla,
  159 + data.data.id, $scope.notaPedido.cotizacion.COTIZACION);
158 160  
159   - var articulosNotaPedido = $scope.articulosTabla;
160   - for(var i = 0; i < articulosNotaPedido.length; i++) {
161   - delete articulosNotaPedido[i].editCantidad;
162   - delete articulosNotaPedido[i].editPrecio;
163   - articulosNotaPedido[i].idNotaPedido = data.data.id;
164   - crearNotaPedidoService
165   - .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
166   - }
167 161 var plazos = $scope.plazosPagos;
168 162 for(var j = 0; j < plazos.length; j++) {
169 163 var json = {
... ... @@ -179,7 +173,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
179 173 'Fecha cotizacion:',
180 174 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy')
181 175 );
182   - addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.cotizacion);
  176 + addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION);
183 177 $scope.notaPedido.vendedor = {};
184 178 $scope.notaPedido.cliente = {};
185 179 $scope.notaPedido.proveedor = {};
... ... @@ -205,8 +199,11 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
205 199 templateUrl: 'modal-busqueda-productos.html',
206 200 controller: 'modalBusquedaProductosCtrl',
207 201 resolve: {
208   - idLista: function() { return $scope.idLista; },
209   - cotizacion: $scope.notaPedido.cotizacion.COTIZACION
  202 + parametroProducto: {
  203 + idLista: $scope.idLista,
  204 + cotizacion: $scope.notaPedido.cotizacion.COTIZACION,
  205 + simbolo: $scope.notaPedido.moneda.simbolo
  206 + }
210 207 },
211 208 size: 'lg'
212 209 }
... ... @@ -222,7 +219,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
222 219 descripcion: producto.descripcion,
223 220 item: $scope.articulosTabla.length + 1,
224 221 nombre: producto.descripcion,
225   - precio: parseFloat(producto.precio.toFixed(2)),
  222 + precio: parseFloat(producto.precio.toFixed(4)),
226 223 costoUnitario: producto.costo,
227 224 editCantidad: false,
228 225 editPrecio: false
... ... @@ -424,7 +421,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
424 421 ($scope.notaPedido.fob ? 'FOB' : 'No'));
425 422 if(datos.flete) {
426 423 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
427   - addCabecera('Kilometros:', datos.kilometros ? 'Si' : 'No');
  424 + addCabecera('Kilometros:', datos.kilometros);
428 425 } else {
429 426 removeCabecera('Bomba:');
430 427 removeCabecera('Kilometros:');
... ... @@ -484,7 +481,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
484 481 $scope.notaPedido.cotizacion = {
485 482 ID: cotizacion.ID,
486 483 COTIZACION: cotizacion.COTIZACION,
487   - FECHA: cotizacion.fecha
  484 + FECHA: cotizacion.FECHA
488 485 };
489 486 addCabecera('Moneda:', moneda.DETALLE);
490 487 addCabecera(
... ... @@ -48,6 +48,15 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
48 48 },
49 49 getCotizacionByIdMoneda: function(id) {
50 50 return $http.get(route + '/moneda/' + id);
  51 + },
  52 + addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) {
  53 + for(var i = 0; i < articulosNotaPedido.length; i++) {
  54 + delete articulosNotaPedido[i].editCantidad;
  55 + delete articulosNotaPedido[i].editPrecio;
  56 + articulosNotaPedido[i].idNotaPedido = idNotaPedido;
  57 + articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion;
  58 + this.crearArticulosParaNotaPedido(articulosNotaPedido[i]);
  59 + }
51 60 }
52 61 };
53 62 }]);
src/views/nota-pedido.html
... ... @@ -124,7 +124,7 @@
124 124 class="col"
125 125 ng-bind="articulo.sector + '-' + articulo.codigo"
126 126 ></td>
127   - <td
  127 + <td
128 128 class="col-4"
129 129 ng-bind="articulo.descripcion"
130 130 ></td>
... ... @@ -153,7 +153,7 @@
153 153 class="form-control"
154 154 type="number"
155 155 min="1"
156   - step="0.01"
  156 + step="0.0001"
157 157 foca-focus="articulo.editPrecio"
158 158 ng-keypress="editarArticulo($event.keyCode, articulo)"
159 159 ng-focus="selectFocus($event)"
... ... @@ -162,12 +162,12 @@
162 162 class="selectable"
163 163 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
164 164 ng-hide="articulo.editPrecio"
165   - ng-bind="articulo.precio | currency: '$'">
  165 + ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4">
166 166 </i>
167 167 </td>
168 168 <td
169 169 class="col text-right"
170   - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'">
  170 + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo">
171 171 </td>
172 172 <td class="text-center">
173 173 <button
... ... @@ -213,14 +213,14 @@
213 213 <td class="col text-right">
214 214 <input
215 215 class="form-control"
216   - ng-value="articuloACargar.precio | currency: '$'"
  216 + ng-value="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4"
217 217 ng-show="idLista != -1"
218 218 readonly
219 219 >
220 220 <input
221 221 class="form-control"
222 222 type="number"
223   - step="0.01"
  223 + step="0.0001"
224 224 ng-model="articuloACargar.precio"
225 225 esc-key="resetFilter()"
226 226 ng-keypress="agregarATabla($event.keyCode)"
... ... @@ -230,7 +230,7 @@
230 230 <td class="col text-right">
231 231 <input
232 232 class="form-control"
233   - ng-value="getSubTotal() | currency: '$'"
  233 + ng-value="getSubTotal() | currency: notaPedido.moneda.simbolo"
234 234 readonly
235 235 ></td>
236 236 <td class="text-center align-middle">
... ... @@ -261,7 +261,7 @@
261 261 <h3>Total:</h3>
262 262 </td>
263 263 <td class="table-celda-total text-right no-border-top" colspan="1">
264   - <h3>{{getTotal() | currency: '$'}}</h3>
  264 + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3>
265 265 </td>
266 266 <td class="text-right no-border-top">
267 267 <button
... ... @@ -323,11 +323,11 @@
323 323 <span ng-bind="'x' + articulo.cantidad"></span>
324 324 </div>
325 325 <div class="col-3 px-1 text-right">
326   - <span ng-bind="articulo.precio | currency: '$'"></span>
  326 + <span ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4"></span>
327 327 </div>
328 328 <div class="col px-1 text-right">
329 329 <span
330   - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"
  330 + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo"
331 331 >
332 332 </span>
333 333 </div>
... ... @@ -375,11 +375,11 @@
375 375 >
376 376 </div>
377 377 <div class="col-3 px-1 text-right">
378   - <span ng-bind="articuloACargar.precio | currency: '$'"></span>
  378 + <span ng-bind="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4"></span>
379 379 </div>
380 380 <div class="col px-1 text-right">
381 381 <span
382   - ng-bind="getSubTotal() | currency: '$'"
  382 + ng-bind="getSubTotal() | currency: notaPedido.moneda.simbolo"
383 383 >
384 384 </span>
385 385 </div>
... ... @@ -437,7 +437,7 @@
437 437 <h3>Total:</h3>
438 438 </td>
439 439 <td class="table-celda-total text-right no-border-top">
440   - <h3>{{getTotal() | currency: '$'}}</h3>
  440 + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3>
441 441 </td>
442 442 </tr>
443 443 </tfoot>