• 解决报表表头格式问题


      private void CreateReportTable(string tableName)
            {
                StringBuilder SB = new StringBuilder();
                SB.AppendFormat("/*dialect*/ CREATE TABLE {0}
     ", tableName);
                SB.AppendFormat(" (
     ");
                SB.AppendFormat("    FANALYSISID        NUMBER (10) NOT NULL,
     ");
                SB.AppendFormat("    FANOTHERANALYSISID NUMBER (10) DEFAULT 0,
     ");
                SB.AppendFormat("    FSALORDERDIMEID    NUMBER (10) NOT NULL,
     ");
                SB.AppendFormat("    FYEARPERIOD        VARCHAR2 (43 BYTE),
     ");
                SB.AppendFormat("    FWORKSHOP          NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FWORKSHOPID        NUMBER (10) DEFAULT 0,
     ");
                SB.AppendFormat("    FSALEORG           NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSALEGROUP         NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSALORDERBILLNO    VARCHAR2 (255 BYTE),
     ");
                SB.AppendFormat("    FSALORDERSEQ       NUMBER (10),
     ");
                SB.AppendFormat("    FPRDTRACKNO        NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FCUSTOMER          NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FINVOICECUSTOMER   NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSHIRTORDNO        NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FMTONO             NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FPRODUCTNUMBER     NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FCLOTHINGSERIES    NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSLEEVETYPE        NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FMALEORFEMALE      NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FMATERIALSOURCE    NVARCHAR2 (255),
    ");
                SB.AppendFormat("    FFABRICSOURCE      NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FCLOTHINGCONTENTS  NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSPECIALART        NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FPROCESSMETHOD     NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FFABRICFLOWERCOLOR NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FSALEDIRECT        NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FWORKSHOPOUTQTY    NUMBER (10),
     ");
                SB.AppendFormat("    FWORKSHOPCUROUTQTY NUMBER (10),
     ");
                SB.AppendFormat("    FCURROUTSTOCKQTY   NUMBER (10),
     ");
                SB.AppendFormat("    FSALEAMOUNT        NUMBER (23,10),
     ");
                SB.AppendFormat("    FORDERCOST         NUMBER (23,10),
     ");
                SB.AppendFormat("    FFABRCIID          NUMBER(10) DEFAULT 0,
     ");
                SB.AppendFormat("    FINSTOCKDAYS       NUMBER (23,10) DEFAULT 0,
     ");
                SB.AppendFormat("    FINSTOCKDATE       NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FCONTRACTDELIVERYTIME NVARCHAR2 (255),
     ");
                SB.AppendFormat("    FREALDELIVERYTIME     NVARCHAR2 (255),
     ");
    
                SB.AppendFormat("    FCONTRACTFABRICPRICE  NUMBER (23,10),
     ");
                SB.AppendFormat("    FCONTRACTCONSUMPT     NUMBER (23,10),
     ");
                SB.AppendFormat("    FCONTRACTFABRICQTY    NUMBER (23,10),
     ");
                SB.AppendFormat("    FMLINCOME          NUMBER (23,10),
     ");
                SB.AppendFormat("    FFLINCOME          NUMBER (23,10),
     ");
                SB.AppendFormat("    FJGFINCOME         NUMBER (23,10),
     ");
                SB.AppendFormat("    FSYMLINCOME        NUMBER (23,10),
     ");
    
                SB.AppendFormat("    FREALFABRICPRICE   NUMBER (23,10),
     ");
                SB.AppendFormat("    FREALCONSUMPT      NUMBER (23,10),
     ");
                SB.AppendFormat("    FREALFABRICQTY     NUMBER (23,10),
     ");
                SB.AppendFormat("    FREALFABRICAMOUNT  NUMBER (23,10),
     ");
                SB.AppendFormat("    FSELFCONSUMPT      NUMBER (23,10),
     ");
                SB.AppendFormat("    FREFERRINGFACTOR   NUMBER (23,10),
     ");
                SB.AppendFormat("    FSTANDARDCOST      NUMBER (23,10),
     ");
    
                SB.AppendFormat("    FMLCOST            NUMBER (23,10),
     ");
                SB.AppendFormat("    FFLCOST            NUMBER (23,10),
     ");
                SB.AppendFormat("    FJGFCOST           NUMBER (23,10),
     ");
                SB.AppendFormat("    FSYMLCOST          NUMBER (23,10),
     ");
    
                var ParentColumnNumber = this.DynamicColumn.Select(o => o.ParentNumber).ToList().Distinct();
                foreach (var colNumber in ParentColumnNumber)
                {
                    string ParentColumnName = this.DynamicColumn.Where(p => p.ParentNumber == colNumber).Select(o => o.ParentName).FirstOrDefault();
                    if (ParentColumnName == null || ParentColumnName == "") continue;
                    var Columns = this.DynamicColumn.Where(o => o.ParentNumber == colNumber).OrderBy(p => p.Number);
                    foreach (var col in Columns)
                    {
                        SB.AppendFormat("    {0}   NUMBER(23,10),
     ", col.Number);
                    }
                    //if (Columns.Count() > 1)
                    //{
                    SB.AppendFormat("    {0}   NUMBER(23,10) DEFAULT 0,
     ", colNumber);
                    //}
                }
    
                SB.AppendFormat("    FMLPROFIT      NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FFLPROFIT      NUMBER(23,10)  DEFAULT 0,
     ");
                SB.AppendFormat("    FJGFPROFIT     NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FSYMLPROFIT    NUMBER(23,10)  DEFAULT 0,
     ");
                SB.AppendFormat("    FORDERPROFIT   NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FORDERUNITPROFIT   NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FANOTHERPROFIT     NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FANOTHERUNITPROFIT NUMBER(23,10)   DEFAULT 0,
     ");
                SB.AppendFormat("    FREMARKS       NVARCHAR2 (255),
    ");
                SB.AppendFormat("    FIDENTITYID    NUMBER(10)   DEFAULT 0
     ");
                SB.AppendFormat(" )
     ");
                DBUtils.Execute(this.Context, SB.ToString());
            }
    
                var ParentColumnNumber = this.DynamicColumn.Select(o => o.ParentNumber).ToList().Distinct();
                foreach (var colNumber in ParentColumnNumber)
                {
                    if (colNumber == "FXSFYSUM")
                    {
                        string ParentColumnName =
                            this.DynamicColumn.Where(p => p.ParentNumber == colNumber)
                                .Select(o => o.ParentName)
                                .FirstOrDefault();
                        if (ParentColumnName == null || ParentColumnName == "") continue;
                        ListHeader Cheader = header.AddChild();
                        Cheader.Caption = new LocaleValue(ParentColumnName, this.Context.UserLocale.LCID);
                        var Columns = this.DynamicColumn.Where(o => o.ParentNumber == colNumber).OrderBy(p => p.Number);
    
    
                        foreach (var col in Columns)
                        {
    
                            Cheader.AddChild(col.Number, new LocaleValue(col.Name, this.Context.UserLocale.LCID),
                                SqlStorageType.SqlDecimal);
                        }
                        if (Columns.Count() > 1)
                        {
                        
                                    Cheader.AddChild(colNumber, new LocaleValue("小计", this.Context.UserLocale.LCID),
                                        SqlStorageType.SqlDecimal);
                        }
                    }
                }

    不管前台显示什么,后头表该有的都有,然后控制显示字段。刚开始后台表已做处理,相同组的列名添加汇总字段,不管组里的列数是否大于1,都添加汇总列。

    忘记了,突然想起来,那么前台表就随意控制。

    在过滤界面,可设置显示隐藏列属性。

    以上好像没啥价值;

  • 相关阅读:
    括号序列
    乘积最大
    装箱问题
    开心的金明
    金明的预算方案(有依赖的背包问题)
    砝码称重
    (枚举)算法竞赛入门经典(7.1.2)最大乘积
    (枚举)算法竞赛入门经典(7.1.1)除法
    Zabbix历史数据清理
    sonarqube6.7.1使用
  • 原文地址:https://www.cnblogs.com/liuyudong0825/p/6543433.html
Copyright © 2020-2023  润新知