protected void btnAddCreditEntry_Click(object sender, EventArgs e) { try { int accid = Convert.ToInt32(ddlCreditAccountList.SelectedValue); string accname = Convert.ToString(ddlCreditAccountList.SelectedItem.Text); Decimal amount = Convert.ToDecimal(txtCreditAmount.Text); String tempKey = MySessionManager.TempTranKey; FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vchTypes = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter(); FinancialDS.tbl_VoucherTypesDataTable vtypes = vchTypes.GetVoucherTypeByName(MySessionManager.VchTypeName); if (vtypes.Count > 0) { FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter tempTran = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); tempTran.InsertTempTransaction(tempKey, accid, accname, MySessionManager.DebitAccountListID, 0, amount, amount, 1, 0, "", DateTime.Now, "", "", "", "", "", "", "", ""); gvTranEntries.DataBind(); FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter getTotal = new FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter(); FinancialDS.GetTempEntriesTotalsDataTable totEntries = getTotal.GetData(tempKey); lblDebitTotal.Text = Convert.ToString(totEntries[0].TotalDebit); lblCreditTotal.Text = Convert.ToString(totEntries[0].TotalCredit); } } catch (Exception ex) { } VchPanel.Visible = true; VchTypeSelPanel.Visible = false; txtCreditAmount.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["action"] != null) { if (Request.QueryString["action"] == "deleteItem") { try { int id = Convert.ToInt32(Request.QueryString["id"]); FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter tempTran = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); tempTran.DeleteTempTransactionEntry(id); Response.Redirect("~/pages/finance/finhome.aspx?panel=Journal&action=" + System.Guid.NewGuid().ToString()); } catch (Exception ex) { } loadAccItems(); VchPanel.Visible = true; VchTypeSelPanel.Visible = false; } else if (Request.QueryString["action"] == "addItem") { VchTypeSelPanel.Visible = false; } } else { VchPanel.Visible = false; VchTypeSelPanel.Visible = true; if (IsPostBack == false) { MySessionManager.TempTranKey = System.Guid.NewGuid().ToString(); } } }
private bool insertVoucher() { FinancialDSTableAdapters.InsertVoucherTableAdapter vch = new FinancialDSTableAdapters.InsertVoucherTableAdapter(); FinancialDSTableAdapters.tbl_Ledger_EntriesTableAdapter led = new FinancialDSTableAdapters.tbl_Ledger_EntriesTableAdapter(); FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter temp = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vType = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter(); FinancialDS.tempTransaction_EntriesDataTable entries = temp.GetTempTransactionsByEntryKey(MySessionManager.TempTranKey); if (entries.Count > 0) { DateTime vchDate = DateTime.Now; try { CultureInfo ukCulture = new CultureInfo("en-GB"); vchDate = DateTime.Parse(txtDate.Text, ukCulture); } catch (Exception ex) { } string VchType = MySessionManager.VchTypeName; string vchNarration = txtNarration.Value; string vchNumber = ""; int vchIsPostDated = 0; int vchIsOptional = 0; FinancialDS.tbl_VoucherTypesDataTable vtypes = vType.GetVoucherTypeByName(VchType); if (vtypes.Count > 0) { try { vchNumber = vtypes[0].datPrefix + " " + vtypes[0].datSuffix; int newid = Convert.ToInt32(vch.InsertVoucher(vchDate, VchType, vchNumber, vchNarration, vchIsPostDated, vchIsOptional, 0, DateTime.Now, DateTime.Now, Convert.ToInt32(MySessionManager.CurrentUser.UserID), 0)[0].vchNewID); decimal totAmount = 0; foreach (FinancialDS.tempTransaction_EntriesRow entry in entries) { led.InsertLedgerEntry(entry.datAccountType, entry.datAccountID, Convert.ToDecimal(entry.datAmount), 0, newid, "On Account", entry.datPaymentMode, "", "", "", "", "", "", "", "", ""); totAmount += entry.datAmount; } led.InsertLedgerEntry(vtypes[0].datCreditAccountTypes, Convert.ToInt32(ListofCreditAccounts.SelectedValue), Convert.ToDecimal(totAmount), 1, newid, "On Account", entries[0].datPaymentMode, "", "", "", "", "", "", "", "", ""); return(true); } catch (Exception ex) { return(false); } } else { return(false); } } else { return(false); } }
protected void deleteItem_Click(object sender, EventArgs e) { try { LinkButton link = (LinkButton)sender; int id = Convert.ToInt32(link.CommandArgument); FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter tempTran = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); tempTran.DeleteTempTransactionEntry(id); gvTranEntries.DataBind(); FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter getTotal = new FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter(); FinancialDS.GetTempEntriesTotalsDataTable totEntries = getTotal.GetData(MySessionManager.TempTranKey); lblDebitTotal.Text = Convert.ToString(totEntries[0].TotalDebit); lblCreditTotal.Text = Convert.ToString(totEntries[0].TotalCredit); } catch (Exception ex) { } loadAccItems(); VchPanel.Visible = true; VchTypeSelPanel.Visible = false; }
protected void btnAddEntry_Click(object sender, EventArgs e) { try { int accid = Convert.ToInt32(ddlDebitAccountList.SelectedValue); string accname = Convert.ToString(ddlDebitAccountList.SelectedItem.Text); int paymenttype = Convert.ToInt32(ddlPaymentType.SelectedValue); string paymentmodename = Convert.ToString(ddlPaymentType.SelectedItem.Text); Decimal amount = Convert.ToDecimal(txtAmount.Text); String tempKey = MySessionManager.TempTranKey; FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vchTypes = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter(); FinancialDS.tbl_VoucherTypesDataTable vtypes = vchTypes.GetVoucherTypeByName(MySessionManager.VchTypeName); if (vtypes.Count > 0) { FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter tempTran = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); tempTran.InsertTempTransaction(tempKey, accid, accname, MySessionManager.DebitAccountListID, 0, 0, amount, 0, paymenttype, paymentmodename, DateTime.Now,"","","","","","","",""); gvTranEntries.DataBind(); FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter getTotal = new FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter(); FinancialDS.GetTempEntriesTotalsDataTable totEntries = getTotal.GetData(tempKey); lblTotal.Text = Convert.ToString(totEntries[0].TotalAmount); } } catch (Exception ex) { } transactionsPanel.Visible = true; VchPanel.Visible = true; VchTypeSelPanel.Visible = false; txtAmount.Text = ""; }
private bool insertVoucher() { FinancialDSTableAdapters.InsertVoucherTableAdapter vch = new FinancialDSTableAdapters.InsertVoucherTableAdapter(); FinancialDSTableAdapters.tbl_Ledger_EntriesTableAdapter led = new FinancialDSTableAdapters.tbl_Ledger_EntriesTableAdapter(); FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter temp = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter vType = new FinancialDSTableAdapters.tbl_VoucherTypesTableAdapter(); FinancialDS.tempTransaction_EntriesDataTable entries = temp.GetTempTransactionsByEntryKey(MySessionManager.TempTranKey); if (entries.Count > 0) { DateTime vchDate = DateTime.Now; try { CultureInfo ukCulture = new CultureInfo("en-GB"); vchDate = DateTime.Parse(txtDate.Text, ukCulture); } catch (Exception ex) { } string VchType = MySessionManager.VchTypeName; string vchNarration = txtNarration.Value; string vchNumber = ""; int vchIsPostDated = 0; int vchIsOptional = 0; FinancialDS.tbl_VoucherTypesDataTable vtypes = vType.GetVoucherTypeByName(VchType); if (vtypes.Count > 0) { try { vchNumber = vtypes[0].datPrefix + " " + vtypes[0].datSuffix; int newid = Convert.ToInt32(vch.InsertVoucher(vchDate, VchType, vchNumber, vchNarration, vchIsPostDated, vchIsOptional, 0, DateTime.Now, DateTime.Now, Convert.ToInt32(MySessionManager.CurrentUser.UserID), 0)[0].vchNewID); decimal totAmount = 0; foreach (FinancialDS.tempTransaction_EntriesRow entry in entries) { led.InsertLedgerEntry(entry.datAccountType, entry.datAccountID, Convert.ToDecimal(entry.datAmount),1, newid, "On Account", entry.datPaymentMode, "", "", "", "", "", "", "","",""); totAmount += entry.datAmount; } led.InsertLedgerEntry(vtypes[0].datCreditAccountTypes, Convert.ToInt32(ListofCreditAccounts.SelectedValue), Convert.ToDecimal(totAmount), 0, newid, "On Account", entries[0].datPaymentMode, "", "", "", "", "", "", "","",""); return true; } catch (Exception ex) { return false; } } else { return false; } } else { return false; } }
protected void deleteItem_Click(object sender, EventArgs e) { try { LinkButton link = (LinkButton)sender; int id = Convert.ToInt32(link.CommandArgument); FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter tempTran = new FinancialDSTableAdapters.tempTransaction_EntriesTableAdapter(); tempTran.DeleteTempTransactionEntry(id); gvTranEntries.DataBind(); FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter getTotal = new FinancialDSTableAdapters.GetTempEntriesTotalsTableAdapter(); FinancialDS.GetTempEntriesTotalsDataTable totEntries = getTotal.GetData(MySessionManager.TempTranKey); lblTotal.Text = Convert.ToString(totEntries[0].TotalAmount); } catch (Exception ex) { } loadAccItems(); transactionsPanel.Visible = true; VchPanel.Visible = true; VchTypeSelPanel.Visible = false; }