public ActionResult Print(int Id)
        {
            ReportDocument rd = new ReportDocument();

            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "CustomerInvoice.rpt"));

            DataSet ds = new DataSet();

            ds.Tables.Add("Head");
            ds.Tables.Add("Items");

            //    //-------HEAD


            ds.Tables["Head"].Columns.Add("DocumentNo");
            ds.Tables["Head"].Columns.Add("DocumentDate");
            ds.Tables["Head"].Columns.Add("Location");
            ds.Tables["Head"].Columns.Add("InsuredName");
            ds.Tables["Head"].Columns.Add("SpecialRemarks");
            //-------DT
            ds.Tables["Items"].Columns.Add("EffectiveDate");
            ds.Tables["Items"].Columns.Add("InsuranceType");
            ds.Tables["Items"].Columns.Add("PolicyOrEndorseNo");
            ds.Tables["Items"].Columns.Add("Company");
            ds.Tables["Items"].Columns.Add("Premium");
            ds.Tables["Items"].Columns.Add("Remarks");
            CustomerInvoiceRepository repo = new CustomerInvoiceRepository();
            var     Head = repo.GetCustomerInvoiceHdDetails(Id);
            DataRow dr   = ds.Tables["Head"].NewRow();

            dr["DocumentNo"]     = Head.CusInvoiceRefNo;
            dr["DocumentDate"]   = Head.CusInvoiceDate.Value.ToString("dd-MMM-yyyy");
            dr["InsuredName"]    = Head.CusName;
            dr["SpecialRemarks"] = Head.SpecialRemarks;

            ds.Tables["Head"].Rows.Add(dr);

            var Items = repo.GetCustomerInvoicePrint(Id);

            foreach (var item in Items)
            {
                var CustomerInvoiceItem = new CustomerInvoiceItem
                {
                    EffectiveDate = item.EffectiveDate,
                    TranType      = item.TranType,
                    PolicyNo      = item.PolicyNo,
                    InsCmpName    = item.InsCmpName,
                    TotalPremium  = item.TotalPremium,
                    Remarks       = item.Remarks
                };

                DataRow dri = ds.Tables["Items"].NewRow();
                dri["EffectiveDate"]     = CustomerInvoiceItem.EffectiveDate.Value.ToString("dd-MMM-yyyy");
                dri["InsuranceType"]     = CustomerInvoiceItem.TranType;
                dri["PolicyOrEndorseNo"] = CustomerInvoiceItem.PolicyNo;
                dri["Company"]           = CustomerInvoiceItem.InsCmpName;
                dri["Premium"]           = CustomerInvoiceItem.TotalPremium;
                dri["Remarks"]           = CustomerInvoiceItem.Remarks;
                ds.Tables["Items"].Rows.Add(dri);
            }

            ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "CustomerInvoice.xml"), XmlWriteMode.WriteSchema);

            rd.SetDataSource(ds);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }