private void ValidarPrecioUnitario(FeaEntidades.InterFacturas.linea l, TextBox txtprecio_unitario) { string auxprecio_unitario = txtprecio_unitario.Text; if (!auxprecio_unitario.Equals(string.Empty) && !auxprecio_unitario.Equals("0")) { try { double auxPU = Convert.ToDouble(auxprecio_unitario, cedeiraCultura); l.precio_unitario = auxPU; l.precio_unitarioSpecified = true; } catch { throw new Exception("El precio unitario tiene más de un separador de decimales"); } } else { if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.BonoFiscal(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta rg2904 = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV2904 = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(rg2904); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV)) { throw new Exception("El precio unitario es obligatorio para bono fiscal"); } else if (listaPV2904.Contains(auxPV)) { l.precio_unitario = 0; l.precio_unitarioSpecified = true; } else { l.precio_unitario = 0; l.precio_unitarioSpecified = false; } } else { l.precio_unitario = 0; l.precio_unitarioSpecified = false; } } else { l.precio_unitario = 0; l.precio_unitarioSpecified = false; } } }
private void ValidarUnidad(FeaEntidades.InterFacturas.linea l, DropDownList ddlunidad) { string auxUnidad = ddlunidad.SelectedItem.Value; if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { int auxPV = Convert.ToInt32(puntoDeVenta); CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta; tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); if (listaPV.Contains(auxPV) && auxUnidad.Equals("99")) { throw new Exception("La unidad BONIFICACIÓN no se admite para RG2904"); } tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.BonoFiscal(); listaPV.AddRange(((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta)); if (listaPV.Contains(auxPV)) { if (auxUnidad.Equals(string.Empty) || auxUnidad.Equals("0")) { throw new Exception("La unidad es obligatoria para bono fiscal y para RG2904"); } else { l.unidad = auxUnidad; } } else { l.unidad = auxUnidad; } } else { l.unidad = auxUnidad; } } else { l.unidad = auxUnidad; } }
private void ValidarAlicuotaIVA(FeaEntidades.InterFacturas.linea l, DropDownList ddl) { double auxAliIVA = Convert.ToDouble(ddl.SelectedValue); string auxDescAliIVA = ddl.SelectedItem.Text; if (!auxDescAliIVA.Equals(string.Empty)) { if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV) && !auxAliIVA.Equals(0) && (l.indicacion_exento_gravado.Equals("N") || l.indicacion_exento_gravado.Equals("E"))) { throw new Exception("La alicuota iva debe ser 0% para RG2904 cuando está exento o no está gravado el artículo"); } else { l.alicuota_ivaSpecified = true; l.alicuota_iva = auxAliIVA; } } else { l.alicuota_ivaSpecified = true; l.alicuota_iva = auxAliIVA; } } else { l.alicuota_ivaSpecified = true; l.alicuota_iva = auxAliIVA; } } else { if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.BonoFiscal(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); listaPV.AddRange(((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta)); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV)) { throw new Exception("La alicuota iva es obligatoria para bono fiscal y RG2904"); } else { l.alicuota_ivaSpecified = false; l.alicuota_iva = new FeaEntidades.IVA.SinInformar().Codigo; } } else { l.alicuota_ivaSpecified = false; l.alicuota_iva = new FeaEntidades.IVA.SinInformar().Codigo; } } else { l.alicuota_ivaSpecified = false; l.alicuota_iva = new FeaEntidades.IVA.SinInformar().Codigo; } } }
private void ValidarImporteIVA(FeaEntidades.InterFacturas.linea l, TextBox txtimporte_alicuota_articulo) { string auxNull = txtimporte_alicuota_articulo.Text; if (!auxNull.Equals(string.Empty) && !auxNull.Equals("0")) { try { double auxImporteIVA = Convert.ToDouble(auxNull, cedeiraCultura); l.importe_ivaSpecified = true; l.importe_iva = auxImporteIVA; } catch { throw new Exception("El importe IVA tiene más de un separador de decimales"); } } else { if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV)) { l.importe_ivaSpecified = true; l.importe_iva = 0; } else { l.importe_ivaSpecified = false; l.importe_iva = 0; } } else { l.importe_ivaSpecified = false; l.importe_iva = 0; } } else { l.importe_ivaSpecified = false; l.importe_iva = 0; } } }
private void ValidarGTIN(FeaEntidades.InterFacturas.linea l, TextBox txtGTIN) { string auxGTIN = txtGTIN.Text; if (!auxGTIN.Equals(string.Empty) && !auxGTIN.Equals("0")) { try { long auxNroGTIN = Convert.ToInt64(auxGTIN, cedeiraCultura); if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV)) { if (auxGTIN.Length > 13) { throw new Exception("La longitud del GTIN debe ser menor o igual a 13 dígitos para RG2904"); } else { l.GTIN = auxNroGTIN; l.GTINSpecified = true; } } else { if (auxGTIN.Length > 20) { throw new Exception("La longitud del GTIN debe ser menor o igual a 20 dígitos"); } else { l.GTIN = auxNroGTIN; l.GTINSpecified = true; } } } else { l.GTIN = auxNroGTIN; l.GTINSpecified = true; } } else { l.GTIN = auxNroGTIN; l.GTINSpecified = true; } } catch (System.OverflowException) { throw new Exception("Longitud no válida para GTIN"); } } else { if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium((CedWebEntidades.Sesion)Session["Sesion"])) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = ((CedWebEntidades.Sesion)Session["Sesion"]).Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV) && l.unidad!="97") { throw new Exception("El GTIN es obligatorio para RG2904 si la unidad de medida es distinta a 'Anticipos/Señas'"); } else { l.GTIN = 0; l.GTINSpecified = false; } } else { l.GTIN = 0; l.GTINSpecified = false; } } else { l.GTIN = 0; l.GTINSpecified = false; } } }
protected void RecalcularLinea(TextBox txtimporte_alicuota_articulo, string puntoDeVenta, CedWebEntidades.Sesion sesion, TextBox txtimporte_total_articulo, DropDownList ddl, TextBox txtprecio_unitario, TextBox txtcantidad) { double preUni; try { preUni = Convert.ToDouble(txtprecio_unitario.Text); } catch { preUni = 0; } double cant; try { cant = Convert.ToDouble(txtcantidad.Text); } catch { cant = 0; } if (!preUni.Equals(0) && !cant.Equals(0)) { txtimporte_total_articulo.Text = Convert.ToString(Math.Round(preUni * cant, 2)); } double imptot = Convert.ToDouble(txtimporte_total_articulo.Text); double alic = Convert.ToDouble(ddl.SelectedValue); if (!imptot.Equals(0) && !alic.Equals(99)) { double aux = imptot * alic / 100; txtimporte_alicuota_articulo.Text = Convert.ToString(Math.Round(aux, 2)); } if (alic.Equals(99)) { txtimporte_alicuota_articulo.Text = string.Empty; } if (CedWebRN.Fun.EstaLogueadoUnUsuarioPremium(sesion)) { if (!puntoDeVenta.Equals(string.Empty)) { CedWebEntidades.TiposPuntoDeVenta.TipoPuntoDeVenta tipoPuntoDeVenta = new CedWebEntidades.TiposPuntoDeVenta.RG2904(); System.Collections.Generic.List<int> listaPV = sesion.Cuenta.Vendedor.PuntosDeVentaHabilitados(tipoPuntoDeVenta); int auxPV = Convert.ToInt32(puntoDeVenta); if (listaPV.Contains(auxPV)) { txtimporte_total_articulo.Text = Convert.ToString(Convert.ToDouble(txtimporte_total_articulo.Text) + Convert.ToDouble(txtimporte_alicuota_articulo.Text)); } } } }