public RtQ(string id, string custName, string custAdd, string RfQId, string text, DataGridView dataGrid, string contact) { string name = "RtQ" + id + ".pdf"; string path = "..\\..\\Reports\\" + name; Document doc = new Document(PageSize.A4, 36, 36, 10, 10); FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None); PdfWriter wr = PdfWriter.GetInstance(doc, fs); doc.Open(); Paragraph date = new Paragraph(dateTime.ToString("dd/MM/yyyy")); date.Alignment = Element.ALIGN_RIGHT; doc.Add(date); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("..\\..\\images\\Logo.png"); img.ScalePercent(80f); img.Alignment = Element.ALIGN_CENTER; doc.Add(img); Paragraph stlAdd = new Paragraph("Socket Technologies Ltd.,\nRaheen Industrial Estate,\nLimerick"); stlAdd.Alignment = Element.ALIGN_CENTER; doc.Add(stlAdd); Paragraph rtq = new Paragraph("\nRefusal to Quote\n"); rtq.Alignment = Element.ALIGN_CENTER; doc.Add(rtq); Paragraph rtqNo = new Paragraph("No. " + id); rtqNo.Alignment = Element.ALIGN_CENTER; doc.Add(rtqNo); string address = ""; address = custAdd.Split(',')[0]; address += "\n" + custAdd.Split(',')[1]; address += "\n" + custAdd.Split(',')[2]; Paragraph cust = new Paragraph("To: " + custName + ",\n" + address); cust.Alignment = Element.ALIGN_LEFT; doc.Add(cust); doc.Add(Chunk.NEWLINE); Paragraph attn = new Paragraph("ATTN: " + contact); attn.Alignment = Element.ALIGN_LEFT; doc.Add(attn); doc.Add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(2); float[] widths = new float[] { 180f, 60f }; table.SetTotalWidth(widths); table.LockedWidth = true; table.HorizontalAlignment = Element.ALIGN_LEFT; table.AddCell("Request for Quotation Number:"); table.AddCell(RfQId.ToString()); doc.Add(table); doc.Add(Chunk.NEWLINE); Paragraph txt = new Paragraph(text); txt.Alignment = Element.ALIGN_LEFT; doc.Add(txt); doc.Add(Chunk.NEWLINE); Chunk chunk = new Chunk("CUSTOM ITEMS", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.UNDERLINE)); Paragraph custItem = new Paragraph(chunk); custItem.Alignment = Element.ALIGN_LEFT; doc.Add(custItem); doc.Add(Chunk.NEWLINE); Phrase header1 = new Phrase("Line No.", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.BOLD)); Phrase header2 = new Phrase("Cust P/N", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.BOLD)); Phrase header3 = new Phrase("Quantity", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.BOLD)); PdfPTable items = new PdfPTable(3); items.HorizontalAlignment = Element.ALIGN_LEFT; items.AddCell(header1); items.AddCell(header2); items.AddCell(header3); foreach (DataGridViewRow row in dataGrid.Rows) { foreach (DataGridViewCell cell in row.Cells) { try { items.AddCell(cell.Value.ToString()); } catch { } } } doc.Add(items); doc.Add(Chunk.NEWLINE); doc.Add(Chunk.NEWLINE); Paragraph sig = new Paragraph("__________________________________\nPatrick G. Hynes, Sales Manager"); sig.Alignment = Element.ALIGN_LEFT; doc.Add(sig); doc.Close(); string FolderId = "0B_ob9qFmHlBcMHNVSDB3YXZ5YkE"; Common_Rules.setPdf("Refusal to Quote " + id, path); Common_Rules.setUpload(name, path, FolderId); Common_Rules.setDatabaseUpload("RefusalToQuote_Report", dateTime.ToShortDateString()); }
public RfQ(string id, Customer customer, List <IProduct> standardParts, List <IProduct> customParts, string[] requiredDates, string contact) { string name = "RfQ" + id + ".pdf"; string path = "..\\..\\Reports\\" + name; iTextSharp.text.Document doc = new iTextSharp.text.Document(PageSize.A4, 36, 36, 10, 10); FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None); PdfWriter wr = PdfWriter.GetInstance(doc, fs); doc.Open(); Paragraph date = new Paragraph(dateTime.ToString("dd/MM/yyyy")); date.Alignment = Element.ALIGN_RIGHT; doc.Add(date); Paragraph custAdd = new Paragraph(customer.CustCompanyName + ",\n" + customer.CustAddress[0] + ",\n" + customer.CustAddress[1] + ",\n" + customer.CustAddress[2]); custAdd.Alignment = Element.ALIGN_CENTER; doc.Add(custAdd); Paragraph rfq = new Paragraph("\nRequest for Quotation\n"); rfq.Alignment = Element.ALIGN_CENTER; doc.Add(rfq); Paragraph rfqNo = new Paragraph("No. " + id); rfqNo.Alignment = Element.ALIGN_CENTER; doc.Add(rfqNo); Paragraph stl = new Paragraph("To: Socket Technologies Ltd.,\nRaheen Industrial Estate,\nLimerick"); stl.Alignment = Element.ALIGN_LEFT; doc.Add(stl); doc.Add(Chunk.NEWLINE); Paragraph p1 = new Paragraph("Please quote for the supply of the following standard STL parts:"); p1.Alignment = Element.ALIGN_LEFT; doc.Add(p1); doc.Add(Chunk.NEWLINE); Chunk chunk = new Chunk("STANDARD ITEMS", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.UNDERLINE)); Paragraph standItem = new Paragraph(chunk); standItem.Alignment = Element.ALIGN_LEFT; doc.Add(standItem); doc.Add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(3); float[] widths = new float[] { 60f, 260f, 180f }; table.SetTotalWidth(widths); table.LockedWidth = true; table.HorizontalAlignment = Element.ALIGN_LEFT; table.AddCell("STL P/N."); table.AddCell("Part Name"); table.AddCell("Quantity"); foreach (Product prod in standardParts) { table.AddCell(prod.ProductId.ToString()); table.AddCell(prod.ProductName); table.AddCell(prod.Quantity.ToString()); i++; } doc.Add(table); doc.Add(Chunk.NEWLINE); Paragraph p2 = new Paragraph("Please quote for the supply of the following custom parts"); p2.Alignment = Element.ALIGN_LEFT; doc.Add(p2); doc.Add(Chunk.NEWLINE); Chunk chunk2 = new Chunk("CUSTOM ITEMS", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12.0f, iTextSharp.text.Font.UNDERLINE)); Paragraph custItem = new Paragraph(chunk2); custItem.Alignment = Element.ALIGN_LEFT; doc.Add(custItem); doc.Add(Chunk.NEWLINE); PdfPTable table2 = new PdfPTable(3); float[] widths2 = new float[] { 180f, 180f, 180f }; table2.SetTotalWidth(widths2); table2.LockedWidth = true; table2.HorizontalAlignment = Element.ALIGN_LEFT; table2.AddCell("Custom Part Name"); table2.AddCell("Specifications"); table2.AddCell("Quantity"); foreach (Product custom in customParts) { table2.AddCell(custom.ProductName); table2.AddCell(custom.ProductDescription); table2.AddCell(custom.Quantity.ToString()); } doc.Add(table2); doc.Add(Chunk.NEWLINE); Paragraph p3 = new Paragraph("Standard conditions apply."); p3.Alignment = Element.ALIGN_LEFT; doc.Add(p3); doc.Add(Chunk.NEWLINE); Paragraph qDate = new Paragraph("Quotation required by " + requiredDates[0]); qDate.Alignment = Element.ALIGN_LEFT; doc.Add(qDate); doc.Add(Chunk.NEWLINE); Paragraph dates = new Paragraph("Delivery required:\n\t\t" + requiredDates[1] + " days from submission of order for custom items.\n\t\t" + requiredDates[2] + " days from submission for standard items."); dates.Alignment = Element.ALIGN_LEFT; doc.Add(dates); doc.Add(Chunk.NEWLINE); doc.Add(Chunk.NEWLINE); Paragraph sig = new Paragraph("__________________________________\n" + contact); sig.Alignment = Element.ALIGN_LEFT; doc.Add(sig); doc.Close(); string FolderId = "0B_ob9qFmHlBcc2tiS2p6bWlEMlE"; Common_Rules.setPdf("Request for Quotation " + id, path); Common_Rules.setUpload(name, path, FolderId); Common_Rules.setDatabaseUpload("RequestForQuotation_Report", dateTime.ToShortDateString()); }
public RGArequest(string rgaID, string custName, string custID, string cpoID, string text) { string fileName = "RGArequest" + rgaID + ".pdf"; string path = "..\\..\\Reports\\" + fileName; Document doc = new Document(PageSize.A4, 36, 36, 10, 10); FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None); PdfWriter wr = PdfWriter.GetInstance(doc, fs); doc.Open(); Paragraph date = new Paragraph("Date: " + dateTime.ToString("dd/MM/yyyy")); date.Alignment = Element.ALIGN_RIGHT; doc.Add(date); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("..\\..\\images\\Logo.png"); img.ScalePercent(80f); img.Alignment = Element.ALIGN_CENTER; doc.Add(img); Paragraph stlAdd = new Paragraph("Socket Technologies Ltd.,\nRaheen Industrial Estate,\nLimerick"); stlAdd.Alignment = Element.ALIGN_CENTER; doc.Add(stlAdd); Paragraph rga = new Paragraph("\nReturned Goods Authorisation Request"); rga.Alignment = Element.ALIGN_CENTER; doc.Add(rga); Paragraph rga_id = new Paragraph("RGA ID: " + rgaID); rga_id.Alignment = Element.ALIGN_CENTER; doc.Add(rga_id); Paragraph id = new Paragraph("\n\nCustomer ID: " + custID); id.Alignment = Element.ALIGN_LEFT; doc.Add(id); Paragraph cpo = new Paragraph("Customer Purchase Order ID: " + cpoID); cpo.Alignment = Element.ALIGN_LEFT; doc.Add(cpo); Paragraph fsrtype = new Paragraph("Customer Name: " + custName); fsrtype.Alignment = Element.ALIGN_LEFT; doc.Add(fsrtype); Paragraph fsrtxt = new Paragraph("\n\nText: \n" + text); fsrtxt.Alignment = Element.ALIGN_LEFT; doc.Add(fsrtxt); Paragraph sig = new Paragraph("\n\n__________________________________\nG. Lyons, Customer Services"); sig.Alignment = Element.ALIGN_LEFT; doc.Add(sig); doc.Close(); MessageBox.Show("RGA request Successfully Created!\n\nRGA Request ID: " + rgaID); string FolderId = "0B_ob9qFmHlBccjA1RmRBWGNnOG8"; Common_Rules.setPdf("Returned Goods Authorisation Request " + rgaID, path); Common_Rules.setUpload(fileName, path, FolderId); Common_Rules.setDatabaseUpload("RGArequest_Report", dateTime.ToShortDateString()); }