public void BuildContractDumpHeader(Document document, float[] layout)
        {
            PdfPTable table = PdfReports.CreateTable(layout, 0);

            //--------------------------------
            // HEADER
            //--------------------------------
            Color borderColor   = Color.BLACK;  //new Color(255, 0, 0);
            float borderWidth   = 1.0F;
            int   borderTypeAll = Rectangle.TOP_BORDER | Rectangle.RIGHT_BORDER | Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;
            float fPadding      = 2;

            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Cnt #", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                                        fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Station", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Field Desc.", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Landowner", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Final Net Tons", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Tons / Acre", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Sugar %", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Tare %", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("SLM %", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Lbs Ext. Sugar / Ton", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("Plant Pop", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                           fPadding, borderWidth, borderTypeAll, borderColor);
            table.AddCell(cell);

            PdfReports.AddTableNoSplit(document, this, table);
        }
Exemple #2
0
        private void AddPatronStockHeader(ref PdfPTable table)
        {
            table = PdfReports.CreateTable(_patronStockLayout, 0);

            iTextSharp.text.pdf.PdfPCell cell =
                PdfReports.AddText2Cell("Patron Preferred Stock", _labelFont, "left", _patronStockLayout.Length);
            cell.BackgroundColor = Color.LIGHT_GRAY;
            table.AddCell(cell);
        }
Exemple #3
0
        private void FinishFinancingData(PdfWriter writer, Document document, ref PdfPTable table, EQStmtEvent pgEvent)
        {
            PdfReports.AddText2Table(table, " ", _normalFont, _equityFinancingLayout.Length);

            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Total", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell(" ", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            if (_financingPaid < 0)
            {
                cell = PdfReports.AddText2Cell("($" + Math.Abs(_financingPaid).ToString("#,##0.00") + ")", _labelFont, "right");
            }
            else
            {
                cell = PdfReports.AddText2Cell("$" + _financingPaid.ToString("#,##0.00"), _labelFont, "right");
            }
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            if (_financingInterest < 0)
            {
                cell = PdfReports.AddText2Cell("($" + Math.Abs(_financingInterest).ToString("#,##0.00") + ")", _labelFont, "right");
            }
            else
            {
                cell = PdfReports.AddText2Cell("$" + _financingInterest.ToString("#,##0.00"), _labelFont, "right");
            }
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            if (_financingBalance < 0)
            {
                cell = PdfReports.AddText2Cell("($" + Math.Abs(_financingBalance).ToString("#,##0.00") + ")", _labelFont, "right");
            }
            else
            {
                cell = PdfReports.AddText2Cell("$" + _financingBalance.ToString("#,##0.00"), _labelFont, "right");
            }
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, " ", _normalFont, 2);

            PdfReports.AddText2Table(table, " ", _normalFont, _equityFinancingLayout.Length);
            PdfReports.AddTableNoSplit(document, pgEvent, table);
            table = null;
        }
Exemple #4
0
        private void AddCommonHeader(ref PdfPTable table)
        {
            table = PdfReports.CreateTable(_commonStockLayout, 0);
            iTextSharp.text.pdf.PdfPCell cell =
                PdfReports.AddText2Cell("Common Stock Purchase", _labelFont, "left", _commonStockLayout.Length);
            cell.BackgroundColor = Color.LIGHT_GRAY;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, " ", _normalFont);
            PdfReports.AddText2Table(table, "Shares", _labelFont, "center");
            PdfReports.AddText2Table(table, "Date", _labelFont, "center");
            PdfReports.AddText2Table(table, "Price", _labelFont, "center");
            PdfReports.AddText2Table(table, "Value", _labelFont, "center");
            PdfReports.AddText2Table(table, " ", _normalFont);
        }
