Esempio n. 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;
   }
 }
Esempio n. 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;
   }
 }
Esempio n. 3
0
    protected override void OnLoadObjectData(DataRow row) {
      this.number = (string) row["SupplierOrderNumber"];
      this.customerOrderNumber = (string) row["CustomerOrderNumber"];
      this.dutyEntryTag = (string) row["OrderDutyEntryTag"];
      this.concept = (string) row["SupplyOrderConcept"];
      this.supplyChannel = SupplyChannel.Parse((int) row["SupplyChannelId"]);
      this.supplyPoint = Contact.Parse((int) row["SupplyPointId"]);
      this.supplier = Contact.Parse((int) row["SupplierId"]);
      this.supplierContact = Person.Parse((int) row["SupplierContactId"]);

      this.customerContact = Person.Parse((int) row["CustomerContactId"]);
      this.deliveryMode = DeliveryMode.Parse((int) row["DeliveryModeId"]);
      this.deliveryTo = Contact.Parse((int) row["DeliveryToId"]);
      this.deliveryPoint = Contact.Parse((int) row["DeliveryPointId"]);
      this.deliveryContact = Person.Parse((int) row["DeliveryContactId"]);

      this.authorizationId = (int) row["OrderAuthorizationId"];
      this.currency = Currency.Parse((int) row["SupplyOrderCurrencyId"]);
      this.orderingTime = (DateTime) row["OrderingTime"];
      this.closedBy = Person.Parse((int) row["ClosedById"]);
      this.closingTime = (DateTime) row["ClosingTime"];
      this.canceledBy = Person.Parse((int) row["CanceledById"]);
      this.cancelationTime = (DateTime) row["CancelationTime"];
      this.keywords = (string) row["SupplyOrderKeywords"];
      this.payment = CRTransaction.Parse((int) row["CRTransactionId"]);
      this.bill = Bill.Parse((int) row["BillId"]);
      this.externalOrderId = (int) row["ExternalOrderId"];
      this.parentSupplyOrderId = (int) row["ParentSupplyOrderId"];
      this.postedBy = Contact.Parse((int) row["PostedById"]);
      this.postingTime = (DateTime) row["PostingTime"];

      this.status = (OrderStatus) Convert.ToChar(row["SupplyOrderStatus"]);

      if (this.Status == OrderStatus.Opened) {
        this.customer = BaseObject.ParseFull<Contact>((int) row["CustomerId"]);
      } else {
        this.customer = Contact.Parse((int) row["CustomerId"]);
      }
    }
Esempio n. 4
0
    public CRTransaction CreatePayment(decimal amount, string notes) {
      CRTransaction crt = new CRTransaction(CRTransactionType.Parse("Input.OrderPayment"), this,
                                            DateTime.Now, DateTime.Now, amount, 0m,
                                            "Pedido: " + this.Number, notes);

      //CRPosting posting = crt.CreatePosting();
      //posting.InstrumentType = instrumentType;
      //posting.InstrumentAmount = crt.Amount;
      //posting.InputAmount = crt.Amount;

      //crt.Status = TreasuryItemStatus.Closed;

      return crt;
    }
Esempio n. 5
0
    private CRTransaction CreateCancelPayment(string notes) {
      CRTransaction crt = new CRTransaction(CRTransactionType.Parse("Output.OrderPayment"), this,
                                            DateTime.Now, DateTime.Now, 0m, this.Items.Total,
                                            "Cancelación del pedido: " + this.Number, notes);

      //CRPosting posting = crt.CreatePosting();
      //posting.InstrumentType = instrumentType;
      //posting.InstrumentAmount = crt.Amount;
      //posting.InputAmount = crt.Amount;

      //crt.Status = TreasuryItemStatus.Closed;

      return crt;
    }
Esempio n. 6
0
 public void AppendPayment(CRTransaction crTransaction) {
   this.Payment = crTransaction;
 }
Esempio n. 7
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"]);
 }
Esempio n. 8
0
    public AccountTransaction DoPayment(CRTransaction crTransaction) {
      string summary = String.Empty;
      FinancialConcept concept = FinancialConcept.Parse("FSP001");
      AccountTransaction accountTransaction = AccountTransaction.CreateDebit(this, concept, crTransaction.Collector, crTransaction.CashRegister,
                                                                             crTransaction.TransactionDate, crTransaction.InputAmount,
                                                                             0m, crTransaction.Summary, crTransaction.Notes, -1);


      //if (document != null) {
      //  crTransaction = this.DoCreditAccountPayment(accountTransaction, document, summary, notes);
      //} else {
      //  crTransaction = this.DoCreditAccountPayment(accountTransaction, instrumentType, summary, notes);
      //}
      crTransaction.ReferenceId = accountTransaction.Id;
      crTransaction.ReferenceTag = this.AccountNumber;
      using (DataWriterContext context = DataWriter.CreateContext("OnCreateFSMTransaction")) {
        ITransaction transaction = context.BeginTransaction();

        accountTransaction.Save();
        crTransaction.Close();
        accountTransaction.CRTransactionId = crTransaction.Id;
        context.Add(AccountTransactionData.GetWriteAccountTransaction(accountTransaction));
        context.Update();
        transaction.Commit();
      }
      FinancialAccountData.UpdateAccountsTable(this.Id);

      return accountTransaction;
    }
Esempio n. 9
0
    public CRTransaction CreatePayment(Contact collector, DateTime transactionDate,
                                       DateTime dueDate, decimal amount, string notes) {
      CRTransaction crt = new CRTransaction(CRTransactionType.Parse("Input.CreditPayment"), this,
                                            transactionDate, dueDate, amount, 0m,
                                            "Pago a cuenta de crédito: " + this.AccountNumber, notes);
      crt.Collector = collector;
      //CRPosting posting = crt.CreatePosting();
      //posting.InstrumentType = instrumentType;
      //posting.InstrumentAmount = crt.Amount;
      //posting.InputAmount = crt.Amount;

      //crt.Status = TreasuryItemStatus.Closed;

      return crt;
    }