using Swift.DAL.VoucherReport; using Swift.web.Library; using System; using System.Data; using System.Text; namespace Swift.web.BillVoucher.ManualVoucher { public partial class List : System.Web.UI.Page { private const string ViewFunctionId = "20102000,20102010,20102020,20102030"; private const string DateFunctionId = "20102040"; private readonly RemittanceLibrary _sdd = new RemittanceLibrary(); private readonly VoucherReportDAO _vrd = new VoucherReportDAO(); protected void Page_Load(object sender, EventArgs e) { Authenticate(); if (!IsPostBack) { AllowChangeDate(); Misc.MakeAmountTextBox(ref amt); Misc.MakeNumericTextbox(ref vNum); transactionDate.Text = DateTime.Today.ToString("d"); transactionDate.Attributes.Add("readonly", "readonly"); //transactionDate.ReadOnly = true; PopulateDDL(); } } private void PopulateDDL() { _sdd.SetDDL(ref voucherType, "EXEC Proc_dropdown_remit @FLAG='voucherDDL'", "value", "functionName", "", ""); } private void Authenticate() { _sdd.CheckAuthentication(ViewFunctionId); } protected bool AllowChangeDate() { return _sdd.HasRight(DateFunctionId); } protected void addBtn_Click(object sender, EventArgs e) { if (GetStatic.ParseDouble(amt.Text) <= 0) { GetStatic.AlertMessage(this, "Please enter valid Amount! "); amt.Text = " "; amt.Focus(); return; } //var result = _vrd.InsertTempVoucherEntry(GetStatic.GetSessionId(), GetStatic.GetUser(), acInfo.Value, dropDownDrCr.Text, amt.Text); //if (result.ErrorCode == "1") //{ // GetStatic.AlertMessage(this, result.Msg); //} //else //{ // ShowTempVoucher(); //} } private void ShowTempVoucher() { //show data on div int sno = 0, drCount = 0, crCount = 0; double drTotal = 0, crTotal = 0; var dt = _vrd.GetTempVoucherEntryData(GetStatic.GetSessionId()); var sb = new StringBuilder(""); sb.AppendLine("
"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); if (dt == null || dt.Rows.Count == 0) { sb.AppendLine("
S. NoAC informationTypeAmountSelect
No transaction found!
"); rpt_tempVoucherTrans.InnerHtml = sb.ToString(); return; } foreach (DataRow item in dt.Rows) { sno++; if (item["part_tran_type"].ToString().ToLower() == "dr") { drCount++; drTotal = drTotal + Convert.ToDouble(item["tran_amt"]); } else if (item["part_tran_type"].ToString().ToLower() == "cr") { crCount++; crTotal = crTotal + Convert.ToDouble(item["tran_amt"]); } sb.AppendLine(""); sb.AppendLine("" + sno.ToString() + " "); sb.AppendLine(" " + item["acct_num"].ToString() + ""); sb.AppendLine("" + item["part_tran_type"].ToString() + " "); sb.AppendLine("
" + GetStatic.ShowDecimal(item["tran_amt"].ToString()) + "
"); sb.AppendLine("
"); sb.AppendLine(""); } sb.AppendLine(""); sb.AppendLine("
Total Dr (" + drCount.ToString() + "):    " + GetStatic.ShowDecimal(drTotal.ToString()) + "
"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("
Total Cr (" + crCount.ToString() + "):    " + GetStatic.ShowDecimal(crTotal.ToString()) + "
"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); rpt_tempVoucherTrans.InnerHtml = sb.ToString(); } protected void btnDelete_Click(object sender, EventArgs e) { var res = _vrd.DeleteRecordVoucherEntry(hdnRowId.Value); if (res.ErrorCode == "0") { GetStatic.AlertMessage(this, res.Msg); } ShowTempVoucher(); } protected void btnUnSave_Click(object sender, EventArgs e) { ShowTempVoucher(); } protected void btnSave_Click(object sender, EventArgs e) { string date = transactionDate.Text; var res = _vrd.SaveTempTransactionManual(GetStatic.GetSessionId(), date, narrationField.Text, voucherType.SelectedValue, chequeNo.Text, vNum.Text); if (res.ErrorCode == "0") { chequeNo.Text = ""; narrationField.Text = ""; rpt_tempVoucherTrans.InnerHtml = res.Msg; } else { GetStatic.AlertMessage(this, res.Msg); } } } }