|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using WebSqlHelper;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.EntityDA
|
|
|
|
|
{
|
|
|
|
|
public class RunFeeSettlementDA
|
|
|
|
|
{
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_GID = "@gid";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_SETTLE_MODE = "@settle_mode";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_CUSTOMER_NAME = "@customer_name";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_SETTLE_TYPE = "@settle_type";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_AMOUNT_RMB = "@amount_rmb";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_ACCOUNT_RMB = "@account_rmb";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_RATE = "@rate";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_AMOUNT_USD = "@amount_usd";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_ACCOUNT_USD = "@account_usd";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_BILL_TYPE = "@bill_type";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_VOUCHER_NO = "@voucher_no";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_IS_EXPORT = "@is_export";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_FINANCIAL_VOUCHER = "@financial_voucher";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_BILL_STATUS = "@bill_status";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_REMARK = "@remark";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_TYPE = "@type";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_CREATE_USER = "@create_user";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_CREATE_TIME = "@create_time";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_PAYABLE_TIME = "@payable_time";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_COMPANY_ID = "@company_id";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO = "@cheque_no";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO_USD = "@cheque_no_usd";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_MODIFIED_USER = "@modified_user";
|
|
|
|
|
private const string PARM_RUN_FEE_SETTLEMENT_MODIFIED_TIME = "@modified_time";
|
|
|
|
|
//ch_fee_do
|
|
|
|
|
private const string PARM_RUN_FEE_DO_GID = "@gid";
|
|
|
|
|
private const string PARM_RUN_FEE_DO_BILL_NO = "@bill_no";
|
|
|
|
|
private const string PARM_RUN_FEE_DO_IS_DELETE = "@is_delete";
|
|
|
|
|
private const string PARM_RUN_FEE_DO_DELETE_USER = "@delete_user";
|
|
|
|
|
private const string PARM_RUN_FEE_DO_DELETE_TIME = "@delete_time";
|
|
|
|
|
private const string PARM_RUN_FEE_DO_RUN_SETTLE_ID = "@runsettle_id";
|
|
|
|
|
|
|
|
|
|
private const string SQL_SELECT_RUN_FEE_SETTLEMENT_BY_GID = " SELECT GID, SETTLEMODE, CUSTOMERNAME, SETTLETYPE, AMOUNTRMB, ACCOUNTRMB, RATE, AMOUNTUSD, ACCOUNTUSD, BILLTYPE, VOUCHERNO, "
|
|
|
|
|
+ " ISEXPORT, FINANCIALVOUCHER, BILLSTATUS, REMARK, TYPE, CREATEUSER, CREATETIME, PAYABLETIME, COMPANYID, CHEQUENO,MODIFIEDUSER, MODIFIEDTIME,SERIALNO,CHEQUENOUSD,CHEQUENUMREMARK "
|
|
|
|
|
+ " FROM run_fee_settlement WHERE GID = @gid";
|
|
|
|
|
|
|
|
|
|
private const string SQL_UPDATE_RUN_FEE_SETTLEMENT_BY_GID = " UPDATE run_fee_settlement SET SETTLETYPE = @settle_type,CHEQUENO = @cheque_no,CHEQUENOUSD = @cheque_no_usd,PAYABLETIME = @payable_time,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE(),VOUCHERNO = @voucher_no WHERE GID = @gid ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_UPDATE_RUN_FEE_SETTLEMENT_BY_GID_NO_PAYABLETIME = " UPDATE run_fee_settlement SET SETTLETYPE = @settle_type,CHEQUENO = @cheque_no,CHEQUENOUSD = @cheque_no_usd,MODIFIEDUSER = @modified_user,MODIFIEDTIME = GETDATE(),VOUCHERNO = @voucher_no WHERE GID = @gid ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_DELETE_RUN_FEE_SETTLEMENT_BY_GID = " DELETE FROM run_fee_settlement WHERE GID = @gid ";
|
|
|
|
|
|
|
|
|
|
private const string SQL_DELETE_RUN_FEE_DO_BY_RUNSETTLE_ID = " DELETE FROM run_fee_do WHERE RUNSETTLEID = @runsettle_id ";
|
|
|
|
|
|
|
|
|
|
#region 更新运行结算表信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新运行结算表信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunSettleID">运行结算表GID</param>
|
|
|
|
|
/// <param name="tempSettleType">结算方式</param>
|
|
|
|
|
/// <param name="tempChequeNO">支票抬头</param>
|
|
|
|
|
/// <param name="tempPayableTime">要求支付日期</param>
|
|
|
|
|
/// <param name="tempOperatorID">操作人GID</param>
|
|
|
|
|
/// <returns>值1表示更新成功 值不等于表示更新失败</returns>
|
|
|
|
|
public int UpdateRunSettleByGID(string tempRunSettleID,int tempSettleType,string tempChequeNO,string tempChequeNOUsd,DateTime tempPayableTime,string tempOperatorID,string tempVoucherNO)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (tempPayableTime == DateTime.MinValue)
|
|
|
|
|
{
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_SETTLE_TYPE,SqlDbType.Int),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO,SqlDbType.VarChar,200),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO_USD,SqlDbType.VarChar,200),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_MODIFIED_USER,SqlDbType.VarChar,36),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_GID,SqlDbType.VarChar,36),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_VOUCHER_NO,SqlDbType.VarChar,50)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parms[0].Value = tempSettleType;
|
|
|
|
|
parms[1].Value = tempChequeNO;
|
|
|
|
|
parms[2].Value = tempChequeNOUsd;
|
|
|
|
|
parms[3].Value = tempOperatorID;
|
|
|
|
|
parms[4].Value = tempRunSettleID;
|
|
|
|
|
parms[5].Value = tempVoucherNO;
|
|
|
|
|
|
|
|
|
|
iResult = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, SQL_UPDATE_RUN_FEE_SETTLEMENT_BY_GID_NO_PAYABLETIME, parms);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SqlParameter[] parms = new SqlParameter[]{
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_SETTLE_TYPE,SqlDbType.Int),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO,SqlDbType.VarChar,200),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_CHEQUE_NO_USD,SqlDbType.VarChar,200),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_PAYABLE_TIME,SqlDbType.DateTime),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_MODIFIED_USER,SqlDbType.VarChar,36),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_GID,SqlDbType.VarChar,36),
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_VOUCHER_NO,SqlDbType.VarChar,50)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
parms[0].Value = tempSettleType;
|
|
|
|
|
parms[1].Value = tempChequeNO;
|
|
|
|
|
parms[2].Value = tempChequeNOUsd;
|
|
|
|
|
parms[3].Value = tempOperatorID;
|
|
|
|
|
parms[4].Value = tempRunSettleID;
|
|
|
|
|
parms[5].Value = tempVoucherNO;
|
|
|
|
|
|
|
|
|
|
iResult = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, SQL_UPDATE_RUN_FEE_SETTLEMENT_BY_GID, parms);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception error)
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//更新失败
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 通过惟一主键获取运行费用结算信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过惟一主键获取运行费用结算信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunFeeSettlementID">运行费用结算GID</param>
|
|
|
|
|
/// <returns>返回实体类RunFeeSettlementEntity</returns>
|
|
|
|
|
public RunFeeSettlementEntity GetRunFeeSettlementByGID(string tempRunFeeSettlementID)
|
|
|
|
|
{
|
|
|
|
|
SqlParameter parm = new SqlParameter(PARM_RUN_FEE_SETTLEMENT_GID, SqlDbType.VarChar, 36);
|
|
|
|
|
parm.Value = tempRunFeeSettlementID;
|
|
|
|
|
|
|
|
|
|
RunFeeSettlementEntity runFeeSettlementEntity = null;
|
|
|
|
|
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_RUN_FEE_SETTLEMENT_BY_GID, parm))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
while (sqlRead.Read())
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity = new RunFeeSettlementEntity();
|
|
|
|
|
if (!sqlRead.IsDBNull(0))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.GID = sqlRead.GetString(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(1))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.SettleMode = sqlRead.GetInt32(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(2))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.CustomerName = sqlRead.GetString(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(3))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.SettleType = sqlRead.GetInt32(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(4))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.AmountRMB = sqlRead.GetDecimal(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(5))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.AccountRMB = sqlRead.GetString(5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(6))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.Rate = sqlRead.GetDecimal(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(7))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.AmountUSD = sqlRead.GetDecimal(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(8))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.AccountUSD = sqlRead.GetString(8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(9))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.BillType = sqlRead.GetInt32(9);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(10))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.VoucherNO = sqlRead.GetString(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(11))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.IsExport = sqlRead.GetBoolean(11);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(12))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.FinancialVoucher = sqlRead.GetString(12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(13))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.BillStatus = sqlRead.GetInt32(13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(14))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.Remark = sqlRead.GetString(14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(15))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.Type = sqlRead.GetInt32(15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(16))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.CreateUser = sqlRead.GetString(16);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(17))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.CreateTime = sqlRead.GetDateTime(17);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(18))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.PayableTime = sqlRead.GetDateTime(18);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(19))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.CompanyID = sqlRead.GetString(19);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(20))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.ChequeNo = sqlRead.GetString(20);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(21))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.ModifiedUser = sqlRead.GetString(21);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(22))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.ModifiedTime = sqlRead.GetDateTime(22);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(23))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.SerialNO = sqlRead.GetString(23);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sqlRead.IsDBNull(24))
|
|
|
|
|
{
|
|
|
|
|
runFeeSettlementEntity.ChequeNoUsd = sqlRead.GetString(24);
|
|
|
|
|
}
|
|
|
|
|
if (!sqlRead.IsDBNull(25)) { runFeeSettlementEntity.CHEQUENUMREMARK = sqlRead.GetString(25); }//支票号备注
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return runFeeSettlementEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 通过SQL语句获取数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过SQL语句获取数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strSql">要执行查询的SQL语句</param>
|
|
|
|
|
/// <returns>返回DataSet数据</returns>
|
|
|
|
|
public DataSet GetDataSetBySql(string strSql)
|
|
|
|
|
{
|
|
|
|
|
DataSet dataSet = new DataSet();
|
|
|
|
|
|
|
|
|
|
dataSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
|
|
|
|
|
return dataSet;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除运行结算表和运行结算费用明细表记录
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除运行结算表和运行结算费用明细表记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempRunFeeSettlementID">运行结算表GID</param>
|
|
|
|
|
/// <returns>值1表示删除成功 值不等于1表示删除失败</returns>
|
|
|
|
|
public int DeleteRunFeeSettlementByGID(string tempRunFeeSettlementID)
|
|
|
|
|
{
|
|
|
|
|
int iResult = 0;
|
|
|
|
|
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
SqlParameter[] deleteRunSettleParms = new SqlParameter[] {
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_SETTLEMENT_GID,SqlDbType.VarChar,36)
|
|
|
|
|
};
|
|
|
|
|
deleteRunSettleParms[0].Value = tempRunFeeSettlementID;
|
|
|
|
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_DELETE_RUN_FEE_SETTLEMENT_BY_GID, deleteRunSettleParms);
|
|
|
|
|
|
|
|
|
|
SqlParameter[] deleteRunDoParms = new SqlParameter[] {
|
|
|
|
|
new SqlParameter(PARM_RUN_FEE_DO_RUN_SETTLE_ID,SqlDbType.VarChar,36)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
deleteRunDoParms[0].Value = tempRunFeeSettlementID;
|
|
|
|
|
|
|
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_DELETE_RUN_FEE_DO_BY_RUNSETTLE_ID, deleteRunDoParms);
|
|
|
|
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
|
|
|
|
|
|
|
iResult = 1;//删除成功
|
|
|
|
|
}
|
|
|
|
|
catch (Exception execError)
|
|
|
|
|
{
|
|
|
|
|
iResult = -1;//有异常,插入失败
|
|
|
|
|
sqlTran.Rollback();
|
|
|
|
|
iResult = -2;//插入异常,事务已回滚成功
|
|
|
|
|
throw execError;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
SqlHelper.CloseConnection();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return iResult;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|