Пример #1
0
        /* ID TIPO TRANSACCION
         * Comisión = 2
         * Servicio de Gestión Legal = 4
         * Timbre Impuesto y Estampilla (Cargo Multiaval) = 7
         * Comisión Fogape = 8
         * Fondo Retenido =
         */

        protected void Page_Load(object sender, EventArgs e)
        {
            LogicaNegocio Ln = new LogicaNegocio();

            if (Page.Session["RESUMEN"] != null)
            {
                ViewState["RES"] = (Resumen)Page.Session["RESUMEN"];
            }
            asignacionResumen(ref objresumen);

            DataTable       tabla   = null;
            SPWeb           app2    = SPContext.Current.Web;
            DataTable       dt2     = new DataTable("dt");
            ValidarPermisos validar = new ValidarPermisos
            {
                NombreUsuario = util.ObtenerValor(app2.CurrentUser.Name),
                Pagina        = pagina,
                Etapa         = objresumen.area,
            };

            dt2 = validar.ListarPerfil(validar);
            if (dt2.Rows.Count > 0)
            {
                if (!Page.IsPostBack)
                {
                    if (Page.Session["RESUMEN"] != null)
                    {
                        //BtnConciliar.Visible = false;
                        //pnFormularioConciliacion.Visible = false;
                        ViewState["BUSQUEDA"]    = Page.Session["BUSQUEDA"];
                        Page.Session["BUSQUEDA"] = null;

                        objresumen              = (Resumen)Page.Session["RESUMEN"];
                        ViewState["RES"]        = objresumen;
                        tabla                   = Ln.ConsultarOperacion(int.Parse(objresumen.idOperacion.ToString()));
                        Page.Session["RESUMEN"] = null;

                        lbEmpresa.Text   = objresumen.desEmpresa;
                        lbRut.Text       = objresumen.rut;
                        lbEjecutivo.Text = objresumen.descEjecutivo;
                        lbOperacion.Text = objresumen.desOperacion.ToString();

                        ocultarDiv();
                        DataSet dt = new DataSet();
                        string  descTipoTransaccion = System.Web.HttpUtility.HtmlDecode(Page.Request.QueryString["idTT"] as string);

                        idTransaccion.Text = descTipoTransaccion;
                        //lbTitulo.Text = descTipoTransaccion;
                        pnDatos.Visible           = false;
                        pnDatosAsesoria.Visible   = false;
                        pnDatosDevolucion.Visible = false;
                        dt = Ln.ConsultaDatosContabilidad(objresumen.idEmpresa.ToString(), objresumen.idOperacion.ToString(), objresumen.idUsuario, objresumen.descCargo, descTipoTransaccion);

                        if (dt.Tables[1].Rows.Count > 0)
                        {
                            txtRanzonSocial.Text = dt.Tables[1].Rows[0]["RazonSocial"].ToString();
                            txtRut.Text          = dt.Tables[1].Rows[0]["Rut"].ToString();
                            txtActEconomica.Text = dt.Tables[1].Rows[0]["DescActividad"].ToString();
                            txtDireccion.Text    = dt.Tables[1].Rows[0]["direccion"].ToString();
                            txtComuna.Text       = dt.Tables[1].Rows[0]["DescComuna"].ToString();
                            txtProvincia.Text    = dt.Tables[1].Rows[0]["DescProvincia"].ToString();
                            txtRegion.Text       = dt.Tables[1].Rows[0]["DescRegion"].ToString();
                            txtTelefonof.Text    = dt.Tables[1].Rows[0]["TelFijo1"].ToString();
                            txtEmail.Text        = dt.Tables[1].Rows[0]["EMail"].ToString();
                        }

                        if (dt.Tables[0].Rows.Count > 0)
                        {
                            if (descTipoTransaccion != "3" && descTipoTransaccion != "1")
                            {
                                pnDatos.Visible             = true;
                                txtCertificado.Text         = dt.Tables[0].Rows[0]["NCertificado"].ToString();
                                txtMonto.Text               = dt.Tables[0].Rows[0]["MontoOperacion"].ToString();
                                txtFechaEmision.Text        = dt.Tables[0].Rows[0]["fecEmision"].ToString();
                                txtFechaVencimiento.Text    = dt.Tables[0].Rows[0]["fechaVencimiento"].ToString();
                                txtComisionCLp.Text         = dt.Tables[0].Rows[0]["comisionCLP"].ToString();
                                txtFondo.Text               = dt.Tables[0].Rows[0]["fondo"].ToString();
                                txtProducto.Text            = dt.Tables[0].Rows[0]["descProducto"].ToString();
                                txtGastosOperacionales.Text = dt.Tables[0].Rows[0]["gastosOperacionales"].ToString();
                                lbTitulo.Text               = dt.Tables[0].Rows[0]["descTipoTransaccion"].ToString();
                                txtAcreedor.Text            = dt.Tables[0].Rows[0]["Acreedor"].ToString();
                                txtSeguro.Text              = dt.Tables[0].Rows[0]["costoSeguro"].ToString();
                                lbseguro.Text               = dt.Tables[0].Rows[0]["incluido"].ToString();
                                txtPlazo.Text               = dt.Tables[0].Rows[0]["PlazoMeses"].ToString();
                                lbcomision.Text             = dt.Tables[0].Rows[0]["incluidoComision"].ToString();
                                lbgastosOpe.Text            = dt.Tables[0].Rows[0]["incluidoGastosOperacionales"].ToString();

                                txtSeguroDesgravamen.Text = dt.Tables[0].Rows[0]["costoSeguroDesgravamen"].ToString();
                                lbSeguroDesgravamen.Text  = dt.Tables[0].Rows[0]["incluidoDesgravamen"].ToString();

                                txtTimbreyEstAcreedor.Text = dt.Tables[0].Rows[0]["TimbreYEstampillaAcreedor"].ToString();
                                lbTimbreyEstAcreedor.Text  = dt.Tables[0].Rows[0]["incluidoTimbreYEstampillaAcreedor"].ToString();

                                txtComisionFogape.Text = dt.Tables[0].Rows[0]["MontoComisionFogape"].ToString();

                                txtTimbreyEstMultiaval.Text = dt.Tables[0].Rows[0]["TimbreYEstampilla"].ToString();
                                lbTimbreyEstMultiaval.Text  = dt.Tables[0].Rows[0]["incluidoTimbreYEstampilla"].ToString();

                                txtNotario.Text = dt.Tables[0].Rows[0]["Notario"].ToString();
                                lbNotario.Text  = dt.Tables[0].Rows[0]["incluidoNotario"].ToString();
                            }

                            if (descTipoTransaccion == "3")
                            {
                                pnDatosDevolucion.Visible = true;
                                txtCertificadoD.Text      = dt.Tables[0].Rows[0]["NCertificado"].ToString();
                                txtMontoD.Text            = dt.Tables[0].Rows[0]["MontoOperacion"].ToString();
                                txtFechaEmisionD.Text     = dt.Tables[0].Rows[0]["fecEmision"].ToString();
                                txtComisionCLPD.Text      = dt.Tables[0].Rows[0]["comisionCLP"].ToString();
                                txtProductoD.Text         = dt.Tables[0].Rows[0]["descProducto"].ToString();

                                txtGastosOperacionales.Text = dt.Tables[0].Rows[0]["gastosOperacionales"].ToString();
                                txtAcreedorD.Text           = dt.Tables[0].Rows[0]["Acreedor"].ToString();
                                txtFondoD.Text               = dt.Tables[0].Rows[0]["fondo"].ToString();
                                txtCostoFondoD.Text          = dt.Tables[0].Rows[0]["costoFondo"].ToString();
                                txtNroFacturaComisión.Text   = dt.Tables[0].Rows[0]["NroFactura"].ToString();
                                txtFechaFacturaComision.Text = dt.Tables[0].Rows[0]["FechaFactura"].ToString();
                                txtTipoContrato.Text         = dt.Tables[0].Rows[0]["tipoContrato"].ToString();
                                txtDevolucionFinal.Text      = dt.Tables[0].Rows[0]["devolucionFinal"].ToString();
                                txtDevolucionCostoFondo.Text = dt.Tables[0].Rows[0]["devolucionCostoFondo"].ToString();
                                txtGatosOperacionalesP.Text  = dt.Tables[0].Rows[0]["GastosOperacionalPendiente"].ToString();
                                lbTitulo.Text = "Devolución";
                                lbTitulo.Text = dt.Tables[0].Rows[0]["descTipoTransaccion"].ToString();
                            }

                            if (descTipoTransaccion == "1")
                            {
                                pnDatosAsesoria.Visible = true;
                                txtComisionA.Text       = dt.Tables[0].Rows[0]["comisionCLP"].ToString();
                                txtProductoA.Text       = dt.Tables[0].Rows[0]["descProducto"].ToString();
                                txtFechaEstimada.Text   = dt.Tables[0].Rows[0]["fecEstimadaCierre"].ToString();
                                lbTitulo.Text           = "Asesoría";
                                lbTitulo.Text           = dt.Tables[0].Rows[0]["descTipoTransaccion"].ToString();
                            }
                        }

                        //DataTable dt1 = new DataTable();
                        //dt1 = LN.ConsultaFacturacion(objresumen.idEmpresa.ToString(), objresumen.idOperacion.ToString(), objresumen.idUsuario, objresumen.descCargo, descTipoTransaccion);

                        //if (dt1.Rows.Count > 0)
                        //{
                        //    if (dt1.Rows[0]["fecFactura"].ToString() != "")
                        //    {
                        //        dctFechaFactura.SelectedDate = Convert.ToDateTime(dt1.Rows[0]["fecFactura"].ToString());
                        //    }

                        //    txt_Factura.Text = dt1.Rows[0]["numFactura"].ToString();
                        //}

                        CargarDatosConciliacion(descTipoTransaccion);
                        CargarDatosContable(descTipoTransaccion, dt.Tables[0].Rows[0]["fecEmision"].ToString(), dt.Tables[0].Rows[0]["NCertificado"].ToString(), lbTitulo.Text, dt.Tables[0].Rows[0]["IdIVA"].ToString(), dt.Tables[0].Rows[0]["IdTipoDocumento"].ToString());
                    }
                    else
                    {
                        Page.Response.Redirect("MensajeSession.aspx");
                    }
                }

                validar.Permiso      = dt2.Rows[0]["Permiso"].ToString();
                ViewState["validar"] = validar;
                Control divFormulario = this.FindControl("dvFormulario");
                bool    TieneFiltro   = true;

                if (divFormulario != null)
                {
                    util.bloquear(divFormulario, dt2.Rows[0]["Permiso"].ToString(), TieneFiltro);
                }
                else
                {
                    dvFormulario.Style.Add("display", "none");
                    dvWarning1.Style.Add("display", "block");
                    lbWarning1.Text = "Usuario sin permisos configurados";
                }
            }
            else
            {
                dvFormulario.Style.Add("display", "none");
                dvWarning1.Style.Add("display", "block");
                lbWarning1.Text = "Usuario sin permisos configurados";
            }
        }