[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 4 * ("License"); You may not use this file except in compliance with the 5 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL 6 * Software distributed under the License is distributed on an "AS IS" basis, 7 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 8 * the specific language governing rights and limitations under the License. 9 * The Original Code is: SugarCRM Open Source 10 * The Initial Developer of the Original Code is SugarCRM, Inc. 11 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; 12 * All Rights Reserved. 13 * Contributor(s): ______________________________________. 14 ********************************************************************************/ 15 /********************************************************************************* 16 * $Header$ 17 * Description: TODO To be written. 18 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. 19 * All Rights Reserved. 20 * Contributor(s): ______________________________________.. 21 ********************************************************************************/ 22 23 require_once ('Smarty_setup.php'); 24 require_once ('data/Tracker.php'); 25 require_once ('modules/PurchaseOrder/PurchaseOrder.php'); 26 require_once ('include/CustomFieldUtil.php'); 27 require_once ('include/ComboUtil.php'); 28 require_once ('include/utils/utils.php'); 29 require_once ('include/FormValidationUtil.php'); 30 31 global $app_strings,$mod_strings,$log,$theme,$currentModule; 32 33 34 $focus = new PurchaseOrder(); 35 $smarty = new vtigerCRM_Smarty(); 36 global $current_user; 37 $currencyid=fetchCurrency($current_user->id); 38 $rate_symbol = getCurrencySymbolandCRate($currencyid); 39 $rate = $rate_symbol['rate']; 40 if(isset($_REQUEST['record']) && $_REQUEST['record'] != '') 41 { 42 $focus->id = $_REQUEST['record']; 43 $focus->mode = 'edit'; 44 $focus->retrieve_entity_info($_REQUEST['record'],"PurchaseOrder"); 45 $focus->name=$focus->column_fields['subject']; 46 } 47 if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { 48 $PO_associated_prod = getAssociatedProducts("PurchaseOrder",$focus); 49 $focus->id = ""; 50 $focus->mode = ''; 51 } 52 if(isset($_REQUEST['product_id']) && $_REQUEST['product_id'] !='') 53 { 54 $focus->column_fields['product_id'] = $_REQUEST['product_id']; 55 $log->debug("Purchase Order EditView: Product Id from the request is ".$_REQUEST['product_id']); 56 $associated_prod = getAssociatedProducts("Products",$focus,$focus->column_fields['product_id']); 57 $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); 58 $smarty->assign("AVAILABLE_PRODUCTS", 'true'); 59 } 60 61 // Get vtiger_vendor address if vtiger_vendorid is given 62 if(isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id']!='' && $_REQUEST['record']==''){ 63 require_once ('modules/Vendors/Vendors.php'); 64 $vend_focus = new Vendors(); 65 66 $vend_focus->retrieve_entity_info($_REQUEST['vendor_id'],"Vendors"); 67 $focus->column_fields['bill_city']=$vend_focus->column_fields['city']; 68 $focus->column_fields['ship_city']=$vend_focus->column_fields['city']; 69 $focus->column_fields['bill_street']=$vend_focus->column_fields['street']; 70 $focus->column_fields['ship_street']=$vend_focus->column_fields['street']; 71 $focus->column_fields['bill_state']=$vend_focus->column_fields['state']; 72 $focus->column_fields['ship_state']=$vend_focus->column_fields['state']; 73 $focus->column_fields['bill_code']=$vend_focus->column_fields['postalcode']; 74 $focus->column_fields['ship_code']=$vend_focus->column_fields['postalcode']; 75 $focus->column_fields['bill_country']=$vend_focus->column_fields['country']; 76 $focus->column_fields['ship_country']=$vend_focus->column_fields['country']; 77 $focus->column_fields['bill_pobox']=$vend_focus->column_fields['pobox']; 78 $focus->column_fields['ship_pobox']=$vend_focus->column_fields['pobox']; 79 } 80 $theme_path="themes/".$theme."/"; 81 $image_path=$theme_path."images/"; 82 //retreiving the combo values array 83 $comboFieldNames = Array('accounttype'=>'account_type_dom' 84 ,'industry'=>'industry_dom'); 85 $comboFieldArray = getComboArray($comboFieldNames); 86 87 $disp_view = getView($focus->mode); 88 $mode = $focus->mode; 89 if($disp_view == 'edit_view') 90 $smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); 91 else 92 { 93 $bas_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS'); 94 $adv_block = getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'ADV'); 95 96 $blocks['basicTab'] = $bas_block; 97 if(is_array($adv_block )) 98 $blocks['moreTab'] = $adv_block; 99 100 $smarty->assign("BLOCKS",$blocks); 101 $smarty->assign("BLOCKS_COUNT",count($blocks)); 102 } 103 $smarty->assign("OP_MODE",$disp_view); 104 105 $smarty->assign("MODULE",$currentModule); 106 $smarty->assign("SINGLE_MOD",'PurchaseOrder'); 107 $category = getParentTab(); 108 $smarty->assign("CATEGORY",$category); 109 110 111 $smarty->assign("MOD", $mod_strings); 112 $smarty->assign("APP", $app_strings); 113 114 115 require_once ($theme_path.'layout_utils.php'); 116 117 $log->info("Order view"); 118 119 if (isset($focus->name)) $smarty->assign("NAME", $focus->name); 120 else $smarty->assign("NAME", ""); 121 122 if($focus->mode == 'edit') 123 { 124 $smarty->assign("UPDATEINFO",updateInfo($focus->id)); 125 $associated_prod = getAssociatedProducts("PurchaseOrder",$focus); 126 $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); 127 $smarty->assign("MODE", $focus->mode); 128 } 129 elseif(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') 130 { 131 $smarty->assign("ASSOCIATEDPRODUCTS", $PO_associated_prod); 132 $smarty->assign("AVAILABLE_PRODUCTS", 'true'); 133 $smarty->assign("MODE", $focus->mode); 134 135 } 136 elseif((isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '')) { 137 $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); 138 $InvTotal = getInventoryTotal($_REQUEST['return_module'],$_REQUEST['return_id']); 139 $InvTotal = convertFromDollar($InvTotal,$rate); 140 $smarty->assign("MODE", $focus->mode); 141 142 //this is to display the Product Details in first row when we create new PO from Product relatedlist 143 if($_REQUEST['return_module'] == 'Products') 144 { 145 $smarty->assign("PRODUCT_ID",$_REQUEST['product_id']); 146 $smarty->assign("PRODUCT_NAME",getProductName($_REQUEST['product_id'])); 147 $smarty->assign("UNIT_PRICE",getUnitPrice($_REQUEST['product_id'])); 148 $smarty->assign("QTY_IN_STOCK",getPrdQtyInStck($_REQUEST['product_id'])); 149 $smarty->assign("VAT_TAX",getProductTaxPercentage("VAT",$_REQUEST['product_id'])); 150 $smarty->assign("SALES_TAX",getProductTaxPercentage("Sales",$_REQUEST['product_id'])); 151 $smarty->assign("SERVICE_TAX",getProductTaxPercentage("Service",$_REQUEST['product_id'])); 152 } 153 } 154 155 156 if(isset($cust_fld)) 157 { 158 $smarty->assign("CUSTOMFIELD", $cust_fld); 159 } 160 161 162 163 if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", $_REQUEST['return_module']); 164 else $smarty->assign("RETURN_MODULE","PurchaseOrder"); 165 if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']); 166 if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", $_REQUEST['return_id']); 167 if (isset($_REQUEST['return_viewname'])) $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); 168 $smarty->assign("THEME", $theme); 169 $smarty->assign("IMAGE_PATH", $image_path); 170 $smarty->assign("MODULE","PurchaseOrder"); 171 $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); 172 $smarty->assign("ID", $focus->id); 173 174 175 $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); 176 $smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); 177 178 179 //if create PO, get all available product taxes and shipping & Handling taxes 180 if($focus->mode != 'edit') 181 { 182 $tax_details = getAllTaxes('available'); 183 $sh_tax_details = getAllTaxes('available','sh'); 184 185 $smarty->assign("GROUP_TAXES",$tax_details); 186 $smarty->assign("SH_TAXES",$sh_tax_details); 187 } 188 189 190 191 192 $tabid = getTabid("PurchaseOrder"); 193 $validationData = getDBValidationData($focus->tab_name,$tabid); 194 $data = split_validationdataArray($validationData); 195 196 $smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); 197 $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); 198 $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); 199 200 $check_button = Button_Check($module); 201 $smarty->assign("CHECK", $check_button); 202 if($focus->mode == 'edit') 203 $smarty->display('Inventory/InventoryEditView.tpl'); 204 else 205 $smarty->display('Inventory/InventoryCreateView.tpl'); 206 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |