Beispiel #1
0
 private static OCurrency GetValue(TellerEvent eventItem, ContractAccountingRule rule)
 {
     OCurrency amount = 0;
     if (rule.EventAttribute.Name.ToLower() == "amount")
     {
         amount = eventItem.Amount;
     }
     return amount;
 }
Beispiel #2
0
 public void AddTellerEvent(TellerEvent tellerEvent, SqlTransaction sqlTransaction)
 {
     const string sql =
         @"INSERT INTO [dbo].[TellerEvents]
                ([teller_id]
                ,[event_code]
                ,[amount]
                ,[date]
                ,[description])
          VALUES
                (
        	            @teller_id
                ,@event_code
                ,@amount
                ,@date
                ,@description
                )";
     using (OpenCbsCommand cmd  = new OpenCbsCommand(sql, sqlTransaction.Connection, sqlTransaction))
     {
         cmd.AddParam("@teller_id", tellerEvent.TellerId);
         cmd.AddParam("@event_code", tellerEvent.Code);
         cmd.AddParam("@amount", tellerEvent.Amount);
         cmd.AddParam("@date", tellerEvent.Date);
         cmd.AddParam("@description", tellerEvent.Description);
         cmd.ExecuteNonQuery();
     }
 }
Beispiel #3
0
        private Booking GetTellerBooking(TellerEvent eventItem, List<Teller> tellers, List<FiscalYear> fiscalYears)
        {
            if (eventItem is TellerCashInEvent)
            {
                Teller teller = tellers.Find(i => i.Id == eventItem.TellerId);
                return new Booking
                    {
                         Amount = eventItem.Amount,
                         CreditAccount = teller.Account,
                         DebitAccount = teller.Vault.Account,
                         ContractId = eventItem.ContracId,
                         Date = eventItem.Date,
                         EventId = eventItem.Id,
                         RuleId = 0,
                         ExchangeRate = 1,
                         Currency = eventItem.Currency,
                         Branch = eventItem.Branch,
                         EventType = eventItem.Code,
                         Name = eventItem.Description + " [" + eventItem.Date + "]",
                         Type = OMovementType.Teller,
                         FiscalYear = fiscalYears.First(f => f.OpenDate <= eventItem.Date.Date && f.CloseDate == null || f.CloseDate > eventItem.Date.Date)
                    };
            }

            if (eventItem is TellerCashOutEvent)
            {
                Teller teller = tellers.Find(i => i.Id == eventItem.TellerId);
                return new Booking
                    {
                         Amount = eventItem.Amount,
                         CreditAccount = teller.Vault.Account,
                         DebitAccount = teller.Account,
                         ContractId = eventItem.ContracId,
                         Date = eventItem.Date,
                         EventId = eventItem.Id,
                         RuleId = 0,
                         ExchangeRate = 1,
                         Currency = eventItem.Currency,
                         Branch = eventItem.Branch,
                         EventType = eventItem.Code,
                         Name = eventItem.Description + " [" + eventItem.Date + "]",
                         Type = OMovementType.Teller,
                         FiscalYear = fiscalYears.First(f => f.OpenDate <= eventItem.Date.Date && f.CloseDate == null || f.CloseDate > eventItem.Date.Date)
                    };
            }
            return null;
        }