protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ALCSA.Negocio.Cobranzas.DocumentoEstandard1 objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoEstandard1();
            objDocumento.ID                    = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDocumento1);
            objDocumento.IdCobranza            = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCobranza);
            objDocumento.RutDemandado2         = ALCSA.FWK.Web.Control.ExtraerValor(txtRutDeudor2).Replace(".", string.Empty);
            objDocumento.IdDomicilioDemandado  = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDomicilioDeudor);
            objDocumento.IdDomicilioDemandado2 = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDomicilioDeudor2);
            objDocumento.RutRepresLegal        = ALCSA.FWK.Web.Control.ExtraerValor(txtRutRepresentante).Replace(".", string.Empty);
            objDocumento.NomRepresLegal        = ALCSA.FWK.Web.Control.ExtraerValor(txtNombreRepresentante);
            objDocumento.DireRepresLegal       = ALCSA.FWK.Web.Control.ExtraerValor(txtDireccionRepresentante);
            objDocumento.ProfesionRepresLegal  = ALCSA.FWK.Web.Control.ExtraerValor(txtProfesionOficioRepresentante);
            objDocumento.Cuantia               = ALCSA.FWK.Web.Control.ExtraerValorComoDecimal(txtcuantia);
            objDocumento.RelacionHechos        = ALCSA.FWK.Web.Control.ExtraerValor(txtRelaciondeloshechos);
            objDocumento.Petitorio             = ALCSA.FWK.Web.Control.ExtraerValor(txtPetitorio);
            objDocumento.DocFundantes          = ALCSA.FWK.Web.Control.ExtraerValor(txtdocumentosfundantes);
            objDocumento.Observacion           = ALCSA.FWK.Web.Control.ExtraerValor(txtObservacion);

            objDocumento.Guardar();

            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("DocEstandar1{0}{1}", objDocumento.ID, Path.GetExtension(this.filesubir.PostedFile.FileName));
                // string str8 = UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_ESTANDAR_1,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objDocumento.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_DOCUMENTO_ESTANDAR_1,
                        Valor = objDocumento.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }

            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objDocumento.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_DOCUMENTO_ESTANDAR_UNO, intIdDocumento), true);
            }
        }
