Example #1
0
        private void gridViewRteIVA_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode.ToString() == "Delete")
                {
                    vwcxc_cobros_x_vta_nota_x_Ret_Info row = (vwcxc_cobros_x_vta_nota_x_Ret_Info)gridViewRteIVA.GetFocusedRow();

                    if (row != null)
                    {
                        if (row.Modificable == false)
                        {
                            MessageBox.Show("No se puede modificar un registro grabado");
                        }
                        else
                        {
                            gridViewRteIVA.DeleteSelectedRows();
                        }
                    }
                    else
                    {
                        gridViewRteIVA.DeleteSelectedRows();
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
 private void gridViewRteFU_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
 {
     try
     {
         vwcxc_cobros_x_vta_nota_x_Ret_Info row = (vwcxc_cobros_x_vta_nota_x_Ret_Info)gridViewRteFU.GetFocusedRow();
         if (row != null)
         {
             if (row.Modificable == false)
             {
                 colcr_fechaCobro.OptionsColumn.AllowEdit    = false;
                 colIdCobro_tipo2.OptionsColumn.AllowEdit    = false;
                 colBase1.OptionsColumn.AllowEdit            = false;
                 colPorcentajeRet2.OptionsColumn.AllowEdit   = false;
                 coldc_ValorPago.OptionsColumn.AllowEdit     = false;
                 colcr_NumDocumento1.OptionsColumn.AllowEdit = false;
             }
             else// if(row.Modificable == true)
             {
                 colcr_fechaCobro.OptionsColumn.AllowEdit    = true;
                 colIdCobro_tipo2.OptionsColumn.AllowEdit    = true;
                 colBase1.OptionsColumn.AllowEdit            = true;
                 colPorcentajeRet2.OptionsColumn.AllowEdit   = true;
                 coldc_ValorPago.OptionsColumn.AllowEdit     = true;
                 colcr_NumDocumento1.OptionsColumn.AllowEdit = true;
             }
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
 private void gridViewRteIVA_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     try
     {
         if (e.Column.FieldName == "IdCobro_tipo")
         {
             vwcxc_cobros_x_vta_nota_x_Ret_Info row = (vwcxc_cobros_x_vta_nota_x_Ret_Info)gridViewRteIVA.GetFocusedRow();
             if (row != null)
             {
                 cxc_cobro_tipo_Info tipo = LstTipCobro.First(var => var.IdCobro_tipo == e.Value);
                 gridViewRteIVA.SetFocusedRowCellValue("PorcentajeRet", tipo.PorcentajeRet);
                 if (row.Base != null && row.Base > 0)
                 {
                     gridViewRteIVA.SetFocusedRowCellValue("dc_ValorPago", row.Base * row.PorcentajeRet / 100);
                 }
                 gridViewRteIVA.SetFocusedRowCellValue("Modificable", true);
                 if (contRetIVA == 0)
                 {
                     gridViewRteIVA.SetFocusedRowCellValue("Base", Convert.ToDouble(txtIVA.Text)); contRetIVA = 1;
                 }
             }
         }
         else if (e.Column.FieldName == "Base")
         {
             vwcxc_cobros_x_vta_nota_x_Ret_Info row = (vwcxc_cobros_x_vta_nota_x_Ret_Info)gridViewRteIVA.GetFocusedRow();
             if (row != null)
             {
                 if (row.Base != null && row.Base > 0)
                 {
                     gridViewRteIVA.SetFocusedRowCellValue("dc_ValorPago", row.Base * row.PorcentajeRet / 100);
                     gridViewRteIVA.SetFocusedRowCellValue("Modificable", true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }