backend/models/search/UserPaymentsSearch.php
/**
     * Function returns dataProvider (statistics for UserPayments)
     *
     * @return SqlDataProvider
     */
Function returns dataProvider (statistics for UserPayments)
@return SqlDataProvider
Function returns dataProvider ( statistics for UserPayments ) @return SqlDataProvider
public function totalStatistic()
    {
        $sql = "
            SELECT count(*) as cnt, 'day' as period, 1 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :today_begin AND :today_end)
            AND (pay_status = :pay_status)
              UNION
            SELECT count(*) as cnt, 'week' as period, 2 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :week_begin AND :week_end)
            AND (pay_status = :pay_status)
              UNION
            SELECT count(*) as cnt, 'mnth' as period, 3 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :mnth_begin AND :mnth_end)
            AND (pay_status = :pay_status)
            ORDER BY sortf
        ";
        $params = Functions::dateInfo();
        $params['pay_status'] = self::STATUS_PAID;
        $dataProvider = new SqlDataProvider([
            'sql' => $sql,
            'params' => $params,
            'pagination' => false,
        ]);
        return $dataProvider;
    }
public function totalStatistic ( ) { $ sql = " 
            SELECT count(*) as cnt, 'day' as period, 1 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :today_begin AND :today_end)
            AND (pay_status = :pay_status)
              UNION
            SELECT count(*) as cnt, 'week' as period, 2 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :week_begin AND :week_end)
            AND (pay_status = :pay_status)
              UNION
            SELECT count(*) as cnt, 'mnth' as period, 3 as sortf
            FROM {{%user_payments}}
            WHERE (pay_date BETWEEN :mnth_begin AND :mnth_end)
            AND (pay_status = :pay_status)
            ORDER BY sortf
         " ; $ params = Functions :: dateInfo ( ) ; $ params [ 'pay_status' ] = self :: STATUS_PAID ; $ dataProvider = new SqlDataProvider ( [ 'sql' => $ sql , 'params' => $ params , 'pagination' => false , ] ) ; return $ dataProvider ; }
Function returns dataProvider (statistics for UserPayments)
 @return SqlDataProvider
Function returns dataProvider ( statistics for UserPayments ) @return SqlDataProvider
/*
            'sort'=> [
                'attributes' => [
                    'cnt',
                    'period',
                ]
            ],
            */