I have the following problem: I need to integrate KoolPHP report into the AppGini project.
I've done everything and the report is ready to use but I have anoying problem with jquery and prototype declarations in header.php file of AppGini.
There is some kind of conflict between Koolreport js files and AppGini. I think the Problem is that both apps are trying to moderate the table that is generated by Koolreport. I've attached screenshot of the page with jquery and prototype declarations removed from header.php - 1.png and the page with jquery and prototype included: 2.png. The difference is that in the first page all js widgets, search field, sorting etc, that is part of KoolPHP is working. In the second page all this is removed and default AppGini table styling is applied to the table.
I definitely need the head navigation bar on this page that's why i need the header.php included. I want to avoid replacing of my adjustments in header.php after regeneration of the app and mine current solution with copy of header.php - header2.php also is not good in the long run.
Please look at my code and suggest any better solution:
index.php
Code: Select all
<?php
/*restrict access to only group memebers */
define('PREPEND_PATH', '../../');
$curr_dir = dirname(__FILE__ )."/../..";
include("{$curr_dir}/defaultLang.php");
include("{$curr_dir}/language.php");
include("{$curr_dir}/lib.php");
/* check access */
$mi = getMemberInfo();
//error_log(print_r($mi, TRUE));
if(!is_array($mi)) {
echo "Access denied";
exit;
}
/*end access check */
include_once("{$curr_dir}/header2.php");
include_once("{$curr_dir}/footer.php");
require_once "turnover.php";
$vendors = new Turnover;
$vendors->run()->render();
Code: Select all
<?php
require_once "../load.koolreport.php";
use \koolreport\processes\CalculatedColumn;
use \koolreport\processes\ColumnMeta;
use \koolreport\processes\Join;
class Turnover extends \koolreport\KoolReport
{
use \koolreport\clients\Bootstrap;
public function settings()
{
$config = include "../config.php";
return array(
"dataSources"=>array(
"turnover"=>$config["accounting"],
"turnover_array"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"associate"
),
"formdata"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"associate"
)
)
);
}
public function setup()
{
//error_log($_POST['from-date']);
$mi = getMemberInfo();
//error_log(print_r($mi, TRUE));
$current_user_group = $mi['groupID'];
//geting filter values
if (!empty($_POST['from-date'])) {
$from_date = $_POST['from-date'];
}
else
{
$from_date = date("01.m.Y");
}
if (!empty($_POST['to-date'])) {
$to_date = $_POST['to-date'];
}
else
{
$to_date = date("d.m.Y");
}
//send to_date and from_date to view
$this->src('formdata')->load(array(
array("to_date"=>$to_date,"from_date"=>$from_date)
))
->pipe($this->dataStore("data"));
//following a lot of sql statemsnts ......
Code: Select all
<?php
use \koolreport\datagrid\DataTables;
$data = $this->dataStore("data")->toArray();
?>
<div class='report-content'>
<div class="text-center">
<h1>Оборотна ведмоÑÑ‚</h1>
<h2>Период от <?=$data[0]['from_date']; ?> до <?=$data[0]['to_date']; ?></h2>
</div>
<form class="form-inline" action="index2.php" method="post">
<a href="#" class="btn btn-danger btn-md" onclick="history.go(-1); return false;"><i class="glyphicon glyphicon-chevron-left"></i>Ðазад</a>
<div class="form-group">
<div class="col-xs-9 col-md-3 col-lg-2 vspacer-md">
<label class="sr-only" for="from-date">От</label>
<input type="text" class="form-control" id="from-date" name="from-date" value="<?=$data[0]['from_date']; ?>" size="10" placeholder="От">
</div>
</div>
<div class="form-group">
<div class="col-xs-9 col-md-3 col-lg-2 vspacer-md">
<label class="sr-only" for="to-date">До</label>
<input type="text" class="form-control" id="to-date" name="to-date" value="<?=$data[0]['to_date']; ?>" size="10" placeholder="До">
</div>
</div>
<button type="submit" id="submit" onclick="return true;" class="btn btn-success btn-md"><i class="glyphicon glyphicon-ok"></i>Филтър</button>
</form>
<script>
$j(function(){
//date
$j("#from-date").datetimepicker({
format: 'DD.MM.YYYY'
});
$j("#to-date").datetimepicker({
format: 'DD.MM.YYYY'
});
});
</script>
<?php
//vendor_mo
$turnover = array(); //new combined array of start balance valuses
$turnover_debit_account_sb_vendor = $this->dataStore("turnover_debit_account_sb_vendor")->toArray();
$turnover_credit_account_sb_vendor = $this->dataStore("turnover_credit_account_sb_vendor")->toArray();
$turnover_debit_account_vendor_start = $this->dataStore("turnover_debit_account_vendor_start")->toArray();
$turnover_credit_account_vendor_start = $this->dataStore("turnover_credit_account_vendor_start")->toArray();
$turnover_debit_account_vendor_end = $this->dataStore("turnover_debit_account_vendor_end")->toArray();
$turnover_credit_account_vendor_end = $this->dataStore("turnover_credit_account_vendor_end")->toArray();
//client_mo
$turnover_debit_account_sb_client = $this->dataStore("turnover_debit_account_sb_client")->toArray();
$turnover_credit_account_sb_client = $this->dataStore("turnover_credit_account_sb_client")->toArray();
$turnover_debit_account_client_start = $this->dataStore("turnover_debit_account_client_start")->toArray();
$turnover_credit_account_client_start = $this->dataStore("turnover_credit_account_client_start")->toArray();
$turnover_debit_account_client_end = $this->dataStore("turnover_debit_account_client_end")->toArray();
$turnover_credit_account_client_end = $this->dataStore("turnover_credit_account_client_end")->toArray();
//other_mo
$turnover_debit_account_sb_other = $this->dataStore("turnover_debit_account_sb_other")->toArray();
$turnover_credit_account_sb_other = $this->dataStore("turnover_credit_account_sb_other")->toArray();
$turnover_debit_account_other_start = $this->dataStore("turnover_debit_account_other_start")->toArray();
$turnover_credit_account_other_start = $this->dataStore("turnover_credit_account_other_start")->toArray();
$turnover_debit_account_other_end = $this->dataStore("turnover_debit_account_other_end")->toArray();
$turnover_credit_account_other_end = $this->dataStore("turnover_credit_account_other_end")->toArray();
//combine debit sb, credit sb, credit and debit arrays
$turnover_account = array_merge(
$turnover_debit_account_sb_vendor, $turnover_credit_account_sb_vendor, $turnover_debit_account_vendor_start, $turnover_credit_account_vendor_start,
$turnover_debit_account_vendor_end, $turnover_credit_account_vendor_end, $turnover_debit_account_sb_client, $turnover_credit_account_sb_client,
$turnover_debit_account_client_start, $turnover_credit_account_client_start, $turnover_debit_account_client_end, $turnover_credit_account_client_end,
$turnover_debit_account_sb_other, $turnover_credit_account_sb_other, $turnover_debit_account_other_start, $turnover_credit_account_other_start,
$turnover_debit_account_other_end, $turnover_credit_account_other_end
);
DataTables::create(array(
"dataSource"=>$turnover,
"options"=>array(
"searching"=>true,
"select"=>true,
),
"showFooter"=>"bottom",
"columns"=>array(
"ID"=>array(
"label"=>"ID",
"footerText"=>"<b>#</b>"
),
"AccDesc"=>array(
"label"=>"ОпиÑание",
"footerText"=>"<b>Общо</b>"
),
"Acc"=>array(
"label"=>"Сметка",
"footerText"=>"<b>---</b>"
),
"AmSumSBDebit"=>array(
"label"=>"Ðачално Салдо Дт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
),
"AmSumSBCredit"=>array(
"label"=>"Ðачално Салдо Кт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
),
"AmSumDebit"=>array(
"label"=>"Обороти Дт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
),
"AmSumCredit"=>array(
"label"=>"Обороти Кт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
),
"AmSumEBDebit"=>array(
"label"=>"Крайно Салдо Дт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
),
"AmSumEBCredit"=>array(
"label"=>"Крайно Салдо Кт",
"footer"=>"sum",
"footerText"=>"<b>@value</b>",
"type"=>"float"
)
),
"paging"=>array(
"pageSize"=>100
),
"cssClass"=>array(
"table"=>"table table-bordered table-striped"
)
));
?>
</div>