protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //扩展属性 GetBillExAttrControl1.TableName = "officedba.SellBack"; string EFIndex = Request.QueryString["EFIndex"]; string EFDesc = Request.QueryString["EFDesc"]; GetBillExAttrControl1.ExtIndex = EFIndex; GetBillExAttrControl1.ExtValue = EFDesc; GetBillExAttrControl1.SetExtControlValue(); DataTable dt = SellBackBus.GetReasonType(); if (dt.Rows.Count > 0) { ddlReasonType.DataSource = dt; ddlReasonType.DataTextField = "CodeName"; ddlReasonType.DataValueField = "ID"; ddlReasonType.DataBind(); } ddlReasonType.Items.Insert(0, new ListItem("请选择", "")); btnImport.Attributes["onclick"] = "return fnIsSearch();"; // 小数位数 _selPoint = int.Parse(UserInfo.SelPoint); } }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = SellBackBus.GetReasonType(); if (dt.Rows.Count > 0) { ddlReasonType.DataSource = dt; ddlReasonType.DataTextField = "CodeName"; ddlReasonType.DataValueField = "ID"; ddlReasonType.DataBind(); } CreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); ModifiedDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); FlowApply1.BillTypeFlag = ConstUtil.CODING_RULE_SELL; FlowApply1.BillTypeCode = ConstUtil.CODING_RULE_SELLBACK_NO; PayTypeUC.TypeFlag = ConstUtil.CUST_TYPE_CUST; //结算方式 PayTypeUC.TypeCode = ConstUtil.CUST_INFO_PAYTYPE; //结算方式 PayTypeUC.IsInsertSelect = true; PackageUC.TypeFlag = ConstUtil.SELL_TYPE_SELL; //包装 PackageUC.IsInsertSelect = true; PackageUC.TypeCode = ConstUtil.SELL_TYPE_PACKAGE; //包装 MoneyTypeUC.IsInsertSelect = true; MoneyTypeUC.TypeFlag = ConstUtil.CUST_TYPE_CUST; MoneyTypeUC.TypeCode = ConstUtil.CUST_INFO_MONEYTYPE; CarryType.TypeFlag = ConstUtil.SELL_TYPE_SELL; //运送方式 CarryType.TypeCode = ConstUtil.SELL_TYPE_CARRYTYPE; //运送方式 CarryType.IsInsertSelect = true; //设置隐藏域条码的值 if (UserInfo.IsBarCode) { hidBarCode.Value = "1"; } else { hidBarCode.Value = "0"; } //是否启用多单位 if (UserInfo.IsMoreUnit) { txtIsMoreUnit.Value = "1"; BaseUnitD.Visible = true; BaseCountD.Visible = true; } else { txtIsMoreUnit.Value = "0"; BaseUnitD.Visible = false; BaseCountD.Visible = false; } // 小数位数 _selPoint = int.Parse(UserInfo.SelPoint); }
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_SELLBACK; // /*接受参数*/ string BackNo = 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" }, { "单据编号", "BackNo" }, { "主题", "Title" }, { "源单类型", "FromTypeText" }, { "源单编号", "SendNo" }, { "客户名称", "CustName" }, { "客户电话", "CustTel" }, { "业务类型", "BusiTypeName" }, { "结算方式", "PayTypeName" }, { "支付方式", "MoneyTypeName" }, { "运送方式", "CarryTypeName" }, { "币种", "CurrencyName" }, { "汇率", "Rate" }, { "业务员", "SellerName" }, { "部门", "DeptName" }, { "发货地址", "SendAddress" }, { "收货地址", "ReceiveAddress" }, { "退货日期", "BackDate" }, { "是否增值税", "isAddTaxName" }, { "所属项目", "ProjectName" }, { "金额合计", "TotalPrice" }, { "税额合计", "Tax" }, { "含税金额合计", "TotalFee" }, { "整单折扣(%)", "Discount" }, { "折后含税金额", "RealTotal" }, { "折扣金额", "DiscountTotal" }, { "退货数量合计", "CountTotal" }, { "抵应收货款", "NotPayTotal" }, { "单据状态", "BillStatusText" }, { "制单人", "CreatorName" }, { "制单日期", "CreateDate" }, { "确认人", "ConfirmorName" }, { "确认日期", "ConfirmDate" }, { "结单人", "CloserName" }, { "结单日期", "CloseDate" }, { "最后更新人", "ModifiedUserID" }, { "最后更新日期", "ModifiedDate" }, { "备注", "Remark" }, { "建单情况", "IsOpenbillText" }, { "结算状态", "IsAccText" }, { "已结算金额", "YAccounts" }, { "入库情况", "IsSendText" }, }; string[,] aDetail; //多计量单位 if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit) { aDetail = new string[, ] { //{ "序号", "SortNo"}, { "物品编号", "ProdNo" }, { "物品名称", "ProductName" }, { "规格", "Specification" }, { "颜色", "ColorName" }, { "基本单位", "UnitName" }, //{ "交货期限(天)", "SendTime" }, { "基本数量", "BackNumber" }, { "单位", "UsedUnitName" }, { "退货数量", "UsedUnitCount" }, { "包装要求", "PackageName" }, { "单价", "UsedPrice" }, { "含税价", "TaxPrice" }, { "折扣(%)", "Discount" }, { "税率(%)", "TaxRate" }, { "含税金额", "TotalFee" }, { "金额", "TotalPrice" }, { "税额", "TotalTax" }, { "退货原因", "ReasonName" }, { "备注", "Remark" }, }; } else { aDetail = new string[, ] { //{ "序号", "SortNo"}, { "物品编号", "ProdNo" }, { "物品名称", "ProductName" }, { "规格", "Specification" }, { "颜色", "ColorName" }, { "单位", "UnitName" }, //{ "交货期限(天)", "SendTime" }, { "退货数量", "BackNumber" }, { "包装要求", "PackageName" }, { "单价", "UnitPrice" }, { "含税价", "TaxPrice" }, { "折扣(%)", "Discount" }, { "税率(%)", "TaxRate" }, { "含税金额", "TotalFee" }, { "金额", "TotalPrice" }, { "税额", "TotalTax" }, { "退货原因", "ReasonName" }, { "备注", "Remark" }, }; } ///*第二明细*/ //string[,] aSecondDetail = { // //{ "序号", "SortNo"}, // { "费用类别", "CodeName"}, // { "金额", "FeeTotal" }, // { "备注", "Remark"}, // }; #endregion #region 1.扩展属性 int countExt = 0; DataTable dtExtTable = TableExtFieldsBus.GetAllList(((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD, "", "officedba.SellBack"); if (dtExtTable.Rows.Count > 0) { for (int i = 0; i < dtExtTable.Rows.Count; i++) { for (int x = 0; x < (aBase.Length / 2) - 40; x++) { if (x == i) { aBase[x, 0] = dtExtTable.Rows[i]["EFDesc"].ToString(); countExt++; } } } } #endregion DataTable dbPrint = XBase.Business.Common.PrintParameterSettingBus.GetPrintParameterSettingInfo(model); DataTable dtMain = SellBackBus.GetRepOrder(BackNo); //获取主表数据 DataTable dtDetail = SellBackBus.GetRepOrderDetail(BackNo); //获取明细表数据:退货明细数据 //DataTable dtFee = SellOrderBus.GetRepOrderFee(OrderNo);//获取明细表:销售费用明细数据 string strBaseFields = ""; string strDetailFields = ""; ///*第二明细*/ //string strDetailSecondFields = ""; if (dbPrint.Rows.Count > 0) { isSeted.Value = "1"; strBaseFields = dbPrint.Rows[0]["BaseFields"].ToString(); strDetailFields = dbPrint.Rows[0]["DetailFields"].ToString(); ///*第二明细*/ //strDetailSecondFields = dbPrint.Rows[0]["DetailSecondFields"].ToString(); } else { isSeted.Value = "0"; strBaseFields = "BackNo|Title|FromTypeText|SendNo|CustName|CustTel|BusiTypeName|PayTypeName|MoneyTypeName|CarryTypeName|CurrencyName|Rate|"; strBaseFields = strBaseFields + "SellerName|DeptName|SendAddress|ReceiveAddress|BackDate|isAddTaxName|ProjectName|TotalPrice|Tax|TotalFee|Discount|"; strBaseFields = strBaseFields + "RealTotal|DiscountTotal|CountTotal|NotPayTotal|BillStatusText|CreatorName|CreateDate|ConfirmorName|ConfirmDate|CloserName|CloseDate|ModifiedUserID|ModifiedDate|Remark|"; strBaseFields = strBaseFields + "IsOpenbillText|IsAccText|YAccounts|IsSendText"; /*基本信息字段+扩展信息字段*/ if (countExt > 0) { for (int i = 0; i < countExt; i++) { strBaseFields = strBaseFields + "|" + "ExtField" + (i + 1); } } //多计量单位 if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit) { /*订单明细SortNo|*/ strDetailFields = "ProdNo|ProductName|Specification|ColorName|UnitName|BackNumber|UsedUnitName|UsedUnitCount|PackageName|UsedPrice|TaxPrice|Discount|TaxRate|TotalFee|TotalPrice|TotalTax|ReasonName|Remark"; } else { /*订单明细SortNo|*/ strDetailFields = "ProdNo|ProductName|Specification|ColorName|UnitName|BackNumber|PackageName|UnitPrice|TaxPrice|Discount|TaxRate|TotalFee|TotalPrice|TotalTax|ReasonName|Remark"; } } #region 2.主表信息 if (!string.IsNullOrEmpty(strBaseFields)) { //第一个是打印页面的正标题,strBaseFields是在PrintParameterSetting表里设置的主表字段, //strDetailFields是在PrintParameterSetting表里设置的明细表的字段, //aBase,是打印设置页面上定义取出来的字段及对应的名称, //aDetail是打印设置页面上定义取出来的字段及对应的名称, //例如明细中的物品编号,对应的就是物品编号及取数据的字段ProdNo, //dtMRP是主表的数据集, //dtDetail是明细表的数据集,最后一个参数,用来区别是主表信息还是明细信息.. tableBase.InnerHtml = WritePrintPageTable("销售退货单", strBaseFields, strDetailFields, aBase, aDetail, dtMain, dtDetail, true); } #endregion #region 3.明细信息 if (!string.IsNullOrEmpty(strDetailFields)) { tableDetail.InnerHtml = WritePrintPageTable("销售退货单", strBaseFields, strDetailFields, aBase, aDetail, dtMain, dtDetail, false); } #endregion ///*第二明细*/ //#region 4.明细信息2 //if (!string.IsNullOrEmpty(strDetailSecondFields)) //{ // tableDetail2.InnerHtml = WritePrintPageTable("销售订单", strBaseFields, strDetailSecondFields, aBase, aSecondDetail, dtMain, dtFee, false); //} //#endregion }
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) : "BackDate"; //要排序的字段,如果为空,默认为"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(); string strorderNo = hiddExpOrderNo.Value.Trim(); string strTitle = hiddExpTitle.Value.Trim(); string strCustID = hiddExpCustID.Value.Trim(); string strSeller = hiddExpSeller.Value.Trim(); string strFromType = hiddExpFromType.Value.Trim(); string strBillStatus = hiddExpBillStatus.Value.Trim(); string strFlowStatus = hiddExpFlowStatus.Value.Trim(); string strReason = hiddExpReasonType.Value.Trim(); string strSttlDate1 = hiddExpOfferDate1.Value.Trim(); string strSttlDate = hiddExpOfferDate.Value.Trim(); string strProjectID = hiddProjectID.Value.Trim(); string orderNo = strorderNo.Length == 0 ? null : strorderNo; string Title = strTitle.Length == 0 ? null : strTitle; int? CustID = strCustID.Length == 0 ? null : (int?)Convert.ToInt32(strCustID); int? Seller = strSeller.Length == 0 ? null : (int?)Convert.ToInt32(strSeller); string FromType = strFromType.Length == 0 ? null : strFromType; string BillStatus = strBillStatus.Length == 0 ? null : strBillStatus; DateTime?date = strSttlDate.Length == 0 ? null : (DateTime?)Convert.ToDateTime(strSttlDate); DateTime?date1 = strSttlDate1.Length == 0 ? null : (DateTime?)Convert.ToDateTime(strSttlDate1); int? FlowStatus = strFlowStatus.Length == 0 ? null : (int?)Convert.ToInt32(strFlowStatus); int? Reason = strReason.Length == 0 ? null : (int?)Convert.ToInt32(strReason); int? ProjectID = strProjectID.Length == 0 ? null : (int?)Convert.ToInt32(strProjectID); //扩展属性 string EFIndex = Request.QueryString["EFIndex"]; string EFDesc = Request.QueryString["EFDesc"]; GetBillExAttrControl1.ExtIndex = EFIndex; GetBillExAttrControl1.ExtValue = EFDesc; GetBillExAttrControl1.SetExtControlValue(); SellBackModel model = new SellBackModel(); model.BillStatus = BillStatus; model.Seller = Seller; model.BackDate = date; model.FromType = FromType; model.BackNo = orderNo; model.CustID = CustID; model.Title = Title; model.ProjectID = ProjectID; dt = SellBackBus.GetOrderList(model, date1, Reason, FlowStatus, EFIndex, EFDesc, pageIndex, pageCount, ord, ref TotalCount); //导出标题 string headerTitle = "单据编号|单据主题|源单类型|客户|业务员|退货日期|总金额|单据状态|审批状态"; //string headerTitle = "建档日期|启用状态"; string[] header = headerTitle.Split('|'); //导出标题所对应的列字段名称 string columnFiled = "BackNo|Title|FromTypeText|CustName|EmployeeName|BackDate|TotalPrice|BillStatusText|FlowInstanceText"; //string columnFiled = "CreateDate|strUsedStatus"; string[] field = columnFiled.Split('|'); XBase.Common.OutputToExecl.ExportToTable(this.Page, dt, header, field, "销售退货单列表"); }