<asp:Button ID="btnVerify" runat="server" CssClass="btn2" OnClientClick="return verifyDetail();" Text="确认选择"
OnClick="btnVerify_Click" />
OnClick="btnVerify_Click" />
<script>
function verifyDetail()//invoked by "确认选择"
{
if(varNumber==0)
{
alert("请选择核销条目!");
return false;
}
var varCurClass=document.form1.ddlVerifyCurClass[document.form1.ddlVerifyCurClass.selectedIndex].value;//币种
var varHidAmount=document.getElementById("hidAmount").value;//隐藏域中的金额
// var varSZDW=document.getElementById("hidSZDW").value;//涉帐单位,准备不传这个参数了!①.已改用根据发票id 把
inv_main.company_id和pd_company.id两个字段关联,从pd_company中取COMP_C_CNAME字段
// &szdw="+escape(varSZDW)+"//②.传参数时用escape()函数,接受页面(invoice_verify_confirm.aspx)用string wd =
Server.UrlDecode(Request.QueryString["szdw"]);则wd为正常汉字
var varID=document.getElementById("hidInvoiceId").value;//隐藏域中的已选中项的ID
var varCompID=document.getElementById("hidSZDWID").value;//隐藏域中的已选中项的对应公司的ID
// var s = new Object();
// s.name ="aaa";
var win=window.showModalDialog("invoice_verify_confirm.aspx?
CurClass="+varCurClass+"&HidAmount="+varHidAmount+"&id="+varID+"&compID="+varCompID+"","","status:Modeless;edge:raised;unador
ned:no;scroll=yes;resizable:yes;center=yes;help:no;dialog890px;dialogheight:425px");
if(win=="ref")
{
// self.location.reload();//如何触发 OnClick="btnSearch_Click"
//alert("aa");
// document.all("btnSearch").click();
// document.getElementById("btnSearch").onclick=function()
// {
// alert('a');
// }
//form1.submit();
return true;
}
else
{
return false;
//有这句就不会刷新父窗口,因为不会再执行服务器代码,showModalDialog窗口以右上角“关闭”,以“取消”按钮关闭,都不刷新
}
// if(win.type=="")//传递回的type为空的时候才刷新页面。
// {
// alert("刷新");
// location.reload();
// }
// return ;
// alert("aa");
}
</script>
function verifyDetail()//invoked by "确认选择"
{
if(varNumber==0)
{
alert("请选择核销条目!");
return false;
}
var varCurClass=document.form1.ddlVerifyCurClass[document.form1.ddlVerifyCurClass.selectedIndex].value;//币种
var varHidAmount=document.getElementById("hidAmount").value;//隐藏域中的金额
// var varSZDW=document.getElementById("hidSZDW").value;//涉帐单位,准备不传这个参数了!①.已改用根据发票id 把
inv_main.company_id和pd_company.id两个字段关联,从pd_company中取COMP_C_CNAME字段
// &szdw="+escape(varSZDW)+"//②.传参数时用escape()函数,接受页面(invoice_verify_confirm.aspx)用string wd =
Server.UrlDecode(Request.QueryString["szdw"]);则wd为正常汉字
var varID=document.getElementById("hidInvoiceId").value;//隐藏域中的已选中项的ID
var varCompID=document.getElementById("hidSZDWID").value;//隐藏域中的已选中项的对应公司的ID
// var s = new Object();
// s.name ="aaa";
var win=window.showModalDialog("invoice_verify_confirm.aspx?
CurClass="+varCurClass+"&HidAmount="+varHidAmount+"&id="+varID+"&compID="+varCompID+"","","status:Modeless;edge:raised;unador
ned:no;scroll=yes;resizable:yes;center=yes;help:no;dialog890px;dialogheight:425px");
if(win=="ref")
{
// self.location.reload();//如何触发 OnClick="btnSearch_Click"
//alert("aa");
// document.all("btnSearch").click();
// document.getElementById("btnSearch").onclick=function()
// {
// alert('a');
// }
//form1.submit();
return true;
}
else
{
return false;
//有这句就不会刷新父窗口,因为不会再执行服务器代码,showModalDialog窗口以右上角“关闭”,以“取消”按钮关闭,都不刷新
}
// if(win.type=="")//传递回的type为空的时候才刷新页面。
// {
// alert("刷新");
// location.reload();
// }
// return ;
// alert("aa");
}
</script>
protected void btnVerify_Click(object sender, EventArgs e)
{//该函数“顺便”回去服务器把页面上的其他控件“重新”取了回来,实现了“整个”页面的“刷新”
BindData();
}
{//该函数“顺便”回去服务器把页面上的其他控件“重新”取了回来,实现了“整个”页面的“刷新”
BindData();
}
private void BindData()//从inv_main表中选出已开票记录
{
Grid1.Levels[0].Columns.Clear();//在 Grid1.DataBind();执行结束,所有列已Bind over 不能再执行本句,否则会清除所有已经bind 的列
string strSql = @"
SELECT
dbo.INV_MAIN.ID,
cast(0 as bit) as choice,
dbo.INV_MAIN.INV_NO,
dbo.PD_COMPANY.COMP_C_CNAME,
dbo.INV_MAIN.CURRENCY,
dbo.INV_MAIN.AMOUNT,
cast(dbo.INV_MAIN.AMOUNT_HX as decimal(18,2)) as AMOUNT_HX ,
dbo.INV_MAIN.AMOUNT_WHX,
'海运出口' as ywlx,
dbo.JOB_SE.JOBNO,
dbo.PD_USER.USER_NAME,
convert(varchar(10),DATE_JOB,120) as DATE_JOB,
dbo.JOB_SE.WTBH,
dbo.PD_COMPANY.ID as compID
FROM dbo.FEE_IN LEFT OUTER JOIN
dbo.PD_USER RIGHT OUTER JOIN
dbo.JOB_SE ON dbo.PD_USER.USER_CODE = dbo.JOB_SE.CR_CODE ON dbo.FEE_IN.PARENTID = dbo.JOB_SE.ID RIGHT OUTER JOIN
dbo.PD_COMPANY RIGHT OUTER JOIN
dbo.INV_MAIN ON dbo.PD_COMPANY.ID = dbo.INV_MAIN.COMPANY_ID ON dbo.FEE_IN.INVOICE_ID = dbo.INV_MAIN.ID where (1=1)";
//dbo.JOB_SE.ETD,需不需要这个字段?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
if (ViewState["strSqlBindData"] == null)
{
ViewState["strSqlBindData"] = strSql;
}
SqlDataAdapter sda = new SqlDataAdapter(strSql, conn);
conn.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "INV_MAIN");
Grid1.DataSource = ds;
Grid1.DataBind();
Grid1.Levels[0].Columns["ID"].Visible = false;
Grid1.Levels[0].Columns["choice"].HeadingText = "选择";
Grid1.Levels[0].Columns["choice"].ColumnType = GridColumnType.CheckBox;
Grid1.Levels[0].Columns["choice"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["choice"].Width = 26;
Grid1.Levels[0].Columns["INV_NO"].HeadingText = "帐单号";
Grid1.Levels[0].Columns["INV_NO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["INV_NO"].Width = 45;
Grid1.Levels[0].Columns["COMP_C_CNAME"].HeadingText = "涉帐单位";
Grid1.Levels[0].Columns["COMP_C_CNAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["COMP_C_CNAME"].Width = 56;
Grid1.Levels[0].Columns["CURRENCY"].HeadingText = "币种";
Grid1.Levels[0].Columns["CURRENCY"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["CURRENCY"].Width = 26;
Grid1.Levels[0].Columns["AMOUNT"].HeadingText = "帐单金额";
Grid1.Levels[0].Columns["AMOUNT"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT"].Width =56;
Grid1.Levels[0].Columns["AMOUNT"].FormatString = "N2";
Grid1.Levels[0].Columns["AMOUNT_HX"].HeadingText = "已核销";
Grid1.Levels[0].Columns["AMOUNT_HX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_HX"].Width = 45;//
Grid1.Levels[0].Columns["AMOUNT_HX"].FormatString = "N2";
Grid1.Levels[0].Columns["AMOUNT_WHX"].HeadingText = "未核销";
Grid1.Levels[0].Columns["AMOUNT_WHX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_WHX"].Width = 45;
Grid1.Levels[0].Columns["AMOUNT_WHX"].FormatString = "N2";//两位小数,每三位有逗号
Grid1.Levels[0].Columns["ywlx"].HeadingText = "业务类型";
Grid1.Levels[0].Columns["ywlx"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["ywlx"].Width = 56;
Grid1.Levels[0].Columns["JOBNO"].HeadingText = "工作编号";
Grid1.Levels[0].Columns["JOBNO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["JOBNO"].Width = 56;
Grid1.Levels[0].Columns["USER_NAME"].HeadingText = "操作人";
Grid1.Levels[0].Columns["USER_NAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["USER_NAME"].Width = 36;
Grid1.Levels[0].Columns["DATE_JOB"].HeadingText = "抵离港日";//?dateJOb 还是ETD?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
Grid1.Levels[0].Columns["DATE_JOB"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["DATE_JOB"].Width = 56;
Grid1.Levels[0].Columns["WTBH"].HeadingText = "委托编号";
Grid1.Levels[0].Columns["WTBH"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["WTBH"].Width = 56;
Grid1.Levels[0].Columns["compID"].HeadingText = "涉帐ID";
Grid1.Levels[0].Columns["compID"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["compID"].Visible = false;
Grid1.Levels[0].Columns["compID"].Width = 56;
}
{
Grid1.Levels[0].Columns.Clear();//在 Grid1.DataBind();执行结束,所有列已Bind over 不能再执行本句,否则会清除所有已经bind 的列
string strSql = @"
SELECT
dbo.INV_MAIN.ID,
cast(0 as bit) as choice,
dbo.INV_MAIN.INV_NO,
dbo.PD_COMPANY.COMP_C_CNAME,
dbo.INV_MAIN.CURRENCY,
dbo.INV_MAIN.AMOUNT,
cast(dbo.INV_MAIN.AMOUNT_HX as decimal(18,2)) as AMOUNT_HX ,
dbo.INV_MAIN.AMOUNT_WHX,
'海运出口' as ywlx,
dbo.JOB_SE.JOBNO,
dbo.PD_USER.USER_NAME,
convert(varchar(10),DATE_JOB,120) as DATE_JOB,
dbo.JOB_SE.WTBH,
dbo.PD_COMPANY.ID as compID
FROM dbo.FEE_IN LEFT OUTER JOIN
dbo.PD_USER RIGHT OUTER JOIN
dbo.JOB_SE ON dbo.PD_USER.USER_CODE = dbo.JOB_SE.CR_CODE ON dbo.FEE_IN.PARENTID = dbo.JOB_SE.ID RIGHT OUTER JOIN
dbo.PD_COMPANY RIGHT OUTER JOIN
dbo.INV_MAIN ON dbo.PD_COMPANY.ID = dbo.INV_MAIN.COMPANY_ID ON dbo.FEE_IN.INVOICE_ID = dbo.INV_MAIN.ID where (1=1)";
//dbo.JOB_SE.ETD,需不需要这个字段?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
if (ViewState["strSqlBindData"] == null)
{
ViewState["strSqlBindData"] = strSql;
}
SqlDataAdapter sda = new SqlDataAdapter(strSql, conn);
conn.Open();
DataSet ds = new DataSet();
sda.Fill(ds, "INV_MAIN");
Grid1.DataSource = ds;
Grid1.DataBind();
Grid1.Levels[0].Columns["ID"].Visible = false;
Grid1.Levels[0].Columns["choice"].HeadingText = "选择";
Grid1.Levels[0].Columns["choice"].ColumnType = GridColumnType.CheckBox;
Grid1.Levels[0].Columns["choice"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["choice"].Width = 26;
Grid1.Levels[0].Columns["INV_NO"].HeadingText = "帐单号";
Grid1.Levels[0].Columns["INV_NO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["INV_NO"].Width = 45;
Grid1.Levels[0].Columns["COMP_C_CNAME"].HeadingText = "涉帐单位";
Grid1.Levels[0].Columns["COMP_C_CNAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["COMP_C_CNAME"].Width = 56;
Grid1.Levels[0].Columns["CURRENCY"].HeadingText = "币种";
Grid1.Levels[0].Columns["CURRENCY"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["CURRENCY"].Width = 26;
Grid1.Levels[0].Columns["AMOUNT"].HeadingText = "帐单金额";
Grid1.Levels[0].Columns["AMOUNT"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT"].Width =56;
Grid1.Levels[0].Columns["AMOUNT"].FormatString = "N2";
Grid1.Levels[0].Columns["AMOUNT_HX"].HeadingText = "已核销";
Grid1.Levels[0].Columns["AMOUNT_HX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_HX"].Width = 45;//
Grid1.Levels[0].Columns["AMOUNT_HX"].FormatString = "N2";
Grid1.Levels[0].Columns["AMOUNT_WHX"].HeadingText = "未核销";
Grid1.Levels[0].Columns["AMOUNT_WHX"].Align = ComponentArt.Web.UI.TextAlign.Right;
Grid1.Levels[0].Columns["AMOUNT_WHX"].Width = 45;
Grid1.Levels[0].Columns["AMOUNT_WHX"].FormatString = "N2";//两位小数,每三位有逗号
Grid1.Levels[0].Columns["ywlx"].HeadingText = "业务类型";
Grid1.Levels[0].Columns["ywlx"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["ywlx"].Width = 56;
Grid1.Levels[0].Columns["JOBNO"].HeadingText = "工作编号";
Grid1.Levels[0].Columns["JOBNO"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["JOBNO"].Width = 56;
Grid1.Levels[0].Columns["USER_NAME"].HeadingText = "操作人";
Grid1.Levels[0].Columns["USER_NAME"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["USER_NAME"].Width = 36;
Grid1.Levels[0].Columns["DATE_JOB"].HeadingText = "抵离港日";//?dateJOb 还是ETD?dbo.INV_MAIN.DATE_JOB(业务日期)对应job_se中ETD
Grid1.Levels[0].Columns["DATE_JOB"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["DATE_JOB"].Width = 56;
Grid1.Levels[0].Columns["WTBH"].HeadingText = "委托编号";
Grid1.Levels[0].Columns["WTBH"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["WTBH"].Width = 56;
Grid1.Levels[0].Columns["compID"].HeadingText = "涉帐ID";
Grid1.Levels[0].Columns["compID"].Align = ComponentArt.Web.UI.TextAlign.Center;
Grid1.Levels[0].Columns["compID"].Visible = false;
Grid1.Levels[0].Columns["compID"].Width = 56;
}