Пример #1
0
        static private string BuildTransactionEntriesFilter(SearchVouchersCommand command, string nestedFilter)
        {
            if (command.AccountKeywords.Length == 0 && command.SubledgerAccountKeywords.Length == 0)
            {
                return(string.Empty);
            }
            string filter = string.Empty;

            if (command.AccountKeywords.Length != 0)
            {
                filter = SearchExpression.ParseAndLikeKeywords("CUENTA_ESTANDAR_KEYWORDS",
                                                               command.AccountKeywords);
            }
            if (command.SubledgerAccountKeywords.Length != 0)
            {
                if (filter.Length != 0)
                {
                    filter += " AND ";
                }
                filter += SearchExpression.ParseAndLikeKeywords("CUENTA_AUXILIAR_KEYWORDS",
                                                                command.SubledgerAccountKeywords);
            }

            if (nestedFilter.Length != 0)
            {
                return($"ID_TRANSACCION IN (SELECT ID_TRANSACCION FROM VW_COF_MOVIMIENTO_SEARCH WHERE ({nestedFilter} AND {filter}))");
            }
            else
            {
                return($"ID_TRANSACCION IN (SELECT ID_TRANSACCION FROM VW_COF_MOVIMIENTO_SEARCH WHERE {filter})");
            }
        }
Пример #2
0
        static private string BuildLedgerFilter(SearchVouchersCommand command)
        {
            string filter = string.Empty;

            if (command.LedgerUID.Length != 0)
            {
                var ledger = Ledger.Parse(command.LedgerUID);

                filter += $"ID_MAYOR = {ledger.Id}";

                return(filter);
            }

            if (command.AccountsChartUID.Length != 0)
            {
                var accountsChart = AccountsChart.Parse(command.AccountsChartUID);
                if (filter.Length != 0)
                {
                    filter += " AND ";
                }
                filter += $"ID_TIPO_CUENTAS_STD = {accountsChart.Id}";
            }

            return(filter);
        }
Пример #3
0
 static internal string MapToSortString(this SearchVouchersCommand command)
 {
     if (command.OrderBy.Length != 0)
     {
         return(command.OrderBy);
     }
     else
     {
         return("ID_MAYOR, NUMERO_TRANSACCION DESC");
     }
 }
Пример #4
0
        static private string BuildVoucherTypeFilter(SearchVouchersCommand command)
        {
            if (command.VoucherTypeUID.Length == 0)
            {
                return(string.Empty);
            }

            var vocherType = VoucherType.Parse(command.VoucherTypeUID);

            return($"ID_TIPO_POLIZA = {vocherType.Id}");
        }
Пример #5
0
        static private string BuildTransactionTypeFilter(SearchVouchersCommand command)
        {
            if (command.TransactionTypeUID.Length == 0)
            {
                return(string.Empty);
            }

            var transactionType = TransactionType.Parse(command.TransactionTypeUID);

            return($"ID_TIPO_TRANSACCION = {transactionType.Id}");
        }
Пример #6
0
        static private string BuildDateRangerFilter(SearchVouchersCommand command)
        {
            if (command.DateSearchField == DateSearchField.None)
            {
                return(string.Empty);
            }

            string filter = $"'{CommonMethods.FormatSqlDate(command.FromDate)}' <= @DATE_FIELD@ AND " +
                            $"@DATE_FIELD@ < '{CommonMethods.FormatSqlDate(command.ToDate.Date.AddDays(1))}'";

            if (command.DateSearchField == DateSearchField.AccountingDate)
            {
                return(filter.Replace("@DATE_FIELD@", "FECHA_AFECTACION"));
            }
            else if (command.DateSearchField == DateSearchField.RecordingDate)
            {
                return(filter.Replace("@DATE_FIELD@", "FECHA_REGISTRO"));
            }
            else
            {
                throw Assertion.AssertNoReachThisCode();
            }
        }
Пример #7
0
        static internal string MapToFilterString(this SearchVouchersCommand command)
        {
            string ledgerFilter          = BuildLedgerFilter(command);
            string dateRangeFilter       = BuildDateRangerFilter(command);
            string transactionTypeFilter = BuildTransactionTypeFilter(command);
            string voucherTypeFilter     = BuildVoucherTypeFilter(command);
            string stageStatusFilter     = BuildStageStatusFilter(command);
            string keywordsFilter        = BuildKeywordsFilter(command.Keywords);

            var filter = new Filter(ledgerFilter);

            filter.AppendAnd(dateRangeFilter);
            filter.AppendAnd(transactionTypeFilter);
            filter.AppendAnd(voucherTypeFilter);
            filter.AppendAnd(stageStatusFilter);
            filter.AppendAnd(keywordsFilter);

            string transactionEntriesFilter = BuildTransactionEntriesFilter(command, filter.ToString());

            filter.AppendAnd(transactionEntriesFilter);

            return(filter.ToString());
        }
Пример #8
0
 static internal void EnsureIsValid(this SearchVouchersCommand command)
 {
     // no-op
 }
Пример #9
0
 static private string BuildStageStatusFilter(SearchVouchersCommand command)
 {
     return(string.Empty);
 }