Commit e700d7112a73b8ca1d3e769cd1cd85bb226d1990

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-crear-nota-pedido!15
1 { 1 {
2 "name": "foca-crear-nota-pedido", 2 "name": "foca-crear-nota-pedido",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "Listado y ABM nota de pedidos", 4 "description": "Listado y ABM nota de pedidos",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit", 9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install", 10 "postinstall": "npm run compile && gulp clean-post-install",
11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git" 11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git"
12 }, 12 },
13 "pre-commit": [ 13 "pre-commit": [
14 "gulp-pre-commit" 14 "gulp-pre-commit"
15 ], 15 ],
16 "repository": { 16 "repository": {
17 "type": "git", 17 "type": "git",
18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" 18 "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git"
19 }, 19 },
20 "author": "Foca Software", 20 "author": "Foca Software",
21 "license": "ISC", 21 "license": "ISC",
22 "peerDependencies": { 22 "peerDependencies": {
23 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", 23 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
24 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", 24 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
25 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos", 25 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
26 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", 26 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git",
27 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git" 27 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git"
28 }, 28 },
29 "devDependencies": { 29 "devDependencies": {
30 "angular": "^1.7.5", 30 "angular": "^1.7.5",
31 "angular-route": "^1.7.5", 31 "angular-route": "^1.7.5",
32 "bootstrap": "^4.1.3", 32 "bootstrap": "^4.1.3",
33 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", 33 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
34 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", 34 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
35 "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", 35 "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git",
36 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos", 36 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
37 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", 37 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete",
38 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", 38 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git",
39 "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", 39 "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git",
40 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", 40 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
41 "font-awesome": "^4.7.0", 41 "font-awesome": "^4.7.0",
42 "gulp": "^3.9.1", 42 "gulp": "^3.9.1",
43 "gulp-angular-templatecache": "2.2.2", 43 "gulp-angular-templatecache": "2.2.2",
44 "gulp-clean": "^0.4.0", 44 "gulp-clean": "^0.4.0",
45 "gulp-concat": "^2.6.1", 45 "gulp-concat": "^2.6.1",
46 "gulp-connect": "^5.6.1", 46 "gulp-connect": "^5.6.1",
47 "gulp-htmlmin": "^5.0.1", 47 "gulp-htmlmin": "^5.0.1",
48 "gulp-jshint": "^2.1.0", 48 "gulp-jshint": "^2.1.0",
49 "gulp-rename": "^1.4.0", 49 "gulp-rename": "^1.4.0",
50 "gulp-replace": "^1.0.0", 50 "gulp-replace": "^1.0.0",
51 "gulp-sequence": "^1.0.0", 51 "gulp-sequence": "^1.0.0",
52 "gulp-uglify": "^3.0.1", 52 "gulp-uglify": "^3.0.1",
53 "gulp-uglify-es": "^1.0.4", 53 "gulp-uglify-es": "^1.0.4",
54 "jasmine-core": "^3.2.1", 54 "jasmine-core": "^3.2.1",
55 "jquery": "^3.3.1", 55 "jquery": "^3.3.1",
56 "jshint": "^2.9.6", 56 "jshint": "^2.9.6",
57 "pre-commit": "^1.2.2", 57 "pre-commit": "^1.2.2",
58 "pump": "^3.0.0", 58 "pump": "^3.0.0",
59 "ui-bootstrap4": "^3.0.5" 59 "ui-bootstrap4": "^3.0.5"
60 } 60 }
61 } 61 }
62 62
src/js/controller.js
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .controller('notaPedidoCtrl', 2 .controller('notaPedidoCtrl',
3 ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService', 3 ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService',
4 function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) { 4 function($scope, $uibModal, crearNotaPedidoService, focaModalService) {
5 $scope.show = false; 5 $scope.show = false;
6 $scope.cargando = true; 6 $scope.cargando = true;
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 $scope.notaPedido = { 11 $scope.notaPedido = {
12 vendedor: {}, 12 vendedor: {},
13 cliente: {} 13 cliente: {},
14 domicilio: { dom: ''}
14 }; 15 };
15 $scope.articulosTabla = []; 16 $scope.articulosTabla = [];
16 var idLista; 17 var idLista;
17 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 18 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
18 $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1);
19 crearNotaPedidoService.getPrecioCondicion().then( 19 crearNotaPedidoService.getPrecioCondicion().then(
20 function(res) { 20 function(res) {
21 $scope.precioCondiciones = res.data; 21 $scope.precioCondiciones = res.data;
22 } 22 }
23 ); 23 );
24 if (notaPedidoTemp !== undefined) { 24 if (notaPedidoTemp !== undefined) {
25 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 25 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
26 $scope.notaPedido = notaPedidoTemp; 26 $scope.notaPedido = notaPedidoTemp;
27 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 27 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
28 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 28 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
29 idLista = $scope.notaPedido.precioCondicion; 29 idLista = $scope.notaPedido.precioCondicion;
30 crearNotaPedidoService 30 crearNotaPedidoService
31 .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 31 .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
32 function(res) { 32 function(res) {
33 $scope.articulosTabla = res.data; 33 $scope.articulosTabla = res.data;
34 } 34 }
35 ); 35 );
36 crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 36 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
37 function(res) { 37 //(NO REQUERIDO EN ESTA VERSION)
38 $scope.notaPedido.domicilio = res.data; 38 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
39 } 39 // function(res) {
40 ); 40 // $scope.notaPedido.domicilio = res.data;
41 // }
42 // );
41 } else { 43 } else {
42 $scope.notaPedido.fechaCarga = new Date(); 44 $scope.notaPedido.fechaCarga = new Date();
43 $scope.notaPedido.domicilio = [{ id: 0 }]; 45 $scope.notaPedido.bomba = '0';
44 $scope.notaPedido.bomba = '1';
45 $scope.notaPedido.flete = '0'; 46 $scope.notaPedido.flete = '0';
46 idLista = undefined; 47 idLista = undefined;
47 } 48 }
48 $scope.addNewDom = function() { 49 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
49 $scope.notaPedido.domicilio.push({ 'id': 0 }); 50 // $scope.addNewDom = function() {
50 }; 51 // $scope.notaPedido.domicilio.push({ 'id': 0 });
51 $scope.removeNewChoice = function(choice) { 52 // };
52 if ($scope.notaPedido.domicilio.length > 1) { 53 // $scope.removeNewChoice = function(choice) {
53 $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 54 // if ($scope.notaPedido.domicilio.length > 1) {
54 function(c) { 55 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
55 return c.$$hashKey === choice.$$hashKey; 56 // function(c) {
56 } 57 // return c.$$hashKey === choice.$$hashKey;
57 ), 1); 58 // }
58 } 59 // ), 1);
59 }; 60 // }
61 // };
60 $scope.crearNotaPedido = function() { 62 $scope.crearNotaPedido = function() {
63 if($scope.articulosTabla.length === 0) {
64 focaModalService.alert('Debe cargar almenos un articulo');
65 return;
66 }
67 if($scope.notaPedido.domicilio.id === undefined) {
68 $scope.notaPedido.domicilio.id = 0;
69 }
70 var date = new Date();
61 var notaPedido = { 71 var notaPedido = {
62 id: 0, 72 id: 0,
63 fechaCarga: $scope.notaPedido.fechaCarga, 73 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
74 .toISOString().slice(0, 19).replace('T', ' '),
64 vendedor: $scope.notaPedido.vendedor.nombre, 75 vendedor: $scope.notaPedido.vendedor.nombre,
65 cliente: $scope.notaPedido.cliente.nombre, 76 idCliente: $scope.notaPedido.cliente.id,
66 domicilio: $scope.notaPedido.domicilio.id, 77 domicilio: $scope.notaPedido.domicilio,
67 precioCondicion: $scope.notaPedido.precioCondicion, 78 precioCondicion: $scope.notaPedido.precioCondicion,
68 bomba: $scope.notaPedido.bomba, 79 bomba: $scope.notaPedido.bomba,
69 flete: $scope.notaPedido.flete, 80 flete: $scope.notaPedido.flete,
70 total: $scope.getTotal() 81 total: $scope.getTotal()
71 }; 82 };
72 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 83 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
73 function() { 84 function(data) {
74 focaModalService.alert('Nota pedido creada'); 85 focaModalService.alert('Nota pedido creada');
75 // $location.path('/venta-nota-pedido'); 86 if($scope.notaPedido.flete === 1) {
76 // var flete = { 87 var flete = {
77 // idNotaPedido: data.data.id, 88 idNotaPedido: data.data.id,
78 // idTransportista: $scope.notaPedido.fleteId, 89 idTransportista: $scope.notaPedido.fleteId,
79 // idChofer: $scope.chofer.id, 90 idChofer: $scope.notaPedido.chofer.id,
80 // idVehiculo: $scope.vehiculo.id, 91 idVehiculo: $scope.notaPedido.vehiculo.id,
81 // kilometros: $scope.notaPedido.kilometros, 92 kilometros: $scope.notaPedido.kilometros,
82 // costoKilometro: $scope.notaPedido.costoUnitarioKmFlete 93 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete
83 // }; 94 };
84 //TO DO - Insert de flete 95 crearNotaPedidoService.crearFlete(flete);
96 }
97 var articulosNotaPedido = $scope.articulosTabla;
98 for(var i = 0; i < articulosNotaPedido.length; i++) {
99 delete articulosNotaPedido[i].edit;
100 articulosNotaPedido[i].idNotaPedido = data.data.id;
101 crearNotaPedidoService
102 .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
103 }
104 $scope.limpiarPantalla();
85 } 105 }
86 ); 106 );
87 var articulosNotaPedido = $scope.articulosTabla;
88 for(var i = 0; i< articulosNotaPedido.length;i++) {
89 delete articulosNotaPedido[i].edit;
90 crearNotaPedidoService
91 .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then(
92 function() {
93 return;
94 }
95 );
96 }
97 $scope.notaPedido.precioCondicion = '';
98 $scope.articulosTabla = [];
99 $scope.notaPedido.fleteNombre = '';
100 $scope.notaPedido.chofer = '';
101 $scope.notaPedido.vehiculo = '';
102 $scope.notaPedido.kilometros = '';
103 $scope.notaPedido.costoUnitarioKmFlete = '';
104 $scope.notaPedido.vendedor.nombre = '';
105 $scope.notaPedido.cliente.nombre = '';
106 $scope.domicilio = '';
107 $scope.notaPedido.flete = 0;
108 };
109 $scope.siguienteTab = function() {
110 $scope.active = 1;
111 }; 107 };
112 $scope.seleccionarArticulo = function() { 108 $scope.seleccionarArticulo = function() {
113 if (idLista === undefined) { 109 if (idLista === undefined) {
114 focaModalService.alert( 110 focaModalService.alert(
115 'primero seleccione una lista de precio y condicion'); 111 'primero seleccione una lista de precio y condicion');
116 return; 112 return;
117 } 113 }
118 var modalInstance = $uibModal.open( 114 var modalInstance = $uibModal.open(
119 { 115 {
120 ariaLabelledBy: 'Busqueda de Productos', 116 ariaLabelledBy: 'Busqueda de Productos',
121 templateUrl: 'modal-busqueda-productos.html', 117 templateUrl: 'modal-busqueda-productos.html',
122 controller: 'modalBusquedaProductosCtrl', 118 controller: 'modalBusquedaProductosCtrl',
123 resolve: { idLista: function() { return idLista; } }, 119 resolve: { idLista: function() { return idLista; } },
124 size: 'lg' 120 size: 'lg'
125 } 121 }
126 ); 122 );
127 modalInstance.result.then( 123 modalInstance.result.then(
128 function(producto) { 124 function(producto) {
129 var newArt = 125 var newArt =
130 { 126 {
131 id: 0, 127 id: 0,
132 codigo: producto.codigo, 128 codigo: producto.codigo,
133 sector: producto.sector, 129 sector: producto.sector,
134 descripcion: producto.descripcion, 130 descripcion: producto.descripcion,
135 item: $scope.articulosTabla.length + 1, 131 item: $scope.articulosTabla.length + 1,
136 nombre: producto.descripcion, 132 nombre: producto.descripcion,
137 precio: producto.precio.toFixed(2), 133 precio: producto.precio.toFixed(2),
138 costoUnitario: producto.costo, 134 costoUnitario: producto.costo,
139 edit: false 135 edit: false
140 }; 136 };
141 $scope.articuloACargar = newArt; 137 $scope.articuloACargar = newArt;
142 $scope.cargando = false; 138 $scope.cargando = false;
143 }, function() { 139 }, function() {
144 // funcion ejecutada cuando se cancela el modal 140 // funcion ejecutada cuando se cancela el modal
145 } 141 }
146 ); 142 );
147 }; 143 };
148 $scope.seleccionarVendedor = function() { 144 $scope.seleccionarVendedor = function() {
149 var modalInstance = $uibModal.open( 145 var modalInstance = $uibModal.open(
150 { 146 {
151 ariaLabelledBy: 'Busqueda de Vendedores', 147 ariaLabelledBy: 'Busqueda de Vendedores',
152 templateUrl: 'modal-vendedores.html', 148 templateUrl: 'modal-vendedores.html',
153 controller: 'modalVendedoresCtrl', 149 controller: 'modalVendedoresCtrl',
154 size: 'lg' 150 size: 'lg'
155 } 151 }
156 ); 152 );
157 modalInstance.result.then( 153 modalInstance.result.then(
158 function(vendedor) { 154 function(vendedor) {
159 $scope.notaPedido.vendedor.nombre = vendedor.NomVen; 155 $scope.notaPedido.vendedor.nombre = vendedor.NomVen;
160 }, function() { 156 }, function() {
161 157
162 } 158 }
163 ); 159 );
164 }; 160 };
165 $scope.seleccionarPetrolera = function() { 161 $scope.seleccionarPetrolera = function() {
166 var modalInstance = $uibModal.open( 162 var modalInstance = $uibModal.open(
167 { 163 {
168 ariaLabelledBy: 'Busqueda de Petrolera', 164 ariaLabelledBy: 'Busqueda de Petrolera',
169 templateUrl: 'modal-petroleras.html', 165 templateUrl: 'modal-petroleras.html',
170 controller: 'modalPetrolerasCtrl', 166 controller: 'modalPetrolerasCtrl',
171 size: 'lg' 167 size: 'lg'
172 } 168 }
173 ); 169 );
174 modalInstance.result.then( 170 modalInstance.result.then(
175 function(petrolera) { 171 function(petrolera) {
176 $scope.notaPedido.petrolera = petrolera.NOM; 172 $scope.notaPedido.petrolera = petrolera.NOM;
177 }, function() { 173 }, function() {
178 174
179 } 175 }
180 ); 176 );
181 }; 177 };
182 $scope.seleccionarCliente = function() { 178 $scope.seleccionarCliente = function() {
183 var modalInstance = $uibModal.open( 179 var modalInstance = $uibModal.open(
184 { 180 {
185 ariaLabelledBy: 'Busqueda de Cliente', 181 ariaLabelledBy: 'Busqueda de Cliente',
186 templateUrl: 'foca-busqueda-cliente-modal.html', 182 templateUrl: 'foca-busqueda-cliente-modal.html',
187 controller: 'focaBusquedaClienteModalController', 183 controller: 'focaBusquedaClienteModalController',
188 size: 'lg' 184 size: 'lg'
189 } 185 }
190 ); 186 );
191 modalInstance.result.then( 187 modalInstance.result.then(
192 function(cliente) { 188 function(cliente) {
189 $scope.limpiarPantalla();
193 $scope.notaPedido.cliente.nombre = cliente.nom; 190 $scope.notaPedido.cliente.nombre = cliente.nom;
191 $scope.notaPedido.cliente.id = cliente.cod;
192 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then(
193 function(data) {
194 if(data.data.length === 0){
195 focaModalService
196 .alert('El cliente no tienen domicilios de entrega')
197 .then(
198 function() {
199 $scope.seleccionarCliente();
200 $scope.notaPedido.cliente = {nombre: ''};
201 }
202 );
203 return;
204 }
205 $scope.domiciliosCliente = data.data;
206 }
207 );
194 }, function() { 208 }, function() {
195 209
196 } 210 }
197 ); 211 );
198 }; 212 };
199 $scope.mostrarFichaCliente = function() { 213 $scope.mostrarFichaCliente = function() {
200 $uibModal.open( 214 $uibModal.open(
201 { 215 {
202 ariaLabelledBy: 'Datos del Cliente', 216 ariaLabelledBy: 'Datos del Cliente',
203 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 217 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
204 controller: 'focaCrearNotaPedidoFichaClienteController', 218 controller: 'focaCrearNotaPedidoFichaClienteController',
205 size: 'lg' 219 size: 'lg'
206 } 220 }
207 ); 221 );
208 }; 222 };
209 $scope.obtenerDomicilios = function(id) {
210 crearNotaPedidoService.getDomicilios(id).then(
211 function(res) {
212 $scope.notaPedido.domicilio = res.data;
213 }
214 );
215 };
216 $scope.getTotal = function() { 223 $scope.getTotal = function() {
217 var total = 0; 224 var total = 0;
218 var array = $scope.articulosTabla; 225 var arrayTempArticulos = $scope.articulosTabla;
219 for (var i = 0; i < array.length; i++) { 226 for (var i = 0; i < arrayTempArticulos.length; i++) {
220 total += array[i].precio * array[i].cantidad; 227 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
221 } 228 }
222 return total.toFixed(2); 229 return total.toFixed(2);
223 }; 230 };
224 $scope.getSubTotal = function() { 231 $scope.getSubTotal = function() {
225 if($scope.articuloACargar) { 232 if($scope.articuloACargar) {
226 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 233 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
227 } 234 }
228 }; 235 };
229 $scope.cargarArticulos = function() {
230 idLista = $scope.notaPedido.precioCondicion;
231 $scope.articulosTabla = [];
232 };
233 $scope.abrirModalListaPrecio = function() { 236 $scope.abrirModalListaPrecio = function() {
234 var modalInstance = $uibModal.open( 237 var modalInstance = $uibModal.open(
235 { 238 {
236 ariaLabelledBy: 'Busqueda de Precio Condición', 239 ariaLabelledBy: 'Busqueda de Precio Condición',
237 templateUrl: 'modal-precio-condicion.html', 240 templateUrl: 'modal-precio-condicion.html',
238 controller: 'focaModalPrecioCondicionController', 241 controller: 'focaModalPrecioCondicionController',
239 size: 'lg' 242 size: 'lg'
240 } 243 }
241 ); 244 );
242 modalInstance.result.then( 245 modalInstance.result.then(
243 function(precioCondicion) { 246 function(precioCondicion) {
244 $scope.notaPedido.precioCondicion = precioCondicion.nombre; 247 $scope.notaPedido.precioCondicion = precioCondicion.nombre;
245 idLista = precioCondicion.idListaPrecio; 248 idLista = precioCondicion.idListaPrecio;
246 $scope.articulosTabla = []; 249 $scope.articulosTabla = [];
247 }, function() { 250 }, function() {
248 251
249 } 252 }
250 ); 253 );
251 }; 254 };
252 $scope.abrirModalFlete = function() { 255 $scope.abrirModalFlete = function() {
253 if($scope.notaPedido.flete === '1') { 256 if($scope.notaPedido.flete === '1') {
254 var modalInstance = $uibModal.open( 257 var modalInstance = $uibModal.open(
255 { 258 {
256 ariaLabelledBy: 'Busqueda de Flete', 259 ariaLabelledBy: 'Busqueda de Flete',
257 templateUrl: 'modal-flete.html', 260 templateUrl: 'modal-flete.html',
258 controller: 'focaModalFleteController', 261 controller: 'focaModalFleteController',
259 size: 'lg' 262 size: 'lg'
260 } 263 }
261 ); 264 );
262 modalInstance.result.then( 265 modalInstance.result.then(
263 function(flete) { 266 function(flete) {
264 $scope.choferes = ''; 267 $scope.limpiarFlete();
265 $scope.vehiculos = '';
266 $scope.notaPedido.chofer = '';
267 $scope.notaPedido.vehiculo = '';
268 $scope.notaPedido.costoUnitarioKmFlete = '';
269 $scope.notaPedido.fleteNombre = flete.nombre; 268 $scope.notaPedido.fleteNombre = flete.nombre;
270 $scope.notaPedido.fleteId = flete.id; 269 $scope.notaPedido.fleteId = flete.id;
271 $scope.choferes = flete.chofer; 270 $scope.choferes = flete.chofer;
272 $scope.vehiculos = flete.vehiculo; 271 $scope.vehiculos = flete.vehiculo;
273 }, function() { 272 }, function() {
274 273
275 } 274 }
276 ); 275 );
277 } 276 }
278 }; 277 };
279 $scope.agregarATabla = function(key) { 278 $scope.agregarATabla = function(key) {
280 if(key === 13) { 279 if(key === 13) {
281 if($scope.articuloACargar.cantidad === undefined || 280 if($scope.articuloACargar.cantidad === undefined ||
282 $scope.articuloACargar.cantidad === 0 || 281 $scope.articuloACargar.cantidad === 0 ||
283 $scope.articuloACargar.cantidad === null ){ 282 $scope.articuloACargar.cantidad === null ){
284 focaModalService.alert('El valor debe ser al menos 1'); 283 focaModalService.alert('El valor debe ser al menos 1');
285 return; 284 return;
286 } 285 }
287 $scope.articulosTabla.unshift($scope.articuloACargar); 286 $scope.articulosTabla.unshift($scope.articuloACargar);
288 $scope.cargando = true; 287 $scope.cargando = true;
289 } 288 }
290 }; 289 };
291 $scope.quitarArticulo = function(key) { 290 $scope.quitarArticulo = function(key) {
292 $scope.articulosTabla.splice(key, 1); 291 $scope.articulosTabla.splice(key, 1);
293 }; 292 };
294 $scope.editarArticulo = function(key, articulo) { 293 $scope.editarArticulo = function(key, articulo) {
295 if(key === 13) { 294 if(key === 13) {
296 if(articulo.cantidad === null || articulo.cantidad === 0 || 295 if(articulo.cantidad === null || articulo.cantidad === 0 ||
297 articulo.cantidad === undefined){ 296 articulo.cantidad === undefined){
298 focaModalService.alert('El valor debe ser al menos 1'); 297 focaModalService.alert('El valor debe ser al menos 1');
299 return; 298 return;
300 } 299 }
301 articulo.edit = false; 300 articulo.edit = false;
302 } 301 }
303 }; 302 };
304 $scope.cambioEdit = function(articulo) { 303 $scope.cambioEdit = function(articulo) {
305 articulo.edit = true; 304 articulo.edit = true;
306 }; 305 };
307 $scope.limpiarFlete = function() { 306 $scope.limpiarFlete = function() {
308 $scope.notaPedido.fleteNombre = ''; 307 $scope.notaPedido.fleteNombre = '';
309 $scope.notaPedido.chofer = ''; 308 $scope.notaPedido.chofer = '';
310 $scope.notaPedido.vehiculo = ''; 309 $scope.notaPedido.vehiculo = '';
311 $scope.notaPedido.kilometros = ''; 310 $scope.notaPedido.kilometros = '';
312 $scope.notaPedido.costoUnitarioKmFlete = ''; 311 $scope.notaPedido.costoUnitarioKmFlete = '';
312 $scope.choferes = '';
313 $scope.vehiculos = '';
313 }; 314 };
314 $scope.crearPedidoDemo = function() { 315 $scope.limpiarPantalla = function() {
315 focaModalService.alert('Pedido Creado'); 316 $scope.limpiarFlete();
317 $scope.notaPedido.flete = '0';
318 $scope.notaPedido.bomba = '0';
316 $scope.notaPedido.precioCondicion = ''; 319 $scope.notaPedido.precioCondicion = '';
317 $scope.articulosTabla = []; 320 $scope.articulosTabla = [];
318 $scope.notaPedido.fleteNombre = '';
319 $scope.notaPedido.chofer = '';
320 $scope.notaPedido.vehiculo = '';
321 $scope.notaPedido.kilometros = '';
322 $scope.notaPedido.costoUnitarioKmFlete = '';
323 $scope.notaPedido.vendedor.nombre = ''; 321 $scope.notaPedido.vendedor.nombre = '';
324 $scope.notaPedido.cliente.nombre = ''; 322 $scope.notaPedido.cliente = {nombre: ''};
325 $scope.domicilio.dom = ''; 323 $scope.notaPedido.domicilio = {dom: ''};
326 $scope.notaPedido.flete = 0; 324 $scope.domiciliosCliente = [];
327 }; 325 };
328 $scope.resetFilter = function() { 326 $scope.resetFilter = function() {
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearNotaPedido: function(notaPedido) { 5 crearNotaPedido: function(notaPedido) {
6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); 6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
7 }, 7 },
8 obtenerNotaPedido: function() { 8 obtenerNotaPedido: function() {
9 return $http.get(route +'/nota-pedido'); 9 return $http.get(route +'/nota-pedido');
10 }, 10 },
11 setNotaPedido: function(notaPedido) { 11 setNotaPedido: function(notaPedido) {
12 this.notaPedido = notaPedido; 12 this.notaPedido = notaPedido;
13 }, 13 },
14 clearNotaPedido: function() { 14 clearNotaPedido: function() {
15 this.notaPedido = undefined; 15 this.notaPedido = undefined;
16 }, 16 },
17 getNotaPedido: function() { 17 getNotaPedido: function() {
18 return this.notaPedido; 18 return this.notaPedido;
19 }, 19 },
20 getArticulosByIdNotaPedido: function(id) { 20 getArticulosByIdNotaPedido: function(id) {
21 return $http.get(route+'/articulos/nota-pedido/'+id); 21 return $http.get(route+'/articulos/nota-pedido/'+id);
22 }, 22 },
23 crearArticulosParaNotaPedido: function(articuloNotaPedido) { 23 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
24 return $http.post(route + '/articulos/nota-pedido', 24 return $http.post(route + '/articulos/nota-pedido',
25 {articuloNotaPedido: articuloNotaPedido}); 25 {articuloNotaPedido: articuloNotaPedido});
26 }, 26 },
27 getDomiciliosByIdNotaPedido: function(id) { 27 getDomiciliosByIdNotaPedido: function(id) {
28 return $http.get(route +'/nota-pedido/'+id+'/domicilios'); 28 return $http.get(route +'/nota-pedido/'+id+'/domicilios');
29 }, 29 },
30 //EN DESARROLLO 30 getDomiciliosByIdCliente: function(id) {
31 getDomicilios: function(id) { 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 // return $http.get(route + '/'+id) 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 id='le asigno un valor para pasar pre commit';
34 var domicilio = [
35 {
36 id: 1,
37 dom: 'RISSO PATRON 781'
38 },
39 {
40 id: 2,
41 dom: 'MARIANO MORENO 533'
42 },
43 {
44 id: 3,
45 dom: 'SALTA 796'
46 }
47 ];
48 return domicilio;
49 }, 33 },
50 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
51 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
52 }, 36 },
53 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
54 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
55 }, 39 },
56 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
57 return $http.get(route + '/plazo-pago/precio-condicion/'+ id); 41 return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
58 }, 42 },
59 crearFlete: function(flete) { 43 crearFlete: function(flete) {
60 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
61 } 45 }
62 }; 46 };
63 }]); 47 }]);
64 48
src/views/nota-pedido.html
1 <div class="row"> 1 <form name="formCrearNota" ng-submit="crearNotaPedido()">
2 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 2 <div class="row">
3 <div class="row bg-secondary p-3"> 3 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
4 <div class="form-group col-12 col-sm-6 col-md-4"> 4 <div class="row bg-secondary p-3">
5 <div class="input-group"> 5 <div class="form-group col-12 col-sm-6 col-md-4">
6 <div class="input-group">
7 <input
8 type="text"
9 class="form-control"
10 uib-datepicker-popup="dd/MM/yyyy"
11 ng-model="notaPedido.fechaCarga"
12 is-open="popup1.opened"
13 datepicker-options="dateOptions"
14 close-text="Cerrar"
15 current-text="Hoy"
16 clear-text="Borrar"
17 alt-input-formats="altInputFormats"
18 ng-required="true"
19 />
20 <span class="input-group-append">
21 <button type="button" class="btn btn-default" ng-click="popup1.opened = true">
22 <i class="fa fa-calendar"></i>
23 </button>
24 </span>
25 </div>
26 </div>
27 <div class="form-group col-12 col-sm-6 col-md-4">
28 <div class="input-group">
29 <input
30 class="form-control selectable"
31 type="text"
32 ng-model="notaPedido.cliente.nombre"
33 placeholder="Seleccione Cliente"
34 readonly="true"
35 ng-click="seleccionarCliente()"
36 ng-required="true"
37 >
38 <span class="input-group-append">
39 <button type="button" class="btn btn-default" ng-click="seleccionarCliente()">
40 <i class="fa fa-search"></i>
41 </button>
42 </span>
43 </div>
44 </div>
45 <div class="form-group col-12 col-sm-6 col-md-4">
46 <div class="input-group">
47 <input
48 class="form-control"
49 type="text"
50 ng-model="notaPedido.vendedor.nombre"
51 placeholder="Seleccione Vendedor"
52 readonly="true"
53 >
54 <span class="input-group-append">
55 <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()">
56 <i class="fa fa-search"></i>
57 </button>
58 </span>
59 </div>
60 </div>
61 <div class="form-group col-12 col-sm-6 col-md-4">
6 <input 62 <input
63 class="form-control selectable"
7 type="text" 64 type="text"
8 class="form-control" 65 ng-model="notaPedido.domicilio"
9 uib-datepicker-popup="dd/MM/yyyy" 66 placeholder="Seleccione Domicilio"
10 ng-model="notaPedido.fechaCarga" 67 typeahead-min-length="0"
11 is-open="popup1.opened" 68 uib-typeahead="domi as domi.dom for domi in domiciliosCliente"
12 datepicker-options="dateOptions" 69 >
13 close-text="Cerrar"
14 current-text="Hoy"
15 clear-text="Borrar"
16 alt-input-formats="altInputFormats"
17 />
18 <span class="input-group-append">
19 <button type="button" class="btn btn-default" ng-click="popup1.opened = true">
20 <i class="fa fa-calendar"></i>
21 </button>
22 </span>
23 </div> 70 </div>
24 </div> 71 <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">
27 <input 72 <input
28 class="form-control" 73 class="form-control selectable"
29 type="text" 74 type="text"
30 ng-model="notaPedido.vendedor.nombre"
31 placeholder="Seleccione Vendedor"
32 readonly="true" 75 readonly="true"
76 ng-model="notaPedido.precioCondicion"
77 ng-click="abrirModalListaPrecio()"
78 placeholder="Seleccione Lista de precio"
33 > 79 >
34 <span class="input-group-append">
35 <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()">
36 <i class="fa fa-search"></i>
37 </button>
38 </span>
39 </div> 80 </div>
40 </div> 81 <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"> 82 <label>Bomba</label>
42 <div class="input-group"> 83 <div class="form-check custom-radio custom-control-inline">
43 <input 84 <input
85 class="form-check-input"
86 type="radio"
87 name="radioBomba"
88 value="1"
89 ng-model="notaPedido.bomba">
90 <label class="form-check-label">Si</label>
91 </div>
92 <div class="form-check custom-radio custom-control-inline">
93 <input
94 class="form-check-input"
95 type="radio"
96 name="radioBomba"
97 value="0"
98 ng-model="notaPedido.bomba">
99 <label class="form-check-label">No</label>
100 </div>
101 </div>
102 <div class="form-group col-12 col-sm-6 col-md-4">
103 <label>Flete</label>
104 <div class="form-check custom-radio custom-control-inline">
105 <input
106 ng-change="limpiarFlete()"
107 class="form-check-input"
108 type="radio"
109 name="radioFlete"
110 value="1"
111 ng-model="notaPedido.flete">
112 <label class="form-check-label">Si</label>
113 </div>
114 <div class="form-check custom-radio custom-control-inline">
115 <input
116 class="form-check-input"
117 type="radio"
118 name="radioFlete"
119 value="0"
120 ng-model="notaPedido.flete">
121 <label class="form-check-label">No</label>
122 </div>
123 </div>
124 <div class="form-group col-12 col-sm-6 col-md-4">
125 <input
44 class="form-control selectable" 126 class="form-control selectable"
45 type="text" 127 type="text"
46 ng-model="notaPedido.cliente.nombre"
47 placeholder="Seleccione Cliente"
48 readonly="true" 128 readonly="true"
49 ng-click="seleccionarCliente()" 129 ng-show="notaPedido.flete == 1"
130 ng-model="notaPedido.fleteNombre"
131 ng-click="abrirModalFlete()"
132 placeholder="Seleccione Flete"
50 > 133 >
51 <span class="input-group-append">
52 <button type="button" class="btn btn-default" ng-click="seleccionarCliente()">
53 <i class="fa fa-search"></i>
54 </button>
55 </span>
56 </div> 134 </div>
57 </div> 135 <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
60 class="form-control selectable"
61 type="text"
62 ng-model="domicilio"
63 placeholder="Seleccione Domicilio"
64 typeahead-min-length="0"
65 uib-typeahead="domi as domi.dom for domi in domiciliosCliente"
66 >
67 </div>
68 <div class="form-group col-12 col-sm-6 col-md-4">
69 <input
70 class="form-control selectable"
71 type="text"
72 readonly="true"
73 ng-model="notaPedido.precioCondicion"
74 ng-click="abrirModalListaPrecio()"
75 placeholder="Seleccione Lista de precio"
76 >
77 </div>
78 <div class="form-group col-12 col-sm-6 col-md-4">
79 <label>Bomba</label>
80 <div class="form-check custom-radio custom-control-inline">
81 <input
82 class="form-check-input"
83 type="radio"
84 name="radioBomba"
85 value="1"
86 ng-model="notaPedido.bomba">
87 <label class="form-check-label">Si</label>
88 </div>
89 <div class="form-check custom-radio custom-control-inline">
90 <input 136 <input
91 class="form-check-input" 137 class="form-control selectable"
92 type="radio" 138 type="text"
93 name="radioBomba" 139 ng-show="notaPedido.flete == 1"
94 value="0" 140 ng-model="notaPedido.chofer"
95 ng-model="notaPedido.bomba"> 141 placeholder="Seleccione Chofer"
96 <label class="form-check-label">No</label> 142 uib-typeahead="chofer as chofer.nombre for chofer in choferes"
143 typeahead-min-length="0"
144 >
97 </div> 145 </div>
98 </div> 146 <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 <label>Flete</label>
101 <div class="form-check custom-radio custom-control-inline">
102 <input 147 <input
103 ng-change="limpiarFlete()" 148 class="form-control selectable"
104 class="form-check-input" 149 type="text"
105 type="radio" 150 ng-show="notaPedido.flete == 1"
106 name="radioFlete" 151 ng-model="notaPedido.vehiculo"
107 value="1" 152 placeholder="Seleccione Vehículo"
108 ng-model="notaPedido.flete"> 153 uib-typeahead="vehiculo as vehiculo.tractor for vehiculo in vehiculos"
109 <label class="form-check-label">Si</label> 154 typeahead-min-length="0"
110 </div> 155 >
111 <div class="form-check custom-radio custom-control-inline"> 156 </div>
112 <input 157 <div class="form-group col-12 col-sm-6 col-md-4">
113 class="form-check-input" 158 <input
114 type="radio" 159 class="form-control selectable"
115 name="radioFlete" 160 type="number"
116 value="0" 161 step="0.01"
117 ng-model="notaPedido.flete"> 162 ng-show="notaPedido.flete == 1"
118 <label class="form-check-label">No</label> 163 ng-model="notaPedido.costoUnitarioKmFlete"
164 placeholder="Costo por kilómetro"
165 >
166 </div>
167 <div class="form-group col-12 col-sm-6 col-md-4">
168 <input
169 class="form-control selectable"
170 type="number"
171 step="0.1"
172 ng-show="notaPedido.flete == 1"
173 ng-model="notaPedido.kilometros"
174 placeholder="Kilómetros recorridos"
175 >
119 </div> 176 </div>
120 </div>
121 <div class="form-group col-12 col-sm-6 col-md-4">
122 <input
123 class="form-control selectable"
124 type="text"
125 readonly="true"
126 ng-show="notaPedido.flete == 1"
127 ng-model="notaPedido.fleteNombre"
128 ng-click="abrirModalFlete()"
129 placeholder="Seleccione Flete"
130 >
131 </div>
132 <div class="form-group col-12 col-sm-6 col-md-4">
133 <input
134 class="form-control selectable"
135 type="text"
136 ng-show="notaPedido.flete == 1"
137 ng-model="notaPedido.chofer"
138 placeholder="Seleccione Chofer"
139 uib-typeahead="chofer as chofer.nombre for chofer in choferes"
140 typeahead-min-length="0"
141 >
142 </div>
143 <div class="form-group col-12 col-sm-6 col-md-4">
144 <input
145 class="form-control selectable"
146 type="text"
147 ng-show="notaPedido.flete == 1"
148 ng-model="notaPedido.vehiculo"
149 placeholder="Seleccione Vehículo"
150 uib-typeahead="vehiculo as vehiculo.tractor for vehiculo in vehiculos"
151 typeahead-min-length="0"
152 >
153 </div>
154 <div class="form-group col-12 col-sm-6 col-md-4">
155 <input
156 class="form-control selectable"
157 type="number"
158 step="0.01"
159 ng-show="notaPedido.flete == 1"
160 ng-model="notaPedido.costoUnitarioKmFlete"
161 placeholder="Costo por kilómetro"
162 >
163 </div>
164 <div class="form-group col-12 col-sm-6 col-md-4">
165 <input
166 class="form-control selectable"
167 type="number"
168 step="0.1"
169 ng-show="notaPedido.flete == 1"
170 ng-model="notaPedido.kilometros"
171 placeholder="Kilómetros recorridos"
172 >
173 </div> 177 </div>
174 </div> 178 </div>
179 <div class="col-auto my-2">
180 <button
181 ng-click="crearNotaPedido()"
182 type="submit"
183 title="Crear nota pedido"
184 class="btn btn-primary float-right">
185 Guardar
186 </button>
187 </div>
175 </div> 188 </div>
176 <div class="col-auto my-2"> 189 </form>
177 <button
178 ng-click="crearNotaPedido()"
179 type="button"
180 title="Crear nota pedido"
181 class="btn btn-primary float-right">
182 Guardar
183 </button>
184 </div>
185 </div>
186 <div class="row"> 190 <div class="row">
187 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 191 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
188 <div class="row"> 192 <div class="row">
189 </div> 193 </div>
190 <div class="row"> 194 <div class="row">
191 <table class="table table-striped table-sm"> 195 <table class="table table-striped table-sm">
192 <thead> 196 <thead>
193 <tr> 197 <tr>
194 <th>Sector</th> 198 <th>Sector</th>
195 <th>Código</th> 199 <th>Código</th>
196 <th>Descripción</th> 200 <th>Descripción</th>
197 <th>Precio Unitario</th> 201 <th>Precio Unitario</th>
198 <th>Cantidad</th> 202 <th>Cantidad</th>
199 <th>SubTotal</th> 203 <th>SubTotal</th>
200 <th> 204 <th>
201 <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > 205 <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" >
202 <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> 206 <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i>
203 <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> 207 <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i>
204 </button> 208 </button>
205 </th> 209 </th>
206 </tr> 210 </tr>
207 </thead> 211 </thead>
208 <tbody> 212 <tbody>
209 <tr ng-show="cargando"> 213 <tr ng-show="cargando">
210 <td colspan="2"><input 214 <td colspan="2"><input
211 placeholder="Seleccione Articulo" 215 placeholder="Seleccione Articulo"
212 class="form-control" 216 class="form-control"
213 readonly 217 readonly
214 ng-click="seleccionarArticulo()"></td> 218 ng-click="seleccionarArticulo()"
219 foca-focus="cargando"></td>
215 <td></td> 220 <td></td>
216 <td></td> 221 <td></td>
217 <td></td> 222 <td></td>
218 <td></td> 223 <td></td>
219 <td></td> 224 <td></td>
220 </tr> 225 </tr>
221 <tr ng-show="!cargando"> 226 <tr ng-show="!cargando">
222 <td><input 227 <td><input
223 class="form-control" 228 class="form-control"
224 ng-model="articuloACargar.sector" 229 ng-model="articuloACargar.sector"
225 readonly></td> 230 readonly></td>
226 <td><input 231 <td><input
227 class="form-control" 232 class="form-control"
228 ng-model="articuloACargar.codigo" 233 ng-model="articuloACargar.codigo"
229 readonly></td> 234 readonly></td>
230 <td><input 235 <td><input
231 class="form-control" 236 class="form-control"
232 ng-model="articuloACargar.descripcion" 237 ng-model="articuloACargar.descripcion"
233 readonly></td> 238 readonly></td>
234 <td><input 239 <td><input
235 class="form-control" 240 class="form-control"
236 ng-value="articuloACargar.precio | currency:'$'" 241 ng-value="articuloACargar.precio | currency:'$'"
237 readonly></td> 242 readonly></td>
238 <td><input 243 <td><input
239 class="form-control" 244 class="form-control"
240 type="number" 245 type="number"
241 min="1" 246 min="1"
242 ng-model="articuloACargar.cantidad" 247 ng-model="articuloACargar.cantidad"
243 foca-focus="!cargando" 248 foca-focus="!cargando"
244 esc-key="resetFilter()" 249 esc-key="resetFilter()"
245 ng-keypress="agregarATabla($event.keyCode)"></td> 250 ng-keypress="agregarATabla($event.keyCode)"></td>
246 <td><input 251 <td><input
247 class="form-control" 252 class="form-control"
248 ng-value="getSubTotal() | currency:'$'" 253 ng-value="getSubTotal() | currency:'$'"
249 readonly></td> 254 readonly></td>
250 <td class="text-center"><button 255 <td class="text-center"><button
251 class="btn btn-outline-secondary btn-sm" 256 class="btn btn-outline-secondary btn-sm"
252 ng-click="agregarATabla(13)"> 257 ng-click="agregarATabla(13)">
253 <i class="fa fa-save"></i> 258 <i class="fa fa-save"></i>
254 </button></td> 259 </button></td>
255 </tr> 260 </tr>
256 <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> 261 <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0">
257 <td ng-bind="articulo.sector"></td> 262 <td ng-bind="articulo.sector"></td>
258 <td ng-bind="articulo.codigo"></td> 263 <td ng-bind="articulo.codigo"></td>
259 <td ng-bind="articulo.descripcion"></td> 264 <td ng-bind="articulo.descripcion"></td>
260 <td ng-bind="articulo.precio | currency:'$'"></td> 265 <td ng-bind="articulo.precio | currency:'$'"></td>
261 <td><input 266 <td><input
262 ng-show="articulo.edit" 267 ng-show="articulo.edit"
263 ng-model="articulo.cantidad" 268 ng-model="articulo.cantidad"
264 class="form-control" 269 class="form-control"
265 type="number" 270 type="number"
266 min="1" 271 min="1"
267 foca-focus="articulo.edit" 272 foca-focus="articulo.edit"
268 ng-keypress="editarArticulo($event.keyCode, articulo)"> 273 ng-keypress="editarArticulo($event.keyCode, articulo)"
274 ng-focus="selectFocus($event)"
275 >
269 <i 276 <i
270 class="selectable" 277 class="selectable"
271 ng-click="cambioEdit(articulo)" 278 ng-click="cambioEdit(articulo)"
272 ng-hide="articulo.edit" 279 ng-hide="articulo.edit"
273 ng-bind="articulo.cantidad"> 280 ng-bind="articulo.cantidad">
274 </i> 281 </i>
275 </td> 282 </td>
276 <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td> 283 <td ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"></td>
277 <td class="text-center"> 284 <td class="text-center">
278 <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)"> 285 <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo(key)">
279 <i class="fa fa-trash"></i> 286 <i class="fa fa-trash"></i>
280 </button> 287 </button>
281 </td> 288 </td>
282 </tr> 289 </tr>
283 </tbody> 290 </tbody>
284 <tfoot> 291 <tfoot>
285 <tr class="table-secondary"> 292 <tr class="table-secondary">
286 <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> 293 <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td>
287 <td colspan="3">{{getTotal() | currency:'$'}}</td> 294 <td colspan="3">{{getTotal() | currency:'$'}}</td>
288 </tr> 295 </tr>
289 </tfoot> 296 </tfoot>
290 </table> 297 </table>
291 </div> 298 </div>
292 </div> 299 </div>
293 </div> 300 </div>
294 301
295 <!-- 302 <!--
296 <form name="formCrearNota"> 303 <form name="formCrearNota">
297 <uib-tabset active="active"> 304 <uib-tabset active="active">
298 <uib-tab index="0" heading="General"> 305 <uib-tab index="0" heading="General">
299 <input type="hidden" name="id" ng-model="notaPedido.id" /> 306 <input type="hidden" name="id" ng-model="notaPedido.id" />
300 <div> 307 <div>
301 <div class="col-auto my-2"> 308 <div class="col-auto my-2">
302 <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> 309 <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button>
303 </div> 310 </div>
304 </div> 311 </div>
305 <br> 312 <br>
306 <br> 313 <br>
307 <div class="row"> 314 <div class="row">
308 <div class="col-md-2"> 315 <div class="col-md-2">
309 <div class="col-auto"> 316 <div class="col-auto">
310 <label>Fecha de carga</label> 317 <label>Fecha de carga</label>
311 </div> 318 </div>
312 </div> 319 </div>
313 <div class="col-md-3"> 320 <div class="col-md-3">
314 <div class="col-auto"> 321 <div class="col-auto">
315 <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> 322 <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true">
316 </div> 323 </div>
317 </div> 324 </div>
318 <div class="col-md-2"> 325 <div class="col-md-2">
319 <div class="col-auto"> 326 <div class="col-auto">
320 <label>Kilómetros</label> 327 <label>Kilómetros</label>
321 </div> 328 </div>
322 </div> 329 </div>
323 <div class="col-md-3"> 330 <div class="col-md-3">
324 <div class="col-auto"> 331 <div class="col-auto">
325 <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" 332 <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente"
326 ng-model="notaPedido.kilometros" ng-required="true"> 333 ng-model="notaPedido.kilometros" ng-required="true">
327 </div> 334 </div>
328 </div> 335 </div>
329 </div> 336 </div>
330 <div class="row my-3"> 337 <div class="row my-3">
331 <div class="col-md-2"> 338 <div class="col-md-2">
332 <div class="col-auto"> 339 <div class="col-auto">
333 <label>Jurisdicción de IIBB</label> 340 <label>Jurisdicción de IIBB</label>
334 </div> 341 </div>
335 </div> 342 </div>
336 <div class="col-md-3"> 343 <div class="col-md-3">
337 <div class="col-auto"> 344 <div class="col-auto">
338 <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" 345 <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega"
339 ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> 346 ng-model="notaPedido.jurisdiccionIIBB" ng-required="true">
340 </div> 347 </div>
341 </div> 348 </div>
342 <div class="col-md-2"> 349 <div class="col-md-2">
343 <div class="col-auto"> 350 <div class="col-auto">
344 <label>Costo de financiación</label> 351 <label>Costo de financiación</label>
345 </div> 352 </div>
346 </div> 353 </div>
347 <div class="col-md-3"> 354 <div class="col-md-3">
348 <div class="col-auto"> 355 <div class="col-auto">
349 <div class="input-group mb-2"> 356 <div class="input-group mb-2">
350 <div class="input-group-prepend"> 357 <div class="input-group-prepend">
351 <div class="input-group-text">$</div> 358 <div class="input-group-text">$</div>
352 </div> 359 </div>
353 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" 360 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación"
354 ng-model="notaPedido.costoFinanciacion"> 361 ng-model="notaPedido.costoFinanciacion">
355 </div> 362 </div>
356 </div> 363 </div>
357 </div> 364 </div>
358 </div> 365 </div>
359 <div class="row"> 366 <div class="row">
360 <div class="col-md-2"> 367 <div class="col-md-2">
361 <div class="col-auto"> 368 <div class="col-auto">
362 <label>Bomba</label> 369 <label>Bomba</label>
363 </div> 370 </div>
364 </div> 371 </div>
365 <div class="col-md-1"> 372 <div class="col-md-1">
366 <div class="col-auto"> 373 <div class="col-auto">
367 <div class="form-check custom-radio custom-control-inline"> 374 <div class="form-check custom-radio custom-control-inline">
368 <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> 375 <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba">
369 <label class="form-check-label"> 376 <label class="form-check-label">
370 Si 377 Si
371 </label> 378 </label>
372 </div> 379 </div>
373 <div class="form-check custom-radio custom-control-inline"> 380 <div class="form-check custom-radio custom-control-inline">
374 <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> 381 <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba">
375 <label class="form-check-label"> 382 <label class="form-check-label">
376 No 383 No
377 </label> 384 </label>
378 </div> 385 </div>
379 </div> 386 </div>
380 </div> 387 </div>
381 <div class="col-md-1"> 388 <div class="col-md-1">
382 <div class="col-auto"> 389 <div class="col-auto">
383 <label>Flete</label> 390 <label>Flete</label>
384 </div> 391 </div>
385 </div> 392 </div>
386 <div class="col-md-1"> 393 <div class="col-md-1">
387 <div class="col-auto"> 394 <div class="col-auto">
388 <div class="form-check custom-radio custom-control-inline"> 395 <div class="form-check custom-radio custom-control-inline">
389 <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> 396 <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete">
390 <label class="form-check-label"> 397 <label class="form-check-label">
391 Si 398 Si
392 </label> 399 </label>
393 </div> 400 </div>
394 <div class="form-check custom-radio custom-control-inline"> 401 <div class="form-check custom-radio custom-control-inline">
395 <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> 402 <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete">
396 <label class="form-check-label"> 403 <label class="form-check-label">
397 FOB 404 FOB
398 </label> 405 </label>
399 </div> 406 </div>
400 </div> 407 </div>
401 </div> 408 </div>
402 <div class="col-md-2"> 409 <div class="col-md-2">
403 <div class="col-auto"> 410 <div class="col-auto">
404 <label>Costo unitario kilometro flete</label> 411 <label>Costo unitario kilometro flete</label>
405 </div> 412 </div>
406 </div> 413 </div>
407 <div class="col-md-3"> 414 <div class="col-md-3">
408 <div class="col-auto"> 415 <div class="col-auto">
409 <div class="input-group mb-2"> 416 <div class="input-group mb-2">
410 <div class="input-group-prepend"> 417 <div class="input-group-prepend">
411 <div class="input-group-text">$</div> 418 <div class="input-group-text">$</div>
412 </div> 419 </div>
413 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" 420 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete"
414 ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> 421 ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true">
415 </div> 422 </div>
416 </div> 423 </div>
417 </div> 424 </div>