Exemplo n.º 1
0
    protected void btnImport_Click(object sender, ImageClickEventArgs e)
    {
        //设置行为参数
        string orderString = hiddExpOrder.Value.Trim();                                                                               //排序
        string order       = "desc";                                                                                                  //排序:降序
        string orderBy     = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "GatheringNo"; //要排序的字段,如果为空,默认为"ID"

        if (orderString.EndsWith("_a"))
        {
            order = "asc";                                    //排序:升序
        }
        int       pageCount  = int.Parse(hiddExpTotal.Value); //每页显示记录数
        int       pageIndex  = 1;                             //当前页
        int       TotalCount = 0;                             //总记录数
        string    ord        = orderBy + " " + order;         //排序字段
        DataTable dt         = new DataTable();

        SellGatheringModel sellGatheringModel = new SellGatheringModel();

        GetSellGatheringModel(sellGatheringModel);
        string PlanPrice0 = hiddExpPlanPrice0.Value.Trim();      //计划回款金额

        PlanPrice0 = PlanPrice0.Length == 0 ? null : PlanPrice0;
        string EFIndex = Request.QueryString["EFIndex"];
        string EFDesc  = Request.QueryString["EFDesc"];

        GetBillExAttrControl1.ExtIndex = EFIndex;
        GetBillExAttrControl1.ExtValue = EFDesc;
        GetBillExAttrControl1.SetExtControlValue();

        dt = SellGatheringBus.GetSellGathering(sellGatheringModel, PlanPrice0, EFIndex, EFDesc, pageIndex, pageCount, ord, ref TotalCount);

        //导出标题
        string headerTitle = "单据编号|主题|客户|回款状态|源单类型|源单编号|业务员|总金额|期次|计划日期";

        string[] header = headerTitle.Split('|');

        //导出标题所对应的列字段名称
        string columnFiled = "GatheringNo|Title|CustName|stateName|fromTypeName|BillNo|EmployeeName|PlanPrice|GatheringTime|PlanGatherDate";

        //string columnFiled = "CreateDate|strUsedStatus";
        string[] field = columnFiled.Split('|');

        XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "回款计划列表");
    }
    protected void LoadPrintInfo()
    {
        PrintParameterSettingModel model = new PrintParameterSettingModel();

        model.CompanyCD     = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;//UserInfo.CompanyCD;
        model.BillTypeFlag  = int.Parse(ConstUtil.BILL_TYPEFLAG_SALE);
        model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_SELLGATHERING;

        //    /*接受参数*/
        string GatheringNo = Request.QueryString["no"].ToString();

        #region 基本信息 明细信息
        /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/
        string[,] aBase = { { "{ExtField1}",  "ExtField1"      },
                            { "{ExtField2}",  "ExtField2"      },
                            { "{ExtField3}",  "ExtField3"      },
                            { "{ExtField4}",  "ExtField4"      },
                            { "{ExtField5}",  "ExtField5"      },
                            { "{ExtField6}",  "ExtField6"      },
                            { "{ExtField7}",  "ExtField7"      },
                            { "{ExtField8}",  "ExtField8"      },
                            { "{ExtField9}",  "ExtField9"      },
                            { "{ExtField10}", "ExtField10"     },
                            { "回款计划编号",       "GatheringNo"    },
                            { "主题",           "Title"          },
                            { "源单类型",         "fromTypeName"   },
                            { "源单编号",         "BillNo"         },
                            { "客户名称",         "CustName"       },
                            { "客户类型",         "TypeName"       },
                            { "客户电话",         "Tel"            },
                            { "币种",           "CurrencyName"   },
                            { "业务员",          "SellerName"     },
                            { "部门",           "DeptName"       },
                            { "计划回款金额",       "PlanPrice"      },
                            { "计划回款时间",       "PlanGatherDate" },
                            { "实际回款金额",       "FactPrice"      },
                            { "实际回款时间",       "FactGatherDate" },
                            { "回款相关单号",       "LinkBillNo"     },
                            { "期次",           "GatheringTime"  },
                            { "状态",           "stateName"      },
                            { "制单人",          "CreatorName"    },
                            { "制单日期",         "CreateDate"     },
                            { "最后更新人",        "ModifiedUserID" },
                            { "最后更新日期",       "ModifiedDate"   },
                            { "备注",           "Remark"         }, };

        #endregion

        #region 1.扩展属性
        int       countExt   = 0;
        DataTable dtExtTable = TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.SellGathering");
        if (dtExtTable.Rows.Count > 0)
        {
            for (int i = 0; i < dtExtTable.Rows.Count; i++)
            {
                for (int x = 0; x < (aBase.Length / 2) - 22; x++)
                {
                    if (x == i)
                    {
                        aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString();
                        countExt++;
                    }
                }
            }
        }
        #endregion

        DataTable dbPrint       = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model);
        DataTable dtMain        = SellGatheringBus.GetRepOrder(GatheringNo);
        string    strBaseFields = "";

        if (dbPrint.Rows.Count > 0)
        {
            isSeted.Value = "1";
            strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString();
        }
        else
        {
            isSeted.Value = "0";
            strBaseFields = "GatheringNo|Title|fromTypeName|BillNo|CustName|TypeName|Tel|CurrencyName|SellerName|DeptName|PlanPrice|PlanGatherDate|FactPrice|";
            strBaseFields = strBaseFields + "FactGatherDate|LinkBillNo|GatheringTime|stateName|CreatorName|CreateDate|ModifiedUserID|ModifiedDate|Remark";
            /*基本信息字段+扩展信息字段*/
            if (countExt > 0)
            {
                for (int i = 0; i < countExt; i++)
                {
                    strBaseFields = strBaseFields + "|" + "ExtField" + (i + 1);
                }
            }
        }

        #region 2.主表信息
        if (!string.IsNullOrEmpty(strBaseFields))
        {
            //第一个是打印页面的正标题,strBaseFields是在PrintParameterSetting表里设置的主表字段,
            //strDetailFields是在PrintParameterSetting表里设置的明细表的字段,
            //aBase,是打印设置页面上定义取出来的字段及对应的名称,
            //aDetail是打印设置页面上定义取出来的字段及对应的名称,
            //例如明细中的物品编号,对应的就是物品编号及取数据的字段ProdNo,
            //dtMRP是主表的数据集,
            //dtDetail是明细表的数据集,最后一个参数,用来区别是主表信息还是明细信息..
            tableBase.InnerHtml = WritePrintPageTable("销售回款计划", strBaseFields, "", aBase, null, dtMain, null, true);
        }
        #endregion
    }