private void GenerateDocuments()
{
if (_haveTax)
{
ActGenerator ag = new ActGenerator(this);
InvoiceGenerator ig = new InvoiceGenerator(this);
_act = ag.Generate();
_invoice = ig.Generate();
}
else
{
NoticeGenerator ng = new NoticeGenerator(this);
_notice = ng.Generate();
}
}
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace PASSSS
{
class InvoiceGenerator : IDocumentGenerator
{
private readonly DocumentHandler _handler;
// Fonts
private static BaseFont _baseTahoma;
private static Font _tahomaBold;
private static Font _tahoma;
private static Font _tahoma14Bold;
private static Font _tahomaSmall;
// Files
private iTextSharp.text.Document _invoiceDoc;
private PdfWriter _invoiceWriter;
// Overall sum row
private PdfPRow _overallSumRow;
public InvoiceGenerator(DocumentHandler handler)
{
_handler = handler;
PrepareFonts();
}
private static void PrepareFonts()
{
_baseTahoma = BaseFont.CreateFont("c:/windows/fonts/tahoma.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
_tahomaBold = new Font(_baseTahoma, 8, Font.BOLD);
_tahoma = new Font(_baseTahoma, 8, Font.NORMAL);
_tahoma14Bold = new Font(_baseTahoma, 14, Font.BOLD);
_tahomaSmall = new Font(_baseTahoma, 6, Font.NORMAL);
}
public FileInfo Generate()
{
DateTime dateOfDoc = _handler.DocData.DocumentDate;
string invoiceFileName = Settings.Default.PDFPath + "\\" + "Бонус_№_" + _handler.DocData.DocumentNum + "_СФ_от_" + dateOfDoc.ToString("dd.MM.yyyy") + ".pdf";
try
{
_invoiceDoc = new iTextSharp.text.Document(PageSize.A4.Rotate(), 15, 15, 15, 15);
_invoiceWriter = PdfWriter.GetInstance(_invoiceDoc, new FileStream(invoiceFileName, FileMode.Create));
}
catch (IOException)
{
MessageBox.Show(Resources.DocumentIsOpenedError, Resources.ErrorHeaderForDialogs, MessageBoxButtons.OK, MessageBoxIcon.Error);
return new FileInfo(invoiceFileName);
}
// Name
string header = "Счёт-фактура № " + _handler.DocData.DocumentNum + " от " + dateOfDoc.ToString("dd.MM.yyyy");
string correctionText;
if (_handler.DocData.CorrectionNum != 0)
correctionText = "Исправление № " + _handler.DocData.CorrectionNum + " от " + _handler.DocData.CorrectionDate.ToString("dd.MM.yyyy");
else
correctionText = "Исправление № ------ от \"----\"--------------";
HeaderFooter hfEvent = new HeaderFooter();
hfEvent.SetHeader(header);
_invoiceWriter.PageEvent = hfEvent;
_invoiceDoc.Open();
AddInvoiceAnnex();
// Title
Paragraph title = new Paragraph();
title.Font = _tahoma14Bold;
title.Alignment = Element.ALIGN_CENTER;
title.Add(header);
title.Add(Chunk.NEWLINE);
title.Add(correctionText);
_invoiceDoc.Add(title);
// Globus Juridical Address
AddGlobusJurSection();
// Globus hypermarkt
AddRetoureMarkt();
// Supplier retour address
AddSuppRetoureAddress();
// Applied to payment-account documents...
Paragraph applToDocsPar = new Paragraph("К платежно-расчетному документу № _______ от ________________", _tahoma);
applToDocsPar.FirstLineIndent = 2;
_invoiceDoc.Add(applToDocsPar);
// Supplier juridical address
AddSuppJurAddress();
// Currency : RUB
Paragraph currencyPar = new Paragraph("Валюта: наименование, код: Российский рубль, 643 ", _tahoma);
currencyPar.IndentationLeft = 2;
_invoiceDoc.Add(currencyPar);
// Debitor and Kreditor numbers
AddKreDebNumbers();
// Some empty lines
_invoiceDoc.Add(Chunk.NEWLINE);
// Retoure positions table
AddPositionsTable();
if (_invoiceWriter.GetVerticalPosition(true) < 100)
{
_invoiceDoc.NewPage();
AddInvoiceEmptyTableHeader();
_invoiceDoc.Add(Chunk.NEWLINE);
}
// Footer
AddInvoiceSignatures();
// Little note
_invoiceDoc.Add(new Phrase("ПРИМЕЧАНИЕ. Первый экземпляр - покупателю, второй экземпляр - продавцу", _tahoma));
// Save document
_invoiceDoc.Close();
return new FileInfo(invoiceFileName);
}
private void AddInvoiceAnnex()
{
PdfPTable annexTable = new PdfPTable(3);
float[] widthsAnnexTable = new[] { 1.0f, 2.0f, 1.0f };
annexTable.SetWidths(widthsAnnexTable);
annexTable.HorizontalAlignment = 0;
annexTable.WidthPercentage = 100;
annexTable.DefaultCell.Border = 0;
Image barcode = Image.GetInstance(_handler.Barcode.FullName);
Paragraph annex = new Paragraph();
annex.Leading = 10;
annex.Add(new Phrase("Приложение №1", _tahoma));
annex.Add(Chunk.NEWLINE);
annex.Add(new Phrase("к постановлению Правительства Российской Федерации ", _tahoma));
annex.Add(Chunk.NEWLINE);
annex.Add(new Phrase("от 26.12.2011 №1137", _tahoma));
annex.IndentationLeft = 600;
annexTable.AddCell(barcode);
annexTable.AddCell("");
annexTable.AddCell(annex);
_invoiceDoc.Add(annexTable);
}
private void AddGlobusJurSection()
{
PdfPTable globJurAddTable = new PdfPTable(2);
globJurAddTable.SpacingBefore = 5;
float[] widthsGlobusJur = new[] { 0.5f, 2.5f };
globJurAddTable.SetWidths(widthsGlobusJur);
globJurAddTable.HorizontalAlignment = 0;
PdfPCell globusNameTitleCell = VariousCells.GetCell("Продавец: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusNameCell = VariousCells.GetCell("ООО", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusAddressTitleCell = VariousCells.GetCell("Адрес: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusAddressCell = VariousCells.GetCell(_handler.GlobusJurAddress, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusInnKppTitleCell = VariousCells.GetCell("ИНН/КПП продавца: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusInnKppCell = VariousCells.GetCell(_handler.Inn + " / " + _handler.Kpp, Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
globusNameTitleCell.Border = 0;
globusNameCell.Border = 0;
globusAddressTitleCell.Border = 0;
globusAddressCell.Border = 0;
globusInnKppTitleCell.Border = 0;
globusInnKppCell.Border = 0;
globJurAddTable.AddCell(globusNameTitleCell);
globJurAddTable.AddCell(globusNameCell);
globJurAddTable.AddCell(globusAddressTitleCell);
globJurAddTable.AddCell(globusAddressCell);
globJurAddTable.AddCell(globusInnKppTitleCell);
globJurAddTable.AddCell(globusInnKppCell);
_invoiceDoc.Add(globJurAddTable);
}
private void AddRetoureMarkt()
{
PdfPTable globRetTable = new PdfPTable(2);
float[] widthsGlobusRet = new[] { 0.8f, 2.2f };
globRetTable.SetWidths(widthsGlobusRet);
globRetTable.HorizontalAlignment = 0;
PdfPCell globusRetNameTitleCell = VariousCells.GetCell("Грузоотправитель и его адрес:", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell globusRetNameCell = VariousCells.GetCell(new string('-', 20), Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
globusRetNameTitleCell.Border = 0;
globusRetNameCell.Border = 0;
globRetTable.AddCell(globusRetNameTitleCell);
globRetTable.AddCell(globusRetNameCell);
_invoiceDoc.Add(globRetTable);
}
private void AddSuppRetoureAddress()
{
PdfPTable suppRetTable = new PdfPTable(2);
float[] widthsSuppRet = new[] { 0.8f, 2.2f };
suppRetTable.SetWidths(widthsSuppRet);
suppRetTable.HorizontalAlignment = 0;
PdfPCell suppRetNameTitleCell = VariousCells.GetCell("Грузополучатель и его адрес:", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppRetNameCell = VariousCells.GetCell(new string('-', 20), Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
suppRetNameTitleCell.Border = 0;
suppRetNameCell.Border = 0;
// Nested table
suppRetTable.AddCell(suppRetNameTitleCell);
suppRetTable.AddCell(suppRetNameCell);
_invoiceDoc.Add(suppRetTable);
}
private void AddSuppJurAddress()
{
PdfPTable suppJurAddTable = new PdfPTable(2);
suppJurAddTable.SpacingBefore = 10;
float[] widthsSuppJur = new[] { 0.5f, 2.5f };
suppJurAddTable.SetWidths(widthsSuppJur);
suppJurAddTable.HorizontalAlignment = 0;
PdfPCell suppNameTitleCell = VariousCells.GetCell("Покупатель: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppNameCell = VariousCells.GetCell(_handler.DocData.Bills.Select(bill => bill.SupplierName).FirstOrDefault(), Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppAddressTitleCell = VariousCells.GetCell("Адрес: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppAddressCell = VariousCells.GetCell(_handler.DocData.Bills.Select(bill => bill.SupplierAddress).FirstOrDefault(), Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppInnKppTitleCell = VariousCells.GetCell("ИНН/КПП покупателя: ", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
PdfPCell suppInnKppCell = VariousCells.GetCell(_handler.DocData.Bills.Select(bill => bill.INN + " / " + bill.KPP).FirstOrDefault(), Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
suppNameTitleCell.Border = 0;
suppNameCell.Border = 0;
suppAddressTitleCell.Border = 0;
suppAddressCell.Border = 0;
suppInnKppTitleCell.Border = 0;
suppInnKppCell.Border = 0;
suppJurAddTable.AddCell(suppNameTitleCell);
suppJurAddTable.AddCell(suppNameCell);
suppJurAddTable.AddCell(suppAddressTitleCell);
suppJurAddTable.AddCell(suppAddressCell);
suppJurAddTable.AddCell(suppInnKppTitleCell);
suppJurAddTable.AddCell(suppInnKppCell);
_invoiceDoc.Add(suppJurAddTable);
}
private void AddKreDebNumbers()
{
Paragraph kredDebInfo = new Paragraph();
kredDebInfo.IndentationLeft = 2;
kredDebInfo.Leading = 10;
kredDebInfo.Add(new Phrase("Номер кредитора: " + _handler.DocData.SupplierNum, _tahoma));
kredDebInfo.Add(Chunk.NEWLINE);
kredDebInfo.Add(new Phrase("Номер кредитора: " + _handler.DocData.Bills.Select(bill => bill.DebitorNum).FirstOrDefault(), _tahoma));
_invoiceDoc.Add(kredDebInfo);
}
private void AddPositionsTable()
{
PdfPTable positionsTable = new PdfPTable(13);
positionsTable.HeaderRows = 3;
positionsTable.WidthPercentage = 100;
float[] positTableWidth = new[] { 2.8f, 0.3f, 0.6f, 0.7f, 0.7f, 0.9f, 0.5f, 0.6f, 0.8f, 1.1f, 0.3f, 1.1f, 1.4f };
positionsTable.SetWidths(positTableWidth);
positionsTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
positionsTable.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
// Positions table header
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Наименование товара (описание выполненых работ, оказанных услуг), имущественного права", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Единица измерения", 2, 1, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Количество (объем)", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Цена (тариф) за единицу измерения", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Стоимость товаров (работ,услуг) имуществен-ных прав без налога - всего", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("В том числе сумма акциза", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Налого-вая ставка", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Сумма налога, предъявляе-мая покупателю", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Стоимость товаров (работ,услуг), имущественных прав с налогом - всего", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Страна происхождения товара", 2, 1, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("Номер таможенной декларации", 1, 2, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("код", 1, 1, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("условное обозначение (национальное)", 1, 1, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("цифровой код", 1, 1, _tahomaBold));
positionsTable.AddCell(VariousCells.GetTableHeaderCell("краткое наименование", 1, 1, _tahomaBold));
// Numbers
positionsTable.AddCell(VariousCells.GetCell("1", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("2", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("2а", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("3", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("4", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("5", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("6", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("7", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("8", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("9", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("10", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("10а", _tahomaBold));
positionsTable.AddCell(VariousCells.GetCell("11", _tahomaBold));
positionsTable.DefaultCell.Border = 0;
foreach (Bonus bill in _handler.BonusList)
{
// Article info
PdfPCell infoCell = VariousCells.GetCell(bill.Description, _tahoma);
positionsTable.AddCell(infoCell);
// code in OKEI (Russian National Classification of Units of Measurement)
PdfPCell unitCodeCell = VariousCells.GetCell("---", _tahoma);
positionsTable.AddCell(unitCodeCell);
// Unit
PdfPCell unitCell = VariousCells.GetCell("---", _tahoma);
positionsTable.AddCell(unitCell);
// Quantity
PdfPCell quantCell = VariousCells.GetCell(bill.Quantity, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(quantCell);
// Price
PdfPCell priceCell = VariousCells.GetCell(bill.Price, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(priceCell);
// Price * Quantity
PdfPCell priceQuantCell = VariousCells.GetCell(bill.Sum, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(priceQuantCell);
// Excise
PdfPCell dashesCell = VariousCells.GetCell("Без акциза", _tahoma);
positionsTable.AddCell(dashesCell);
// TaxPercent
PdfPCell taxCell = VariousCells.GetCell(bill.TaxPercent.ToString(CultureInfo.InvariantCulture) + "%", _tahoma);
positionsTable.AddCell(taxCell);
// Price * tax / 100
PdfPCell artTaxCell = VariousCells.GetCell(bill.Tax, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(artTaxCell);
// Overall cost
PdfPCell overallCell = VariousCells.GetCell(bill.PositionSum, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(overallCell);
// Code of land of production
PdfPCell landCodeCell = VariousCells.GetCell("---", _tahoma);
positionsTable.AddCell(landCodeCell);
// Land of production
PdfPCell landCell = VariousCells.GetCell("---", _tahoma);
positionsTable.AddCell(landCell);
// Declaration
PdfPCell declCell = VariousCells.GetCell("---", _tahoma);
positionsTable.AddCell(declCell);
}
PdfPCell noBorderCell = new PdfPCell();
noBorderCell.Border = Rectangle.NO_BORDER;
PdfPCell emptyCells = new PdfPCell();
PdfPCell overAllText = VariousCells.GetCell("Всего к оплате", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 7, 1, _tahomaBold);
overAllText.Border = Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;
positionsTable.AddCell(overAllText);
positionsTable.AddCell(emptyCells);
PdfPCell overallTaxCell = VariousCells.GetCell(_handler.Tax, "{0:#,##0.00}", _tahoma);
positionsTable.AddCell(overallTaxCell);
PdfPCell overallPriceCell = VariousCells.GetCell(_handler.OverallSum, "{0:#,##0.00}", _tahomaBold);
positionsTable.AddCell(overallPriceCell);
positionsTable.CompleteRow();
_overallSumRow = positionsTable.GetRow(positionsTable.Size - 1);
_invoiceDoc.Add(positionsTable);
}
private void AddInvoiceEmptyTableHeader()
{
PdfPTable emptyTable = new PdfPTable(13);
emptyTable.HeaderRows = 3;
emptyTable.SpacingBefore = 10;
emptyTable.WidthPercentage = 100;
float[] positTableWidth = new[] { 2.8f, 0.3f, 0.6f, 0.7f, 0.7f, 0.9f, 0.5f, 0.6f, 0.7f, 1.0f, 0.3f, 1.1f, 1.6f };
emptyTable.SetWidths(positTableWidth);
emptyTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
emptyTable.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
// Positions table header
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Наименование товара (описание выполненых работ, оказанных услуг), имущественного права", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Единица измерения", 2, 1, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Количество (объем)", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Цена (тариф) за единицу измерения", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Стоимость товаров (работ,услуг) имуществен-ных прав без налога - всего", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("В том числе сумма акциза", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Налого-вая ставка", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Сумма налога, предъявляе-мая покупателю", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Стоимость товаров (работ,услуг), имущественных прав с налогом - всего", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Страна происхождения товара", 2, 1, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("Номер таможенной декларации", 1, 2, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("код", 1, 1, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("условное обозначение (национальное)", 1, 1, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("цифровой код", 1, 1, _tahomaBold));
emptyTable.AddCell(VariousCells.GetTableHeaderCell("краткое наименование", 1, 1, _tahomaBold));
// Numbers
emptyTable.AddCell(VariousCells.GetCell("1", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("2", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("2а", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("3", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("4", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("5", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("6", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("7", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("8", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("9", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("10", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("10а", _tahomaBold));
emptyTable.AddCell(VariousCells.GetCell("11", _tahomaBold));
emptyTable.Rows.Add(_overallSumRow);
_invoiceDoc.Add(emptyTable);
}
private void AddInvoiceSignatures()
{
PdfPTable footerTable = new PdfPTable(2);
footerTable.SpacingBefore = 10;
footerTable.WidthPercentage = 100;
footerTable.DefaultCell.Border = 0;
float[] footerTableWidth = new[] { 1.1f, 0.9f };
footerTable.SetWidths(footerTableWidth);
// Prepare duplicated cells
PdfPCell signCell = VariousCells.GetCell("(подпись)", _tahoma);
signCell.Border = Rectangle.NO_BORDER;
PdfPCell fioCell = VariousCells.GetCell("(Ф.И.О.)", _tahoma);
fioCell.Border = Rectangle.NO_BORDER;
// General director
PdfPTable genDirNestedTable = new PdfPTable(3);
genDirNestedTable.DefaultCell.Border = Rectangle.NO_BORDER;
float[] genDirNestedTableWidth = new[] { 1.2f, 0.6f, 1.2f };
genDirNestedTable.SetWidths(genDirNestedTableWidth);
PdfPCell genDirTitleCell = VariousCells.GetCell("Руководитель организации или иное уполномоченное лицо", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
genDirTitleCell.Border = Rectangle.NO_BORDER;
genDirNestedTable.AddCell(genDirTitleCell);
// Fields to fill
genDirNestedTable.AddCell("____________");
PdfPCell generalDirectorCell = VariousCells.GetCell(_handler.GeneralDirector, _tahoma);
generalDirectorCell.Border = Rectangle.NO_BORDER;
genDirNestedTable.AddCell(generalDirectorCell);
// Empty cell
genDirNestedTable.AddCell("");
// under lines...
genDirNestedTable.AddCell(signCell);
genDirNestedTable.AddCell(fioCell);
footerTable.AddCell(genDirNestedTable);
// Accountant
PdfPTable accountantNestedTable = new PdfPTable(3);
accountantNestedTable.DefaultCell.Border = Rectangle.NO_BORDER;
float[] accountNestedTableWidth = new[] { 1.1f, 0.8f, 1.1f };
accountantNestedTable.SetWidths(accountNestedTableWidth);
PdfPCell accountantTitleCell = VariousCells.GetCell("Главный бухгалтер или иное уполномоченное лицо", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
accountantTitleCell.Border = Rectangle.NO_BORDER;
accountantNestedTable.AddCell(accountantTitleCell);
// Fields to fill
accountantNestedTable.AddCell("____________");
PdfPCell accountantCell = VariousCells.GetCell(_handler.Accountant, _tahoma);
accountantCell.Border = Rectangle.NO_BORDER;
accountantNestedTable.AddCell(accountantCell);
// Empty cell
accountantNestedTable.AddCell("");
// under lines...
accountantNestedTable.AddCell(signCell);
accountantNestedTable.AddCell(fioCell);
footerTable.AddCell(accountantNestedTable);
// Business owner
PdfPTable busOwnerNestedTable = new PdfPTable(3);
busOwnerNestedTable.DefaultCell.Border = Rectangle.NO_BORDER;
float[] busOwnerNestedTableWidth = new[] { 1.2f, 0.6f, 1.2f };
busOwnerNestedTable.SetWidths(busOwnerNestedTableWidth);
PdfPCell busOwnerTitleCell = VariousCells.GetCell("Индивидуальный предприниматель", Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, _tahoma);
busOwnerTitleCell.Border = Rectangle.NO_BORDER;
busOwnerNestedTable.AddCell(busOwnerTitleCell);
// Fields to fill
busOwnerNestedTable.AddCell("___________");
busOwnerNestedTable.AddCell("________________________");
// Empty cell
busOwnerNestedTable.AddCell("");
// under lines...
busOwnerNestedTable.AddCell(signCell);
busOwnerNestedTable.AddCell(fioCell);
footerTable.AddCell(busOwnerNestedTable);
// Certificate details
PdfPCell certDetails = VariousCells.GetCell("(реквизиты свидетельства о государственной регистрации индивидуального предпринимателя)", _tahoma);
certDetails.Border = Rectangle.NO_BORDER;
footerTable.AddCell(certDetails);
// Add to document
_invoiceDoc.Add(footerTable);
}
}
}