コード例 #1
0
ファイル: estimateReport.cs プロジェクト: nonenane/hardware
        /// <summary>
        /// Таблица
        /// </summary>
        /// <param name="report">Отчет</param>
        /// <param name="id">id Сметы</param>
        /// <returns>Отчет</returns>
        ExcelUnLoad addTable(ExcelUnLoad report, int id)
        {
            int row = 8;

            DataTable dtTable = readSQL.getContentEstimate(id);

            dtTable.Select("Purchase = 0 or Purchase = 1");

            dtTable.Columns.Remove("isSelect");
            dtTable.Columns.Remove("id_ComponentsHardware");
            dtTable.Columns.Remove("TypeComponentsHardware");
            dtTable.Columns.Remove("Link");
            dtTable.Columns.Remove("Description");
            dtTable.Columns.Remove("isLink");
            dtTable.Columns.Remove("id");
            dtTable.Columns.Remove("Status");
            dtTable.Columns.Remove("nameStatus");
            dtTable.Columns.Remove("nameStatusConfirm");
            dtTable.Columns.Remove("StatusConfirmation");
            dtTable.Columns.Remove("Purchase");
            dtTable.Columns.Remove("namePurchase");
            dtTable.Columns.Remove("Delivery");
            dtTable.Columns.Remove("id_component_link");
            dtTable.Columns.Remove("sort");
            dtTable.Columns.Remove("pos");
            dtTable.Columns.Remove("nameTypeLinkView");
            dtTable.Columns.Remove("StatusBuild");

            dtTable.Columns["row"].SetOrdinal(0);
            dtTable.Columns["nameType"].SetOrdinal(1);
            dtTable.Columns["cName"].SetOrdinal(2);
            dtTable.Columns["Count"].SetOrdinal(3);
            dtTable.Columns["Price"].SetOrdinal(4);
            dtTable.Columns["summa"].SetOrdinal(5);
            dtTable.Columns["Comments"].SetOrdinal(6);

            int count = dtTable.Rows.Count;

            report.AddMultiValue(dtTable, row, 1);

            report.SetBorders(row, 1, row + count - 1, 7);
            report.SetCellAlignmentToCenter(row, 1, row + count - 1, 1);
            report.SetCellAlignmentToRight(row, 4, row + count - 1, 6);

            row      += count;
            posFooter = row;

            return(report);
        }
コード例 #2
0
        /// <summary>
        /// Таблица
        /// </summary>
        /// <param name="report">Отчет</param>
        /// <param name="id">id Сметы</param>
        /// <param name="date">Дата выдачи денежных средств</param>
        /// <returns>Отчет</returns>
        ExcelUnLoad addTable(ExcelUnLoad report, int id, DateTime date)
        {
            int row = 4;

            DataTable dtTable = readSQL.getContentEstimate(id);

            dtTable.Select("Status = 1");

            dtTable.Columns.Remove("isSelect");
            dtTable.Columns.Remove("id_ComponentsHardware");
            dtTable.Columns.Remove("TypeComponentsHardware");
            dtTable.Columns.Remove("Link");
            dtTable.Columns.Remove("Description");
            dtTable.Columns.Remove("isLink");
            dtTable.Columns.Remove("id");
            dtTable.Columns.Remove("Status");
            dtTable.Columns.Remove("nameStatus");
            dtTable.Columns.Remove("nameStatusConfirm");
            dtTable.Columns.Remove("StatusConfirmation");
            dtTable.Columns.Remove("Purchase");
            dtTable.Columns.Remove("namePurchase");
            dtTable.Columns.Remove("Delivery");
            dtTable.Columns.Remove("id_component_link");
            dtTable.Columns.Remove("sort");
            dtTable.Columns.Remove("pos");
            dtTable.Columns.Remove("nameTypeLinkView");
            dtTable.Columns.Remove("StatusBuild");
            dtTable.Columns.Remove("Comments");

            DataColumn dc = new DataColumn();

            dc.ColumnName   = "dateEdit";
            dc.DataType     = typeof(String);
            dc.DefaultValue = date.ToShortDateString();
            dtTable.Columns.Add(dc);

            dtTable.Columns["row"].SetOrdinal(0);
            dtTable.Columns["nameType"].SetOrdinal(1);
            dtTable.Columns["cName"].SetOrdinal(2);
            dtTable.Columns["Count"].SetOrdinal(3);
            dtTable.Columns["Price"].SetOrdinal(4);
            dtTable.Columns["summa"].SetOrdinal(5);
            dtTable.Columns["dateEdit"].SetOrdinal(6);

            int count = dtTable.Rows.Count;

            for (int i = row; i < row + count; i++)
            {
                report.Merge(i, 5, i, 6);
            }

            report.AddMultiValue(dtTable, row, 1);

            report.SetBorders(row, 1, row + count - 1, 7);
            report.SetCellAlignmentToCenter(row, 1, row + count - 1, 1);
            report.SetCellAlignmentToRight(row, 4, row + count - 1, 7);
            report.SetCellAlignmentToJustify(row, 3, row + count - 1, 3);
            report.SetWrapText(row, 3, row + count - 1, 3);

            amount = Convert.ToDecimal(dtTable.Compute("sum(summa)", "").ToString());

            row      += count;
            posFooter = row;

            return(report);
        }