Exemple #2
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            DataTable table = null;

            table = Consulta.BuscarJuicio(this.hiddidcobranza.Value.ToString());
            if ((table.Rows.Count > 0) && (table != null))
            {
                this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Cobranza ya tiene juicio asociado');</script>");
                this.txtRol.Focus();
                return;
            }

            DateTime datFechaCorte = new DateTime(1900, 1, 1), datFechaRiesgo = new DateTime(1900, 1, 1);

            if (!string.IsNullOrEmpty(txtFechaIngCorte.Text))
            {
                DateTime.TryParseExact(txtFechaIngCorte.Text.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out datFechaCorte);
            }

            if (!string.IsNullOrEmpty(txtFechaRiesgo.Text))
            {
                DateTime.TryParseExact(txtFechaRiesgo.Text.Replace("-", "/"), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out datFechaRiesgo);
            }

            DataTable table2 = Transaccion.InsertaJuicio(
                this.hiddidcobranza.Value,
                this.Tribunal.SelectedValue,
                this.Abogado.SelectedValue,
                this.Procurador.SelectedValue,
                this.txtRol.Text,
                datFechaCorte,
                this.juris.SelectedValue,
                Convert.ToInt32(ddlRiesgo.SelectedValue),
                datFechaRiesgo
                );

            if (table2 != null && table2.Rows.Count > 0)
            {
                /*string idjuicio = table2.Rows[0][0].ToString();
                 * string nomArchivo = "";
                 * string path = base.Server.MapPath(@"~\DOCUMENTOS");
                 * nomArchivo = "DocJuicio" + idjuicio.ToString() + Path.GetExtension(this.filesubir.PostedFile.FileName);
                 * string str4 = filesubir.HasFile ? UTIL.SubirArchivo(this.filesubir, path, nomArchivo) : "OK";*/

                int intIdDocumento = 0;
                int intIdJuicio    = Convert.ToInt32(table2.Rows[0][0]);

                if (filesubir.HasFile)
                {
                    ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                    {
                        Nombre              = this.filesubir.PostedFile.FileName,
                        Descripcion         = string.Empty,
                        CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_JUICIO,
                        FechaIngreso        = DateTime.Now,
                        IdTipoDocumento     = 0,
                        Peso    = this.filesubir.PostedFile.ContentLength,
                        Archivo = this.filesubir.FileBytes
                    };
                    objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                    {
                        new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                        {
                            CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                            Valor = hiddidcobranza.Value
                        },
                        new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                        {
                            CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_JUICIO,
                            Valor = intIdJuicio.ToString()
                        }
                    });

                    intIdDocumento = objDocumentoFisico.ID;
                }

                /*if (str4 != "OK")
                 *  this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('" + str4.ToString() + "');</script>");
                 * else if (!string.IsNullOrEmpty(nomArchivo))
                 *  Transaccion.UpdateDocumentoJuicio(idjuicio, nomArchivo);*/

                this.Page.RegisterClientScriptBlock("Mensaje",
                                                    string.Format("<script>alert('Datos guardados correctamente');location.href='ActividadCobranza.aspx?Codigo={0}&idCobranza={1}&termino=N&id_doc={2}';</script>", intIdJuicio, hiddidcobranza.Value, intIdDocumento)
                                                    );
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                return;
            }

            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";

            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);

            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;

            CambiarColorControlesSoloLectura();

            ALCSA.Negocio.Cobranzas.DocumentoEstandard1 objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoEstandard1();
            if (objDocumento.CargarPorCobranza(intIdCobranza))
            {
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDocumento1, objDocumento.ID);
                txtRutDeudor2.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.RutDemandado2);

                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioDeudor, objDocumento.IdDomicilioDemandado);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioDeudor2, objDocumento.IdDomicilioDemandado2);

                txtRutRepresentante.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.RutRepresLegal);

                ALCSA.FWK.Web.Control.AsignarValor(txtNombreRepresentante, objDocumento.NomRepresLegal);
                ALCSA.FWK.Web.Control.AsignarValor(txtDireccionRepresentante, objDocumento.DireRepresLegal);
                ALCSA.FWK.Web.Control.AsignarValor(txtProfesionOficioRepresentante, objDocumento.ProfesionRepresLegal);
                ALCSA.FWK.Web.Control.AsignarValor(txtcuantia, objDocumento.Cuantia, 2);
                ALCSA.FWK.Web.Control.AsignarValor(txtRelaciondeloshechos, objDocumento.RelacionHechos);
                ALCSA.FWK.Web.Control.AsignarValor(txtPetitorio, objDocumento.Petitorio);
                ALCSA.FWK.Web.Control.AsignarValor(txtdocumentosfundantes, objDocumento.DocFundantes);
                ALCSA.FWK.Web.Control.AsignarValor(txtObservacion, objDocumento.Observacion);

                txtDomicilioDeudor.Text  = objDocumento.DireccionDemandado;
                txtDomicilioDeudor2.Text = objDocumento.DireccionDemandadoDos;
                txtNombreDeudor2.Text    = objDocumento.NombreDemandadoDos;

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objDocumento.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
            txtNumeroOperacion.Focus();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";

            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);

            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;

            CambiarColorControlesSoloLectura();

            ALCSA.Negocio.Cobranzas.DocumentoEstandard2 objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoEstandard2();
            if (objDocumento.CargarPorCobranza(intIdCobranza))
            {
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDocumento2, objDocumento.ID);
                ALCSA.FWK.Web.Control.AsignarValor(txtCaratulaJuicio, objDocumento.Txtcaratulajuicio);
                ALCSA.FWK.Web.Control.AsignarValor(txtJuzgado, objDocumento.Txtjuzgado);
                ALCSA.FWK.Web.Control.AsignarValor(txtRol, objDocumento.Txtrol);
                ALCSA.FWK.Web.Control.AsignarValor(txtTipoJuicio, objDocumento.Txttipojuicio);
                ALCSA.FWK.Web.Control.AsignarValor(txtMateria, objDocumento.Txtmateria);
                ALCSA.FWK.Web.Control.AsignarValor(txtDemandante, objDocumento.Txtdemandante);
                ALCSA.FWK.Web.Control.AsignarValor(txtDomicilioDemandante, objDocumento.Txtdomiciliodemandante);
                ALCSA.FWK.Web.Control.AsignarValor(txtRutDemandante, objDocumento.Txtrutdemandante);
                ALCSA.FWK.Web.Control.AsignarValor(txtAbogado, objDocumento.Txtabogado);
                ALCSA.FWK.Web.Control.AsignarValor(txtDomicilioabogado, objDocumento.Txtdomicilioabogado);
                ALCSA.FWK.Web.Control.AsignarValor(txtRutAbogado, objDocumento.Txtrutabogado);
                ALCSA.FWK.Web.Control.AsignarValor(txtDemandado, objDocumento.Txtdemandado);
                ALCSA.FWK.Web.Control.AsignarValor(txtRutDemandado, objDocumento.Txtrutdemandado);
                ALCSA.FWK.Web.Control.AsignarValor(txtRepresentante2, objDocumento.Txtrepresentante2);
                ALCSA.FWK.Web.Control.AsignarValor(txtActividad, objDocumento.Txtactividad);
                ALCSA.FWK.Web.Control.AsignarValor(txtActividad2, objDocumento.Txtactividad2);
                ALCSA.FWK.Web.Control.AsignarValor(txtDomicilio, objDocumento.Txtdomicilio);
                ALCSA.FWK.Web.Control.AsignarValor(txtmontoDemandado, objDocumento.Txtmontodemandado, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtTituloFunda, objDocumento.Txttitulofunda);
                ALCSA.FWK.Web.Control.AsignarValor(txtNroTitulo, objDocumento.Txtnrotitulo);
                ALCSA.FWK.Web.Control.AsignarValor(txtTipoNotificacion, objDocumento.Txttiponotificacion);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechasubasta, objDocumento.Txtfechasubasta);
                ALCSA.FWK.Web.Control.AsignarValor(txtMinimosubasta, objDocumento.Txtminimosubasta);
                ALCSA.FWK.Web.Control.AsignarValor(txtDocumentosfundantes, objDocumento.Txtdocumentosfundantes);
                ALCSA.FWK.Web.Control.AsignarValor(txtObservacion, objDocumento.Txtobservacion);

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objDocumento.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ALCSA.Negocio.Cobranzas.DocumentoEstandard2 objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoEstandard2();
            objDocumento.ID         = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDocumento2);
            objDocumento.IdCobranza = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCobranza);

            objDocumento.Txtcaratulajuicio      = ALCSA.FWK.Web.Control.ExtraerValor(txtCaratulaJuicio);
            objDocumento.Txtjuzgado             = ALCSA.FWK.Web.Control.ExtraerValor(txtJuzgado);
            objDocumento.Txtrol                 = ALCSA.FWK.Web.Control.ExtraerValor(txtRol);
            objDocumento.Txttipojuicio          = ALCSA.FWK.Web.Control.ExtraerValor(txtTipoJuicio);
            objDocumento.Txtmateria             = ALCSA.FWK.Web.Control.ExtraerValor(txtMateria);
            objDocumento.Txtdemandante          = ALCSA.FWK.Web.Control.ExtraerValor(txtDemandante);
            objDocumento.Txtdomiciliodemandante = ALCSA.FWK.Web.Control.ExtraerValor(txtDomicilioDemandante);
            objDocumento.Txtrutdemandante       = ALCSA.FWK.Web.Control.ExtraerValor(txtRutDemandante);
            objDocumento.Txtrepresentante       = string.Empty;
            objDocumento.Txtabogado             = ALCSA.FWK.Web.Control.ExtraerValor(txtAbogado);
            objDocumento.Txtdomicilioabogado    = ALCSA.FWK.Web.Control.ExtraerValor(txtDomicilioabogado);
            objDocumento.Txtrutabogado          = ALCSA.FWK.Web.Control.ExtraerValor(txtRutAbogado);
            objDocumento.Txtdemandado           = ALCSA.FWK.Web.Control.ExtraerValor(txtDemandado);
            objDocumento.Txtrutdemandado        = ALCSA.FWK.Web.Control.ExtraerValor(txtRutDemandado);
            objDocumento.Txtrepresentante2      = ALCSA.FWK.Web.Control.ExtraerValor(txtRepresentante2);
            objDocumento.Txtactividad           = ALCSA.FWK.Web.Control.ExtraerValor(txtActividad);
            objDocumento.Txtactividad2          = ALCSA.FWK.Web.Control.ExtraerValor(txtActividad2);
            objDocumento.Txtdomicilio           = ALCSA.FWK.Web.Control.ExtraerValor(txtDomicilio);
            objDocumento.Txtmontodemandado      = ALCSA.FWK.Web.Control.ExtraerValorComoDecimal(txtmontoDemandado);
            objDocumento.Txttitulofunda         = ALCSA.FWK.Web.Control.ExtraerValor(txtNroTitulo);
            objDocumento.Txtnrotitulo           = ALCSA.FWK.Web.Control.ExtraerValor(txtNroTitulo);
            objDocumento.Txttiponotificacion    = ALCSA.FWK.Web.Control.ExtraerValor(txtTipoNotificacion);
            objDocumento.Txtfechasubasta        = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechasubasta);
            objDocumento.Txtminimosubasta       = ALCSA.FWK.Web.Control.ExtraerValor(txtMinimosubasta);
            objDocumento.Txtdocumentosfundantes = ALCSA.FWK.Web.Control.ExtraerValor(txtDocumentosfundantes);
            objDocumento.Txtobservacion         = ALCSA.FWK.Web.Control.ExtraerValor(txtObservacion);

            objDocumento.Guardar();

            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("DocEstandar2{0}{1}", objDocumento.ID, Path.GetExtension(filesubir.PostedFile.FileName));
                // string str8 = UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_ESTANDAR_2,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objDocumento.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_DOCUMENTO_ESTANDAR_2,
                        Valor = objDocumento.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }

            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objDocumento.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_DOCUMENTO_ESTANDAR_DOS, intIdDocumento), true);
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ALCSA.Negocio.Cobranzas.DocumentoPagare objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoPagare();
            objDocumento.ID         = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDocuPagare);
            objDocumento.IdCobranza = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCobranza);

            objDocumento.Nropagare   = txtNroPagare.Text;
            objDocumento.IdDomicilio = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDireccionPagare);

            objDocumento.RutRepresentante1 = txtRutAval1.Text.Replace(".", string.Empty).Trim();
            objDocumento.IdDomiRepre1      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDireccionAval1);

            objDocumento.RutRepresentante2 = txtRutAval2.Text.Replace(".", string.Empty).Trim();
            objDocumento.IdDomiRepre2      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDireccionAval1);

            objDocumento.Montodemanda         = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtMontoDemanda);
            objDocumento.Montotaldeuda        = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtMontoTotalDeuda);
            objDocumento.Fsuscripcion         = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaSuscripcion);
            objDocumento.Sumainisuscripcion   = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtSumaInicialSuscripcion);
            objDocumento.IdMoneda             = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdTipoMoneda);
            objDocumento.Nrocuotas            = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtNroCuotas);
            objDocumento.Tasainteres          = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtTasaInteres);
            objDocumento.Vcto1cuota           = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtVcto1cuota);
            objDocumento.Vctosiguientescuotas = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtVstoSgteCuotas);
            objDocumento.Monto1cuotas         = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtMonto1cuota);
            objDocumento.Montoultimacuota     = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtMontoUltCuota);
            objDocumento.Fmora              = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechamora);
            objDocumento.Fprescripcion      = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechaprescripcion);
            objDocumento.Fliquidacion       = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaLiquidacion);
            objDocumento.IdComunaExhorto    = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdComunaExhorto);
            objDocumento.Fautorizacionfirma = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaAutoriFirma);
            objDocumento.IdNotaria          = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdNotario);
            objDocumento.IdComunaNotaria    = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdLocalidadNotario);
            objDocumento.Observacion        = txtObservacion.Text.Trim();

            objDocumento.Guardar();

            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("DocPagare{0}{1}", objDocumento.ID, Path.GetExtension(this.filesubir.PostedFile.FileName));
                // string str8 = UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                // GUARDAR ARCHIVO EN BASE DE DATOS
                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_PAGARE,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objDocumento.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_DOCUMENTO_PAGARE,
                        Valor = objDocumento.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }

            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objDocumento.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_DOCUMENTO_PAGARE, intIdDocumento), true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                return;
            }

            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";

            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);

            AsignarTitulo(objCobranza.IdMateria);

            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;

            CambiarColorControlesSoloLectura();

            ALCSA.Negocio.Cobranzas.DocumentoPagare objDocumento = new ALCSA.Negocio.Cobranzas.DocumentoPagare();
            if (objDocumento.CargarPorCobranza(intIdCobranza))
            {
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDocuPagare, objDocumento.ID);
                txtNroPagare.Text = objDocumento.Nropagare;

                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDireccionPagare, objDocumento.IdDomicilio);

                txtRutAval1.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.RutRepresentante1);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDireccionAval1, objDocumento.IdDomiRepre1);

                txtRutAval2.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.RutRepresentante2);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDireccionAval2, objDocumento.IdDomiRepre2);

                ALCSA.FWK.Web.Control.AsignarValor(txtMontoDemanda, objDocumento.Montodemanda, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtMontoTotalDeuda, objDocumento.Montotaldeuda, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaSuscripcion, objDocumento.Fsuscripcion);
                ALCSA.FWK.Web.Control.AsignarValor(txtSumaInicialSuscripcion, objDocumento.Sumainisuscripcion, 0);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdTipoMoneda, objDocumento.IdMoneda);
                ALCSA.FWK.Web.Control.AsignarValor(txtNroCuotas, objDocumento.Nrocuotas);
                ALCSA.FWK.Web.Control.AsignarValor(txtTasaInteres, objDocumento.Tasainteres, 2);
                ALCSA.FWK.Web.Control.AsignarValor(txtVcto1cuota, objDocumento.Vcto1cuota);
                ALCSA.FWK.Web.Control.AsignarValor(txtVstoSgteCuotas, objDocumento.Vctosiguientescuotas);
                ALCSA.FWK.Web.Control.AsignarValor(txtMonto1cuota, objDocumento.Monto1cuotas, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtMontoUltCuota, objDocumento.Montoultimacuota, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechamora, objDocumento.Fmora);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechaprescripcion, objDocumento.Fprescripcion);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaLiquidacion, objDocumento.Fliquidacion);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdComunaExhorto, objDocumento.IdComunaExhorto);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaAutoriFirma, objDocumento.Fautorizacionfirma);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdNotario, objDocumento.IdNotaria);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdLocalidadNotario, objDocumento.IdComunaNotaria);
                txtObservacion.Text = objDocumento.Observacion;

                txtTipoMoneda.Text    = objDocumento.NombreTipoMoneda;
                txtComunaExhorto.Text = objDocumento.NombreComunaExhorto;
                txtNotario.Text       = objDocumento.NombreNotario;

                txtNombreAval1.Text = objDocumento.NombreRepresentanteUno;
                txtNombreAval2.Text = objDocumento.NombreRepresentanteDos;

                txtLocalidadNotario.Text = objDocumento.NombreComunaNotario;
                txtDireccionAval1.Text   = objDocumento.DireccionRepresentanteUno;
                txtDireccionAval2.Text   = objDocumento.DireccionRepresentanteDos;
                txtDireccionPagare.Text  = objDocumento.DireccionPagare;

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objDocumento.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
            txtNumeroOperacion.Focus();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                return;
            }

            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";

            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);

            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;

            CambiarColorControlesSoloLectura();

            ALCSA.Negocio.Cobranzas.Mutuo objMutuo = new ALCSA.Negocio.Cobranzas.Mutuo();
            if (objMutuo.CargarPorCobranza(objCobranza.ID))
            {
                // CARGAR DATOS MUTUO
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdMutuo, objMutuo.ID);

                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioInmueble, objMutuo.IdBienRaiz);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioInmuebleActual, objMutuo.IdBienRaiz);

                ALCSA.FWK.Web.Control.SeleccionarValor(moneda, objMutuo.IdMoneda);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdSubProducto, objMutuo.Subproducto);

                txtNroDocum.Text       = objMutuo.Nrodocumento;
                txtSerieLetraCred.Text = objMutuo.SerieLetCred;

                ALCSA.FWK.Web.Control.AsignarValor(txtMontoCred1esc, objMutuo.MontoCred1Esc);
                ALCSA.FWK.Web.Control.AsignarValor(txtMontoCred2esc, objMutuo.MontoCred2Esc);
                ALCSA.FWK.Web.Control.AsignarValor(txtPlazoMutuoMeses, objMutuo.PlazoMutuoMes);
                ALCSA.FWK.Web.Control.AsignarValor(txtNumero1Divimpago, objMutuo.N1DivImpago);
                ALCSA.FWK.Web.Control.AsignarValor(txtNumeroUltDivImpago, objMutuo.NUltDivImpago);
                ALCSA.FWK.Web.Control.AsignarValor(txtMontoDivAdeudadoPESO, objMutuo.MontoDivAdeudadoPs);
                ALCSA.FWK.Web.Control.AsignarValor(txtTotalAdeudado, objMutuo.TotalAdeudado);

                ALCSA.FWK.Web.Control.AsignarValor(txtTasaInt1Esc, objMutuo.TazaInt1Esc, 2);
                ALCSA.FWK.Web.Control.AsignarValor(txtTasaInt2Esc, objMutuo.TazaInt2Esc, 2);
                ALCSA.FWK.Web.Control.AsignarValor(txtMontoDivAdeudadoUF, objMutuo.MontoDivAdeudadoUf, 2);
                ALCSA.FWK.Web.Control.AsignarValor(txtSaldoTotalDeudaUF, objMutuo.SaldoTotalDeudaUf, 2);

                ALCSA.FWK.Web.Control.AsignarValor(txtFechaPrescripcion, objMutuo.FechaPrescripcion);
                ALCSA.FWK.Web.Control.AsignarValor(txtFecha1Vcto, objMutuo.Fecha1Venc);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaLiquidacion, objMutuo.FechaLiquidacion);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaMora, objMutuo.FechaMora);

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objMutuo.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ALCSA.Negocio.Cobranzas.Mutuo objMutuo = new ALCSA.Negocio.Cobranzas.Mutuo();

            objMutuo.ID         = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdMutuo);
            objMutuo.IdCobranza = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCobranza);

            objMutuo.IdBienRaiz  = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdDomicilioInmueble);
            objMutuo.IdMoneda    = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(moneda);
            objMutuo.Subproducto = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdSubProducto);

            objMutuo.Nrodocumento = txtNroDocum.Text;
            objMutuo.SerieLetCred = txtSerieLetraCred.Text;

            objMutuo.MontoCred1Esc      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtMontoCred1esc);
            objMutuo.MontoCred2Esc      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtMontoCred2esc);
            objMutuo.PlazoMutuoMes      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtPlazoMutuoMeses);
            objMutuo.N1DivImpago        = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtNumero1Divimpago);
            objMutuo.NUltDivImpago      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtNumeroUltDivImpago);
            objMutuo.MontoDivAdeudadoPs = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtMontoDivAdeudadoPESO);
            objMutuo.TotalAdeudado      = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtTotalAdeudado);

            objMutuo.TazaInt1Esc        = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtTasaInt1Esc);
            objMutuo.TazaInt2Esc        = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtTasaInt2Esc);
            objMutuo.MontoDivAdeudadoUf = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtMontoDivAdeudadoUF);
            objMutuo.SaldoTotalDeudaUf  = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtSaldoTotalDeudaUF);

            objMutuo.FechaPrescripcion = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaPrescripcion);
            objMutuo.Fecha1Venc        = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFecha1Vcto);
            objMutuo.FechaLiquidacion  = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaLiquidacion);
            objMutuo.FechaMora         = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFechaMora);

            objMutuo.Guardar();

            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("DocMutuo{0}{1}", objMutuo.ID, Path.GetExtension(this.filesubir.PostedFile.FileName));
                // string str8 = UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_MUTUO,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objMutuo.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_MUTUO,
                        Valor = objMutuo.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }

            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objMutuo.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_MUTUO, intIdDocumento), true);
            }
        }
