Jquery 在数据库Asp.net中插入值时显示进度条

Jquery 在数据库Asp.net中插入值时显示进度条,jquery,asp.net,ajax,Jquery,Asp.net,Ajax,我想在单击“插入/更新”按钮时显示进度条,因为按钮具有一些验证/更新/插入功能,因此我无法计算特定按钮单击过程的时间。这是我的密码 try { dt = myDbGL.SelectQuery("Select ComCreationDate from GASCompanyDetail where ComCode = '" + DropDownCompany.SelectedItem.Value + "' And ComCreationDate is

我想在单击“插入/更新”按钮时显示进度条,因为按钮具有一些验证/更新/插入功能,因此我无法计算特定按钮单击过程的时间。这是我的密码

try
    {            
        dt = myDbGL.SelectQuery("Select ComCreationDate from GASCompanyDetail where ComCode = '" + DropDownCompany.SelectedItem.Value + "' And ComCreationDate is not NULL");
        if (dt.Rows.Count != 0)
        {
            DateTime ComDate = DateTime.Parse(dt.Rows[0]["ComCreationDate"].ToString());
            DateTime TRDate = DateTime.Parse(TB_TRDate.Text);
            DateTime GLDate = DateTime.Parse(TB_GLDate.Text);
            int result = DateTime.Compare(TRDate, ComDate);
            if (result < 0)
            {
                DisplayMessage = "Transaction Date is not less then to Company Creation Date!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true); return;
            }
            result = DateTime.Compare(GLDate, ComDate);
            if (result < 0)
            {
                DisplayMessage = "GL Date is not less then to Company Creation Date!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true); return;
            }
        }

        GridTotal();

        dt = myDbGL.SelectQuery("Select * from GLSBankAccountDetailView where AccCode = '" + DropDownType.SelectedItem.Value + "'");
        if (dt.Rows.Count != 0)
        {
            ChequeBankName = ""; // dt.Rows[0]["BankName"].ToString();
            ChequeBranchName = ""; // dt.Rows[0]["BranchName"].ToString();
            ChequeAccountNo = dt.Rows[0]["BacAccountNumber"].ToString();
        }

        TRTotalAmount = 0;
        TRTotalAmount = myDbGL.ConvertStringToNumber(TB_TRTotalAmount.Text);
        if (TRTotalAmount < 0)
        {
            DisplayMessage = "Cannot Save Negative Transaction!";
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
            return;
        }
        ExchangeRate = myDbGL.ConvertStringToNumber(TB_TRExchangeRate.Text);
        if (ExchangeRate == 0)
        {
            DisplayMessage = "Please enter valid Exchange Rate!";
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
            return;
        }

        dt = myDbGL.SelectQuery("Select EntryFrom from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And EntryFrom = 'Payment Detail'");
        if (dt.Rows.Count == 0)
        {
            DisplayMessage = "This Transaction is not related to this Entry Form";
            ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
            return;
        }

        dt = myDbGL.SelectQuery("Select EnterBy, EnterDate from GLTPaymentMaster where TRNo = '" + TB_TRCode_Hidden.Text + "'");
        if (dt.Rows.Count != 0)
        {
            EnterBy = dt.Rows[0]["EnterBy"].ToString();
            EnterDate = dt.Rows[0]["EnterDate"].ToString();
        }

        if (TB_TRCode.Text.Left(2) == "BP") { VoucherType = "BANK"; } else { VoucherType = "CASH"; }
        if (CB_Reverse.Checked) { ReverseDateCheck = TB_ReverseDate.Text; } else { ReverseDateCheck = null; }

        if (!CB_Reverse.Checked)
        {
            dt = myDbGL.SelectQuery("Select TRPostStatus, TRPostStatusReverse from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And (TRPostStatusReverse = 'UN-POST')");
            if (dt.Rows.Count != 0)
            {
                myDbGL.deleteTable("Delete from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And TRReverseStatus = 1");
                myDbGL.UpdatePaymentMaster(TB_TRCode_Hidden.Text, CB_Reverse.Checked.ToString(), ReverseDateCheck, EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime());
            }
            dt = myDbGL.SelectQuery("Select TRPostStatus, TRPostStatusReverse from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And (TRPostStatus = 'POST')");
            if (dt.Rows.Count != 0)
            {
                DisplayMessage = "Cannot Change Posted Transaction!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }
            dt = myDbGL.SelectQuery("Select TRPostStatus, TRPostStatusReverse from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And (TRPostStatusReverse = 'POST')");
            if (dt.Rows.Count != 0)
            {
                DisplayMessage = "Cannot Change Posted Transaction!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }                
        }

        TRApprovedLevel = 0; TRCurrentLevel = 0; TRUserLevel = 0;
        dt = myDbGL.SelectQuery("Select PagWebAddress from UMSPageDetail where PagWebAddress like '%" + Path.GetFileName(Request.PhysicalPath) + "%' And PagApprove = 'True'");
        if (dt.Rows.Count != 0)
        {
            dt1 = myDbGL.SelectQuery("Select * from GLTPostingDetail where PosPageName not like '%Reverse%' And PosPageWebAddress like '" + Path.GetFileName(Request.PhysicalPath) + "'");
            if (dt1.Rows.Count != 0)
            {
                dt2 = myDbGL.SelectQuery("Select TOP (1) ApvSerialNo from GASApprovalPolicyDetailView where ApvTType = '" + dt1.Rows[0]["PosPageName"].ToString() + "' And SitCode like '" + LoginUserIDSitCode.ToString() + "' Order by ApvSerialNo Desc");
                if (dt2.Rows.Count != 0) { TRApprovedLevel = myDbGL.ConvertStringToNumber(dt2.Rows[0]["ApvSerialNo"].ToString()); }

                dt2 = myDbGL.SelectQuery("Select TOP (1) ApvSerialNo from GASApprovalPolicyDetailView where ApvTType = '" + dt1.Rows[0]["PosPageName"].ToString() + "' And SitCode like '" + LoginUserIDSitCode.ToString() + "' AND UseID = '" + LoginUserID.ToString() + "' Order by ApvSerialNo Desc");
                if (dt2.Rows.Count != 0) { TRUserLevel = myDbGL.ConvertStringToNumber(dt2.Rows[0]["ApvSerialNo"].ToString()); }

                dt2 = myDbGL.SelectQuery("Select ApprovedLevel from [" + dt1.Rows[0]["PosTableMaster"].ToString() + "] where [" + dt1.Rows[0]["PosColumnWhereMaster"].ToString() + "] = '" + TB_TRCode.Text + "'");
                if (dt2.Rows.Count != 0) { TRCurrentLevel = myDbGL.ConvertStringToNumber(dt2.Rows[0]["ApprovedLevel"].ToString()); }

                if (TRApprovedLevel != 0 && TRCurrentLevel > TRUserLevel)
                {
                    DisplayMessage = "Cannot Change as This Transaction approved by Higher Authority!";
                    ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true); return;
                }
            }
        }

        if (CB_Reverse.Checked)
        {
            dt = myDbGL.SelectQuery("Select TRPostStatus, TRPostStatusReverse from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And (TRPostStatus <> 'POST')");
            if (dt.Rows.Count != 0)
            {
                DisplayMessage = "Cannot Reverse Un-Posted Transaction!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }
            dt = myDbGL.SelectQuery("Select TRPostStatus, TRPostStatusReverse from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And (TRPostStatusReverse = 'POST')");
            if (dt.Rows.Count != 0)
            {
                DisplayMessage = "Cannot Reverse Posted Transaction!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }

            if (TB_ReverseDate.Text.ToString().Equals(""))
            {
                DisplayMessage = "Please Enter Any Reverse Date!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }
            DateTime GLDate = DateTime.Parse(TB_GLDate.Text);
            DateTime ReverseDate = DateTime.Parse(TB_ReverseDate.Text);
            int result = DateTime.Compare(ReverseDate, GLDate);

            if (result < 0)
            {
                DisplayMessage = "Reverse Date is not less then/equals to GL Date. Please enter correct Reverse Date!";
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + DisplayMessage + "');", true);
                return;
            }

            //myDbGL.deleteTable("Delete from GLTPaymentMaster where TRNo = '" + TB_TRCode_Hidden.Text + "'");
            myDbGL.deleteTable("Delete from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And TRReverseStatus = 1");

            dt = myDbGL.SelectQuery("Select * from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "' And TRReverseStatus = 0");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt1 = myDbGL.SelectQuery("Select TRSerialNo from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "'");
                myDbGL.InsertLedgerDetail(dt.Rows[i]["TRNo"].ToString(), dt.Rows[i]["TRDate"].ToString(), ReverseDateCheck, dt.Rows[i]["TRType"].ToString(), "POST", "UN-POST", CB_Reverse.Checked.ToString(), ReverseDateCheck, (myDbGL.ConvertStringToNumber(dt1.Rows.Count.ToString()) + 1).ToString(), dt.Rows[i]["TRAccCode"].ToString(), dt.Rows[i]["TRRefAccCode"].ToString(), dt.Rows[i]["TRDocReference"].ToString(), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRDocRefTotalAmount"].ToString()), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRDocRefBalanceAmount"].ToString()), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRCredit"].ToString()), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRDebit"].ToString()), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRExchangeRate"].ToString()), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRAmountConverted"].ToString()), dt.Rows[i]["TRCurCode"].ToString(), dt.Rows[i]["TRTxsCode"].ToString(), myDbGL.ConvertStringToNumber(dt.Rows[i]["TRTaxPercent"].ToString()), dt.Rows[i]["TRChequeNo"].ToString(), dt.Rows[i]["TRChequeDate"].ToString(), dt.Rows[i]["TRChequeMaturityDate"].ToString(), dt.Rows[i]["TRChequeDepositDate"].ToString(), dt.Rows[i]["TRDepositNo"].ToString(), dt.Rows[i]["TRChequeBankName"].ToString(), dt.Rows[i]["TRChequeBranchName"].ToString(), dt.Rows[i]["TRChequeAccountNo"].ToString(), dt.Rows[i]["TRRefNo"].ToString(), dt.Rows[i]["TRGrpCode"].ToString(), dt.Rows[i]["TRComCode"].ToString(), dt.Rows[i]["TRBsuCode"].ToString(), dt.Rows[i]["TRCosCode"].ToString(), dt.Rows[i]["TRDepCode"].ToString(), dt.Rows[i]["TRSecCode"].ToString(), dt.Rows[i]["TRProCode"].ToString(), dt.Rows[i]["TRFucCode"].ToString(), dt.Rows[i]["TRCusAccCode"].ToString(), dt.Rows[i]["TRSupAccCode"].ToString(), dt.Rows[i]["TRConAccCode"].ToString(), dt.Rows[i]["TRAgtAccCode"].ToString(), dt.Rows[i]["TRIvtAccCode"].ToString(), dt.Rows[i]["TRInvCode"].ToString(), dt.Rows[i]["TRRemarks"].ToString(), dt.Rows[i]["TREntryType"].ToString(), EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime(), "Payment Detail", dt.Rows[i]["EntryTypeDoc"].ToString());
            }

            myDbGL.UpdatePaymentMaster(TB_TRCode_Hidden.Text, CB_Reverse.Checked.ToString(), ReverseDateCheck, EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime());
            myDbGL.InsertUserLog("General Ledger", "Transaction", "Payment Detail", "Update", TB_TRCode.Text, LoginUserID.ToString(), myDbGL.GetUserPCName(), myDbGL.GetUserPCIP(), myDbGL.GetUserPCMAC(), myDbGL.GetServerDateTime(), myDbGL.GetServerDateTime());
            Response.Redirect(Request.Url.AbsoluteUri);
            return;
        }

        myDbGL.deleteTable("Delete from GLTPaymentMaster where TRNo = '" + TB_TRCode_Hidden.Text + "'");
        myDbGL.deleteTable("Delete from GLTLedger where TRNo = '" + TB_TRCode_Hidden.Text + "'");
        TRTotalAmount = 0;
        TRCount = 1;
        foreach (GridViewRow gvRow in gvTransaction.Rows)
        {
            TRDebit = 0;
            TRCredit = 0;
            if (((DropDownList)gvRow.FindControl("DropDownGridAccount")).SelectedItem.Value != "-1")
            {
                if (((DropDownList)gvRow.FindControl("DropDownGridDebitCredit")).SelectedItem.Text == "DEBIT")
                {
                    TRDebit = myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmountConverted")).Text);
                    TRCredit = 0;
                }
                else
                {
                    TRDebit = 0;
                    TRCredit = myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmountConverted")).Text);
                }
                //if (myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmount")).Text) != 0 && ((DropDownList)gvRow.FindControl("DropDownGridAccount")).SelectedValue.ToString() != "-1")
                if (myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmountConverted")).Text) != 0)
                {
                    myDbGL.InsertLedgerDetail(TB_TRCode.Text, TB_TRDate.Text, TB_GLDate.Text, VoucherType, "UN-POST", "UN-POST", CB_Reverse.Checked.ToString(), ReverseDateCheck, TRCount.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridAccount")).SelectedValue.ToString(), DropDownType.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridDocRef")).SelectedValue.ToString(), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTotalDocAmount")).Text), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTotalDocBalAmount")).Text), TRDebit, TRCredit, myDbGL.ConvertStringToNumber(TB_TRExchangeRate.Text), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmountConverted")).Text), DropDownCurrency.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridTaxSlab")).SelectedValue.ToString(), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTaxPercent")).Text), ((TextBox)gvRow.FindControl("TB_TRChequeNo")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeDate")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeMaturityDate")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeDepositDate")).Text, "", ChequeBankName, ChequeBranchName, ChequeAccountNo, TB_TRRefNo.Text, DropDownGroup.SelectedItem.Value, DropDownCompany.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridBU")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridCostCenter")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridDepartment")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridSection")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridProject")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridFunction")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridCustomer")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridSupplier")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridContractor")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridAgent")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridInvestor")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridItem")).SelectedValue.ToString(), ((TextBox)gvRow.FindControl("TB_TRRemarks")).Text, "CHILD", EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime(), "Payment Detail", "CHILD");
                    TRCount = TRCount + 1;
                    myDbGL.InsertLedgerDetail(TB_TRCode.Text, TB_TRDate.Text, TB_GLDate.Text, VoucherType, "UN-POST", "UN-POST", CB_Reverse.Checked.ToString(), ReverseDateCheck, TRCount.ToString(), DropDownType.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridAccount")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridDocRef")).SelectedValue.ToString(), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTotalDocAmount")).Text), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTotalDocBalAmount")).Text), TRCredit, TRDebit, myDbGL.ConvertStringToNumber(TB_TRExchangeRate.Text), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRAmountConverted")).Text), DropDownCurrency.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridTaxSlab")).SelectedValue.ToString(), myDbGL.ConvertStringToNumber(((TextBox)gvRow.FindControl("TB_TRTaxPercent")).Text), ((TextBox)gvRow.FindControl("TB_TRChequeNo")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeDate")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeMaturityDate")).Text, ((TextBox)gvRow.FindControl("TB_TRChequeDepositDate")).Text, "", ChequeBankName, ChequeBranchName, ChequeAccountNo, TB_TRRefNo.Text, DropDownGroup.SelectedItem.Value, DropDownCompany.SelectedItem.Value, ((DropDownList)gvRow.FindControl("DropDownGridBU")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridCostCenter")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridDepartment")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridSection")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridProject")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridFunction")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridCustomer")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridSupplier")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridContractor")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridAgent")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridInvestor")).SelectedValue.ToString(), ((DropDownList)gvRow.FindControl("DropDownGridItem")).SelectedValue.ToString(), ((TextBox)gvRow.FindControl("TB_TRRemarks")).Text, "CHILD", EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime(), "Payment Detail", "PARENT");
                    TRCount = TRCount + 1;
                }
            }
            TRTotalAmount = TRTotalAmount + (TRDebit - TRCredit);
        }
        if (TRTotalAmount != 0) { myDbGL.InsertLedgerDetail(TB_TRCode.Text, TB_TRDate.Text, TB_GLDate.Text, VoucherType, "UN-POST", "UN-POST", CB_Reverse.Checked.ToString(), ReverseDateCheck, "0", DropDownType.SelectedItem.Value, DropDownType.SelectedItem.Value, "-1", 0, 0, 0, TRTotalAmount, myDbGL.ConvertStringToNumber(TB_TRExchangeRate.Text), TRTotalAmount, DropDownCurrency.SelectedItem.Value, "-1", 0, "", "", "", "", "", ChequeBankName, ChequeBranchName, ChequeAccountNo, TB_TRRefNo.Text, DropDownGroup.SelectedItem.Value, DropDownCompany.SelectedItem.Value, "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", TB_Remarks.Text, "TOTAL", EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime(), "Payment Detail", "TOTAL"); }
        if (TRTotalAmount != 0) { myDbGL.InsertPaymentMaster(TB_TRCode.Text, TB_TRDate.Text, TB_GLDate.Text, TRTotalAmount, VoucherType, DropDownType.SelectedItem.Value, DropDownType.SelectedItem.Text, TB_Remarks.Text, myDbGL.ConvertStringToNumber(TB_TRExchangeRate.Text), DropDownCurrency.SelectedItem.Value, DropDownGroup.SelectedItem.Value, DropDownCompany.SelectedItem.Value, CB_Reverse.Checked.ToString(), ReverseDateCheck, "UN-POST", "UN-POST", TRCurrentLevel, EnterBy.ToString(), EnterDate.ToString(), LoginUserID.ToString(), myDbGL.GetServerDateTime()); }
        myDbGL.InsertUserLog("General Ledger", "Transaction", "Payment Detail", "Update", TB_TRCode.Text, LoginUserID.ToString(), myDbGL.GetUserPCName(), myDbGL.GetUserPCIP(), myDbGL.GetUserPCMAC(), myDbGL.GetServerDateTime(), myDbGL.GetServerDateTime());
        Response.Redirect(Request.Url.AbsoluteUri);
    }
    catch (Exception ex)
    {
        myDbGL.CatchException(this, ex);
    }
