123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data.SqlClient;
- using System.Data;
- using System.Runtime.InteropServices;
- namespace DAL
- {
- /// <summary>
- /// 付款信息数据访问类
- /// </summary>
- public class CreditCardPaymentService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<CreditCardPayment> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<CreditCardPayment>.excuteSql(new CreditCardPayment(), "CreditCardPayment", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- CreditCardPayment excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<CreditCardPayment> ccpList = excuteSql(sql, param);
- //判断集合是否为空
- if (ccpList == null || ccpList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return ccpList[0];
- }
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public CreditCardPayment GetCreditCardPaymentByID(int id, int ispay)
- {
- string sql = "select * from CreditCardPayment where Id = @id and isdel=0";
- //ispay=2为不查询ispay
- if (ispay != 2)
- {
- sql = sql + " and isPay=" + ispay;
- }
- //调用获取单个对象的方法
- return excuteType(sql, new SqlParameter("@id", id));
- }
- /// <summary>
- /// 根据编号CId,Ctable查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public CreditCardPayment GetCreditCardPaymentByCid(int cid,int cTable)
- {
- string sql = "select * from CreditCardPayment where cid = @cid and cTable=" + cTable;
-
- //调用获取单个对象的方法
- return excuteType(sql, new SqlParameter("@cid", cid));
- }
- /// <summary>
- /// 根据ID集合查询数据
- /// </summary>
- /// <param name="idlist"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetByIdList(string idlist)
- {
- //调用获取单个对象的方法
- return excuteSql("select * from CreditCardPayment where Isdel=0 and Id in (" + idlist + ")");
- }
- /// <summary>
- /// 根据查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者单个对象信息</returns>
- public CreditCardPayment GetCreditCardPaymentByCIDAndDIIDAndCTable(int cid, int diid, int ctable)
- {
- //调用获取单个对象的方法
- return excuteType("select * from CreditCardPayment where CId = @CId and DIId = @DIId and CTable = @CTable", new SqlParameter("@CId", cid), new SqlParameter("@DIId", diid), new SqlParameter("@CTable", ctable));
- }
- /// <summary>
- /// 查询ctable中的cid
- /// </summary>
- /// <param name="cids">cid集合</param>
- /// <param name="ctable">ctable</param>
- /// <returns></returns>
- public List<CreditCardPayment> GetCreditCardPaymentByCIDSAndCTable(List<int> cids , int ctable)
- {
- string sql = $@"select * from CreditCardPayment
- where isdel = 0 and cid in ({string.Join(",",cids).TrimEnd(',')}) and ctable = {ctable} ";
- return excuteSql(sql);
- }
- /// <summary>
- /// 查询对象集合
- /// </summary>
- /// <param name="CTable">标识</param>
- /// <param name="DIID">团组主键编号</param>
- /// <returns></returns>
- public List<CreditCardPayment> GetByInCTableAndDIID(string CTable, int DIID)
- {
- return excuteSql("select * from CreditCardPayment where isdel=0 and CTable in (" + CTable + ") and DIID = " + DIID + "");
- }
- /// <summary>
- /// 新增
- /// </summary>
- /// <param name="sdt">对象</param>
- public bool AddCreditCardPayment(CreditCardPayment ccp)
- {
- string sql = "insert into CreditCardPayment values(@PayDId,@ConsumptionPatterns,@ConsumptionDate,@CTDId,@BankNo,@CardholderName,@PayMoney,@PaymentCurrency,@DayRate,@CompanyBankNo,@OtherBankName,@OtherSideNo,@OtherSideName,@Remark,@Operator,@OperatorDate,@MFOperator,@MFOperatorDate,@IsAuditDM,@AuditDMOperate,@AuditDMDate,@IsAuditMF,@AuditMFOperate,@AuditMFDate,@IsAuditGM,@AuditGMOperate,@AuditGMDate,@IsPay,@DIId,@CId,@CTable,@IsDel,@PayPercentage,@PayThenMoney,@PayPercentageOld,@PayThenMoneyOld,@UpdateDate,@Payee,@RMBPrice,@OrbitalPrivateTransfer,@ExceedBudget,@IsMatchCreditCard)";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@PayDId",ccp.PayDId),
- new SqlParameter("@ConsumptionPatterns",ccp.ConsumptionPatterns),
- new SqlParameter("@ConsumptionDate",ccp.ConsumptionDate),
- new SqlParameter("@CTDId",ccp.CTDId),
- new SqlParameter("@BankNo",ccp.BankNo),
- new SqlParameter("@CardholderName",ccp.CardholderName),
- new SqlParameter("@PayMoney",ccp.PayMoney),
- new SqlParameter("@PaymentCurrency",ccp.PaymentCurrency),
- new SqlParameter("@DayRate",ccp.DayRate),
- new SqlParameter("@CompanyBankNo",ccp.CompanyBankNo),
- new SqlParameter("@OtherBankName",ccp.OtherBankName),
- new SqlParameter("@OtherSideNo",ccp.OtherSideNo),
- new SqlParameter("@OtherSideName",ccp.OtherSideName),
- new SqlParameter("@Remark",ccp.Remark),
- new SqlParameter("@Operator",ccp.Operators),
- new SqlParameter("@OperatorDate",ccp.OperatorsDate),
- new SqlParameter("@MFOperator",ccp.MFOperators),
- new SqlParameter("@MFOperatorDate",ccp.MFOperatorsDate),
- new SqlParameter("@IsAuditDM",ccp.IsAuditDM),
- new SqlParameter("@AuditDMOperate",ccp.AuditDMOperate),
- new SqlParameter("@AuditDMDate",ccp.AuditDMDate),
- new SqlParameter("@IsAuditMF",ccp.IsAuditMF),
- new SqlParameter("@AuditMFOperate",ccp.AuditMFOperate),
- new SqlParameter("@AuditMFDate",ccp.AuditMFDate),
- new SqlParameter("@IsAuditGM",ccp.IsAuditGM),
- new SqlParameter("@AuditGMOperate",ccp.AuditGMOperate),
- new SqlParameter("@AuditGMDate",ccp.AuditGMDate),
- new SqlParameter("@IsPay",ccp.IsPay),
- new SqlParameter("@DIId",ccp.DIId),
- new SqlParameter("@CId",ccp.CId),
- new SqlParameter("@CTable",ccp.CTable),
- new SqlParameter("@IsDel",ccp.IsDel),
- new SqlParameter("@PayPercentage",ccp.PayPercentage),
- new SqlParameter("@PayThenMoney",ccp.PayThenMoney),
- new SqlParameter("@PayPercentageOld",ccp.PayPercentage),
- new SqlParameter("@PayThenMoneyOld",ccp.PayThenMoney),
- new SqlParameter("@UpdateDate",ccp.UpdateDate),
- new SqlParameter("@Payee",ccp.Payee),
- new SqlParameter("@RMBPrice",ccp.RMBPrice),
- new SqlParameter("@OrbitalPrivateTransfer",ccp.OrbitalPrivateTransfer),
- new SqlParameter("@ExceedBudget",ccp.ExceedBudget),
- new SqlParameter("@IsMatchCreditCard","0")
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="sdt">对象</param>
- public bool EditCreditCardPayment(CreditCardPayment ccp)
- {
- string sql = "update CreditCardPayment set PayThenMoneyOld=PayThenMoney,PayPercentageOld=PayPercentage,UpdateDate=OperatorDate,PayDId = @PayDId,ConsumptionPatterns = @ConsumptionPatterns,ConsumptionDate = @ConsumptionDate,CTDId = @CTDId,BankNo = @BankNo,CardholderName=@CardholderName,PayMoney=@PayMoney,PaymentCurrency = @PaymentCurrency,DayRate = @DayRate,CompanyBankNo = @CompanyBankNo,OtherBankName = @OtherBankName,OtherSideNo = @OtherSideNo,OtherSideName = @OtherSideName,Remark = @Remark,Operator = @Operator,OperatorDate = @OperatorDate,PayPercentage = @PayPercentage,PayThenMoney = @PayThenMoney,IsAuditGM = 0,AuditGMOperate=0,AuditGMDate='',Payee=@Payee,RMBPrice=@RMBPrice,OrbitalPrivateTransfer=@OrbitalPrivateTransfer,ExceedBudget=@ExceedBudget where DIId = @DIId and CId = @CId and ID = @ID";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@PayDId",ccp.PayDId),
- new SqlParameter("@ConsumptionPatterns",ccp.ConsumptionPatterns),
- new SqlParameter("@ConsumptionDate",ccp.ConsumptionDate),
- new SqlParameter("@CTDId",ccp.CTDId),
- new SqlParameter("@BankNo",ccp.BankNo),
- new SqlParameter("@CardholderName",ccp.CardholderName),
- new SqlParameter("@PayMoney",ccp.PayMoney),
- new SqlParameter("@PaymentCurrency",ccp.PaymentCurrency),
- new SqlParameter("@DayRate",ccp.DayRate),
- new SqlParameter("@CompanyBankNo",ccp.CompanyBankNo),
- new SqlParameter("@OtherBankName",ccp.OtherBankName),
- new SqlParameter("@OtherSideNo",ccp.OtherSideNo),
- new SqlParameter("@OtherSideName",ccp.OtherSideName),
- new SqlParameter("@Remark",ccp.Remark),
- new SqlParameter("@Operator",ccp.Operators),
- new SqlParameter("@OperatorDate",ccp.OperatorsDate),
- new SqlParameter("@PayPercentage",ccp.PayPercentage),
- new SqlParameter("@PayThenMoney",ccp.PayThenMoney),
- new SqlParameter("@DIId",ccp.DIId),
- new SqlParameter("@CId",ccp.CId),
- new SqlParameter("@Payee",ccp.Payee),
- new SqlParameter("@RMBPrice",ccp.RMBPrice),
- new SqlParameter("@OrbitalPrivateTransfer",ccp.OrbitalPrivateTransfer),
- new SqlParameter("@ExceedBudget",ccp.ExceedBudget),
- new SqlParameter("@Id",ccp.Id)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- public bool EditCreditCardPaymentByHotelID(CreditCardPayment ccp)
- {
- string sql = "update CreditCardPayment set PayMoney=@PayMoney,PaymentCurrency=@PaymentCurrency,DayRate=@DayRate,Operator=@Operator,OperatorDate=@OperatorDate,PayThenMoney=@PayThenMoney,PayThenMoneyOld=@PayThenMoneyOld,RMBPrice=@RMBPrice, IsAuditGM = @IsAuditGM,AuditGMDate=@AuditGMDate where Id = @Id ";
- SqlParameter[] parameter = new SqlParameter[]{
-
- new SqlParameter("@PayMoney",ccp.PayMoney),
- new SqlParameter("@PaymentCurrency",ccp.PaymentCurrency),
- new SqlParameter("@DayRate",ccp.DayRate),
- new SqlParameter("@Operator",ccp.Operators),
- new SqlParameter("@OperatorDate",ccp.OperatorsDate),
- new SqlParameter("@PayThenMoney",ccp.PayThenMoney),
- new SqlParameter("@PayThenMoneyOld",ccp.PayThenMoneyOld),
- new SqlParameter("@RMBPrice",ccp.RMBPrice),
- new SqlParameter("@IsAuditGM",ccp.IsAuditGM),
- new SqlParameter("@AuditGMDate",ccp.AuditGMDate),
- new SqlParameter("@Id",ccp.Id)
-
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="sdt">对象</param>
- public bool EditCreditCardPaymentByID(CreditCardPayment ccp)
- {
- string sql = "update CreditCardPayment set PayDId = @PayDId,ConsumptionPatterns = @ConsumptionPatterns,ConsumptionDate = @ConsumptionDate,CTDId = @CTDId,BankNo = @BankNo,CardholderName=@CardholderName,PayMoney=@PayMoney,PaymentCurrency = @PaymentCurrency,DayRate = @DayRate,CompanyBankNo = @CompanyBankNo,OtherBankName = @OtherBankName,OtherSideNo = @OtherSideNo,OtherSideName = @OtherSideName,Remark = @Remark,Operator = @Operator,OperatorDate = @OperatorDate,IsPay = 1 where Id = @Id";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@PayDId",ccp.PayDId),
- new SqlParameter("@ConsumptionPatterns",ccp.ConsumptionPatterns),
- new SqlParameter("@ConsumptionDate",ccp.ConsumptionDate),
- new SqlParameter("@CTDId",ccp.CTDId),
- new SqlParameter("@BankNo",ccp.BankNo),
- new SqlParameter("@CardholderName",ccp.CardholderName),
- new SqlParameter("@PayMoney",ccp.PayMoney),
- new SqlParameter("@PaymentCurrency",ccp.PaymentCurrency),
- new SqlParameter("@DayRate",ccp.DayRate),
- new SqlParameter("@CompanyBankNo",ccp.CompanyBankNo),
- new SqlParameter("@OtherBankName",ccp.OtherBankName),
- new SqlParameter("@OtherSideNo",ccp.OtherSideNo),
- new SqlParameter("@OtherSideName",ccp.OtherSideName),
- new SqlParameter("@Remark",ccp.Remark),
- new SqlParameter("@Operator",ccp.Operators),
- new SqlParameter("@OperatorDate",ccp.OperatorsDate),
- new SqlParameter("@Id",ccp.Id)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 编辑 - 价格、货币、汇率
- /// </summary>
- /// <param name="sdt">对象</param>
- public bool EditCreditCardPaymentByMoneyAndCurrencyAndDayRate(CreditCardPayment ccp)
- {
- string sql = "update CreditCardPayment set PayMoney=@PayMoney,RMBPrice=@RMBPrice,PaymentCurrency = @PaymentCurrency,DayRate = @DayRate,Operator = @Operator,OperatorDate = @OperatorDate ,IsAuditGM = 0,AuditGMOperate=0,AuditGMDate='' where DIId = @DIId and CId = @CId";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@PayMoney",ccp.PayMoney),
- new SqlParameter("@RMBPrice",ccp.RMBPrice),
- new SqlParameter("@PaymentCurrency",ccp.PaymentCurrency),
- new SqlParameter("@DayRate",ccp.DayRate),
- new SqlParameter("@Operator",ccp.Operators),
- new SqlParameter("@OperatorDate",ccp.OperatorsDate),
- new SqlParameter("@DIId",ccp.DIId),
- new SqlParameter("@CId",ccp.CId)
- };
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 更改人民币金额和汇率
- /// </summary>
- /// <param name="list"></param>
- /// <returns></returns>
- public bool EditPayMoneyAndDayRate(int id, string payMoney, string dayRate, string RMBPrice)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set PayMoney = @PayMoney,DayRate = @DayRate,RMBPrice=@RMBPrice where Id = @Id", CommandType.Text, new SqlParameter("@PayMoney", payMoney), new SqlParameter("@DayRate", dayRate), new SqlParameter("@RMBPrice", RMBPrice), new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool DelCreditCardPayment(int cid, int diid)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsDel = 1 where CId = @CId and DIId = @DIId", CommandType.Text, new SqlParameter("@CId", cid), new SqlParameter("DIId", diid)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 更改已付款状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsPay(int cid, int diid)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsPay = 1 where CId = @CId and DIId = @DIId", CommandType.Text, new SqlParameter("@CId", cid), new SqlParameter("DIId", diid)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 更改审核通过状态 2021-01-11
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateAudit(int id, int IsAuditGM, int auditGMOperate, string auditGMDate, float exceedbudget)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsAuditGM = @IsAuditGM,AuditGMOperate = @AuditGMOperate , AuditGMDate = @AuditGMDate ,ExceedBudget=@ExceedBudget where Id = @Id",
- CommandType.Text,
- new SqlParameter("@IsAuditGM", IsAuditGM),
- new SqlParameter("@AuditGMOperate", auditGMOperate),
- new SqlParameter("@AuditGMDate", auditGMDate),
- new SqlParameter("@ExceedBudget", exceedbudget),
- new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 更改审核通过状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsAudit(int id, int auditGMOperate, string auditGMDate)
- {
- //CreditCardPayment ccp = GetCreditCardPaymentByID(id, 0);
- //if (ccp != null)
- // if(ccp.CTable==76 || ccp.CTable==85)
- // UpdateCreditCardPaymentIsPay(id);
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsAuditGM = 1,AuditGMOperate = @AuditGMOperate , AuditGMDate = @AuditGMDate where Id = @Id", CommandType.Text, new SqlParameter("@AuditGMOperate", auditGMOperate), new SqlParameter("@AuditGMDate", auditGMDate), new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- public bool UpdateCreditCardPaymentIsAuditMF(int id, int AuditMFOperate, string AuditMFDate)
- {
- //CreditCardPayment ccp = GetCreditCardPaymentByID(id, 0);
- //if (ccp != null)
- // if(ccp.CTable==76 || ccp.CTable==85)
- // UpdateCreditCardPaymentIsPay(id);
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsAuditMF = 1,AuditMFOperate = @AuditMFOperate , AuditMFDate = @AuditMFDate where Id = @Id", CommandType.Text, new SqlParameter("@AuditMFOperate", AuditMFOperate), new SqlParameter("@AuditMFDate", AuditMFDate)
- , new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 审核不通过
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsReAudit(int id, int auditGMOperate, string auditGMDate)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsAuditGM = 3,AuditGMOperate = @AuditGMOperate , AuditGMDate = @AuditGMDate where Id = @Id", CommandType.Text, new SqlParameter("@AuditGMOperate", auditGMOperate), new SqlParameter("@AuditGMDate", auditGMDate), new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- public List<CreditCardPayment> GetCreditCardPaymentByCTableAndIsPay(int CTable, int IsPay)
- {
- //调用获取单个对象的方法
- return excuteSql("select * from creditCardPayment where IsDel = 0 and CTable = @CTable and IsPay = @IsPay", new SqlParameter("@CTable", CTable), new SqlParameter("@IsPay", IsPay));
- }
- /// <summary>
- /// 根据类别和支付状态查询信用卡表数据
- /// 分页
- /// 20210910 贾文滔
- /// </summary>
- /// <param name="CTable"></param>
- /// <param name="IsPay"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetDataByCTableAndIsPay(int pageIndex, out int sumPage, out int totalRecord, int CTable, int IsPay)
- {
- string sqlwhere = "Isdel=0 and CTable=" + CTable+ " and IsPay=" + IsPay;
- return PageBase<CreditCardPayment>.excutePageSql(new CreditCardPayment(), "CreditCardPayment", "CreditCardPayment", "*", "id desc", sqlwhere, 20, pageIndex, out sumPage, out totalRecord);
- }
- /// <summary>
- /// 经理审核
- /// </summary>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPListByDIID(string diid, int isAuditGM)
- {
- return excuteSql("select * from creditCardPayment where diid = " + diid + " and IsAuditGM = " + isAuditGM + " and isDel = 0 and Operator > 0 and Operator is not null");
- }
- /// <summary>
- /// 更改审核通过状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsAuditByNo(int id, int auditGMOperate, string auditGMDate)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsAuditGM = 2,AuditGMOperate = @AuditGMOperate , AuditGMDate = @AuditGMDate where Id = @Id", CommandType.Text, new SqlParameter("@AuditGMOperate", auditGMOperate), new SqlParameter("@AuditGMDate", auditGMDate), new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 查询付款集合
- /// </summary>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPIsPayListByDIID(string diid, int isPay)
- {
- return excuteSql("select * from creditCardPayment where diid = " + diid + " and IsPay = " + isPay + " and IsAuditGM = 1");
- }
- /// <summary>
- /// 付款申请书 - 旧版2016-05-10
- /// </summary>
- /// <returns></returns>
- //public List<CreditCardPayment> GetOPIsPaymentApplicationReport(string startTime,string endTime)
- //{
- // return excuteSql("select * from creditCardPayment where isDel = 0 and IsPay = 0 and IsAuditGM = 1 and (auditGMDate between '" + startTime + "' and '" + endTime + "')");
- //}
- /// <summary>
- /// 付款申请书
- /// </summary>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPIsPaymentApplicationReport(string startTime, string endTime)
- {
- return excuteSql("select * from creditCardPayment where isDel = 0 and IsPay = 0 and IsAuditGM = 1 and (auditGMDate between '" + startTime + "' and '" + endTime + "')");
- }
- /// <summary>
- /// 更改已付款状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsPay(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsPay = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 更改已付款状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsPay(int id, string DayRate, string RMBPrice)
- {
- string sql = "update CreditCardPayment set IsPay = 1";
- if (DayRate != "")
- {
- sql = sql + " ,DayRate=" + DayRate;
- }
- if (RMBPrice != "")
- sql = sql + " ,RMBPrice=" + RMBPrice;
- sql = sql + " where id=@Id";
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 修改信用卡匹配状态
- /// </summary>
- /// <param name="id"></param>
- /// <param name="IsMatchCreditCard"></param>
- /// <returns></returns>
- public bool UpdateCreditCardPaymentIsMatchCreditCard(string[] ids, int IsMatchCreditCard = 1)
- {
- if (ids != null && ids.Length > 0)
- {
- string sql = $"update CreditCardPayment set IsMatchCreditCard = {IsMatchCreditCard} where isdel = 0 and id in ({string.Join(",", ids).TrimEnd(',')})";
- if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text) > 0)
- return true;
- }
- return false;
- }
- /// <summary>
- /// 获取团组总费用
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public double GetSumByDIID(int diid)
- {
- Object obj = SqlHelper.ExecuteScalar("select sum(PayMoney) from CreditCardPayment where diid = " + diid + " and isDel = 0 and isPay = 1", CommandType.Text);
- if (obj == null || string.IsNullOrEmpty(obj.ToString()))
- {
- return 0.0;
- }
- else
- {
- return (double)(obj);
- }
- }
- public decimal GetRBMSumByDiid(int diid)
- {
- Object obj = SqlHelper.ExecuteScalar("select SUM(RMBPrice) from CreditCardPayment where diid = " + diid + " and isDel = 0 and isPay = 1", CommandType.Text);
- if (obj == null || string.IsNullOrEmpty(obj.ToString()))
- {
- return 0.00M;
- }
- else
- {
- return Convert.ToDecimal(obj);
- }
- }
- /// <summary>
- /// 根据团组业务类型获取收款方
- /// </summary>
- /// <param name="Ctable">团组业务类型</param>
- /// <returns></returns>
- public List<string> GetPayee(int Ctable, string payee)
- {
- List<string> List = new List<string>();
- using (SqlDataReader dr = SqlHelper.ExcuteReader("select Distinct(payee) from CreditCardPayment where CTable = " + Ctable + " AND Ispay=1 and Isdel=0 and payee like '%" + payee + "%' ", CommandType.Text))
- {
- if (dr != null)
- {
- string str = "";
- while (dr.Read())
- {
- str = dr["payee"].ToString();
- List.Add(str);
- }
- }
- }
- return List;
- }
- /// <summary>
- /// 获取非团组总费用
- /// </summary>
- /// <param name="p"></param>
- /// <returns></returns>
- public double GetSumOfNotTeamByDIID(int diid)
- {
- return (double)(SqlHelper.ExecuteScalar("select sum(PayMoney) from CreditCardPayment where diid <> " + diid + "", CommandType.Text));
- }
- /// <summary>
- /// 更改团组是否操作完成状态
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public bool EditCreditCardPaymentByDiid(int id)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set IsSure = 1,SureTime=" + DateTime.Now + " where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据信用卡账单修改酒店付款金额
- /// </summary>
- /// <param name="diid"></param>
- /// <param name="hotelName"></param>
- public bool UpdateCreditCardPaymentMoney(int diid, string hotelName, int payMoney)
- {
- if (SqlHelper.ExecuteNonQuery("update T set T.PayThenMoneyOld=T.PayThenMoney,T.UpdateDate=T.OperatorDate,T.paymoney = " + payMoney + " from CreditCardPayment T inner join HotelReservations H on T.diid=H.diid where T.diid=" + diid + " and h.isdel=0 and t.isdel=0 and t.CTABLE = 76 and t.cid = h.id and h.hotelName ='" + hotelName + "'", CommandType.Text, null) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据信用卡账单修改机票付款金额
- /// </summary>
- /// <param name="diid"></param>
- /// <param name="p"></param>
- public bool UpdateCreditCardPaymentMoneyForAirTick(int diid, int payMoney)
- {
- if (SqlHelper.ExecuteNonQuery("update CreditCardPayment set PayThenMoneyOld=paymoney,UpdateDate=OperatorDate,paymoney = " + payMoney + " where diid=" + diid + " and ctable=85 and isdel=0", CommandType.Text, null) > 0)
- return true;
- return false;
- }
- /// <summary>
- /// 根据团组编号查询该团组的付款信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPIsPayListByDIID(int diid, int ispay)
- {
- string sql = "select * from creditCardPayment where diid = " + diid + " and isdel=0 and IsAuditGM=1";
- if (ispay != 2)
- sql += " and ispay=" + ispay;
- return excuteSql(sql);
- }
- /// <summary>
- /// 根据团组编号查询该团组的付款信息 notIsPsy
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetByDIIDNotIsPay(int diid)
- {
- string sql = "select * from creditCardPayment where diid = " + diid + " and isdel = 0 and IsAuditGM <> 2 ";
- return excuteSql(sql);
- }
- /// <summary>
- /// 根据团组编号查询该团组的付款信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetListByDIID(int diid)
- {
- string sql = "select * from creditCardPayment where diid = " + diid + " and isdel = 0 and isPay = 1";
-
- return excuteSql(sql);
- }
- /// <summary>
- /// 根据团组编号查询该团组的付款信息
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public List<CreditCardPayment> GetListByID(int id)
- {
- string sql = "select * from creditCardPayment where id = " + id + " and isdel=0";
- return excuteSql(sql);
- }
- /// <summary>
- /// 查询团组所有的付款信息
- /// </summary>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPListByDIID(string diid, string startTime, string endTime)
- {
- return excuteSql("select * from creditCardPayment where diid = " + diid + " and isDel = 0 and VisitDate between '" + startTime + "' and '" + endTime + "'");
- }
- /// <summary>
- /// 经理审核
- /// </summary>
- /// <returns></returns>
- public List<CreditCardPayment> GetOPListByDIID(int isAuditGM)
- {
- return excuteSql("select * from creditCardPayment where IsPay = 0 and IsAuditGM = " + isAuditGM + " and isDel = 0");
- }
- /// <summary>
- /// 根据条件查询条件获取 - 分页
- /// </summary>
- /// <param name="pageIndex"></param>
- /// <param name="sumPage"></param>
- /// <param name="totalRecord"></param>
- /// <param name="dataType"></param>
- /// <param name="name"></param>
- /// <returns></returns>
- public DataTable GetAll(int pageIndex, int pageSize, out int sumPage, out int totalRecord, int isAuditGM, string teamName, string tourCode, string clientName, string clientUnit)
- {
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@pageIndex",pageIndex),
- new SqlParameter("@pageSize",pageSize),
- new SqlParameter("@isAuditGM",isAuditGM),
- new SqlParameter("@teamName",teamName),
- new SqlParameter("@tourCode",tourCode),
- new SqlParameter("@clientName",clientName),
- new SqlParameter("@clientUnit",clientUnit)
- };
- SqlParameter[] parameter1 = new SqlParameter[]{
- new SqlParameter("@isAuditGM",isAuditGM),
- new SqlParameter("@teamName",teamName),
- new SqlParameter("@tourCode",tourCode),
- new SqlParameter("@clientName",clientName),
- new SqlParameter("@clientUnit",clientUnit)
- };
- string sqlC = "select count(1) from creditCardPayment T join DelegationInfo D on T.diid=D.id join setData S on T.Cid=S.ID join setData S1 on T.CTable=S1.ID where T.isdel=0 and isAuditGM=@isAuditGM and TeamName like '%" + teamName + "%' and TourCode like '%" + tourCode + "%' and ClientName like '%" + clientName + "%' and clientUnit like '%" + clientUnit + "%'";
- object result = SqlHelper.ExecuteScalar(sqlC, CommandType.Text, parameter1);
- if (result != null)
- {
- totalRecord = Convert.ToInt32(result.ToString());
- //计算出总页数
- sumPage = totalRecord % 10 == 0 ? totalRecord / 10 : totalRecord / 10 + 1;
- }
- else
- {
- totalRecord = 0;
- //计算出总页数
- sumPage = 1;
- }
- return SqlHelper.TransferProcedure("exec_creditCardPayment", CommandType.StoredProcedure, parameter);
- }
- //签证费用审核过不能删除
- public bool isAduitByaVisa(int diid, int cid)
- {
- string sql = "select * from creditCardPayment WHERE DIId= @diid AND CId=@cid AND (IsAuditDM=1 OR IsAuditGM = 1 OR IsAuditMF = 1)";
- SqlParameter[] parameter = new SqlParameter[]{
- new SqlParameter("@diid",diid),
- new SqlParameter("@cid",cid)
- };
- object result = SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter);
- if (result != null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// 获取全部 - 分页 + 条件
- /// </summary>
- /// <param name="pageIndex">分页当前页数</param>
- /// <param name="sumPage">分页总页数</param>
- /// <param name="totalRecord">一共多少条数据</param>
- /// <param name="TypeId">信用卡类型</param>
- /// <param name="dateType">日期类型</param>
- /// <param name="startTime">开始时间</param>
- /// <param name="endTime">结束时间</param>
- /// <param name="HandlersOper">经手人</param>
- /// <returns></returns>
- public List<CreditCardPayment> GetALL(int pageIndex, out int sumPage, out int totalRecord, int TypeId, int dateType, string startTime, string endTime, string HandlersOper)
- {
- //消费类型 不匹配 财付通,京东,微信支付,淘宝
- string sqlwhere = "charindex('财付通',ConsumptionPatterns) = 0 " +
- "and charindex('京东',ConsumptionPatterns) = 0 " +
- "and charindex('微信支付',ConsumptionPatterns) = 0 " +
- "and charindex('淘宝',ConsumptionPatterns) = 0 ";
- //信用卡类型
- if (TypeId == 0)
- sqlwhere += " and IsDel = 0 and CTDId != 0 ";
- else
- sqlwhere += " and IsDel = 0 and CTDId != 0 and CTDId =" + TypeId;
- //时间类型
- if (dateType == 0 && startTime != "")
- {
- if (endTime != "")
- sqlwhere += " and ConsumptionDate between '" + startTime + "' and '" + endTime + "'";
- else
- {
- endTime = DateTime.Now.ToString("yyyy-MM-dd");
- sqlwhere += " and ConsumptionDate between '" + startTime + "' and '" + endTime + "'";
- }
- }
- else if (dateType == 1 && startTime != "")
- {
- if (endTime != "")
- sqlwhere += " and MFOperatorsDate between '" + startTime + "' and '" + endTime + "'";
- else
- {
- endTime = DateTime.Now.ToString("yyyy-MM-dd");
- sqlwhere += " and MFOperatorsDate between '" + startTime + "' and '" + endTime + "'";
- }
- }
- //经手人
- if (HandlersOper != "")
- sqlwhere += " and Operator=" + HandlersOper;
- return PageBase<CreditCardPayment>.excutePageSql(new CreditCardPayment(), "CreditCardPayment", "CreditCardPayment", "*", "id desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
- }
- public List<CreditCardPayment> GetALL(string OperType,int size ,int page,out int total,string Queryname,string groupName)
- {
- string QuerySql = string.Empty;
- string sql = $"select top {size} * from creditCardPayment where isdel = 0 and Operator > 0 and Operator is not null ";
- total = 0 ;
- if (!string.IsNullOrWhiteSpace(Queryname))
- {
- UsersService usersService = new UsersService();
- var queryUserId = usersService.GetAll().FindAll(x => x.CnName.Contains(Queryname)).Select(x => x.Id);
- if (queryUserId.Count() > 0)
- {
- QuerySql += $" and Operator in ({string.Join(",", queryUserId).TrimEnd(',')}) ";
- }
- else
- {
- QuerySql += $" and Operator in (0) ";
- }
- }
- if (!string.IsNullOrWhiteSpace(groupName))
- {
- DelegationInfoService Dele = new DelegationInfoService();
- var deleId = Dele.getByName(groupName).Select(x => x.Id);
- if (deleId.Count() > 0)
- {
- QuerySql += $" and DIId in ({string.Join(",", deleId).TrimEnd(',')}) ";
- }
- else
- {
- QuerySql += $" and DIId in (0) ";
- }
- }
- sql += QuerySql;
- if (OperType == "finance")
- {
- sql += $@" and IsAuditMF = 0 and IsAuditGM = 0 and Id not in (
- select top {(page-1)*size} Id from creditCardPayment where isdel = 0 and Operator > 0 and Operator is not null
- and IsAuditMF = 0 and IsAuditGM = 0 {QuerySql}
- order by DIId desc
- )";
- total = (int)SqlHelper.ExecuteScalar($@"select count(*) from creditCardPayment where isdel = 0 and Operator > 0
- and Operator is not null and IsAuditMF = 0 and IsAuditGM = 0 " + QuerySql, CommandType.Text);
- }
- else if (OperType == "GM")
- {
- sql += $@" and IsAuditMF = 1 and IsAuditGM = 0 and Id not in (
- select top {(page - 1) * size} Id from creditCardPayment where isdel = 0 and Operator > 0 and Operator is not null
- and IsAuditMF = 1 and IsAuditGM = 0 {QuerySql}
- order by DIId desc
- )";
- total = (int)SqlHelper.ExecuteScalar($@"select count(*) from creditCardPayment where isdel = 0 and Operator > 0
- and Operator is not null and IsAuditMF = 1 and IsAuditGM = 0 " + QuerySql, CommandType.Text);
- }
- sql += " order by DIId desc ";
- return excuteSql(sql);
- }
- /// <summary>
- /// excel导出查询
- /// </summary>
- /// <param name="TypeId">信用卡类型</param>
- /// <param name="startTime">开始时间</param>
- /// <param name="endTime">结束时间</param>
- /// <returns></returns>
- public List<CreditCardPayment> GetDownExcelSelelct(int TypeId, string startTime, string endTime)
- {
- string sqlwhere = "select * from creditCardPayment where ";
- //信用卡类型
- if (TypeId == 0)
- sqlwhere += "IsDel = 0 and CTDId != 0 ";
- else
- sqlwhere += "IsDel = 0 and CTDId != 0 and CTDId =" + TypeId;
- sqlwhere += " and ConsumptionDate between '" + startTime + "' and '" + endTime + "'";
- return excuteSql(sqlwhere);
- }
- }
- }
|