public DataTable FinanceExport(FinanceQueryFilter filter, out int totalCount, out double totalPayAmt) { string sqlName = string.Empty; string orderStr = "SysNo DESC"; if (filter.IsGroupByVendor == true) { sqlName = "Invoice_Query_FinanceGroupByVendor"; } else { sqlName = "Invoice_Query_Finance"; if (!string.IsNullOrEmpty(filter.PagingInfo.SortBy)) { orderStr = filter.PagingInfo.SortBy; } } CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig(sqlName); using (DynamicQuerySqlBuilder sb = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, HelpDA.ToPagingInfo(filter.PagingInfo), orderStr)) { cmd.CommandText = sb.BuildQuerySql(); if (filter.IsGroupByVendor == true) { AddFinanceParametersGroupByVendor(cmd, filter); } else { AddFinanceParameters(filter, cmd); } //合计已到应付总额 cmd.AddOutParameter("@TotalPayableAmt", DbType.Double, 12); DataTable dt = cmd.ExecuteDataTable(); totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); var totalPayableAmtParam = cmd.GetParameterValue("@TotalPayableAmt"); if (totalPayableAmtParam != DBNull.Value) { totalPayAmt = Convert.ToDouble(totalPayableAmtParam); } else { totalPayAmt = 0.0; } return(dt); } }
public DataTable FinanceQuery(FinanceQueryFilter filter, out int totalCount, out double totalPayAmt) { string sqlName = string.Empty; string orderStr = "SysNo DESC"; if (filter.IsGroupByVendor == true) { sqlName = "Invoice_Query_FinanceGroupByVendor"; } else { sqlName = "Invoice_Query_Finance"; if (!string.IsNullOrEmpty(filter.PagingInfo.SortBy)) { orderStr = filter.PagingInfo.SortBy; } } CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig(sqlName); using (DynamicQuerySqlBuilder sb = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, HelpDA.ToPagingInfo(filter.PagingInfo), orderStr)) { cmd.CommandText = sb.BuildQuerySql(); if (filter.IsGroupByVendor == true) { AddFinanceParametersGroupByVendor(cmd, filter); } else { AddFinanceParameters(filter, cmd); } //合计已到应付总额 cmd.AddOutParameter("@TotalPayableAmt", DbType.Double, 12); DataTable dt = cmd.ExecuteDataTable(); EnumColumnList enumColList = new EnumColumnList(); CodeNamePairColumnList codeNameColList = new CodeNamePairColumnList(); if (filter.IsGroupByVendor == false || filter.IsGroupByVendor == null) { enumColList.Add("AuditStatus", typeof(PayableAuditStatus)); //codeNameColList.Add("OrderType", "Invoice", "OrderType"); enumColList.Add("OrderType", typeof(PayableOrderType)); //codeNameColList.Add("OrderStatus", "Invoice", "OrderStatus"); codeNameColList.Add("InvoiceStatus", "Invoice", "InvoiceStatus"); codeNameColList.Add("IsConsign", "Invoice", "VendorType"); } else { codeNameColList.Add("IsConsign", "Invoice", "VendorType"); } cmd.ConvertColumn(dt, enumColList, codeNameColList); totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); var totalPayableAmtParam = cmd.GetParameterValue("@TotalPayableAmt"); if (totalPayableAmtParam != DBNull.Value) { totalPayAmt = Convert.ToDouble(totalPayableAmtParam); } else { totalPayAmt = 0.0; } return(dt); } }