试试看
{            
dt=myDbGL.SelectQuery(“从GASCompanyDetail中选择ComCreationDate,其中ComCode='”+DropDownCompany.SelectedItem.Value+”,ComCreationDate不为空);
如果(dt.Rows.Count!=0)
{
DateTime ComDate=DateTime.Parse(dt.Rows[0][“ComCreationDate”].ToString());
DateTime TRDate=DateTime.Parse(TB_TRDate.Text);
DateTime GLDate=DateTime.Parse(TB_GLDate.Text);
int result=DateTime.Compare(TRDate,ComDate);
如果(结果<0)
{
DisplayMessage=“交易日期不小于公司创建日期!”;
RegisterStartupScript(this.GetType(),“”,alert(““+DisplayMessage+”);”,true);返回;
}
结果=日期时间。比较(GLDate、ComDate);
如果(结果<0)
{
DisplayMessage=“总账日期不小于公司创建日期!”;
RegisterStartupScript(this.GetType(),“”,alert(““+DisplayMessage+”);”,true);返回;
}
}
GridTotal();
dt=myDbGL.SelectQuery(“从GLSBankAccountDetailView中选择*,其中AccCode='”+DropDownType.SelectedItem.Value+'”;
如果(dt.Rows.Count!=0)
{
ChequeBankName=“;//dt.Rows[0][“BankName”].ToString();
ChequeBranchName=“;//dt.Rows[0][“BranchName”].ToString();
ChequeAccountNo=dt.Rows[0][“baccountnumber”].ToString();
}
TRTotalAmount=0;
TRTotalAmount=myDbGL.convertstringtonNumber(TB_TRTotalAmount.Text);
如果(总金额<0)
{
DisplayMessage=“无法保存负面交易!”;
ClientScript.RegisterStartupScript(this.GetType(),“”,警报(“+DisplayMessage+”);“,true);
返回;
}
ExchangeRate=myDbGL.convertstringtonNumber(TB_TRExchangeRate.Text);
如果(汇率==0)
{
DisplayMessage=“请输入有效汇率!”;
ClientScript.RegisterStartupScript(this.GetType(),“”,警报(“+DisplayMessage+”);“,true);
返回;
}
dt=myDbGL.SelectQuery(“从GLTLedger中选择EntryFrom,其中TRNo='”+TB\u TRCode\u Hidden.Text+“'和EntryFrom='Payment Detail'”);
如果(dt.Rows.Count==0)
{
DisplayMessage=“此交易与此录入单无关”;
ClientScript.RegisterStartupScript(this.GetType(),“”,警报(“+DisplayMessage+”);“,true);
返回;
}
dt=myDbGL.SelectQuery(“选择EnterBy,从GLTPaymentMaster输入日期,其中TRNo='”+TB\u TRCode\u Hidden.Text+”;
如果(dt.Rows.Count!=0)
{
EnterBy=dt.Rows[0][“EnterBy”].ToString();
EnterDate=dt.Rows[0][“EnterDate”].ToString();
}
if(TB_TRCode.Text.Left(2)=“BP”){VoucherType=“BANK”}else{VoucherType=“CASH”}
如果(CB_Reverse.Checked){ReverseDateCheck=TB_ReverseDate.Text;}其他{ReverseDateCheck=null;}
如果(!CB_Reverse.Checked)
{
dt=myDbGL.SelectQuery(“从GLTLedger中选择TRPostStatus,TRPostStatusReverse,其中TRNo='”+TB\u TRCode\u Hidden.Text+“,(TRPostStatusReverse='UN-POST');
如果(dt.Rows.Count!=0)
{
myDbGL.deleteTable(“从GLTLedger中删除,其中TRNo='”+TB_TRCode_Hidden.Text+“'和TRReverseStatus=1”);
myDbGL.UpdatePaymentMaster(TB_TRCode_Hidden.Text、CB_Reverse.Checked.ToString()、ReversedTechCheck、EnterBy.ToString()、EnterDate.ToString()、LoginUserID.ToString()、myDbGL.GetServerDateTime());
}
dt=myDbGL.SelectQuery(“选择TRPostStatus,TRPostStatusReverse from GLTLedger,其中TRNo='”+TB\u TRCode\u Hidden.Text+“'和(TRPostStatus='POST')”;
如果(dt.Rows.Count!=0)
{
DisplayMessage=“无法更改已过账的交易!”;
ClientScript.RegisterStartupScript(this.GetType(),“”,警报(“+DisplayMessage+”);“,true);
返回;
}
dt=myDbGL.SelectQuery(“从GLTLedger中选择TRPostStatus,TRPostStatusReverse,其中TRNo='”+TB\u TRCode\u Hidden.Text+“,(TRPostStatusReverse='POST')”;
如果(dt.Rows.Count!=0)
{
DisplayMessage=“无法更改已过账的交易!”;
ClientScript.RegisterStartupScript(this.GetType(),“”,警报(“+DisplayMessage+”);“,true);
返回;
}                
}
TRApprovedLevel=0;TRCurrentLevel=0;TRUserLevel=0;
dt=myDbGL.SelectQuery(“从UMSPageDetail中选择PagWebAddress,其中PagWebAddress类似“%”+Path.GetFileName(Request.PhysicalPath)+“%”和PagApprove='True'”;
如果(dt.Rows.Count!=0)
{
dt1=myDbGL.SelectQuery(“从GLTPostingDetail中选择*,其中PosPageName不象“%Reverse%”,PosPageWebAddress象“+”Path.GetFileName(Request.PhysicalPath)+“”;
如果(dt1.Rows.Count!=0)
{
dt2=myDbGL.SelectQuery(“从GASApprovalPolicyDetailView中选择TOP(1)ApvSerialNo,其中ApvTType='”+dt1.Rows[0][“PosPageName”].ToString()+“”和类似于“+LoginUserIDSitCode.ToString()+””的SitCode,如“+LoginUserIDSitCode.ToString()+”;
如果(dt2.Rows.Count!=0){TRApprovedLevel=myDbGL.convertstringtonNumber(dt2.Rows[0][“ApvSerialNo”].ToString();}
dt2=myDbGL.SelectQuery(“从GASApprovalPolicyDetailView中选择顶部(1)ApvSerialNo,其中ApvTType=
<asp:Button ID="uniqueID" ClientIdMode="Static" OnClientClick="GetData()" ... />

  function GetData() {
      $('#uniqueID').addClass('loading');
      $.ajax(...).then(function() {
          //update cell data
          $('#uniqueID').removeClass('loading');
      });
  }