Пример #1
0
        public static void AddTruckDetail(ref Document document, SqlDataReader drTrucks, DailyGrowerTareDetailEvent pgEvent)
        {
            const string METHOD_NAME = "AddTruckDetail";
            string       yardCard    = null;

            try {
                pgEvent.HeaderNameList = _truckDetailHdrNames;
                //PdfPTable table = PdfReports.CreateTable(_primaryTableLayout, 1);

                int iYardCard     = drTrucks.GetOrdinal("Yard_Card_Sequence_Number");
                int iDeliveryDate = drTrucks.GetOrdinal("Delivery_Date");
                int iTruckNumber  = drTrucks.GetOrdinal("Truck_Number");
                int iWeightIn     = drTrucks.GetOrdinal("Weight_In");
                int iWeightOut    = drTrucks.GetOrdinal("Weight_Out");
                int iDirtWt       = drTrucks.GetOrdinal("Dirt_Weight");
                int iDirtTaken    = drTrucks.GetOrdinal("Dirt_Taken");
                int iNetWt        = drTrucks.GetOrdinal("Net_Weight");

                while (drTrucks.Read())
                {
                    PdfPTable table = PdfReports.CreateTable(_primaryTableLayout, 1);

                    // On first pass, add the header labels here.
                    if (yardCard == null)
                    {
                        PdfReports.FillHeaderLabels(ref table, _truckDetailHdrNames, _labelFont);
                    }
                    else
                    {
                        // Now let the PDF Page event handler take care of adding column labels on page breaks.
                        pgEvent.HeaderTableLayout = _primaryTableLayout;
                    }

                    yardCard = drTrucks.GetString(iYardCard);
                    PdfReports.AddText2Table(table, yardCard, _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iDeliveryDate), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iTruckNumber), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iWeightIn).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iWeightOut).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iDirtWt).ToString("#,##0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drTrucks.GetString(iDirtTaken), _normalFont, "center");
                    PdfReports.AddText2Table(table, drTrucks.GetInt32(iNetWt).ToString("#,##0"), _normalFont, "right");

                    PdfReports.AddTableNoSplit(document, pgEvent, table);
                }

                //PdfReports.AddTableNoSplit(document, pgEvent, table);

                pgEvent.HeaderNameList    = null;
                pgEvent.HeaderTableLayout = null;
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
Пример #2
0
        public static void AddSampleDetail(ref Document document, SqlDataReader drSamples, DailyGrowerTareDetailEvent pgEvent)
        {
            const string METHOD_NAME = "AddSampleDetail";
            string       yardCard    = null;
            PdfPTable    table       = null;

            try {
                pgEvent.HeaderNameList = _sampleDetailHdrNames;

                while (drSamples.Read())
                {
                    table = PdfReports.CreateTable(_tareTableLayout, 1);

                    // On first pass, add the header labels here.
                    if (yardCard == null)
                    {
                        PdfReports.FillHeaderLabels(ref table, _sampleDetailHdrNames, _labelFont);
                    }
                    else
                    {
                        // Now let the PDF Page event handler take care of adding column labels on page breaks.
                        pgEvent.HeaderTableLayout = _tareTableLayout;
                    }

                    yardCard = drSamples.GetString(drSamples.GetOrdinal("Yard_Card_No"));
                    PdfReports.AddText2Table(table, yardCard, _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetInt32(drSamples.GetOrdinal("SampleNo")).ToString("#"), _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetDecimal(drSamples.GetOrdinal("Sugar_Content")).ToString("0.00"), _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetDecimal(drSamples.GetOrdinal("Gross_Weight")).ToString("#,##0.0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drSamples.GetDecimal(drSamples.GetOrdinal("Clean_Weight")).ToString("#,##0.0"), _normalFont, "right");
                    PdfReports.AddText2Table(table, drSamples.GetDecimal(drSamples.GetOrdinal("Tare")).ToString("0.00"), _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetString(drSamples.GetOrdinal("High_Tare")), _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetInt32(drSamples.GetOrdinal("Sample_Quality")).ToString(), _normalFont, "center");
                    PdfReports.AddText2Table(table, drSamples.GetDecimal(drSamples.GetOrdinal("SLM_Pct")).ToString("0.0000"), _normalFont, "center");

                    PdfReports.AddTableNoSplit(document, pgEvent, table);
                }

                pgEvent.HeaderNameList    = null;
                pgEvent.HeaderTableLayout = null;

                // Follow the table with a blank line
                table = PdfReports.CreateTable(_tareTableLayout, 1);
                PdfReports.AddText2Table(table, " ", _normalFont, _tareTableLayout.Length);

                PdfReports.AddTableNoSplit(document, pgEvent, table);
            }
            catch (Exception ex) {
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(MOD_NAME + "." + METHOD_NAME, ex);
                throw (wscEx);
            }
        }
Пример #3
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (!_isDocumentClosing)
            {
                _pageNumber++;

                // ===========================================================================
                // Create header column -- in this report this is the page's column object
                // ===========================================================================
                _ct.SetSimpleColumn(PortraitPageSize.HdrLowerLeftX, PortraitPageSize.HdrLowerLeftY,
                                    PortraitPageSize.HdrUpperRightX, PortraitPageSize.HdrUpperRightY,
                                    PortraitPageSize.PgLeading, Element.ALIGN_CENTER);
                _ct.YLine = PortraitPageSize.HdrTopYLine;

                // =======================================================
                // Add Logo
                // =======================================================
                if (_pageNumber == 1)
                {
                    float[]   wscLogoLayout = new float[] { 413F, 127F };
                    PdfPTable logoTable     = PdfReports.CreateTable(wscLogoLayout, 0);
                    PdfReports.AddText2Table(logoTable, " ", _normalFont);
                    PdfReports.AddImage2Table(logoTable, _imgLogo);
                    PdfReports.AddText2Table(logoTable, " ", _titleFont, wscLogoLayout.Length);

                    PdfReports.AddTableNoSplit(document, this, logoTable);
                }

                float[]   headerLayout = new float[] { 50F, 200F, 290F };
                PdfPTable table        = PdfReports.CreateTable(headerLayout, 1);

                Paragraph p = new Paragraph(_title, _titleFont);
                PdfReports.AddText2Table(table, p, "center", headerLayout.Length);

                // Add blank lines
                PdfReports.AddText2Table(table, " ", _subNormalFont, headerLayout.Length);
                PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);

                // Add Header information
                PdfReports.AddText2Table(table, "SHID", _labelFont);
                PdfReports.AddText2Table(table, "Shareholder Name", _labelFont);
                PdfReports.AddText2Table(table, "Delivery Date", _labelFont);

                PdfReports.AddText2Table(table, _shid, _normalFont);
                PdfReports.AddText2Table(table, _shareholderName, _normalFont);
                PdfReports.AddText2Table(table, _deliveryDate, _normalFont);

                PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);
                PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);

                PdfReports.AddTableNoSplit(document, this, table);

                table = PdfReports.CreateTable(_hdrTableLayout, 1);
                PdfReports.FillHeaderLabels(ref table, _hdrTableNames, _labelFont);
                PdfReports.AddTableNoSplit(document, this, table);

                _headerBottomYLine = _ct.YLine;
            }

            base.OnStartPage(writer, document);
        }
