123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data.SqlClient;
- using System.Data;
- namespace DAL
- {
- /// <summary>
- /// 应收款项报表数据访问类
- /// </summary>
- public class ViewDelegationInfoAndForeignReceivablesService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<ViewDelegationInfoAndForeignReceivables> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<ViewDelegationInfoAndForeignReceivables>.excuteSql(new ViewDelegationInfoAndForeignReceivables(), "ViewDelegationInfoAndForeignReceivables", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- ViewDelegationInfoAndForeignReceivables excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<ViewDelegationInfoAndForeignReceivables> adList = excuteSql(sql, param);
- //判断集合是否为空
- if (adList == null || adList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return adList[0];
- }
- /// <summary>
- /// 根据出访日期获取数据集合
- /// </summary>
- /// <param name="userNumber"></param>
- /// <param name="swipeDate"></param>
- /// <returns></returns>
- public List<ViewDelegationInfoAndForeignReceivables> GetByTime(string startTime, string endTime)
- {
- //return excuteSql("select distinct fr.diid,di.TeamName,di.ClientUnit,di.VisitDate from ForeignReceivables fr join DelegationInfo di on fr.DIID = di.id where di.VisitDate between '" + startTime + "' and '" + endTime + "' and issure=1 and di.isdel=0 ");
- return excuteSql("select distinct fr.diid,di.TeamName,di.ClientUnit,di.VisitDate from ForeignReceivables fr join DelegationInfo di on fr.DIID = di.id where di.VisitDate between '" + startTime + "' and '" + endTime + "' and di.isdel=0 order by di.VisitDate asc");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="startTime"></param>
- /// <param name="endTime"></param>
- /// <param name="Type">(团组收入,会务收入,赛事项目收入,其他非团组收入)</param>
- /// <returns></returns>
- public List<ViewDelegationInfoAndForeignReceivables> GetByTimeAndType(string startTime, string endTime,string Type)
- {
- string sql = string.Empty;
- switch (Type)
- {
- case "团组收入":
- sql = $@"select distinct a.Id as diid,a.TeamName,a.ClientUnit,a.VisitDate from DelegationInfo a,SetData b ,ForeignReceivables c
- where a.TeamDid = b.Id and a.Id = c.DIId and b.id in(38,39,40)
- and a.VisitDate between '{startTime}' and '{endTime}' and a.IsDel = 0 ";
- break;
- case "会务收入":
- sql = $@"select distinct a.Id as diid,a.TeamName,a.ClientUnit,a.VisitDate from DelegationInfo a,SetData b ,ForeignReceivables c
- where a.TeamDid = b.Id and a.Id = c.DIId and b.id in(691)
- and a.VisitDate between '{startTime}' and '{endTime}' and a.IsDel = 0 ";
- break;
- case "赛事项目收入":
- sql = $@" select distinct a.Id as diid,a.TeamName,a.ClientUnit,a.VisitDate from DelegationInfo a,SetData b ,ForeignReceivables c
- where a.TeamDid = b.Id and a.Id = c.DIId and b.id in(762)
- and a.VisitDate between '{startTime}' and '{endTime}' and a.IsDel = 0 ";
- break;
- case "其他非团组收入":
- sql = $@" select distinct a.Id as diid,a.TeamName,a.ClientUnit,a.VisitDate from DelegationInfo a,SetData b ,ForeignReceivables c
- where a.TeamDid = b.Id and a.Id = c.DIId and b.id not in(762,691,38,39,40)
- and a.VisitDate between '{startTime}' and '{endTime}' and a.IsDel = 0 ";
- break;
- }
- if (string.IsNullOrEmpty(sql))
- {
- return new List<ViewDelegationInfoAndForeignReceivables>();
- }
- return excuteSql(sql);
- }
- }
- }
|