Example #1
0
        public static entComprobante ReadComprobante(int id)
        {
            entComprobante obj = null;
            SqlCommand     cmd = null;
            SqlDataReader  dr  = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("ComprobanteRead", cnx);
                cmd.Parameters.AddWithValue("@inID_Comprobante", id);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr  = cmd.ExecuteReader();
                obj = new entComprobante();
                dr.Read();
                obj.ID_Comprobante = Convert.ToInt32(dr["ID_Comprobante"].ToString());
                obj.NumFinca       = Convert.ToInt32(dr["NumFinca"].ToString());
                obj.Fecha          = Convert.ToDateTime(dr["Fecha"].ToString());
                obj.Monto          = Convert.ToDouble(dr["Monto"].ToString());
                obj.MedioPago      = dr["MedioPago"].ToString();
            }
            catch
            {
                obj = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(obj);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int ID_Comprobante = Convert.ToInt32(Request.QueryString["ID_Comprobante"]);

            if (Request.QueryString["ID_Comprobante"] != null)
            {
                entComprobante obj = negComprobante.ReadComprobante(ID_Comprobante);
                if (obj != null)
                {
                    numero.Text    = Convert.ToString(obj.ID_Comprobante);
                    propiedad.Text = Convert.ToString(obj.NumFinca);
                    Fecha.Text     = Convert.ToString(obj.Fecha);
                    medio.Text     = Convert.ToString(obj.MedioPago);//eSTE DEBO CAMBIARLO
                    monto.Text     = Convert.ToString(obj.Monto);

                    //tira los recibos que son asociados con el comprobante
                    GridView1.DataSource = negRecibos.ListarReciboxCom(obj.ID_Comprobante);
                    GridView1.DataBind();

                    for (int i = 0; i < GridView1.Rows.Count; i++)
                    {
                        int id = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text);
                        entConceptoCobro tipo = negConceptoCobro.BuscarConcepto(id);
                        if (tipo != null)
                        {
                            GridView1.Rows[0].Cells[3].Text = tipo.Concepto;
                            GridView1.Rows[0].Cells[4].Text = Convert.ToString(tipo.DiaVencimiento);
                        }
                        else
                        {
                            lblError.Text    = "No se encontro un concepto de cobro asociado.";
                            lblError.Visible = true;
                        }
                    }
                }

                else
                {
                    lblError.Text    = "No se encontro el comprobante";
                    lblError.Visible = true;
                }
            }
            else
            {
                lblError.Text    = "Error al buscar el ID del comprobante";
                lblError.Visible = true;
            }
        }
Example #3
0
        public static List <entComprobante> ListarComprobantes(int NumPropiedad)
        {
            SqlCommand            cmd   = null;
            SqlDataReader         dr    = null;
            List <entComprobante> lista = null;

            try
            {
                Conexion      cn  = new Conexion();
                SqlConnection cnx = cn.Conectar();
                cmd = new SqlCommand("ListarComprobantes", cnx);
                cmd.Parameters.AddWithValue("@inNumPropiedad", NumPropiedad);
                cmd.CommandType = CommandType.StoredProcedure;
                cnx.Open();
                dr    = cmd.ExecuteReader();
                lista = new List <entComprobante>();
                while (dr.Read())
                {
                    entComprobante C = new entComprobante();
                    C.ID_Comprobante = Convert.ToInt32(dr["ID_Comprobante"].ToString());
                    C.NumFinca       = Convert.ToInt32(dr["NumFinca"].ToString());
                    C.Fecha          = Convert.ToDateTime(dr["Fecha"].ToString());
                    C.Monto          = Convert.ToDouble(dr["Monto"].ToString());
                    C.MedioPago      = dr["MedioPago"].ToString();
                    lista.Add(C);
                }
            }
            catch (Exception e)
            {
                lista = null;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(lista);
        }