Пример #1
0
        protected void txtIdCte_OnTextChanged(object sender, EventArgs e)
        {
            try
            {
                RadNumericTextBox txt        = (RadNumericTextBox)sender;
                RadComboBox       Cmb_Id_Cte = (RadComboBox)txt.Parent.FindControl("Cmb_Id_Cte");
                RadComboBox       Cmb_Id_Ter = (RadComboBox)txt.Parent.FindControl("Cmb_Id_Ter");
                RadNumericTextBox txtIdTer   = (RadNumericTextBox)txt.Parent.FindControl("txtIdTer");

                if (txt.Text.Contains("-") | txt.Text == "0")
                {
                    txt.Text = "";
                    return;
                }
                Cmb_Id_Cte.SelectedValue = txt.Text;
                //cargar territorio del cliente a txtIdTer y Cmb_Id_Ter, despues de escribir en txtIdCte:
                Sesion Sesion = new Sesion();
                Sesion = (Sesion)Session["Sesion" + Session.SessionID];
                CapaNegocios.CN__Comun CN_Comun = new CapaNegocios.CN__Comun();
                CN_Comun.LlenaCombo(Sesion.Id_Emp, Sesion.Id_Cd_Ver, Convert.ToInt32(txt.Text), Sesion.Emp_Cnx, "spCatTerritorioCte_Combo", ref Cmb_Id_Ter);

                if (Cmb_Id_Ter.SelectedValue != "-1")
                {
                    txtIdTer.Text = Cmb_Id_Ter.SelectedValue;
                }

                txtIdTer.Focus();
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Пример #2
0
        protected void txtTerritorio_TextChanged(object sender, EventArgs e)
        {
            RadNumericTextBox txtcliente = ((sender as RadNumericTextBox).Parent.FindControl("txtIdCte") as RadNumericTextBox);

            txtCliente_TextChanged(txtcliente, null);
            txtcliente.Focus();
        }
        protected void rgDetalles_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
            {
                GridEditableItem editItem = (GridEditableItem)e.Item;
                this.rgDetalles.Columns.FindByUniqueName("EditCommandColumn").Visible = true;
                RadComboBox       rcmbFac = editItem.FindControl("rcbSerie") as RadComboBox;
                RadNumericTextBox txtFact = editItem.FindControl("txtFact") as RadNumericTextBox;
                new CN__Comun().LlenaCombo(sesion.Id_Emp, sesion.Id_Cd_Ver, sesion.Emp_Cnx, "spConsecutivos_Combo", ref rcmbFac);

                Control insertbtn = (Control)editItem.FindControl("PerformInsertButton");
                if (insertbtn != null)
                {
                    txtFact.Enabled = true;
                    (e.Item.FindControl("txtFact") as RadNumericTextBox).Enabled = true;
                }
            }
            else
            if (e.Item.IsDataBound)
            {
                GridDataItem item = (GridDataItem)e.Item;
                item["EditCommandColumn"].Controls[0].Visible = false;
            }
            //TODO: AGREGAR PARA PONER EL FOCUS
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem  form      = (GridEditableItem)e.Item;
                RadNumericTextBox dataField = (RadNumericTextBox)form["Factura"].FindControl("txtFact");
                dataField.Focus();
            }
        }
Пример #4
0
 protected void rg1_ItemDataBound(object sender, GridItemEventArgs e)
 {
     //TODO: AGREGAR PARA PONER EL FOCUS
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
         GridEditableItem  form      = (GridEditableItem)e.Item;
         RadNumericTextBox dataField = (RadNumericTextBox)form["Id_Ter"].FindControl("txtIdTer");
         if (!dataField.Enabled)
         {
             dataField = (RadNumericTextBox)form["Id_Cte"].FindControl("txtIdCte");
         }
         dataField.Focus();
     }
 }
