Exemplo n.º 1
0
    static internal AccountTransaction CreateCredit(FinancialAccount account, FinancialConcept financialConcept, Organization organization,
                                                    DateTime transactionDate, decimal amount, decimal taxes, string summary, string notes,
                                                    int referenceId) {
      AccountTransaction transaction = new AccountTransaction(account, financialConcept);
      transaction.organization = organization;
      transaction.transactionDate = transactionDate;
      transaction.amount = amount;
      transaction.taxes = taxes;
      transaction.credit = amount;
      transaction.debit = 0m;
      transaction.summary = summary;
      transaction.notes = notes;
      transaction.referenceId = referenceId;

      return transaction;
    }
Exemplo n.º 2
0
    static internal AccountTransaction CreateDebit(FinancialAccount account, FinancialConcept financialConcept,
                                                   Contact collector, CashRegister cashRegister, DateTime transactionDate,
                                                   decimal amount, decimal taxes, string summary, string notes, int referenceId) {
      AccountTransaction transaction = new AccountTransaction(account, financialConcept);
      transaction.appliedToId = -1;
      transaction.transactionDate = transactionDate;
      transaction.collectedBy = collector;
      transaction.organization = cashRegister.Organization;

      transaction.amount = amount;
      transaction.taxes = taxes;
      transaction.credit = 0m;
      transaction.debit = amount;
      transaction.notes = notes;
      transaction.summary = summary;
      transaction.referenceId = referenceId;

      return transaction;
    }
Exemplo n.º 3
0
 protected AccountTransaction(FinancialAccount account, FinancialConcept concept) {
   this.financialAccount = account;
   this.financialConcept = concept;
 }
Exemplo n.º 4
0
 protected override void OnLoadObjectData(DataRow row) {
   this.financialAccount = FinancialAccount.Parse((int) row["FinancialAccountId"]);
   this.financialConcept = FinancialConcept.Parse((int) row["FinancialConceptId"]);
   this.organization = Organization.Parse((int) row["OrganizationId"]);
   this.appliedToId = (int) row["AppliedToId"];
   this.collectedBy = Contact.Parse((int) row["CollectedById"]);
   this.referenceId = (int) row["ReferenceId"];
   this.summary = (string) row["Summary"];
   this.notes = (string) row["Notes"];
   this.authorizationId = (int) row["AuthorizationId"];
   this.transactionDate = (DateTime) row["TransactionDate"];
   this.postingDate = (DateTime) row["PostingDate"];
   this.cancelationDate = (DateTime) row["CancelationDate"];
   this.canceledById = (int) row["CanceledById"];
   this.currencyId = (int) row["CurrencyId"];
   this.amount = (decimal) row["Amount"];
   this.taxes = (decimal) row["Taxes"];
   this.credit = (decimal) row["Credit"];
   this.debit = (decimal) row["Debit"];
   this.creditBalance = (decimal) row["CreditBalance"];
   this.crTransactionId = (int) row["CRTransactionId"];
   this.postedBy = Contact.Parse((int) row["PostedById"]);
   this.status = (string) row["TransactionStatus"];
 }
Exemplo n.º 5
0
 static private decimal GetTaxPercentage(FinancialConcept financialConcept) {
   if (financialConcept.Id >= 25) {
     return 0.16m;
   } else {
     return 0m;
   }
 }
Exemplo n.º 6
0
    public AccountTransaction CreateConcept(FinancialConcept concept, CashRegister cashRegister, DateTime transactionDate,
                                            decimal amount, string summary, string notes, int referenceId) {
      AccountTransaction transaction = null;
      if (concept.AppliesToCredit) {
        transaction = AccountTransaction.CreateCredit(this, concept, cashRegister.Organization, transactionDate,
                                                      amount, (amount - (amount / 1.16m)), summary, notes, referenceId);
      } else if (concept.AppliesToDebit) {
        transaction = AccountTransaction.CreateDebit(this, concept, Person.Empty, cashRegister, transactionDate,
                                                     amount, (amount - (amount / 1.16m)), summary, notes, referenceId);
      }
      transaction.Save();

      return transaction;
    }