Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andjelko committed Sep 19, 2016
0 parents commit b2f00e9
Show file tree
Hide file tree
Showing 316 changed files with 99,372 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Dolphin]
Timestamp=2016,9,19,10,47,7
Version=3
58 changes: 58 additions & 0 deletions IReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace andjelko\ireport;

use Yii;
use yii\base\Component;

#include_once(dirname(__FILE__) . '/IReportParser.php');
#include_once(dirname(__FILE__) . '/IReportRender.php');
#
use andjelko\ireport\IReportParser;
use andjelko\ireport\IReportRender;
include_once(dirname(__FILE__) . '/IReportProvider.php');
use IReportProvider;
use IReportProviderDB;


//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

class IReport extends Component{

private $reportparser;
public $debug = false;

public function init()
{
parent::init();
$this->reportparser = new IReportParser;
$this->reportparser->parser(simplexml_load_file($fileReport));
}

public function __construct($fileReport) {

$this->reportparser = new IReportParser;
$this->reportparser->parser(simplexml_load_file($fileReport));
}

public function getParameters() {
return $this->reportparser->parameters;
}

public function setParameters($value) {
$this->reportparser->parameters = $value;
}

public function execute($outpage = 'D',$filename='report_name.pdf') {
$this->reportparser->debugsql = $this->debug;
$IRender = new IReportRender($this->reportparser);
$IRender->debuggroup = $this->debug;
$IRender->provider = new IReportProviderDB(Yii::$app->db);
$IRender->outpage = $outpage;
$IRender->filename = $filename;
$IRender->execute();
}

}

?>
85 changes: 85 additions & 0 deletions IReportHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace andjelko\ireport;

class IReportHelper {

public static function time_to_sec($time) {
$hours = substr($time, 0, -6);
$minutes = substr($time, -5, 2);
$seconds = substr($time, -2);

return $hours * 3600 + $minutes * 60 + $seconds;
}

public static function sec_to_time($seconds) {
$hours = floor($seconds / 3600);
$minutes = floor($seconds % 3600 / 60);
$seconds = $seconds % 60;

return sprintf("%d:%02d:%02d", $hours, $minutes, $seconds);
}

public static function formatText($txt, $pattern) {
if (is_double($txt)) {
if ($pattern == "###0")
return number_format($txt, 0, "", "");
elseif ($pattern == "#,##0")
return number_format($txt, 0, ".", ",");
elseif ($pattern == "###0.0")
return number_format($txt, 1, ".", "");
elseif ($pattern == "#,##0.0")
return number_format($txt, 1, ".", ",");
elseif ($pattern == "###0.00")
return number_format($txt, 2, ".", "");
elseif ($pattern == "#,##0.00")
return number_format($txt, 2, ".", ",");
elseif ($pattern == "###0.000")
return number_format($txt, 3, ".", "");
elseif ($pattern == "#,##0.000")
return number_format($txt, 3, ".", ",");
elseif ($pattern == "#,##0.0000")
return number_format($txt, 4, ".", ",");
elseif ($pattern == "###0.0000")
return number_format($txt, 4, ".", "");
}elseif ($pattern == "dd/MM/yyyy" && $txt != "")
return date("d/m/Y", strtotime($txt));
elseif ($pattern == "MM/dd/yyyy" && $txt != "")
return date("m/d/Y", strtotime($txt));
elseif ($pattern == "yyyy/MM/dd" && $txt != "")
return date("Y/m/d", strtotime($txt));
elseif ($pattern == "dd-MMM-yy" && $txt != "")
return date("d-M-Y", strtotime($txt));
elseif ($pattern == "dd-MMM-yy" && $txt != "")
return date("d-M-Y", strtotime($txt));
elseif ($pattern == "dd/MM/yyyy h.mm a" && $txt != "")
return date("d/m/Y h:i a", strtotime($txt));
elseif ($pattern == "dd/MM/yyyy HH.mm.ss" && $txt != "")
return date("d-m-Y H:i:s", strtotime($txt));
else
return $txt;
}

public static function hex_code_color($value) {
$r = hexdec(substr($value, 1, 2));
$g = hexdec(substr($value, 3, 2));
$b = hexdec(substr($value, 5, 2));
return array("r" => $r, "g" => $g, "b" => $b);
}

public static function get_first_value($value) {
return (substr($value, 0, 1));
}

public static function right($value, $count) {

return substr($value, ($count * -1));
}

public static function left($string, $count) {
return substr($string, 0, $count);
}

}

?>
Loading

0 comments on commit b2f00e9

Please sign in to comment.