retrieve($_REQUEST['record']);
$focus->format_all_fields();
if(isset($_REQUEST['status']) && $_REQUEST['status'] != '' ) {
$focus->doNotAccepted();
}
$focus->position_list = str_replace('"','\"',$focus->getPositionList());
$OPT['status'] = $focus->status;
} else {
$OPT['new_number'] = true;
$datef = $current_user->getPreference('datef');
if($datef != '') $sugar_config['datef'];
$focus->register_date = date($datef);
$focus->payment_date = date($datef,mktime()+30*24*60*60);
$focus->sell_date = date($datef);
}
//if access 'Delete' is avaible for user than he is Manager and he can confirm Quotes.
$OPT['user']['access']['send_email'] = $focus->ACLAccess("send_email");
if(isset($_REQUEST['send_email']) && $_REQUEST['send_email'] == '1') $OPT['setTab'] = 'EMAIL';
$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['type'] = $focus->type;
$OPT['to_is_vat_free'] = $focus->to_is_vat_free;
$cq = $current_user->getPreference('confirm_quotes');
$OPT['user']['confirm_quotes'] = ((isset($cq) && $cq)?1:0);
$w=$GLOBALS['db']->query("select name,id,value from ecmvats where deleted='0' order by name");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$VAT[$r['id']]=array(
"id"=>$r['id'],
"name"=>$r['name'],
"value"=>$r['value']
);
$nvats++;
}
$json = getJSONobj();
$show_pdf=$current_user->getPreference('show_pdf_in_div');
if(!isset($show_pdf)){
require_once('modules/EcmGroupSales/EcmGroupSale.php');
$cc = EcmGroupSale::loadSettings();
$show_pdf=$cc['show_pdf_in_div_global'];
}
$scriptOpt = '';
echo $scriptOpt;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmInsideOrders/views/DetailView/view.detail.my.php');
$edit = new ViewDetailMy();
$edit->ss = new Sugar_Smarty();
//echo $focus->subtotal;
$edit->bean = $focus;
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
$edit->bean->total = unformat_number($edit->bean->total);
$edit->module = "EcmInsideOrders";
$edit->preDisplay();
//$edit->bean->subtotal = unformat_number($edit->bean->subtotal);
//echo '
'.$edit->bean->subtotal;
$rdoc=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select * from ecminsideorders where id='".$_REQUEST['record']."'"));
$srw=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$rdoc['rw_stock_id']."'"));
$spw=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select name from ecmstocks where id='".$rdoc['pw_stock_id']."'"));
$edit->ss->assign("RW_STOCK", $srw['name']);
$edit->ss->assign("PW_STOCK", $spw['name']);
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select o.pw_id from ecminsideorders as o where o.id='".$focus->id."'"));
$r=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select count(*) as c from ecmstockdocinsideins where id='".$r['pw_id']."'"));
$edit->ss->assign("CID",$r['c']);
$arr_template = $focus->getTemplateList();
$desc.='';
$desc .= '