Exemple #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;
 }
Exemple #2
0
 private void FormDepositEdit_Load(object sender, System.EventArgs e)
 {
     butSendQB.Visible = false;
     IsQuickBooks      = PrefC.GetInt(PrefName.AccountingSoftware) == (int)AccountingSoftware.QuickBooks;
     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() && !IsQuickBooks)
         {
             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              //Not new.
     {
         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;
                 }
             }
         }
     }
     if (IsQuickBooks)             //If in QuickBooks mode, always show deposit and income accounts so that users can send old deposits into QB.
     {
         labelIncomeAccountQB.Visible = true;
         comboIncomeAccountQB.Visible = true;
         comboIncomeAccountQB.Items.Clear();
         textDepositAccount.Visible  = false;
         labelDepositAccount.Visible = true;
         labelDepositAccount.Text    = Lan.g(this, "Deposit into Account");
         comboDepositAccount.Visible = true;
         comboDepositAccount.Enabled = true;
         comboDepositAccount.Items.Clear();
         if (Accounts.DepositsLinked())
         {
             if (!IsNew)
             {
                 butSendQB.Visible = true;
             }
             DepositAccountsQB = Accounts.GetDepositAccountsQB();
             for (int i = 0; i < DepositAccountsQB.Count; i++)
             {
                 comboDepositAccount.Items.Add(DepositAccountsQB[i]);
             }
             comboDepositAccount.SelectedIndex = 0;
             IncomeAccountsQB = Accounts.GetIncomeAccountsQB();
             for (int i = 0; i < IncomeAccountsQB.Count; i++)
             {
                 comboIncomeAccountQB.Items.Add(IncomeAccountsQB[i]);
             }
             comboIncomeAccountQB.SelectedIndex = 0;
         }
     }
     textDate.Text            = DepositCur.DateDeposit.ToShortDateString();
     textAmount.Text          = DepositCur.Amount.ToString("F");
     textBankAccountInfo.Text = DepositCur.BankAccountInfo;
     textMemo.Text            = DepositCur.Memo;
     FillGrids();
     if (IsNew)
     {
         gridPat.SetSelected(true);
         gridIns.SetSelected(true);
     }
     ComputeAmt();
 }