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.

5124 lines
440 KiB
C#

10 months ago
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using DSWeb.Authority;
namespace DSWeb.Reports
{
public partial class ReportService : System.Web.UI.Page
{
private string strHandle;
private string strBSNO;
private string strGIDS;
private string strFeeGids;
private string strGainType;
private string strInvoiceID;
private string strUserID;
private string strCompanyID;
private string strShowName;//用户显示名
private string strDeptName;//部门名称
private int iFeeType;
private string strSearch;
private string strBillNO;
private string strOldModifiedID;
private string strNewModifiedID;
private string stroplb = "";//业务类别
private string strassociatedno = "";
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
strUserID = "";
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
//
if (Request.QueryString["handle"] != null)
{
strHandle = Request.QueryString["handle"].ToString();
}
if (Request.QueryString["oplb"] != null)
{
stroplb = Request.QueryString["oplb"].ToString();
}
if (Request.QueryString["bsno"] != null)
{
strBSNO = Request.QueryString["bsno"].ToString();
}
if (Request.QueryString["gids"] != null)
{
strGIDS = Request.QueryString["gids"].ToString();
}
if (Request.QueryString["feegids"] != null)
{
strFeeGids = Request.QueryString["feegids"].ToString();
}
if (Request.QueryString["feetype"] != null)
{
iFeeType = int.Parse(Request.QueryString["feetype"].ToString());
}
if (Request.QueryString["gaintype"] != null)
{
strGainType = Request.QueryString["gaintype"].ToString();
}
if (Request.QueryString["search"] != null)
{
UnicodeEncoding unicode = new UnicodeEncoding();
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
}
if(Request.QueryString["invoiceid"] != null)
{
strInvoiceID = Request.QueryString["invoiceid"].ToString();
}
if(Request.QueryString["billno"] != null)
{
strBillNO = Request.QueryString["billno"].ToString();
}
if(Request.QueryString["oldfeeid"] != null)
{
strOldModifiedID = Request.QueryString["oldfeeid"].ToString();
}
if(Request.QueryString["newfeeid"] != null)
{
strNewModifiedID = Request.QueryString["newfeeid"].ToString();
}
if (Request.QueryString["associatedno"] != null)
{
strassociatedno = Request.QueryString["associatedno"].ToString();
}
if (Request.QueryString["USERID"] != null)
{
strBillNO = Request.QueryString["USERID"].ToString();
}
if (strHandle != null)
{
if (strHandle == "printseaop" && strBSNO != null)
{
Response.Write(PrintSeaOpReport(strUserID,strBSNO));
}
if (strHandle == "printseaopfee" && strBSNO != null)
{ //打印委托(op_seae)应收应付费用报表返回JSON对象
Response.Write(PrintSeaOpFeeReport(strUserID, strBSNO, iFeeType, strFeeGids));
}
if (strHandle == "printseaebilloflading" && strBSNO != null)
{
Response.Write(PrintSeaeBillOfLadingReport(strUserID, strBSNO));
}
if (strHandle == "printseaebusinesschange" && strBSNO != null)
{
Response.Write(PrintSeaeBusinessChangeReport(strUserID, strBSNO));
}
if (strHandle == "printseaebusinessintogoods" && strBSNO != null)
{
Response.Write(PrintSeaeBusinessIntoGoodsReport(strUserID, strBSNO));
}
if (strHandle == "printseaebusinesssur" && strBSNO != null)
{
Response.Write(PrintSeaeBusinessSurReport(strUserID, strBSNO));
}
if (strHandle == "printseaebusinesstruck" && strBSNO != null)//出口派车单
{
Response.Write(PrintSeaeBusinessTruckReport(strUserID, strBSNO));
}
if (strHandle == "printseaibusinesstruck" && strBSNO != null)//进口派车单
{
Response.Write(PrintSeaiBusinessTruckReport(strUserID, strBSNO));
}
if (strHandle == "printseaeblissue" && strBSNO != null)
{
Response.Write(PrintSeaeblissueReport(strUserID, strBSNO));
}
if (strHandle == "printseaopgain" && strBSNO != null)
{ //打印委托op_seae费用利润报表返回JSON对象
Response.Write(PrintSeaOpFeeGainReport(strUserID, strBSNO));
}
if (strHandle == "printinvoice" && strInvoiceID != null)
{
Response.Write(PrintInvoiceReport(strUserID, strInvoiceID));
}
if (strHandle == "printinvoiceapplication" && strInvoiceID != null)
{
Response.Write(PrintInvoiceApplicationReport(strUserID, strInvoiceID));
}
if (strHandle == "printrecvappsettle" && strBillNO != null)
{
//收费申请打印
Response.Write(PrintRecvApplicationSettleReport(strUserID, strBillNO));
}
if (strHandle == "printrecvsettle" && strBillNO != null)
{
//收费结算打印
Response.Write(PrintRecvSettleReport(strUserID, strBillNO));
}
if (strHandle == "printrecvsettlelist" && strBillNO != null)
{
//收费结算列表打印
Response.Write(PrintRecvSettleListReport(strUserID, strBillNO, strSearch));
}
if (strHandle == "printpaysettlelist" && strBillNO != null)
{
//付费结算列表打印
Response.Write(PrintPaySettleListReport(strUserID, strBillNO, strSearch));
}
if (strHandle == "printpaysettle" && strBillNO != null)
{
//付费结算打印
Response.Write(PrintPaySettleReport(strUserID, strBillNO));
}
if (strHandle == "printpayappsettle" && strBillNO != null)
{
//付费申请打印
Response.Write(PrintPayApplicationSettleReport(strUserID, strBillNO));
}
if (strHandle == "printmodify" && strOldModifiedID != null && strNewModifiedID != null)
{
//打印费用更改单
Response.Write(PrintFeeModifiedReport(strUserID, strOldModifiedID, strNewModifiedID));
}
if (strHandle == "printinvoicedetail" && strBillNO != null)
{
//打印发票明细
Response.Write(PrintInvoiceDetailReport(strUserID, strBillNO));
}
if (strHandle == "printseai" && strBSNO != null)
{
Response.Write(PrintSeaiReport(strUserID, strBSNO));
}
if (strHandle == "printwmsin" && strBSNO != null)
{
Response.Write(PrintWmsInReport(strUserID, strBSNO));
}
if (strHandle == "printwmszxin" && strBSNO != null)
{
Response.Write(PrintWmsZXInReport(strUserID, strBSNO));
}
if (strHandle == "printwmsout" && strBSNO != null)
{
//打印出库单WmsOutEdit.aspx
Response.Write(PrintWmsOut(strUserID, strBSNO));
}
//
if (strHandle == "printwmsoutlist" && strSearch != null)
{
//打印出库单列表WmsOutList.aspx
Response.Write(PrintWmsOutList(strUserID, strSearch));
}
//
if (strHandle == "printwmsoutlist2" && strSearch != null)
{
//打印出库单多票WmsOutList.aspx
Response.Write(PrintWmsOutList2(strUserID, strSearch));
}
//
if (strHandle == "printwmsstock" && strSearch != null)
{
//打印库存单VwWmsStocktakeList.aspx
Response.Write(PrintWmsStock(strUserID, strSearch));
}
//
if (strHandle == "printrecvfeeauditlist" )
{
//打印收费申请列表
Response.Write(PrintRecvFeeAuditList());
}
if (strHandle == "printpayfeeauditlist" )
{
//打印付费申请列表
Response.Write(PrintPayFeeAuditList());
}
if (strHandle == "printpayfeeauditreport2")
{
//打印收付费审批列表多票CommonPayApplicationAudit.aspx
Response.Write(PrintPayFeeAuditReport2());
}
if (strHandle == "printpayfeeauditreport")
{
//打印付费审批信息单票CommonPayApplicationAudit.aspx
Response.Write(PrintPayFeeAuditReport());
}
if (strHandle == "printwmszxininfo")
{ //打印出库单返回JSON对象
Response.Write(PrintWmszxinInfoReport());
}
if (strHandle == "printwmszxoutinfo")
{ //打印出库单返回JSON对象
Response.Write(PrintWmszxoutInfoReport());
}
if (strHandle == "printquotation")
{ //打印出库单返回JSON对象
Response.Write(PrintQuotationReport());
}
if (strHandle == "printwmsinfo")
{
//入库单 WmsInfo.aspx
Response.Write(PrintWmsInfoReport());
}
//
if (strHandle == "printwmsfeequery" && strSearch != null)
{
//库存仓储费用查询 WmsWmsrateTestList.aspx
Response.Write(PrintWmsFeeQuery(strUserID, strSearch));
}
//
if (strHandle == "printwmsdetail" && strSearch != null)
{ //打印出库单返回JSON对象
Response.Write(PrintWmsDetail(strUserID, strSearch));
}
//打印出入库明细
if (strHandle == "printwmsDetailstock" && strSearch != null)
{
Response.Write(PrintWmsDetailStock(strUserID,strSearch));
}
if (strHandle == "printwmsinputinfo")
{
//打印入库单列表WmsList.aspx
Response.Write(this.PrintWMSInputInfo());
}
//应收应付费用总表
if (strHandle == "printfeereport" && strSearch != null)
{
Response.Write(PrintFeeReport(strUserID, strSearch));
}
//if (strHandle == "printseaiopfee" && strBSNO != null)
//{ //打印委托(op_seai)应收应付费用报表返回JSON对象
// Response.Write(PrintSeaiOpFeeReport(strUserID, strBSNO, iFeeType));
//}
//if (strHandle == "printseaiopgain" && strBSNO != null)
//{ //打印委托op_seai费用利润报表返回JSON对象
// Response.Write(PrintSeaiOpFeeGainReport(strUserID, strBSNO));
//}
if (strHandle == "PrintUser")
{ //打印出库单返回JSON对象
Response.Write(PrintUserReport());
}
}
}
#region 打印付费申请报表
/// <summary>
/// 打印付费申请报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintInvoiceDetailReport(string tempUserID, string tempBillNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "INVOICEDETAIL");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = " SELECT A.GID, A.INVOICENO, A.BILLNO, A.CUSTOMERNAME, A.INVOICECUSTNAME, A.INVOICEMAKETIME,A.BANK, A.ACCOUNT, A.BSNO, A.VESSELVOYAGE, A.ETD, "
+ " A.POL, A.POD, A.FEEITEM, A.AMOUNTLIST, A.AMOUNT, A.AMOUNTCAPITAL, A.CURRENCY, A.REMARK, C.SHOWNAME AS APPLICANT, A.APPLYTIME, B.SHOWNAME AS OPERATOR,"
+ " A.LICENSECODE, A.TAXCODE, A.INVOICETYPE, A.ISDELETE, A.DELETEOPERATOR, A.DELETETIME,A.ISNEEDPRINT, A.ISNEEDFEE, A.OPERATETIME, A.MBLNO, "
+ " CASE WHEN A.PRINTCAPITAL IS NULL THEN A.AMOUNTCAPITAL ELSE A.PRINTCAPITAL END AS AMOUNTCAPITAL, "
+ " CASE WHEN A.PRINTAMOUNT IS NULL THEN A.AMOUNT ELSE A.PRINTAMOUNT END AS AMOUNT,ISNULL(A.PRINTTITLE,'') AS PRINTTITLE "
+ " FROM ch_fee_invoice AS A LEFT JOIN [user] AS B ON A.OPERATOR = B.GID LEFT JOIN [user] AS C ON A.APPLICANT = C.GID WHERE A.BILLNO = '" + tempBillNO + "' ";
reportDBSourceEntity.SqlString_2 = " SELECT * FROM ch_fee_do WHERE BILLNO = '" + tempBillNO + "' AND CATEGORY = 7 ";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "INVOICEDETAIL";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = " SELECT A.GID, A.INVOICENO, A.BILLNO, A.CUSTOMERNAME, A.INVOICECUSTNAME, A.INVOICEMAKETIME,A.BANK, A.ACCOUNT, A.BSNO, A.VESSELVOYAGE, A.ETD, "
+ " A.POL, A.POD, A.FEEITEM, A.AMOUNTLIST, A.AMOUNT, A.AMOUNTCAPITAL, A.CURRENCY, A.REMARK, C.SHOWNAME AS APPLICANT, A.APPLYTIME, B.SHOWNAME AS OPERATOR,"
+ " A.LICENSECODE, A.TAXCODE, A.INVOICETYPE, A.ISDELETE, A.DELETEOPERATOR, A.DELETETIME,A.ISNEEDPRINT, A.ISNEEDFEE, A.OPERATETIME, A.MBLNO, "
+ " CASE WHEN A.PRINTCAPITAL IS NULL THEN A.AMOUNTCAPITAL ELSE A.PRINTCAPITAL END AS AMOUNTCAPITAL, "
+ " CASE WHEN A.PRINTAMOUNT IS NULL THEN A.AMOUNT ELSE A.PRINTAMOUNT END AS AMOUNT,ISNULL(A.PRINTTITLE,'') AS PRINTTITLE "
+ " FROM ch_fee_invoice AS A LEFT JOIN [user] AS B ON A.OPERATOR = B.GID LEFT JOIN [user] AS C ON A.APPLICANT = C.GID WHERE A.BILLNO = '" + tempBillNO + "' ";
reportDBSourceEntity.SqlString_2 = " SELECT * FROM ch_fee_do WHERE BILLNO = '" + tempBillNO + "' AND CATEGORY = 7 ";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印费用更改报表
/// <summary>
/// 打印费用更改报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempOldModifiedID">费用更改旧值GID</param>
/// <param name="tempNewModifiedID">费用更改新值GID</param>
/// <returns>返回JSON对象</returns>
private string PrintFeeModifiedReport(string tempUserID, string tempOldModifiedID, string tempNewModifiedID)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "FEEMODIFIED");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = " SELECT A.GID, CASE WHEN A.TYPE = 1 THEN '应收费用' ELSE '应付费用' END AS FEETYPE,A.TYPE,CASE WHEN A.APPLYTYPE = 1 THEN '原始值' ELSE '新值' END AS APPLYTYPENAME,"
+ " A.APPLYTYPE,A.REASON, A.FEEID, A.BSNO, A.FEENAME, A.CUSTOMERNAME, A.UNIT, A.UNITPRICE, A.QUANTITY,A.AMOUNT, A.CURRENCY, A.FRT, A.COMMISSIONRATE, A.EXCHANGERATE, "
+ " A.ISADVANCEDPAY, B.SHOWNAME AS AUDITUSER,A.AUDITTIME, C.SHOWNAME AS APPLYUSER, A.APPLYTIME, A.APPLYSTATUS, A.REMARK, A.GROUPID "
+ " FROM ch_fee_modify as A LEFT JOIN [user] as B ON A.AUDITUSER = B.GID LEFT JOIN [user] as C ON A.APPLYUSER = C.GID WHERE A.GID = '" + tempOldModifiedID + "'";
reportDBSourceEntity.SqlString_2 = " SELECT A.GID, CASE WHEN A.TYPE = 1 THEN '应收费用' ELSE '应付费用' END AS FEETYPE,A.TYPE,CASE WHEN A.APPLYTYPE = 1 THEN '原始值' ELSE '新值' END AS APPLYTYPENAME,"
+ " A.APPLYTYPE,A.REASON, A.FEEID, A.BSNO, A.FEENAME, A.CUSTOMERNAME, A.UNIT, A.UNITPRICE, A.QUANTITY,A.AMOUNT, A.CURRENCY, A.FRT, A.COMMISSIONRATE, A.EXCHANGERATE, "
+ " A.ISADVANCEDPAY, B.SHOWNAME AS AUDITUSER,A.AUDITTIME, C.SHOWNAME AS APPLYUSER, A.APPLYTIME, A.APPLYSTATUS, A.REMARK, A.GROUPID "
+ " FROM ch_fee_modify as A LEFT JOIN [user] as B ON A.AUDITUSER = B.GID LEFT JOIN [user] as C ON A.APPLYUSER = C.GID WHERE A.GID = '" + tempNewModifiedID + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "FEEMODIFIED";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = " SELECT A.GID, CASE WHEN A.TYPE = 1 THEN '应收费用' ELSE '应付费用' END AS FEETYPE,A.TYPE,CASE WHEN A.APPLYTYPE = 1 THEN '原始值' ELSE '新值' END AS APPLYTYPENAME,"
+ " A.APPLYTYPE,A.REASON, A.FEEID, A.BSNO, A.FEENAME, A.CUSTOMERNAME, A.UNIT, A.UNITPRICE, A.QUANTITY,A.AMOUNT, A.CURRENCY, A.FRT, A.COMMISSIONRATE, A.EXCHANGERATE, "
+ " A.ISADVANCEDPAY, B.SHOWNAME AS AUDITUSER,A.AUDITTIME, C.SHOWNAME AS APPLYUSER, A.APPLYTIME, A.APPLYSTATUS, A.REMARK, A.GROUPID "
+ " FROM ch_fee_modify as A LEFT JOIN [user] as B ON A.AUDITUSER = B.GID LEFT JOIN [user] as C ON A.APPLYUSER = C.GID WHERE A.GID = '" + tempOldModifiedID + "'";
reportDBSourceEntity.SqlString_2 = " SELECT A.GID, CASE WHEN A.TYPE = 1 THEN '应收费用' ELSE '应付费用' END AS FEETYPE,A.TYPE,CASE WHEN A.APPLYTYPE = 1 THEN '原始值' ELSE '新值' END AS APPLYTYPENAME,"
+ " A.APPLYTYPE,A.REASON, A.FEEID, A.BSNO, A.FEENAME, A.CUSTOMERNAME, A.UNIT, A.UNITPRICE, A.QUANTITY,A.AMOUNT, A.CURRENCY, A.FRT, A.COMMISSIONRATE, A.EXCHANGERATE, "
+ " A.ISADVANCEDPAY, B.SHOWNAME AS AUDITUSER,A.AUDITTIME, C.SHOWNAME AS APPLYUSER, A.APPLYTIME, A.APPLYSTATUS, A.REMARK, A.GROUPID "
+ " FROM ch_fee_modify as A LEFT JOIN [user] as B ON A.AUDITUSER = B.GID LEFT JOIN [user] as C ON A.APPLYUSER = C.GID WHERE A.GID = '" + tempNewModifiedID + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印付费申请报表
/// <summary>
/// 打印付费申请报表 打印付费申请条
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPayApplicationSettleReport(string tempUserID, string tempBillNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PAYAPPSETTLE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取付费申请表信息
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// + " union all "
// + "SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// , tempBillNO);//获取付费申请表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,applicantname=(select top 1 SHOWNAME from [user] where GID=a.applicant and ISDELETED=0) FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取付费申请表信息
//reportDBSourceEntity.SqlString_2 = "select M.HTH,M.billno,cd.feename,cd.amount,cd.doamount,c.currency from ch_fee_payapplication cp inner join ch_fee_do cd on cd.billno=cp.billno inner join import_main m on M.contractno=cd.bsno inner join ch_fee c on c.gid=cd.feeid where c.feetype=2 and cp.billno='" + tempBillNO + "'";
//2014-03-28 修改
//reportDBSourceEntity.SqlString_2 = "select M.HTH,M.billno,cd.feename,cd.amount,cd.doamount,c.currency,"
// + " (case when cd.feetype=1 then '收' else '付' end) as feetype,cc.fullname "
// + " from ch_fee_payapplication cp inner join ch_fee_do cd on cd.billno=cp.billno "
// + " inner join import_main m on M.contractno=cd.bsno inner join ch_fee c on c.gid=cd.feeid "
// + " left join [company] cc on cc.gid=m.company "
// + " where cp.billno='" + tempBillNO + "' order by m.hth,cd.feename";
//2014-09-02 邓宇修改
reportDBSourceEntity.SqlString_2 = "select M.HTH,M.billno,dbo.trimdate(M.arrivaldate) arrivaldate,cd.feename,cd.amount,cd.doamount,c.currency,"
+ " (case when cd.feetype=1 then '收' else '付' end) as feetype,cc.fullname "
+ " from ch_fee_payapplication cp inner join ch_fee_do cd on cd.billno=cp.billno "
+ " inner join import_main m on M.contractno=cd.bsno inner join ch_fee c on c.gid=cd.feeid "
+ " left join [company] cc on cc.gid=m.company "
+ " where cp.billno='" + tempBillNO + "' order by m.hth,cd.feename";
reportDBSourceEntity.SqlString_3 = "select sum(cd.doamount) ZJ from ch_fee_do cd where billno='" + tempBillNO + "'";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PAYAPPSETTLE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取收费结算表信息
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// + " union all "
// + "SELECT * FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// , tempBillNO);//获取收费结算表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,applicantname=(select top 1 SHOWNAME from [user] where GID=a.applicant and ISDELETED=0) FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取收费结算表信息
//2014-03-28 修改
reportDBSourceEntity.SqlString_2 = "select M.HTH,M.billno,cd.feename,cd.amount,cd.doamount,c.currency,(case when cd.feetype=1 then '收' else '付' end) as feetype from ch_fee_payapplication cp inner join ch_fee_do cd on cd.billno=cp.billno inner join import_main m on M.contractno=cd.bsno inner join ch_fee c on c.gid=cd.feeid where cp.billno='" + tempBillNO + "'";//"SELECT * FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印付费结算报表
/// <summary>
/// 打印收费结算报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPaySettleReport(string tempUserID, string tempBillNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PAYSETTLE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取收费结算表信息
//reportDBSourceEntity.SqlString_1 =String.Format( "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// + " union all "
// + "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// , tempBillNO);//获取收费结算表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取收费结算表信息
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PAYSETTLE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取收费结算表信息
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = {0}"
// + " union all "
// + "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = {0}"
// , tempBillNO);//获取收费结算表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = {0}", tempBillNO);//获取收费结算表信息
reportDBSourceEntity.SqlString_2 = "";//"SELECT * FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印收费申请报表
/// <summary>
/// 打印收费申请报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintRecvApplicationSettleReport(string tempUserID, string tempBillNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "RECVAPPSETTLE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,applicantname=(select top 1 SHOWNAME from [user] where GID=a.applicant and ISDELETED=0) FROM ch_fee_recvapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取付费申请表信息
reportDBSourceEntity.SqlString_2 = "select M.HTH,M.billno,cd.feename,cd.amount,cd.doamount,c.currency from ch_fee_recvapplication cp inner join ch_fee_do cd on cd.billno=cp.billno inner join import_main m on M.contractno=cd.bsno inner join ch_fee c on c.gid=cd.feeid where c.feetype=1 and cp.billno='" + tempBillNO + "' order by m.hth,cd.feename";
reportDBSourceEntity.SqlString_3 = "select sum(cd.doamount) ZJ from ch_fee_do cd where billno='" + tempBillNO + "'";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "RECVAPPSETTLE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,applicantname=(select top 1 SHOWNAME from [user] where GID=a.applicant and ISDELETED=0) FROM ch_fee_recvapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取收费结算表信息
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印收费结算报表
/// <summary>
/// 打印收费结算报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintRecvSettleReport(string tempUserID, string tempBillNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "RECVSETTLE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取收费结算表信息
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = {0}"
// + " union all "
// + "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = {0}"
// , tempBillNO);//获取收费结算表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}'", tempBillNO);//获取收费结算表信息
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "RECVSETTLE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '" + tempBillNO + "'";//获取收费结算表信息
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seae as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// + " union all "
// + "SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN op_seai as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' "
// , tempBillNO);//获取收费结算表信息
//2013-02-05 修改
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM ch_fee_settlement as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN VW_Settlement as C ON B.BSNO = C.BSNO WHERE A.BILLNO = '{0}' ", tempBillNO);//获取收费结算表信息
reportDBSourceEntity.SqlString_2 = "";//"SELECT * FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印收费结算列表报表
/// <summary>
/// 打印收费结算列表报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintRecvSettleListReport(string tempUserID, string tempBillNO, string tempSearch)
{
string strCondition = "";
string strAmount1 = "";
string strAmount2 = "";
//
if (!tempSearch.Trim().Equals(""))
{
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://Customer
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://BillNO
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://ETD BeginDate
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no":
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
break;
case "blno":
strCondition += String.Format(" AND A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where bsno in (select bsno from VW_Settlement where MBLNO LIKE '%{0}%')) and BILLNO LIKE '%DR%')", strArg[1].Replace("\"", ""));
break;
case "other":
strCondition += String.Format(" AND A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where INVOICENUM LIKE '%{0}%') and BILLNO LIKE '%DR%')", strArg[1].Replace("\"", ""));
break;
case "amount1"://
//strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strArg[1].Replace("\"", ""));
strAmount1 = strArg[1].Replace("\"", "");
break;
case "amount2"://
//strCondition += String.Format(" AND (A.AMOUNTRMB <= '{0}' or A.AMOUNTUSD <= '{0}')", strArg[1].Replace("\"", ""));
strAmount2 = strArg[1].Replace("\"", "");
break;
default:
break;
}
}
}
//
if (strAmount1.Trim() != "" && strAmount2.Trim() != "")
{
strCondition += String.Format(" AND ((A.AMOUNTRMB >= '{0}' and A.AMOUNTRMB <= '{1}') or (A.AMOUNTUSD >= '{0}' and A.AMOUNTUSD <= '{1}'))", strAmount1.Trim(), strAmount2.Trim());
}
else
{
if (strAmount1.Trim() != "")
{
strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strAmount1.Trim());
}
else if (strAmount2.Trim() != "")
{
strCondition += String.Format(" AND (A.AMOUNTRMB <= '{1}' or A.AMOUNTUSD <= '{1}')", strAmount2.Trim());
}
}
}
//
if (tempBillNO.Trim() != "")
{
tempBillNO = "'" + tempBillNO.Replace(",", "','") + "'";
strCondition += " and A.gid in (" + tempBillNO.Trim() + ")";
}
//
string strAuthorityCondition = "";
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modRecvSettleList");
if (userAuthorityManage.OperateType != AuthorityType.NULL)
{
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.RECVSETTLELIST, strShowName, strCompanyID, strDeptName, strUserID);
}
//
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "RECVSETTLELIST");
//
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = " SELECT A.GID as 惟一编号,A.BILLNO as 结算编号,A.BILLDATE as 单据日期,(case A.SETTLEMODE when '1' then '申请' when '2' then '自由' when '3' then '发票' when '4' then '流程' else '' end) as 结算类别,A.CUSTOMERNAME as 结算客户,(case A.SETTLETYPE when '1' then '现金' when '2' then '支票' when '3' then '电汇' when '4' then '转账' when '5' then '承兑汇票' else '' end) as 结算方式,A.AMOUNTRMB as 人民币金额,A.ACCOUNTRMB as 人民币账户,A.RATE as 汇率,A.AMOUNTUSD as 美元金额,A.ACCOUNTUSD as 美元账户,(case A.BILLSTATUS when '1' then '锁定' else '未锁定' end) as 单据用途,A.VOUCHERNO as 凭证号,(select top 1 [SHOWNAME] from [user] where A.SETTLEUSER = [user].GID) as 结算人,A.SETTLETIME as 结算时间,(select top 1 [SHOWNAME] from [user] where A.AUDITUSER = [user].GID) as 审核人,A.AUDITTIME as 审核时间,A.ISEXPORT as 是否进行财务凭证导出,A.FINANCIALVOUCHER as 财务凭证,A.BILLSTATUS as 单据状态,A.REMARK as 备注,A.VOUNO as 财务生成的凭证号,A.ACCOUNTS_CURRENCY as 记账资料_币别,A.ACCOUNTS_RATE as 记账资料_汇率,A.ACCOUNTS_MONEY as 记账资料_金额,A.PREPAY_CURRENCY as 预付支资料_币别,A.PREPAY_RATE as 预付支资料_汇率,A.PREPAY_MONEY as 预付支资料_金额,A.AHSR_CURRENCY as 实付支资料_币别,A.AHSR_RATE as 实付支资料_汇率,A.AHSR_MONEY as 实付支资料_金额,A.FINANCIAL_CURRENCY as 财务费用_币别,A.FINANCIAL_RATE as 财务费用_汇率,A.FINANCIAL_MONEY as 财务费用_金额,A.ADVANCE_CURRENCY as 预付支取用资料_币别,A.ADVANCE_RATE as 预付支取用资料_汇率,A.ADVANCE_MONEY as 预付支取用资料_金额"
+ ",发票号=(select top 1 INVOICENUM from ch_fee where gid in (select top 1 feeid from ch_fee_do where billno=A.billno))"
+ " FROM ch_fee_settlement as A WHERE BILLNO LIKE '%DR%' "
+ strAuthorityCondition + strCondition
+ " AND ISNULL(ISDELETE,0) <> 1 ORDER BY BILLNO DESC ";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "RECVSETTLELIST";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = " SELECT A.GID as 惟一编号,A.BILLNO as 结算编号,A.BILLDATE as 单据日期,(case A.SETTLEMODE when '1' then '申请' when '2' then '自由' when '3' then '发票' when '4' then '流程' else '' end) as 结算类别,A.CUSTOMERNAME as 结算客户,(case A.SETTLETYPE when '1' then '现金' when '2' then '支票' when '3' then '电汇' when '4' then '转账' when '5' then '承兑汇票' else '' end) as 结算方式,A.AMOUNTRMB as 人民币金额,A.ACCOUNTRMB as 人民币账户,A.RATE as 汇率,A.AMOUNTUSD as 美元金额,A.ACCOUNTUSD as 美元账户,(case A.BILLSTATUS when '1' then '锁定' else '未锁定' end) as 单据用途,A.VOUCHERNO as 凭证号,(select top 1 [SHOWNAME] from [user] where A.SETTLEUSER = [user].GID) as 结算人,A.SETTLETIME as 结算时间,(select top 1 [SHOWNAME] from [user] where A.AUDITUSER = [user].GID) as 审核人,A.AUDITTIME as 审核时间,A.ISEXPORT as 是否进行财务凭证导出,A.FINANCIALVOUCHER as 财务凭证,A.BILLSTATUS as 单据状态,A.REMARK as 备注,A.VOUNO as 财务生成的凭证号,A.ACCOUNTS_CURRENCY as 记账资料_币别,A.ACCOUNTS_RATE as 记账资料_汇率,A.ACCOUNTS_MONEY as 记账资料_金额,A.PREPAY_CURRENCY as 预付支资料_币别,A.PREPAY_RATE as 预付支资料_汇率,A.PREPAY_MONEY as 预付支资料_金额,A.AHSR_CURRENCY as 实付支资料_币别,A.AHSR_RATE as 实付支资料_汇率,A.AHSR_MONEY as 实付支资料_金额,A.FINANCIAL_CURRENCY as 财务费用_币别,A.FINANCIAL_RATE as 财务费用_汇率,A.FINANCIAL_MONEY as 财务费用_金额,A.ADVANCE_CURRENCY as 预付支取用资料_币别,A.ADVANCE_RATE as 预付支取用资料_汇率,A.ADVANCE_MONEY as 预付支取用资料_金额"
+ ",发票号=(select top 1 INVOICENUM from ch_fee where gid in (select top 1 feeid from ch_fee_do where billno=A.billno))"
+ " FROM ch_fee_settlement as A WHERE BILLNO LIKE '%DR%' "
+ strAuthorityCondition + strCondition
+ " AND ISNULL(ISDELETE,0) <> 1 ORDER BY BILLNO DESC ";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印付费结算列表报表
/// <summary>
/// 打印付费结算列表报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBillNO">业务编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPaySettleListReport(string tempUserID, string tempBillNO, string tempSearch)
{
string strCondition = "";
string strAmount1 = "";
string strAmount2 = "";
//
if (!tempSearch.Trim().Equals(""))
{
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://Customer
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://BillNO
strCondition += String.Format(" AND convert(char(10),A.SETTLETIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://ETD BeginDate
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no":
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%'", strArg[1].Replace("\"", ""));
break;
case "mblno":
strCondition += String.Format(" AND A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where bsno in (select bsno from VW_Settlement where MBLNO LIKE '%{0}%')) and BILLNO LIKE '%CR%') ", strArg[1].Replace("\"", ""));
break;
case "other":
strCondition += String.Format(" AND A.BILLNO in (select BILLNO from ch_fee_do where feeid in (select gid from ch_fee where CHEQUENUM LIKE '%{0}%') and BILLNO LIKE '%CR%') ", strArg[1].Replace("\"", ""));
break;
case "amount1"://
strAmount1 = strArg[1].Replace("\"", "");
break;
case "amount2"://
strAmount2 = strArg[1].Replace("\"", "");
break;
default:
break;
}
}
}
//
if (strAmount1.Trim() != "" && strAmount2.Trim() != "")
{
strCondition += String.Format(" AND ((A.AMOUNTRMB >= '{0}' and A.AMOUNTRMB <= '{1}') or (A.AMOUNTUSD >= '{0}' and A.AMOUNTUSD <= '{1}'))", strAmount1.Trim(), strAmount2.Trim());
}
else
{
if (strAmount1.Trim() != "")
{
strCondition += String.Format(" AND (A.AMOUNTRMB >= '{0}' or A.AMOUNTUSD >= '{0}')", strAmount1.Trim());
}
else if (strAmount2.Trim() != "")
{
strCondition += String.Format(" AND (A.AMOUNTRMB <= '{1}' or A.AMOUNTUSD <= '{1}')", strAmount2.Trim());
}
}
}
//
if (tempBillNO.Trim() != "")
{
tempBillNO = "'" + tempBillNO.Replace(",", "','") + "'";
strCondition += " and A.gid in (" + tempBillNO.Trim() + ")";
}
//
string strAuthorityCondition = "";
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modPaySettlementList");
if (userAuthorityManage.OperateType != AuthorityType.NULL)
{
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.PAYSETTLELIST, strShowName, strCompanyID, strDeptName, strUserID);
}
//
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PAYSETTLELIST");
//
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = " SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '锁定' else '未锁定' end) as BILLSTATUS,(case A.SETTLEMODE when '1' then '申请' when '2' then '自由' when '3' then '发票' when '4' then '流程' else '' end) as SETTLEMODE,A.CUSTOMERNAME,(case A.SETTLETYPE when '1' then '现金' when '2' then '支票' when '3' then '电汇' when '4' then '转账' when '5' then '承兑汇票' else '' end) as SETTLETYPE"
+ ",CHEQUENUM=(select top 1 CHEQUENUM from ch_fee where gid in (select top 1 feeid from ch_fee_do where billno=A.billno))"
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),' ') REMARK "
+ " FROM ch_fee_settlement as A INNER JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE '%CR%' "
+ strAuthorityCondition + strCondition
+ " AND ISNULL(ISDELETE,0) <> 1 ORDER BY BILLNO DESC ";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PAYSETTLELIST";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = " SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '锁定' when '2' then '未锁定' when '3' then '结算撤销' else '' end) as BILLSTATUS,(case A.SETTLEMODE when '1' then '申请' when '2' then '自由' when '3' then '发票' when '4' then '流程' else '' end) as SETTLEMODE,A.CUSTOMERNAME,(case A.SETTLETYPE when '1' then '现金' when '2' then '支票' when '3' then '电汇' when '4' then '转账' when '5' then '承兑汇票' else '' end) as SETTLETYPE"
+ ",CHEQUENUM=(select top 1 CHEQUENUM from ch_fee where gid in (select top 1 feeid from ch_fee_do where billno=A.billno))"
+ ",A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME,A.SETTLETIME,replace(replace(A.REMARK,char(13),'|'),char(10),' ') REMARK "
+ " FROM ch_fee_settlement as A INNER JOIN [user] as B ON A.SETTLEUSER = B.GID WHERE BILLNO LIKE '%CR%' "
+ strAuthorityCondition + strCondition
+ " AND ISNULL(ISDELETE,0) <> 1 ORDER BY BILLNO DESC ";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印发票报表
/// <summary>
/// 打印发票报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempInvoiceID">发票编号</param>
/// <returns>返回JSON对象</returns>
private string PrintInvoiceReport(string tempUserID, string tempInvoiceID)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "QDSK");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_invoice WHERE GID = '" + tempInvoiceID + "'";
reportDBSourceEntity.SqlString_2 = "SELECT C.GID,C.BSNO,CASE WHEN C.FEETYPE = 1 THEN '收' ELSE '付' END as FEETYPE,C.FEENAME,C.CUSTOMERNAME,C.UNIT, C.UNITPRICE,C.QUANTITY,C.AMOUNT,C.CURRENCY,C.EXCHANGERATE,ISNULL(C.ORDERINVOICE,0) as ORDERINVOICE,C.AMOUNT - ISNULL(C.ORDERINVOICE,0) as UNORDERINVOICE FROM ch_fee_do as A INNER JOIN ch_fee_invoiceapplication as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON A.FEEID = C.GID WHERE B.GID = '" + tempInvoiceID + "' AND A.CATEGORY = 6";
reportDBSourceEntity.SqlString_3 = " SELECT CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS_name,* FROM VW_Settlement WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='" + tempInvoiceID + "' )";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "QDSK";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_invoice WHERE GID = '" + tempInvoiceID + "'";
reportDBSourceEntity.SqlString_2 = "SELECT C.GID,C.BSNO,CASE WHEN C.FEETYPE = 1 THEN '收' ELSE '付' END as FEETYPE,C.FEENAME,C.CUSTOMERNAME,C.UNIT, C.UNITPRICE,C.QUANTITY,C.AMOUNT,C.CURRENCY,C.EXCHANGERATE,ISNULL(C.ORDERINVOICE,0) as ORDERINVOICE,C.AMOUNT - ISNULL(C.ORDERINVOICE,0) as UNORDERINVOICE FROM ch_fee_do as A INNER JOIN ch_fee_invoiceapplication as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON A.FEEID = C.GID WHERE B.GID = '" + tempInvoiceID + "' AND A.CATEGORY = 6";
reportDBSourceEntity.SqlString_3 = " SELECT CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS_name,* FROM VW_Settlement WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='" + tempInvoiceID + "' )";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印申请发票报表
/// <summary>
/// 打印发票报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempInvoiceID">发票编号</param>
/// <returns>返回JSON对象</returns>
private string PrintInvoiceApplicationReport(string tempUserID, string tempInvoiceID)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PrintInvoiceApplicationReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_invoiceapplication WHERE GID = '" + tempInvoiceID + "'";
reportDBSourceEntity.SqlString_2 = "SELECT C.GID,C.BSNO,CASE WHEN C.FEETYPE = 1 THEN '收' ELSE '付' END as FEETYPE,C.FEENAME,C.CUSTOMERNAME,C.UNIT, C.UNITPRICE,C.QUANTITY,C.AMOUNT,C.CURRENCY,C.EXCHANGERATE,ISNULL(C.ORDERINVOICE,0) as ORDERINVOICE,C.AMOUNT - ISNULL(C.ORDERINVOICE,0) as UNORDERINVOICE FROM ch_fee_do as A INNER JOIN ch_fee_invoiceapplication as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON A.FEEID = C.GID WHERE B.GID = '" + tempInvoiceID + "' AND A.CATEGORY = 6";
reportDBSourceEntity.SqlString_3 = " SELECT CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS_name,* FROM VW_Settlement WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='" + tempInvoiceID + "' )";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PrintInvoiceApplicationReport";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM ch_fee_invoiceapplication WHERE GID = '" + tempInvoiceID + "'";
reportDBSourceEntity.SqlString_2 = "SELECT C.GID,C.BSNO,CASE WHEN C.FEETYPE = 1 THEN '收' ELSE '付' END as FEETYPE,C.FEENAME,C.CUSTOMERNAME,C.UNIT, C.UNITPRICE,C.QUANTITY,C.AMOUNT,C.CURRENCY,C.EXCHANGERATE,ISNULL(C.ORDERINVOICE,0) as ORDERINVOICE,C.AMOUNT - ISNULL(C.ORDERINVOICE,0) as UNORDERINVOICE FROM ch_fee_do as A INNER JOIN ch_fee_invoiceapplication as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON A.FEEID = C.GID WHERE B.GID = '" + tempInvoiceID + "' AND A.CATEGORY = 6";
reportDBSourceEntity.SqlString_3 = " SELECT CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS_name,* FROM VW_Settlement WHERE BSNO IN (SELECT DISTINCT B.BSNO FROM ch_fee_invoiceapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO WHERE A.GID ='" + tempInvoiceID + "' )";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印提单签发报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeblissueReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBLISSUE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT A.* FROM op_seae as A INNER JOIN op_blissue as B ON A.BSNO = B.BSNO WHERE BSINKNO='" + tempBSNO.Trim() + "' AND DELFLAG = 0 AND BLSTATUS = '申请提单'";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBLISSUE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT BSNO FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_blissue where 1=1 and BSINKNO='" + tempBSNO.Trim() + "' and DElFLAG=0 and BLSTATUS='申请提单'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出口派车通知报表
/// <summary>
/// 打印出口派车通知报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeBusinessTruckReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBUSINESSTRUCK");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBUSINESSTRUCK";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印进口派车通知报表
/// <summary>
/// 打印进口派车通知报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaiBusinessTruckReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAIBUSINESSTRUCK");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "seaiBUSINESSTRUCK";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_truck ON op_letter.LE_ID = op_letter_truck.LE_ID and op_letter_truck.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印电放保函报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeBusinessSurReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBUSINESSSUR");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_sur ON op_letter.LE_ID = op_letter_sur.LE_ID and op_letter_sur.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_sur ON op_letter.LE_ID = op_letter_sur.LE_ID and op_letter_sur.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBUSINESSSUR";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_sur ON op_letter.LE_ID = op_letter_sur.LE_ID and op_letter_sur.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_sur ON op_letter.LE_ID = op_letter_sur.LE_ID and op_letter_sur.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印入货通知报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeBusinessIntoGoodsReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBUSINESSINTOGOODS");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_yard ON op_letter.LE_ID = op_letter_yard.LE_ID and op_letter_yard.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_yard ON op_letter.LE_ID = op_letter_yard.LE_ID and op_letter_yard.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "SELECT Y.LE_ID, Y.MBLNO, Y.PORTDISCHARGE, Y.VESSELVOYNO, Y.ETD, Y.PKC, Y.CNTR, Y.DESCRIPTION, Y.YARD, Y.Address, Y.Tel, Y.YARD2,Y.Address2, Y.Tel2, Y.DRQ, Y.CLOSEDOCDATE, Y.ExportCustoms, Y.CustomsCode, Y.DeclarationCode, Y.REMARK, Y.CLOSINGDATE, Y.DOC, Y.CHIEF, Y.CHIEF2, Y.DOCTEL, Y.DOCFAX, Y.DOCEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS Expr1, B.USERID, B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK AS Expr2, B.CREATEUSER AS Expr3, B.CREATETIME, B.MODIFIEDUSER AS Expr4, B.MODIFIEDTIME AS Expr5, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter_yard AS Y INNER JOIN [user] AS U ON Y.DOC = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where Y.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//单证的基本信息
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBUSINESSINTOGOODS";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_yard ON op_letter.LE_ID = op_letter_yard.LE_ID and op_letter_yard.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_yard ON op_letter.LE_ID = op_letter_yard.LE_ID and op_letter_yard.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "SELECT Y.LE_ID, Y.MBLNO, Y.PORTDISCHARGE, Y.VESSELVOYNO, Y.ETD, Y.PKC, Y.CNTR, Y.DESCRIPTION, Y.YARD, Y.Address, Y.Tel, Y.YARD2,Y.Address2, Y.Tel2, Y.DRQ, Y.CLOSEDOCDATE, Y.ExportCustoms, Y.CustomsCode, Y.DeclarationCode, Y.REMARK, Y.CLOSINGDATE, Y.DOC, Y.CHIEF, Y.CHIEF2, Y.DOCTEL, Y.DOCFAX, Y.DOCEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS Expr1, B.USERID, B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK AS Expr2, B.CREATEUSER AS Expr3, B.CREATETIME, B.MODIFIEDUSER AS Expr4, B.MODIFIEDTIME AS Expr5, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter_yard AS Y INNER JOIN [user] AS U ON Y.DOC = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where Y.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//单证的基本信息
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印更改通知报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeBusinessChangeReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBUSINESSCHANGE");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_change ON op_letter.LE_ID = op_letter_change.LE_ID and op_letter_change.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_change ON op_letter.LE_ID = op_letter_change.LE_ID and op_letter_change.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBUSINESSCHANGE";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT op_letter.BSNO FROM op_letter INNER JOIN op_letter_change ON op_letter.LE_ID = op_letter_change.LE_ID and op_letter_change.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_letter INNER JOIN op_letter_change ON op_letter.LE_ID = op_letter_change.LE_ID and op_letter_change.LE_ID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT L.LE_ID, L.BSNO, L.HEAD_TO, L.HEAD_ATTN, L.LETTERNAME, L.INPUTBY, L.INPUTTIME, L.UpdateTime, L.HEAD_ATTNTEL, L.HEAD_ATTNFAX,L.HEAD_FMTEL, L.HEAD_FMFAX, L.HEAD_FMEMAIL, U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME, U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME, U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME, B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE, B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE, B.SIGNATURE FROM op_letter AS L INNER JOIN [user] AS U ON L.INPUTBY = U.SHOWNAME INNER JOIN user_baseinfo AS B ON U.GID = B.USERID where L.LE_ID = '" + tempBSNO + "' and U.ISDELETED=0 and U.ISDISABLE=0";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_letter AS L INNER JOIN info_client AS C ON L.HEAD_TO = C.SHORTNAME WHERE (C.ISSTOP = 0 and L.LE_ID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印提单信息报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">id编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaeBillOfLadingReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAEBILLOFLADING");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT BSNO FROM op_seae_billmanage where AS_ID='" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_seae_billmanage where AS_ID='" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAEBILLOFLADING";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae where BSNO=(SELECT BSNO FROM op_seae_billmanage where AS_ID='" + tempBSNO + "')";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM op_seae_billmanage where AS_ID='" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印委托报表
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaOpReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOP");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "select CTN_ID,BSNO,CTNCODE as 箱型代码,SIZE as 尺寸,CTN as 箱型,CTNNUM as 箱量,TEU,CTNALL as 表现形式,CNTRNO as 箱号,SEALNO as 封号,PKGS as 件,KGS as 重,CBM as 尺,REMARK as 备注,KINDPKGS as 包装类型,TAREWEIGHT as 箱皮重,GOODSNAME as 品名 from [op_ctn] where BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAOP";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "select CTN_ID,BSNO,CTNCODE as 箱型代码,SIZE as 尺寸,CTN as 箱型,CTNNUM as 箱量,TEU,CTNALL as 表现形式,CNTRNO as 箱号,SEALNO as 封号,PKGS as 件,KGS as 重,CBM as 尺,REMARK as 备注,KINDPKGS as 包装类型,TAREWEIGHT as 箱皮重,GOODSNAME as 品名 from [op_ctn] where BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印海运进口委托报表
/// <summary>
/// 打印海运进口委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaiReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOP");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seai AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAOP";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seai AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印仓储入库信息报表
/// <summary>
/// 打印仓储入库信息报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsInReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOP");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT GID,ASSOCIATEDNO,BLNO,CONTRACTNO,CNTRNO,SEALNO,BSNO,CLIENTCODE,CLIENTNAME,convert(char(10),DODATE,20) AS DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME,GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,GOODSPACKSTOCK,GOODSKGS,CHARGEUNIT,GOODSRKSL,GOODSSTOCK,FREESTORAGEPERIOD,ISLOCK,LOCKTIME,LOCKUSER,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,CLIENTCODEOLD,CLIENTNAMEOLD FROM wms_in WHERE GID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "select BSNO,ORDERTYPE,MASTERNO,CUSTNO,MBLNO,HBLNO,BSSTATUS,FEESTATUS,convert(char(10),BSDATE,20) AS BSDATE,ACCDATE,CUSTOMERNAME,BSSOURCE,BSSOURCEDETAIL,INPUTBY,OP,CUSTSERVICE,SALE,CORPID,SALEDEPT,CREATETIME,VESSEL,VOYNO,convert(char(10),ETD,20) AS ETD,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,CNTRTOTAL,GOODSNAME,COUNTRYOFORIGIN,NUMBERPLATE,CONTRACTNO,UNITS,BALES,KGS,NETWEIGHT,CUSTOMSER,CUSTOMNO,convert(char(10),CUSTOMDATE,20) AS CUSTOMDATE,INSPECTION,INSPECTIONNO,convert(char(10),INSPECTIONDATE,20) AS INSPECTIONDATE,FBP,convert(char(10),BMDDATE,20) AS BMDDATE,convert(char(10),MDTDATE,20) AS MDTDATE,UNITOFWEIGHT,PKGS,ISVOU,VOUNO from op_seai WHERE BSNO in(Select ASSOCIATEDNO FROM wms_in WHERE GID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_3 = "select CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT from op_ctn WHERE BSNO in(Select ASSOCIATEDNO FROM wms_in WHERE GID = '" + tempBSNO + "') and CNTRNO in(Select CNTRNO FROM wms_in WHERE GID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "SELECT TOP (1) C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE, C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE,C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT, S.GID AS GID_S, S.LINKID, S.CODENAME AS CODENAME_S, S.SHOWNAME, S.ADDR AS ADDR_S, S.EMAIL AS EMAIL_S, S.TEL AS TEL_S, S.FAX AS FAX_S, S.MOBILE, S.ISFINANCIALSTAFF, S.ISOPERATOR, S.ISSALEMAN, S.ISOTHER, S.CONTACTTYPE1, S.CONTACTTYPE2, S.CONTACTTYPE3, S.CONTACTTYPE4, S.CONTACTTYPE5, S.CONTACTTYPE6, S.CONTACTTYPE7, S.CREATEUSER, S.CREATETIME, S.ISDELETED FROM info_client_contact AS S INNER JOIN info_client AS C ON S.LINKID = C.GID WHERE (C.ISSTOP = 0) AND (S.ISDELETED = 0) AND (C.SHORTNAME IN (SELECT STORAGENAME FROM wms_in WHERE (GID = '" + tempBSNO + "')))";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM wms_in AS S INNER JOIN info_client AS C ON S.CLIENTNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.gid = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAOP";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT GID,ASSOCIATEDNO,BLNO,CONTRACTNO,CNTRNO,SEALNO,BSNO,CLIENTCODE,CLIENTNAME,convert(char(10),DODATE,20) AS DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME,GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,GOODSPACKSTOCK,GOODSKGS,CHARGEUNIT,GOODSRKSL,GOODSSTOCK,FREESTORAGEPERIOD,ISLOCK,LOCKTIME,LOCKUSER,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,REMARK,CLIENTCODEOLD,CLIENTNAMEOLD FROM wms_in WHERE GID = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "select BSNO,ORDERTYPE,MASTERNO,CUSTNO,MBLNO,HBLNO,BSSTATUS,FEESTATUS,convert(char(10),BSDATE,20) AS BSDATE,ACCDATE,CUSTOMERNAME,BSSOURCE,BSSOURCEDETAIL,INPUTBY,OP,CUSTSERVICE,SALE,CORPID,SALEDEPT,CREATETIME,VESSEL,VOYNO,convert(char(10),ETD,20) AS ETD,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,CNTRTOTAL,GOODSNAME,COUNTRYOFORIGIN,NUMBERPLATE,CONTRACTNO,UNITS,BALES,KGS,NETWEIGHT,CUSTOMSER,CUSTOMNO,convert(char(10),CUSTOMDATE,20) AS CUSTOMDATE,INSPECTION,INSPECTIONNO,convert(char(10),INSPECTIONDATE,20) AS INSPECTIONDATE,FBP,convert(char(10),BMDDATE,20) AS BMDDATE,convert(char(10),MDTDATE,20) AS MDTDATE,UNITOFWEIGHT,PKGS,ISVOU,VOUNO from op_seai WHERE BSNO in(Select ASSOCIATEDNO FROM wms_in WHERE GID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_3 = "select CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT from op_ctn WHERE BSNO in(Select ASSOCIATEDNO FROM wms_in WHERE GID = '" + tempBSNO + "') and CNTRNO in(Select CNTRNO FROM wms_in WHERE GID = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "SELECT TOP (1) C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE, C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE,C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT, S.GID AS GID_S, S.LINKID, S.CODENAME AS CODENAME_S, S.SHOWNAME, S.ADDR AS ADDR_S, S.EMAIL AS EMAIL_S, S.TEL AS TEL_S, S.FAX AS FAX_S, S.MOBILE, S.ISFINANCIALSTAFF, S.ISOPERATOR, S.ISSALEMAN, S.ISOTHER, S.CONTACTTYPE1, S.CONTACTTYPE2, S.CONTACTTYPE3, S.CONTACTTYPE4, S.CONTACTTYPE5, S.CONTACTTYPE6, S.CONTACTTYPE7, S.CREATEUSER, S.CREATETIME, S.ISDELETED FROM info_client_contact AS S INNER JOIN info_client AS C ON S.LINKID = C.GID WHERE (C.ISSTOP = 0) AND (S.ISDELETED = 0) AND (C.SHORTNAME IN (SELECT STORAGENAME FROM wms_in WHERE (GID = '" + tempBSNO + "')))";
reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM wms_in AS S INNER JOIN info_client AS C ON S.CLIENTNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.gid = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印仓储装卸费入库信息报表
/// <summary>
/// 打印仓储装卸费入库信息报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsZXInReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOP");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT * FROM VW_WMS_IN WHERE ASSOCIATEDNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAOP";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT * FROM VW_WMS_IN WHERE ASSOCIATEDNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印委托报表Fee
/// <summary>
/// 打印委托报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaiFeeReport(string tempUserID,string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOP");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_1 = String.Format("SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = {0}"
+ " union all "
+ "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seai WHERE BSNO = {0}"
, tempBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
//reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_6 = String.Format("SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = {0})"
+ " union all "
+ "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seai AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = {0})"
, tempBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "SEAOP";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_1 = String.Format("SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seae WHERE BSNO = {0}"
+ " union all "
+ "SET LANGUAGE 'us_english' SELECT *,CONVERT(varchar(100), ISSUEDATE, 107) as ISSUEDATE_EN,(case BLTYPE when '整箱' then 'FCL' else 'LCL' end) as BLTYPE_CL FROM op_seai WHERE BSNO = {0}"
, tempBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
//reportDBSourceEntity.SqlString_6 = "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = '" + tempBSNO + "')";
reportDBSourceEntity.SqlString_6 = String.Format("SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seae AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = {0})"
+ " union all "
+ "SELECT C.GID, C.CODENAME, C.SHORTNAME, C.DESCRIPTION, C.NAME, C.EnFullName, C.STATUS, C.ADDR, C.EMAIL, C.WEB, C.TEL, C.FAX, C.CHIEF, C.SALE, C.OP, C.DOC, C.ISCARRIER, C.ISBOOKING, C.ISYARD, C.ISTRUCK, C.ISCONTROLLER, C.ISCUSTOM, C.ISAGENT, C.ISAGENTCN, C.ISEXPRESS,C.ISAIRLINES, C.ISSHIPPER, C.ISCONSIGNEE, C.ISNOTIFYPARTY, C.ISWAREHOUSE, C.COUNTRY, C.PROVINCE, C.CITY, C.CORPID, C.BLCONTENT, C.ISSTOP, C.BillRises1, C.BillRises2, C.USDBillRises, C.RMBBillRises, C.RMBBank, C.RMBAccount, C.RMBOnlineNO, C.USDBank, C.USDAccount, C.USDOnlineNO, C.CustomAttributes1, C.CustomAttributes2, C.FARCODE,C.FAPCODE, C.USDMaxAmountCredit, C.RMBMaxAmountCredit, C.MaxAmountCredit, C.STLNAME, C.OPNAME, C.OPTIME, C.REMARK, C.USDExchangeRate, C.STLDATE, C.STLFIRSTHALFDATE, C.STLMIDDLEDATE, C.STLDATEPJ, C.[LEVEL], C.LOGINNAME, C.LOGINPASSWORD, C.QQ, C.MSN, C.MODIFIEDUSER, C.MODIFIEDTIME, C.ISWHARF, C.ISSHIPPINGAGENT FROM op_seai AS S INNER JOIN info_client AS C ON S.CUSTOMERNAME = C.SHORTNAME WHERE (C.ISSTOP = 0 and S.BSNO = {0})"
, tempBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID,strUserID);
}
else
{
strResult = GetJosonResult("", "","");
}
}
return strResult;
}
#endregion
#region 打印委托(op_seae)应收应付费用报表返回JSON对象
/// <summary>
/// 打印委托(op_seae)应收应付费用报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaOpFeeReport(string tempUserID, string tempBSNO,int tempFeeType,string tempFeeGids)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
if (tempFeeType == 1)
{ //根据用户GID和报表类型获取报表数据源sys_report_dbsource
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOPFEEDR");
}
else
{ //根据用户GID和报表类型获取报表数据源sys_report_dbsource
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOPFEECR");
}
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = {0}"
// + " union all "
// + "SELECT * FROM op_seai WHERE BSNO = {0}"
// , tempBSNO);
if (stroplb == "op_Seae")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = '{0}'", tempBSNO);
}
else if (stroplb == "op_Seai")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seai WHERE BSNO = '{0}'", tempBSNO);
}
//reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
if (tempFeeType == 1)
{
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND CUSTOMERNAME IN (" + strSearch + ") AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC ";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
}
else
{
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND CUSTOMERNAME IN (" + strSearch + ") AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
}
reportDBSourceEntity.SqlString_3 = "";//"SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = "SELECT b.BANKNAME, c.CODENAME, c.NAME, c.FULLNAME, c.ENNAME, c.ADDRESS, c.ENADDRESS, c.POSTCODE, c.OFFICEPHONE, c.FAX, c.EMAIL, c.WEBSITEURL, c.LICENSECODE, c.TAXCODE, c.LOGO, c.CREATEUSER, c.CREATETIME, c.MODIFIEDUSER, c.MODIFIEDTIME, c.ISDELETED, c.ISDISABLE, c.PARENTID, c.BILLRISES, c.CHEQUEPAYABLE, c.PRTHEADXML1, c.PRTHEADXML2, c.PRTHEADXML3, c.PRTHEADXML4, c.PRTHEADXML5, c.BANKSHEAD, b.GID, b.LINKID, b.CURRENCY, b.ACCOUNT, b.SUBJECTCODE, b.REMARK, b.FINANCESOFTCODE FROM company AS c INNER JOIN sys_bank AS b ON c.GID = b.LINKID WHERE b.LINKID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seae WHERE BSNO = '" + tempBSNO + "'";
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = {0}"
// + " union all "
// + "SELECT * FROM op_seai WHERE BSNO = {0}"
// , tempBSNO);
if (stroplb == "op_Seae")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = '{0}'", tempBSNO);
}
else if (stroplb == "op_Seai")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seai WHERE BSNO = '{0}'", tempBSNO);
}
//reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
if (tempFeeType == 1)
{
reportDBSourceEntity.Type = "SEAOPFEEDR";
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND CUSTOMERNAME IN (" + strSearch + ") AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
}
else
{
reportDBSourceEntity.Type = "SEAOPFEECR";
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND CUSTOMERNAME IN (" + strSearch + ") AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND gid IN (" + tempFeeGids + ") order by BSNO,LINENUM,ENTERDATE ASC";
}
}
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";//"SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = "SELECT b.BANKNAME, c.CODENAME, c.NAME, c.FULLNAME, c.ENNAME, c.ADDRESS, c.ENADDRESS, c.POSTCODE, c.OFFICEPHONE, c.FAX, c.EMAIL, c.WEBSITEURL, c.LICENSECODE, c.TAXCODE, c.LOGO, c.CREATEUSER, c.CREATETIME, c.MODIFIEDUSER, c.MODIFIEDTIME, c.ISDELETED, c.ISDISABLE, c.PARENTID, c.BILLRISES, c.CHEQUEPAYABLE, c.PRTHEADXML1, c.PRTHEADXML2, c.PRTHEADXML3, c.PRTHEADXML4, c.PRTHEADXML5, c.BANKSHEAD, b.GID, b.LINKID, b.CURRENCY, b.ACCOUNT, b.SUBJECTCODE, b.REMARK, b.FINANCESOFTCODE FROM company AS c INNER JOIN sys_bank AS b ON c.GID = b.LINKID WHERE b.LINKID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印委托op_seae费用利润报表返回JSON对象
/// <summary>
/// 打印委托op_seae费用利润报表返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaOpFeeGainReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAOPGAIN");
//区分打印利润报表
string strsel = " and BSNO = '" + tempBSNO + "' and FEENAME in (select [name] from code_fee where FEETYPE='普通') ";//全部费用利润
if (strGainType != null)
{
if (strGainType.ToString().Trim() == "sea")
{
strsel = " and BSNO = '" + tempBSNO + "' and FEENAME in (select [name] from code_fee where FEETYPE='普通' and ISWMS=0) ";//海运费利润
}
else if (strGainType.ToString().Trim() == "wms")
{
strsel = " and BSNO = '" + tempBSNO + "' and FEENAME in (select [name] from code_fee where FEETYPE='普通' and ISWMS=1) ";//仓储利润
}
}
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
if (stroplb == "op_Seae")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = '{0}' ", tempBSNO);
}
else if (stroplb == "op_Seai")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seai WHERE BSNO = '{0}' ", tempBSNO);
}
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE FEETYPE = 1 " + strsel + " order by LINENUM,SORT";
reportDBSourceEntity.SqlString_3 = "SELECT * FROM ch_fee WHERE FEETYPE = 2 " + strsel + " order by LINENUM,SORT";
//reportDBSourceEntity.SqlString_4 = "SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";//全部费用利润
//全部费用利润 或 海运费利润 或 仓储利润
reportDBSourceEntity.SqlString_4 = "SELECT BSNO"
+ ",SUM(RMBDR) as RMBDR,SUM(RMBCR) as RMBCR,SUM(USDDR) as USDDR,SUM(USDCR) as USDCR"
+ ",SUM(RMBDR+USDTORMBDR) as DRTTL"
+ ",SUM(RMBCR+USDTORMBCR) as CRTTL"
+ ",(SUM(RMBDR)-SUM(RMBCR)) AS RMBPROFIT"
+ ",(SUM(USDDR)-SUM(USDCR)) AS USDPROFIT"
+ ",SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT"
//+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)-SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",'" + strShowName + "' as CREATEUSER,GETDATE() as CREATETIME "
+ " FROM ("
+ "SELECT BSNO,CURRENCY,FEETYPE"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR "
+ " FROM ch_fee WHERE 1=1 " + strsel
+ " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE "
+ " ) AS C GROUP BY BSNO ";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = "SELECT b.BANKNAME, c.CODENAME, c.NAME, c.FULLNAME, c.ENNAME, c.ADDRESS, c.ENADDRESS, c.POSTCODE, c.OFFICEPHONE, c.FAX, c.EMAIL, c.WEBSITEURL, c.LICENSECODE, c.TAXCODE, c.LOGO, c.CREATEUSER, c.CREATETIME, c.MODIFIEDUSER, c.MODIFIEDTIME, c.ISDELETED, c.ISDISABLE, c.PARENTID, c.BILLRISES, c.CHEQUEPAYABLE, c.PRTHEADXML1, c.PRTHEADXML2, c.PRTHEADXML3, c.PRTHEADXML4, c.PRTHEADXML5, c.BANKSHEAD, b.GID, b.LINKID, b.CURRENCY, b.ACCOUNT, b.SUBJECTCODE, b.REMARK, b.FINANCESOFTCODE FROM company AS c INNER JOIN sys_bank AS b ON c.GID = b.LINKID WHERE b.LINKID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.Type = "SEAOPGAIN";
if (stroplb == "op_Seae")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seae WHERE BSNO = '{0}' ", tempBSNO);
}
else if (stroplb == "op_Seai")
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM op_seai WHERE BSNO = '{0}' ", tempBSNO);
}
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE FEETYPE = 1 " + strsel + " order by LINENUM,SORT";
reportDBSourceEntity.SqlString_3 = "SELECT * FROM ch_fee WHERE FEETYPE = 2 " + strsel + " order by LINENUM,SORT";
//reportDBSourceEntity.SqlString_4 = "SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";//全部费用利润
//全部费用利润 或 海运费利润 或 仓储利润
reportDBSourceEntity.SqlString_4 = "SELECT BSNO"
+ ",SUM(RMBDR) as RMBDR,SUM(RMBCR) as RMBCR,SUM(USDDR) as USDDR,SUM(USDCR) as USDCR"
+ ",SUM(RMBDR+USDTORMBDR) as DRTTL"
+ ",SUM(RMBCR+USDTORMBCR) as CRTTL"
+ ",(SUM(RMBDR)-SUM(RMBCR)) AS RMBPROFIT"
+ ",(SUM(USDDR)-SUM(USDCR)) AS USDPROFIT"
+ ",SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR) as TTLPROFIT"
//+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND((case when SUM(RMBDR+USDTORMBDR)=0 then 0 else (SUM(RMBDR+USDTORMBDR)- SUM(RMBCR+USDTORMBCR))/SUM(RMBDR+USDTORMBDR) END),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",(CAST(CAST(CASE WHEN SUM(RMBCR+USDTORMBCR) = 0 THEN 100 ELSE (ROUND(((SUM(RMBDR+USDTORMBDR)-SUM(RMBCR+USDTORMBCR))/SUM(RMBCR+USDTORMBCR)),4))*100 END as decimal(18,2)) as varchar(20))+'%') AS PROFITRATE"
+ ",'" + strShowName + "' as CREATEUSER,GETDATE() as CREATETIME "
+ " FROM ("
+ "SELECT BSNO,CURRENCY,FEETYPE"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as RMBDR"
+ ",SUM(CASE WHEN CURRENCY='RMB' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as RMBCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT ELSE 0 END) as USDDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT ELSE 0 END) as USDCR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 1 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBDR"
+ ",SUM(CASE WHEN CURRENCY='USD' AND FEETYPE = 2 THEN AMOUNT*EXCHANGERATE ELSE 0 END) as USDTORMBCR "
+ " FROM ch_fee WHERE 1=1 " + strsel
+ " GROUP BY BSNO,CURRENCY,EXCHANGERATE,FEETYPE "
+ " ) AS C GROUP BY BSNO ";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = "SELECT b.BANKNAME, c.CODENAME, c.NAME, c.FULLNAME, c.ENNAME, c.ADDRESS, c.ENADDRESS, c.POSTCODE, c.OFFICEPHONE, c.FAX, c.EMAIL, c.WEBSITEURL, c.LICENSECODE, c.TAXCODE, c.LOGO, c.CREATEUSER, c.CREATETIME, c.MODIFIEDUSER, c.MODIFIEDTIME, c.ISDELETED, c.ISDISABLE, c.PARENTID, c.BILLRISES, c.CHEQUEPAYABLE, c.PRTHEADXML1, c.PRTHEADXML2, c.PRTHEADXML3, c.PRTHEADXML4, c.PRTHEADXML5, c.BANKSHEAD, b.GID, b.LINKID, b.CURRENCY, b.ACCOUNT, b.SUBJECTCODE, b.REMARK, b.FINANCESOFTCODE FROM company AS c INNER JOIN sys_bank AS b ON c.GID = b.LINKID WHERE b.LINKID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印委托(op_seai)应收应付费用报表返回JSON对象
/// <summary>
/// 打印委托(op_seai)应收应付费用报表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaiOpFeeReport(string tempUserID, string tempBSNO, int tempFeeType)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
//根据用户GID获取用户公司信息
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
if (tempFeeType == 1)
{ //根据用户GID和报表类型获取报表数据源sys_report_dbsource
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAIOPFEEDR");
}
else
{ //根据用户GID和报表类型获取报表数据源sys_report_dbsource
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAIOPFEECR");
}
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
//reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
if (tempFeeType == 1)
{
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND CUSTOMERNAME IN (" + strSearch + ")";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1";
}
}
else
{
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND CUSTOMERNAME IN (" + strSearch + ")";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2";
}
}
reportDBSourceEntity.SqlString_3 = "";//"SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
//reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
if (tempFeeType == 1)
{
reportDBSourceEntity.Type = "SEAIOPFEEDR";
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1 AND CUSTOMERNAME IN (" + strSearch + ")";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1";
}
}
else
{
reportDBSourceEntity.Type = "SEAIOPFEECR";
if (!strSearch.Trim().Equals(""))
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 AND CUSTOMERNAME IN (" + strSearch + ")";
}
else
{
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2 ";
}
}
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";//"SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印委托op_seai费用利润报表返回JSON对象
/// <summary>
/// 打印委托op_seai费用利润报表返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintSeaiOpFeeGainReport(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "SEAIOPGAIN");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1";//"SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2";
reportDBSourceEntity.SqlString_4 = "SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.Type = "SEAIOPGAIN";
reportDBSourceEntity.SqlString_1 = "SELECT * FROM op_seai WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_2 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 1";//"SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_3 = "SELECT * FROM ch_fee WHERE BSNO = '" + tempBSNO + "' AND FEETYPE = 2";
reportDBSourceEntity.SqlString_4 = "SELECT * FROM fee_gain WHERE BSNO = '" + tempBSNO + "'";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出库单WmsOutEdit.aspx
/// <summary>
/// 打印出库单WmsOutEdit.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsOut(string tempUserID, string tempBSNO)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WMSOUTREPORT");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT GID,ASSOCIATEDNO,BSNO,CLIENTGID,CLIENTCODE,CUSTOMERNAME,convert(char(10),DODATE,120) as DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME, "
+ " GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,GOODSPFSL,GOODSOUTFEE,"
+ " replace(TRUCKNO,'×',char(13)+char(10)) TRUCKNO ,"
+ " REMARK,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,GOODSPACKPFSL,ARFEE,APFEE,INSPECTIONNO,CUSTOMNO,CORPID,CLIENTNAMEOLD,convert(char(10),OLDCUSTFEEDATE,120) as OLDCUSTFEEDATE,convert(char(10),VALIDDATE,120) as VALIDDATE,TOTALNO,REMARK2,CLIENTBSNO,blno=(select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=wms_out.bsno)) FROM wms_out WHERE BSNO='{0}' "
, tempBSNO);
reportDBSourceEntity.SqlString_2 = String.Format(" SELECT a.GID,b.BLNO,a.INBSNO,a.OUTBSNO,a.CUSTOMERNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,b.WMSDATE INDATE,convert(char(10),a.DODATE,120) as OUTDATE, "
+ " b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.GOODSOUTFEE, datediff(day,b.WMSDATE,a.DODATE)+1 days,a.feedays,a.TRUCKNO, a.CREATEUSER, a.CREATETIME, a.REMARK, a.ARFEE, a.APFEE, a.ISLOCK, a.LOCKTIME, a.LOCKUSER, a.CORPID, a.CLIENTNAMEOLD,convert(char(10),a.OLDCUSTFEEDATE,120) as OLDCUSTFEEDATE,convert(char(10),a.STARTBILLINGDATE,120) as STARTBILLINGDATE,convert(char(10),a.ENDBILLINGDATE,120) as ENDBILLINGDATE "
+ " FROM wms_out_detail a left outer join wms b on a.INBSNO=b.GID where b.ISDELETE=0 and b.ISLOCK=1 and a.OUTBSNO='{0}' "
+ " ORDER BY a.bsno ", tempBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID,FEEGRADE,FEETYPE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,convert(char(10),ENDBILLINGDATE,20) AS ENDBILLINGDATE,FEESCALE,FEEUNIT,FEEPRICE,GOODSPFSL,OUTFEE,REMARK,MODIFIEDUSER=(select top 1 SHOWNAME from [user] where gid=wms_rate_detail.MODIFIEDUSER),MODIFIEDTIME,ASSOCIATEDNO FROM wms_rate_detail WHERE ASSOCIATEDNO in (SELECT GID FROM wms_out_detail where OUTBSNO='{0}') ORDER BY ASSOCIATEDNO,FEETYPE,FEEGRADE,CREATETIME "
, tempBSNO);
reportDBSourceEntity.SqlString_4 = String.Format("select * from op_seai where bsno in (select top 1 ASSOCIATEDNO FROM wms_out WHERE BSNO='{0}')", tempBSNO);
reportDBSourceEntity.SqlString_5 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT CUSTOMERNAME FROM wms_out WHERE CUSTOMERNAME=info_client.SHORTNAME and BSNO='{0}')", tempBSNO);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT STORAGENAME FROM wms_out WHERE STORAGENAME=info_client.SHORTNAME and BSNO='{0}')", tempBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT GID,ASSOCIATEDNO,BSNO,CLIENTGID,CLIENTCODE,CUSTOMERNAME,convert(char(10),DODATE,120) as DODATE,STORAGECODE,STORAGENAME,AREACODE,AREANAME, "
+ " GOODSCODE,GOODSNAME,GOODSTYPE,GOODSMODEL,GOODSSTANDARD,GOODSPACK,GOODSPFSL,GOODSOUTFEE,"
+ " replace(TRUCKNO,'×',char(13)+char(10)) TRUCKNO ,"
+ " REMARK,ISDELETE,DELETETIME,DELETEUSER,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME,GOODSPACKPFSL,ARFEE,APFEE,INSPECTIONNO,CUSTOMNO,CORPID,CLIENTNAMEOLD,convert(char(10),OLDCUSTFEEDATE,120) as OLDCUSTFEEDATE,convert(char(10),VALIDDATE,120) as VALIDDATE,TOTALNO,REMARK2,CLIENTBSNO,blno=(select top 1 BLNO from wms where gid in (select inbsno from wms_out_detail where outbsno=wms_out.bsno)) FROM wms_out WHERE BSNO='{0}' "
, tempBSNO);
reportDBSourceEntity.SqlString_2 = String.Format(" SELECT a.GID,b.BLNO,a.INBSNO,a.OUTBSNO,a.CUSTOMERNAME,a.STORAGENAME,a.GOODSNAME,a.GOODSMODEL,b.WMSDATE INDATE,convert(char(10),a.DODATE,120) as OUTDATE, "
+ " b.GOODSRKSL,b.GOODSSTOCK,b.GOODSPACKSTOCK,a.GOODSPACKPFSL,a.GOODSPFSL,a.GOODSOUTFEE, datediff(day,b.WMSDATE,a.DODATE)+1 days,a.feedays,a.TRUCKNO, a.CREATEUSER, a.CREATETIME, a.REMARK, a.ARFEE, a.APFEE, a.ISLOCK, a.LOCKTIME, a.LOCKUSER, a.CORPID, a.CLIENTNAMEOLD,convert(char(10),a.OLDCUSTFEEDATE,120) as OLDCUSTFEEDATE,convert(char(10),a.STARTBILLINGDATE,120) as STARTBILLINGDATE,convert(char(10),a.ENDBILLINGDATE,120) as ENDBILLINGDATE "
+ " FROM wms_out_detail a left outer join wms b on a.INBSNO=b.GID where b.ISDELETE=0 and b.ISLOCK=1 and a.OUTBSNO='{0}' "
+ " ORDER BY a.bsno ", tempBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID,FEEGRADE,FEETYPE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,convert(char(10),ENDBILLINGDATE,20) AS ENDBILLINGDATE,FEESCALE,FEEUNIT,FEEPRICE,GOODSPFSL,OUTFEE,REMARK,MODIFIEDUSER=(select top 1 SHOWNAME from [user] where gid=wms_rate_detail.MODIFIEDUSER),MODIFIEDTIME,ASSOCIATEDNO FROM wms_rate_detail WHERE ASSOCIATEDNO in (SELECT GID FROM wms_out_detail where OUTBSNO='{0}') ORDER BY ASSOCIATEDNO,FEETYPE,FEEGRADE,CREATETIME "
, tempBSNO);
reportDBSourceEntity.SqlString_4 = String.Format("select * from op_seai where bsno in (select top 1 ASSOCIATEDNO FROM wms_out WHERE BSNO='{0}')", tempBSNO);//业务表
reportDBSourceEntity.SqlString_5 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT CUSTOMERNAME FROM wms_out WHERE CUSTOMERNAME=info_client.SHORTNAME and BSNO='{0}')", tempBSNO);//客户明细信息表
reportDBSourceEntity.SqlString_6 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT STORAGENAME FROM wms_out WHERE STORAGENAME=info_client.SHORTNAME and BSNO='{0}')", tempBSNO);//仓库明细信息表
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";//制单人信息表
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";//当前分公司信息表
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出库单列表WmsOutList.aspx
/// <summary>
/// 打印出库单列表WmsOutList.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsOutList(string tempUserID, string strSearch)
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "bt"://ETD BeginDate
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "et"://ETD EndDate
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "clientnameold"://
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
break;
case "storagename"://
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "ischange"://
string ls = strArg[1].Replace("\"", "");
if (ls.Trim() != "")
{
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
}
break;
case "bsno"://NO
strCondition += String.Format(" AND (a.outbsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.outbsno like '%{0}%') or a.outbsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%' or a.BZTCHNO like '%{0}%') ", strArg[1].Replace("\"", ""));
break;
case "associatedno"://NO
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "goods":
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "goodsstandard":
strCondition += String.Format(" AND a.outbsno in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
else
{
if (strassociatedno != "")
{
strCondition += String.Format(" AND ASSOCIATEDNO like '%{0}%' ", strassociatedno);
}
}
//
#region 权限可视范围
RangeDA RangeDA = new EntityDA.RangeDA();
//wms_out
string strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modWmsOutList");//仓储入库列表
if (strRange.Trim().Equals("0"))//全部
{
strRange = "";
}
else if (strRange.Trim().Equals("1"))//分公司
{
strRange = " and GID in(" + RangeDA.GetWmsOutListCompany(strCompanyID.Trim()) + ")";
}
else if (strRange.Trim().Equals("2"))//部门
{
strRange = " and GID in(" + RangeDA.GetWmsOutListDEPT(strDeptName, strCompanyID, strUserID) + ")";
}
else if (strRange.Trim().Equals("3"))//个人
{
strRange = " and GID in(" + RangeDA.GetWmsOutListPerson(strUserID, strCompanyID) + ")";
}
else if (strRange.Trim().Equals("4"))//无
{
strRange = " and 1<0";
}
else//空
{
strRange = " and 1<0";
}
strCondition += strRange;
#endregion
//
if (strBSNO != "" && strBSNO != null)
{
strBSNO = "'" + strBSNO.Replace(",", "','") + "'";
strCondition += String.Format(" AND OUTGID in ({0}) ", strBSNO);
}
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WMSOUTLISTREPORT");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT blno as 提单号,WMSDATE as 入库日期,WMSNO as 入库单号,OUTBSNO as 出库单号,OUTGID as 出库GID,GID as 出库明细GID,ASSOCIATEDNO as 业务GID,BSNO as 出库明细单号,CUSTOMERNAME as 货主,DODATE as 出库日期,STORAGENAME as 仓库,STORAGENAME_FULL as 仓库全称,AREANAME as 库位,GOODSNAME as 货物名称,GOODSTYPE as 货物类型,GOODSMODEL as 货物型号,GOODSSTANDARD as 货物规格,GOODSTHICKNESS as 厚度,GOODSWIDTH as 宽度,GOODSLENGTH as 长度,GOODSPACK as 入库件数,GOODSPFSL as 出库量,GOODSOUTFEE as 应收仓储费,TRUCKNO as 车号,REMARK as 出库明细备注,CREATEUSER as 出库明细创建人,CREATETIME as 出库明细创建时间,GOODSPACKPFSL as 出库件数,ISLOCK as 明细是否锁定,LOCKUSER as 明细锁定人,LOCKTIME as 明细锁定时间,GOODSOUTFEEAP as 应付仓储费,ARFEE as 出库费应收,APFEE as 出库费应付,INSPECTIONNO as 审批单号,CUSTOMNO as 备案清单号,CORPID as 分公司,CLIENTNAMEOLD as 原客户名称,OLDCUSTFEEDATE as 上家承担仓储期限,STARTBILLINGDATE as 应收开始计费日期,ENDBILLINGDATE as 应收结束计费日期,wmsdays as 仓储天数,FEEDAYS as 计费天数,FREESTORAGEPERIOD as 应收免仓储期,DESCRIPTION as 货主全称,EnFullName as 货主英文全称,NAME as 货主英文简称,ADDR as 货主地址,EMAIL as 货主邮箱,WEB as 货主WEB,TEL as 货主电话,FAX as 货主传真,CHIEF as 货主负责人,TOTALNO as 出库件数大写,REMARK2_OUT as 出库备注2,VALIDDATE as 出库有效期,REMARK_OUT as 出库备注1,GOODSGRADE as 品名的等级,GOODSSLICE as [片数/件],MBLNONEW as 货权转移的分单的提单号,CONTRACTNO as 合同号,BZTCHNO as 批次号 FROM VW_WmsOutList_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT GID as 惟一编号,FEEGRADE as 计费等级,FEETYPE as 费用类别,convert(char(10),STARTBILLINGDATE,20) AS 开始计费日期,convert(char(10),ENDBILLINGDATE,20) AS 结束计费日期,FEESCALE as 计费区间,FEEUNIT as 计费单位,FEEPRICE as 计费单价,GOODSPFSL as 出库量,OUTFEE as 仓储费,REMARK as 备注,(select top 1 SHOWNAME from [user] where gid=wms_rate_detail.MODIFIEDUSER) as 最后一次操作人,MODIFIEDTIME as 最后一次操作时间,ASSOCIATEDNO as 关联号 FROM wms_rate_detail WHERE ASSOCIATEDNO in (SELECT GID FROM wms_out_detail where GID in (SELECT a.GID FROM VW_WmsOutList_Print as a WHERE 1=1 {0})) ORDER BY ASSOCIATEDNO,FEETYPE,FEEGRADE,CREATETIME ", strCondition);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID as 仓储费率明细GID, FEETYPE as 费用类别, FEEGRADE as 计费等级, STARTBILLINGDATE as 开始计费日期, ENDBILLINGDATE as 结束计费日期, FEESCALE as 计费区间, FEEUNIT as 计费单位, FEEPRICE as 计费单价, GOODSPFSL as 仓储费率出库量, OUTFEE as 仓储费率仓储费, blno as 提单号, WMSDATE as 入库日期, WMSNO as 入库单号, OUTBSNO as 出库单号, OUTGID as 出库GID, GID as 出库明细GID, ASSOCIATEDNO as 业务GID, BSNO as 出库明细单号, CUSTOMERNAME as 货主, DODATE as 出库日期, STORAGENAME as 仓库, STORAGENAME_FULL as 仓库全称, AREANAME as 库位, GOODSNAME as 货物名称, GOODSTYPE as 货物类型, GOODSMODEL as 货物型号, GOODSSTANDARD as 货物规格, GOODSPACK as 入库件数, GOODSPFSL as 出库量, GOODSOUTFEE as 应收仓储费, TRUCKNO as 车号, REMARK as 出库明细备注, GOODSPACKPFSL as 出库件数, GOODSOUTFEEAP as 应付仓储费, ARFEE as 出库费应收, APFEE as 出库费应付, INSPECTIONNO as 审批单号, CUSTOMNO as 备案清单号, CORPID as 分公司, CLIENTNAMEOLD as 原客户名称, OLDCUSTFEEDATE as 上家承担仓储期限, wmsdays as 仓储天数, FEEDAYS as 计费天数, FREESTORAGEPERIOD as 应收免仓储期, DESCRIPTION as 货主全称, EnFullName as 货主英文全称, NAME as 货主英文简称, ADDR as 货主地址, EMAIL as 货主邮箱, WEB as 货主WEB, TEL as 货主电话, FAX as 货主传真, CHIEF as 货主负责人, TOTALNO as 出库件数大写, REMARK2_OUT as 出库备注2, VALIDDATE as 出库有效期, REMARK_OUT as 出库备注1, GOODSGRADE as 品名的等级, GOODSSLICE as [片数/件], MBLNONEW as 货权转移的分单的提单号, CONTRACTNO as 合同号, CREATEUSER as 出库创建人,CREATETIME as 出库创建时间, ISLOCK as 是否锁定, LOCKUSER as 锁定人, LOCKTIME as 锁定时间 FROM VW_WmsOutList_Rate_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE,feegrade", strCondition);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "WMSOUTLISTREPORT";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT blno as 提单号,WMSDATE as 入库日期,WMSNO as 入库单号,OUTBSNO as 出库单号,OUTGID as 出库GID,GID as 出库明细GID,ASSOCIATEDNO as 业务GID,BSNO as 出库明细单号,CUSTOMERNAME as 货主,DODATE as 出库日期,STORAGENAME as 仓库,STORAGENAME_FULL as 仓库全称,AREANAME as 库位,GOODSNAME as 货物名称,GOODSTYPE as 货物类型,GOODSMODEL as 货物型号,GOODSSTANDARD as 货物规格,GOODSTHICKNESS as 厚度,GOODSWIDTH as 宽度,GOODSLENGTH as 长度,GOODSPACK as 入库件数,GOODSPFSL as 出库量,GOODSOUTFEE as 应收仓储费,TRUCKNO as 车号,REMARK as 出库明细备注,CREATEUSER as 出库明细创建人,CREATETIME as 出库明细创建时间,GOODSPACKPFSL as 出库件数,ISLOCK as 明细是否锁定,LOCKUSER as 明细锁定人,LOCKTIME as 明细锁定时间,GOODSOUTFEEAP as 应付仓储费,ARFEE as 出库费应收,APFEE as 出库费应付,INSPECTIONNO as 审批单号,CUSTOMNO as 备案清单号,CORPID as 分公司,CLIENTNAMEOLD as 原客户名称,OLDCUSTFEEDATE as 上家承担仓储期限,STARTBILLINGDATE as 应收开始计费日期,ENDBILLINGDATE as 应收结束计费日期,wmsdays as 仓储天数,FEEDAYS as 计费天数,FREESTORAGEPERIOD as 应收免仓储期,DESCRIPTION as 货主全称,EnFullName as 货主英文全称,NAME as 货主英文简称,ADDR as 货主地址,EMAIL as 货主邮箱,WEB as 货主WEB,TEL as 货主电话,FAX as 货主传真,CHIEF as 货主负责人,TOTALNO as 出库件数大写,REMARK2_OUT as 出库备注2,VALIDDATE as 出库有效期,REMARK_OUT as 出库备注1,GOODSGRADE as 品名的等级,GOODSSLICE as [片数/件],MBLNONEW as 货权转移的分单的提单号,CONTRACTNO as 合同号,BZTCHNO as 批次号 FROM VW_WmsOutList_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT GID as 惟一编号,FEEGRADE as 计费等级,FEETYPE as 费用类别,convert(char(10) as ,STARTBILLINGDATE as ,20) AS 开始计费日期,convert(char(10) as ,ENDBILLINGDATE as ,20) AS 结束计费日期,FEESCALE as 计费区间,FEEUNIT as 计费单位,FEEPRICE as 计费单价,GOODSPFSL as 出库量,OUTFEE as 仓储费,REMARK as 备注,(select top 1 SHOWNAME from [user] where gid=wms_rate_detail.MODIFIEDUSER) as 最后一次操作人,MODIFIEDTIME as 最后一次操作时间,ASSOCIATEDNO as 关联号 FROM wms_rate_detail WHERE ASSOCIATEDNO in (SELECT GID FROM wms_out_detail where GID in (SELECT a.GID FROM VW_WmsOutList_Print as a WHERE 1=1 {0})) ORDER BY ASSOCIATEDNO,FEETYPE,FEEGRADE,CREATETIME ", strCondition);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID as 仓储费率明细GID, FEETYPE as 费用类别, FEEGRADE as 计费等级, STARTBILLINGDATE as 开始计费日期, ENDBILLINGDATE as 结束计费日期, FEESCALE as 计费区间, FEEUNIT as 计费单位, FEEPRICE as 计费单价, GOODSPFSL as 仓储费率出库量, OUTFEE as 仓储费率仓储费, blno as 提单号, WMSDATE as 入库日期, WMSNO as 入库单号, OUTBSNO as 出库单号, OUTGID as 出库GID, GID as 出库明细GID, ASSOCIATEDNO as 业务GID, BSNO as 出库明细单号, CUSTOMERNAME as 货主, DODATE as 出库日期, STORAGENAME as 仓库, STORAGENAME_FULL as 仓库全称, AREANAME as 库位, GOODSNAME as 货物名称, GOODSTYPE as 货物类型, GOODSMODEL as 货物型号, GOODSSTANDARD as 货物规格, GOODSPACK as 入库件数, GOODSPFSL as 出库量, GOODSOUTFEE as 应收仓储费, TRUCKNO as 车号, REMARK as 出库明细备注, GOODSPACKPFSL as 出库件数, GOODSOUTFEEAP as 应付仓储费, ARFEE as 出库费应收, APFEE as 出库费应付, INSPECTIONNO as 审批单号, CUSTOMNO as 备案清单号, CORPID as 分公司, CLIENTNAMEOLD as 原客户名称, OLDCUSTFEEDATE as 上家承担仓储期限, wmsdays as 仓储天数, FEEDAYS as 计费天数, FREESTORAGEPERIOD as 应收免仓储期, DESCRIPTION as 货主全称, EnFullName as 货主英文全称, NAME as 货主英文简称, ADDR as 货主地址, EMAIL as 货主邮箱, WEB as 货主WEB, TEL as 货主电话, FAX as 货主传真, CHIEF as 货主负责人, TOTALNO as 出库件数大写, REMARK2_OUT as 出库备注2, VALIDDATE as 出库有效期, REMARK_OUT as 出库备注1, GOODSGRADE as 品名的等级, GOODSSLICE as [片数/件], MBLNONEW as 货权转移的分单的提单号, CONTRACTNO as 合同号, CREATEUSER as 出库创建人,CREATETIME as 出库创建时间, ISLOCK as 是否锁定, LOCKUSER as 锁定人, LOCKTIME as 锁定时间 FROM VW_WmsOutList_Rate_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE,feegrade", strCondition);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出库单多票WmsOutList.aspx
/// <summary>
/// 打印出库单多票WmsOutList.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsOutList2(string tempUserID, string strSearch)
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "bt"://ETD BeginDate
strCondition += String.Format(" AND a.DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "et"://ETD EndDate
strCondition += String.Format(" AND a.DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND a.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "clientnameold"://
strCondition += String.Format(" AND a.CLIENTNAMEOLD='{0}' ", strArg[1].Replace("\"", ""));
break;
case "storagename"://
strCondition += String.Format(" AND a.STORAGENAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "ischange"://
string ls = strArg[1].Replace("\"", "");
if (ls.Trim() != "")
{
strCondition += String.Format(" AND a.ISCHANGE={0} ", ls);
}
break;
case "bsno"://NO
strCondition += String.Format(" AND (a.outbsno in (select outbsno from wms_out_detail where inbsno in (select gid from wms where blno like '%{0}%')) or (a.outbsno like '%{0}%') or a.outbsno in (select outbsno from wms_out_detail where inbsno in(select gid from wms_in where blno like '%{0}%')) or CUSTOMNO like '%{0}%' or a.MBLNONEW like '%{0}%' or a.BZTCHNO like '%{0}%') ", strArg[1].Replace("\"", ""));
break;
case "associatedno"://NO
strCondition += String.Format(" AND a.ASSOCIATEDNO like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "goods":
strCondition += String.Format(" AND a.GOODSNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "goodsstandard":
strCondition += String.Format(" AND a.outbsno in (select outbsno from wms_out_detail where goodsstandard like '%{0}%')", strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
else
{
if (strassociatedno != "")
{
strCondition += String.Format(" AND ASSOCIATEDNO like '%{0}%' ", strassociatedno);
}
}
//
#region 权限可视范围
RangeDA RangeDA = new EntityDA.RangeDA();
//wms_out
string strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modWmsOutList");//仓储入库列表
if (strRange.Trim().Equals("0"))//全部
{
strRange = "";
}
else if (strRange.Trim().Equals("1"))//分公司
{
strRange = " and OUTGID in(" + RangeDA.GetWmsOutListCompany(strCompanyID.Trim()) + ")";
}
else if (strRange.Trim().Equals("2"))//部门
{
strRange = " and OUTGID in(" + RangeDA.GetWmsOutListDEPT(strDeptName, strCompanyID, strUserID) + ")";
}
else if (strRange.Trim().Equals("3"))//个人
{
strRange = " and OUTGID in(" + RangeDA.GetWmsOutListPerson(strUserID, strCompanyID) + ")";
}
else if (strRange.Trim().Equals("4"))//无
{
strRange = " and 1<0";
}
else//空
{
strRange = " and 1<0";
}
strCondition += strRange;
#endregion
//
if (strBSNO != "" && strBSNO != null)
{
strBSNO = "'" + strBSNO.Replace(",", "','") + "'";
strCondition += String.Format(" AND OUTGID in ({0}) ", strBSNO);
}
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WMSOUTLISTREPORT2");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT BLNO as 提单号,convert(char(10),WMSDATE,20) as 入库日期, WMSNO as 入库单号, OUTBSNO as 出库单号, BSNO as 出库单明细号, CUSTOMERNAME as 货主,ARCLIENTWMSOUT as 仓储费应收客户名称, convert(char(10),DODATE,20) as 出库日期, STORAGENAME as 仓库,STORAGENAME_FULL as 仓库全称, AREANAME as 库位名称, GOODSNAME as 货物名称, GOODSTYPE as 货物类型, GOODSMODEL as 型号, GOODSSTANDARD as 规格, GOODSPACK as 包装, GOODSPFSL as 出库量, GOODSOUTFEE as 应收仓储费, TRUCKNO as 车号, REMARK as 出库明细备注, CREATEUSER as 出库创建人, CREATETIME as 出库创建时间, GOODSPACKPFSL as 出库件数, (case when ISLOCK=1 then '是' else '否' end) as 是否锁定, LOCKUSER as 锁定操作人, LOCKTIME as 锁定时间, GOODSOUTFEEAP as 应付仓储费, ARFEE as 应收账款, APFEE as 应付账款, INSPECTIONNO as 审批单号, CUSTOMNO as 备案清单号, CLIENTNAMEOLD as 货权转移的客户名称, OLDCUSTFEEDATE as 上家承担仓储期限,STARTBILLINGDATE as 应收开始计费日期,ENDBILLINGDATE as 应收结束计费日期, wmsdays as 应收仓储天数, FEEDAYS as 应收计费天数, FREESTORAGEPERIOD as 应收免仓储期, DESCRIPTION as 仓储费应收客户全称, EnFullName as 仓储费应收客户英文全称, NAME as 仓储费应收客户英文简称, ADDR as 仓储费应收客户地址, EMAIL as 仓储费应收客户邮箱, WEB as 仓储费应收客户网址, TEL AS 仓储费应收客户电话, FAX AS 仓储费应收客户传真, CHIEF as 仓储费应收客户负责人, TOTALNO as 件数大写, REMARK2_OUT AS [出库备注2/发货须知第一条], VALIDDATE as 有效期, REMARK AS [出库备注1], GOODSGRADE as 品名的等级, GOODSSLICE as [片数/件], MBLNONEW as [货权转移的分单的提单号], CONTRACTNO as 合同号 , CORPID, GID AS OUTGID, GID, ASSOCIATEDNO,BZTCHNO as 批次号 FROM VW_WmsOutList_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE", strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select a.CUSTOMERNAME from VW_WmsOutList_Print as a WHERE 1=1 {0}) and ISSTOP=0 ", strCondition);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select a.STORAGENAME from VW_WmsOutList_Print as a WHERE 1=1 {0}) and ISSTOP=0 ", strCondition);
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "WMSOUTLISTREPORT2";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT BLNO as 提单号,convert(char(10),WMSDATE,20) as 入库日期, WMSNO as 入库单号, OUTBSNO as 出库单号, BSNO as 出库单明细号, CUSTOMERNAME as 货主,ARCLIENTWMSOUT as 仓储费应收客户名称, convert(char(10),DODATE,20) as 出库日期, STORAGENAME as 仓库,STORAGENAME_FULL as 仓库全称, AREANAME as 库位名称, GOODSNAME as 货物名称, GOODSTYPE as 货物类型, GOODSMODEL as 型号, GOODSSTANDARD as 规格, GOODSPACK as 包装, GOODSPFSL as 出库量, GOODSOUTFEE as 应收仓储费, TRUCKNO as 车号, REMARK as 出库明细备注, CREATEUSER as 出库创建人, CREATETIME as 出库创建时间, GOODSPACKPFSL as 出库件数, (case when ISLOCK=1 then '是' else '否' end) as 是否锁定, LOCKUSER as 锁定操作人, LOCKTIME as 锁定时间, GOODSOUTFEEAP as 应付仓储费, ARFEE as 应收账款, APFEE as 应付账款, INSPECTIONNO as 审批单号, CUSTOMNO as 备案清单号, CLIENTNAMEOLD as 货权转移的客户名称, OLDCUSTFEEDATE as 上家承担仓储期限,STARTBILLINGDATE as 应收开始计费日期,ENDBILLINGDATE as 应收结束计费日期, wmsdays as 应收仓储天数, FEEDAYS as 应收计费天数, FREESTORAGEPERIOD as 应收免仓储期, DESCRIPTION as 仓储费应收客户全称, EnFullName as 仓储费应收客户英文全称, NAME as 仓储费应收客户英文简称, ADDR as 仓储费应收客户地址, EMAIL as 仓储费应收客户邮箱, WEB as 仓储费应收客户网址, TEL AS 仓储费应收客户电话, FAX AS 仓储费应收客户传真, CHIEF as 仓储费应收客户负责人, TOTALNO as 件数大写, REMARK2_OUT AS [出库备注2/发货须知第一条], VALIDDATE as 有效期, REMARK AS [出库备注1], GOODSGRADE as 品名的等级, GOODSSLICE as [片数/件], MBLNONEW as [货权转移的分单的提单号], CONTRACTNO as 合同号 , CORPID, GID AS OUTGID, GID, ASSOCIATEDNO,BZTCHNO as 批次号 FROM VW_WmsOutList_Print as a WHERE 1=1 {0} order by OUTBSNO,WMSNO,DODATE", strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select a.CUSTOMERNAME from VW_WmsOutList_Print as a WHERE 1=1 {0}) and ISSTOP=0 ", strCondition);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select a.STORAGENAME from VW_WmsOutList_Print as a WHERE 1=1 {0}) and ISSTOP=0 ", strCondition);
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印收费审批列表返回JSON对象//打印收费申请列表
/// <summary>
/// 打印收费审批列表返回JSON对象//打印收费申请列表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintRecvFeeAuditList()
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://Customer
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://BillNO
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://ETD BeginDate
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no"://ETD EndDate
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "blno"://ETD EndDate
strCondition += String.Format(" AND (A.BILLNO in (select BILLNO from ch_fee_do where bsno in (select bsno from VW_Settlement where (CUSTNO LIKE '%{0}%' or MBLNO LIKE '%{0}%' or HBLNO LIKE '%{0}%' or CUSTOMNO LIKE '%{0}%' OR CUSTOMNO2 LIKE '%{0}%'))))", strArg[1].Replace("\"", ""));
break;
case "billstatus":
string strbillstatus = strArg[1].Replace("\"", "");
if (strbillstatus.Trim() != "7" && strbillstatus.Trim() != "")
{
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
}
break;
default:
break;
}
}
}
}
}
string strSql = "";
strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,OPLB "
+ " FROM ch_fee_recvapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
+ " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
+ " inner join VW_Settlement as E on C.BSNO =E.BSNO "
+ " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} ORDER BY BILLNO DESC "
, strUserID, strCondition);
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "RecvFeeAuditList");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '未提交' when '2' then '已提交' when '3' then '审批中' when '4' then '已结算' when '5' then '部分结算' when '6' then '审核驳回' when '0' then '已审批' end) as BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
+ " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
, strUserID, strCondition);
reportDBSourceEntity.SqlString_2 ="";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '未提交' when '2' then '已提交' when '3' then '审批中' when '4' then '已结算' when '5' then '部分结算' when '6' then '审核驳回' when '0' then '已审批' end) as BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
+ " FROM ch_fee_recvapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
, strUserID, strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印打印付费审批列表返回JSON对象
/// <summary>
/// 打印打印付费审批列表返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPayFeeAuditList()
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://Customer
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://BillNO
strCondition += String.Format(" AND convert(char(10),A.APPLYTIME,120) <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://ETD BeginDate
strCondition += String.Format(" AND A.CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "no"://ETD EndDate
strCondition += String.Format(" AND A.BILLNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "blno"://ETD EndDate
strCondition += String.Format(" AND (A.BILLNO in (select BILLNO from ch_fee_do where bsno in (select bsno from VW_Settlement where (CUSTNO LIKE '%{0}%' or MBLNO LIKE '%{0}%' or HBLNO LIKE '%{0}%' or CUSTOMNO LIKE '%{0}%' OR CUSTOMNO2 LIKE '%{0}%'))))", strArg[1].Replace("\"", ""));
break;
case "billstatus":
string strbillstatus = strArg[1].Replace("\"", "");
if (strbillstatus.Trim() != "7" && strbillstatus.Trim() != "")
{
strCondition += String.Format(" AND A.billstatus={0} ", strbillstatus);
}
break;
default:
break;
}
}
}
}
}
//
if (strGIDS.Trim() != "")
{
string ls = strGIDS.Trim().Replace(",", "','");
strCondition += " and A.GID in ('" + ls + "')";
}
//
string strSql = "";
//strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seae' OPLB "
// + " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
// + " inner join op_seae as E on C.BSNO =E.BSNO "
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
// + " union all "
// + " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seai' OPLB "
// + " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
// + " inner join op_seai as E on C.BSNO =E.BSNO "
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
// + " ORDER BY BILLNO DESC "
// , strUserID, strCondition);
//2013-02-05 修改
strSql = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,OPLB "
+ " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
+ " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
+ " inner join VW_Settlement as E on C.BSNO =E.BSNO "
+ " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} ORDER BY BILLNO DESC "
, strUserID, strCondition);
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PayFeeAuditList");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seae' OPLB "
// + " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
// + " inner join op_seae as E on C.BSNO =E.BSNO "
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
// + " union all "
// + " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seai' OPLB "
// + " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
// + " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
// + " inner join op_seai as E on C.BSNO =E.BSNO "
// + " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
// + " ORDER BY BILLNO DESC "
// , strUserID, strCondition);
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '未提交' when '2' then '已提交' when '3' then '审批中' when '4' then '已结算' when '5' then '部分结算' when '6' then '审核驳回' when '0' then '已审批' end) as BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
+ " FROM ch_fee_payapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
, strUserID, strCondition);
reportDBSourceEntity.SqlString_2 ="";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
//reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seae' OPLB "
//+ " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
//+ " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
//+ " inner join op_seae as E on C.BSNO =E.BSNO "
//+ " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
//+ " union all "
//+ " SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,A.REMARK,'op_Seai' OPLB "
//+ " FROM ch_fee_payapplication as A LEFT JOIN [user] as B ON A.APPLICANT = B.GID "
//+ " INNER JOIN ch_fee_do as C ON A.BILLNO = C.BILLNO "
//+ " inner join op_seai as E on C.BSNO =E.BSNO "
//+ " WHERE A.BILLNO IN ( SELECT B.BILLNO FROM workflow_do as B INNER JOIN workflow_step as C ON B.STEPID = C.GID WHERE C.AUDITOR = '{0}') {1} "
//+ " ORDER BY BILLNO DESC "
//, strUserID, strCondition);
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT A.GID,A.BILLNO,(case A.BILLSTATUS when '1' then '未提交' when '2' then '已提交' when '3' then '审批中' when '4' then '已结算' when '5' then '部分结算' when '6' then '审核驳回' when '0' then '已审批' end) as BILLSTATUS,A.CUSTOMERNAME,A.AMOUNTUSD,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.APPLYTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK "
+ " FROM ch_fee_payapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.BILLNO in "
+ " ( select A.BILLNO from workflow_do A inner join workflow_step B on A.STEPID=B.GID where B.AUDITOR='{0}') {1} ORDER BY APPLYTIME DESC"
, strUserID, strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印打印付费审批列表返回JSON对象
/*
/// <summary>
/// 打印打印付费审批列表返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPayFeeAuditReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PayFeeAuditReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT BSNO,'海运出口' OPLB, CUSTOMERNAME,CUSTNO,MBLNO,HBLNO FROM op_seae WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
+ " union all "
+ " SELECT BSNO,'海运进口' OPLB, CUSTOMERNAME,CUSTNO,MBLNO,HBLNO FROM op_seai WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT GID,AMOUNTRMB,AMOUNTUSD FROM ch_fee_payapplication WHERE GID = '{0}'", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format(" SELECT C.GID,C.FEETYPE,C.CUSTOMERNAME,C.FEENAME,C.CURRENCY,C.AMOUNT,B.AMOUNT,B.AMOUNT,A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.CHEQUEPAYABLE,A.SETTLETYPE,A.PAYABLETIME,A.AMOUNTRMB,A.RATE,A.AMOUNTUSD,A.SETTLERMB,A.SETTLEUSD,A.SETTLERATE,A.APPLICANT,A.APPLYTIME,A.ENTERTIME,A.SETTLEUSER,A.SETTLETIME,A.AUDITUSER,A.AUDITTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,A.ISDELETE,A.DELETEUSER,A.DELETETIME,A.COMPANYID,A.ISAPP,A.PAYAPPID,D.SHOWNAME "
+ " FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID inner join [user] D on A.APPLICANT=D.GID WHERE A.GID='{0}' "
, strBSNO);
reportDBSourceEntity.SqlString_4 = String.Format("select GID,CODENAME,SHORTNAME, DESCRIPTION,EnFullName, RMBBank, RMBAccount, RMBOnlineNO, USDBank, USDAccount, USDOnlineNO "
+ " from info_client where SHORTNAME in "
+ " (SELECT C.CUSTOMERNAME FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_5 = String.Format(" SELECT BSNO,MASTERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,"
+ " CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,"
+ " PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,"
+ " DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,CNTRSEALNO,NOPKGS,"
+ " DESCRIPTION,GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,"
+ " CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,"
+ " CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,BSSOURCE,BSSOURCEDETAIL,"
+ " CUSTOMSNUM,CONTRACTNO,ORDTYPE,ORDERNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,STATUS2,"
+ " STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,"
+ " SERVICE10,DOC,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,STLDATE,"
+ " ORDERTYPE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,FINANCIALSTAFFCODE,FINANCIALSTAFF,"
+ " FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,DPAGE,DLABEL,LINKMAN,"
+ " VESSELID,ISSUEPLACEID "
+ " FROM op_seae WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_6 = String.Format(" SELECT BSNO,ORDERTYPE,MASTERNO,CUSTNO,MBLNO,HBLNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,CUSTOMERNAME,BSSOURCE,"
+ " BSSOURCEDETAIL,INPUTBY,OP,CUSTSERVICE,SALE,CORPID,SALEDEPT,CREATETIME,VESSEL,VOYNO,ETD,PORTLOADID,PORTLOAD,"
+ " PORTDISCHARGEID,PORTDISCHARGE,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,"
+ " CNTRTOTAL,GOODSNAME,COUNTRYOFORIGIN,NUMBERPLATE,CONTRACTNO,UNITS,BALES,KGS,NETWEIGHT,CUSTOMSER,CUSTOMNO,"
+ " CUSTOMDATE,INSPECTION,INSPECTIONNO,INSPECTIONDATE,TRANSNO,BLTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,SHIPPER,"
+ " CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,CLOSINGDATE,ETA,PlACERECEIPT,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,"
+ " DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,CNTRSEALNO,NOPKGS,"
+ " DESCRIPTION,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,CBM,TOTALNO,LANE,CARRIER,FORWARDER,TRUCKER,INVNO,CARGOID,"
+ " DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,CUSTOMSNUM,ORDTYPE,ORDERNO,INSURANCEER,INSURANCENO,"
+ " INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,"
+ " ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,"
+ " MBLFRT,STLNAME,STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,FINANCIALSTAFFCODE,"
+ " FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,DPAGE,"
+ " DLABEL,LINKMAN,VESSELID,ISSUEPLACEID,FBP,BMDDATE,MDTDATE,UNITOFWEIGHT,MT"
+ " FROM op_seai WHERE BSNO IN "
+ "(SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
//reportDBSourceEntity.SqlString_9 =String.Format("SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.CHEQUEPAYABLE,A.SETTLETYPE,A.PAYABLETIME,A.AMOUNTRMB,B.SHOWNAME as APPLICANT,A.RATE,A.AMOUNTUSD,A.SETTLERMB,A.SETTLEUSD,A.SETTLERATE,A.APPLICANT,A.APPLYTIME,A.ENTERTIME,A.SETTLEUSER,A.SETTLETIME,A.AUDITUSER,A.AUDITTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,A.ISDELETE,A.DELETEUSER,A.DELETETIME,A.COMPANYID,A.ISAPP,A.PAYAPPID "
// + " FROM ch_fee_payapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.GID='{0}' "
// , strBSNO);
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format(" SELECT BSNO,'海运出口' OPLB, CUSTOMERNAME,CUSTNO,MBLNO,HBLNO FROM op_seae WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
+ " union all "
+ " SELECT BSNO,'海运进口' OPLB, CUSTOMERNAME,CUSTNO,MBLNO,HBLNO FROM op_seai WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT GID,AMOUNTRMB,AMOUNTUSD FROM ch_fee_payapplication WHERE GID = '{0}'", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format(" SELECT C.GID,C.FEETYPE,C.CUSTOMERNAME,C.FEENAME,C.CURRENCY,C.AMOUNT,B.AMOUNT,B.AMOUNT,A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.CHEQUEPAYABLE,A.SETTLETYPE,A.PAYABLETIME,A.AMOUNTRMB,A.RATE,A.AMOUNTUSD,A.SETTLERMB,A.SETTLEUSD,A.SETTLERATE,A.APPLICANT,A.APPLYTIME,A.ENTERTIME,A.SETTLEUSER,A.SETTLETIME,A.AUDITUSER,A.AUDITTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,A.ISDELETE,A.DELETEUSER,A.DELETETIME,A.COMPANYID,A.ISAPP,A.PAYAPPID,D.SHOWNAME "
+ " FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID inner join [user] D on A.APPLICANT=D.GID WHERE A.GID='{0}' "
, strBSNO);
reportDBSourceEntity.SqlString_4 = String.Format("select GID,CODENAME,SHORTNAME, DESCRIPTION,EnFullName, RMBBank, RMBAccount, RMBOnlineNO, USDBank, USDAccount, USDOnlineNO "
+ " from info_client where SHORTNAME in "
+ " (SELECT C.CUSTOMERNAME FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_5 = String.Format(" SELECT BSNO,MASTERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,"
+ " CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,"
+ " PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,"
+ " DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,CNTRSEALNO,NOPKGS,"
+ " DESCRIPTION,GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,"
+ " CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,"
+ " CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,BSSOURCE,BSSOURCEDETAIL,"
+ " CUSTOMSNUM,CONTRACTNO,ORDTYPE,ORDERNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,STATUS2,"
+ " STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,"
+ " SERVICE10,DOC,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,STLDATE,"
+ " ORDERTYPE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,FINANCIALSTAFFCODE,FINANCIALSTAFF,"
+ " FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,DPAGE,DLABEL,LINKMAN,"
+ " VESSELID,ISSUEPLACEID "
+ " FROM op_seae WHERE BSNO IN "
+ " (SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_6 = String.Format(" SELECT BSNO,ORDERTYPE,MASTERNO,CUSTNO,MBLNO,HBLNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,CUSTOMERNAME,BSSOURCE,"
+ " BSSOURCEDETAIL,INPUTBY,OP,CUSTSERVICE,SALE,CORPID,SALEDEPT,CREATETIME,VESSEL,VOYNO,ETD,PORTLOADID,PORTLOAD,"
+ " PORTDISCHARGEID,PORTDISCHARGE,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,"
+ " CNTRTOTAL,GOODSNAME,COUNTRYOFORIGIN,NUMBERPLATE,CONTRACTNO,UNITS,BALES,KGS,NETWEIGHT,CUSTOMSER,CUSTOMNO,"
+ " CUSTOMDATE,INSPECTION,INSPECTIONNO,INSPECTIONDATE,TRANSNO,BLTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,SHIPPER,"
+ " CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,CLOSINGDATE,ETA,PlACERECEIPT,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,"
+ " DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,CNTRSEALNO,NOPKGS,"
+ " DESCRIPTION,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,CBM,TOTALNO,LANE,CARRIER,FORWARDER,TRUCKER,INVNO,CARGOID,"
+ " DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,CUSTOMSNUM,ORDTYPE,ORDERNO,INSURANCEER,INSURANCENO,"
+ " INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,"
+ " ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,"
+ " MBLFRT,STLNAME,STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,FINANCIALSTAFFCODE,"
+ " FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,DPAGE,"
+ " DLABEL,LINKMAN,VESSELID,ISSUEPLACEID,FBP,BMDDATE,MDTDATE,UNITOFWEIGHT,MT"
+ " FROM op_seai WHERE BSNO IN "
+ "(SELECT C.BSNO FROM ch_fee_payapplication as A INNER JOIN ch_fee_do as B ON A.BILLNO = B.BILLNO INNER JOIN ch_fee as C ON B.FEEID = C.GID WHERE A.GID ='{0}' ) "
, strBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
//reportDBSourceEntity.SqlString_9 = String.Format("SELECT A.GID,A.BILLNO,A.BILLSTATUS,A.CUSTOMERNAME,A.CHEQUEPAYABLE,A.SETTLETYPE,A.PAYABLETIME,A.AMOUNTRMB,A.RATE,A.AMOUNTUSD,A.SETTLERMB,A.SETTLEUSD,A.SETTLERATE,A.APPLICANT,A.APPLYTIME,A.ENTERTIME,A.SETTLEUSER,A.SETTLETIME,A.AUDITUSER,A.AUDITTIME,replace(replace(A.REMARK,char(13),'|'),char(10),'') REMARK,A.ISDELETE,A.DELETEUSER,A.DELETETIME,A.COMPANYID,A.ISAPP,A.PAYAPPID "
// + " FROM ch_fee_payapplication A inner JOIN [user] B ON A.APPLICANT = B.GID where A.GID='{0}' "
// , strBSNO);
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
*/
#endregion
#region 打印付费审批信息单票CommonPayApplicationAudit.aspx
/// <summary>
/// 打印付费审批信息单票CommonPayApplicationAudit.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPayFeeAuditReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PayFeeAuditReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "";
reportDBSourceEntity.SqlString_2 = "";
//reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID,FEETYPE,CUSTOMERNAME,FEENAME,CURRENCY,AMOUNT,GID_A,BILLNO,BILLSTATUS,CUSTOMERNAME,CHEQUEPAYABLE,SETTLETYPE,PAYABLETIME,AMOUNTRMB,RATE,AMOUNTUSD,SETTLERMB,SETTLEUSD,SETTLERATE,APPLICANT,APPLYTIME,ENTERTIME,SETTLEUSER,SETTLETIME,AUDITUSER,AUDITTIME,REMARK,ISDELETE,DELETEUSER,DELETETIME,COMPANYID,ISAPP,PAYAPPID,SHOWNAME,DESCRIPTION,RMBBank,RMBAccount,RMBOnlineNO,USDBank,USDAccount,USDOnlineNO,MBLNO,CNTRTOTAL,VESSEL,VOYNO,ETD,CUSTNO,POR,KGS FROM VW_PrintPayFeeAuditReport2 WHERE GID_A='{0}' order by MBLNO", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE GID_A='{0}' order by MBLNO", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "";
reportDBSourceEntity.SqlString_2 = "";
//reportDBSourceEntity.SqlString_3 = String.Format("SELECT GID,FEETYPE,CUSTOMERNAME,FEENAME,CURRENCY,AMOUNT,GID_A,BILLNO,BILLSTATUS,CUSTOMERNAME,CHEQUEPAYABLE,SETTLETYPE,PAYABLETIME,AMOUNTRMB,RATE,AMOUNTUSD,SETTLERMB,SETTLEUSD,SETTLERATE,APPLICANT,APPLYTIME,ENTERTIME,SETTLEUSER,SETTLETIME,AUDITUSER,AUDITTIME,REMARK,ISDELETE,DELETEUSER,DELETETIME,COMPANYID,ISAPP,PAYAPPID,SHOWNAME,DESCRIPTION,RMBBank,RMBAccount,RMBOnlineNO,USDBank,USDAccount,USDOnlineNO,MBLNO,CNTRTOTAL,VESSEL,VOYNO,ETD,CUSTNO,POR,KGS FROM VW_PrintPayFeeAuditReport2 WHERE GID_A='{0}' order by MBLNO", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE GID_A='{0}' order by MBLNO", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印收付费审批列表多票CommonPayApplicationAudit.aspx
/// <summary>
/// 打印收付费审批列表多票CommonPayApplicationAudit.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintPayFeeAuditReport2()
{
string ls = strGIDS.Trim().Replace(",","','");
//
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PayFeeAuditReport2");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT GID,FEETYPE,CUSTOMERNAME,FEENAME,CURRENCY,AMOUNT,GID_A,BILLNO,BILLSTATUS,CUSTOMERNAME,CHEQUEPAYABLE,SETTLETYPE,PAYABLETIME,AMOUNTRMB,RATE,AMOUNTUSD,SETTLERMB,SETTLEUSD,SETTLERATE,APPLICANT,APPLYTIME,ENTERTIME,SETTLEUSER,SETTLETIME,AUDITUSER,AUDITTIME,REMARK,ISDELETE,DELETEUSER,DELETETIME,COMPANYID,ISAPP,PAYAPPID,SHOWNAME,DESCRIPTION,RMBBank,RMBAccount,RMBOnlineNO,USDBank,USDAccount,USDOnlineNO,MBLNO,CNTRTOTAL,VESSEL,VOYNO,ETD,CUSTNO,POR,KGS FROM VW_PrintPayFeeAuditReport2 WHERE GID_A in ('{0}') order by billno ", ls);
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE GID_A in ('{0}') order by CUSTOMERNAME,MBLNO,FEENAME ", ls);
reportDBSourceEntity.SqlString_2 = "select * from ch_fee_do where billno in(" + String.Format("SELECT distinct billno FROM VW_PrintPayFeeAuditReport2 WHERE GID_A='{0}' ", strBSNO) + ")";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
//
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
//
//reportDBSourceEntity.SqlString_1 = String.Format("SELECT GID,FEETYPE,CUSTOMERNAME,FEENAME,CURRENCY,AMOUNT,GID_A,BILLNO,BILLSTATUS,CUSTOMERNAME,CHEQUEPAYABLE,SETTLETYPE,PAYABLETIME,AMOUNTRMB,RATE,AMOUNTUSD,SETTLERMB,SETTLEUSD,SETTLERATE,APPLICANT,APPLYTIME,ENTERTIME,SETTLEUSER,SETTLETIME,AUDITUSER,AUDITTIME,REMARK,ISDELETE,DELETEUSER,DELETETIME,COMPANYID,ISAPP,PAYAPPID,SHOWNAME,DESCRIPTION,RMBBank,RMBAccount,RMBOnlineNO,USDBank,USDAccount,USDOnlineNO,MBLNO,CNTRTOTAL,VESSEL,VOYNO,ETD,CUSTNO,POR,KGS FROM VW_PrintPayFeeAuditReport2 WHERE GID_A in ('{0}') order by billno ", ls);
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_PrintPayFeeAuditReport2 WHERE GID_A in ('{0}') order by CUSTOMERNAME,MBLNO,FEENAME ", ls);
reportDBSourceEntity.SqlString_2 = "select * from ch_fee_do where billno in(" + String.Format("SELECT distinct billno FROM VW_PrintPayFeeAuditReport2 WHERE GID_A in ('{0}') ", ls) + ")";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
//
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印打印打印装卸费入库单信息返回JSON对象
/// <summary>
/// 打印打印打印装卸费入库单信息返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmszxinInfoReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WmszxinInfoReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_IN.CUSTOMERNAME),ARRATE=(select top 1 [ARRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),APRATE=(select top 1 [APRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME) FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' order by CREATETIME", strBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_IN.CUSTOMERNAME),ARRATE=(select top 1 [ARRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),APRATE=(select top 1 [APRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME) FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' order by CREATETIME", strBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印打印打印装卸费出库单信息返回JSON对象
/// <summary>
/// 打印打印打印装卸费出库单信息返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmszxoutInfoReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WmszxoutInfoReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_OUT_DETAIL.CUSTOMERNAME),AROUTRATE=(select top 1 [AROUTRATE] from code_goods where GOODNAME=VW_WMS_OUT_DETAIL.GOODSNAME_OUT),APOUTRATE=(select top 1 [APOUTRATE] from code_goods where GOODNAME=VW_WMS_OUT_DETAIL.GOODSNAME_OUT) FROM VW_WMS_OUT_DETAIL WHERE gid='{0}' order by CREATETIME_OUT", strBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_OUT_DETAIL.CUSTOMERNAME),AROUTRATE=(select top 1 [AROUTRATE] from code_goods where GOODNAME=VW_WMS_OUT_DETAIL.GOODSNAME_OUT),APOUTRATE=(select top 1 [APOUTRATE] from code_goods where GOODNAME=VW_WMS_OUT_DETAIL.GOODSNAME_OUT) FROM VW_WMS_OUT_DETAIL WHERE gid='{0}' order by CREATETIME_OUT", strBSNO);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印报价单信息返回JSON对象
/// <summary>
/// 打印报价单信息返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintQuotationReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "QuotationReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT top 1 * from crm_quotation where gid='{0}'", strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT * from crm_quotation_detail where LINKGID='{0}' and FEETYPE='海运费及附加费' order by FEENAME", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT * from crm_quotation_detail where LINKGID='{0}' and FEETYPE='人民币费用' order by FEENAME", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT top 1 * from crm_quotation where gid='{0}'", strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT * from crm_quotation_detail where LINKGID='{0}' and FEETYPE='海运费及附加费' order by FEENAME", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT * from crm_quotation_detail where LINKGID='{0}' and FEETYPE='人民币费用' order by FEENAME", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印入库单 WmsInfo.aspx
/// <summary>
/// 打印入库单 WmsInfo.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsInfoReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WmsInfoReport");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_IN.CUSTOMERNAME),ARRATE=(select top 1 [ARRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),APRATE=(select top 1 [APRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),GOODSPACKACTUAL,GOODSRKSLACTUAL FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' order by GOODSGRADE,GOODSLENGTH,GOODSSTANDARD,CREATETIME,LINENUM", strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("select * from op_seai where bsno=(select top 1 ASSOCIATEDNO FROM wms WHERE GID='{0}')", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT ctnall as 箱型,count(ctnall) as 箱量 FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' group by ctnall", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT top 1 CUSTOMERNAME FROM VW_WMS_IN WHERE CUSTOMERNAME=info_client.SHORTNAME and ASSOCIATEDNO='{0}')", strBSNO);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT top 1 STORAGENAME FROM VW_WMS_IN WHERE STORAGENAME=info_client.SHORTNAME and ASSOCIATEDNO='{0}')", strBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT *,FULLNAME=(select top 1 [DESCRIPTION] from info_client where SHORTNAME=VW_WMS_IN.CUSTOMERNAME),ARRATE=(select top 1 [ARRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),APRATE=(select top 1 [APRATE] from code_goods where GOODNAME=VW_WMS_IN.GOODSNAME),GOODSPACKACTUAL,GOODSRKSLACTUAL FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' order by GOODSGRADE,GOODSLENGTH,GOODSSTANDARD,CREATETIME", strBSNO);
reportDBSourceEntity.SqlString_2 = String.Format("select * from op_seai where bsno=(select top 1 ASSOCIATEDNO FROM wms WHERE GID='{0}')", strBSNO);
reportDBSourceEntity.SqlString_3 = String.Format("SELECT ctnall as 箱型,count(ctnall) as 箱量 FROM VW_WMS_IN WHERE ASSOCIATEDNO='{0}' group by ctnall", strBSNO);
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT top 1 CUSTOMERNAME FROM VW_WMS_IN WHERE CUSTOMERNAME=info_client.SHORTNAME and ASSOCIATEDNO='{0}')", strBSNO);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT * FROM [info_client] WHERE SHORTNAME =(SELECT top 1 STORAGENAME FROM VW_WMS_IN WHERE STORAGENAME=info_client.SHORTNAME and ASSOCIATEDNO='{0}')", strBSNO);
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印仓储费用实时查询列表WmsWmsrateTestList.aspx
/// <summary>
/// 打印仓储费用实时查询列表WmsWmsrateTestList.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsFeeQuery(string tempUserID, string strSearch)
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "cus"://CUSTOMER
strCondition += String.Format(" and W.CUSTOMERNAME like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "blno"://NO
strCondition += String.Format(" AND W.BLNO like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "customno"://NO
strCondition += String.Format(" AND W.CUSTOMNO like '%{0}%' ", strArg[1].Replace("\"", ""));
break;
case "outdate":
strCondition += String.Format(" AND W.outdate = '{0}' ", strArg[1].Replace("\"", ""));
break;
case "isout":
strCondition += String.Format(" AND W.ISWMSOUT = '{0}' ", strArg[1].Replace("\"", ""));
//strCondition += bool.Parse(strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
if (strBSNO != "" && strBSNO != null)
{
strBSNO = "'" + strBSNO.Replace(",", "','") + "'";
strCondition += String.Format(" AND W.GID in ({0}) ", strBSNO);
}
strCondition += " AND W.CREATEUSER='" + strUserID + "' and W.CORPID2='" + strCompanyID + "' ";
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "printwmsfeequery");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_WmsFeeQuery_Print W WHERE 1=1 {0} order by CUSTOMERNAME,INDATE,WMSNO", strCondition);
//reportDBSourceEntity.SqlString_2 = String.Format("select *,wmsno=isnull((select top 1 wmsno from wms where gid=wms_rate.bsno),'') from wms_rate where bsno in (select gid from wms where wmsno in (SELECT wmsno FROM VW_WmsFeeQuery_Print WHERE 1=1 {0})) order by bsno", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT W.CUSTOMERNAME,W.BLNO,W.CUSTOMNO,W.WMSNO,W.STORAGENAME"
+ ",W.GOODSGRADE,W.GOODSNAME,W.GOODSMODEL,W.GOODSSTANDARD,W.GOODSSLICE,R.FEEGRADE"
+ ",(case R.FEETYPE when 1 then '收' else '付' end) as FEETYPE"
+ ",convert(char(10),R.STARTBILLINGDATE,20) AS STARTBILLINGDATE"
+ ",convert(char(10),R.ENDBILLINGDATE,20) AS ENDBILLINGDATE"
+ ",R.FEESCALE,R.FEEUNIT,R.FEEPRICE,R.GOODSPFSL,R.OUTFEE"
+ ",MODIFIEDUSER=(select top 1 SHOWNAME from [user] where gid=R.MODIFIEDUSER),R.MODIFIEDTIME"
+ " FROM VW_WmsFeeQuery_Print as W LEFT OUTER JOIN wms_rate_detail AS R on R.ASSOCIATEDNO=W.GID"
+ " where 1=1 {0} "
+ " ORDER BY W.CUSTOMERNAME,W.BLNO,R.ASSOCIATEDNO,R.FEETYPE,R.FEEGRADE,R.MODIFIEDTIME", strCondition);
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_WmsFeeQuery_Print WHERE 1=1 {0} order by CUSTOMERNAME,INDATE,WMSNO", strCondition);
//reportDBSourceEntity.SqlString_2 = String.Format("select *,wmsno=isnull((select top 1 wmsno from wms where gid=wms_rate.bsno),'') from wms_rate where bsno in (select gid from wms where wmsno in (SELECT wmsno FROM VW_WmsFeeQuery_Print WHERE 1=1 {0})) order by bsno", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("SELECT W.CUSTOMERNAME,W.BLNO,W.CUSTOMNO,W.WMSNO,W.STORAGENAME"
+ ",W.GOODSGRADE,W.GOODSNAME,W.GOODSMODEL,W.GOODSSTANDARD,W.GOODSSLICE,R.FEEGRADE"
+ ",(case R.FEETYPE when 1 then '收' else '付' end) as FEETYPE"
+ ",convert(char(10),R.STARTBILLINGDATE,20) AS STARTBILLINGDATE"
+ ",convert(char(10),R.ENDBILLINGDATE,20) AS ENDBILLINGDATE"
+ ",R.FEESCALE,R.FEEUNIT,R.FEEPRICE,R.GOODSPFSL,R.OUTFEE"
+ ",MODIFIEDUSER=(select top 1 SHOWNAME from [user] where gid=R.MODIFIEDUSER),R.MODIFIEDTIME"
+ " FROM VW_WmsFeeQuery_Print as W LEFT OUTER JOIN wms_rate_detail AS R on R.ASSOCIATEDNO=W.GID"
+ " where 1=1 {0} "
+ " ORDER BY W.CUSTOMERNAME,W.BLNO,R.ASSOCIATEDNO,R.FEETYPE,R.FEEGRADE,R.MODIFIEDTIME", strCondition);
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印库存单列表VwWmsStocktakeList.aspx
/// <summary>
/// 打印库存单列表VwWmsStocktakeList.aspx
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsStock(string tempUserID, string strSearch)
{
string strCondition = strSearch;
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WMSSTOCKPORT");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT NID,CUSTOMERNAME,STORAGENAME,WMSDATE,BLNO,CONTRACTNO,CUSTOMNO,GOODSGRADE,GOODSNAME,GOODSMODEL,GOODSSTANDARD,GOODSSLICE,hj_GOODSPACK,hj_GOODSPACKPFSL,hj_GOODSPACKSTOCK,hj_GOODSRKSL,hj_GOODSPFSL_OUT,hj_GOODSSTOCK,CHARGEUNIT,REMARK,CUSTOMERNAME_FULL=(select top 1 DESCRIPTION from info_client where SHORTNAME=VW_WMS_STOCKTAKE.CUSTOMERNAME),STORAGENAME_FULL=(select top 1 DESCRIPTION from info_client where SHORTNAME=VW_WMS_STOCKTAKE.STORAGENAME) FROM VW_WMS_STOCKTAKE WHERE 1=1 {0} ORDER BY CUSTOMERNAME,STORAGENAME,WMSDATE,BLNO,GOODSNAME,GOODSMODEL", strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT NID,CUSTOMERNAME,STORAGENAME,WMSDATE,BLNO,CONTRACTNO,CUSTOMNO,GOODSGRADE,GOODSNAME,GOODSMODEL,GOODSSTANDARD,GOODSSLICE,hj_GOODSPACK,hj_GOODSPACKPFSL,hj_GOODSPACKSTOCK,hj_GOODSRKSL,hj_GOODSPFSL_OUT,hj_GOODSSTOCK,CHARGEUNIT,REMARK,CUSTOMERNAME_FULL=(select top 1 DESCRIPTION from info_client where SHORTNAME=VW_WMS_STOCKTAKE.CUSTOMERNAME),STORAGENAME_FULL=(select top 1 DESCRIPTION from info_client where SHORTNAME=VW_WMS_STOCKTAKE.STORAGENAME) FROM VW_WMS_STOCKTAKE WHERE 1=1 {0} ORDER BY CUSTOMERNAME,STORAGENAME,WMSDATE,BLNO,GOODSNAME,GOODSMODEL", strCondition);
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出入库明细列表返回JSON对象
/// <summary>
/// 打印出入库明细列表返回JSON对象
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintWmsDetail(string tempUserID, string strSearch)
{
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://ETD BeginDate
strCondition += String.Format(" AND DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://ETD EndDate
strCondition += String.Format(" AND DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "btime2"://ETD BeginDate
strCondition += String.Format(" AND DODATE_OUT >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime2"://ETD EndDate
strCondition += String.Format(" AND DODATE_OUT <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND (CLIENTNAME LIKE '%{0}%' or CUSTOMERNAME_OUT LIKE '%{0}%')", strArg[1].Replace("\"", ""));
break;
case "no"://NO
strCondition += String.Format(" AND (BLNO LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%' OR CONTRACTNO LIKE '%{0}%' OR GOODSMODEL LIKE '%{0}%' OR TRUCKNO_OUT LIKE '%{0}%' OR WMSNO LIKE '%{0}%' OR OUTBSNO_OUT LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%')", strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
if (strBSNO != "" && strBSNO != null)
{
strBSNO = "'" + strBSNO.Replace(",", "','") + "'";
strCondition += String.Format(" AND NID in ({0}) ", strBSNO);
}
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "printwmsdetail");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_WMS_DETAIL where 1=1 {0} ORDER BY CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,BLNO,DODATE_OUT DESC,OUTBSNO_OUT,BSNO_OUT", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("select *,wmsno=isnull((select top 1 wmsno from wms where gid=wms_rate.bsno),'') from wms_rate where bsno in (select gid from wms where gid in (SELECT INBSNO_OUT FROM VW_WMS_DETAIL where 1=1 {0})) order by bsno", strCondition);
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = String.Format("SELECT * FROM VW_WMS_DETAIL where 1=1 {0} ORDER BY CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,BLNO,DODATE_OUT DESC,OUTBSNO_OUT,BSNO_OUT", strCondition);
reportDBSourceEntity.SqlString_2 = String.Format("select *,wmsno=isnull((select top 1 wmsno from wms where gid=wms_rate.bsno),'') from wms_rate where bsno in (select gid from wms where gid in (SELECT INBSNO_OUT FROM VW_WMS_DETAIL where 1=1 {0})) order by bsno", strCondition);
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印出入库明细
/// <summary>
/// 打印出入库明细
/// </summary>
/// <returns></returns>
private string PrintWmsDetailStock(string userid, string strSearch)
{
string strResult = "";
string strCondition = "";
if (strSearch != null)
{
if (!strSearch.Trim().Equals(""))
{
string tempSearch = strSearch;
tempSearch = tempSearch.Replace("{", "");
tempSearch = tempSearch.Replace("}", "");
tempSearch = tempSearch.Replace("[", "");
tempSearch = tempSearch.Replace("]", "");
string[] searchArg = tempSearch.Split(new char[] { ',' });
for (int i = 0; i < searchArg.Length; i++)
{
string[] strArg = searchArg[i].Split(new char[] { ':' });
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
{
switch (strArg[0].Replace("\"", ""))
{
case "btime"://ETD BeginDate
strCondition += String.Format(" AND DODATE >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime"://ETD EndDate
strCondition += String.Format(" AND DODATE <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "btime2"://ETD BeginDate
strCondition += String.Format(" AND DODATE_OUT >= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "etime2"://ETD EndDate
strCondition += String.Format(" AND DODATE_OUT <= '{0}' ", strArg[1].Replace("\"", ""));
break;
case "cus"://CUSTOMER
strCondition += String.Format(" AND (CUSTOMERNAME LIKE '%{0}%' or CUSTOMERNAME_OUT LIKE '%{0}%')", strArg[1].Replace("\"", ""));
break;
case "no"://NO
strCondition += String.Format(" AND (BLNO LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%' OR CONTRACTNO LIKE '%{0}%' OR GOODSMODEL LIKE '%{0}%' OR TRUCKNO_OUT LIKE '%{0}%' OR WMSNO LIKE '%{0}%' OR OUTBSNO_OUT LIKE '%{0}%' OR CUSTOMNO LIKE '%{0}%' OR CUSTNO LIKE '%{0}%')", strArg[1].Replace("\"", ""));
break;
default:
break;
}
}
}
}
}
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(userid);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(userid, "WMSDETAILSTOCK");
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT NID,BLNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSPFSL_OUT,GOODSSTOCK,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,CHARGEUNIT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT,DATEDIFF(DAY,WMSDATE,DODATE_OUT)+1 AS WMSSTOREDAYS FROM VW_WMS_DETAIL WHERE 1>0 " + strCondition.Trim() + " ORDER BY CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,BLNO,DODATE_OUT DESC,OUTBSNO_OUT,BSNO_OUT ";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + userid.Trim() + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, userid);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser = userid;
reportDBSourceEntity.Type = "";
reportDBSourceEntity.UserID = userid;
reportDBSourceEntity.SqlString_1 = "SELECT NID,BLNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSPFSL_OUT,GOODSSTOCK,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,CHARGEUNIT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT,DATEDIFF(DAY,WMSDATE,DODATE_OUT)+1 AS WMSSTOREDAYS FROM VW_WMS_DETAIL WHERE 1>0 " + strCondition.Trim() + " ORDER BY CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSMODEL,BLNO,DODATE_OUT DESC,OUTBSNO_OUT,BSNO_OUT";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + userid.Trim() + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, userid);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印入库单列表WmsList.aspx
/// <summary>
/// 打印入库单列表WmsList.aspx
/// </summary>
/// <returns></returns>
protected string PrintWMSInputInfo()
{
string strResult = "";
string strCondition = strSearch;
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(strUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "WMSInputInfoPrint");
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "select a.WMSNO,a.CUSTOMERNAME,a.WMSOP,convert(char(10),a.WMSDATE,20) AS WMSDATE,a.ARCLIENT,TRUCKNAME,a.GOODSNAME,a.GOODSMODEL,a.CHARGEUNIT,isnull(a.GOODSPACK,0) GOODSPACK,isnull(a.GOODSPACKSTOCK,0) GOODSPACKSTOCK,isnull(a.GOODSRKSL,0) GOODSRKSL,isnull(a.GOODSSTOCK,0) GOODSSTOCK,isnull(a.ARFEE,0) ARFEE,isnull(a.APFEE,0) APFEE,a.FREESTORAGEPERIOD,a.BLNO,a.CONTRACTNO,a.STORAGENAME,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,CUSTOMNO,CUSTNO,b.GOODSSTANDARD,CTNALL,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSGRADE,STACKLOCATION,DODATE,REMARK,a.GOODSPACKACTUAL,a.GOODSRKSLACTUAL from wms as a inner join wms_in as b on a.gid=b.ASSOCIATEDNO where 1>0 " + strCondition.Trim();
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID.Trim() + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.CreateUser =strUserID;
reportDBSourceEntity.Type = "WMSInputInfoPrint";
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "select a.WMSNO,a.CUSTOMERNAME,a.WMSOP,convert(char(10),a.WMSDATE,20) AS WMSDATE,a.ARCLIENT,TRUCKNAME,a.GOODSNAME,a.GOODSMODEL,a.CHARGEUNIT,isnull(a.GOODSPACK,0) GOODSPACK,isnull(a.GOODSPACKSTOCK,0) GOODSPACKSTOCK,isnull(a.GOODSRKSL,0) GOODSRKSL,isnull(a.GOODSSTOCK,0) GOODSSTOCK,isnull(a.ARFEE,0) ARFEE,isnull(a.APFEE,0) APFEE,a.FREESTORAGEPERIOD,a.BLNO,a.CONTRACTNO,a.STORAGENAME,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,CUSTOMNO,CUSTNO,b.GOODSSTANDARD,CTNALL,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSGRADE,STACKLOCATION,DODATE,REMARK,a.GOODSPACKACTUAL,a.GOODSRKSLACTUAL from wms as a inner join wms_in as b on a.gid=b.ASSOCIATEDNO where 1>0 " + strCondition.Trim();
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID.Trim() + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 应收应付费用总表
/// <summary>
/// 应收应付费用总表
/// </summary>
/// <param name="tempUserID">用户GID</param>
/// <param name="tempBSNO">委托编号</param>
/// <returns>返回JSON对象</returns>
private string PrintFeeReport(string tempUserID, string strSearch)
{
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "FEEREPORT");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "SELECT GID as 费用GID,OPLBNAME as 业务类型,CUSTOMERNAME as 委托单位,MBLNO as 主提单号,CONTRACTNO as 合同号,ETD as 业务日期,GOODSNAME as 品名,NUMBERPLATE as 牌号,NETWEIGHT as 净重,KGS as 毛重,FEETYPE as 费用类型,FEESTATUS as 费用状态,FEENAME as 费用名称,SETTLEMENTNAME as 结算单位,UNIT as 单位,QUANTITY as 数量,UNITPRICE as 单价,AMOUNTRMB as 金额RMB,AMOUNTUSD as 金额USD,CURRENCY as 币别,EXCHANGERATE as 汇率,TOTALRMB as 本位币,SETTLEMENT as 结算金额,INVOICE as 开票金额,INVOICENUM as 发票号码,REMARK as 费用备注,ENTEROPERATOR as 录入人,ENTERDATE as 录入时间 FROM VW_FEE WHERE 1=1 " + strSearch + " order by MBLNO,CUSTOMERNAME,ENTERDATE";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select CUSTOMERNAME from VW_FEE where 1=1 {0}) and ISSTOP=0 ", strSearch);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select SETTLEMENTNAME from VW_FEE where 1=1 {0}) and ISSTOP=0 ", strSearch);
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "FEEREPORT";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "SELECT GID as 费用GID,OPLBNAME as 业务类型,CUSTOMERNAME as 委托单位,MBLNO as 主提单号,CONTRACTNO as 合同号,ETD as 业务日期,GOODSNAME as 品名,NUMBERPLATE as 牌号,NETWEIGHT as 净重,KGS as 毛重,FEETYPE as 费用类型,FEESTATUS as 费用状态,FEENAME as 费用名称,SETTLEMENTNAME as 结算单位,UNIT as 单位,QUANTITY as 数量,UNITPRICE as 单价,AMOUNTRMB as 金额RMB,AMOUNTUSD as 金额USD,CURRENCY as 币别,EXCHANGERATE as 汇率,TOTALRMB as 本位币,SETTLEMENT as 结算金额,INVOICE as 开票金额,INVOICENUM as 发票号码,REMARK as 费用备注,ENTEROPERATOR as 录入人,ENTERDATE as 录入时间 FROM VW_FEE WHERE 1=1 " + strSearch + " order by MBLNO,CUSTOMERNAME,ENTERDATE";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select CUSTOMERNAME from VW_FEE where 1=1 {0}) and ISSTOP=0 ", strSearch);
reportDBSourceEntity.SqlString_6 = String.Format("SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select SETTLEMENTNAME from VW_FEE where 1=1 {0}) and ISSTOP=0 ", strSearch);
reportDBSourceEntity.SqlString_7 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 打印用户信息
/// <summary>
/// 打印用户信息
/// </summary>
/// <param name="strBillNO">此处存放用户GID</param>
/// <returns>返回JSON对象</returns>
private string PrintUserReport()
{
string strResult = "";
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(strUserID, "PrintUser");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "select u.GID userid,u.USERNAME,u.CODENAME,u.SHOWNAME ,ub.COMPANYNAME 公司名称, ub.DEPTNAME 部门名称, ub.OFFICEPHONE 办公电话, ub.HOMEPHONE 家庭电话, ub.MOBILE 移动电话, ub.FAX 传真, ub.EMAIL1 邮箱1, ub.EMAIL2 邮箱2, ub.HOMEADDRESS 家庭住址, dbo.trimdate(ub.CONTRACTDATE) 合同日期,ub.TRIALTIME 试用期, ub.IDNUM 身份证号, ub.EDURECORD 学历, ub.ANNUALLEAVE 年假 from[user] u left join user_baseinfo ub on ub.USERID = u.GID where u.gid='"+ strBillNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PrintUser";
reportDBSourceEntity.CreateUser = strUserID;
reportDBSourceEntity.UserID = strUserID;
reportDBSourceEntity.SqlString_1 = "select u.GID userid,u.USERNAME,u.CODENAME,u.SHOWNAME ,ub.COMPANYNAME 公司名称, ub.DEPTNAME 部门名称, ub.OFFICEPHONE 办公电话, ub.HOMEPHONE 家庭电话, ub.MOBILE 移动电话, ub.FAX 传真, ub.EMAIL1 邮箱1, ub.EMAIL2 邮箱2, ub.HOMEADDRESS 家庭住址, dbo.trimdate(ub.CONTRACTDATE) 合同日期,ub.TRIALTIME 试用期, ub.IDNUM 身份证号, ub.EDURECORD 学历, ub.ANNUALLEAVE 年假 from[user] u left join user_baseinfo ub on ub.USERID = u.GID where u.gid='" + strBillNO + "'";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, strUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
#endregion
#region 获取JSON值
/// <summary>
/// 获取JSON值
/// </summary>
/// <param name="tempCompanyID">公司GID</param>
/// <param name="tempSourceID">报表资源GID</param>
/// <param name="tempUserID">用户GID</param>
/// <returns>返回JSON字符串</returns>
private string GetJosonResult(string tempCompanyID,string tempSourceID,string tempUserID)
{
StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.Append("{");
jsonBuilder.Append("\"reports\":");
jsonBuilder.Append("[");
jsonBuilder.Append("{");
jsonBuilder.Append("\"compid\":\"" + tempCompanyID + "\",");
jsonBuilder.Append("\"sourceid\":\"" + tempSourceID + "\",");
jsonBuilder.Append("\"userid\":\"" + tempUserID + "\"");
jsonBuilder.Append("}");
jsonBuilder.Append("]");
jsonBuilder.Append("}");
return jsonBuilder.ToString();
}
#endregion
}
}