private void Dgv_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            int pos  = Dgv.CurrentCell.RowIndex;
            int posi = Dgv.CurrentCell.ColumnIndex;

            if (Dgv.Rows.Count > 0)
            {
                if (Dgv.Columns[posi].Name == "")
                {
                    Dgv.BeginEdit(true);
                    if (Convert.ToBoolean(Dgv.Rows[pos].Cells[""].EditedFormattedValue))
                    {
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value      = Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(Dgv.Rows[pos].Cells["dgvbalance"].Value)).ToString("N2");
                        Dgv.Rows[pos].Cells["dgvbalancefinal"].Value = "0.00";
                    }
                    else
                    {
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value        = string.Empty;
                        Dgv.Rows[pos].Cells["dgvdescuento"].Value      = string.Empty;
                        Dgv.Rows[pos].Cells["dgvcargo"].Value          = string.Empty;
                        Dgv.Rows[pos].Cells["dgvbalancefinal"].Value   = string.Empty;
                        Dgv.Rows[pos].Cells["dgvretencionitbis"].Value = string.Empty;
                        Dgv.Rows[pos].Cells["dgvretencionisr"].Value   = string.Empty;
                    }
                    Dgv.EndEdit();
                }
            }
        }
        void checkheader_OnCheckBoxHeaderClick(CheckBoxHeaderCellEventArgs e)
        {
            double aplica = 0; int pos = 0;

            if (Dgv.Rows.Count > 0)
            {
                foreach (DataGridViewRow item in Dgv.Rows)
                {
                    Dgv.BeginEdit(true);
                    item.Cells[""].Value = e.IsChecked;
                    pos = item.Cells[0].RowIndex;
                    if (Convert.ToBoolean(item.Cells[""].Value) == true)
                    {
                        aplica += Convert.ToDouble(item.Cells["dgvbalance"].Value);
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value = Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvbalance"].Value)).ToString("N2");
                    }
                    else if (Convert.ToBoolean(item.Cells[""].Value) == false)
                    {
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value = "";
                    }
                    Dgv.EndEdit();
                }
                Txtaplicar.Text = aplica + "";
            }
        }
        protected void Fun_Buscar_Detalle_Registro(int idregistro)
        {
            Dgv.ClearSelection();
            string  cmd = "";
            DataSet ds  = new DataSet();

            Dgv.CurrentCell = null;

            cmd = string.Format("select cxcdbfregistro.idregistro, cxcdbfregistro.secuencia, cxcdbfregistro.fecha as fechafac ,cxcdbfregistro.referencia, fechavencimiento, cxcdbfregistro.total as totalfac ,balance,cxcdbfdebcre.total,cxcdbfdebcre.itbis  from cxcdbfregistro"
                                + " inner join cxcdbfdebcre on cxcdbfdebcre.idfactura = cxcdbfregistro.idregistro where cxcdbfdebcre.secuencia='" + Txtregistro.Text.Trim() + "'");
            ds = FuncionesSQL.Fun_Sql_Ejecutar(cmd);


            Dgv.DataSource = ds.Tables[0];
        }
Exemple #4
0
        protected void Fun_Buscar_Detalle_Registro(int idregistro)
        {
            Dgv.ClearSelection();
            string  cmd = "";
            DataSet ds  = new DataSet();

            Dgv.CurrentCell = null;
            if (Rbnreciboingreso.Checked)
            {
                cmd = string.Format("select cxcdbfcobrodetalle.idregistro,cxcdbfregistro.secuencia,cxcdbfregistro.referencia,ncf,cxcdbfregistro.fecha as fechafac,fechavencimiento, DATEDIFF(day, cxcdbfregistro.fecha, getdate()) as dias ,cxcdbfregistro.total,balance, cxcdbfcobrodetalle.monto,montoretencionisr,montoretencionitbis,cxcdbfcobrodetalle.cargo,cxcdbfcobrodetalle.descuento from cxcdbfregistro "
                                    + "inner join cxcdbfcobrodetalle on cxcdbfregistro.idregistro = cxcdbfcobrodetalle.idregistro inner join cxcdbfcobro on cxcdbfcobrodetalle.idcobro=cxcdbfcobro.idcobro where cxcdbfcobro.secuencia='" + Txtcobro.Text.Trim() + "'");
                ds = FuncionesSQL.Fun_Sql_Ejecutar(cmd);
            }

            Dgv.DataSource = ds.Tables[0];
        }
Exemple #5
0
        private void Dgv_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (e.Button == MouseButtons.Left)
                {
                }
                else
                {
                    ContextMenuStrip op_lista = new ContextMenuStrip();

                    //Primeiro item da ista
                    ToolStripMenuItem send = new ToolStripMenuItem();
                    send.Name = "send";
                    send.Text = "Enviar mensagem a este contacto";
                    //send.ForeColor = Color.White;
                    send.BackColor = Color.Black;

                    ToolStripMenuItem del = new ToolStripMenuItem();
                    del.Name      = "del";
                    del.Text      = "Apagar contacto";
                    del.BackColor = Color.Black;


                    int posicao = Dgv.HitTest(e.X, e.Y).RowIndex;

                    op_lista.BackColor = Color.FromArgb(22, 23, 23);
                    op_lista.Font      = new Font("Rubik", 9, FontStyle.Regular);
                    op_lista.ForeColor = Color.White;
                    if (posicao >= 0)
                    {
                        op_lista.Items.Add(send);
                        op_lista.Items.Add(del);
                        //op_lista.Items.Add("Deletar").BackColor = Color.Black;
                    }
                    op_lista.Show(Dgv, new Point(e.X, e.Y));

                    //Chamar evento ao clicar o item
                    op_lista.ItemClicked += Op_lista_ItemClicked;
                }
            }
        }
Exemple #6
0
        private void TableBrowser_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Escape)
            {
                Close();
            }

            if (e.KeyCode == Keys.Menu && e.Modifiers == Keys.Alt)
            {
                if (Dgv.Focused)
                {
                    Dgv2.Focus();
                }
                else
                {
                    Dgv.Focus();
                }
                e.Handled = true;
            }
        }
        private void Dgv_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            int pos  = Dgv.CurrentCell.RowIndex;
            int posi = Dgv.CurrentCell.ColumnIndex;

            if (Dgv.Rows.Count > 0)
            {
                if (Dgv.Columns[posi].Name == "dgvcheck")
                {
                    Dgv.BeginEdit(true);
                    if (Convert.ToBoolean(Dgv.Rows[pos].Cells["dgvcheck"].EditedFormattedValue))
                    {
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value = Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(Dgv.Rows[pos].Cells["dgvbalance"].Value));
                    }
                    else
                    {
                        Dgv.Rows[pos].Cells["dgvcheck"].Value   = false;
                        Dgv.Rows[pos].Cells["dgvaplicar"].Value = "";
                        Dgv.Rows[pos].Cells["dgvitbis"].Value   = "";
                    }
                    Dgv.EndEdit();
                }
            }
        }
        void checkheader_OnCheckBoxHeaderClick(CheckBoxHeaderCellEventArgs e)
        {
            double aplica   = 0;
            double deposito = Funciones.Fun_Convierte_String_aDecimal(Txtdeposito.Text);
            double balance  = Funciones.Fun_Convierte_String_aDecimal(Txtbalance.Text);

            if (Dgv.Rows.Count > 0)
            {
                if (Rbnreciboingreso.Checked)
                {
                    Dgv.BeginEdit(true);

                    foreach (DataGridViewRow item in Dgv.Rows)
                    {
                        item.Cells[""].Value = e.IsChecked;

                        if (Convert.ToBoolean(item.Cells[""].Value))
                        {
                            aplica += Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvbalance"].Value));


                            item.Cells["dgvaplicar"].Value      = Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvbalance"].Value)).ToString("N2");
                            item.Cells["dgvbalancefinal"].Value = "0.00";
                        }

                        else
                        {
                            item.Cells["dgvaplicar"].Value = string.Empty;
                        }
                        item.Cells["dgvbalancefinal"].Value   = string.Empty;
                        item.Cells["dgvdescuento"].Value      = string.Empty;
                        item.Cells["dgvcargo"].Value          = string.Empty;
                        item.Cells["dgvretencionitbis"].Value = string.Empty;
                        item.Cells["dgvretencionisr"].Value   = string.Empty;
                    }
                }
                else if (Rbnaplicardeposito.Checked)
                {
                    if (balance > deposito)
                    {
                        aplica = deposito;
                    }
                    else
                    {
                        aplica = balance;
                    }

                    foreach (DataGridViewRow item in Dgv.Rows)
                    {
                        if (deposito > 0)
                        {
                            item.Cells[""].Value = e.IsChecked;
                        }

                        if (Convert.ToBoolean(item.Cells[""].Value) == true)
                        {
                            if (deposito >= Funciones.Fun_Convierte_String_aDecimal(Convert.ToString(item.Cells["dgvbalance"].Value)))
                            {
                                deposito -= Convert.ToDouble(item.Cells["dgvbalance"].Value);
                                item.Cells["dgvaplicar"].Value      = Convert.ToDouble(item.Cells["dgvbalance"].Value);
                                item.Cells["dgvbalancefinal"].Value = Convert.ToDouble(item.Cells["dgvbalance"].Value) - Convert.ToDouble(item.Cells["dgvaplicar"].Value);
                            }

                            else if (deposito < Convert.ToDouble(item.Cells["dgvbalance"].Value) && deposito > 0)
                            {
                                item.Cells["dgvaplicar"].Value      = deposito;
                                item.Cells["dgvbalancefinal"].Value = Convert.ToDouble(item.Cells["dgvbalance"].Value) - Convert.ToDouble(item.Cells["dgvaplicar"].Value);
                                deposito = 0;
                            }
                        }
                        else if (Convert.ToBoolean(item.Cells[""].Value) == false)
                        {
                            item.Cells["dgvaplicar"].Value        = string.Empty;
                            item.Cells["dgvbalancefinal"].Value   = string.Empty;
                            item.Cells["dgvdescuento"].Value      = string.Empty;
                            item.Cells["dgvcargo"].Value          = string.Empty;
                            item.Cells["dgvretencionitbis"].Value = string.Empty;
                            item.Cells["dgvretencionisr"].Value   = string.Empty;

                            if (Funciones.Fun_Convierte_String_aDecimal(Txtaplicar.Text) == 0)
                            {
                                aplica = 0;
                            }
                        }
                    }
                }



                Fun_Calcular_Totales();

                Dgv.EndEdit();
            }
        }
 public DataGridView Refresh()
 {
     Dgv.Refresh();
     return(Dgv);
 }