Commit 629eef2c09fd15ad1a47730803031828526a55fd
1 parent
a4ce9f88c9
Exists in
master
and in
1 other branch
fix detalles correctos
Showing
3 changed files
with
12 additions
and
7 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaModalFacturaDetalle') | 1 | angular.module('focaModalFacturaDetalle') |
| 2 | .controller('focaModalFacturaDetalleController', | 2 | .controller('focaModalFacturaDetalleController', |
| 3 | [ | 3 | [ |
| 4 | '$scope', | 4 | '$scope', |
| 5 | '$uibModalInstance', | 5 | '$uibModalInstance', |
| 6 | 'focaModalFacturaDetalleService', | 6 | 'focaModalFacturaDetalleService', |
| 7 | 'factura', | 7 | 'factura', |
| 8 | function($scope, $uibModalInstance, | 8 | function($scope, $uibModalInstance, |
| 9 | focaModalFacturaDetalleService, factura | 9 | focaModalFacturaDetalleService, factura |
| 10 | ) { | 10 | ) { |
| 11 | $scope.factura = factura; | 11 | $scope.factura = factura; |
| 12 | $scope.detalles = []; | 12 | $scope.detalles = []; |
| 13 | focaModalFacturaDetalleService | 13 | focaModalFacturaDetalleService |
| 14 | .getFacturasDetalleByNCO(factura.NCO) | 14 | .getFacturasDetalleByNCO({ |
| 15 | tip: factura.TIP, | ||
| 16 | tco: factura.TCO, | ||
| 17 | suc: factura.SUC, | ||
| 18 | nco: factura.NCO | ||
| 19 | }) | ||
| 15 | .then(function(res) { | 20 | .then(function(res) { |
| 16 | $scope.detalles = res.data; | 21 | $scope.detalles = res.data; |
| 17 | }); | 22 | }); |
| 18 | 23 | ||
| 19 | $scope.cerrar = function() { | 24 | $scope.cerrar = function() { |
| 20 | $uibModalInstance.dismiss(); | 25 | $uibModalInstance.dismiss(); |
| 21 | }; | 26 | }; |
| 22 | 27 | ||
| 23 | switch(factura.TCO){ | 28 | switch(factura.TCO){ |
| 24 | case 'NC': | 29 | case 'NC': |
| 25 | $scope.factura.tipoComprobante = 'Nota de crédito'; | 30 | $scope.factura.tipoComprobante = 'Nota de crédito'; |
| 26 | break; | 31 | break; |
| 27 | case 'CI': | 32 | case 'CI': |
| 28 | $scope.factura.tipoComprobante = 'Comprobante interno'; | 33 | $scope.factura.tipoComprobante = 'Comprobante interno'; |
| 29 | break; | 34 | break; |
| 30 | case 'ND': | 35 | case 'ND': |
| 31 | $scope.factura.tipoComprobante = 'Nota de débito'; | 36 | $scope.factura.tipoComprobante = 'Nota de débito'; |
| 32 | break; | 37 | break; |
| 33 | case 'NI': | 38 | case 'NI': |
| 34 | $scope.factura.tipoComprobante = 'No de débito interno'; | 39 | $scope.factura.tipoComprobante = 'No de débito interno'; |
| 35 | break; | 40 | break; |
| 36 | case 'TI': | 41 | case 'TI': |
| 37 | $scope.factura.tipoComprobante = 'Ticket'; | 42 | $scope.factura.tipoComprobante = 'Ticket'; |
| 38 | break; | 43 | break; |
| 39 | case 'FT': | 44 | case 'FT': |
| 40 | $scope.factura.tipoComprobante = 'Factura'; | 45 | $scope.factura.tipoComprobante = 'Factura'; |
| 41 | break; | 46 | break; |
| 42 | } | 47 | } |
| 43 | } | 48 | } |
| 44 | ] | 49 | ] |
| 45 | ); | 50 | ); |
| 46 | 51 |
src/js/service.js
| 1 | angular.module('focaModalFacturaDetalle') | 1 | angular.module('focaModalFacturaDetalle') |
| 2 | .factory('focaModalFacturaDetalleService', [ | 2 | .factory('focaModalFacturaDetalleService', [ |
| 3 | '$http', | 3 | '$http', |
| 4 | 'API_ENDPOINT', | 4 | 'API_ENDPOINT', |
| 5 | function($http, API_ENDPOINT) { | 5 | function($http, API_ENDPOINT) { |
| 6 | return { | 6 | return { |
| 7 | getFacturasDetalleByNCO: function(nco) { | 7 | getFacturasDetalleByNCO: function(data) { |
| 8 | return $http.get( | 8 | return $http.post( |
| 9 | API_ENDPOINT.URL + '/factura/' + nco + '/detalles'); | 9 | API_ENDPOINT.URL + '/factura/detalles', data); |
| 10 | } | 10 | } |
| 11 | }; | 11 | }; |
| 12 | } | 12 | } |
| 13 | ]); | 13 | ]); |
| 14 | 14 |
src/views/foca-modal-factura-detalle.html
| 1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> |
| 2 | <div class="row"> | 2 | <div class="row"> |
| 3 | <div class="col-md-4"></div> | 3 | <div class="col-md-4"></div> |
| 4 | <div class="col-md-4 text-center"> | 4 | <div class="col-md-4 text-center"> |
| 5 | <strong>{{factura.tipoComprobante}} | 5 | <strong>{{factura.tipoComprobante}} |
| 6 | <br>{{factura.TIP}}</strong> | 6 | <br>{{factura.TIP}}</strong> |
| 7 | </div> | 7 | </div> |
| 8 | <div class="col-md-4 text-center text-md-right"> | 8 | <div class="col-md-4 text-center text-md-right"> |
| 9 | {{factura.SUC | rellenarDigitos: 4: 0}}-{{factura.NCO | rellenarDigitos: 8: 0}} | 9 | {{factura.SUC | rellenarDigitos: 4: 0}}-{{factura.NCO | rellenarDigitos: 8: 0}} |
| 10 | <br class="d-none d-md-block">{{factura.FECHA_COMPROBANTE | date: 'dd/MM/yyyy'}} | 10 | <br class="d-none d-md-block">{{factura.FECHA_COMPROBANTE | date: 'dd/MM/yyyy'}} |
| 11 | </div> | 11 | </div> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | <div class="modal-body" id="modal-body"> | 14 | <div class="modal-body" id="modal-body"> |
| 15 | <div class="row"> | 15 | <div class="row"> |
| 16 | <div class="col-12"> | 16 | <div class="col-12"> |
| 17 | <small><strong>({{factura.cliente.COD | rellenarDigitos: 5: 0}}) {{factura.cliente.NOM}}</strong></small> | 17 | <small><strong>({{factura.cliente.COD | rellenarDigitos: 5: 0}}) {{factura.cliente.NOM}}</strong></small> |
| 18 | <br><small><strong>{{factura.cliente.DOM}}, {{factura.cliente.LOC}}, {{factura.cliente.PCI}}</strong></small> | 18 | <br><small><strong>{{factura.cliente.DOM}}, {{factura.cliente.LOC}}, {{factura.cliente.PCI}}</strong></small> |
| 19 | <br><small><strong>PAGO: {{factura.formaPago.NOMBRE}}</strong><strong class="float-right">Items: {{detalles.length}}</strong></small> | 19 | <br><small><strong>PAGO: {{factura.formaPago.NOMBRE}}</strong><strong class="float-right">Items: {{detalles.length}}</strong></small> |
| 20 | </div> | 20 | </div> |
| 21 | </div> | 21 | </div> |
| 22 | <div class="row"> | 22 | <div class="row"> |
| 23 | <div class="col-12"> | 23 | <div class="col-12"> |
| 24 | <table class="table table-sm mt-3"> | 24 | <table class="table table-sm mt-3 tabla-factura"> |
| 25 | <thead> | 25 | <thead> |
| 26 | <tr> | 26 | <tr> |
| 27 | <th>Codigo</th> | 27 | <th>Codigo</th> |
| 28 | <th>Cantidad</th> | 28 | <th>Cantidad</th> |
| 29 | <th>Detalle</th> | 29 | <th>Detalle</th> |
| 30 | <th>Precio</th> | 30 | <th>Precio</th> |
| 31 | <th>Importe</th> | 31 | <th>Importe</th> |
| 32 | </tr> | 32 | </tr> |
| 33 | </thead> | 33 | </thead> |
| 34 | <tbody> | 34 | <tbody> |
| 35 | <tr ng-repeat="detalle in detalles"> | 35 | <tr ng-repeat="detalle in detalles"> |
| 36 | <td class="border-right border-top-0"><small>{{detalle.COD | rellenarDigitos: 2: 0}}-{{detalle.ART | rellenarDigitos: 5: 0}}</small></td> | 36 | <td class="border-right border-top-0"><small>{{detalle.COD | rellenarDigitos: 2: 0}}-{{detalle.ART | rellenarDigitos: 5: 0}}</small></td> |
| 37 | <td class="border-right border-top-0 text-right"><small ng-bind="detalle.CAN | number: 2"></small></td> | 37 | <td class="border-right border-top-0 text-right"><small ng-bind="detalle.CAN | number: 2"></small></td> |
| 38 | <td class="border-right border-top-0"><small ng-bind="detalle.TIO"></small></td> | 38 | <td class="border-right border-top-0"><small ng-bind="detalle.TIO"></small></td> |
| 39 | <td class="border-right border-top-0 text-right"><small ng-bind="detalle.PUN | number: 2"></small></td> | 39 | <td class="border-right border-top-0 text-right"><small ng-bind="detalle.PUT | number: 2"></small></td> |
| 40 | <td class="border-top-0 text-right"><small ng-bind="detalle.PUN * detalle.CAN | number: 2"></small></td> | 40 | <td class="border-top-0 text-right"><small ng-bind="detalle.PUT * detalle.CAN | number: 2"></small></td> |
| 41 | </tr> | 41 | </tr> |
| 42 | </tbody> | 42 | </tbody> |
| 43 | </table> | 43 | </table> |
| 44 | <table class="table table-sm table-bordered"> | 44 | <table class="table table-sm table-bordered"> |
| 45 | <tbody> | 45 | <tbody> |
| 46 | <tr> | 46 | <tr> |
| 47 | <td><small>Neto</small></td> | 47 | <td><small>Neto</small></td> |
| 48 | <td><small>IVA</small></td> | 48 | <td><small>IVA</small></td> |
| 49 | <td><small>Percepción</small></td> | 49 | <td><small>Percepción</small></td> |
| 50 | <td><small>Imp internos</small></td> | 50 | <td><small>Imp internos</small></td> |
| 51 | <td><small>Perc. IVA</small></td> | 51 | <td><small>Perc. IVA</small></td> |
| 52 | </tr> | 52 | </tr> |
| 53 | </tbody> | 53 | </tbody> |
| 54 | <tbody> | 54 | <tbody> |
| 55 | <tr> | 55 | <tr> |
| 56 | <td class="text-right" ng-bind="factura.NETO | number: 2"></td> | 56 | <td class="text-right" ng-bind="factura.NETO | number: 2"></td> |
| 57 | <td class="text-right" ng-bind="factura.IVA | number: 2"></td> | 57 | <td class="text-right" ng-bind="factura.IVA | number: 2"></td> |
| 58 | <td class="text-right" ng-bind="factura.PERCEPCION_IIBB"></td> | 58 | <td class="text-right" ng-bind="factura.PERCEPCION_IIBB"></td> |
| 59 | <td class="text-right" ng-bind="factura.IMPUESTOS_INTERNOS | number: 2"></td> | 59 | <td class="text-right" ng-bind="factura.IMPUESTOS_INTERNOS | number: 2"></td> |
| 60 | <td class="text-right" ng-bind="factura.PERCECPION_IVA | number: 2"></td> | 60 | <td class="text-right" ng-bind="factura.PERCECPION_IVA | number: 2"></td> |
| 61 | </tr> | 61 | </tr> |
| 62 | </tbody> | 62 | </tbody> |
| 63 | <tbody> | 63 | <tbody> |
| 64 | <tr> | 64 | <tr> |
| 65 | <td></td> | 65 | <td></td> |
| 66 | <td></td> | 66 | <td></td> |
| 67 | <td><small>Moneda</small></td> | 67 | <td><small>Moneda</small></td> |
| 68 | <td><small>Coticacion</small></td> | 68 | <td><small>Coticacion</small></td> |
| 69 | <td><small><strong>Total</strong></small></td> | 69 | <td><small><strong>Total</strong></small></td> |
| 70 | </tr> | 70 | </tr> |
| 71 | </tbody> | 71 | </tbody> |
| 72 | <tbody> | 72 | <tbody> |
| 73 | <tr> | 73 | <tr> |
| 74 | <td></td> | 74 | <td></td> |
| 75 | <td></td> | 75 | <td></td> |
| 76 | <td ng-bind="factura.moneda.CODIGO_AFIP"></td> | 76 | <td ng-bind="factura.moneda.CODIGO_AFIP"></td> |
| 77 | <td class="text-right" ng-bind="factura.COTIZACION | number: 2"></td> | 77 | <td class="text-right" ng-bind="factura.COTIZACION | number: 2"></td> |
| 78 | <td class="text-right" ng-bind="factura.TOTAL | number: 2"></td> | 78 | <td class="text-right" ng-bind="factura.TOTAL | number: 2"></td> |
| 79 | </tr> | 79 | </tr> |
| 80 | </tbody> | 80 | </tbody> |
| 81 | </table> | 81 | </table> |
| 82 | </div> | 82 | </div> |
| 83 | </div> | 83 | </div> |
| 84 | </div> | 84 | </div> |
| 85 | <div class="modal-footer py-1"> | 85 | <div class="modal-footer py-1"> |
| 86 | <div class="row"> | 86 | <div class="row"> |
| 87 | <div class="col-12"> | 87 | <div class="col-12"> |
| 88 | <button | 88 | <button |
| 89 | class="btn btn-primary" | 89 | class="btn btn-primary" |
| 90 | ng-click="cerrar()" | 90 | ng-click="cerrar()" |
| 91 | >Cerrar</button> | 91 | >Cerrar</button> |
| 92 | </div> | 92 | </div> |
| 93 | </div> | 93 | </div> |
| 94 | </div> | 94 | </div> |
| 95 | 95 |