Commit 6f40e99928d15ab517d8f4bbe4b1e2e1260f1bc2
Exists in
master
and in
2 other branches
Merge branch 'master' into 'master'
Master See merge request modulos-npm/foca-crear-remito!15
Showing
2 changed files
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', |
| 4 | 'focaModalService', 'remitoBusinessService', | 4 | 'focaModalService', 'remitoBusinessService', |
| 5 | function( | 5 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
| 7 | remitoBusinessService | 7 | remitoBusinessService |
| 8 | ) { | 8 | ) { |
| 9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
| 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, |
| 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
| 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
| 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
| 15 | { | 15 | { |
| 16 | texto: 'Precios y condiciones', | 16 | texto: 'Precios y condiciones', |
| 17 | accion: function() {$scope.abrirModalListaPrecio();}}, | 17 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
| 20 | ]; | 20 | ]; |
| 21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
| 22 | 22 | ||
| 23 | $scope.show = false; | 23 | $scope.show = false; |
| 24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
| 25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
| 26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
| 27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | $scope.remito = { | 30 | $scope.remito = { |
| 31 | id: 0, | 31 | id: 0, |
| 32 | vendedor: {}, | 32 | vendedor: {}, |
| 33 | cliente: {}, | 33 | cliente: {}, |
| 34 | proveedor: {}, | 34 | proveedor: {}, |
| 35 | domicilio: {dom: ''}, | 35 | domicilio: {dom: ''}, |
| 36 | moneda: {}, | 36 | moneda: {}, |
| 37 | cotizacion: {} | 37 | cotizacion: {} |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | $scope.notaPedido = { | 40 | $scope.notaPedido = { |
| 41 | id: 0 | 41 | id: 0 |
| 42 | }; | 42 | }; |
| 43 | var monedaPorDefecto; | 43 | var monedaPorDefecto; |
| 44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 44 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
| 45 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 45 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
| 46 | monedaPorDefecto = { | 46 | monedaPorDefecto = { |
| 47 | id: res.data[0].ID, | 47 | id: res.data[0].ID, |
| 48 | detalle: res.data[0].DETALLE, | 48 | detalle: res.data[0].DETALLE, |
| 49 | simbolo: res.data[0].SIMBOLO, | 49 | simbolo: res.data[0].SIMBOLO, |
| 50 | cotizaciones: res.data[0].cotizaciones | 50 | cotizaciones: res.data[0].cotizaciones |
| 51 | }; | 51 | }; |
| 52 | addCabecera('Moneda:', monedaPorDefecto.detalle); | 52 | addCabecera('Moneda:', monedaPorDefecto.detalle); |
| 53 | addCabecera('Fecha cotizacion:', | 53 | addCabecera('Fecha cotizacion:', |
| 54 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | 54 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
| 55 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | 55 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); |
| 56 | $scope.remito.moneda = monedaPorDefecto; | 56 | $scope.remito.moneda = monedaPorDefecto; |
| 57 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | 57 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; |
| 58 | }); | 58 | }); |
| 59 | 59 | ||
| 60 | $scope.cabecera = []; | 60 | $scope.cabecera = []; |
| 61 | $scope.showCabecera = true; | 61 | $scope.showCabecera = true; |
| 62 | 62 | ||
| 63 | $scope.now = new Date(); | 63 | $scope.now = new Date(); |
| 64 | $scope.puntoVenta = rellenar(0, 4); | 64 | $scope.puntoVenta = rellenar(0, 4); |
| 65 | $scope.comprobante = rellenar(0, 8); | 65 | $scope.comprobante = rellenar(0, 8); |
| 66 | 66 | ||
| 67 | $scope.articulosTabla = []; | 67 | $scope.articulosTabla = []; |
| 68 | $scope.idLista = undefined; | 68 | $scope.idLista = undefined; |
| 69 | //La pantalla solo se usa para cargar remitos | 69 | //La pantalla solo se usa para cargar remitos |
| 70 | //var remitoTemp = crearRemitoService.getRemito(); | 70 | //var remitoTemp = crearRemitoService.getRemito(); |
| 71 | 71 | ||
| 72 | crearRemitoService.getPrecioCondicion().then( | 72 | crearRemitoService.getPrecioCondicion().then( |
| 73 | function(res) { | 73 | function(res) { |
| 74 | $scope.precioCondiciones = res.data; | 74 | $scope.precioCondiciones = res.data; |
| 75 | } | 75 | } |
| 76 | ); | 76 | ); |
| 77 | 77 | ||
| 78 | crearRemitoService.getNumeroRemito().then( | 78 | crearRemitoService.getNumeroRemito().then( |
| 79 | function(res) { | 79 | function(res) { |
| 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
| 82 | }, | 82 | }, |
| 83 | function(err) { | 83 | function(err) { |
| 84 | focaModalService.alert('La terminal no esta configurada correctamente'); | 84 | focaModalService.alert('La terminal no esta configurada correctamente'); |
| 85 | console.info(err); | 85 | console.info(err); |
| 86 | } | 86 | } |
| 87 | ); | 87 | ); |
| 88 | 88 | ||
| 89 | $scope.seleccionarNotaPedido = function() { | 89 | $scope.seleccionarNotaPedido = function() { |
| 90 | var modalInstance = $uibModal.open( | 90 | var modalInstance = $uibModal.open( |
| 91 | { | 91 | { |
| 92 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 92 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
| 93 | templateUrl: 'foca-modal-nota-pedido.html', | 93 | templateUrl: 'foca-modal-nota-pedido.html', |
| 94 | controller: 'focaModalNotaPedidoController', | 94 | controller: 'focaModalNotaPedidoController', |
| 95 | size: 'lg' | 95 | size: 'lg' |
| 96 | } | 96 | } |
| 97 | ); | 97 | ); |
| 98 | modalInstance.result.then( | 98 | modalInstance.result.then( |
| 99 | function(notaPedido) { | 99 | function(notaPedido) { |
| 100 | //añado cabeceras | 100 | //añado cabeceras |
| 101 | $scope.notaPedido.id = notaPedido.id; | 101 | $scope.notaPedido.id = notaPedido.id; |
| 102 | removeCabecera('Moneda:'); | 102 | removeCabecera('Moneda:'); |
| 103 | removeCabecera('Fecha cotizacion:'); | 103 | removeCabecera('Fecha cotizacion:'); |
| 104 | removeCabecera('Cotizacion:'); | 104 | removeCabecera('Cotizacion:'); |
| 105 | var cabeceras = [ | 105 | var cabeceras = [ |
| 106 | { | 106 | { |
| 107 | label: 'Moneda', | 107 | label: 'Moneda', |
| 108 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE | 108 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE |
| 109 | }, | 109 | }, |
| 110 | { | 110 | { |
| 111 | label: 'Fecha cotizacion', | 111 | label: 'Fecha cotizacion', |
| 112 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, | 112 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, |
| 113 | 'dd/MM/yyyy') | 113 | 'dd/MM/yyyy') |
| 114 | }, | 114 | }, |
| 115 | { | 115 | { |
| 116 | label: 'Cotizacion', | 116 | label: 'Cotizacion', |
| 117 | valor: notaPedido.cotizacion[0].VENDEDOR | 117 | valor: notaPedido.cotizacion[0].VENDEDOR |
| 118 | }, | 118 | }, |
| 119 | { | 119 | { |
| 120 | label: 'Cliente:', | 120 | label: 'Cliente:', |
| 121 | valor: notaPedido.cliente[0].NOM | 121 | valor: notaPedido.cliente[0].NOM |
| 122 | }, | 122 | }, |
| 123 | { | 123 | { |
| 124 | label: 'Domicilio:', | 124 | label: 'Domicilio:', |
| 125 | valor: notaPedido.domicilioStamp | 125 | valor: notaPedido.domicilioStamp |
| 126 | }, | 126 | }, |
| 127 | { | 127 | { |
| 128 | label: 'Vendedor:', | 128 | label: 'Vendedor:', |
| 129 | valor: notaPedido.vendedor[0].NomVen | 129 | valor: notaPedido.vendedor[0].NomVen |
| 130 | }, | 130 | }, |
| 131 | { | 131 | { |
| 132 | label: 'Proveedor:', | 132 | label: 'Proveedor:', |
| 133 | valor: notaPedido.proveedor[0].NOM | 133 | valor: notaPedido.proveedor[0].NOM |
| 134 | }, | 134 | }, |
| 135 | { | 135 | { |
| 136 | label: 'Flete:', | 136 | label: 'Flete:', |
| 137 | valor: notaPedido.flete === 1 ? 'Si' : 'No' | 137 | valor: notaPedido.flete === 1 ? 'Si' : 'No' |
| 138 | }, | 138 | }, |
| 139 | { | 139 | { |
| 140 | label: 'FOB:', | 140 | label: 'FOB:', |
| 141 | valor: notaPedido.fob === 1 ? 'Si' : 'No' | 141 | valor: notaPedido.fob === 1 ? 'Si' : 'No' |
| 142 | }, | 142 | }, |
| 143 | { | 143 | { |
| 144 | label: 'Precio condicion:', | 144 | label: 'Precio condicion:', |
| 145 | valor: valorPrecioCondicion() | 145 | valor: valorPrecioCondicion() |
| 146 | } | 146 | } |
| 147 | ]; | 147 | ]; |
| 148 | //TO DO CUANDO MOSTRAR PLAZOS | 148 | //TO DO CUANDO MOSTRAR PLAZOS |
| 149 | function valorPrecioCondicion() { | 149 | function valorPrecioCondicion() { |
| 150 | if(notaPedido.idPrecioCondicion > 0) { | 150 | if(notaPedido.idPrecioCondicion > 0) { |
| 151 | return notaPedido.precioCondicion[0].nombre; | 151 | return notaPedido.precioCondicion[0].nombre; |
| 152 | } else { | 152 | } else { |
| 153 | return 'Ingreso Manual'; | 153 | return 'Ingreso Manual'; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | if(notaPedido.flete === 1) { | 158 | if(notaPedido.flete === 1) { |
| 159 | var cabeceraBomba = { | 159 | var cabeceraBomba = { |
| 160 | label: 'Bomba', | 160 | label: 'Bomba', |
| 161 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 161 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
| 162 | }; | 162 | }; |
| 163 | if(notaPedido.kilometros) { | 163 | if(notaPedido.kilometros) { |
| 164 | var cabeceraKilometros = { | 164 | var cabeceraKilometros = { |
| 165 | label: 'Kilometros', | 165 | label: 'Kilometros', |
| 166 | valor: notaPedido.kilometros | 166 | valor: notaPedido.kilometros |
| 167 | }; | 167 | }; |
| 168 | cabeceras.push(cabeceraKilometros); | 168 | cabeceras.push(cabeceraKilometros); |
| 169 | } | 169 | } |
| 170 | cabeceras.push(cabeceraBomba); | 170 | cabeceras.push(cabeceraBomba); |
| 171 | } | 171 | } |
| 172 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | 172 | $scope.articulosTabla = notaPedido.articulosNotaPedido; |
| 173 | if(notaPedido.precioCondicion.length > 0) { | 173 | if(notaPedido.precioCondicion.length > 0) { |
| 174 | $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; | 174 | $scope.idLista = notaPedido.precioCondicion[0].idListaPrecio; |
| 175 | } else { | 175 | } else { |
| 176 | $scope.idLista = -1; | 176 | $scope.idLista = -1; |
| 177 | } | 177 | } |
| 178 | delete notaPedido.id; | 178 | delete notaPedido.id; |
| 179 | $scope.remito.domicilioStamp = notaPedido.domicilioStamp; | ||
| 179 | $scope.remito = notaPedido; | 180 | $scope.remito = notaPedido; |
| 180 | $scope.remito.vendedor = notaPedido.vendedor[0]; | 181 | $scope.remito.vendedor = notaPedido.vendedor[0]; |
| 181 | $scope.remito.cliente = notaPedido.cliente[0]; | 182 | $scope.remito.cliente = notaPedido.cliente[0]; |
| 182 | $scope.remito.proveedor = notaPedido.proveedor[0]; | 183 | $scope.remito.proveedor = notaPedido.proveedor[0]; |
| 183 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; | 184 | $scope.remito.moneda = notaPedido.cotizacion[0].moneda[0]; |
| 184 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; | 185 | $scope.remito.cotizacion = notaPedido.cotizacion[0]; |
| 185 | addArrayCabecera(cabeceras); | 186 | addArrayCabecera(cabeceras); |
| 186 | 187 | ||
| 187 | }, function() { | 188 | }, function() { |
| 188 | // funcion ejecutada cuando se cancela el modal | 189 | // funcion ejecutada cuando se cancela el modal |
| 189 | } | 190 | } |
| 190 | ); | 191 | ); |
| 191 | }; | 192 | }; |
| 192 | 193 | ||
| 193 | $scope.seleccionarRemito = function() { | 194 | $scope.seleccionarRemito = function() { |
| 194 | var modalInstance = $uibModal.open( | 195 | var modalInstance = $uibModal.open( |
| 195 | { | 196 | { |
| 196 | ariaLabelledBy: 'Busqueda de Remito', | 197 | ariaLabelledBy: 'Busqueda de Remito', |
| 197 | templateUrl: 'foca-modal-remito.html', | 198 | templateUrl: 'foca-modal-remito.html', |
| 198 | controller: 'focaModalRemitoController', | 199 | controller: 'focaModalRemitoController', |
| 199 | size: 'lg' | 200 | size: 'lg' |
| 200 | } | 201 | } |
| 201 | ); | 202 | ); |
| 202 | modalInstance.result.then( | 203 | modalInstance.result.then( |
| 203 | function(remito) { | 204 | function(remito) { |
| 204 | //añado cabeceras | 205 | //añado cabeceras |
| 205 | removeCabecera('Moneda:'); | 206 | removeCabecera('Moneda:'); |
| 206 | removeCabecera('Fecha cotizacion:'); | 207 | removeCabecera('Fecha cotizacion:'); |
| 207 | removeCabecera('Cotizacion:'); | 208 | removeCabecera('Cotizacion:'); |
| 208 | var cabeceras = [ | 209 | var cabeceras = [ |
| 209 | { | 210 | { |
| 210 | label: 'Moneda', | 211 | label: 'Moneda', |
| 211 | valor: remito.cotizacion[0].moneda[0].DETALLE | 212 | valor: remito.cotizacion[0].moneda[0].DETALLE |
| 212 | }, | 213 | }, |
| 213 | { | 214 | { |
| 214 | label: 'Fecha cotizacion', | 215 | label: 'Fecha cotizacion', |
| 215 | valor: $filter('date')(remito.cotizacion[0].FECHA, | 216 | valor: $filter('date')(remito.cotizacion[0].FECHA, |
| 216 | 'dd/MM/yyyy') | 217 | 'dd/MM/yyyy') |
| 217 | }, | 218 | }, |
| 218 | { | 219 | { |
| 219 | label: 'Cotizacion', | 220 | label: 'Cotizacion', |
| 220 | valor: remito.cotizacion[0].VENDEDOR | 221 | valor: remito.cotizacion[0].VENDEDOR |
| 221 | }, | 222 | }, |
| 222 | { | 223 | { |
| 223 | label: 'Cliente:', | 224 | label: 'Cliente:', |
| 224 | valor: remito.cliente[0].NOM | 225 | valor: remito.cliente[0].NOM |
| 225 | }, | 226 | }, |
| 226 | { | 227 | { |
| 227 | label: 'Domicilio:', | 228 | label: 'Domicilio:', |
| 228 | valor: remito.domicilioStamp | 229 | valor: remito.domicilioStamp |
| 229 | }, | 230 | }, |
| 230 | { | 231 | { |
| 231 | label: 'Vendedor:', | 232 | label: 'Vendedor:', |
| 232 | valor: remito.vendedor[0].NomVen | 233 | valor: remito.vendedor[0].NomVen |
| 233 | }, | 234 | }, |
| 234 | { | 235 | { |
| 235 | label: 'Proveedor:', | 236 | label: 'Proveedor:', |
| 236 | valor: remito.proveedor[0].NOM | 237 | valor: remito.proveedor[0].NOM |
| 237 | }, | 238 | }, |
| 238 | { | 239 | { |
| 239 | label: 'Flete:', | 240 | label: 'Flete:', |
| 240 | valor: remito.flete === 1 ? 'Si' : 'No' | 241 | valor: remito.flete === 1 ? 'Si' : 'No' |
| 241 | }, | 242 | }, |
| 242 | { | 243 | { |
| 243 | label: 'FOB:', | 244 | label: 'FOB:', |
| 244 | valor: remito.fob === 1 ? 'Si' : 'No' | 245 | valor: remito.fob === 1 ? 'Si' : 'No' |
| 245 | }, | 246 | }, |
| 246 | { | 247 | { |
| 247 | label: 'Precio condicion:', | 248 | label: 'Precio condicion:', |
| 248 | valor: valorPrecioCondicion() | 249 | valor: valorPrecioCondicion() |
| 249 | } | 250 | } |
| 250 | ]; | 251 | ]; |
| 251 | //TO DO CUANDO MOSTRAR PLAZOS | 252 | //TO DO CUANDO MOSTRAR PLAZOS |
| 252 | function valorPrecioCondicion() { | 253 | function valorPrecioCondicion() { |
| 253 | if(remito.idPrecioCondicion > 0) { | 254 | if(remito.idPrecioCondicion > 0) { |
| 254 | return remito.precioCondicion[0].nombre; | 255 | return remito.precioCondicion[0].nombre; |
| 255 | } else { | 256 | } else { |
| 256 | return 'Ingreso Manual'; | 257 | return 'Ingreso Manual'; |
| 257 | } | 258 | } |
| 258 | 259 | ||
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | if(remito.flete === 1) { | 262 | if(remito.flete === 1) { |
| 262 | var cabeceraBomba = { | 263 | var cabeceraBomba = { |
| 263 | label: 'Bomba', | 264 | label: 'Bomba', |
| 264 | valor: remito.bomba === 1 ? 'Si' : 'No' | 265 | valor: remito.bomba === 1 ? 'Si' : 'No' |
| 265 | }; | 266 | }; |
| 266 | if(remito.kilometros) { | 267 | if(remito.kilometros) { |
| 267 | var cabeceraKilometros = { | 268 | var cabeceraKilometros = { |
| 268 | label: 'Kilometros', | 269 | label: 'Kilometros', |
| 269 | valor: remito.kilometros | 270 | valor: remito.kilometros |
| 270 | }; | 271 | }; |
| 271 | cabeceras.push(cabeceraKilometros); | 272 | cabeceras.push(cabeceraKilometros); |
| 272 | } | 273 | } |
| 273 | cabeceras.push(cabeceraBomba); | 274 | cabeceras.push(cabeceraBomba); |
| 274 | } | 275 | } |
| 275 | $scope.articulosTabla = remito.articulosRemito; | 276 | $scope.articulosTabla = remito.articulosRemito; |
| 276 | if(remito.precioCondicion.length > 0) { | 277 | if(remito.precioCondicion.length > 0) { |
| 277 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; | 278 | $scope.idLista = remito.precioCondicion[0].idListaPrecio; |
| 278 | } else { | 279 | } else { |
| 279 | $scope.idLista = -1; | 280 | $scope.idLista = -1; |
| 280 | } | 281 | } |
| 281 | $scope.comprobante = rellenar(remito.numeroRemito, 8); | 282 | $scope.comprobante = rellenar(remito.numeroRemito, 8); |
| 282 | $scope.remito = remito; | 283 | $scope.remito = remito; |
| 283 | $scope.remito.vendedor = remito.vendedor[0]; | 284 | $scope.remito.vendedor = remito.vendedor[0]; |
| 284 | $scope.remito.cliente = remito.cliente[0]; | 285 | $scope.remito.cliente = remito.cliente[0]; |
| 285 | $scope.remito.proveedor = remito.proveedor[0]; | 286 | $scope.remito.proveedor = remito.proveedor[0]; |
| 286 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; | 287 | $scope.remito.moneda = remito.cotizacion[0].moneda[0]; |
| 287 | $scope.remito.cotizacion = remito.cotizacion[0]; | 288 | $scope.remito.cotizacion = remito.cotizacion[0]; |
| 288 | addArrayCabecera(cabeceras); | 289 | addArrayCabecera(cabeceras); |
| 289 | }, function() { | 290 | }, function() { |
| 290 | // funcion ejecutada cuando se cancela el modal | 291 | // funcion ejecutada cuando se cancela el modal |
| 291 | } | 292 | } |
| 292 | ); | 293 | ); |
| 293 | }; | 294 | }; |
| 294 | 295 | ||
| 295 | //La pantalla solo se usa para cargar remitos | 296 | //La pantalla solo se usa para cargar remitos |
| 296 | // if (remitoTemp !== undefined) { | 297 | // if (remitoTemp !== undefined) { |
| 297 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 298 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
| 298 | // $scope.remito = remitoTemp; | 299 | // $scope.remito = remitoTemp; |
| 299 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 300 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
| 300 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 301 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
| 301 | // $scope.idLista = $scope.remito.precioCondicion; | 302 | // $scope.idLista = $scope.remito.precioCondicion; |
| 302 | // crearRemitoService | 303 | // crearRemitoService |
| 303 | // .getArticulosByIdRemito($scope.remito.id).then( | 304 | // .getArticulosByIdRemito($scope.remito.id).then( |
| 304 | // function(res) { | 305 | // function(res) { |
| 305 | // $scope.articulosTabla = res.data; | 306 | // $scope.articulosTabla = res.data; |
| 306 | // } | 307 | // } |
| 307 | // ); | 308 | // ); |
| 308 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 309 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
| 309 | //(NO REQUERIDO EN ESTA VERSION) | 310 | //(NO REQUERIDO EN ESTA VERSION) |
| 310 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 311 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
| 311 | // function(res) { | 312 | // function(res) { |
| 312 | // $scope.remito.domicilio = res.data; | 313 | // $scope.remito.domicilio = res.data; |
| 313 | // } | 314 | // } |
| 314 | // ); | 315 | // ); |
| 315 | // } else { | 316 | // } else { |
| 316 | // $scope.remito.fechaCarga = new Date(); | 317 | // $scope.remito.fechaCarga = new Date(); |
| 317 | // $scope.remito.bomba = '0'; | 318 | // $scope.remito.bomba = '0'; |
| 318 | // $scope.remito.flete = '0'; | 319 | // $scope.remito.flete = '0'; |
| 319 | // $scope.idLista = undefined; | 320 | // $scope.idLista = undefined; |
| 320 | // } | 321 | // } |
| 321 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 322 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 322 | // $scope.addNewDom = function() { | 323 | // $scope.addNewDom = function() { |
| 323 | // $scope.remito.domicilio.push({ 'id': 0 }); | 324 | // $scope.remito.domicilio.push({ 'id': 0 }); |
| 324 | // }; | 325 | // }; |
| 325 | // $scope.removeNewChoice = function(choice) { | 326 | // $scope.removeNewChoice = function(choice) { |
| 326 | // if ($scope.remito.domicilio.length > 1) { | 327 | // if ($scope.remito.domicilio.length > 1) { |
| 327 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 328 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
| 328 | // function(c) { | 329 | // function(c) { |
| 329 | // return c.$$hashKey === choice.$$hashKey; | 330 | // return c.$$hashKey === choice.$$hashKey; |
| 330 | // } | 331 | // } |
| 331 | // ), 1); | 332 | // ), 1); |
| 332 | // } | 333 | // } |
| 333 | // }; | 334 | // }; |
| 334 | //validacion por domicilio y por plazo pago | 335 | //validacion por domicilio y por plazo pago |
| 335 | $scope.crearRemito = function() { | 336 | $scope.crearRemito = function() { |
| 336 | if(!$scope.remito.vendedor) { | 337 | if(!$scope.remito.vendedor) { |
| 337 | focaModalService.alert('Ingrese Vendedor'); | 338 | focaModalService.alert('Ingrese Vendedor'); |
| 338 | return; | 339 | return; |
| 339 | } else if(!$scope.remito.cliente) { | 340 | } else if(!$scope.remito.cliente) { |
| 340 | focaModalService.alert('Ingrese Cliente'); | 341 | focaModalService.alert('Ingrese Cliente'); |
| 341 | return; | 342 | return; |
| 342 | } else if(!$scope.remito.proveedor) { | 343 | } else if(!$scope.remito.proveedor) { |
| 343 | focaModalService.alert('Ingrese Proveedor'); | 344 | focaModalService.alert('Ingrese Proveedor'); |
| 344 | return; | 345 | return; |
| 345 | } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { | 346 | } else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { |
| 346 | focaModalService.alert('Ingrese Moneda'); | 347 | focaModalService.alert('Ingrese Moneda'); |
| 347 | return; | 348 | return; |
| 348 | } else if(!$scope.remito.cotizacion.ID) { | 349 | } else if(!$scope.remito.cotizacion.ID) { |
| 349 | focaModalService.alert('Ingrese Cotización'); | 350 | focaModalService.alert('Ingrese Cotización'); |
| 350 | return; | 351 | return; |
| 351 | } else if( | 352 | } else if( |
| 352 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 353 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
| 353 | { | 354 | { |
| 354 | focaModalService.alert('Ingrese Flete'); | 355 | focaModalService.alert('Ingrese Flete'); |
| 355 | return; | 356 | return; |
| 356 | } else if($scope.articulosTabla.length === 0) { | 357 | } else if($scope.articulosTabla.length === 0) { |
| 357 | focaModalService.alert('Debe cargar al menos un articulo'); | 358 | focaModalService.alert('Debe cargar al menos un articulo'); |
| 358 | return; | 359 | return; |
| 359 | } | 360 | } |
| 360 | var date = new Date(); | 361 | var date = new Date(); |
| 361 | var save = { | 362 | var save = { |
| 362 | remito: { | 363 | remito: { |
| 363 | id: 0, | 364 | id: 0, |
| 364 | fechaRemito: | 365 | fechaRemito: |
| 365 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 366 | new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 366 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter | 367 | .toISOString().slice(0, 19).replace('T', ' '),//TODO$filter |
| 367 | idCliente: $scope.remito.idCliente, | 368 | idCliente: $scope.remito.idCliente, |
| 368 | nombreCliente: $scope.remito.nombreCliente, | 369 | nombreCliente: $scope.remito.nombreCliente, |
| 369 | cuitCliente: $scope.remito.cuitCliente, | 370 | cuitCliente: $scope.remito.cuitCliente, |
| 370 | responsabilidadIvaCliente: 0,//TODO, | 371 | responsabilidadIvaCliente: 0,//TODO, |
| 371 | descuento: 0,//TODO, | 372 | descuento: 0,//TODO, |
| 372 | importeNeto: 0,//TODO | 373 | importeNeto: 0,//TODO |
| 373 | importeExento: 0,//TODO | 374 | importeExento: 0,//TODO |
| 374 | importeIva: 0,//TODO | 375 | importeIva: 0,//TODO |
| 375 | importeIvaServicios: 0,//TODO | 376 | importeIvaServicios: 0,//TODO |
| 376 | importeImpuestoInterno: 0,//TODO | 377 | importeImpuestoInterno: 0,//TODO |
| 377 | importeImpuestoInterno1: 0,//TODO | 378 | importeImpuestoInterno1: 0,//TODO |
| 378 | importeImpuestoInterno2: 0,//TODO | 379 | importeImpuestoInterno2: 0,//TODO |
| 379 | percepcion: 0,//TODO | 380 | percepcion: 0,//TODO |
| 380 | percepcionIva: 0,//TODO | 381 | percepcionIva: 0,//TODO |
| 381 | redondeo: 0,//TODO | 382 | redondeo: 0,//TODO |
| 382 | total: $scope.getTotal(), | 383 | total: $scope.getTotal(), |
| 383 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 384 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
| 384 | anulado: false, | 385 | anulado: false, |
| 385 | planilla: 0,//TODO | 386 | planilla: 0,//TODO |
| 386 | lugar: 0,//TODO | 387 | lugar: 0,//TODO |
| 387 | cuentaMadre: 0,// | 388 | cuentaMadre: 0,// |
| 388 | cuentaContable: 0,//TODO | 389 | cuentaContable: 0,//TODO |
| 389 | asiento: 0,//TODO | 390 | asiento: 0,//TODO |
| 390 | e_hd: '',//TODO | 391 | e_hd: '',//TODO |
| 391 | c_hd: '', | 392 | c_hd: '', |
| 392 | numeroLiquidoProducto: 0,//TODO | 393 | numeroLiquidoProducto: 0,//TODO |
| 393 | idVendedor: $scope.remito.idVendedor, | 394 | idVendedor: $scope.remito.idVendedor, |
| 394 | idProveedor: $scope.remito.idProveedor, | 395 | idProveedor: $scope.remito.idProveedor, |
| 395 | idDomicilio: 0,//TODO | 396 | idDomicilio: 0,//TODO |
| 396 | idCotizacion: $scope.remito.idCotizacion, | 397 | idCotizacion: $scope.remito.idCotizacion, |
| 397 | flete: $scope.remito.flete, | 398 | flete: $scope.remito.flete, |
| 398 | fob: $scope.remito.fob, | 399 | fob: $scope.remito.fob, |
| 399 | bomba: $scope.remito.bomba, | 400 | bomba: $scope.remito.bomba, |
| 400 | kilometros: $scope.remito.kilometros, | 401 | kilometros: $scope.remito.kilometros, |
| 401 | estado: 0,//TODO | 402 | estado: 0,//TODO |
| 402 | destinoVenta: 0,//TODO | 403 | destinoVenta: 0,//TODO |
| 403 | operacionTipo: 0//TODO | 404 | operacionTipo: 0//TODO |
| 404 | }, | 405 | }, |
| 405 | notaPedido: $scope.notaPedido | 406 | notaPedido: $scope.notaPedido |
| 406 | }; | 407 | }; |
| 407 | crearRemitoService.crearRemito(save).then( | 408 | crearRemitoService.crearRemito(save).then( |
| 408 | function(data) { | 409 | function(data) { |
| 409 | remitoBusinessService.addArticulos($scope.articulosTabla, | 410 | remitoBusinessService.addArticulos($scope.articulosTabla, |
| 410 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 411 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
| 411 | 412 | ||
| 412 | focaModalService.alert('Nota remito creada'); | 413 | focaModalService.alert('Nota remito creada'); |
| 413 | $scope.cabecera = []; | 414 | $scope.cabecera = []; |
| 414 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); | 415 | addCabecera('Moneda:', $scope.remito.moneda.DETALLE); |
| 415 | addCabecera( | 416 | addCabecera( |
| 416 | 'Fecha cotizacion:', | 417 | 'Fecha cotizacion:', |
| 417 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 418 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
| 418 | ); | 419 | ); |
| 419 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 420 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
| 420 | $scope.remito.vendedor = {}; | 421 | $scope.remito.vendedor = {}; |
| 421 | $scope.remito.cliente = {}; | 422 | $scope.remito.cliente = {}; |
| 422 | $scope.remito.proveedor = {}; | 423 | $scope.remito.proveedor = {}; |
| 423 | $scope.remito.domicilio = {}; | 424 | $scope.remito.domicilio = {}; |
| 424 | $scope.remito.flete = null; | 425 | $scope.remito.flete = null; |
| 425 | $scope.remito.fob = null; | 426 | $scope.remito.fob = null; |
| 426 | $scope.remito.bomba = null; | 427 | $scope.remito.bomba = null; |
| 427 | $scope.remito.kilometros = null; | 428 | $scope.remito.kilometros = null; |
| 428 | $scope.articulosTabla = []; | 429 | $scope.articulosTabla = []; |
| 429 | crearRemitoService.getNumeroRemito().then( | 430 | crearRemitoService.getNumeroRemito().then( |
| 430 | function(res) { | 431 | function(res) { |
| 431 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 432 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
| 432 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 433 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
| 433 | }, | 434 | }, |
| 434 | function(err) { | 435 | function(err) { |
| 435 | focaModalService | 436 | focaModalService |
| 436 | .alert('La terminal no esta configurada correctamente'); | 437 | .alert('La terminal no esta configurada correctamente'); |
| 437 | console.info(err); | 438 | console.info(err); |
| 438 | } | 439 | } |
| 439 | ); | 440 | ); |
| 440 | 441 | ||
| 441 | $scope.notaPedido = { | 442 | $scope.notaPedido = { |
| 442 | id: 0 | 443 | id: 0 |
| 443 | }; | 444 | }; |
| 444 | } | 445 | } |
| 445 | ); | 446 | ); |
| 446 | }; | 447 | }; |
| 447 | 448 | ||
| 448 | $scope.seleccionarArticulo = function() { | 449 | $scope.seleccionarArticulo = function() { |
| 449 | if ($scope.idLista === undefined) { | 450 | if ($scope.idLista === undefined) { |
| 450 | focaModalService.alert( | 451 | focaModalService.alert( |
| 451 | 'Primero seleccione una lista de precio y condicion'); | 452 | 'Primero seleccione una lista de precio y condicion'); |
| 452 | return; | 453 | return; |
| 453 | } | 454 | } |
| 454 | var modalInstance = $uibModal.open( | 455 | var modalInstance = $uibModal.open( |
| 455 | { | 456 | { |
| 456 | ariaLabelledBy: 'Busqueda de Productos', | 457 | ariaLabelledBy: 'Busqueda de Productos', |
| 457 | templateUrl: 'modal-busqueda-productos.html', | 458 | templateUrl: 'modal-busqueda-productos.html', |
| 458 | controller: 'modalBusquedaProductosCtrl', | 459 | controller: 'modalBusquedaProductosCtrl', |
| 459 | resolve: { | 460 | resolve: { |
| 460 | parametroProducto: { | 461 | parametroProducto: { |
| 461 | idLista: $scope.idLista, | 462 | idLista: $scope.idLista, |
| 462 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 463 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
| 463 | simbolo: $scope.remito.moneda.simbolo | 464 | simbolo: $scope.remito.moneda.simbolo |
| 464 | } | 465 | } |
| 465 | }, | 466 | }, |
| 466 | size: 'lg' | 467 | size: 'lg' |
| 467 | } | 468 | } |
| 468 | ); | 469 | ); |
| 469 | modalInstance.result.then( | 470 | modalInstance.result.then( |
| 470 | function(producto) { | 471 | function(producto) { |
| 471 | var newArt = | 472 | var newArt = |
| 472 | { | 473 | { |
| 473 | id: 0, | 474 | id: 0, |
| 474 | codigo: producto.codigo, | 475 | codigo: producto.codigo, |
| 475 | sector: producto.sector, | 476 | sector: producto.sector, |
| 476 | sectorCodigo: producto.sector + '-' + producto.codigo, | 477 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 477 | descripcion: producto.descripcion, | 478 | descripcion: producto.descripcion, |
| 478 | item: $scope.articulosTabla.length + 1, | 479 | item: $scope.articulosTabla.length + 1, |
| 479 | nombre: producto.descripcion, | 480 | nombre: producto.descripcion, |
| 480 | precio: parseFloat(producto.precio.toFixed(4)), | 481 | precio: parseFloat(producto.precio.toFixed(4)), |
| 481 | costoUnitario: producto.costo, | 482 | costoUnitario: producto.costo, |
| 482 | editCantidad: false, | 483 | editCantidad: false, |
| 483 | editPrecio: false, | 484 | editPrecio: false, |
| 484 | rubro: producto.CodRub, | 485 | rubro: producto.CodRub, |
| 485 | exentoUnitario: producto.precio, | 486 | exentoUnitario: producto.precio, |
| 486 | ivaUnitario: producto.IMPIVA, | 487 | ivaUnitario: producto.IMPIVA, |
| 487 | impuestoInternoUnitario: producto.ImpInt, | 488 | impuestoInternoUnitario: producto.ImpInt, |
| 488 | impuestoInterno1Unitario: producto.ImpInt2, | 489 | impuestoInterno1Unitario: producto.ImpInt2, |
| 489 | impuestoInterno2Unitario: producto.ImpInt3, | 490 | impuestoInterno2Unitario: producto.ImpInt3, |
| 490 | precioLista: producto.precio, | 491 | precioLista: producto.precio, |
| 491 | combustible: 1, | 492 | combustible: 1, |
| 492 | facturado: 0 | 493 | facturado: 0 |
| 493 | }; | 494 | }; |
| 494 | $scope.articuloACargar = newArt; | 495 | $scope.articuloACargar = newArt; |
| 495 | $scope.cargando = false; | 496 | $scope.cargando = false; |
| 496 | }, function() { | 497 | }, function() { |
| 497 | // funcion ejecutada cuando se cancela el modal | 498 | // funcion ejecutada cuando se cancela el modal |
| 498 | } | 499 | } |
| 499 | ); | 500 | ); |
| 500 | }; | 501 | }; |
| 501 | 502 | ||
| 502 | $scope.seleccionarVendedor = function() { | 503 | $scope.seleccionarVendedor = function() { |
| 503 | var modalInstance = $uibModal.open( | 504 | var modalInstance = $uibModal.open( |
| 504 | { | 505 | { |
| 505 | ariaLabelledBy: 'Busqueda de Vendedores', | 506 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 506 | templateUrl: 'modal-vendedores.html', | 507 | templateUrl: 'modal-vendedores.html', |
| 507 | controller: 'modalVendedoresCtrl', | 508 | controller: 'modalVendedoresCtrl', |
| 508 | size: 'lg' | 509 | size: 'lg' |
| 509 | } | 510 | } |
| 510 | ); | 511 | ); |
| 511 | modalInstance.result.then( | 512 | modalInstance.result.then( |
| 512 | function(vendedor) { | 513 | function(vendedor) { |
| 513 | addCabecera('Vendedor:', vendedor.NomVen); | 514 | addCabecera('Vendedor:', vendedor.NomVen); |
| 514 | $scope.remito.idVendedor = vendedor.CodVen; | 515 | $scope.remito.idVendedor = vendedor.CodVen; |
| 515 | }, function() { | 516 | }, function() { |
| 516 | 517 | ||
| 517 | } | 518 | } |
| 518 | ); | 519 | ); |
| 519 | }; | 520 | }; |
| 520 | 521 | ||
| 521 | $scope.seleccionarProveedor = function() { | 522 | $scope.seleccionarProveedor = function() { |
| 522 | var modalInstance = $uibModal.open( | 523 | var modalInstance = $uibModal.open( |
| 523 | { | 524 | { |
| 524 | ariaLabelledBy: 'Busqueda de Proveedor', | 525 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 525 | templateUrl: 'modal-proveedor.html', | 526 | templateUrl: 'modal-proveedor.html', |
| 526 | controller: 'focaModalProveedorCtrl', | 527 | controller: 'focaModalProveedorCtrl', |
| 527 | size: 'lg', | 528 | size: 'lg', |
| 528 | resolve: { | 529 | resolve: { |
| 529 | transportista: function() { | 530 | transportista: function() { |
| 530 | return false; | 531 | return false; |
| 531 | } | 532 | } |
| 532 | } | 533 | } |
| 533 | } | 534 | } |
| 534 | ); | 535 | ); |
| 535 | modalInstance.result.then( | 536 | modalInstance.result.then( |
| 536 | function(proveedor) { | 537 | function(proveedor) { |
| 537 | $scope.remito.idProveedor = proveedor.COD; | 538 | $scope.remito.idProveedor = proveedor.COD; |
| 538 | addCabecera('Proveedor:', proveedor.NOM); | 539 | addCabecera('Proveedor:', proveedor.NOM); |
| 539 | }, function() { | 540 | }, function() { |
| 540 | 541 | ||
| 541 | } | 542 | } |
| 542 | ); | 543 | ); |
| 543 | }; | 544 | }; |
| 544 | 545 | ||
| 545 | $scope.seleccionarCliente = function() { | 546 | $scope.seleccionarCliente = function() { |
| 546 | 547 | ||
| 547 | var modalInstance = $uibModal.open( | 548 | var modalInstance = $uibModal.open( |
| 548 | { | 549 | { |
| 549 | ariaLabelledBy: 'Busqueda de Cliente', | 550 | ariaLabelledBy: 'Busqueda de Cliente', |
| 550 | templateUrl: 'foca-busqueda-cliente-modal.html', | 551 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 551 | controller: 'focaBusquedaClienteModalController', | 552 | controller: 'focaBusquedaClienteModalController', |
| 552 | size: 'lg' | 553 | size: 'lg' |
| 553 | } | 554 | } |
| 554 | ); | 555 | ); |
| 555 | modalInstance.result.then( | 556 | modalInstance.result.then( |
| 556 | function(cliente) { | 557 | function(cliente) { |
| 557 | $scope.abrirModalDomicilios(cliente); | 558 | $scope.abrirModalDomicilios(cliente); |
| 558 | }, function() { | 559 | }, function() { |
| 559 | 560 | ||
| 560 | } | 561 | } |
| 561 | ); | 562 | ); |
| 562 | }; | 563 | }; |
| 563 | 564 | ||
| 564 | $scope.abrirModalDomicilios = function(cliente) { | 565 | $scope.abrirModalDomicilios = function(cliente) { |
| 565 | var modalInstanceDomicilio = $uibModal.open( | 566 | var modalInstanceDomicilio = $uibModal.open( |
| 566 | { | 567 | { |
| 567 | ariaLabelledBy: 'Busqueda de Domicilios', | 568 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 568 | templateUrl: 'modal-domicilio.html', | 569 | templateUrl: 'modal-domicilio.html', |
| 569 | controller: 'focaModalDomicilioController', | 570 | controller: 'focaModalDomicilioController', |
| 570 | size: 'lg', | 571 | size: 'lg', |
| 571 | resolve: { idCliente: function() { return cliente.cod; }} | 572 | resolve: { idCliente: function() { return cliente.cod; }} |
| 572 | } | 573 | } |
| 573 | ); | 574 | ); |
| 574 | modalInstanceDomicilio.result.then( | 575 | modalInstanceDomicilio.result.then( |
| 575 | function(domicilio) { | 576 | function(domicilio) { |
| 576 | //$scope.remito.domicilio.id = domicilio.nivel2; | 577 | //$scope.remito.domicilio.id = domicilio.nivel2; |
| 577 | $scope.remito.cliente = { | 578 | $scope.remito.cliente = { |
| 578 | COD: cliente.cod, | 579 | COD: cliente.cod, |
| 579 | CUIT: cliente.cuit, | 580 | CUIT: cliente.cuit, |
| 580 | NOM: cliente.nom | 581 | NOM: cliente.nom |
| 581 | }; | 582 | }; |
| 582 | 583 | ||
| 583 | addCabecera('Cliente:', cliente.nom); | 584 | addCabecera('Cliente:', cliente.nom); |
| 584 | var domicilioStamp = | 585 | var domicilioStamp = |
| 585 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 586 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
| 586 | domicilio.Localidad + ', ' + domicilio.Provincia; | 587 | domicilio.Localidad + ', ' + domicilio.Provincia; |
| 587 | $scope.remito.domicilioStamp = domicilioStamp; | 588 | $scope.remito.domicilioStamp = domicilioStamp; |
| 588 | addCabecera('Domicilio:', domicilioStamp); | 589 | addCabecera('Domicilio:', domicilioStamp); |
| 589 | }, function() { | 590 | }, function() { |
| 590 | $scope.seleccionarCliente(); | 591 | $scope.seleccionarCliente(); |
| 591 | return; | 592 | return; |
| 592 | } | 593 | } |
| 593 | ); | 594 | ); |
| 594 | }; | 595 | }; |
| 595 | 596 | ||
| 596 | $scope.mostrarFichaCliente = function() { | 597 | $scope.mostrarFichaCliente = function() { |
| 597 | $uibModal.open( | 598 | $uibModal.open( |
| 598 | { | 599 | { |
| 599 | ariaLabelledBy: 'Datos del Cliente', | 600 | ariaLabelledBy: 'Datos del Cliente', |
| 600 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 601 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
| 601 | controller: 'focaCrearRemitoFichaClienteController', | 602 | controller: 'focaCrearRemitoFichaClienteController', |
| 602 | size: 'lg' | 603 | size: 'lg' |
| 603 | } | 604 | } |
| 604 | ); | 605 | ); |
| 605 | }; | 606 | }; |
| 606 | 607 | ||
| 607 | $scope.getTotal = function() { | 608 | $scope.getTotal = function() { |
| 608 | var total = 0; | 609 | var total = 0; |
| 609 | var arrayTempArticulos = $scope.articulosTabla; | 610 | var arrayTempArticulos = $scope.articulosTabla; |
| 610 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 611 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 611 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 612 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 612 | } | 613 | } |
| 613 | return parseFloat(total.toFixed(2)); | 614 | return parseFloat(total.toFixed(2)); |
| 614 | }; | 615 | }; |
| 615 | 616 | ||
| 616 | $scope.getSubTotal = function() { | 617 | $scope.getSubTotal = function() { |
| 617 | if($scope.articuloACargar) { | 618 | if($scope.articuloACargar) { |
| 618 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 619 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 619 | } | 620 | } |
| 620 | }; | 621 | }; |
| 621 | 622 | ||
| 622 | $scope.abrirModalListaPrecio = function() { | 623 | $scope.abrirModalListaPrecio = function() { |
| 623 | var modalInstance = $uibModal.open( | 624 | var modalInstance = $uibModal.open( |
| 624 | { | 625 | { |
| 625 | ariaLabelledBy: 'Busqueda de Precio Condición', | 626 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 626 | templateUrl: 'modal-precio-condicion.html', | 627 | templateUrl: 'modal-precio-condicion.html', |
| 627 | controller: 'focaModalPrecioCondicionController', | 628 | controller: 'focaModalPrecioCondicionController', |
| 628 | size: 'lg' | 629 | size: 'lg' |
| 629 | } | 630 | } |
| 630 | ); | 631 | ); |
| 631 | modalInstance.result.then( | 632 | modalInstance.result.then( |
| 632 | function(precioCondicion) { | 633 | function(precioCondicion) { |
| 633 | var cabecera = ''; | 634 | var cabecera = ''; |
| 634 | var plazosConcat = ''; | 635 | var plazosConcat = ''; |
| 635 | if(!Array.isArray(precioCondicion)) { | 636 | if(!Array.isArray(precioCondicion)) { |
| 636 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 637 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
| 637 | $scope.plazosPagos = precioCondicion.plazoPago; | 638 | $scope.plazosPagos = precioCondicion.plazoPago; |
| 638 | $scope.idLista = precioCondicion.idListaPrecio; | 639 | $scope.idLista = precioCondicion.idListaPrecio; |
| 639 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 640 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
| 640 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 641 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
| 641 | } | 642 | } |
| 642 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 643 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
| 643 | } else { //Cuando se ingresan los plazos manualmente | 644 | } else { //Cuando se ingresan los plazos manualmente |
| 644 | $scope.remito.idPrecioCondicion = 0; | 645 | $scope.remito.idPrecioCondicion = 0; |
| 645 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 646 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
| 646 | $scope.plazosPagos = precioCondicion; | 647 | $scope.plazosPagos = precioCondicion; |
| 647 | for(var j = 0; j < precioCondicion.length; j++) { | 648 | for(var j = 0; j < precioCondicion.length; j++) { |
| 648 | plazosConcat += precioCondicion[j].dias + ' '; | 649 | plazosConcat += precioCondicion[j].dias + ' '; |
| 649 | } | 650 | } |
| 650 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 651 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
| 651 | } | 652 | } |
| 652 | $scope.articulosTabla = []; | 653 | $scope.articulosTabla = []; |
| 653 | addCabecera('Precios y condiciones:', cabecera); | 654 | addCabecera('Precios y condiciones:', cabecera); |
| 654 | }, function() { | 655 | }, function() { |
| 655 | 656 | ||
| 656 | } | 657 | } |
| 657 | ); | 658 | ); |
| 658 | }; | 659 | }; |
| 659 | 660 | ||
| 660 | $scope.abrirModalFlete = function() { | 661 | $scope.abrirModalFlete = function() { |
| 661 | var modalInstance = $uibModal.open( | 662 | var modalInstance = $uibModal.open( |
| 662 | { | 663 | { |
| 663 | ariaLabelledBy: 'Busqueda de Flete', | 664 | ariaLabelledBy: 'Busqueda de Flete', |
| 664 | templateUrl: 'modal-flete.html', | 665 | templateUrl: 'modal-flete.html', |
| 665 | controller: 'focaModalFleteController', | 666 | controller: 'focaModalFleteController', |
| 666 | size: 'lg', | 667 | size: 'lg', |
| 667 | resolve: { | 668 | resolve: { |
| 668 | parametrosFlete: | 669 | parametrosFlete: |
| 669 | function() { | 670 | function() { |
| 670 | return { | 671 | return { |
| 671 | flete: $scope.remito.flete ? '1' : | 672 | flete: $scope.remito.flete ? '1' : |
| 672 | ($scope.remito.fob ? 'FOB' : | 673 | ($scope.remito.fob ? 'FOB' : |
| 673 | ($scope.remito.flete === undefined ? null : '0')), | 674 | ($scope.remito.flete === undefined ? null : '0')), |
| 674 | bomba: $scope.remito.bomba ? '1' : | 675 | bomba: $scope.remito.bomba ? '1' : |
| 675 | ($scope.remito.bomba === undefined ? null : '0'), | 676 | ($scope.remito.bomba === undefined ? null : '0'), |
| 676 | kilometros: $scope.remito.kilometros | 677 | kilometros: $scope.remito.kilometros |
| 677 | }; | 678 | }; |
| 678 | } | 679 | } |
| 679 | } | 680 | } |
| 680 | } | 681 | } |
| 681 | ); | 682 | ); |
| 682 | modalInstance.result.then( | 683 | modalInstance.result.then( |
| 683 | function(datos) { | 684 | function(datos) { |
| 684 | $scope.remito.flete = datos.flete; | 685 | $scope.remito.flete = datos.flete; |
| 685 | $scope.remito.fob = datos.FOB; | 686 | $scope.remito.fob = datos.FOB; |
| 686 | $scope.remito.bomba = datos.bomba; | 687 | $scope.remito.bomba = datos.bomba; |
| 687 | $scope.remito.kilometros = datos.kilometros; | 688 | $scope.remito.kilometros = datos.kilometros; |
| 688 | 689 | ||
| 689 | addCabecera('Flete:', datos.flete ? 'Si' : | 690 | addCabecera('Flete:', datos.flete ? 'Si' : |
| 690 | ($scope.remito.fob ? 'FOB' : 'No')); | 691 | ($scope.remito.fob ? 'FOB' : 'No')); |
| 691 | if(datos.flete) { | 692 | if(datos.flete) { |
| 692 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 693 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
| 693 | addCabecera('Kilometros:', datos.kilometros); | 694 | addCabecera('Kilometros:', datos.kilometros); |
| 694 | } else { | 695 | } else { |
| 695 | removeCabecera('Bomba:'); | 696 | removeCabecera('Bomba:'); |
| 696 | removeCabecera('Kilometros:'); | 697 | removeCabecera('Kilometros:'); |
| 697 | $scope.remito.fob = false; | 698 | $scope.remito.fob = false; |
| 698 | $scope.remito.bomba = false; | 699 | $scope.remito.bomba = false; |
| 699 | $scope.remito.kilometros = null; | 700 | $scope.remito.kilometros = null; |
| 700 | } | 701 | } |
| 701 | }, function() { | 702 | }, function() { |
| 702 | 703 | ||
| 703 | } | 704 | } |
| 704 | ); | 705 | ); |
| 705 | }; | 706 | }; |
| 706 | 707 | ||
| 707 | $scope.abrirModalMoneda = function() { | 708 | $scope.abrirModalMoneda = function() { |
| 708 | var modalInstance = $uibModal.open( | 709 | var modalInstance = $uibModal.open( |
| 709 | { | 710 | { |
| 710 | ariaLabelledBy: 'Busqueda de Moneda', | 711 | ariaLabelledBy: 'Busqueda de Moneda', |
| 711 | templateUrl: 'modal-moneda.html', | 712 | templateUrl: 'modal-moneda.html', |
| 712 | controller: 'focaModalMonedaController', | 713 | controller: 'focaModalMonedaController', |
| 713 | size: 'lg' | 714 | size: 'lg' |
| 714 | } | 715 | } |
| 715 | ); | 716 | ); |
| 716 | modalInstance.result.then( | 717 | modalInstance.result.then( |
| 717 | function(moneda) { | 718 | function(moneda) { |
| 718 | $scope.abrirModalCotizacion(moneda); | 719 | $scope.abrirModalCotizacion(moneda); |
| 719 | }, function() { | 720 | }, function() { |
| 720 | 721 | ||
| 721 | } | 722 | } |
| 722 | ); | 723 | ); |
| 723 | }; | 724 | }; |
| 724 | 725 | ||
| 725 | $scope.abrirModalCotizacion = function(moneda) { | 726 | $scope.abrirModalCotizacion = function(moneda) { |
| 726 | var modalInstance = $uibModal.open( | 727 | var modalInstance = $uibModal.open( |
| 727 | { | 728 | { |
| 728 | ariaLabelledBy: 'Busqueda de Cotización', | 729 | ariaLabelledBy: 'Busqueda de Cotización', |
| 729 | templateUrl: 'modal-cotizacion.html', | 730 | templateUrl: 'modal-cotizacion.html', |
| 730 | controller: 'focaModalCotizacionController', | 731 | controller: 'focaModalCotizacionController', |
| 731 | size: 'lg', | 732 | size: 'lg', |
| 732 | resolve: {idMoneda: function() {return moneda.ID;}} | 733 | resolve: {idMoneda: function() {return moneda.ID;}} |
| 733 | } | 734 | } |
| 734 | ); | 735 | ); |
| 735 | modalInstance.result.then( | 736 | modalInstance.result.then( |
| 736 | function(cotizacion) { | 737 | function(cotizacion) { |
| 737 | var articulosTablaTemp = $scope.articulosTabla; | 738 | var articulosTablaTemp = $scope.articulosTabla; |
| 738 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 739 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
| 739 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 740 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
| 740 | $scope.remito.cotizacion.COTIZACION; | 741 | $scope.remito.cotizacion.COTIZACION; |
| 741 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 742 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
| 742 | cotizacion.COTIZACION; | 743 | cotizacion.COTIZACION; |
| 743 | } | 744 | } |
| 744 | $scope.articulosTabla = articulosTablaTemp; | 745 | $scope.articulosTabla = articulosTablaTemp; |
| 745 | $scope.remito.moneda = { | 746 | $scope.remito.moneda = { |
| 746 | id: moneda.ID, | 747 | id: moneda.ID, |
| 747 | detalle: moneda.DETALLE, | 748 | detalle: moneda.DETALLE, |
| 748 | simbolo: moneda.SIMBOLO | 749 | simbolo: moneda.SIMBOLO |
| 749 | }; | 750 | }; |
| 750 | $scope.remito.cotizacion = { | 751 | $scope.remito.cotizacion = { |
| 751 | ID: cotizacion.ID, | 752 | ID: cotizacion.ID, |
| 752 | COTIZACION: cotizacion.COTIZACION, | 753 | COTIZACION: cotizacion.COTIZACION, |
| 753 | FECHA: cotizacion.FECHA | 754 | FECHA: cotizacion.FECHA |
| 754 | }; | 755 | }; |
| 755 | addCabecera('Moneda:', moneda.DETALLE); | 756 | addCabecera('Moneda:', moneda.DETALLE); |
| 756 | addCabecera( | 757 | addCabecera( |
| 757 | 'Fecha cotizacion:', | 758 | 'Fecha cotizacion:', |
| 758 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 759 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
| 759 | ); | 760 | ); |
| 760 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 761 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
| 761 | }, function() { | 762 | }, function() { |
| 762 | 763 | ||
| 763 | } | 764 | } |
| 764 | ); | 765 | ); |
| 765 | }; | 766 | }; |
| 766 | 767 | ||
| 767 | $scope.agregarATabla = function(key) { | 768 | $scope.agregarATabla = function(key) { |
| 768 | if(key === 13) { | 769 | if(key === 13) { |
| 769 | if($scope.articuloACargar.cantidad === undefined || | 770 | if($scope.articuloACargar.cantidad === undefined || |
| 770 | $scope.articuloACargar.cantidad === 0 || | 771 | $scope.articuloACargar.cantidad === 0 || |
| 771 | $scope.articuloACargar.cantidad === null ) { | 772 | $scope.articuloACargar.cantidad === null ) { |
| 772 | focaModalService.alert('El valor debe ser al menos 1'); | 773 | focaModalService.alert('El valor debe ser al menos 1'); |
| 773 | return; | 774 | return; |
| 774 | } | 775 | } |
| 775 | delete $scope.articuloACargar.sectorCodigo; | 776 | delete $scope.articuloACargar.sectorCodigo; |
| 776 | $scope.articulosTabla.push($scope.articuloACargar); | 777 | $scope.articulosTabla.push($scope.articuloACargar); |
| 777 | $scope.cargando = true; | 778 | $scope.cargando = true; |
| 778 | } | 779 | } |
| 779 | }; | 780 | }; |
| 780 | 781 | ||
| 781 | $scope.quitarArticulo = function(key) { | 782 | $scope.quitarArticulo = function(key) { |
| 782 | $scope.articulosTabla.splice(key, 1); | 783 | $scope.articulosTabla.splice(key, 1); |
| 783 | }; | 784 | }; |
| 784 | 785 | ||
| 785 | $scope.editarArticulo = function(key, articulo) { | 786 | $scope.editarArticulo = function(key, articulo) { |
| 786 | if(key === 13) { | 787 | if(key === 13) { |
| 787 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 788 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 788 | articulo.cantidad === undefined) { | 789 | articulo.cantidad === undefined) { |
| 789 | focaModalService.alert('El valor debe ser al menos 1'); | 790 | focaModalService.alert('El valor debe ser al menos 1'); |
| 790 | return; | 791 | return; |
| 791 | } | 792 | } |
| 792 | articulo.editCantidad = false; | 793 | articulo.editCantidad = false; |
| 793 | articulo.editPrecio = false; | 794 | articulo.editPrecio = false; |
| 794 | } | 795 | } |
| 795 | }; | 796 | }; |
| 796 | 797 | ||
| 797 | $scope.cambioEdit = function(articulo, propiedad) { | 798 | $scope.cambioEdit = function(articulo, propiedad) { |
| 798 | if(propiedad === 'cantidad') { | 799 | if(propiedad === 'cantidad') { |
| 799 | articulo.editCantidad = true; | 800 | articulo.editCantidad = true; |
| 800 | } else if(propiedad === 'precio') { | 801 | } else if(propiedad === 'precio') { |
| 801 | articulo.editPrecio = true; | 802 | articulo.editPrecio = true; |
| 802 | } | 803 | } |
| 803 | }; | 804 | }; |
| 804 | 805 | ||
| 805 | $scope.limpiarFlete = function() { | 806 | $scope.limpiarFlete = function() { |
| 806 | $scope.remito.fleteNombre = ''; | 807 | $scope.remito.fleteNombre = ''; |
| 807 | $scope.remito.chofer = ''; | 808 | $scope.remito.chofer = ''; |
| 808 | $scope.remito.vehiculo = ''; | 809 | $scope.remito.vehiculo = ''; |
| 809 | $scope.remito.kilometros = ''; | 810 | $scope.remito.kilometros = ''; |
| 810 | $scope.remito.costoUnitarioKmFlete = ''; | 811 | $scope.remito.costoUnitarioKmFlete = ''; |
| 811 | $scope.choferes = ''; | 812 | $scope.choferes = ''; |
| 812 | $scope.vehiculos = ''; | 813 | $scope.vehiculos = ''; |
| 813 | }; | 814 | }; |
| 814 | 815 | ||
| 815 | $scope.limpiarPantalla = function() { | 816 | $scope.limpiarPantalla = function() { |
| 816 | $scope.limpiarFlete(); | 817 | $scope.limpiarFlete(); |
| 817 | $scope.remito.flete = '0'; | 818 | $scope.remito.flete = '0'; |
| 818 | $scope.remito.bomba = '0'; | 819 | $scope.remito.bomba = '0'; |
| 819 | $scope.remito.precioCondicion = ''; | 820 | $scope.remito.precioCondicion = ''; |
| 820 | $scope.articulosTabla = []; | 821 | $scope.articulosTabla = []; |
| 821 | $scope.remito.vendedor.nombre = ''; | 822 | $scope.remito.vendedor.nombre = ''; |
| 822 | $scope.remito.cliente = {nombre: ''}; | 823 | $scope.remito.cliente = {nombre: ''}; |
| 823 | $scope.remito.domicilio = {dom: ''}; | 824 | $scope.remito.domicilio = {dom: ''}; |
| 824 | $scope.domiciliosCliente = []; | 825 | $scope.domiciliosCliente = []; |
| 825 | }; | 826 | }; |
| 826 | 827 | ||
| 827 | $scope.resetFilter = function() { | 828 | $scope.resetFilter = function() { |
| 828 | $scope.articuloACargar = {}; | 829 | $scope.articuloACargar = {}; |
| 829 | $scope.cargando = true; | 830 | $scope.cargando = true; |
| 830 | }; | 831 | }; |
| 831 | 832 | ||
| 832 | $scope.selectFocus = function($event) { | 833 | $scope.selectFocus = function($event) { |
| 833 | $event.target.select(); | 834 | $event.target.select(); |
| 834 | }; | 835 | }; |
| 835 | 836 | ||
| 836 | $scope.salir = function() { | 837 | $scope.salir = function() { |
| 837 | $location.path('/'); | 838 | $location.path('/'); |
| 838 | }; | 839 | }; |
| 839 | function addArrayCabecera(array) { | 840 | function addArrayCabecera(array) { |
| 840 | for(var i = 0; i < array.length; i++) { | 841 | for(var i = 0; i < array.length; i++) { |
| 841 | addCabecera(array[i].label, array[i].valor); | 842 | addCabecera(array[i].label, array[i].valor); |
| 842 | } | 843 | } |
| 843 | } | 844 | } |
| 844 | 845 | ||
| 845 | function addCabecera(label, valor) { | 846 | function addCabecera(label, valor) { |
| 846 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 847 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 847 | if(propiedad.length === 1) { | 848 | if(propiedad.length === 1) { |
| 848 | propiedad[0].valor = valor; | 849 | propiedad[0].valor = valor; |
| 849 | } else { | 850 | } else { |
| 850 | $scope.cabecera.push({label: label, valor: valor}); | 851 | $scope.cabecera.push({label: label, valor: valor}); |
| 851 | } | 852 | } |
| 852 | } | 853 | } |
| 853 | 854 | ||
| 854 | function removeCabecera(label) { | 855 | function removeCabecera(label) { |
| 855 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 856 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
| 856 | if(propiedad.length === 1) { | 857 | if(propiedad.length === 1) { |
| 857 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 858 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 858 | } | 859 | } |
| 859 | } | 860 | } |
| 860 | 861 | ||
| 861 | function rellenar(relleno, longitud) { | 862 | function rellenar(relleno, longitud) { |
| 862 | relleno = '' + relleno; | 863 | relleno = '' + relleno; |
| 863 | while (relleno.length < longitud) { | 864 | while (relleno.length < longitud) { |
| 864 | relleno = '0' + relleno; | 865 | relleno = '0' + relleno; |
| 865 | } | 866 | } |
| 866 | 867 | ||
| 867 | return relleno; | 868 | return relleno; |
| 868 | } | 869 | } |
| 869 | } | 870 | } |
| 870 | ] | 871 | ] |
| 871 | ) | 872 | ) |
| 872 | .controller('remitoListaCtrl', [ | 873 | .controller('remitoListaCtrl', [ |
| 873 | '$scope', | 874 | '$scope', |
| 874 | 'crearRemitoService', | 875 | 'crearRemitoService', |
| 875 | '$location', | 876 | '$location', |
| 876 | function($scope, crearRemitoService, $location) { | 877 | function($scope, crearRemitoService, $location) { |
| 877 | crearRemitoService.obtenerRemito().then(function(datos) { | 878 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 878 | $scope.remitos = datos.data; | 879 | $scope.remitos = datos.data; |
| 879 | }); | 880 | }); |
| 880 | $scope.editar = function(remito) { | 881 | $scope.editar = function(remito) { |
| 881 | crearRemitoService.setRemito(remito); | 882 | crearRemitoService.setRemito(remito); |
| 882 | $location.path('/venta-nota-remito/abm/'); | 883 | $location.path('/venta-nota-remito/abm/'); |
| 883 | }; | 884 | }; |
| 884 | $scope.crearRemito = function() { | 885 | $scope.crearRemito = function() { |
| 885 | crearRemitoService.clearRemito(); | 886 | crearRemitoService.clearRemito(); |
| 886 | $location.path('/venta-nota-remito/abm/'); | 887 | $location.path('/venta-nota-remito/abm/'); |
| 887 | }; | 888 | }; |
| 888 | } | 889 | } |
| 889 | ]) | 890 | ]) |
| 890 | .controller('focaCrearRemitoFichaClienteController', [ | 891 | .controller('focaCrearRemitoFichaClienteController', [ |
| 891 | '$scope', | 892 | '$scope', |
| 892 | 'crearRemitoService', | 893 | 'crearRemitoService', |
| 893 | '$location', | 894 | '$location', |
| 894 | function($scope, crearRemitoService, $location) { | 895 | function($scope, crearRemitoService, $location) { |
| 895 | crearRemitoService.obtenerRemito().then(function(datos) { | 896 | crearRemitoService.obtenerRemito().then(function(datos) { |
| 896 | $scope.remitos = datos.data; | 897 | $scope.remitos = datos.data; |
| 897 | }); | 898 | }); |
| 898 | $scope.editar = function(remito) { | 899 | $scope.editar = function(remito) { |
| 899 | crearRemitoService.setRemito(remito); | 900 | crearRemitoService.setRemito(remito); |
| 900 | $location.path('/venta-nota-remito/abm/'); | 901 | $location.path('/venta-nota-remito/abm/'); |
| 901 | }; | 902 | }; |
| 902 | $scope.crearRemito = function() { | 903 | $scope.crearRemito = function() { |
| 903 | crearRemitoService.clearRemito(); | 904 | crearRemitoService.clearRemito(); |
| 904 | $location.path('/venta-nota-remito/abm/'); | 905 | $location.path('/venta-nota-remito/abm/'); |
| 905 | }; | 906 | }; |
| 906 | } | 907 | } |
| 907 | ]); | 908 | ]); |
| 908 | 909 |
src/views/remito.html
| 1 | <div class="crear-nota-remito"> | 1 | <div class="crear-nota-remito"> |
| 2 | <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0"> | 2 | <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0"> |
| 3 | <div class="row"> | 3 | <div class="row"> |
| 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
| 5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
| 6 | <div class="col-12"> | 6 | <div class="col-12"> |
| 7 | <div class="row"> | 7 | <div class="row"> |
| 8 | <div class="col-12 col-sm-4 nota-remito"> | 8 | <div class="col-12 col-sm-4 nota-remito"> |
| 9 | <h5>REMITO</h5> | 9 | <h5>REMITO</h5> |
| 10 | </div> | 10 | </div> |
| 11 | <div class="col-5 col-sm-4 numero-remito" | 11 | <div class="col-5 col-sm-4 numero-remito" |
| 12 | > | 12 | > |
| 13 | Nº {{puntoVenta}}-{{comprobante}} | 13 | Nº {{puntoVenta}}-{{comprobante}} |
| 14 | <button | 14 | <button |
| 15 | class="btn btn-xs btn-outline-dark" | 15 | class="btn btn-xs btn-outline-dark" |
| 16 | type="button" | 16 | type="button" |
| 17 | ng-click="seleccionarRemito()" | 17 | ng-click="seleccionarRemito()" |
| 18 | > | 18 | > |
| 19 | <i class="fa fa-search"></i> | 19 | <i class="fa fa-search"></i> |
| 20 | </button> | 20 | </button> |
| 21 | </div> | 21 | </div> |
| 22 | <div class="col-7 col-sm-4 text-right"> | 22 | <div class="col-7 col-sm-4 text-right"> |
| 23 | Fecha: | 23 | Fecha: |
| 24 | <span | 24 | <span |
| 25 | ng-show="!datepickerAbierto" | 25 | ng-show="!datepickerAbierto" |
| 26 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | 26 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" |
| 27 | ng-click="datepickerAbierto = true" | 27 | ng-click="datepickerAbierto = true" |
| 28 | > | 28 | > |
| 29 | </span> | 29 | </span> |
| 30 | <input | 30 | <input |
| 31 | ng-show="datepickerAbierto" | 31 | ng-show="datepickerAbierto" |
| 32 | type="date" | 32 | type="date" |
| 33 | ng-model="now" | 33 | ng-model="now" |
| 34 | ng-change="datepickerAbierto = false" | 34 | ng-change="datepickerAbierto = false" |
| 35 | ng-blur="datepickerAbierto = false" | 35 | ng-blur="datepickerAbierto = false" |
| 36 | class="form-control form-control-sm col-8 float-right" | 36 | class="form-control form-control-sm col-8 float-right" |
| 37 | foca-focus="datepickerAbierto" | 37 | foca-focus="datepickerAbierto" |
| 38 | hasta-hoy | 38 | hasta-hoy |
| 39 | /> | 39 | /> |
| 40 | </div> | 40 | </div> |
| 41 | </div> | 41 | </div> |
| 42 | <div class="row"> | 42 | <div class="row"> |
| 43 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 43 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
| 44 | <span class="label" ng-bind="cab.label"></span> | 44 | <span class="label" ng-bind="cab.label"></span> |
| 45 | <span class="valor" ng-bind="cab.valor"></span> | 45 | <span class="valor" ng-bind="cab.valor"></span> |
| 46 | </div> | 46 | </div> |
| 47 | <a | 47 | <a |
| 48 | class="btn col-12 btn-secondary d-sm-none" | 48 | class="btn col-12 btn-secondary d-sm-none" |
| 49 | ng-show="cabecera.length > 0" | 49 | ng-show="cabecera.length > 0" |
| 50 | ng-click="showCabecera = !showCabecera" | 50 | ng-click="showCabecera = !showCabecera" |
| 51 | > | 51 | > |
| 52 | <i | 52 | <i |
| 53 | class="fa fa-chevron-down" | 53 | class="fa fa-chevron-down" |
| 54 | ng-hide="showCabecera" | 54 | ng-hide="showCabecera" |
| 55 | aria-hidden="true" | 55 | aria-hidden="true" |
| 56 | > | 56 | > |
| 57 | </i> | 57 | </i> |
| 58 | <i | 58 | <i |
| 59 | class="fa fa-chevron-up" | 59 | class="fa fa-chevron-up" |
| 60 | ng-show="showCabecera" | 60 | ng-show="showCabecera" |
| 61 | aria-hidden="true"> | 61 | aria-hidden="true"> |
| 62 | </i> | 62 | </i> |
| 63 | </a> | 63 | </a> |
| 64 | </div> | 64 | </div> |
| 65 | </div> | 65 | </div> |
| 66 | </div> | 66 | </div> |
| 67 | <div class="row p-1 botonera-secundaria"> | 67 | <div class="row p-1 botonera-secundaria"> |
| 68 | <div class="col-12"> | 68 | <div class="col-12"> |
| 69 | <div class="row"> | 69 | <div class="row"> |
| 70 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 70 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
| 71 | <button | 71 | <button |
| 72 | type="button" | 72 | type="button" |
| 73 | class="btn btn-default btn-block btn-xs text-left py-2" | 73 | class="btn btn-default btn-block btn-xs text-left py-2" |
| 74 | ng-click="boton.accion()" | 74 | ng-click="boton.accion()" |
| 75 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 75 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
| 76 | > | 76 | > |
| 77 | <i | 77 | <i |
| 78 | class="fa fa-arrow-circle-right" | 78 | class="fa fa-arrow-circle-right" |
| 79 | ng-show="boton.texto != ''" | 79 | ng-show="boton.texto != ''" |
| 80 | ></i> | 80 | ></i> |
| 81 | | 81 | |
| 82 | {{boton.texto}} | 82 | {{boton.texto}} |
| 83 | </button> | 83 | </button> |
| 84 | </div> | 84 | </div> |
| 85 | </div> | 85 | </div> |
| 86 | </div> | 86 | </div> |
| 87 | </div> | 87 | </div> |
| 88 | </div> | 88 | </div> |
| 89 | </div> | 89 | </div> |
| 90 | </form> | 90 | </form> |
| 91 | <div class="row"> | 91 | <div class="row"> |
| 92 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 92 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
| 93 | <!-- PC --> | 93 | <!-- PC --> |
| 94 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 94 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
| 95 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 95 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
| 96 | <thead> | 96 | <thead> |
| 97 | <tr class="d-flex"> | 97 | <tr class="d-flex"> |
| 98 | <th class="">#</th> | 98 | <th class="">#</th> |
| 99 | <th class="col">Código</th> | 99 | <th class="col">Código</th> |
| 100 | <th class="col-4">Descripción</th> | 100 | <th class="col-4">Descripción</th> |
| 101 | <th class="col text-right">Cantidad</th> | 101 | <th class="col text-right">Cantidad</th> |
| 102 | <th class="col text-right">Precio Unitario</th> | 102 | <th class="col text-right">Precio Unitario</th> |
| 103 | <th class="col text-right">SubTotal</th> | 103 | <th class="col text-right">SubTotal</th> |
| 104 | <th class="text-right"> | 104 | <th class="text-right"> |
| 105 | <button | 105 | <button |
| 106 | class="btn btn-outline-secondary selectable" | 106 | class="btn btn-outline-secondary selectable" |
| 107 | ng-click="show = !show; masMenos()" | 107 | ng-click="show = !show; masMenos()" |
| 108 | > | 108 | > |
| 109 | <i | 109 | <i |
| 110 | class="fa fa-chevron-down" | 110 | class="fa fa-chevron-down" |
| 111 | ng-show="show" | 111 | ng-show="show" |
| 112 | aria-hidden="true" | 112 | aria-hidden="true" |
| 113 | > | 113 | > |
| 114 | </i> | 114 | </i> |
| 115 | <i | 115 | <i |
| 116 | class="fa fa-chevron-up" | 116 | class="fa fa-chevron-up" |
| 117 | ng-hide="show" | 117 | ng-hide="show" |
| 118 | aria-hidden="true"> | 118 | aria-hidden="true"> |
| 119 | </i> | 119 | </i> |
| 120 | </button> | 120 | </button> |
| 121 | </th> | 121 | </th> |
| 122 | </tr> | 122 | </tr> |
| 123 | </thead> | 123 | </thead> |
| 124 | <tbody class="tabla-articulo-body"> | 124 | <tbody class="tabla-articulo-body"> |
| 125 | <tr | 125 | <tr |
| 126 | ng-repeat="(key, articulo) in articulosTabla" | 126 | ng-repeat="(key, articulo) in articulosTabla" |
| 127 | ng-show="show || key == (articulosTabla.length - 1)" | 127 | ng-show="show || key == (articulosTabla.length - 1)" |
| 128 | class="d-flex" | 128 | class="d-flex" |
| 129 | > | 129 | > |
| 130 | <td ng-bind="key + 1"></td> | 130 | <td ng-bind="key + 1"></td> |
| 131 | <td | 131 | <td |
| 132 | class="col" | 132 | class="col" |
| 133 | ng-bind="articulo.sector + '-' + articulo.codigo" | 133 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 134 | ></td> | 134 | ></td> |
| 135 | <td | 135 | <td |
| 136 | class="col-4" | 136 | class="col-4" |
| 137 | ng-bind="articulo.descripcion" | 137 | ng-bind="articulo.descripcion" |
| 138 | ></td> | 138 | ></td> |
| 139 | <td class="col text-right"> | 139 | <td class="col text-right"> |
| 140 | <input | 140 | <input |
| 141 | ng-show="articulo.editCantidad" | 141 | ng-show="articulo.editCantidad" |
| 142 | ng-model="articulo.cantidad" | 142 | ng-model="articulo.cantidad" |
| 143 | class="form-control" | 143 | class="form-control" |
| 144 | type="number" | 144 | foca-tipo-input |
| 145 | min="1" | 145 | min="1" |
| 146 | foca-focus="articulo.editCantidad" | 146 | foca-focus="articulo.editCantidad" |
| 147 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 147 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 148 | ng-focus="selectFocus($event)" | 148 | ng-focus="selectFocus($event)" |
| 149 | teclado-virtual | ||
| 149 | > | 150 | > |
| 150 | <i | 151 | <i |
| 151 | class="selectable" | 152 | class="selectable" |
| 152 | ng-click="cambioEdit(articulo, 'cantidad')" | 153 | ng-click="cambioEdit(articulo, 'cantidad')" |
| 153 | ng-hide="articulo.editCantidad" | 154 | ng-hide="articulo.editCantidad" |
| 154 | ng-bind="articulo.cantidad"> | 155 | ng-bind="articulo.cantidad"> |
| 155 | </i> | 156 | </i> |
| 156 | </td> | 157 | </td> |
| 157 | <td class="col text-right"> | 158 | <td class="col text-right"> |
| 158 | <input | 159 | <input |
| 159 | ng-show="articulo.editPrecio" | 160 | ng-show="articulo.editPrecio" |
| 160 | ng-model="articulo.precio" | 161 | ng-model="articulo.precio" |
| 161 | class="form-control" | 162 | class="form-control" |
| 162 | type="number" | 163 | foca-tipo-input |
| 163 | min="1" | 164 | min="1" |
| 164 | step="0.0001" | 165 | step="0.0001" |
| 165 | foca-focus="articulo.editPrecio" | 166 | foca-focus="articulo.editPrecio" |
| 166 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 167 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 167 | ng-focus="selectFocus($event)" | 168 | ng-focus="selectFocus($event)" |
| 169 | teclado-virtual | ||
| 168 | > | 170 | > |
| 169 | <i | 171 | <i |
| 170 | class="selectable" | 172 | class="selectable" |
| 171 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 173 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
| 172 | ng-hide="articulo.editPrecio" | 174 | ng-hide="articulo.editPrecio" |
| 173 | ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> | 175 | ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> |
| 174 | </i> | 176 | </i> |
| 175 | </td> | 177 | </td> |
| 176 | <td | 178 | <td |
| 177 | class="col text-right" | 179 | class="col text-right" |
| 178 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> | 180 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> |
| 179 | </td> | 181 | </td> |
| 180 | <td class="text-center"> | 182 | <td class="text-center"> |
| 181 | <button | 183 | <button |
| 182 | class="btn btn-outline-secondary" | 184 | class="btn btn-outline-secondary" |
| 183 | ng-click="quitarArticulo(key)" | 185 | ng-click="quitarArticulo(key)" |
| 184 | > | 186 | > |
| 185 | <i class="fa fa-trash"></i> | 187 | <i class="fa fa-trash"></i> |
| 186 | </button> | 188 | </button> |
| 187 | </td> | 189 | </td> |
| 188 | </tr> | 190 | </tr> |
| 189 | </tbody> | 191 | </tbody> |
| 190 | <tfoot> | 192 | <tfoot> |
| 191 | <tr ng-show="!cargando" class="d-flex"> | 193 | <tr ng-show="!cargando" class="d-flex"> |
| 192 | <td | 194 | <td |
| 193 | class="align-middle" | 195 | class="align-middle" |
| 194 | ng-bind="articulosTabla.length + 1" | 196 | ng-bind="articulosTabla.length + 1" |
| 195 | ></td> | 197 | ></td> |
| 196 | <td class="col"> | 198 | <td class="col"> |
| 197 | <input | 199 | <input |
| 198 | class="form-control" | 200 | class="form-control" |
| 199 | ng-model="articuloACargar.sectorCodigo" | 201 | ng-model="articuloACargar.sectorCodigo" |
| 200 | readonly | 202 | readonly |
| 201 | > | 203 | > |
| 202 | </td> | 204 | </td> |
| 203 | <td class="col-4 tabla-articulo-descripcion"> | 205 | <td class="col-4 tabla-articulo-descripcion"> |
| 204 | <input | 206 | <input |
| 205 | class="form-control" | 207 | class="form-control" |
| 206 | ng-model="articuloACargar.descripcion" | 208 | ng-model="articuloACargar.descripcion" |
| 207 | readonly | 209 | readonly |
| 208 | > | 210 | > |
| 209 | </td> | 211 | </td> |
| 210 | <td class="col text-right"> | 212 | <td class="col text-right"> |
| 211 | <input | 213 | <input |
| 212 | class="form-control" | 214 | class="form-control" |
| 213 | type="number" | 215 | foca-tipo-input |
| 214 | min="1" | 216 | min="1" |
| 215 | ng-model="articuloACargar.cantidad" | 217 | ng-model="articuloACargar.cantidad" |
| 216 | foca-focus="!cargando" | 218 | foca-focus="!cargando" |
| 217 | esc-key="resetFilter()" | 219 | esc-key="resetFilter()" |
| 218 | ng-keypress="agregarATabla($event.keyCode)" | 220 | ng-keypress="agregarATabla($event.keyCode)" |
| 221 | teclado-virtual | ||
| 219 | > | 222 | > |
| 220 | </td> | 223 | </td> |
| 221 | <td class="col text-right"> | 224 | <td class="col text-right"> |
| 222 | <input | 225 | <input |
| 223 | class="form-control" | 226 | class="form-control" |
| 224 | ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" | 227 | ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" |
| 225 | ng-show="idLista != -1" | 228 | ng-show="idLista != -1" |
| 226 | readonly | 229 | readonly |
| 227 | > | 230 | > |
| 228 | <input | 231 | <input |
| 229 | class="form-control" | 232 | class="form-control" |
| 230 | type="number" | 233 | foca-tipo-input |
| 231 | step="0.0001" | 234 | step="0.0001" |
| 232 | ng-model="articuloACargar.precio" | 235 | ng-model="articuloACargar.precio" |
| 233 | esc-key="resetFilter()" | 236 | esc-key="resetFilter()" |
| 234 | ng-keypress="agregarATabla($event.keyCode)" | 237 | ng-keypress="agregarATabla($event.keyCode)" |
| 235 | ng-show="idLista == -1" | 238 | ng-show="idLista == -1" |
| 239 | teclado-virtual | ||
| 236 | > | 240 | > |
| 237 | </td> | 241 | </td> |
| 238 | <td class="col text-right"> | 242 | <td class="col text-right"> |
| 239 | <input | 243 | <input |
| 240 | class="form-control" | 244 | class="form-control" |
| 241 | ng-value="getSubTotal() | currency: remito.moneda.simbolo" | 245 | ng-value="getSubTotal() | currency: remito.moneda.simbolo" |
| 242 | readonly | 246 | readonly |
| 243 | ></td> | 247 | ></td> |
| 244 | <td class="text-center align-middle"> | 248 | <td class="text-center align-middle"> |
| 245 | <button | 249 | <button |
| 246 | class="btn btn-outline-secondary" | 250 | class="btn btn-outline-secondary" |
| 247 | ng-click="agregarATabla(13)" | 251 | ng-click="agregarATabla(13)" |
| 248 | > | 252 | > |
| 249 | <i class="fa fa-save"></i> | 253 | <i class="fa fa-save"></i> |
| 250 | </button> | 254 | </button> |
| 251 | </td> | 255 | </td> |
| 252 | </tr> | 256 | </tr> |
| 253 | <tr ng-show="cargando" class="d-flex"> | 257 | <tr ng-show="cargando" class="d-flex"> |
| 254 | <td colspan="7" class="col-12"> | 258 | <td colspan="7" class="col-12"> |
| 255 | <input | 259 | <input |
| 256 | placeholder="Seleccione Articulo" | 260 | placeholder="Seleccione Articulo" |
| 257 | class="form-control form-control-sm" | 261 | class="form-control form-control-sm" |
| 258 | readonly | 262 | readonly |
| 259 | ng-click="seleccionarArticulo()" | 263 | ng-click="seleccionarArticulo()" |
| 260 | /> | 264 | /> |
| 261 | </td> | 265 | </td> |
| 262 | </tr> | 266 | </tr> |
| 263 | <tr class="d-flex"> | 267 | <tr class="d-flex"> |
| 264 | <td colspan="4" class="no-border-top"> | 268 | <td colspan="4" class="no-border-top"> |
| 265 | <strong>Items:</strong> | 269 | <strong>Items:</strong> |
| 266 | <a ng-bind="articulosTabla.length"></a> | 270 | <a ng-bind="articulosTabla.length"></a> |
| 267 | </td> | 271 | </td> |
| 268 | <td class="text-right ml-auto table-celda-total no-border-top"> | 272 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 269 | <h3>Total:</h3> | 273 | <h3>Total:</h3> |
| 270 | </td> | 274 | </td> |
| 271 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 275 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 272 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | 276 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> |
| 273 | </td> | 277 | </td> |
| 274 | <td class="text-right no-border-top"> | 278 | <td class="text-right no-border-top"> |
| 275 | <button | 279 | <button |
| 276 | type="button" | 280 | type="button" |
| 277 | class="btn btn-default btn-sm" | 281 | class="btn btn-default btn-sm" |
| 278 | > | 282 | > |
| 279 | Totales | 283 | Totales |
| 280 | </button> | 284 | </button> |
| 281 | </td> | 285 | </td> |
| 282 | </tr> | 286 | </tr> |
| 283 | </tfoot> | 287 | </tfoot> |
| 284 | </table> | 288 | </table> |
| 285 | </div> | 289 | </div> |
| 286 | 290 | ||
| 287 | <!-- MOBILE --> | 291 | <!-- MOBILE --> |
| 288 | <div class="row d-sm-none"> | 292 | <div class="row d-sm-none"> |
| 289 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | 293 | <table class="table table-sm table-striped table-dark margin-bottom-mobile"> |
| 290 | <thead> | 294 | <thead> |
| 291 | <tr class="d-flex"> | 295 | <tr class="d-flex"> |
| 292 | <th class="">#</th> | 296 | <th class="">#</th> |
| 293 | <th class="col px-0"> | 297 | <th class="col px-0"> |
| 294 | <div class="d-flex"> | 298 | <div class="d-flex"> |
| 295 | <div class="col-4 px-1">Código</div> | 299 | <div class="col-4 px-1">Código</div> |
| 296 | <div class="col-8 px-1">Descripción</div> | 300 | <div class="col-8 px-1">Descripción</div> |
| 297 | </div> | 301 | </div> |
| 298 | <div class="d-flex"> | 302 | <div class="d-flex"> |
| 299 | <div class="col-3 px-1">Cantidad</div> | 303 | <div class="col-3 px-1">Cantidad</div> |
| 300 | <div class="col px-1 text-right">P. Uni.</div> | 304 | <div class="col px-1 text-right">P. Uni.</div> |
| 301 | <div class="col px-1 text-right">Subtotal</div> | 305 | <div class="col px-1 text-right">Subtotal</div> |
| 302 | </div> | 306 | </div> |
| 303 | </th> | 307 | </th> |
| 304 | <th class="text-center tamaño-boton"> | 308 | <th class="text-center tamaño-boton"> |
| 305 | | 309 | |
| 306 | </th> | 310 | </th> |
| 307 | </tr> | 311 | </tr> |
| 308 | </thead> | 312 | </thead> |
| 309 | <tbody> | 313 | <tbody> |
| 310 | <tr | 314 | <tr |
| 311 | ng-repeat="(key, articulo) in articulosTabla" | 315 | ng-repeat="(key, articulo) in articulosTabla" |
| 312 | ng-show="show || key == articulosTabla.length - 1" | 316 | ng-show="show || key == articulosTabla.length - 1" |
| 313 | > | 317 | > |
| 314 | <td class="w-100 align-middle d-flex p-0"> | 318 | <td class="w-100 align-middle d-flex p-0"> |
| 315 | <div class="align-middle p-1"> | 319 | <div class="align-middle p-1"> |
| 316 | <span ng-bind="key+1" class="align-middle"></span> | 320 | <span ng-bind="key+1" class="align-middle"></span> |
| 317 | </div> | 321 | </div> |
| 318 | <div class="col px-0"> | 322 | <div class="col px-0"> |
| 319 | <div class="d-flex"> | 323 | <div class="d-flex"> |
| 320 | <div class="col-4 px-1"> | 324 | <div class="col-4 px-1"> |
| 321 | <span | 325 | <span |
| 322 | ng-bind="articulo.sector + '-' + articulo.codigo" | 326 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 323 | ></span> | 327 | ></span> |
| 324 | </div> | 328 | </div> |
| 325 | <div class="col-8 px-1"> | 329 | <div class="col-8 px-1"> |
| 326 | <span ng-bind="articulo.descripcion"></span> | 330 | <span ng-bind="articulo.descripcion"></span> |
| 327 | </div> | 331 | </div> |
| 328 | </div> | 332 | </div> |
| 329 | <div class="d-flex"> | 333 | <div class="d-flex"> |
| 330 | <div class="col-3 px-1"> | 334 | <div class="col-3 px-1"> |
| 331 | <span ng-bind="'x' + articulo.cantidad"></span> | 335 | <span ng-bind="'x' + articulo.cantidad"></span> |
| 332 | </div> | 336 | </div> |
| 333 | <div class="col-3 px-1 text-right"> | 337 | <div class="col-3 px-1 text-right"> |
| 334 | <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> | 338 | <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> |
| 335 | </div> | 339 | </div> |
| 336 | <div class="col px-1 text-right"> | 340 | <div class="col px-1 text-right"> |
| 337 | <span | 341 | <span |
| 338 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" | 342 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" |
| 339 | > | 343 | > |
| 340 | </span> | 344 | </span> |
| 341 | </div> | 345 | </div> |
| 342 | </div> | 346 | </div> |
| 343 | </div> | 347 | </div> |
| 344 | <div class="align-middle p-1"> | 348 | <div class="align-middle p-1"> |
| 345 | <button | 349 | <button |
| 346 | class="btn btn-outline-secondary" | 350 | class="btn btn-outline-secondary" |
| 347 | ng-click="quitarArticulo(key)" | 351 | ng-click="quitarArticulo(key)" |
| 348 | > | 352 | > |
| 349 | <i class="fa fa-trash"></i> | 353 | <i class="fa fa-trash"></i> |
| 350 | </button> | 354 | </button> |
| 351 | </div> | 355 | </div> |
| 352 | </td> | 356 | </td> |
| 353 | </tr> | 357 | </tr> |
| 354 | </tbody> | 358 | </tbody> |
| 355 | <tfoot> | 359 | <tfoot> |
| 356 | <!-- CARGANDO ITEM --> | 360 | <!-- CARGANDO ITEM --> |
| 357 | <tr ng-show="!cargando" class="d-flex"> | 361 | <tr ng-show="!cargando" class="d-flex"> |
| 358 | <td | 362 | <td |
| 359 | class="align-middle p-1" | 363 | class="align-middle p-1" |
| 360 | ng-bind="articulosTabla.length + 1" | 364 | ng-bind="articulosTabla.length + 1" |
| 361 | ></td> | 365 | ></td> |
| 362 | <td class="col p-0"> | 366 | <td class="col p-0"> |
| 363 | <div class="d-flex"> | 367 | <div class="d-flex"> |
| 364 | <div class="col-4 px-1"> | 368 | <div class="col-4 px-1"> |
| 365 | <span | 369 | <span |
| 366 | ng-bind="articuloACargar.sectorCodigo" | 370 | ng-bind="articuloACargar.sectorCodigo" |
| 367 | ></span> | 371 | ></span> |
| 368 | </div> | 372 | </div> |
| 369 | <div class="col-8 px-1"> | 373 | <div class="col-8 px-1"> |
| 370 | <span ng-bind="articuloACargar.descripcion"></span> | 374 | <span ng-bind="articuloACargar.descripcion"></span> |
| 371 | </div> | 375 | </div> |
| 372 | </div> | 376 | </div> |
| 373 | <div class="d-flex"> | 377 | <div class="d-flex"> |
| 374 | <div class="col-3 px-1 m-1"> | 378 | <div class="col-3 px-1 m-1"> |
| 375 | <input | 379 | <input |
| 376 | class="form-control p-1" | 380 | class="form-control p-1" |
| 377 | type="number" | 381 | foca-tipo-input |
| 378 | min="1" | 382 | min="1" |
| 379 | ng-model="articuloACargar.cantidad" | 383 | ng-model="articuloACargar.cantidad" |
| 380 | foca-focus="!cargando" | 384 | foca-focus="!cargando" |
| 381 | ng-keypress="agregarATabla($event.keyCode)" | 385 | ng-keypress="agregarATabla($event.keyCode)" |
| 382 | style="height: auto; line-height: 1.1em" | 386 | style="height: auto; line-height: 1.1em" |
| 383 | > | 387 | > |
| 384 | </div> | 388 | </div> |
| 385 | <div class="col-3 px-1 text-right"> | 389 | <div class="col-3 px-1 text-right"> |
| 386 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> | 390 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> |
| 387 | </div> | 391 | </div> |
| 388 | <div class="col px-1 text-right"> | 392 | <div class="col px-1 text-right"> |
| 389 | <span | 393 | <span |
| 390 | ng-bind="getSubTotal() | currency: remito.moneda.simbolo" | 394 | ng-bind="getSubTotal() | currency: remito.moneda.simbolo" |
| 391 | > | 395 | > |
| 392 | </span> | 396 | </span> |
| 393 | </div> | 397 | </div> |
| 394 | </div> | 398 | </div> |
| 395 | </td> | 399 | </td> |
| 396 | <td class="text-center align-middle"> | 400 | <td class="text-center align-middle"> |
| 397 | <button | 401 | <button |
| 398 | class="btn btn-outline-secondary" | 402 | class="btn btn-outline-secondary" |
| 399 | ng-click="agregarATabla(13)" | 403 | ng-click="agregarATabla(13)" |
| 400 | > | 404 | > |
| 401 | <i class="fa fa-save"></i> | 405 | <i class="fa fa-save"></i> |
| 402 | </button> | 406 | </button> |
| 403 | </td> | 407 | </td> |
| 404 | </tr> | 408 | </tr> |
| 405 | <!-- SELECCIONAR PRODUCTO --> | 409 | <!-- SELECCIONAR PRODUCTO --> |
| 406 | <tr ng-show="cargando" class="d-flex"> | 410 | <tr ng-show="cargando" class="d-flex"> |
| 407 | <td class="col-12"> | 411 | <td class="col-12"> |
| 408 | <input | 412 | <input |
| 409 | placeholder="Seleccione Articulo" | 413 | placeholder="Seleccione Articulo" |
| 410 | class="form-control form-control-sm" | 414 | class="form-control form-control-sm" |
| 411 | readonly | 415 | readonly |
| 412 | ng-click="seleccionarArticulo()" | 416 | ng-click="seleccionarArticulo()" |
| 413 | /> | 417 | /> |
| 414 | </td> | 418 | </td> |
| 415 | </tr> | 419 | </tr> |
| 416 | <!-- TOOGLE EXPANDIR --> | 420 | <!-- TOOGLE EXPANDIR --> |
| 417 | <tr> | 421 | <tr> |
| 418 | <td class="col"> | 422 | <td class="col"> |
| 419 | <button | 423 | <button |
| 420 | class="btn btn-outline-secondary selectable w-100" | 424 | class="btn btn-outline-secondary selectable w-100" |
| 421 | ng-click="show = !show; masMenos()" | 425 | ng-click="show = !show; masMenos()" |
| 422 | ng-show="articulosTabla.length > 0" | 426 | ng-show="articulosTabla.length > 0" |
| 423 | > | 427 | > |
| 424 | <i | 428 | <i |
| 425 | class="fa fa-chevron-down" | 429 | class="fa fa-chevron-down" |
| 426 | ng-hide="show" | 430 | ng-hide="show" |
| 427 | aria-hidden="true" | 431 | aria-hidden="true" |
| 428 | > | 432 | > |
| 429 | </i> | 433 | </i> |
| 430 | <i | 434 | <i |
| 431 | class="fa fa-chevron-up" | 435 | class="fa fa-chevron-up" |
| 432 | ng-show="show" | 436 | ng-show="show" |
| 433 | aria-hidden="true"> | 437 | aria-hidden="true"> |
| 434 | </i> | 438 | </i> |
| 435 | </button> | 439 | </button> |
| 436 | </td> | 440 | </td> |
| 437 | </tr> | 441 | </tr> |
| 438 | <!-- FOOTER --> | 442 | <!-- FOOTER --> |
| 439 | <tr class="d-flex"> | 443 | <tr class="d-flex"> |
| 440 | <td class="align-middle no-border-top" colspan="2"> | 444 | <td class="align-middle no-border-top" colspan="2"> |
| 441 | <strong>Cantidad Items:</strong> | 445 | <strong>Cantidad Items:</strong> |
| 442 | <a ng-bind="articulosTabla.length"></a> | 446 | <a ng-bind="articulosTabla.length"></a> |
| 443 | </td> | 447 | </td> |
| 444 | <td class="text-right ml-auto table-celda-total no-border-top"> | 448 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 445 | <h3>Total:</h3> | 449 | <h3>Total:</h3> |
| 446 | </td> | 450 | </td> |
| 447 | <td class="table-celda-total text-right no-border-top"> | 451 | <td class="table-celda-total text-right no-border-top"> |
| 448 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | 452 | <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> |
| 449 | </td> | 453 | </td> |
| 450 | </tr> | 454 | </tr> |
| 451 | </tfoot> | 455 | </tfoot> |
| 452 | </table> | 456 | </table> |
| 453 | </div> | 457 | </div> |
| 454 | </div> | 458 | </div> |
| 455 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | 459 | <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> |
| 456 | <div class="row align-items-end"> | 460 | <div class="row align-items-end"> |
| 457 | <div class="col-12"> | 461 | <div class="col-12"> |
| 458 | <button | 462 | <button |
| 459 | ng-click="crearRemito()" | 463 | ng-click="crearRemito()" |
| 460 | type="submit" | 464 | type="submit" |
| 461 | title="Crear nota remito" | 465 | title="Crear nota remito" |
| 462 | class="btn btn-default btn-block mb-2"> | 466 | class="btn btn-default btn-block mb-2"> |
| 463 | Guardar | 467 | Guardar |
| 464 | </button> | 468 | </button> |
| 465 | <button | 469 | <button |
| 466 | ng-click="salir()" | 470 | ng-click="salir()" |
| 467 | type="button" | 471 | type="button" |
| 468 | title="Salir" | 472 | title="Salir" |
| 469 | class="btn btn-default btn-block"> | 473 | class="btn btn-default btn-block"> |
| 470 | Salir | 474 | Salir |
| 471 | </button> | 475 | </button> |
| 472 | </div> | 476 | </div> |
| 473 | </div> | 477 | </div> |
| 474 | </div> | 478 | </div> |
| 475 | </div> | 479 | </div> |
| 476 | <div class="row d-md-none fixed-bottom"> | 480 | <div class="row d-md-none fixed-bottom"> |
| 477 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 481 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
| 478 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 482 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
| 479 | <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> | 483 | <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> |
| 480 | </div> | 484 | </div> |
| 481 | </div> | 485 | </div> |
| 482 | </div> | 486 | </div> |
| 483 | 487 |