$tmpl->place('header');
?>
<script type="text/javascript" src="./js/document-po-view.js"></script>
<?php 
$tmpl->place('menu');
?>
<div id="content" class="span-24 last">

	<?php 
$tmpl->place('menuDocument');
if (!isset($_GET['id'])) {
    echo "<div class=\"span-24 ui-state-error ui-corner-all\">\n\t\t\t\t\t<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 30px;\"></span>\n\t\t\t\t\tYou arrived to this page in error</div>";
} else {
    try {
        $purchase = new Purchase($_GET['id']);
        $purchase_details = Purchase_detail::findDetail($_GET['id']);
        ?>
	<h2>Purchase Order</h2> 
  <div align=left> <a href=report/pdf.php?POnum=<?php 
        echo $_GET['id'];
        ?>
><b>Download PDF</b></a></div><br>
	<div class="form-frame span-23 last">
		<h3>Purchase Order</h3><br />
		<label for="doc_num">Document Number </label>
			<?php 
        Purchase::checkDuplicatePo($_GET['id']);
        echo $purchase->preparePoNumber();
        echo "<input id=\"PrNumber\" type=\"hidden\" value=\"" . $purchase->prepareDocNumber() . "\" />";
        ?>
		<label class="mofLabel" for="mof_num">MOF Number</label>
Exemplo n.º 2
0
         if (!$error) {
             $total = $total - $_POST['discount'];
             $purchase->setTotal(round($total, 2));
             $purchase->store();
         }
     } catch (fExpectedException $e) {
         echo $e->printMessage();
         $error = true;
     }
 } else {
     if ($_POST['type'] == "countPR") {
         $countPR = Purchase::findByBranch(fRequest::get('branch', 'string'), fRequest::get('doctype', 'string'));
         echo sprintf("%03d", $countPR->count() + 1);
     } else {
         if ($_POST['type'] == "json") {
             $purchasedetails = Purchase_detail::findDetail($_POST['key']);
             echo $purchasedetails->toJSON();
         } else {
             if ($_POST['type'] == "cancelPO") {
                 $purchase = new Purchase($_POST['key']);
                 $purchase->setStatus('cancelled');
                 $purchase->store();
             } else {
                 if ($_POST['type'] == "cancelPR") {
                     $purchase = new Purchase($_POST['key']);
                     $purchase->setStatus('cancelled');
                     $purchase->store();
                 } else {
                     if ($_POST['type'] == "deleteDetail") {
                         Purchase_detail::deleteDetail($_POST['key']);
                     } else {