Commit e335c6d95f3289a25edb8911d5b4706e8a069fe5
1 parent
2df859a534
Exists in
master
agrego foca-cabecera-facturador
Showing
2 changed files
with
31 additions
and
87 deletions
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearHojaRutaService', 'focaModalService', |
| 4 | function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { | 4 | function($scope, $uibModal, $location, $filter, crearHojaRutaService, focaModalService) { |
| 5 | 5 | ||
| 6 | $scope.botonera = crearHojaRutaService.getBotonera(); | 6 | $scope.botonera = crearHojaRutaService.getBotonera(); |
| 7 | $scope.datepickerAbierto = false; | 7 | $scope.datepickerAbierto = false; |
| 8 | 8 | ||
| 9 | $scope.show = false; | 9 | $scope.show = false; |
| 10 | $scope.cargando = true; | 10 | $scope.cargando = true; |
| 11 | $scope.dateOptions = { | 11 | $scope.dateOptions = { |
| 12 | maxDate: new Date(), | 12 | maxDate: new Date(), |
| 13 | minDate: new Date(2010, 0, 1) | 13 | minDate: new Date(2010, 0, 1) |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | $scope.hojaRuta = { | 16 | $scope.hojaRuta = { |
| 17 | fecha: new Date(), | 17 | fecha: new Date(), |
| 18 | litros: 0, | 18 | litros: 0, |
| 19 | chofer: {}, | 19 | chofer: {}, |
| 20 | vehiculo: { | 20 | vehiculo: { |
| 21 | capacidad: 0 | 21 | capacidad: 0 |
| 22 | }, | 22 | }, |
| 23 | transportista: {}, | 23 | transportista: {}, |
| 24 | tarifario: { | 24 | tarifario: { |
| 25 | costo: null | 25 | costo: null |
| 26 | } | 26 | } |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | $scope.cabecera = []; | ||
| 30 | $scope.showCabecera = true; | 29 | $scope.showCabecera = true; |
| 31 | 30 | ||
| 32 | $scope.now = new Date(); | 31 | $scope.now = new Date(); |
| 33 | $scope.puntoVenta = '0000'; | 32 | $scope.puntoVenta = '0000'; |
| 34 | $scope.comprobante = '00000000'; | 33 | $scope.comprobante = '00000000'; |
| 35 | $scope.remitosTabla = []; | 34 | $scope.remitosTabla = []; |
| 36 | $scope.idLista = undefined; | 35 | $scope.idLista = undefined; |
| 37 | //La pantalla solo se usa para cargar pedidos | 36 | //La pantalla solo se usa para cargar pedidos |
| 38 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); | 37 | //var hojaRutaTemp = crearHojaRutaService.getHojaRuta(); |
| 39 | 38 | ||
| 40 | crearHojaRutaService.getNumeroHojaRuta().then( | 39 | crearHojaRutaService.getNumeroHojaRuta().then( |
| 41 | function(res) { | 40 | function(res) { |
| 42 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); | 41 | $scope.puntoVenta = $scope.rellenar(res.data.sucursal, 4); |
| 43 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 42 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
| 44 | }, | 43 | }, |
| 45 | function(err) { | 44 | function(err) { |
| 46 | focaModalService.alert('La terminal no esta configurada correctamente'); | 45 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 47 | console.info(err); | 46 | console.info(err); |
| 48 | } | 47 | } |
| 49 | ); | 48 | ); |
| 50 | //La pantalla solo se usa para cargar pedidos | 49 | //La pantalla solo se usa para cargar pedidos |
| 51 | // if (hojaRutaTemp !== undefined) { | 50 | // if (hojaRutaTemp !== undefined) { |
| 52 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); | 51 | // hojaRutaTemp.fechaCarga = new Date(hojaRutaTemp.fechaCarga); |
| 53 | // $scope.hojaRuta = hojaRutaTemp; | 52 | // $scope.hojaRuta = hojaRutaTemp; |
| 54 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); | 53 | // $scope.hojaRuta.flete = ($scope.hojaRuta.flete).toString(); |
| 55 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); | 54 | // $scope.hojaRuta.bomba = ($scope.hojaRuta.bomba).toString(); |
| 56 | // $scope.idLista = $scope.hojaRuta.precioCondicion; | 55 | // $scope.idLista = $scope.hojaRuta.precioCondicion; |
| 57 | // crearHojaRutaService | 56 | // crearHojaRutaService |
| 58 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( | 57 | // .getArticulosByIdHojaRuta($scope.hojaRuta.id).then( |
| 59 | // function(res) { | 58 | // function(res) { |
| 60 | // $scope.remitosTabla = res.data; | 59 | // $scope.remitosTabla = res.data; |
| 61 | // } | 60 | // } |
| 62 | // ); | 61 | // ); |
| 63 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
| 64 | //(NO REQUERIDO EN ESTA VERSION) | 63 | //(NO REQUERIDO EN ESTA VERSION) |
| 65 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( | 64 | // crearHojaRutaService.getDomiciliosByIdHojaRuta($scope.hojaRuta.id).then( |
| 66 | // function(res) { | 65 | // function(res) { |
| 67 | // $scope.hojaRuta.domicilio = res.data; | 66 | // $scope.hojaRuta.domicilio = res.data; |
| 68 | // } | 67 | // } |
| 69 | // ); | 68 | // ); |
| 70 | // } else { | 69 | // } else { |
| 71 | // $scope.hojaRuta.fechaCarga = new Date(); | 70 | // $scope.hojaRuta.fechaCarga = new Date(); |
| 72 | // $scope.hojaRuta.bomba = '0'; | 71 | // $scope.hojaRuta.bomba = '0'; |
| 73 | // $scope.hojaRuta.flete = '0'; | 72 | // $scope.hojaRuta.flete = '0'; |
| 74 | // $scope.idLista = undefined; | 73 | // $scope.idLista = undefined; |
| 75 | // } | 74 | // } |
| 76 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 77 | // $scope.addNewDom = function() { | 76 | // $scope.addNewDom = function() { |
| 78 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); | 77 | // $scope.hojaRuta.domicilio.push({ 'id': 0 }); |
| 79 | // }; | 78 | // }; |
| 80 | // $scope.removeNewChoice = function(choice) { | 79 | // $scope.removeNewChoice = function(choice) { |
| 81 | // if ($scope.hojaRuta.domicilio.length > 1) { | 80 | // if ($scope.hojaRuta.domicilio.length > 1) { |
| 82 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( | 81 | // $scope.hojaRuta.domicilio.splice($scope.hojaRuta.domicilio.findIndex( |
| 83 | // function(c) { | 82 | // function(c) { |
| 84 | // return c.$$hashKey === choice.$$hashKey; | 83 | // return c.$$hashKey === choice.$$hashKey; |
| 85 | // } | 84 | // } |
| 86 | // ), 1); | 85 | // ), 1); |
| 87 | // } | 86 | // } |
| 88 | // }; | 87 | // }; |
| 89 | 88 | ||
| 90 | $scope.crearHojaRuta = function() { | 89 | $scope.crearHojaRuta = function() { |
| 91 | if($scope.hojaRuta.litros <= 0) { | 90 | if($scope.hojaRuta.litros <= 0) { |
| 92 | focaModalService.alert('Ingrese Remitos'); | 91 | focaModalService.alert('Ingrese Remitos'); |
| 93 | return; | 92 | return; |
| 94 | } | 93 | } |
| 95 | 94 | ||
| 96 | if(!$scope.hojaRuta.chofer.id) { | 95 | if(!$scope.hojaRuta.chofer.id) { |
| 97 | focaModalService.alert('Ingrese Chofer'); | 96 | focaModalService.alert('Ingrese Chofer'); |
| 98 | return; | 97 | return; |
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | if(!$scope.hojaRuta.vehiculo.id) { | 100 | if(!$scope.hojaRuta.vehiculo.id) { |
| 102 | focaModalService.alert('Ingrese Vehiculo'); | 101 | focaModalService.alert('Ingrese Vehiculo'); |
| 103 | return; | 102 | return; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | if(!$scope.hojaRuta.transportista.codigo) { | 105 | if(!$scope.hojaRuta.transportista.codigo) { |
| 107 | focaModalService.alert('Ingrese Transportista'); | 106 | focaModalService.alert('Ingrese Transportista'); |
| 108 | return; | 107 | return; |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { | 110 | if($scope.hojaRuta.vehiculo.capacidad < $scope.hojaRuta.litros) { |
| 112 | focaModalService.alert( | 111 | focaModalService.alert( |
| 113 | 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' | 112 | 'La capacidad del Vehiculo es menor a lo ingresado en Remitos' |
| 114 | ); | 113 | ); |
| 115 | return; | 114 | return; |
| 116 | } | 115 | } |
| 117 | 116 | ||
| 118 | if(!$scope.hojaRuta.tarifario.costo) { | 117 | if(!$scope.hojaRuta.tarifario.costo) { |
| 119 | focaModalService.alert('Ingrese Tarifario'); | 118 | focaModalService.alert('Ingrese Tarifario'); |
| 120 | return; | 119 | return; |
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | var date = new Date(); | 122 | var date = new Date(); |
| 124 | var save = { | 123 | var save = { |
| 125 | hojaRuta: { | 124 | hojaRuta: { |
| 126 | id: 0, | 125 | id: 0, |
| 127 | fechaCreacion: | 126 | fechaCreacion: |
| 128 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 127 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 129 | .toISOString().slice(0, 19) .replace('T', ' '), | 128 | .toISOString().slice(0, 19) .replace('T', ' '), |
| 130 | idTransportista: $scope.hojaRuta.transportista.codigo, | 129 | idTransportista: $scope.hojaRuta.transportista.codigo, |
| 131 | idChofer: $scope.hojaRuta.chofer.id, | 130 | idChofer: $scope.hojaRuta.chofer.id, |
| 132 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 131 | idVehiculo: $scope.hojaRuta.vehiculo.id, |
| 133 | tarifaFlete: $scope.hojaRuta.tarifario.costo | 132 | tarifaFlete: $scope.hojaRuta.tarifario.costo |
| 134 | }, | 133 | }, |
| 135 | remitos: $scope.remitosTabla | 134 | remitos: $scope.remitosTabla |
| 136 | }; | 135 | }; |
| 137 | 136 | ||
| 138 | crearHojaRutaService.crearHojaRuta(save).then( | 137 | crearHojaRutaService.crearHojaRuta(save).then( |
| 139 | function(data) { | 138 | function(data) { |
| 140 | focaModalService.alert( | 139 | focaModalService.alert( |
| 141 | 'Hoja ruta creada Nº: ' + | 140 | 'Hoja ruta creada Nº: ' + |
| 142 | $scope.rellenar(data.data.sucursal, 4) + | 141 | $scope.rellenar(data.data.sucursal, 4) + |
| 143 | '-' + | 142 | '-' + |
| 144 | $scope.rellenar(data.data.numeroHojaRuta, 8) | 143 | $scope.rellenar(data.data.numeroHojaRuta, 8) |
| 145 | ); | 144 | ); |
| 146 | $scope.hojaRuta = { | 145 | $scope.hojaRuta = { |
| 147 | fecha: new Date(), | 146 | fecha: new Date(), |
| 148 | litros: 0, | 147 | litros: 0, |
| 149 | chofer: {}, | 148 | chofer: {}, |
| 150 | vehiculo: { | 149 | vehiculo: { |
| 151 | capacidad: 0 | 150 | capacidad: 0 |
| 152 | }, | 151 | }, |
| 153 | transportista: {}, | 152 | transportista: {}, |
| 154 | tarifario: { | 153 | tarifario: { |
| 155 | costo: null | 154 | costo: null |
| 156 | } | 155 | } |
| 157 | }; | 156 | }; |
| 158 | 157 | ||
| 159 | $scope.remitosTabla = []; | 158 | $scope.remitosTabla = []; |
| 160 | $scope.cabecera = []; | 159 | $scope.$broadcast('cleanCabecera'); |
| 161 | 160 | ||
| 162 | crearHojaRutaService.getNumeroHojaRuta().then(function(res) { | 161 | crearHojaRutaService.getNumeroHojaRuta().then(function(res) { |
| 163 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); | 162 | $scope.comprobante = $scope.rellenar(res.data.numeroHojaRuta, 8); |
| 164 | }); | 163 | }); |
| 165 | }, | 164 | }, |
| 166 | function(error) { | 165 | function(error) { |
| 167 | focaModalService.alert('Hubo un error al crear la nota de pedido'); | 166 | focaModalService.alert('Hubo un error al crear la nota de pedido'); |
| 168 | console.info(error); | 167 | console.info(error); |
| 169 | } | 168 | } |
| 170 | ); | 169 | ); |
| 171 | }; | 170 | }; |
| 172 | 171 | ||
| 173 | $scope.seleccionarTransportista = function() { | 172 | $scope.seleccionarTransportista = function() { |
| 174 | var modalInstance = $uibModal.open( | 173 | var modalInstance = $uibModal.open( |
| 175 | { | 174 | { |
| 176 | ariaLabelledBy: 'Busqueda de Transportista', | 175 | ariaLabelledBy: 'Busqueda de Transportista', |
| 177 | templateUrl: 'modal-proveedor.html', | 176 | templateUrl: 'modal-proveedor.html', |
| 178 | controller: 'focaModalProveedorCtrl', | 177 | controller: 'focaModalProveedorCtrl', |
| 179 | size: 'lg', | 178 | size: 'lg', |
| 180 | resolve: { | 179 | resolve: { |
| 181 | transportista: function() { | 180 | transportista: function() { |
| 182 | return true; | 181 | return true; |
| 183 | } | 182 | } |
| 184 | } | 183 | } |
| 185 | } | 184 | } |
| 186 | ); | 185 | ); |
| 187 | modalInstance.result.then( | 186 | modalInstance.result.then( |
| 188 | function(proveedor) { | 187 | function(proveedor) { |
| 189 | console.info($scope.hojaRuta); | 188 | console.info($scope.hojaRuta); |
| 190 | $scope.hojaRuta.transportista.codigo = proveedor.COD; | 189 | $scope.hojaRuta.transportista.codigo = proveedor.COD; |
| 191 | addCabecera('Transportista:', proveedor.NOM); | 190 | $scope.$broadcast('addCabecera', { |
| 191 | label: 'Transportista:', | ||
| 192 | valor: proveedor.NOM | ||
| 193 | }); | ||
| 192 | }, function() { | 194 | }, function() { |
| 193 | 195 | ||
| 194 | } | 196 | } |
| 195 | ); | 197 | ); |
| 196 | }; | 198 | }; |
| 197 | 199 | ||
| 198 | $scope.seleccionarChofer = function() { | 200 | $scope.seleccionarChofer = function() { |
| 199 | var modalInstance = $uibModal.open( | 201 | var modalInstance = $uibModal.open( |
| 200 | { | 202 | { |
| 201 | ariaLabelledBy: 'Busqueda de Chofer', | 203 | ariaLabelledBy: 'Busqueda de Chofer', |
| 202 | templateUrl: 'modal-chofer.html', | 204 | templateUrl: 'modal-chofer.html', |
| 203 | controller: 'focaModalChoferController', | 205 | controller: 'focaModalChoferController', |
| 204 | size: 'lg' | 206 | size: 'lg' |
| 205 | } | 207 | } |
| 206 | ); | 208 | ); |
| 207 | 209 | ||
| 208 | modalInstance.result.then( | 210 | modalInstance.result.then( |
| 209 | function(chofer) { | 211 | function(chofer) { |
| 210 | $scope.hojaRuta.chofer = chofer; | 212 | $scope.hojaRuta.chofer = chofer; |
| 211 | addCabecera('Chofer: ', chofer.nombre); | 213 | $scope.$broadcast('addCabecera', { |
| 214 | label: 'Chofer:', | ||
| 215 | valor: chofer.nombre | ||
| 216 | }); | ||
| 212 | }, function() { | 217 | }, function() { |
| 213 | // funcion ejecutada cuando se cancela el modal | 218 | // funcion ejecutada cuando se cancela el modal |
| 214 | } | 219 | } |
| 215 | ); | 220 | ); |
| 216 | }; | 221 | }; |
| 217 | 222 | ||
| 218 | $scope.seleccionarVehiculo = function() { | 223 | $scope.seleccionarVehiculo = function() { |
| 219 | var modalInstance = $uibModal.open( | 224 | var modalInstance = $uibModal.open( |
| 220 | { | 225 | { |
| 221 | ariaLabelledBy: 'Busqueda de Vehiculo', | 226 | ariaLabelledBy: 'Busqueda de Vehiculo', |
| 222 | templateUrl: 'modal-vehiculo.html', | 227 | templateUrl: 'modal-vehiculo.html', |
| 223 | controller: 'focaModalVehiculoController', | 228 | controller: 'focaModalVehiculoController', |
| 224 | size: 'lg' | 229 | size: 'lg' |
| 225 | } | 230 | } |
| 226 | ); | 231 | ); |
| 227 | 232 | ||
| 228 | modalInstance.result.then( | 233 | modalInstance.result.then( |
| 229 | function(vehiculo) { | 234 | function(vehiculo) { |
| 230 | $scope.hojaRuta.vehiculo = vehiculo; | 235 | $scope.hojaRuta.vehiculo = vehiculo; |
| 231 | addCabecera('Tractor: ', vehiculo.tractor); | 236 | $scope.$broadcast('addCabecera', { |
| 232 | addCabecera('Semi: ', vehiculo.semi); | 237 | label: 'Tractor:', |
| 233 | addCabecera('Capacidad: ', vehiculo.capacidad); | 238 | valor: vehiculo.tractor |
| 239 | }); | ||
| 240 | $scope.$broadcast('addCabecera', { | ||
| 241 | label: 'Semi:', | ||
| 242 | valor: vehiculo.semi | ||
| 243 | }); | ||
| 244 | $scope.$broadcast('addCabecera', { | ||
| 245 | label: 'Capacidad:', | ||
| 246 | valor: vehiculo.capacidad | ||
| 247 | }); | ||
| 234 | }, function() { | 248 | }, function() { |
| 235 | // funcion ejecutada cuando se cancela el modal | 249 | // funcion ejecutada cuando se cancela el modal |
| 236 | } | 250 | } |
| 237 | ); | 251 | ); |
| 238 | }; | 252 | }; |
| 239 | 253 | ||
| 240 | $scope.seleccionarTarifario = function() { | 254 | $scope.seleccionarTarifario = function() { |
| 241 | var modalInstance = $uibModal.open( | 255 | var modalInstance = $uibModal.open( |
| 242 | { | 256 | { |
| 243 | ariaLabelledBy: 'Busqueda de Tarifario', | 257 | ariaLabelledBy: 'Busqueda de Tarifario', |
| 244 | templateUrl: 'modal-tarifa-flete.html', | 258 | templateUrl: 'modal-tarifa-flete.html', |
| 245 | controller: 'focaModalTarifaFleteController', | 259 | controller: 'focaModalTarifaFleteController', |
| 246 | size: 'lg', | 260 | size: 'lg', |
| 247 | resolve: { | 261 | resolve: { |
| 248 | parametrosTarifaFlete: function() { | 262 | parametrosTarifaFlete: function() { |
| 249 | return $scope.hojaRuta.tarifario.costo; | 263 | return $scope.hojaRuta.tarifario.costo; |
| 250 | } | 264 | } |
| 251 | } | 265 | } |
| 252 | } | 266 | } |
| 253 | ); | 267 | ); |
| 254 | 268 | ||
| 255 | modalInstance.result.then( | 269 | modalInstance.result.then( |
| 256 | function(tarifario) { | 270 | function(tarifario) { |
| 257 | $scope.hojaRuta.tarifario = tarifario; | 271 | $scope.hojaRuta.tarifario = tarifario; |
| 258 | addCabecera('Tarifario: ', tarifario.costo); | 272 | $scope.$broadcast('addCabecera', { |
| 273 | label: 'Tarifario:', | ||
| 274 | valor: tarifario.costo | ||
| 275 | }); | ||
| 259 | }, function() { | 276 | }, function() { |
| 260 | // funcion ejecutada cuando se cancela el modal | 277 | // funcion ejecutada cuando se cancela el modal |
| 261 | } | 278 | } |
| 262 | ); | 279 | ); |
| 263 | }; | 280 | }; |
| 264 | 281 | ||
| 265 | $scope.seleccionarRemitos = function() { | 282 | $scope.seleccionarRemitos = function() { |
| 266 | var modalInstance = $uibModal.open( | 283 | var modalInstance = $uibModal.open( |
| 267 | { | 284 | { |
| 268 | ariaLabelledBy: 'Busqueda de Remito', | 285 | ariaLabelledBy: 'Busqueda de Remito', |
| 269 | templateUrl: 'foca-modal-remito.html', | 286 | templateUrl: 'foca-modal-remito.html', |
| 270 | controller: 'focaModalRemitoController', | 287 | controller: 'focaModalRemitoController', |
| 271 | size: 'lg', | 288 | size: 'lg', |
| 272 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 289 | resolve: {usadoPor: function() {return 'hojaRuta';}} |
| 273 | } | 290 | } |
| 274 | ); | 291 | ); |
| 275 | modalInstance.result.then( | 292 | modalInstance.result.then( |
| 276 | function(remito) { | 293 | function(remito) { |
| 277 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 294 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { |
| 278 | if ($scope.remitosTabla[i].id === remito.id) { | 295 | if ($scope.remitosTabla[i].id === remito.id) { |
| 279 | focaModalService.alert('Remito ya incluido'); | 296 | focaModalService.alert('Remito ya incluido'); |
| 280 | return; | 297 | return; |
| 281 | } | 298 | } |
| 282 | } | 299 | } |
| 283 | 300 | ||
| 284 | var litros = 0; | 301 | var litros = 0; |
| 285 | for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 302 | for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { |
| 286 | litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 303 | litros = litros + parseFloat(remito.articulosRemito[j].cantidad); |
| 287 | } | 304 | } |
| 288 | 305 | ||
| 289 | if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 306 | if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { |
| 290 | focaModalService.alert( | 307 | focaModalService.alert( |
| 291 | 'Debe ingresar toda la información para el transporte' | 308 | 'Debe ingresar toda la información para el transporte' |
| 292 | ); | 309 | ); |
| 293 | return; | 310 | return; |
| 294 | } | 311 | } |
| 295 | 312 | ||
| 296 | if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 313 | if ($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) |
| 297 | { | 314 | { |
| 298 | var litrostotales = litros; | 315 | var litrostotales = litros; |
| 299 | litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 316 | litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; |
| 300 | focaModalService.alert( | 317 | focaModalService.alert( |
| 301 | 'La carga excede la capacidad disponible del vehiculo. ' + | 318 | 'La carga excede la capacidad disponible del vehiculo. ' + |
| 302 | 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 319 | 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' |
| 303 | ); | 320 | ); |
| 304 | } | 321 | } |
| 305 | 322 | ||
| 306 | remito.litros = litros; | 323 | remito.litros = litros; |
| 307 | $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 324 | $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
| 308 | $scope.remitosTabla.push(remito); | 325 | $scope.remitosTabla.push(remito); |
| 309 | }, function() { | 326 | }, function() { |
| 310 | // funcion ejecutada cuando se cancela el modal | 327 | // funcion ejecutada cuando se cancela el modal |
| 311 | } | 328 | } |
| 312 | ); | 329 | ); |
| 313 | }; | 330 | }; |
| 314 | 331 | ||
| 315 | $scope.getTotal = function() { | 332 | $scope.getTotal = function() { |
| 316 | var total = 0; | 333 | var total = 0; |
| 317 | var arrayTempArticulos = $scope.remitosTabla; | 334 | var arrayTempArticulos = $scope.remitosTabla; |
| 318 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 335 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 319 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 336 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 320 | } | 337 | } |
| 321 | return parseFloat(total.toFixed(2)); | 338 | return parseFloat(total.toFixed(2)); |
| 322 | }; | 339 | }; |
| 323 | 340 | ||
| 324 | $scope.getSubTotal = function() { | 341 | $scope.getSubTotal = function() { |
| 325 | if($scope.articuloACargar) { | 342 | if($scope.articuloACargar) { |
| 326 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 343 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 327 | } | 344 | } |
| 328 | }; | 345 | }; |
| 329 | 346 | ||
| 330 | $scope.limpiarPantalla = function() { | 347 | $scope.limpiarPantalla = function() { |
| 331 | $scope.limpiarFlete(); | 348 | $scope.limpiarFlete(); |
| 332 | $scope.hojaRuta.flete = '0'; | 349 | $scope.hojaRuta.flete = '0'; |
| 333 | $scope.hojaRuta.bomba = '0'; | 350 | $scope.hojaRuta.bomba = '0'; |
| 334 | $scope.hojaRuta.precioCondicion = ''; | 351 | $scope.hojaRuta.precioCondicion = ''; |
| 335 | $scope.remitosTabla = []; | 352 | $scope.remitosTabla = []; |
| 336 | $scope.hojaRuta.vendedor.nombre = ''; | 353 | $scope.hojaRuta.vendedor.nombre = ''; |
| 337 | $scope.hojaRuta.cliente = {nombre: ''}; | 354 | $scope.hojaRuta.cliente = {nombre: ''}; |
| 338 | $scope.hojaRuta.domicilio = {dom: ''}; | 355 | $scope.hojaRuta.domicilio = {dom: ''}; |
| 339 | $scope.hojaRuta.litros = 0; | 356 | $scope.hojaRuta.litros = 0; |
| 340 | $scope.domiciliosCliente = []; | 357 | $scope.domiciliosCliente = []; |
| 341 | }; | 358 | }; |
| 342 | //Recibe aviso si el teclado está en uso | 359 | //Recibe aviso si el teclado está en uso |
| 343 | // $rootScope.$on('usarTeclado', function(event, data) { | 360 | // $rootScope.$on('usarTeclado', function(event, data) { |
| 344 | // if(data) { | 361 | // if(data) { |
| 345 | // $scope.mostrarTeclado = true; | 362 | // $scope.mostrarTeclado = true; |
| 346 | // return; | 363 | // return; |
| 347 | // } | 364 | // } |
| 348 | // $scope.mostrarTeclado = false; | 365 | // $scope.mostrarTeclado = false; |
| 349 | // }) | 366 | // }) |
| 350 | $scope.selectFocus = function($event) { | 367 | $scope.selectFocus = function($event) { |
| 351 | //Si el teclado esta en uso no selecciona el valor | 368 | //Si el teclado esta en uso no selecciona el valor |
| 352 | // if($scope.mostrarTeclado) { | 369 | // if($scope.mostrarTeclado) { |
| 353 | // return; | 370 | // return; |
| 354 | // } | 371 | // } |
| 355 | $event.target.select(); | 372 | $event.target.select(); |
| 356 | }; | 373 | }; |
| 357 | 374 | ||
| 358 | $scope.salir = function() { | 375 | $scope.salir = function() { |
| 359 | $location.path('/'); | 376 | $location.path('/'); |
| 360 | }; | 377 | }; |
| 361 | 378 | ||
| 362 | $scope.parsearATexto = function(articulo) { | 379 | $scope.parsearATexto = function(articulo) { |
| 363 | articulo.cantidad = parseFloat(articulo.cantidad); | 380 | articulo.cantidad = parseFloat(articulo.cantidad); |
| 364 | articulo.precio = parseFloat(articulo.precio); | 381 | articulo.precio = parseFloat(articulo.precio); |
| 365 | }; | 382 | }; |
| 366 | 383 | ||
| 367 | $scope.rellenar = function(relleno, longitud) { | 384 | $scope.rellenar = function(relleno, longitud) { |
| 368 | relleno = '' + relleno; | 385 | relleno = '' + relleno; |
| 369 | while (relleno.length < longitud) { | 386 | while (relleno.length < longitud) { |
| 370 | relleno = '0' + relleno; | 387 | relleno = '0' + relleno; |
| 371 | } | 388 | } |
| 372 | 389 | ||
| 373 | return relleno; | 390 | return relleno; |
| 374 | }; | 391 | }; |
| 375 | 392 | ||
| 376 | $scope.quitarArticulo = function(key) { | 393 | $scope.quitarArticulo = function(key) { |
| 377 | $scope.remitosTabla.splice(key, 1); | 394 | $scope.remitosTabla.splice(key, 1); |
| 378 | var litros = 0; | 395 | var litros = 0; |
| 379 | 396 | ||
| 380 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 397 | for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { |
| 381 | litros += parseFloat($scope.remitosTabla[i].litros); | 398 | litros += parseFloat($scope.remitosTabla[i].litros); |
| 382 | } | 399 | } |
| 383 | 400 | ||
| 384 | $scope.hojaRuta.litros = litros; | 401 | $scope.hojaRuta.litros = litros; |
| 385 | 402 | ||
| 386 | }; | 403 | }; |
| 387 | 404 | ||
| 388 | function addCabecera(label, valor) { | ||
| 389 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | ||
| 390 | if(propiedad.length === 1) { | ||
| 391 | propiedad[0].valor = valor; | ||
| 392 | } else { | ||
| 393 | $scope.cabecera.push({label: label, valor: valor}); | ||
| 394 | } | ||
| 395 | } | ||
| 396 | |||
| 397 | /*function removeCabecera(label) { | 405 | /*function removeCabecera(label) { |
| 398 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 406 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 399 | if(propiedad.length === 1){ | 407 | if(propiedad.length === 1){ |
| 400 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 408 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 401 | } | 409 | } |
| 402 | }*/ | 410 | }*/ |
| 403 | } | 411 | } |
| 404 | ] | 412 | ] |
| 405 | ) | 413 | ) |
| 406 | .controller('hojaRutaListaCtrl', [ | 414 | .controller('hojaRutaListaCtrl', [ |
| 407 | '$scope', | 415 | '$scope', |
| 408 | 'crearHojaRutaService', | 416 | 'crearHojaRutaService', |
| 409 | '$location', | 417 | '$location', |
| 410 | function($scope, crearHojaRutaService, $location) { | 418 | function($scope, crearHojaRutaService, $location) { |
| 411 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { | 419 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { |
| 412 | $scope.hojaRutas = datos.data; | 420 | $scope.hojaRutas = datos.data; |
| 413 | }); | 421 | }); |
| 414 | $scope.editar = function(hojaRuta) { | 422 | $scope.editar = function(hojaRuta) { |
| 415 | crearHojaRutaService.setHojaRuta(hojaRuta); | 423 | crearHojaRutaService.setHojaRuta(hojaRuta); |
| 416 | $location.path('/venta-nota-pedido/abm/'); | 424 | $location.path('/venta-nota-pedido/abm/'); |
| 417 | }; | 425 | }; |
| 418 | $scope.crearPedido = function() { | 426 | $scope.crearPedido = function() { |
| 419 | crearHojaRutaService.clearHojaRuta(); | 427 | crearHojaRutaService.clearHojaRuta(); |
| 420 | $location.path('/venta-nota-pedido/abm/'); | 428 | $location.path('/venta-nota-pedido/abm/'); |
| 421 | }; | 429 | }; |
| 422 | } | 430 | } |
| 423 | ]) | 431 | ]) |
| 424 | .controller('focaCrearHojaRutaFichaClienteController', [ | 432 | .controller('focaCrearHojaRutaFichaClienteController', [ |
| 425 | '$scope', | 433 | '$scope', |
| 426 | 'crearHojaRutaService', | 434 | 'crearHojaRutaService', |
| 427 | '$location', | 435 | '$location', |
| 428 | function($scope, crearHojaRutaService, $location) { | 436 | function($scope, crearHojaRutaService, $location) { |
| 429 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { | 437 | crearHojaRutaService.obtenerHojaRuta().then(function(datos) { |
| 430 | $scope.hojaRutas = datos.data; | 438 | $scope.hojaRutas = datos.data; |
| 431 | }); | 439 | }); |
| 432 | $scope.editar = function(hojaRuta) { | 440 | $scope.editar = function(hojaRuta) { |
src/views/hoja-ruta.html
| 1 | <div class="crear-hoja-ruta foca-crear one-row row"> | 1 | <div class="crear-hoja-ruta foca-crear one-row row"> |
| 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()" class="mb-0 col-lg-12"> | 2 | <foca-cabecera-facturador |
| 3 | <div class="row"> | 3 | titulo="'HOJA DE RUTA'" |
| 4 | <div class="col-md-10 col-lg-12"> | 4 | numero="puntoVenta + '-' + comprobante" |
| 5 | <div class="row panel-informativo"> | 5 | fecha="now" |
| 6 | <div class="col-12"> | 6 | class="mb-0 col-lg-12" |
| 7 | <div class="row titulares"> | 7 | ></foca-cabecera-facturador> |
| 8 | <div class="col-12 col-sm-3 nota-pedido border border-left-0 border-white align-middle"> | ||
| 9 | <h5 class="mb-0">HOJA DE RUTA</h5> | ||
| 10 | </div> | ||
| 11 | <div class="col-12 col-sm-3 numero-pedido text-center text-md-left border border-white align-middle" | ||
| 12 | >Nº {{puntoVenta}}-{{comprobante}} | ||
| 13 | </div> | ||
| 14 | <div class="col-7 col-sm-3 border border-white align-middle"> | ||
| 15 | Fecha: | ||
| 16 | <span | ||
| 17 | ng-show="!datepickerAbierto" | ||
| 18 | ng-bind="now | date:'dd/MM/yyyy'" | ||
| 19 | ng-click="datepickerAbierto = true" | ||
| 20 | > | ||
| 21 | </span> | ||
| 22 | <input | ||
| 23 | ng-show="datepickerAbierto" | ||
| 24 | type="date" | ||
| 25 | ng-model="now" | ||
| 26 | ng-change="datepickerAbierto = false" | ||
| 27 | ng-blur="datepickerAbierto = false" | ||
| 28 | class="form-control form-control-sm col-8 float-right" | ||
| 29 | foca-focus="datepickerAbierto" | ||
| 30 | hasta-hoy | ||
| 31 | /> | ||
| 32 | </div> | ||
| 33 | <div class="col-5 col-sm-3 border border-white border-right-0 align-middle"> | ||
| 34 | Hora: | ||
| 35 | <span | ||
| 36 | ng-show="!datepickerAbierto" | ||
| 37 | ng-bind="now | date:'HH:mm'" | ||
| 38 | ng-click="datepickerAbierto = true" | ||
| 39 | > | ||
| 40 | </span> | ||
| 41 | </div> | ||
| 42 | </div> | ||
| 43 | <div class="row py-2"> | ||
| 44 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | ||
| 45 | <span class="label" ng-bind="cab.label"></span> | ||
| 46 | <span class="valor" ng-bind="cab.valor"></span> | ||
| 47 | </div> | ||
| 48 | <a | ||
| 49 | class="btn col-12 btn-secondary d-sm-none" | ||
| 50 | ng-show="cabecera.length > 0" | ||
| 51 | ng-click="showCabecera = !showCabecera" | ||
| 52 | > | ||
| 53 | <i | ||
| 54 | class="fa fa-chevron-down" | ||
| 55 | ng-hide="showCabecera" | ||
| 56 | aria-hidden="true" | ||
| 57 | > | ||
| 58 | </i> | ||
| 59 | <i | ||
| 60 | class="fa fa-chevron-up" | ||
| 61 | ng-show="showCabecera" | ||
| 62 | aria-hidden="true"> | ||
| 63 | </i> | ||
| 64 | </a> | ||
| 65 | </div> | ||
| 66 | </div> | ||
| 67 | </div> | ||
| 68 | |||
| 69 | </div> | ||
| 70 | </div> | ||
| 71 | </form> | ||
| 72 | <div class="col-lg-12"> | 8 | <div class="col-lg-12"> |
| 73 | <div class="row mt-4"> | 9 | <div class="row mt-4"> |
| 74 | <div class="col-12 col-md-10 border border-light rounded"> | 10 | <div class="col-12 col-md-10 border border-light rounded"> |
| 75 | <div class="row px-5 py-2 botonera-secundaria"> | 11 | <div class="row px-5 py-2 botonera-secundaria"> |
| 76 | <div class="col-12"> | 12 | <div class="col-12"> |
| 77 | <foca-botonera-facturador botones="botonera" extra="1" class="row"></foca-botonera-facturador> | 13 | <foca-botonera-facturador botones="botonera" extra="1" class="row"></foca-botonera-facturador> |
| 78 | </div> | 14 | </div> |
| 79 | </div> | 15 | </div> |
| 80 | <!-- PC --> | 16 | <!-- PC --> |
| 81 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
| 82 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
| 83 | <thead> | 19 | <thead> |
| 84 | <tr class="d-flex"> | 20 | <tr class="d-flex"> |
| 85 | <th class="col-auto">#</th> | 21 | <th class="col-auto">#</th> |
| 86 | <th class="col-2">Remito</th> | 22 | <th class="col-2">Remito</th> |
| 87 | <th class="col">Cliente</th> | 23 | <th class="col">Cliente</th> |
| 88 | <th class="col">Dirección</th> | 24 | <th class="col">Dirección</th> |
| 89 | <th class="text-right" style="width: 80px">Cantidad</th> | 25 | <th class="text-right" style="width: 80px">Cantidad</th> |
| 90 | <th class="col-auto"> | 26 | <th class="col-auto"> |
| 91 | <button | 27 | <button |
| 92 | class="btn btn-outline-light selectable" | 28 | class="btn btn-outline-light selectable" |
| 93 | ng-click="show = !show; masMenos()" | 29 | ng-click="show = !show; masMenos()" |
| 94 | > | 30 | > |
| 95 | <i | 31 | <i |
| 96 | class="fa fa-chevron-down" | 32 | class="fa fa-chevron-down" |
| 97 | ng-show="show" | 33 | ng-show="show" |
| 98 | aria-hidden="true" | 34 | aria-hidden="true" |
| 99 | > | 35 | > |
| 100 | </i> | 36 | </i> |
| 101 | <i | 37 | <i |
| 102 | class="fa fa-chevron-up" | 38 | class="fa fa-chevron-up" |
| 103 | ng-hide="show" | 39 | ng-hide="show" |
| 104 | aria-hidden="true"> | 40 | aria-hidden="true"> |
| 105 | </i> | 41 | </i> |
| 106 | </button> | 42 | </button> |
| 107 | </th> | 43 | </th> |
| 108 | </th> | 44 | </th> |
| 109 | </tr> | 45 | </tr> |
| 110 | </thead> | 46 | </thead> |
| 111 | <tbody class="tabla-articulo-body"> | 47 | <tbody class="tabla-articulo-body"> |
| 112 | <tr | 48 | <tr |
| 113 | ng-repeat="(key, remito) in remitosTabla" | 49 | ng-repeat="(key, remito) in remitosTabla" |
| 114 | class="d-flex" | 50 | class="d-flex" |
| 115 | ng-show="show || key == remitosTabla.length - 1" | 51 | ng-show="show || key == remitosTabla.length - 1" |
| 116 | > | 52 | > |
| 117 | <td ng-bind="key + 1" class="col-auto"></td> | 53 | <td ng-bind="key + 1" class="col-auto"></td> |
| 118 | <td | 54 | <td |
| 119 | class="col-2" | 55 | class="col-2" |
| 120 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | 56 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" |
| 121 | ></td> | 57 | ></td> |
| 122 | <th class="col" ng-bind="remito.cliente[0].NOM"></th> | 58 | <th class="col" ng-bind="remito.cliente[0].NOM"></th> |
| 123 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 59 | <th class="col" ng-bind="remito.domicilioStamp"></th> |
| 124 | <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> | 60 | <th class="text-right" ng-bind="remito.litros" style="width: 80px"></th> |
| 125 | <td class="text-center col-auto"> | 61 | <td class="text-center col-auto"> |
| 126 | <button | 62 | <button |
| 127 | class="btn btn-outline-light" | 63 | class="btn btn-outline-light" |
| 128 | ng-click="quitarArticulo(key)" | 64 | ng-click="quitarArticulo(key)" |
| 129 | > | 65 | > |
| 130 | <i class="fa fa-trash"></i> | 66 | <i class="fa fa-trash"></i> |
| 131 | </button> | 67 | </button> |
| 132 | </td> | 68 | </td> |
| 133 | </tr> | 69 | </tr> |
| 134 | </tbody> | 70 | </tbody> |
| 135 | <tfoot> | 71 | <tfoot> |
| 136 | <tr class="d-flex"> | 72 | <tr class="d-flex"> |
| 137 | <td class="col-auto px-1"> | 73 | <td class="col-auto px-1"> |
| 138 | <strong>Remitos:</strong> | 74 | <strong>Remitos:</strong> |
| 139 | <a ng-bind="remitosTabla.length"></a> | 75 | <a ng-bind="remitosTabla.length"></a> |
| 140 | </td> | 76 | </td> |
| 141 | <td class="col"></td> | 77 | <td class="col"></td> |
| 142 | <td class="col-auto px-1"> | 78 | <td class="col-auto px-1"> |
| 143 | <strong>Cantidad:</strong> | 79 | <strong>Cantidad:</strong> |
| 144 | <a ng-bind="hojaRuta.litros"></a> | 80 | <a ng-bind="hojaRuta.litros"></a> |
| 145 | </td> | 81 | </td> |
| 146 | </tr> | 82 | </tr> |
| 147 | </tfoot> | 83 | </tfoot> |
| 148 | </table> | 84 | </table> |
| 149 | </div> | 85 | </div> |
| 150 | 86 | ||
| 151 | <!-- MOBILE --> | 87 | <!-- MOBILE --> |
| 152 | <div class="row d-sm-none"> | 88 | <div class="row d-sm-none"> |
| 153 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | 89 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> |
| 154 | <thead> | 90 | <thead> |
| 155 | <tr class="d-flex"> | 91 | <tr class="d-flex"> |
| 156 | <th class="">#</th> | 92 | <th class="">#</th> |
| 157 | <th class="col px-0"> | 93 | <th class="col px-0"> |
| 158 | <div class="d-flex"> | 94 | <div class="d-flex"> |
| 159 | <div class="col-4 px-1">Código</div> | 95 | <div class="col-4 px-1">Código</div> |
| 160 | <div class="col-8 px-1">Descripción</div> | 96 | <div class="col-8 px-1">Descripción</div> |
| 161 | </div> | 97 | </div> |
| 162 | <div class="d-flex"> | 98 | <div class="d-flex"> |
| 163 | <div class="col-3 px-1">Cantidad</div> | 99 | <div class="col-3 px-1">Cantidad</div> |
| 164 | <div class="col px-1 text-right">P. Uni.</div> | 100 | <div class="col px-1 text-right">P. Uni.</div> |
| 165 | <div class="col px-1 text-right">Subtotal</div> | 101 | <div class="col px-1 text-right">Subtotal</div> |
| 166 | </div> | 102 | </div> |
| 167 | </th> | 103 | </th> |
| 168 | <th class="text-center tamaño-boton"> | 104 | <th class="text-center tamaño-boton"> |
| 169 | | 105 | |
| 170 | </th> | 106 | </th> |
| 171 | </tr> | 107 | </tr> |
| 172 | </thead> | 108 | </thead> |
| 173 | <tbody> | 109 | <tbody> |
| 174 | <tr | 110 | <tr |
| 175 | ng-repeat="(key, articulo) in remitosTabla" | 111 | ng-repeat="(key, articulo) in remitosTabla" |
| 176 | ng-show="show || key == remitosTabla.length - 1" | 112 | ng-show="show || key == remitosTabla.length - 1" |
| 177 | > | 113 | > |
| 178 | <td class="w-100 align-middle d-flex p-0"> | 114 | <td class="w-100 align-middle d-flex p-0"> |
| 179 | <div class="align-middle p-1"> | 115 | <div class="align-middle p-1"> |
| 180 | <span ng-bind="key+1" class="align-middle"></span> | 116 | <span ng-bind="key+1" class="align-middle"></span> |
| 181 | </div> | 117 | </div> |
| 182 | <div class="col px-0"> | 118 | <div class="col px-0"> |
| 183 | <div class="d-flex"> | 119 | <div class="d-flex"> |
| 184 | <div class="col-4 px-1"> | 120 | <div class="col-4 px-1"> |
| 185 | <span | 121 | <span |
| 186 | ng-bind="articulo.sector + '-' + articulo.codigo" | 122 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 187 | ></span> | 123 | ></span> |
| 188 | </div> | 124 | </div> |
| 189 | <div class="col-8 px-1"> | 125 | <div class="col-8 px-1"> |
| 190 | <span ng-bind="articulo.descripcion"></span> | 126 | <span ng-bind="articulo.descripcion"></span> |
| 191 | </div> | 127 | </div> |
| 192 | </div> | 128 | </div> |
| 193 | <div class="d-flex"> | 129 | <div class="d-flex"> |
| 194 | <div class="col-3 px-1"> | 130 | <div class="col-3 px-1"> |
| 195 | <span ng-bind="'x' + articulo.cantidad"></span> | 131 | <span ng-bind="'x' + articulo.cantidad"></span> |
| 196 | </div> | 132 | </div> |
| 197 | <div class="col-3 px-1 text-right"> | 133 | <div class="col-3 px-1 text-right"> |
| 198 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | 134 | <span ng-bind="articulo.precio | currency: hojaRuta.moneda.simbolo : 4"></span> |
| 199 | </div> | 135 | </div> |
| 200 | <div class="col px-1 text-right"> | 136 | <div class="col px-1 text-right"> |
| 201 | <span | 137 | <span |
| 202 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" | 138 | ng-bind="(articulo.precio * articulo.cantidad) | currency: hojaRuta.moneda.simbolo" |
| 203 | > | 139 | > |
| 204 | </span> | 140 | </span> |
| 205 | </div> | 141 | </div> |
| 206 | </div> | 142 | </div> |
| 207 | </div> | 143 | </div> |
| 208 | <div class="align-middle p-1"> | 144 | <div class="align-middle p-1"> |
| 209 | <button | 145 | <button |
| 210 | class="btn btn-outline-light" | 146 | class="btn btn-outline-light" |
| 211 | ng-click="quitarArticulo(key)" | 147 | ng-click="quitarArticulo(key)" |
| 212 | > | 148 | > |
| 213 | <i class="fa fa-trash"></i> | 149 | <i class="fa fa-trash"></i> |
| 214 | </button> | 150 | </button> |
| 215 | </div> | 151 | </div> |
| 216 | </td> | 152 | </td> |
| 217 | </tr> | 153 | </tr> |
| 218 | </tbody> | 154 | </tbody> |
| 219 | <tfoot> | 155 | <tfoot> |
| 220 | <!-- CARGANDO ITEM --> | 156 | <!-- CARGANDO ITEM --> |
| 221 | <tr ng-show="!cargando" class="d-flex"> | 157 | <tr ng-show="!cargando" class="d-flex"> |
| 222 | <td | 158 | <td |
| 223 | class="align-middle p-1" | 159 | class="align-middle p-1" |
| 224 | ng-bind="remitosTabla.length + 1" | 160 | ng-bind="remitosTabla.length + 1" |
| 225 | ></td> | 161 | ></td> |
| 226 | <td class="col p-0"> | 162 | <td class="col p-0"> |
| 227 | <div class="d-flex"> | 163 | <div class="d-flex"> |
| 228 | <div class="col-4 px-1"> | 164 | <div class="col-4 px-1"> |
| 229 | <span | 165 | <span |
| 230 | ng-bind="articuloACargar.sectorCodigo" | 166 | ng-bind="articuloACargar.sectorCodigo" |
| 231 | ></span> | 167 | ></span> |
| 232 | </div> | 168 | </div> |
| 233 | <div class="col-8 px-1"> | 169 | <div class="col-8 px-1"> |
| 234 | <span ng-bind="articuloACargar.descripcion"></span> | 170 | <span ng-bind="articuloACargar.descripcion"></span> |
| 235 | </div> | 171 | </div> |
| 236 | </div> | 172 | </div> |
| 237 | <div class="d-flex"> | 173 | <div class="d-flex"> |
| 238 | <div class="col-3 px-1 m-1"> | 174 | <div class="col-3 px-1 m-1"> |
| 239 | <input | 175 | <input |
| 240 | class="form-control p-1" | 176 | class="form-control p-1" |
| 241 | type="number" | 177 | type="number" |
| 242 | min="1" | 178 | min="1" |
| 243 | ng-model="articuloACargar.cantidad" | 179 | ng-model="articuloACargar.cantidad" |
| 244 | foca-focus="!cargando" | 180 | foca-focus="!cargando" |
| 245 | ng-keypress="agregarATabla($event.keyCode)" | 181 | ng-keypress="agregarATabla($event.keyCode)" |
| 246 | style="height: auto; line-height: 1.1em" | 182 | style="height: auto; line-height: 1.1em" |
| 247 | > | 183 | > |
| 248 | </div> | 184 | </div> |
| 249 | <div class="col-3 px-1 text-right"> | 185 | <div class="col-3 px-1 text-right"> |
| 250 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> | 186 | <span ng-bind="articuloACargar.precio | currency: hojaRuta.moneda.simbolo : 4"></span> |
| 251 | </div> | 187 | </div> |
| 252 | <div class="col px-1 text-right"> | 188 | <div class="col px-1 text-right"> |
| 253 | <span | 189 | <span |
| 254 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" | 190 | ng-bind="getSubTotal() | currency: hojaRuta.moneda.simbolo" |
| 255 | > | 191 | > |
| 256 | </span> | 192 | </span> |
| 257 | </div> | 193 | </div> |
| 258 | </div> | 194 | </div> |
| 259 | </td> | 195 | </td> |
| 260 | <td class="text-center align-middle"> | 196 | <td class="text-center align-middle"> |
| 261 | <button | 197 | <button |
| 262 | class="btn btn-outline-light" | 198 | class="btn btn-outline-light" |
| 263 | ng-click="agregarATabla(13)" | 199 | ng-click="agregarATabla(13)" |
| 264 | > | 200 | > |
| 265 | <i class="fa fa-save"></i> | 201 | <i class="fa fa-save"></i> |
| 266 | </button> | 202 | </button> |
| 267 | </td> | 203 | </td> |
| 268 | </tr> | 204 | </tr> |
| 269 | <!-- SELECCIONAR PRODUCTO --> | 205 | <!-- SELECCIONAR PRODUCTO --> |
| 270 | <tr ng-show="cargando" class="d-flex"> | 206 | <tr ng-show="cargando" class="d-flex"> |
| 271 | <td class="col-12"> | 207 | <td class="col-12"> |
| 272 | <input | 208 | <input |
| 273 | placeholder="Seleccione Articulo" | 209 | placeholder="Seleccione Articulo" |
| 274 | class="form-control form-control-sm" | 210 | class="form-control form-control-sm" |
| 275 | readonly | 211 | readonly |
| 276 | ng-click="seleccionarArticulo()" | 212 | ng-click="seleccionarArticulo()" |
| 277 | /> | 213 | /> |
| 278 | </td> | 214 | </td> |
| 279 | </tr> | 215 | </tr> |
| 280 | <!-- TOOGLE EXPANDIR --> | 216 | <!-- TOOGLE EXPANDIR --> |
| 281 | <tr> | 217 | <tr> |
| 282 | <td class="col"> | 218 | <td class="col"> |
| 283 | <button | 219 | <button |
| 284 | class="btn btn-outline-light selectable w-100" | 220 | class="btn btn-outline-light selectable w-100" |
| 285 | ng-click="show = !show; masMenos()" | 221 | ng-click="show = !show; masMenos()" |
| 286 | ng-show="remitosTabla.length > 0" | 222 | ng-show="remitosTabla.length > 0" |
| 287 | > | 223 | > |
| 288 | <i | 224 | <i |
| 289 | class="fa fa-chevron-down" | 225 | class="fa fa-chevron-down" |
| 290 | ng-hide="show" | 226 | ng-hide="show" |
| 291 | aria-hidden="true" | 227 | aria-hidden="true" |
| 292 | > | 228 | > |
| 293 | </i> | 229 | </i> |
| 294 | <i | 230 | <i |
| 295 | class="fa fa-chevron-up" | 231 | class="fa fa-chevron-up" |
| 296 | ng-show="show" | 232 | ng-show="show" |
| 297 | aria-hidden="true"> | 233 | aria-hidden="true"> |
| 298 | </i> | 234 | </i> |
| 299 | </button> | 235 | </button> |
| 300 | </td> | 236 | </td> |
| 301 | </tr> | 237 | </tr> |
| 302 | <!-- FOOTER --> | 238 | <!-- FOOTER --> |
| 303 | <tr class="d-flex"> | 239 | <tr class="d-flex"> |
| 304 | <td class="align-middle no-border-top" colspan="2"> | 240 | <td class="align-middle no-border-top" colspan="2"> |
| 305 | <strong>Cantidad Items:</strong> | 241 | <strong>Cantidad Items:</strong> |
| 306 | <a ng-bind="remitosTabla.length"></a> | 242 | <a ng-bind="remitosTabla.length"></a> |
| 307 | </td> | 243 | </td> |
| 308 | <td class="text-right ml-auto table-celda-total no-border-top"> | 244 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 309 | <h3>Total:</h3> | 245 | <h3>Total:</h3> |
| 310 | </td> | 246 | </td> |
| 311 | <td class="table-celda-total text-right no-border-top"> | 247 | <td class="table-celda-total text-right no-border-top"> |
| 312 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> | 248 | <h3>{{getTotal() | currency: hojaRuta.moneda.simbolo}}</h3> |
| 313 | </td> | 249 | </td> |
| 314 | </tr> | 250 | </tr> |
| 315 | </tfoot> | 251 | </tfoot> |
| 316 | </table> | 252 | </table> |
| 317 | </div> | 253 | </div> |
| 318 | </div> | 254 | </div> |
| 319 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> | 255 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none"> |
| 320 | <div class="col-12 mt-auto"> | 256 | <div class="col-12 mt-auto"> |
| 321 | <button | 257 | <button |
| 322 | ng-click="crearHojaRuta()" | 258 | ng-click="crearHojaRuta()" |
| 323 | type="submit" | 259 | type="submit" |
| 324 | title="Crear nota pedido" | 260 | title="Crear nota pedido" |
| 325 | class="btn btn-default btn-block mb-2 border border-dark"> | 261 | class="btn btn-default btn-block mb-2 border border-dark"> |
| 326 | <strong>GUARDAR</strong> | 262 | <strong>GUARDAR</strong> |
| 327 | </button> | 263 | </button> |
| 328 | <button | 264 | <button |
| 329 | type="submit" | 265 | type="submit" |
| 330 | title="Crear nota pedido" | 266 | title="Crear nota pedido" |
| 331 | class="btn btn-default btn-block mb-2 border border-dark"> | 267 | class="btn btn-default btn-block mb-2 border border-dark"> |
| 332 | <strong>PAUSAR</strong> | 268 | <strong>PAUSAR</strong> |
| 333 | </button> | 269 | </button> |
| 334 | <button | 270 | <button |
| 335 | ng-click="salir()" | 271 | ng-click="salir()" |
| 336 | type="button" | 272 | type="button" |
| 337 | title="Salir" | 273 | title="Salir" |
| 338 | class="btn btn-default btn-block border border-dark"> | 274 | class="btn btn-default btn-block border border-dark"> |
| 339 | <strong>SALIR</strong> | 275 | <strong>SALIR</strong> |
| 340 | </button> | 276 | </button> |
| 341 | </div> | 277 | </div> |
| 342 | </div> | 278 | </div> |
| 343 | </div> | 279 | </div> |
| 344 | </div> | 280 | </div> |
| 345 | <div class="row d-md-none fixed-bottom"> | 281 | <div class="row d-md-none fixed-bottom"> |
| 346 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 282 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 347 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 283 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 348 | <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> | 284 | <span class="mr-3 ml-auto" ng-click="crearHojaRuta()">Guardar</span> |
| 349 | </div> | 285 | </div> |
| 350 | </div> | 286 | </div> |
| 351 | </div> | 287 | </div> |
| 352 | 288 |