This topic is locked

Totals in a progress bar

11/22/2015 9:11:21 AM
PHPRunner Tips and Tricks
F
fantasmino author

This is a progress bar where you can set a container in volume or kg etc.. on the list page.

insert a php code snippet:

global $dal;

$sql = "select SUM(DECIMAL(VOLUME,10,3)) AS TOT from mytable where status='READY' ";
$rs = CustomQuery($sql);
while ($data = db_fetch_array($rs))
{

$TOT=$data["TOT"]/65*100;

$TOT20=$data["TOT"]/27*100;

echo "<div class='progress'>

<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='70'

aria-valuemin='0' aria-valuemax='100' style='width:".ROUND($TOT)."%'>

<span class='sr-only'> ".ROUND($TOT)."% Complete </span>

</div>

</div>";

echo "<div class='progress'>

<div class='progress-bar progress-bar-info' role='progressbar' aria-valuenow='70'

aria-valuemin='0' aria-valuemax='100' style='width:".ROUND($TOT20)."%'>

<span class='sr-only'>".ROUND($TOT20)."% Complete </span>

</div>

</div>";
}
;



CSS

if you already use bootstrap css you are ok

otherwise this is a part of bootstrap css for progressive bar to add in custom css

.progress {

height: 20px;

margin-bottom: 20px;

overflow: hidden;

background-color: #f5f5f5;

border-radius: 4px;

-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);

box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);

}

.progress-bar {

float: left;

width: 0;

height: 100%;

font-size: 12px;

line-height: 20px;

color: #fff;

text-align: LEFT;

background-color: #337ab7;

-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);

box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);

-webkit-transition: width .6s ease;

-o-transition: width .6s ease;

transition: width .6s ease;

}

.progress-striped .progress-bar,

.progress-bar-striped {

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

-webkit-background-size: 40px 40px;

background-size: 40px 40px;

}

.progress.active .progress-bar,

.progress-bar.active {

-webkit-animation: progress-bar-stripes 2s linear infinite;

-o-animation: progress-bar-stripes 2s linear infinite;

animation: progress-bar-stripes 2s linear infinite;

}

.progress-bar-success {

background-color: #5cb85c;

}

.progress-striped .progress-bar-success {

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

}

.progress-bar-info {

background-color: #5bc0de;

}

.progress-striped .progress-bar-info {

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

}

.progress-bar-warning {

background-color: #f0ad4e;

}

.progress-striped .progress-bar-warning {

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

}

.progress-bar-danger {

background-color: #d9534f;

}

.progress-striped .progress-bar-danger {

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);

}



source:

More information