protected void btn_submit_Click(object sender, EventArgs e) { TBL_Accounting_Receipt tar = new TBL_Accounting_Receipt(); tar.Receipt_ID = Convert.ToInt32(hfdreceipt.Value); tar.Receiptnum = "0"; tar.PayeerName = txt_payer.Text; tar.DatePaid = Convert.ToDateTime(txt_datepaid.Text); tar.PaymentType = ddl_paymenttype.SelectedValue; tar.Checknum = txtchknumber.Text; tar.CCHolderName = txt_payer.Text; tar.CCDigits = txtcreditcardnumber.Text; tar.IsVoid = Convert.ToBoolean(0); tar.VoidReason_ID = 0; tar.ISReReceipt = Convert.ToBoolean(0); tar.ReReceiptFrom = ""; tar.Receiptnum = ""; tar.Batchnum = ""; tar.Modifyby = 1; tar.Modifydate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); object obj = Person_Details.Licensing_Details.InsertSelected_Receipt(tar); foreach (DataListItem li in dlistAmtOwed.Items) { string dlistamt = ((HiddenField)li.FindControl("hfdtot")).Value; string txtamt = ((TextBox)li.FindControl("txtamnt")).Text; string feeid = ((HiddenField)li.FindControl("hfddlistfeeid")).Value; string status = "3"; if (Convert.ToDecimal(dlistamt) == Convert.ToDecimal(txtamt)) { status = "2"; } else { status = "3"; } TBL_Accounting_ReceiptDetail tard = new TBL_Accounting_ReceiptDetail(); tard.ReceiptdetailsID = Convert.ToInt32(hfdrecdetail.Value); tard.ReceiptID = Convert.ToInt32(obj); tard.Fee_ID = Convert.ToInt32(feeid); tard.Amount = Convert.ToDecimal(txtamt); tard.ModifiedBY = 1; tard.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); TBL_Accounting_FeeDetail tafd = new TBL_Accounting_FeeDetail(); Person_Details.Licensing_Details.Insert_FeeReceipt(tard, tafd); TBL_Licensing_FeeAuditHistory feeaudit = new TBL_Licensing_FeeAuditHistory(); feeaudit.FeeAudit_Id = 0; feeaudit.Fee_Type_Id = Convert.ToInt32(feeid.ToString()); feeaudit.Amount = Convert.ToDecimal(txtamt); feeaudit.TypeofAction = "Insert"; feeaudit.Datepaid = Convert.ToDateTime(DateTime.Now.ToShortDateString()); feeaudit.Modifiedby = 1; feeaudit.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); feeaudit.Create_User = 1; feeaudit.Create_Date = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Person_Details.Licensing_Details.Insert_feeaudit(feeaudit); } string js = " altbox('Sucessfully Saved.');sa5.process();$('#btn_receptdata_pop').dialog('close');"; ScriptManager.RegisterStartupScript(Page, GetType(), "scr", js, true); }
protected void btn_submit_Click(object sender, EventArgs e) { decimal amount = 0; foreach (DataListItem dl in dlistAmtOwed.Items) { amount = (amount) + Convert.ToDecimal(((TextBox)dl.FindControl("txtamnt")).Text); } if (txtchknumber.Text.Trim() != "") { List <OperationsLink.tbl_Add_Log> obj = Operations.Utilities_Operations.Get_CheckandAmount(txtchknumber.Text); List <OperationsLink.USP_GetBalanceAmountInChecksResult> obj1 = Operations.Utilities_Operations.GetBalanceAmount(txtchknumber.Text); if (obj.Count <= 0) { ScriptManager.RegisterStartupScript(this, GetType(), "js", "<script> recp_error();</script>", false); return; } else { // if (amount > obj[0].Amount||amount > obj1[0].BalanceAmount) if (amount > obj[0].Amount) { ScriptManager.RegisterStartupScript(this, GetType(), "js", "<script> recp_error1();</script>", false); return; } if (obj.Select(c => c.PaymentType == ddl_paymenttype.SelectedValue).ToList().Count == 0) { ScriptManager.RegisterStartupScript(this, GetType(), "js", "<script> recp_error();</script>", false); return; } } } //if (txtchknumber.Text.Trim() != "") //{ // if (Operations.Utilities_Operations.validatecheck(txtchknumber.Text)) // { // ScriptManager.RegisterStartupScript(this, GetType(), "js", "<script> recp_error();</script>", false); // return; // } //} foreach (DataListItem li in dlistAmtOwed.Items) { TBL_Accounting_Receipt tar = new TBL_Accounting_Receipt(); tar.Receipt_ID = Convert.ToInt32(hfdreceipt.Value); tar.Receiptnum = "0"; tar.PayeerName = txt_payer.Text; tar.DatePaid = Convert.ToDateTime(txt_datepaid.Text); tar.PaymentType = ddl_paymenttype.SelectedValue; if (ddl_paymenttype.SelectedValue == "538") { tar.Checknum = txtmorderno.Text; } else { tar.Checknum = txtchknumber.Text; } tar.CCHolderName = txt_payer.Text; tar.CCDigits = txtcreditcardnumber.Text; tar.IsVoid = Convert.ToBoolean(0); tar.VoidReason_ID = 0; tar.ISReReceipt = Convert.ToBoolean(0); tar.ReReceiptFrom = ""; tar.Receiptnum = ""; tar.Batchnum = ""; tar.Modifyby = Convert.ToInt32(Session["UID"].ToString()); tar.Modifydate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); object obj = Person_Details.Licensing_Details.InsertSelected_Receipt(tar); string dlistamt = ((HiddenField)li.FindControl("hfdtot")).Value; string txtamt = ((TextBox)li.FindControl("txtamnt")).Text; string feeid = ((HiddenField)li.FindControl("hfddlistfeeid")).Value; string status = "3"; if (Convert.ToDecimal(dlistamt) == Convert.ToDecimal(txtamt)) { status = "2"; } else { status = "3"; } TBL_Accounting_ReceiptDetail tard = new TBL_Accounting_ReceiptDetail(); tard.ReceiptdetailsID = Convert.ToInt32(hfdrecdetail.Value); tard.ReceiptID = Convert.ToInt32(obj); tard.Fee_ID = Convert.ToInt32(feeid); tard.Amount = Convert.ToDecimal(txtamt); tard.ModifiedBY = 1; tard.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); TBL_Accounting_FeeDetail tafd = new TBL_Accounting_FeeDetail(); tafd.Status = Convert.ToInt32(status); Person_Details.Licensing_Details.Insert_FeeReceipt(tard, tafd); TBL_Licensing_FeeAuditHistory feeaudit = new TBL_Licensing_FeeAuditHistory(); feeaudit.FeeAudit_Id = 0; feeaudit.Fee_Type_Id = Convert.ToInt32(feeid.ToString()); feeaudit.Amount = Convert.ToDecimal(txtamt); feeaudit.TypeofAction = "Insert"; feeaudit.Datepaid = Convert.ToDateTime(DateTime.Now.ToShortDateString()); feeaudit.Modifiedby = 1; feeaudit.ModifiedDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); feeaudit.Create_User = 1; feeaudit.Create_Date = Convert.ToDateTime(DateTime.Now.ToShortDateString()); Person_Details.Licensing_Details.Insert_feeaudit(feeaudit); } altbox("Sucessfully saved."); }