You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
236 lines
20 KiB
C#
236 lines
20 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using DSWeb.MvcShipping.Models.MsCwDesignGl;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using HcUtility.Comm;
|
|
using System.Data.SqlClient;
|
|
using DSWeb.DataAccess;
|
|
using HcUtility.Core;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsCwDesignGlDAL
|
|
{
|
|
public class MsCwDesignGlDAL
|
|
{
|
|
#region 查询
|
|
static public List<MsCwDesignGlItem> GetDataList(string strCondition, string companyid, string strUserID)
|
|
{
|
|
string strCwSTARTGID = BasicDataRefDAL.GetCwSTARTGID(strUserID);
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT [GID],[LINKGID],[ITEMGID],[OPTYPE],[MODIFIEDUSER],[MODIFIEDTIME]"
|
|
+ ",[MODIFIEDUSERNAME]=(select top 1 SHOWNAME from [user] where gid=[cw_design_gl_item].MODIFIEDUSER)"
|
|
+ ",[ITEMCODE]=(SELECT top 1 ITEMCODE from cw_item where GID=[cw_design_gl_item].[ITEMGID])"
|
|
+ ",[ITEMNAME]=(SELECT top 1 ITEMNAME from cw_item where GID=[cw_design_gl_item].[ITEMGID])"
|
|
+ " FROM [cw_design_gl_item] WITH(NOLOCK)"
|
|
+ " where LINKGID in (SELECT top 1 GID from cw_design_gl WITH(NOLOCK) where [STARTGID]='" + strCwSTARTGID + "')");
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" and " + strCondition);
|
|
}
|
|
strSql.Append(" ORDER BY [ITEMCODE]");
|
|
return SetData2(strSql);
|
|
}
|
|
|
|
private static List<MsCwDesignGlItem> SetData2(StringBuilder strSql)
|
|
{
|
|
var headList = new List<MsCwDesignGlItem>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
MsCwDesignGlItem data = new MsCwDesignGlItem();
|
|
#region Set DB data to Object
|
|
data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//唯一编码
|
|
data.LINKGID = (reader["LINKGID"] == null ? "" : Convert.ToString(reader["LINKGID"]));//关联GID
|
|
data.ITEMGID = (reader["ITEMGID"] == null ? "" : Convert.ToString(reader["ITEMGID"]));//项目GID
|
|
data.OPTYPE = (reader["OPTYPE"] == null ? "" : Convert.ToString(reader["OPTYPE"]));//业务类型
|
|
data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//更改操作人gid
|
|
if (data.MODIFIEDTIME != null)
|
|
data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]);//更改操作时间
|
|
data.MODIFIEDUSERNAME = (reader["MODIFIEDUSERNAME"] == null ? "" : Convert.ToString(reader["MODIFIEDUSERNAME"]));//更改人
|
|
data.ITEMCODE = (reader["ITEMCODE"] == null ? "" : Convert.ToString(reader["ITEMCODE"]));
|
|
data.ITEMNAME = (reader["ITEMNAME"] == null ? "" : Convert.ToString(reader["ITEMNAME"]));
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
|
|
static public MsCwDesignGl GetData(string strCondition, string companyid, string strUserID)
|
|
{
|
|
//调汇的默认科目
|
|
string strCwSTARTGID = BasicDataRefDAL.GetCwSTARTGID(strUserID);
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT top 1 *,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=cw_design_gl.MODIFIEDUSER) from cw_design_gl where [STARTGID]='" + strCwSTARTGID + "'");// and CORPID='"+companyid+"' and CORPID in (select GID from cw_design_startusing where (ISDELETE=0 or ISDELETE is null) and ISENABLE=1 and GID=(select top 1 STARTGID from [cw_design_startusing_user] WITH(NOLOCK) where USERGID='" + strUSERID + "') order by STARTMONTH desc)
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" and " + strCondition);
|
|
}
|
|
//期末调汇
|
|
var list = SetData(strSql);
|
|
if (list.Count > 0)
|
|
return list[0];
|
|
return new MsCwDesignGl();
|
|
}
|
|
static public MsCwDesignGl GetDataAll(string strCondition, string companyid, string strUserID)
|
|
{
|
|
//调汇的默认科目
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT top 1 *,MODIFIEDUSERNAME=(select top 1 SHOWNAME from [user] where gid=cw_design_gl.MODIFIEDUSER) from cw_design_gl ");// and CORPID='"+companyid+"' and CORPID in (select GID from cw_design_startusing where (ISDELETE=0 or ISDELETE is null) and ISENABLE=1 and GID=(select top 1 STARTGID from [cw_design_startusing_user] WITH(NOLOCK) where USERGID='" + strUSERID + "') order by STARTMONTH desc)
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" WHERE " + strCondition);
|
|
}
|
|
//期末调汇
|
|
var list = SetData(strSql);
|
|
if (list.Count > 0)
|
|
return list[0];
|
|
return new MsCwDesignGl();
|
|
}
|
|
|
|
private static List<MsCwDesignGl> SetData(StringBuilder strSql)
|
|
{
|
|
var headList = new List<MsCwDesignGl>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
MsCwDesignGl data = new MsCwDesignGl();
|
|
#region Set DB data to Object
|
|
data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//唯一编码
|
|
data.FSOFTCODE = (reader["FSOFTCODE"] == null ? 0 : Convert.ToInt32(reader["FSOFTCODE"]));//财务软件编码
|
|
data.TVW = (reader["TVW"] == null ? "" : Convert.ToString(reader["TVW"]));//转帐凭证字
|
|
data.BPVW = (reader["BPVW"] == null ? "" : Convert.ToString(reader["BPVW"]));//银行付款凭证字
|
|
data.BRTW = (reader["BRTW"] == null ? "" : Convert.ToString(reader["BRTW"]));//银行收款凭证字
|
|
data.TVWFC = (reader["TVWFC"] == null ? "" : Convert.ToString(reader["TVWFC"]));//外币转帐凭证字
|
|
data.BPVWFC = (reader["BPVWFC"] == null ? "" : Convert.ToString(reader["BPVWFC"]));//银行外币付款凭证字
|
|
data.BRTWFC = (reader["BRTWFC"] == null ? "" : Convert.ToString(reader["BRTWFC"]));//银行外币收款凭证字
|
|
//data.ISTCOIIED = (reader["ISTCOIIED"] == null ? false : Convert.ToBoolean(reader["ISTCOIIED"]));//收入成本是否核算美元
|
|
//data.ISUAPGE = (reader["ISUAPGE"] == null ? false : Convert.ToBoolean(reader["ISUAPGE"]));//使用核算项目生成分录
|
|
data.AMCODE = (reader["AMCODE"] == null ? "" : Convert.ToString(reader["AMCODE"]));//核算办法
|
|
//data.ISATTNOTCVVGV = (reader["ISATTNOTCVVGV"] == null ? false : Convert.ToBoolean(reader["ISATTNOTCVVGV"]));//根据船名航次生成凭证
|
|
//data.ISATBGV = (reader["ISATBGV"] == null ? false : Convert.ToBoolean(reader["ISATBGV"]));//根据帐单生成凭证
|
|
data.ISCTGCIC = (reader["ISCTGCIC"] == null ? false : Convert.ToBoolean(reader["ISCTGCIC"]));//合并生成成本收入凭证
|
|
data.ISMGSC = (reader["ISMGSC"] == null ? false : Convert.ToBoolean(reader["ISMGSC"]));//合并生成结算凭证
|
|
data.ISVBM = (reader["ISVBM"] == null ? false : Convert.ToBoolean(reader["ISVBM"]));//凭证禁止修改
|
|
data.ISFILLSERIALNO = (reader["ISFILLSERIALNO"] == null ? false : Convert.ToBoolean(reader["ISFILLSERIALNO"]));//是否在生成凭证号时补号
|
|
data.ISCLIENTNAME = (reader["ISCLIENTNAME"] == null ? false : Convert.ToBoolean(reader["ISCLIENTNAME"]));//是否客户名称
|
|
data.ISCUSTNO = (reader["ISCUSTNO"] == null ? false : Convert.ToBoolean(reader["ISCUSTNO"]));//是否委托编号
|
|
data.ISMBLNO = (reader["ISMBLNO"] == null ? false : Convert.ToBoolean(reader["ISMBLNO"]));//是否主提单号
|
|
if (reader["ISSALE"] != DBNull.Value)
|
|
data.ISSALE = (reader["ISSALE"] == null ? false : Convert.ToBoolean(reader["ISSALE"]));//是否主提单号
|
|
//data.ISBILLNO = (reader["ISBILLNO"] == null ? false : Convert.ToBoolean(reader["ISBILLNO"]));//是否申请单号
|
|
data.ISVESSEL = (reader["ISVESSEL"] == null ? false : Convert.ToBoolean(reader["ISVESSEL"]));//是否船名
|
|
data.ISVOYNO = (reader["ISVOYNO"] == null ? false : Convert.ToBoolean(reader["ISVOYNO"]));//是否航次
|
|
data.ISBSSOURCE = (reader["ISBSSOURCE"] == null ? false : Convert.ToBoolean(reader["ISBSSOURCE"]));//是否业务来源
|
|
data.ISRPCLIENTNAME = (reader["ISRPCLIENTNAME"] == null ? false : Convert.ToBoolean(reader["ISRPCLIENTNAME"]));//是否收付客户名称
|
|
data.ISRPCUSTNO = (reader["ISRPCUSTNO"] == null ? false : Convert.ToBoolean(reader["ISRPCUSTNO"]));//是否收付委托编号
|
|
data.ISRPMBLNO = (reader["ISRPMBLNO"] == null ? false : Convert.ToBoolean(reader["ISRPMBLNO"]));//是否收付主提单号
|
|
if (reader["ISRPSALE"] != DBNull.Value)
|
|
data.ISRPSALE = (reader["ISRPSALE"] == null ? false : Convert.ToBoolean(reader["ISRPSALE"]));//是否收付主提单号
|
|
data.ISRPVESSEL = (reader["ISRPVESSEL"] == null ? false : Convert.ToBoolean(reader["ISRPVESSEL"]));//是否收付船名
|
|
data.ISRPVOYNO = (reader["ISRPVOYNO"] == null ? false : Convert.ToBoolean(reader["ISRPVOYNO"]));//是否收付航次
|
|
data.ISRPBSSOURCE = (reader["ISRPBSSOURCE"] == null ? false : Convert.ToBoolean(reader["ISRPBSSOURCE"]));//是否收付业务来源
|
|
data.ISRPBILLNO = (reader["ISRPBILLNO"] == null ? false : Convert.ToBoolean(reader["ISRPBILLNO"]));//是否收付结算单号
|
|
data.ISRPBILLNO_ACAD = (reader["ISRPBILLNO_ACAD"] == null ? false : Convert.ToBoolean(reader["ISRPBILLNO_ACAD"]));//是否收付申请单号
|
|
if (reader["ISADVANCE"] != DBNull.Value)
|
|
data.ISADVANCE = (reader["ISADVANCE"] == null ? false : Convert.ToBoolean(reader["ISADVANCE"]));//预收预付生成凭证
|
|
if (reader["ISSTLCR"] != DBNull.Value)
|
|
data.ISSTLCR = (reader["ISSTLCR"] == null ? false : Convert.ToBoolean(reader["ISSTLCR"]));//结算生成成本凭证
|
|
if (reader["ISSTLEGOL"] != DBNull.Value)
|
|
data.ISSTLEGOL = (reader["ISSTLEGOL"] == null ? false : Convert.ToBoolean(reader["ISSTLEGOL"]));//结算生成损益
|
|
if (reader["ISSTLDATE"] != DBNull.Value)
|
|
data.ISSTLDATE = (reader["ISSTLDATE"] == null ? false : Convert.ToBoolean(reader["ISSTLDATE"]));//结算生成成本凭证结算日期为凭证日期
|
|
if (reader["ISINVRATESELF"] != DBNull.Value)
|
|
data.ISINVRATESELF = (reader["ISINVRATESELF"] == null ? false : Convert.ToBoolean(reader["ISINVRATESELF"]));//结算生成成本凭证结算日期为凭证日期
|
|
if (reader["ISINVEXPLANONRATE"] != DBNull.Value)
|
|
data.ISINVEXPLANONRATE = (reader["ISINVEXPLANONRATE"] == null ? false : Convert.ToBoolean(reader["ISINVEXPLANONRATE"]));//结算生成成本凭证结算日期为凭证日期
|
|
if (reader["ISRPSTLDATE"] != DBNull.Value)
|
|
data.ISRPSTLDATE = (reader["ISRPSTLDATE"] == null ? false : Convert.ToBoolean(reader["ISRPSTLDATE"]));//结算生成成本凭证结算日期为凭证日期
|
|
if (reader["ISSTLDRCRISGROUP"] != DBNull.Value)
|
|
data.ISSTLDRCRISGROUP = (reader["ISSTLDRCRISGROUP"] == null ? false : Convert.ToBoolean(reader["ISSTLDRCRISGROUP"]));//结算凭证应收应付账款合并
|
|
data.AR = (reader["AR"] == null ? "" : Convert.ToString(reader["AR"]));//应收账款
|
|
data.ARFC = (reader["ARFC"] == null ? "" : Convert.ToString(reader["ARFC"]));//应收账款外币
|
|
data.AP = (reader["AP"] == null ? "" : Convert.ToString(reader["AP"]));//应付账款
|
|
data.APFC = (reader["APFC"] == null ? "" : Convert.ToString(reader["APFC"]));//应付账款外币
|
|
data.DR = (reader["DR"] == null ? "" : Convert.ToString(reader["DR"]));//预收账款
|
|
data.DRFC = (reader["DRFC"] == null ? "" : Convert.ToString(reader["DRFC"]));//预收账款外币
|
|
data.CR = (reader["CR"] == null ? "" : Convert.ToString(reader["CR"]));//预付账款
|
|
data.CRFC = (reader["CRFC"] == null ? "" : Convert.ToString(reader["CRFC"]));//预付账款外币
|
|
data.FC = (reader["FC"] == null ? "" : Convert.ToString(reader["FC"]));//财务费用
|
|
data.MBINCOME = (reader["MBINCOME"] == null ? "" : Convert.ToString(reader["MBINCOME"]));//主营业务收入
|
|
data.MBSPENDING = (reader["MBSPENDING"] == null ? "" : Convert.ToString(reader["MBSPENDING"]));//主营业务支出
|
|
data.TMFCI = (reader["TMFCI"] == null ? "" : Convert.ToString(reader["TMFCI"]));//主营收入外币
|
|
data.TMSFC = (reader["TMSFC"] == null ? "" : Convert.ToString(reader["TMSFC"]));//主营支出外币
|
|
//data.OTHERR = (reader["OTHERR"] == null ? "" : Convert.ToString(reader["OTHERR"]));//其他应收
|
|
//data.OTHERP = (reader["OTHERP"] == null ? "" : Convert.ToString(reader["OTHERP"]));//其他应付
|
|
//data.DR = (reader["DR"] == null ? "" : Convert.ToString(reader["DR"]));//预收账款
|
|
//data.DRFC = (reader["DRFC"] == null ? "" : Convert.ToString(reader["DRFC"]));//预收账款外币
|
|
//data.CR = (reader["CR"] == null ? "" : Convert.ToString(reader["CR"]));//预付账款
|
|
//data.CRFC = (reader["CRFC"] == null ? "" : Convert.ToString(reader["CRFC"]));//预付账款外币
|
|
data.EGOL = (reader["EGOL"] == null ? "" : Convert.ToString(reader["EGOL"]));//汇兑收益/财务费用
|
|
data.ExchangeLoss = (reader["ExchangeLoss"] == null ? "" : Convert.ToString(reader["ExchangeLoss"]));//汇兑损失/财务费用
|
|
data.CASH = (reader["CASH"] == null ? "" : Convert.ToString(reader["CASH"]));//现金科目
|
|
data.OUTPUTTAX = (reader["OUTPUTTAX"] == null ? "" : Convert.ToString(reader["OUTPUTTAX"]));//销项税科目
|
|
data.INPUTTAX = (reader["INPUTTAX"] == null ? "" : Convert.ToString(reader["INPUTTAX"]));//进项税科目
|
|
data.ISAPMBSPENDING = (reader["ISAPMBSPENDING"] == null ? false : Convert.ToBoolean(reader["ISAPMBSPENDING"]));//是否默认付费结算借方科目代码
|
|
data.APMBSPENDING = (reader["APMBSPENDING"] == null ? "" : Convert.ToString(reader["APMBSPENDING"]));//付费结算借方默认科目代码
|
|
data.ISAPTMSFC = (reader["ISAPTMSFC"] == null ? false : Convert.ToBoolean(reader["ISAPTMSFC"]));//是否默认付费结算借方外币科目代码
|
|
data.APTMSFC = (reader["APTMSFC"] == null ? "" : Convert.ToString(reader["APTMSFC"]));//付费结算借方外币默认科目代码
|
|
data.CORPID = (reader["CORPID"] == null ? "" : Convert.ToString(reader["CORPID"]));
|
|
data.MODIFIEDUSER = (reader["MODIFIEDUSER"] == null ? "" : Convert.ToString(reader["MODIFIEDUSER"]));//最后一次更新操作人
|
|
if (data.MODIFIEDTIME != null)
|
|
data.MODIFIEDTIME = Convert.ToDateTime(reader["MODIFIEDTIME"]);//更改操作时间
|
|
data.MODIFIEDUSERNAME = (reader["MODIFIEDUSERNAME"] == null ? "" : Convert.ToString(reader["MODIFIEDUSERNAME"]));//更改人
|
|
data.ISARMBSPENDING = (reader["ISARMBSPENDING"] == null ? false : Convert.ToBoolean(reader["ISARMBSPENDING"]));//是否默认收费结算借方科目代码
|
|
data.ARMBSPENDING = (reader["ARMBSPENDING"] == null ? "" : Convert.ToString(reader["ARMBSPENDING"]));//收费结算借方默认科目代码
|
|
data.ISARTMSFC = (reader["ISARTMSFC"] == null ? false : Convert.ToBoolean(reader["ISARTMSFC"]));//是否默认收费结算借方外币科目代码
|
|
data.ARTMSFC = (reader["ARTMSFC"] == null ? "" : Convert.ToString(reader["ARTMSFC"]));//收费结算借方外币默认科目代码
|
|
data.ISMBINCOME = (reader["ISMBINCOME"] == null ? false : Convert.ToBoolean(reader["ISMBINCOME"]));//是否合并生成成本收入凭证中的主营业务科目
|
|
data.ISSETTLEMENTSOPEN = (reader["ISSETTLEMENTSOPEN"] == null ? false : Convert.ToBoolean(reader["ISSETTLEMENTSOPEN"]));//是否在结算自动生成凭证时自动弹出结算凭证
|
|
data.STARTGID = (reader["STARTGID"] == null ? "" : Convert.ToString(reader["STARTGID"]));
|
|
data.PiaoHao = (reader["PiaoHao"] == null ? "" : Convert.ToString(reader["PiaoHao"]));
|
|
data.PiaoHaoRP = (reader["PiaoHaoRP"] == null ? "" : Convert.ToString(reader["PiaoHaoRP"]));
|
|
data.ISMERGEBANK = (reader["ISMERGEBANK"] == null ? false : Convert.ToBoolean(reader["ISMERGEBANK"]));//是否合并生成结算凭证中的银行科目
|
|
data.CANAME = (reader["CANAME"] == null ? "" : Convert.ToString(reader["CANAME"]));//客户核算名称
|
|
data.SANAME = (reader["SANAME"] == null ? "" : Convert.ToString(reader["SANAME"]));//供应商核算名称
|
|
data.DANAME = (reader["DANAME"] == null ? "" : Convert.ToString(reader["DANAME"]));//部门核算名称
|
|
data.PANAEM = (reader["PANAEM"] == null ? "" : Convert.ToString(reader["PANAEM"]));//人员核算名称
|
|
if (reader["ISSTLEXCHANGERATEISVAR"] != DBNull.Value)
|
|
data.ISSTLEXCHANGERATEISVAR= Convert.ToBoolean(reader["ISSTLEXCHANGERATEISVAR"]);
|
|
data.INVTAX = (reader["INVTAX"] == null ? "" : Convert.ToString(reader["INVTAX"]));//税额
|
|
if (reader["ISSALECORP"] != DBNull.Value)
|
|
data.ISSALECORP = Convert.ToBoolean(reader["ISSALECORP"]);
|
|
if (reader["ISRATESET"] != DBNull.Value)
|
|
data.ISRATESET = Convert.ToBoolean(reader["ISRATESET"]);
|
|
if (reader["ISSTBANKGROUP"] != DBNull.Value)
|
|
data.ISSTBANKGROUP = Convert.ToBoolean(reader["ISSTBANKGROUP"]);
|
|
data.DREXPLAN = Convert.ToString(reader["DREXPLAN"]);
|
|
data.CREXPLAN = Convert.ToString(reader["CREXPLAN"]);
|
|
data.STLDREXPLAN = Convert.ToString(reader["STLDREXPLAN"]);
|
|
data.STLCREXPLAN = Convert.ToString(reader["STLCREXPLAN"]);
|
|
data.MBINCOMEEXPLAN = Convert.ToString(reader["MBINCOMEEXPLAN"]);
|
|
data.MBSPENDINGEXPLAN = Convert.ToString(reader["MBSPENDINGEXPLAN"]);
|
|
data.INVDREXPLAN = Convert.ToString(reader["INVDREXPLAN"]);
|
|
data.INVCREXPLAN = Convert.ToString(reader["INVCREXPLAN"]);
|
|
data.INVMBINCOMEEXPLAN = Convert.ToString(reader["INVMBINCOMEEXPLAN"]);
|
|
data.INVMBSPENDINGEXPLAN = Convert.ToString(reader["INVMBSPENDINGEXPLAN"]);
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|