Пример #5
0
        protected void FecIni_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        {
            try
            {
                Sesion Sesion = new Sesion();
                Sesion = (Sesion)Session["Sesion" + Session.SessionID];

                RadDatePicker     rdp_FecIni      = sender as RadDatePicker;
                RadDatePicker     rdp_FecVigencia = (rdp_FecIni.Parent.FindControl("rdp_FecVigencia") as RadDatePicker);
                RadNumericTextBox txtPrecioAAAEsp = (rdp_FecVigencia.Parent.FindControl("txtPrecioAAAEsp") as RadNumericTextBox);

                if (rdp_FecIni.SelectedDate.HasValue && rdp_FecVigencia.SelectedDate.HasValue)
                {
                    if (rdp_FecIni.SelectedDate > rdp_FecVigencia.SelectedDate)
                    {
                        AlertaFocus("La fecha de fin debe ser mayor a la fecha de inicio", rdp_FecVigencia.DateInput.ClientID);
                        rdp_FecVigencia.DbSelectedDate = null;
                        return;
                    }
                    else
                    {
                        txtPrecioAAAEsp.Focus();
                    }
                }
                else if (rdp_FecIni.SelectedDate.HasValue)
                {
                    if (rdp_FecIni.SelectedDate < Sesion.CalendarioIni)
                    {
                        AlertaFocus("La fecha de inicio debe ser mayor o igual a la fecha de inicio del periodo actual", rdp_FecIni.DateInput.ClientID);
                        rdp_FecIni.DbSelectedDate = null;
                        return;
                    }
                    else
                    {
                        rdp_FecVigencia.DateInput.Focus();
                    }
                }
                else
                {
                    rdp_FecIni.DateInput.Focus();
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Пример #6
0
        protected void txtIdTer_OnTextChanged(object sender, EventArgs e)
        {
            try
            {  //actualizar combo de territorio:
                RadNumericTextBox txt   = (RadNumericTextBox)sender;
                RadComboBox       combo = (RadComboBox)txt.Parent.FindControl("Cmb_Id_Ter");

                if (txt.Text.Contains("-") | txt.Text == "0")
                {
                    txt.Text = "";
                    return;
                }
                combo.SelectedValue = txt.Text;

                RadNumericTextBox txtFis_Consignados = (RadNumericTextBox)txt.Parent.FindControl("txtFis_Consignados");
                txtFis_Consignados.Focus();
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }
Пример #7
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;
            }
        }
Пример #8
0
        protected void rgNotaCreditoEspecialDet_ItemDataBound(object sender, GridItemEventArgs e)
        {
            try
            {
                if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode))
                {
                    Sesion           sesion   = (Sesion)Session["Sesion" + Session.SessionID];
                    GridEditableItem editItem = (GridEditableItem)e.Item;

                    //obtener nombres de los controles de formulario de inserción/edición de registro de grid.
                    RadNumericTextBox Ctrl_txtOrd_Cantidad       = (RadNumericTextBox)editItem.FindControl("txtNcr_Cantidad");
                    string            lblNcr_Cantidad            = ((Label)editItem.FindControl("lblVal_txtNcr_Cantidad")).ClientID.ToString();
                    string            txtNcr_Cantidad            = Ctrl_txtOrd_Cantidad.ClientID.ToString();
                    string            lbl_cmbProducto            = ((Label)editItem.FindControl("lbl_cmbProducto")).ClientID.ToString();
                    string            txtId_Prd                  = ((RadNumericTextBox)editItem.FindControl("txtId_Prd")).ClientID.ToString();
                    string            lblVal_txtPrd_Descripcion  = ((Label)editItem.FindControl("lblVal_txtPrd_Descripcion")).ClientID.ToString();
                    string            txtPrd_Descripcion         = ((RadTextBox)editItem.FindControl("txtPrd_Descripcion")).ClientID.ToString();
                    string            lblVal_txtPrd_Presentacion = ((Label)editItem.FindControl("lblVal_txtPrd_Presentacion")).ClientID.ToString();
                    string            txtPrd_Presentacion        = ((RadTextBox)editItem.FindControl("txtPrd_Presentacion")).ClientID.ToString();
                    string            lblVal_txtPrd_UniNe        = ((Label)editItem.FindControl("lblVal_txtPrd_UniNe")).ClientID.ToString();
                    string            txtPrd_UniNe               = ((RadTextBox)editItem.FindControl("txtPrd_UniNe")).ClientID.ToString();
                    string            lblVal_txtNcr_Precio       = ((Label)editItem.FindControl("lblVal_txtNcr_Precio")).ClientID.ToString();
                    string            txtNcr_Precio              = ((RadNumericTextBox)editItem.FindControl("txtNcr_Precio")).ClientID.ToString();

                    //Llenar combo de productos
                    RadComboBox comboProductoItem = (RadComboBox)editItem.FindControl("cmbProducto");
                    CargarProductos(comboProductoItem);

                    string jsControles = string.Concat(
                        "lblNcr_CantidadClientId='", lblNcr_Cantidad, "';"
                        , "txtNcr_CantidadClientId='", txtNcr_Cantidad, "';"
                        , "lbl_cmbProductoClientId='", lbl_cmbProducto, "';"
                        , "txtId_PrdClientId='", txtId_Prd, "';"
                        , "lblVal_txtPrd_DescripcionClientId='", lblVal_txtPrd_Descripcion, "';"
                        , "txtPrd_DescripcionClientId='", txtPrd_Descripcion, "';"
                        , "lblVal_txtPrd_PresentacionClientId='", lblVal_txtPrd_Presentacion, "';"
                        , "txtPrd_PresentacionClientId='", txtPrd_Presentacion, "';"
                        , "lblVal_txtPrd_UniNeClientId='", lblVal_txtPrd_UniNe, "';"
                        , "txtPrd_UniNeClientId='", txtPrd_UniNe, "';"
                        , "lblVal_txtNcr_PrecioClientId='", lblVal_txtNcr_Precio, "';"
                        , "txtNcr_PrecioClientId='", txtNcr_Precio, "';"
                        );

                    ImageButton insertbtn = (ImageButton)editItem.FindControl("PerformInsertButton");
                    if (insertbtn != null)
                    {
                        //cuando la edición se usa para inserción, se habilita el combo de producto
                        ((RadComboBox)editItem.FindControl("cmbProducto")).Enabled = true;
                        //es registro nuevo y se inhabilita el campo de cantidad (se habilita hasta ke elija un producto del combo)
                        Ctrl_txtOrd_Cantidad.Enabled = false;

                        jsControles = string.Concat(
                            jsControles
                            , "return ValidaFormEdit(\"insertar\");");

                        insertbtn.Attributes.Add("onclick", jsControles);
                        ((RadNumericTextBox)editItem.FindControl("txtId_Prd")).Focus();
                    }

                    ImageButton updatebtn = (ImageButton)editItem.FindControl("UpdateButton");
                    if (updatebtn != null)
                    {
                        //cuando la edición se usa para actualización, se deshabilita el campo de texto y el combo de producto
                        ((RadNumericTextBox)editItem.FindControl("txtId_Prd")).Enabled = false;
                        ((RadComboBox)editItem.FindControl("cmbProducto")).Enabled     = false;
                        //es registro de edición, se habilita el campo de cantidad porque ya eligió producto
                        Ctrl_txtOrd_Cantidad.Enabled = true;

                        jsControles = string.Concat(
                            jsControles
                            , "return ValidaFormEdit(\"actualizar\");");
                        updatebtn.Attributes.Add("onclick", jsControles);

                        //cuando es actualización se selecciona el producto del combo
                        comboProductoItem.SelectedValue = editItem.OwnerTableView.DataKeyValues[editItem.ItemIndex]["Id_Prd"].ToString();
                        Ctrl_txtOrd_Cantidad.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
            }
        }