Commit d661a13633bd703280018b9a8c383e8a23e60731
1 parent
e9ecb68964
Exists in
master
funcionamiento grilla articulos
Showing
2 changed files
with
47 additions
and
19 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearNotaPedido') | 1 | angular.module('focaCrearNotaPedido') |
| 2 | .controller('notaPedidoCtrl', | 2 | .controller('notaPedidoCtrl', |
| 3 | ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', | 3 | ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', |
| 4 | function($scope, $uibModal, $location, crearNotaPedidoService) { | 4 | function($scope, $uibModal, $location, crearNotaPedidoService) { |
| 5 | $scope.show = false; | 5 | $scope.show = false; |
| 6 | 6 | $scope.edit = false; | |
| 7 | $scope.dateOptions = { | 7 | $scope.dateOptions = { |
| 8 | maxDate: new Date(), | 8 | maxDate: new Date(), |
| 9 | minDate: new Date(2010, 0, 1) | 9 | minDate: new Date(2010, 0, 1) |
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | $scope.notaPedido = { | 12 | $scope.notaPedido = { |
| 13 | vendedor: {}, | 13 | vendedor: {}, |
| 14 | cliente: {} | 14 | cliente: {} |
| 15 | }; | 15 | }; |
| 16 | $scope.articulosTabla = []; | 16 | $scope.articulosTabla = []; |
| 17 | var idLista; | 17 | var idLista; |
| 18 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 18 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
| 19 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); | 19 | $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); |
| 20 | crearNotaPedidoService.getPrecioCondicion().then( | 20 | crearNotaPedidoService.getPrecioCondicion().then( |
| 21 | function(res) { | 21 | function(res) { |
| 22 | $scope.precioCondiciones = res.data; | 22 | $scope.precioCondiciones = res.data; |
| 23 | } | 23 | } |
| 24 | ); | 24 | ); |
| 25 | if (notaPedidoTemp !== undefined) { | 25 | if (notaPedidoTemp !== undefined) { |
| 26 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 26 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
| 27 | $scope.notaPedido = notaPedidoTemp; | 27 | $scope.notaPedido = notaPedidoTemp; |
| 28 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 28 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
| 29 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 29 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
| 30 | idLista = $scope.notaPedido.precioCondicion; | 30 | idLista = $scope.notaPedido.precioCondicion; |
| 31 | crearNotaPedidoService | 31 | crearNotaPedidoService |
| 32 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 32 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
| 33 | function(res) { | 33 | function(res) { |
| 34 | $scope.articulosTabla = res.data; | 34 | $scope.articulosTabla = res.data; |
| 35 | } | 35 | } |
| 36 | ); | 36 | ); |
| 37 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 37 | crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
| 38 | function(res) { | 38 | function(res) { |
| 39 | $scope.notaPedido.domicilio = res.data; | 39 | $scope.notaPedido.domicilio = res.data; |
| 40 | } | 40 | } |
| 41 | ); | 41 | ); |
| 42 | } else { | 42 | } else { |
| 43 | $scope.notaPedido.fechaCarga = new Date(); | 43 | $scope.notaPedido.fechaCarga = new Date(); |
| 44 | $scope.notaPedido.domicilio = [{ id: 0 }]; | 44 | $scope.notaPedido.domicilio = [{ id: 0 }]; |
| 45 | $scope.notaPedido.bomba = '1'; | 45 | $scope.notaPedido.bomba = '1'; |
| 46 | $scope.notaPedido.flete = '0'; | 46 | $scope.notaPedido.flete = '0'; |
| 47 | idLista = undefined; | 47 | idLista = undefined; |
| 48 | } | 48 | } |
| 49 | $scope.addNewDom = function() { | 49 | $scope.addNewDom = function() { |
| 50 | $scope.notaPedido.domicilio.push({ 'id': 0 }); | 50 | $scope.notaPedido.domicilio.push({ 'id': 0 }); |
| 51 | }; | 51 | }; |
| 52 | $scope.removeNewChoice = function(choice) { | 52 | $scope.removeNewChoice = function(choice) { |
| 53 | if ($scope.notaPedido.domicilio.length > 1) { | 53 | if ($scope.notaPedido.domicilio.length > 1) { |
| 54 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 54 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
| 55 | function(c) { | 55 | function(c) { |
| 56 | return c.$$hashKey === choice.$$hashKey; | 56 | return c.$$hashKey === choice.$$hashKey; |
| 57 | } | 57 | } |
| 58 | ), 1); | 58 | ), 1); |
| 59 | } | 59 | } |
| 60 | }; | 60 | }; |
| 61 | $scope.crearNotaPedido = function() { | 61 | $scope.crearNotaPedido = function() { |
| 62 | var notaPedido = { | 62 | var notaPedido = { |
| 63 | id: 0, | 63 | id: 0, |
| 64 | precioCondicion: $scope.notaPedido.precioCondicion, | 64 | precioCondicion: $scope.notaPedido.precioCondicion, |
| 65 | fechaCarga: $scope.notaPedido.fechaCarga, | 65 | fechaCarga: $scope.notaPedido.fechaCarga, |
| 66 | vendedor: $scope.notaPedido.vendedor, | 66 | vendedor: $scope.notaPedido.vendedor, |
| 67 | cliente: $scope.notaPedido.cliente, | 67 | cliente: $scope.notaPedido.cliente, |
| 68 | producto: $scope.notaPedido.producto, | 68 | producto: $scope.notaPedido.producto, |
| 69 | bomba: $scope.notaPedido.bomba, | 69 | bomba: $scope.notaPedido.bomba, |
| 70 | petrolera: $scope.notaPedido.petrolera, | 70 | petrolera: $scope.notaPedido.petrolera, |
| 71 | domicilio: $scope.notaPedido.domicilio, | 71 | domicilio: $scope.notaPedido.domicilio, |
| 72 | kilometros: $scope.notaPedido.kilometros, | 72 | kilometros: $scope.notaPedido.kilometros, |
| 73 | jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB, | 73 | jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB, |
| 74 | costoFinanciacion: $scope.notaPedido.costoFinanciacion, | 74 | costoFinanciacion: $scope.notaPedido.costoFinanciacion, |
| 75 | flete: $scope.notaPedido.flete, | 75 | flete: $scope.notaPedido.flete, |
| 76 | costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, | 76 | costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, |
| 77 | total: $scope.articulosTabla[0].subTotal | 77 | total: $scope.articulosTabla[0].subTotal |
| 78 | }; | 78 | }; |
| 79 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 79 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 80 | function() { | 80 | function() { |
| 81 | alert('Nota pedido creada'); | 81 | alert('Nota pedido creada'); |
| 82 | $location.path('/venta-nota-pedido'); | 82 | $location.path('/venta-nota-pedido'); |
| 83 | } | 83 | } |
| 84 | ); | 84 | ); |
| 85 | var articulosNotaPedido = $scope.articulosTabla; | 85 | var articulosNotaPedido = $scope.articulosTabla; |
| 86 | for(var i = 0; i< articulosNotaPedido.length;i++) { | 86 | for(var i = 0; i< articulosNotaPedido.length;i++) { |
| 87 | crearNotaPedidoService | 87 | crearNotaPedidoService |
| 88 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | 88 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( |
| 89 | function() { | 89 | function() { |
| 90 | return; | 90 | return; |
| 91 | } | 91 | } |
| 92 | ); | 92 | ); |
| 93 | } | 93 | } |
| 94 | }; | 94 | }; |
| 95 | $scope.siguienteTab = function() { | 95 | $scope.siguienteTab = function() { |
| 96 | $scope.active = 1; | 96 | $scope.active = 1; |
| 97 | }; | 97 | }; |
| 98 | $scope.seleccionarArticulo = function() { | 98 | $scope.seleccionarArticulo = function() { |
| 99 | if (idLista === undefined) { | 99 | if (idLista === undefined) { |
| 100 | alert('primero seleccione una lista de precio y condicion'); | 100 | alert('primero seleccione una lista de precio y condicion'); |
| 101 | return; | 101 | return; |
| 102 | } | 102 | } |
| 103 | var modalInstance = $uibModal.open( | 103 | var modalInstance = $uibModal.open( |
| 104 | { | 104 | { |
| 105 | ariaLabelledBy: 'Busqueda de Productos', | 105 | ariaLabelledBy: 'Busqueda de Productos', |
| 106 | templateUrl: 'modal-busqueda-productos.html', | 106 | templateUrl: 'modal-busqueda-productos.html', |
| 107 | controller: 'modalBusquedaProductosCtrl', | 107 | controller: 'modalBusquedaProductosCtrl', |
| 108 | resolve: { idLista: function() { return idLista; } }, | 108 | resolve: { idLista: function() { return idLista; } }, |
| 109 | size: 'lg' | 109 | size: 'lg' |
| 110 | } | 110 | } |
| 111 | ); | 111 | ); |
| 112 | modalInstance.result.then( | 112 | modalInstance.result.then( |
| 113 | function(producto) { | 113 | function(producto) { |
| 114 | var newArt = | 114 | var newArt = |
| 115 | { | 115 | { |
| 116 | id: 0, | 116 | id: 0, |
| 117 | codigo: producto.codigo, | 117 | codigo: producto.codigo, |
| 118 | sector: producto.sector, | 118 | sector: producto.sector, |
| 119 | descripcion: producto.descripcion, | 119 | descripcion: producto.descripcion, |
| 120 | item: $scope.articulosTabla.length + 1, | 120 | item: $scope.articulosTabla.length + 1, |
| 121 | nombre: producto.descripcion, | 121 | nombre: producto.descripcion, |
| 122 | precio: producto.precio.toFixed(2), | 122 | precio: producto.precio.toFixed(2), |
| 123 | costoUnitario: producto.costo, | 123 | costoUnitario: producto.costo, |
| 124 | cantidad: 1 | 124 | cantidad: 1 |
| 125 | }; | 125 | }; |
| 126 | $scope.articuloACargar = newArt; | 126 | $scope.articuloACargar = newArt; |
| 127 | }, function() { | 127 | }, function() { |
| 128 | // funcion ejecutada cuando se cancela el modal | 128 | // funcion ejecutada cuando se cancela el modal |
| 129 | } | 129 | } |
| 130 | ); | 130 | ); |
| 131 | }; | 131 | }; |
| 132 | $scope.seleccionarVendedor = function() { | 132 | $scope.seleccionarVendedor = function() { |
| 133 | var modalInstance = $uibModal.open( | 133 | var modalInstance = $uibModal.open( |
| 134 | { | 134 | { |
| 135 | ariaLabelledBy: 'Busqueda de Vendedores', | 135 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 136 | templateUrl: 'modal-vendedores.html', | 136 | templateUrl: 'modal-vendedores.html', |
| 137 | controller: 'modalVendedoresCtrl', | 137 | controller: 'modalVendedoresCtrl', |
| 138 | size: 'lg' | 138 | size: 'lg' |
| 139 | } | 139 | } |
| 140 | ); | 140 | ); |
| 141 | modalInstance.result.then( | 141 | modalInstance.result.then( |
| 142 | function(vendedor) { | 142 | function(vendedor) { |
| 143 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 143 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
| 144 | }, function() { | 144 | }, function() { |
| 145 | 145 | ||
| 146 | } | 146 | } |
| 147 | ); | 147 | ); |
| 148 | }; | 148 | }; |
| 149 | $scope.seleccionarPetrolera = function() { | 149 | $scope.seleccionarPetrolera = function() { |
| 150 | var modalInstance = $uibModal.open( | 150 | var modalInstance = $uibModal.open( |
| 151 | { | 151 | { |
| 152 | ariaLabelledBy: 'Busqueda de Petrolera', | 152 | ariaLabelledBy: 'Busqueda de Petrolera', |
| 153 | templateUrl: 'modal-petroleras.html', | 153 | templateUrl: 'modal-petroleras.html', |
| 154 | controller: 'modalPetrolerasCtrl', | 154 | controller: 'modalPetrolerasCtrl', |
| 155 | size: 'lg' | 155 | size: 'lg' |
| 156 | } | 156 | } |
| 157 | ); | 157 | ); |
| 158 | modalInstance.result.then( | 158 | modalInstance.result.then( |
| 159 | function(petrolera) { | 159 | function(petrolera) { |
| 160 | $scope.notaPedido.petrolera = petrolera.NOM; | 160 | $scope.notaPedido.petrolera = petrolera.NOM; |
| 161 | }, function() { | 161 | }, function() { |
| 162 | 162 | ||
| 163 | } | 163 | } |
| 164 | ); | 164 | ); |
| 165 | }; | 165 | }; |
| 166 | $scope.seleccionarCliente = function() { | 166 | $scope.seleccionarCliente = function() { |
| 167 | var modalInstance = $uibModal.open( | 167 | var modalInstance = $uibModal.open( |
| 168 | { | 168 | { |
| 169 | ariaLabelledBy: 'Busqueda de Cliente', | 169 | ariaLabelledBy: 'Busqueda de Cliente', |
| 170 | templateUrl: 'foca-busqueda-cliente-modal.html', | 170 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 171 | controller: 'focaBusquedaClienteModalController', | 171 | controller: 'focaBusquedaClienteModalController', |
| 172 | size: 'lg' | 172 | size: 'lg' |
| 173 | } | 173 | } |
| 174 | ); | 174 | ); |
| 175 | modalInstance.result.then( | 175 | modalInstance.result.then( |
| 176 | function(cliente) { | 176 | function(cliente) { |
| 177 | $scope.notaPedido.cliente.nombre = cliente.nom; | 177 | $scope.notaPedido.cliente.nombre = cliente.nom; |
| 178 | }, function() { | 178 | }, function() { |
| 179 | 179 | ||
| 180 | } | 180 | } |
| 181 | ); | 181 | ); |
| 182 | }; | 182 | }; |
| 183 | $scope.mostrarFichaCliente = function() { | 183 | $scope.mostrarFichaCliente = function() { |
| 184 | $uibModal.open( | 184 | $uibModal.open( |
| 185 | { | 185 | { |
| 186 | ariaLabelledBy: 'Datos del Cliente', | 186 | ariaLabelledBy: 'Datos del Cliente', |
| 187 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 187 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
| 188 | controller: 'focaCrearNotaPedidoFichaClienteController', | 188 | controller: 'focaCrearNotaPedidoFichaClienteController', |
| 189 | size: 'lg' | 189 | size: 'lg' |
| 190 | } | 190 | } |
| 191 | ); | 191 | ); |
| 192 | }; | 192 | }; |
| 193 | $scope.obtenerDomicilios = function(id) { | 193 | $scope.obtenerDomicilios = function(id) { |
| 194 | crearNotaPedidoService.getDomicilios(id).then( | 194 | crearNotaPedidoService.getDomicilios(id).then( |
| 195 | function(res) { | 195 | function(res) { |
| 196 | $scope.notaPedido.domicilio = res.data; | 196 | $scope.notaPedido.domicilio = res.data; |
| 197 | } | 197 | } |
| 198 | ); | 198 | ); |
| 199 | }; | 199 | }; |
| 200 | $scope.getSubTotal = function(item) { | 200 | $scope.getTotal = function() { |
| 201 | var subTotal = 0; | 201 | var total = 0; |
| 202 | var array = $scope.articulosTabla.filter( | 202 | var array = $scope.articulosTabla; |
| 203 | function(a) { | ||
| 204 | return a.item <= item; | ||
| 205 | } | ||
| 206 | ); | ||
| 207 | for (var i = 0; i < array.length; i++) { | 203 | for (var i = 0; i < array.length; i++) { |
| 208 | subTotal += array[i].precio * array[i].cantidad; | 204 | total += array[i].precio * array[i].cantidad; |
| 209 | } | 205 | } |
| 210 | return subTotal.toFixed(2); | 206 | return total.toFixed(2); |
| 207 | }; | ||
| 208 | $scope.getSubTotal = function() { | ||
| 209 | if($scope.articuloACargar) { | ||
| 210 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | ||
| 211 | } | ||
| 211 | }; | 212 | }; |
| 212 | $scope.cargarArticulos = function() { | 213 | $scope.cargarArticulos = function() { |
| 213 | idLista = $scope.notaPedido.precioCondicion; | 214 | idLista = $scope.notaPedido.precioCondicion; |
| 214 | $scope.articulosTabla = []; | 215 | $scope.articulosTabla = []; |
| 215 | }; | 216 | }; |
| 216 | $scope.abrirModalListaPrecio = function() { | 217 | $scope.abrirModalListaPrecio = function() { |
| 217 | var modalInstance = $uibModal.open( | 218 | var modalInstance = $uibModal.open( |
| 218 | { | 219 | { |
| 219 | ariaLabelledBy: 'Busqueda de Precio Condición', | 220 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 220 | templateUrl: 'modal-precio-condicion.html', | 221 | templateUrl: 'modal-precio-condicion.html', |
| 221 | controller: 'focaModalPrecioCondicionController', | 222 | controller: 'focaModalPrecioCondicionController', |
| 222 | size: 'lg' | 223 | size: 'lg' |
| 223 | } | 224 | } |
| 224 | ); | 225 | ); |
| 225 | modalInstance.result.then( | 226 | modalInstance.result.then( |
| 226 | function(precioCondicion) { | 227 | function(precioCondicion) { |
| 227 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 228 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
| 228 | idLista = precioCondicion.idListaPrecio; | 229 | idLista = precioCondicion.idListaPrecio; |
| 230 | $scope.articulosTabla = []; | ||
| 229 | }, function() { | 231 | }, function() { |
| 230 | 232 | ||
| 231 | } | 233 | } |
| 232 | ); | 234 | ); |
| 233 | }; | 235 | }; |
| 234 | $scope.abrirModalFlete = function() { | 236 | $scope.abrirModalFlete = function() { |
| 235 | if($scope.notaPedido.flete === '1') { | 237 | if($scope.notaPedido.flete === '1') { |
| 236 | var modalInstance = $uibModal.open( | 238 | var modalInstance = $uibModal.open( |
| 237 | { | 239 | { |
| 238 | ariaLabelledBy: 'Busqueda de Flete', | 240 | ariaLabelledBy: 'Busqueda de Flete', |
| 239 | templateUrl: 'modal-flete.html', | 241 | templateUrl: 'modal-flete.html', |
| 240 | controller: 'focaModalFleteController', | 242 | controller: 'focaModalFleteController', |
| 241 | size: 'lg' | 243 | size: 'lg' |
| 242 | } | 244 | } |
| 243 | ); | 245 | ); |
| 244 | modalInstance.result.then( | 246 | modalInstance.result.then( |
| 245 | function(flete) { | 247 | function(flete) { |
| 246 | $scope.notaPedido.fleteNombre = flete.nombre; | 248 | $scope.notaPedido.fleteNombre = flete.nombre; |
| 247 | $scope.notaPedido.costoUnitarioKmFlete = flete.costoKilometro; | 249 | $scope.notaPedido.costoUnitarioKmFlete = flete.costoKilometro; |
| 248 | }, function() { | 250 | }, function() { |
| 249 | 251 | ||
| 250 | } | 252 | } |
| 251 | ); | 253 | ); |
| 252 | } | 254 | } |
| 253 | }; | 255 | }; |
| 254 | $scope.agregarATabla = function(key) { | 256 | $scope.agregarATabla = function(key) { |
| 255 | if(key === 13) { | 257 | if(key === 13) { |
| 256 | $scope.articulosTabla.unshift($scope.articuloACargar); | 258 | $scope.articulosTabla.unshift($scope.articuloACargar); |
| 257 | $scope.articuloACargar = undefined; | 259 | $scope.articuloACargar = undefined; |
| 258 | } | 260 | } |
| 259 | }; | 261 | }; |
| 262 | $scope.quitarArticulo = function(key) { | ||
| 263 | $scope.articulosTabla.splice(key, 1); | ||
| 264 | }; | ||
| 265 | $scope.editarArticulo = function(key) { | ||
| 266 | if(key === 13) { | ||
| 267 | $scope.edit = false; | ||
| 268 | } | ||
| 269 | }; | ||
| 270 | $scope.cambioEdit = function() { | ||
| 271 | $scope.edit = !$scope.edit ? true : false; | ||
| 272 | }; | ||
| 260 | } | 273 | } |
| 261 | ] | 274 | ] |
| 262 | ) | 275 | ) |
| 263 | .controller('notaPedidoListaCtrl', [ | 276 | .controller('notaPedidoListaCtrl', [ |
| 264 | '$scope', | 277 | '$scope', |
| 265 | 'crearNotaPedidoService', | 278 | 'crearNotaPedidoService', |
| 266 | '$location', | 279 | '$location', |
| 267 | function($scope, crearNotaPedidoService, $location) { | 280 | function($scope, crearNotaPedidoService, $location) { |
| 268 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 281 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 269 | $scope.notaPedidos = datos.data; | 282 | $scope.notaPedidos = datos.data; |
| 270 | }); | 283 | }); |
| 271 | $scope.editar = function(notaPedido) { | 284 | $scope.editar = function(notaPedido) { |
| 272 | crearNotaPedidoService.setNotaPedido(notaPedido); | 285 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 273 | $location.path('/venta-nota-pedido/abm/'); | 286 | $location.path('/venta-nota-pedido/abm/'); |
| 274 | }; | 287 | }; |
| 275 | $scope.crearPedido = function() { | 288 | $scope.crearPedido = function() { |
| 276 | crearNotaPedidoService.clearNotaPedido(); | 289 | crearNotaPedidoService.clearNotaPedido(); |
| 277 | $location.path('/venta-nota-pedido/abm/'); | 290 | $location.path('/venta-nota-pedido/abm/'); |
| 278 | }; | 291 | }; |
| 279 | } | 292 | } |
| 280 | ]) | 293 | ]) |
| 281 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 294 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
| 282 | '$scope', | 295 | '$scope', |
| 283 | 'crearNotaPedidoService', | 296 | 'crearNotaPedidoService', |
| 284 | '$location', | 297 | '$location', |
| 285 | function($scope, crearNotaPedidoService, $location) { | 298 | function($scope, crearNotaPedidoService, $location) { |
| 286 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 299 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 287 | $scope.notaPedidos = datos.data; | 300 | $scope.notaPedidos = datos.data; |
| 288 | }); | 301 | }); |
| 289 | $scope.editar = function(notaPedido) { | 302 | $scope.editar = function(notaPedido) { |
| 290 | crearNotaPedidoService.setNotaPedido(notaPedido); | 303 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 291 | $location.path('/venta-nota-pedido/abm/'); | 304 | $location.path('/venta-nota-pedido/abm/'); |
| 292 | }; | 305 | }; |
| 293 | $scope.crearPedido = function() { | 306 | $scope.crearPedido = function() { |
| 294 | crearNotaPedidoService.clearNotaPedido(); | 307 | crearNotaPedidoService.clearNotaPedido(); |
| 295 | $location.path('/venta-nota-pedido/abm/'); | 308 | $location.path('/venta-nota-pedido/abm/'); |
src/views/nota-pedido.html
| 1 | <div class="row"> | 1 | <div class="row"> |
| 2 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 2 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 3 | <div class="row bg-secondary p-3"> | 3 | <div class="row bg-secondary p-3"> |
| 4 | <div class="form-group col-12 col-sm-6 col-md-4"> | 4 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 5 | <div class="input-group"> | 5 | <div class="input-group"> |
| 6 | <input | 6 | <input |
| 7 | type="text" | 7 | type="text" |
| 8 | class="form-control" | 8 | class="form-control" |
| 9 | uib-datepicker-popup="dd/MM/yyyy" | 9 | uib-datepicker-popup="dd/MM/yyyy" |
| 10 | ng-model="notaPedido.fechaCarga" | 10 | ng-model="notaPedido.fechaCarga" |
| 11 | is-open="popup1.opened" | 11 | is-open="popup1.opened" |
| 12 | datepicker-options="dateOptions" | 12 | datepicker-options="dateOptions" |
| 13 | close-text="Cerrar" | 13 | close-text="Cerrar" |
| 14 | current-text="Hoy" | 14 | current-text="Hoy" |
| 15 | clear-text="Borrar" | 15 | clear-text="Borrar" |
| 16 | alt-input-formats="altInputFormats" | 16 | alt-input-formats="altInputFormats" |
| 17 | /> | 17 | /> |
| 18 | <span class="input-group-append"> | 18 | <span class="input-group-append"> |
| 19 | <button type="button" class="btn btn-default" ng-click="popup1.opened = true"> | 19 | <button type="button" class="btn btn-default" ng-click="popup1.opened = true"> |
| 20 | <i class="fa fa-calendar"></i> | 20 | <i class="fa fa-calendar"></i> |
| 21 | </button> | 21 | </button> |
| 22 | </span> | 22 | </span> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | <div class="form-group col-12 col-sm-6 col-md-4"> | 25 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 26 | <div class="input-group"> | 26 | <div class="input-group"> |
| 27 | <input | 27 | <input |
| 28 | class="form-control" | 28 | class="form-control" |
| 29 | type="text" | 29 | type="text" |
| 30 | ng-model="notaPedido.vendedor.nombre" | 30 | ng-model="notaPedido.vendedor.nombre" |
| 31 | placeholder="Seleccione Vendedor" | 31 | placeholder="Seleccione Vendedor" |
| 32 | readonly="true" | 32 | readonly="true" |
| 33 | > | 33 | > |
| 34 | <span class="input-group-append"> | 34 | <span class="input-group-append"> |
| 35 | <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()"> | 35 | <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()"> |
| 36 | <i class="fa fa-search"></i> | 36 | <i class="fa fa-search"></i> |
| 37 | </button> | 37 | </button> |
| 38 | </span> | 38 | </span> |
| 39 | </div> | 39 | </div> |
| 40 | </div> | 40 | </div> |
| 41 | <div class="form-group col-12 col-sm-6 col-md-4"> | 41 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 42 | <div class="input-group"> | 42 | <div class="input-group"> |
| 43 | <input | 43 | <input |
| 44 | class="form-control selectable" | 44 | class="form-control selectable" |
| 45 | type="text" | 45 | type="text" |
| 46 | ng-model="notaPedido.cliente.nombre" | 46 | ng-model="notaPedido.cliente.nombre" |
| 47 | placeholder="Seleccione Cliente" | 47 | placeholder="Seleccione Cliente" |
| 48 | readonly="true" | 48 | readonly="true" |
| 49 | ng-click="mostrarFichaCliente()" | 49 | ng-click="mostrarFichaCliente()" |
| 50 | > | 50 | > |
| 51 | <span class="input-group-append"> | 51 | <span class="input-group-append"> |
| 52 | <button type="button" class="btn btn-default" ng-click="seleccionarCliente()"> | 52 | <button type="button" class="btn btn-default" ng-click="seleccionarCliente()"> |
| 53 | <i class="fa fa-search"></i> | 53 | <i class="fa fa-search"></i> |
| 54 | </button> | 54 | </button> |
| 55 | </span> | 55 | </span> |
| 56 | </div> | 56 | </div> |
| 57 | </div> | 57 | </div> |
| 58 | <div class="form-group col-12 col-sm-6 col-md-4"> | 58 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 59 | <input | 59 | <input |
| 60 | class="form-control selectable" | 60 | class="form-control selectable" |
| 61 | type="text" | 61 | type="text" |
| 62 | readonly="true" | 62 | readonly="true" |
| 63 | ng-bind="vendedor.nombre" | 63 | ng-bind="vendedor.nombre" |
| 64 | ng-click="abrirModalDomicilio()" | 64 | ng-click="abrirModalDomicilio()" |
| 65 | placeholder="Seleccione Domicilio" | 65 | placeholder="Seleccione Domicilio" |
| 66 | > | 66 | > |
| 67 | </div> | 67 | </div> |
| 68 | <div class="form-group col-12 col-sm-6 col-md-4"> | 68 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 69 | <input | 69 | <input |
| 70 | class="form-control selectable" | 70 | class="form-control selectable" |
| 71 | type="text" | 71 | type="text" |
| 72 | readonly="true" | 72 | readonly="true" |
| 73 | ng-model="notaPedido.precioCondicion" | 73 | ng-model="notaPedido.precioCondicion" |
| 74 | ng-click="abrirModalListaPrecio()" | 74 | ng-click="abrirModalListaPrecio()" |
| 75 | placeholder="Seleccione Lista de precio" | 75 | placeholder="Seleccione Lista de precio" |
| 76 | > | 76 | > |
| 77 | </div> | 77 | </div> |
| 78 | <div class="form-group col-12 col-sm-6 col-md-4"> | 78 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 79 | <label>Flete</label> | 79 | <label>Flete</label> |
| 80 | <div class="form-check custom-radio custom-control-inline"> | 80 | <div class="form-check custom-radio custom-control-inline"> |
| 81 | <input | 81 | <input |
| 82 | class="form-check-input" | 82 | class="form-check-input" |
| 83 | type="radio" | 83 | type="radio" |
| 84 | name="radioFlete" | 84 | name="radioFlete" |
| 85 | value="1" | 85 | value="1" |
| 86 | ng-model="notaPedido.flete"> | 86 | ng-model="notaPedido.flete"> |
| 87 | <label class="form-check-label">Si</label> | 87 | <label class="form-check-label">Si</label> |
| 88 | </div> | 88 | </div> |
| 89 | <div class="form-check custom-radio custom-control-inline"> | 89 | <div class="form-check custom-radio custom-control-inline"> |
| 90 | <input | 90 | <input |
| 91 | class="form-check-input" | 91 | class="form-check-input" |
| 92 | type="radio" | 92 | type="radio" |
| 93 | name="radioFlete" | 93 | name="radioFlete" |
| 94 | value="0" | 94 | value="0" |
| 95 | ng-model="notaPedido.flete"> | 95 | ng-model="notaPedido.flete"> |
| 96 | <label class="form-check-label">No</label> | 96 | <label class="form-check-label">No</label> |
| 97 | </div> | 97 | </div> |
| 98 | </div> | 98 | </div> |
| 99 | <div class="form-group col-12 col-sm-6 col-md-4"> | 99 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 100 | <input | 100 | <input |
| 101 | class="form-control selectable" | 101 | class="form-control selectable" |
| 102 | type="text" | 102 | type="text" |
| 103 | readonly="true" | 103 | readonly="true" |
| 104 | ng-model="notaPedido.fleteNombre" | 104 | ng-model="notaPedido.fleteNombre" |
| 105 | ng-click="abrirModalFlete()" | 105 | ng-click="abrirModalFlete()" |
| 106 | placeholder="Seleccione Flete" | 106 | placeholder="Seleccione Flete" |
| 107 | > | 107 | > |
| 108 | </div> | 108 | </div> |
| 109 | <div class="form-group col-12 col-sm-6 col-md-4"> | 109 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 110 | <input | 110 | <input |
| 111 | class="form-control selectable" | 111 | class="form-control selectable" |
| 112 | type="number" | 112 | type="number" |
| 113 | step="0.01" | 113 | step="0.01" |
| 114 | ng-disabled="notaPedido.flete == 0" | 114 | ng-disabled="notaPedido.flete == 0" |
| 115 | ng-model="notaPedido.costoUnitarioKmFlete" | 115 | ng-model="notaPedido.costoUnitarioKmFlete" |
| 116 | placeholder="Costo por kilómetro" | 116 | placeholder="Costo por kilómetro" |
| 117 | > | 117 | > |
| 118 | </div> | 118 | </div> |
| 119 | <div class="form-group col-12 col-sm-6 col-md-4"> | 119 | <div class="form-group col-12 col-sm-6 col-md-4"> |
| 120 | <input | 120 | <input |
| 121 | class="form-control selectable" | 121 | class="form-control selectable" |
| 122 | type="number" | 122 | type="number" |
| 123 | step="0.1" | 123 | step="0.1" |
| 124 | ng-disabled="notaPedido.flete == 0" | 124 | ng-disabled="notaPedido.flete == 0" |
| 125 | ng-model="notaPedido.kilometros" | 125 | ng-model="notaPedido.kilometros" |
| 126 | placeholder="Kilómetros recorridos" | 126 | placeholder="Kilómetros recorridos" |
| 127 | > | 127 | > |
| 128 | </div> | 128 | </div> |
| 129 | </div> | 129 | </div> |
| 130 | </div> | 130 | </div> |
| 131 | </div> | 131 | </div> |
| 132 | <div class="row"> | 132 | <div class="row"> |
| 133 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 133 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 134 | <div class="row"> | 134 | <div class="row"> |
| 135 | </div> | 135 | </div> |
| 136 | <div class="row"> | 136 | <div class="row"> |
| 137 | <table class="table table-striped table-sm"> | 137 | <table class="table table-striped table-sm"> |
| 138 | <thead> | 138 | <thead> |
| 139 | <tr> | 139 | <tr> |
| 140 | <th>Sector</th> | 140 | <th>Sector</th> |
| 141 | <th>Código</th> | 141 | <th>Código</th> |
| 142 | <th>Descripción</th> | 142 | <th>Descripción</th> |
| 143 | <th>Precio Unitario</th> | 143 | <th>Precio Unitario</th> |
| 144 | <th>Cantidad</th> | 144 | <th>Cantidad</th> |
| 145 | <th>SubTotal</th> | 145 | <th>SubTotal</th> |
| 146 | <th> | 146 | <th> |
| 147 | <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > | 147 | <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > |
| 148 | <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> | 148 | <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> |
| 149 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> | 149 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> |
| 150 | </button> | 150 | </button> |
| 151 | </th> | 151 | </th> |
| 152 | </tr> | 152 | </tr> |
| 153 | </thead> | 153 | </thead> |
| 154 | <tbody> | 154 | <tbody> |
| 155 | <tr ng-show="!articuloACargar"> | 155 | <tr ng-show="!articuloACargar"> |
| 156 | <td colspan="2"><input class="form-control" readonly ng-click="seleccionarArticulo()"></td> | 156 | <td colspan="2"><input placeholder="Seleccione Articulo" class="form-control" readonly ng-click="seleccionarArticulo()"></td> |
| 157 | <td></td> | 157 | <td></td> |
| 158 | <td></td> | 158 | <td></td> |
| 159 | <td></td> | 159 | <td></td> |
| 160 | <td></td> | 160 | <td></td> |
| 161 | <td></td> | 161 | <td></td> |
| 162 | </tr> | 162 | </tr> |
| 163 | <tr ng-show="articuloACargar"> | 163 | <tr ng-show="articuloACargar"> |
| 164 | <td><input | 164 | <td><input |
| 165 | class="form-control" | 165 | class="form-control" |
| 166 | ng-model="articuloACargar.sector" | 166 | ng-model="articuloACargar.sector" |
| 167 | readonly></td> | 167 | readonly></td> |
| 168 | <td><input | 168 | <td><input |
| 169 | class="form-control" | 169 | class="form-control" |
| 170 | ng-model="articuloACargar.codigo" | 170 | ng-model="articuloACargar.codigo" |
| 171 | readonly></td> | 171 | readonly></td> |
| 172 | <td><input | 172 | <td><input |
| 173 | class="form-control" | 173 | class="form-control" |
| 174 | ng-model="articuloACargar.descripcion" | 174 | ng-model="articuloACargar.descripcion" |
| 175 | readonly></td> | 175 | readonly></td> |
| 176 | <td><input | 176 | <td><input |
| 177 | class="form-control" | 177 | class="form-control" |
| 178 | ng-model="articuloACargar.precio" | 178 | ng-value="articuloACargar.precio | currency:'$'" |
| 179 | readonly></td> | 179 | readonly></td> |
| 180 | <td><input | 180 | <td><input |
| 181 | class="form-control" | 181 | class="form-control" |
| 182 | type="number" | 182 | type="number" |
| 183 | min="1" | 183 | min="1" |
| 184 | value="1" | 184 | value="1" |
| 185 | ng-model="articuloACargar.cantidad" | 185 | ng-model="articuloACargar.cantidad" |
| 186 | foca-focus="articuloACargar.cantidad == 1" | 186 | foca-focus="articuloACargar.cantidad == 1" |
| 187 | ng-keypress="agregarATabla($event.keyCode)"></td> | 187 | ng-keypress="agregarATabla($event.keyCode)"></td> |
| 188 | <td><input | 188 | <td><input |
| 189 | class="form-control" | 189 | class="form-control" |
| 190 | ng-model="(articuloACargar.precio * articuloACargar.cantidad)" | 190 | ng-value="getSubTotal() | currency:'$'" |
| 191 | readonly></td> | 191 | readonly></td> |
| 192 | <td class="text-center"><button | ||
| 193 | class="btn btn-outline-secondary btn-sm" | ||
| 194 | ng-click="agregarATabla(13)"> | ||
| 195 | <i class="fa fa-save"></i> | ||
| 196 | </button></td> | ||
| 192 | </tr> | 197 | </tr> |
| 193 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> | 198 | <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> |
| 194 | <td ng-bind="articulo.sector"></td> | 199 | <td ng-bind="articulo.sector"></td> |
| 195 | <td ng-bind="articulo.codigo"></td> | 200 | <td ng-bind="articulo.codigo"></td> |
| 196 | <td ng-bind="articulo.descripcion"></td> | 201 | <td ng-bind="articulo.descripcion"></td> |
| 197 | <td ng-bind="articulo.precio | currency:'$'"></td> | 202 | <td ng-bind="articulo.precio | currency:'$'"></td> |
| 198 | <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="1" value="1"></td> | 203 | <td><input |
| 199 | <td ng-bind="(articulo.precio * articulo.cantidad)"></td> | 204 | ng-show="edit" |
| 205 | ng-model="articulo.cantidad" | ||
| 206 | class="form-control" | ||
| 207 | type="number" | ||
| 208 | min="1" | ||
| 209 | value="1" | ||
| 210 | foca-focus="edit" | ||
| 211 | ng-keypress="editarArticulo($event.keyCode)"> | ||
| 212 | <i class="selectable" ng-click="cambioEdit()" ng-hide="edit" ng-bind="articulo.cantidad"></i> | ||
| 213 | </td> | ||
| 214 | <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> | ||
| 200 | <td class="text-center"> | 215 | <td class="text-center"> |
| 201 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo()"> | 216 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> |
| 202 | <i class="fa fa-trash"></i> | 217 | <i class="fa fa-trash"></i> |
| 203 | </button> | 218 | </button> |
| 204 | </td> | 219 | </td> |
| 205 | </tr> | 220 | </tr> |
| 206 | </tbody> | 221 | </tbody> |
| 207 | <tfoot> | 222 | <tfoot> |
| 208 | <tr class="table-secondary"> | 223 | <tr class="table-secondary"> |
| 209 | <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> | 224 | <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> |
| 210 | <td colspan="3">{{getSubTotal(articulosTabla[0].item) | currency:'$'}}</td> | 225 | <td colspan="3">{{getTotal() | currency:'$'}}</td> |
| 211 | </tr> | 226 | </tr> |
| 212 | </tfoot> | 227 | </tfoot> |
| 213 | </table> | 228 | </table> |
| 214 | </div> | 229 | </div> |
| 215 | </div> | 230 | </div> |
| 216 | </div> | 231 | </div> |
| 217 | 232 | ||
| 218 | <!-- | 233 | <!-- |
| 219 | <form name="formCrearNota"> | 234 | <form name="formCrearNota"> |
| 220 | <uib-tabset active="active"> | 235 | <uib-tabset active="active"> |
| 221 | <uib-tab index="0" heading="General"> | 236 | <uib-tab index="0" heading="General"> |
| 222 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | 237 | <input type="hidden" name="id" ng-model="notaPedido.id" /> |
| 223 | <div> | 238 | <div> |
| 224 | <div class="col-auto my-2"> | 239 | <div class="col-auto my-2"> |
| 225 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | 240 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> |
| 226 | </div> | 241 | </div> |
| 227 | </div> | 242 | </div> |
| 228 | <br> | 243 | <br> |
| 229 | <br> | 244 | <br> |
| 230 | <div class="row"> | 245 | <div class="row"> |
| 231 | <div class="col-md-2"> | 246 | <div class="col-md-2"> |
| 232 | <div class="col-auto"> | 247 | <div class="col-auto"> |
| 233 | <label>Fecha de carga</label> | 248 | <label>Fecha de carga</label> |
| 234 | </div> | 249 | </div> |
| 235 | </div> | 250 | </div> |
| 236 | <div class="col-md-3"> | 251 | <div class="col-md-3"> |
| 237 | <div class="col-auto"> | 252 | <div class="col-auto"> |
| 238 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | 253 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> |
| 239 | </div> | 254 | </div> |
| 240 | </div> | 255 | </div> |
| 241 | <div class="col-md-2"> | 256 | <div class="col-md-2"> |
| 242 | <div class="col-auto"> | 257 | <div class="col-auto"> |
| 243 | <label>Kilómetros</label> | 258 | <label>Kilómetros</label> |
| 244 | </div> | 259 | </div> |
| 245 | </div> | 260 | </div> |
| 246 | <div class="col-md-3"> | 261 | <div class="col-md-3"> |
| 247 | <div class="col-auto"> | 262 | <div class="col-auto"> |
| 248 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | 263 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" |
| 249 | ng-model="notaPedido.kilometros" ng-required="true"> | 264 | ng-model="notaPedido.kilometros" ng-required="true"> |
| 250 | </div> | 265 | </div> |
| 251 | </div> | 266 | </div> |
| 252 | </div> | 267 | </div> |
| 253 | <div class="row my-3"> | 268 | <div class="row my-3"> |
| 254 | <div class="col-md-2"> | 269 | <div class="col-md-2"> |
| 255 | <div class="col-auto"> | 270 | <div class="col-auto"> |
| 256 | <label>Jurisdicción de IIBB</label> | 271 | <label>Jurisdicción de IIBB</label> |
| 257 | </div> | 272 | </div> |
| 258 | </div> | 273 | </div> |
| 259 | <div class="col-md-3"> | 274 | <div class="col-md-3"> |
| 260 | <div class="col-auto"> | 275 | <div class="col-auto"> |
| 261 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | 276 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" |
| 262 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | 277 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> |
| 263 | </div> | 278 | </div> |
| 264 | </div> | 279 | </div> |
| 265 | <div class="col-md-2"> | 280 | <div class="col-md-2"> |
| 266 | <div class="col-auto"> | 281 | <div class="col-auto"> |
| 267 | <label>Costo de financiación</label> | 282 | <label>Costo de financiación</label> |
| 268 | </div> | 283 | </div> |
| 269 | </div> | 284 | </div> |
| 270 | <div class="col-md-3"> | 285 | <div class="col-md-3"> |
| 271 | <div class="col-auto"> | 286 | <div class="col-auto"> |
| 272 | <div class="input-group mb-2"> | 287 | <div class="input-group mb-2"> |
| 273 | <div class="input-group-prepend"> | 288 | <div class="input-group-prepend"> |
| 274 | <div class="input-group-text">$</div> | 289 | <div class="input-group-text">$</div> |
| 275 | </div> | 290 | </div> |
| 276 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | 291 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" |
| 277 | ng-model="notaPedido.costoFinanciacion"> | 292 | ng-model="notaPedido.costoFinanciacion"> |
| 278 | </div> | 293 | </div> |
| 279 | </div> | 294 | </div> |
| 280 | </div> | 295 | </div> |
| 281 | </div> | 296 | </div> |
| 282 | <div class="row"> | 297 | <div class="row"> |
| 283 | <div class="col-md-2"> | 298 | <div class="col-md-2"> |
| 284 | <div class="col-auto"> | 299 | <div class="col-auto"> |
| 285 | <label>Bomba</label> | 300 | <label>Bomba</label> |
| 286 | </div> | 301 | </div> |
| 287 | </div> | 302 | </div> |
| 288 | <div class="col-md-1"> | 303 | <div class="col-md-1"> |
| 289 | <div class="col-auto"> | 304 | <div class="col-auto"> |
| 290 | <div class="form-check custom-radio custom-control-inline"> | 305 | <div class="form-check custom-radio custom-control-inline"> |
| 291 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | 306 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> |
| 292 | <label class="form-check-label"> | 307 | <label class="form-check-label"> |
| 293 | Si | 308 | Si |
| 294 | </label> | 309 | </label> |
| 295 | </div> | 310 | </div> |
| 296 | <div class="form-check custom-radio custom-control-inline"> | 311 | <div class="form-check custom-radio custom-control-inline"> |
| 297 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | 312 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> |
| 298 | <label class="form-check-label"> | 313 | <label class="form-check-label"> |
| 299 | No | 314 | No |
| 300 | </label> | 315 | </label> |
| 301 | </div> | 316 | </div> |
| 302 | </div> | 317 | </div> |
| 303 | </div> | 318 | </div> |
| 304 | <div class="col-md-1"> | 319 | <div class="col-md-1"> |
| 305 | <div class="col-auto"> | 320 | <div class="col-auto"> |
| 306 | <label>Flete</label> | 321 | <label>Flete</label> |
| 307 | </div> | 322 | </div> |
| 308 | </div> | 323 | </div> |
| 309 | <div class="col-md-1"> | 324 | <div class="col-md-1"> |
| 310 | <div class="col-auto"> | 325 | <div class="col-auto"> |
| 311 | <div class="form-check custom-radio custom-control-inline"> | 326 | <div class="form-check custom-radio custom-control-inline"> |
| 312 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | 327 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> |
| 313 | <label class="form-check-label"> | 328 | <label class="form-check-label"> |
| 314 | Si | 329 | Si |
| 315 | </label> | 330 | </label> |
| 316 | </div> | 331 | </div> |
| 317 | <div class="form-check custom-radio custom-control-inline"> | 332 | <div class="form-check custom-radio custom-control-inline"> |
| 318 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | 333 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> |
| 319 | <label class="form-check-label"> | 334 | <label class="form-check-label"> |
| 320 | FOB | 335 | FOB |
| 321 | </label> | 336 | </label> |
| 322 | </div> | 337 | </div> |
| 323 | </div> | 338 | </div> |
| 324 | </div> | 339 | </div> |
| 325 | <div class="col-md-2"> | 340 | <div class="col-md-2"> |
| 326 | <div class="col-auto"> | 341 | <div class="col-auto"> |
| 327 | <label>Costo unitario kilometro flete</label> | 342 | <label>Costo unitario kilometro flete</label> |
| 328 | </div> | 343 | </div> |
| 329 | </div> | 344 | </div> |
| 330 | <div class="col-md-3"> | 345 | <div class="col-md-3"> |
| 331 | <div class="col-auto"> | 346 | <div class="col-auto"> |
| 332 | <div class="input-group mb-2"> | 347 | <div class="input-group mb-2"> |
| 333 | <div class="input-group-prepend"> | 348 | <div class="input-group-prepend"> |
| 334 | <div class="input-group-text">$</div> | 349 | <div class="input-group-text">$</div> |
| 335 | </div> | 350 | </div> |
| 336 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | 351 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" |
| 337 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | 352 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> |
| 338 | </div> | 353 | </div> |
| 339 | </div> | 354 | </div> |
| 340 | </div> | 355 | </div> |
| 341 | </div> | 356 | </div> |
| 342 | <div class="row my-3"> | 357 | <div class="row my-3"> |
| 343 | <div class="col-md-2"> | 358 | <div class="col-md-2"> |
| 344 | <div class="col-auto"> | 359 | <div class="col-auto"> |
| 345 | <label>Vendedor</label> | 360 | <label>Vendedor</label> |
| 346 | </div> | 361 | </div> |
| 347 | </div> | 362 | </div> |
| 348 | <div class="col-md-3"> | 363 | <div class="col-md-3"> |
| 349 | <div class="col-auto"> | 364 | <div class="col-auto"> |
| 350 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | 365 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" |
| 351 | ng-click="seleccionarVendedor()" readonly> | 366 | ng-click="seleccionarVendedor()" readonly> |
| 352 | </div> | 367 | </div> |
| 353 | </div> | 368 | </div> |
| 354 | <div class="col-md-2"> | 369 | <div class="col-md-2"> |
| 355 | <div class="col-auto"> | 370 | <div class="col-auto"> |
| 356 | <label>Petrolera</label> | 371 | <label>Petrolera</label> |
| 357 | </div> | 372 | </div> |
| 358 | </div> | 373 | </div> |
| 359 | <div class="col-md-3"> | 374 | <div class="col-md-3"> |
| 360 | <div class="col-auto"> | 375 | <div class="col-auto"> |
| 361 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" | 376 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" |
| 362 | ng-click="seleccionarPetrolera()" readonly> | 377 | ng-click="seleccionarPetrolera()" readonly> |
| 363 | </div> | 378 | </div> |
| 364 | </div> | 379 | </div> |
| 365 | </div> | 380 | </div> |
| 366 | </div> | 381 | </div> |
| 367 | <div class="row"> | 382 | <div class="row"> |
| 368 | <div class="col-md-2"> | 383 | <div class="col-md-2"> |
| 369 | <div class="col-auto"> | 384 | <div class="col-auto"> |
| 370 | <label>Cliente</label> | 385 | <label>Cliente</label> |
| 371 | </div> | 386 | </div> |
| 372 | </div> | 387 | </div> |
| 373 | <div class="col-md-3"> | 388 | <div class="col-md-3"> |
| 374 | <div class="col-auto"> | 389 | <div class="col-auto"> |
| 375 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | 390 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" |
| 376 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | 391 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> |
| 377 | </div> | 392 | </div> |
| 378 | </div> | 393 | </div> |
| 379 | <div class="col-md-2"> | 394 | <div class="col-md-2"> |
| 380 | <div class="col-auto"> | 395 | <div class="col-auto"> |
| 381 | <label>Domicilio</label> | 396 | <label>Domicilio</label> |
| 382 | </div> | 397 | </div> |
| 383 | </div> | 398 | </div> |
| 384 | <div class="col-md-4"> | 399 | <div class="col-md-4"> |
| 385 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | 400 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> |
| 386 | <div class="col-auto"> | 401 | <div class="col-auto"> |
| 387 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | 402 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" |
| 388 | domi.dom | 403 | domi.dom |
| 389 | for domi | 404 | for domi |
| 390 | in domiciliosCliente | 405 | in domiciliosCliente |
| 391 | " | 406 | " |
| 392 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | 407 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" |
| 393 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | 408 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> |
| 394 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 409 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> |
| 395 | <div ng-show="sinResultados"> | 410 | <div ng-show="sinResultados"> |
| 396 | No se encontraron resultados. | 411 | No se encontraron resultados. |
| 397 | </div> | 412 | </div> |
| 398 | </div> | 413 | </div> |
| 399 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> | 414 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> |
| 400 | <a class="btn" ng-click="addNewDom()">+</a> | 415 | <a class="btn" ng-click="addNewDom()">+</a> |
| 401 | </div> | 416 | </div> |
| 402 | </div> | 417 | </div> |
| 403 | </div> | 418 | </div> |
| 404 | </uib-tab> | 419 | </uib-tab> |
| 405 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> | 420 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> |
| 406 | <div> | 421 | <div> |
| 407 | <div class="col-auto my-2"> | 422 | <div class="col-auto my-2"> |
| 408 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> | 423 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> |
| 409 | </div> | 424 | </div> |
| 410 | </div> | 425 | </div> |
| 411 | <br> | 426 | <br> |
| 412 | <br> | 427 | <br> |
| 413 | <div class="row"> | 428 | <div class="row"> |
| 414 | <div class="col-md-2"> | 429 | <div class="col-md-2"> |
| 415 | <div class="col-auto"> | 430 | <div class="col-auto"> |
| 416 | <label>Precios y condiciones</label> | 431 | <label>Precios y condiciones</label> |
| 417 | </div> | 432 | </div> |
| 418 | </div> | 433 | </div> |
| 419 | <div class="col-md-4"> | 434 | <div class="col-md-4"> |
| 420 | <div class="col-auto"> | 435 | <div class="col-auto"> |
| 421 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> | 436 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> |
| 422 | </select> | 437 | </select> |
| 423 | </div> | 438 | </div> |
| 424 | </div> | 439 | </div> |
| 425 | <div class="col-md-2"> | 440 | <div class="col-md-2"> |
| 426 | <div class="col-auto"> | 441 | <div class="col-auto"> |
| 427 | <label>Producto</label> | 442 | <label>Producto</label> |
| 428 | </div> | 443 | </div> |
| 429 | </div> | 444 | </div> |
| 430 | <div class="col-md-4"> | 445 | <div class="col-md-4"> |
| 431 | <div class="col-auto"> | 446 | <div class="col-auto"> |
| 432 | <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" | 447 | <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" |
| 433 | ng-click="seleccionarArticulo()" readonly> | 448 | ng-click="seleccionarArticulo()" readonly> |
| 434 | </div> | 449 | </div> |
| 435 | </div> | 450 | </div> |
| 436 | </div> | 451 | </div> |
| 437 | <div class="col-md-12"> | 452 | <div class="col-md-12"> |
| 438 | <table class="table my-3 table-hover table-nonfluid"> | 453 | <table class="table my-3 table-hover table-nonfluid"> |
| 439 | <thead> | 454 | <thead> |
| 440 | <tr> | 455 | <tr> |
| 441 | <th>Código</th> | 456 | <th>Código</th> |
| 442 | <th>Nombre</th> | 457 | <th>Nombre</th> |
| 443 | <th>Precio unitario</th> | 458 | <th>Precio unitario</th> |
| 444 | <th>Costo unitario bruto</th> | 459 | <th>Costo unitario bruto</th> |
| 445 | <th>Cantidad</th> | 460 | <th>Cantidad</th> |
| 446 | <th>Subtotal</th> | 461 | <th>Subtotal</th> |
| 447 | </tr> | 462 | </tr> |
| 448 | </thead> | 463 | </thead> |
| 449 | <tbody> | 464 | <tbody> |
| 450 | <tr ng-repeat="articulo in articulosTabla"> | 465 | <tr ng-repeat="articulo in articulosTabla"> |
| 451 | <td ng-bind="articulo.codigo"></td> | 466 | <td ng-bind="articulo.codigo"></td> |
| 452 | <td ng-bind="articulo.nombre"></td> | 467 | <td ng-bind="articulo.nombre"></td> |
| 453 | <td ng-bind="articulo.precio"></td> | 468 | <td ng-bind="articulo.precio"></td> |
| 454 | <td ng-bind="articulo.costoUnitario"></td> | 469 | <td ng-bind="articulo.costoUnitario"></td> |
| 455 | <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td> | 470 | <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td> |
| 456 | <td ng-bind="getSubTotal(articulo.item)"></td> | 471 | <td ng-bind="getSubTotal(articulo.item)"></td> |
| 457 | </tr> | 472 | </tr> |
| 458 | </tbody> | 473 | </tbody> |
| 459 | </table> | 474 | </table> |
| 460 | </div> | 475 | </div> |
| 461 | </uib-tab> | 476 | </uib-tab> |
| 462 | </uib-tabset> | 477 | </uib-tabset> |
| 463 | </form>--> | 478 | </form>--> |