Commit 436b00177a30ad379e7d62f30665d5f41e26a4e5
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
master See merge request modulos-npm/foca-crear-nota-pedido!33
Showing
3 changed files
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
| 4 | 'focaModalService', | 4 | 'focaModalService', |
| 5 | function( | 5 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService |
| 7 | ) { | 7 | ) { |
| 8 | $scope.botonera = [ | 8 | $scope.botonera = [ |
| 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
| 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
| 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
| 13 | { | 13 | { |
| 14 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
| 15 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
| 18 | {texto: '', accion: function() {}} | 18 | {texto: '', accion: function() {}} |
| 19 | ]; | 19 | ]; |
| 20 | 20 | ||
| 21 | $scope.show = false; | 21 | $scope.show = false; |
| 22 | $scope.cargando = true; | 22 | $scope.cargando = true; |
| 23 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
| 24 | maxDate: new Date(), | 24 | maxDate: new Date(), |
| 25 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | $scope.notaPedido = { | 28 | $scope.notaPedido = { |
| 29 | vendedor: {}, | 29 | vendedor: {}, |
| 30 | cliente: {}, | 30 | cliente: {}, |
| 31 | domicilio: {dom: ''}, | 31 | domicilio: {dom: ''}, |
| 32 | moneda: {detalle: ''} | 32 | moneda: {detalle: ''} |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | $scope.cabecera = []; | 35 | $scope.cabecera = []; |
| 36 | 36 | ||
| 37 | $scope.now = new Date(); | 37 | $scope.now = new Date(); |
| 38 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 38 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
| 39 | $scope.comprobante = Math.round(Math.random() * 1000000); | 39 | $scope.comprobante = Math.round(Math.random() * 1000000); |
| 40 | 40 | ||
| 41 | $scope.articulosTabla = []; | 41 | $scope.articulosTabla = []; |
| 42 | var idLista; | 42 | var idLista; |
| 43 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 43 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
| 44 | crearNotaPedidoService.getPrecioCondicion().then( | 44 | crearNotaPedidoService.getPrecioCondicion().then( |
| 45 | function(res) { | 45 | function(res) { |
| 46 | $scope.precioCondiciones = res.data; | 46 | $scope.precioCondiciones = res.data; |
| 47 | } | 47 | } |
| 48 | ); | 48 | ); |
| 49 | if (notaPedidoTemp !== undefined) { | 49 | if (notaPedidoTemp !== undefined) { |
| 50 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 50 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
| 51 | $scope.notaPedido = notaPedidoTemp; | 51 | $scope.notaPedido = notaPedidoTemp; |
| 52 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 52 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
| 53 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 53 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
| 54 | idLista = $scope.notaPedido.precioCondicion; | 54 | idLista = $scope.notaPedido.precioCondicion; |
| 55 | crearNotaPedidoService | 55 | crearNotaPedidoService |
| 56 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 56 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
| 57 | function(res) { | 57 | function(res) { |
| 58 | $scope.articulosTabla = res.data; | 58 | $scope.articulosTabla = res.data; |
| 59 | } | 59 | } |
| 60 | ); | 60 | ); |
| 61 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 61 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
| 62 | //(NO REQUERIDO EN ESTA VERSION) | 62 | //(NO REQUERIDO EN ESTA VERSION) |
| 63 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 63 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
| 64 | // function(res) { | 64 | // function(res) { |
| 65 | // $scope.notaPedido.domicilio = res.data; | 65 | // $scope.notaPedido.domicilio = res.data; |
| 66 | // } | 66 | // } |
| 67 | // ); | 67 | // ); |
| 68 | } else { | 68 | } else { |
| 69 | $scope.notaPedido.fechaCarga = new Date(); | 69 | $scope.notaPedido.fechaCarga = new Date(); |
| 70 | $scope.notaPedido.bomba = '0'; | 70 | $scope.notaPedido.bomba = '0'; |
| 71 | $scope.notaPedido.flete = '0'; | 71 | $scope.notaPedido.flete = '0'; |
| 72 | idLista = undefined; | 72 | idLista = undefined; |
| 73 | } | 73 | } |
| 74 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 74 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 75 | // $scope.addNewDom = function() { | 75 | // $scope.addNewDom = function() { |
| 76 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 76 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
| 77 | // }; | 77 | // }; |
| 78 | // $scope.removeNewChoice = function(choice) { | 78 | // $scope.removeNewChoice = function(choice) { |
| 79 | // if ($scope.notaPedido.domicilio.length > 1) { | 79 | // if ($scope.notaPedido.domicilio.length > 1) { |
| 80 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 80 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
| 81 | // function(c) { | 81 | // function(c) { |
| 82 | // return c.$$hashKey === choice.$$hashKey; | 82 | // return c.$$hashKey === choice.$$hashKey; |
| 83 | // } | 83 | // } |
| 84 | // ), 1); | 84 | // ), 1); |
| 85 | // } | 85 | // } |
| 86 | // }; | 86 | // }; |
| 87 | $scope.crearNotaPedido = function() { | 87 | $scope.crearNotaPedido = function() { |
| 88 | if($scope.articulosTabla.length === 0) { | 88 | if($scope.articulosTabla.length === 0) { |
| 89 | focaModalService.alert('Debe cargar almenos un articulo'); | 89 | focaModalService.alert('Debe cargar almenos un articulo'); |
| 90 | return; | 90 | return; |
| 91 | } | 91 | } |
| 92 | if($scope.notaPedido.domicilio.id === undefined) { | 92 | if($scope.notaPedido.domicilio.id === undefined) { |
| 93 | $scope.notaPedido.domicilio.id = 0; | 93 | $scope.notaPedido.domicilio.id = 0; |
| 94 | } | 94 | } |
| 95 | var date = new Date(); | 95 | var date = new Date(); |
| 96 | var notaPedido = { | 96 | var notaPedido = { |
| 97 | id: 0, | 97 | id: 0, |
| 98 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 98 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 99 | .toISOString().slice(0, 19).replace('T', ' '), | 99 | .toISOString().slice(0, 19).replace('T', ' '), |
| 100 | vendedor: $scope.notaPedido.vendedor.nombre, | 100 | vendedor: $scope.notaPedido.vendedor.nombre, |
| 101 | idCliente: $scope.notaPedido.cliente.id, | 101 | idCliente: $scope.notaPedido.cliente.id, |
| 102 | domicilio: $scope.notaPedido.domicilio, | 102 | domicilio: $scope.notaPedido.domicilio, |
| 103 | precioCondicion: $scope.notaPedido.precioCondicion, | 103 | precioCondicion: $scope.notaPedido.precioCondicion, |
| 104 | bomba: $scope.notaPedido.bomba, | 104 | bomba: $scope.notaPedido.bomba, |
| 105 | flete: $scope.notaPedido.flete, | 105 | flete: $scope.notaPedido.flete, |
| 106 | total: $scope.getTotal() | 106 | total: $scope.getTotal() |
| 107 | }; | 107 | }; |
| 108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 109 | function(data) { | 109 | function(data) { |
| 110 | focaModalService.alert('Nota pedido creada'); | 110 | focaModalService.alert('Nota pedido creada'); |
| 111 | if($scope.notaPedido.flete === 1) { | 111 | if($scope.notaPedido.flete === 1) { |
| 112 | var flete = { | 112 | var flete = { |
| 113 | idNotaPedido: data.data.id, | 113 | idNotaPedido: data.data.id, |
| 114 | idTransportista: $scope.notaPedido.fleteId, | 114 | idTransportista: $scope.notaPedido.fleteId, |
| 115 | idChofer: $scope.notaPedido.chofer.id, | 115 | idChofer: $scope.notaPedido.chofer.id, |
| 116 | idVehiculo: $scope.notaPedido.vehiculo.id, | 116 | idVehiculo: $scope.notaPedido.vehiculo.id, |
| 117 | kilometros: $scope.notaPedido.kilometros, | 117 | kilometros: $scope.notaPedido.kilometros, |
| 118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
| 119 | }; | 119 | }; |
| 120 | crearNotaPedidoService.crearFlete(flete); | 120 | crearNotaPedidoService.crearFlete(flete); |
| 121 | } | 121 | } |
| 122 | var articulosNotaPedido = $scope.articulosTabla; | 122 | var articulosNotaPedido = $scope.articulosTabla; |
| 123 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 123 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
| 124 | delete articulosNotaPedido[i].edit; | 124 | delete articulosNotaPedido[i].edit; |
| 125 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 125 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
| 126 | crearNotaPedidoService | 126 | crearNotaPedidoService |
| 127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
| 128 | } | 128 | } |
| 129 | $scope.limpiarPantalla(); | 129 | $scope.limpiarPantalla(); |
| 130 | } | 130 | } |
| 131 | ); | 131 | ); |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | $scope.seleccionarArticulo = function() { | 134 | $scope.seleccionarArticulo = function() { |
| 135 | if (idLista === undefined) { | 135 | if (idLista === undefined) { |
| 136 | focaModalService.alert( | 136 | focaModalService.alert( |
| 137 | 'Primero seleccione una lista de precio y condicion'); | 137 | 'Primero seleccione una lista de precio y condicion'); |
| 138 | return; | 138 | return; |
| 139 | } | 139 | } |
| 140 | var modalInstance = $uibModal.open( | 140 | var modalInstance = $uibModal.open( |
| 141 | { | 141 | { |
| 142 | ariaLabelledBy: 'Busqueda de Productos', | 142 | ariaLabelledBy: 'Busqueda de Productos', |
| 143 | templateUrl: 'modal-busqueda-productos.html', | 143 | templateUrl: 'modal-busqueda-productos.html', |
| 144 | controller: 'modalBusquedaProductosCtrl', | 144 | controller: 'modalBusquedaProductosCtrl', |
| 145 | resolve: { idLista: function() { return idLista; } }, | 145 | resolve: { idLista: function() { return idLista; } }, |
| 146 | size: 'lg' | 146 | size: 'lg' |
| 147 | } | 147 | } |
| 148 | ); | 148 | ); |
| 149 | modalInstance.result.then( | 149 | modalInstance.result.then( |
| 150 | function(producto) { | 150 | function(producto) { |
| 151 | var newArt = | 151 | var newArt = |
| 152 | { | 152 | { |
| 153 | id: 0, | 153 | id: 0, |
| 154 | codigo: producto.codigo, | 154 | codigo: producto.codigo, |
| 155 | sector: producto.sector, | 155 | sector: producto.sector, |
| 156 | sectorCodigo: producto.sector + '-' + producto.codigo, | 156 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 157 | descripcion: producto.descripcion, | 157 | descripcion: producto.descripcion, |
| 158 | item: $scope.articulosTabla.length + 1, | 158 | item: $scope.articulosTabla.length + 1, |
| 159 | nombre: producto.descripcion, | 159 | nombre: producto.descripcion, |
| 160 | precio: producto.precio.toFixed(2), | 160 | precio: producto.precio.toFixed(2), |
| 161 | costoUnitario: producto.costo, | 161 | costoUnitario: producto.costo, |
| 162 | edit: false | 162 | edit: false |
| 163 | }; | 163 | }; |
| 164 | $scope.articuloACargar = newArt; | 164 | $scope.articuloACargar = newArt; |
| 165 | $scope.cargando = false; | 165 | $scope.cargando = false; |
| 166 | }, function() { | 166 | }, function() { |
| 167 | // funcion ejecutada cuando se cancela el modal | 167 | // funcion ejecutada cuando se cancela el modal |
| 168 | } | 168 | } |
| 169 | ); | 169 | ); |
| 170 | }; | 170 | }; |
| 171 | 171 | ||
| 172 | $scope.seleccionarVendedor = function() { | 172 | $scope.seleccionarVendedor = function() { |
| 173 | var modalInstance = $uibModal.open( | 173 | var modalInstance = $uibModal.open( |
| 174 | { | 174 | { |
| 175 | ariaLabelledBy: 'Busqueda de Vendedores', | 175 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 176 | templateUrl: 'modal-vendedores.html', | 176 | templateUrl: 'modal-vendedores.html', |
| 177 | controller: 'modalVendedoresCtrl', | 177 | controller: 'modalVendedoresCtrl', |
| 178 | size: 'lg' | 178 | size: 'lg' |
| 179 | } | 179 | } |
| 180 | ); | 180 | ); |
| 181 | modalInstance.result.then( | 181 | modalInstance.result.then( |
| 182 | function(vendedor) { | 182 | function(vendedor) { |
| 183 | addCabecera('Vendedor:', vendedor.NomVen); | 183 | addCabecera('Vendedor:', vendedor.NomVen); |
| 184 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 184 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
| 185 | }, function() { | 185 | }, function() { |
| 186 | 186 | ||
| 187 | } | 187 | } |
| 188 | ); | 188 | ); |
| 189 | }; | 189 | }; |
| 190 | 190 | ||
| 191 | $scope.seleccionarProveedor = function() { | 191 | $scope.seleccionarProveedor = function() { |
| 192 | var modalInstance = $uibModal.open( | 192 | var modalInstance = $uibModal.open( |
| 193 | { | 193 | { |
| 194 | ariaLabelledBy: 'Busqueda de Proveedor', | 194 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 195 | templateUrl: 'modal-proveedor.html', | 195 | templateUrl: 'modal-proveedor.html', |
| 196 | controller: 'focaModalProveedorCtrl', | 196 | controller: 'focaModalProveedorCtrl', |
| 197 | size: 'lg' | 197 | size: 'lg' |
| 198 | } | 198 | } |
| 199 | ); | 199 | ); |
| 200 | modalInstance.result.then( | 200 | modalInstance.result.then( |
| 201 | function(proveedor) { | 201 | function(proveedor) { |
| 202 | $scope.notaPedido.proveedor = proveedor.NOM; | 202 | $scope.notaPedido.proveedor = proveedor.NOM; |
| 203 | addCabecera('Proveedor:', proveedor.NOM); | 203 | addCabecera('Proveedor:', proveedor.NOM); |
| 204 | }, function() { | 204 | }, function() { |
| 205 | 205 | ||
| 206 | } | 206 | } |
| 207 | ); | 207 | ); |
| 208 | }; | 208 | }; |
| 209 | 209 | ||
| 210 | $scope.seleccionarCliente = function() { | 210 | $scope.seleccionarCliente = function() { |
| 211 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
| 212 | { | 212 | { |
| 213 | ariaLabelledBy: 'Busqueda de Cliente', | 213 | ariaLabelledBy: 'Busqueda de Cliente', |
| 214 | templateUrl: 'foca-busqueda-cliente-modal.html', | 214 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 215 | controller: 'focaBusquedaClienteModalController', | 215 | controller: 'focaBusquedaClienteModalController', |
| 216 | size: 'lg' | 216 | size: 'lg' |
| 217 | } | 217 | } |
| 218 | ); | 218 | ); |
| 219 | modalInstance.result.then( | 219 | modalInstance.result.then( |
| 220 | function(cliente) { | 220 | function(cliente) { |
| 221 | $scope.notaPedido.cliente.nombre = cliente.nom; | 221 | $scope.notaPedido.cliente.nombre = cliente.nom; |
| 222 | $scope.notaPedido.cliente.id = cliente.cod; | 222 | $scope.notaPedido.cliente.id = cliente.cod; |
| 223 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 223 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
| 224 | function(data) { | 224 | function(data) { |
| 225 | if(data.data.length === 0){ | 225 | if(data.data.length === 0){ |
| 226 | focaModalService | 226 | focaModalService |
| 227 | .alert('El cliente no tienen domicilios de entrega') | 227 | .alert('El cliente no tienen domicilios de entrega') |
| 228 | .then( | 228 | .then( |
| 229 | function() { | 229 | function() { |
| 230 | $scope.seleccionarCliente(); | 230 | $scope.seleccionarCliente(); |
| 231 | $scope.notaPedido.cliente = {nombre: ''}; | 231 | $scope.notaPedido.cliente = {nombre: ''}; |
| 232 | } | 232 | } |
| 233 | ); | 233 | ); |
| 234 | return; | 234 | return; |
| 235 | } | 235 | } |
| 236 | var modalInstanceDomicilio = $uibModal.open( | 236 | var modalInstanceDomicilio = $uibModal.open( |
| 237 | { | 237 | { |
| 238 | ariaLabelledBy: 'Busqueda de Domicilios', | 238 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 239 | templateUrl: 'modal-domicilio.html', | 239 | templateUrl: 'modal-domicilio.html', |
| 240 | controller: 'focaModalDomicilioController', | 240 | controller: 'focaModalDomicilioController', |
| 241 | resolve: { idCliente: function() { return cliente.cod; }}, | 241 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 242 | size: 'lg', | 242 | size: 'lg', |
| 243 | backdrop: 'static', | 243 | backdrop: 'static', |
| 244 | } | 244 | } |
| 245 | ); | 245 | ); |
| 246 | modalInstanceDomicilio.result.then( | 246 | modalInstanceDomicilio.result.then( |
| 247 | function(domicilio) { | 247 | function(domicilio) { |
| 248 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 248 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
| 249 | }, function() { | 249 | }, function() { |
| 250 | $scope.notaPedido.cliente.nombre = ''; | 250 | $scope.notaPedido.cliente.nombre = ''; |
| 251 | $scope.notaPedido.cliente.id = ''; | 251 | $scope.notaPedido.cliente.id = ''; |
| 252 | removeCabecera('Cliente:'); | 252 | removeCabecera('Cliente:'); |
| 253 | $scope.seleccionarCliente(); | 253 | $scope.seleccionarCliente(); |
| 254 | return; | 254 | return; |
| 255 | } | 255 | } |
| 256 | ); | 256 | ); |
| 257 | } | 257 | } |
| 258 | ); | 258 | ); |
| 259 | addCabecera('Cliente:', cliente.nom); | 259 | addCabecera('Cliente:', cliente.nom); |
| 260 | }, function() { | 260 | }, function() { |
| 261 | 261 | ||
| 262 | } | 262 | } |
| 263 | ); | 263 | ); |
| 264 | }; | 264 | }; |
| 265 | 265 | ||
| 266 | $scope.mostrarFichaCliente = function() { | 266 | $scope.mostrarFichaCliente = function() { |
| 267 | $uibModal.open( | 267 | $uibModal.open( |
| 268 | { | 268 | { |
| 269 | ariaLabelledBy: 'Datos del Cliente', | 269 | ariaLabelledBy: 'Datos del Cliente', |
| 270 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 270 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
| 271 | controller: 'focaCrearNotaPedidoFichaClienteController', | 271 | controller: 'focaCrearNotaPedidoFichaClienteController', |
| 272 | size: 'lg' | 272 | size: 'lg' |
| 273 | } | 273 | } |
| 274 | ); | 274 | ); |
| 275 | }; | 275 | }; |
| 276 | 276 | ||
| 277 | $scope.getTotal = function() { | 277 | $scope.getTotal = function() { |
| 278 | var total = 0; | 278 | var total = 0; |
| 279 | var arrayTempArticulos = $scope.articulosTabla; | 279 | var arrayTempArticulos = $scope.articulosTabla; |
| 280 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 280 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 281 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 281 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 282 | } | 282 | } |
| 283 | return total.toFixed(2); | 283 | return total.toFixed(2); |
| 284 | }; | 284 | }; |
| 285 | 285 | ||
| 286 | $scope.getSubTotal = function() { | 286 | $scope.getSubTotal = function() { |
| 287 | if($scope.articuloACargar) { | 287 | if($scope.articuloACargar) { |
| 288 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 288 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 289 | } | 289 | } |
| 290 | }; | 290 | }; |
| 291 | 291 | ||
| 292 | $scope.abrirModalListaPrecio = function() { | 292 | $scope.abrirModalListaPrecio = function() { |
| 293 | var modalInstance = $uibModal.open( | 293 | var modalInstance = $uibModal.open( |
| 294 | { | 294 | { |
| 295 | ariaLabelledBy: 'Busqueda de Precio Condición', | 295 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 296 | templateUrl: 'modal-precio-condicion.html', | 296 | templateUrl: 'modal-precio-condicion.html', |
| 297 | controller: 'focaModalPrecioCondicionController', | 297 | controller: 'focaModalPrecioCondicionController', |
| 298 | size: 'lg' | 298 | size: 'lg' |
| 299 | } | 299 | } |
| 300 | ); | 300 | ); |
| 301 | modalInstance.result.then( | 301 | modalInstance.result.then( |
| 302 | function(precioCondicion) { | 302 | function(precioCondicion) { |
| 303 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 303 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
| 304 | idLista = precioCondicion.idListaPrecio; | 304 | idLista = precioCondicion.idListaPrecio; |
| 305 | $scope.articulosTabla = []; | 305 | $scope.articulosTabla = []; |
| 306 | 306 | ||
| 307 | addCabecera('Precios y condiciones:', precioCondicion.nombre); | 307 | addCabecera('Precios y condiciones:', precioCondicion.nombre); |
| 308 | }, function() { | 308 | }, function() { |
| 309 | 309 | ||
| 310 | } | 310 | } |
| 311 | ); | 311 | ); |
| 312 | }; | 312 | }; |
| 313 | 313 | ||
| 314 | $scope.abrirModalFlete = function() { | 314 | $scope.abrirModalFlete = function() { |
| 315 | var modalInstance = $uibModal.open( | 315 | var modalInstance = $uibModal.open( |
| 316 | { | 316 | { |
| 317 | ariaLabelledBy: 'Busqueda de Flete', | 317 | ariaLabelledBy: 'Busqueda de Flete', |
| 318 | templateUrl: 'modal-flete.html', | 318 | templateUrl: 'modal-flete.html', |
| 319 | controller: 'focaModalFleteController', | 319 | controller: 'focaModalFleteController', |
| 320 | size: 'lg', | 320 | size: 'lg', |
| 321 | resolve: { | 321 | resolve: { |
| 322 | parametrosFlete: | 322 | parametrosFlete: |
| 323 | function() { | 323 | function() { |
| 324 | return { | 324 | return { |
| 325 | flete: $scope.notaPedido.flete, | 325 | flete: $scope.notaPedido.flete, |
| 326 | bomba: $scope.notaPedido.bomba, | 326 | bomba: $scope.notaPedido.bomba, |
| 327 | kilometros: $scope.notaPedido.kilometros | 327 | kilometros: $scope.notaPedido.kilometros |
| 328 | }; | 328 | }; |
| 329 | } | 329 | } |
| 330 | } | 330 | } |
| 331 | } | 331 | } |
| 332 | ); | 332 | ); |
| 333 | modalInstance.result.then( | 333 | modalInstance.result.then( |
| 334 | function(datos) { | 334 | function(datos) { |
| 335 | $scope.notaPedido.flete = datos.flete; | 335 | $scope.notaPedido.flete = datos.flete; |
| 336 | $scope.notaPedido.bomba = datos.bomba; | 336 | $scope.notaPedido.bomba = datos.bomba; |
| 337 | $scope.notaPedido.kilometros = datos.kilometros; | 337 | $scope.notaPedido.kilometros = datos.kilometros; |
| 338 | 338 | ||
| 339 | addCabecera('Flete:', datos.flete); | 339 | addCabecera('Flete:', datos.flete); |
| 340 | if(datos.flete === 'si') { | 340 | if(datos.flete === 'si') { |
| 341 | addCabecera('Bomba:', datos.bomba); | 341 | addCabecera('Bomba:', datos.bomba); |
| 342 | addCabecera('Kilometros:', datos.kilometros); | 342 | addCabecera('Kilometros:', datos.kilometros); |
| 343 | } else { | 343 | } else { |
| 344 | removeCabecera('Bomba:'); | 344 | removeCabecera('Bomba:'); |
| 345 | removeCabecera('Kilometros:'); | 345 | removeCabecera('Kilometros:'); |
| 346 | } | 346 | } |
| 347 | }, function() { | 347 | }, function() { |
| 348 | 348 | ||
| 349 | } | 349 | } |
| 350 | ); | 350 | ); |
| 351 | }; | 351 | }; |
| 352 | 352 | ||
| 353 | $scope.abrirModalMoneda = function() { | 353 | $scope.abrirModalMoneda = function() { |
| 354 | var modalInstance = $uibModal.open( | 354 | var modalInstance = $uibModal.open( |
| 355 | { | 355 | { |
| 356 | ariaLabelledBy: 'Busqueda de Moneda', | 356 | ariaLabelledBy: 'Busqueda de Moneda', |
| 357 | templateUrl: 'modal-moneda.html', | 357 | templateUrl: 'modal-moneda.html', |
| 358 | controller: 'focaModalMonedaController', | 358 | controller: 'focaModalMonedaController', |
| 359 | size: 'lg' | 359 | size: 'lg' |
| 360 | } | 360 | } |
| 361 | ); | 361 | ); |
| 362 | modalInstance.result.then( | 362 | modalInstance.result.then( |
| 363 | function(moneda) { | 363 | function(moneda) { |
| 364 | $scope.notaPedido.moneda = { | 364 | $scope.notaPedido.moneda = { |
| 365 | id: moneda.ID, | 365 | id: moneda.ID, |
| 366 | detalle: moneda.DETALLE, | 366 | detalle: moneda.DETALLE, |
| 367 | simbolo: moneda.SIMBOLO | 367 | simbolo: moneda.SIMBOLO |
| 368 | }; | 368 | }; |
| 369 | 369 | ||
| 370 | addCabecera('Moneda:', moneda.DETALLE); | 370 | addCabecera('Moneda:', moneda.DETALLE); |
| 371 | }, function() { | 371 | }, function() { |
| 372 | 372 | ||
| 373 | } | 373 | } |
| 374 | ); | 374 | ); |
| 375 | }; | 375 | }; |
| 376 | 376 | ||
| 377 | $scope.agregarATabla = function(key) { | 377 | $scope.agregarATabla = function(key) { |
| 378 | if(key === 13) { | 378 | if(key === 13) { |
| 379 | if($scope.articuloACargar.cantidad === undefined || | 379 | if($scope.articuloACargar.cantidad === undefined || |
| 380 | $scope.articuloACargar.cantidad === 0 || | 380 | $scope.articuloACargar.cantidad === 0 || |
| 381 | $scope.articuloACargar.cantidad === null ){ | 381 | $scope.articuloACargar.cantidad === null ){ |
| 382 | focaModalService.alert('El valor debe ser al menos 1'); | 382 | focaModalService.alert('El valor debe ser al menos 1'); |
| 383 | return; | 383 | return; |
| 384 | } | 384 | } |
| 385 | delete $scope.articuloACargar.sectorCodigo; | 385 | delete $scope.articuloACargar.sectorCodigo; |
| 386 | $scope.articulosTabla.unshift($scope.articuloACargar); | 386 | $scope.articulosTabla.push($scope.articuloACargar); |
| 387 | $scope.cargando = true; | 387 | $scope.cargando = true; |
| 388 | } | 388 | } |
| 389 | }; | 389 | }; |
| 390 | 390 | ||
| 391 | $scope.quitarArticulo = function(key) { | 391 | $scope.quitarArticulo = function(key) { |
| 392 | $scope.articulosTabla.splice(key, 1); | 392 | $scope.articulosTabla.splice(key, 1); |
| 393 | }; | 393 | }; |
| 394 | 394 | ||
| 395 | $scope.editarArticulo = function(key, articulo) { | 395 | $scope.editarArticulo = function(key, articulo) { |
| 396 | if(key === 13) { | 396 | if(key === 13) { |
| 397 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 397 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 398 | articulo.cantidad === undefined){ | 398 | articulo.cantidad === undefined){ |
| 399 | focaModalService.alert('El valor debe ser al menos 1'); | 399 | focaModalService.alert('El valor debe ser al menos 1'); |
| 400 | return; | 400 | return; |
| 401 | } | 401 | } |
| 402 | articulo.edit = false; | 402 | articulo.edit = false; |
| 403 | } | 403 | } |
| 404 | }; | 404 | }; |
| 405 | 405 | ||
| 406 | $scope.cambioEdit = function(articulo) { | 406 | $scope.cambioEdit = function(articulo) { |
| 407 | articulo.edit = true; | 407 | articulo.edit = true; |
| 408 | }; | 408 | }; |
| 409 | 409 | ||
| 410 | $scope.limpiarFlete = function() { | 410 | $scope.limpiarFlete = function() { |
| 411 | $scope.notaPedido.fleteNombre = ''; | 411 | $scope.notaPedido.fleteNombre = ''; |
| 412 | $scope.notaPedido.chofer = ''; | 412 | $scope.notaPedido.chofer = ''; |
| 413 | $scope.notaPedido.vehiculo = ''; | 413 | $scope.notaPedido.vehiculo = ''; |
| 414 | $scope.notaPedido.kilometros = ''; | 414 | $scope.notaPedido.kilometros = ''; |
| 415 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 415 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
| 416 | $scope.choferes = ''; | 416 | $scope.choferes = ''; |
| 417 | $scope.vehiculos = ''; | 417 | $scope.vehiculos = ''; |
| 418 | }; | 418 | }; |
| 419 | 419 | ||
| 420 | $scope.limpiarPantalla = function() { | 420 | $scope.limpiarPantalla = function() { |
| 421 | $scope.limpiarFlete(); | 421 | $scope.limpiarFlete(); |
| 422 | $scope.notaPedido.flete = '0'; | 422 | $scope.notaPedido.flete = '0'; |
| 423 | $scope.notaPedido.bomba = '0'; | 423 | $scope.notaPedido.bomba = '0'; |
| 424 | $scope.notaPedido.precioCondicion = ''; | 424 | $scope.notaPedido.precioCondicion = ''; |
| 425 | $scope.articulosTabla = []; | 425 | $scope.articulosTabla = []; |
| 426 | $scope.notaPedido.vendedor.nombre = ''; | 426 | $scope.notaPedido.vendedor.nombre = ''; |
| 427 | $scope.notaPedido.cliente = {nombre: ''}; | 427 | $scope.notaPedido.cliente = {nombre: ''}; |
| 428 | $scope.notaPedido.domicilio = {dom: ''}; | 428 | $scope.notaPedido.domicilio = {dom: ''}; |
| 429 | $scope.domiciliosCliente = []; | 429 | $scope.domiciliosCliente = []; |
| 430 | }; | 430 | }; |
| 431 | 431 | ||
| 432 | $scope.resetFilter = function() { | 432 | $scope.resetFilter = function() { |
| 433 | $scope.articuloACargar = {}; | 433 | $scope.articuloACargar = {}; |
| 434 | $scope.cargando = true; | 434 | $scope.cargando = true; |
| 435 | }; | 435 | }; |
| 436 | 436 | ||
| 437 | $scope.selectFocus = function($event) { | 437 | $scope.selectFocus = function($event) { |
| 438 | $event.target.select(); | 438 | $event.target.select(); |
| 439 | }; | 439 | }; |
| 440 | 440 | ||
| 441 | $scope.salir = function() { | 441 | $scope.salir = function() { |
| 442 | $location.path('/'); | 442 | $location.path('/'); |
| 443 | }; | 443 | }; |
| 444 | 444 | ||
| 445 | function addCabecera(label, valor) { | 445 | function addCabecera(label, valor) { |
| 446 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 446 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
| 447 | if(propiedad.length === 1) { | 447 | if(propiedad.length === 1) { |
| 448 | propiedad[0].valor = valor; | 448 | propiedad[0].valor = valor; |
| 449 | } else { | 449 | } else { |
| 450 | $scope.cabecera.push({label: label, valor: valor}); | 450 | $scope.cabecera.push({label: label, valor: valor}); |
| 451 | } | 451 | } |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | function removeCabecera(label) { | 454 | function removeCabecera(label) { |
| 455 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 455 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
| 456 | if(propiedad.length === 1){ | 456 | if(propiedad.length === 1){ |
| 457 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 457 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 458 | } | 458 | } |
| 459 | } | 459 | } |
| 460 | } | 460 | } |
| 461 | ] | 461 | ] |
| 462 | ) | 462 | ) |
| 463 | .controller('notaPedidoListaCtrl', [ | 463 | .controller('notaPedidoListaCtrl', [ |
| 464 | '$scope', | 464 | '$scope', |
| 465 | 'crearNotaPedidoService', | 465 | 'crearNotaPedidoService', |
| 466 | '$location', | 466 | '$location', |
| 467 | function($scope, crearNotaPedidoService, $location) { | 467 | function($scope, crearNotaPedidoService, $location) { |
| 468 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 468 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 469 | $scope.notaPedidos = datos.data; | 469 | $scope.notaPedidos = datos.data; |
| 470 | }); | 470 | }); |
| 471 | $scope.editar = function(notaPedido) { | 471 | $scope.editar = function(notaPedido) { |
| 472 | crearNotaPedidoService.setNotaPedido(notaPedido); | 472 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 473 | $location.path('/venta-nota-pedido/abm/'); | 473 | $location.path('/venta-nota-pedido/abm/'); |
| 474 | }; | 474 | }; |
| 475 | $scope.crearPedido = function() { | 475 | $scope.crearPedido = function() { |
| 476 | crearNotaPedidoService.clearNotaPedido(); | 476 | crearNotaPedidoService.clearNotaPedido(); |
| 477 | $location.path('/venta-nota-pedido/abm/'); | 477 | $location.path('/venta-nota-pedido/abm/'); |
| 478 | }; | 478 | }; |
| 479 | } | 479 | } |
| 480 | ]) | 480 | ]) |
| 481 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 481 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
| 482 | '$scope', | 482 | '$scope', |
| 483 | 'crearNotaPedidoService', | 483 | 'crearNotaPedidoService', |
| 484 | '$location', | 484 | '$location', |
| 485 | function($scope, crearNotaPedidoService, $location) { | 485 | function($scope, crearNotaPedidoService, $location) { |
| 486 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 486 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 487 | $scope.notaPedidos = datos.data; | 487 | $scope.notaPedidos = datos.data; |
| 488 | }); | 488 | }); |
| 489 | $scope.editar = function(notaPedido) { | 489 | $scope.editar = function(notaPedido) { |
| 490 | crearNotaPedidoService.setNotaPedido(notaPedido); | 490 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 491 | $location.path('/venta-nota-pedido/abm/'); | 491 | $location.path('/venta-nota-pedido/abm/'); |
| 492 | }; | 492 | }; |
| 493 | $scope.crearPedido = function() { | 493 | $scope.crearPedido = function() { |
| 494 | crearNotaPedidoService.clearNotaPedido(); | 494 | crearNotaPedidoService.clearNotaPedido(); |
| 495 | $location.path('/venta-nota-pedido/abm/'); | 495 | $location.path('/venta-nota-pedido/abm/'); |
| 496 | }; | 496 | }; |
| 497 | } | 497 | } |
| 498 | ]); | 498 | ]); |
| 499 | 499 |
src/views/nota-pedido.html
| 1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
| 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
| 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-5"> | 8 | <div class="col-5"> |
| 9 | <div class="h6">NOTA DE PEDIDO</div> | 9 | <div class="h6">NOTA DE PEDIDO</div> |
| 10 | </div> | 10 | </div> |
| 11 | <div class="col-3">Nº {{puntoVenta}}-{{comprobante}}</div> | 11 | <div class="col-3">Nº {{puntoVenta}}-{{comprobante}}</div> |
| 12 | <div class="col-4 text-right"> | 12 | <div class="col-4 text-right"> |
| 13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} | 13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} |
| 14 | </div> | 14 | </div> |
| 15 | </div> | 15 | </div> |
| 16 | <div class="row"> | 16 | <div class="row"> |
| 17 | <div class="col-auto" ng-repeat="cab in cabecera"> | 17 | <div class="col-auto" ng-repeat="cab in cabecera"> |
| 18 | <span class="label" ng-bind="cab.label"></span> | 18 | <span class="label" ng-bind="cab.label"></span> |
| 19 | <span class="valor" ng-bind="cab.valor"></span> | 19 | <span class="valor" ng-bind="cab.valor"></span> |
| 20 | </div> | 20 | </div> |
| 21 | </div> | 21 | </div> |
| 22 | </div> | 22 | </div> |
| 23 | </div> | 23 | </div> |
| 24 | <div class="row p-1 botonera-secundaria"> | 24 | <div class="row p-1 botonera-secundaria"> |
| 25 | <div class="col-12"> | 25 | <div class="col-12"> |
| 26 | <div class="row"> | 26 | <div class="row"> |
| 27 | <div class="col-3 px-0 py-0" ng-repeat="boton in botonera"> | 27 | <div class="col-3 px-0 py-0" ng-repeat="boton in botonera"> |
| 28 | <button | 28 | <button |
| 29 | type="button" | 29 | type="button" |
| 30 | class="btn btn-default btn-block btn-xs text-left py-2" | 30 | class="btn btn-default btn-block btn-xs text-left py-2" |
| 31 | ng-click="boton.accion()" | 31 | ng-click="boton.accion()" |
| 32 | > | 32 | > |
| 33 | <i | 33 | <i |
| 34 | class="fa fa-arrow-circle-right" | 34 | class="fa fa-arrow-circle-right" |
| 35 | ng-show="boton.texto != ''" | 35 | ng-show="boton.texto != ''" |
| 36 | ></i> | 36 | ></i> |
| 37 | | 37 | |
| 38 | {{boton.texto}} | 38 | {{boton.texto}} |
| 39 | </button> | 39 | </button> |
| 40 | </div> | 40 | </div> |
| 41 | </div> | 41 | </div> |
| 42 | </div> | 42 | </div> |
| 43 | </div> | 43 | </div> |
| 44 | </div> | 44 | </div> |
| 45 | </div> | 45 | </div> |
| 46 | </form> | 46 | </form> |
| 47 | <div class="row"> | 47 | <div class="row"> |
| 48 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 48 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 49 | <div class="row grilla-articulos align-items-end"> | 49 | <div class="row grilla-articulo align-items-end"> |
| 50 | <table class="table table-striped table-sm table-dark"> | 50 | <table class="table table-striped table-sm table-dark tabla-articulo"> |
| 51 | <thead> | 51 | <thead> |
| 52 | <tr> | 52 | <tr> |
| 53 | <th>Código</th> | 53 | <th class="tabla-articulo-numero">#</th> |
| 54 | <th>Descripción</th> | 54 | <th class="tabla-articulo-codigo">Código</th> |
| 55 | <th>Cantidad</th> | 55 | <th class="tabla-articulo-descripcion">Descripción</th> |
| 56 | <th>Precio Unitario</th> | 56 | <th class="tabla-articulo-cantidad text-right">Cantidad</th> |
| 57 | <th>SubTotal</th> | 57 | <th class="tabla-articulo-precio text-right">Precio Unitario</th> |
| 58 | <th> | 58 | <th class="tabla-articulo-subtotal text-right">SubTotal</th> |
| 59 | <th class="tabla-articulo-boton text-right"> | ||
| 59 | <button | 60 | <button |
| 60 | class="btn btn-outline-secondary selectable" | 61 | class="btn btn-outline-secondary selectable" |
| 61 | style="float: right;" | ||
| 62 | ng-click="show = !show; masMenos()" | 62 | ng-click="show = !show; masMenos()" |
| 63 | > | 63 | > |
| 64 | <i | 64 | <i |
| 65 | class="fa fa-chevron-down" | 65 | class="fa fa-chevron-down" |
| 66 | ng-hide="show" | 66 | ng-show="show" |
| 67 | aria-hidden="true" | 67 | aria-hidden="true" |
| 68 | > | 68 | > |
| 69 | </i> | 69 | </i> |
| 70 | <i | 70 | <i |
| 71 | class="fa fa-chevron-up" | 71 | class="fa fa-chevron-up" |
| 72 | ng-show="show" | 72 | ng-hide="show" |
| 73 | aria-hidden="true"> | 73 | aria-hidden="true"> |
| 74 | </i> | 74 | </i> |
| 75 | </button> | 75 | </button> |
| 76 | </th> | 76 | </th> |
| 77 | </tr> | 77 | </tr> |
| 78 | </thead> | 78 | </thead> |
| 79 | <tbody> | 79 | <tbody class="tabla-articulo-body"> |
| 80 | <tr ng-show="!cargando"> | ||
| 81 | <td><input | ||
| 82 | class="form-control" | ||
| 83 | ng-model="articuloACargar.sectorCodigo" | ||
| 84 | readonly></td> | ||
| 85 | <td><input | ||
| 86 | class="form-control" | ||
| 87 | ng-model="articuloACargar.descripcion" | ||
| 88 | readonly></td> | ||
| 89 | <td class="text-right"><input | ||
| 90 | class="form-control" | ||
| 91 | type="number" | ||
| 92 | min="1" | ||
| 93 | ng-model="articuloACargar.cantidad" | ||
| 94 | foca-focus="!cargando" | ||
| 95 | esc-key="resetFilter()" | ||
| 96 | ng-keypress="agregarATabla($event.keyCode)"></td> | ||
| 97 | <td class="text-right"><input | ||
| 98 | class="form-control" | ||
| 99 | ng-value="articuloACargar.precio | currency: '$'" | ||
| 100 | readonly></td> | ||
| 101 | <td class="text-right"><input | ||
| 102 | class="form-control" | ||
| 103 | ng-value="getSubTotal() | currency: '$'" | ||
| 104 | readonly></td> | ||
| 105 | <td class="text-center"><button | ||
| 106 | class="btn btn-outline-secondary btn-sm" | ||
| 107 | ng-click="agregarATabla(13)"> | ||
| 108 | <i class="fa fa-save"></i> | ||
| 109 | </button></td> | ||
| 110 | </tr> | ||
| 111 | <tr | 80 | <tr |
| 112 | ng-repeat="(key, articulo) in articulosTabla" | 81 | ng-repeat="(key, articulo) in articulosTabla" |
| 113 | ng-show="show || key == 0" | 82 | ng-show="show || key == (articulosTabla.length - 1)" |
| 114 | > | 83 | > |
| 115 | <td ng-bind="articulo.sector + '-' + articulo.codigo"></td> | 84 | <td class="tabla-articulo-numero" ng-bind="key + 1"></td> |
| 116 | <td ng-bind="articulo.descripcion"></td> | 85 | <td |
| 117 | <td class="text-right"><input | 86 | class="tabla-articulo-codigo" |
| 87 | ng-bind="articulo.sector + '-' + articulo.codigo" | ||
| 88 | ></td> | ||
| 89 | <td | ||
| 90 | class="tabla-articulo-descripcion" | ||
| 91 | ng-bind="articulo.descripcion" | ||
| 92 | ></td> | ||
| 93 | <td class="tabla-articulo-cantidad text-right"> | ||
| 94 | <input | ||
| 118 | ng-show="articulo.edit" | 95 | ng-show="articulo.edit" |
| 119 | ng-model="articulo.cantidad" | 96 | ng-model="articulo.cantidad" |
| 120 | class="form-control" | 97 | class="form-control" |
| 121 | type="number" | 98 | type="number" |
| 122 | min="1" | 99 | min="1" |
| 123 | foca-focus="articulo.edit" | 100 | foca-focus="articulo.edit" |
| 124 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 101 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 125 | ng-focus="selectFocus($event)" | 102 | ng-focus="selectFocus($event)" |
| 126 | > | 103 | > |
| 127 | <i | 104 | <i |
| 128 | class="selectable" | 105 | class="selectable" |
| 129 | ng-click="cambioEdit(articulo)" | 106 | ng-click="cambioEdit(articulo)" |
| 130 | ng-hide="articulo.edit" | 107 | ng-hide="articulo.edit" |
| 131 | ng-bind="articulo.cantidad"> | 108 | ng-bind="articulo.cantidad"> |
| 132 | </i> | 109 | </i> |
| 133 | </td> | 110 | </td> |
| 134 | <td class="text-right" ng-bind="articulo.precio | currency: '$'"></td> | 111 | <td |
| 112 | class="tabla-articulo-precio text-right" | ||
| 113 | ng-bind="articulo.precio | currency: '$'" | ||
| 114 | ></td> | ||
| 135 | <td | 115 | <td |
| 136 | class="text-right" | 116 | class="tabla-articulo-subtotal text-right" |
| 137 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | 117 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
| 138 | </td> | 118 | </td> |
| 139 | <td class="text-center"> | 119 | <td class="tabla-articulo-boton text-center"> |
| 140 | <button | 120 | <button |
| 141 | class="btn btn-outline-secondary btn-sm" | 121 | class="btn btn-outline-secondary btn-sm" |
| 142 | ng-click="quitarArticulo(key)" | 122 | ng-click="quitarArticulo(key)" |
| 143 | > | 123 | > |
| 144 | <i class="fa fa-trash"></i> | 124 | <i class="fa fa-trash"></i> |
| 145 | </button> | 125 | </button> |
| 146 | </td> | 126 | </td> |
| 147 | </tr> | 127 | </tr> |
| 128 | </tbody> | ||
| 129 | <tfoot> | ||
| 130 | <tr ng-show="!cargando"> | ||
| 131 | <td | ||
| 132 | class="tabla-articulo-numero align-middle" | ||
| 133 | ng-bind="articulosTabla.length + 1" | ||
| 134 | ></td> | ||
| 135 | <td class="tabla-articulo-codigo"> | ||
| 136 | <input | ||
| 137 | class="form-control" | ||
| 138 | ng-model="articuloACargar.sectorCodigo" | ||
| 139 | readonly | ||
| 140 | > | ||
| 141 | </td> | ||
| 142 | <td class="tabla-articulo-descripcion"> | ||
| 143 | <input | ||
| 144 | class="form-control" | ||
| 145 | ng-model="articuloACargar.descripcion" | ||
| 146 | readonly | ||
| 147 | > | ||
| 148 | </td> | ||
| 149 | <td class="tabla-articulo-cantidad text-right"> | ||
| 150 | <input | ||
| 151 | class="form-control" | ||
| 152 | type="number" | ||
| 153 | min="1" | ||
| 154 | ng-model="articuloACargar.cantidad" | ||
| 155 | foca-focus="!cargando" | ||
| 156 | esc-key="resetFilter()" | ||
| 157 | ng-keypress="agregarATabla($event.keyCode)" | ||
| 158 | > | ||
| 159 | </td> | ||
| 160 | <td class="tabla-articulo-precio text-right"> | ||
| 161 | <input | ||
| 162 | class="form-control" | ||
| 163 | ng-value="articuloACargar.precio | currency: '$'" | ||
| 164 | readonly | ||
| 165 | > | ||
| 166 | </td> | ||
| 167 | <td class="tabla-articulo-subtotal text-right"> | ||
| 168 | <input | ||
| 169 | class="form-control" | ||
| 170 | ng-value="getSubTotal() | currency: '$'" | ||
| 171 | readonly | ||
| 172 | ></td> | ||
| 173 | <td class="tabla-articulo-boton text-center align-middle"> | ||
| 174 | <button | ||
| 175 | class="btn btn-outline-secondary" | ||
| 176 | ng-click="agregarATabla(13)" | ||
| 177 | > | ||
| 178 | <i class="fa fa-save"></i> | ||
| 179 | </button> | ||
| 180 | </td> | ||
| 181 | </tr> | ||
| 148 | <tr ng-show="cargando"> | 182 | <tr ng-show="cargando"> |
| 149 | <td colspan="6"> | 183 | <td colspan="7"> |
| 150 | <input | 184 | <input |
| 151 | placeholder="Seleccione Articulo" | 185 | placeholder="Seleccione Articulo" |
| 152 | class="form-control form-control-sm" | 186 | class="form-control form-control-sm" |
| 153 | readonly | 187 | readonly |
| 154 | ng-click="seleccionarArticulo()" | 188 | ng-click="seleccionarArticulo()" |
| 155 | /> | 189 | /> |
| 156 | </td> | 190 | </td> |
| 157 | </tr> | 191 | </tr> |
| 158 | </tbody> | ||
| 159 | <tfoot> | ||
| 160 | <tr class=""> | 192 | <tr class=""> |
| 161 | <td colspan="3"> | 193 | <td colspan="4"> |
| 162 | <strong>Cantidad Items:</strong> | 194 | <strong>Cantidad Items:</strong> |
| 163 | <a ng-bind="articulosTabla.length"></a> | 195 | <a ng-bind="articulosTabla.length"></a> |
| 164 | </td> | 196 | </td> |
| 165 | <td class="text-right table-celda-total"><h3>Total:</h3></td> | 197 | <td class="text-right table-celda-total"><h3>Total:</h3></td> |
| 166 | <td class="table-celda-total text-right" colspan="1"> | 198 | <td class="table-celda-total text-right" colspan="1"> |
| 167 | <h3>{{getTotal() | currency: '$'}}</h3> | 199 | <h3>{{getTotal() | currency: '$'}}</h3> |
| 168 | </td> | 200 | </td> |
| 169 | <td colspan="2" class="text-right"> | 201 | <td class="text-right"> |
| 170 | <button | 202 | <button |
| 171 | type="button" | 203 | type="button" |
| 172 | class="btn btn-default btn-sm" | 204 | class="btn btn-default btn-sm" |
| 173 | > | 205 | > |
| 174 | Totales | 206 | Totales |
| 175 | </button> | 207 | </button> |
| 176 | </td> | 208 | </td> |
| 177 | </tr> | 209 | </tr> |
| 178 | </tfoot> | 210 | </tfoot> |
| 179 | </table> | 211 | </table> |
| 180 | </div> | 212 | </div> |
| 181 | </div> | 213 | </div> |
| 182 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> | 214 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> |
| 183 | <div class="row align-items-end"> | 215 | <div class="row align-items-end"> |
| 184 | <div class="col-12"> | 216 | <div class="col-12"> |
| 185 | <button | 217 | <button |
| 186 | ng-click="crearNotaPedido()" | 218 | ng-click="crearNotaPedido()" |
| 187 | type="submit" | 219 | type="submit" |
| 188 | title="Crear nota pedido" | 220 | title="Crear nota pedido" |
| 189 | class="btn btn-default btn-block mb-2"> | 221 | class="btn btn-default btn-block mb-2"> |
| 190 | Guardar | 222 | Guardar |
| 191 | </button> | 223 | </button> |
| 192 | <button | 224 | <button |
| 193 | ng-click="salir()" | 225 | ng-click="salir()" |
| 194 | type="button" | 226 | type="button" |
| 195 | title="Salir" | 227 | title="Salir" |
| 196 | class="btn btn-default btn-block"> | 228 | class="btn btn-default btn-block"> |
| 197 | Salir | 229 | Salir |
| 198 | </button> | 230 | </button> |
| 199 | </div> | 231 | </div> |
| 200 | </div> | 232 | </div> |
| 201 | </div> | 233 | </div> |
| 202 | </div> | 234 | </div> |
| 203 | </div> | 235 | </div> |
| 204 | <!-- | ||
| 205 | <form name="formCrearNota"> | ||
| 206 | <uib-tabset active="active"> | ||
| 207 | <uib-tab index="0" heading="General"> | ||
| 208 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | ||
| 209 | <div> | ||
| 210 | <div class="col-auto my-2"> | ||
| 211 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | ||
| 212 | </div> | ||
| 213 | </div> | ||
| 214 | <br> | ||
| 215 | <br> | ||
| 216 | <div class="row"> | ||
| 217 | <div class="col-md-2"> | ||
| 218 | <div class="col-auto"> | ||
| 219 | <label>Fecha de carga</label> | ||
| 220 | </div> | ||
| 221 | </div> | ||
| 222 | <div class="col-md-3"> | ||
| 223 | <div class="col-auto"> | ||
| 224 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | ||
| 225 | </div> | ||
| 226 | </div> | ||
| 227 | <div class="col-md-2"> | ||
| 228 | <div class="col-auto"> | ||
| 229 | <label>Kilómetros</label> | ||
| 230 | </div> | ||
| 231 | </div> | ||
| 232 | <div class="col-md-3"> | ||
| 233 | <div class="col-auto"> | ||
| 234 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | ||
| 235 | ng-model="notaPedido.kilometros" ng-required="true"> | ||
| 236 | </div> | ||
| 237 | </div> | ||
| 238 | </div> | ||
| 239 | <div class="row my-3"> | ||
| 240 | <div class="col-md-2"> | ||
| 241 | <div class="col-auto"> | ||
| 242 | <label>Jurisdicción de IIBB</label> | ||
| 243 | </div> | ||
| 244 | </div> | ||
| 245 | <div class="col-md-3"> | ||
| 246 | <div class="col-auto"> | ||
| 247 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | ||
| 248 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | ||
| 249 | </div> | ||
| 250 | </div> | ||
| 251 | <div class="col-md-2"> | ||
| 252 | <div class="col-auto"> | ||
| 253 | <label>Costo de financiación</label> | ||
| 254 | </div> | ||
| 255 | </div> | ||
| 256 | <div class="col-md-3"> | ||
| 257 | <div class="col-auto"> | ||
| 258 | <div class="input-group mb-2"> | ||
| 259 | <div class="input-group-prepend"> | ||
| 260 | <div class="input-group-text">$</div> | ||
| 261 | </div> | ||
| 262 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | ||
| 263 | ng-model="notaPedido.costoFinanciacion"> | ||
| 264 | </div> | ||
| 265 | </div> | ||
| 266 | </div> | ||
| 267 | </div> | ||
| 268 | <div class="row"> | ||
| 269 | <div class="col-md-2"> | ||
| 270 | <div class="col-auto"> | ||
| 271 | <label>Bomba</label> | ||
| 272 | </div> | ||
| 273 | </div> | ||
| 274 | <div class="col-md-1"> | ||
| 275 | <div class="col-auto"> | ||
| 276 | <div class="form-check custom-radio custom-control-inline"> | ||
| 277 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | ||
| 278 | <label class="form-check-label"> | ||
| 279 | Si | ||
| 280 | </label> | ||
| 281 | </div> | ||
| 282 | <div class="form-check custom-radio custom-control-inline"> | ||
| 283 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | ||
| 284 | <label class="form-check-label"> | ||
| 285 | No | ||
| 286 | </label> | ||
| 287 | </div> | ||
| 288 | </div> | ||
| 289 | </div> | ||
| 290 | <div class="col-md-1"> | ||
| 291 | <div class="col-auto"> | ||
| 292 | <label>Flete</label> | ||
| 293 | </div> | ||
| 294 | </div> | ||
| 295 | <div class="col-md-1"> | ||
| 296 | <div class="col-auto"> | ||
| 297 | <div class="form-check custom-radio custom-control-inline"> | ||
| 298 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | ||
| 299 | <label class="form-check-label"> | ||
| 300 | Si | ||
| 301 | </label> | ||
| 302 | </div> | ||
| 303 | <div class="form-check custom-radio custom-control-inline"> | ||
| 304 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | ||
| 305 | <label class="form-check-label"> | ||
| 306 | FOB | ||
| 307 | </label> | ||
| 308 | </div> | ||
| 309 | </div> | ||
| 310 | </div> | ||
| 311 | <div class="col-md-2"> | ||
| 312 | <div class="col-auto"> | ||
| 313 | <label>Costo unitario kilometro flete</label> | ||
| 314 | </div> | ||
| 315 | </div> | ||
| 316 | <div class="col-md-3"> | ||
| 317 | <div class="col-auto"> | ||
| 318 | <div class="input-group mb-2"> | ||
| 319 | <div class="input-group-prepend"> | ||
| 320 | <div class="input-group-text">$</div> | ||
| 321 | </div> | ||
| 322 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | ||
| 323 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | ||
| 324 | </div> | ||
| 325 | </div> | ||
| 326 | </div> | ||
| 327 | </div> | ||
| 328 | <div class="row my-3"> | ||
| 329 | <div class="col-md-2"> | ||
| 330 | <div class="col-auto"> | ||
| 331 | <label>Vendedor</label> | ||
| 332 | </div> | ||
| 333 | </div> | ||
| 334 | <div class="col-md-3"> | ||
| 335 | <div class="col-auto"> | ||
| 336 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | ||
| 337 | ng-click="seleccionarVendedor()" readonly> | ||
| 338 | </div> | ||
| 339 | </div> | ||
| 340 | <div class="col-md-2"> | ||
| 341 | <div class="col-auto"> | ||
| 342 | <label>Proveedor</label> | ||
| 343 | </div> | ||
| 344 | </div> | ||
| 345 | <div class="col-md-3"> | ||
| 346 | <div class="col-auto"> | ||
| 347 | <input type="text" class="form-control" placeholder="Seleccione proveedor" ng-model="notaPedido.proveedor" | ||
| 348 | ng-click="seleccionarProveedor()" readonly> | ||
| 349 | </div> | ||
| 350 | </div> | ||
| 351 | </div> | ||
| 352 | </div> | ||
| 353 | <div class="row"> | ||
| 354 | <div class="col-md-2"> | ||
| 355 | <div class="col-auto"> | ||
| 356 | <label>Cliente</label> | ||
| 357 | </div> | ||
| 358 | </div> | ||
| 359 | <div class="col-md-3"> | ||
| 360 | <div class="col-auto"> | ||
| 361 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | ||
| 362 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | ||
| 363 | </div> | ||
| 364 | </div> | ||
| 365 | <div class="col-md-2"> | ||
| 366 | <div class="col-auto"> | ||
| 367 | <label>Domicilio</label> | ||
| 368 | </div> | ||
| 369 | </div> | ||
| 370 | <div class="col-md-4"> | ||
| 371 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | ||
| 372 | <div class="col-auto"> | ||
| 373 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | ||
| 374 | domi.dom | ||
| 375 | for domi | ||
| 376 | in domiciliosCliente | ||
| 377 | " | ||
| 378 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | ||
| 379 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | ||
| 380 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | ||
| 381 | <div ng-show="sinResultados"> | ||
| 382 | No se encontraron resultados. | ||
| 383 | </div> |
src/views/nota-pedido_1.html
| 1 | <form name="formCrearNota" ng-submit="siguienteTab()"> | File was deleted | |
| 2 | <uib-tabset active="active"> | ||
| 3 | <uib-tab index="0" heading="General"> | ||
| 4 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | ||
| 5 | <div> | ||
| 6 | <div class="col-auto my-2"> | ||
| 7 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | ||
| 8 | </div> | ||
| 9 | </div> | ||
| 10 | <br> | ||
| 11 | <br> | ||
| 12 | <div class="row"> | ||
| 13 | <div class="col-md-2"> | ||
| 14 | <div class="col-auto"> | ||
| 15 | <label>Fecha de carga</label> | ||
| 16 | </div> | ||
| 17 | </div> | ||
| 18 | <div class="col-md-3"> | ||
| 19 | <div class="col-auto"> | ||
| 20 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | ||
| 21 | </div> | ||
| 22 | </div> | ||
| 23 | <div class="col-md-2"> | ||
| 24 | <div class="col-auto"> | ||
| 25 | <label>Kilómetros</label> | ||
| 26 | </div> | ||
| 27 | </div> | ||
| 28 | <div class="col-md-3"> | ||
| 29 | <div class="col-auto"> | ||
| 30 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | ||
| 31 | ng-model="notaPedido.kilometros" ng-required="true"> | ||
| 32 | </div> | ||
| 33 | </div> | ||
| 34 | </div> | ||
| 35 | <div class="row my-3"> | ||
| 36 | <div class="col-md-2"> | ||
| 37 | <div class="col-auto"> | ||
| 38 | <label>Jurisdicción de IIBB</label> | ||
| 39 | </div> | ||
| 40 | </div> | ||
| 41 | <div class="col-md-3"> | ||
| 42 | <div class="col-auto"> | ||
| 43 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | ||
| 44 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | ||
| 45 | </div> | ||
| 46 | </div> | ||
| 47 | <div class="col-md-2"> | ||
| 48 | <div class="col-auto"> | ||
| 49 | <label>Costo de financiación</label> | ||
| 50 | </div> | ||
| 51 | </div> | ||
| 52 | <div class="col-md-3"> | ||
| 53 | <div class="col-auto"> | ||
| 54 | <div class="input-group mb-2"> | ||
| 55 | <div class="input-group-prepend"> | ||
| 56 | <div class="input-group-text">$</div> | ||
| 57 | </div> | ||
| 58 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | ||
| 59 | ng-model="notaPedido.costoFinanciacion"> | ||
| 60 | </div> | ||
| 61 | </div> | ||
| 62 | </div> | ||
| 63 | </div> | ||
| 64 | <div class="row"> | ||
| 65 | <div class="col-md-2"> | ||
| 66 | <div class="col-auto"> | ||
| 67 | <label>Bomba</label> | ||
| 68 | </div> | ||
| 69 | </div> | ||
| 70 | <div class="col-md-1"> | ||
| 71 | <div class="col-auto"> | ||
| 72 | <div class="form-check custom-radio custom-control-inline"> | ||
| 73 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | ||
| 74 | <label class="form-check-label"> | ||
| 75 | Si | ||
| 76 | </label> | ||
| 77 | </div> | ||
| 78 | <div class="form-check custom-radio custom-control-inline"> | ||
| 79 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | ||
| 80 | <label class="form-check-label"> | ||
| 81 | No | ||
| 82 | </label> | ||
| 83 | </div> | ||
| 84 | </div> | ||
| 85 | </div> | ||
| 86 | <div class="col-md-1"> | ||
| 87 | <div class="col-auto"> | ||
| 88 | <label>Flete</label> | ||
| 89 | </div> | ||
| 90 | </div> | ||
| 91 | <div class="col-md-1"> | ||
| 92 | <div class="col-auto"> | ||
| 93 | <div class="form-check custom-radio custom-control-inline"> | ||
| 94 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | ||
| 95 | <label class="form-check-label"> | ||
| 96 | Si | ||
| 97 | </label> | ||
| 98 | </div> | ||
| 99 | <div class="form-check custom-radio custom-control-inline"> | ||
| 100 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | ||
| 101 | <label class="form-check-label"> | ||
| 102 | FOB | ||
| 103 | </label> | ||
| 104 | </div> | ||
| 105 | </div> | ||
| 106 | </div> | ||
| 107 | <div class="col-md-2"> | ||
| 108 | <div class="col-auto"> | ||
| 109 | <label>Costo unitario kilometro flete</label> | ||
| 110 | </div> | ||
| 111 | </div> | ||
| 112 | <div class="col-md-3"> | ||
| 113 | <div class="col-auto"> | ||
| 114 | <div class="input-group mb-2"> | ||
| 115 | <div class="input-group-prepend"> | ||
| 116 | <div class="input-group-text">$</div> | ||
| 117 | </div> | ||
| 118 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | ||
| 119 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | ||
| 120 | </div> | ||
| 121 | </div> | ||
| 122 | </div> | ||
| 123 | </div> | ||
| 124 | <div class="row my-3"> | ||
| 125 | <div class="col-md-2"> | ||
| 126 | <div class="col-auto"> | ||
| 127 | <label>Vendedor</label> | ||
| 128 | </div> | ||
| 129 | </div> | ||
| 130 | <div class="col-md-3"> | ||
| 131 | <div class="col-auto"> | ||
| 132 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | ||
| 133 | ng-click="seleccionarVendedor()" readonly> | ||
| 134 | </div> | ||
| 135 | </div> | ||
| 136 | <div class="col-md-2"> | ||
| 137 | <div class="col-auto"> | ||
| 138 | <label>Proveedor</label> | ||
| 139 | </div> | ||
| 140 | </div> | ||
| 141 | <div class="col-md-3"> | ||
| 142 | <div class="col-auto"> | ||
| 143 | <input type="text" class="form-control" placeholder="Seleccione proveedor" ng-model="notaPedido.proveedor" | ||
| 144 | ng-click="seleccionarProveedor()" readonly> | ||
| 145 | </div> | ||
| 146 | </div> | ||
| 147 | </div> | ||
| 148 | </div> | ||
| 149 | <div class="row"> | ||
| 150 | <div class="col-md-2"> | ||
| 151 | <div class="col-auto"> | ||
| 152 | <label>Cliente</label> | ||
| 153 | </div> | ||
| 154 | </div> | ||
| 155 | <div class="col-md-3"> | ||
| 156 | <div class="col-auto"> | ||
| 157 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | ||
| 158 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | ||
| 159 | </div> | ||
| 160 | </div> | ||
| 161 | <div class="col-md-2"> | ||
| 162 | <div class="col-auto"> | ||
| 163 | <label>Domicilio</label> | ||
| 164 | </div> | ||
| 165 | </div> | ||
| 166 | <div class="col-md-4"> | ||
| 167 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | ||
| 168 | <div class="col-auto"> | ||
| 169 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | ||
| 170 | domi.dom | ||
| 171 | for domi | ||
| 172 | in domiciliosCliente | ||
| 173 | " | ||
| 174 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | ||
| 175 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | ||
| 176 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | ||
| 177 | <div ng-show="sinResultados"> | ||
| 178 | No se encontraron resultados. | ||
| 179 | </div> | ||
| 180 | </div> | ||
| 181 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> | ||
| 182 | <a class="btn" ng-click="addNewDom()">+</a> | ||
| 183 | </div> | ||
| 184 | </div> | ||
| 185 | </div> | ||
| 186 | </uib-tab> | ||
| 187 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> | ||
| 188 | <div> | ||
| 189 | <div class="col-auto my-2"> | ||
| 190 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> | ||
| 191 | </div> | ||
| 192 | </div> | ||
| 193 | <br> | ||
| 194 | <br> | ||
| 195 | <div class="row"> | ||
| 196 | <div class="col-md-2"> | ||
| 197 | <div class="col-auto"> | ||
| 198 | <label>Precios y condiciones</label> | ||
| 199 | </div> | ||
| 200 | </div> | ||
| 201 | <div class="col-md-4"> | ||
| 202 | <div class="col-auto"> | ||
| 203 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> | ||
| 204 | </select> | ||
| 205 | </div> | ||
| 206 | </div> | ||
| 207 | <div class="col-md-2"> | ||
| 208 | <div class="col-auto"> | ||
| 209 | <label>Producto</label> | ||
| 210 | </div> | ||
| 211 | </div> | ||
| 212 | <div class="col-md-4"> | ||
| 213 | <div class="col-auto"> | ||
| 214 | <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" | ||
| 215 | ng-click="seleccionarArticulo()" readonly> | ||
| 216 | </div> | ||
| 217 | </div> | ||
| 218 | </div> | ||
| 219 | <div class="col-md-12"> | ||
| 220 | <table class="table my-3 table-hover table-nonfluid"> | ||
| 221 | <thead> | ||
| 222 | <tr> | ||
| 223 | <th>Código</th> | ||
| 224 | <th>Nombre</th> | ||
| 225 | <th>Precio unitario</th> | ||
| 226 | <th>Costo unitario bruto</th> | ||
| 227 | <th>Cantidad</th> | ||
| 228 | <th>Subtotal</th> | ||
| 229 | </tr> | ||
| 230 | </thead> | ||
| 231 | <tbody> | ||
| 232 | <tr ng-repeat="articulo in articulosTabla"> | ||
| 233 | <td ng-bind="articulo.codigo"></td> | ||
| 234 | <td ng-bind="articulo.nombre"></td> | ||
| 235 | <td ng-bind="articulo.precio"></td> | ||
| 236 | <td ng-bind="articulo.costoUnitario"></td> | ||
| 237 | <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td> | ||
| 238 | <td ng-bind="getSubTotal(articulo.item)"></td> | ||
| 239 | </tr> | ||
| 240 | </tbody> | ||
| 241 | </table> | ||
| 242 | </div> | ||
| 243 | </uib-tab> | ||
| 244 | </uib-tabset> | ||
| 245 | </form> |