static function deleteDetail($key)
 {
     try {
         $detail = new Production_issue_detail($key);
         $detail->delete();
     } catch (fValidationException $e) {
         echo $e->printMessage();
     }
 }
Пример #2
0
    ?>
	<h3>List (Pending)</h3>
	<table>
		<thead>
			<tr><th>Document Number</th><th>Document Date</th><th>Issuer and Receiver</th><th style="width: 100px;">Status</th></tr>
		</thead>
		<tbody>
			<?php 
    try {
        $productionEntries = Production_issue::findByStatus('pending');
        foreach ($productionEntries as $productionEntry) {
            //$statusAll = "completed";
            //if($productionEntry->getStatus() == "pending")
            //{
            $statusAll = "checking";
            $productionDetails = Production_issue_detail::findDetail($productionEntry->getDocNumber());
            foreach ($productionDetails as $productionDetail) {
                if ($productionDetail->getStatus() == "pending") {
                    $statusAll = "pending";
                }
            }
            if ($statusAll == "checking") {
                $statusAll = "completed";
                $productionEntry->setStatus("completed");
                $productionEntry->store();
            }
            //}
            //else
            //{
            //	$statusAll = $productionEntry->prepareStatus();
            //}
fAuthorization::requireLoggedIn();
$tmpl->place('header');
?>
<script type="text/javascript" src="./js/document-pi-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 {
        $production = new Production_issue($_GET['id']);
        $production_details = Production_issue_detail::findDetail($_GET['id']);
        ?>
	<h2>Production Issue Form</h2>
  <div align=left> <a href=report/pi-pdf.php?PInum=<?php 
        echo $_GET['id'];
        ?>
><b>Download PDF</b></a></div><br>
	<div class="form-frame span-23 last">
		<h3>Production Issue Form</h3><br />
		<label for="doc_num">Document Number </label><span id="docNum"><?php 
        echo $production->prepareDocNumber();
        ?>
</span><br />
		<label for="doc_date">Document Date </label><?php 
        echo $production->prepareDocDate("j F Y");
        ?>
             }
         }
     } catch (fExpectedException $e) {
         echo $e->printMessage();
         $error = true;
     }
 } else {
     if ($_POST['type'] == "removeStock") {
         $records = Inv_stock::gotoStock($_POST['itemCode'], $_POST['branch']);
         if ($records->count()) {
             foreach ($records as $record) {
                 if ($record->getQuantity() < $_POST['itemQuan']) {
                     echo "Item not enough quantity";
                 } else {
                     Inv_stock::removeStock($_POST['itemCode'], $_POST['branch'], $_POST['itemQuan']);
                     $stock = new Production_issue_detail($_POST['detailId']);
                     $stock->setStatus('completed');
                     $stock->store();
                 }
             }
         } else {
             echo "Item not enough quantity.";
         }
     } else {
         if ($_POST['type'] == "save") {
             try {
                 $production = new Production_issue($_POST['key']);
                 //$production->populate();
                 if ($_POST['issuer'] != "") {
                     $production->setIssuer($_POST['issuer']);
                     $production->setIssuerDate($_POST['issuer_date']);