コード例 #1
0
                     }
                     $SQL .= "WHERE stockid='" . $OrderLine->StockID . "'\n\t\t\t\t\t\t\t\t\t\t\t AND loccode = '" . $_SESSION['PO' . $identifier]->Location . "'\n\t\t\t\t\t\t\t\t\t\t\t AND serialno = '" . $Item->BundleRef . "'";
                 } else {
                     $SQL = "INSERT INTO stockserialitems (stockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tloccode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tserialno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tqualitytext,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\texpirationdate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tquantity)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $OrderLine->StockID . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['PO' . $identifier]->Location . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $Item->BundleRef . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($Item->ExpiryDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $Item->BundleQty . "')";
                 }
                 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because');
                 $DbgMsg = _('The following SQL to insert the serial stock item records was used');
                 $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                 /* end of handle stockserialitems records */
                 /** now insert the serial stock movement **/
                 $SQL = "INSERT INTO stockserialmoves (stockmoveno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tserialno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmoveqty)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $StkMoveNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $OrderLine->StockID . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $Item->BundleRef . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $Item->BundleQty . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)";
                 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because');
                 $DbgMsg = _('The following SQL to insert the serial stock movement records was used');
                 $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                 if ($_SESSION['QualityLogSamples'] == 1) {
                     CreateQASample($OrderLine->StockID, $Item->BundleRef, '', 'Created from Purchase Order', 0, 0, $db);
                 }
             }
             //non blank BundleRef
         }
         //end foreach
     }
 }
 /*end of its a stock item - updates to locations and insert movements*/
 /* Check to see if the line item was flagged as the purchase of an asset */
 if ($OrderLine->AssetID != '' and $OrderLine->AssetID != '0') {
     //then it is an asset
     /*first validate the AssetID and if it doesn't exist treat it like a normal nominal item  */
     $CheckAssetExistsResult = DB_query("SELECT assetid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdatepurchased,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcostact\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM fixedassets\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN fixedassetcategories\n\t\t\t\t\t\t\t\t\t\t\t\t\tON fixedassets.assetcategoryid=fixedassetcategories.categoryid\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE assetid='" . $OrderLine->AssetID . "'");
     if (DB_num_rows($CheckAssetExistsResult) == 1) {
         //then work with the assetid provided
コード例 #2
0
        $result = DB_query($sql, $ErrMsg, $DbgMsg);
        prnMsg($msg, 'success');
        if ($_POST['Cert'] == 1) {
            $result = DB_query("SELECT prodspeckey, lotkey FROM qasamples\n\t\t\t\t\t\t\tWHERE sampleid = '" . $SelectedSampleID . "'");
            $myrow = DB_fetch_row($result);
            if ($myrow[0] > '') {
                $sql = "UPDATE qasamples SET cert='0'\n\t\t\t\t\t\tWHERE sampleid <> '" . $SelectedSampleID . "'\n\t\t\t\t\t\tAND prodspeckey='" . $myrow[0] . "'\n\t\t\t\t\t\tAND lotkey='" . $myrow[1] . "'";
                $msg = _('All other samples for this Specification and Lot was marked as Cert=No');
                $ErrMsg = _('The update of the QA Sample failed because');
                $DbgMsg = _('The SQL that was used and failed was');
                $result = DB_query($sql, $ErrMsg, $DbgMsg);
                prnMsg($msg, 'success');
            }
        }
    } else {
        CreateQASample($_POST['ProdSpecKey'], $_POST['LotKey'], $_POST['Identifier'], $_POST['Comments'], $_POST['Cert'], $_POST['DuplicateOK'], $db);
        $SelectedSampleID = DB_Last_Insert_ID($db, 'qasamples', 'sampleid');
        if ($SelectedSampleID > '') {
            $msg = _('Created New Sample');
            prnMsg($msg, 'success');
        }
    }
    unset($SelectedSampleID);
    unset($_POST['ProdSpecKey']);
    unset($_POST['LotKey']);
    unset($_POST['Identifier']);
    unset($_POST['Comments']);
    unset($_POST['Cert']);
} elseif (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked instead of the submit button
    // PREVENT DELETES IF DEPENDENT RECORDS
コード例 #3
0
                     $SQL = "SELECT sum(moveqty) FROM stockserialmoves\n\t\t\t\t\t\t\t\t\t\tINNER JOIN stockmoves ON stockserialmoves.stockmoveno=stockmoves.stkmoveno\n\t\t\t\t\t\t\t\t\t\tWHERE stockmoves.type=26\n\t\t\t\t\t\t\t\t\t\tAND stockserialmoves.stockid='" . $_POST['StockID'] . "'\n\t\t\t\t\t\t\t\t\t\tAND stockserialmoves.serialno='" . $_POST['BatchRef' . $i] . "'";
                     $BatchTotQtyResult = DB_query($SQL);
                     $BatchTotQtyRow = DB_fetch_row($BatchTotQtyResult);
                     /*	if ($BatchTotQtyRow[0] >= $_POST['QtyReqd'.$i]){
                     					//need to delete the item from woserialnos
                     					$SQL = "DELETE FROM	woserialnos
                     							WHERE wo='" . $_POST['WO'] . "'
                     							AND stockid='" . $_POST['StockID'] ."'
                     							AND serialno='" . $_POST['BatchRef'.$i] . "'";
                     					$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The predefined batch/lot/bundle record could not be deleted because');
                     					$DbgMsg = _('The following SQL to delete the predefined work order batch/bundle/lot record was used');
                     					$Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
                     			} */
                 }
                 if ($_SESSION['QualityLogSamples'] == 1) {
                     CreateQASample($_POST['StockID'], $_POST['BatchRef' . $i], '', 'Created from Work Order', 0, 0, $db);
                 }
             }
             //non blank BundleRef
         }
         //end for all of the potential batch/lot fields received
     }
     //end of the batch controlled stuff
 }
 //end if the woitem received here is a controlled item
 /* If GLLink_Stock then insert GLTrans to debit the GL Code  and credit GRN Suspense account at standard cost*/
 if ($_SESSION['CompanyRecord']['gllink_stock'] == 1 and $WORow['stdcost'] * $QuantityReceived != 0) {
     /*GL integration with stock is activated so need the GL journals to make it so */
     /*first the debit the finished stock of the item received from the WO
       the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off
       it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/