protected void btnBuscar_Click(object sender, EventArgs e)
 {
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     DataTable dt = new DataTable();
     BE.filtro = "1";
     dt = BL.GetAll_Filtro(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     //GridView1.DataSource = dt;
     //GridView1.DataBind();
 }
    public void lanzarProgress(string val1, string val2)
    {
        string estado = val1.ToString();
        string proforma = val2.ToString();

        string tipdoc = proforma.ToString().Substring(0,2);
        string serdoc = proforma.ToString().Substring(2,4);
        string numdoc = (proforma.ToString().Substring(6,4)).PadLeft(10, '0');
        string obs = LblIdObs.Text;

        string rpta = "";
        try
        {
            tb_cxc_evalcredBL obj_prof = new tb_cxc_evalcredBL();
            //obj_prof.GetAll_PendAprob(proforma.ToString(), estado.ToString(), obs);
            //this.refreca();
        }
        catch (Exception ex)
        {
            //MessageBox.Show("codigo ya exixte");
            rpta = ex.Message;
        }
    }
    void cargar_grilla()
    {
        tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
        tb_cxc_evalcred BE = new tb_cxc_evalcred();
        TablaPendAprob = BL.GetAll_PendAprob(Session["ssEmpresaID"].ToString(), BE).Tables[0];

        DataTable dtDatos = new DataTable();
        if (TablaPendAprob.Rows.Count > 0)
        {
            dtDatos.Columns.Add("numdoc");
            dtDatos.Columns.Add("ctactename");
            dtDatos.Columns.Add("canalventaname");
            dtDatos.Columns.Add("vendorname");
            dtDatos.Columns.Add("imponeto");
            dtDatos.Columns.Add("fecre");
            string canalid = "";
            string canalname = "";
            for (int i = 0; i < TablaPendAprob.Rows.Count; i++)
            {
                DataRow dtRow = dtDatos.NewRow();
                dtRow["numdoc"] = TablaPendAprob.Rows[i]["numdoc"].ToString();
                dtRow["ctactename"] = TablaPendAprob.Rows[i]["ctactename"].ToString();
                canalname = TablaPendAprob.Rows[i]["canalventaid"].ToString();
                switch (canalid.ToString())
                {
                    case "01":
                        canalname = "NO PROMOCIONALES";
                        break;
                    case "02":
                        canalname = "CLIENTES ESPECIALES";
                        break;
                    case "03":
                        canalname = "MARCAS PROMOCIONALES";
                        break;
                    default:
                        canalname = "NO PROMOCIONALES";
                        break;
                }
                dtRow["canalventaname"] = canalname.ToString();
                dtRow["vendorname"] = TablaPendAprob.Rows[i]["vendorname"].ToString();
                dtRow["imponeto"] = TablaPendAprob.Rows[i]["imponeto"].ToString();
                dtRow["fecre"] = TablaPendAprob.Rows[i]["fecre"].ToString().Substring(0,10);

                dtDatos.Rows.Add(dtRow);
            }
            GridView.DataSource = dtDatos;
            GridView.DataBind();
        }
    }
    private void Update()
    {
        try
        {
            var BL = new tb_cxc_evalcredBL();
            var BE = new tb_cxc_evalcred();

            BE.ctacte = Session["ssCtacte"].ToString();
            BE.item = lblitem.Text.Trim();
            BE.tipdoc = Session["xtipdoc"].ToString();
            BE.serdoc = Session["xserdoc"].ToString();
            BE.numdoc = Session["xnumdoc"].ToString();
            BE.es_persjuridica = Convert.ToBoolean(es_persjuridica.Value);
            BE.copia_constitucionempresa = copia_constitucionempresa.Checked;
            BE.copia_ruc = copia_ruc.Checked;
            BE.copia_dni = copia_dni.Checked;
            BE.lic_func = lic_func.Checked;
            BE.titulo_localcom = titulo_localcom.Checked;
            BE.contra_localcom = contra_localcom.Checked;
            BE.recibo_agualuz = recibo_agualuz.Checked;
            BE.tiene_letraprotestada = Convert.ToBoolean(tiene_letraprotestada.Value);
            BE.tiene_morosidad = Convert.ToBoolean(tiene_morosidad.Value);
            BE.moroso_infocorp = Convert.ToBoolean(moroso_infocorp.Value);
            BE.refe_comerc = refe_comerc.Value.ToString();
            BE.refe_banca = refe_banca.Value.ToString();
            BE.bienes_bienmueble = Convert.ToBoolean(bienes_bienmueble.Value);
            BE.bienes_inmuebles = Convert.ToBoolean(bienes_inmuebles.Value);
            BE.puntaje = Convert.ToInt32(lblpuntos.Text);
            BE.eval_cxcob = eval_cxcob.Value.ToString();
            BE.obs_cxcob = obs_cxcob.Text;
            BE.aprob_gerencial = aprob_gerencial.Value.ToString();
            BE.obs_gerencial = obs_gerencial.Text;
            BE.usuar = Session["ssUsuar"].ToString().Trim();

            if (BL.Update(Session["ssEmpresaID"].ToString(), BE))
            {
                ClientMessage("Registros Modificados Correctamente !!!");
                //MensajeQuery2("Registros Modificados Correctamente !!!");
                LimpiarDocumento();
            }
        }
        catch (Exception ex)
        {
            ClientMessage(ex.Message);
        }
    }
    private void Insert()
    {
        try
        {
            tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
            tb_cxc_evalcred BE = new tb_cxc_evalcred();

            BE.ctacte = Session["ssCtacte"].ToString();
            BE.item = "";
            BE.tipdoc = Session["xtipdoc"].ToString();
            BE.serdoc = Session["xserdoc"].ToString();
            BE.numdoc = Session["xnumdoc"].ToString();
            BE.es_persjuridica = Convert.ToBoolean(es_persjuridica.Value);
            BE.copia_constitucionempresa = copia_constitucionempresa.Checked;
            BE.copia_ruc = copia_ruc.Checked;
            BE.copia_dni = copia_dni.Checked;
            BE.lic_func = lic_func.Checked;
            BE.titulo_localcom = titulo_localcom.Checked;
            BE.contra_localcom = contra_localcom.Checked;
            BE.recibo_agualuz = recibo_agualuz.Checked;
            BE.tiene_letraprotestada = Convert.ToBoolean(tiene_letraprotestada.Value);
            BE.tiene_morosidad = Convert.ToBoolean(tiene_morosidad.Value);
            BE.moroso_infocorp = Convert.ToBoolean(moroso_infocorp.Value);
            BE.refe_comerc = refe_comerc.Value.ToString();
            BE.refe_banca = refe_banca.Value.ToString();
            BE.bienes_bienmueble = Convert.ToBoolean(bienes_bienmueble.Value);
            BE.bienes_inmuebles = Convert.ToBoolean(bienes_inmuebles.Value);
            BE.puntaje = Convert.ToInt32(lblpuntos.Text);
            BE.eval_cxcob = eval_cxcob.Value.ToString();
            BE.obs_cxcob = obs_cxcob.Text;
            BE.aprob_gerencial = aprob_gerencial.Value.ToString();
            BE.obs_gerencial = obs_gerencial.Text;
            BE.usuar = Session["ssUsuar"].ToString();

            if (BL.Insert(Session["ssEmpresaID"].ToString(), BE))
            {
                ClientMessage("Registros Grabados Correctamente !!!");
                LimpiarDocumento();
                Lock_or_Unlock_Boton("N", true, "");
                Lock_or_Unlock_Boton("C", false, "_disabled");
                Lock_or_Unlock_Boton("G", false, "_disabled");
            }
        }
        catch (Exception ex)
        {
            ClientMessage(ex.Message);
        }
    }
 private void CargarEvaluacion_Paginacion(String xposicion)
 {
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     DataTable dt = new DataTable();
     BE.item = lblitem.Text.Trim();
     BE.posicion = xposicion.Trim();
     dt = BL.GetAll_paginacion(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         lblitem.Text = dt.Rows[0]["item"].ToString();
         es_persjuridica.Value = Convert.ToBoolean(dt.Rows[0]["es_persjuridica"].ToString());
         copia_constitucionempresa.Checked = Convert.ToBoolean(dt.Rows[0]["copia_constitucionempresa"].ToString());
         copia_ruc.Checked = Convert.ToBoolean(dt.Rows[0]["copia_ruc"].ToString());
         copia_dni.Checked = Convert.ToBoolean(dt.Rows[0]["copia_dni"].ToString());
         lic_func.Checked = Convert.ToBoolean(dt.Rows[0]["lic_func"].ToString());
         titulo_localcom.Checked = Convert.ToBoolean(dt.Rows[0]["copia_ruc"].ToString());
         contra_localcom.Checked = Convert.ToBoolean(dt.Rows[0]["contra_localcom"].ToString());
         recibo_agualuz.Checked = Convert.ToBoolean(dt.Rows[0]["recibo_agualuz"].ToString());
         tiene_letraprotestada.Value = Convert.ToBoolean(dt.Rows[0]["tiene_letraprotestada"].ToString());
         tiene_morosidad.Value = Convert.ToBoolean(dt.Rows[0]["tiene_morosidad"].ToString());
         moroso_infocorp.Value = Convert.ToBoolean(dt.Rows[0]["moroso_infocorp"].ToString());
         refe_comerc.Value = dt.Rows[0]["refe_comerc"].ToString();
         refe_banca.Value = dt.Rows[0]["refe_banca"].ToString();
         bienes_bienmueble.Value = Convert.ToBoolean(dt.Rows[0]["bienes_bienmueble"].ToString());
         bienes_inmuebles.Value = Convert.ToBoolean(dt.Rows[0]["bienes_inmuebles"].ToString());
         lblpuntos.Text = dt.Rows[0]["puntaje"].ToString();
         eval_cxcob.Value = dt.Rows[0]["eval_cxcob"].ToString();
         obs_cxcob.Text = dt.Rows[0]["obs_cxcob"].ToString();
     }
 }
    private void CargarEvaluacion()
    {
        tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
        tb_cxc_evalcred BE = new tb_cxc_evalcred();
        DataTable dt = new DataTable();

        BE.tipdoc = Session["xtipdoc"].ToString();
        BE.serdoc = Session["xserdoc"].ToString();
        BE.numdoc = Session["xnumdoc"].ToString();

        dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
        if (dt.Rows.Count > 0)
        {
            es_persjuridica.Value = Convert.ToBoolean(dt.Rows[0]["es_persjuridica"].ToString());
            copia_constitucionempresa.Checked = Convert.ToBoolean(dt.Rows[0]["copia_constitucionempresa"].ToString());
            copia_ruc.Checked = Convert.ToBoolean(dt.Rows[0]["copia_ruc"].ToString());
            copia_dni.Checked = Convert.ToBoolean(dt.Rows[0]["copia_dni"].ToString());
            lic_func.Checked = Convert.ToBoolean(dt.Rows[0]["lic_func"].ToString());
            titulo_localcom.Checked = Convert.ToBoolean(dt.Rows[0]["copia_ruc"].ToString());
            contra_localcom.Checked = Convert.ToBoolean(dt.Rows[0]["contra_localcom"].ToString());
            recibo_agualuz.Checked = Convert.ToBoolean(dt.Rows[0]["recibo_agualuz"].ToString());
            tiene_letraprotestada.Value = Convert.ToBoolean(dt.Rows[0]["tiene_letraprotestada"].ToString());
            tiene_morosidad.Value = Convert.ToBoolean(dt.Rows[0]["tiene_morosidad"].ToString());
            moroso_infocorp.Value = Convert.ToBoolean(dt.Rows[0]["moroso_infocorp"].ToString());
            refe_comerc.Value = dt.Rows[0]["refe_comerc"].ToString();
            refe_banca.Value = dt.Rows[0]["refe_banca"].ToString();
            bienes_bienmueble.Value = Convert.ToBoolean(dt.Rows[0]["bienes_bienmueble"].ToString());
            bienes_inmuebles.Value = Convert.ToBoolean(dt.Rows[0]["bienes_inmuebles"].ToString());
            eval_cxcob.Value = dt.Rows[0]["eval_cxcob"].ToString();
            obs_cxcob.Text = dt.Rows[0]["obs_cxcob"].ToString();
            if (dt.Rows[0]["aprob_gerencial"].ToString().Length > 0)
            {
                aprob_gerencial.Value = dt.Rows[0]["aprob_gerencial"].ToString();
            }
            obs_gerencial.Text = dt.Rows[0]["obs_gerencial"].ToString();
            lblpuntos.Text = dt.Rows[0]["puntaje"].ToString();
            lblitem.Text = dt.Rows[0]["item"].ToString();
            lblnumdoc.Text = Session["xtipdoc"].ToString() + "-"
                           + Session["xserdoc"].ToString()
                           + Equivalencias.Right(Session["xnumdoc"].ToString(),5);
        }
    }
    private void data_gridVendedor()
    {
        tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
        tb_cxc_evalcred BE = new tb_cxc_evalcred();
        DataTable dt = new DataTable();
        switch (cmbvendedor.SelectedValue)
        {
            case "01":
                BE.vendorid = txt_busqueda02.Text.Trim().ToUpper();
                break;
            case "02":
                BE.vendorname = txt_busqueda02.Text.Trim().ToUpper();
                break;
            default:
                //**
                break;
        }
        try
        {
            //Eliminar Columnas Actuales(Opcional):
            dgb_vendedor.Columns.Clear();
            dgb_vendedor.Width = 535;
            //Objeto Columna:
            CommandField image;
            //Crear Columna:
            image = new CommandField();
            image.ButtonType = ButtonType.Image;
            image.SelectImageUrl = "~/Images/go-search.png";
            image.ShowSelectButton = true;
            image.ItemStyle.Width = 10;
            image.ItemStyle.Wrap = true;
            dgb_vendedor.Columns.Add(image);

            BoundField DDNNI;
            DDNNI = new BoundField();
            DDNNI.DataField = "vendorid";
            DDNNI.HeaderText = "CODIGO";
            DDNNI.ItemStyle.Width = 50;
            dgb_vendedor.Columns.Add(DDNNI);

            BoundField NOMBR;
            NOMBR = new BoundField();
            NOMBR.DataField = "vendorname";
            NOMBR.HeaderText = "VENDEDOR";
            NOMBR.ItemStyle.Width = 250;
            dgb_vendedor.Columns.Add(NOMBR);

            BE.filtro = "2";

            dt = BL.GetAll_Filtro(Session["ssEmpresaID"].ToString(), BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                dgb_vendedor.DataSource = dt;
                dgb_vendedor.DataBind();
                dgb_vendedor.Visible = true;
            }
        }
        catch (Exception ex)
        {
            throw ex;// ClientMessage(ex.Message);
        }
    }
 void CargarEvaluacion()
 {
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     DataTable dt = new DataTable();
     BE.ctacte = txt_ctacte.Value.ToString();
     BE.vendorid = txt_vendorid.Value.ToString();
     if(chk_estado.Checked)
         BE.aprob_gerencial = cmbestado.SelectedValue.ToString();
     BE.filtro = "2";
     dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     dgb_evalcred.DataSource = dt;
     dgb_evalcred.DataBind();
 }
 void CargarCombos(String filtro,String xctacte,String xvendorid)
 {
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     DataTable dt = new DataTable();
     BE.filtro = filtro;
     BE.ctacte = xctacte;
     BE.vendorid = xvendorid;
     if (filtro == "1")
     {
         dt = BL.GetAll_Filtro(Session["ssEmpresaID"].ToString(), BE).Tables[0];
         //lstCliente.DataSource = dt;
         //lstCliente.DataValueField = "ctacte";
         //lstCliente.DataTextField = "ctactename";
         //lstCliente.DataBind();
     }
     if (filtro == "2")
     {
         dt = BL.GetAll_Filtro(Session["ssEmpresaID"].ToString(), BE).Tables[0];
         //lstVendor.DataSource = dt;
         //lstVendor.DataValueField = "vendorid";
         //lstVendor.DataTextField = "vendorname";
         //lstVendor.DataBind();
     }
     if (filtro == "3")
     {
         dt = BL.GetAll_Filtro(Session["ssEmpresaID"].ToString(), BE).Tables[0];
         //lstNumdoc.DataSource = dt;
         //lstNumdoc.DataValueField = "numdoc";
         //lstNumdoc.DataTextField = "proforma";
         //lstNumdoc.DataBind();
     }
 }
 void cargarComboEstado()
 {
     // CARGAMOS COMBOS PARA LA VISTA DE VENTAS HORISONTALES
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     DataTable dt = new DataTable();
     BE.canalventaid = Session["ssCanalVentaId"].ToString();
     BE.filtro = "2";
     dt = BL.GetAll_Estados(Session["ssEmpresaID"].ToString(), BE).Tables[0];
     cmbestado.DataSource = dt;
     cmbestado.DataValueField = "aprob_status";
     cmbestado.DataTextField = "descripcion";
     cmbestado.DataBind();
 }
    private void Rpt_EvalCrediticia()
    {
        try
        {
            //Se crea el documento PDF
            PdfDocument document = new PdfDocument();

            //Se configura los datos dela pagina
            document.Info.Title = "»» EVALUACIÓN CREDITICIA ««";
            document.Info.Author = "HVR";

            //Se crea la pagina A4
            PdfPage page = document.AddPage();
            page.Orientation = PageOrientation.Portrait;

            //Se crea el objeto dibujo
            XGraphics gfx = XGraphics.FromPdfPage(page);
            XPen pen = new XPen(XColors.Navy, 1);
            string anio = Convert.ToString(DateTime.Now).Substring(6, 10);
            XRect rect;
            XFont fontB18 = new XFont("Times", 20, XFontStyle.Bold);
            XFont fontB12 = new XFont("Times", 12, XFontStyle.Bold);
            XFont fontB9 = new XFont("Times", 9, XFontStyle.Bold);
            XFont font9 = new XFont("Times", 9);

            #region OBTENIENDO VALORES DE SESSION
            // DECLARANDO VARIBALES QUE RECIBIMOS DE SESSION
            string XEMPRESANAME = Session["ssEmpresaName"].ToString();
            string XEMPRESARUC = Session["ssEmpresaRuc"].ToString();
            string XGERENTEGENE = Session["ssGerenteGeneral"].ToString();
            string XGERENTEDNI = Session["ssGerenteNrodni"].ToString();
            string XPARTELECTRO = Session["ssPartElectro"].ToString();
            string XUSUAR = Session["ssUsuar"].ToString();

            int XPUNTAJE = 0;
            Boolean XESJURIDICA = false,
                    XCOPIACONST = false,
                    XCOPIARUC = false,
                    XCOPIADNI = false,
                    XLICFUNC = false,
                    XTITLOCAL = false,
                    XCONTLOCAL = false,
                    XRECIBO = false,
                    XTIENLETR = false,
                    XTIENMORO = false,
                    XMOROSO = false,
                    XBIENMUEB = false,
                    XBIENINMUEB = false;

            string XNUMDOC = "", XSERDOC = "", XCTACTENAME = "", XCLINMRUC = "", XFECHA = "", XREFCOMER = "",
                   XREFBANCA = "",XEVALCXCOB ="",XOBSCXCOB="",XOBSGEREN="",XAPROBGERE="";

            tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
            tb_cxc_evalcred BE = new tb_cxc_evalcred();
            DataTable TablaEval = new DataTable();
            BE.tipdoc = Session["xtipdoc"].ToString();
            BE.serdoc = Session["xserdoc"].ToString();
            BE.numdoc = Session["xnumdoc"].ToString();
            TablaEval = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
            foreach (DataRow fila in TablaEval.Rows)
            {
                XNUMDOC = fila["numdoc"].ToString();
                XSERDOC = fila["serdoc"].ToString();
                XCTACTENAME = fila["ctactename"].ToString();
                XCLINMRUC = fila["nmruc"].ToString();
                XFECHA = fila["fechdoc"].ToString();
                XESJURIDICA = Convert.ToBoolean(fila["es_persjuridica"].ToString());
                XCOPIACONST = Convert.ToBoolean(fila["copia_constitucionempresa"].ToString());
                XCOPIARUC = Convert.ToBoolean(fila["copia_ruc"].ToString());
                XCOPIADNI = Convert.ToBoolean(fila["copia_dni"].ToString());
                XLICFUNC = Convert.ToBoolean(fila["lic_func"].ToString());
                XTITLOCAL = Convert.ToBoolean(fila["titulo_localcom"].ToString());
                XCONTLOCAL = Convert.ToBoolean(fila["contra_localcom"].ToString());
                XRECIBO = Convert.ToBoolean(fila["recibo_agualuz"].ToString());
                XTIENLETR = Convert.ToBoolean(fila["tiene_letraprotestada"].ToString());
                XTIENMORO = Convert.ToBoolean(fila["tiene_morosidad"].ToString());
                XMOROSO = Convert.ToBoolean(fila["moroso_infocorp"].ToString());
                XREFCOMER = fila["refe_comerc"].ToString();
                XREFBANCA = fila["refe_banca"].ToString();
                XBIENMUEB = Convert.ToBoolean(fila["bienes_bienmueble"].ToString());
                XBIENINMUEB = Convert.ToBoolean(fila["bienes_inmuebles"].ToString());

                XPUNTAJE = Convert.ToInt32(fila["puntaje"].ToString());
                XEVALCXCOB = fila["eval_cxcob"].ToString();
                XOBSCXCOB = fila["obs_cxcob"].ToString();
                XAPROBGERE = fila["aprob_gerencial"].ToString();
                XOBSGEREN = fila["obs_gerencial"].ToString();
            }
            #endregion

            //define margins
            double leftMargin = 40.0;
            double rightMargin = 570.0;
            double topMargin = 20.0;
            double lineTop = 0d;
            double lineFooter = 780d;
            double rowStep = 12d;
            double newRow = topMargin + rowStep;
            double beginRow = newRow;
            double currentRow = beginRow;
            double currentRowCol2 = 0;
            double firstCustomerRow = 100d;
            double txtShift = 8d;
            string hcString = string.Empty; //---added 6-26-13
            string sim1 = "[";
            string sim2 = "]";
            string space = "   ";

            // TITULO
            gfx.DrawString("EVALUACION CREDITICIA", fontB18, XBrushes.Black, leftMargin + 20, topMargin + 40);

            pen = new XPen(XColors.Black, 2);
            gfx.DrawRoundedRectangle(pen, leftMargin + 300, topMargin + 15, 240, 50, 15, 15);

            // CUADRO
            gfx.DrawString("PROFORMA", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 30);
            gfx.DrawString(": PD-"+XSERDOC+Equivalencias.Right(XNUMDOC,4), font9, XBrushes.Black, leftMargin + 370, topMargin + 30);
            gfx.DrawString("FECHA", fontB9, XBrushes.Black, leftMargin + 440, topMargin + 30);
            gfx.DrawString(": " + Equivalencias.Left(XFECHA, 10), font9, XBrushes.Black, leftMargin + 480, topMargin + 30);
            gfx.DrawString("CLIENTE", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 40);
            gfx.DrawString(": "+Equivalencias.Left(XCTACTENAME,30) , font9, XBrushes.Black, leftMargin + 370, topMargin + 40);
            gfx.DrawString("RUC", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 50);
            gfx.DrawString(": "+XCLINMRUC, font9, XBrushes.Black, leftMargin + 370, topMargin + 50);
            gfx.DrawString("VENDEDOR", fontB9, XBrushes.Black, leftMargin + 310, topMargin + 60);
            gfx.DrawString(": "+XUSUAR, font9, XBrushes.Black, leftMargin + 370, topMargin + 60);

            // CONTENIDO
            gfx.DrawString("I.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 80);
            gfx.DrawString("DOCUMENTACION PARA LA EVALUACION CREDITICIA :", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 80);

            gfx.DrawString("1.", font9, XBrushes.Black, leftMargin + 50, topMargin + 95);
            gfx.DrawString("CONDICION JURIDICA DEL CLIENTE :", font9, XBrushes.Black, leftMargin + 70, topMargin + 95);
            if (XESJURIDICA)
            {
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 108);
                gfx.DrawString("PERSONA NATURAL", font9, XBrushes.Black, leftMargin + 90, topMargin + 108);
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 118);
                gfx.DrawString("PERSONA JURIDICA", font9, XBrushes.Black, leftMargin + 90, topMargin + 118);
            }
            else {
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 108);
                gfx.DrawString("PERSONA NATURAL", font9, XBrushes.Black, leftMargin + 90, topMargin + 108);
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 118);
                gfx.DrawString("PERSONA JURIDICA", font9, XBrushes.Black, leftMargin + 90, topMargin + 118);
            }

            gfx.DrawString("2.", font9, XBrushes.Black, leftMargin + 50, topMargin + 133);
            gfx.DrawString("DOCUMENTOS PRESENTADOS POR EL CLIENTE :", font9, XBrushes.Black, leftMargin + 70, topMargin + 133);
            // COLUMNA 1
            if(XCOPIACONST)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 146);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 146);
            gfx.DrawString("CONSTITUCION DE LA EMPRESA", font9, XBrushes.Black, leftMargin + 90, topMargin + 146);

            if(XCOPIARUC)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 156);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 156);
            gfx.DrawString("RUC", font9, XBrushes.Black, leftMargin + 90, topMargin + 156);

            if(XCOPIADNI)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 166);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 166);
            gfx.DrawString("DNI", font9, XBrushes.Black, leftMargin + 90, topMargin + 166);

            // COLUMNA 2
            if(XLICFUNC)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 146);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 146);
            gfx.DrawString("LIC. DE FUNCIONAMIENTO", font9, XBrushes.Black, leftMargin + 320, topMargin + 146);

            if(XTITLOCAL)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 156);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 156);
            gfx.DrawString("TITULO DE PROPIEDAD", font9, XBrushes.Black, leftMargin + 320, topMargin + 156);

            if(XCONTLOCAL)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 166);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 166);
            gfx.DrawString("CONTRATO DE LOCAL", font9, XBrushes.Black, leftMargin + 320, topMargin + 166);

            if(XRECIBO)
                gfx.DrawString(sim1 + "X" + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 176);
            else
                gfx.DrawString(sim1 + space + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 176);
            gfx.DrawString("RECIBO AGUA O LUZ", font9, XBrushes.Black, leftMargin + 320, topMargin + 176);

            gfx.DrawString("II.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 200);
            gfx.DrawString("FACTORES DE EVALUACION CREDITICIA:", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 200);

            // COLUMNA 1
            gfx.DrawString("3.", font9, XBrushes.Black, leftMargin + 50, topMargin + 215);
            gfx.DrawString("COMPORTAMIENTO DE PAGO", font9, XBrushes.Black, leftMargin + 70, topMargin + 215);

            gfx.DrawString("3.1", font9, XBrushes.Black, leftMargin + 70, topMargin + 228);
            gfx.DrawString("PROTESTOS DE LETRA", font9, XBrushes.Black, leftMargin + 90, topMargin + 228);
            string x1 = space, x2 = space;
            if (XTIENLETR)
                x1 = "X";
            else
                x2 = "X";
            gfx.DrawString(sim1 + x1 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 241);
            gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 241);
            gfx.DrawString(sim1 + x2 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 251);
            gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 251);

            gfx.DrawString("3.2", font9, XBrushes.Black, leftMargin + 70, topMargin + 264);
            gfx.DrawString("INCUMPLIMIENTO DE PAGO", font9, XBrushes.Black, leftMargin + 90, topMargin + 264);
            string x3 = space, x4 = space;
            if (XTIENMORO)
                x3 = "X";
            else
                x4 = "X";
            gfx.DrawString(sim1 + x3 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 277);
            gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 277);
            gfx.DrawString(sim1 + x4 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 287);
            gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 287);

            gfx.DrawString("4.", font9, XBrushes.Black, leftMargin + 50, topMargin + 310);
            gfx.DrawString("ANTECEDENTES INFOCORP", font9, XBrushes.Black, leftMargin + 70, topMargin + 310);
            string x5 = space, x6 = space;
            if (XMOROSO)
                x5 = "X";
            else
                x6 = "X";
            gfx.DrawString(sim1 + x5 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 323);
            gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 323);
            gfx.DrawString(sim1 + x6 + sim2, font9, XBrushes.Black, leftMargin + 90, topMargin + 333);
            gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 110, topMargin + 333);

            // COLUMNA 2
            gfx.DrawString("5.", font9, XBrushes.Black, leftMargin + 300, topMargin + 215);
            gfx.DrawString("REFERENCIAS COMERCIALES", font9, XBrushes.Black, leftMargin + 320, topMargin + 215);
            string xva1 = space, xva2 = space, xva3 = space;
            if (XREFCOMER.Length > 0)
            {
                if (XREFCOMER.ToString() == "B")
                    xva1 = "X";
                else if (XREFCOMER.ToString() == "R")
                    xva2 = "X";
                else if (XREFCOMER.ToString() == "M")
                    xva3 = "X";
            }
            gfx.DrawString(sim1 + xva1 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 228);
            gfx.DrawString("BUENA", font9, XBrushes.Black, leftMargin + 340, topMargin + 228);
            gfx.DrawString(sim1 + xva2 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 238);
            gfx.DrawString("REGULAR", font9, XBrushes.Black, leftMargin + 340, topMargin + 238);
            gfx.DrawString(sim1 + xva3 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 248);
            gfx.DrawString("MALA", font9, XBrushes.Black, leftMargin + 340, topMargin + 248);

            gfx.DrawString("6.", font9, XBrushes.Black, leftMargin + 300, topMargin + 271);
            gfx.DrawString("REFERENCIAS BANCARIAS", font9, XBrushes.Black, leftMargin + 320, topMargin + 271);
            string xva4 = space, xva5 = space, xva6 = space;
            if (XREFBANCA.Length > 0)
            {
                if (XREFBANCA.ToString() == "B")
                    xva4 = "X";
                else if (XREFBANCA.ToString() == "R")
                    xva5 = "X";
                else if (XREFBANCA.ToString() == "M")
                    xva6 = "X";
            }
            gfx.DrawString(sim1 + xva4 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 284);
            gfx.DrawString("BUENA", font9, XBrushes.Black, leftMargin + 340, topMargin + 284);
            gfx.DrawString(sim1 + xva5 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 294);
            gfx.DrawString("REGULAR", font9, XBrushes.Black, leftMargin + 340, topMargin + 294);
            gfx.DrawString(sim1 + xva6 + sim2, font9, XBrushes.Black, leftMargin + 320, topMargin + 304);
            gfx.DrawString("MALA", font9, XBrushes.Black, leftMargin + 340, topMargin + 304);

            gfx.DrawString("7.", font9, XBrushes.Black, leftMargin + 300, topMargin + 327);
            gfx.DrawString("EVALUACION PATRIMONIAL", font9, XBrushes.Black, leftMargin + 320, topMargin + 327);

            gfx.DrawString("7.1", font9, XBrushes.Black, leftMargin + 320, topMargin + 340);
            gfx.DrawString("BIENES MUEBLES", font9, XBrushes.Black, leftMargin + 340, topMargin + 340);
            string x7 = space, x8 = space;
            if (XBIENMUEB)
                x7 = "X";
            else
                x8 = "X";
            gfx.DrawString(sim1 + x7 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 351);
            gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 351);
            gfx.DrawString(sim1 + x8 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 361);
            gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 361);

            gfx.DrawString("7.2", font9, XBrushes.Black, leftMargin + 320, topMargin + 374);
            gfx.DrawString("BIENES INMUEBLES", font9, XBrushes.Black, leftMargin + 340, topMargin + 374);
            string x9 = space, x10 = space;
            if (XBIENINMUEB)
                x9 = "X";
            else
                x10 = "X";
            gfx.DrawString(sim1 + x9 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 387);
            gfx.DrawString("SI TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 387);
            gfx.DrawString(sim1 + x10 + sim2, font9, XBrushes.Black, leftMargin + 340, topMargin + 397);
            gfx.DrawString("NO TIENE", font9, XBrushes.Black, leftMargin + 360, topMargin + 397);

            //----------
            gfx.DrawString("III.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 420);
            gfx.DrawString("OPINION AREA DE VENTAS HORIZONTALES", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 420);
            string xcli1 = space, xcli2 = space, xcli3 = space;
            if (XEVALCXCOB.Length > 0)
            {
                if (XEVALCXCOB.ToString() == "CA")
                    xcli1 = "X";
                else if (XEVALCXCOB.ToString() == "CN")
                    xcli2 = "X";
                else if (XEVALCXCOB.ToString() == "CD")
                    xcli3 = "X";
            }
            gfx.DrawString(sim1 + xcli1 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 435);
            gfx.DrawString("CLIENTE ACEPTABLE", font9, XBrushes.Black, leftMargin + 90, topMargin + 435);
            gfx.DrawString(sim1 + xcli2 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 445);
            gfx.DrawString("CLIENTE NO ACEPTABLE", font9, XBrushes.Black, leftMargin + 90, topMargin + 445);
            gfx.DrawString(sim1 + xcli3 + sim2, font9, XBrushes.Black, leftMargin + 70, topMargin + 455);
            gfx.DrawString("CLIENTE DUDOSO", font9, XBrushes.Black, leftMargin + 90, topMargin + 455);

            gfx.DrawString("OTROS COMENTARIOS:", font9, XBrushes.Black, leftMargin + 50, topMargin + 475);
            gfx.DrawString("» "+XOBSCXCOB, font9, XBrushes.Black, leftMargin + 80, topMargin + 490);

            gfx.DrawString("IV.", fontB9, XBrushes.Black, leftMargin + 20, topMargin + 520);
            gfx.DrawString("APROBACIÓN GERENCIA GENERAL", fontB9, XBrushes.Black, leftMargin + 50, topMargin + 520);
            string x11 = space, x12 = space;
            if (XAPROBGERE == "32")
                x11 = "X";
            else if (XAPROBGERE == "39")
                x12 = "X";
            gfx.DrawString(sim1 + x11 + sim2, font9, XBrushes.Black, leftMargin + 200, topMargin + 533);
            gfx.DrawString("APROBADO", font9, XBrushes.Black, leftMargin + 220, topMargin + 533);
            gfx.DrawString(sim1 + x12 + sim2, font9, XBrushes.Black, leftMargin + 300, topMargin + 533);
            gfx.DrawString("NO APROBADO", font9, XBrushes.Black, leftMargin + 320, topMargin + 533);

            gfx.DrawString("OBSERVACIONES:", font9, XBrushes.Black, leftMargin + 50, topMargin + 553);
            gfx.DrawString("» " + XOBSGEREN, font9, XBrushes.Black, leftMargin + 80, topMargin + 568);
            string texto = "NOTA: A ESTE FORMATO SE DEBERA ANEXAR LA DOCUMENTACIÓN CORRESPONDIENTE";
            gfx.DrawString(texto, fontB9, XBrushes.Black, leftMargin + 50, topMargin + 598);

            //SE ENVIA EL PDF AL BROWSER
            MemoryStream stream = new MemoryStream();
            document.Save(stream, false);
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-length", stream.Length.ToString());
            Response.BinaryWrite(stream.ToArray());
            Response.Flush();
            stream.Close();
            Response.End();

        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
 void cargar_grilla()
 {
     tb_cxc_evalcredBL BL = new tb_cxc_evalcredBL();
     tb_cxc_evalcred BE = new tb_cxc_evalcred();
     TablaPendAprob = BL.GetAll_PendAprob("02", BE).Tables[0];
     if (TablaPendAprob.Rows.Count > 0)
     {
         GridView.DataSource = TablaPendAprob;
         GridView.DataBind();
     }
 }