Add php files
This commit is contained in:
229
modules/EcmFkVatKinds/DetailView.php
Executable file
229
modules/EcmFkVatKinds/DetailView.php
Executable file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
// require_once('modules/EcmGroupFkVatKinds/HeaderMenu.php');
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
|
||||
|
||||
require_once('modules/EcmFkVatKinds/EcmFkVatKind.php');
|
||||
|
||||
// require_once('modules/EcmFkVatKinds/Forms.php');
|
||||
|
||||
require_once('include/json_config.php');
|
||||
|
||||
$json_config = new json_config();
|
||||
|
||||
|
||||
$file = 'modules/EcmGroupFkVatKinds/EcmGroupFkVatKind.php';
|
||||
if(file_exists($file)) {
|
||||
$cc = array();
|
||||
require_once($file);
|
||||
$cc = EcmGroupFkVatKind::loadSettings();
|
||||
}
|
||||
|
||||
|
||||
$cc = array (
|
||||
'default_payment_condition' => '3caa3a68-4f75-ca20-18a6-5065b4110d25',
|
||||
'default_delivery_condition' => '4cd1cb6f-ac4b-763e-07d7-5065b1068adb',
|
||||
'default_document_template' => '20e764d0-7816-5115-475b-4f3d1be98260',
|
||||
'default_representative_role_id' => NULL,
|
||||
'default_representative_extra_role_id' => NULL,
|
||||
'default_manager_role_id' => NULL,
|
||||
'checkbox_demo' => 0,
|
||||
'show_images_on_offers' => 1,
|
||||
'creating_invoice_direct_from_quote' => 1,
|
||||
'rows_on_item_list_global' => '',
|
||||
'row_item_height_global' => '',
|
||||
'row_item_height_selected_global' => '',
|
||||
'quick_product_item_adding_global' => 0,
|
||||
'show_pdf_in_div_global' => 0,
|
||||
'rows_on_item_list' => '6',
|
||||
'row_item_height' => '35',
|
||||
'row_item_height_selected' => '70',
|
||||
'quick_product_item_adding' => 0,
|
||||
'show_pdf_in_div' => 0,
|
||||
'settings_user_save' => 1,
|
||||
);
|
||||
|
||||
$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;
|
||||
|
||||
$focus = new EcmFkVatKind();
|
||||
|
||||
if(isset($_REQUEST['record'])) {
|
||||
|
||||
$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
// dump($focus->toArray());
|
||||
// exit;
|
||||
|
||||
$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->kind_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'] = "23.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);
|
||||
|
||||
$json = getJSONobj();
|
||||
|
||||
$counts=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select count(*) as c from ecmvats where deleted='0'"));
|
||||
$nvats=$counts['c'];
|
||||
$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']
|
||||
);
|
||||
}
|
||||
|
||||
// $show_pdf=$current_user->getPreference('show_pdf_in_div');
|
||||
// if(!isset($show_pdf)){
|
||||
// require_once('modules/EcmGroupFkVatKinds/EcmGroupFkVatKind.php');
|
||||
// $cc = EcmGroupFkVatKind::loadSettings();
|
||||
// $show_pdf=$cc['show_pdf_in_div_global'];
|
||||
// }
|
||||
|
||||
$json = getJSONobj();
|
||||
$scriptOpt = '
|
||||
<script language="javascript">
|
||||
var SHOW_PDF_IN_DIV = ' . ($show_pdf ? : 'false') . ';
|
||||
var OPT = ' . str_replace('"', '"', $json->encode($OPT)) . ';
|
||||
var MOD = ' . str_replace('"', '"', $json->encode($mod_strings)) . ';
|
||||
var N;
|
||||
var CURRENCY = '.str_replace('"','\"',$json->encode($CUR)).';
|
||||
</script>
|
||||
';
|
||||
|
||||
echo $scriptOpt;
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
require_once('modules/EcmFkVatKinds/views/DetailView/view.detail.my.php');
|
||||
|
||||
$edit = new ViewDetailMy();
|
||||
$edit->ss = new Sugar_Smarty();
|
||||
$edit->module = 'EcmFkVatKinds';
|
||||
|
||||
$edit->bean = $focus;
|
||||
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||||
|
||||
// $edit->bean->total = unformat_number($edit->bean->total);
|
||||
|
||||
$edit->preDisplay();
|
||||
|
||||
|
||||
// $matches = preg_split('/( )*\|( )*/', $focus->col_1_1, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// dump($focus->col_1_1);
|
||||
// dump($matches);
|
||||
|
||||
// dump($focus->title_1);
|
||||
// dump($focus->col_1_1);
|
||||
// dump($focus->col_2_1);
|
||||
|
||||
// dump($focus->title_2);
|
||||
// dump($focus->col_1_2);
|
||||
// dump($focus->col_2_2);
|
||||
// exit;
|
||||
|
||||
// $arr_template = $focus->getTemplateList();
|
||||
|
||||
|
||||
$decreeList = str_replace('"', '\'', $focus->position_list);
|
||||
|
||||
// if(isset($focus->template_id)) $edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, $focus->template_id));
|
||||
// else $edit->ss->assign("DOCUMENT_TEMPLATES_OPTIONS", get_select_options_with_id($arr_template, ''));
|
||||
// dump($focus->position_list);exit;
|
||||
// $edit->ss->assign("POSITION_LIST", $focus->position_list);
|
||||
|
||||
$edit->ss->assign("POSITION_LIST", $decreeList);
|
||||
$edit->ss->assign("RECORD", $_REQUEST['record']);
|
||||
|
||||
// $edit->ss->assign("EMAIL_LINK",$focus->createSendEmailLink());
|
||||
|
||||
// $email_link_tab = '<script language="javascript">YAHOO.util.Event.addListener(window,"load",function(){setEMAIL = function(){'.$focus->createSendEmailLink().'}});</script>';
|
||||
// $edit->ss->assign("EMAIL_LINK_TAB",$email_link_tab);
|
||||
|
||||
|
||||
$OPTIONS = '';
|
||||
|
||||
foreach($focus->getPositionList(true) as $key => $value) {
|
||||
// dump($value);exit;
|
||||
$OPTIONS .= '<option value="' . $value['id'] . '">' . $value['i_title'] . '</option>';
|
||||
}
|
||||
|
||||
/* BOF: Date from, date to preparation. */
|
||||
$dateTo = new DateTime();
|
||||
$dateFrom = clone $dateTo;
|
||||
|
||||
$currentDateTo = DateTime::createFromFormat('d.m.Y', @$_GET['date_to']);
|
||||
$currentDateFrom = DateTime::createFromFormat('d.m.Y', @$_GET['date_from']);
|
||||
|
||||
$currentTo = $currentDateTo ? $currentDateTo->format('d.m.Y') : $dateTo->format('t.m.Y');
|
||||
$currentFrom = $currentDateFrom ? $currentDateFrom->format('d.m-Y') : $dateFrom->format('01.01.Y');
|
||||
|
||||
$edit->ss->assign('date_to', $currentTo);
|
||||
$edit->ss->assign('date_from', $currentFrom);
|
||||
/* EOF: Date from, date to preparation. */
|
||||
|
||||
$checked = 'checked="checked"';
|
||||
|
||||
$edit->ss->assign("OPTIONS", $OPTIONS);
|
||||
$edit->ss->assign('CHECKED', $CHECKED);
|
||||
$edit->ss->assign("OPT", $OPT);
|
||||
echo $edit->display();
|
||||
Reference in New Issue
Block a user