print problem

Reply

Join Date: Oct 2007
Posts: 46
Reputation: rohitrohitrohit is an unknown quantity at this point 
Solved Threads: 3
rohitrohitrohit's Avatar
rohitrohitrohit rohitrohitrohit is offline Offline
Light Poster

print problem

 
0
  #1
Oct 10th, 2008
hi all ,the code i write below display report on selection of some field below it.my problem is that i want to print this report but controls are also printing with report.i want that only report will print.
please help me to solve my problem............can i transfer report to other page ?

from rohit


  1. <html>
  2. <head>
  3. <title></title>
  4. </head>
  5. <body>
  6. <table bgcolor="#FFFFFF" width="100%" border="0" cellspacing="0" cellpadding="0">
  7. <tr>
  8. <td colspan="10"><div align="center">
  9. <span class="style2">hhh</span></div></td>
  10. </tr>
  11. <tr>
  12. <td>&nbsp;</td>
  13. <td>&nbsp;</td>
  14. <td>&nbsp;</td>
  15. <td>&nbsp;</td>
  16. <td>&nbsp;</td>
  17. <td>&nbsp;</td>
  18. <td>&nbsp;</td>
  19. <td>&nbsp;</td>
  20. <td>&nbsp;</td>
  21. <td>&nbsp;</td>
  22. </tr>
  23. <tr>
  24. <td width="7%">&nbsp;</td>
  25. <td width="7%">&nbsp;</td>
  26. <td width="18%">&nbsp;</td>
  27. <td width="4%">&nbsp;</td>
  28. <td width="17%">&nbsp;</td>
  29. <td width="3%">&nbsp;</td>
  30. <td width="22%">&nbsp;</td>
  31. <td width="4%">&nbsp;</td>
  32. <td width="16%">&nbsp;</td>
  33. <td width="2%">&nbsp;</td>
  34. </tr>
  35. <form name="form" id="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  36.  
  37. <tr>
  38. <td></td>
  39. <td><strong>Division</strong></td>
  40. <td>
  41. <strong>
  42. <?php
  43. include("../dbcon.php");
  44. $objdb=new Dbcon();
  45. $host=$objdb->host;
  46. $user=$objdb->user;
  47. $pass1=$objdb->pass;
  48. $db=$objdb->db;
  49.  
  50. mysql_connect($host,$user,$pass1) or die("could not connect:".mysql_error());
  51. mysql_select_db($db);
  52. $divname=$_POST['txtdiv'];
  53. $qur = mysql_query("select distinct(division) from div_gp")
  54. or die("Invalid query: ".mysql_error());
  55.  
  56. echo '<select id="txtdiv" name="txtdiv" onchange="ref()">';
  57. echo '<option value="">Select..</option>';
  58. while ($row = mysql_fetch_array($qur))
  59. {
  60. $va1 = $row['division'];
  61. if(isset($_POST['txtdiv']) )
  62. {
  63. if($va1==$_POST['txtdiv'])
  64. {
  65. echo "<option value='$va1' selected>$va1</option>";
  66. }
  67. else
  68. {
  69. echo "<option value='$va1'>$va1</option>";
  70. }
  71. }
  72. else
  73. {
  74. echo "<option value='$va1'>$va1</option>";
  75. }
  76. }
  77. echo '</select>';
  78. ?>
  79. </strong></td>
  80. <td><strong>Unit</strong></td>
  81. <td><span class="style121">
  82. <?php
  83.  
  84. $div=$_POST['txtdiv'];
  85. if(isset($div) and strlen($div) > 0)
  86. {
  87. $res = mysql_query("SELECT distinct(untcode) FROM div_gp where division='$div'")
  88. or die("Invalid query: " . mysql_query());
  89. echo '<select id="txtunt" name="txtunt" onchange="ref()">';
  90. echo '<option value="">Select..</option>';
  91. while ($row = mysql_fetch_array($res))
  92. {
  93. $va1 = $row['untcode'];
  94. if(isset($_POST['txtunt']) )
  95. {
  96. if($va1==$_POST['txtunt'])
  97. {
  98. echo "<option value='$va1' selected>$va1</option>";
  99. }
  100. else
  101. {
  102. echo "<option value='$va1' >$va1</option>";
  103. }
  104. }
  105. else
  106. {
  107. echo "<option value='$va1' >$va1</option>";
  108. }
  109. }
  110. echo '</select>';
  111. }
  112. else
  113. {
  114.  
  115. }
  116. ?>
  117. </span></td>
  118. <td><strong>GP</strong></td>
  119. <td><span class="style121">
  120.  
  121. <?php
  122. $gp=$_POST['txtunt'];
  123. //echo"$cat";
  124. if(isset($gp) and strlen($gp) > 0)
  125. {
  126. $res = mysql_query("SELECT gp,gpid FROM div_gp where untcode='$gp'")
  127. or die("Invalid query: " . mysql_query());
  128. echo '<select class="style23" id="txtgp" name="txtgp" >';
  129. echo '<option value="">Select..</option>';
  130. while ($row = mysql_fetch_array($res))
  131. {
  132. $va1 = $row['gp'];
  133. $va2 = $row['gpid'];
  134. if(isset($_POST['txtgp']) )
  135. {
  136. if($va2==$_POST['txtgp'])
  137. {
  138. echo "<option value='$va2' selected>$va1</option>";
  139. }
  140. else
  141. {
  142. echo "<option value='$va2' >$va1</option>";
  143. }
  144. }
  145. else
  146. {
  147. echo "<option value='$va2' >$va1</option>";
  148. }
  149. }
  150. echo '</select>';
  151. }
  152. else
  153. {
  154. }
  155. ?>
  156.  
  157. </span></td>
  158. <td><strong>Year</strong></td>
  159. <td>
  160. <?php
  161. $arryear=array('2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014');
  162. echo "<select class=\"style23\" id=\"ddyr\" name=\"ddyr\">";
  163. echo "<option value=\"\">Select..</option>";
  164.  
  165. if(isset($_POST['ddyr']) )
  166. {
  167. $selddyr=$_POST['ddyr'];
  168. foreach($arryear as $y)
  169. {
  170. if($y==$selddyr)
  171.  
  172. echo "<option value=\"$y\" selected>$y</option>";
  173. else
  174. echo "<option value=\"$y\">$y</option>";
  175. }
  176. }
  177. else
  178. {
  179. foreach($arryear as $y)
  180. {
  181. echo "<option value=\"$y\">$y</option>";
  182. }
  183. }
  184. echo "</select>";
  185. ?></td>
  186. <td>&nbsp;</td>
  187. </tr>
  188. <tr>
  189. <td>&nbsp;</td>
  190. <td>&nbsp;</td>
  191. <td>&nbsp;</td>
  192. <td>&nbsp;</td>
  193. <td>&nbsp;</td>
  194. <td>&nbsp;</td>
  195. <td>&nbsp;</td>
  196. <td>&nbsp;</td>
  197. <td>&nbsp;</td>
  198. <td>&nbsp;</td>
  199. </tr>
  200. <tr>
  201. <td>&nbsp;</td>
  202. <td colspan="2"><strong>Report Level&nbsp;&nbsp; <span class="style4">
  203. <?php
  204. $arrval=array('GP Level','Unit Level','Division Level');
  205. echo "<select class=\"style23\" id=\"val\" name=\"val\">";
  206. echo "<option value=\"\">Select..</option>";
  207.  
  208. if(isset($_POST['val']) )
  209. {
  210. $selddmonth=$_POST['val'];
  211. foreach($arrval as $m)
  212. {
  213. if($m==$selddmonth)
  214. echo "<option value=\"$m\" selected>$m</option>";
  215. else
  216. echo "<option value=\"$m\">$m</option>";
  217. }
  218. }
  219. else
  220. {
  221. foreach($arrval as $m)
  222. {
  223. echo "<option value=\"$m\">$m</option>";
  224. }
  225. }
  226. echo "</select>";
  227. ?>
  228. </span></strong></td>
  229. <td></td>
  230. <td colspan="3">
  231. <span class="style121">
  232. <input name="btshow" id="btshow" onClick="sel()" type="submit" class="style121" value=" Show " />
  233. </span>
  234. <span class="style121">
  235. <input name="btcum" id="btcum" onChange="sel()" type="submit" class="style121" value=" Cumulative " />
  236. </span></td>
  237. <td colspan="2">&nbsp;</td>
  238. <td>&nbsp;</td>
  239. </tr>
  240. </form>
  241. <tr>
  242. <form name="form1" id="form1" method="post" action="printgpwd.php?name=<?php echo $divname;?>">
  243. <?php
  244. $divname=$_POST['txtdiv'];
  245. ?>
  246. <td>&nbsp;</td>
  247. <td colspan="2">&nbsp;</td>
  248. <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  249. <tr>
  250. <td width="12%">&nbsp;</td>
  251. <td width="63%">&nbsp;</td>
  252. <td width="25%"><span class="style121">
  253. <input name="btprint" id="btprint" onClick="window.print();return false;" type="submit" class="style121" value=" Print " />
  254. </span></td>
  255. </tr>
  256. </table></td>
  257. <td>&nbsp;</td>
  258. </form>
  259. </tr>
  260. <tr>
  261. <td>&nbsp;</td>
  262. <td colspan="2">&nbsp;</td>
  263. <td colspan="6"> </td>
  264. <td>&nbsp;</td>
  265. </tr>
  266. <tr>
  267. <td colspan="9">
  268. <div align="center">
  269. <?php
  270. if(isset($_POST['btshow']))
  271. {
  272. $val=$_POST['val'];
  273. if($val=='GP Level')
  274. {
  275. $div=$_POST['txtdiv'];
  276. $txtgp=$_POST['txtgp'];
  277. $txtunt=$_POST['txtunt'];
  278. $ddyr=$_POST['ddyr'];
  279.  
  280. $qur1="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
  281. FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID='$txtgp' and tactivity .FinYr='$ddyr')
  282. GROUP BY reportgpwd.Activity UNION
  283. SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID = '$txtgp' and tactivity .FinYr='$ddyr') UNION
  284. SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
  285. FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID = '$txtgp'
  286. AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  287. //echo"$qur1";
  288. //echo("<input type=\"text\" id=\"hidgpyr\" name=\"hidgpyr\" value=\"$qur1\">");
  289. $result=mysql_query($qur1) or die(mysql_error());
  290. //$row = mysql_fetch_row($result);
  291. //$total_records = $row[0];
  292. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  293. echo("<tr bgcolor='#BEBEBE'>");
  294. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical <br> &nbsp;Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;&nbsp;A&nbsp;&nbsp;</th><th>&nbsp;&nbsp;B&nbsp;&nbsp;</th><th>&nbsp;&nbsp;C&nbsp;&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  295. echo("</tr>");
  296. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  297. {
  298. $Activity=$row['Activity'];
  299. $unit=$row['unit'];
  300. $pshare=$row['PShare'];
  301. $BShare =$row['BShare'];
  302. $BenFamily =$row['BenFamily'];
  303. $pachv=$row['PAchv'];
  304. $BPL=$row['BPL'];
  305. $Oth=$row['Oth'];
  306. $SCST=$row['SCST'];
  307. $Total=$row['Total'];
  308.  
  309. $Male =$row['Male'];
  310. $Female =$row['Female'];
  311.  
  312. $TotalPerson =$row['TotalPerson'];
  313.  
  314. echo("<tr>");
  315. echo("<td>$Activity</td>");
  316. echo("<td align=right>$unit</td>");
  317. echo("<td align=right>$pachv</td>");
  318. echo("<td align=right>$pshare</td>");
  319. echo("<td align=right>$BShare</td>");
  320. echo("<td align=right>$BenFamily </td>");
  321. echo("<td align=right>$BPL</td>");
  322. echo("<td align=right>$Oth</td>");
  323. echo("<td align=right>$SCST</td>");
  324. echo("<td align=right>$Total</td>");
  325. echo("<td align=right>$Male</td>");
  326. echo("<td align=right>$Female</td>");
  327. echo("<td align=right>$TotalPerson</td>");
  328. echo("</tr>");
  329. }
  330. echo("</table>");
  331. }
  332. elseif($val=='Unit Level')
  333. {
  334. $div=$_POST['txtdiv'];
  335. $txtgp=$_POST['txtgp'];
  336. $txtunt=$_POST['txtunt'];
  337. $ddyr=$_POST['ddyr'];
  338.  
  339. $qur2="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
  340. FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where untcode='$txtunt' ) and tactivity .FinYr='$ddyr')
  341. GROUP BY reportgpwd.Activity UNION
  342. SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where untcode='$txtunt' and tactivity .FinYr='$ddyr')) UNION
  343. SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
  344. FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where untcode='$txtunt') AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  345. //echo"$qur";
  346. $result=mysql_query($qur2) or die(mysql_error());
  347. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  348. echo("<tr bgcolor='#BEBEBE'>");
  349. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  350. echo("</tr>");
  351. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  352. {
  353. $Activity=$row['Activity'];
  354. $unit=$row['unit'];
  355. $pshare=$row['PShare'];
  356. $BShare =$row['BShare'];
  357. $BenFamily =$row['BenFamily'];
  358. $pachv=$row['PAchv'];
  359. $BPL=$row['BPL'];
  360. $Oth =$row['Oth'];
  361. $SCST =$row['SCST'];
  362. $Total =$row['Total'];
  363.  
  364. $Male =$row['Male'];
  365. $Female =$row['Female'];
  366.  
  367. $TotalPerson =$row['TotalPerson'];
  368.  
  369. echo("<tr>");
  370. echo("<td>$Activity</td>");
  371. echo("<td align=right>$unit</td>");
  372. echo("<td align=right>$pachv</td>");
  373. echo("<td align=right>$pshare</td>");
  374. echo("<td align=right>$BShare</td>");
  375. echo("<td align=right>$BenFamily </td>");
  376. echo("<td align=right>$BPL</td>");
  377. echo("<td align=right>$Oth</td>");
  378. echo("<td align=right>$SCST</td>");
  379. echo("<td align=right>$Total</td>");
  380. echo("<td align=right>$Male</td>");
  381. echo("<td align=right>$Female</td>");
  382. echo("<td align=right>$TotalPerson</td>");
  383. echo("</tr>");
  384. }
  385. echo("</table>");
  386. }
  387. elseif($val=='Division Level')
  388. {
  389. $div=$_POST['txtdiv'];
  390. $txtgp=$_POST['txtgp'];
  391. $txtunt=$_POST['txtunt'];
  392. $ddyr=$_POST['ddyr'];
  393.  
  394. $qur3="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
  395. FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where division='$div') and tactivity .FinYr='$ddyr')
  396. GROUP BY reportgpwd.Activity UNION
  397. SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where division='$div' and tactivity .FinYr='$ddyr'))UNION
  398. SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
  399. FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where division='$div') AND tactcrop.FY ='$ddyr') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  400. //echo"$qur";
  401. $result=mysql_query($qur3) or die(mysql_error());
  402.  
  403. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  404. echo("<tr bgcolor='#BEBEBE'>");
  405. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  406. echo("</tr>");
  407. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  408. {
  409. $Activity=$row['Activity'];
  410. $unit=$row['unit'];
  411. $pshare=$row['PShare'];
  412. $BShare =$row['BShare'];
  413. $BenFamily =$row['BenFamily'];
  414. $pachv=$row['PAchv'];
  415. $BPL=$row['BPL'];
  416. $Oth =$row['Oth'];
  417. $SCST =$row['SCST'];
  418. $Total =$row['Total'];
  419.  
  420. $Male =$row['Male'];
  421. $Female =$row['Female'];
  422.  
  423. $TotalPerson =$row['TotalPerson'];
  424.  
  425. echo("<tr>");
  426. echo("<td>$Activity</td>");
  427. echo("<td align=right>$unit</td>");
  428. echo("<td align=right>$pachv</td>");
  429. echo("<td align=right>$pshare</td>");
  430. echo("<td align=right>$BShare</td>");
  431. echo("<td align=right>$BenFamily </td>");
  432. echo("<td align=right>$BPL</td>");
  433. echo("<td align=right>$Oth</td>");
  434. echo("<td align=right>$SCST</td>");
  435. echo("<td align=right>$Total</td>");
  436. echo("<td align=right>$Male</td>");
  437. echo("<td align=right>$Female</td>");
  438. echo("<td align=right>$TotalPerson</td>");
  439. echo("</tr>");
  440. }
  441. echo("</table>");
  442. }
  443. }
  444. else
  445. {
  446. }
  447. ?>
  448. </div></td>
  449. <td>&nbsp;</td>
  450. </tr>
  451. <tr>
  452. <td colspan="9"><div align="center">
  453. <?php
  454. if(isset($_POST['btcum']))
  455. {
  456. $val=$_POST['val'];
  457. if($val=='GP Level')
  458. {
  459. $div=$_POST['txtdiv'];
  460. $txtgp=$_POST['txtgp'];
  461. $txtunt=$_POST['txtunt'];
  462. $ddyr=$_POST['ddyr'];
  463.  
  464. $qur4="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
  465. FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID='$txtgp')
  466. GROUP BY reportgpwd.Activity UNION
  467. SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID = '$txtgp') UNION
  468. SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
  469. FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID = '$txtgp') group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  470. //echo"$qur";
  471. $result=mysql_query($qur4) or die(mysql_error());
  472. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  473. echo("<tr bgcolor='#BEBEBE'>");
  474.  
  475. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  476. echo("</tr>");
  477. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  478. {
  479. $Activity=$row['Activity'];
  480. $unit=$row['unit'];
  481. $pshare=$row['PShare'];
  482. $BShare =$row['BShare'];
  483. $BenFamily =$row['BenFamily'];
  484. $pachv=$row['PAchv'];
  485. $BPL=$row['BPL'];
  486. $Oth =$row['Oth'];
  487. $SCST =$row['SCST'];
  488. $Total =$row['Total'];
  489.  
  490. $Male =$row['Male'];
  491. $Female =$row['Female'];
  492.  
  493. $TotalPerson =$row['TotalPerson'];
  494.  
  495. echo("<tr>");
  496. echo("<td>$Activity</td>");
  497. echo("<td align=right>$unit</td>");
  498. echo("<td align=right>$pachv</td>");
  499. echo("<td align=right>$pshare</td>");
  500. echo("<td align=right>$BShare</td>");
  501. echo("<td align=right>$BenFamily </td>");
  502. echo("<td align=right>$BPL</td>");
  503. echo("<td align=right>$Oth</td>");
  504. echo("<td align=right>$SCST</td>");
  505. echo("<td align=right>$Total</td>");
  506. echo("<td align=right>$Male</td>");
  507. echo("<td align=right>$Female</td>");
  508. echo("<td align=right>$TotalPerson</td>");
  509. echo("</tr>");
  510. }
  511. echo("</table>");
  512. }
  513. elseif($val=='Unit Level')
  514. {
  515. $div=$_POST['txtdiv'];
  516. $txtgp=$_POST['txtgp'];
  517. $txtunt=$_POST['txtunt'];
  518. $ddyr=$_POST['ddyr'];
  519.  
  520. $qur5="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson'
  521. FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where untcode='$txtunt'))
  522. GROUP BY reportgpwd.Activity UNION
  523. SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where untcode='$txtunt')) UNION
  524. SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson
  525. FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where untcode='$txtunt')) group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  526. //echo"$qur";
  527. $result=mysql_query($qur5) or die(mysql_error());
  528.  
  529. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  530. echo("<tr bgcolor='#BEBEBE'>");
  531. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  532. echo("</tr>");
  533. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  534. {
  535. $Activity=$row['Activity'];
  536. $unit=$row['unit'];
  537. $pshare=$row['PShare'];
  538. $BShare =$row['BShare'];
  539. $BenFamily =$row['BenFamily'];
  540. $pachv=$row['PAchv'];
  541. $BPL=$row['BPL'];
  542. $Oth =$row['Oth'];
  543. $SCST =$row['SCST'];
  544. $Total =$row['Total'];
  545.  
  546. $Male =$row['Male'];
  547. $Female =$row['Female'];
  548.  
  549. $TotalPerson =$row['TotalPerson'];
  550.  
  551. echo("<tr>");
  552. echo("<td>$Activity</td>");
  553. echo("<td align=right>$unit</td>");
  554. echo("<td align=right>$pachv</td>");
  555. echo("<td align=right>$pshare</td>");
  556. echo("<td align=right>$BShare</td>");
  557. echo("<td align=right>$BenFamily </td>");
  558. echo("<td align=right>$BPL</td>");
  559. echo("<td align=right>$Oth</td>");
  560. echo("<td align=right>$SCST</td>");
  561. echo("<td align=right>$Total</td>");
  562. echo("<td align=right>$Male</td>");
  563. echo("<td align=right>$Female</td>");
  564. echo("<td align=right>$TotalPerson</td>");
  565. echo("</tr>");
  566. }
  567. echo("</table>");
  568. }
  569. elseif($val=='Division Level')
  570. {
  571. $div=$_POST['txtdiv'];
  572. $txtgp=$_POST['txtgp'];
  573. $txtunt=$_POST['txtunt'];
  574. $ddyr=$_POST['ddyr'];
  575.  
  576. $qur6="SELECT reportgpwd.Ord as 'Ord',reportgpwd.Activity AS Activity,reportgpwd.unit as unit,sum(tactivity.PAchv) AS 'PAchv', sum(tactivity.Pshare) AS 'PShare', sum(tactivity.BShare) AS 'BShare', sum(tactivity.BenFamily) AS 'BenFamily', sum(tactivity.bpl) AS 'BPL', sum(tactivity.oth) AS 'Oth', sum(tactivity.scst) AS 'SCST', sum(tactivity.bpl) + sum(tactivity.oth) + sum(tactivity.scst) AS 'Total', sum(tactivity.male) AS 'Male', sum(tactivity.female) AS 'Female',sum(tactivity.male) + sum(tactivity.female) AS 'TotalPerson' FROM reportgpwd LEFT OUTER JOIN tactivity ON reportgpwd.ActCode=tactivity .ActvID WHERE (tactivity .GPID IN (select gpid from div_gp where division='$div'))GROUP BY reportgpwd.Activity UNION SELECT Ord, Activity, unit, PhyAct, ProShare, BenShare, BenefitedFamilies, A, B, C, Total, Male, Female, TotalPerson FROM reportgpwd WHERE ActCode NOT IN (SELECT DISTINCT (ActvID) FROM tactivity WHERE tactivity.GPID IN (select gpid from div_gp where division='$div')) UNION SELECT reportgpwd.Ord, cropmaster.cropname,reportgpwd.unit, sum(tactcrop.pval)as pval, reportgpwd.ProShare,reportgpwd.BenShare,reportgpwd.BenefitedFamilies,reportgpwd.A,reportgpwd.B,reportgpwd.C, reportgpwd.Total,reportgpwd.Male,reportgpwd.Female,reportgpwd.TotalPerson FROM tactcrop join reportgpwd on tactcrop.ActvID=reportgpwd.actcode join cropmaster on tactcrop.cropid=cropmaster.cropid WHERE (tactcrop.GPID IN (select gpid from div_gp where division='$div')) group by tactcrop.ActvID,tactcrop.cropid order by `Ord`";
  577. //echo"$qur";
  578. $result=mysql_query($qur6) or die(mysql_error());
  579.  
  580. echo("<table border=1 bordercolor='black' cellpadding=1 cellspacing=1 aling='center' width='856'>");
  581. echo("<tr bgcolor='#BEBEBE'>");
  582. echo("<th>Activity</th><th>Unit</th><th>&nbsp;Physical<br> Activity&nbsp;</th><th>&nbsp;ProShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;BenShare<br>(Rs. in 000)&nbsp;</th><th>&nbsp;Benefited<br>Families&nbsp;</th><th>&nbsp;A&nbsp;</th><th>&nbsp;B&nbsp;</th><th>&nbsp;C&nbsp;</th><th>&nbsp;Total&nbsp;</th><th>&nbsp;Male&nbsp;</th><th>&nbsp;Female&nbsp;</th><th>&nbsp;Total&nbsp;</th>");
  583. echo("</tr>");
  584. while($row=mysql_fetch_array($result,MYSQL_ASSOC))
  585. {
  586. $Activity=$row['Activity'];
  587. $unit=$row['unit'];
  588. $pshare=$row['PShare'];
  589. $BShare =$row['BShare'];
  590. $BenFamily =$row['BenFamily'];
  591. $pachv=$row['PAchv'];
  592. $BPL=$row['BPL'];
  593. $Oth =$row['Oth'];
  594. $SCST =$row['SCST'];
  595. $Total =$row['Total'];
  596. $Male =$row['Male'];
  597. $Female =$row['Female'];
  598. $TotalPerson =$row['TotalPerson'];
  599.  
  600. echo("<tr>");
  601. echo("<td>$Activity</td>");
  602. echo("<td align=right>$unit</td>");
  603. echo("<td align=right>$pachv</td>");
  604. echo("<td align=right>$pshare</td>");
  605. echo("<td align=right>$BShare</td>");
  606. echo("<td align=right>$BenFamily </td>");
  607. echo("<td align=right>$BPL</td>");
  608. echo("<td align=right>$Oth</td>");
  609. echo("<td align=right>$SCST</td>");
  610. echo("<td align=right>$Total</td>");
  611. echo("<td align=right>$Male</td>");
  612. echo("<td align=right>$Female</td>");
  613. echo("<td align=right>$TotalPerson</td>");
  614. echo("</tr>");
  615. }
  616. echo("</table>");
  617. }
  618. }
  619. else
  620. {
  621. }
  622. ?>
  623. </div></td>
  624. <td>&nbsp;</td>
  625. </tr>
  626. </table>
  627. </body>
  628. </html>
  629. <script language="javascript">
  630. function ref()
  631. {
  632. document.form.submit();
  633. }
  634. function sel()
  635. {
  636.  
  637. }
  638. </script>
