private void RptJournal_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGLJournalCodes = new SqlDataAdapter("Select * from GLJournalCodes", sqlcon); adaptertbGLJournalCodes.Fill(dbAccountingProjectDS.GLJournalCodes); if (dbAccountingProjectDS.GLJournalCodes.Rows.Count != 0) { foreach (DataRow dr in dbAccountingProjectDS.GLJournalCodes.Rows) { ListAvailable.Items.Add(dr["JournalDescription"]); } } adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RptJournalDet.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); RptJournalAcc.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } rdb_both.Checked = true; rdbdetails.Checked = true; if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void RPTVendorList_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); DTVendor = new DataTable(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbVendor = new SqlDataAdapter("SELECT APVendors.VendorCode, APVendors.VendorName FROM APVendors ", sqlcon); adaptertbVendor.Fill(DTVendor); rdvendorcode.Checked = true; if (DTVendor.Rows.Count != 0) { ListAvailable.Items.Clear(); ListSelect.Items.Clear(); foreach (DataRow dr in DTVendor.Rows) { if (!ListAvailable.Items.Contains(dr["VendorCode"])) { ListAvailable.Items.Add(dr["VendorCode"]); } } } rdsortcode.Checked = true; rdbsummer.Checked = true; if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void RPTOpenItem_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); DTVendor = new DataTable(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbVendor = new SqlDataAdapter("SELECT APVendors.VendorCode, APVendors.VendorName FROM APVendors ", sqlcon); adaptertbVendor.Fill(DTVendor); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RPTOpenItems.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } rdvendorcode.Checked = true; if (DTVendor.Rows.Count != 0) { ListAvailable.Items.Clear(); ListSelect.Items.Clear(); foreach (DataRow dr in DTVendor.Rows) { if (!ListAvailable.Items.Contains(dr["VendorCode"])) { ListAvailable.Items.Add(dr["VendorCode"]); } } } rdsortcode.Checked = true; if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void ARGenerateInvoice_Load(object sender, EventArgs e) { string msg = GeneralFunctions.CheckLockTables("", "ARGenerateInvoice", "", "Open"); if (msg != "") { MessageBox.Show("ARGenerateInvoice Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); btn_Generated.Visible = false; } GeneralFunctions.LockTables("", "ARGenerateInvoice", "", "Open"); InvoiceDT = new DataTable(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adaptertbBatch = new SqlDataAdapter("Select * from Batch", sqlcon); adaptertbInvoices = new SqlDataAdapter("Select * from GenerateInvoice", sqlcon); adaptertbGenInvoice = new SqlDataAdapter("SELECT TOP 100 PERCENT dbo.ARtrans.TransNO AS Voucher#,dbo.Batch.BatchNo AS Batch#, dbo.ARtrans.TRANSDATE AS Invoice_Date, dbo.ARtrans.AmountLC AS Amount, dbo.ARtrans.CodeTran, dbo.ARtrans.AccountCode, dbo.ARtrans.AccountName, dbo.ARtrans.GenInv AS Invoice# FROM dbo.ARtrans INNER JOIN dbo.Batch ON dbo.ARtrans.BatchNo = dbo.Batch.BatchNo Where dbo.Batch.BatchSRC = 'AR' AND dbo.ARtrans.GenInv = 0 AND dbo.ARtrans.AmountLC >= 0 ORDER BY dbo.ARtrans.TRANSDATE", sqlcon); adaptertbARtrans = new SqlDataAdapter("Select * from ARtrans", sqlcon); cmdBuilderInvoices = new SqlCommandBuilder(); cmdBuilderARtrans = new SqlCommandBuilder(); cmdBuilderInvoices.DataAdapter = adaptertbInvoices; cmdBuilderARtrans.DataAdapter = adaptertbARtrans; adaptertbBatch.Fill(dbAccountingProjectDS.Batch); adaptertbInvoices.Fill(dbAccountingProjectDS.GenerateInvoice); adaptertbARtrans.Fill(dbAccountingProjectDS.ARtrans); adaptertbGenInvoice.Fill(InvoiceDT); foreach (DataGridViewColumn c in dgv.Columns) { c.SortMode = DataGridViewColumnSortMode.NotSortable; c.ReadOnly = true; } dgv.Columns[0].ReadOnly = false; }
private void fillusers() { dbAccountingProjectDS1 = new dbAccountingProjectDS(); mycon = new SqlConnection(GeneralFunctions.ConnectionString); Adapterusers = new SqlDataAdapter("Select * from Users", mycon); Adapterusers.Fill(dbAccountingProjectDS1.Users); }
private void RPTARTranCode_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); DTCust = new DataTable(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbCust = new SqlDataAdapter("SELECT ARTransactionCodes.TransCode, ARTransactionCodes.TransDesc FROM ARTransactionCodes ", sqlcon); adaptertbCust.Fill(DTCust); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RptARByTranCode.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } rdcode.Checked = true; if (DTCust.Rows.Count != 0) { ListAvailable.Items.Clear(); ListSelect.Items.Clear(); foreach (DataRow dr in DTCust.Rows) { if (!ListAvailable.Items.Contains(dr["TransCode"])) { ListAvailable.Items.Add(dr["TransCode"]); } } ListAvailable.Sorted = true; } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void RptBalanceSheet_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RptBalanceSheetList.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); //Balance = GeneralFunctions.Decrypt(dr["BalanceSheet"].ToString()); Balance = "All"; } if (Balance == "Standard") { rdbstandard.Top = 42; rdbstandard.Checked = true; rdbstandard.Visible = true; rdbtraditional.Visible = false; rdT.Visible = false; } else if (Balance == "Traditional") { rdbtraditional.Checked = true; rdbstandard.Visible = false; rdbtraditional.Visible = true; rdT.Visible = false; } else if (Balance == "T") { rdT.Top = 42; rdT.Checked = true; rdbstandard.Visible = false; rdbtraditional.Visible = false; rdT.Visible = true; } else if (Balance == "All") { rdbstandard.Visible = true; rdbtraditional.Visible = true; rdT.Visible = true; } else { rdbstandard.Visible = false; rdbtraditional.Visible = false; rdT.Visible = false; } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void ViewGLAcc_Load(object sender, EventArgs e) { sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbFiscalPeriod = new SqlDataAdapter("Select * from GLFiscalPeriod", sqlcon); adaptertbFiscalPeriodsetup = new SqlDataAdapter("Select * from GLFiscalPeriodSetup", sqlcon); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adaptertbGLBudget = new SqlDataAdapter("Select * from GLBudget", sqlcon); adaptertbGLBudget.Fill(dbAccountingProjectDS.GLBudget); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts); adaptertbFiscalPeriod.Fill(dbAccountingProjectDS.GLFiscalPeriod); adaptertbFiscalPeriodsetup.Fill(dbAccountingProjectDS.GLFiscalPeriodSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { //txt_AccountNumber.Mask = dr["AccountNumberFormat"].ToString(); txt_AccountNumber.Mask = ""; } DTTran = new DataTable(); DTTran.Columns.Add("Date", System.Type.GetType("System.String")); DTTran.Columns.Add("Batch_Date", System.Type.GetType("System.String")); DTTran.Columns.Add("Reference", System.Type.GetType("System.String")); DTTran.Columns.Add("Debit", System.Type.GetType("System.String")); DTTran.Columns.Add("Credit", System.Type.GetType("System.String")); DTTran.Columns.Add("Units", System.Type.GetType("System.String")); DTTran.Columns.Add("Journal", System.Type.GetType("System.String")); DTTran.Columns.Add("Src", System.Type.GetType("System.String")); DTTran.Columns.Add("User", System.Type.GetType("System.String")); fillperiod(); fillYear(); dgvtotal.Rows.Add(new object[] { "BeginningBalance", "", "0", "", "", "0" }); dgvtotal.Rows.Add(new object[] { "Period 1", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 2", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 3", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 4", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 5", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 6", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 7", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 8", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 9", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 10", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 11", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 12", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Period 13", "0", "0", "0", "0", "0" }); dgvtotal.Rows.Add(new object[] { "Year End Adjustments", "0", "0", "", "0", "0" }); dgvtotal.Rows.Add(new object[] { "EnddningBalance", "0", "0", "", "0", "0" }); }
private void RPTARPaymentHistory_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); if (txtReport == "Credit") { this.Text = "AR Credit Report"; } else if (txtReport == "Payment") { this.Text = "AR Payment History Report"; } else { this.Text = "AR Payment And Credit Report"; } DTCust = new DataTable(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbCust = new SqlDataAdapter("SELECT ARCustomerMaintainance.AccountCode, ARCustomerMaintainance.AccoutName FROM ARCustomerMaintainance ", sqlcon); adaptertbCust.Fill(DTCust); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RPTARPaymentHis.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } rdAccountcode.Checked = true; if (DTCust.Rows.Count != 0) { ListAvailable.Items.Clear(); ListSelect.Items.Clear(); foreach (DataRow dr in DTCust.Rows) { if (!ListAvailable.Items.Contains(dr["AccountCode"])) { ListAvailable.Items.Add(dr["AccountCode"]); } } } rdsortcode.Checked = true; if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void RPTAPBatch_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RPTAPBatches.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } rdb_both.Checked = true; if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void refill() { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon2 = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon2); adaptertbBatch = new SqlDataAdapter("Select * From Batch", sqlcon2); adaptertbMYGLTransactions = new SqlDataAdapter("Select * From GLTransactions", sqlcon2); cmdBuilderGLTotals = new SqlCommandBuilder(adaptertbGLTotals); cmdBuilderBatch = new SqlCommandBuilder(adaptertbBatch); cmdMyJVTransactions = new SqlCommandBuilder(adaptertbMYGLTransactions); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adaptertbBatch.Fill(dbAccountingProjectDS.Batch); adaptertbMYGLTransactions.Fill(dbAccountingProjectDS.GLTransactions); }
private void RptGLTrialBalance_Load(object sender, EventArgs e) { // radioButton1.Checked = true; dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { txt_AccountNumber1.Mask = dr["AccountNumberFormat"].ToString(); RptTrialBalanceS.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); RptsTrailBalance.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void ShippingLine_Load(object sender, EventArgs e) { //GeneralFunctions.priviledgeGroupBox(Lock85); //GeneralFunctions.priviledgeGroupBox(Lock86); //GeneralFunctions.priviledgeGroupBox(Lock87); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adapter = new SqlDataAdapter("Select * from ShippingLine", sqlcon); cmdBuilder = new SqlCommandBuilder(adapter); adapter.Fill(dbAccountingProjectDS.ShippingLine); dgv.DataSource = dbAccountingProjectDS.ShippingLine; //dgv.Columns[0].Visible = false; //dgv.Columns[3].Visible = false; dgv.ClearSelection(); if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void GeneralLadger_GeneralSetup_Load(object sender, EventArgs e) { sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS1 = new dbAccountingProjectDS(); adaptertbG_L_GeneralSetup = new SqlDataAdapter("Select * from G_L_GeneralSetup", sqlcon); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGLJournalCodes = new SqlDataAdapter("Select * from GLJournalCodes", sqlcon); adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts", sqlcon); cmdBuilderaG_L_GeneralSetup = new SqlCommandBuilder(adaptertbG_L_GeneralSetup); adaptertbAccounts.Fill(dbAccountingProjectDS1.GLAccounts); adaptertbG_L_GeneralSetup.Fill(dbAccountingProjectDS1.G_L_GeneralSetup); adaptertbGeneralSetup.Fill(dbAccountingProjectDS1.GeneralSetup); adaptertbGLJournalCodes.Fill(dbAccountingProjectDS1.GLJournalCodes); foreach (DataRow dr in dbAccountingProjectDS1.GeneralSetup.Rows) { txtbalanceSheet.Mask = dr["AccountNumberFormat"].ToString(); txtIncome.Mask = dr["AccountNumberFormat"].ToString(); txtRetained.Mask = dr["AccountNumberFormat"].ToString(); } cb_BankDepost = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_BankDepost, "JournalCode", "JournalCodeID"); cb_Payable = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_Payable, "JournalCode", "JournalCodeID"); cb_payroll = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_payroll, "JournalCode", "JournalCodeID"); cb_Receivable = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_Receivable, "JournalCode", "JournalCodeID"); cb_Tran_Cashier = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_Tran_Cashier, "JournalCode", "JournalCodeID"); cb_Systeminterface = GeneralFunctions.FillComboBox(dbAccountingProjectDS1.GLJournalCodes, cb_Systeminterface, "JournalCode", "JournalCodeID"); drs = dbAccountingProjectDS1.G_L_GeneralSetup.Select(); if (drs.Length != 0) { cb_BankDepost.Text = drs[0]["BankDepost"].ToString(); cb_Payable.Text = drs[0]["Accounts_Payable"].ToString(); cb_payroll.Text = drs[0]["PayRoll"].ToString(); cb_Receivable.Text = drs[0]["Accounts_Receivable"].ToString(); cb_Systeminterface.Text = drs[0]["SystemInterface"].ToString(); txtRetained.Text = drs[0]["RetainedEarnings"].ToString(); txtIncome.Text = drs[0]["IncomeStatment"].ToString(); txtbalanceSheet.Text = drs[0]["BalanceSheet"].ToString(); cb_Receivable.Text = drs[0]["JNL_Tran_Cashier"].ToString(); } }
private void RPTAPDestributionFrm_Load(object sender, EventArgs e) { ACClist = new ArrayList(); dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { RPTAPDestributions.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } SqlCommand mycom = new SqlCommand("SELECT DISTINCT dbo.APDeliveryType.DeliveryTypeAccountNumber FROM dbo.GLTransactions INNER JOIN dbo.Batch ON dbo.GLTransactions.BatchNo = dbo.Batch.BatchNo INNER JOIN dbo.APDeliveryType ON dbo.GLTransactions.GLAccount = dbo.APDeliveryType.DeliveryTypeAccountNumber WHERE (dbo.Batch.BatchSRC = N'AP') AND (dbo.Batch.BatchStat = N'P')"); sqlcon.Open(); mycom.Connection = sqlcon; SqlDataReader sqldr; sqldr = mycom.ExecuteReader(); while (sqldr.Read()) { ACClist.Add(sqldr[0].ToString()); } mycom.Clone(); sqldr.Close(); sqlcon.Close(); adaptertbAPGeneralSetup = new SqlDataAdapter("Select * from APGeneralSetup", sqlcon); adaptertbAPGeneralSetup.Fill(dbAccountingProjectDS.APGeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.APGeneralSetup.Rows) { ACClist.Add(dr["APAccountNumber"].ToString()); } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void RptGLAccountDetail_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbGLJournalCodes = new SqlDataAdapter("Select * from GLJournalCodes", sqlcon); adaptertbGLJournalCodes.Fill(dbAccountingProjectDS.GLJournalCodes); if (dbAccountingProjectDS.GLJournalCodes.Rows.Count != 0) { foreach (DataRow dr in dbAccountingProjectDS.GLJournalCodes.Rows) { ListAvailable.Items.Add(dr["JournalDescription"]); } } adaptertbAccounts = new SqlDataAdapter("Select AccountNumber,AccountName from GLAccounts where AccountTypeName <> 'Header'", sqlcon); tableAccount = new DataTable(); adaptertbAccounts.Fill(tableAccount); tableAccount.Columns.Add("Select", Type.GetType("System.Boolean")); dgv.DataSource = tableAccount; int I = dgv.Rows.Count; dgv.Columns["AccountNumber"].ReadOnly = true; dgv.Columns["AccountName"].ReadOnly = true; adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { txt_AccountNumber1.Mask = dr["AccountNumberFormat"].ToString(); RptGLdet.decmial = short.Parse(dr["DecimalPointsNumber"].ToString()); } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } }
private void GLGeneralSetup_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); if (!GeneralFunctions.SubTypesloaded) { SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString); sqlcon10.Open(); SqlCommand command10 = new SqlCommand("Select AccountSubType From GeneralSetup", sqlcon10); SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10); SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10); SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10); SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10); int AccountSubTypeNumber; if (command10.ExecuteScalar() != DBNull.Value) { AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar()); if (AccountSubTypeNumber == 2) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 3) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 4) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } } } }
public static void FillBalanceSheet(DateTime DatePeriod, string Lang) { SqlConnection sqlconndelete = new SqlConnection(GeneralFunctions.ConnectionString); sqlconndelete.Open(); SqlCommand sqlcommandDeletetran = new SqlCommand("Delete From BalanceSheet", sqlconndelete); SqlDataReader drDeletetran = sqlcommandDeletetran.ExecuteReader(); drDeletetran.Close(); sqlconndelete.Close(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adaptertChart = new SqlDataAdapter("Select * from GLAccountsChart", sqlcon); adapterBalanceSheet = new SqlDataAdapter("Select * from BalanceSheet", sqlcon); adapteraccount = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon); commbChart = new SqlCommandBuilder(adaptertChart); commbBalanceSheet = new SqlCommandBuilder(adapterBalanceSheet); commbaccount = new SqlCommandBuilder(adapteraccount); commbGLTotals = new SqlCommandBuilder(adaptertbGLTotals); adaptertChart.Fill(dbAccountingProjectDS.GLAccountsChart); adapteraccount.Fill(dbAccountingProjectDS.GLAccounts); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adapterBalanceSheet.Fill(dbAccountingProjectDS.BalanceSheet); periodbalance = FindPeriod(DatePeriod); if (dbAccountingProjectDS.GLAccounts.Rows.Count > 0) { // ID = 1; // ID = dbAccountingProjectDS.BalanceSheet.Count + 1; for (int i = 0; i < dbAccountingProjectDS.GLAccounts.Rows.Count; i++) { if (dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() == "Assets" || dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() == "Liability" || dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() == "Equity" || dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString().Contains("iabil")) { //SqlConnection sqlconndelete = new SqlConnection(GeneralFunctions.ConnectionString); //sqlconndelete.Open(); //SqlCommand sqlcommandDeletetran = new SqlCommand(string.Format("select * from BalanceSheet where AccountNumber ={0}", dbAccountingProjectDS.GLAccounts.Rows[i]["AccountNumber"].ToString()), sqlconndelete); //SqlDataReader drDeletetran = sqlcommandDeletetran.ExecuteReader(); //bool x = false; //if (drDeletetran.HasRows) //{ // x = true; //} //else { x = false; } //drDeletetran.Close(); //sqlconndelete.Close(); bool x = false; if (x == false) { acc = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountNumber"].ToString(); rs = dbAccountingProjectDS.GLAccountsChart.Select("AccountNumber = '" + acc + "'"); rsb = dbAccountingProjectDS.GLTotals.Select("AccountNumber = '" + acc + "' AND FiscalYear = " + DatePeriod.Year + ""); if (rsb.Length != 0 && periodbalance != "") { valbalance = double.Parse(rsb[0][periodbalance].ToString()); } else { valbalance = 0; } if (rs.Length != 0 && rs[0]["TreeRowParent"].ToString() == "Personal Accounts Ramy Harby") { r = dbAccountingProjectDS.BalanceSheet.NewRow(); r["ID"] = ID; ID++; r["AccountNumber"] = acc; if (Lang == "AR") { r["AccountName"] = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountNameArabic"].ToString(); } else { r["AccountName"] = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountName"].ToString(); } r["AccountType"] = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString(); if (dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() == "Assets") { r["Debit"] = valbalance; } else { r["Credit"] = valbalance; } totalorder = rs[0]["ListOrder"].ToString(); if (totalorder != "") { string[] ns; string[] sp = new string[1]; sp[0] = "-"; listorder = totalorder.Remove(0, 2); ns = listorder.Split(sp, StringSplitOptions.None); listorder = "0"; for (int m = 0; m < ns.Length - 1; m++) { listorder = listorder + "-" + ns[m]; n = m + 1; rst = dbAccountingProjectDS.GLAccountsChart.Select("ListOrder = '" + listorder + "'"); if (rst.Length != 0) { if (Lang == "AR") { string ARN = FindArabicName(rst[0]["AccountNumber"].ToString()); if (ARN != "") { r["g" + n.ToString()] = ARN; } else { r["g" + n.ToString()] = rst[0]["TreeRowName"].ToString(); } } else { r["g" + n.ToString()] = rst[0]["TreeRowName"].ToString(); } } } } dbAccountingProjectDS.BalanceSheet.Rows.Add(r); } } } } for (int q = 1; q <= 9; q++) { HideField("g" + q.ToString()); } update(); } }
private void GLInterface_Load(object sender, EventArgs e) { try { //update AccountFormat SqlConnection MyConnection; SqlCommand MyComm; MyConnection = new SqlConnection(GeneralFunctions.ConnectionString); MyConnection.Open(); MyComm = new SqlCommand("Update GeneralSetup set AccountNumberFormat = '' ", MyConnection); MyComm.ExecuteNonQuery(); //update AccountFormat checkLoginStatus(); int cpt; try { GLInterface.report_language_available = System.IO.Directory.GetFiles(this.exe_path + LANGUAGE_DIRECTORY, "*.xml"); if (GLInterface.report_language_available != null) { for (cpt = 0; cpt < GLInterface.report_language_available.Length; cpt++) { GLInterface.report_language_available[cpt] = System.IO.Path.GetFileNameWithoutExtension(GLInterface.report_language_available[cpt]); } this.comboBox_language.Items.AddRange(GLInterface.report_language_available); } } catch { GLInterface.report_language_available = null; } //logOffUserToolStripMenuItem_Click(sender, e); dbAccountingProjectDS dbAccountingProjectDS = new dbAccountingProjectDS(); SqlConnection sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); SqlDataAdapter adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { if (dr["MultiCurrency"].ToString() == "True") { GeneralFunctions.GMultiCurrency = 1; } else { GeneralFunctions.GMultiCurrency = 0; } } if (GeneralFunctions.GMultiCurrency == 1) { this.currencyConvertionToolStripMenuItem.Visible = true; this.currencyToolStripMenuItem.Visible = true; } else { this.currencyConvertionToolStripMenuItem.Visible = false; this.currencyToolStripMenuItem.Visible = false; } SqlConnection sqlconLanguage = new SqlConnection(GeneralFunctions.ConnectionString); SqlCommand sqlcomLanguage = new SqlCommand("Select SelectedLanguage From GeneralSetup", sqlconLanguage); sqlconLanguage.Open(); SqlDataReader sqlread = sqlcomLanguage.ExecuteReader(); if (sqlread.HasRows) { sqlread.Read(); comboBox_language.Text = sqlread.GetString(0); } sqlread.Close(); sqlconLanguage.Close(); //logInToolStripMenuItem_Click(sender, e); Load_G_Report(); } catch { } finally { if (Function.FUNAVL.Count > 0) { if (Function.FUNAVL.Contains("SS")) { btnSetup.Visible = true; } if (Function.FUNAVL.Contains("GL")) { btnGL.Visible = true; btnGL_Setup.Visible = true; } if (Function.FUNAVL.Contains("AP")) { btnAP.Visible = true; btnAP_Setup.Visible = true; } if (Function.FUNAVL.Contains("AR")) { btnAR.Visible = true; btnAR_Setup.Visible = true; } if (Function.FUNAVL.Contains("Bank")) { btnBank.Visible = true; btnBank_Setup.Visible = true; } } } }
private void GeneralSetup_Load(object sender, EventArgs e) { string msg = GeneralFunctions.CheckLockTables("", "", "", ""); if (msg != "") { MessageBox.Show("Can't Open Because Other Form Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } GeneralFunctions.LockTables("All", "GeneralSetup", "", ""); string BS = ""; EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_GRAYED); dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); FillNumberFormat(cb_APNumberFormat); FillNumberFormat(cb_ARNumberFormat); FillNumberFormat(cb_JVNumberFormat); FillNumberFormat(cb_BankNumberFormat); adaptertbGeneralSetup = new SqlDataAdapter("Select * From GeneralSetup", sqlcon); cmdBuilderGeneralSetup = new SqlCommandBuilder(adaptertbGeneralSetup); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { txtMaxAccountNo.Text = dr["AccountNumberFormat"].ToString(); txtDecimalPoint.Text = dr["DecimalPointFormat"].ToString(); cb_JVNumberFormat.Text = dr["JVNumberFormat"].ToString(); cb_APNumberFormat.Text = dr["APNumberFormat"].ToString(); cb_ARNumberFormat.Text = dr["ARNumberFormat"].ToString(); cb_BankNumberFormat.Text = dr["BankNumberFormat"].ToString(); lblAP.Text = dr["lblAP"].ToString(); lblAR.Text = dr["lblAR"].ToString(); lblJV.Text = dr["lblJV"].ToString(); lblBank.Text = dr["lblBank"].ToString(); //txt_SublevelNumber.Text = dr["AccountsChartSubLevels"].ToString(); tempAccountNumber = dr["AccountNumberFormat"].ToString(); cbMultiCurrency.Checked = Convert.ToBoolean(dr["MultiCurrency"].ToString()); comboBox_language.Text = dr["SelectedLanguage"].ToString(); BS = dr["BalanceSheet"].ToString(); if (BS.Trim() == "") { cmbBS.SelectedIndex = -1; } else { cmbBS.Text = GeneralFunctions.Decrypt(BS); } } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } //GLInterface gl=new GLInterface(); comboBox_language.Items.AddRange(GLInterface.report_language_available); }
private void AccountsPayableControl_Load(object sender, EventArgs e) { try { string msg = GeneralFunctions.CheckLockTables("", "", "", ""); if (msg != "") { MessageBox.Show("Can't Open Because Other Form Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } GeneralFunctions.LockTables("All", "AccountsPayableControl", "", ""); dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adapterPaymentTerms = new SqlDataAdapter("Select * from APPaymentTerms", sqlcon); adapterPaymentTerms.Fill(dbAccountingProjectDS.APPaymentTerms); cb_VendorTerms = GeneralFunctions.FillComboBox(dbAccountingProjectDS.APPaymentTerms, cb_VendorTerms, "PaymentTermCode", "PaymentTermCodeID"); SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString); sqlcon10.Open(); if (!GeneralFunctions.SubTypesloaded) { SqlCommand command10 = new SqlCommand("Select AccountSubType From GeneralSetup", sqlcon10); SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10); SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10); SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10); SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10); int AccountSubTypeNumber; if (command10.ExecuteScalar() != DBNull.Value) { AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar()); if (AccountSubTypeNumber == 2) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 3) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 4) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } } } fillData(sqlcon10); if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "system Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Allocation_Run_Load(object sender, EventArgs e) { try { string msg = GeneralFunctions.CheckLockTables("", "AllocationMaintenance", "", "Edit"); if (msg != "") { MessageBox.Show("Can't Open Because AllocationMaintenance Edit By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } msg = GeneralFunctions.CheckLockTables("", "Allocation Run", "", "Open"); if (msg != "") { MessageBox.Show("Allocation Run Open By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); Lock67.Visible = false; } msg = GeneralFunctions.CheckLockTables("GLFiscalPeriod", "EndMonth", "", "Edit"); if (msg != "") { MessageBox.Show("EndMonth Edit By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } msg = GeneralFunctions.CheckLockTables("GLFiscalPeriodSetup", "ENDYear", "", "Edit"); if (msg != "") { MessageBox.Show("ENDYear Edit By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } GeneralFunctions.LockTables("", "Allocation Run", "", "Open"); GeneralFunctions.priviledgeGroupBox(Lock67); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adaptertbAllocation = new SqlDataAdapter("Select distinct(AllocationCode) from GLAllocation", sqlcon); adaptertbAllocationsource = new SqlDataAdapter("Select * from GLAllocation", sqlcon); adaptertbAllocationDestinationAccounts = new SqlDataAdapter("Select * from GLAllocationDestinationAccounts", sqlcon); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon); adaptertbGLJVTransaction = new SqlDataAdapter("Select * From GLTransactions", sqlcon); adaptertbBatch = new SqlDataAdapter("Select * From Batch", sqlcon); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbG_L_GeneralSetup = new SqlDataAdapter("Select * from G_L_GeneralSetup", sqlcon); adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts); adaptertbBatch.Fill(dbAccountingProjectDS.Batch); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adaptertbGLJVTransaction.Fill(dbAccountingProjectDS.GLTransactions); adaptertbAllocationsource.Fill(dbAccountingProjectDS.GLAllocation); adaptertbAllocationDestinationAccounts.Fill(dbAccountingProjectDS.GLAllocationDestinationAccounts); adaptertbG_L_GeneralSetup.Fill(dbAccountingProjectDS.G_L_GeneralSetup); cmdBuilderBatch = new SqlCommandBuilder(adaptertbBatch); cmdBuildertbJVTransaction = new SqlCommandBuilder(adaptertbGLJVTransaction); cmdBuilderGLTotals = new SqlCommandBuilder(adaptertbGLTotals); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); //adaptertbG_L_GeneralSetup.Fill(dbAccountingProjectDS.G_L_GeneralSetup); foreach (DataRow drg in dbAccountingProjectDS.GeneralSetup.Rows) { decmal = int.Parse(drg["DecimalPointsNumber"].ToString()); GeneralFunctions.JVNumberFormat = drg["JVNumberFormat"].ToString(); GeneralFunctions.lblJV = drg["lblJV"].ToString(); } DataRow[] drGL = dbAccountingProjectDS.G_L_GeneralSetup.Select(); if (drGL.Length != 0) { DefaultACCBalanceSheet = drGL[0]["BalanceSheet"].ToString(); DefaultACCIncomeStatment = drGL[0]["IncomeStatment"].ToString(); if (DefaultACCBalanceSheet == "" || DefaultACCIncomeStatment == "") { MessageBox.Show("Please Check AccountBalanceSheet And AccountIncomeStatment In G/L GeneralSetup ", "Error"); this.Close(); } } dtallocation = new DataTable(); adaptertbAllocation.Fill(dtallocation); ArrayList allcode = new ArrayList(); for (int i = 0; i < dtallocation.Rows.Count; i++) { allcode.Add(dtallocation.Rows[i][0].ToString()); } adaptertbAllocation = new SqlDataAdapter("Select * from GLAllocation", sqlcon); adaptertbAllocation.Fill(dbAccountingProjectDS.GLAllocation); dtallocation = new DataTable(); dtallocation.Columns.Add("Code", System.Type.GetType("System.String")); dtallocation.Columns.Add("Journal", System.Type.GetType("System.String")); dtallocation.Columns.Add("Description", System.Type.GetType("System.String")); dtallocation.Columns.Add("Repeat", System.Type.GetType("System.String")); DataRow dr; DataRow[] drs; for (int i = 0; i < allcode.Count; i++) { drs = dbAccountingProjectDS.GLAllocation.Select("AllocationCode = '" + allcode[i].ToString() + "'"); if (drs.Length != 0) { dr = dtallocation.NewRow(); dr["Code"] = drs[0]["AllocationCode"]; dr["Journal"] = drs[0]["AllocationGLJournalCode"]; dr["Description"] = drs[0]["AllocationDescription"]; dr["Repeat"] = drs[0]["AllocationRepeat"]; dtallocation.Rows.Add(dr); } } dgvallocation.DataSource = dtallocation; dgvallocation.Columns["Repeat"].Visible = false; dgvallocation.Refresh(); //AllocationCode,DestinationGLAccountNumber,DestinationAccountDescription,DestinationAccountPercentage dtSourceAccounts = new DataTable(); //dtSourceAccounts.Columns.Add("AllocationCode", System.Type.GetType("System.Int32")); //dtSourceAccounts.Columns.Add("AllocationGLJournalCode", System.Type.GetType("System.String")); //dtSourceAccounts.Columns.Add("AllocationDescription", System.Type.GetType("System.String")); dtSourceAccounts.Columns.Add("AllocationSourceAccount", System.Type.GetType("System.String")); dtSourceAccounts.Columns.Add("AllocationSourceAccountName", System.Type.GetType("System.String")); dtSourceAccounts.Columns.Add("AllocationSourceAccountPercentage", System.Type.GetType("System.Double")); //adaptertbAllocationsource.Fill(dtSourceAccounts); dgvsource.DataSource = dtSourceAccounts; //dgvsource.Columns[0].HeaderText = "Code"; //dgvsource.Columns[1].HeaderText = "GLJournalCode"; //dgvsource.Columns[2].HeaderText = "Description"; dgvsource.Columns[0].HeaderText = "AccountNumber"; dgvsource.Columns[1].HeaderText = "AccountName"; dgvsource.Columns[2].HeaderText = "Percentage"; dgvsource.Refresh(); dtDestinationAccounts = new DataTable(); //dtDestinationAccounts.Columns.Add("AllocationCode", System.Type.GetType("System.Int32")); dtDestinationAccounts.Columns.Add("DestinationGLAccountNumber", System.Type.GetType("System.String")); dtDestinationAccounts.Columns.Add("DestinationAccountDescription", System.Type.GetType("System.String")); dtDestinationAccounts.Columns.Add("DestinationAccountPercentage", System.Type.GetType("System.Double")); //adaptertbAllocationDestinationAccounts.Fill(dtDestinationAccounts); dgvdestination.DataSource = dtDestinationAccounts; //dgvdestination.Columns[0].HeaderText = "Code"; dgvdestination.Columns[0].HeaderText = "AccountNumber"; dgvdestination.Columns[1].HeaderText = "AccountName"; dgvdestination.Columns[2].HeaderText = "Percentage"; dgvdestination.Refresh(); if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "General Ledger"); } }
private void Bank_Deposit_Load(object sender, EventArgs e) { try { string msg = GeneralFunctions.CheckLockTables("", "ENDYear", "", "Edit"); if (msg != "") { MessageBox.Show("Can't Open Because ENDYear Edit By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } msg = GeneralFunctions.CheckLockTables("", "EndMonth", "", "Edit"); if (msg != "") { MessageBox.Show("Can't Open Because EndMonth Edit By " + msg, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } GeneralFunctions.LockTables("", "Bank_Deposit", "", "Open"); // TODO: This line of code loads data into the 'dbAccountingProjectDS1.BatchTemp' table. You can move, or remove it, as needed. dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbFiscalPeriod = new SqlDataAdapter("Select * from GLFiscalPeriod", sqlcon); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon); adaptertbBatch = new SqlDataAdapter("Select * From Batch", sqlcon); adaptertbGLTransactions = new SqlDataAdapter("Select * From GLTransactions", sqlcon); adaptertbGeneralSetup = new SqlDataAdapter("Select * from GeneralSetup", sqlcon); adaptertbG_L_GeneralSetup = new SqlDataAdapter("Select * from G_L_GeneralSetup", sqlcon); cmdBuilderGLTotals = new SqlCommandBuilder(adaptertbGLTotals); cmdBuilderBatch = new SqlCommandBuilder(adaptertbBatch); cmdGLTransactions = new SqlCommandBuilder(adaptertbGLTransactions); adaptertbFiscalPeriod.Fill(dbAccountingProjectDS.GLFiscalPeriod); adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adaptertbBatch.Fill(dbAccountingProjectDS.Batch); adaptertbGLTransactions.Fill(dbAccountingProjectDS.GLTransactions); adaptertbGeneralSetup.Fill(dbAccountingProjectDS.GeneralSetup); adaptertbG_L_GeneralSetup.Fill(dbAccountingProjectDS.G_L_GeneralSetup); foreach (DataRow dr in dbAccountingProjectDS.GeneralSetup.Rows) { GeneralFunctions.BankNumberFormat = dr["BankNumberFormat"].ToString(); GeneralFunctions.DecimalPointsNumber = int.Parse(dr["DecimalPointsNumber"].ToString()); AccountNumberFormat = dr["AccountNumberFormat"].ToString(); decmal = int.Parse(dr["DecimalPointsNumber"].ToString()); GeneralFunctions.lblBank = dr["lblBank"].ToString(); } DataRow[] drs = dbAccountingProjectDS.G_L_GeneralSetup.Select(); if (drs.Length != 0) { DefaultACCBalanceSheet = drs[0]["BalanceSheet"].ToString(); DefaultACCIncomeStatment = drs[0]["IncomeStatment"].ToString(); JNL_BankDeposit = drs[0]["BankDepost"].ToString(); if (DefaultACCBalanceSheet == "" || DefaultACCIncomeStatment == "") { MessageBox.Show("Please Check AccountBalanceSheet And AccountIncomeStatment In G/L GeneralSetup ", "Error"); this.Close(); } } string periodName; if (GeneralFunctions.RetrievePeriod(string.Format(GeneralFunctions.Format_Date, DTP_JVDate.Value.Date), out currentPeriodID, out periodName, out currentEndDate)) { txt_Period.Text = periodName; } else { MessageBox.Show("The period has been defined", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (GeneralFunctions.languagechioce != "") { this.obj_options = new ClassOptions(); this.obj_options.report_language = GeneralFunctions.languagechioce; this.update_language_interface(); } DataTable DtCat = DataClass.RetrieveData("Select Bank_Deposit_Type_ID,Bank_Deposit_Type_Name From Bank_Deposit_Type "); cb_Bank_Deposit_Type.DataSource = DtCat; cb_Bank_Deposit_Type.DisplayMember = "Bank_Deposit_Type_Name"; cb_Bank_Deposit_Type.ValueMember = "Bank_Deposit_Type_ID"; cb_Bank_Deposit_Type.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// /// </summary> /// <param name="DatePeriod"></param> public static void FillTrialBalance(DateTime DatePeriod) { SqlConnection sqlconndelete = new SqlConnection(GeneralFunctions.ConnectionString); sqlconndelete.Open(); SqlCommand sqlcommandDeletetran = new SqlCommand("Delete From TrialBalance", sqlconndelete); SqlDataReader drDeletetran = sqlcommandDeletetran.ExecuteReader(); drDeletetran.Close(); sqlconndelete.Close(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adaptertChart = new SqlDataAdapter("Select * from GLAccountsChart", sqlcon); adapterTrialBalance = new SqlDataAdapter("Select * from TrialBalance", sqlcon); adapteraccount = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbGLTotals = new SqlDataAdapter("Select * from GLTotals", sqlcon); commbChart = new SqlCommandBuilder(adaptertChart); commbTrialBalance = new SqlCommandBuilder(adapterTrialBalance); commbaccount = new SqlCommandBuilder(adapteraccount); commbGLTotals = new SqlCommandBuilder(adaptertbGLTotals); adaptertChart.Fill(dbAccountingProjectDS.GLAccountsChart); adapteraccount.Fill(dbAccountingProjectDS.GLAccounts); adaptertbGLTotals.Fill(dbAccountingProjectDS.GLTotals); adapterTrialBalance.Fill(dbAccountingProjectDS.TrialBalance); periodbalance = FindPeriod(DatePeriod); if (dbAccountingProjectDS.GLAccounts.Rows.Count > 0) { ID = 1; for (int i = 0; i < dbAccountingProjectDS.GLAccounts.Rows.Count; i++) { if (dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() != "Statictical" && dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString() != "Header") { acc = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountNumber"].ToString(); rs = dbAccountingProjectDS.GLAccountsChart.Select("AccountNumber = '" + acc + "'"); rsb = dbAccountingProjectDS.GLTotals.Select("AccountNumber = '" + acc + "' AND FiscalYear = " + DatePeriod.Year + ""); if (rsb.Length != 0 && periodbalance != "") { valbalance = double.Parse(rsb[0][periodbalance].ToString()); Beginbalance = double.Parse(rsb[0]["BeginningBalance"].ToString()); } else { valbalance = 0; Beginbalance = 0; } if (rs.Length != 0) { r = dbAccountingProjectDS.TrialBalance.NewRow(); r["ID"] = ID; ID++; r["AccountNumber"] = acc; r["AccountName"] = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountName"].ToString(); r["AccountType"] = dbAccountingProjectDS.GLAccounts.Rows[i]["AccountTypeName"].ToString(); r["OpenBalance"] = Beginbalance; r["EndBalance"] = valbalance; totalorder = rs[0]["ListOrder"].ToString(); if (totalorder != "") { string[] ns; string[] sp = new string[1]; sp[0] = "-"; listorder = totalorder.Remove(0, 2); ns = listorder.Split(sp, StringSplitOptions.None); listorder = "0"; for (int m = 0; m < ns.Length - 1; m++) { listorder = listorder + "-" + ns[m]; n = m + 1; rst = dbAccountingProjectDS.GLAccountsChart.Select("ListOrder = '" + listorder + "'"); if (rst.Length != 0) { //if (Lang == "AR") //{ // string ARN = FindArabicName(rst[0]["AccountNumber"].ToString()); // if (ARN != "") // r["g" + n.ToString()] = ARN; // else // r["g" + n.ToString()] = rst[0]["TreeRowName"].ToString(); //} //else r["g" + n.ToString()] = rst[0]["TreeRowName"].ToString(); } } } dbAccountingProjectDS.TrialBalance.Rows.Add(r); } } } for (int q = 1; q <= 9; q++) { HideField("g" + q.ToString()); } update(); } }
public static void FillVendorList() { SqlConnection sqlconndelete = new SqlConnection(GeneralFunctions.ConnectionString); sqlconndelete.Open(); SqlCommand sqlcommandDeletetran = new SqlCommand("Delete From RptVendorList", sqlconndelete); SqlDataReader drDeletetran = sqlcommandDeletetran.ExecuteReader(); drDeletetran.Close(); sqlconndelete.Close(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); dbAccountingProjectDS = new dbAccountingProjectDS(); adapterVendor = new SqlDataAdapter("Select * from APVendors", sqlcon); adapterContact = new SqlDataAdapter("Select * from APVendorContacts", sqlcon); adapterCategory = new SqlDataAdapter("Select * from APVendorCategory", sqlcon); adapterVendorList = new SqlDataAdapter("Select * from RptVendorList", sqlcon); commbVendorList = new SqlCommandBuilder(adapterVendorList); adapterVendor.Fill(dbAccountingProjectDS.APVendors); adapterContact.Fill(dbAccountingProjectDS.APVendorContacts); adapterCategory.Fill(dbAccountingProjectDS.APVendorCategory); adapterVendorList.Fill(dbAccountingProjectDS.RptVendorList); DataRow r; DataRow[] rs; DataRow[] rc; if (dbAccountingProjectDS.APVendors.Rows.Count > 0) { for (int i = 0; i < dbAccountingProjectDS.APVendors.Rows.Count; i++) { rs = dbAccountingProjectDS.APVendorContacts.Select("VendorCode = '" + dbAccountingProjectDS.APVendors.Rows[i]["VendorCode"].ToString() + "'"); if (rs.Length != 0) { for (int c = 0; c < rs.Length; c++) { r = dbAccountingProjectDS.RptVendorList.NewRow(); r["VendorCode"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCode"]; r["VendorName"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorName"]; r["VendorCity"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCity"]; r["VendorPhone"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorPhone"]; r["VendorCountry"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCountry"]; r["VendorFax"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorFax"]; r["VendorTermID"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorTermID"]; r["VendorStatus"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorStatus"]; r["VendorAddress"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorAddress"]; rc = dbAccountingProjectDS.APVendorCategory.Select("CategoryCode = '" + dbAccountingProjectDS.APVendors.Rows[i]["VendorCategory"].ToString() + "'"); if (rc.Length != 0) { r["CategoryDescription"] = dbAccountingProjectDS.APVendorCategory.Rows[0]["CategoryDescription"]; } else { r["CategoryDescription"] = ""; } r["ContactName"] = rs[c]["ContactName"]; r["ContactMobile"] = rs[c]["ContactMobile"]; r["ContactEmail"] = rs[c]["ContactEmail"]; dbAccountingProjectDS.RptVendorList.Rows.Add(r); } } else { r = dbAccountingProjectDS.RptVendorList.NewRow(); r["VendorCode"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCode"]; r["VendorName"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorName"]; r["VendorCity"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCity"]; r["VendorPhone"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorPhone"]; r["VendorCountry"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorCountry"]; r["VendorFax"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorFax"]; r["VendorTermID"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorTermID"]; r["VendorStatus"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorStatus"]; r["VendorAddress"] = dbAccountingProjectDS.APVendors.Rows[i]["VendorAddress"]; rc = dbAccountingProjectDS.APVendorCategory.Select("CategoryCode = '" + dbAccountingProjectDS.APVendors.Rows[i]["VendorCategory"].ToString() + "'"); if (rc.Length != 0) { r["CategoryDescription"] = dbAccountingProjectDS.APVendorCategory.Rows[0]["CategoryDescription"]; } else { r["CategoryDescription"] = ""; } r["ContactName"] = ""; r["ContactMobile"] = ""; r["ContactEmail"] = ""; dbAccountingProjectDS.RptVendorList.Rows.Add(r); } } update(); } }
private void GeneralLedgerTemplate_Load(object sender, EventArgs e) { dbAccountingProjectDS = new dbAccountingProjectDS(); sqlcon = new SqlConnection(GeneralFunctions.ConnectionString); adaptertbTemplate = new SqlDataAdapter("Select * from GLTemplates", sqlcon); adaptertbGLJournalCodes = new SqlDataAdapter("Select * from GLJournalCodes", sqlcon); adaptertbAccounts = new SqlDataAdapter("Select * from GLAccounts", sqlcon); adaptertbTemplateAccounts = new SqlDataAdapter("Select * from GLTemplateAccounts", sqlcon); adaptertbCurrency = new SqlDataAdapter("Select * from GLCurrency", sqlcon); cmdBuildertbTemplate = new SqlCommandBuilder(adaptertbTemplate); cmdBuildertbTemplateAccounts = new SqlCommandBuilder(adaptertbTemplateAccounts); adaptertbGLJournalCodes.Fill(dbAccountingProjectDS.GLJournalCodes); adaptertbTemplate.Fill(dbAccountingProjectDS.GLTemplates); adaptertbAccounts.Fill(dbAccountingProjectDS.GLAccounts); adaptertbTemplateAccounts.Fill(dbAccountingProjectDS.GLTemplateAccounts); adaptertbCurrency.Fill(dbAccountingProjectDS.GLCurrency); dtTemplateAccounts = new DataTable(); dtTemplateAccounts.Columns.Add("AccountID", System.Type.GetType("System.Int32")); dtTemplateAccounts.Columns.Add("AccountNumber", System.Type.GetType("System.String")); dtTemplateAccounts.Columns.Add("AccountName", System.Type.GetType("System.String")); dtTemplateAccounts.Columns.Add("AccountTypeName", System.Type.GetType("System.String")); dtTemplateAccounts.Columns.Add("Reference", System.Type.GetType("System.String")); dtTemplateAccounts.Columns.Add("Debit", System.Type.GetType("System.Double")); dtTemplateAccounts.Columns.Add("Credit", System.Type.GetType("System.Double")); dtTemplateAccounts.Columns.Add("DebitCC", System.Type.GetType("System.Double")); dtTemplateAccounts.Columns.Add("CreditCC", System.Type.GetType("System.Double")); dtTemplateAccounts.Columns.Add("Units", System.Type.GetType("System.Int32")); dtTemplateAccounts.Columns.Add("TemplateCode", System.Type.GetType("System.String")); DataRow r = dtTemplateAccounts.NewRow(); dtTemplateAccounts.Rows.Add(r); dgv.DataSource = dtTemplateAccounts; dgv.Columns["AccountID"].Visible = false; dgv.Columns["AccountTypeName"].Visible = false; dgv.Columns["TemplateCode"].Visible = false; dgv.Columns["DebitCC"].ReadOnly = true; dgv.Columns["CreditCC"].ReadOnly = true; DataGridViewComboBoxColumn dgvc = new DataGridViewComboBoxColumn(); dgvc.HeaderText = "ProjectCode"; dgvc.Name = "ProjectCode"; dgvc.FlatStyle = FlatStyle.Popup; AddItems(dgvc); dgv.Columns.Add(dgvc); cb_JournalCode = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLJournalCodes, cb_JournalCode, "JournalCode", "JournalCodeID"); cb_Currency = GeneralFunctions.FillComboBox(dbAccountingProjectDS.GLCurrency, cb_Currency, "CurrencyCode", "CurrencyNumber"); cb_Currency = GeneralFunctions.RemoveBaseCurrency(cb_Currency); value = "0."; for (int i = 0; i < GeneralFunctions.DecimalPointsNumber; i++) { value += "0"; } if (!GeneralFunctions.SubTypesloaded) { SqlConnection sqlcon10 = new SqlConnection(GeneralFunctions.ConnectionString); sqlcon10.Open(); SqlCommand command10 = new SqlCommand("Select AccountSubType From GeneralSetup", sqlcon10); SqlCommand command11 = new SqlCommand("Select FirstSub From GeneralSetup", sqlcon10); SqlCommand command12 = new SqlCommand("Select SecondSub From GeneralSetup", sqlcon10); SqlCommand command13 = new SqlCommand("Select ThirdSub From GeneralSetup", sqlcon10); SqlCommand command14 = new SqlCommand("Select FourthSub From GeneralSetup", sqlcon10); int AccountSubTypeNumber; if (command10.ExecuteScalar() != DBNull.Value) { AccountSubTypeNumber = Convert.ToInt32(command10.ExecuteScalar()); if (AccountSubTypeNumber == 2) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 3) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } if (AccountSubTypeNumber == 4) { GeneralFunctions.LoadSubtypes(Convert.ToInt32(command11.ExecuteScalar()), Convert.ToInt32(command12.ExecuteScalar()), Convert.ToInt32(command13.ExecuteScalar()), Convert.ToInt32(command14.ExecuteScalar())); GeneralFunctions.SubTypesloaded = true; } } } currentTemplateID = GeneralFunctions.TemplateID; txt_TemplateID.Text = currentTemplateID.ToString(); }