private void Insert()
        {
            try
            {
                var BE = new tb_cm_liquidacab();
                var BL = new tb_cm_liquidacabBL();

                BE.tipdoc = tipdoc.Text.Trim();
                BE.serdoc = moduloiddes.SelectedValue.ToString();
                BE.numdoc = serdoc.Text.Trim() + numdoc.Text.Trim();
                BE.moduloid = moduloiddes.SelectedValue.ToString();
                BE.local = localdes.SelectedValue.ToString();
                BE.tipref = tipguia.Text.Trim();
                BE.serref = serguia.Text.Trim();
                BE.numref = numguia.Text.Trim();
                BE.fecre = Convert.ToDateTime(fechdoc.Text);
                BE.cif = Convert.ToDecimal(cif.Text.Trim());
                BE.dua = Convert.ToDecimal(dua.Text.Trim());
                BE.gas_impo = Convert.ToDecimal(gas_impo.Text.Trim());
                BE.gas_financ = Convert.ToDecimal(gas_financ.Text.Trim());
                BE.tot_bimp = Convert.ToDecimal(tot_bimp.Text.Trim());
                BE.factorincre = Convert.ToDecimal(factorincre.Text.Trim());
                BE.usuar = VariablesPublicas.Usuar.Trim();
                BE.status = "0";

                if (TablaDetalleImportacion2 != null)
                {
                    TablaDetalleImportacion2.Clear();
                }

                for (var i = 0; i < dgb_importacion1.RowCount; i++)
                {
                    row = TablaDetalleImportacion2.NewRow();
                    row["tipdoc"] = tipdoc.Text.Trim();
                    row["serdoc"] = moduloiddes.SelectedValue.ToString();
                    row["numdoc"] = serdoc.Text.Trim() + numdoc.Text.Trim();

                    row["conceptoid"] = dgb_importacion1.GetRowCellValue(i, "conceptoid").ToString().Trim();
                    row["ctacte"] = dgb_importacion1.GetRowCellValue(i, "ctacte").ToString().Trim();
                    row["tipbou"] = dgb_importacion1.GetRowCellValue(i, "tipbou").ToString().Trim();
                    row["serbou"] = dgb_importacion1.GetRowCellValue(i, "serbou").ToString().Trim();
                    row["numbou"] = dgb_importacion1.GetRowCellValue(i, "numbou").ToString().Trim();
                    var fecha = dgb_importacion1.GetRowCellValue(i, "fechbou").ToString().Trim();
                    if (fecha.ToString().Trim().Length > 0 && fecha.ToString().Trim() != "-")
                    {
                        row["fechbou"] = dgb_importacion1.GetRowCellValue(i, "fechbou").ToString().Trim();
                    }
                    row["bimp_sunat2"] = dgb_importacion1.GetRowCellValue(i, "bimp_sunat2").ToString().Trim();
                    row["tipcamb"] = dgb_importacion1.GetRowCellValue(i, "tipcamb").ToString().Trim();
                    row["bimp_sunat1"] = dgb_importacion1.GetRowCellValue(i, "bimp_sunat1").ToString().Trim();
                    row["pven"] = dgb_importacion1.GetRowCellValue(i, "pven").ToString().Trim();
                    row["status"] = "0".ToString().Trim();
                    row["usuar"] = VariablesPublicas.Usuar.Trim();
                    TablaDetalleImportacion2.Rows.Add(row);
                }
                if (BL.Insert(EmpresaID, BE, TablaDetalleImportacion2))
                {
                    MessageBox.Show("Datos Grabados Correctamente !!!", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    form_bloqueado(false);
                    tipdoc.Enabled = false;

                    btn_nuevo.Enabled = true;
                    btn_imprimir.Enabled = true;

                    btn_primero.Enabled = true;
                    btn_anterior.Enabled = true;
                    btn_siguiente.Enabled = true;
                    btn_ultimo.Enabled = true;

                    btn_salir.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }