Example #1
0
function getProductAvailableQty($materialId)
{
    $getReturnMessage = new CommonMethods();
    global $dbh;
    $stmt = $dbh->prepare("SELECT * FROM inventory WHERE materialid={$materialId}");
    if ($stmt->execute()) {
        $json_array = array();
        while ($result2 = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $inventoryData = array();
            $inventoryData['warehouseid'] = $result2['warehouseid'];
            $inventoryData['companyid'] = $result2['companyid'];
            $inventoryData['inventoryid'] = $result2['inventoryid'];
            $inventoryData['totalquantity'] = $result2['totalquantity'];
            $inventoryData['packagingtype'] = $result2['packagingtype'];
            $inventoryData['packagingsize'] = $result2['packagingsize'];
            $warehouseId = $result2['warehouseid'];
            $companyId = $result2['companyid'];
            $inventoryData['companyName'] = DatabaseCommonOperations::getCompanyName($warehouseId);
            $inventoryData['warehouseName'] = DatabaseCommonOperations::getWarehouseName($companyId);
            array_push($json_array, $inventoryData);
        }
        $json = json_encode($json_array);
        echo $json;
        //            $getReturnMessage->showAlert('success',$json );
    } else {
        $getReturnMessage->showAlert('error', "No Data Found");
    }
}
Example #2
0
                <?php 
echo $form->error($ModelVideo, 'video_1080p', array('class' => 'text-danger'));
?>
 
                <span class="glyphicon <?php 
echo $iconStat;
?>
 form-control-feedback"></span>
            </div>
            <div class="form-group <?php 
echo $fieldStat;
?>
 has-feedback">
                <?php 
$parents = CmsvideoCategories::model()->findAll('parent_id = 1');
$cm = new CommonMethods();
$data = $cm->makeDropDown($parents);
?>
                <?php 
echo $form->labelEx($ModelVideo, 'video_category');
?>
                <?php 
echo $form->dropDownList($ModelVideo, 'video_category', $data, array('class' => 'form-control'));
?>
                <?php 
echo $form->error($ModelVideo, 'video_category');
?>
            </div> 
            <div class="form-group <?php 
echo $fieldStat;
?>
 *	Get connection to the Database
 **********************************************/
$db = Database::getInstance();
$dbh = $db->getConnection();
$opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
// Get Data From ANgular Service
$productDetails = json_decode($_GET["product"]);
/****************************************************************
 *Get Data into variables 
 *
 *****************************************************************/
if (!isset($_SESSION['token'])) {
    session_start();
}
$userId = $_SESSION['token'];
$showAlerts = new CommonMethods();
$productModel = new ProductModel();
$productModel->_setProductName($productDetails->productname);
$productModel->_setProductAbbrevations($productDetails->abbrevation);
$productModel->_setProductUnitOfMeasure($productDetails->unitofmeasure);
$productModel->_setProductAlertQty($productDetails->alertquantity);
$productModel->_setProductColor($productDetails->color);
$productModel->_setProductDescription($productDetails->description);
$productModel->_setProductPackaging($productDetails->packaging);
$productModel->_setProductType($productDetails->materialtypeid);
$productModel->_setProductOperation($productDetails->opertaion);
$productObj = new Product($productModel);
switch ($productDetails->opertaion) {
    case 'insert':
        # code...
        if (!$productObj->isAvailable($dbh)) {