SimpleCard

The example shows how to use SimpleCard of Amazing Theme

45,000
Page views / month
230
Conversions
$7,500
Revenue
$2,484
Cost
45,000
Page views / month
230
Conversions
$7,500
Revenue
$2,484
Cost

Note: You can show card with value queried from database like below example

$8,853,839
Revenue

Introduction

This example shows how to use Amazing Theme's SimpleCard. The card is extremely useful when you want to show a single meaningful KPI. The simple card has 5 color preset prumary, success, warning, danger and info that you can use instantly. Still if you want to use your own color, you can use cssClass and cssStyle properties to set. It is very flexible.

Another nice feature of SimpleCard or other kinds of card that you can directly input value from SQL query for example:

<?php
\koolreport\amazing\SimpleCard::create(array(
    ...
    "value"=>$this->src("automaker")->query("SELECT SUM(amount) FROM payments"),
    ...
));
?>
<?php
require_once "MyReport.php";

$report = new MyReport;
$report->run()->render();
<?php
require_once "../../../load.koolreport.php";

class MyReport extends \koolreport\KoolReport
{
    use \koolreport\amazing\Theme;
    public function settings()
    {
        $config = include "../../../config.php";

        return array(
            "dataSources"=>array(
                "automaker"=>$config["automaker"]
            )
        );
    }
}
<?php
    use \koolreport\amazing\SimpleCard;
?>
<div class="report-content" style="padding:15px">
    <div class="text-center">
        <h1>SimpleCard</h1>
        <p class="lead">
            The example shows how to use SimpleCard of Amazing Theme
        </p>
    </div>
    <div class="row">
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Page views / month",
            "value"=>45000,
            "preset"=>"warning",
            "cssClass"=>array(
                "icon"=>"fa fa-eye"
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Conversions",
            "value"=>230,
            "preset"=>"primary",
            "cssClass"=>array(
                "icon"=>"fa fa-shopping-cart"
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Revenue",
            "value"=>7500,
            "preset"=>"success",
            "format"=>array(
                "value"=>array(
                    "prefix"=>"$"
                )
            ),
            "cssClass"=>array(
                "icon"=>"fa fa-dollar"
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Cost",
            "preset"=>"danger",
            "value"=>2484,
            "format"=>array(
                "value"=>array(
                    "prefix"=>"$"
                )
            ),
            "cssClass"=>array(
                "icon"=>"fa fa-dollar"
            ),
        ));
        ?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Page views / month",
            "value"=>45000,
            "preset"=>"warning",
            "cssClass"=>array(
                "icon"=>"fa fa-eye",
                "card"=>"p-3",
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Conversions",
            "value"=>230,
            "preset"=>"primary",
            "cssClass"=>array(
                "icon"=>"fa fa-shopping-cart",
                "card"=>"p-3",
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Revenue",
            "value"=>7500,
            "preset"=>"success",
            "format"=>array(
                "value"=>array(
                    "prefix"=>"$"
                )
            ),
            "cssClass"=>array(
                "icon"=>"fa fa-dollar",
                "card"=>"p-3",
            ),
        ));
        ?>
        </div>
        <div class="col-md-3">
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Cost",
            "preset"=>"danger",
            "value"=>2484,
            "format"=>array(
                "value"=>array(
                    "prefix"=>"$"
                )
            ),
            "cssClass"=>array(
                "icon"=>"fa fa-dollar",
                "card"=>"p-3",
            ),
        ));
        ?>
        </div>
    </div>

    <p>
    <b>Note:</b> You can show card with value queried from database like below example
    </p>
    
    <div class='row'>
        <div class='col-md-3'>
        <?php
        \koolreport\amazing\SimpleCard::create(array(
            "title"=>"Revenue",
            "value"=>$this->src("automaker")->query("select sum(amount) from payments"),
            "preset"=>"success",
            "format"=>array(
                "value"=>array(
                    "prefix"=>"$"
                )
            ),
            "cssClass"=>array(
                "icon"=>"fa fa-dollar",
            ),
        ));
        ?>
        </div>
    </div>

</div>

What People Are Saying

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
-- Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
-- Dr. Lew Choy Onn

"Fantastic framework for reporting!"
-- Greg Schneider

Download KoolReport Get KoolReport Pro