Exemplo n.º 1
0
        protected void onLoadGrid()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAntPagos oPagos = new cAntPagos(ref oConn);
                oPagos.CodUsuario = oIsUsuario.CodUsuario;
                oPagos.Estado     = "C";

                if (!string.IsNullOrEmpty(txt_num_valija.Text))
                {
                    oPagos.CodPagos = txt_num_valija.Text;
                }

                if (!string.IsNullOrEmpty(cmb_centrodistribucion.SelectedValue))
                {
                    oPagos.CodCentroDist = cmb_centrodistribucion.SelectedValue;
                }

                if (!string.IsNullOrEmpty(cmb_documento.SelectedValue))
                {
                    oPagos.CodTipoPago = cmb_documento.SelectedValue;
                }

                if (!string.IsNullOrEmpty(txt_cliente.Text))
                {
                    oPagos.RazonSocial = txt_cliente.Text;
                }

                if ((!string.IsNullOrEmpty(hdd_fch_inicio.Value)) && (!string.IsNullOrEmpty(hdd_fch_hasta.Value)))
                {
                    oPagos.FechaInicial = DateTime.Parse(hdd_fch_inicio.Value).ToString("yyyyMMdd");
                    oPagos.FechaFinal   = DateTime.Parse(hdd_fch_hasta.Value).ToString("yyyyMMdd");
                }

                if ((!string.IsNullOrEmpty(txt_num_documento.Text)) && (!string.IsNullOrEmpty(cmd_tipo_documento.SelectedValue)))
                {
                    oPagos.TipoDocumento = cmd_tipo_documento.SelectedValue;
                    oPagos.NumDocumento  = txt_num_documento.Text;
                }

                gdPagos.DataSource = oPagos.GetPagosValidar();
                gdPagos.DataBind();
                oConn.Close();
            }
        }
Exemplo n.º 2
0
        protected void btnRechazar_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAntPagos oPagos = new cAntPagos(ref oConn);
                oPagos.CodPagos             = hdd_cod_pago.Value;
                oPagos.ImporteTotalRecibido = hdd_importetotal_recibido.Value;
                oPagos.Discrepancia         = hdd_total_discrepancia.Value;
                oPagos.Estado = "A";
                oPagos.Accion = "EDITAR";
                oPagos.Put();
                oConn.Close();
            }

            StringBuilder sHmtl = new StringBuilder();

            sHmtl.Append("Se informa que la valija # ").Append(lblValija.Text).Append(" a sido rechazada.");

            AppSettingsReader appReader = new System.Configuration.AppSettingsReader();
            string            sEmlAddr  = appReader.GetValue("AntalisMail", typeof(string)).ToString();

            oEmailing.FromName = Application["NameSender"].ToString();
            oEmailing.From     = Application["EmailSender"].ToString();
            oEmailing.Address  = sEmlAddr;
            oEmailing.Subject  = "Valija # " + lblValija.Text + ", RECHAZADA";
            oEmailing.Body     = sHmtl;
            oEmailing.EmailSend();

            Log oLog = new Log();

            oLog.IdUsuario = oIsUsuario.CodUsuario;
            oLog.ObsLog    = "RECHAZO VALIJA #" + hdd_cod_pago.Value;
            oLog.CodEvtLog = "2";
            oLog.AppLog    = "ANTALIS";
            oLog.putLog();

            Response.Redirect("controllerpagos.aspx");
        }
Exemplo n.º 3
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAntPagos oPagos = new cAntPagos(ref oConn);
                oPagos.CodPagos             = hdd_cod_pago.Value;
                oPagos.ImporteTotalRecibido = hdd_importetotal_recibido.Value;
                oPagos.Discrepancia         = hdd_total_discrepancia.Value;
                oPagos.Estado = "V";
                oPagos.Accion = "EDITAR";
                oPagos.Put();
                oConn.Close();
            }

            string lblTitulo = string.Empty;

            switch (hdd_tipo_documento.Value)
            {
            case "1":
                lblTitulo = "CHEQUES AL DÍA";
                break;

            case "2":
                lblTitulo = "CHEQUES AL FECHA";
                break;

            case "4":
                lblTitulo = "LETRA";
                break;

            case "5":
                lblTitulo = "TARJETA";
                break;

            case "6":
                lblTitulo = "TRANSFERENCIA";
                break;
            }

            StringBuilder sHmtl = new StringBuilder();

            sHmtl.Append("Se informa que la valija # ").Append(lblValija.Text).Append(", de tipo de pago ").Append(lblTitulo).Append("  a sido validada.");

            AppSettingsReader appReader = new System.Configuration.AppSettingsReader();
            string            sEmlAddr  = appReader.GetValue("AntalisMail", typeof(string)).ToString();

            oEmailing.FromName = Application["NameSender"].ToString();
            oEmailing.From     = Application["EmailSender"].ToString();
            oEmailing.Address  = sEmlAddr;
            oEmailing.Subject  = "Valija # " + lblValija.Text + ", VALIDADA";
            oEmailing.Body     = sHmtl;
            oEmailing.EmailSend();

            Log oLog = new Log();

            oLog.IdUsuario = oIsUsuario.CodUsuario;
            oLog.ObsLog    = "VALIDADO VALIJA #" + hdd_cod_pago.Value;
            oLog.CodEvtLog = "2";
            oLog.AppLog    = "ANTALIS";
            oLog.putLog();

            Response.Redirect("controllerpagos.aspx");
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oIsUsuario = oWeb.ValidaUserAppReport();
            //getMenu(idReportePago, oIsUsuario.CodUsuario, "1");
            //getMenu(idProcesoSeguimiento, oIsUsuario.CodUsuario, "2");
            //getMenu(idCartolas, oIsUsuario.CodUsuario, "3");
            //getMenu(idProcesoNormalizacion, oIsUsuario.CodUsuario, "4");
            //getMenu(idIndicadoresClaves, oIsUsuario.CodUsuario, "5");
            //getMenu(IndClasificacionRiesgo, oIsUsuario.CodUsuario, "6");

            //getMenuAntalis(indAntalis, oIsUsuario.CodUsuario);

            if (!IsPostBack)
            {
                hdd_cod_pago.Value = oWeb.GetData("CodPago");
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    cAntPagos oPagos = new cAntPagos(ref oConn);
                    oPagos.CodPagos = hdd_cod_pago.Value;
                    DataTable dt = oPagos.Get();
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            lblValija.Text = "# Valija " + dt.Rows[0]["cod_pago"].ToString();

                            cCliente oCliente = new cCliente(ref oConn);
                            oCliente.CodNkey = dt.Rows[0]["nkey_cliente"].ToString();
                            DataTable dtCliente = oCliente.GeCliente();
                            if (dtCliente != null)
                            {
                                if (dtCliente.Rows.Count > 0)
                                {
                                    lblRazonSocial.Text = dtCliente.Rows[0]["cliente"].ToString();
                                }
                            }
                            dtCliente = null;

                            cAntCentrosDistribucion oCentrosDistribucion = new cAntCentrosDistribucion(ref oConn);
                            oCentrosDistribucion.CodCentroDist = dt.Rows[0]["cod_centrodist"].ToString();
                            DataTable dtCentro = oCentrosDistribucion.GetByCod();
                            if (dtCentro != null)
                            {
                                if (dtCentro.Rows.Count > 0)
                                {
                                    lblCentroDistribucion.Text = dtCentro.Rows[0]["descripcion"].ToString();
                                }
                            }
                            dtCentro = null;

                            lblFecharecepcion.Text   = dt.Rows[0]["fech_recepcion"].ToString();
                            hdd_tipo_documento.Value = dt.Rows[0]["cod_tipo_pago"].ToString();
                            string lblTitulo = string.Empty;
                            switch (dt.Rows[0]["cod_tipo_pago"].ToString())
                            {
                            case "1":
                                lblTitulo = "VALIDACIÓN DE RECAUDACIÓN DE PAGOS / CHEQUES AL DÍA";
                                break;

                            case "2":
                                lblTitulo = "VALIDACIÓN DE RECAUDACIÓN DE PAGOS / CHEQUES A FECHA";
                                break;

                            case "4":
                                lblTitulo = "VALIDACIÓN DE RECAUDACIÓN DE PAGOS / LETRA";
                                break;

                            case "5":
                                lblTitulo = "VALIDACIÓN DE RECAUDACIÓN DE PAGOS / TARJETA";
                                break;

                            case "6":
                                lblTitulo = "VALIDACIÓN DE RECAUDACIÓN DE PAGOS / TRANSFERENCIA";
                                break;
                            }
                            lblTitle.Text = lblTitulo;
                        }
                    }
                    dt = null;
                }
                oConn.Close();

                Log oLog = new Log();
                oLog.IdUsuario = oIsUsuario.CodUsuario;
                oLog.ObsLog    = "VALIDACION VALIJA #" + hdd_cod_pago.Value;
                oLog.CodEvtLog = "2";
                oLog.AppLog    = "ANTALIS";
                oLog.putLog();
            }

            onLoadGrid();
        }
