示例#1
0
        protected void cmbProducto_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            try
            {
                //verificar que el producto este el segmento
                if (false)
                {
                }
                else
                {
                    Sesion      sesion = (Sesion)Session["Sesion" + Session.SessionID];
                    RadComboBox combo  = (RadComboBox)sender;
                    //obtiene la tabla contenedora de los controles de edición de registro del Grid
                    Telerik.Web.UI.GridTableCell tabla    = (Telerik.Web.UI.GridTableCell)combo.Parent;
                    RadTextBox        txtPrd_Descripcion  = (RadTextBox)tabla.FindControl("txtPrd_Descripcion");
                    RadTextBox        txtPrd_Presentacion = (RadTextBox)tabla.FindControl("txtPrd_Presentacion");
                    RadTextBox        txtPrd_UniNe        = (RadTextBox)tabla.FindControl("txtPrd_UniNe");
                    RadNumericTextBox txtNcr_Cantidad     = (RadNumericTextBox)tabla.FindControl("txtNcr_Cantidad");
                    RadNumericTextBox txtNcr_Precio       = (RadNumericTextBox)tabla.FindControl("txtNcr_Precio");
                    RadComboBoxItem   item = ((RadComboBox)sender).FindItemByValue(e.Value);
                    int id_Cd_Prod         = sesion.Id_Cd_Ver;// Convert.ToInt32(((Label)item.FindControl("lblLiCd")).Text);

                    Producto producto = null;
                    if (e.Value != string.Empty && e.Value != "-1")
                    {
                        //obtener datos de producto
                        CN_CatProducto clsProducto = new CN_CatProducto();
                        clsProducto.ConsultaProducto(ref producto, sesion.Emp_Cnx, sesion.Id_Emp, id_Cd_Prod, sesion.Id_Cd_Ver, Convert.ToInt32(e.Value));


                        //Finalmente introduce el precio de producto aceptado para la partida
                        txtNcr_Precio.Text = "";
                    }
                    txtPrd_Descripcion.Text  = producto == null ? string.Empty : producto.Prd_Descripcion;
                    txtPrd_Presentacion.Text = producto == null ? string.Empty : producto.Prd_Presentacion;
                    txtPrd_UniNe.Text        = producto == null ? string.Empty : producto.Prd_UniNe;

                    //este evento es porque se elige producto, por lo que
                    //se habilita el campo de cantidad porque ya eligió producto y se estableció las unidades de empaque
                    txtNcr_Cantidad.Enabled = true;
                    txtNcr_Cantidad.Text    = string.Empty;

                    txtPrd_Descripcion.Focus();
                    //Limpiar controles de compras locales
                    //combo.Items[0].FindControl("liComprasLocales").Controls.Clear();
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
示例#2
0
        protected void cmbProducto_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            try
            {
                //verificar que el producto este el segmento
                if (false)
                {
                }
                else
                {
                    RadComboBox combo = (RadComboBox)sender;
                    //obtiene la tabla contenedora de los controles de edición de registro del Grid
                    Telerik.Web.UI.GridTableCell tabla = (Telerik.Web.UI.GridTableCell)combo.Parent;

                    RadTextBox        txtPrd_Descripcion  = (RadTextBox)tabla.FindControl("txtPrd_Descripcion");
                    RadTextBox        txtPrd_Presentacion = (RadTextBox)tabla.FindControl("txtPrd_Presentacion");
                    RadTextBox        txtPrd_UniNe        = (RadTextBox)tabla.FindControl("txtPrd_UniNe");
                    RadNumericTextBox txtRem_Cantidad     = (RadNumericTextBox)tabla.FindControl("txtRem_Cantidad");
                    RadNumericTextBox txtRem_Precio       = (RadNumericTextBox)tabla.FindControl("txtRem_Precio");

                    Sesion          sesion     = (Sesion)Session["Sesion" + Session.SessionID];
                    RadComboBoxItem item       = ((RadComboBox)sender).FindItemByValue(e.Value);
                    int             id_Cd_Prod = sesion.Id_Cd_Ver;

                    Producto producto = new Producto();
                    if (e.Value != string.Empty && e.Value != "-1")
                    {
                        //obtener datos de producto
                        CN_CatProducto clsProducto = new CN_CatProducto();
                        clsProducto.ConsultaProducto(ref producto, sesion.Emp_Cnx, sesion.Id_Emp, id_Cd_Prod, sesion.Id_Cd_Ver, Convert.ToInt32(e.Value));
                    }
                    txtRem_Precio.Text       = "";
                    txtPrd_Descripcion.Text  = producto == null ? string.Empty : producto.Prd_Descripcion;
                    txtPrd_Presentacion.Text = producto == null ? string.Empty : producto.Prd_Presentacion;
                    txtPrd_UniNe.Text        = producto == null ? string.Empty : producto.Prd_UniNe;

                    //este evento es porque se elige producto, por lo que
                    //se habilita el campo de cantidad porque ya eligió producto y se estableció las unidades de empaque
                    txtRem_Cantidad.Enabled = true;
                    txtRem_Cantidad.Text    = string.Empty;

                    txtPrd_Descripcion.Focus();
                }
            }
            catch (Exception ex)
            {
                this.DisplayMensajeAlerta(string.Concat(ex.Message, "cmbProducto_IndexChanging_error"));
            }
        }
        protected void rcmbFac_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            try
            {
                RadComboBox rcmbFac = (sender as RadComboBox);
                Telerik.Web.UI.GridTableCell tabla   = (Telerik.Web.UI.GridTableCell)rcmbFac.Parent;
                RadNumericTextBox            txtFact = tabla.FindControl("txtFact") as RadNumericTextBox;
                RadTextBox        txtCte             = tabla.FindControl("txtCte") as RadTextBox;
                RadNumericTextBox txtImporte         = tabla.FindControl("txtImporte") as RadNumericTextBox;

                Factura factura = new Factura();
                factura.Id_Cd  = this.sesion.Id_Cd_Ver;
                factura.Id_Emp = this.sesion.Id_Emp;
                if (txtFact.Text != string.Empty)
                {
                    factura.Id_Fac = Convert.ToInt32(txtFact.Text);
                }
                else
                {
                    factura.Id_Fac = 0;
                }

                CN_CapFactura CNCapFactura = new CN_CapFactura();
                try
                {
                    CNCapFactura.BuscaFacturaRuta(ref factura, sesion.Emp_Cnx);
                }
                catch (Exception ex)
                {
                    txtFact.Text    = "";
                    txtCte.Text     = "";
                    txtImporte.Text = "";
                    AlertaFocus(ex.Message, txtFact.ClientID);
                    return;
                }
                txtCte.Text     = factura.Cte_NomComercial;
                txtImporte.Text = factura.Fac_Importe.ToString();

                txtCte.ReadOnly     = true;
                txtImporte.ReadOnly = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        private void ConsultaDatosDocumento(object sender)
        {
            try
            {
                Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID];
                Telerik.Web.UI.GridTableCell tabla = new Telerik.Web.UI.GridTableCell();

                if (sender is RadNumericTextBox)
                {
                    tabla = (Telerik.Web.UI.GridTableCell)((RadNumericTextBox)sender).Parent;
                }
                if (sender is RadComboBox)
                {
                    tabla = (Telerik.Web.UI.GridTableCell)((RadComboBox)sender).Parent;
                }

                //obtiene la tabla contenedora de los controles de edición de registro del Grid
                RadDatePicker     txtFva_Fecha       = ((RadDatePicker)tabla.FindControl("txtFva_Fecha"));
                Label             lblId_CteEdit      = ((Label)tabla.FindControl("lblId_CteEdit"));
                Label             lblId_CteStrEdit   = ((Label)tabla.FindControl("lblId_CteStrEdit"));
                RadNumericTextBox txtFva_ImporteEdit = ((RadNumericTextBox)tabla.FindControl("txtFva_ImporteEdit"));
                Label             lblVal_Fva_DiaRev  = ((Label)tabla.FindControl("lblVal_Fva_DiaRev"));

                txtFva_Fecha.SelectedDate = null;
                lblId_CteEdit.Text        = string.Empty;
                lblId_CteStrEdit.Text     = string.Empty;
                txtFva_ImporteEdit.Text   = string.Empty;
                lblVal_Fva_DiaRev.Text    = string.Empty;

                RadNumericTextBox txtFva_Doc = ((RadNumericTextBox)tabla.FindControl("txtFva_Doc"));
                if (string.IsNullOrEmpty(txtFva_Doc.Text))
                {
                    //this.DisplayMensajeAlerta("FacturaSvtaAlmacenDet_IntroducirNumDocumento");
                    txtFva_Doc.Focus();
                }
                else
                {
                    bool    encontrado = false;
                    Factura factura    = new Factura();
                    factura.Id_Emp = sesion.Id_Emp;
                    factura.Id_Cd  = sesion.Id_Cd_Ver;
                    factura.Id_Fac = Convert.ToInt32(txtFva_Doc.Text);
                    new CN_CapFacturaSvtaAlmacen().ConsultaFacturaEncabezado(ref factura, sesion.Emp_Cnx, ref encontrado);

                    if (encontrado)
                    {
                        if (factura.Fac_Saldo <= 0)
                        {
                            txtFva_Doc.Text = string.Empty;
                            txtFva_Doc.Focus();
                            this.DisplayMensajeAlerta("MovFacRevCobro_NoSaldo");
                        }
                        else
                        {
                            if (factura.Fac_Estatus.ToUpper() != "B" && factura.Fac_Estatus.ToUpper() != "C")
                            {
                                txtFva_Fecha.SelectedDate = factura.Fac_Fecha;
                                lblId_CteEdit.Text        = factura.Id_Cte.ToString();
                                lblId_CteStrEdit.Text     = factura.Cte_NomComercial;
                                txtFva_ImporteEdit.Text   = factura.Fac_Saldo.ToString();
                                lblVal_Fva_DiaRev.Text    = factura.Fac_Notas.ToString();
                            }
                            else
                            {
                                txtFva_Doc.Text = string.Empty;
                                txtFva_Doc.Focus();
                                this.DisplayMensajeAlerta("MovFacRevCobro_EstatusInvalido");
                            }
                        }
                    }
                    else
                    {
                        this.DisplayMensajeAlerta("FacturaSvtaAlmacenDet_DocNoEncontrado");
                        txtFva_Doc.Text = string.Empty;
                        txtFva_Doc.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        protected void txtId_Rem_TextChanged(object sender, EventArgs e)
        {
            Sesion   sesion   = (Sesion)Session["Sesion" + Session.SessionID];
            Remision remision = new Remision();

            RadNumericTextBox txtId_Rem = (RadNumericTextBox)sender;

            remision.Id_Emp = sesion.Id_Emp;
            remision.Id_Cd  = sesion.Id_Cd_Ver;
            remision.Id_Rem = Convert.ToInt32(txtId_Rem.Text);
            CN_CapRemision cn_remision = new CN_CapRemision();


            Telerik.Web.UI.GridTableCell tabla = (Telerik.Web.UI.GridTableCell)txtId_Rem.Parent;
            //limpia los datos de la remision
            txtId_Rem.Text = string.Empty;
            ((Label)tabla.FindControl("lblRem_FechaEdit")).Text      = string.Empty;
            ((Label)tabla.FindControl("lblId_CteEdit")).Text         = string.Empty;
            ((Label)tabla.FindControl("lblNombreClienteEdit")).Text  = string.Empty;
            ((Label)tabla.FindControl("lblRem_EstatusEdit")).Text    = string.Empty;
            ((Label)tabla.FindControl("lblRem_EstatusStrEdit")).Text = string.Empty;

            //validar remision
            if (cn_remision.ConsultaRemisionFacturacion(ref remision, sesion.Emp_Cnx))//si encuentra la remision
            {
                if (remision.Rem_Estatus.ToUpper() == "B")
                {
                    this.DisplayMensajeAlerta("RemisionEstatusBaja");
                }
                else
                {
                    if (remision.Rem_Estatus.ToUpper() == "C")
                    {
                        this.DisplayMensajeAlerta("RemisionEstatusCapturado");
                    }
                    else
                    {
                        //calcular producto pendiente a facturar.
                        int cantidadPendienteFacturar = 0;

                        if (remision.ListRemisionDetalle.Count > 0)
                        {
                            foreach (RemisionDet remisionDet in remision.ListRemisionDetalle)
                            {
                                if (remisionDet.Rem_CantF == null)
                                {
                                    cantidadPendienteFacturar += remisionDet.Rem_Cant;// -Convert.ToInt32(remisionDet.Rem_CantF);
                                }
                                else
                                {
                                    if (remisionDet.Rem_Cant > Convert.ToInt32(remisionDet.Rem_CantF))
                                    {
                                        cantidadPendienteFacturar += remisionDet.Rem_Cant - Convert.ToInt32(remisionDet.Rem_CantF);
                                    }
                                }
                            }
                        }
                        if (cantidadPendienteFacturar > 0)
                        {
                            txtId_Rem.Text = remision.Id_Rem.ToString();
                            ((Label)tabla.FindControl("lblRem_FechaEdit")).Text      = remision.Rem_Fecha.ToShortDateString();
                            ((Label)tabla.FindControl("lblId_CteEdit")).Text         = remision.Id_Cte.ToString();
                            ((Label)tabla.FindControl("lblNombreClienteEdit")).Text  = remision.NombreCliente;
                            ((Label)tabla.FindControl("lblRem_EstatusEdit")).Text    = remision.Rem_Estatus;
                            ((Label)tabla.FindControl("lblRem_EstatusStrEdit")).Text = remision.Rem_EstatusStr;
                        }
                        else
                        {
                            this.DisplayMensajeAlerta("RemisionNoProdPendienteFacturar");
                        }
                    }
                }
            }
            else
            {
                this.DisplayMensajeAlerta("RemisionNoExiste");
            }
        }