|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
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 System.Xml.Linq;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.Models;
|
|
|
|
|
using JsonHelper;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using DSWeb.Authority;
|
|
|
|
|
using System.Data.OleDb;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.CW
|
|
|
|
|
{
|
|
|
|
|
public partial class CwVouchersList : System.Web.UI.Page
|
|
|
|
|
{
|
|
|
|
|
RangeDA RangeDA = new RangeDA();
|
|
|
|
|
|
|
|
|
|
//grid
|
|
|
|
|
private string strColumnVal;
|
|
|
|
|
public string strUserID = "";//"04eaeac5-f271-45d1-b17b-ad4ccbab63d0";
|
|
|
|
|
public string strCompanyID;//公司GID
|
|
|
|
|
public string strShowName;//用户显示名
|
|
|
|
|
public string strDeptName;//部门名称
|
|
|
|
|
private string strType = "48";//Grid模块号
|
|
|
|
|
private string strType2 = "49";//Grid模块号
|
|
|
|
|
//gridEnd
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Session["USERID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
|
|
|
this.hdUserID.Value = strUserID;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//Session["USERID"] = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
|
|
|
|
|
//strUserID = Session["USERID"].ToString().Trim();
|
|
|
|
|
//this.hdUserID.Value = strUserID;
|
|
|
|
|
Server.Transfer("~/Error/FriendError.aspx");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
|
|
{
|
|
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
|
|
{
|
|
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//权限可视范围
|
|
|
|
|
//this.hdRangeV.Value = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modCwVouchersListlist");
|
|
|
|
|
//this.hdRangeO.Value = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modCwVouchersListlist");
|
|
|
|
|
//this.hdRange.Value = "";
|
|
|
|
|
////if (this.hdRangeV.Value.Trim() != this.hdRangeO.Value.Trim())
|
|
|
|
|
////{
|
|
|
|
|
//this.hdRange.Value = "";
|
|
|
|
|
//if (this.hdRangeO.Value.Trim().Equals("4"))//无
|
|
|
|
|
//{
|
|
|
|
|
// this.imgAdd.Disabled = true;
|
|
|
|
|
// this.imgSave.Disabled = true;
|
|
|
|
|
// this.imgDel.Disabled = true;
|
|
|
|
|
// this.imgPrint.Disabled = true;
|
|
|
|
|
//}
|
|
|
|
|
//}
|
|
|
|
|
//grid
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
//if (Request.QueryString["handle"] != null)
|
|
|
|
|
//{
|
|
|
|
|
// this.hid_handle.Value = Request.QueryString["handle"].ToString().Trim();
|
|
|
|
|
// Session["handle"] = this.hid_handle.Value;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// Session["handle"] = "";
|
|
|
|
|
// this.hid_handle.Value = "";
|
|
|
|
|
//}
|
|
|
|
|
////
|
|
|
|
|
//if (Request.QueryString["ORDNO"] != null)
|
|
|
|
|
//{
|
|
|
|
|
// this.hid_ORDNO.Value = Request.QueryString["ORDNO"].ToString().Trim();
|
|
|
|
|
// Session["ORDNO"] = this.hid_ORDNO.Value;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// Session["ORDNO"] = "";
|
|
|
|
|
// this.hid_ORDNO.Value = "";
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (hid_setting.Value.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strColumnVal = hid_setting.Value.Trim();
|
|
|
|
|
SaveColumnSetting(strColumnVal);
|
|
|
|
|
hid_setting.Value = "";
|
|
|
|
|
}
|
|
|
|
|
if (hid_header.Value.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strColumnVal = hid_header.Value.Trim();
|
|
|
|
|
SaveColumnSetting(strColumnVal);
|
|
|
|
|
hid_header.Value = "";
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
if (hid_setting2.Value.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strColumnVal = hid_setting2.Value.Trim();
|
|
|
|
|
SaveColumnSetting2(strColumnVal);
|
|
|
|
|
hid_setting2.Value = "";
|
|
|
|
|
}
|
|
|
|
|
if (hid_header2.Value.Trim() != "")
|
|
|
|
|
{
|
|
|
|
|
strColumnVal = hid_header2.Value.Trim();
|
|
|
|
|
SaveColumnSetting2(strColumnVal);
|
|
|
|
|
hid_header2.Value = "";
|
|
|
|
|
}
|
|
|
|
|
//gridEnd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ibAdd_Click(object sender, ImageClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string sSQL = "";
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
//帐套设置
|
|
|
|
|
sSQL = "SELECT top 1 * from cw_design";
|
|
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL(sSQL);
|
|
|
|
|
if (ds == null)
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('请先设置帐套信息!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
//1. 金蝶迷你
|
|
|
|
|
//2. 金蝶标准
|
|
|
|
|
//3. 金蝶k3
|
|
|
|
|
//4. 用友U8
|
|
|
|
|
//5. 浪潮
|
|
|
|
|
//6. SyBase
|
|
|
|
|
//7. 用友NC
|
|
|
|
|
//8. 金蝶专业
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "1")
|
|
|
|
|
{
|
|
|
|
|
setExcelReport1();
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "2")
|
|
|
|
|
{
|
|
|
|
|
setExcelReport2();
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "3")
|
|
|
|
|
{
|
|
|
|
|
setExcelReport3();
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "4")
|
|
|
|
|
{
|
|
|
|
|
setExcelReport4(ds);
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "5")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "6")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "7")
|
|
|
|
|
{
|
|
|
|
|
setExcelReportNC(ds);
|
|
|
|
|
}
|
|
|
|
|
else if (ds.Tables[0].Rows[0]["FSOFTCODE"].ToString().Trim() == "8")
|
|
|
|
|
{
|
|
|
|
|
setExcelReport8();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReport1()
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",", "','");
|
|
|
|
|
//
|
|
|
|
|
string OppPath = "dbf";
|
|
|
|
|
string xmlPath = Server.MapPath(OppPath);
|
|
|
|
|
string xmlName = "kismn.dbf";
|
|
|
|
|
string sName = "kismn";
|
|
|
|
|
//
|
|
|
|
|
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
|
|
|
|
|
{
|
|
|
|
|
CwVouitemsDA CwVouitemsDA = new CwVouitemsDA();
|
|
|
|
|
int iResult = CwVouitemsDA.setExcelReport1(sGid, xmlPath, sName);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
string fileName = "vouitems.dbf";//客户端保存的文件名
|
|
|
|
|
string filePath = xmlPath + "//" + xmlName;// Server.MapPath(xmlPath + "//" + xmlName);//路径
|
|
|
|
|
|
|
|
|
|
//以字符流的形式下载文件
|
|
|
|
|
FileStream fs = new FileStream(filePath, FileMode.Open);
|
|
|
|
|
byte[] bytes = new byte[(int)fs.Length];
|
|
|
|
|
fs.Read(bytes, 0, bytes.Length);
|
|
|
|
|
fs.Close();
|
|
|
|
|
Response.ContentType = "application/octet-stream";
|
|
|
|
|
//通知浏览器下载文件而不是打开
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.BinaryWrite(bytes);
|
|
|
|
|
Response.Flush();
|
|
|
|
|
Response.End();
|
|
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证成功!');</script>");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证出错!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('金蝶迷你凭证文件缺失,请联系管理员!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReport2()
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",", "','");
|
|
|
|
|
//
|
|
|
|
|
string OppPath = "dbf";
|
|
|
|
|
string xmlPath = Server.MapPath(OppPath);
|
|
|
|
|
string xmlName = "kisbz.dbf";
|
|
|
|
|
string sName = "kisbz";
|
|
|
|
|
//
|
|
|
|
|
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
|
|
|
|
|
{
|
|
|
|
|
CwVouitemsDA CwVouitemsDA = new CwVouitemsDA();
|
|
|
|
|
int iResult = CwVouitemsDA.setExcelReport2(sGid, xmlPath, sName);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
string fileName = "vouitems.dbf";//客户端保存的文件名
|
|
|
|
|
string filePath = xmlPath + "//" + xmlName;// Server.MapPath(xmlPath + "//" + xmlName);//路径
|
|
|
|
|
|
|
|
|
|
//以字符流的形式下载文件
|
|
|
|
|
FileStream fs = new FileStream(filePath, FileMode.Open);
|
|
|
|
|
byte[] bytes = new byte[(int)fs.Length];
|
|
|
|
|
fs.Read(bytes, 0, bytes.Length);
|
|
|
|
|
fs.Close();
|
|
|
|
|
Response.ContentType = "application/octet-stream";
|
|
|
|
|
//通知浏览器下载文件而不是打开
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.BinaryWrite(bytes);
|
|
|
|
|
Response.Flush();
|
|
|
|
|
Response.End();
|
|
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证成功!');</script>");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证出错!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('金蝶标准凭证文件缺失,请联系管理员!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReport3()
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",", "','");
|
|
|
|
|
//
|
|
|
|
|
string OppPath = "dbf";
|
|
|
|
|
string xmlPath = Server.MapPath(OppPath);
|
|
|
|
|
string xmlName = "kisk3.dbf";
|
|
|
|
|
string sName = "kisk3";
|
|
|
|
|
//
|
|
|
|
|
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
|
|
|
|
|
{
|
|
|
|
|
CwVouitemsDA CwVouitemsDA = new CwVouitemsDA();
|
|
|
|
|
int iResult = CwVouitemsDA.setExcelReport3(sGid, xmlPath, sName);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
string fileName = "vouitems.dbf";//客户端保存的文件名
|
|
|
|
|
string filePath = xmlPath + "//" + xmlName;// Server.MapPath(xmlPath + "//" + xmlName);//路径
|
|
|
|
|
|
|
|
|
|
//以字符流的形式下载文件
|
|
|
|
|
FileStream fs = new FileStream(filePath, FileMode.Open);
|
|
|
|
|
byte[] bytes = new byte[(int)fs.Length];
|
|
|
|
|
fs.Read(bytes, 0, bytes.Length);
|
|
|
|
|
fs.Close();
|
|
|
|
|
Response.ContentType = "application/octet-stream";
|
|
|
|
|
//通知浏览器下载文件而不是打开
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.BinaryWrite(bytes);
|
|
|
|
|
Response.Flush();
|
|
|
|
|
Response.End();
|
|
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证成功!');</script>");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证出错!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('金蝶K3凭证文件缺失,请联系管理员!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReport4(DataSet dsCwDesign)
|
|
|
|
|
{//导出用友U8凭证
|
|
|
|
|
StringWriter sw = new StringWriter();
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sSQL = "";
|
|
|
|
|
string ls = "";
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",","','");
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
sSQL = "SELECT c.VOUNO, c.VKNO, CONVERT(varchar(10), c.VOUDATE, 120) AS VOUDATE, c.ACCYEAR, c.ACCMONTH, c.ATTACHS, c.FCY, c.QTY, c.VOUPROP, c.PREPARED, c.CHECKED, c.ENTERED, c.ERRMSG, c.ISDELETE, c.DELETEUSER, c.DELETETIME, c.VOUALLNO, c.ISEXPORT, i.GID, i.ORDNO, i.ITEMNO, i.ACCID, i.PACCID, i.ACCNAME, i.PROPERTY, i.GRADE, i.DC, i.AMTDR, i.AMTCR, i.ISFCY, i.FCYNO, i.FCYEXRATE, i.FCYDR, i.FCYCR, i.QTYUNIT, i.QTYDR, i.QTYCR, i.EXPLAN, i.ISDEPTACC, i.ISEMPLACC, i.ISCORPACC, i.ISITEMACC, i.DEPTID, i.EMPLID, i.CORPID, i.PITEMID, i.ITEMID, i.FIELD10, i.FIELD9, i.FIELD8, i.FIELD7, i.FIELD6, i.FIELD5, i.FIELD4, i.FIELD3, i.FIELD2, i.FIELD1, i.ISSYS, i.FSETTLCODE, i.FSETTLENO, i.MODIFIEDUSER, i.MODIFIEDTIME, i.CUSTOMERNAME, i.SALE, i.BLNO FROM cw_vouchers AS c INNER JOIN cw_vouitems AS i ON c.ORDNO = i.ORDNO where i.ORDNO in ('" + sGid.Trim() + "') order by c.VOUALLNO,i.ITEMNO";
|
|
|
|
|
DataSet DS = T_ALL_DA.GetAllSQL(sSQL);
|
|
|
|
|
if (DS != null)
|
|
|
|
|
{
|
|
|
|
|
string strCompanyName = T_ALL_DA.GetStrSQL("FULLNAME", "select top 1 FULLNAME from company where gid='" + strCompanyID + "'");
|
|
|
|
|
//
|
|
|
|
|
ls = "填制凭证,V800";
|
|
|
|
|
sw.WriteLine(ls.Trim());
|
|
|
|
|
//用友U8 凭证导出 导出凭证
|
|
|
|
|
foreach (DataTable myTable in DS.Tables)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
|
|
{
|
|
|
|
|
ls = (myRow["VOUDATE"].ToString().Trim() == "" ? "" : ("\"" + myRow["VOUDATE"].ToString().Trim() + "\""));//F1日期
|
|
|
|
|
ls += "," + (myRow["VKNO"].ToString().Trim() == "" ? "" : ("\"" + myRow["VKNO"].ToString().Trim() + "\""));//F2类别
|
|
|
|
|
ls += "," + (myRow["VOUNO"].ToString().Trim() == "" ? "" : ("\"" + myRow["VOUNO"].ToString().Trim() + "\""));//F3凭证号
|
|
|
|
|
ls += "," + (dsCwDesign.Tables[0].Rows[0]["AFFIXNO"].ToString().Trim() == "" ? "0" : dsCwDesign.Tables[0].Rows[0]["AFFIXNO"].ToString().Trim());//F4附单据数
|
|
|
|
|
ls += "," + (myRow["EXPLAN"].ToString().Trim() == "" ? "" : ("\"" + myRow["EXPLAN"].ToString().Trim() + "\""));//F5摘要
|
|
|
|
|
ls += "," + (myRow["ACCID"].ToString().Trim() == "" ? "" : ("\"" + myRow["ACCID"].ToString().Trim() + "\""));//F6科目编码
|
|
|
|
|
ls += "," + myRow["AMTDR"].ToString().Trim();//F7借方
|
|
|
|
|
ls += "," + myRow["AMTCR"].ToString().Trim();//F8贷方
|
|
|
|
|
ls += ",0.00";// + myRow["FCYNO"].ToString().Trim();//F9数量/外币编号
|
|
|
|
|
//
|
|
|
|
|
if (myRow["FCYDR"].ToString().Trim() != "0.00" || myRow["FCYCR"].ToString().Trim() != "0.00")
|
|
|
|
|
{
|
|
|
|
|
ls += "," + ((myRow["FCYDR"].ToString().Trim() == "0.00" ? myRow["FCYCR"].ToString().Trim() : myRow["FCYDR"].ToString().Trim()));//F10外币
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ls += "," + ((myRow["AMTDR"].ToString().Trim() == "0.00" ? myRow["AMTCR"].ToString().Trim() : myRow["AMTDR"].ToString().Trim()));//F7借方//F8贷方
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
ls += "," + Decimal.Parse(myRow["FCYEXRATE"].ToString().Trim()).ToString("F2");//F11汇率
|
|
|
|
|
ls += "," + (myRow["PREPARED"].ToString().Trim() == "" ? "" : ("\"" + myRow["PREPARED"].ToString().Trim() + "\""));//F12制单人
|
|
|
|
|
ls += "," + (myRow["FSETTLCODE"].ToString().Trim() == "" ? "" : ("\"" + myRow["FSETTLCODE"].ToString().Trim() + "\"")); ;//F13结算方式
|
|
|
|
|
string sbl = "";
|
|
|
|
|
sbl = T_ALL_DA.GetStrSQL("gid", "select gid from cw_design where AR='" + myRow["ACCID"].ToString().Trim() + "' or ARFC='" + myRow["ACCID"].ToString().Trim() + "' or AP='" + myRow["ACCID"].ToString().Trim() + "' or APFC='" + myRow["ACCID"].ToString().Trim() + "'");
|
|
|
|
|
if (sbl.Trim() == "" && myRow["ACCID"].ToString().Trim() != "100206" )
|
|
|
|
|
{
|
|
|
|
|
ls += ",";//F14票号
|
|
|
|
|
ls += ",";//F15发生日期
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ls += "," + (myRow["BLNO"].ToString().Trim() == "" ? "" : ("\"" + myRow["BLNO"].ToString().Trim() + "\""));//F14票号
|
|
|
|
|
ls += "," + (myRow["VOUDATE"].ToString().Trim() == "" ? "" : ("\"" + myRow["VOUDATE"].ToString().Trim() + "\""));//F15发生日期
|
|
|
|
|
}
|
|
|
|
|
//ls += ",";//F14票号
|
|
|
|
|
//ls += ",";//F15发生日期
|
|
|
|
|
ls += "," + (myRow["DEPTID"].ToString().Trim() == "" ? "" : ("\"" + myRow["DEPTID"].ToString().Trim() + "\""));//F16部门编码
|
|
|
|
|
ls += "," + (myRow["EMPLID"].ToString().Trim() == "" ? "" : ("\"" + myRow["EMPLID"].ToString().Trim() + "\""));//F17个人编码
|
|
|
|
|
ls += "," + (myRow["CORPID"].ToString().Trim() == "" ? "" : ("\"" + myRow["CORPID"].ToString().Trim() + "\""));//F18客户编码
|
|
|
|
|
ls += "," + (myRow["FIELD3"].ToString().Trim() == "" ? "" : ("\"" + myRow["FIELD3"].ToString().Trim() + "\"")); ;//F19供应商编码 FIELD3
|
|
|
|
|
ls += ",";//F20业务员
|
|
|
|
|
ls += "," + (myRow["ITEMID"].ToString().Trim() == "" ? "" : ("\"" + myRow["ITEMID"].ToString().Trim() + "\"")); ;//F21项目编码
|
|
|
|
|
ls += ",";//F22自定义项
|
|
|
|
|
ls += ",";//F23自定义项2
|
|
|
|
|
ls += ",";//F24自由项1
|
|
|
|
|
ls += ",";//F25自由项2
|
|
|
|
|
ls += ",";//F26自由项3
|
|
|
|
|
ls += ",";//F27自由项4
|
|
|
|
|
ls += ",0";//F28自由项5
|
|
|
|
|
ls += ",";//F29自由项6
|
|
|
|
|
ls += ",0.00";//F30自由项7
|
|
|
|
|
ls += ",";//F31自由项8
|
|
|
|
|
ls += ",";//F32自由项9
|
|
|
|
|
ls += ",";//F33自由项10
|
|
|
|
|
ls += ",";//F34外部系统标识
|
|
|
|
|
ls += ",";//F35业务类型
|
|
|
|
|
ls += ",";//F36单据类型
|
|
|
|
|
ls += ",";//F37单据日期
|
|
|
|
|
ls += ",";//F38单据号
|
|
|
|
|
ls += "," + (dsCwDesign.Tables[0].Rows[0]["ISVBM"].ToString().Trim().Equals("True")?"0":"1");//F39凭证是否可改
|
|
|
|
|
ls += ",1";//F40分录是否可增删
|
|
|
|
|
ls += ",1";//F41合计金额是否保值
|
|
|
|
|
ls += ",1";//F42数值是否可改
|
|
|
|
|
ls += ",1";//F43科目是否可改
|
|
|
|
|
ls += ",";//F44受控科目
|
|
|
|
|
ls += ",1";//F45往来是否可改
|
|
|
|
|
ls += ",1";//F46部门是否可改
|
|
|
|
|
ls += ",1";//F47项目是否可改
|
|
|
|
|
ls += ",0";//F48往来项是否必输
|
|
|
|
|
ls += ",";//F49账套号
|
|
|
|
|
ls += ",";//F50核算单位
|
|
|
|
|
ls += ",";//F51会计年度
|
|
|
|
|
ls += ",";//F52会计期间
|
|
|
|
|
ls += ",";//F53类别顺序号
|
|
|
|
|
ls += ",";//F54凭证号
|
|
|
|
|
ls += ",";//F55审核人
|
|
|
|
|
ls += ",";//F56记账人
|
|
|
|
|
ls += ",0";//F57是否记账
|
|
|
|
|
ls += ",";//F58出纳人
|
|
|
|
|
ls += ",";//F59行号
|
|
|
|
|
ls += ",";//F60外币名称
|
|
|
|
|
ls += ",0.00";//F61单价
|
|
|
|
|
ls += ",";//F62科目名称
|
|
|
|
|
ls += ",";//F63部门名称
|
|
|
|
|
ls += ",";//F64个人名称
|
|
|
|
|
ls += "," + (myRow["CUSTOMERNAME"].ToString().Trim() == "" ? "" : ("\"" + myRow["CUSTOMERNAME"].ToString().Trim() + "\""));//F65客户简称
|
|
|
|
|
ls += ",";//F66供应商简称
|
|
|
|
|
ls += ",";//F67项目名称
|
|
|
|
|
ls += ",";//F68项目大类编码
|
|
|
|
|
ls += ",";//F69项目大类名称
|
|
|
|
|
ls += ",";//F70对方科目
|
|
|
|
|
ls += ",0";//F71银行两清标志
|
|
|
|
|
ls += ",0";//F72往来两清标志
|
|
|
|
|
ls += ",0";//F73银行核销标志
|
|
|
|
|
ls += ",";//F74外部系统名称
|
|
|
|
|
ls += ",";//F75外部账套号
|
|
|
|
|
ls += ",0";//F76外部会计年度
|
|
|
|
|
ls += ",0";//F77外部会计期间
|
|
|
|
|
ls += ",";//F78外部制单日期
|
|
|
|
|
ls += ",";//F79外部系统版本
|
|
|
|
|
ls += ",";//F80凭证标识
|
|
|
|
|
ls += ",";//F81分录自动编号
|
|
|
|
|
ls += ",";//F82唯一标识
|
|
|
|
|
ls += ",";//F83主管签字
|
|
|
|
|
ls += ",";//F84自由项11
|
|
|
|
|
ls += ",";//F85自由项12
|
|
|
|
|
ls += ",";//F86自由项13
|
|
|
|
|
ls += ",";//F87自由项14
|
|
|
|
|
ls += ",0";//F88自由项15
|
|
|
|
|
ls += ",0.00";//F89自由项16
|
|
|
|
|
sw.WriteLine(ls);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//标记已经导出凭证
|
|
|
|
|
string sSql = " update cw_vouchers set ISEXPORT=1 where ORDNO in('" + sGid.Trim() + "')";
|
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sSql);
|
|
|
|
|
//
|
|
|
|
|
sw.Close();
|
|
|
|
|
switch ("MUTEXT")
|
|
|
|
|
{
|
|
|
|
|
case "MUEXCEL":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.xls");
|
|
|
|
|
Response.ContentType = "application/ms-excel";
|
|
|
|
|
break;
|
|
|
|
|
case "MUTEXT":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.txt");
|
|
|
|
|
Response.ContentType = "application/txt";
|
|
|
|
|
break;
|
|
|
|
|
case "MUWORD":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.doc");
|
|
|
|
|
Response.ContentType = "application/ms-word";
|
|
|
|
|
break;
|
|
|
|
|
case "MUPDF":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.pdf");
|
|
|
|
|
Response.ContentType = "application/pdf";
|
|
|
|
|
break;
|
|
|
|
|
case "MUXML":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.xml");
|
|
|
|
|
Response.ContentType = "application/xml";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
|
|
|
|
|
Response.Write(sw);
|
|
|
|
|
Response.End();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReportNC(DataSet dsCwDesign)
|
|
|
|
|
{//导出用友NC凭证
|
|
|
|
|
StringWriter sw = new StringWriter();
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sSQL = "";
|
|
|
|
|
string ls = "";
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",", "','");
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
sSQL = "SELECT ROW_NUMBER() OVER (ORDER BY i.ACCID) AS RowNumber,'0010100011801-0001','01' pzlb,c.VOUNO,'0' fdjs, c.PREPARED, ";//0-5
|
|
|
|
|
sSQL = sSQL + " CONVERT(varchar(10), c.VOUDATE, 120) AS VOUDATE, i.EXPLAN,i.ACCID,'人民币' bz, "; //6-9
|
|
|
|
|
sSQL = sSQL + " i.FCYDR,i.AMTDR,'' jtbbj,'' qjbbj,'01120' ywdybm,'' dj,'' jfsl,'' dfsl, ";//10-17
|
|
|
|
|
sSQL = sSQL + " i.FCYCR,i.AMTCR,'' _20,'' _21,i.BLNO,'' _23,'' _24, CONVERT(varchar(10), c.VOUDATE, 120) AS BSDATE, ";//18-25
|
|
|
|
|
sSQL = sSQL + " '' _26,'' _27,'' _28,'' _29,'' _30,'' _31,'' _32,'' _33,'' _34,'' _35,'' _36, ";//26-36
|
|
|
|
|
sSQL = sSQL + " '1' _37,'' _38,'' _39, ";//37-39
|
|
|
|
|
sSQL = sSQL + " i.FIELD1, i.FIELD2, i.FIELD3, i.FIELD4, i.FIELD5, i.FIELD6, i.FIELD7, i.FIELD8, i.FIELD9 ";
|
|
|
|
|
sSQL = sSQL + " FROM cw_vouchers AS c INNER JOIN cw_vouitems AS i ON c.ORDNO = i.ORDNO where i.ORDNO in ('" + sGid.Trim() + "') ";
|
|
|
|
|
sSQL = sSQL + " order by i.ACCID ";
|
|
|
|
|
DataSet DS = T_ALL_DA.GetAllSQL(sSQL);
|
|
|
|
|
if (DS != null)
|
|
|
|
|
{
|
|
|
|
|
string strCompanyName = T_ALL_DA.GetStrSQL("FULLNAME", "select top 1 FULLNAME from company where gid='" + strCompanyID + "'");
|
|
|
|
|
//
|
|
|
|
|
ls = "\"null_$head,main_m_pk_accountingbook,main_m_pk_vouchertype,main_m_num,main_m_attachment,main_pk_prepared,main_m_prepareddate,m_explanation,m_accsubjcode,m_pk_currtype,m_debitamount,m_localdebitamount,m_groupdebitamount,m_globaldebitamount,unitname,m_price,m_debitquantity,m_creditquantity,m_creditamount,m_localcreditamount,m_groupcreditamount,m_globalcreditamount,m_checkno,m_checkdate,verifyno,verifydate,m_bankaccount,billtype,m_checkstyle,vat_pk_vatcountry,vat_pk_receivecountry,vat_businesscode,vat_pk_clientvatcode,vat_pk_suppliervatcode,vat_pk_taxcode,vat_direction,vat_moneyamount,m_excrate2,excrate3,excrate4,ass_1,ass_2,ass_3,ass_4,ass_5,ass_6,ass_7,ass_8,ass_9\"\t核算账簿\t凭证类别编码 凭证号 附单据数 制单人编码 制单日期 摘要 科目编码 币种 原币借方金额 本币借方金额 集团本币借方金额 全局本币借方金额 业务单元编码 单价 借方数量 贷方数量 原币贷方金额 本币贷方金额 集团本币贷方金额 全局本币贷方金额 结算号 结算日期 核销号 业务日期 银行账户 票据类型 结算方式 报税国家 收货国 交易代码 客户VAT注册码 供应商VAT注册码 税码 VAT方向 计税金额 组织本币汇率 集团本币汇率 全局本币汇率 辅助核算1 辅助核算2 辅助核算3 辅助核算4 辅助核算5 辅助核算6 辅助核算7 辅助核算8 辅助核算9";
|
|
|
|
|
ls = ls.Replace(" ", "\t");
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
//标记已经导出凭证
|
|
|
|
|
string sSql = " update cw_vouchers set ISEXPORT=1 where ORDNO in('" + sGid.Trim() + "')";
|
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sSql);
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
ExcelDA ExcelDA = new EntityDA.ExcelDA();
|
|
|
|
|
MemoryStream ms = ExcelDA.RenderToExcel(DS.Tables[0], ls,1);
|
|
|
|
|
ExcelDA.RenderToBrowser(ms, Context, "report.xls");
|
|
|
|
|
/*
|
|
|
|
|
sw.WriteLine(ls.Trim());
|
|
|
|
|
//用友U8 凭证导出 导出凭证
|
|
|
|
|
var linenum = 0;
|
|
|
|
|
foreach (DataTable myTable in DS.Tables)
|
|
|
|
|
{
|
|
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
|
|
{
|
|
|
|
|
ls = linenum.ToString();//0列 行号
|
|
|
|
|
linenum++;
|
|
|
|
|
ls += "\t" + "0010100011801-0001";//1列 "核算账簿 推测是帐套号"
|
|
|
|
|
ls += "\t" + "1";//2列 凭证类别编码
|
|
|
|
|
ls += "\t" ;//3列 凭证号 自动生成
|
|
|
|
|
ls += "\t" +"0";//F4附单据数
|
|
|
|
|
ls += "\t" + (myRow["PREPARED"].ToString().Trim() == "" ? "" : ("\"" + myRow["PREPARED"].ToString().Trim() + "\""));//5 制单人
|
|
|
|
|
ls += "\t" + (myRow["VOUDATE"].ToString().Trim() == "" ? "" : ("\"" + myRow["VOUDATE"].ToString().Trim() + "\""));//6 制单日期
|
|
|
|
|
ls += "\t" + (myRow["EXPLAN"].ToString().Trim() == "" ? "" : ("\"" + myRow["EXPLAN"].ToString().Trim() + "\""));// 7 摘要
|
|
|
|
|
ls += "\t" + myRow["ACCID"].ToString().Trim();//8 科目编码
|
|
|
|
|
ls += "\t" + "人民币";//9 币种
|
|
|
|
|
ls += "\t" + myRow["FCYDR"].ToString().Trim();//10 原币借方
|
|
|
|
|
ls += "\t" + myRow["AMTDR"].ToString().Trim();//11 本币借方
|
|
|
|
|
ls += "\t";//集团本币借方金额
|
|
|
|
|
ls += "\t";//全局本币借方金额
|
|
|
|
|
ls += "\t"+"01120";//业务单元编码14
|
|
|
|
|
ls += "\t";//单价15
|
|
|
|
|
ls += "\t";//借方数量16
|
|
|
|
|
ls += "\t";//贷方数量17
|
|
|
|
|
ls += "\t" + myRow["FCYCR"].ToString().Trim(); ;//原币贷方金额18
|
|
|
|
|
ls += "\t" + myRow["AMTCR"].ToString().Trim();//本币贷方金额19
|
|
|
|
|
ls += "\t";//集团本币贷方金额 20
|
|
|
|
|
ls += "\t";//全局本币贷方金额21
|
|
|
|
|
ls += "\t";//结算号22//此处放置支票号
|
|
|
|
|
ls += "\t";//结算日期23
|
|
|
|
|
ls += "\t";//核销号24
|
|
|
|
|
ls += "\t"+ (myRow["VOUDATE"].ToString().Trim() == "" ? "" : ("\"" + myRow["VOUDATE"].ToString().Trim() + "\""));;//业务日期25
|
|
|
|
|
ls += "\t";//银行账户26
|
|
|
|
|
ls += "\t";//票据类型27
|
|
|
|
|
ls += "\t";//结算方式
|
|
|
|
|
ls += "\t";//报税国家
|
|
|
|
|
ls += "\t";//收货国30
|
|
|
|
|
ls += "\t";//交易代码
|
|
|
|
|
ls += "\t";//客户VAT注册码
|
|
|
|
|
ls += "\t";//供应商VAT注册码
|
|
|
|
|
ls += "\t";//税码
|
|
|
|
|
ls += "\t";//VAT方向35
|
|
|
|
|
ls += "\t";//计税金额
|
|
|
|
|
ls += "\t"+"1";//组织本币汇率37
|
|
|
|
|
ls += "\t";//集团本币汇率
|
|
|
|
|
ls += "\t";//全局本币汇率
|
|
|
|
|
ls += "\t" + myRow["FIELD1"].ToString().Trim(); //辅助核算1 40
|
|
|
|
|
ls += "\t" + myRow["FIELD2"].ToString().Trim();//辅助核算2
|
|
|
|
|
ls += "\t" + myRow["FIELD3"].ToString().Trim();//辅助核算3
|
|
|
|
|
ls += "\t" + myRow["FIELD4"].ToString().Trim();//辅助核算4
|
|
|
|
|
ls += "\t" + myRow["FIELD5"].ToString().Trim();//辅助核算5
|
|
|
|
|
ls += "\t" + myRow["FIELD6"].ToString().Trim();//辅助核算6
|
|
|
|
|
ls += "\t" + myRow["FIELD7"].ToString().Trim();//辅助核算7
|
|
|
|
|
ls += "\t" + myRow["FIELD8"].ToString().Trim();//辅助核算8
|
|
|
|
|
ls += "\t" + myRow["FIELD9"].ToString().Trim();//辅助核算9 48
|
|
|
|
|
//共49列
|
|
|
|
|
|
|
|
|
|
sw.WriteLine(ls);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//标记已经导出凭证
|
|
|
|
|
string sSql = " update cw_vouchers set ISEXPORT=1 where ORDNO in('" + sGid.Trim() + "')";
|
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sSql);
|
|
|
|
|
//
|
|
|
|
|
sw.Close();
|
|
|
|
|
switch ("MUEXCEL")
|
|
|
|
|
{
|
|
|
|
|
case "MUEXCEL":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.xls");
|
|
|
|
|
Response.ContentType = "application/ms-excel";
|
|
|
|
|
break;
|
|
|
|
|
case "MUTEXT":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.txt");
|
|
|
|
|
Response.ContentType = "application/txt";
|
|
|
|
|
break;
|
|
|
|
|
case "MUWORD":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.doc");
|
|
|
|
|
Response.ContentType = "application/ms-word";
|
|
|
|
|
break;
|
|
|
|
|
case "MUPDF":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.pdf");
|
|
|
|
|
Response.ContentType = "application/pdf";
|
|
|
|
|
break;
|
|
|
|
|
case "MUXML":
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=report.xml");
|
|
|
|
|
Response.ContentType = "application/xml";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
|
|
|
|
|
Response.Write(sw);
|
|
|
|
|
Response.End();*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void setExcelReport8()
|
|
|
|
|
{
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
string sGid = this.hdGid.Value.Trim();
|
|
|
|
|
sGid = sGid.Trim().Replace(",", "','");
|
|
|
|
|
//
|
|
|
|
|
string OppPath = "dbf";
|
|
|
|
|
string xmlPath = Server.MapPath(OppPath);
|
|
|
|
|
string xmlName = "kiszy.dbf";
|
|
|
|
|
string sName = "kiszy";
|
|
|
|
|
//
|
|
|
|
|
if (File.Exists(xmlPath + "//" + xmlName)) //判断文件是否寸在
|
|
|
|
|
{
|
|
|
|
|
CwVouitemsDA CwVouitemsDA = new CwVouitemsDA();
|
|
|
|
|
int iResult = CwVouitemsDA.setExcelReport8(sGid, xmlPath, sName);
|
|
|
|
|
if (iResult > 0)
|
|
|
|
|
{
|
|
|
|
|
string fileName = "vouitems.dbf";//客户端保存的文件名
|
|
|
|
|
string filePath = xmlPath + "//" + xmlName;// Server.MapPath(xmlPath + "//" + xmlName);//路径
|
|
|
|
|
|
|
|
|
|
//以字符流的形式下载文件
|
|
|
|
|
FileStream fs = new FileStream(filePath, FileMode.Open);
|
|
|
|
|
byte[] bytes = new byte[(int)fs.Length];
|
|
|
|
|
fs.Read(bytes, 0, bytes.Length);
|
|
|
|
|
fs.Close();
|
|
|
|
|
Response.ContentType = "application/octet-stream";
|
|
|
|
|
//通知浏览器下载文件而不是打开
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
|
|
|
|
Response.BinaryWrite(bytes);
|
|
|
|
|
Response.Flush();
|
|
|
|
|
Response.End();
|
|
|
|
|
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证成功!');</script>");
|
|
|
|
|
//return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('导出凭证出错!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('金蝶专业版凭证文件缺失,请联系管理员!');</script>");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Grid参数
|
|
|
|
|
private void SaveColumnSetting(string tempColumnVal)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
JsonColumnGroupEntity jsonColumnGroupEntity = GetPostEntity(tempColumnVal);
|
|
|
|
|
List<JsonColumnEntity> jsonColumnEntities = new List<JsonColumnEntity>();
|
|
|
|
|
|
|
|
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
|
|
|
|
|
|
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType);
|
|
|
|
|
|
|
|
|
|
if (userSettingEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
userSettingEntity.ModifiedUser = strUserID;
|
|
|
|
|
|
|
|
|
|
GridEntity gridEntity = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
|
|
|
|
|
gridEntity = GetSettingXml(userSettingEntity.Xml);
|
|
|
|
|
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
|
|
|
|
|
|
|
|
|
|
foreach (JsonColumnEntity jColumn in jsonColumnGroupEntity.JsonColumnEntities)
|
|
|
|
|
{
|
|
|
|
|
foreach (GridColumnEntity gColumn in gridEntity.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (gColumn.Description.Equals(jColumn.col3))
|
|
|
|
|
{
|
|
|
|
|
gColumn.Description = jColumn.col3;
|
|
|
|
|
gColumn.Width = jColumn.col5;
|
|
|
|
|
gColumn.Index = jColumn.col4;
|
|
|
|
|
if (jColumn.col6 != -1)
|
|
|
|
|
{
|
|
|
|
|
gColumn.VisibleState = jColumn.col6;
|
|
|
|
|
}
|
|
|
|
|
//gridColumnEntities.Add(gColumn);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//Columns
|
|
|
|
|
//gridEntity.Columns = gridColumnEntities;
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml;
|
|
|
|
|
int iResult = userSettingDA.UpdateUserSetting(userSettingEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (jsonColumnGroupEntity != null)
|
|
|
|
|
{
|
|
|
|
|
userSettingEntity = new UserSettingEntity();
|
|
|
|
|
|
|
|
|
|
userSettingEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
userSettingEntity.Name = "CwVouchersListGridSetting";
|
|
|
|
|
userSettingEntity.Description = "凭证主表Grid设置";
|
|
|
|
|
userSettingEntity.UserID = strUserID;
|
|
|
|
|
userSettingEntity.Type = 1;//type值为1表示Grid
|
|
|
|
|
string strRequestUrl = Request.Url.ToString();
|
|
|
|
|
string strUrl = strRequestUrl.Substring(0, strRequestUrl.LastIndexOf("/"));
|
|
|
|
|
string strPage = strRequestUrl.Substring(strRequestUrl.LastIndexOf("/") + 1, strRequestUrl.Length - strRequestUrl.LastIndexOf("/") - 1);
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Url = strUrl;
|
|
|
|
|
userSettingEntity.Page = strPage;
|
|
|
|
|
userSettingEntity.CreateUser = strUserID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridEntity gridEntity = new GridEntity();
|
|
|
|
|
|
|
|
|
|
gridEntity.GID = userSettingEntity.GID;
|
|
|
|
|
gridEntity.UserID = strUserID;
|
|
|
|
|
gridEntity.GroupBy = "";
|
|
|
|
|
gridEntity.DefaultPrePageCount = 15;
|
|
|
|
|
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
|
|
|
|
|
|
|
|
|
|
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
|
|
|
|
|
|
|
|
|
|
foreach (JsonColumnEntity column in jsonColumnGroupEntity.JsonColumnEntities)
|
|
|
|
|
{
|
|
|
|
|
GridColumnEntity gridColumnEntity = new GridColumnEntity();
|
|
|
|
|
|
|
|
|
|
if (column.col6 != -1)
|
|
|
|
|
{
|
|
|
|
|
gridColumnEntity.Name = column.col2;
|
|
|
|
|
gridColumnEntity.VisibleState = column.col6;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (column.col3.Trim())
|
|
|
|
|
{
|
|
|
|
|
case "凭证号":
|
|
|
|
|
gridColumnEntity.Name = "VOUALLNO";
|
|
|
|
|
break;
|
|
|
|
|
case "凭证日期":
|
|
|
|
|
gridColumnEntity.Name = "VOUDATE";
|
|
|
|
|
break;
|
|
|
|
|
case "年":
|
|
|
|
|
gridColumnEntity.Name = "ACCYEAR";
|
|
|
|
|
break;
|
|
|
|
|
case "月":
|
|
|
|
|
gridColumnEntity.Name = "ACCMONTH";
|
|
|
|
|
break;
|
|
|
|
|
case "序号":
|
|
|
|
|
gridColumnEntity.Name = "VOUNO";
|
|
|
|
|
break;
|
|
|
|
|
case "制单人":
|
|
|
|
|
gridColumnEntity.Name = "PREPARED";
|
|
|
|
|
break;
|
|
|
|
|
case "凭证字":
|
|
|
|
|
gridColumnEntity.Name = "VKNO";
|
|
|
|
|
break;
|
|
|
|
|
case "本位币借方":
|
|
|
|
|
gridColumnEntity.Name = "AMTDR";
|
|
|
|
|
break;
|
|
|
|
|
case "本位币贷方":
|
|
|
|
|
gridColumnEntity.Name = "AMTCR";
|
|
|
|
|
break;
|
|
|
|
|
case "外币借方":
|
|
|
|
|
gridColumnEntity.Name = "FCYDR";
|
|
|
|
|
break;
|
|
|
|
|
case "外币贷方":
|
|
|
|
|
gridColumnEntity.Name = "FCYCR";
|
|
|
|
|
break;
|
|
|
|
|
case "折合本位币借方":
|
|
|
|
|
gridColumnEntity.Name = "AMTFCYDR";
|
|
|
|
|
break;
|
|
|
|
|
case "折合本位币贷方":
|
|
|
|
|
gridColumnEntity.Name = "AMTFCYCR";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
gridColumnEntity.VisibleState = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gridColumnEntity.Description = column.col3;
|
|
|
|
|
gridColumnEntity.Index = column.col4;
|
|
|
|
|
gridColumnEntity.Width = column.col5;
|
|
|
|
|
|
|
|
|
|
gridColumnEntities.Add(gridColumnEntity);
|
|
|
|
|
}
|
|
|
|
|
//Columns
|
|
|
|
|
gridEntity.Columns = gridColumnEntities;
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml;
|
|
|
|
|
|
|
|
|
|
int iResult = userSettingDA.InsertUserSetting(userSettingEntity);
|
|
|
|
|
|
|
|
|
|
dvSaveState.InnerHtml = iResult.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取列信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取列信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private JsonColumnGroupEntity GetPostEntity(string tempValue)
|
|
|
|
|
{
|
|
|
|
|
JsonColumnGroupEntity tempColumnGroupEntity = new JsonColumnGroupEntity();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
tempColumnGroupEntity = (JsonColumnGroupEntity)JSON.Instance.ToObject(tempValue);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception error)
|
|
|
|
|
{
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
return tempColumnGroupEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private XmlDocument SaveUserSetting(GridEntity gridEntity)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
XmlElement root = xmlDoc.CreateElement("user-settings");
|
|
|
|
|
|
|
|
|
|
//xmlDoc.AppendChild(root);
|
|
|
|
|
|
|
|
|
|
XmlElement xGid = xmlDoc.CreateElement("gid");
|
|
|
|
|
xGid.InnerText = gridEntity.GID;
|
|
|
|
|
root.AppendChild(xGid);
|
|
|
|
|
|
|
|
|
|
XmlElement xUserID = xmlDoc.CreateElement("userid");
|
|
|
|
|
xUserID.InnerText = gridEntity.UserID;
|
|
|
|
|
root.AppendChild(xUserID);
|
|
|
|
|
|
|
|
|
|
XmlElement xCreateTime = xmlDoc.CreateElement("create-time");
|
|
|
|
|
xCreateTime.InnerText = gridEntity.CreateTime.ToString();
|
|
|
|
|
root.AppendChild(xCreateTime);
|
|
|
|
|
|
|
|
|
|
XmlElement xColumns = xmlDoc.CreateElement("columns");
|
|
|
|
|
|
|
|
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
|
|
|
{
|
|
|
|
|
XmlElement xColumn = xmlDoc.CreateElement("column");
|
|
|
|
|
XmlElement nName = xmlDoc.CreateElement("name");
|
|
|
|
|
nName.InnerText = column.Name;
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nName);
|
|
|
|
|
|
|
|
|
|
XmlElement nDescription = xmlDoc.CreateElement("description");
|
|
|
|
|
nDescription.InnerText = column.Description;
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nDescription);
|
|
|
|
|
|
|
|
|
|
XmlElement nIndex = xmlDoc.CreateElement("index");
|
|
|
|
|
nIndex.InnerText = column.Index.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nIndex);
|
|
|
|
|
|
|
|
|
|
XmlElement nWidth = xmlDoc.CreateElement("width");
|
|
|
|
|
nWidth.InnerText = column.Width.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nWidth);
|
|
|
|
|
|
|
|
|
|
XmlElement nVisible = xmlDoc.CreateElement("visible");
|
|
|
|
|
nVisible.InnerText = column.VisibleState.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nVisible);
|
|
|
|
|
|
|
|
|
|
xColumns.AppendChild(xColumn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xColumns);
|
|
|
|
|
|
|
|
|
|
XmlElement xGroupBy = xmlDoc.CreateElement("group-by");
|
|
|
|
|
xGroupBy.InnerText = gridEntity.GroupBy;
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xGroupBy);
|
|
|
|
|
|
|
|
|
|
XmlElement xPage = xmlDoc.CreateElement("page");
|
|
|
|
|
|
|
|
|
|
XmlElement nPageDefault = xmlDoc.CreateElement("page-default");
|
|
|
|
|
nPageDefault.InnerText = gridEntity.DefaultPrePageCount.ToString();
|
|
|
|
|
xPage.AppendChild(nPageDefault);
|
|
|
|
|
|
|
|
|
|
XmlElement nPagePre = xmlDoc.CreateElement("page-pre");
|
|
|
|
|
nPagePre.InnerText = gridEntity.PagePreCount.ToString();
|
|
|
|
|
xPage.AppendChild(nPagePre);
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xPage);
|
|
|
|
|
|
|
|
|
|
xmlDoc.AppendChild(root);
|
|
|
|
|
return xmlDoc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GridEntity GetSettingXml(string strXml)
|
|
|
|
|
{
|
|
|
|
|
XmlDocument xmlSettingDoc = new XmlDocument();
|
|
|
|
|
GridEntity gridEntity = new GridEntity();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xmlSettingDoc.LoadXml(strXml);
|
|
|
|
|
|
|
|
|
|
gridEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[0].InnerText.Trim();
|
|
|
|
|
gridEntity.UserID = xmlSettingDoc.ChildNodes[0].ChildNodes[1].InnerText.Trim();
|
|
|
|
|
gridEntity.CreateTime = DateTime.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[2].InnerText.Trim());
|
|
|
|
|
|
|
|
|
|
IList<GridColumnEntity> columnsEntities = new List<GridColumnEntity>();
|
|
|
|
|
|
|
|
|
|
int iColCount = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes.Count;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < iColCount; i++)
|
|
|
|
|
{
|
|
|
|
|
GridColumnEntity columnEntity = new GridColumnEntity();
|
|
|
|
|
//columnEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[0].ToString();
|
|
|
|
|
columnEntity.Name = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[0].InnerText.Trim();
|
|
|
|
|
columnEntity.Description = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[1].InnerText.Trim();
|
|
|
|
|
columnEntity.Index = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[2].InnerText.Trim());
|
|
|
|
|
columnEntity.Width = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[3].InnerText.Trim());
|
|
|
|
|
|
|
|
|
|
columnsEntities.Add(columnEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gridEntity.Columns = columnsEntities;
|
|
|
|
|
gridEntity.GroupBy = xmlSettingDoc.ChildNodes[0].ChildNodes[4].InnerText.Trim();
|
|
|
|
|
gridEntity.DefaultPrePageCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[0].InnerText.Trim());
|
|
|
|
|
gridEntity.PagePreCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[1].InnerText.Trim());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception error)
|
|
|
|
|
{
|
|
|
|
|
throw (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gridEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum SqlName
|
|
|
|
|
{
|
|
|
|
|
NAME = 0,
|
|
|
|
|
LOGTYPE = 1,
|
|
|
|
|
LOGTIME = 2,
|
|
|
|
|
LOGCONTENT = 3,
|
|
|
|
|
USERNAME = 4
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region Grid参数2
|
|
|
|
|
private void SaveColumnSetting2(string tempColumnVal)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
JsonColumnGroupEntity jsonColumnGroupEntity = GetPostEntity2(tempColumnVal);
|
|
|
|
|
List<JsonColumnEntity> jsonColumnEntities = new List<JsonColumnEntity>();
|
|
|
|
|
|
|
|
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
|
|
|
|
|
|
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType2);
|
|
|
|
|
|
|
|
|
|
if (userSettingEntity.GID != null)
|
|
|
|
|
{
|
|
|
|
|
userSettingEntity.ModifiedUser = strUserID;
|
|
|
|
|
|
|
|
|
|
GridEntity gridEntity = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
|
|
|
|
|
gridEntity = GetSettingXml2(userSettingEntity.Xml);
|
|
|
|
|
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
|
|
|
|
|
|
|
|
|
|
foreach (JsonColumnEntity jColumn in jsonColumnGroupEntity.JsonColumnEntities)
|
|
|
|
|
{
|
|
|
|
|
foreach (GridColumnEntity gColumn in gridEntity.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (gColumn.Description.Equals(jColumn.col3))
|
|
|
|
|
{
|
|
|
|
|
gColumn.Description = jColumn.col3;
|
|
|
|
|
gColumn.Width = jColumn.col5;
|
|
|
|
|
gColumn.Index = jColumn.col4;
|
|
|
|
|
if (jColumn.col6 != -1)
|
|
|
|
|
{
|
|
|
|
|
gColumn.VisibleState = jColumn.col6;
|
|
|
|
|
}
|
|
|
|
|
//gridColumnEntities.Add(gColumn);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//Columns
|
|
|
|
|
//gridEntity.Columns = gridColumnEntities;
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Xml = SaveUserSetting2(gridEntity).OuterXml;
|
|
|
|
|
int iResult = userSettingDA.UpdateUserSetting(userSettingEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (jsonColumnGroupEntity != null)
|
|
|
|
|
{
|
|
|
|
|
userSettingEntity = new UserSettingEntity();
|
|
|
|
|
|
|
|
|
|
userSettingEntity.GID = Guid.NewGuid().ToString();
|
|
|
|
|
userSettingEntity.Name = "CwVouchersListGridSetting_2";
|
|
|
|
|
userSettingEntity.Description = "凭证明细表_2Grid设置";
|
|
|
|
|
userSettingEntity.UserID = strUserID;
|
|
|
|
|
userSettingEntity.Type = 1;//type值为1表示Grid
|
|
|
|
|
string strRequestUrl = Request.Url.ToString();
|
|
|
|
|
string strUrl = strRequestUrl.Substring(0, strRequestUrl.LastIndexOf("/"));
|
|
|
|
|
string strPage = strRequestUrl.Substring(strRequestUrl.LastIndexOf("/") + 1, strRequestUrl.Length - strRequestUrl.LastIndexOf("/") - 1);
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Url = strUrl;
|
|
|
|
|
userSettingEntity.Page = strPage;
|
|
|
|
|
userSettingEntity.CreateUser = strUserID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridEntity gridEntity = new GridEntity();
|
|
|
|
|
|
|
|
|
|
gridEntity.GID = userSettingEntity.GID;
|
|
|
|
|
gridEntity.UserID = strUserID;
|
|
|
|
|
gridEntity.GroupBy = "";
|
|
|
|
|
gridEntity.DefaultPrePageCount = 15;
|
|
|
|
|
gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount;
|
|
|
|
|
|
|
|
|
|
List<GridColumnEntity> gridColumnEntities = new List<GridColumnEntity>();
|
|
|
|
|
|
|
|
|
|
foreach (JsonColumnEntity column in jsonColumnGroupEntity.JsonColumnEntities)
|
|
|
|
|
{
|
|
|
|
|
GridColumnEntity gridColumnEntity = new GridColumnEntity();
|
|
|
|
|
|
|
|
|
|
if (column.col6 != -1)
|
|
|
|
|
{
|
|
|
|
|
gridColumnEntity.Name = column.col2;
|
|
|
|
|
gridColumnEntity.VisibleState = column.col6;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (column.col3.Trim())
|
|
|
|
|
{
|
|
|
|
|
case "行号":
|
|
|
|
|
gridColumnEntity.Name = "ITEMNO";
|
|
|
|
|
break;
|
|
|
|
|
case "摘要":
|
|
|
|
|
gridColumnEntity.Name = "EXPLAN";
|
|
|
|
|
break;
|
|
|
|
|
case "科目代码":
|
|
|
|
|
gridColumnEntity.Name = "ACCID";
|
|
|
|
|
break;
|
|
|
|
|
case "科目名称":
|
|
|
|
|
gridColumnEntity.Name = "ACCNAME";
|
|
|
|
|
break;
|
|
|
|
|
case "本位币借方":
|
|
|
|
|
gridColumnEntity.Name = "AMTDR";
|
|
|
|
|
break;
|
|
|
|
|
case "本位币贷方":
|
|
|
|
|
gridColumnEntity.Name = "AMTCR";
|
|
|
|
|
break;
|
|
|
|
|
case "外币借方":
|
|
|
|
|
gridColumnEntity.Name = "FCYDR";
|
|
|
|
|
break;
|
|
|
|
|
case "外币贷方":
|
|
|
|
|
gridColumnEntity.Name = "FCYCR";
|
|
|
|
|
break;
|
|
|
|
|
case "汇率":
|
|
|
|
|
gridColumnEntity.Name = "FCYEXRATE";
|
|
|
|
|
break;
|
|
|
|
|
case "客户财务编码":
|
|
|
|
|
gridColumnEntity.Name = "CORPID";
|
|
|
|
|
break;
|
|
|
|
|
case "客户名称":
|
|
|
|
|
gridColumnEntity.Name = "CUSTOMERNAME";
|
|
|
|
|
break;
|
|
|
|
|
case "揽货人":
|
|
|
|
|
gridColumnEntity.Name = "SALE";
|
|
|
|
|
break;
|
|
|
|
|
case "提单号":
|
|
|
|
|
gridColumnEntity.Name = "MBLNO";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
gridColumnEntity.VisibleState = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gridColumnEntity.Description = column.col3;
|
|
|
|
|
gridColumnEntity.Index = column.col4;
|
|
|
|
|
gridColumnEntity.Width = column.col5;
|
|
|
|
|
|
|
|
|
|
gridColumnEntities.Add(gridColumnEntity);
|
|
|
|
|
}
|
|
|
|
|
//Columns
|
|
|
|
|
gridEntity.Columns = gridColumnEntities;
|
|
|
|
|
|
|
|
|
|
userSettingEntity.Xml = SaveUserSetting2(gridEntity).OuterXml;
|
|
|
|
|
|
|
|
|
|
int iResult = userSettingDA.InsertUserSetting(userSettingEntity);
|
|
|
|
|
|
|
|
|
|
dvSaveState.InnerHtml = iResult.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取列信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取列信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tempValue"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private JsonColumnGroupEntity GetPostEntity2(string tempValue)
|
|
|
|
|
{
|
|
|
|
|
JsonColumnGroupEntity tempColumnGroupEntity = new JsonColumnGroupEntity();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
tempColumnGroupEntity = (JsonColumnGroupEntity)JSON.Instance.ToObject(tempValue);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception error)
|
|
|
|
|
{
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
return tempColumnGroupEntity;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private XmlDocument SaveUserSetting2(GridEntity gridEntity)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
|
|
XmlElement root = xmlDoc.CreateElement("user-settings");
|
|
|
|
|
|
|
|
|
|
//xmlDoc.AppendChild(root);
|
|
|
|
|
|
|
|
|
|
XmlElement xGid = xmlDoc.CreateElement("gid");
|
|
|
|
|
xGid.InnerText = gridEntity.GID;
|
|
|
|
|
root.AppendChild(xGid);
|
|
|
|
|
|
|
|
|
|
XmlElement xUserID = xmlDoc.CreateElement("userid");
|
|
|
|
|
xUserID.InnerText = gridEntity.UserID;
|
|
|
|
|
root.AppendChild(xUserID);
|
|
|
|
|
|
|
|
|
|
XmlElement xCreateTime = xmlDoc.CreateElement("create-time");
|
|
|
|
|
xCreateTime.InnerText = gridEntity.CreateTime.ToString();
|
|
|
|
|
root.AppendChild(xCreateTime);
|
|
|
|
|
|
|
|
|
|
XmlElement xColumns = xmlDoc.CreateElement("columns");
|
|
|
|
|
|
|
|
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
|
|
|
{
|
|
|
|
|
XmlElement xColumn = xmlDoc.CreateElement("column");
|
|
|
|
|
XmlElement nName = xmlDoc.CreateElement("name");
|
|
|
|
|
nName.InnerText = column.Name;
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nName);
|
|
|
|
|
|
|
|
|
|
XmlElement nDescription = xmlDoc.CreateElement("description");
|
|
|
|
|
nDescription.InnerText = column.Description;
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nDescription);
|
|
|
|
|
|
|
|
|
|
XmlElement nIndex = xmlDoc.CreateElement("index");
|
|
|
|
|
nIndex.InnerText = column.Index.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nIndex);
|
|
|
|
|
|
|
|
|
|
XmlElement nWidth = xmlDoc.CreateElement("width");
|
|
|
|
|
nWidth.InnerText = column.Width.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nWidth);
|
|
|
|
|
|
|
|
|
|
XmlElement nVisible = xmlDoc.CreateElement("visible");
|
|
|
|
|
nVisible.InnerText = column.VisibleState.ToString();
|
|
|
|
|
|
|
|
|
|
xColumn.AppendChild(nVisible);
|
|
|
|
|
|
|
|
|
|
xColumns.AppendChild(xColumn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xColumns);
|
|
|
|
|
|
|
|
|
|
XmlElement xGroupBy = xmlDoc.CreateElement("group-by");
|
|
|
|
|
xGroupBy.InnerText = gridEntity.GroupBy;
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xGroupBy);
|
|
|
|
|
|
|
|
|
|
XmlElement xPage = xmlDoc.CreateElement("page");
|
|
|
|
|
|
|
|
|
|
XmlElement nPageDefault = xmlDoc.CreateElement("page-default");
|
|
|
|
|
nPageDefault.InnerText = gridEntity.DefaultPrePageCount.ToString();
|
|
|
|
|
xPage.AppendChild(nPageDefault);
|
|
|
|
|
|
|
|
|
|
XmlElement nPagePre = xmlDoc.CreateElement("page-pre");
|
|
|
|
|
nPagePre.InnerText = gridEntity.PagePreCount.ToString();
|
|
|
|
|
xPage.AppendChild(nPagePre);
|
|
|
|
|
|
|
|
|
|
root.AppendChild(xPage);
|
|
|
|
|
|
|
|
|
|
xmlDoc.AppendChild(root);
|
|
|
|
|
return xmlDoc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GridEntity GetSettingXml2(string strXml)
|
|
|
|
|
{
|
|
|
|
|
XmlDocument xmlSettingDoc = new XmlDocument();
|
|
|
|
|
GridEntity gridEntity = new GridEntity();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
xmlSettingDoc.LoadXml(strXml);
|
|
|
|
|
|
|
|
|
|
gridEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[0].InnerText.Trim();
|
|
|
|
|
gridEntity.UserID = xmlSettingDoc.ChildNodes[0].ChildNodes[1].InnerText.Trim();
|
|
|
|
|
gridEntity.CreateTime = DateTime.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[2].InnerText.Trim());
|
|
|
|
|
|
|
|
|
|
IList<GridColumnEntity> columnsEntities = new List<GridColumnEntity>();
|
|
|
|
|
|
|
|
|
|
int iColCount = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes.Count;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < iColCount; i++)
|
|
|
|
|
{
|
|
|
|
|
GridColumnEntity columnEntity = new GridColumnEntity();
|
|
|
|
|
//columnEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[0].ToString();
|
|
|
|
|
columnEntity.Name = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[0].InnerText.Trim();
|
|
|
|
|
columnEntity.Description = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[1].InnerText.Trim();
|
|
|
|
|
columnEntity.Index = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[2].InnerText.Trim());
|
|
|
|
|
columnEntity.Width = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[3].InnerText.Trim());
|
|
|
|
|
|
|
|
|
|
columnsEntities.Add(columnEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gridEntity.Columns = columnsEntities;
|
|
|
|
|
gridEntity.GroupBy = xmlSettingDoc.ChildNodes[0].ChildNodes[4].InnerText.Trim();
|
|
|
|
|
gridEntity.DefaultPrePageCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[0].InnerText.Trim());
|
|
|
|
|
gridEntity.PagePreCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[1].InnerText.Trim());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception error)
|
|
|
|
|
{
|
|
|
|
|
throw (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gridEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum SqlName2
|
|
|
|
|
{
|
|
|
|
|
NAME = 0,
|
|
|
|
|
LOGTYPE = 1,
|
|
|
|
|
LOGTIME = 2,
|
|
|
|
|
LOGCONTENT = 3,
|
|
|
|
|
USERNAME = 4
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|