public static DataTable BuildingCostApportionAllPayout(string projectCode, string DateBegin, string DateEnd, string AreaField) { DataTable table2; try { EntityData buildings = ProductDAO.GetBuildingNotAreaByProjectCode(projectCode); EntityData pBSUnits = PBSDAO.GetPBSUnitByProject(projectCode); EntityData cBS = CBSDAO.GetCBSByProject(projectCode); DataTable dtApportion = BuildBuildingCostApportionTable(); PayoutStrategyBuilder builder = new PayoutStrategyBuilder("Payout"); builder.AddStrategy(new Strategy(PayoutStrategyName.ProjectCode, projectCode)); if ((DateBegin != "") || (DateEnd != "")) { ArrayList pas = new ArrayList(); pas.Add(DateBegin); pas.Add(DateEnd); builder.AddStrategy(new Strategy(PayoutStrategyName.PayoutDateRange, pas)); } string queryString = builder.BuildMainQueryString(); QueryAgent agent = new QueryAgent(); EntityData data4 = agent.FillEntityData("Payout", queryString); agent.Dispose(); foreach (DataRow row in data4.CurrentTable.Rows) { string payoutCode = ConvertRule.ToString(row["PayoutCode"]); BuildingCostApportionOnePayout(projectCode, payoutCode, pBSUnits, buildings, cBS, dtApportion, AreaField); } data4.Dispose(); pBSUnits.Dispose(); buildings.Dispose(); cBS.Dispose(); table2 = dtApportion; } catch (Exception exception) { throw exception; } return(table2); }
private void LoadData() { PayoutStrategyBuilder sb = new PayoutStrategyBuilder("V_Payout"); sb.AddStrategy(new Strategy(PayoutStrategyName.ProjectCode, ProjectCode)); string sql = sb.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("V_Payout", sql); qa.Dispose(); this.dgDetailData.DataSource = entity; this.dgDetailData.DataBind(); }
private void LoadDataGrid() { try { PayoutStrategyBuilder sb = new PayoutStrategyBuilder("V_Payout"); sb.AddStrategy(new Strategy(PayoutStrategyName.ProjectCode, txtProjectCode.Value)); ArrayList arStatus = new ArrayList(); if (this.chkStatus0.Checked) { arStatus.Add("0"); } if (this.chkStatus1.Checked) { arStatus.Add("1"); } string status = BLL.ConvertRule.GetArrayLinkString(arStatus); if (status != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.Status, status)); } 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(PayoutStrategyName.IsContract, isContract)); } ////2007.2.8 注释掉 世茂——不打开高级查询也能够生效 // if (this.txtAdvSearch.Value != "none") // { if (this.txtPayoutID.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.PayoutID, this.txtPayoutID.Value)); } if (this.txtPaymentID.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.PaymentID, this.txtPaymentID.Value)); } if (this.txtVoucherID.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.VoucherID, this.txtVoucherID.Value)); } if (this.txtContractID.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.ContractID, this.txtContractID.Value)); } if (this.txtContractName.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.ContractName, this.txtContractName.Value)); } if (this.txtSupplyName.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.SupplyName, this.txtSupplyName.Value)); } if (this.txtPayer.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.Payer, this.txtPayer.Value)); } if (this.ucInputPerson.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.InputPerson, this.ucInputPerson.Value)); } if (this.ucCheckPerson.Value != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.CheckPerson, this.ucCheckPerson.Value)); } if (this.dtbInputDate0.Value != "" || this.dtbInputDate1.Value != "") { ArrayList ar = new ArrayList(); ar.Add(this.dtbInputDate0.Value); ar.Add(this.dtbInputDate1.Value); sb.AddStrategy(new Strategy(PayoutStrategyName.InputDateRange, 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(PayoutStrategyName.CheckDateRange, ar)); } if (this.dtbPayoutDate0.Value != "" || this.dtbPayoutDate1.Value != "") { ArrayList ar = new ArrayList(); ar.Add(this.dtbPayoutDate0.Value); ar.Add(this.dtbPayoutDate1.Value); sb.AddStrategy(new Strategy(PayoutStrategyName.PayoutDateRange, ar)); } //成本批量请款 if (this.chkBatchPayment.Checked && !this.chkNotBatchPayment.Checked) { sb.AddStrategy(new Strategy(PayoutStrategyName.BatchPayment)); } //非成本批量请款 if (!this.chkBatchPayment.Checked && this.chkNotBatchPayment.Checked) { sb.AddStrategy(new Strategy(PayoutStrategyName.NotBatchPayment)); } // } //权限 ArrayList arA = new ArrayList(); arA.Add("060201"); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.AccessRange, arA)); //类型 if (this.inputSystemGroup.Value != "") { ArrayList arS = new ArrayList(); arS.Add(this.inputSystemGroup.Value); arS.Add("0"); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.GroupCodeEx, arS)); } //贷方科目 if (this.ucInputSubjectStart.Value != "") { sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.SubjectCodeStart, this.ucInputSubjectStart.Value)); } if (this.ucInputSubjectEnd.Value != "") { sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.SubjectCodeEnd, this.ucInputSubjectEnd.Value)); } if (this.TxtGreateCash.Value.Trim() != "") { sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.GreatRootCash, this.TxtGreateCash.Value.Trim())); } if (this.TxtSmallCash.Value.Trim() != "") { sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.SmallRootCash, this.TxtSmallCash.Value.Trim())); } //排序 string sortsql = BLL.GridSort.GetSortSQL(ViewState); if (sortsql == "") { //缺省排序 sb.AddOrder("PayoutDate", false); sb.AddOrder("PayoutCode", false); } string sql = sb.BuildMainQueryString(); if (sortsql != "") { //点列标题排序 sql = sql + " order by " + sortsql; } QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("V_Payout", sql); qa.Dispose(); //EntityData entity = new EntityData("Standard_Payout"); //StandardEntityDAO dao = new StandardEntityDAO("Standard_Payout"); //dao.FillEntity(, "@PayoutCode", code, entity, "Payout"); //dao.FillEntity(SqlManager.GetSqlStruct("PayoutItem", "SelectByPayoutCode").GetSqlStringWithOrder(), "@PayoutCode", code, entity, "PayoutItem"); //dao.FillEntity(SqlManager.GetSqlStruct("PayoutItemBuilding", "SelectByPayoutCode").GetSqlStringWithOrder(), "@PayoutCode", code, entity, "PayoutItemBuilding"); string[] arrField = { "Money" }; decimal[] arrSum = BLL.MathRule.SumColumn(entity.CurrentTable, arrField); this.txtSumMoney.Value = arrSum[0].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)); } }
private void BuildSqlString() { string projectCode = Request["ProjectCode"] + ""; PayoutStrategyBuilder sb = new PayoutStrategyBuilder("V_Payout"); sb.AddStrategy(new Strategy(PayoutStrategyName.ProjectCode, projectCode)); ArrayList arStatus = new ArrayList(); if ((Request["IsApportioned"] + "") == "1") { arStatus.Add("1"); } if ((Request["NotIsApportioned"] + "") == "1") { arStatus.Add("0"); } string apportionStatus = BLL.ConvertRule.GetArrayLinkString(arStatus); if (apportionStatus != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.IsApportioned, apportionStatus)); } //必定是已经审核过的 sb.AddStrategy(new Strategy(PayoutStrategyName.Status, "1")); // if ( this.txtPayoutID.Value != "" ) // sb.AddStrategy( new Strategy( PayoutStrategyName.PayoutID,this.txtPayoutID.Value )); // // if ( this.txtPaymentID.Value != "" ) // sb.AddStrategy( new Strategy( PayoutStrategyName.PaymentID,this.txtPaymentID.Value )); // // if ( this.txtVoucherID.Value != "" ) // sb.AddStrategy( new Strategy( PayoutStrategyName.VoucherID,this.txtVoucherID.Value )); string contractID = Request["ContractID"] + ""; if (contractID != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.ContractID, contractID)); } string contractName = Request["ContractName"] + ""; if (contractName != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.ContractName, contractName)); } string supplierName = Request["SupplierName"] + ""; if (supplierName != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.SupplyName, supplierName)); } string payer = Request["Payer"] + ""; if (payer != "") { sb.AddStrategy(new Strategy(PayoutStrategyName.Payer, payer)); } //权限先去掉 // ArrayList arA = new ArrayList(); // arA.Add("060201"); // arA.Add(user.UserCode); // arA.Add(user.BuildStationCodes()); // sb.AddStrategy( new Strategy( DAL.QueryStrategy.PayoutStrategyName.AccessRange,arA)); //类型 string payoutTypeCode = Request["payoutTypeCode"] + ""; if (payoutTypeCode != "") { ArrayList arS = new ArrayList(); arS.Add(payoutTypeCode); arS.Add("0"); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.GroupCodeEx, arS)); } // 在分摊方式中查找 string alloType = Request["AlloType"] + ""; string buildingCode = Request["BuildingCode"] + ""; string buildingName = Request["BuildingName"] + ""; string isInType = Request["IsInType"] + ""; if (isInType != "" && alloType != "") { ArrayList arAllo = new ArrayList(); arAllo.Add(alloType); arAllo.Add(buildingCode); sb.AddStrategy(new Strategy(DAL.QueryStrategy.PayoutStrategyName.AlloType, arAllo)); } string sortColumn = (string)this.ViewState["SortColumn"]; string sortASC = (string)this.ViewState["SortASC"]; bool isAsc = (sortASC == "True"); sb.AddOrder(sortColumn, isAsc); string sql = sb.BuildMainQueryString(); // Response.Write(sql); this.ViewState.Add("SqlString", sql); }