protected void Page_Load(object sender, EventArgs e) { ReportDocument rd = new ReportDocument(); //if (!this.Page.IsPostBack) //{ string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; //string orderBy = Request.QueryString["orderby"].ToString();//排序 string orderString = Request.QueryString["orderby"].ToString(); //排序 string order = "DESC"; //排序:升序 string orderBy = (!string.IsNullOrEmpty(orderString)) ? orderString.Substring(0, orderString.Length - 2) : "ProviderNo"; //要排序的字段,如果为空,默认为"ID" if (orderString.EndsWith("_a")) { order = "ASC";//排序:降序 } orderBy = orderBy + " " + order; string ProviderID = Request.QueryString["ProviderID"]; string ProductID = Request.QueryString["ProductID"]; string StartConfirmDate = Request.QueryString["StartConfirmDate"]; string EndConfirmDate = Request.QueryString["EndConfirmDate"]; DataTable dt = null; if (Request.QueryString["dataSource"].ToString() == "Arrive") { dt = PurchaseArriveBus.PurchaseArriveCollectListPrint(ProviderID, ProductID, StartConfirmDate, EndConfirmDate, CompanyCD, orderBy); } else { dt = PurchaseArriveBus.PurchaseOrderCollectListPrint(ProviderID, ProductID, StartConfirmDate, EndConfirmDate, CompanyCD, orderBy); } rd.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/PurchaseManager/PurchaseDetailCollect.rpt")); //绑定数据 rd.SetDataSource(dt); rd.Refresh(); this.CrystalReportViewer1.ReportSource = rd; rd.SetParameterValue("creator", "制表人:" + ((UserInfoUtil)SessionUtil.Session["UserInfo"]).EmployeeName); string DateParam = string.Empty; if (!string.IsNullOrEmpty(StartConfirmDate)) { DateParam += "起始日期:" + StartConfirmDate; } if (!string.IsNullOrEmpty(EndConfirmDate)) { DateParam += " 终止日期:" + EndConfirmDate; } rd.SetParameterValue("StartEndDate", DateParam); //} }
protected void btnImport_Click(object sender, ImageClickEventArgs e) { string companyCD = UserInfo.CompanyCD; PurchaseContractModel model = new PurchaseContractModel(); string ArriveNo = this.txtArriveNo.Text; string Title = this.txtTitle.Text; string TypeID = this.drpTypeID.Value; if (TypeID == "0") { TypeID = ""; } string Purchaser = this.HidPurchaser.Value; string FromType = this.ddlFromType.Value; if (FromType == "-1") { FromType = ""; } string ProviderID = this.txtHidProviderID.Value; string BillStatus = this.ddlBillStatus.Value; if (BillStatus == "0") { BillStatus = ""; } string UsedStatus = this.ddlUsedStatus.Value; if (UsedStatus == "0") { UsedStatus = ""; } string index = GetBillExAttrControl1.GetExtIndexValue; string ExtValue = GetBillExAttrControl1.GetExtTxtValue; model.CompanyCD = companyCD; int TotalCount = 0; DataTable dt = PurchaseArriveBus.SelectPurchaseArrive(1, 1000000, "ID", ref TotalCount, ArriveNo, Title, TypeID, Purchaser, FromType, ProviderID, BillStatus, UsedStatus, this.hidProjectID.Value, index, ExtValue); //导出标题 string headerTitle = "单据编号|单据主题|采购分类|采购员|供应商|采购订单编号|采购订单名称|总金额|单据状态|审批状态"; string[] header = headerTitle.Split('|'); //导出标题所对应的列字段名称 string columnFiled = "ArriveNo|Title|TypeName|PurchaserName|ProviderName|OrderNo|OrderTitle|TotalMoney|BillStatusName|UsedStatus"; string[] field = columnFiled.Split('|'); XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "采购到货列表"); }
private void BinddrpTypeID() { DataTable dt = PurchaseArriveBus.GetddlTypeID(); if (dt != null && dt.Rows.Count > 0) { drpTypeID.DataSource = dt; drpTypeID.DataTextField = "TypeName"; drpTypeID.DataValueField = "ID"; drpTypeID.DataBind(); ListItem Item = new ListItem("--请选择--", ""); drpTypeID.Items.Insert(0, Item); } }
/// <summary> /// 绑定列表支付方式 /// </summary> private void binddrpMoneyType() { DataTable dt = PurchaseArriveBus.GetDrpMoneyType(); if (dt != null && dt.Rows.Count > 0) { drpMoneyType.DataSource = dt; drpMoneyType.DataTextField = "TypeName"; drpMoneyType.DataValueField = "ID"; drpMoneyType.DataBind(); } ListItem Item = new ListItem(); Item.Value = "0"; Item.Text = "--请选择--"; drpMoneyType.Items.Insert(0, Item); }
protected void LoadPrintInfo() { PrintParameterSettingModel model = new PrintParameterSettingModel(); model.CompanyCD = UserInfo.CompanyCD; model.BillTypeFlag = int.Parse(ConstUtil.BILL_TYPEFLAG_PURCHASE); model.PrintTypeFlag = ConstUtil.PRINTBILL_TYPEFLAG_PurchaseArrive; /*此处需注意在模板设置表里的字段和取基本信息的字段是否一致*/ Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("ExtField1", "{ExtField1}"); dic.Add("ExtField2", "{ExtField2}"); dic.Add("ExtField3", "{ExtField3}"); dic.Add("ExtField4", "{ExtField4}"); dic.Add("ExtField5", "{ExtField5}"); dic.Add("ExtField6", "{ExtField6}"); dic.Add("ExtField7", "{ExtField7}"); dic.Add("ExtField8", "{ExtField8}"); dic.Add("ExtField9", "{ExtField9}"); dic.Add("ExtField10", "{ExtField10}"); dic.Add("ArriveNo", "单据编号"); dic.Add("Title", "主题"); dic.Add("TypeIDName", "采购类别"); dic.Add("ProviderName", "供应商"); dic.Add("DeptName", "部门"); dic.Add("CheckUserName", "点收人"); dic.Add("PurchaserName", "采购员"); dic.Add("CheckDate", "点收日期"); dic.Add("FromTypeName", "源单类型"); dic.Add("MoneyTypeName", "支付方式"); dic.Add("SendAddress", "发货地址"); dic.Add("ReceiveOverAddress", "收货地址"); dic.Add("isAddTaxName", "是否为增值税"); dic.Add("TakeTypeName", "交货方式"); dic.Add("CarryTypeName", "运送方式"); dic.Add("PayTypeName", "结算方式"); dic.Add("CurrencyTypeName", "币种"); dic.Add("Rate", "汇率"); dic.Add("ArriveDate", "到货时间"); dic.Add("ProjectName", "所属项目"); dic.Add("CountTotal", "数量总计"); if (UserInfo.IsDisplayPrice) {// 出入库显示单价 dic.Add("TotalMoney", "金额总计"); dic.Add("TotalTax", "税额合计"); dic.Add("TotalFee", "含税总额总计"); dic.Add("Discount", "整单折扣"); dic.Add("DiscountTotal", "折扣金额"); dic.Add("RealTotal", "折后含税额"); dic.Add("OtherTotal", "其他费用支出合计"); } dic.Add("BillStatusName", "单据状态"); dic.Add("CreatorName", "制单人"); dic.Add("CreateDate", "制单日期"); dic.Add("ConfirmorName", "确认人"); dic.Add("ConfirmDate", "确认日期"); dic.Add("CloserName", "结单人"); dic.Add("CloseDate", "结单日期"); dic.Add("ModifiedUserID", "最后更新人"); dic.Add("ModifiedDate", "最后更新日期"); dic.Add("Remark", "备注"); string[,] aBase = ConvertDictionaryToString(dic, out _sbase); dic.Clear(); dic.Add("SortNo", "序号"); dic.Add("ProductNo", "物品编号"); dic.Add("ProductName", "物品名称"); dic.Add("Specification", "规格"); dic.Add("ColorName", "颜色"); if (_isMoreUnit) {// 启用多计量单位 dic.Add("UnitName", "基本单位"); dic.Add("ProductCount", "基本数量"); dic.Add("UsedUnitName", "单位"); dic.Add("UsedUnitCount", "到货数量"); } else { dic.Add("UnitName", "单位"); dic.Add("ProductCount", "到货数量"); } if (UserInfo.IsDisplayPrice) {// 出入库显示单价 dic.Add("TotalPrice", "金额"); dic.Add("UnitPrice", "单价"); dic.Add("TaxPrice", "含税价"); dic.Add("TaxRate", "税率"); dic.Add("TotalFee", "含税金额"); dic.Add("TotalTax", "税额"); } string[,] aDetail = ConvertDictionaryToString(dic, out _sdetail); #region 1.扩展属性 int countExt = 0; DataTable dtExtTable = TableExtFieldsBus.GetAllList(UserInfo.CompanyCD, "", "officedba." + ConstUtil.CODING_RULE_TABLE_PURCHASEARRIVE); if (dtExtTable.Rows.Count > 0) { for (int i = 0; i < dtExtTable.Rows.Count; i++) { for (int x = 0; x < (aBase.Length / 2) - 15; x++) { if (x == i) { aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString(); countExt++; } } } } #endregion DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model); DataTable dtMRP = PurchaseArriveBus.SelectArrive(this.intMrpID); DataTable dtDetail = PurchaseArriveBus.Details(this.intMrpID); string strBaseFields = ""; string strDetailFields = ""; if (dbPrint.Rows.Count > 0) { isSeted.Value = "1"; strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString(); strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString(); } else { isSeted.Value = "0"; strBaseFields = GetDefaultFields(aBase); /*基本信息字段+扩展信息字段*/ if (countExt > 0) { for (int i = 0; i < countExt; i++) { strBaseFields = strBaseFields + "|" + "ExtField" + (i + 1); } } strDetailFields = GetDefaultFields(aDetail); } #region 2.主表信息 if (!string.IsNullOrEmpty(strBaseFields)) { tableBase.InnerHtml = WritePrintPageTable("采购到货", strBaseFields, strDetailFields, aBase, aDetail, dtMRP, dtDetail, true); } #endregion #region 3.明细信息 if (!string.IsNullOrEmpty(strDetailFields)) { tableDetail.InnerHtml = WritePrintPageTable("采购到货", strBaseFields, strDetailFields, aBase, aDetail, dtMRP, dtDetail, false); } #endregion }