当前位置: 首页>>代码示例>>PHP>>正文


PHP getPrdQtyInStck函数代码示例

本文整理汇总了PHP中getPrdQtyInStck函数的典型用法代码示例。如果您正苦于以下问题:PHP getPrdQtyInStck函数的具体用法?PHP getPrdQtyInStck怎么用?PHP getPrdQtyInStck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getPrdQtyInStck函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateInventoryProductRel

function updateInventoryProductRel($entity)
{
    global $log, $adb, $updateInventoryProductRel_update_product_array;
    $entity_id = vtws_getIdComponents($entity->getId());
    $entity_id = $entity_id[1];
    $update_product_array = $updateInventoryProductRel_update_product_array;
    $log->debug("Entering into function updateInventoryProductRel(" . $entity_id . ").");
    if (!empty($update_product_array)) {
        foreach ($update_product_array as $id => $seq) {
            foreach ($seq as $seq => $product_info) {
                foreach ($product_info as $key => $index) {
                    $updqtyinstk = getPrdQtyInStck($key);
                    $upd_qty = $updqtyinstk + $index;
                    updateProductQty($key, $upd_qty);
                }
            }
        }
    }
    $adb->pquery("UPDATE vtiger_inventoryproductrel SET incrementondel=1 WHERE id=?", array($entity_id));
    $product_info = $adb->pquery("SELECT productid,sequence_no, quantity from vtiger_inventoryproductrel WHERE id=?", array($entity_id));
    $numrows = $adb->num_rows($product_info);
    for ($index = 0; $index < $numrows; $index++) {
        $productid = $adb->query_result($product_info, $index, 'productid');
        $qty = $adb->query_result($product_info, $index, 'quantity');
        $sequence_no = $adb->query_result($product_info, $index, 'sequence_no');
        $qtyinstk = getPrdQtyInStck($productid);
        $upd_qty = $qtyinstk - $qty;
        updateProductQty($productid, $upd_qty);
        $sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($entity_id, $sequence_no));
        if ($adb->num_rows($sub_prod_query) > 0) {
            for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) {
                $sub_prod_id = $adb->query_result($sub_prod_query, $j, "productid");
                $sqtyinstk = getPrdQtyInStck($sub_prod_id);
                $supd_qty = $sqtyinstk - $qty;
                updateProductQty($sub_prod_id, $supd_qty);
            }
        }
    }
    $log->debug("Exit from function updateInventoryProductRel(" . $entity_id . ")");
}
开发者ID:jaimeaga84,项目名称:corebos,代码行数:40,代码来源:InventoryUtils.php

示例2: updateQtyInStock

 /**	Function used to save the Inventory product details for the passed entity
  *	@param object reference $focus - object reference to which we want to save the product details from REQUEST values where as the entity will be out,in
  *	@param string $module - module name
  *	@param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
  *	@return void
  */
 function updateQtyInStock()
 {
     global $log;
     $log->debug("Entering into function updateQtyInStock().");
     $query = "select productid, quantity from ec_inventoryproductrel where id='" . $this->id . "'";
     $result = $this->db->query($query);
     while ($row = $this->db->fetch_array($result)) {
         $productid = $row['productid'];
         $quantity = $row['quantity'];
         $qtyinstock = getPrdQtyInStck($productid);
         $lates_qty = $qtyinstock + $quantity;
         updateProductQty($productid, $lates_qty);
     }
     $log->debug("Exit from function updateQtyInStock().");
 }
开发者ID:honj51,项目名称:taobaocrm,代码行数:21,代码来源:Relsettings.php

