<?
include_once('../hdr_general.php');
/* **************************************************************************************************** */
$pubmodule = $_REQUEST["module"];
$pubtask = $_REQUEST["task"];
$pubitemid = $_REQUEST["itemid"];
//$pubsuppliers = $_REQUEST["suppliers"];
$pubsupplier = $_REQUEST["supplier"];
/* **************************************************************************************************** */
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../css/<?=$_SESSION['Xcssfile'];?>" type="text/css" media=all>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
<title>Purchasing Online (ZIKAY)</title>
</head>
<body leftmargin=5 topmargin=5 bgcolor="#ffffff">
<table border=0 cellspacing=0 cellpadding=0 width=760>
<tr valign=top>
<td valign=top width=760px>

  <?
  include_once('../models/mroModel.php');
  include_once('../models/itqModel.php');
  include_once('../models/supplierModel.php');
  include_once('../models/tradeModel.php');
  $mymroModel=new mroModel;
  $myitqModel=new itqModel;
  $mysupplierModel=new supplierModel;
  $mytradeModel=new tradeModel;

  // get project info
  // get mro details and items

  //$project_data = $myprojectModel->getdata_project

  $myprojectname = $_SESSION['Xprojectname'];
  $myprojectdesc = $_SESSION['Xprojectdesc'];
  $itq_data = $myitqModel->getdata_itq($pubitemid);
  $mro_data = $mymroModel->getdata_mro($itq_data['itq_mropkey']);
  $mro_items = $mymroModel->getlist_mroitems($itq_data['itq_mropkey']);

  //$mysuppliers = explode(";",$pubsuppliers);
  $supplier_data = $mysupplierModel->getdata_supplier($pubsupplier);
  $trade_data = $mytradeModel->getdata_trade($itq_data['itq_subtradepkey']);
  ?>

  <?
  //foreach ($mysuppliers as $mysupplier) {
  ?>

  <table border=0 cellspacing=2 cellpadding=0 width=760>
  <tr valign=top>
  <td valign=top width=100>&nbsp;</td>
  <!--<td valign=top width=500 class=rptzikayheader style="text-decoration: none; text-align: right; line-height: 20px;"><img src="../gfx/zikay.png" width=90px height=112px align=left><br><br><span style="font-size: 24px; font-family: times new roman;"><u>KEMBANG SERANTAU SDN. BHD.</u></span><br><span style="font-size: 10px; font-family: times new roman;">(224505-W)</span></td>-->
  <td valign=top width=500 class=rptzikayheader style="text-decoration: none; text-align: center;"><img src="../gfx/zikayheader.png" style="width: 226px; height: 82px;"><!-- 390/87 416/93 519/116 --><!--<br><span style="font-size: 14px;"><u>KEMBANG SERANTAU SDN. BHD.</u></span>--></td>
  <td valign=top width=60>&nbsp;</td>
  <td valign=top width=100>
    <table border=0 cellspacing=0 cellpadding=2 width=100>
    <tr valign=top><td valign=top width=100 class=rptzikayconfidential style="font-size: 10px; text-align: right;">PU-SP-01-F2</td></tr>
    <tr valign=top><td valign=top width=100 class=rptzikayconfidential style="font-size: 10px; text-align: right; border-top: 0px;">Rev : 2</td></tr>
    </table>
  </td>
  </tr>
  </table>
  <br><br>

  <table border=0 cellspacing=2 cellpadding=0 width=760>
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent style="text-align: center;">
    <span style="font-size: 14px;"><b>INVITATION TO QUOTE</b></span>
    <table border=1 cellspacing=0 cellpadding=2 width=760 style="border: 1px solid black; border-collapse: collapse;">
    <tr valign=top>
    <td valign=top width=750 class=listcontent style="border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <table border=0 cellspacing=8 cellpadding=2 width=750>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent>
      &nbsp;&nbsp;TO
      </td>
      <td valign=top width=10 class=rptlistcontent> : </td>
      <td valign=top width=520 colspan=3 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$supplier_data['supplier_name'];?>
      </td>
      <td valign=top width=60 class=rptlistcontent style="text-align: right;">
      DATE :
      </td>
      <td valign=top width=120 colspan=2 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=unconverttounixslash($itq_data['itq_date']);?>
      </td>
      </tr>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent>
      &nbsp;&nbsp;ATTN
      </td>
      <td valign=top width=10 class=rptlistcontent> : </td>
      <td valign=top width=320 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$supplier_data['supplier_pic'];?>&nbsp;
      </td>
      <td valign=top width=60 class=rptlistcontent>
      FAX NO :
      </td>
      <td valign=top width=160 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$supplier_data['supplier_fax'];?>&nbsp;
      </td>
      <td valign=top width=60 class=rptlistcontent style="text-align: right;">
      TEL NO :
      </td>
      <td valign=top width=120 colspan=2 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$supplier_data['supplier_phone'];?>&nbsp;
      </td>
      </tr>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent>
      &nbsp;&nbsp;FROM
      </td>
      <td valign=top width=10 class=rptlistcontent> : </td>
      <td valign=top width=320 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$itq_data['itq_from'];?>
      </td>
      <td valign=top width=200 colspan=2 class=rptlistcontent>
      TOTAL PAGE (Including cover) : 
      </td>
      <td valign=top width=60 class=rptlistcontent style="border-bottom: 1px solid black;">
      &nbsp;
      </td>
      <td valign=top width=60 class=rptlistcontent>
      RFQ No:
      </td>
      <td valign=top width=60 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=itqidstr($itq_data['itq_rfqno'],$itq_data['itq_revno']);?>
      </td>
      </tr>
      </table>
    </td>
    </tr>
    </table>
  </td>
  </tr>
  </table>
  <br>

  <table border=0 cellspacing=2 cellpadding=0 width=760>
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>
    <table border=0 cellspacing=0 cellpadding=2 width=760>
    <tr valign=top>
    <td valign=top width=750 class=listcontent style="border-left: 0px; border-top: 0px; border-right: 0px; border-bottom: 0px;">
      <table border=0 cellspacing=2 cellpadding=2 width=750>
      <tr valign=top>
      <td valign=top width=750 colspan=4 class=rptlistcontent>
      We are pleased to invite you to quote for the following:
      </td>
      </tr>
      <tr valign=top><td valign=top width=750 colspan=4 class=rptlistcontent><img src="../pixel.gif" width=1 height=8></td></tr>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent style="text-align: center; border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <? if ($itq_data['itq_type']=="1") { echo "<b>X</b>"; } else { echo "&nbsp;"; } ?>
      </td>
      <td valign=top width=335 class=rptlistcontent>
      Items as per attached B.Q.
      </td>
      <td valign=top width=40 class=rptlistcontent style="text-align: center; border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <? if ($itq_data['itq_type']=="4") { echo "<b>X</b>"; } else { echo "&nbsp;"; } ?>
      </td>
      <td valign=top width=335 class=rptlistcontent>
      Items as per attached B.Q. and specification.
      </td>
      </tr>
      <tr valign=top><td valign=top width=750 colspan=4 class=rptlistcontent><img src="../pixel.gif" width=1 height=5></td></tr>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent style="text-align: center; border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <? if ($itq_data['itq_type']=="2") { echo "<b>X</b>"; } else { echo "&nbsp;"; } ?>
      </td>
      <td valign=top width=335 class=rptlistcontent>
      Items as per attached B.Q. and Drawings
      </td>
      <td valign=top width=40 class=rptlistcontent style="text-align: center; border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <? if ($itq_data['itq_type']=="5") { echo "<b>X</b>"; } else { echo "&nbsp;"; } ?>
      </td>
      <td valign=top width=335 class=rptlistcontent>
      Items as per listed belows
      </td>
      </tr>
      <tr valign=top><td valign=top width=750 colspan=4 class=rptlistcontent><img src="../pixel.gif" width=1 height=5></td></tr>
      <tr valign=top>
      <td valign=top width=40 class=rptlistcontent style="text-align: center; border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;">
      <? if ($itq_data['itq_type']=="3") { echo "<b>X</b>"; } else { echo "&nbsp;"; } ?>
      </td>
      <td valign=top width=375 colspan=2 class=rptlistcontent>
      Items as per attached B.Q., Drawings and specification.
      </td>
      <td valign=top width=335 colspan=2 class=rptlistcontent>
      &nbsp;
      </td>
      </tr>
    </td>
    </tr>
    </table>
  </td>
  </tr>
  </table>
  <br>

  <table border=0 cellspacing=2 cellpadding=0 width=760>
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>
    <table border=0 cellspacing=0 cellpadding=2 width=760>
    <tr valign=top>
    <td valign=top width=750 class=listcontent style="border-left: 0px; border-top: 0px; border-right: 0px; border-bottom: 0px;">
      <table border=0 cellspacing=0 cellpadding=2 width=750>
      <tr valign=top>
      <td valign=top width=80 class=rptlistcontent>
      <b>PROJECT</b>
      </td>
      <td valign=top width=10 class=rptlistcontent>
      :
      </td>
      <td valign=top width=660 class=rptlistcontent style="border-bottom: 1px solid black;">
      <?=$myprojectdesc;?>
      </td>
      </tr>
      <tr valign=top><td valign=top width=750 colspan=4 class=rptlistcontent><img src="../pixel.gif" width=1 height=8></td></tr>
      <tr valign=top>
      <td valign=top width=80 class=rptlistcontent>
      <b>TRADE</b>
      </td>
      <td valign=top width=10 class=rptlistcontent>
      :
      </td>
      <td valign=top width=660 class=rptlistcontent>
      <b><?=$trade_data['tradedescription'];?></b><br>

        <? $maxitem=0; ?>
        <? foreach($mro_items as $myitem) { ?>

          <? $maxitem++; ?>

          <? if ($maxitem==6) { ?>
            <i>Please Refer Attachment</i>
            <? break; ?>
          <? } ?>

          <?=$maxitem;?>.&nbsp;&nbsp;<?php echo $myitem['item_code']; ?> : <?=unescape($myitem['item_description']);?> - <?=number_format($myitem['item_quantity'],4);?> <?=$myitem['item_unit'];?><br>

        <? } ?>

      </td>
      </tr>
      <tr valign=top>
      <td valign=top width=750 colspan=3 class=rptlistcontent style="font-size: 11px;">
      <br><br><br>
      Kindly send or fax back your quotation together with your Catalogue or Sample ( if any ) to us on or before:<br><br>
      <b><u>&nbsp;&nbsp;&nbsp;&nbsp;<?=unconverttounixslash($itq_data['itq_returndate']);?>&nbsp;&nbsp;&nbsp;&nbsp;</u></b>
      <br><br><br>
      Should you need any clarification and further information, please do not hesitate to contact the undersigned.
      <br><br>
      Your kind co-operation and support is most appreciated.
      <br><br>
      Thank you.
      <br><br>
      Yours faithfully,<br>
      <span style="font-size: 12px;"><b><i>KEMBANG SERANTAU SDN BHD</i></b></span>
      <br><br><br><br><br>
	  <? echo $pubuserfullname;?><br>
      <u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</u><br>
      
	  <?php
	  $sql1 = "SELECT * FROM zikay_pmsv5.staff_profiles WHERE staff_name = '$pubuserfullname'";
	  $sql2 = mysql_query($sql1);
	  while($data = mysql_fetch_array($sql2)) {
	  echo $data['staff_designation'];
	  
	  }
	  ?>
	  
	  <? //$itq_data['itq_requestor'];?><!--Purchasing Manager/Purchasing Executive-->
      </td>
      </tr>
    </td>
    </tr>
    </table>

  </td>
  </tr>
  </table>
  <br>

  <table border=0 cellspacing=2 cellpadding=0 width=760 style="position: absolute; top: 1000px;">
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>
    <table border=0 cellspacing=0 cellpadding=2 width=750>
    <tr valign=top>
    <td valign=top width=750 class=rptlistcontent style="text-align: center;">
    <!--<span style="font-family: times new roman; font-size: 11px;">THIS IS A COMPUTER GENERATED FORM AND IT DOES NOT REQUIRE ANY SIGNATURE</span>-->
    </td>
    </tr>
    </table>
  </td>
  </tr>
  </table>

  <table border=0 cellspacing=2 cellpadding=0 width=760 style="position: absolute; top: 1020px;">
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>
    <table border=0 cellspacing=0 cellpadding=2 width=760>
    <tr valign=top>
    <td valign=top width=750 class=listcontent style="border-left: 0px; border-top: 0px; border-right: 0px; border-bottom: 0px;">
      <table border=0 cellspacing=0 cellpadding=2 width=750>
      <tr valign=top>
      <td valign=top width=750 class=rptlistcontent style="text-align: center; border-top: 1px solid black;">
      <span style="font-family: times new roman; font-size: 11px;"><b>ARAS 8, BANGUNAN ZIKAY, JALAN RAJA ALANG, KAMPUNG BARU, 50300 KUALA LUMPUR.</b></span><br><span style="font-family: arial; font-size: 11px;"><b>TEL: 03-26988789 &nbsp;&nbsp;&nbsp; FAX: 03-26936775</b></span>
      </td>
      </tr>
    </td>
    </tr>
    </table>

  </td>
  </tr>
  </table>

