function transValue()
{
document.getElementById("hidInvTitle").value=document.getElementById("txtTitle").value;//开票抬头隐藏域,赋值
//document.getElementById("hidInvDate").value=document.getElementById("PickDate_Qg").value;//开票日期隐藏域,赋值,在CS代码的“确定”事件的结尾
document.getElementById("hidBankName").value=document.form1.ddlBankName[document.form1.ddlBankName.selectedIndex].text;//开户行隐藏域,赋值
document.getElementById("hidAccountNo").value=document.form1.ddlBankName[document.form1.ddlBankName.selectedIndex].value;//开户账号隐藏域,右边用document.form1.txtAccountNo.text更好些
document.getElementById("hidFeeItem").value=document.form1.txtFeeItem.value;//收费内容
// alert(document.getElementById("hidFeeItem").value);
document.getElementById("hidAmount").value=document.form1.txtAmount.value;//收费内容金额
document.getElementById("hidRemark").value=document.form1.txtRemark.value;//备注
//alert(document.getElementById("hidRemark").value);
document.getElementById("hidCurrency").value=document.form1.txtCurrency.value;//货币种类
document.getElementById("hidUpper").value=document.form1.txtAmountUpper.value;//大写金额
document.getElementById("hidLower").value=document.form1.txtAmountTotal.value;//小写金额
document.getElementById("hidDrawer").value=document.form1.txtDrawer.value;//开票人
}


</script>
<asp:Button ID="btnConfirm" runat="server" CssClass="btn" Text="确定" OnClientClick="transValue()" OnClick="btnConfirm_Click" />
protected void btnConfirm_Click(object sender, EventArgs e)
{
string szdw_id = "";
System.Guid guidSZDW = new Guid();//如果ViewState中一直没有涉帐单位的ID,inv_main表中就可能插入新的不相关的ID,依据这个不相关ID在PD_COMPANY中找不到相关的COMPANY
if (ViewState["SZDW_ID"] != null)
{
szdw_id = ViewState["SZDW_ID"].ToString();
guidSZDW = new Guid(szdw_id);
}//隐含如果ViewState["SZDW_ID"] == null 则放System.Guid guidSZDE = new Guid();生成的GUID进INV_MAIN该GUID组成部分全为0-〉32个0
从ViewState中取值 从ViewState中取值 END
string strSqlInsert = @"
insert into inv_main
(ID ,INV_NO,INV_TITLE,COMPANY_ID,INV_DATE,INV_REN,CURRENCY,AMOUNT,DETAIL_FEE,DETAIL_AMOUNT,DETAIL_REMARK,BANK_NAME,ACCOUNT_NO,JOBNO,LPORT,DPORT,DEST,WTBH,DATE_JOB,AMOUNT_CHN,AMOUNT_HX,AMOUNT_WHX,CR_CODE,CR_TIME,OP_CODE,OP_TIME)
values
(@ID,@INV_NO,@INV_TITLE,@COMPANY_ID,@INV_DATE,@INV_REN,@CURRENCY,@AMOUNT,@DETAIL_FEE,@DETAIL_AMOUNT,@DETAIL_REMARK,@BANK_NAME,@ACCOUNT_NO,@JOBNO,@LPORT,@DPORT,@DEST,@WTBH,@DATE_JOB,@AMOUNT_CHN,@AMOUNT_HX,@AMOUNT_WHX,@CR_CODE,@CR_TIME,@OP_CODE,@OP_TIME)";
try
{
insert inot inv_main new record
comm.ExecuteNonQuery();
comm.Dispose();

/*从Page_Load中传strID过来,再次split成数组,ViweState好像不能存数组,更新fee_in或fee_out中的“已开票标志” flag_kp和 “发票号码” Invoice_No */


string invDateTemp = PickDate_Qg.SelectedDate.ToString("d");//不能通过隐藏域传递,现在通过QueryString传递
//if (!this.IsClientScriptBlockRegistered("clientScript"))
//{
// String scriptString = @"<script language=JavaScript>window.showModalDialog('invoice_print.aspx?ID=" + strid.ToString() + "',window,'status:Modeless;edge:raised;unadorned:no;scroll=yes;resizable:yes;center=yes;help:no;dialog800px;dialogheight:600px');</script>";
// this.RegisterClientScriptBlock("clientScript", scriptString);//注册客户端脚本块
//}


//Server.Transfer("invoice_print.aspx?ID=" + strID.ToString() + "");
Server.Transfer("invoice_print.aspx?invDate=" + invDateTemp + "");
//Response.Redirect("invoice_print.aspx?ID=" + strID.ToString() + "");
//Response.Write("<script>"+"window.showModalDialog('invoice_print.aspx',window,'status:Modeless;edge:raised;unadorned:no;scroll=yes;resizable:yes;center=yes;help:no;dialog890px;dialogheight:620px');"+"</script>");

}
finally
{
//Response.Write("<script>window.alert('Success invoiced!');</script>");
conn.Close();
//Response.Write("<script>window.close()</script>");
}


}
