Line 1: using System;
Line 2: using System.Collections.Generic;
Line 3: using System.Linq;
Line 4: using System.Web;
Line 5: using System.Data;
Line 6: using System.Data.SqlClient;
Line 7: using System.Configuration;
Line 8: using System.Web.UI.WebControls;
Line 9: using System.Web.UI;
Line 10: using System.Text.RegularExpressions;
Line 11: using iTextSharp.text.pdf;
Line 12: using iTextSharp.text;
Line 13: using System.Text;
Line 14: using System.IO;
Line 15:
Line 16: /// <summary>
Line 17: /// Summary description for PdfAccess
Line 18: /// </summary>
Line 19: public class PdfAccess
Line 20: {
Line 21: string dbcon = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
Line 22: public PdfAccess()
Line 23: {
Line 24: //
Line 25: // TODO: Add constructor logic here
Line 26: //
Line 27: }
Line 28: public void GenratePdfReport(string cid, System.Web.UI.WebControls.Button sss)
Line 29: {
Line 30: try
Line 31: {
Line 32: using (SqlConnection con = new SqlConnection(dbcon))
Line 33: {
Line 34: using (SqlCommand cmd = new SqlCommand("select top(1) c.pc_id, p.pack_id,p.pack_name,p.itday,p.itday-1 night,p.brief_desc,p.mainimage,p.descp,c.twin,p.c_id,p.pack_code, CONVERT(VARCHAR(100), getdate(), 100) as dttt from package_tab p inner join vdate_tab v on p.pack_id=v.pack_id inner join pcost_tab c on c.vd_id=v.vd_id where p.pack_id=@cid order by c.pc_id", con))
Line 35: {
Line 36: cmd.Parameters.AddWithValue("@cid", cid);
Line 37: using (SqlDataAdapter da = new SqlDataAdapter(cmd))
Line 38: {
Line 39: using (DataSet ds = new DataSet())
Line 40: {
Line 41: da.Fill(ds, "pd");
Line 42: if (ds.Tables[0].Rows.Count > 0)
Line 43: {
Line 44: //h11.Value = ds.Tables[0].Rows[0].ItemArray[1].ToString();
Line 45: string pname = ds.Tables[0].Rows[0].ItemArray[2].ToString();
Line 46: string day = ds.Tables[0].Rows[0].ItemArray[3].ToString();
Line 47: string night = ds.Tables[0].Rows[0].ItemArray[4].ToString();
Line 48: string sdesc = ds.Tables[0].Rows[0].ItemArray[5].ToString();
Line 49: string ldesc = Regex.Replace(ds.Tables[0].Rows[0].ItemArray[7].ToString().Trim(), @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 50: string pcode = ds.Tables[0].Rows[0].ItemArray[10].ToString();
Line 51: //hdffirstimg.Value = ds.Tables[0].Rows[0]["mainimage"].ToString().Trim();
Line 52:
Line 53: Font fontheader = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 10.0F, Font.BOLD, Color.BLACK);
Line 54: Font fontbody = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 9.0F, Font.NORMAL, Color.DARK_GRAY);
Line 55: Rectangle pageType = new Rectangle(PageSize.A4);
Line 56: string fileName = pname;
Line 57: string vfileName = HttpContext.Current.Request.PhysicalApplicationPath + "pdf" + "//" + fileName + ".pdf";
Line 58: //Document doc = new Document(pageType, 5, 5, 15, 15);
Line 59: Document doc = new Document(pageType, 50, 20, 50, 50);
Line 60:
Line 61:
Line 62:
Line 63: PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(vfileName, FileMode.Create));
Line 64: string dtm = ds.Tables[0].Rows[0].ItemArray[11].ToString();
Line 65:
Line 66: HeaderFooter vFooter = new HeaderFooter(new Phrase(dtm + ", " + "Page:", fontbody), true);
Line 67: vFooter.Alignment = Element.ALIGN_CENTER;
Line 68: vFooter.Border = Rectangle.NO_BORDER;
Line 69: doc.Footer = vFooter;
Line 70: doc.Open();
Line 71:
Line 72: float[] colwwidi = new float[1] { 100 };
Line 73: iTextSharp.text.Table ttable = new iTextSharp.text.Table(1);
Line 74: ttable.Width = 98.0F;
Line 75: ttable.Border = 0;
Line 76:
Line 77: ttable.Widths = colwwidi;
Line 78: ttable.Cellpadding = 2;
Line 79: //ttable.Border = Rectangle.BOX;
Line 80: Cell td2 = new Cell();
Line 81: string absURI = HttpContext.Current.Request.Url.AbsoluteUri;
Line 82: Uri imgurl = new Uri(absURI.Replace(System.IO.Path.GetFileName(HttpContext.Current.Request.Url.LocalPath), "images/logo.png"));
Line 83: iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(imgurl);
Line 84: img.ScaleToFit(100f, 100f);
Line 85: td2.HorizontalAlignment = Element.ALIGN_LEFT;
Line 86: td2.Add(img);
Line 87: td2.Border = 0;
Line 88: ttable.AddCell(td2);
Line 89:
Line 90: Cell th0 = new Cell(new Phrase("Package Code : " + pcode, fontheader));
Line 91: th0.Border = 0;
Line 92: ttable.AddCell(th0);
Line 93:
Line 94: Cell th1 = new Cell(new Phrase("Package Name : " + pname, fontheader));
Line 95: th1.Border = 0;
Line 96: ttable.AddCell(th1);
Line 97:
Line 98: Cell th13 = new Cell(new Phrase("Tour Days : " + day + " Days / " + night + " Nights", fontheader));
Line 99: th13.Border = 0;
Line 100: ttable.AddCell(th13);
Line 101:
Line 102: Cell th2 = new Cell(new Phrase("Package Summmary ", fontheader));
Line 103: th2.Border = 0;
Line 104: ttable.AddCell(th2);
Line 105: Cell td1 = new Cell(new Phrase(ldesc, fontbody));
Line 106: td1.Border = 0;
Line 107: //td1.VerticalAlignment = Element.ALIGN_JUSTIFIED_ALL;
Line 108: ttable.AddCell(td1);
Line 109:
Line 110: Cell th3 = new Cell(new Phrase("Package Itinerary ", fontheader));
Line 111: th3.Border = 0;
Line 112: ttable.AddCell(th3);
Line 113:
Line 114: // Itinerary details
Line 115: using (SqlConnection con2 = new SqlConnection(dbcon))
Line 116: {
Line 117: using (SqlCommand cmd2 = new SqlCommand("select i.day,c.city_name city,i.descp,c.city_id,c.c_id,ct.country_name from Itenry_tab i inner join city_tab c on i.city=c.city_id inner join country_tab ct on ct.c_id=i.cid where pack_id=@cid2 order by i.day", con2))
Line 118: {
Line 119: cmd2.Parameters.AddWithValue("@cid2", cid);
Line 120: using (SqlDataAdapter da2 = new SqlDataAdapter(cmd2))
Line 121: {
Line 122: using (DataSet ds2 = new DataSet())
Line 123: {
Line 124: da2.Fill(ds2, "tmp");
Line 125: if (ds2.Tables[0].Rows.Count > 0)
Line 126: {
Line 127: for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
Line 128: {
Line 129: Cell ddt = new Cell(new Phrase("Day-" + ds2.Tables[0].Rows[i]["day"].ToString() + " : " + ds2.Tables[0].Rows[i]["city"].ToString(), fontheader));
Line 130: ddt.Border = 0;
Line 131: ttable.AddCell(ddt);
Line 132: string iti = ds2.Tables[0].Rows[i]["descp"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 133: string fiti = Regex.Replace(iti, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 134: Cell ddtdata = new Cell(new Phrase(fiti, fontbody));
Line 135: ddtdata.Border = 0;
Line 136: ttable.AddCell(ddtdata);
Line 137: }
Line 138: Cell ddtdataa = new Cell(new Phrase(" ", fontbody));
Line 139: ddtdataa.Border = 0;
Line 140: ttable.AddCell(ddtdataa);
Line 141: }
Line 142: else
Line 143: { }
Line 144: }
Line 145: }
Line 146: }
Line 147: }
Line 148: // Enclusion details
Line 149: using (SqlConnection con3 = new SqlConnection(dbcon))
Line 150: {
Line 151: using (SqlCommand cmd3 = new SqlCommand("Select ins_desc from inclu_tab where pack_id= @cid3", con3))
Line 152: {
Line 153: cmd3.Parameters.AddWithValue("@cid3", cid);
Line 154: using (SqlDataAdapter da3 = new SqlDataAdapter(cmd3))
Line 155: {
Line 156: using (DataSet ds3 = new DataSet())
Line 157: {
Line 158: da3.Fill(ds3, "tmps");
Line 159: if (ds3.Tables[0].Rows.Count > 0)
Line 160: {
Line 161: Cell th7 = new Cell(new Phrase("Enclusion ", fontheader));
Line 162: ttable.AddCell(th7);
Line 163: //string inc = Server.aspxDecode(ds3.Tables[0].Rows[0]["ins_desc"].ToString()).Replace("<li>", "").Replace("</li>", "").Replace("<ul>", "").Replace("</ul>", "");
Line 164: string inc = ds3.Tables[0].Rows[0]["ins_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 165: inc = Regex.Replace(inc, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 166: Cell td7 = new Cell(new Phrase(inc, fontbody));
Line 167: ttable.AddCell(td7);
Line 168: Cell th77 = new Cell(new Phrase(" ", fontheader));
Line 169: th77.Border = 0;
Line 170: ttable.AddCell(th77);
Line 171:
Line 172: }
Line 173: else
Line 174: { }
Line 175: }
Line 176: }
Line 177: }
Line 178: }
Line 179:
Line 180:
Line 181: // Exclusion details
Line 182: using (SqlConnection con4 = new SqlConnection(dbcon))
Line 183: {
Line 184: using (SqlCommand cmd4 = new SqlCommand("Select ex_desc from exclu_tab where pack_id= @cid4", con4))
Line 185: {
Line 186: cmd4.Parameters.AddWithValue("@cid4", cid);
Line 187: using (SqlDataAdapter da4 = new SqlDataAdapter(cmd4))
Line 188: {
Line 189: using (DataSet ds4 = new DataSet())
Line 190: {
Line 191: da4.Fill(ds4, "tmps");
Line 192: if (ds4.Tables[0].Rows.Count > 0)
Line 193: {
Line 194: Cell th8 = new Cell(new Phrase("Exclusion ", fontheader));
Line 195: ttable.AddCell(th8);
Line 196: string exc = ds4.Tables[0].Rows[0]["ex_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 197: exc = Regex.Replace(exc, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 198: Cell td8 = new Cell(new Phrase(exc, fontbody));
Line 199: ttable.AddCell(td8);
Line 200: Cell th78 = new Cell(new Phrase(" ", fontheader));
Line 201: th78.Border = 0;
Line 202: ttable.AddCell(th78);
Line 203:
Line 204: }
Line 205: else
Line 206: { }
Line 207: }
Line 208: }
Line 209: }
Line 210: }
Line 211:
Line 212: // Cost details
Line 213: using (SqlConnection con5 = new SqlConnection(dbcon))
Line 214: {
Line 215: using (SqlCommand cmd5 = new SqlCommand("select pc.cname,ht.hname,p.single,p.twin,p.triple,p.childbed,p.chilwoutbed,p.infant,p.pc_id from pcost_tab p inner join Package_Cate_Tab pc on p.packgeCate=pc.id inner join Hotel_Category ht on p.hotelCate=ht.id where pack_id=@cid5", con5))
Line 216: {
Line 217: cmd5.Parameters.AddWithValue("@cid5", cid);
Line 218: using (SqlDataAdapter da5 = new SqlDataAdapter(cmd5))
Line 219: {
Line 220: using (DataSet ds5 = new DataSet())
Line 221: {
Line 222: da5.Fill(ds5, "tmps");
Line 223: if (ds5.Tables[0].Rows.Count > 0)
Line 224: {
Line 225:
Line 226: float[] colwwidi2 = new float[8] { 12, 8, 18, 15, 15, 15, 18, 10 };
Line 227: iTextSharp.text.Table ttable2 = new iTextSharp.text.Table(8);
Line 228: ttable2.Width = 98.0F;
Line 229:
Line 230: ttable2.Widths = colwwidi2;
Line 231: ttable2.Cellpadding = 2;
Line 232:
Line 233: Cell thc1 = new Cell(new Phrase("Package", fontheader));
Line 234: ttable2.AddCell(thc1);
Line 235: Cell thc2 = new Cell(new Phrase("Hotel", fontheader));
Line 236: ttable2.AddCell(thc2);
Line 237: Cell thc3 = new Cell(new Phrase("Single Occupancy", fontheader));
Line 238: ttable2.AddCell(thc3);
Line 239: Cell thc4 = new Cell(new Phrase("Twin Sharing", fontheader));
Line 240: ttable2.AddCell(thc4);
Line 241: Cell thc5 = new Cell(new Phrase("Triple Sharing", fontheader));
Line 242: ttable2.AddCell(thc5);
Line 243: Cell thc6 = new Cell(new Phrase("Child with bed", fontheader));
Line 244: ttable2.AddCell(thc6);
Line 245: Cell thc7 = new Cell(new Phrase("Child without bed", fontheader));
Line 246: ttable2.AddCell(thc7);
Line 247: Cell thc8 = new Cell(new Phrase("Infant", fontheader));
Line 248: ttable2.AddCell(thc8);
Line 249: int len = ds5.Tables[0].Rows.Count;
Line 250: for (int i = 0; i < len; i++)
Line 251: {
Line 252: for (int j = 0; j < 8; j++)
Line 253: {
Line 254: if (j > 1)
Line 255: {
Line 256: Cell td10 = new Cell(new Phrase(ds5.Tables[0].Rows[i].ItemArray[j].ToString() + "/-INR", fontbody));
Line 257: ttable2.AddCell(td10);
Line 258: }
Line 259: else
Line 260: {
Line 261: Cell td10 = new Cell(new Phrase(ds5.Tables[0].Rows[i].ItemArray[j].ToString(), fontbody));
Line 262: ttable2.AddCell(td10);
Line 263: }
Line 264: }
Line 265: }
Line 266: Cell th9 = new Cell(new Phrase("Tour Costing", fontheader));
Line 267: ttable.AddCell(th9);
Line 268: ttable.InsertTable(ttable2);
Line 269: Cell th79 = new Cell(new Phrase(" ", fontheader));
Line 270: th79.Border = 0;
Line 271: ttable.AddCell(th79);
Line 272: }
Line 273: else
Line 274: {
Line 275: // temp = temp + "</table>";
Line 276: }
Line 277:
Line 278: }
Line 279: }
Line 280: }
Line 281: }
Line 282: // other details
Line 283: using (SqlConnection con6 = new SqlConnection(dbcon))
Line 284: {
Line 285: using (SqlCommand cmd6 = new SqlCommand("Select ins_desc from other_tab where pack_id= @cid6", con6))
Line 286: {
Line 287: cmd6.Parameters.AddWithValue("@cid6", cid);
Line 288: using (SqlDataAdapter da6 = new SqlDataAdapter(cmd6))
Line 289: {
Line 290: using (DataSet ds6 = new DataSet())
Line 291: {
Line 292: da6.Fill(ds6, "tmps");
Line 293: if (ds6.Tables[0].Rows.Count > 0)
Line 294: {
Line 295: Cell th11 = new Cell(new Phrase("Important Notes ", fontheader));
Line 296: th11.Border = 0;
Line 297: ttable.AddCell(th11);
Line 298:
Line 299: string tmpother = ds6.Tables[0].Rows[0]["ins_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 300: string othrsdscrp = Regex.Replace(tmpother, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 301: Cell td11 = new Cell(new Phrase(othrsdscrp, fontbody));
Line 302: td11.Border = 0;
Line 303: ttable.AddCell(td11);
Line 304:
Line 305: }
Line 306: else
Line 307: { }
Line 308: }
Line 309: }
Line 310: }
Line 311: }
Line 312: doc.Add(ttable);
Line 313: doc.Close();
Line 314: string rtp = "pdf/" + fileName.Trim() + ".pdf";
Line 315: ScriptManager.RegisterClientScriptBlock(sss, sss.GetType(), "ClientScript", " window.open('" + rtp + "','" + fileName.Trim() + "','left=5,top=5, width=1010,height=700');", true);
Line 316: }
Line 317: }
Line 318: }
Line 319: }
Line 320: }
Line 321: }
Line 322: catch (Exception ex)
Line 323: {
Line 324: string abc = ex.Message;
Line 325: string st = abc.Replace(",", "").ToString();
Line 326: st = "Error : " + st.Replace("'", "").ToString();
Line 327: // ClientScript.RegisterStartupScript(this.GetType(), "temp", "<script language='javascript'>alert('" + st + "');</script>", false);
Line 328: ScriptManager.RegisterClientScriptBlock(sss, sss.GetType(), "temp", "<script language='javascript'>alert('" + st + "'+'\\nPlease contact to Website Administrator. !');</script>", false);
Line 329: }
Line 330: }
Line 331:
Line 332:
Line 333: public string GenratePdfforPackage(string cid)
Line 334: {
Line 335: string url = string.Empty;
Line 336: System.Web.UI.WebControls.Button sss = new System.Web.UI.WebControls.Button();
Line 337: try
Line 338: {
Line 339: using (SqlConnection con = new SqlConnection(dbcon))
Line 340: {
Line 341: using (SqlCommand cmd = new SqlCommand("select top(1) c.pc_id, p.pack_id,p.pack_name,p.itday,p.itday-1 night,p.brief_desc,p.mainimage,p.descp,c.twin,p.c_id,p.pack_code, CONVERT(VARCHAR(100), getdate(), 100) as dttt,p.remark from package_tab p inner join vdate_tab v on p.pack_id=v.pack_id inner join pcost_tab c on c.vd_id=v.vd_id where p.pack_id=@cid order by c.pc_id", con))
Line 342: {
Line 343: cmd.Parameters.AddWithValue("@cid", cid);
Line 344: using (SqlDataAdapter da = new SqlDataAdapter(cmd))
Line 345: {
Line 346: using (DataSet ds = new DataSet())
Line 347: {
Line 348: da.Fill(ds, "pd");
Line 349: if (ds.Tables[0].Rows.Count > 0)
Line 350: {
Line 351: //h11.Value = ds.Tables[0].Rows[0].ItemArray[1].ToString();
Line 352: string pdffilename = ds.Tables[0].Rows[0]["remark"].ToString();
Line 353: string pname = ds.Tables[0].Rows[0].ItemArray[2].ToString();
Line 354: string day = ds.Tables[0].Rows[0].ItemArray[3].ToString();
Line 355: string night = ds.Tables[0].Rows[0].ItemArray[4].ToString();
Line 356: string sdesc = ds.Tables[0].Rows[0].ItemArray[5].ToString();
Line 357: string ldesc = Regex.Replace(ds.Tables[0].Rows[0].ItemArray[7].ToString().Trim(), @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 358: string pcode = ds.Tables[0].Rows[0].ItemArray[10].ToString();
Line 359: url = pname;
Line 360: //hdffirstimg.Value = ds.Tables[0].Rows[0]["mainimage"].ToString().Trim();
Line 361:
Line 362: Font fontheader = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 10.0F, Font.BOLD, Color.BLACK);
Line 363: Font fontbody = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 9.0F, Font.NORMAL, Color.DARK_GRAY);
Line 364: Rectangle pageType = new Rectangle(PageSize.A4);
Line 365: string fileName = pdffilename;
Line 366: //string vfilename = "add.pdf";
Line 367: string vfileName = HttpContext.Current.Request.PhysicalApplicationPath + "pdf" + "//" + fileName + ".pdf";
Line 368: //Document doc = new Document(pageType, 5, 5, 15, 15);
Line 369: Document doc = new Document(pageType, 50, 20, 50, 50);
Line 370:
Line 371:
Line 372:
Line 373: PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(vfileName, FileMode.Create));
Line 374: string dtm = ds.Tables[0].Rows[0].ItemArray[11].ToString();
Line 375:
Line 376: HeaderFooter vFooter = new HeaderFooter(new Phrase(dtm + ", " + "Page:", fontbody), true);
Line 377: vFooter.Alignment = Element.ALIGN_CENTER;
Line 378: vFooter.Border = Rectangle.NO_BORDER;
Line 379: doc.Footer = vFooter;
Line 380: doc.Open();
Line 381:
Line 382: float[] colwwidi = new float[1] { 100 };
Line 383: iTextSharp.text.Table ttable = new iTextSharp.text.Table(1);
Line 384: ttable.Width = 98.0F;
Line 385: ttable.Border = 0;
Line 386:
Line 387: ttable.Widths = colwwidi;
Line 388: ttable.Cellpadding = 2;
Line 389: //ttable.Border = Rectangle.BOX;
Line 390: Cell td2 = new Cell();
Line 391: string absURI = HttpContext.Current.Request.Url.AbsoluteUri;
Line 392:
Line 393: Uri imgurl = new Uri(absURI.Replace("AccessServiceData.asmx/getpdf", "assets/images/logo.png"));
Line 394: iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(imgurl);
Line 395: img.ScaleToFit(100f, 100f);
Line 396: td2.HorizontalAlignment = Element.ALIGN_LEFT;
Line 397: td2.Add(img);
Line 398: td2.Border = 0;
Line 399: ttable.AddCell(td2);
Line 400:
Line 401: Cell th0 = new Cell(new Phrase("Package Code : " + pcode, fontheader));
Line 402: th0.Border = 0;
Line 403: ttable.AddCell(th0);
Line 404:
Line 405: Cell th1 = new Cell(new Phrase("Package Name : " + pname, fontheader));
Line 406: th1.Border = 0;
Line 407: ttable.AddCell(th1);
Line 408:
Line 409: Cell th13 = new Cell(new Phrase("Tour Days : " + day + " Days / " + night + " Nights", fontheader));
Line 410: th13.Border = 0;
Line 411: ttable.AddCell(th13);
Line 412:
Line 413: Cell th2 = new Cell(new Phrase("Package Summary ", fontheader));
Line 414: th2.Border = 0;
Line 415: ttable.AddCell(th2);
Line 416: Cell td1 = new Cell(new Phrase(ldesc, fontbody));
Line 417: td1.Border = 0;
Line 418: //td1.VerticalAlignment = Element.ALIGN_JUSTIFIED_ALL;
Line 419: ttable.AddCell(td1);
Line 420:
Line 421: Cell th3 = new Cell(new Phrase("Package Itinerary ", fontheader));
Line 422: th3.Border = 0;
Line 423: ttable.AddCell(th3);
Line 424:
Line 425: // Itinerary details
Line 426: using (SqlConnection con2 = new SqlConnection(dbcon))
Line 427: {
Line 428: using (SqlCommand cmd2 = new SqlCommand("select i.day,c.city_name city,i.descp,c.city_id,c.c_id,ct.country_name from Itenry_tab i inner join city_tab c on i.city=c.city_id inner join country_tab ct on ct.c_id=i.cid where pack_id=@cid2 order by i.day", con2))
Line 429: {
Line 430: cmd2.Parameters.AddWithValue("@cid2", cid);
Line 431: using (SqlDataAdapter da2 = new SqlDataAdapter(cmd2))
Line 432: {
Line 433: using (DataSet ds2 = new DataSet())
Line 434: {
Line 435: da2.Fill(ds2, "tmp");
Line 436: if (ds2.Tables[0].Rows.Count > 0)
Line 437: {
Line 438: for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
Line 439: {
Line 440: Cell ddt = new Cell(new Phrase("Day-" + ds2.Tables[0].Rows[i]["day"].ToString() + " : " + ds2.Tables[0].Rows[i]["city"].ToString(), fontheader));
Line 441: ddt.Border = 0;
Line 442: ttable.AddCell(ddt);
Line 443: string iti = ds2.Tables[0].Rows[i]["descp"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 444: string fiti = Regex.Replace(iti, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 445: Cell ddtdata = new Cell(new Phrase(fiti, fontbody));
Line 446: ddtdata.Border = 0;
Line 447: ttable.AddCell(ddtdata);
Line 448: }
Line 449: Cell ddtdataa = new Cell(new Phrase(" ", fontbody));
Line 450: ddtdataa.Border = 0;
Line 451: ttable.AddCell(ddtdataa);
Line 452: }
Line 453: else
Line 454: { }
Line 455: }
Line 456: }
Line 457: }
Line 458: }
Line 459: // Enclusion details
Line 460: using (SqlConnection con3 = new SqlConnection(dbcon))
Line 461: {
Line 462: using (SqlCommand cmd3 = new SqlCommand("Select ins_desc from inclu_tab where pack_id= @cid3", con3))
Line 463: {
Line 464: cmd3.Parameters.AddWithValue("@cid3", cid);
Line 465: using (SqlDataAdapter da3 = new SqlDataAdapter(cmd3))
Line 466: {
Line 467: using (DataSet ds3 = new DataSet())
Line 468: {
Line 469: da3.Fill(ds3, "tmps");
Line 470: if (ds3.Tables[0].Rows.Count > 0)
Line 471: {
Line 472: Cell th7 = new Cell(new Phrase("Inclusion ", fontheader));
Line 473: ttable.AddCell(th7);
Line 474: //string inc = Server.aspxDecode(ds3.Tables[0].Rows[0]["ins_desc"].ToString()).Replace("<li>", "").Replace("</li>", "").Replace("<ul>", "").Replace("</ul>", "");
Line 475: string inc = ds3.Tables[0].Rows[0]["ins_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 476: inc = Regex.Replace(inc, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 477: Cell td7 = new Cell(new Phrase(inc, fontbody));
Line 478: ttable.AddCell(td7);
Line 479: Cell th77 = new Cell(new Phrase(" ", fontheader));
Line 480: th77.Border = 0;
Line 481: ttable.AddCell(th77);
Line 482:
Line 483: }
Line 484: else
Line 485: { }
Line 486: }
Line 487: }
Line 488: }
Line 489: }
Line 490:
Line 491:
Line 492: // Exclusion details
Line 493: using (SqlConnection con4 = new SqlConnection(dbcon))
Line 494: {
Line 495: using (SqlCommand cmd4 = new SqlCommand("Select ex_desc from exclu_tab where pack_id= @cid4", con4))
Line 496: {
Line 497: cmd4.Parameters.AddWithValue("@cid4", cid);
Line 498: using (SqlDataAdapter da4 = new SqlDataAdapter(cmd4))
Line 499: {
Line 500: using (DataSet ds4 = new DataSet())
Line 501: {
Line 502: da4.Fill(ds4, "tmps");
Line 503: if (ds4.Tables[0].Rows.Count > 0)
Line 504: {
Line 505: Cell th8 = new Cell(new Phrase("Exclusion ", fontheader));
Line 506: ttable.AddCell(th8);
Line 507: string exc = ds4.Tables[0].Rows[0]["ex_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 508: exc = Regex.Replace(exc, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 509: Cell td8 = new Cell(new Phrase(exc, fontbody));
Line 510: ttable.AddCell(td8);
Line 511: Cell th78 = new Cell(new Phrase(" ", fontheader));
Line 512: th78.Border = 0;
Line 513: ttable.AddCell(th78);
Line 514:
Line 515: }
Line 516: else
Line 517: { }
Line 518: }
Line 519: }
Line 520: }
Line 521: }
Line 522:
Line 523: // Cost details
Line 524: using (SqlConnection con5 = new SqlConnection(dbcon))
Line 525: {
Line 526: using (SqlCommand cmd5 = new SqlCommand("select pc.cname,ht.hname,p.single,p.twin,p.triple,p.childbed,p.chilwoutbed,p.infant,p.pc_id from pcost_tab p inner join Package_Cate_Tab pc on p.packgeCate=pc.id inner join Hotel_Category ht on p.hotelCate=ht.id where pack_id=@cid5", con5))
Line 527: {
Line 528: cmd5.Parameters.AddWithValue("@cid5", cid);
Line 529: using (SqlDataAdapter da5 = new SqlDataAdapter(cmd5))
Line 530: {
Line 531: using (DataSet ds5 = new DataSet())
Line 532: {
Line 533: da5.Fill(ds5, "tmps");
Line 534: if (ds5.Tables[0].Rows.Count > 0)
Line 535: {
Line 536:
Line 537: float[] colwwidi2 = new float[8] { 12, 8, 18, 15, 15, 15, 18, 10 };
Line 538: iTextSharp.text.Table ttable2 = new iTextSharp.text.Table(8);
Line 539: ttable2.Width = 98.0F;
Line 540:
Line 541: ttable2.Widths = colwwidi2;
Line 542: ttable2.Cellpadding = 2;
Line 543:
Line 544: Cell thc1 = new Cell(new Phrase("Package", fontheader));
Line 545: ttable2.AddCell(thc1);
Line 546: Cell thc2 = new Cell(new Phrase("Hotel", fontheader));
Line 547: ttable2.AddCell(thc2);
Line 548: Cell thc3 = new Cell(new Phrase("Single Occupancy", fontheader));
Line 549: ttable2.AddCell(thc3);
Line 550: Cell thc4 = new Cell(new Phrase("Twin Sharing", fontheader));
Line 551: ttable2.AddCell(thc4);
Line 552: Cell thc5 = new Cell(new Phrase("Triple Sharing", fontheader));
Line 553: ttable2.AddCell(thc5);
Line 554: Cell thc6 = new Cell(new Phrase("Child with bed", fontheader));
Line 555: ttable2.AddCell(thc6);
Line 556: Cell thc7 = new Cell(new Phrase("Child without bed", fontheader));
Line 557: ttable2.AddCell(thc7);
Line 558: Cell thc8 = new Cell(new Phrase("Infant", fontheader));
Line 559: ttable2.AddCell(thc8);
Line 560: int len = ds5.Tables[0].Rows.Count;
Line 561: for (int i = 0; i < len; i++)
Line 562: {
Line 563: for (int j = 0; j < 8; j++)
Line 564: {
Line 565: if (j > 1)
Line 566: {
Line 567: Cell td10 = new Cell(new Phrase(ds5.Tables[0].Rows[i].ItemArray[j].ToString() + "/-INR", fontbody));
Line 568: ttable2.AddCell(td10);
Line 569: }
Line 570: else
Line 571: {
Line 572: Cell td10 = new Cell(new Phrase(ds5.Tables[0].Rows[i].ItemArray[j].ToString(), fontbody));
Line 573: ttable2.AddCell(td10);
Line 574: }
Line 575: }
Line 576: }
Line 577: Cell th9 = new Cell(new Phrase("Tour Costing", fontheader));
Line 578: ttable.AddCell(th9);
Line 579: ttable.InsertTable(ttable2);
Line 580: Cell th79 = new Cell(new Phrase(" ", fontheader));
Line 581: th79.Border = 0;
Line 582: ttable.AddCell(th79);
Line 583: }
Line 584: else
Line 585: {
Line 586: // temp = temp + "</table>";
Line 587: }
Line 588:
Line 589: }
Line 590: }
Line 591: }
Line 592: }
Line 593: // other details
Line 594: using (SqlConnection con6 = new SqlConnection(dbcon))
Line 595: {
Line 596: using (SqlCommand cmd6 = new SqlCommand("Select ins_desc from other_tab where pack_id= @cid6", con6))
Line 597: {
Line 598: cmd6.Parameters.AddWithValue("@cid6", cid);
Line 599: using (SqlDataAdapter da6 = new SqlDataAdapter(cmd6))
Line 600: {
Line 601: using (DataSet ds6 = new DataSet())
Line 602: {
Line 603: da6.Fill(ds6, "tmps");
Line 604: if (ds6.Tables[0].Rows.Count > 0)
Line 605: {
Line 606: Cell th11 = new Cell(new Phrase("Important Notes ", fontheader));
Line 607: th11.Border = 0;
Line 608: ttable.AddCell(th11);
Line 609:
Line 610: string tmpother = ds6.Tables[0].Rows[0]["ins_desc"].ToString().Trim().Replace("<", "<").Replace(">", ">");
Line 611: string othrsdscrp = Regex.Replace(tmpother, @"<(.|\n\s)*?>", "").Replace(" ", " ");
Line 612: Cell td11 = new Cell(new Phrase(othrsdscrp, fontbody));
Line 613: td11.Border = 0;
Line 614: ttable.AddCell(td11);
Line 615:
Line 616: }
Line 617: else
Line 618: { }
Line 619: }
Line 620: }
Line 621: }
Line 622: }
Line 623: doc.Add(ttable);
Line 624: doc.Close();
Line 625: string rtp = "pdf/" + fileName.Trim() + ".pdf";
Line 626: // ScriptManager.RegisterClientScriptBlock(sss, sss.GetType(), "ClientScript", " window.open('" + rtp + "','" + fileName.Trim() + "','left=5,top=5, width=1010,height=700');", true);
Line 627: }
Line 628: }
Line 629: }
Line 630: }
Line 631: }
Line 632:
Line 633: }
Line 634: catch (Exception ex)
Line 635: {
Line 636: string abc = ex.Message;
Line 637: string st = abc.Replace(",", "").ToString();
Line 638: st = "Error : " + st.Replace("'", "").ToString();
Line 639: // ClientScript.RegisterStartupScript(this.GetType(), "temp", "<script language='javascript'>alert('" + st + "');</script>", false);
Line 640: ScriptManager.RegisterClientScriptBlock(sss, sss.GetType(), "temp", "<script language='javascript'>alert('" + st + "'+'\\nPlease contact to Website Administrator. !');</script>", false);
Line 641: }
Line 642: return url;
Line 643: }
Line 644:
Line 645: public void GenrateInvoicePdf(string bookid, System.Web.UI.WebControls.ImageButton imgbtn)
Line 646: {
Line 647: string qry = string.Empty;
Line 648: string companyqry = string.Empty;
Line 649: companyqry = "select id,companyname,compAddress,contact,email,stno,pan,bankAcNo,bankname,bankAddress,ifsccode,payableto,payableat from CompanyProfile";
Line 650:
Line 651: qry = "select id,leadPaxName,emailid,contactno,('INV'+queryid) as InvoiceNo,CONVERT(varchar,bookdate,103)bookdate,packageName,CONVERT(varchar,tourStartDate,103)tourStartDate, ";
Line 652: qry += "CONVERT(varchar,tourEndDate,103)tourEndDate,(adult+'Adult '+child+'Child '+infant+'Infant')as pax,itineraydays,amount from TabBook where id=@id";
Line 653:
Line 654: SqlConnection connection = new SqlConnection(dbcon);
Line 655: SqlCommand command = new SqlCommand(qry, connection);
Line 656: command.Parameters.AddWithValue("@id", bookid);
Line 657: command.CommandType = CommandType.Text;
Line 658: SqlDataAdapter adapter = new SqlDataAdapter(command);
Line 659: DataSet paxdata = new DataSet();
Line 660: adapter.Fill(paxdata, "paxdetails");
Line 661:
Line 662:
Line 663:
Line 664: string temp = string.Empty;
Line 665:
Line 666: using (SqlConnection con = new SqlConnection(dbcon))
Line 667: {
Line 668: using (SqlCommand com = new SqlCommand(companyqry, con))
Line 669: {
Line 670: com.CommandType = CommandType.Text;
Line 671: using (SqlDataAdapter da = new SqlDataAdapter(com))
Line 672: {
Line 673: using (DataSet ds = new DataSet())
Line 674: {
Line 675: da.Fill(ds, "invoice");
Line 676:
Line 677: if (ds.Tables[0].Rows.Count > 0)
Line 678: {
Line 679:
Line 680:
Line 681: Font fontheader = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 10.0F, Font.BOLD, Color.BLACK);
Line 682: Font fontbody = new Font(Font.GetFamilyIndex("Arial, Helvetica, sans-serif"), 9.0F, Font.NORMAL, Color.DARK_GRAY);
Line 683: Rectangle pageType = new Rectangle(PageSize.A4);
Line 684: string fileName = paxdata.Tables[0].Rows[0]["InvoiceNo"].ToString().Trim();
Line 685: string vfileName = HttpContext.Current.Request.PhysicalApplicationPath + "CMS_form/invoiceReports/" + fileName + ".pdf";
Line 686: //Document doc = new Document(pageType, 5, 5, 15, 15);
Line 687: Document doc = new Document(pageType, 50, 20, 50, 50);
Line 688:
Line 689:
Line 690:
Line 691: PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(vfileName, FileMode.Create));
Line 692: //string dtm = ds.Tables[0].Rows[0].ItemArray[11].ToString();
Line 693:
Line 694: HeaderFooter vFooter = new HeaderFooter(new Phrase(ds.Tables[0].Rows[0]["companyname"].ToString().Trim() + " " + "Page:", fontbody), true);
Line 695: vFooter.Alignment = Element.ALIGN_CENTER;
Line 696: vFooter.Border = Rectangle.NO_BORDER;
Line 697: doc.Footer = vFooter;
Line 698: doc.Open();
Line 699:
Line 700: float[] colwwidi = new float[1] { 100 };
Line 701: iTextSharp.text.Table ttable = new iTextSharp.text.Table(1);
Line 702: ttable.Width = 98.0F;
Line 703: ttable.Border = 0;
Line 704:
Line 705: ttable.Widths = colwwidi;
Line 706: ttable.Cellpadding = 2;
Line 707: ttable.Border = Rectangle.BOX;
Line 708:
Line 709:
Line 710: float[] colwwidi2 = new float[2] { 50, 50 };
Line 711: iTextSharp.text.Table ttable2 = new iTextSharp.text.Table(2);
Line 712: ttable2.Width = 98.0F;
Line 713:
Line 714: ttable2.Widths = colwwidi2;
Line 715: ttable2.Cellpadding = 2;
Line 716:
Line 717:
Line 718:
Line 719: Cell td1 = new Cell();
Line 720: string absURI = HttpContext.Current.Request.Url.AbsoluteUri;
Line 721: Uri imgurl = new Uri(absURI.Replace(System.IO.Path.GetFileName(HttpContext.Current.Request.Url.LocalPath), "images/macologo.png"));
Line 722: iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(imgurl);
Line 723: img.ScaleToFit(100f, 100f);
Line 724: td1.HorizontalAlignment = Element.ALIGN_LEFT;
Line 725: td1.Add(img);
Line 726: td1.Border = 0;
Line 727: ttable2.AddCell(td1);
Line 728:
Line 729: Cell td2 = new Cell(new Phrase(ds.Tables[0].Rows[0]["companyname"].ToString().Trim() + "\n" + ds.Tables[0].Rows[0]["compAddress"].ToString().Trim() + "\n" + "Phone : " + ds.Tables[0].Rows[0]["contact"].ToString().Trim() + "\n" + "Email: " + ds.Tables[0].Rows[0]["email"].ToString().Trim(), fontheader));
Line 730: td2.HorizontalAlignment = Element.ALIGN_RIGHT;
Line 731: td2.Border = 0;
Line 732: ttable2.AddCell(td2);
Line 733: ttable.InsertTable(ttable2);
Line 734:
Line 735: float[] colwwidi222 = new float[1] { 100 };
Line 736: iTextSharp.text.Table ttable2222 = new iTextSharp.text.Table(1);
Line 737: ttable2222.Width = 98.0F;
Line 738:
Line 739: ttable2222.Widths = colwwidi222;
Line 740: ttable2222.Cellpadding = 2;
Line 741:
Line 742: Cell thc1 = new Cell(new Phrase("INVOICE", fontheader));
Line 743: thc1.BackgroundColor = Color.LIGHT_GRAY;
Line 744: thc1.HorizontalAlignment = Element.ALIGN_CENTER;
Line 745: ttable2222.AddCell(thc1);
Line 746: ttable.InsertTable(ttable2222);
Line 747:
Line 748:
Line 749:
Line 750: float[] colwwidi6666 = new float[2] { 18, 80 };
Line 751: iTextSharp.text.Table ttable60100 = new iTextSharp.text.Table(2);
Line 752: ttable60100.Width = 98.0F;
Line 753:
Line 754: ttable60100.Widths = colwwidi6666;
Line 755: ttable60100.Cellpadding = 2;
Line 756:
Line 757: Cell thc70100 = new Cell(new Phrase("Name:", fontheader));
Line 758: thc70100.HorizontalAlignment = Element.ALIGN_LEFT;
Line 759: ttable60100.AddCell(thc70100);
Line 760:
Line 761: Cell thc70200 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["leadPaxName"].ToString().Trim(), fontbody));
Line 762: thc70200.HorizontalAlignment = Element.ALIGN_LEFT;
Line 763: ttable60100.AddCell(thc70200);
Line 764:
Line 765: Cell thc70300 = new Cell(new Phrase("Email:", fontheader));
Line 766: thc70300.HorizontalAlignment = Element.ALIGN_LEFT;
Line 767: ttable60100.AddCell(thc70300);
Line 768:
Line 769: Cell thc70400 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["emailid"].ToString().Trim(), fontbody));
Line 770: thc70400.HorizontalAlignment = Element.ALIGN_LEFT;
Line 771: ttable60100.AddCell(thc70400);
Line 772:
Line 773: Cell thc160100 = new Cell(new Phrase("Contact No:", fontheader));
Line 774: thc160100.HorizontalAlignment = Element.ALIGN_LEFT;
Line 775: ttable60100.AddCell(thc160100);
Line 776:
Line 777: Cell thc170100 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["contactno"].ToString().Trim(), fontbody));
Line 778: thc170100.HorizontalAlignment = Element.ALIGN_LEFT;
Line 779: ttable60100.AddCell(thc170100);
Line 780: ttable.InsertTable(ttable60100);
Line 781:
Line 782:
Line 783: //Cell td301 = new Cell(new Phrase("Name: " + paxdata.Tables[0].Rows[0]["leadPaxName"].ToString().Trim() + "\n" + "Email:" + paxdata.Tables[0].Rows[0]["emailid"].ToString().Trim() + "\n" + "Phone :" + paxdata.Tables[0].Rows[0]["contactno"].ToString().Trim()));
Line 784: //td301.HorizontalAlignment = Element.ALIGN_LEFT;
Line 785: //td301.Border = 0;
Line 786: //ttable.AddCell(td301);
Line 787:
Line 788: //Cell thc50100 = new Cell(new Phrase("Email: " + paxdata.Tables[0].Rows[0]["InvoiceNo"].ToString().Trim(), fontheader));
Line 789: //thc50100.HorizontalAlignment = Element.ALIGN_LEFT;
Line 790: //ttable.AddCell(thc50100);
Line 791:
Line 792: //Cell thc501000 = new Cell(new Phrase("Phone: " + paxdata.Tables[0].Rows[0]["InvoiceNo"].ToString().Trim(), fontheader));
Line 793: //thc501000.HorizontalAlignment = Element.ALIGN_LEFT;
Line 794: //ttable.AddCell(thc501000);
Line 795:
Line 796:
Line 797: Cell thc401 = new Cell(new Phrase("INVOICE DETAILS", fontheader));
Line 798: thc401.BackgroundColor = Color.LIGHT_GRAY;
Line 799: thc401.HorizontalAlignment = Element.ALIGN_LEFT;
Line 800: ttable.AddCell(thc401);
Line 801:
Line 802: Cell thc501 = new Cell(new Phrase("Invoice No.: " + paxdata.Tables[0].Rows[0]["InvoiceNo"].ToString().Trim(), fontheader));
Line 803: thc501.HorizontalAlignment = Element.ALIGN_LEFT;
Line 804: ttable.AddCell(thc501);
Line 805:
Line 806:
Line 807:
Line 808: float[] colwwidi6 = new float[4] { 20, 35, 20, 35 };
Line 809: iTextSharp.text.Table ttable601 = new iTextSharp.text.Table(4);
Line 810: ttable601.Width = 98.0F;
Line 811:
Line 812: ttable601.Widths = colwwidi6;
Line 813: ttable601.Cellpadding = 2;
Line 814:
Line 815: Cell thc701 = new Cell(new Phrase("BOOKING DATE: ", fontheader));
Line 816: thc701.HorizontalAlignment = Element.ALIGN_LEFT;
Line 817: ttable601.AddCell(thc701);
Line 818:
Line 819: Cell thc702 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["bookdate"].ToString().Trim(), fontbody));
Line 820: thc702.HorizontalAlignment = Element.ALIGN_LEFT;
Line 821: ttable601.AddCell(thc702);
Line 822:
Line 823: Cell thc703 = new Cell(new Phrase("PACKAGE NAME:", fontheader));
Line 824: thc703.HorizontalAlignment = Element.ALIGN_LEFT;
Line 825: ttable601.AddCell(thc703);
Line 826:
Line 827: Cell thc704 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["packageName"].ToString().Trim(), fontbody));
Line 828: thc704.HorizontalAlignment = Element.ALIGN_LEFT;
Line 829: ttable601.AddCell(thc704);
Line 830:
Line 831: Cell thc801 = new Cell(new Phrase("TOUR START DATE:", fontheader));
Line 832: thc801.HorizontalAlignment = Element.ALIGN_LEFT;
Line 833: ttable601.AddCell(thc801);
Line 834:
Line 835: Cell thc802 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["tourStartDate"].ToString().Trim(), fontbody));
Line 836: thc802.HorizontalAlignment = Element.ALIGN_LEFT;
Line 837: ttable601.AddCell(thc802);
Line 838:
Line 839: Cell thc803 = new Cell(new Phrase("TOUR END DATE:", fontheader));
Line 840: thc803.HorizontalAlignment = Element.ALIGN_LEFT;
Line 841: ttable601.AddCell(thc803);
Line 842:
Line 843: Cell thc804 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["tourEndDate"].ToString().Trim(), fontbody));
Line 844: thc804.HorizontalAlignment = Element.ALIGN_LEFT;
Line 845: ttable601.AddCell(thc804);
Line 846:
Line 847:
Line 848: Cell thc901 = new Cell(new Phrase("NO. OF PAX:", fontheader));
Line 849: thc901.HorizontalAlignment = Element.ALIGN_LEFT;
Line 850: ttable601.AddCell(thc901);
Line 851:
Line 852: Cell thc902 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["pax"].ToString().Trim(), fontbody));
Line 853: thc902.HorizontalAlignment = Element.ALIGN_LEFT;
Line 854: ttable601.AddCell(thc902);
Line 855:
Line 856: Cell thc903 = new Cell(new Phrase("ITINERARY DAYS:", fontheader));
Line 857: thc903.HorizontalAlignment = Element.ALIGN_LEFT;
Line 858: ttable601.AddCell(thc903);
Line 859:
Line 860: Cell thc904 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["itineraydays"].ToString().Trim(), fontbody));
Line 861: thc904.HorizontalAlignment = Element.ALIGN_LEFT;
Line 862: ttable601.AddCell(thc904);
Line 863: ttable.InsertTable(ttable601);
Line 864:
Line 865: Cell thc1001 = new Cell(new Phrase("PAYMENT DETAILS", fontheader));
Line 866: thc1001.BackgroundColor = Color.LIGHT_GRAY;
Line 867: thc1001.HorizontalAlignment = Element.ALIGN_LEFT;
Line 868: ttable.AddCell(thc1001);
Line 869:
Line 870:
Line 871: float[] colwwidi67 = new float[2] { 50, 50 };
Line 872: iTextSharp.text.Table ttable1101 = new iTextSharp.text.Table(2);
Line 873: ttable1101.Width = 98.0F;
Line 874:
Line 875: ttable1101.Widths = colwwidi67;
Line 876: ttable1101.Cellpadding = 2;
Line 877:
Line 878: Cell thc1201 = new Cell(new Phrase("PARTICULARS ", fontheader));
Line 879: thc1201.HorizontalAlignment = Element.ALIGN_LEFT;
Line 880: ttable1101.AddCell(thc1201);
Line 881:
Line 882: Cell thc1301 = new Cell(new Phrase("TOTAL ", fontheader));
Line 883: thc1301.HorizontalAlignment = Element.ALIGN_LEFT;
Line 884: ttable1101.AddCell(thc1301);
Line 885:
Line 886: Cell thc1401 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["packageName"].ToString().Trim(), fontbody));
Line 887: thc1401.HorizontalAlignment = Element.ALIGN_LEFT;
Line 888: ttable1101.AddCell(thc1401);
Line 889:
Line 890: Cell thc1501 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["amount"].ToString().Trim(), fontbody));
Line 891: thc1501.HorizontalAlignment = Element.ALIGN_LEFT;
Line 892: ttable1101.AddCell(thc1501);
Line 893:
Line 894: Cell thc1601 = new Cell(new Phrase("SUB TOTAL (Rs.)", fontheader));
Line 895: thc1601.HorizontalAlignment = Element.ALIGN_RIGHT;
Line 896: ttable1101.AddCell(thc1601);
Line 897:
Line 898: Cell thc1701 = new Cell(new Phrase(paxdata.Tables[0].Rows[0]["amount"].ToString().Trim() + "/- (INC ALL TAXES.)", fontbody));
Line 899: thc1701.HorizontalAlignment = Element.ALIGN_LEFT;
Line 900: ttable1101.AddCell(thc1701);
Line 901: ttable.InsertTable(ttable1101);
Line 902:
Line 903:
Line 904:
Line 905:
Line 906:
Line 907:
Line 908: float[] colwwidi12 = new float[2] { 50, 50 };
Line 909: iTextSharp.text.Table ttable5 = new iTextSharp.text.Table(2);
Line 910: ttable5.Width = 98.0F;
Line 911:
Line 912: ttable5.Widths = colwwidi12;
Line 913: ttable5.Cellpadding = 2;
Line 914:
Line 915: Cell td1801 = new Cell(new Phrase("Your Sincerely," + "\n" + ds.Tables[0].Rows[0]["companyname"].ToString().Trim() + "\n" + ds.Tables[0].Rows[0]["compAddress"].ToString().Trim() + "\n" + "Phone : " + ds.Tables[0].Rows[0]["contact"].ToString().Trim() + "\n" + "Email: " + ds.Tables[0].Rows[0]["email"].ToString().Trim() + "\n" + "S.T.No: " + ds.Tables[0].Rows[0]["stno"].ToString().Trim() + "\n" + "PAN No: " + ds.Tables[0].Rows[0]["pan"].ToString().Trim(), fontheader));
Line 916: td1801.HorizontalAlignment = Element.ALIGN_LEFT;
Line 917: td1801.Border = 0;
Line 918: ttable5.AddCell(td1801);
Line 919:
Line 920: Cell td1901 = new Cell(new Phrase("Received by,\n Signature:______________________\n Name:______________________\n Date:______________________\n Place:______________________\n", fontheader));
Line 921: td1901.HorizontalAlignment = Element.ALIGN_RIGHT;
Line 922: td1901.Border = 0;
Line 923: ttable5.AddCell(td1901);
Line 924: ttable.InsertTable(ttable5);
Line 925:
Line 926: Cell thc2001 = new Cell(new Phrase("ACCOUNT DETAILS", fontheader));
Line 927: thc2001.BackgroundColor = Color.LIGHT_GRAY;
Line 928: thc2001.HorizontalAlignment = Element.ALIGN_LEFT;
Line 929: ttable.AddCell(thc2001);
Line 930:
Line 931:
Line 932: float[] colwwidi66 = new float[4] { 20, 35, 20, 35 };
Line 933: iTextSharp.text.Table ttable6 = new iTextSharp.text.Table(4);
Line 934: ttable6.Width = 98.0F;
Line 935:
Line 936: ttable6.Widths = colwwidi66;
Line 937: ttable6.Cellpadding = 2;
Line 938:
Line 939: Cell thc2101 = new Cell(new Phrase("AC NO:", fontheader));
Line 940: thc2101.HorizontalAlignment = Element.ALIGN_LEFT;
Line 941: ttable6.AddCell(thc2101);
Line 942:
Line 943: Cell thc2102 = new Cell(new Phrase(ds.Tables[0].Rows[0]["bankAcNo"].ToString().Trim(), fontbody));
Line 944: thc2102.HorizontalAlignment = Element.ALIGN_LEFT;
Line 945: ttable6.AddCell(thc2102);
Line 946:
Line 947: Cell thc2103 = new Cell(new Phrase("BANK NAME:", fontheader));
Line 948: thc2103.HorizontalAlignment = Element.ALIGN_LEFT;
Line 949: ttable6.AddCell(thc2103);
Line 950:
Line 951: Cell thc2104 = new Cell(new Phrase(ds.Tables[0].Rows[0]["bankname"].ToString().Trim(), fontbody));
Line 952: thc2104.HorizontalAlignment = Element.ALIGN_LEFT;
Line 953: ttable6.AddCell(thc2104);
Line 954:
Line 955: Cell thc2105 = new Cell(new Phrase("BANK ADDRESS:", fontheader));
Line 956: thc2105.HorizontalAlignment = Element.ALIGN_LEFT;
Line 957: ttable6.AddCell(thc2105);
Line 958:
Line 959: Cell thc2106 = new Cell(new Phrase(ds.Tables[0].Rows[0]["bankAddress"].ToString().Trim(), fontbody));
Line 960: thc2106.HorizontalAlignment = Element.ALIGN_LEFT;
Line 961: ttable6.AddCell(thc2106);
Line 962:
Line 963: Cell thc2107 = new Cell(new Phrase("BANK IFSC CODE:", fontheader));
Line 964: thc2107.HorizontalAlignment = Element.ALIGN_LEFT;
Line 965: ttable6.AddCell(thc2107);
Line 966:
Line 967: Cell thc2108 = new Cell(new Phrase(ds.Tables[0].Rows[0]["ifsccode"].ToString().Trim(), fontbody));
Line 968: thc2108.HorizontalAlignment = Element.ALIGN_LEFT;
Line 969: ttable6.AddCell(thc2108);
Line 970:
Line 971: Cell thc2109 = new Cell(new Phrase("PAYABLE TO:", fontheader));
Line 972: thc2109.HorizontalAlignment = Element.ALIGN_LEFT;
Line 973: ttable6.AddCell(thc2109);
Line 974:
Line 975: Cell thc2110 = new Cell(new Phrase(ds.Tables[0].Rows[0]["payableto"].ToString().Trim(), fontbody));
Line 976: thc2110.HorizontalAlignment = Element.ALIGN_LEFT;
Line 977: ttable6.AddCell(thc2110);
Line 978:
Line 979: Cell thc2111 = new Cell(new Phrase("PAYABLE AT:", fontheader));
Line 980: thc2111.HorizontalAlignment = Element.ALIGN_LEFT;
Line 981: ttable6.AddCell(thc2111);
Line 982:
Line 983: Cell thc2112 = new Cell(new Phrase(ds.Tables[0].Rows[0]["payableat"].ToString().Trim(), fontbody));
Line 984: thc2112.HorizontalAlignment = Element.ALIGN_LEFT;
Line 985: ttable6.AddCell(thc2112);
Line 986: ttable.InsertTable(ttable6);
Line 987:
Line 988:
Line 989:
Line 990:
Line 991: doc.Add(ttable);
Line 992: doc.Close();
Line 993: string rtp = "invoiceReports/" + fileName.Trim() + ".pdf";
Line 994: ScriptManager.RegisterClientScriptBlock(imgbtn, imgbtn.GetType(), "ClientScript", " window.open('" + rtp + "','" + fileName.Trim() + "','left=5,top=5, width=1010,height=700');", true);
Line 995:
Line 996:
Line 997:
Line 998: }
Line 999: else
Line 1000: {
Line 1001: }
Line 1002:
Line 1003: }
Line 1004: }
Line 1005: }
Line 1006: }
Line 1007:
Line 1008: //string rtp = "PDFReports/abc.pdf";
Line 1009: //ScriptManager.RegisterClientScriptBlock(imgbtn, imgbtn.GetType(), "ClientScript", " window.open('" + rtp + "','test','left=5,top=5, width=1010,height=700');", true);
Line 1010: }
Line 1011: }
|