Beispiel #1
0
 internal CRPosting(CRTransaction transaction, InstrumentType instrumentType,
                    IFinancialAccount account, decimal amount) {
   this.transaction = transaction;
   this.instrumentType = instrumentType;
   this.instrumentId = account.Id;
   this.instrumentAmount = amount;
   if (this.transaction.TransactionType.UniqueCode.StartsWith("Input.")) {
     this.inputAmount = amount;
   } else {
     this.outputAmount = amount;
   }
 }
Beispiel #2
0
 internal CRPosting(CRTransaction transaction, InstrumentType instrumentType,
                    CRDocument document, decimal amount) {
   this.transaction = transaction;
   this.instrumentType = instrumentType;
   this.instrumentId = -1;
   this.document = document;
   this.instrumentAmount = amount;
   if (this.transaction.TransactionType.UniqueCode.StartsWith("Input.")) {
     this.inputAmount = amount;
   } else {
     this.outputAmount = amount;
   }
 }
Beispiel #3
0
 public CRTransaction(CRTransactionType transactionType,
                      BaseObject reference, DateTime transactionDate,
                      DateTime dueDate, decimal inputAmount, decimal outputAmount,
                      string summary, string notes) {
   this.transactionType = transactionType;
   this.baseInstrumentType = InstrumentType.Empty;
   this.cashRegister = CashRegister.MyCashRegister();
   this.referenceId = reference.Id;
   this.transactionDate = transactionDate;
   this.dueDate = dueDate;
   this.currencyAmount = inputAmount + outputAmount;
   this.inputAmount = inputAmount;
   this.outputAmount = outputAmount;
   this.summary = summary;
   this.notes = notes;
 }
Beispiel #4
0
    static public CRDocument CreateBankCardSlip(InstrumentType instrumentType, FinancialInstitution institution, string bankCardAccount,
                                                string voucherNumber, Contact issuedBy, DateTime issueDate, DateTime dueDate,
                                                decimal amount, string notes) {
      CRDocument document = new CRDocument(instrumentType);
      document.Institution = institution;
      document.AccountNumber = bankCardAccount;
      document.DocumentNumber = voucherNumber;
      document.IssuedBy = issuedBy;
      document.IssuedTo = CashRegister.MyCashRegister().Organization;
      document.IssueDate = issueDate;
      document.DueDate = dueDate;
      document.Amount = amount;
      document.Notes = notes;
      document.Status = TreasuryItemStatus.Pending;

      return document;
    }
Beispiel #5
0
    public void Cancel(InstrumentType instrumentType, string notes) {
      if (this.Payment.IsEmptyInstance) {
        throw new NotImplementedException("I can't cancel this supply order using this method because " +
                                          "their payment information is empty. " +
                                          "Please use order.Cancel() method instead.");
      }
      UpdateARPStock(false);
      cancelationTime = DateTime.Now;
      canceledBy = Person.Parse(ExecutionServer.CurrentUserId);
      status = OrderStatus.Canceled;
      Save();
      CRTransaction tr = this.CreateCancelPayment(notes);

      var postings = this.Payment.Postings.FindAll((x) => (x.InstrumentId > 0));
      decimal canceledAmount = decimal.Zero;
      for (int i = 0; i < postings.Count; i++) {
        FinancialAccount account = FinancialAccount.Parse(postings[i].InstrumentId);
        account.CreateConcept(FinancialConcept.Parse("FSD005"), tr.CashRegister, DateTime.Now,
                              postings[i].InputAmount, "Pedido: " + this.Number, String.Empty, this.Id);
        tr.AppendPosting(postings[i].InstrumentType, account, postings[i].InputAmount);
        canceledAmount += postings[i].InputAmount;
      }
      if (items.Total != canceledAmount) {
        tr.AppendPosting(instrumentType, CRDocument.Empty, items.Total - canceledAmount);
      }
      tr.Close();
      bill.Cancel();
    }
Beispiel #6
0
    public CRPosting AppendPosting(InstrumentType instrumentType, IFinancialAccount account, decimal amount) {
      CRPosting posting = new CRPosting(this, instrumentType, account, amount);
      this.Postings.Add(posting);

      return posting;
    }
Beispiel #7
0
    public CRPosting AppendPosting(InstrumentType instrumentType, CRDocument document, decimal amount) {
      CRPosting posting = new CRPosting(this, instrumentType, document, amount);
      this.Postings.Add(posting);

      return posting;
    }
Beispiel #8
0
 protected override void OnLoadObjectData(DataRow row) {
   this.cashRegister = CashRegister.Parse(Organization.Parse((int) row["OrganizationId"]),
                                          Contact.Parse((int) row["CashierId"]));
   this.transactionType = CRTransactionType.Parse((int) row["TransactionTypeId"]);
   this.collector = Contact.Parse((int) row["CollectorId"]);
   this.referenceId = (int) row["ReferenceId"];
   this.referenceTag = (string) row["ReferenceTag"];
   this.financialAccountId = (int) row["FinancialAccountId"];
   this.authorizationId = (int) row["AuthorizationId"];
   this.baseInstrumentType = InstrumentType.Parse((int) row["BaseInstrumentTypeId"]);
   this.transactionDate = (DateTime) row["TransactionDate"];
   this.dueDate = (DateTime) row["DueDate"];
   this.currency = Currency.Parse((int) row["CurrencyId"]);
   this.currencyAmount = (decimal) row["CurrencyAmount"];
   this.inputAmount = (decimal) row["InputAmount"];
   this.outputAmount = (decimal) row["OutputAmount"];
   this.summary = (string) row["Summary"];
   this.notes = (string) row["Notes"];
   this.keywords = (string) row["TransactionKeywords"];
   this.postedBy = Contact.Parse((int) row["PostedById"]);
   this.postingTime = (DateTime) row["PostingTime"];
   this.canceledBy = Contact.Parse((int) row["CanceledById"]);
   this.cancelationTime = (DateTime) row["CancelationTime"];
   this.status = (TreasuryItemStatus) Convert.ToChar(row["TransactionStatus"]);
 }
Beispiel #9
0
    static public CRDocument CreateBankDepositSlip(InstrumentType instrumentType, int accountId, string reference, Contact issuedBy,
                                                   DateTime dueDate, decimal amount, string notes) {
      CRDocument document = new CRDocument(instrumentType);
      if (accountId == 1) {
        document.Institution = FinancialInstitution.Parse(51);
        document.AccountNumber = "0482079690";
      } else if (accountId == 2) {
        document.Institution = FinancialInstitution.Parse(57);
        document.AccountNumber = "12381918";
      }
      document.DocumentNumber = reference;
      document.IssuedBy = issuedBy;
      document.IssuedTo = CashRegister.MyCashRegister().Organization;
      document.DueDate = dueDate;
      document.Amount = amount;
      document.Notes = notes;
      document.Status = TreasuryItemStatus.Pending;

      return document;
    }
Beispiel #10
0
 internal CRDocument(InstrumentType type) {
   this.instrumentType = type;
 }
Beispiel #11
0
 protected override void OnLoadObjectData(DataRow row) {
   this.instrumentType = InstrumentType.Parse((int) row["InstrumentTypeId"]);
   this.institution = FinancialInstitution.Parse((int) row["InstitutionId"]);
   this.accountId = (int) row["FinancialAccountId"];
   this.accountNumber = (string) row["AccountNumber"];
   this.documentNumber = (string) row["DocumentNumber"];
   this.issuedBy = Contact.Parse((int) row["IssuedById"]);
   this.issuedTo = Contact.Parse((int) row["IssuedToId"]);
   this.issueDate = (DateTime) row["IssueTime"];
   this.dueDate = (DateTime) row["DueDate"];
   this.cancelationTime = (DateTime) row["CancelationTime"];
   this.notes = (string) row["Notes"];
   this.keywords = (string) row["Keywords"];
   this.currency = Currency.Parse((int) row["CurrencyId"]);
   this.amount = (decimal) row["Amount"];
   this.postedBy = Contact.Parse((int) row["PostedById"]);
   this.canceledBy = Contact.Parse((int) row["CanceledById"]);
   this.status = (TreasuryItemStatus) Convert.ToChar(row["DocumentStatus"]);
 }
Beispiel #12
0
 protected override void OnLoadObjectData(DataRow row) {
   this.transaction = CRTransaction.Parse((int) row["TransactionId"]);
   this.instrumentType = InstrumentType.Parse((int) row["InstrumentTypeId"]);
   this.instrumentId = (int) row["InstrumentId"];
   this.document = CRDocument.Parse((int) row["DocumentId"]);
   this.currency = Currency.Parse((int) row["CurrencyId"]);
   this.instrumentAmount = (decimal) row["CurrencyAmount"];
   this.inputAmount = (decimal) row["InputAmount"];
   this.outputAmount = (decimal) row["OutputAmount"];
   this.status = (TreasuryItemStatus) Convert.ToChar(row["PostingStatus"]);
 }
Beispiel #13
0
    public CRDocument CreateDocument(InstrumentType instrumentType) {
      this.document = new CRDocument(instrumentType);

      return this.Document;
    }