$app_list_strings['moduleList']['Accounts'],
'Leads' => $app_list_strings['moduleList']['Leads'],
);
require_once('modules/EcmProducts/EcmProduct.php');
require_once('modules/EcmProducts/Forms.php');
require_once('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmProduct();
if(isset($_REQUEST['record'])){
$focus->retrieve($_REQUEST['record']);
//if(isset($focus->id) && $focus->id != '')$focus->format_all_fields();
}
$json = getJSONobj();
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmProducts/views/DetailView/view.detail.ecmproducts.php');
$detail = new ViewDetailEcmProducts();
$detail->ss = new Sugar_Smarty();
$detail->bean = $focus;
$detail->preDisplay();
$uunit_array = array();
$uunit='';
$result = $db->query("select id,name from ecmproductusageunits order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$uunit.='';
$uunit_array[$row['id']] = $row['name'];
}
$detail->ss->assign("USAGE_UNIT_ID",$uunit);
$tax='';
$result = $db->query("select id,name from ecmvats where deleted='0' order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$tax.='';
}
$detail->ss->assign("VAT_ID",$tax);
$fbas='';
$result = $db->query("select id,name from ecmproductbasis order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$fbas.='';
}
$detail->ss->assign("FOB_BASIS_ID",$fbas);
$pack='';
$result = $db->query("select id,name from ecmproductpackingtypes order by name asc");
while(($row=$db->fetchByAssoc($result))!=null)
{
$pack.='';
}
$detail->ss->assign("PACKING_TYPE_ID",$pack);
//load currencies
require_once('modules/Currencies/Currency.php');
$currency = new Currency();
$currency_list = $currency->get_full_list('name');
$currency->retrieve('-99');
if(is_array($currency_list))
{
$currency_list = array_merge(Array($currency), $currency_list);
}
else
{
$currency_list = Array($currency);
}
$arr = array();
foreach($currency_list as $key=>$value)
{
$arr[$value->id] = $value->name;
}
$detail->ss->assign("EXCHANGE_RATE_NAME", $arr[$focus->exchange_rate_id]);
function show_image($img, $big)
{
if(is_file($img))
{
$obraz=@GetImageSize($img);
$obig = @GetImageSize($big);
if($obraz[0]>=180)
{
$szerokosc=180;
$wysokosc=$obraz[1]*$szerokosc/$obraz[0];
}
else
{
$szerokosc=$obraz[0];
$wysokosc=$obraz[1];
}
$height=$obig[1]+20;
$width=$obig[0]+20;
return '';
}
}
$detail->ss->assign("PRODUCT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->product_picture,"modules/EcmProducts/upload/images/big/".$focus->product_picture));
$detail->ss->assign("PACKING_FRONT_PICTURE", show_image("modules/EcmProducts/upload/images/".$focus->packing_front_picture,"modules/EcmProducts/upload/images/big/".$focus->packing_front_picture));
$detail->ss->assign("DRIVER_1", $focus->driver_1);
if($focus->driver_1)$detail->ss->assign("DRIVER_1_DOWNLOAD",'Download');
$detail->ss->assign("DRIVER_2", $focus->driver_2);
if($focus->driver_2)$detail->ss->assign("DRIVER_2_DOWNLOAD",'Download');
//add mz
$pl3 = $this->bean->showPositions3();
$detail->ss->assign('POSITIONS3', $pl3);
$pl4 = $this->bean->showPrices();
$detail->ss->assign('POSITIONS4', $pl4);
$ii='
| '.$mod_strings['LBL_II_STOCK'].' | '.$mod_strings['LBL_II_QTY'].' | '.$mod_strings['LBL_II_PRICE'].' |
| '.$r['sname']." | ".$r['q']." | ".number_format($r['p'],2,$GLOBALS['sugar_config']['default_decimal_seperator'],$GLOBALS['sugar_config']['default_number_grouping_seperator'])." |
');
//end mz
/*
$desc='';
$desc.='';
$desc.='';
$detail->ss->assign("CATALOGUE",$desc);
*/
//add mz - nowa karta produktu
global $mod_strings;
$desc='';
$desc.='';
$desc.='';
$detail->ss->assign("CATALOGUE_NEW",$desc);
$desc='';
$detail->ss->assign("DIV_DESC",$desc);
$desc='';
$detail->ss->assign("DIV_DESC_CARD",$desc);
//Added for Graduated Prices - Begin
/* require_once('modules/EcmProducts/EcmProductGraduatedPrices.php');
$epgp = new EcmProductGraduatedPrices($focus->graduated_prices);
$detail->ss->assign("PRODUCT_GRADUATED_PRICES_HTML", $epgp->getHtmlDetail());*/
//Added for Graduated Prices - End
//Added for Components
$detail->ss->assign("POSITION_LIST", $focus->getPositionList());
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::loadSettings();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
global $current_user;
$tmp = $current_user->getPreference('num_grp_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_number_grouping_seperator'];
$OPT['sep_1000'] = $tmp;
$tmp = $current_user->getPreference('dec_sep');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_decimal_seperator'];
$OPT['dec_sep'] = $tmp;
$tmp = $current_user->getPreference('default_currency_significant_digits');
if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_currency_significant_digits'];
$OPT['dec_len'] = $tmp;
$OPT['default_unit'] = "1";
$OPT['default_vat'] = "19.00";
$OPT['default_category'] = "";
$OPT['default_currency'] = "-99";
$OPT['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$uunit='';
foreach($app_list_strings['ecmproducts_unit_dom'] as $key=>$value){
$uunit.='';
}
$OPT['ecmproduct_usage_units_options'] =$app_list_strings['ecmproducts_unit_dom'];
$scriptOpt = '
';
echo $scriptOpt;
$detail->ss->assign("OPT", $OPT);
//Added for Components
global $current_user;
$detail->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
echo $detail->display();
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($focus, "EcmProducts");
echo $subpanel->display();
?>