Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/irp/pcstore/
Upload File :
Current File : /var/www/html/mmishra/irp/irp/pcstore/parts_consumed.php

<?php
include "report_header.inc";
$mode = $_REQUEST["mode"];
$date1 = $_REQUEST["date1"];
$date2 = $_REQUEST["date2"];
if ($date1 == "") $date1 = date("Y-m-d");
if ($date2 == "") $date2 = date("Y-m-d");
$sql1 = "select distinct pc_code as qty from pc_configuration where used_for=";
$sql2 = "select im.category_code, im.description, count(pm.parts_code) as qty, sum(im.unit_price) as cost from item_master im, parts_master pm, pc_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, $link_id);
$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, $link_id);

echo "<center><b><u><font color='red'>Consumption ($ttl) Report</font></u></b><p><br>";
echo "Period <input type='text' name='date1' value='$date1' size='10'> ";
echo "To <input type='text' name='date2' value='$date2' size='10'> ";
echo "<input type='submit' name='submit' value='SHOW'><input type='hidden' name='mode' value='$mode'>";

echo "<div align='left'><b>Parts used in $no computers</b> (<a href='pc_list.php?mode=$mode&date1=$date1&date2=$date2'>List Inclosed</a>)</div>";

echo "<table width='100%' border='1' cellspacing='0' cellpadding='1' bordercolordark='white' bordercolor='black' frame='box' id='id4'>";
echo "<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_detail = category_detail($category_code1, $link_id);
  $description = $qd2["description"];
  $qty = $qd2["qty"];
  $cost = $qd2["cost"];
  $tqty += $qty;
  $tcost += $cost;
  echo "<tr><td>$i</td><td>$category_detail</td><td>$description</td><td align='center'>$qty</td><td align='right'>$cost</
td></tr>";
}
echo "</table>";
$tcost = number_format($tcost, 2);
echo "<div align='right'><b>Total $tqty Items Worth Rs. $tcost</b></div>";

include "report_footer.inc";
?>