Last edited by cscgal; Oct 10th, 2008 at 11:18 am. Reason: Added code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 87
Reputation: TopDogger is an unknown quantity at this point 
Solved Threads: 5
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: print problem

 
0
  #2
Oct 10th, 2008
If you just want to prevent page elements such as buttons from displaying on printed output, the easiest way to do that is by using external stylesheets. You can use a different stylesheet to format what displays on the screen versus what is printed.

Here is a article that shows you how to do it:

Formatting Printed Web Pages With CSS

If you are trying to prevent the date, page URL and other information from printing at the top and bottom of a printed page, you have to turn that off in your browser. You cannot do it with web page code.

In Internet Explorer, go to File > Page Setup. Just remove the code in the Header and Footer sections.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 46
Reputation: rohitrohitrohit is an unknown quantity at this point 
Solved Threads: 3
rohitrohitrohit's Avatar
rohitrohitrohit rohitrohitrohit is offline Offline
Light Poster

Re: print problem

 
0
  #3
Oct 13th, 2008
actually there is two button in my page one is for show report and second is for cummulative report.is there any way that my report when i click show button it display in other page not in same page.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: print problem

 
0
  #4
Oct 13th, 2008
use this code:
  1. <a href="javascript:;" onClick="window.open('yourpage.php?id=<?=$row['reportid'];?>','no','scrollbars=yes,width=600,height=550')" >View</a>
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 46
Reputation: rohitrohitrohit is an unknown quantity at this point 
Solved Threads: 3
rohitrohitrohit's Avatar
rohitrohitrohit rohitrohitrohit is offline Offline
Light Poster

Re: print problem

 
0
  #5
Oct 13th, 2008
how can i get report id ? i am little bit confuse because there are approximate 6 query in my page for generating report.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: print problem

 
0
  #6
Oct 13th, 2008
get report id from where ever you display the view in your page...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 16
Reputation: trinitybrown is an unknown quantity at this point 
Solved Threads: 2
trinitybrown trinitybrown is offline Offline
Newbie Poster

Re: print problem

 
0
  #7
Oct 14th, 2008
well, it looks fine , let me run this code on my PC and I will let you know about the problem if i will be able to track it
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 593 | Replies: 6
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC