|
|
@@ -4,13 +4,13 @@ function BUDGET_ANALYTICS() {
|
|
|
|
|
|
$budgetAnalyticsRouter = new BudgetAnalyticsRouter();
|
|
|
|
|
|
- $_print = V::get('_print', '', $_REQUEST);
|
|
|
- if (!$_print) {
|
|
|
- $budgetAnalyticsRouter->menu();
|
|
|
- }
|
|
|
-
|
|
|
$args = array();
|
|
|
$args['year'] = V::get('zest_year', '', $_REQUEST, 'int');
|
|
|
+ $args['_print'] = V::get('_print', '', $_REQUEST, 'int');
|
|
|
+
|
|
|
+ if (!$args['_print']) {
|
|
|
+ $budgetAnalyticsRouter->menu($args['year']);
|
|
|
+ }
|
|
|
|
|
|
if (empty($args['year'])) {
|
|
|
?>
|
|
|
@@ -40,8 +40,9 @@ function BUDGET_ANALYTICS() {
|
|
|
|
|
|
class BudgetAnalyticsRouter {
|
|
|
|
|
|
- function menu() {
|
|
|
+ function menu($selectedYear) {
|
|
|
//SE_Layout::menu();
|
|
|
+ $year = ($selectedYear)? $selectedYear : date("Y");
|
|
|
?>
|
|
|
<div class="jumbotron">
|
|
|
<div class="container">
|
|
|
@@ -67,7 +68,7 @@ jQuery(document).ready(function () {
|
|
|
|
|
|
jQuery("#fldZestYear").datetimepicker({
|
|
|
format: "YYYY",
|
|
|
- defaultDate: new Date(<?php echo date("Y"); ?>, <?php echo intval(date("m")); ?>, 1),
|
|
|
+ defaultDate: new Date(<?php echo $year; ?>, <?php echo intval(date("m")); ?>, 1),
|
|
|
// minDate: new Date(2014, 11, 1),
|
|
|
// maxDate: "<?php echo date("Y"); ?>"
|
|
|
});
|
|
|
@@ -79,40 +80,23 @@ jQuery(document).ready(function () {
|
|
|
function css() {
|
|
|
?>
|
|
|
<style type="text/css">
|
|
|
-.oferta-programowa { border-collapse:collapse; border:1px solid #7EC5FF; }
|
|
|
-.oferta-programowa td { border:1px solid #7EC5FF; }
|
|
|
-.oferta-programowa .prog-group { color:#7A7A7A; }
|
|
|
-.oferta-programowa .cyfrowe-prog-count {}
|
|
|
-.oferta-programowa .p2 { padding:0 2px; }
|
|
|
-.oferta-programowa .c { text-align:center; }
|
|
|
-.oferta-programowa .r { text-align:right; }
|
|
|
-.oferta-programowa .cyfrowe-prog-count td { background-color:#fff; }
|
|
|
-.oferta-programowa .hd { background-color:#FF5F5F; color:#fff; font-weight:bold; }
|
|
|
-.oferta-programowa .nr { color:#7A7A7A; }
|
|
|
-.oferta-programowa thead th { border:1px solid #7EC5FF; }
|
|
|
-
|
|
|
-#oferta-programowa-cyfrowe thead { background:none; }
|
|
|
-#oferta-programowa-cyfrowe thead th { vertical-align:bottom; border:none; }
|
|
|
-#oferta-programowa-cyfrowe .logo { text-align:center; background-color:#fff; border:none; }
|
|
|
-#oferta-programowa-cyfrowe .vertical { height:30px; white-space:nowrap; line-height:30px; padding:2px 0; }
|
|
|
-
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-24 {background-color:#EBEBEB;} /* Biały */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-25 {background-color:#B88019;} /* Brązowy */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-26 {background-color:#CACACA;} /* Srebrny */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-27 {background-color:#FFE554;} /* Złoty */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-28 {background-color:#E7E4E4;} /* Platynowy */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-8 {background-color:#94CFFF;} /* CANAL+ */
|
|
|
-#oferta-programowa-cyfrowe .prog-pakiet-10 {background-color:#77A3FF;} /* CANAL+ HD */
|
|
|
-
|
|
|
-#oferta-programowa-analogowe { }
|
|
|
-
|
|
|
-/* print table background colors */
|
|
|
-table td, table th { -webkit-print-color-adjust:exact; }
|
|
|
-table { page-break-after:auto }
|
|
|
-tr { page-break-inside:avoid; page-break-after:auto; position:relative; }
|
|
|
-td { page-break-inside:avoid; page-break-after:auto; position:relative; }
|
|
|
-thead { display:table-header-group }
|
|
|
-tfoot { display:table-footer-group }
|
|
|
+ .c { text-align:center; }
|
|
|
+ .r { text-align:right; }
|
|
|
+
|
|
|
+ .zestawienie-kosztow-tbl { border-collapse:collapse; border:1px solid #7EC5FF; }
|
|
|
+ .zestawienie-kosztow-tbl td { border:1px solid #7EC5FF; }
|
|
|
+ .zestawienie-kosztow-tbl .p2 { padding:0 2px; }
|
|
|
+ .zestawienie-kosztow-tbl .nr { color:#7A7A7A; }
|
|
|
+ .zestawienie-kosztow-tbl thead th { border:1px solid #7EC5FF; }
|
|
|
+ .zestawienie-kosztow-tbl tbody tr:hover td { background:#cafbfd; }
|
|
|
+
|
|
|
+ /* print table background colors */
|
|
|
+ table td, table th { -webkit-print-color-adjust:exact; }
|
|
|
+ table { page-break-after:auto }
|
|
|
+ tr { page-break-inside:avoid; page-break-after:auto; position:relative; }
|
|
|
+ td { page-break-inside:avoid; page-break-after:auto; position:relative; }
|
|
|
+ thead { display:table-header-group }
|
|
|
+ tfoot { display:table-footer-group }
|
|
|
|
|
|
.cost { padding:0 2px; min-width:30px; text-align:right; }
|
|
|
.cost-only_child { color:#777; }
|
|
|
@@ -131,8 +115,8 @@ tfoot { display:table-footer-group }
|
|
|
//echo'<pre style="width:600px;border:1px solid red;max-height:300px;overflow:auto;">';print_r($costs);echo'</pre>';
|
|
|
?>
|
|
|
<div style="float:right;color:#aaa;"><?php echo date("Y-m-d"); ?></div>
|
|
|
- <h1>Zestawienie kosztów projektów na podstawie korespondencji</h1>
|
|
|
- <table cellspacing="0" cellpadding="0" border="0" id="oferta-programowa-cyfrowe" class="oferta-programowa">
|
|
|
+ <h1>Zestawienie kosztów projektów na rok <?php echo $year; ?></h1>
|
|
|
+ <table cellspacing="0" cellpadding="0" border="0" id="zestawienie-kosztow-projektow" class="zestawienie-kosztow-tbl">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<td colspan="3" style="text-align:right">
|
|
|
@@ -148,8 +132,8 @@ tfoot { display:table-footer-group }
|
|
|
<?php foreach ($projOrder as $projPath => $projId) : ?>
|
|
|
<?php $projectInfo = $costs[$projId]; ?>
|
|
|
<tr class="row-<?php echo ($t = 1 - $t); ?>">
|
|
|
- <td class="p2 r nr"><?php echo $projectInfo->path; ?></td>
|
|
|
- <td class="p2" style="max-width:300px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php echo $projectInfo->M_DIST_DESC; ?></td>
|
|
|
+ <td class="p2 l nr"><?php echo $projectInfo->path; ?></td>
|
|
|
+ <td class="p2" style="max-width:300px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="<?php echo $projectInfo->M_DIST_DESC; ?>"><?php echo $projectInfo->M_DIST_DESC; ?></td>
|
|
|
<td class="p2 r nr"><input type="checkbox" name="selectedProject" value="<?php echo $projectInfo->ID_PROJECT; ?>" /></td>
|
|
|
<?php foreach ($months as $month) : ?>
|
|
|
<?php if (array_key_exists($month, $projectInfo->costsByMonth)) : ?>
|
|
|
@@ -251,4 +235,44 @@ tfoot { display:table-footer-group }
|
|
|
return $la - $lb;
|
|
|
}
|
|
|
|
|
|
+ public function installView() {
|
|
|
+ $sql = "
|
|
|
+ CREATE VIEW `test_budget_project_analytics_view` AS
|
|
|
+ select `IN7_DZIENNIK_KORESP`.`ID_PROJECT` AS `ID_PROJECT`
|
|
|
+ , date_format(`IN7_DZIENNIK_KORESP`.`K_DATA_OTRZYMANEJ_KORESP`,'%Y-%m') AS `MONTH`
|
|
|
+ , sum(`IN7_DZIENNIK_KORESP`.`COST_VALUE`) AS `COST`
|
|
|
+ , sum(`IN7_DZIENNIK_KORESP`.`INCOME_VALUE`) AS `INCOME`
|
|
|
+ , 'SELF' AS `TYPE`
|
|
|
+ from `IN7_DZIENNIK_KORESP`
|
|
|
+ where ((`IN7_DZIENNIK_KORESP`.`COST_VALUE` > 0) or (`IN7_DZIENNIK_KORESP`.`INCOME_VALUE` > 0))
|
|
|
+ group by `IN7_DZIENNIK_KORESP`.`ID_PROJECT`
|
|
|
+ , date_format(`IN7_DZIENNIK_KORESP`.`K_DATA_OTRZYMANEJ_KORESP`,'%Y-%m')
|
|
|
+ union
|
|
|
+ select `p`.`ID` AS `ID_PROJECT`
|
|
|
+ , date_format(`k`.`K_DATA_OTRZYMANEJ_KORESP`,'%Y-%m') AS `MONTH`
|
|
|
+ , sum(`k`.`COST_VALUE`) AS `COST`,sum(`k`.`INCOME_VALUE`) AS `INCOME`
|
|
|
+ , 'CHILD' AS `TYPE`
|
|
|
+ from (`IN7_MK_BAZA_DYSTRYBUCJI` `p`
|
|
|
+ join `IN7_DZIENNIK_KORESP` `k` on((((`k`.`COST_VALUE` > 0) or (`k`.`INCOME_VALUE` > 0)) and (`k`.`path` like concat('%-',`p`.`ID`,'-%')))))
|
|
|
+ group by `p`.`ID`, date_format(`k`.`K_DATA_OTRZYMANEJ_KORESP`, '%Y-%m')
|
|
|
+ ";
|
|
|
+ $sql = "
|
|
|
+ CREATE VIEW `test_budget_project_synthetics_view` AS
|
|
|
+ select `t1`.`ID_PROJECT` AS `ID_PROJECT`
|
|
|
+ , `p`.`M_DIST_DESC` AS `M_DIST_DESC`
|
|
|
+ , `p`.`P_ID` AS `P_ID`
|
|
|
+ , `p`.`path` AS `path`
|
|
|
+ , `t1`.`MONTH` AS `MONTH`
|
|
|
+ , cast(sum(if((`t1`.`TYPE` = 'SELF'),`t1`.`COST`,'0')) as decimal(10,2)) AS `COST_SELF`
|
|
|
+ , cast(sum(if((`t1`.`TYPE` = 'CHILD'),`t1`.`COST`,'0')) as decimal(10,2)) AS `COST_CHILD`
|
|
|
+ , sum(`t1`.`COST`) AS `COST_TOTAL`
|
|
|
+ , cast(sum(if((`t1`.`TYPE` = 'SELF'),`t1`.`INCOME`,'0')) as decimal(10,2)) AS `INCOME_SELF`
|
|
|
+ , cast(sum(if((`t1`.`TYPE` = 'CHILD'),`t1`.`INCOME`,'0')) as decimal(10,2)) AS `INCOME_CHILD`
|
|
|
+ , sum(`t1`.`INCOME`) AS `INCOME_TOTAL`
|
|
|
+ from (`test_budget_project_analytics_view` `t1`
|
|
|
+ join `IN7_MK_BAZA_DYSTRYBUCJI` `p` on((`t1`.`ID_PROJECT` = `p`.`ID`))
|
|
|
+ )
|
|
|
+ group by `t1`.`ID_PROJECT`, `t1`.`MONTH`
|
|
|
+ ";
|
|
|
+ }
|
|
|
}
|