report.php
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- include "login.php";
- $template = tmpl_open('templates/report.html');
- else $ratedate1 = $_GET['ratedate1'];
- else $ratedate2 = $_GET['ratedate2'];
- else $ratedate1c = $_GET['ratedate1c'];
- else $ratedate2c = $_GET['ratedate2c'];
- //////////////// I
- $stmt = ociparse($conn, "select count(id) con from ty where power < 140 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a11 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 140 and power <200 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a12 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 200 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a13 = ociresult($stmt, "CON");
- //////////////// II
- $stmt = ociparse($conn, "select count(id) con from ty where power < 140 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a21 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 140 and power <200 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a22 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >200 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a23 = ociresult($stmt, "CON");
- //////////////// III
- $stmt = ociparse($conn, "select count(id) con from ty where power < 140 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a31 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a32 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 200 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a33 = ociresult($stmt, "CON");
- //////////////// IV
- $stmt = ociparse($conn, "select count(id) con from ty where power < 140 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a41 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a42 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from ty where power >200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a43 = ociresult($stmt, "CON");
- //////////////// V
- $stmt = ociparse($conn, "select avg(count_day) avg from ty where power < 140 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a51 = ociresult($stmt, "AVG");
- $stmt = ociparse($conn, "select avg(count_day) avg from ty where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a52 = ociresult($stmt, "AVG");
- $stmt = ociparse($conn, "select avg(count_day) avg from ty where power >200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a53 = ociresult($stmt, "AVG");
- //////////////// VI
- $stmt = ociparse($conn, "select count(id) con from podkl where power < 140 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a61 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 140 and power <200 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a62 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 200 and DATE_IN between :d1 and :d2" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a63 = ociresult($stmt, "CON");
- //////////////// VII
- $stmt = ociparse($conn, "select count(id) con from podkl where power < 140 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a71 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 140 and power <200 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a72 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >200 and DATE_IN between :d1 and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d1", $ratedate1);
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a73 = ociresult($stmt, "CON");
- //////////////// VIII
- $stmt = ociparse($conn, "select count(id) con from podkl where power < 140 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a81 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a82 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 200 and DATE_IN between '01.06.2012' and :d2" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a83 = ociresult($stmt, "CON");
- //////////////// IX
- $stmt = ociparse($conn, "select count(id) con from podkl where power < 140 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a91 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a92 = ociresult($stmt, "CON");
- $stmt = ociparse($conn, "select count(id) con from podkl where power >200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a93 = ociresult($stmt, "CON");
- //////////////// X
- $stmt = ociparse($conn, "select avg(count_day) avg from podkl where power < 140 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL" );
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a101 = ociresult($stmt, "AVG");
- $stmt = ociparse($conn, "select avg(count_day) avg from podkl where power >= 140 and power <200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a102 = ociresult($stmt, "AVG");
- $stmt = ociparse($conn, "select avg(count_day) avg from podkl where power >200 and DATE_IN between '01.06.2012' and :d2 and DATE_OUT IS NOT NULL");
- ocibindbyname($stmt, ":d2", $ratedate2);
- ociexecute($stmt, OCI_DEFAULT);
- ocifetch($stmt);
- $a103 = ociresult($stmt, "AVG");
- tmpl_iterate($template, "data");
- tmpl_set($template, "data/a11", $a11);
- tmpl_set($template, "data/a12", $a12);
- tmpl_set($template, "data/a13", $a13);
- tmpl_set($template, "data/a14", $a11+$a12+$a13);
- tmpl_set($template, "data/a21", $a21);
- tmpl_set($template, "data/a22", $a22);
- tmpl_set($template, "data/a23", $a23);
- tmpl_set($template, "data/a24", $a21+$a22+$a23);
- tmpl_set($template, "data/a31", $a31);
- tmpl_set($template, "data/a32", $a32);
- tmpl_set($template, "data/a33", $a33);
- tmpl_set($template, "data/a34", $a31+$a32+$a33);
- tmpl_set($template, "data/a41", $a41);
- tmpl_set($template, "data/a42", $a42);
- tmpl_set($template, "data/a43", $a43);
- tmpl_set($template, "data/a44", $a41+$a42+$a43);
- if ($a51>0) $rgValues[] = $a51;
- if ($a52>0) $rgValues[] = $a52;
- if ($a53>0) $rgValues[] = $a53;
- tmpl_set($template, "data/a61", $a61);
- tmpl_set($template, "data/a62", $a62);
- tmpl_set($template, "data/a63", $a63);
- tmpl_set($template, "data/a64", $a61+$a62+$a63);
- tmpl_set($template, "data/a71", $a71);
- tmpl_set($template, "data/a72", $a72);
- tmpl_set($template, "data/a73", $a73);
- tmpl_set($template, "data/a74", $a71+$a72+$a73);
- tmpl_set($template, "data/a81", $a81);
- tmpl_set($template, "data/a82", $a82);
- tmpl_set($template, "data/a83", $a83);
- tmpl_set($template, "data/a84", $a81+$a82+$a83);
- tmpl_set($template, "data/a91", $a91);
- tmpl_set($template, "data/a92", $a92);
- tmpl_set($template, "data/a93", $a93);
- tmpl_set($template, "data/a94", $a91+$a92+$a93);
- if ($a101>0) $rgValues[] = $a101;
- if ($a102>0) $rgValues[] = $a102;
- if ($a103>0) $rgValues[] = $a103;
- tmpl_set($template, "ratedate1", $ratedate1);
- tmpl_set($template, "ratedate2", $ratedate2);
- tmpl_set($template, "ratedate1c", $ratedate1c);
- tmpl_set($template, "ratedate2c", $ratedate2c);
- tmpl_set($template, "head/DATE_IN", $ratedate1);
- tmpl_set($template, "head/DATE_OUT", $ratedate2);
- echo tmpl_parse($template);
- ?>