Пример #1
0
    private MemoryStream PrintBillList(string billType, string party, string date1, string date2, string sortFiled, string userName, string refType)
    {
        XtraReport rpt = new XtraReport();

        if (billType == "VO" || billType == "PL")
        {
            rpt.LoadLayout(Server.MapPath(@"~\ReportAir\ReportRepx\Account\VoucherList.repx"));

            if (date1.IndexOf("/") != -1 && date2.IndexOf("/") != -1)
            {
                string[] s1 = date1.Split('/');
                string[] s2 = date2.Split('/');
                DateTime d1 = new DateTime(SafeValue.SafeInt(s1[2], 0), SafeValue.SafeInt(s1[1], 0), SafeValue.SafeInt(s1[0], 0));
                DateTime d2 = new DateTime(SafeValue.SafeInt(s2[2], 0), SafeValue.SafeInt(s2[1], 0), SafeValue.SafeInt(s2[0], 0));
                rpt.DataSource = AirFreightRptPrint.dsVoucherByDate(billType, party, d1, d2, sortFiled, userName, refType);
            }
            else
            {
                rpt.DataSource = AirFreightRptPrint.dsVoucherByNo(billType, party, date1, date2, sortFiled, userName, refType);
            }
        }
        else
        {
            rpt.LoadLayout(Server.MapPath(@"~\ReportAir\ReportRepx\Account\InvoiceList.repx"));

            if (date1.IndexOf("/") != -1 && date2.IndexOf("/") != -1)
            {
                string[] s1 = date1.Split('/');
                string[] s2 = date2.Split('/');
                DateTime d1 = new DateTime(SafeValue.SafeInt(s1[2], 0), SafeValue.SafeInt(s1[1], 0), SafeValue.SafeInt(s1[0], 0));
                DateTime d2 = new DateTime(SafeValue.SafeInt(s2[2], 0), SafeValue.SafeInt(s2[1], 0), SafeValue.SafeInt(s2[0], 0));
                rpt.DataSource = AirFreightRptPrint.dsInvoiceByDate(billType, party, d1, d2, sortFiled, userName, refType);
            }
            else
            {
                rpt.DataSource = AirFreightRptPrint.dsInvoiceByNo(billType, party, date1, date2, sortFiled, userName, refType);
            }
        }
        System.IO.MemoryStream str = new MemoryStream();
        if (docType == "1")
        {
            rpt.ExportToXls(str);
        }
        else
        {
            rpt.ExportToPdf(str);
        }

        return(str);
    }