private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; ClearDbInfo(); if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; UpdateStatus(@"Opening database...", 1, 2); _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { GetFieldLengths(); ShowDbInfo(); } else { UpdateStatus(@"Unable to open database.", 2, 2); toolStripStatusLabel.Text = @"Status: No open database"; } this.Cursor = Cursors.Default; }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string sql = "SELECT Name,convert(varchar,LastRuntime, 101) as LastRunDate,case when Active = 1 then 'Y' else 'N' end as Active,ID FROM ScheduleTasks"; DataSet Tasks = _jurisUtility.RecordsetFromSQL(sql); dataGridView2.AutoGenerateColumns = true; dataGridView2.DataSource = Tasks.Tables[0]; // dataset dataGridView2.Columns[0].Width = 220; dataGridView2.Columns[1].Width = 100; dataGridView2.Columns[2].Width = 50; }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { } }
private void listBoxFromCompany_SelectedIndexChanged(object sender, EventArgs e) { OrigDB = ""; //FROM DB if (oldBooksCon.DbOpen) { oldBooksCon.CloseDatabase(); } CompanyCode = "Company" + listBoxFromCompany.SelectedValue; oldBooksCon.SetInstance(CompanyCode); OrigDB = oldBooksCon.Company.DatabaseName; JBillsDbName = "JBills" + oldBooksCon.Company.Code; oldBooksCon.OpenDatabase(); if (oldBooksCon.DbOpen) { //oldBooksCon.CloseDatabase(); } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string TkprIndex; cbFrom.ClearItems(); string SQLTkpr = "select empinitials + case when len(empinitials)=1 then ' ' when len(empinitials)=2 then ' ' when len(empinitials)=3 then ' ' else ' ' end + empname as employee from employee where ( empsysnbr in (select morigatty from matorigatty) ) order by empinitials"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { cbFrom.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr.Tables) { foreach (DataRow dr in table.Rows) { TkprIndex = dr["employee"].ToString(); cbFrom.Items.Add(TkprIndex); } } } DateTime result = DateTime.Today.Subtract(TimeSpan.FromDays(1)); dateTimePicker1.Value = result; }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } for (int i = 0; i < (checkedListBox1.Items.Count); i++) { checkedListBox1.SetItemChecked(i, true); } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string bankAcct; comboBox1.ClearItems(); string SQLTkpr = "SELECT BnkCode + ' ' + BnkDesc as bankaccount FROM BankAccount"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { comboBox1.SelectedIndex = -1; } else { foreach (DataTable table in myRSTkpr.Tables) { foreach (DataRow dr in table.Rows) { bankAcct = dr["bankaccount"].ToString(); comboBox1.Items.Add(bankAcct); } } } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string sql = "SELECT distinct empname, BillToBillingAtty FROM PreBill " + "inner join billto on billtosysnbr = pbbillto " + "inner join employee on empsysnbr = BillToBillingAtty " + " inner join prebillmatter on pbmprebill = pbsysnbr " + " inner join matter on matsysnbr = pbmmatter " + " where pbstatus <= 2 and matbillagreecode = 'R' and matfltfeeorretainer<>0 and matstatusflag='O' "; DataSet emp = _jurisUtility.RecordsetFromSQL(sql); if (emp == null || emp.Tables[0].Rows.Count == 0) { MessageBox.Show("There are no prebills to process", "No processing", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { comboBox1.ValueMember = "BillToBillingAtty"; comboBox1.DisplayMember = "empname"; comboBox1.DataSource = emp.Tables[0]; } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } populateCBFrom(); populateCBTo(); populatePG(); matPractClass = " "; cliPractClass = " "; this.cbPG.SelectedIndex = 0; }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } comboBox1.ClearItems(); string SQLTkpr = "select cast(EmpId as varchar) + ' ' + EmpName as employee from employee order by EmpInitials"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { comboBox1.SelectedIndex = 0; } else { comboBox1.Items.Add("* All Employees"); foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { comboBox1.Items.Add(dr["employee"].ToString()); allEmployees = allEmployees + "" + dr["employee"].ToString().Split(' ')[0] + ","; } allEmployees = allEmployees.TrimEnd(','); } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string sql = "select dbo.jfn_formatclientcode(client.CliCode) AS Client, client.clireportingname as ClientName, " + " dbo.jfn_formatmattercode(matter.MatCode) AS Matter, matter.matreportingname as MatterName, " + " matsysnbr as matsysnbr, clisysnbr as clisysnbr " + " from matter inner join client on matclinbr = clisysnbr where MatStatusFlag <> 'C' order by clicode, matcode"; DataSet Tasks = _jurisUtility.RecordsetFromSQL(sql); AllItems = new DataSet(); AllItems.Tables.Add(Tasks.Tables[0].Copy()); foreach (DataRow row in Tasks.Tables[0].Rows) { object[] items = new object[6]; items[0] = row[0].ToString(); items[1] = row[1].ToString(); items[2] = row[2].ToString(); items[3] = row[3].ToString(); items[4] = row[4].ToString(); items[5] = row[5].ToString(); dataGridView2.Rows.Add(items); } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { cbClient.SelectedIndex = -1; string CliIndex; cbClient.ClearItems(); string SQLCli = "select Client from (select '* All' as Client union all select dbo.jfn_formatclientcode(clicode) + ' ' + clireportingname as Client from Client where clisysnbr in (select matclinbr from matter where matsysnbr in (select splitfrommat from splitbill))) CLI order by Client"; DataSet myRSCli = _jurisUtility.RecordsetFromSQL(SQLCli); if (myRSCli.Tables[0].Rows.Count == 0) { cbClient.SelectedIndex = 0; } else { foreach (DataTable table in myRSCli.Tables) { foreach (DataRow dr in table.Rows) { CliIndex = dr["Client"].ToString(); cbClient.Items.Add(CliIndex); } } } } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string sstest = "select distinct ChtSubAcct1 from ChartOfAccounts order by ChtSubAcct1"; DataSet dd = _jurisUtility.RecordsetFromSQL(sstest); if (dd.Tables[0].Rows.Count == 1 && Convert.ToInt32(dd.Tables[0].Rows[0][0].ToString()) == 0) { sstest = getSQLBasedOnAccounts(false); } else { sstest = getSQLBasedOnAccounts(true); } string taskCode; cbFrom.ClearItems(); string SQLTkpr = sstest; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { cbFrom.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr.Tables) { foreach (DataRow dr in table.Rows) { taskCode = dr["COA"].ToString(); cbFrom.Items.Add(taskCode); } } } string TkprIndex2; cbTo.ClearItems(); string SQLTkpr2 = sstest; DataSet myRSTkpr2 = _jurisUtility.RecordsetFromSQL(SQLTkpr2); if (myRSTkpr2.Tables[0].Rows.Count == 0) { cbTo.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr2.Tables) { foreach (DataRow dr in table.Rows) { TkprIndex2 = dr["COA"].ToString(); cbTo.Items.Add(TkprIndex2); } } } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } listViewClient.Clear(); setColumns(); string SQLTkpr = "SELECT [CliSysNbr] ,right([CliCode], 8) as CliCode,[CliNickName] FROM [Client]"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { MessageBox.Show("There are no open clients in this database", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { string offsetClient = ""; if (dr["CliCode"].ToString().Trim().Length < 8) //ensure they are all same number of digits { int diff = 8 - dr["CliCode"].ToString().Trim().Length; for (int a = 0; a < diff; a++) { offsetClient = offsetClient + "0"; } } ListViewItem lvi = new ListViewItem(dr["CliSysNbr"].ToString()); lvi.SubItems.Add(offsetClient + dr["CliCode"].ToString().Trim()); lvi.SubItems.Add(dr["CliNickName"].ToString()); listViewClient.Items.Add(lvi); } } comboBoxBill.ClearItems(); myRSTkpr.Clear(); SQLTkpr = "select cast(EmpSysNbr as varchar) + ' ' + EmpName as employee from employee"; myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { comboBoxBill.SelectedIndex = 0; } else { comboBoxBill.Items.Add("* All Employees"); foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { comboBoxBill.Items.Add(dr["employee"].ToString()); allEmployeesBill = allEmployeesBill + dr["employee"].ToString().Split(' ')[0] + ","; } allEmployeesBill = allEmployeesBill.TrimEnd(','); } comboBoxOrig.ClearItems(); myRSTkpr.Clear(); SQLTkpr = "select cast(EmpSysNbr as varchar) + ' ' + EmpName as employee from employee"; myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { comboBoxOrig.SelectedIndex = 0; } else { comboBoxOrig.Items.Add("* All Employees"); foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { comboBoxOrig.Items.Add(dr["employee"].ToString()); allEmployeesOrig = allEmployeesOrig + dr["employee"].ToString().Split(' ')[0] + ","; } allEmployeesOrig = allEmployeesOrig.TrimEnd(','); } }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); cbDays.Visible = true; dtSince.Visible = false; rbDays.Checked = true; string TkprIndex2; cbBT.ClearItems(); string SQLTkpr2 = "select employee from (select '* (All Timekeepers)' as employee union all select case when empinitials<=' ' then empid else empinitials end + case when len(empinitials)=1 then ' ' when len(empinitials)=2 then ' ' when len(empinitials)=3 then ' ' else ' ' end + empname as employee from employee where empvalidastkpr='Y') Emp order by employee"; DataSet myRSTkpr2 = _jurisUtility.RecordsetFromSQL(SQLTkpr2); if (myRSTkpr2.Tables[0].Rows.Count == 0) { cbBT.SelectedIndex = 0; } else { foreach (DataRow dr in myRSTkpr2.Tables[0].Rows) { TkprIndex2 = dr["employee"].ToString(); cbBT.Items.Add(TkprIndex2); } } string CliIndex2; cbClient.ClearItems(); string SQLCli2 = "select Client from (select '* (All Clients)' as Client union all select dbo.jfn_formatclientcode(clicode) + ' ' + clireportingname as Client from Client) Emp order by Client"; DataSet myRSCli2 = _jurisUtility.RecordsetFromSQL(SQLCli2); if (myRSCli2.Tables[0].Rows.Count == 0) { cbClient.SelectedIndex = 0; } else { foreach (DataRow dr in myRSCli2.Tables[0].Rows) { CliIndex2 = dr["Client"].ToString(); cbClient.Items.Add(CliIndex2); } } string PCIndex2; cbPC.ClearItems(); string SQLPC2 = "select PC from (select '* (All Practice Classes)' as PC union all select prctclscode + ' ' + prctclsdesc as PC from PracticeClass) Emp order by PC"; DataSet myRSPC2 = _jurisUtility.RecordsetFromSQL(SQLPC2); if (myRSPC2.Tables[0].Rows.Count == 0) { cbPC.SelectedIndex = 0; } else { foreach (DataRow dr in myRSPC2.Tables[0].Rows) { PCIndex2 = dr["PC"].ToString(); cbPC.Items.Add(PCIndex2); } } string TkprIndex; cbExcBT.ClearItems(); string SQLTkpr = "select employee from (select '* (None)' as employee union all select case when empinitials<=' 'then empid else empinitials end + case when len(empinitials)=1 then ' ' when len(empinitials)=2 then ' ' when len(empinitials)=3 then ' ' else ' ' end + empname as employee from employee where empvalidastkpr='Y') Emp order by employee"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { cbExcBT.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr.Tables) { foreach (DataRow dr in table.Rows) { TkprIndex = dr["employee"].ToString(); cbExcBT.Items.Add(TkprIndex); } } } string CliIndex; cbExcCli.ClearItems(); string SQLCli = "select Client from (select '* (None)' as Client union all select dbo.jfn_formatclientcode(clicode) + ' ' + clireportingname as Client from Client) Emp order by Client"; DataSet myRSCli = _jurisUtility.RecordsetFromSQL(SQLCli); if (myRSCli.Tables[0].Rows.Count == 0) { cbExcCli.SelectedIndex = 0; } else { foreach (DataTable table in myRSCli.Tables) { foreach (DataRow dr in table.Rows) { CliIndex = dr["Client"].ToString(); cbExcCli.Items.Add(CliIndex); } } } cbBT.SelectedIndex = 0; cbClient.SelectedIndex = 0; cbPC.SelectedIndex = 0; cbExcBT.SelectedIndex = 0; cbExcCli.SelectedIndex = 0; cbDays.SelectedIndex = 0; }
private void listBoxCompanies_SelectedIndexChanged(object sender, EventArgs e) { if (_jurisUtility.DbOpen) { _jurisUtility.CloseDatabase(); } CompanyCode = "Company" + listBoxCompanies.SelectedValue; _jurisUtility.SetInstance(CompanyCode); JurisDbName = _jurisUtility.Company.DatabaseName; JBillsDbName = "JBills" + _jurisUtility.Company.Code; _jurisUtility.OpenDatabase(); if (_jurisUtility.DbOpen) { ///GetFieldLengths(); } string taskCode; cbFrom.ClearItems(); string SQLTkpr = "select TaskCdCode + ' ' + TaskCdDesc as taskcode from TaskCode"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQLTkpr); if (myRSTkpr.Tables[0].Rows.Count == 0) { cbFrom.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr.Tables) { foreach (DataRow dr in table.Rows) { taskCode = dr["taskcode"].ToString(); cbFrom.Items.Add(taskCode); } } } string TkprIndex2; cbTo.ClearItems(); string SQLTkpr2 = "select TaskCdCode + ' ' + TaskCdDesc as taskcode from TaskCode"; DataSet myRSTkpr2 = _jurisUtility.RecordsetFromSQL(SQLTkpr2); if (myRSTkpr2.Tables[0].Rows.Count == 0) { cbTo.SelectedIndex = 0; } else { foreach (DataTable table in myRSTkpr2.Tables) { foreach (DataRow dr in table.Rows) { TkprIndex2 = dr["taskcode"].ToString(); cbTo.Items.Add(TkprIndex2); } } } }