示例3: elseif

    $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
    $smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $associated_prod = $INVOICE_associated_prod;
    $smarty->assign("AVAILABLE_PRODUCTS", 'true');
    $smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '' || isset($_REQUEST['opportunity_id']) && $_REQUEST['opportunity_id'] != '') {
    $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
    $InvTotal = getInventoryTotal($_REQUEST['return_module'], $_REQUEST['return_id']);
    $smarty->assign("MODE", $focus->mode);
    //this is to display the Product Details in first row when we create new PO from Product relatedlist
    if ($_REQUEST['return_module'] == 'Products') {
        $smarty->assign("PRODUCT_ID", vtlib_purify($_REQUEST['product_id']));
        $smarty->assign("PRODUCT_NAME", getProductName($_REQUEST['product_id']));
        $smarty->assign("UNIT_PRICE", vtlib_purify($_REQUEST['product_id']));
        $smarty->assign("QTY_IN_STOCK", getPrdQtyInStck($_REQUEST['product_id']));
        $smarty->assign("VAT_TAX", getProductTaxPercentage("VAT", $_REQUEST['product_id']));
        $smarty->assign("SALES_TAX", getProductTaxPercentage("Sales", $_REQUEST['product_id']));
        $smarty->assign("SERVICE_TAX", getProductTaxPercentage("Service", $_REQUEST['product_id']));
    }
}
if (isset($cust_fld)) {
    $smarty->assign("CUSTOMFIELD", $cust_fld);
}
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
if (isset($_REQUEST['return_module'])) {
    $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
} else {
    $smarty->assign("RETURN_MODULE", "Invoice");
}
if (isset($_REQUEST['return_action'])) {
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:EditView.php

示例4: addProductsToStock

function addProductsToStock($recordId)
{
    $adb = PearDatabase::getInstance();
    $product_info = $adb->pquery("SELECT productid,sequence_no, quantity from vtiger_inventoryproductrel WHERE id=?", array($recordId));
    $numrows = $adb->num_rows($product_info);
    for ($index = 0; $index < $numrows; $index++) {
        $productid = $adb->query_result($product_info, $index, 'productid');
        $qty = $adb->query_result($product_info, $index, 'quantity');
        $sequence_no = $adb->query_result($product_info, $index, 'sequence_no');
        $qtyinstk = getPrdQtyInStck($productid);
        $upd_qty = $qtyinstk + $qty;
        updateProductQty($productid, $upd_qty);
        $sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($recordId, $sequence_no));
        if ($adb->num_rows($sub_prod_query) > 0) {
            for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) {
                $sub_prod_id = $adb->query_result($sub_prod_query, $j, "productid");
                $sqtyinstk = getPrdQtyInStck($sub_prod_id);
                $supd_qty = $sqtyinstk + $qty;
                updateProductQty($sub_prod_id, $supd_qty);
            }
        }
    }
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:23,代码来源:InventoryUtils.php

示例5: updateProductStockFromDatabase

function updateProductStockFromDatabase($recordId, $add = true)
{
    global $adb;
    $pdosql = 'SELECT vtiger_inventoryproductrel.productid,sequence_no, quantity
		from vtiger_inventoryproductrel
		inner join vtiger_products on vtiger_products.productid = vtiger_inventoryproductrel.productid
		WHERE id=?';
    $subpdosql = 'SELECT vtiger_inventorysubproductrel.productid
		from vtiger_inventorysubproductrel
		inner join vtiger_products on vtiger_products.productid = vtiger_inventorysubproductrel.productid
		WHERE id=? AND sequence_no=?';
    $product_info = $adb->pquery($pdosql, array($recordId));
    $numrows = $adb->num_rows($product_info);
    for ($index = 0; $index < $numrows; $index++) {
        $productid = $adb->query_result($product_info, $index, 'productid');
        $qty = $adb->query_result($product_info, $index, 'quantity');
        $sequence_no = $adb->query_result($product_info, $index, 'sequence_no');
        $qtyinstk = getPrdQtyInStck($productid);
        if ($add) {
            $upd_qty = $qtyinstk + $qty;
        } else {
            $upd_qty = $qtyinstk - $qty;
        }
        updateProductQty($productid, $upd_qty);
        $sub_prod_query = $adb->pquery($subpdosql, array($recordId, $sequence_no));
        if ($adb->num_rows($sub_prod_query) > 0) {
            for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) {
                $sub_prod_id = $adb->query_result($sub_prod_query, $j, "productid");
                $sqtyinstk = getPrdQtyInStck($sub_prod_id);
                if ($add) {
                    $supd_qty = $sqtyinstk + $qty;
                } else {
                    $supd_qty = $sqtyinstk - $qty;
                }
                updateProductQty($sub_prod_id, $supd_qty);
            }
        }
    }
}
开发者ID:jgjermeni,项目名称:corebos,代码行数:39,代码来源:InventoryUtils.php

