function showPurchaseOrderUI()
 {
     $db = Database::getInstance();
     $cxn = $db->getConnection();
     $any = new Anylist();
     if ($this->poid != '') {
         $q = "SELECT *,DATE_FORMAT(PO_Date,'%d-%m-%Y') as pod,DATE_FORMAT(Supp_Ref_Date,'%d-%m-%Y') as srd,DATE_FORMAT(Required_Date,'%d-%m-%Y') as rdate,DATE_FORMAT(Not_Later_Date,'%d-%m-%Y') as nldate FROM Purchase_Order WHERE PO_ID={$this->poid}";
         if (!($res = $cxn->query($q))) {
             exit("error (showPurchaseOrderUI) {$q} : {$cxn->error}");
         }
         $r = mysqli_fetch_assoc($res);
         $this->pono = $r['PO_NO'];
         $this->supplierid = $r['Supplier_ID'];
         $this->podatedb = $r['PO_Date'];
         $this->podate = $r['pod'];
         $this->suppref = $r['Supp_Ref'];
         $this->supprefdatedb = $r['Supp_Ref_Date'];
         $this->supprefdate = $r['srd'];
         $this->potermid = $r['Terms_ID'];
         $this->currency = $r['Currency'];
         $this->notes = $r['Notes'];
         $this->requireddatedb = $r['Required_Date'];
         $this->requireddate = $r['rdate'];
         $this->notlaterdatedb = $r['Not_Later_Date'];
         $this->notlaterdate = $r['nldate'];
         $qi = "SELECT * FROM PO_Item WHERE PO_ID={$this->poid}";
         if (!($res2 = $cxn->query($qi))) {
             exit("error (showPurchaseOrderUI2) {$qi} : {$cxn->error}");
         }
         $desc = array();
         $i = 0;
         while ($ri = mysqli_fetch_assoc($res2)) {
             $desc[$i] = ['poitemid' => $ri['PO_Item_ID'], 'desc' => $ri['Description'], 'qty' => $ri['Item_Qty'], 'price' => $ri['Unit_Price'], 'discount' => $ri['Discount']];
             $i++;
         }
     }
     echo '<fieldset><legend>Enter Purchase Order Details</legend>';
     echo '<p><label>Purchase Order No</label><input id="pono" name="pono" class="required" value="' . $this->pono . '">';
     echo '<p><label>Purchase Order Date</label><input id="podate" name="podate" class="required" value="' . $this->podate . '"><input id="podatedb" name="podatedb" type="hidden" value="' . $this->podatedb . '">';
     echo '<p><label>Supplier Ref No</label><input id="suppref" name="suppref" value="' . $this->suppref . '">';
     echo '<p><label>Supplier Ref Date</label><input id="supprefdate" name="supprefdate" class="required" value="' . $this->supprefdate . '"><input id="supprefdatedb" name="supprefdatedb" type="hidden" value="' . $this->supprefdatedb . '">';
     echo '<p><label>Currency</label><input id="currency" name="currency" value="' . $this->currency . '">';
     echo '<p><label>Notes</label><input id="notes" name="notes" value="' . $this->notes . '" size="100">';
     echo '<p><label>Required Date</label><input id="requireddate" name="requireddate" class="required" value="' . $this->requireddate . '"><input id="requireddatedb" name="requireddatedb" type="hidden" value="' . $this->requireddatedb . '">';
     echo '<p><label>Not Later Then Date</label><input id="notlaterdate" name="notlaterdate" class="required" value="' . $this->notlaterdate . '"><input id="notlaterdatedb" name="notlaterdatedb" type="hidden" value="' . $this->notlaterdatedb . '">';
     echo '<p><label>Purchase Order Item Details</label><input type="button" id="additem" value="Add One More Item">';
     echo '<table class="pcd" id="item"><tr><th>Sl No</th><th>Description</th><th>Quantity</th><th>Unit Price</th><th>Discount</th></tr>';
     if ($this->poid != '') {
         if (isset($desc[0]['poitemid'])) {
             $i = 0;
             $j = count($desc);
             while ($i < $j) {
                 $slno = $i + 1;
                 echo '<tr><td><input id="poitemid[' . $i . ']" name="poitemid[' . $i . ']" value="' . $desc[$i]['poitemid'] . '" type="hidden">' . $slno . '</td><td><input id="description[' . $i . ']" name="description[' . $i . ']" class="required" value="' . $desc[$i]['desc'] . '"></td>';
                 echo '<td><input i="itemqty[' . $i . ']" name="itemqty[' . $i . ']" class="required" value="' . $desc[$i]['qty'] . '"></td>';
                 echo '<td><input i="price[' . $i . ']" name="price[' . $i . ']" class="required" value="' . $desc[$i]['price'] . '"></td>';
                 echo '<td><input i="discount[' . $i . ']" name="discount[' . $i . ']" value="' . $desc[$i]['discount'] . '"></td></tr>';
                 $i++;
             }
         } else {
             $this->addItemRow('0');
         }
     } else {
         $this->addItemRow('0');
     }
     echo '</table>';
     echo '<fieldset><legend>Select Terms and Condition</legend>';
     $any->createAnyGrid('PO_Terms', 'Term', 'PO_Term_ID', $this->potermid);
     echo '<input type="button" id="preview" value="Preview PO">';
     echo '<input type="checkbox" id="previewok" name="previewok" value="1">PreView Checked OK';
     echo '</fieldset>';
 }
            //machine list
            $l = new Operator();
            $l->createLEaveList();
            $sel = new selectlist('Leave_ID', $l->getLeaveList(), 'Select Leave to Approve', 'Leave_ID', 'leavedesc', '', '', '1');
            break;
        case 'qmsactivity':
            //machine list
            $l = new QMS();
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
            } else {
                $id = '';
            }
            $l->createQMSTitleList();
            $sel = new selectlist('QMS_Sch_ID', $l->getQMSTitleList(), 'Select QMS Activity', 'QMS_Sch_ID', 'QMS_Title', 'class="required"', $id, '1');
            break;
        case 'qmsdesc':
            //machine list
            $any = new Anylist();
            if (isset($_GET['qmsdescid'])) {
                $qmsdescid = $_GET['qmsdescid'];
            } else {
                $qmsdescid = '';
            }
            $any->createAnyGrid('QMS_Desc', 'QMS_Desc', 'QMS_Desc_ID', $qmsdescid, 'QMS_Sch_ID', $_GET['qmsschid']);
            break;
        default:
            # code...
            break;
    }
}
Beispiel #3
0
 function showSpareUI()
 {
     $db = Database::getInstance();
     $cxn = $db->getConnection();
     $any = new Anylist();
     if ($this->spareid != '') {
         $q = "SELECT * FROM Spare WHERE Spare_ID={$this->spareid}";
         if (!($res = $cxn->query($q))) {
             exit("error (showSpareUI) : {$cxn->error}");
         }
         $r = mysqli_fetch_assoc($res);
         $this->description = $r['Description'];
         $this->supppartno = $r['Supplier_Part_NO'];
         $this->mfgpartno = $r['Mfg_Part_NO'];
         $this->machineid = $r['Machine_ID'];
     }
     echo '<fieldset><legend>Enter Spare Details</legend>';
     echo '<p><label>Description</label><input id="description" name="description" class="required" value="' . $this->description . '">';
     echo '<p><label>Supplier Part No</label><input id="supppartno" name="supppartno" class="required" value="' . $this->supppartno . '">';
     echo '<p><label>Manufacturres\'s Part No</label><input id="mfgpartno" name="mfgpartno" value="' . $this->mfgpartno . '">';
     echo '<fieldset><legend>Select Machines This Spare is Used For</legend>';
     $any->createAnyGrid('Machine', 'Machine_Name', 'Machine_ID', $this->machineid);
     echo '</fieldset>';
 }