Ejemplo n.º 1
0
    public csPagoCuota GetById(int id)
    {
        DataTable     dt  = new DataTable("PagoCuota");
        SqlConnection con = new SqlConnection(GlobalClass.conexion);
        SqlCommand    cmd = new SqlCommand();

        cmd.CommandText = "PagoCuota_GetById";
        cmd.CommandType = System.Data.CommandType.StoredProcedure;
        cmd.Connection  = con;
        cmd.Parameters.AddWithValue("@id", SqlDbType.Int).Value = id;
        SqlDataAdapter da = new SqlDataAdapter();

        csPagoCuota pagoCuota = null;

        da.SelectCommand = cmd;
        try
        {
            con.Open();
            da.Fill(dt);
            con.Close();

            pagoCuota = new csPagoCuota(int.Parse(dt.Rows[0][0].ToString()), int.Parse(dt.Rows[0][1].ToString()), int.Parse(dt.Rows[0][2].ToString()), dt.Rows[0][3].ToString(), dt.Rows[0][4].ToString());

            return(pagoCuota);
        }
        catch (Exception ex) { GlobalClass.SaveLog("csPagoCuota", "GetByVcaId", ex.ToString(), DateTime.Now); return(null); }
    }
Ejemplo n.º 2
0
    public static string Cuota_Insert(string valform)
    {
        csPagoCuota objPagoCuota = JsonConvert.DeserializeObject <csPagoCuota>(valform);

        objPagoCuota.Insert();
        return(JsonConvert.SerializeObject(objPagoCuota.estado_transaccion));
    }
Ejemplo n.º 3
0
    public List <csMedioPagoCS> armaObjeto(DataTable dt)
    {
        List <csMedioPagoCS> lstMedioPagoCS = new List <csMedioPagoCS>();
        List <csPagoCuota>   listaPagoCuota = null;
        csPagoCuota          pagoCuota      = null;

        try
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (dt.Rows.Count == 1)
                {
                    pagoCuota      = new csPagoCuota();
                    listaPagoCuota = pagoCuota.GetByVcaId(vca_id);
                }

                lstMedioPagoCS.Add(new csMedioPagoCS(
                                       id                  = int.Parse(dr[0].ToString()),
                                       vca_id              = int.Parse(dr[1].ToString()),
                                       cli_rut             = dr[2].ToString(),
                                       cli_nombre          = dr[3].ToString(),
                                       fechaDocto          = dr[4].ToString(),
                                       importe             = double.Parse(dr[5].ToString()),
                                       numero_cuota        = int.Parse(dr[6].ToString()),
                                       numero_cuota_pagada = int.Parse(dr[7].ToString()),
                                       monto_cuota         = double.Parse(dr[8].ToString()),
                                       lstPagoCuota        = listaPagoCuota)
                                   );
            }
            return(lstMedioPagoCS);
        }
        catch (Exception ex) { GlobalClass.SaveLog("csMedioPagoCS", "armaObjeto", ex.ToString(), DateTime.Now); return(null); }
        finally {
            listaPagoCuota = null;
            pagoCuota      = null;
        }
    }
Ejemplo n.º 4
0
    protected void btn_Imprimir_Click(object sender, EventArgs e)
    {
        try
        {
            csPagoCuota pagoCuota = new csPagoCuota();
            pagoCuota = pagoCuota.GetById(int.Parse(txtId.Value));

            Document document = new Document();

            MemoryStream memorystream = new MemoryStream();

            PdfWriter.GetInstance(document, memorystream);

            document.Open();

            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(Server.MapPath("img/logo.jpg"));
            image.Alignment = iTextSharp.text.Image.ALIGN_RIGHT;
            image.ScaleToFit(200, 80);
            image.SetAbsolutePosition(380, 710);
            //Agregar Imagen
            document.Add(image);
            //Agregar Linea de texto

            Font fuente = new Font();
            fuente.Size = 24;
            Paragraph parrafo = new Paragraph("Muebles Oliva", fuente);
            parrafo.Font = FontFactory.GetFont("Arial", 23, BaseColor.BLACK);

            document.Add(parrafo);

            document.Add(new Paragraph("Comprobante de Pago"));

            //Fecha Documento
            fuente.Size  = 12;
            parrafo      = new Paragraph("Fecha: " + pagoCuota.fecha_pago, fuente);
            parrafo.Font = FontFactory.GetFont("Arial", 13);
            document.Add(parrafo);

            //Nombre
            fuente.Size  = 12;
            parrafo      = new Paragraph("Nombre: " + txtNombre.Value, fuente);
            parrafo.Font = FontFactory.GetFont("Arial", 23);
            document.Add(parrafo);

            //Rut
            fuente.Size  = 12;
            parrafo      = new Paragraph("Rut: " + txtRut.Value, fuente);
            parrafo.Font = FontFactory.GetFont("Arial", 13);
            document.Add(parrafo);

            //Salto de linea

            document.Add(new Chunk(""));

            //Tabla

            PdfPTable table = new PdfPTable(3);
            table.HorizontalAlignment = 0;
            PdfPCell cell = new PdfPCell(new Phrase("COMPROBANTE PAGO"));

            cell.Colspan = 3;

            cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right

            table.AddCell(cell);

            table.AddCell("CUOTA");

            table.AddCell("DESCRIPCION");

            table.AddCell("MONTO");


            float[] anchoDeColumnas = new float[] { 20f, 40f, 20f };
            table.SetWidths(anchoDeColumnas);

            table.AddCell(pagoCuota.numero_cuota_pagada.ToString() + " de " + txtNumeroCuotas.Value);

            table.AddCell("Pago Credito Simple");

            table.AddCell("$ " + txtMontoCuota.Value);

            document.Add(table);
            document.Close();

            byte[] pdfContent = memorystream.ToArray();

            //Return PDF
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-disposition", "attachment; filename=ComprobantePago.pdf");
            Response.BinaryWrite(pdfContent);
            Response.End();
        }
        catch (Exception ex) { GlobalClass.SaveLog("CreditoSimple.aspx.cs", "Imprimir", ex.ToString(), DateTime.Now); }
    }