示例6: save_module

 function save_module($module)
 {
     global $adb, $updateInventoryProductRel_deduct_stock;
     $updateInventoryProductRel_deduct_stock = false;
     //in ajax save we should not call this function, because this will delete all the existing product values
     if ($_REQUEST['action'] != 'PurchaseOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false && $_REQUEST['action'] != 'FROM_WS') {
         $requestProductIdsList = $requestQuantitiesList = array();
         $totalNoOfProducts = $_REQUEST['totalProductCount'];
         for ($i = 1; $i <= $totalNoOfProducts; $i++) {
             $productId = $_REQUEST['hdnProductId' . $i];
             $requestProductIdsList[$productId] = $productId;
             if (array_key_exists($productId, $requestQuantitiesList)) {
                 $requestQuantitiesList[$productId] = $requestQuantitiesList[$productId] + $_REQUEST['qty' . $i];
                 continue;
             }
             $requestQuantitiesList[$productId] = $_REQUEST['qty' . $i];
         }
         if ($this->mode == '' && $this->column_fields['postatus'] === 'Received Shipment') {
             //Updating Product stock quantity during create mode
             foreach ($requestProductIdsList as $productId) {
                 addToProductStock($productId, $requestQuantitiesList[$productId]);
             }
         } else {
             if ($this->column_fields['postatus'] === 'Received Shipment' && $this->mode != '') {
                 //Updating Product stock quantity during edit mode
                 $recordId = $this->id;
                 $result = $adb->pquery("SELECT productid, quantity FROM vtiger_inventoryproductrel WHERE id = ?", array($recordId));
                 $numOfRows = $adb->num_rows($result);
                 for ($i = 0; $i < $numOfRows; $i++) {
                     $productId = $adb->query_result($result, $i, 'productid');
                     $productIdsList[$productId] = $productId;
                     $quantitiesList[$productId] = $adb->query_result($result, $i, 'quantity');
                 }
                 $newProductIds = array_diff($requestProductIdsList, $productIdsList);
                 if ($newProductIds) {
                     foreach ($newProductIds as $productId) {
                         addToProductStock($productId, $requestQuantitiesList[$productId]);
                     }
                 }
                 $deletedProductIds = array_diff($productIdsList, $requestProductIdsList);
                 if ($deletedProductIds) {
                     foreach ($deletedProductIds as $productId) {
                         $productStock = getPrdQtyInStck($productId);
                         $quantity = $productStock - $quantitiesList[$productId];
                         updateProductQty($productId, $quantity);
                     }
                 }
                 $updatedProductIds = array_intersect($productIdsList, $requestProductIdsList);
                 if ($updatedProductIds) {
                     foreach ($updatedProductIds as $productId) {
                         $quantityDiff = $quantitiesList[$productId] - $requestQuantitiesList[$productId];
                         if ($quantityDiff < 0) {
                             $quantityDiff = -$quantityDiff;
                             addToProductStock($productId, $quantityDiff);
                         } elseif ($quantityDiff > 0) {
                             $productStock = getPrdQtyInStck($productId);
                             $quantity = $productStock - $quantityDiff;
                             updateProductQty($productId, $quantity);
                         }
                     }
                 }
             }
         }
         //Based on the total Number of rows we will save the product relationship with this entity
         saveInventoryProductDetails($this, 'PurchaseOrder', $this->update_prod_stock);
         if ($this->mode != '') {
             $updateInventoryProductRel_deduct_stock = true;
         }
     }
     // Update the currency id and the conversion rate for the purchase order
     $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?";
     $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
     $adb->pquery($update_query, $update_params);
 }
开发者ID:krzychab,项目名称:YetiForceCRM,代码行数:74,代码来源:PurchaseOrder.php


注:本文中的getPrdQtyInStck函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。