[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 /** 12 * PurchaseOrder Record Model Class 13 */ 14 class PurchaseOrder_Record_Model extends Inventory_Record_Model { 15 16 /** 17 * This Function adds the specified product quantity to the Product Quantity in Stock 18 * @param type $recordId 19 */ 20 function addStockToProducts($recordId) { 21 $db = PearDatabase::getInstance(); 22 23 $recordModel = Inventory_Record_Model::getInstanceById($recordId); 24 $relatedProducts = $recordModel->getProducts(); 25 26 foreach ($relatedProducts as $key => $relatedProduct) { 27 if($relatedProduct['qty'.$key]){ 28 $productId = $relatedProduct['hdnProductId'.$key]; 29 $result = $db->pquery("SELECT qtyinstock FROM vtiger_products WHERE productid=?", array($productId)); 30 $qty = $db->query_result($result,0,"qtyinstock"); 31 $stock = $qty + $relatedProduct['qty'.$key]; 32 $db->pquery("UPDATE vtiger_products SET qtyinstock=? WHERE productid=?", array($stock, $productId)); 33 } 34 } 35 } 36 37 /** 38 * This Function returns the current status of the specified Purchase Order. 39 * @param type $purchaseOrderId 40 * @return <String> PurchaseOrderStatus 41 */ 42 function getPurchaseOrderStatus($purchaseOrderId){ 43 $db = PearDatabase::getInstance(); 44 $sql = "SELECT postatus FROM vtiger_purchaseorder WHERE purchaseorderid=?"; 45 $result = $db->pquery($sql, array($purchaseOrderId)); 46 $purchaseOrderStatus = $db->query_result($result,0,"postatus"); 47 return $purchaseOrderStatus; 48 } 49 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |