%@ Page Language="C#" %>
<%@ Import Namespace ="eMIS" %>
<%@ Import Namespace ="System.Data.Common" %>
<%
string proid = Request.QueryString["proid"].ToString();
string recid = Request.QueryString["recid"].ToString(); //记录ID
string defid = Request.QueryString["defid"].ToString(); //COM_ASPSJGL_DY.ID
string defaultFunction = (Request.QueryString["f"] == null ? "" : Request.QueryString["f"].ToString());
InstanceManager instance = new InstanceManager(Context,proid);
string[] printDefinitionArray = new string[2];
printDefinitionArray[0] = instance.RecPrint;
printDefinitionArray[1] = instance.LisPrint;
int printType;
string s;
if (recid == "")
printType = 1;
else
printType = 0;
s = instance.Program.Properties["GLBJDYCXID"].ToString();
if ( s!= "")
proid = s;
bool b = true;
string definitionId;
int i;
string str_script = "";
string str_template = "";
DbDataReader reader = null;
for (i = 0;i<2;i++)
{
if (defid == "")
definitionId = getDefinitionId(printDefinitionArray[printType]);
else
definitionId = defid;
if (definitionId != "")
{
reader = instance.SystemDbOperator.ExecuteReader("select JB,NR from COM_ASPSJGL_DY where ID=" + definitionId);
if(reader.Read())
{
str_script = reader[0].ToString();
str_template = reader[1].ToString();
break;
}
else
{
printType = Math.Abs(printType -1);
}
reader.Close();
}
}
if (printType == 0 && recid == "")
{
Response.Write("只定义了但记录打印,请选择一条记录!");
Response.End();
}
string prnfor = printDefinitionArray[printType]; //'多记录打印格式
int j = 0;
string str_old;
string str_new;
string glid;
string xml;
string condition;
while(true)
{
i = str_script.IndexOf("",j);
if(i==-1)
break;
j = str_script.IndexOf("",i);
str_old = str_script.Substring(i + 9, j - 9 - i);
if (str_old.Substring(str_old.Length-1) == "0")
str_new = "print_MasterDataXML.asp?proname=" + str_old.Substring(0,str_old.Length-1) + "&recid=" + recid;
else
{
glid = str_old.Substring(0,str_old.Length-1);
if (recid != "")
{
//if obj is nothing then
// set obj = server.CreateObject("emMain" & ver & ".PageControls")
// set obj.aco = aco
// obj.Init recid,0,1
//end if
reader = instance.SystemDbOperator.ExecuteReader("select GLTJ,XML from COM_ASPSJGL_GLCX where cxid=" + proid + " and glcxid=" + glid);
if(reader.Read())
{
xml = reader[1].ToString();
s = reader[0].ToString().Replace("SignColumn","ID");
s = s.Replace("&readonly=true","");
condition = instance.Tag.ReplaceExpression(s,"colval");
if (condition != "")
condition = StringHelper.GetXmlValue(xml,"外键") + "='" + reader[StringHelper.GetXmlValue(xml,"主键")].ToString() + "'" + " and " + condition;
else
condition = StringHelper.GetXmlValue(xml,"外键") + "='" + reader[StringHelper.GetXmlValue(xml,"主键")].ToString() + "'";
glid += "&con=" + Server.UrlEncode(condition);
}
reader.Close();
}
str_new = "print_DetailDataXML.asp?proname=" + glid;
}
str_script = str_script.Replace(str_old, str_new);
}
string wwwroot = Request.ApplicationPath;
str_template = str_template.Replace("0","1");
string ChinaExcel_Version = "CODEBASE='" + wwwroot + "/App_Web/downloads/chinaexcelweb.cab#version=3,7,4'";
%>
<%=instance.Program.Properties["bt"].ToString()%> - 打印
<%
Response.Write("");
%>
|
<%=str_script%>
<%=str_template%>