Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/iws8/html/pcstore/report/
Upload File :
Current File : /var/www/html/mmishra/iws8/html/pcstore/report/report_summary.php

<?php
include "report_header.inc";

$mode = $_REQUEST["mode"];
$date1 = $_REQUEST["date1"];
$date2 = $_REQUEST["date2"];
if ($date1 == "") $date1 = (date("Y") - 1) . "-04-01";
if ($date2 == "") $date2 = date("Y") . "-03-31";

$sql1 = "select distinct pc_code as qty from product_configuration where used_for=";
$sql2 = "select im.category_code, im.description, count(pm.parts_code) as qty, sum(im.unit_price) as cost from parts_receipt im, parts_master pm, product_configuration pc where im.row_id=pm.item_code and pm.row_id=pc.parts_code and pc.used_for=";

switch ($mode){
case "fab":
  $ttl = "Fabrication";
  $sql1 .= "'fabrication'";
  $sql2 .= "'fabrication'";
  break;
case "upg":
  $ttl = "Upgradation";
  $sql1 .= "'upgradation'";
  $sql2 .= "'upgradation'";
  break;
case "rep":
  $ttl = "Replacement";
  $sql1 .= "'replacement'";
  $sql2 .= "'replacement'";
  break;
}
if ($date1 <> $date2 and $date1 < $date2) $sql1 .= " and issue_date>='$date1' and issue_date<='$date2'";
$rs1 = mysql_query($sql1, $con);
$no = mysql_num_rows($rs1);

if ($date1 <> $date2 and $date1 < $date2) $sql2 .= " and issue_date>='$date1' and issue_date<='$date2'";
$sql2 .= " group by im.category_code";
$rs2 = mysql_query($sql2, $con);

echo "<center><b class='reptitle'>$ttl Report</b><p><br>
      Date <input type='text' name='date1' value='$date1' size='10'> 
      To <input type='text' name='date2' value='$date2' size='10'> 
      <input type='submit' name='submit' value='SHOW'><input type='hidden' name='mode' value='$mode'>

      <div align='left'><b>Parts used in $no Products</b> 
      (<a href='report/list_computer_fur.php?mode=$mode&date1=$date1&date2=$date2'>List Inclosed</a>)</div>

      <table width='100%' border='1' id='gray_box' cellspacing='0' cellpadding='5' bordercolordark='white' bordercolor='black' frame='box'>
      <tr><th>No.</th><th>Item</th><th>Description</th><th>Quantity</th><th nowrap>Cost in Rs.</th></tr>";

while ($qd2 = mysql_fetch_array($rs2)){
  $i++;
  $category_code1 = $qd2["category_code"];
  $category = category($category_code1, $con);
  $description = $qd2["description"];
  $qty = $qd2["qty"];
  $cost = $qd2["cost"];
  $tqty += $qty;
  $tcost += $cost;
  echo "<tr><td>$i</td><td>$category</td><td>$description</td><td align='center'>$qty</td><td align='right'>$cost</td></tr>";
}
$tcost = number_format($tcost, 2);
echo "</table>
      <div align='right'><b>Total $tqty Items Worth Rs. $tcost</b></div>
      <p><p><input type='submit' name='submit' value='PRINT' onclick=\"window.print()\" />";

include "report_footer.inc";
?>