<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
	die ( 'Not A Valid Entry Point' );
	
	// require_once('modules/EcmGroupSales/HeaderMenu.php');
ini_set('max_execution_time', 9999999999);
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;

require_once ('include/time.php');
require_once ('include/json_config.php');

// add jquery
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/css/style.css"/>';
echo '<script type="text/javascript"
src="include/jQuery/jquery-lastes.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jQuery.tablesorter/jquery.tablesorter.js"></script>';
echo '<script type="text/javascript"
src="include/jQuery/jquery.tablesorter.pager.js"></script>';
echo '<script type="text/javascript"
src="modules/EcmSales/javascript/ListNewSales.js"></script>';

$json_config = new json_config ();

$focus = new EcmSale ();


if($_GET['submit']){
	$position_list=$focus->GetArrayResultFromQuery($focus->CreateQueryFromPost($_GET));
	
}
if($_GET['gets']){
	$position_list=$focus->GetArrayResultFromQuery($focus->CreateQueryFromPost($_GET));
	$link=$focus->CreateMultiPDF($_GET['selectedid']);
	

}
$edit->ss = new Sugar_Smarty ();
$edit->module = 'EcmSales';

$currencies = [
		'PLN'=>'PLN',
		'3c8d317e-513b-9a9b-d0e6-511e2abee625'=>"GBP",
		'98b2b752-b0be-37c2-d2eb-511e29f81cab'=>'USD',
		'6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'=>'EUR'
];
$edit->ss->assign ( "CREATED_BY_NAME", $focus->created_by_name );
$edit->ss->assign ( "MODIFIED_BY_NAME", $focus->modified_by_name );
$edit->ss->assign ( 'FOCUS', $focus);
$edit->ss->assign ( 'POST', $_GET);
$edit->ss->assign ( 'LINK', $link);
$edit->ss->assign ( "CURRENCIES", $currencies);
$edit->ss->assign('POSITION_LIST',$position_list);
$edit->ss->assign('POSITION_LIST_C',$position_list_c);
$edit->ss->assign ( 'MOD', $mod_strings);
$edit->ss-> display('modules/EcmSales/tpls/ListNewSales.tpl'); //4

// loading view
//echo '<link rel="stylesheet" type="text/css" href="modules/EcmInsideOrders/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
?>