Exemple #5
0
        private void FinishPatronStockData(PdfWriter writer, Document document, ref PdfPTable table, EQStmtEvent pgEvent)
        {
            PdfReports.AddText2Table(table, " ", _normalFont, _patronStockLayout.Length);

            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Total Shares Owned", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell(_patronStockShares.ToString("#,##0"), _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, " ", _normalFont, _patronStockLayout.Length - 2);
            PdfReports.AddText2Table(table, " ", _normalFont, _patronStockLayout.Length);
            PdfReports.AddTableNoSplit(document, pgEvent, table);
            table = null;
        }
Exemple #6
0
        private void AddFinancingHeader(ref PdfPTable table)
        {
            table = PdfReports.CreateTable(_equityFinancingLayout, 0);

            iTextSharp.text.pdf.PdfPCell cell =
                PdfReports.AddText2Cell("Equity Financing", _labelFont, "left", _equityFinancingLayout.Length);
            cell.BackgroundColor = Color.LIGHT_GRAY;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, " ", _normalFont);
            PdfReports.AddText2Table(table, "Date", _labelFont, "center");
            PdfReports.AddText2Table(table, "Principal Paid", _labelFont, "center");
            PdfReports.AddText2Table(table, "Interest", _labelFont, "center");
            PdfReports.AddText2Table(table, "Balance", _labelFont, "center");
            PdfReports.AddText2Table(table, " ", _normalFont);
            PdfReports.AddText2Table(table, " ", _normalFont);
        }
Exemple #7
0
        private void AddUnitRetainHeader(ref PdfPTable table)
        {
            table = PdfReports.CreateTable(_unitRetainsLayout, 0);

            iTextSharp.text.pdf.PdfPCell cell =
                PdfReports.AddText2Cell("Unit Retains", _labelFont, "left", _unitRetainsLayout.Length);
            cell.BackgroundColor = Color.LIGHT_GRAY;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, "Crop Year", _labelFont, "center");
            PdfReports.AddText2Table(table, "Date", _labelFont, "center");
            PdfReports.AddText2Table(table, "Tons Delivered", _labelFont, "center");
            PdfReports.AddText2Table(table, "$/Ton", _labelFont, "center");
            PdfReports.AddText2Table(table, "Amount", _labelFont, "center");
            PdfReports.AddText2Table(table, "$ Paid", _labelFont, "center");
            PdfReports.AddText2Table(table, "Balance", _labelFont, "center");
            PdfReports.AddText2Table(table, " ", _normalFont);
        }
Exemple #8
0
        private void AddPatronageRefundHeader(ref PdfPTable table)
        {
            table = PdfReports.CreateTable(_patronageRefundLayout, 0);

            iTextSharp.text.pdf.PdfPCell cell =
                PdfReports.AddText2Cell("Patronage Refunds", _labelFont, "left", _patronageRefundLayout.Length);
            cell.BackgroundColor = Color.LIGHT_GRAY;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, "Crop Year", _labelFont, "center");
            PdfReports.AddText2Table(table, "Date", _labelFont, "center");
            PdfReports.AddText2Table(table, "Tons Delivered", _labelFont, "center");
            PdfReports.AddText2Table(table, "$/Ton", _labelFont, "center");
            PdfReports.AddText2Table(table, "Amount", _labelFont, "center");
            PdfReports.AddText2Table(table, "Initial Pay", _labelFont, "center");
            PdfReports.AddText2Table(table, "Crop Loss Allocation/Pmt", _labelFont, "center");
            PdfReports.AddText2Table(table, "Certificate Paid", _labelFont, "center");
            PdfReports.AddText2Table(table, "Balance", _labelFont, "center");
        }