Exemple #10
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            DataTable table = ConsultasEspecificas.BuscarExhortoDupli(this.hiddidjuicio.Value.ToString(), this.tribunalexhorto.SelectedValue.ToString(), this.txtRolExhorto.Text);

            if (table != null && table.Rows.Count > 0)
            {
                this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Exhorto ya est\x00e1 registrado');</script>");
                this.tipoexhorto.Focus();
            }
            else
            {
                int intIdExhorto = Transaccion.InsertaExhorto(
                    this.hiddidjuicio.Value.ToString(),
                    this.tribunalexhorto.SelectedValue,
                    this.procurador.SelectedValue,
                    this.tipoexhorto.SelectedValue,
                    this.receptor.SelectedValue,
                    this.txtFechaingreso.Text,
                    this.txtRolExhorto.Text,
                    this.juris.SelectedValue.ToString(),
                    Convert.ToInt32(ddlComunas.SelectedValue)
                    );

                if (intIdExhorto > 0)
                {
                    int intIdDocumento = 0;

                    if (filesubir.HasFile)
                    {
                        ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                        {
                            Nombre              = this.filesubir.PostedFile.FileName,
                            Descripcion         = string.Empty,
                            CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_ESTANDAR_1,
                            FechaIngreso        = DateTime.Now,
                            IdTipoDocumento     = 0,
                            Peso    = this.filesubir.PostedFile.ContentLength,
                            Archivo = this.filesubir.FileBytes
                        };
                        objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                        {
                            new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                            {
                                CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_EXHORTO,
                                Valor = intIdExhorto.ToString()
                            },
                            new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                            {
                                CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_JUICIO,
                                Valor = hiddidjuicio.Value
                            }
                        });

                        intIdDocumento = objDocumentoFisico.ID;
                    }

                    this.Page.RegisterClientScriptBlock("Mensaje", string.Format("<script>location.href='BuscaCobranzaExhortos.aspx?mensaje=1&id_doc={0}';</script>", intIdDocumento));

                    /*
                     * string idexhorto = intIdExhorto.ToString();
                     * string nomArchivo = "";
                     * string path = base.Server.MapPath(@"~\DOCUMENTOS");
                     * nomArchivo = "DocExhorto" + idexhorto.ToString() + Path.GetExtension(this.filesubir.PostedFile.FileName);
                     * string str4 = UTIL.SubirArchivo(this.filesubir, path, nomArchivo);
                     * if (!(str4 == "OK"))
                     * {
                     *  this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('" + str4.ToString() + "');</script>");
                     * }
                     * else if (!string.IsNullOrEmpty(nomArchivo))
                     * {
                     *  Transaccion.UpdateDocumentoExhorto(idexhorto, nomArchivo);
                     *
                     * }
                     */
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            ALCSA.Negocio.Cobranzas.CuotaColegio objDocumento = new ALCSA.Negocio.Cobranzas.CuotaColegio();
            objDocumento.ID         = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCuotaColegio);
            objDocumento.IdCobranza = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdCobranza);

            objDocumento.Representante1 = ALCSA.FWK.Web.Control.ExtraerValor(txtRutRepresentante1).Replace(".", string.Empty);
            objDocumento.Representante2 = ALCSA.FWK.Web.Control.ExtraerValor(txtRutRepresentante2).Replace(".", string.Empty);

            objDocumento.Nrodocumento         = ALCSA.FWK.Web.Control.ExtraerValor(txtnrodocumento);
            objDocumento.IdTipoDocu           = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdTipoDocumento);
            objDocumento.Codigo               = ALCSA.FWK.Web.Control.ExtraerValor(txtcodigo);
            objDocumento.IdBanco              = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdBanco);
            objDocumento.Serie                = ALCSA.FWK.Web.Control.ExtraerValor(txtserie);
            objDocumento.Nrocuota             = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtnrocuota);
            objDocumento.Fechamora            = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechamora);
            objDocumento.Fechaingresocobranza = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechaingresocobranza);
            objDocumento.Fechavencimiento     = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechavcto);
            objDocumento.Fprescripcion        = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtfechaprescripcion);
            objDocumento.Mesmora              = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdMes);
            objDocumento.Aniomora             = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(txtaniomora);
            objDocumento.Montocapital         = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtmontocapital);
            objDocumento.Abonos               = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtabonos);
            objDocumento.Montointeres         = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtmontointeres);
            objDocumento.Saldodeuda           = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(txtsaldodeuda);
            objDocumento.Observacion          = ALCSA.FWK.Web.Control.ExtraerValor(txtobservacion);

            objDocumento.Guardar();

            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("CuotaColegio{0}{1}", objDocumento.ID, Path.GetExtension(this.filesubir.PostedFile.FileName));
                // string str8 = UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_CUOTA_COLEGIO,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objDocumento.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_CUOTA_COLEGIO,
                        Valor = objDocumento.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }

            // GENERAR ARCHIVO

            /*
             *  string text2 = dataTable3.Rows[0][0].ToString();
             *  string path = base.Server.MapPath("~\\DOCUMENTOS");
             *  string text3 = "DocCuotaColegio" + text2.ToString();
             *  text3 += Path.GetExtension(this.filesubir.PostedFile.FileName);
             *  string text4 = UTIL.SubirArchivo(this.filesubir, path, text3);
             *  Transaccion.UpdateDocumentoCuotaColegio(text2, text3);
             */

            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objDocumento.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_CUOTA_COLEGIO, intIdDocumento), true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                return;
            }

            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";

            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);

            AsignarTitulo(objCobranza.IdMateria);

            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;

            CambiarColorControlesSoloLectura();

            ALCSA.Negocio.Cobranzas.CuotaColegio objDocumento = new ALCSA.Negocio.Cobranzas.CuotaColegio();
            if (objDocumento.CargarPorCobranza(objCobranza.ID))
            {
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdCuotaColegio, objDocumento.ID);

                txtRutRepresentante1.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.Representante1);
                txtRutRepresentante2.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.Representante2);

                ALCSA.FWK.Web.Control.AsignarValor(txtnrodocumento, objDocumento.Nrodocumento);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdTipoDocumento, objDocumento.IdTipoDocu);
                ALCSA.FWK.Web.Control.AsignarValor(txtcodigo, objDocumento.Codigo);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdBanco, objDocumento.IdBanco);
                ALCSA.FWK.Web.Control.AsignarValor(txtserie, objDocumento.Serie);
                ALCSA.FWK.Web.Control.AsignarValor(txtnrocuota, objDocumento.Nrocuota);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechamora, objDocumento.Fechamora);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechaingresocobranza, objDocumento.Fechaingresocobranza);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechavcto, objDocumento.Fechavencimiento);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechaprescripcion, objDocumento.Fprescripcion);
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdMes, objDocumento.Mesmora);
                ALCSA.FWK.Web.Control.AsignarValor(txtaniomora, objDocumento.Aniomora);
                ALCSA.FWK.Web.Control.AsignarValor(txtmontocapital, objDocumento.Montocapital, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtabonos, objDocumento.Abonos, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtmontointeres, objDocumento.Montointeres, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtsaldodeuda, objDocumento.Saldodeuda, 0);
                ALCSA.FWK.Web.Control.AsignarValor(txtobservacion, objDocumento.Observacion);

                txtNombreRepresentante1.Text = objDocumento.NombreRepresentanteUno;
                txtNombreRepresentante2.Text = objDocumento.NombreRepresentanteDos;
                txtTipoDocumento.Text        = objDocumento.NombreTipoDocumento;
                txtBanco.Text = objDocumento.NombreBanco;
                txtMeses.Text = objDocumento.Mesmora > 0 ? ALCSA.FWK.Tiempo.MESES[objDocumento.Mesmora - 1] : string.Empty;

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objDocumento.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            // ----------------------------------------------------------------------------------
            int intPrimerId = 0;

            ALCSA.Negocio.Cobranzas.DocumentoJuicio objDocumento = null;
            // ----------------------------------------------------------------------------------
            foreach (GridViewRow objFila in gvDocumentos.Rows)
            {
                objDocumento = CrearObjetoDocuJuicio();

                objDocumento.Nrodocumento    = ALCSA.FWK.Web.Control.ExtraerValor(objFila.FindControl("txtNroDocumento") as TextBox).Trim();
                objDocumento.Numcheque       = objDocumento.Nrodocumento;
                objDocumento.Monto           = ALCSA.FWK.Web.Control.ExtraerValorComoFloat(objFila.FindControl("txtMonto") as TextBox);
                objDocumento.IdTipoDocumento = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(objFila.FindControl("ddlTiposDocumentos") as DropDownList);
                objDocumento.Fvencimiento    = ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(objFila.FindControl("txtFechaVencimiento") as TextBox);
                objDocumento.ID = ALCSA.FWK.Web.Control.ExtraerValorComoEntero(objFila.FindControl("hdfIdDocumentoJuicio") as HiddenField);

                if (objDocumento.IdTipoDocumento > 0 && !string.IsNullOrEmpty(objDocumento.Nrodocumento))
                {
                    objDocumento.Guardar();
                    if (intPrimerId.Equals(0))
                    {
                        intPrimerId = objDocumento.ID;
                    }
                }
                else if (objDocumento.ID > 0)
                {
                    objDocumento.Eliminar();
                }
            }
            // ----------------------------------------------------------------------------------
            // NO SE INGRESARON DOCUMENTOS
            if (intPrimerId.Equals(0))
            {
                objDocumento = CrearObjetoDocuJuicio();
                objDocumento.Guardar();
                intPrimerId = objDocumento.ID;
            }
            // ----------------------------------------------------------------------------------
            int intIdDocumento = 0;

            if (filesubir.HasFile)
            {
                // string nomArchivo = string.Format("DocJuicio{0}{1}", intPrimerId, Path.GetExtension(this.filesubir.PostedFile.FileName));
                // string str8 = ALCLOCAL.UTIL.SubirArchivo(filesubir, Server.MapPath(@"~\DOCUMENTOS"), nomArchivo);

                ALCSA.Negocio.Documentos.Fisicos.Documento objDocumentoFisico = new ALCSA.Negocio.Documentos.Fisicos.Documento()
                {
                    Nombre              = this.filesubir.PostedFile.FileName,
                    Descripcion         = string.Empty,
                    CodigoTipoDocumento = TipoDocumento.TIPO_DOCUMENTO_JUICIO,
                    FechaIngreso        = DateTime.Now,
                    IdTipoDocumento     = 0,
                    Peso    = this.filesubir.PostedFile.ContentLength,
                    Archivo = this.filesubir.FileBytes
                };
                objDocumentoFisico.Insertar(new List <ALCSA.Entidades.Documentos.Fisicos.Identificador>()
                {
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA,
                        Valor = objDocumento.IdCobranza.ToString()
                    },
                    new ALCSA.Negocio.Documentos.Fisicos.Identificador()
                    {
                        CodigoTipoIdentificador = TipoIdentificador.TIPO_IDENTIFICADOR_DOCUMENTO_JUICIO,
                        Valor = objDocumento.ID.ToString()
                    }
                });

                intIdDocumento = objDocumentoFisico.ID;
            }
            // ----------------------------------------------------------------------------------
            // GENERAR ARCHIVO
            if (ALCSA.FWK.Web.Control.ExtraerValorComoEntero(hdfIdEsCobranzaNueva) == 1)
            {
                Response.Redirect(string.Format("Cobranza.aspx?mensaje=1&id_doc={0}", intIdDocumento), true);
            }
            else
            {
                Response.Redirect(string.Format("../Demandas/DatosCobranza.aspx?gen_doc=1&id_cob={0}&tipo={1}&id_doc={2}", objDocumento.IdCobranza, ALCSA.Negocio.Cobranzas.Cobranza.TIPO_COBRANZA_DOCUMENTO_JUICIO, intIdDocumento), true);
            }
            // ----------------------------------------------------------------------------------
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // ----------------------------------------------------------------------------------
            if (this.Page.IsPostBack)
            {
                return;
            }
            // ----------------------------------------------------------------------------------
            ALCSA.Negocio.ServiciosJson.ListadorConceptos objConcepto = new ALCSA.Negocio.ServiciosJson.ListadorConceptos();
            ddlNotarios.DataSource = objConcepto.Listar("NOTARIOS");
            ddlNotarios.DataBind();
            ddlNotarios.Items.Insert(0, new ListItem("...", "0"));

            ddlLocalidadesNotarios.DataSource = objConcepto.Listar("COMUNAS_NOTARIO");
            ddlLocalidadesNotarios.DataBind();
            ddlLocalidadesNotarios.Items.Insert(0, new ListItem("...", "0"));

            ddlBancos.DataSource = objConcepto.Listar("BANCOS");
            ddlBancos.DataBind();
            ddlBancos.Items.Insert(0, new ListItem("...", "0"));
            // ----------------------------------------------------------------------------------
            int intIdCobranza = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "id_cob");

            if (intIdCobranza < 1)
            {
                return;
            }
            hdfIdEsCobranzaNueva.Value = ALCSA.FWK.Web.Sitio.ExtraerValorQueryStringComoEntero(Request, "es_nueva").ToString();
            btnGuardar.Text            = hdfIdEsCobranzaNueva.Value.Equals("1") ? "GUARDAR" : "GUARDAR Y GENERAR";
            // ----------------------------------------------------------------------------------
            ALCSA.Negocio.Cobranzas.Cobranza objCobranza = new ALCSA.Negocio.Cobranzas.Cobranza(intIdCobranza);
            ALCSA.FWK.Web.Control.AsignarValor(hdfIdCobranza, objCobranza.ID);
            // ----------------------------------------------------------------------------------
            AsignarTitulo(objCobranza.IdMateria);
            // ----------------------------------------------------------------------------------
            txtNumeroOperacion.Text = objCobranza.Nrooperacion;
            txtRutCliente.Text      = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutCli);
            txtRutDeudor.Text       = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objCobranza.RutDeudor);
            txtNombreCliente.Text   = objCobranza.NombreCliente;
            txtNombreDeudor.Text    = objCobranza.NombreDeudor;
            // ----------------------------------------------------------------------------------
            CambiarColorControlesSoloLectura();
            // ----------------------------------------------------------------------------------
            IList <ALCSA.Entidades.Cobranzas.DocumentoJuicio> arrDocumentos = new ALCSA.Negocio.Cobranzas.DocumentoJuicio().Listar(intIdCobranza);

            // ----------------------------------------------------------------------------------
            if (arrDocumentos.Count > 0)
            {
                ALCSA.Entidades.Cobranzas.DocumentoJuicio objDocumento = arrDocumentos[0];
                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioDeudor, objDocumento.IdDomicilio);

                txtRutRepresentanteUno.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.Representante1);
                txtRutRepresentanteDos.Text = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.Representante2);
                txtRutEndosante.Text        = ALCSA.FWK.IdentificacionTributaria.FormatearRut(objDocumento.RutDeudorEndosante);

                ALCSA.FWK.Web.Control.AsignarValor(hdfIdDomicilioEndosante, objDocumento.IdDomicilioEndosante);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaAceptacion, objDocumento.Faceptacion);
                ALCSA.FWK.Web.Control.SeleccionarValor(ddlNotarios, objDocumento.IdNotario);
                ALCSA.FWK.Web.Control.SeleccionarValor(ddlLocalidadesNotarios, objDocumento.IdComunaNotario);
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaAutorizacionNotarial, objDocumento.Fautorizacionnotarial);

                txtTituloConstaDeuda.Text = objDocumento.Tituloconstadeuda;
                ALCSA.FWK.Web.Control.AsignarValor(txtFechaDeuda, objDocumento.Fdeuda);
                ALCSA.FWK.Web.Control.SeleccionarValor(ddlBancos, objDocumento.IdBanco);
                txtCtacte.Text = objDocumento.Ctacte;
                txtserie.Text  = objDocumento.Numserie;

                ALCSA.FWK.Web.Control.AsignarValor(txtFechaGiroEmision, objDocumento.Fgiroemision);
                ALCSA.FWK.Web.Control.AsignarValor(txtfechaprescripcion, objDocumento.Fprescripcion);
                txtActaProtesto.Text  = objDocumento.Actaprotesto;
                txtDireccionActa.Text = objDocumento.Direccionacta;
                txtObservacion.Text   = objDocumento.Observacion;

                txtNombreRepresentanteUno.Text = objDocumento.NombreRepresentanteUno;
                txtNombreRepresentanteDos.Text = objDocumento.NombreRepresentanteDos;
                txtNombreEndosante.Text        = objDocumento.NombreEndosante;

                txtDomicilioEndosante.Text = objDocumento.DireccionEndosante;
                txtDomicilioDeudor.Text    = objDocumento.DireccionDeudor;

                IList <ALCSA.Entidades.Documentos.Fisicos.Documento> arrDocumentosFisicos = new ALCSA.Negocio.Documentos.Fisicos.Documento().Listar(
                    objDocumento.IdCobranza.ToString(),
                    ALCSA.Negocio.Documentos.Fisicos.TipoIdentificador.TIPO_IDENTIFICADOR_COBRANZA);

                if (arrDocumentosFisicos != null && arrDocumentosFisicos.Count > 0)
                {
                    gvDocumentosFisicos.DataSource = arrDocumentosFisicos;
                    gvDocumentosFisicos.DataBind();
                }
            }
            // ----------------------------------------------------------------------------------
            while (arrDocumentos.Count < 10)
            {
                arrDocumentos.Add(new ALCSA.Entidades.Cobranzas.DocumentoJuicio()
                {
                    ID = 0, Monto = 0, Nrodocumento = string.Empty, IdTipoDocumento = 0
                });
            }

            gvDocumentos.DataSource = arrDocumentos;
            gvDocumentos.DataBind();

            foreach (GridViewRow objFila in gvDocumentos.Rows)
            {
                TextBox txtFecha = objFila.FindControl("txtFechaVencimiento") as TextBox;
                txtFecha.Text = txtFecha.Text.Replace("-", "/");
                if (ALCSA.FWK.Web.Control.ExtraerValorComoDateTime(txtFecha).Year < 1950)
                {
                    txtFecha.Text = string.Empty;
                }
            }
            // ----------------------------------------------------------------------------------
            txtNumeroOperacion.Focus();
            // ----------------------------------------------------------------------------------
        }