Exemplo n.º 5
0
        protected void gdPagos_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string pCodPago = gdPagos.DataKeys[e.RowIndex].Value.ToString();

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                int nImporteFactura;
                int nSaldo;
                int nAplicacionPagoFactura;
                //int nSaldoNotaCredito;
                int                nAplicacionNotaCredito;
                DataTable          dt;
                cAntFactura        oFactura;
                cAntNotaCredito    oNotaCredito;
                cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn);
                oDocumentosPago.CodPagos = pCodPago;
                DataTable dtDocPago = oDocumentosPago.Get();
                if (dtDocPago != null)
                {
                    foreach (DataRow oRow in dtDocPago.Rows)
                    {
                        nSaldo                 = 0;
                        nImporteFactura        = int.Parse(oRow["importe_factura"].ToString());
                        nAplicacionPagoFactura = int.Parse(oRow["aplicacion_pago_factura"].ToString());
                        //nSaldoNotaCredito = int.Parse(oRow["saldo_nota_credito"].ToString());
                        nAplicacionNotaCredito = int.Parse(oRow["aplicacion_nota_credito"].ToString());

                        int nValorFactura = 0;
                        oFactura            = new cAntFactura(ref oConn);
                        oFactura.CodFactura = oRow["cod_factura"].ToString();
                        dt = oFactura.Get();
                        if (dt != null)
                        {
                            if (dt.Rows.Count > 0)
                            {
                                nValorFactura = int.Parse(dt.Rows[0]["valor_factura"].ToString());
                            }
                        }
                        dt = null;

                        if (nValorFactura < (nAplicacionPagoFactura + nAplicacionNotaCredito))
                        {
                            oFactura.SaldoFactura = nValorFactura.ToString();
                        }
                        else
                        {
                            if (nValorFactura < (nImporteFactura + nAplicacionPagoFactura + nAplicacionNotaCredito))
                            {
                                oFactura.SaldoFactura = nValorFactura.ToString();
                            }
                            else
                            {
                                oFactura.SaldoFactura = (nImporteFactura + nAplicacionPagoFactura + nAplicacionNotaCredito).ToString();
                            }
                        }

                        oFactura.Accion = "EDITAR";
                        oFactura.Put();

                        if (!string.IsNullOrEmpty(oFactura.Error))
                        {
                            Response.Write("[Eliminar / Factura Editar] Se ha encontrado el siguiente error : " + oFactura.Error);
                            Response.End();
                        }



                        //if (!string.IsNullOrEmpty(oRow["cod_nota_credito"].ToString())) {
                        oNotaCredito = new cAntNotaCredito(ref oConn);
                        oNotaCredito.CodDocumento = oRow["cod_documento"].ToString();
                        DataTable dtNC = oNotaCredito.GetDocNotaCredito();
                        if (dtNC != null)
                        {
                            if (dtNC.Rows.Count > 0)
                            {
                                foreach (DataRow oRowNC in dtNC.Rows)
                                {
                                    oNotaCredito.CodNotaCredito = oRowNC["cod_nota_credito"].ToString();
                                    dt = oNotaCredito.Get();
                                    if (dt != null)
                                    {
                                        if (dt.Rows.Count > 0)
                                        {
                                            oNotaCredito.SaldoNotaCredito = (int.Parse(dt.Rows[0]["saldo_nota_credito"].ToString()) + int.Parse(oRowNC["aplicacion_nota_credito"].ToString())).ToString();
                                            oNotaCredito.Accion           = "EDITAR";
                                            oNotaCredito.Put();

                                            if (!string.IsNullOrEmpty(oNotaCredito.Error))
                                            {
                                                Response.Write("[Eliminar / Nota Credito Editar] Se ha encontrado el siguiente error : " + oNotaCredito.Error);
                                                Response.End();
                                            }
                                        }
                                    }
                                    dt = null;
                                    oNotaCredito.Accion = "ELIMINAR";
                                    oNotaCredito.PutDocNotaCredito();
                                    if (!string.IsNullOrEmpty(oNotaCredito.Error))
                                    {
                                        Response.Write("[Eliminar / REL Nota Credito - DOC] Se ha encontrado el siguiente error : " + oNotaCredito.Error);
                                        Response.End();
                                    }
                                }
                            }
                        }
                        dtNC = null;

                        //}

                        oDocumentosPago.CodDocumento = oRow["cod_documento"].ToString();
                        oDocumentosPago.Accion       = "ELIMINAR";
                        oDocumentosPago.Put();

                        if (!string.IsNullOrEmpty(oDocumentosPago.Error))
                        {
                            Response.Write("[Eliminar / Documento Pago] Se ha encontrado el siguiente error : " + oDocumentosPago.Error);
                            Response.End();
                        }
                    }
                }
                dtDocPago = null;


                cAntPagos oPagos = new cAntPagos(ref oConn);
                oPagos.CodPagos = pCodPago;
                oPagos.Accion   = "ELIMINAR";
                oPagos.Put();

                if (!string.IsNullOrEmpty(oPagos.Error))
                {
                    Response.Write("[Eliminar / Pagos] Se ha encontrado el siguiente error : " + oPagos.Error);
                    Response.End();
                }
            }
            oConn.Close();

            onLoadGrid();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            oIsUsuario = oWeb.ValidaUserAppReport();
            //getMenu(idReportePago, oIsUsuario.CodUsuario, "1");
            //getMenu(idProcesoSeguimiento, oIsUsuario.CodUsuario, "2");
            //getMenu(idCartolas, oIsUsuario.CodUsuario, "3");
            //getMenu(idProcesoNormalizacion, oIsUsuario.CodUsuario, "4");
            //getMenu(idIndicadoresClaves, oIsUsuario.CodUsuario, "5");
            //getMenu(IndClasificacionRiesgo, oIsUsuario.CodUsuario, "6");

            //getMenuAntalis(indAntalis, oIsUsuario.CodUsuario);

            if (!IsPostBack)
            {
                hdd_cod_pago.Value = oWeb.GetData("CodPago");

                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    cAntPagos oPagos = new cAntPagos(ref oConn);
                    oPagos.CodPagos = hdd_cod_pago.Value;
                    DataTable dt = oPagos.Get();
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            lblValija.Text = "# Valija " + dt.Rows[0]["cod_pago"].ToString();

                            cCliente oCliente = new cCliente(ref oConn);
                            oCliente.CodNkey = dt.Rows[0]["nkey_cliente"].ToString();
                            DataTable dtCliente = oCliente.GeCliente();
                            if (dtCliente != null)
                            {
                                if (dtCliente.Rows.Count > 0)
                                {
                                    lblRazonSocial.Text = dtCliente.Rows[0]["cliente"].ToString();
                                }
                            }
                            dtCliente = null;

                            cAntDocumentosPago oDocPago = new cAntDocumentosPago(ref oConn);
                            oDocPago.CodPagos = hdd_cod_pago.Value;
                            DataTable dtDocPago = oDocPago.Get();
                            if (dtDocPago != null)
                            {
                                if (dtDocPago.Rows.Count > 0)
                                {
                                    lblNomDeudor.Text = dtDocPago.Rows[0]["nom_deudor"].ToString();
                                }
                                dtDocPago = null;
                            }

                            cAntCentrosDistribucion oCentrosDistribucion = new cAntCentrosDistribucion(ref oConn);
                            oCentrosDistribucion.CodCentroDist = dt.Rows[0]["cod_centrodist"].ToString();
                            DataTable dtCentro = oCentrosDistribucion.GetByCod();
                            if (dtCentro != null)
                            {
                                if (dtCentro.Rows.Count > 0)
                                {
                                    lblCentroDistribucion.Text = dtCentro.Rows[0]["descripcion"].ToString();
                                }
                            }
                            dtCentro = null;

                            lblFecharecepcion.Text = dt.Rows[0]["fech_recepcion"].ToString();
                            lblimporte.Text        = string.Format("{0:N0}", int.Parse(dt.Rows[0]["importe_total"].ToString()));
                            hdd_importe.Value      = dt.Rows[0]["importe_total"].ToString();
                        }
                    }
                    dt = null;
                }
                oConn.Close();

                Log oLog = new Log();
                oLog.IdUsuario = oIsUsuario.CodUsuario;
                oLog.ObsLog    = "VALIDACION VALIJA #" + hdd_cod_pago.Value;
                oLog.CodEvtLog = "2";
                oLog.AppLog    = "ANTALIS";
                oLog.putLog();
            }
        }