示例#1
0
 ///<summary>
 /// Devuelve un valor booleano despues de que cargue los datos del archivo xls en el cuadro de diferencias
 ///</summary>
 public static bool cargarValoresCuadro(CuadroTotal dt, DataGridView table)
 {
     try
     {
         GridViewObj.objCell(table, 0, 1).Value = dt.GastoCelular.ToString();
         GridViewObj.objCell(table, 1, 1).Value = dt.iva.ToString();
         GridViewObj.objCell(table, 2, 1).Value = dt.imp.ToString();
         GridViewObj.objCell(table, 8, 1).Value = (dt.GastoCelular + dt.imp + dt.iva).ToString();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#2
0
        private void Importar_btn_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog()
            {
                Filter = "Excel | *.xls;*.xlsx;",
                Title  = "Seleccionar Archivo"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Data data = new Data();
                txtFileName.Text = dialog.FileName;
                try
                {
                    this.listxls            = Datos.obtenerDatos(dialog.FileName);
                    this.listDetallesCargos = Datos.DetallesCargos(listxls);

                    facturasGrid.DataSource = this.listDetallesCargos;

                    CuadroTotal DetallesFactura = Datos.DetallesFactura(listxls);

                    if (Validacion.cargarValoresCuadro(DetallesFactura, cuadroGrid))
                    {
                        activarForm();
                    }
                }
                catch
                {
                    string            message = "No se encontro una hoja de calculo con el nombre de factura.\n Asegurese que la hoja a calcular tenga el nombre de factura";
                    string            caption = "Error en la hoja de calculo";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    DialogResult      result;

                    result = MessageBox.Show(message, caption, buttons);
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        this.Close();
                    }
                }
            }
        }