Example #1
0
    protected void btnXuatPDF_Click(object sender, EventArgs e)
    {
        Func <PDFmethod> duLieu = new Func <PDFmethod>
                                  (
            () =>
        {
            PDFmethod pdf   = new PDFmethod();
            pdf.tuNgay      = txtTuNgay.Value;
            pdf.denNgay     = txtDenNgay.Value;
            pdf.nguoiGui    = txtNguoiGui.Value;
            pdf.tuyenQuanLi = txtTuyenQuanLi.Value;
            return(pdf);
        }
                                  );
        PDFmethod thongTin    = duLieu();
        string    html        = thongTin.HTML();
        string    printScript = "<script>";

        printScript += "var html = `" + html + "`;";
        printScript += "var print = window.open(' ', '_blank');";
        printScript += @"                            
                            print.document.write(html);
                            print.document.close();
                            print.focus();
                            print.print();
                            print.close();";
        printScript += "</script>";
        Response.Write(printScript);
    }
Example #2
0
    protected void btnXuatPDF_Click(object sender, EventArgs e)
    {
        Func <PDFmethod> thongTin = new Func <PDFmethod>
                                    (
            () =>
        {
            PDFmethod pD = new PDFmethod();
            pD.tuNgay    = txtNgay.Value;
            pD.denNgay   = txtDenNgay.Value;
            string value = slNhomQLKH.Value.Trim();
            if (value == "0")
            {
                pD.nhomQL = "";
            }
            else
            {
                pD.nhomQL = slNhomQLKH.Items[slNhomQLKH.SelectedIndex].Text;
            }
            return(pD);
        }
                                    );

        string    table  = dvdsDonHang.InnerHtml;
        PDFmethod duLieu = thongTin();
        string    print  = duLieu.Print(table);

        Response.Write(print);
    }
Example #3
0
 protected void btnXuatPDF_Click(object sender, EventArgs e)
 {
     #region Table
     CapNhatDuLieu();
     string    sql   = SQLToanBo();
     DataTable table = Connect.GetTable(sql);
     string    html  = "<table border='1' style='width:100%; border-collapse:collapse;'>";
     html += HTMLThongKe(table);
     html += "</table>";
     #endregion
     PDFmethod pdf   = new PDFmethod(sTuNgay, sDenNgay, sNguoiGui, sNhomQLKH);
     string    print = pdf.Print(html);
     Response.Write(print);
 }