<? if ($maxitem==6) { ?>

  <p style="page-break-before: always;">&nbsp;</p>

<span class="noprint">
<hr size=1 style="border: 1px solid black;">
</span>

  <table border=0 cellspacing=2 cellpadding=0 width=750>
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>
    <table border=0 cellspacing=0 cellpadding=2 width=750>
    <tr valign=top>
    <td valign=top width=60 class=cboxcontent>TRADE : </td>
    <td valign=top width=430 class=cboxcontent style="border-bottom: 1px solid black;"><?=$trade_data['tradedescription'];?></td>
    <td valign=top width=60 class=cboxcontent>&nbsp;</td>
    <td valign=top width=60 class=cboxcontent>RFQ NO : </td>
    <td valign=top width=140 class=cboxcontent style="border-bottom: 1px solid black;"><?=itqidstr($itq_data['itq_rfqno'],$itq_data['itq_revno']);?></td>
    </tr>
    </table>
    <br>
  </td>
  </tr>
  </table>

  <table border=0 cellspacing=2 cellpadding=0 width=750>
  <tr valign=top>
  <td valign=top width=100% class=cboxcontent>

    <table border=0 cellspacing=0 cellpadding=2 width=750 style="border: 1px solid black; border-collapse: collapse;">
    <tr valign=top>
    <td valign=top width=40 class=rptlistheader style="text-transform: none;">Item</td>
    <td valign=top width=490 class=rptlistheader style="text-transform: none;">Description</td>
    <td valign=top width=80 class=rptlistheader style="text-transform: none;">Unit</td>
    <td valign=top width=140 class=rptlistheader style="text-transform: none;">Qty</td>
    </tr>
    <tr valign=top>
    <td valign=top width=40 class=rptlistnumber>&nbsp;</td>
    <td valign=top width=490 class=rptlistcontent-left>&nbsp;</td>
    <td valign=top width=80 class=rptlistcontent-left style="text-align: center;">&nbsp;</td>
    <td valign=top width=140 class=rptlistcontentnumeric-left>&nbsp;</td>
    </tr>

    <? $maxitem=0; ?>
    <? reset($mro_items); ?>
    <? foreach($mro_items as $myitem) { ?>

      <? $maxitem++; ?>
      <? if ($maxitem>5) { ?>
        <tr valign=top>
        <td valign=top width=40 class=rptlistnumber><?=$myitem['item_no'];?>&nbsp;</td>
        <td valign=top width=490 class=rptlistcontent-left><?=unescape($myitem['item_description']);?>&nbsp;</td>
        <td valign=top width=80 class=rptlistcontent-left style="text-align: center;"><?=$myitem['item_unit'];?>&nbsp;</td>
        <td valign=top width=140 class=rptlistcontentnumeric-left><?=number_format($myitem['item_quantity'],4);?>&nbsp;</td>
        </tr>
     <? } ?>

    <? } ?>

    <tr valign=top>
    <td valign=top width=40 height=20 class=rptlistnumber>&nbsp;</td>
    <td valign=top width=490 class=rptlistcontent-left>&nbsp;</td>
    <td valign=top width=80 class=rptlistcontent-left style="text-align: center;">&nbsp;</td>
    <td valign=top width=140 class=rptlistcontentnumeric-left>&nbsp;</td>
    </tr>

    </table>

  </td>
  </tr>
  </table>

<? } ?>

