strSql.Append(",isnull(CASE DEFAULTDEBIT when 1 then 'CARRIER' when 2 then 'FORWARD' when 3 then 'YARD' when 4 then 'TRUCK' when 5 then 'CUSTOMERNAME' when 6 then 'CUSTOMSER' when 7 then 'AGENTID' when 8 then '航空公司' when 9 then 'SHIPPERID' when 10 then 'CONSIGNEEID' when 11 then 'NOTIFYPARTYID' when 12 then 'SHIPAGENCY' when 0 then '' end ,'') DEFAULTDEBITREF ");
strSql.Append(",isnull(CASE DEFAULTCREDIT when 1 then 'CARRIER' when 2 then 'FORWARD' when 3 then 'YARD' when 4 then 'TRUCK' when 5 then 'CUSTOMERNAME' when 6 then 'CUSTOMSER' when 7 then 'AGENTID' when 8 then '航空公司' when 9 then 'SHIPPERID' when 10 then 'CONSIGNEEID' when 11 then 'NOTIFYPARTYID' when 12 then 'SHIPAGENCY' when 0 then '' end ,'') DEFAULTCREDITREF,FEEGROUP ");
}
else
{
strSql.Append("Select FeeCode,Name,FEECODE + '-' + NAME AS CodeAndName,DEFAULTCURR,DEFAULTDEBIT,DEFAULTCREDIT,feetype,Description,DefaultUnit,FeeFRT,ISADVANCEDPAY,ISOPEN,ISINVOICE,TAXRATE ");
strSql.Append(",isnull(CASE DEFAULTDEBIT when 1 then '船公司' when 2 then '订舱代理' when 3 then '场站' when 4 then '车队' when 5 then '委托单位' when 6 then '报关行' when 7 then '代理' when 8 then '航空公司' when 9 then '发货人' when 10 then '收货人' when 11 then '通知人' when 12 then '船代' when 0 then '其他' end ,'') DEFAULTDEBITREF ");
strSql.Append(",isnull(CASE DEFAULTCREDIT when 1 then '船公司' when 2 then '订舱代理' when 3 then '场站' when 4 then '车队' when 5 then '委托单位' when 6 then '报关行' when 7 then '代理' when 8 then '航空公司' when 9 then '发货人' when 10 then '收货人' when 11 then '通知人' when 12 then '船代' when 0 then '其他' end ,'') DEFAULTCREDITREF,FEEGROUP ");
}
strSql.Append(",isnull(CASE DEFAULTDEBIT when 1 then '船公司' when 2 then '订舱代理' when 3 then '场站' when 4 then '车队' when 5 then '委托单位' when 6 then '报关行' when 7 then '代理' when 8 then '航空公司' when 9 then '发货人' when 10 then '收货人' when 11 then '通知人' when 12 then '船代' when 0 then '其他' end ,'') DEFAULTDEBITREF ");
strSql.Append(",isnull(CASE DEFAULTCREDIT when 1 then '船公司' when 2 then '订舱代理' when 3 then '场站' when 4 then '车队' when 5 then '委托单位' when 6 then '报关行' when 7 then '代理' when 8 then '航空公司' when 9 then '发货人' when 10 then '收货人' when 11 then '通知人' when 12 then '船代' when 0 then '其他' end ,'') DEFAULTCREDITREF,FEEGROUP ");
@"update Receipt_Doc set URL=@URL,Driect_URL=@Driect_URL,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=@MODIFIEDTIME,RECEIPTTYPE=@RECEIPTTYPE,DOCUMENTATTACHEDCODE=@DOCUMENTATTACHEDCODE,DOCUMENTATTACHEDNO=@DOCUMENTATTACHEDNO
,ISPUBLIC=@ISPUBLIC,BSNO=@BSNOWHEREGID=@GID");
varcmdupdateopseae=
db.GetSqlStringCommand(
@"update Receipt_Doc set URL=@URL,Driect_URL=@Driect_URL,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=@MODIFIEDTIME,RECEIPTTYPE=@RECEIPTTYPE,DOCUMENTATTACHEDCODE=@DOCUMENTATTACHEDCODE,DOCUMENTATTACHEDNO=@DOCUMENTATTACHEDNO
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=t.GId ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(",(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=t.GId ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO =t.GId ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP,DCLASS,DUNNO");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF from tMsWlPcHead t ");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=t.GId ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(",(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=t.GId ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO =t.GId ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP,DCLASS,DUNNO");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF from tMsWlPcHead t ");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=t.GId ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(",'' AS COLOR");
strSql.Append(",t.SALECORPID,(select [NAME] from [company] where GID=t.SALECORPID) as SALECORP,DCLASS,DUNNO");
strSql.Append(" ,INVOICENO,KINDPKGS,CUSTNO,SalesName,GoodsName,PORTLOAD,DESTINATION,RtnDocStatus,RtnDocTime,ACCDATE,(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF from tMsWlPcHead t ");