示例#1
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn);
                oDocumentosPago.CodDocumento    = hdd_cod_documento.Value;
                oDocumentosPago.ImporteRecibido = txt_importe_recibido.Text;
                oDocumentosPago.Discrepancia    = txt_discrepancia.Text;
                oDocumentosPago.Accion          = "EDITAR";
                oDocumentosPago.Put();

                oConn.Close();
            }

            hdd_cod_documento.Value   = string.Empty;
            txt_importe_recibido.Text = string.Empty;
            txt_discrepancia.Text     = string.Empty;
            lblRazonSocialPago.Text   = string.Empty;
            lblcuentacorriente.Text   = string.Empty;
            lblFechtransaccion.Text   = string.Empty;
            lblNumOperacion.Text      = string.Empty;
            lblimporte.Text           = string.Empty;
            hdd_importe.Value         = string.Empty;

            idRow1.Visible     = false;
            idRow2.Visible     = false;
            idRow3.Visible     = false;
            idColBanco.Visible = false;

            onLoadGrid();
        }
示例#2
0
        protected void onLoadGrid()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn);
                oDocumentosPago.CodPagos = hdd_cod_pago.Value;
                DataTable dt = oDocumentosPago.GetDocFacturas();
                gdPagos.DataSource = dt;
                gdPagos.DataBind();

                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        lblCantidad.Text = string.Format("{0:N0}", dt.Compute("COUNT(cod_documento)", " nod_cod_documento is null "));

                        string iImporteTotal = dt.Compute("SUM(importe)", string.Empty).ToString();
                        lblMonto.Text = string.Format("{0:N0}", int.Parse(iImporteTotal));

                        string iImporteTotalRecibido = (!string.IsNullOrEmpty(dt.Compute("SUM(importe_recibido)", string.Empty).ToString()) ? dt.Compute("SUM(importe_recibido)", string.Empty).ToString() : "0");
                        lblImporteTotalRecibido.Text    = string.Format("{0:N0}", int.Parse(iImporteTotalRecibido));
                        hdd_importetotal_recibido.Value = iImporteTotalRecibido;

                        string iDiscrepancia = (!string.IsNullOrEmpty(dt.Compute("SUM(discrepancia)", string.Empty).ToString()) ? dt.Compute("SUM(discrepancia)", string.Empty).ToString() : "0");
                        lblDiscrepanciaTotal.Text    = string.Format("{0:N0}", int.Parse(iDiscrepancia));
                        hdd_total_discrepancia.Value = iDiscrepancia;
                    }
                }
                dt = null;

                oConn.Close();
            }
        }
示例#3
0
        protected void gdPagos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            LinkButton  lnkBtn        = (LinkButton)e.CommandSource;                       // the button
            GridViewRow myRow         = (GridViewRow)lnkBtn.Parent.Parent;                 // the row
            GridView    myGrid        = (GridView)sender;                                  // the gridview
            string      pCodDocumento = gdPagos.DataKeys[myRow.RowIndex].Value.ToString(); // value of the datakey

            if (e.CommandName == "NO")
            {
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn);
                    oDocumentosPago.CodDocumento = pCodDocumento;
                    DataTable dt = oDocumentosPago.Get();
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            idRow1.Visible = true;
                            idRow2.Visible = true;
                            idRow3.Visible = true;

                            hdd_cod_documento.Value = dt.Rows[0]["cod_documento"].ToString();
                            lblRazonSocialPago.Text = dt.Rows[0]["nom_deudor"].ToString();
                            lblcuentacorriente.Text = dt.Rows[0]["cuenta_corriente"].ToString();
                            lblFechtransaccion.Text = dt.Rows[0]["fch_documento"].ToString();
                            lblNumOperacion.Text    = dt.Rows[0]["num_documento"].ToString();

                            cAntBancos oBancos = new cAntBancos(ref oConn);
                            oBancos.NKeyBanco = dt.Rows[0]["cod_banco"].ToString();
                            DataTable dtBanco = oBancos.Get();
                            if (dtBanco != null)
                            {
                                if (dtBanco.Rows.Count > 0)
                                {
                                    lblBanco.Text = dtBanco.Rows[0]["ncod"].ToString() + " - " + dtBanco.Rows[0]["snombre"].ToString();
                                }
                            }
                            dtBanco = null;

                            lblimporte.Text   = string.Format("{0:N0}", int.Parse(dt.Rows[0]["importe"].ToString()));
                            hdd_importe.Value = dt.Rows[0]["importe"].ToString();
                        }
                    }
                    dt = null;
                    oConn.Close();
                }
                btnAceptar.Visible  = false;
                btnRechazar.Visible = false;
                if ((hdd_tipo_documento.Value == "1") || (hdd_tipo_documento.Value == "2") || (hdd_tipo_documento.Value == "4"))
                {
                    idColBanco.Visible = true;
                }
            }
            else if (e.CommandName == "SI")
            {
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn);
                    oDocumentosPago.CodDocumento = pCodDocumento;
                    DataTable dt = oDocumentosPago.Get();
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            oDocumentosPago.ImporteRecibido = dt.Rows[0]["importe"].ToString();
                        }
                    }
                    dt = null;

                    oDocumentosPago.Discrepancia = "0";
                    oDocumentosPago.Accion       = "EDITAR";
                    oDocumentosPago.Put();

                    oConn.Close();
                }

                onLoadGrid();
            }
        }
示例#4
0
        protected void gdPagos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string cCodDocumento    = gdPagos.DataKeys[e.Row.RowIndex].Values["cod_documento"].ToString();
                string sNodCodDocumento = gdPagos.DataKeys[e.Row.RowIndex].Values["nod_cod_documento"].ToString();
                foreach (DataControlFieldCell cell in e.Row.Cells)
                {
                    foreach (Control control in cell.Controls)
                    {
                        LinkButton BtnlnkSI = control as LinkButton;
                        if ((BtnlnkSI != null) && (BtnlnkSI.CommandName == "SI") && (!string.IsNullOrEmpty(sNodCodDocumento)))
                        {
                            BtnlnkSI.Visible = false;
                        }
                        else if ((BtnlnkSI != null) && (BtnlnkSI.CommandName == "NO") && (!string.IsNullOrEmpty(sNodCodDocumento)))
                        {
                            BtnlnkSI.Visible = false;
                        }
                    }
                }

                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    cAntDocumentosPago oAntDocumentosPago = new cAntDocumentosPago(ref oConn);
                    oAntDocumentosPago.CodDocumento = cCodDocumento;
                    DataTable dt = oAntDocumentosPago.GetValDoc();

                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            if (!string.IsNullOrEmpty(dt.Rows[0]["valida_cheque"].ToString()))
                            {
                                if (dt.Rows[0]["valida_cheque"].ToString() == "1")
                                {
                                    e.Row.Cells[3].CssClass = "green_text";
                                }
                                else
                                {
                                    e.Row.Cells[3].CssClass = "red_text";
                                }
                            }
                            else
                            {
                                e.Row.Cells[3].CssClass = "blue_text";
                            }

                            if ((!string.IsNullOrEmpty(e.Row.Cells[15].Text.ToString())) && (e.Row.Cells[15].Text.ToString() != " "))
                            {
                                if (!string.IsNullOrEmpty(dt.Rows[0]["valida_cuenta"].ToString()))
                                {
                                    if (dt.Rows[0]["valida_cuenta"].ToString() == "1")
                                    {
                                        e.Row.Cells[5].CssClass = "green_text";
                                    }
                                    else
                                    {
                                        e.Row.Cells[5].CssClass = "red_text";
                                    }
                                }
                                else
                                {
                                    e.Row.Cells[5].CssClass = "blue_text";
                                }
                            }


                            if (!string.IsNullOrEmpty(dt.Rows[0]["valida_banco"].ToString()))
                            {
                                if (dt.Rows[0]["valida_banco"].ToString() == "1")
                                {
                                    e.Row.Cells[7].CssClass = "green_text";
                                }
                                else
                                {
                                    e.Row.Cells[7].CssClass = "red_text";
                                }
                            }
                            else
                            {
                                e.Row.Cells[7].CssClass = "blue_text";
                            }


                            if ((!string.IsNullOrEmpty(e.Row.Cells[15].Text.ToString())) && (e.Row.Cells[15].Text.ToString() != " "))
                            {
                                if (!string.IsNullOrEmpty(dt.Rows[0]["valida_monto"].ToString()))
                                {
                                    if (dt.Rows[0]["valida_monto"].ToString() == "1")
                                    {
                                        e.Row.Cells[8].CssClass = "green_text";
                                    }
                                    else
                                    {
                                        e.Row.Cells[8].CssClass = "red_text";
                                    }
                                }
                                else
                                {
                                    e.Row.Cells[8].CssClass = "blue_text";
                                }
                            }

                            if (!string.IsNullOrEmpty(dt.Rows[0]["imagen_frente"].ToString()))
                            {
                                e.Row.Cells[13].CssClass = "green_text";
                            }
                            else
                            {
                                e.Row.Cells[13].CssClass = "blue_text";
                            }


                            foreach (DataControlFieldCell cell in e.Row.Cells)
                            {
                                foreach (Control control in cell.Controls)
                                {
                                    HyperLink btn_img = control as HyperLink;
                                    if ((btn_img != null) && (btn_img.ID == "btn_img_frente"))
                                    {
                                        btn_img.NavigateUrl = "https://www.dbtlatam.com/cheques/antalis/" + dt.Rows[0]["imagen_frente"].ToString();
                                        btn_img.Attributes.Add("data-fancybox", string.Empty);
                                    }
                                    else if ((btn_img != null) && (btn_img.ID == "btn_img_atras"))
                                    {
                                        btn_img.NavigateUrl = "https://www.dbtlatam.com/cheques/antalis/" + dt.Rows[0]["imagen_atras"].ToString();
                                        btn_img.Attributes.Add("data-fancybox", string.Empty);
                                    }
                                }
                            }
                        }
                        else
                        {
                            e.Row.Cells[3].CssClass  = "blue_text";
                            e.Row.Cells[5].CssClass  = "blue_text";
                            e.Row.Cells[7].CssClass  = "blue_text";
                            e.Row.Cells[8].CssClass  = "blue_text";
                            e.Row.Cells[13].CssClass = "blue_text";
                        }
                    }
                    dt = null;
                }
                oConn.Close();

                //e.Row.Cells[2].Text = ((e.Row.Cells[13].Text.ToString() != "0") && (e.Row.Cells[14].Text.ToString() != "0") ? "FNC" : ((e.Row.Cells[13].Text.ToString() != "0") ? "F" : "NC"));
                e.Row.Cells[2].Text = getTipoDoc(hdd_tipo_documento.Value);

                switch (hdd_tipo_documento.Value)
                {
                case "1":
                case "2":
                case "4":

                    if (e.Row.Cells[7].Text.ToString() != " ")
                    {
                        if (oConn.Open())
                        {
                            cAntBancos oBancos = new cAntBancos(ref oConn);
                            oBancos.NKeyBanco = e.Row.Cells[7].Text.ToString();
                            DataTable dt = oBancos.Get();
                            if (dt != null)
                            {
                                if (dt.Rows.Count > 0)
                                {
                                    e.Row.Cells[7].Text = dt.Rows[0]["ncod"].ToString() + " - " + dt.Rows[0]["snombre"].ToString();
                                }
                            }
                            dt = null;
                        }
                        oConn.Close();
                    }
                    break;
                }
            }
        }
示例#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();
            }
        }