Beispiel #1
0
        ///////////////////////////////////////////////////////////////////////
        // Private functions
        ///////////////////////////////////////////////////////////////////////
        private void setAccountBalance()
        {
            FFDataSet.LineItemRow[] lines    = MyData.getInstance().Account.FindByid(this.AccountID).GetLineItemRows();
            FFDataSet.BankInfoRow   bankInfo = MyData.getInstance().BankInfo.FindByaccountID(this.AccountID);
            decimal cSum   = 0.0m;
            decimal dSum   = 0.0m;
            bool    lineCD = LineCD.DEBIT; // default

            foreach (FFDataSet.LineItemRow line in lines)
            {
                if (line.creditDebit == LineCD.CREDIT)
                {
                    cSum += line.amount;
                }
                else
                {
                    dSum += line.amount;
                }
            }


            if (bankInfo != null && bankInfo.creditDebit == LineCD.CREDIT)
            {
                lineCD = LineCD.CREDIT;
            }

            if (lineCD == LineCD.DEBIT)
            {
                Balance = dSum - cSum;
            }
            else
            {
                Balance = cSum - dSum;
            }
        }
        public AccountBankModel()
        {
            this.accountRow = MyData.getInstance().Account.NewAccountRow();
            MyData.getInstance().Account.AddAccountRow(this.accountRow);
            MyData.getInstance().saveRow(this.accountRow);

            this.bankInfoRow = null;
        }
        private void BankInfo_TableNewRow(object sender, System.Data.DataTableNewRowEventArgs e)
        {
            FFDataSet.BankInfoRow row = e.Row as FFDataSet.BankInfoRow;

            // account id needs to be set by the funcion getting the new line.  row.accountID = SpclAccount.NULL;
            row.bankID        = SpclBank.NULL;
            row.accountNumber = "";
            row.creditDebit   = LineCD.DEBIT;
        }
Beispiel #4
0
        public FFDataSet.BankInfoRow NewBankInfoRow(FFDataSet.AccountRow account)
        {
            FFDataSet.BankInfoRow newRow = ffDataSet.BankInfo.NewBankInfoRow();

            newRow.accountID     = account.id;
            newRow.bankID        = BankCON.NULL.ID;
            newRow.accountNumber = "";
            newRow.polarity      = PolarityCON.DEBIT.Value;

            ffDataSet.BankInfo.AddBankInfoRow(newRow);

            return(newRow);
        }
        ///////////////////////////////////////////////////////////////////////
        // Private functions
        ///////////////////////////////////////////////////////////////////////
        private void calcAccountBalance()
        {
            DateTime today = DateTime.Today;
            decimal  tBal  = 0.0m;
            decimal  bal   = 0.0m;
            bool     cd    = LineCD.DEBIT;

            FFDataSet.BankInfoRow bInfo = MyData.getInstance().BankInfo.FindByaccountID(this.currentAccountID);
            LineItemRegModel      line;

            if (bInfo != null)
            {
                cd = bInfo.creditDebit;
            }

            if (cd == LineCD.DEBIT)
            {
                for (int i = 0; i < this.RegistryLines.Count; i++)
                {
                    line = this.RegistryLines[i];
                    bal  = (line.CreditDebit) ? bal += line.Amount : bal -= line.Amount;
                    line.BalanceAmount = bal;

                    if (line.Date <= today)
                    {
                        tBal = bal;
                    }
                }
            }
            else
            {
                for (int i = 0; i < this.RegistryLines.Count; i++)
                {
                    line = this.RegistryLines[i];
                    bal  = (line.CreditDebit) ? bal -= line.Amount : bal += line.Amount;
                    line.BalanceAmount = bal;

                    if (line.Date <= today)
                    {
                        tBal = bal;
                    }
                }
            }

            this.EndingBalance = bal;
            this.TodaysBalance = tBal;
        }
Beispiel #6
0
 public AccountDRM(FFDataSet.AccountRow accountRow, FFDataSet.BankInfoRow bankRow)
 {
     this.accountRow  = accountRow;
     this.bankInfoRow = bankRow;
 }
Beispiel #7
0
 ///////////////////////////////////////////////////////////////////////
 // Public functions
 ///////////////////////////////////////////////////////////////////////
 public AccountDRM()
 {
     this.accountRow  = DataSetModel.Instance.NewAccountRow();
     this.bankInfoRow = null;
 }
 public AccountBankModel(FFDataSet.AccountRow aRow)
 {
     this.accountRow  = aRow;
     this.bankInfoRow = MyData.getInstance().BankInfo.FindByaccountID(this.ID);
 }
        ///////////////////////////////////////////////////////////////////////
        // Private functions
        ///////////////////////////////////////////////////////////////////////



        ///////////////////////////////////////////////////////////////////////
        // Public functions
        ///////////////////////////////////////////////////////////////////////
        public AccountBankModel(int aID)
        {
            this.accountRow  = MyData.getInstance().Account.FindByid(aID);
            this.bankInfoRow = MyData.getInstance().BankInfo.FindByaccountID(aID);
        }