Beispiel #1
0
 private void FormQBAccountSelect_Load(object sender, EventArgs e)
 {
     _listDepositAccountsQB = Accounts.GetDepositAccountsQB();
     for (int i = 0; i < _listDepositAccountsQB.Count; i++)
     {
         comboDepositAccount.Items.Add(_listDepositAccountsQB[i]);
     }
     comboDepositAccount.SelectedIndex = 0;
     _listIncomeAccountsQB             = Accounts.GetIncomeAccountsQB();
     for (int i = 0; i < _listIncomeAccountsQB.Count; i++)
     {
         comboIncomeAccountQB.Items.Add(_listIncomeAccountsQB[i]);
     }
     comboIncomeAccountQB.SelectedIndex = 0;
 }
Beispiel #2
0
 private void FormDepositEdit_Load(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         if (!Security.IsAuthorized(Permissions.DepositSlips, DateTime.Today))
         {
             //we will check the date again when saving
             DialogResult = DialogResult.Cancel;
             return;
         }
     }
     else
     {
         //We enforce security here based on date displayed, not date entered
         if (!Security.IsAuthorized(Permissions.DepositSlips, DepositCur.DateDeposit))
         {
             butOK.Enabled     = false;
             butDelete.Enabled = false;
         }
     }
     if (IsNew)
     {
         textDateStart.Text = PIn.Date(PrefC.GetString(PrefName.DateDepositsStarted)).ToShortDateString();
         if (PrefC.GetBool(PrefName.EasyNoClinics))
         {
             comboClinic.Visible = false;
             labelClinic.Visible = false;
         }
         comboClinic.Items.Clear();
         comboClinic.Items.Add(Lan.g(this, "all"));
         comboClinic.SelectedIndex = 0;
         for (int i = 0; i < Clinics.List.Length; i++)
         {
             comboClinic.Items.Add(Clinics.List[i].Description);
         }
         for (int i = 0; i < DefC.Short[(int)DefCat.PaymentTypes].Length; i++)
         {
             listPayType.Items.Add(DefC.Short[(int)DefCat.PaymentTypes][i].ItemName);
             listPayType.SetSelected(i, true);
         }
         textDepositAccount.Visible = false;              //this is never visible for new. It's a description if already attached.
         if (Accounts.DepositsLinked())
         {
             if (PrefC.GetInt(PrefName.AccountingSoftware) == (int)AccountingSoftware.QuickBooks)
             {
                 DepositAccountsQB = Accounts.GetDepositAccountsQB();
                 for (int i = 0; i < DepositAccountsQB.Count; i++)
                 {
                     comboDepositAccount.Items.Add(DepositAccountsQB[i]);
                 }
             }
             else
             {
                 DepositAccounts = Accounts.GetDepositAccounts();
                 for (int i = 0; i < DepositAccounts.Length; i++)
                 {
                     comboDepositAccount.Items.Add(Accounts.GetDescript(DepositAccounts[i]));
                 }
             }
             comboDepositAccount.SelectedIndex = 0;
         }
         else
         {
             labelDepositAccount.Visible = false;
             comboDepositAccount.Visible = false;
         }
     }
     else
     {
         groupSelect.Visible   = false;
         gridIns.SelectionMode = GridSelectionMode.None;
         gridPat.SelectionMode = GridSelectionMode.None;
         //we never again let user change the deposit linking again from here.
         //They need to detach it from within the transaction
         //Might be enhanced later to allow, but that's very complex.
         Transaction trans = Transactions.GetAttachedToDeposit(DepositCur.DepositNum);
         if (trans == null)
         {
             labelDepositAccount.Visible = false;
             comboDepositAccount.Visible = false;
             textDepositAccount.Visible  = false;
         }
         else
         {
             comboDepositAccount.Enabled = false;
             labelDepositAccount.Text    = Lan.g(this, "Deposited into Account");
             List <JournalEntry> jeL = JournalEntries.GetForTrans(trans.TransactionNum);
             for (int i = 0; i < jeL.Count; i++)
             {
                 if (Accounts.GetAccount(jeL[i].AccountNum).AcctType == AccountType.Asset)
                 {
                     comboDepositAccount.Items.Add(Accounts.GetDescript(jeL[i].AccountNum));
                     comboDepositAccount.SelectedIndex = 0;
                     textDepositAccount.Text           = jeL[i].DateDisplayed.ToShortDateString()
                                                         + " " + jeL[i].DebitAmt.ToString("c");
                     break;
                 }
             }
         }
     }
     textDate.Text            = DepositCur.DateDeposit.ToShortDateString();
     textAmount.Text          = DepositCur.Amount.ToString("F");
     textBankAccountInfo.Text = DepositCur.BankAccountInfo;
     FillGrids();
     if (IsNew)
     {
         gridPat.SetSelected(true);
         gridIns.SetSelected(true);
     }
     ComputeAmt();
 }