/// <summary> /// 取得最新的请款 /// </summary> /// <param name="num"></param> /// <returns></returns> private DataTable GetPayment(int num) { PaymentStrategyBuilder sb = new PaymentStrategyBuilder("V_Payment"); ArrayList arA = new ArrayList(); //arA.Add("060102"); arA.Add(base.user.UserCode); arA.Add(base.user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PaymentStrategyName.AccessRange, arA)); sb.AddStrategy(new Strategy(PaymentStrategyName.Status, "0")); // 0为待审 sb.AddOrder("ApplyDate", false); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); //qa.SetTopNumber(num); EntityData entity = qa.FillEntityData("V_Payment", sql); DataTable dt = entity.CurrentTable; qa.Dispose(); return(dt); }
private void LoadDataGrid() { dgList.PageSize = int.Parse(txtPageSize.Value); try { PaymentStrategyBuilder sb = new PaymentStrategyBuilder("V_Payment"); if (txtProjectCode.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.ProjectCode, txtProjectCode.Value)); } string isContract = ""; if (this.chkIsContract.Checked && !this.chkIsNotContract.Checked) { isContract = "1"; } if (!this.chkIsContract.Checked && this.chkIsNotContract.Checked) { isContract = "0"; } if (isContract != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.IsContract, isContract)); } ArrayList arStatus = new ArrayList(); if (this.chkStatus0.Checked) { arStatus.Add("0"); } if (this.chkStatus1.Checked) { arStatus.Add("1"); } if (this.chkStatus2.Checked) { arStatus.Add("2"); } if (this.chkStatus3.Checked) { arStatus.Add("3"); switch (this.up_sPMName.ToUpper()) { case "TANGCHENPM": arStatus.Add("5"); //汤臣的情况,还有等待汇总也算是审核中状态。 arStatus.Add("6"); //汤臣的情况,还有汇总审核中也算是审核中状态。 break; default: break; } } string status = BLL.ConvertRule.GetArrayLinkString(arStatus); if (status != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.Status, status)); } if (this.inputSystemGroupPayment.Value != "") { ArrayList arGroup = new ArrayList(); arGroup.Add(this.inputSystemGroupPayment.Value); arGroup.Add("0"); sb.AddStrategy(new Strategy(PaymentStrategyName.GroupCodeEx, arGroup)); } if (this.txtAct.Value == "1") //应付款 { sb.AddStrategy(new Strategy(PaymentStrategyName.NotPayout)); } ////2007.2.8 注释掉 世茂——不打开高级查询也能够生效 // if (this.txtAdvSearch.Value != "none") // { //供应商条件 if (this.txtSupplyName.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.SupplyName, this.txtSupplyName.Value)); } //受款人条件 if (this.txtPayer.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.Payer, this.txtPayer.Value)); } //请款部门 if (this.ucUnit.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.UnitCode, this.ucUnit.Value)); } //申请人 if (this.ucApplyPerson.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.ApplyPerson, this.ucApplyPerson.Value)); } if (this.ucCheckPerson.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.CheckPerson, this.ucCheckPerson.Value)); } //申请日期 if (this.dtbApplyDate0.Value != "" || this.dtbApplyDate1.Value != "") { ArrayList ar = new ArrayList(); ar.Add(this.dtbApplyDate0.Value); ar.Add(this.dtbApplyDate1.Value); sb.AddStrategy(new Strategy(PaymentStrategyName.ApplyDate, ar)); } ////审核日期 审核人 if (this.dtbCheckDate0.Value != "" || this.dtbCheckDate1.Value != "") { ArrayList ar = new ArrayList(); ar.Add(this.dtbCheckDate0.Value); ar.Add(this.dtbCheckDate1.Value); sb.AddStrategy(new Strategy(PaymentStrategyName.CheckDate, ar)); } //最晚付款日期 if (this.dtbPayDate0.Value != "" || this.dtbPayDate1.Value != "") { ArrayList ar = new ArrayList(); ar.Add(this.dtbPayDate0.Value); ar.Add(this.dtbPayDate1.Value); sb.AddStrategy(new Strategy(PaymentStrategyName.PayDate, ar)); } //受款金额 if (this.txtTotalMoney0.Text != "" || this.txtTotalMoney1.Text != "") { ArrayList ar = new ArrayList(); ar.Add((this.txtTotalMoney0.Text == "") ? "" : this.txtTotalMoney0.ValueDecimal.ToString()); ar.Add((this.txtTotalMoney1.Text == "") ? "" : this.txtTotalMoney1.ValueDecimal.ToString()); sb.AddStrategy(new Strategy(PaymentStrategyName.Money, ar)); } //请款单编号 if (this.txtPaymentID.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.PaymentID, this.txtPaymentID.Value)); } //合同编号 if (this.txtContractID.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.ContractID, this.txtContractID.Value)); } //合同名称 if (this.txtContractName.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.PaymentNameEx, this.txtContractName.Value)); } //成本批量请款 if (this.chkBatchPayment.Checked && !this.chkNotBatchPayment.Checked) { sb.AddStrategy(new Strategy(PaymentStrategyName.BatchPayment)); } //非成本批量请款 if (!this.chkBatchPayment.Checked && this.chkNotBatchPayment.Checked) { sb.AddStrategy(new Strategy(PaymentStrategyName.NotBatchPayment)); } if (this.txtPaymentTitle.Value != "") { sb.AddStrategy(new Strategy(PaymentStrategyName.PaymentTitle, this.txtPaymentTitle.Value)); } // } //权限 ArrayList arA = new ArrayList(); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PaymentStrategyName.AccessRange, arA)); //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); if (sortsql == "") { //缺省排序 sb.AddOrder("ApplyDate", false); sb.AddOrder("PaymentCode", false); } string sql = sb.BuildMainQueryString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("Payment", sql); qa.Dispose(); string[] arrField = { "Money", "TotalPayout" }; decimal[] arrSum = BLL.MathRule.SumColumn(entity.CurrentTable, arrField); this.txtSumMoney.Value = arrSum[0].ToString("N"); this.txtSumTotalPayoutMoney.Value = arrSum[1].ToString("N"); this.dgList.DataSource = entity.CurrentTable; this.dgList.DataBind(); this.GridPagination1.RowsCount = entity.CurrentTable.Rows.Count.ToString(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示列表出错:" + ex.Message)); } }