<span class="noprint">
<br>
<button name="printreport" id="printreport" onClick="javascript:print_report();">&nbsp;Print&nbsp;</button>
</span>

</td>
</tr>
</table>
</body>
</html>

<!-- MeadCo ScriptX -->
<!-- For IE 7 only (not using MeadCo's scale-to-fit)
<object id="factory" viewastext style="display:none"
   classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
   codebase="http://[your_path]/smsx.cab#Version=6,4,438,06">
</object>
-->

<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
   classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
   codebase="../lib/smsx.cab#Version=6,4,438,06">
   <param name="template" value="MeadCo://IE7" />
</object>

<script type="text/javascript">
function print_report() {
  //window.print();
  // save before meadco
  var h=factory.printing.header;
  var f=factory.printing.footer;
  var o=factory.printing.portrait;
  var lm=factory.printing.leftMargin;
  var tm=factory.printing.topMargin;
  var rm=factory.printing.rightMargin;
  var bm=factory.printing.bottomMargin;
  // set and print (&b for tab)
  factory.printing.header = "";
  factory.printing.footer = "";
  factory.printing.portrait = true;
  factory.printing.leftMargin = 0.75;
  factory.printing.topMargin = 0.55;
  factory.printing.rightMargin = 0.75;
  factory.printing.bottomMargin = 0.75;
  factory.printing.Print(true);
  // restore..
  factory.printing.header=h;
  factory.printing.footer=f;
  factory.printing.portrait=o;
  factory.printing.leftMargin=lm;
  factory.printing.topMargin=tm;
  factory.printing.rightMargin=rm;
  factory.printing.bottomMargin=bm;
}
</script>