Пример #4
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (!_isDocumentClosing)
            {
                _pageNumber++;
                if (_pageNumber == 1)
                {
                    _template = _cb.CreateTemplate(PortraitPageSize.HdrUpperRightX - PortraitPageSize.HdrLowerLeftX, 50);
                }

                // ===========================================================================
                // Create header column -- in this report this is the page's column object
                // ===========================================================================
                _ct.SetSimpleColumn(PortraitPageSize.HdrLowerLeftX, PortraitPageSize.HdrLowerLeftY,
                                    PortraitPageSize.HdrUpperRightX, PortraitPageSize.HdrUpperRightY,
                                    PortraitPageSize.PgLeading, Element.ALIGN_CENTER);
                _ct.YLine = PortraitPageSize.HdrTopYLine;

                // =======================================================
                // Add Report Header
                // =======================================================
                float[]   headerLayout = new float[] { 40F, 120F, 220F, 160F };
                PdfPTable table        = PdfReports.CreateTable(headerLayout, 1);

                if (_isSummary)
                {
                    PdfReports.AddText2Table(table, "Process Summary", _titleFont, "center", headerLayout.Length);
                    PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);
                    PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);
                    PdfReports.AddTableNoSplit(document, this, table);
                }
                else
                {
                    PdfReports.AddText2Table(table, " ", _normalFont, headerLayout.Length);
                    PdfReports.AddText2Table(table, _contractNumber.ToString(), _normalFont);
                    PdfReports.AddText2Table(table, " ", _normalFont);
                    PdfReports.AddText2Table(table, _title, _titleFont, "center");
                    PdfReports.AddText2Table(table, " ", _normalFont);

                    PdfReports.AddTableNoSplit(document, this, table);

                    float[]   addrLayout = new float[] { 50F, 270F, 220F };
                    PdfPTable addrTable  = PdfReports.CreateTable(addrLayout, 0);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);

                    if (_pageNumber == 1)
                    {
                        PdfReports.AddText2Table(addrTable, _contractNumber.ToString(), _normalFont);

                        // Left column: Full Mailling Address
                        Paragraph p = PdfReports.GetAddressBlock(_busName, _address1, _address2,
                                                                 _csz, 0F, 12F, iTextSharp.text.Element.ALIGN_LEFT, _uspsFont);
                        PdfReports.AddText2Table(addrTable, p);

                        // Right column: shid / tax id
                        PdfReports.AddText2Table(addrTable, "Factory: " + _factoryNo, _normalFont, "right");
                    }
                    else
                    {
                        // Left column
                        PdfReports.AddText2Table(addrTable, _contractNumber.ToString(), _normalFont);
                        PdfReports.AddText2Table(addrTable, _busName, _normalFont);

                        // Right column
                        PdfReports.AddText2Table(addrTable, "Factory: " + _factoryNo, _normalFont, "right");
                    }
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);
                    PdfReports.AddText2Table(addrTable, " ", _normalFont, addrLayout.Length);

                    PdfReports.AddTableNoSplit(document, this, addrTable);

                    if (_hdrTableLayout != null)
                    {
                        PdfPTable hdrTab = PdfReports.CreateTable(_hdrTableLayout, 0);
                        PdfReports.FillHeaderLabels(ref hdrTab, _hdrNameList, _labelFont);
                        PdfReports.AddTableNoSplit(document, this, hdrTab);
                    }
                }

                _headerBottomYLine = _ct.YLine;
            }

            base.OnStartPage(writer, document);
        }
Пример #5
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (!_isDocumentClosing)
            {
                _pageNumber++;

                if (_pageNumber == 1)
                {
                    _template = _cb.CreateTemplate(PortraitPageSize.HdrUpperRightX - PortraitPageSize.HdrLowerLeftX, 50);
                }

                // ===========================================================================
                // Create header column -- in this report this is the page's column object
                // ===========================================================================
                _ct.SetSimpleColumn(PortraitPageSize.HdrLowerLeftX, PortraitPageSize.HdrLowerLeftY,
                                    PortraitPageSize.HdrUpperRightX, PortraitPageSize.HdrUpperRightY,
                                    PortraitPageSize.PgLeading, Element.ALIGN_TOP);
                _ct.YLine = PortraitPageSize.HdrTopYLine;

                // =======================================================
                // Add Payment Header
                // =======================================================
                float[]   layout = new float[] { 413F, 127F };
                PdfPTable table  = PdfReports.CreateTable(layout, 0);
                PdfReports.AddText2Table(table, _title + "\n" +
                                         _paymentDesc + " - " + _cropYear + " Crop " + (_statementDate.Length > 0 ? "- " : "") +
                                         _statementDate, titleFont, "center");

                if (_pageNumber == 1)
                {
                    PdfReports.AddImage2Table(table, _imgLogo);
                }
                else
                {
                    PdfReports.AddText2Table(table, " ", normalFont);
                }
                PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);
                PdfReports.AddTableNoSplit(document, this, table);

                float[] headerLayout = new float[] { 31.5F, 326.4F, 44.1F, 91.5F, 46.5F };
                table = PdfReports.CreateTable(headerLayout, 1);

                // Add blank lines
                float[]   shareholderLayout = new float[] { 50F, 270F, 220F };
                PdfPTable addrTable         = PdfReports.CreateTable(shareholderLayout, 0);
                PdfReports.AddText2Table(addrTable, " ", normalFont, addrTable.NumberOfColumns);
                PdfReports.AddText2Table(addrTable, " ", normalFont, addrTable.NumberOfColumns);
                PdfReports.AddText2Table(addrTable, " ", normalFont, addrTable.NumberOfColumns);

                if (_pageNumber == 1)
                {
                    string    csz = _city + ", " + _state + " " + _postalCode;
                    Paragraph p   = PdfReports.GetAddressBlock(_growerName, _adr1, _adr2,
                                                               csz, 0F, 12F, iTextSharp.text.Element.ALIGN_LEFT, uspsFont);
                    PdfReports.AddText2Table(addrTable, " ", uspsFont);
                    PdfReports.AddText2Table(addrTable, p);

                    PdfReports.AddText2Table(addrTable, "SHID: " + _shid + "\n" +
                                             "Amount: " + _checkAmount.ToString("N2"), uspsFont, "right");
                    PdfReports.AddText2Table(addrTable, " ", normalFont, addrTable.NumberOfColumns);
                    PdfReports.AddTableNoSplit(document, this, addrTable);

                    PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);
                    PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);

                    PdfReports.AddText2Table(table, " ", normalFont);
                    PdfReports.AddText2Table(table, "EH - Early Harvest", normalFont, table.NumberOfColumns - 1);

                    PdfReports.AddText2Table(table, " ", normalFont);
                    PdfReports.AddText2Table(table, "RH - Regular Harvest", normalFont, table.NumberOfColumns - 1);

                    PdfReports.AddText2Table(table, " ", normalFont);
                    PdfReports.AddText2Table(table, "SLM - Sugar Lost to Molasses", normalFont, table.NumberOfColumns - 1);

                    PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);
                }
                else
                {
                    PdfReports.AddText2Table(addrTable, " ", uspsFont);
                    PdfReports.AddText2Table(addrTable, _growerName, uspsFont);

                    PdfReports.AddText2Table(addrTable, "SHID: " + _shid + "\n" +
                                             "Amount: " + _checkAmount.ToString("N2"), uspsFont, "right");
                    PdfReports.AddText2Table(addrTable, " ", normalFont, addrTable.NumberOfColumns);
                    PdfReports.AddTableNoSplit(document, this, addrTable);

                    PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);
                    PdfReports.AddText2Table(table, " ", normalFont, table.NumberOfColumns);
                }

                PdfReports.AddTableNoSplit(document, this, table);

                if (_hdrTableLayout != null)
                {
                    PdfPTable hdrTab = PdfReports.CreateTable(_hdrTableLayout, 0);
                    PdfReports.FillHeaderLabels(ref hdrTab, _hdrNameList, labelFont);
                    PdfReports.AddTableNoSplit(document, this, hdrTab);
                }

                _headerBottomYLine = _ct.YLine;
            }

            base.OnStartPage(writer, document);
        }