Exemple #9
0
        private void FinishUnitRetainData(PdfWriter writer, Document document, ref PdfPTable table, EQStmtEvent pgEvent)
        {
            PdfReports.AddText2Table(table, " ", _normalFont, _unitRetainsLayout.Length);

            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Total", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Date
            cell = PdfReports.AddText2Cell(" ", _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell(_unitRetainTons.ToString("#,##0.0000"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell(" ", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("$" + _unitRetainAmount.ToString("#,##0.00"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("$" + _unitRetainPaid.ToString("#,##0.00"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell("$" + _unitRetainBalance.ToString("#,##0.00"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            cell = PdfReports.AddText2Cell(" ", _labelFont, "right");
            table.AddCell(cell);

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

            PdfReports.AddTableNoSplit(document, pgEvent, table);
            table = null;
        }
        private static void ReportBuilder(int cropYear, ArrayList shidList, string busName, ArrayList growerPerformanceList, ArrayList regionCodeList, ArrayList areaCodeList,
                                          ArrayList regionNameList, ArrayList areaNameList, string logoUrl, string filePath, System.IO.FileStream fs)
        {
            const string METHOD_NAME = "ReportBuilder: ";
            const string CharBlank   = " ";
            const string CharAffirm  = "X";

            Document  document = null;
            PdfWriter writer   = null;
            PdfPTable table    = null;
            ShareholderSummaryEvent pgEvent = null;

            iTextSharp.text.Image imgLogo = null;

            int    iShid               = 0;
            string areaCode            = "";
            string regionCode          = "";
            string regionName          = "";
            string areaName            = "";
            int    growerPerformanceID = 0;

            string rptTitle = "Western Sugar Cooperative\nShareholder Summary for " + cropYear.ToString() + " Crop Year";

            string okFertility  = "";
            string okIrrigation = "";
            string okStand      = "";
            string okWeed       = "";
            string okDisease    = "";
            string okVariety    = "";

            string descFertility  = "";
            string descIrrigation = "";
            string descStand      = "";
            string descWeed       = "";
            string descDisease    = "";
            string descVariety    = "";

            // Build the contract information.
            try {
                for (int j = 0; j < shidList.Count; j++)
                {
                    string shid = shidList[j].ToString();
                    iShid = Convert.ToInt32(shid);

                    if (growerPerformanceList.Count == 0)
                    {
                        busName = "";
                        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                            using (SqlDataReader dr = WSCField.SharholderSummaryGetAreas(conn, cropYear, iShid)) {
                                while (dr.Read())
                                {
                                    growerPerformanceList.Add(dr["GrowerPerformanceID"].ToString());
                                    regionCodeList.Add(dr["RegionCode"].ToString());
                                    areaCodeList.Add(dr["AreaCode"].ToString());
                                    regionNameList.Add(dr["RegionName"].ToString());
                                    areaNameList.Add(dr["AreaName"].ToString());
                                    if (busName.Length == 0)
                                    {
                                        busName = dr["BusName"].ToString();
                                    }
                                }
                            }
                        }
                    }

                    // ---------------------------------------------------------------------------------------------------------
                    // Given all of the pieces, crop year, shid, growerPerformanceID, region, and area, generate the report
                    // ---------------------------------------------------------------------------------------------------------
                    if (areaCodeList.Count > 0)
                    {
                        for (int i = 0; i < areaCodeList.Count; i++)
                        {
                            growerPerformanceID = Convert.ToInt32(growerPerformanceList[i]);
                            regionCode          = regionCodeList[i].ToString();
                            areaCode            = areaCodeList[i].ToString();
                            regionName          = regionNameList[i].ToString();
                            areaName            = areaNameList[i].ToString();

                            // ------------------------------------------------
                            // Collect the data: Get the report card.
                            // ------------------------------------------------
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                                using (SqlDataReader dr = WSCField.GrowerAdviceGetBySHID(conn, growerPerformanceID)) {
                                    if (dr.Read())
                                    {
                                        //busName = dr["gadBusinessName"].ToString();
                                        okFertility  = dr["gadGoodFertilityManagement"].ToString();
                                        okIrrigation = dr["gadGoodIrrigationManagement"].ToString();
                                        okStand      = dr["gadGoodStandEstablishment"].ToString();
                                        okWeed       = dr["gadGoodWeedControl"].ToString();
                                        okDisease    = dr["gadGoodDiseaseControl"].ToString();
                                        okVariety    = dr["gadGoodVarietySelection"].ToString();

                                        descFertility  = dr["gadTextFertilityManagement"].ToString();
                                        descIrrigation = dr["gadTextIrrigationManagement"].ToString();
                                        descStand      = dr["gadTextStandEstablishment"].ToString();
                                        descWeed       = dr["gadTextWeedControl"].ToString();
                                        descDisease    = dr["gadTextDiseaseControl"].ToString();
                                        descVariety    = dr["gadTextVarietySelection"].ToString();
                                    }
                                    else
                                    {
                                        //busName = "";
                                        okFertility  = "";
                                        okIrrigation = "";
                                        okStand      = "";
                                        okWeed       = "";
                                        okDisease    = "";
                                        okVariety    = "";

                                        descFertility  = "";
                                        descIrrigation = "";
                                        descStand      = "";
                                        descWeed       = "";
                                        descDisease    = "";
                                        descVariety    = "";
                                    }
                                }
                            }

                            if (document == null)
                            {
                                // IF YOU CHANGE MARGINS, CHANGE YOUR TABLE LAYOUTS !!!
                                //  ***  US LETTER: 612 X 792  ***
                                //document = new Document(iTextSharp.text.PageSize.LETTER, 36, 36, 54, 72);
                                document = new Document(PortraitPageSize.PgPageSize, PortraitPageSize.PgLeftMargin,
                                                        PortraitPageSize.PgRightMargin, PortraitPageSize.PgTopMargin, PortraitPageSize.PgBottomMargin);

                                // we create a writer that listens to the document
                                // and directs a PDF-stream to a file
                                writer = PdfWriter.GetInstance(document, fs);

                                imgLogo = PdfReports.GetImage(logoUrl, 127, 50, iTextSharp.text.Element.ALIGN_CENTER);

                                // Attach my override event handler(s)
                                //busName = dr["Business Name"].ToString();
                                pgEvent = new ShareholderSummaryEvent();
                                pgEvent.FillEvent(cropYear, shid, busName, rptTitle, regionName, areaName, imgLogo);

                                writer.PageEvent = pgEvent;

                                // Open the document
                                document.Open();
                            }
                            else
                            {
                                // everytime thru kick out a new page because we're on a different shid/region/area combination.
                                pgEvent.FillEvent(cropYear, shid, busName, rptTitle, regionName, areaName, imgLogo);
                                document.NewPage();
                            }

                            // -----------------------------------------------------
                            // Create the report card
                            // -----------------------------------------------------
                            table = PdfReports.CreateTable(_adviceTableLayout, 1);

                            Color borderColor   = Color.BLACK;  //new Color(255, 0, 0);
                            float borderWidth   = 1.0F;
                            int   borderTypeAll = Rectangle.TOP_BORDER | Rectangle.RIGHT_BORDER | Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;
                            float fPadding      = 3;

                            // HEADER
                            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Okay", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                                                        fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Opportunity\nfor\nImprovement", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Big Six Growing Practices", _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            /// ----------------------------------------
                            // TBODY
                            /// ----------------------------------------
                            // Fertility
                            cell = PdfReports.AddText2Cell((okFertility == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okFertility == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Fertility Management", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            // Irrigation
                            cell = PdfReports.AddText2Cell((okIrrigation == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okIrrigation == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Irrigation Water Management", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            // Stand
                            cell = PdfReports.AddText2Cell((okStand == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okStand == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Stand Establishment (Harvest Plant Population)", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            // Weed
                            cell = PdfReports.AddText2Cell((okWeed == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okWeed == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Weed Control", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            // Disease
                            cell = PdfReports.AddText2Cell((okDisease == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okDisease == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Disease & Insect Control", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            // Varitey
                            cell = PdfReports.AddText2Cell((okVariety == "Y" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell((okVariety == "N" ? CharAffirm : CharBlank), _labelFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            cell = PdfReports.AddText2Cell("Proper Variety Selection", _labelFont, PdfPCell.ALIGN_LEFT, PdfPCell.ALIGN_BOTTOM,
                                                           fPadding, borderWidth, borderTypeAll, borderColor);
                            table.AddCell(cell);

                            PdfReports.AddText2Table(table, " ", _normalFont, 3);

                            PdfReports.AddTableNoSplit(document, pgEvent, table);

                            // ==========================================================
                            // Recommendations for Improvement.
                            // ==========================================================
                            table = PdfReports.CreateTable(_adviceTableLayout, 1);

                            // Caption
                            iTextSharp.text.Phrase phrase = new iTextSharp.text.Phrase("Recommendations for Improvement", _labelFont);
                            cell         = new iTextSharp.text.pdf.PdfPCell(phrase);
                            cell.Colspan = 3;

                            cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                            cell.VerticalAlignment   = PdfPCell.ALIGN_BOTTOM;
                            cell.Padding             = fPadding;
                            cell.BorderWidth         = borderWidth;
                            cell.Border      = Rectangle.TOP_BORDER | Rectangle.RIGHT_BORDER | Rectangle.LEFT_BORDER;
                            cell.BorderColor = borderColor;
                            table.AddCell(cell);

                            // Content
                            phrase = new iTextSharp.text.Phrase((descFertility.Length > 0 ? descFertility + "\n\n" : "") +
                                                                (descIrrigation.Length > 0 ? descIrrigation + "\n\n" : "") +
                                                                (descStand.Length > 0 ? descStand + "\n\n" : "") +
                                                                (descWeed.Length > 0 ? descWeed + "\n\n" : "") +
                                                                (descDisease.Length > 0 ? descDisease + "\n\n" : "") +
                                                                (descVariety.Length > 0 ? descVariety + "\n\n" : ""), _normalFont);

                            cell         = new iTextSharp.text.pdf.PdfPCell(phrase);
                            cell.Colspan = 3;

                            cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                            cell.VerticalAlignment   = PdfPCell.ALIGN_BOTTOM;
                            cell.Padding             = fPadding;
                            cell.BorderWidth         = borderWidth;
                            cell.Border      = Rectangle.RIGHT_BORDER | Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;
                            cell.BorderColor = borderColor;
                            table.AddCell(cell);

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

                            PdfReports.AddTableNoSplit(document, pgEvent, table);

                            // ------------------------------------------------
                            // Create the contract dump.
                            // ------------------------------------------------
                            ArrayList cntPerfs;
                            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BeetConn"].ToString())) {
                                cntPerfs = WSCField.ShareholderSummaryContracts(conn, iShid, cropYear, regionCode, areaCode);
                            }

                            // =======================================
                            // HEADER
                            // =======================================
                            table = PdfReports.CreateTable(_contractTableLayout, 0);
                            pgEvent.BuildContractDumpHeader(document, _contractTableLayout);
                            pgEvent.ContractTableLayout = _contractTableLayout;

                            // DATA
                            for (int k = 0; k < cntPerfs.Count; k++)
                            {
                                ContractPerformanceState perf = (ContractPerformanceState)cntPerfs[k];

                                switch (perf.RowType)
                                {
                                case 1:

                                    table = PdfReports.CreateTable(_contractTableLayout, 0);

                                    PdfReports.AddText2Table(table, perf.ContractNumber, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.ContractStation, _normalFont);
                                    PdfReports.AddText2Table(table, perf.FieldDescription, _normalFont);
                                    PdfReports.AddText2Table(table, perf.LandownerName, _normalFont);
                                    PdfReports.AddText2Table(table, perf.HarvestFinalNetTons, _normalFont, "right");
                                    PdfReports.AddText2Table(table, perf.TonsPerAcre, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSugarPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestTarePct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSLMPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestExtractableSugar, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.BeetsPerAcre, _normalFont, "center");

                                    PdfReports.AddTableNoSplit(document, pgEvent, table);

                                    break;

                                case 2:

                                    table = PdfReports.CreateTable(_contractTableLayout, 0);

                                    PdfReports.AddText2Table(table, " ", _normalFont, _contractTableLayout.Length);
                                    PdfReports.AddText2Table(table, " ", _normalFont);
                                    PdfReports.AddText2Table(table, "Overall Average", _labelFont, 3);
                                    PdfReports.AddText2Table(table, perf.HarvestFinalNetTons, _normalFont, "right");
                                    PdfReports.AddText2Table(table, perf.TonsPerAcre, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSugarPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestTarePct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSLMPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestExtractableSugar, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.BeetsPerAcre, _normalFont, "center");

                                    break;

                                case 3:

                                    PdfReports.AddText2Table(table, " ", _normalFont);
                                    PdfReports.AddText2Table(table, "Top 20% Area Average", _labelFont, 4);
                                    PdfReports.AddText2Table(table, perf.TonsPerAcre, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSugarPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestTarePct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSLMPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestExtractableSugar, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.BeetsPerAcre, _normalFont, "center");

                                    break;

                                case 4:

                                    PdfReports.AddText2Table(table, " ", _normalFont);
                                    PdfReports.AddText2Table(table, "Your Rankings", _labelFont, 10);

                                    PdfReports.AddText2Table(table, " ", _normalFont);
                                    PdfReports.AddText2Table(table, areaName, _labelFont, 4);
                                    PdfReports.AddText2Table(table, perf.TonsPerAcre, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSugarPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestTarePct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSLMPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestExtractableSugar, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.BeetsPerAcre, _normalFont, "center");

                                    break;

                                case 5:

                                    PdfReports.AddText2Table(table, " ", _normalFont);
                                    PdfReports.AddText2Table(table, regionName, _labelFont, 4);
                                    PdfReports.AddText2Table(table, perf.TonsPerAcre, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSugarPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestTarePct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestSLMPct, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.HarvestExtractableSugar, _normalFont, "center");
                                    PdfReports.AddText2Table(table, perf.BeetsPerAcre, _normalFont, "center");

                                    PdfReports.AddTableNoSplit(document, pgEvent, table);

                                    break;
                                }
                            }

                            pgEvent.ContractTableLayout = null;
                        }
                    }

                    // --------------------------------------------
                    // --------  reset for next iteration  --------
                    // --------------------------------------------
                    growerPerformanceList.Clear();
                    regionCodeList.Clear();
                    areaCodeList.Clear();
                    regionNameList.Clear();
                    areaNameList.Clear();
                }

                // ======================================================
                // Close document
                // ======================================================
                if (document != null)
                {
                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                    document = null;
                }
                if (writer == null)
                {
                    // Warn that we have no data.
                    WSCIEMP.Common.CWarning warn = new WSCIEMP.Common.CWarning("No records matched your report criteria.");
                    throw (warn);
                }
            }
            catch (Exception ex) {
                string errMsg = "document is null: " + (document == null).ToString() + "; " +
                                "writer is null: " + (writer == null).ToString();
                WSCIEMP.Common.CException wscex = new WSCIEMP.Common.CException(MOD_NAME + METHOD_NAME + errMsg, ex);
                throw (wscex);
            }
            finally {
                if (document != null)
                {
                    pgEvent.IsDocumentClosing = true;
                    document.Close();
                }
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }
Exemple #11
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            int borderTypeAll = Rectangle.TOP_BORDER | Rectangle.RIGHT_BORDER | Rectangle.BOTTOM_BORDER | Rectangle.LEFT_BORDER;

            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 Header
                // =======================================================
                float[]   layout = new float[] { 320F, 180F, 40F };
                PdfPTable table  = PdfReports.CreateTable(layout, 0);

                PdfReports.AddText2Table(table, _title + "\n", _titleFont, "center", layout.Length);
                PdfReports.AddText2Table(table, " ", _normalFont, layout.Length);
                //PdfReports.AddText2Table(table, " ", _normalFont, layout.Length);

                PdfReports.AddText2Table(table, _statementDate, _normalFont, "left");

                //PdfReports.AddText2Table(table, " ", _normalFont);
                iTextSharp.text.pdf.PdfPCell cell =
                    PdfReports.AddText2Cell("URGENT TAX\n"
                                            + "NOTIFICATION",
                                            _superTitleFont, PdfPCell.ALIGN_CENTER, PdfPCell.ALIGN_BOTTOM,
                                            3F, 1.0F, borderTypeAll, Color.BLACK);
                table.AddCell(cell);
                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, " ", _superTitleFont, layout.Length);                   // larger font to push address line down

                PdfReports.AddTableNoSplit(document, this, table);

                // Address
                string    csz = _city + ", " + _state + " " + _postalCode;
                Paragraph p   = PdfReports.GetAddressBlock(_memberName, _adr1, _adr2,
                                                           csz, 0F, 12F, iTextSharp.text.Element.ALIGN_LEFT, _uspsFont);

                float[] addrLayout = new float[] { 50F, 270F, 220F };
                table = PdfReports.CreateTable(addrLayout, 0);

                PdfReports.AddText2Table(table, " ", _normalFont);
                PdfReports.AddText2Table(table, p);
                PdfReports.AddText2Table(table, " ", _normalFont);

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

                PdfReports.AddTableNoSplit(document, this, table);
                _headerBottomYLine = _ct.YLine;
            }

            base.OnStartPage(writer, document);
        }
Exemple #12
0
        private void FinishPatronageRefundData(PdfWriter writer, Document document, ref PdfPTable table, EQStmtEvent pgEvent)
        {
            PdfReports.AddText2Table(table, " ", _normalFont, _patronageRefundLayout.Length);

            // Crop Year
            iTextSharp.text.pdf.PdfPCell cell = PdfReports.AddText2Cell("Total", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Date
            cell = PdfReports.AddText2Cell(" ", _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Tons
            cell = PdfReports.AddText2Cell(_patronageRefundTons.ToString("#,##0.0000"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Rate
            cell = PdfReports.AddText2Cell(" ", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Amount
            if (_patronageRefundAmount < 0)
            {
                cell = PdfReports.AddText2Cell("($" + Math.Abs(_patronageRefundAmount).ToString("#,##0.00") + ")", _labelFont, "right");
            }
            else
            {
                cell = PdfReports.AddText2Cell("$" + _patronageRefundAmount.ToString("#,##0.00"), _labelFont, "right");
            }
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Initial Paid
            cell = PdfReports.AddText2Cell("$" + _patronageRefundInitialPaid.ToString("#,##0.00"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Loss Alloc
            cell = PdfReports.AddText2Cell(" ", _labelFont, "center");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // Certificate Paid
            cell = PdfReports.AddText2Cell("$" + _patronageCertificatePaid.ToString("#,##0.00"), _labelFont, "right");
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            // New Balance
            if (_patronageRefundNewBalance < 0)
            {
                cell = PdfReports.AddText2Cell("($" + Math.Abs(_patronageRefundNewBalance).ToString("#,##0.00") + ")", _labelFont, "right");
            }
            else
            {
                cell = PdfReports.AddText2Cell("$" + _patronageRefundNewBalance.ToString("#,##0.00"), _labelFont, "right");
            }
            cell.BackgroundColor = cell.BackgroundColor = Color_Highlight;
            table.AddCell(cell);

            PdfReports.AddText2Table(table, " ", _normalFont, _patronageRefundLayout.Length);
            PdfReports.AddTableNoSplit(document, pgEvent, table);
            table = null;
        }