100 lines
5.8 KiB
PHP
100 lines
5.8 KiB
PHP
|
|
<?php
|
||
|
|
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||
|
|
die ( 'Not A Valid Entry Point' );
|
||
|
|
|
||
|
|
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
|
||
|
|
|
||
|
|
require_once ('modules/EcmQuotes/EcmQuote.php');
|
||
|
|
|
||
|
|
|
||
|
|
require_once ('include/time.php');
|
||
|
|
|
||
|
|
require_once ('include/json_config.php');
|
||
|
|
|
||
|
|
//add jquery
|
||
|
|
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
|
||
|
|
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
|
||
|
|
echo '<script type="text/javascript"
|
||
|
|
src="include/jQuery/jquery-2.1.0.min.js"></script>';
|
||
|
|
echo '<script type="text/javascript"
|
||
|
|
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
|
||
|
|
echo '<script type="text/javascript"
|
||
|
|
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
|
||
|
|
|
||
|
|
$json_config = new json_config ();
|
||
|
|
|
||
|
|
$focus = new EcmQuote ();
|
||
|
|
|
||
|
|
if (isset ( $_REQUEST ['record'] )) {
|
||
|
|
$focus->retrieve ( $_REQUEST ['record'] );
|
||
|
|
$focus->format_all_fields ();
|
||
|
|
$OPT ['status'] = $focus->status;
|
||
|
|
}
|
||
|
|
|
||
|
|
require_once ('include/MVC/View/SugarView.php');
|
||
|
|
|
||
|
|
require_once ('modules/EcmQuotes/views/DetailView/view.detail.my.php');
|
||
|
|
|
||
|
|
//create position list table
|
||
|
|
$pl = $focus->getPositionList();
|
||
|
|
|
||
|
|
$edit = new ViewDetailMy ();
|
||
|
|
$edit->ss = new Sugar_Smarty ();
|
||
|
|
$edit->module = 'EcmQuotes';
|
||
|
|
|
||
|
|
//add pdf buttons
|
||
|
|
$btn ='<input title="Generuj PDF" class="button" onclick="if($(\'#div_pdf\').css(\'display\') == \'none\'){$(\'#div_pdf\').show(\'slow\'); } else { $(\'#div_pdf\').hide(\'slow\'); }" type="button" name="productcard" id="productcard" value="Generuj PDF">';
|
||
|
|
$btn .= '<div id="div_pdf" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||
|
|
$btn .= 'Zdjęcia: <select name="pdf_images" id="pdf_images"><option value="1">Tak</option><option value="0">Nie</option></select><br /><br />';
|
||
|
|
$btn .= 'EAN: <select name="pdf_ean" id="pdf_ean"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||
|
|
$btn .= 'EAN2: <select name="pdf_ean2" id="pdf_ean2"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||
|
|
$btn .= 'Kod odbiorcy: <select name="pdf_recipient_code" id="pdf_recipient_code"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||
|
|
$btn .= 'Uwagi: <select name="pdf_remarks" id="pdf_remarks"><option value="1">Tak</option><option value="0" selected>Nie</option></select><br /><br />';
|
||
|
|
$btn .= '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmQuotes&action=createPDF&to_pdf=1&show_img=\'+$(\'#pdf_images\').val()+\'&show_ean=\'+$(\'#pdf_ean\').val()+\'&show_ean2=\'+$(\'#pdf_ean2\').val()+\'&show_recipient_code=\'+$(\'#pdf_recipient_code\').val()+\'&show_remarks=\'+$(\'#pdf_remarks\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
|
||
|
|
$edit->ss->assign("CREATE_PDF",$btn);
|
||
|
|
|
||
|
|
$btn ='<input title="Generuj Katalog" class="button" onclick="if($(\'#div_cat\').css(\'display\') == \'none\'){$(\'#div_cat\').show(\'slow\'); } else { $(\'#div_cat\').hide(\'slow\'); }" type="button" name="productcat" id="productcat" value="Generuj Katalog">';
|
||
|
|
$btn .= '<div id="div_cat" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||
|
|
$btn .= 'EAN: <select name="cat_ean" id="cat_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
|
||
|
|
$btn .= '<input name="cat_pdf" id="cat_pdf" title="Show Cat" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmQuotes&action=createCatalogue&to_pdf=1&show_ean=\'+$(\'#cat_ean\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż Katalog"></div>';
|
||
|
|
$edit->ss->assign("CATALOGUE",$btn);
|
||
|
|
|
||
|
|
$btn ='<input title="Generuj XLS" class="button" onclick="if($(\'#div_xls\').css(\'display\') == \'none\'){$(\'#div_xls\').show(\'slow\'); } else { $(\'#div_xls\').hide(\'slow\'); }" type="button" name="productxls" id="productxls" value="Generuj XLS">';
|
||
|
|
$btn .= '<div id="div_xls" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||
|
|
$btn .= 'EAN: <select name="xls_ean" id="xls_ean"><option value="1">1</option><option value="2">2</option><option value="0">Brak</option></select><br /><br />';
|
||
|
|
$btn .= '<input name="cat_xls" id="cat_xls" title="Generuj XLS" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmQuotes&action=createXLS&to_pdf=1&show_ean=\'+$(\'#xls_ean\').val()+\'&record='.$_REQUEST['record'].'\',\'_blank\');" type="button" value="Pokaż XLS"></div>';
|
||
|
|
$edit->ss->assign("CREATE_XLS",$btn);
|
||
|
|
|
||
|
|
$can_edit = false;
|
||
|
|
global $current_user;
|
||
|
|
if ($focus->assigned_user_id == $current_user->id || is_admin($current_user))
|
||
|
|
$can_edit = true;
|
||
|
|
$can_edit=true;
|
||
|
|
$edit->ss->assign("CAN_EDIT", $can_edit);
|
||
|
|
|
||
|
|
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
|
||
|
|
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);
|
||
|
|
|
||
|
|
$edit->bean = $focus;
|
||
|
|
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||
|
|
|
||
|
|
$edit->preDisplay ();
|
||
|
|
|
||
|
|
//check number
|
||
|
|
$db = $GLOBALS['db'];
|
||
|
|
$res = $db->query("SELECT id FROM ecmquotes WHERE document_no='$focus->document_no'");
|
||
|
|
if ($res->num_rows > 1) {
|
||
|
|
echo '<h1 style="color: red;">Błąd numeracji, skontaktuj się z administratorem! Nie drukuj/publikuj dokumentu!</h1>';
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
echo $edit->display ();
|
||
|
|
|
||
|
|
require_once ('include/SubPanel/SubPanelTiles.php');
|
||
|
|
$subpanel = new SubPanelTiles ( $focus, 'EcmQuotes' );
|
||
|
|
echo $subpanel->display ();
|
||
|
|
//loading view
|
||
|
|
echo '<link rel="stylesheet" type="text/css" href="modules/EcmQuotes/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
||
|
|
?>
|