%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/backups/db_backups/mysql/db.old/paste/
Upload File :
Create Path :
Current File : //proc/985914/root/backups/db_backups/mysql/db.old/paste/main.sql

/*M!999999\- enable the sandbox mode */ 
-- MariaDB dump 10.19  Distrib 10.6.22-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: paste
-- ------------------------------------------------------
-- Server version	10.6.22-MariaDB-0ubuntu0.22.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `main`
--

DROP TABLE IF EXISTS `main`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `main` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `urlkey` varchar(9) NOT NULL DEFAULT '',
  `author_id` int(11) DEFAULT NULL,
  `author` varchar(50) DEFAULT '',
  `project` varchar(50) DEFAULT '',
  `timestamp` int(11) NOT NULL,
  `expire` int(11) NOT NULL,
  `title` varchar(25) DEFAULT '',
  `data` longtext NOT NULL,
  `language` varchar(50) NOT NULL DEFAULT 'text',
  `password` varchar(60) NOT NULL,
  `salt` varchar(5) NOT NULL,
  `private` tinyint(1) NOT NULL DEFAULT 0,
  `hash` varchar(12) NOT NULL,
  `ip` varchar(50) NOT NULL,
  `hits` int(11) NOT NULL DEFAULT 0,
  `flagged` tinyint(1) NOT NULL DEFAULT 0,
  `attachment` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `main_urlkey_index` (`urlkey`),
  KEY `main_author_index` (`author`),
  KEY `main_project_index` (`project`),
  KEY `main_private_index` (`private`)
) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `main`
--

LOCK TABLES `main` WRITE;
/*!40000 ALTER TABLE `main` DISABLE KEYS */;
INSERT INTO `main` VALUES (2,'piaxjssoq',2,'waritko',NULL,1421838963,0,'WinForms key capture','private void textBoxCmd_KeyPress(object sender, KeyPressEventArgs e)\r\n{\r\n	string Set = \"\";\r\n	if (e.KeyChar == \'\\n\' || e.KeyChar == \'\\r\')\r\n	{\r\n		bool Uspat = false;\r\n		string Vstup = textBoxCmd.Text.Trim().ToUpper();\r\n		string reg = \"(S10[0-5]|S11[0-5]|S12[0-7]|S13[0-7]|S14[0-4]|S15[0-4]|S16[0-1]|S17[0-4]|R1)\";\r\n		Regex test = new Regex(reg);\r\n		if (test.IsMatch(Vstup))\r\n		{\r\n			if (Vstup.StartsWith(\"S\"))\r\n			{\r\n				Uspat = true;\r\n				Set = Vstup;\r\n			}\r\n			toolStripStatusLabel1.ForeColor = Color.Black;\r\n			toolStripStatusLabel1.Text = \"PROVÁDĂŤM\";\r\n			this.Update(); // prekresli se\r\n		}\r\n		else\r\n		{\r\n			toolStripStatusLabel1.ForeColor = Color.Red;\r\n			toolStripStatusLabel1.Text = \"CHYBA\";\r\n			return;\r\n		}\r\n		ttyClient.Instance.SendMessage(Vstup);\r\n		string Data = \"\";              \r\n		Data = ttyClient.Instance.ReadMessage();\r\n		if (Vstup == \"R1\" && Data == \"=>\")\r\n		{\r\n			Data = ttyClient.Instance.ReadMessage();\r\n		}\r\n		if (!Uspat)\r\n		{            \r\n			switch (Set)\r\n			{\r\n				case \"S100\":\r\n					{\r\n						Data += \"V\";\r\n						break;\r\n					}\r\n				default:\r\n					{\r\n						Data += \"xxx\";\r\n						break;\r\n					}\r\n			}\r\n			lblDisplay.Text = Data;\r\n		}\r\n		else\r\n		{\r\n			Thread.Sleep(3000);\r\n		}\r\n\r\n		toolStripStatusLabel1.Text = \"OK\";\r\n		textBoxCmd.Text = \"\";\r\n	}\r\n}','csharp','','hjEZq',0,'dd2nin','80.188.29.62',106,0,0),(3,'psvte4w7s',2,'waritko',NULL,1421839109,0,'EVO proj 1','/* OneMax.cc: Evolutionary solving of Queens palcement problem.\r\n *\r\n * Author(s): Jiri Jaros (jarosjir@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <algorithm>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 8;\r\n\r\n\r\n\r\n//------------------Fitness function for Queen problem-----------------------//\r\nfloat QueensFitness(GAGenome& g){\r\n  //-- Fitness function is based on testing and counting conflicts between  --//\r\n  //-- paricular queens. In order to permutation encoding is used queens,   --//\r\n  //-- it is necessaty to test only diagonal directions                     --//\r\n\r\n  GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n  int fitness;\r\n  \r\n  for(int i  = 0; i < dimension; i++)\r\n  {\r\n	  for(int j = i+1; j < dimension; j++)\r\n	  {\r\n		  int left = genome.gene(i)-(j-i);\r\n		  int right = genome.gene(i)+(j-i);\r\n		  if(left >= 0 && right < dimension && (genome.gene(j) == left || genome.gene(j) == right))\r\n			fitness++;\r\n	  }\r\n  }\r\n \r\n \r\n \r\n	return fitness;\r\n} //- OneMaxFitnessFunction -//\r\n\r\n\r\n//--------------------------- Init function ----------------------------------//\r\nvoid QueensInitializer(GAGenome& g) {\r\n  //-- creation of permutation chromozome --//\r\n\r\n	vector<int> tmp;\r\n  GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &) g;\r\n  \r\n  \r\n  for(int i = 0; i < dimension; i++)\r\n  {\r\n	  int num = GARandomInt(0, dimension - 1);\r\n	  \r\n	  if(!tmp.empty() && (std::find(tmp.begin(), tmp.end(), num)!=tmp.end()))\r\n	  {\r\n		   i--; \r\n		   continue;\r\n	  }\r\n	  tmp.push_back(num);\r\n	  genome.gene(i, num);\r\n  }\r\n  \r\n\r\n      \r\n} //- Initializer -//\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n    GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n    int i, j, x;\r\n\r\n    cout << endl;\r\n    for (x = 0; x < (dimension * 4) + 1; x++)\r\n        cout << \"-\";\r\n    cout << endl;\r\n\r\n    for (j = 0; j < dimension; j++) {\r\n        for (i = 0; i < dimension; i++) {\r\n            cout << \"|\";\r\n            if (genome.gene(i) == j)\r\n                cout << \" X \";\r\n            else\r\n                cout << \"   \";\r\n        }\r\n        cout << \"|\";\r\n        cout << endl;\r\n        for (x = 0; x < (dimension * 4) + 1; x++)\r\n            cout << \"-\";\r\n        cout << endl;\r\n    }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n                      \r\n     //-- Declaration of population with genome size and Fitness function --//\r\n   GA1DArrayGenome<int> genome(dimension, QueensFitness);\r\n      \r\n    //-- Genetic operations --//\r\n   genome.initializer(::QueensInitializer);\r\n   genome.mutator(GA1DArrayGenome<int>::SwapMutator);		//- Fill mutator\r\n   genome.crossover(GA1DArrayGenome<int>::PartialMatchCrossover);		//- Fill Crossover\r\n\r\n  \r\n    //-- Declaration of genetic algorithm --//\r\n   GASimpleGA ga(genome);\r\n  \r\n//   GATournamentSelector selector;\r\n//   ga.selector(selector);\r\n     //-- search for global maximum --//\r\n   ga.minimize();\r\n   \r\n     //-- Parameters setting --//\r\n   ga.parameters(argc,argv);\r\n   \r\n     //-- Start of evolution process --//\r\n   ga.initialize();\r\n   while(!ga.done()){\r\n     ++ga; \r\n  \r\n     if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n       cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n            << ga.population().min() <<endl;\r\n            \r\n     if (ga.population().min() == 0) break;\r\n   }\r\n   ga.flushScores();\r\n    \r\n  \r\n     //-- Print statistics --//\r\n   cout <<endl << \"Final statistics:\" << endl;\r\n   cout << ga.statistics() << endl;\r\n   \r\n   cout << \"The best solution: \" <<  ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n   PrintPhenotype(ga.statistics().bestIndividual());\r\n   \r\n    return 0;\r\n} //- main -//','cpp','','eleaM',0,'pbhbvz','80.188.29.62',83,0,0),(4,'pgx3ku2wk',2,'waritko',NULL,1421839134,0,'EVO proj 2','/* numericOptimistation.cc: Search for optimum of a numeric function.\r\n *\r\n * Author(s): Jiri Petrlik (ipetrlik@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 5; // dimension of optimised function\r\nconst int resolution=24; // number of bits per value\r\nconst double minValue=-500; // min value\r\nconst double maxValue=500; // max value\r\n\r\n\r\n//------------------Fitness function -----------------------//\r\nfloat fitness(GAGenome& g){\r\n  //---------------Type your code here ---------------------//\r\n\r\n  GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n\r\n  double result=0;\r\n  for(int i = 0; i < dimension; i++)\r\n  {\r\n	  int tmp = 0;\r\n	  for(int j = 0; j < resolution; j++)\r\n	  {\r\n		  tmp = tmp << 1;\r\n		  tmp += genome.gene(i*resolution + j);\r\n	  }\r\n	  double dtmp = (double)tmp / (double)((1 << 24) - 1);\r\n	  dtmp = dtmp * (maxValue - minValue) + minValue;\r\n	  result += dtmp * sin(sqrt(fabs(dtmp)));\r\n  }\r\n  result = 418.9829 * dimension - result;\r\n  \r\n\r\n  return result;\r\n\r\n}\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n	GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;	\r\n	\r\n  for(int i = 0; i < dimension; i++)\r\n  {\r\n	  int tmp = 0;\r\n	  for(int j = 0; j < resolution; j++)\r\n	  {\r\n		  tmp = tmp << 1;\r\n		  tmp += genome.gene(i*resolution + j);\r\n	  }\r\n	  double dtmp = (double)tmp / (double)((1 << 24) - 1);\r\n	  dtmp = dtmp * (maxValue - minValue) + minValue;\r\n	  cout << \"Gene \" << i << \": \" << dtmp << endl;\r\n  }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n                      \r\n     //-- Declaration of population with genome size and Fitness function --//\r\n	GA1DBinaryStringGenome genome(dimension*resolution, fitness);\r\n  \r\n    //-- Declaration of genetic algorithm --//\r\n   GASimpleGA ga(genome);\r\n  \r\n     //-- search for global minimum --//\r\n   ga.minimize();\r\n   \r\n   ga.nGenerations(1000);\r\n   //ga.populationSize(1000);\r\n\r\n     //-- Parameters setting --//\r\n   ga.parameters(argc,argv);\r\n   \r\n     //-- Start of evolution process --//\r\n   ga.initialize();\r\n   while(!ga.done()){\r\n     ++ga; \r\n  \r\n     if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n       cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n            << ga.population().min() <<endl;\r\n            \r\n     if (ga.population().min() == 0) break;\r\n   }\r\n   ga.flushScores();\r\n    \r\n  \r\n     //-- Print statistics --//\r\n   cout <<endl << \"Final statistics:\" << endl;\r\n   cout << ga.statistics() << endl;\r\n   \r\n   cout << \"The best solution: \" <<  ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n   PrintPhenotype(ga.statistics().bestIndividual());\r\n   \r\n    return 0;\r\n} //- main -//','cpp','','fmwKe',0,'4vqpyo','80.188.29.62',77,0,0),(5,'pf3cinw4p',2,'waritko',NULL,1421839185,0,'EVO proj 3','/* GP.cc: Program tries to approximate simple numerical function - params from command line.\r\n*\r\n* Author(s): Petr Pospichal (ipospichal@fit.vutbr.cz)\r\n*\r\n*/\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n#include <stack>\r\n#include <vector>\r\n//#include <limits.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n\r\n#define VARIABLE 0\r\n#define CONSTANT 1\r\n#define UNARY_OPERATOR 2\r\n#define BINARY_OPERATOR 3\r\n\r\n\r\nstruct GPTreeItem_T {\r\n	short type;\r\n	string name;\r\n	float const_value;\r\n	float (*unaryfunc)(float);\r\n	float (*binaryfunc)(float,float);\r\n};\r\n\r\n#define TREE_ITEM_VARIABLE(name) { VARIABLE, name, 0.0, NULL, NULL }\r\n#define TREE_ITEM_CONSTANT(name,value) { CONSTANT, name, value, NULL, NULL }\r\n#define TREE_ITEM_UNARY_OPERATOR(name,ptr) { UNARY_OPERATOR, name, 0.0, ptr, NULL }\r\n#define TREE_ITEM_BINARY_OPERATOR(name,ptr) { BINARY_OPERATOR, name, 0.0, NULL, ptr }\r\n\r\nfloat Plus(float a, float b) { return a+b; }\r\nfloat Minus(float a, float b) { return a-b; }\r\nfloat Multiplication(float a, float b) { return a*b; }\r\nfloat Division(float a, float b) { return a/b; }\r\n\r\n\r\nconst GPTreeItem_T TreeItems[] = {\r\n	TREE_ITEM_VARIABLE(\"x\"),\r\n	TREE_ITEM_CONSTANT(\"-1.0\",-1.0),\r\n	TREE_ITEM_CONSTANT(\"1.0\",1.0),\r\n	TREE_ITEM_BINARY_OPERATOR(\"+\",Plus),\r\n	TREE_ITEM_BINARY_OPERATOR(\"-\",Minus),\r\n	TREE_ITEM_BINARY_OPERATOR(\"*\",Multiplication),\r\n	TREE_ITEM_BINARY_OPERATOR(\"/\",Division)\r\n};\r\n\r\nconst unsigned int TreeItemsCount = (sizeof TreeItems)/(sizeof TreeItems[0]);\r\n\r\n\r\n#define CROSSOVER_MOD 0.8\r\n#define MUTATION_MOD 1.2\r\n#define GENERATIONS_MOD 100\r\n#define CHROM_LEN_PENALIZATION 2\r\n//#define CHROM_LEN_PENALIZATION 0.1\r\n//#define CHROM_LEN_PENALIZATION 10\r\n\r\n#define NO_SCALING\r\n//#define SCALING_LINEAR\r\n//#define SCALING_SIGMA\r\n\r\n//#define GOAL_FUNC1\r\n//#define GOAL_FUNC2\r\n//#define GOAL_FUNC3\r\n#define GOAL_FUNC4\r\n\r\n\r\n#define DEBUG_POPULATION\r\n\r\nconst int MAX_DEPTH = 3; // max random tree depth param\r\n\r\n\r\n#ifdef GOAL_FUNC1\r\n// x\r\n #define GOAL_STRING \"x\"\r\nconst float GoalFunc[][2] = {\r\n	{0.0 ,   0.0},\r\n	{1.0 ,   1.0},\r\n	{2.0 ,   2.0},\r\n	{3.0 ,   3.0},\r\n	{4.0 ,   4.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC2\r\n// x^2+1\r\n	#define GOAL_STRING \"x^2 + 1\"\r\nconst float GoalFunc[][2] = {\r\n	{0.0 ,   1.0},\r\n	{1.0 ,   2.0},\r\n	{2.0 ,   5.0},\r\n	{3.0 ,   10.0},\r\n	{4.0 ,   17.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC3\r\n// x^2+x+1\r\n	#define GOAL_STRING \"x^2 + x + 1\"\r\nconst float GoalFunc[][2] = {\r\n	{0.0 ,   1.0},\r\n	{1.0 ,   3.0},\r\n	{2.0 ,   7.0},\r\n	{3.0 ,   13.0},\r\n	{4.0 ,   21.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC4\r\n// TODO find function for these points\r\n	#define GOAL_STRING \"to be found\"\r\nconst float GoalFunc[][2] = {\r\n	{0.0 ,   1.0},\r\n	{1.0 ,   5.0},\r\n	{2.0 ,   31.0},\r\n	{3.0 ,   121.0},\r\n	{4.0 ,   341.0}\r\n};\r\n#endif\r\n\r\n\r\n\r\nclass GaMyTreeIter : public GATreeIterBASE {\r\npublic:\r\n	GaMyTreeIter(const GATreeBASE & t) : GATreeIterBASE(t) {} // just call parent constructor\r\n\r\n	GANodeBASE* getRootNode()\r\n	{   return this->node;  } // this allows us to get to root node pointer so we can traverse tree easily\r\n	 \r\n};\r\n\r\n\r\n\r\n// The objective function is declared here and defined below.\r\nfloat objective(GAGenome &);\r\n\r\n// This is the declaration for the initialization operator for our trees.\r\nvoid TreeInitializer(GAGenome &);\r\n\r\n// This is a recursive function that will be used in the \'write\' method for \r\n// our tree genomes.\r\nvoid WriteNode(ostream & os, GANode<int> * n);\r\n\r\nvoid PreorderWalk( GANode<int> * n, void function(GANodeBASE * node), void* params );\r\nvoid PostoderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params );\r\n\r\nstring GetNodeName(int n) { return TreeItems[n].name; }\r\n\r\nint GetTreeItemType(int n) { return TreeItems[n].type; }\r\n\r\nvoid PrintNodeType(GANodeBASE * node, void* params) { cout << GetNodeName(((GANode<int> *)node)->contents) << \" \"; }\r\n\r\n\r\nint\r\nmain(int argc, char *argv[])\r\n{\r\n	\r\n	//cout << GoalFunc[1][1] << endl;\r\n	//cout << TreeItems[0].name << endl;\r\n	cout.flush();\r\n	\r\n	// See if we\'ve been given a seed to use (for testing purposes).  When you\r\n	// specify a random seed, the evolution will be exactly the same each time\r\n	// you use that seed number.\r\n	\r\n	unsigned int seed = 0;\r\n	for(int i=1; i<argc; i++) {\r\n		if(strcmp(argv[i++],\"seed\") == 0) {\r\n			//seed = atoi(argv[i]);\r\n			GARandomSeed(atoi(argv[i]));\r\n		}\r\n	}\r\n	\r\n	// Set the default values of the parameters.\r\n\r\n	const int popsize=10; // this param is used twice\r\n\r\n	GAParameterList params;\r\n	GASimpleGA::registerDefaultParameters(params);\r\n	params.set(gaNpopulationSize, popsize);\r\n	params.set(gaNpCrossover, CROSSOVER_MOD);\r\n	params.set(gaNpMutation, MUTATION_MOD);\r\n	params.set(gaNnGenerations, GENERATIONS_MOD);\r\n	params.set(gaNelitism,true);\r\n	//params.set(gaNnBestGenomes,10);\r\n	//params.set(gaNminimaxi,true);\r\n	//params.set(gaNminimaxi,true);\r\n	//params.set(gaNscoreFilename, \"bog.dat\");\r\n	//params.set(gaNscoreFrequency, 1); // record score every 10th generation\r\n	//params.set(gaNflushFrequency, 10); // dump scores every 10th recorded score\r\n	//params.parse(argc, argv, gaFalse); // Parse the command line for GAlib args.\r\n\r\n	GATreeGenome<int> genome(objective),genome2(objective);\r\n	genome.initializer(TreeInitializer);\r\n	genome.mutator(GATreeGenome<int>::SwapSubtreeMutator);\r\n	genome.crossover(GATreeGenome<int>::OnePointCrossover);	\r\n	\r\n	GASimpleGA ga(genome);  	\r\n	ga.parameters(params);\r\n	#ifdef NO_SCALING\r\n	GANoScaling scale;\r\n	#endif\r\n	#ifdef SCALING_LINEAR\r\n	GALinearScaling scale;\r\n	#endif\r\n	#ifdef SCALING_SIGMA\r\n	GASigmaTruncationScaling scale;\r\n	#endif\r\n\r\n  	ga.scaling(scale);\r\n	ga.minimize();\r\n	ga.initialize();\r\n	int gen=0;\r\n	while(!ga.done())\r\n	{\r\n		gen++;\r\n		#ifdef DEBUG_POPULATION\r\n		//cout << \"============== generation \" << gen << endl << \"--- new objective evaluations\" << endl;\r\n		#endif\r\n		ga.step(); // do one generation of the evolution\r\n		#ifdef DEBUG_POPULATION\r\n		//cout << \"--- current population\" << endl;\r\n		for (int i=0; i<popsize;i++)\r\n		{\r\n			//cout << i << \" (\" << ga.population().individual(i).fitness() << \"): \" << ga.population().individual(i);\r\n		}\r\n\r\n		genome2=ga.statistics().bestIndividual();\r\n		//cout << \"--- best\" << endl;\r\n		float objvalue = ::objective(genome2);\r\n		//cout << \"  (\" << objvalue << \", \" << genome2.fitness()  << \"):\" << ga.statistics().bestIndividual() <<  endl;\r\n		#endif\r\n	}\r\n\r\n	genome2 = ga.statistics().bestIndividual();\r\n	cout <<  \"=================\" << endl << \"The GA generated this tree (sould be \" << GOAL_STRING << \")\\n\" << genome2;\r\n	cout << \"objective: \" << genome2.score() << \" fitness:\" << genome2.fitness() << \", \" << genome2.size() << \" nodes, \" << genome2.depth() << \" levels deep.\\n\\n\";\r\n	cout << \"==============\" << endl;\r\n	cout << genome2.score() - CHROM_LEN_PENALIZATION * genome2.size() << endl;\r\n	cout << \"==============\" << endl;\r\n\r\n	//cout << ga.statistics() << endl;\r\n	\r\n	\r\n	return 0;\r\n}\r\n\r\n/* ----------------------------------------------------------------------------\r\n\r\n This function is calculating intermetiate results of the tree interpretation. It uses stack to store operands, inputs and outputs. \r\n\r\n*/\r\n\r\nvoid calculateResult(GANodeBASE * node, void* params)\r\n{\r\n	//cout << \"calculateResult \" << endl;\r\n	vector<float>* stack = (std::vector<float>*)params; // stack is passed using void*\r\n	float x=stack->at(0); // value of x is stored on the first position\r\n\r\n	int treeitemindex=((GANode<int> *)node)->contents; // get value of tree item (node), use it to index constant array of tree elements\r\n	int type=GetTreeItemType(treeitemindex); // get note type\r\n	float op1,op2,result=0.0;\r\n	switch(type)\r\n	{\r\n		// do operation depending on note type\r\n		case BINARY_OPERATOR: //cout << \"binary\" << endl; \r\n			op1=stack->back();stack->pop_back(); // binary operator -> use two operands from stack\r\n			op2=stack->back();stack->pop_back();\r\n			result=TreeItems[treeitemindex].binaryfunc(op1,op2); // ... calculate result\r\n			stack->push_back(result); // and put it back on the stack\r\n			break;\r\n		case UNARY_OPERATOR: //cout << \"unary\" << endl; \r\n			op1=stack->back();stack->pop_back();\r\n			result=TreeItems[treeitemindex].unaryfunc(op1);\r\n			stack->push_back(result);\r\n			break;\r\n		case CONSTANT: //cout << \"constant\" << endl; \r\n			stack->push_back(TreeItems[treeitemindex].const_value); // push constant to stack\r\n			break;\r\n		case VARIABLE: //cout << \"variable\" << endl; 	\r\n			stack->push_back(x); // push x value to stack\r\n			break;\r\n		default:\r\n			cout<< \"error no operator defined\" << endl; exit(0);\r\n		break;		\r\n	}\r\n\r\n}\r\n\r\n\r\n\r\n/*----------------------------------------------------------------------------\r\n\r\n Objective function of getting \"fitness\" of tree chromosome. Compares values of GoalFunc on defined x points with interpreted tree chromosome. Fitness is defined as sum of all differences between goal function and interpreted tree plus possible penalization for longer chromosomes. \r\n\r\n*/\r\n\r\nfloat objective(GAGenome & t){\r\n	GATreeGenome<int> & tree= (GATreeGenome<int> &)t;\r\n\r\n	vector<float> stack; // stack for storing elements and intermediate results as we walk the tree\r\n\r\n	GaMyTreeIter *iterator = new GaMyTreeIter(tree); \r\n	GANodeBASE * nod = iterator->getRootNode(); // root node pointer used as traversal start point\r\n	\r\n\r\n	int GoalFuncPoints = sizeof(GoalFunc)/sizeof(GoalFunc[0]);\r\n	float objective=0.0;\r\n	\r\n	// for each point of the goal function, interpret the tree\r\n	// could be optimized - how?\r\n	for(int point=0;point<GoalFuncPoints;point++)\r\n	{\r\n		stack.clear();		\r\n		float x=GoalFunc[point][0];\r\n		float reference=GoalFunc[point][1];\r\n		float result=0.0;\r\n\r\n		stack.push_back(x); // use stack for sending x-value to calculation function\r\n		//cout << \"point \" << point << \" x \" << reference << \" \" << endl;\r\n\r\n	        // call tree traversal with calculateResult func, which interpretes the tree for defined x value\r\n		PostoderWalk((GANode<int> *)nod, calculateResult, static_cast<void*>(& stack) );\r\n\r\n		// get result value from stack after interpretation\r\n		result=stack.back();\r\n		if(stack.size()!=2) // stack should contain only x-value and result, otherwise traversal was incorrect (possibly damaged or not initialized tree)\r\n		{\r\n			cout << \" error interpreting expression, incorrect derivation tree \" << endl; exit(1);\r\n		}\r\n\r\n		//cout << \"  size:  \" << stack.size() << endl;\r\n		//cout << \"  reference: \" << reference << \"  result:\" << result << endl;\r\n		objective+=fabs(reference-result); // get sum of difference beween goal func and interpreted result\r\n	}\r\n\r\n	if(isnan(objective) || isinf(objective)) objective=1e5; // get rid of NaN and Inf results (division by zero)\r\n	objective+=tree.size()*CHROM_LEN_PENALIZATION; // possibly penalize longer chromosomes\r\n\r\n	#ifdef DEBUG_POPULATION	\r\n	cout << \"  (\" <<  objective  << \"): \" << tree;\r\n	#endif	\r\n\r\n	return objective;	\r\n}\r\n\r\n\r\n\r\n\r\n// Initializer for tree chromosomes to maximum depth of MAX_DEPTH constant. Ensures that trees are traversable, eg. binary operator has 2 children, unary only one etc.\r\nvoid \r\nMakeRandomTreeNode(GATreeGenome<int> &tree, int depth, bool after)\r\n{\r\n	int randomitem=GARandomInt(0,TreeItemsCount-1);\r\n 	//GPTreeItem_T randomitem=TreeItems[randomitemnum];\r\n	short randomitemtype=TreeItems[randomitem].type;\r\n	\r\n	// if we reached maximum depth, create only terminals\r\n	if(depth>=MAX_DEPTH)\r\n	{\r\n		// not entirely optimal :)\r\n		while(randomitemtype!=CONSTANT && randomitemtype!=VARIABLE)\r\n		{\r\n			randomitem=GARandomInt(0,TreeItemsCount-1);\r\n			//randomitem=TreeItems[randomitemnum];\r\n			randomitemtype=TreeItems[randomitem].type;\r\n		}\r\n		// cout << \" depth, below \" << GetNodeName(randomitem) << endl;\r\n		tree.insert(randomitem,GATreeBASE::BELOW);\r\n		return;\r\n	}\r\n	\r\n	// insert side-by-side or below current node?\r\n	if(after)\r\n	{\r\n		tree.insert(randomitem,GATreeBASE::AFTER);\r\n	} else {\r\n		tree.insert(randomitem,GATreeBASE::BELOW);\r\n	}\r\n	\r\n	// constants and variables do not have children\r\n	if(randomitemtype==CONSTANT || randomitemtype==VARIABLE)\r\n	{ \r\n		return;\r\n	} else if(randomitemtype==UNARY_OPERATOR)\r\n	{ // unary operator has one children\r\n		MakeRandomTreeNode(tree, depth+1, false);\r\n	} else if(randomitemtype==BINARY_OPERATOR)\r\n	{ // binary has two children\r\n		//cout << \" binary operator \" << endl;\r\n		MakeRandomTreeNode(tree, depth+1, false);\r\n		tree.parent(); // move the iterator up one level\r\n		MakeRandomTreeNode(tree, depth+1, false);\r\n	} else {\r\n		cout << \"MakeRandomTreeNode error, unknown operator number :\" << randomitemtype;\r\n	}\r\n	\r\n	tree.parent(); // up one level\r\n}\r\n\r\n\r\n\r\n\r\n/* ----------------------------------------------------------------------------\r\nHere is the initializer for our genomes.  It builds a tree of n items of type\r\nint.  Notice that we first destroy any tree that is already in the genome \r\nbefore we do our initialization.  This is so that the genomes can be re-used.\r\nWhen you re-run a GA, it does not destroy the individuals in the population - \r\nit reuses them.  Thus, the initializer must make sure that the genome is \r\ncleaned up before it tries to initialize it.\r\n---------------------------------------------------------------------------- */\r\nvoid\r\nTreeInitializer(GAGenome & c)\r\n{\r\n	GATreeGenome<int> &child=(GATreeGenome<int> &)c;\r\n	\r\n	// destroy any pre-existing tree\r\n	child.root();\r\n	child.destroy();\r\n\r\n	// make random tree\r\n	MakeRandomTreeNode(child,0,false);\r\n}\r\n\r\n\r\n// just for inspiration\r\nvoid \r\nPreorderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params )\r\n{\r\n	if(!n) return;\r\n	GANodeBASE * node = (GANodeBASE *)n;\r\n	\r\n	//cout << GetNodeName(((GANode<GPTreeItem_T> *)node)->contents) << \" \";\r\n	//cout << GetNodeName(((GANode<int> *)node)->contents) << \" aaa\" << endl;\r\n	function(node,params);\r\n	\r\n	PreorderWalk((GANode<int> *)node->child, function, params);\r\n	\r\n	for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n		//cout << GetNodeName(((GANode<GPTreeItem_T> *)tmp)->contents) << \" \";\r\n		function(tmp,params);\r\n		PreorderWalk((GANode<int> *)tmp->child, function, params);\r\n	}\r\n}\r\n\r\n\r\n// Function for walking the tree genome. Results in calling \"function\" in reverse-polish-notation order on nodes\r\nvoid \r\nPostoderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params )\r\n{\r\n\r\n	if(!n) return;\r\n	GANodeBASE * node = (GANodeBASE *)n;\r\n	//cout << \"PostorderWalk: \" << n << endl;	\r\n	//cout << GetNodeName(((GANode<int> *)node)->contents) << \" aaa\" << endl;\r\n	\r\n	PostoderWalk((GANode<int> *)node->child, function, params);\r\n\r\n	for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n		//cout << GetNodeName(((GANode<GPTreeItem_T> *)tmp)->contents) << \" \";\r\n		PostoderWalk((GANode<int> *)tmp->child, function, params);\r\n		function(tmp,params);\r\n	}\r\n\r\n	function(node,params);	\r\n	\r\n}\r\n\r\n\r\n\r\n/* ----------------------------------------------------------------------------\r\nTree genome method overrides\r\n-------------------------------------------------------------------------------\r\nHere we override the built-in methods for the tree class.  We can do this\r\nbecause the tree class is template-ized - when the compiler looks for an\r\ninstance of the tree class methods, it finds these so it won\'t generate an\r\ninstance from the templates.  You can do this with ANY method of a template\r\nclass.  Here we do it only for the write method.\r\nThe default write operator prints out po	//TreeItemsCount\r\ninters to the contents of each node.\r\nHere we print out the actual contents of each node.  This assumes that the \r\nobject in our node has the operator<< defined for it.\r\n---------------------------------------------------------------------------- */\r\nvoid \r\nWriteNode(ostream & os, GANode<int> * n)\r\n{\r\n	if(!n) return;\r\n	GANodeBASE * node = (GANodeBASE *)n;\r\n	os.width(10);\r\n	os << (((GANode<int> *)node)) << \" \";\r\n	os.width(10);\r\n	os << GetNodeName(((GANode<int> *)node)->contents) << \" \";\r\n	//os << GetNodeName((*(GANode<int> *)node)) << \" \";\r\n	os.width(10); \r\n	if(node->parent) os << ((GANode<int> *)node->parent) << \" \";\r\n	else os << \"_\" << \" \";\r\n	os.width(10); \r\n	if(node->child) os << ((GANode<int> *)node->child) << \" \";\r\n	else os << \"_\" << \" \";\r\n	os.width(10);\r\n	if(node->next) os << (((GANode<int> *)node->next)) << \" \";\r\n	else os << \"_\" << \" \";\r\n	os.width(10);\r\n	if(node->prev) os << (((GANode<int> *)node->prev)) << \"\\n\";\r\n	else os << \".\\n\";\r\n	WriteNode(os, (GANode<int> *)node->child);\r\n	\r\n	for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n		os.width(10);\r\n		os << (((GANode<int> *)tmp)) << \" \";\r\n		os.width(10);\r\n		os << GetNodeName(((GANode<int> *)tmp)->contents) << \" \";\r\n		//os << GetNodeName(((GANode<int> *)tmp)) << \" \";\r\n		os.width(10);\r\n		if(tmp->parent) os << (((GANode<int> *)tmp->parent)) << \" \";\r\n		else os << \"_\" << \" \";\r\n		os.width(10); \r\n		if(tmp->child) os << (((GANode<int> *)tmp->child)) << \" \";\r\n		else os << \"_\" << \" \";\r\n		os.width(10); \r\n		if(tmp->next) os << (((GANode<int> *)tmp->next)) << \" \";\r\n		else os << \"_\" << \" \";\r\n		os.width(10); \r\n		if(tmp->prev) os << (((GANode<int> *)tmp->prev)) << \"\\n\";\r\n		else os << \".\\n\";\r\n		WriteNode(os, (GANode<int> *)tmp->child);\r\n	}\r\n}\r\n\r\n\r\n// function for printing out the phenotype to screen\r\ntemplate<> int\r\nGATreeGenome<int>::write(ostream & os) const\r\n{\r\n	//os << \"       ptr       type     parent      child       next       prev\\n\";\r\n	//WriteNode(os, (GANode<int> *)rt);\r\n	//PreorderWalk((GANode<int> *)rt, PrintNodeType, 0);\r\n	PostoderWalk((GANode<int> *)rt, PrintNodeType, 0);\r\n	cout << endl;\r\n	return os.fail() ? 1 : 0;\r\n}\r\n\r\n\r\n\r\n// force instantiations for compilers that do not do auto instantiation\r\n// for some compilers (e.g. metrowerks) this must come after any\r\n// specializations or you will get \'multiply-defined errors when you compile.\r\n#if !defined(GALIB_USE_AUTO_INST)\r\n#include <ga/GATree.C>\r\n#include <ga/GATreeGenome.C>\r\nGALIB_INSTANTIATION_PREFIX GATreeGenome<int>;\r\nGALIB_INSTANTIATION_PREFIX GATree<int>;\r\n#endif','cpp','','mxbfP',0,'cs67kd','80.188.29.62',85,0,0),(6,'prlfhbaoh',2,'waritko',NULL,1421839235,0,'NetSuite test','using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace question1\r\n{\r\n    class Program\r\n    {\r\n        /// <summary>\r\n        /// Removes duplicate entries from sorted array of integers\r\n        /// </summary>\r\n        /// <param name=\"values\">Input sorted array of integers</param>\r\n        /// <returns>Sorted array of integers without duplicate entries</returns>\r\n        public int[] removeDuplicates(int[] values)\r\n        {\r\n            // First, check, if there is valid array and contains at least one member\r\n            if (values == null || values.Length < 1) return null;\r\n\r\n            int nullVal = values[0] - 1; // set this to be smaller than first member of array\r\n            int lastVal = nullVal; // Initialize lastVal with invalid value\r\n            int uniqueCount = 0;\r\n\r\n            // Simply just go over the array and since it is sorted, just ommit the members, that are equal to previous one\r\n            for(int i = 0; i < values.Length; i++)\r\n            {\r\n                if (values[i] != lastVal)\r\n                {\r\n                    uniqueCount++;\r\n                }\r\n                else\r\n                {\r\n                    values[i] = nullVal;\r\n                }\r\n                lastVal = values[i];\r\n            }\r\n\r\n            // Create output array in needed length\r\n            int[] retValue = new int[uniqueCount];\r\n\r\n            // Copy the unique ( != nullValue) elements to output array\r\n            int outIdx = 0;\r\n            for (int i = 0; i < values.Length; i++)\r\n            {\r\n                if (values[i] != nullVal)\r\n                {\r\n                    retValue[outIdx] = values[i];\r\n                    outIdx++; // I could write retValue[idx++] ... but this is easier read\r\n                }\r\n            }\r\n            return retValue;\r\n        }\r\n        // Answers to questions:\r\n        // 1) Yes, the code is written as production, if needed to respect the limitations (no dynamic structures such as List<int>)\r\n        // 2) No assumptions beyond C# typechecking, if given parameter is either null or empty array, I return back null value\r\n        // 3) Number of unique items in array\r\n        // 4) I think yes, since the array is already sorted, i can just go over it and compare current element with previous one\r\n        // 5) It has linear complexity (O(n)) since I traverse the array fixed number of times (2x)\r\n\r\n\r\n\r\n\r\n        /// <summary>\r\n        /// Approximates square root of a number with given precision\r\n        /// </summary>\r\n        /// <param name=\"a\">Number to approximate square root from</param>\r\n        /// <param name=\"epsilon\">How precisely to approximate (absolute value of retVal^2-a must be less than epsilon)</param>\r\n        /// <returns>Approximated square root of a</returns>\r\n        public double square_root(double a, double epsilon)\r\n        {\r\n            double x = a/3; // Divide number with quite random value to get the approximation started\r\n            double lastX;\r\n\r\n            // Approximation loop\r\n            while (Math.Abs(x*x - a) > epsilon)\r\n            {\r\n                lastX = x;\r\n                x = ((a/x) + lastX) / 2;\r\n            }\r\n            return x;\r\n        }\r\n        // Answers to questions:\r\n        // 1) \r\n        // 2) It will return zero, as abs(0-0) == 0\r\n        // 3) 1.4142137800472\r\n    }\r\n}','csharp','','8eYkR',1,'ouqtfn','80.188.29.62',6,0,0),(7,'phllxu6so',2,'waritko',NULL,1422154982,0,'NetSuite test SQL','-- I\'m using MS SQL dialect\r\n--\r\n--\r\n-- A\r\nSELECT\r\n	[E].[name],\r\n	[S].[name] [supervisor_name],\r\n	[B].[nbonus]\r\nFROM\r\n	[employees] [E]\r\nLEFT JOIN [employees] [S] ON [E].[supervisor] = [S].[empid]\r\nJOIN [bonus] [B] ON [B].[empid] = [E].[empid]\r\nWHERE\r\n	[B].[nbonus] > 10000 \r\n\r\n--\r\n--\r\n--	B \r\nSELECT\r\n	[E].[name],\r\n	[E].[salary],\r\n	[B].[nbonus],\r\n	[TS].[total],\r\n	[E].[location]\r\nFROM\r\n	(\r\n		SELECT\r\n			[E].[empid],\r\n			MAX (\r\n				[E].[salary] + COALESCE ([B].[nbonus], 0)\r\n			) [total]\r\n		FROM\r\n			[employees] [E]\r\n		LEFT JOIN [bonus] [B] ON [E].[empid] = [B].[empid]\r\n		GROUP BY\r\n			[E].[location],\r\n			[E].[empid]\r\n	) [TS]\r\nJOIN [employees] [E] ON [E].[empid] = [TS].[empid]\r\nJOIN [bonus] [B] ON [TS].[empid] = [B].[empid] \r\n\r\n\r\n--\r\n--\r\n-- C\r\nUPDATE [employees]\r\nSET [supervisor] = (\r\n	SELECT\r\n		[supervisor]\r\n	FROM\r\n		[new_supervisor] [NS]\r\n	WHERE\r\n		[NS].[empid] = [employees].[empid]\r\n)\r\nWHERE\r\n	[empid] IN (\r\n		SELECT\r\n			[empid]\r\n		FROM\r\n			[new_supervisor]\r\n	)','sql','','y2rMT',1,'bgphlv','194.228.20.243',5,0,0),(8,'pwvg7ukpz',2,'waritko',NULL,1422448622,0,'SuiteScript Service Item ','var record = nlapiCreateRecord(\'serviceitem\', true);\r\nrecord.setFieldValue(\'itemid\', \'Service 1422446593707gg\');\r\nrecord.setFieldValue(\'subtype\', \'Sale\');\r\nrecord.setLineItemValue(\'price\', \'price_1_\', 1, \'25\');\r\nrecord.selectNewLineItem(\'billingrate\');\r\nrecord.setCurrentLineItemValue(\'billingrate\', \'billingclass\', \'3\');\r\nrecord.setCurrentLineItemValue(\'billingrate\', \'rate1\', \'63\');\r\nrecord.commitLineItem(\'billingrate\');\r\nnlapiSubmitRecord(record);','javascript','','b0YlM',0,'fhl39d','80.188.29.62',67,0,0),(9,'pbjzdkvt9',2,'waritko',NULL,1422885790,0,'FAM','/**\r\n * � 2014 NetSuite Inc.  User may not copy, modify, distribute, or re-bundle or otherwise make available this code.\r\n */\r\n\r\n/* *************************************************\r\n * Fixed Assets Register, Nolan Computers Plc\r\n *\r\n * Shared Server Scripts for Fixed Assets\r\n *\r\n * Version History\r\n *         30/05/2007    P.Boniface        Initial version created\r\n *        06/04/2010    P.Boniface        Common code split off to ncFAR_Utilities script file\r\n */\r\n\r\n/* *************************************************\r\n * Functions implemented:\r\n *\r\n * ncFAR_FnToken object - defines an element within a formula expression\r\n * ncFAR_ParseFormula - parse a formula expression and determine if syntax is correct and build tree of terms\r\n * ncFAR_ParseFnExp - parse a formula expression and build a simple array of identified terms\r\n * ncFAR_AssignTerms - parse a formula expression list and fold into a tree of terms\r\n * ncFAR_ExecFormula - execute a formula expression (already parsed and validated) and return resulting value\r\n * ncFAR_RenderFormula - renders a formula expression as inline html showing the grouping of terms (for visual validation)\r\n *\r\n * ncFAR_NewPropBG - Trawl for new assets and create proposals (background process)\r\n * ncFAR_CreateProposal_ITER - validate and create a new asset proposal record (defaulting from asset type)\r\n * ncFAR_GenerateAssetsFromPropList - Generate new assets from the given array of asset proposals\r\n * ncFAR_GenerateAsset - Generates a new asset from the given asset proposal record\r\n *\r\n * ncFAR_DepreciateAssetBG - Depreciate assets (background process)\r\n * ncFAR_DepreciateAsset_v2 - Depreciate given asset\r\n *\r\n * ncFAR_BeforeSubmitAsset - Event Script to run \'Before Submit\' for Asset records\r\n * ncFAR_AfterSubmitJob - Event Script to run \'After Submit\' for Job (project) records\r\n *\r\n * CreateJournalEntry - will create a new journalentry record and add lines based upon the arrays of values\r\n * CreateJournalEntryToArray - will create a new journalentry record and add lines based upon the arrays of values\r\n * GetJournalHash - create hash for rolling up journals\r\n */\r\n\r\n/* *************************************************\r\n * Utility Functions for Netsuite, Nolan Computers Plc\r\n *\r\n * Shared General Utility Functions for use with Netsuite Projects\r\n *\r\n */\r\n\r\n/* *************************************************\r\n * Functions implemented:\r\n *\r\n * ncConst - object which will contain our Record Type constants\r\n *\r\n * ncLogExecution - utility for debug, to either log (server side) or show on screen (client) a debug message\r\n * ncGetIdFromName - search for a record where given field contains given value, and return record ID\r\n * ncRound2 - utility function to round the supplied numeric value to 2 decimal places\r\n * ncRoundCurr - utility function to round the supplied numeric value to 2 or 0 decimal places, based upon currency info\r\n * ncFormatNumber - utility function to return a formatted number string\r\n * ncGetCurrencyInfo - utility function to retrieve format info from the given currency record\r\n * ncFormatNumberWithCurrency - utility function to return a formatted number string, using info from the given currency record\r\n * ncParseIntNV - utility function to parse a string to an integer, with default value for null/empty string\r\n * ncParseFloatNV - utility function to parse a string to a float, with default value for null/empty string\r\n * ncStringToDate - utility function to parse a string to a date, with default value for null/empty string\r\n * ncGetAgeInMonths - utility function to return the different in months between two dates, regardless of day within each month\r\n * SubsidiariesEnabled - Utility script to check whether Subsidiaries feature is enabled\r\n * ncIsFeatureEnabled - Utility script to check whether a feature is enabled\r\n * ncGetEndOfMonth - Utility script to get the end of the month for a given date, returned as a new date object\r\n * ncBGP_WriteToLog - create a background process log record for the current process instance\r\n *\r\n */\r\n\r\n/* ************* Shared Constant Values ************* */\r\n\r\nfunction ncConst()    // dummy constructor for ncConst object which will contain our Record Type constants\r\n{\r\n}\r\n\r\nncConst.BGP_ProcessInstance = \'customrecord_bg_procinstance\';    /* record type for Process Instance */\r\nncConst.BGP_ProcessLog = \'customrecord_bg_proclog\';                /* record type for Process Log */\r\nncConst.FAR_SystemSetup = \'customrecord_ncfar_systemsetup\';            /* record type for System Setup */\r\nncConst.FAR_AssetType = \'customrecord_ncfar_assettype\';                /* record type for Asset Type */\r\nncConst.FAR_DeprMethod = \'customrecord_ncfar_deprmethod\';            /* record type for Deprecation Method */\r\nncConst.FAR_Asset = \'customrecord_ncfar_asset\';                        /* record type for Asset */\r\nncConst.FAR_Proposal = \'customrecord_ncfar_assetproposal\';            /* record type for Asset Proposal */\r\nncConst.FAR_AssetUsage = \'customrecord_ncfar_assetusage\';            /* record type for Asset Usage */\r\nncConst.FAR_DeprHistory = \'customrecord_ncfar_deprhistory\';            /* record type for Depreciation History */\r\nncConst.FAR_XferAccounts = \'customrecord_ncfar_transferaccounts\';    /* record type for Asset Transfer Accounts */\r\nncConst.BGP_ProcInstIdParam = \'custscript_bgp_procinstid\';            /* parameter name for Process Instance Id on scheduled script deployments */\r\nncConst.BGP_FunctionNameParam = \'custscript_bgp_processfunction\';    /* parameter name for Function Name on scheduled script deployments */\r\nncConst.BGP_StartupScriptId = \'customscript_ncfar_bgp_startup\';        /* script id for background execution startup */\r\nncConst.BGP_StartupDeployId = \'customdeploy_ncfar_bgp_startup_sd1\';    /* deployment id for background execution startup */\r\nncConst.NC_ProcessActivity = \'\';    /* (old) record type for Process Activity */\r\nncConst.NC_ProcessLog = \'\';            /* (old) record type for Process Log */\r\nncConst.BGP_ProcessIdParam = \'custscript_bgp_processid\';            /* (old) parameter name for Process Id on scheduled script deployments */\r\nncConst.BGP_ProcessIdParam2 =\'custscript_bgp_startprocessid\';        /* (old) parameter name for Process Id on additional scheduled script deployments */\r\n\r\nncConst.FAR_AltDepr = \'customrecord_ncfar_altdepreciation\';            /* record type for new Alternate Depreciation */\r\nncConst.FAM_AltMethods = \'customrecord_ncfar_altmethods\';            /* record type for new Alternate Methods */\r\n\r\n\r\nvar OBJ_ncFAR_ALTDEPR = {};\r\nvar ncFAR_ALTDEPR = function(_assetId)\r\n{\r\n    var _recName = \'customrecord_ncfar_altdepreciation\';\r\n    var _fields =  [\'internalid\',\r\n                    \'custrecord_altdepraltmethod\',\r\n                    \'custrecord_altdeprmethod\',\r\n                    \'custrecord_altdeprconvention\',\r\n                    \'custrecord_altdeprlifetime\',\r\n                    \'custrecord_altdeprrv\',\r\n                    \'custrecord_altdeprcd\',\r\n                    \'custrecord_altdeprld\',\r\n                    \'custrecord_altdeprnbv\',\r\n                    \'custrecord_altdeprfc\',\r\n                    \'custrecord_altdeprpriornbv\',\r\n                    \'custrecord_altdeprfinancialyear\',\r\n                    \'custrecord_altdeprperiodconvention\',\r\n                    \'custrecord_altdeproverride\',\r\n                    \'custrecord_altdepr_groupmaster\',\r\n                    \'custrecord_altdepr_groupdepreciation\',\r\n                    \'custrecord_altdepr_depreciationperiod\',\r\n                    \'custrecord_altdepr_originalcost\',\r\n                    \'custrecord_altdepr_currentcost\',\r\n                    \'custrecord_altdepr_subsidiary\'];\r\n\r\n    this.assetId = _assetId;\r\n    this.readRecords = [];\r\n    this.updateRecords = [];\r\n\r\n    this.getAllRecords = function(filter_params)\r\n    {\r\n        var arrRecords = [];\r\n\r\n        var cols = [];\r\n        for (var f in _fields) {\r\n            cols.push(new nlobjSearchColumn(_fields[f]));\r\n        }\r\n        cols[0].setSort();\r\n\r\n        var filters = [new nlobjSearchFilter(\'custrecord_altdeprasset\', null, \'anyof\', _assetId)];\r\n\r\n        if ((typeof filter_params == \'object\') && filter_params.length) {\r\n            filters = filters.concat(filter_params);\r\n        }\r\n\r\n        var result = nlapiSearchRecord(_recName, null,\r\n                            filters,\r\n                            cols);\r\n        if (result != null) {\r\n            for (var i=0; i<result.length; i++) {\r\n                var rec = result[i];\r\n                arrRecords[i] = {};\r\n                arrRecords[i][\'skip\'] = false;\r\n                for (var f in _fields) {\r\n                    arrRecords[i][_fields[f]] = rec.getValue(_fields[f]);\r\n                }\r\n            }\r\n        }\r\n\r\n        this.readRecords = arrRecords;\r\n        this.updateRecords = arrRecords;\r\n        return this.readRecords;\r\n    };\r\n};\r\n\r\n// TO BE REMOVED; use FAM_Util.getDefaultValuesPerBook instead\r\nvar clsDefaultAltDepr = function(_assetTypeId)\r\n{\r\n    var _recName = \'customrecord_ncfar_altdeprdef\';\r\n    var _fields =  [\'internalid\',\r\n                    \'custrecord_altdeprdef_altmethod\',\r\n                    \'custrecord_altdeprdef_deprmethod\',\r\n                    \'custrecord_altdeprdef_convention\',\r\n                    \'custrecord_altdeprdef_lifetime\',\r\n                    \'custrecord_altdeprdef_financialyear\',\r\n                    \'custrecord_altdeprdef_periodconvention\',\r\n                    \'custrecord_altdeprdef_depreciationperiod\',\r\n                    \'custrecord_altdeprdef_subsidiary\'];\r\n\r\n    this.getAllRecords = function(filter_params)\r\n    {\r\n        var arrRecords = [];\r\n\r\n        var cols = [];\r\n        for (var f in _fields) {\r\n            cols.push(new nlobjSearchColumn(_fields[f]));\r\n        }\r\n        cols[0].setSort(); //sort by internalid\r\n\r\n        var filters = [new nlobjSearchFilter(\'custrecord_altdeprdef_assettype\', null, \'anyof\', _assetTypeId)];\r\n        if ((typeof filter_params == \'object\') && filter_params.length) {\r\n            filters = filters.concat(filter_params);\r\n        }\r\n\r\n        var result = nlapiSearchRecord(_recName, null, filters, cols);\r\n        if (result != null) {\r\n            for (var i=0; i<result.length; i++) {\r\n                var rec = result[i];\r\n                arrRecords[i] = {};\r\n                for (var f in _fields) {\r\n                    arrRecords[i][_fields[f]] = rec.getValue(_fields[f]);\r\n                }\r\n            }\r\n        }\r\n\r\n        return arrRecords;\r\n    }\r\n}\r\n\r\n// TO BE REMOVED; use FAM_Util.getProposalValuesPerBook instead\r\nvar clsProposalAltDepr = function(_propId)\r\n{\r\n    var _recName = \'customrecord_ncfar_altdepr_proposal\';\r\n    var _fields =  [\'internalid\',\r\n                    \'custrecord_propaltdepr_altmethod\',\r\n                    \'custrecord_propaltdepr_deprmethod\',\r\n                    \'custrecord_propaltdepr_convention\',\r\n                    \'custrecord_propaltdepr_lifetime\',\r\n                    \'custrecord_propaltdepr_financialyear\',\r\n                    \'custrecord_propaltdepr_periodconvention\',\r\n                    \'custrecord_propaltdepr_deprperiod\',\r\n                    \'custrecord_propaltdepr_subsidiary\'];\r\n\r\n    this.getAllRecords = function(filter_params)\r\n    {\r\n        var arrRecords = [];\r\n\r\n        var cols = [];\r\n        for (var f in _fields) {\r\n            cols.push(new nlobjSearchColumn(_fields[f]));\r\n        }\r\n        cols[0].setSort(); //sort by internalid\r\n\r\n        var filters = [new nlobjSearchFilter(\'custrecord_propaltdepr_propid\', null, \'anyof\', _propId)];\r\n        if ((typeof filter_params == \'object\') && filter_params.length) {\r\n            filters = filters.concat(filter_params);\r\n        }\r\n\r\n        var result = nlapiSearchRecord(_recName, null, filters, cols);\r\n        if (result != null) {\r\n            for (var i=0; i<result.length; i++) {\r\n                var rec = result[i];\r\n                arrRecords[i] = {};\r\n                for (var f in _fields) {\r\n                    arrRecords[i][_fields[f]] = rec.getValue(_fields[f]);\r\n                }\r\n            }\r\n        }\r\n\r\n        return arrRecords;\r\n    }\r\n}\r\n\r\n\r\n\r\n\r\n/* ************* Utilities ************* */\r\n\r\n// utility for debug, to either log (server side) or show on screen (client) a debug message\r\nfunction ncLogExecution(msgType, msgTitle, msgDetails)\r\n{\r\n    if( typeof(nlapiLogExecution) != \'undefined\' )\r\n        nlapiLogExecution(msgType,msgTitle,msgDetails);\r\n    else\r\n        alert(msgTitle+\'\\n\\n\'+msgDetails);\r\n}\r\n\r\nfunction ncGetIdFromName(recordtype,fldName,fldValue)\r\n{\r\n    var SF = new nlobjSearchFilter(fldName,null,\'is\',fldValue,null);\r\n    var SC = new nlobjSearchColumn(fldName);\r\n    var SR = nlapiSearchRecord(recordtype,null,SF,SC);\r\n    if( (SR == null) || (SR.length == 0) )\r\n    {\r\n        return null;\r\n    }\r\n    return SR[0].getId();\r\n}\r\n\r\nfunction isUndefinedNullOrEmpty( value ) {\r\n    return (!value || value == null || value == \'\');\r\n}\r\n\r\n/* ncRound2 - utility function to round the supplied numeric value to 2 decimal places\r\n *\r\n * Parameters:\r\n *         N            - the numeric value to be rounded\r\n * Returns:\r\n *         value rounded to 2 decimal places\r\n */\r\nfunction ncRound2(N)\r\n{\r\n    return Math.round(N*100.00) / 100.00;\r\n}\r\n\r\n/* ncRoundCurr - utility function to round the supplied numeric value to 2 or 0 decimal places, based upon currency info\r\n *\r\n * Parameters:\r\n *         N            - the numeric value to be rounded\r\n *        Curr        - the symbol of the currency being rounded\r\n *        IntCurr        - list of currency symbols for 0 dp\r\n * Returns:\r\n *         value rounded to appropriate decimal places\r\n */\r\nfunction ncRoundCurr(N,Curr,IntCurr)\r\n{\r\n    if( (Curr != null) && (Curr != \'\') && (IntCurr != null) && (IntCurr != \'\') && (IntCurr.indexOf(Curr) != -1) )\r\n        return Math.round(N);\r\n    else\r\n        return Math.round(N*100.00) / 100.00;\r\n}\r\n\r\n/* ncFormatNumber - utility function to return a formatted number string\r\n *\r\n * Parameters:\r\n *         N            - the numeric value to be formatted\r\n *      G            - the number group separator, e.g. for 15000 with: \'\':15000, \',\':15,000, \' \':15 000\r\n *        D            - the decimal place symbol, e.g. for 123.45 with: \'.\':123.45, \',\':123,45\r\n *      P            - the number of decimal places to display\r\n *      S            - the sign to display for negative number - this can be a two-element array to display before and after, e.g. \'(\',\')\'\r\n *      C            - the currency symbol to display, will always lead the number (with no space, so use \'$ \' for \'$ 100\')\r\n * Returns:\r\n *         the formatted representation of the number\r\n */\r\nfunction ncFormatNumber(N,G,D,P,S,C)\r\n{\r\n    try\r\n    {\r\n        var fact = Math.pow(10,P);\r\n        var rndN = Math.round(N*fact)/fact;\r\n        var absN = Math.abs(rndN);\r\n        var tmpStr = absN.toString();\r\n        var tPos;\r\n        var decsym = D;\r\n        var testval = 123.45;\r\n        var testfmt = testval.toString();\r\n        var locsym = testfmt.substr(3,1);\r\n\r\n        if( P>0 )\r\n        {\r\n            tPos = tmpStr.indexOf(locsym);\r\n            if( tPos == -1 )\r\n            {\r\n                tmpStr += locsym;\r\n                tPos = tmpStr.indexOf(locsym);\r\n            }\r\n            while( tmpStr.length <= (tPos+P) )\r\n                tmpStr += \'0\';\r\n\r\n            if( locsym != decsym )\r\n                tmpStr = tmpStr.substr(0,tPos) + D + tmpStr.substr(tPos+1);\r\n        }\r\n        else\r\n            tPos = tmpStr.length;\r\n        if( G != \'\' )\r\n        {\r\n            while( tPos > 3 )\r\n            {\r\n                tmpStr = tmpStr.substr(0,tPos-3) + G + tmpStr.substr(tPos-3);\r\n                tPos -= 3;\r\n            }\r\n        }\r\n        if( N < 0 )\r\n        {\r\n            if( S instanceof Array )\r\n                tmpStr = S[0] + tmpStr + S[1];\r\n            else\r\n                tmpStr = S + tmpStr;\r\n        }\r\n        if( (C != null) && (C != \'\') )\r\n            tmpStr = C + tmpStr;\r\n\r\n        return(tmpStr);\r\n    } catch(e) {\r\n        return(\'NAN\');\r\n    }\r\n}\r\n\r\n/* ncGetCurrencyInfo - utility function to retrieve format info from the given currency record\r\n *\r\n * Parameters:\r\n *      Cid            - the id of a currency record\r\n * Returns:\r\n *         A named-values array containing the following currency format details:\r\n *             \'CurrencySymbol\', \'DecimalSymbol\', \'GroupingSymbol\' and \'CurrencyName\'\r\n */\r\nfunction ncGetCurrencyInfo(Cid)\r\n{\r\n    var CurrInfo;\r\n\r\n    try\r\n    {\r\n        var rCurr = nlapiLoadRecord(\'currency\',Cid);\r\n        if( rCurr != null )\r\n        {\r\n            var currSym = \'\';\r\n            var decSym = \'\';\r\n            var grpSym = \'\';\r\n\r\n            var testfmt = rCurr.getFieldValue(\'currencyformatsample\') || rCurr.getFieldValue(\'formatsample\');\r\n            // NetSuite 2011.1 uses a new format sample, 1234.56 not 123.45 ...\r\n            var srch = /\\d\\D\\d{3}\\D\\d{2}/;    // 1 digit, 1 non-digit (grouping char), 3 digits, 1 non-digit (decimal point), 2 digits\r\n            var numpos = testfmt.search(srch);\r\n            if( numpos != -1 )\r\n            {\r\n                if( numpos == 0 )\r\n                    currSym = testfmt.substr(8);    // pick up everything after the number\r\n                else\r\n                    currSym = testfmt.substr(0,numpos);    // pick up everything before the number\r\n                decSym = testfmt.substr(numpos+5,1);    // pick up the symbol before the two decimal places\r\n                grpSym = testfmt.substr(numpos+1,1);    // pick up the symbol between the digit groups\r\n            }\r\n            else\r\n            {\r\n                // could be that there is no grouping symbol, so look for 4 digits, decimal point, 2 digits\r\n                srch = /\\d{4}\\D\\d{2}/;\r\n                numpos = testfmt.search(srch);\r\n                if( numpos != -1 )\r\n                {\r\n                    if( numpos == 0 )\r\n                        currSym = testfmt.substr(7);    // pick up everything after the number\r\n                    else\r\n                        currSym = testfmt.substr(0,numpos);    // pick up everything before the number\r\n                    decSym = testfmt.substr(numpos+4,1);    // pick up the symbol before the two decimal places\r\n                    grpSym = \'\'; // no grouping symbol\r\n                }\r\n                else\r\n                {\r\n                    // revert to prior version\r\n                    srch = /\\d{3}\\D\\d{2}/;    // 3 digits, 1 non-digit (decimal point), 2 digits\r\n                    numpos = testfmt.search(srch);\r\n                    if( numpos == -1 )\r\n                        return(CurrInfo);    // cannot handle this, probably failed to retrieve formatsample\r\n\r\n                    if( numpos == 0 )\r\n                        currSym = testfmt.substr(6);    // pick up everything after the number\r\n                    else\r\n                        currSym = testfmt.substr(0,numpos);    // pick up everything before the number\r\n                    decSym = testfmt.substr(numpos+3,1);    // pick up the symbol between the two digit groups\r\n                    grpSym = (decSym==\',\')?\'.\':\',\';            // use \'.\' if decimal is \',\' otherwise use \',\'\r\n                }\r\n            }\r\n\r\n            CurrInfo = new Array();\r\n            CurrInfo[\'CurrencySymbol\'] = currSym;\r\n            CurrInfo[\'DecimalSymbol\']  = decSym;\r\n            CurrInfo[\'GroupingSymbol\'] = grpSym;\r\n            CurrInfo[\'CurrencyName\']   = rCurr.getFieldValue(\'name\');\r\n            CurrInfo[\'ISOCode\'] = rCurr.getFieldValue(\'symbol\');\r\n        }\r\n    } catch(e) {\r\n        var msg = \'\';\r\n        if ( e instanceof nlobjError )\r\n        {\r\n            msg = e.getCode() + \' - \' + e.getDetails();\r\n            var ST = e.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n            {\r\n                if( typeof(ST) == \'string\' )\r\n                    msg += \'<BR>\'+ST;\r\n                else    // in case we ever do get an array...\r\n                    for( var nST=0; nST<ST.length; ++nST )\r\n                        if( ST[nST] != \'undefined\' )\r\n                            msg += \'<BR>\'+ST[nST];\r\n            }\r\n        }\r\n        else\r\n            msg = e.toString();\r\n        ncLogExecution(\'error\',\'ncGetCurrencyInfo trapped exception\',msg);\r\n    }\r\n\r\n    return(CurrInfo);\r\n}\r\n\r\n/* ncFormatNumberWithCurrency - utility function to return a formatted number string, using info from the given currency record\r\n *\r\n * Parameters:\r\n *         N            - the numeric value to be formatted\r\n *      Cid            - the id of a currency record, to be used for symbol, decimal and grouping\r\n *      P            - the number of decimal places to display\r\n *      S            - the sign to display for negative number - this can be a two-element array to display before and after, e.g. \'(\',\')\'\r\n *      G            - the number group separator, e.g. for 15000 with: \'\':15000, \',\':15,000, \' \':15 000\r\n *                    if this is null, will default the grouping from the currency and decimal separator\r\n * Returns:\r\n *         the formatted representation of the number\r\n */\r\nfunction ncFormatNumberWithCurrency(N,Cid,P,S,G)\r\n{\r\n    try\r\n    {\r\n        var currInfo = ncGetCurrencyInfo(Cid);\r\n\r\n        var currSym = currInfo[\'CurrencySymbol\'];\r\n        var decSym = currInfo[\'DecimalSymbol\'];\r\n        var grpSym = currInfo[\'GroupingSymbol\'];\r\n        if( G != null )\r\n            grpSym = G;\r\n\r\n        return( ncFormatNumber(N,grpSym,decSym,P,S,currSym) );\r\n    } catch(e) {\r\n        return(\'NAN\');\r\n    }\r\n}\r\n\r\n/* ncParseIntNV - utility function to parse a string to an integer, with default value for null/empty string\r\n *\r\n * Parameters:\r\n *         S            - the string value to be parsed\r\n *         I            - the numeric (integer) value to use as a default\r\n * Returns:\r\n *         default or parsed value (which may still be NaN)\r\n */\r\nfunction ncParseIntNV(S,I)\r\n{\r\n    if( (S==null) || (S.length==0) )\r\n        return I;\r\n\r\n    return parseInt(S,10);\r\n}\r\n\r\n/* ncParseFloatNV - utility function to parse a string to a float, with default value for null/empty string\r\n *\r\n * Parameters:\r\n *         S            - the string value to be parsed\r\n *         F            - the numeric (float) value to use as a default\r\n * Returns:\r\n *         default or parsed value (which may still be NaN)\r\n */\r\nfunction ncParseFloatNV(S,F)\r\n{\r\n    if( (S==null) || (S.length==0) )\r\n        return F;\r\n\r\n    return parseFloat(S);\r\n}\r\n\r\n/* ncEncodeDate - utility function to convert a date to a string in a fixed format rather than based upon user preference\r\n *\r\n * Parameters:\r\n *       D            - the date value to encode\r\n * Returns:\r\n *       encoded date (as a string, YYYYMMDD format)\r\n */\r\nfunction ncEncodeDate(D)\r\n{\r\n    var YYYY = D.getUTCFullYear();\r\n    var MM = D.getUTCMonth() + 1;    // because dates use zero-based month index\r\n    var DD = D.getUTCDate();    // getDay() gives day of week, getDate() is day of month\r\n\r\n    var sYYYY = YYYY.toString();\r\n    var sMM = MM.toString();\r\n    if (sMM.length == 1)\r\n        sMM = \'0\' + sMM;\r\n    var sDD = DD.toString();\r\n    if (sDD.length == 1)\r\n        sDD = \'0\' + sDD;\r\n\r\n    return sYYYY+sMM+sDD;\r\n}\r\n\r\n/* ncDecodeDate - utility function to convert a date string to a date, based upon a fixed format rather than user preference\r\n *\r\n * Parameters:\r\n *       S            - the date string to decode, in YYYYMMDD format\r\n * Returns:\r\n *       decoded date\r\n */\r\nfunction ncDecodeDate(S)\r\n{\r\n    var sYYYY = S.substring(0,4);\r\n    var sMM = S.substring(4,6);\r\n    var sDD = S.substring(6,8);\r\n\r\n    var YYYY = parseInt(sYYYY,10);\r\n    var MM = parseInt(sMM,10) - 1; // because dates use zero-based month index\r\n    var DD = parseInt(sDD,10);\r\n\r\n    return new Date(YYYY,MM,DD,0,0,0,0);\r\n}\r\n\r\n/* ncStringToDate - utility function to parse a string to a date, with default value for null/empty string\r\n *\r\n * Parameters:\r\n *         S            - the string value to be parsed\r\n *         D            - the date value to use as a default\r\n * Returns:\r\n *         default or parsed value\r\n */\r\nfunction ncStringToDate(S,D)\r\n{\r\n    if( (S==null) || (S.length==0) )\r\n        return D;\r\n\r\n    return nlapiStringToDate(S);\r\n}\r\n\r\n/* ncGetAgeInMonths - utility function to return the different in months between two dates, regardless of day within each month\r\n *\r\n * Parameters:\r\n *         startDate        - the first date\r\n *         currentDate        - the second date\r\n * Returns:\r\n *         number of months difference between the two dates (01/06/2007 to 31/07/2007 = 1, 30/06/2007 to 01/07/2007 = 1)\r\n */\r\nfunction ncGetAgeInMonths(startDate,currentDate)\r\n{\r\n    var currentAgeM = (currentDate.getFullYear() - startDate.getFullYear())*12 + (currentDate.getMonth() - startDate.getMonth());\r\n\r\n    return currentAgeM;\r\n}\r\n\r\n/* SubsidiariesEnabled - Utility script to check whether Subsidiaries feature is enabled\r\n *\r\n * In ClientScript code, nlobjContext.getSetting() can only retrieve SCRIPT parameters,\r\n *  not FEATURE settings or other values.  This script works for Client and Server contexts.\r\n *\r\n * Returns:\r\n *      boolean indicating whether Subsidiaries are enabled\r\n */\r\nfunction SubsidiariesEnabled()\r\n{\r\n    var rValue = false;\r\n    var currentContext = nlapiGetContext();\r\n\r\n    rValue = currentContext.getFeature(\'subsidiaries\');\r\n    return rValue;\r\n}\r\n\r\n\r\n/*  ncIsFeatureEnabled - Utility script to check whether a feature is enabled\r\n *\r\n * In ClientScript code, nlobjContext.getSetting() can only retrieve SCRIPT parameters,\r\n *  not FEATURE settings or other values.  This script works for Client and Server contexts.\r\n *\r\n * Returns:\r\n *      boolean indicating whether a feature is enabled\r\n */\r\nfunction ncIsFeatureEnabled(feature)\r\n{\r\n    var rValue;\r\n    var currentContext = nlapiGetContext();\r\n\r\n    // nlobjContext.getFeature() is now available and works in all contexts!\r\n    rValue = currentContext.getFeature(feature);\r\n    return rValue;\r\n\r\n}\r\n\r\n/* ncGetEndOfMonth - will return a new date object set to the last day of the same month as the source date\r\n * Parameters:\r\n *        sourceDate     - Date (actual date object)\r\n * Returns:\r\n *      new date object set to the last day of the same month as the source date\r\n */\r\nfunction ncGetEndOfMonth(sourceDate)\r\n{\r\n    var returnDate = new Date(sourceDate);\r\n    returnDate.setDate(1);\r\n    returnDate = nlapiAddMonths(returnDate,1);\r\n    returnDate = new Date(returnDate - 86400000); // 24 hrs x 60 mins x 60 secs x 1000 millisecs = 86400000\r\n\r\n    return returnDate;\r\n}\r\n\r\n\r\n/* ncBGP_WriteToLog - create a background process log record for the current process instance\r\n * Parameters:\r\n *      ProcessInstanceId    - record id for parent record (process instance)\r\n *      RecordRef            - current record description/name\r\n *      MessageText            - message to be logged\r\n *      MessageType            - type of message to be logged (string: Error, Warning or Message)\r\n */\r\nfunction ncBGP_WriteToLog(ProcessInstanceId,RecordRef,MessageText,MessageType)\r\n{\r\n    var l_MsgType;\r\n    switch (MessageType)\r\n    {\r\n        case \'Error\':\r\n            l_MsgType = 1;\r\n            break;\r\n\r\n        case \'Warning\':\r\n            l_MsgType = 2;\r\n            break;\r\n\r\n        case \'Message\':\r\n        default:\r\n            l_MsgType = 3;\r\n    }\r\n\r\n    var procmsg = MessageText;\r\n    if (procmsg && procmsg.length > 300) {\r\n        nlapiLogExecution(\'DEBUG\', \'ncBGP_WriteToLog\', \'Error Detail contained more than maximum \' +\r\n            \'number (300) characters, truncating message..\');\r\n        procmsg = procmsg.substring(0, 300);\r\n    }\r\n\r\n    var LogRec = nlapiCreateRecord(ncConst.BGP_ProcessLog);\r\n    LogRec.setFieldValue(\'custrecord_far_prolog_procinstance\',ProcessInstanceId);\r\n    LogRec.setFieldValue(\'custrecord_far_prolog_recordname\',RecordRef);\r\n    LogRec.setFieldValue(\'custrecord_far_prolog_type\',l_MsgType);\r\n    LogRec.setFieldValue(\'custrecord_far_prolog_msg\',procmsg);\r\n    nlapiSubmitRecord(LogRec,false);\r\n}\r\n\r\n\r\n/* *************************************************\r\n * Depreciation Formula (function) processing\r\n */\r\n\r\n/* ncFAR_FnToken object - defines an element within a formula expression\r\n *\r\n * Properties:\r\n *      OpCode    - operation code, see below for enum\r\n *      OpType    - operation type, indicates whether an operator or constant\r\n *      OpPrec    - operator precendence, used to control evalation sequence and binding of terms\r\n *      LValue    - left-hand operand for operator\r\n *      RValue    - right-hand operand for operator (undefined for unary operators)\r\n */\r\n function ncFAR_FnToken()    // object constructor\r\n {\r\n     this.OpCode = \'\';    // ^, *, /, +, -, #, OC, NB, RV, AL, CP, TD, CU, LU, LD, CC, DH, PB\r\n     this.OpType = 0;    // 0 = undefined, 1 = operator, 2 = constant (# through PB)\r\n     this.OpPrec = 0;    // Precedence, ^ = 3, */ = 2, +- = 1, non-op = 0 (4 = already processed)\r\n     this.LValue = null;    // only used for ^, *, /, +, -, #\r\n     this.RValue = null;    // only used for ^, *, /, +, -\r\n }\r\n\r\n/* global regular expression for finding function terms */\r\nvar ncFnTerms = /[~\\(\\)\\^\\*\\/\\+\\-]|[0-9]+(\\.[0-9]+)?|OC|NB|RV|AL|CP|TD|CU|LU|LD|CC|DH|PB/gi;    // PSG 4807, 2011-07-11\r\n\r\n/* ncFAR_ParseFormula - parse a formula expression and determine if syntax is correct and build tree of terms\r\n *\r\n * This function will recursively parse a formula expression to identify all the terms (building a tree)\r\n * and validate that the formula syntax is correct.\r\n *\r\n * The resulting expression tree can be used by other functions to evaluate the formula\r\n *\r\n * Parameters:\r\n *         Fn            - the formula expression to be parsed\r\n *         Token        - (output) the resulting token (tree of OpCodes)\r\n * Returns:\r\n *         boolean        - indicates if validation was successful\r\n */\r\nfunction ncFAR_ParseFormula(Fn,Token)\r\n{\r\n    try\r\n    {\r\n        // strip all whitespace\r\n        var l_Fn = Fn.replace(/\\s/g,\'\');\r\n        // and restore encoded \'+\'\r\n        l_Fn = l_Fn.replace(/%2b/g,\'+\');\r\n\r\n        // all in one test that valid terms are used (but cannot validate correct positioning)\r\n        var validexp = /^([~\\(\\)\\^\\*\\/\\+\\-]|[0-9]+(\\.[0-9]+)?|OC|NB|RV|AL|CP|TD|CU|LU|LD|CC|DH|PB)+$/gi;    // PSG 4807, 2011-07-11\r\n        validexp.lastIndex = 0;    // ensure regular expression reset to start position\r\n        if( !validexp.test(l_Fn) )\r\n            return false;\r\n\r\n        // identify expressions, left to right\r\n        ncFnTerms.lastIndex = 0;    // ensure regular expression reset to start position\r\n        var ExpList = new Array();\r\n        ncFAR_ParseFnExp(l_Fn,ExpList);\r\n\r\n        // in order of opcode precedence, search for opcodes and assign expressions\r\n        return ncFAR_AssignTerms(ExpList, Token);\r\n    } catch (GE)\r\n    {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n            {\r\n                if( typeof(ST) == \'string\' )\r\n                    msg += \'<BR>\'+ST;\r\n                else    // in case we ever do get an array...\r\n                    for( var nST=0; nST<ST.length; ++nST )\r\n                        if( ST[nST] != \'undefined\' )\r\n                            msg += \'<BR>\'+ST[nST];\r\n            }\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n\r\n        return false;\r\n    }\r\n}\r\n\r\n/* ncFAR_ParseFnExp - parse a formula expression and build a simple array of identified terms\r\n *\r\n * This function will recursively parse a formula expression to identify all the terms\r\n * storing them in an array.  Parenthesised expressions are stored as sub-arrays.\r\n *\r\n * The resulting expression list will be used by another function (which will fold it into a tree\r\n * using correct operator precendence).\r\n *\r\n * Parameters:\r\n *         Fn            - the formula expression to be parsed\r\n *         ExpList        - (output) the resulting expression list\r\n * Returns:\r\n *         integer        - current regular expression search index (used during recursion)\r\n */\r\nfunction ncFAR_ParseFnExp(Fn,ExpList)\r\n{\r\n    var numeric = /^[0-9]+(\\.[0-9]+)?$/;\r\n    var exp;\r\n    var l_tok;\r\n    while( (exp = ncFnTerms.exec(Fn)) != null )    // regexp.exec() automatically stores and resumes from previous position\r\n    {\r\n        switch( exp[0] )\r\n        {\r\n            case \'(\':    // (    - add new ExpList[] and recurse until matching ) found\r\n                var l_ExpList = new Array();\r\n                var l_Fn = Fn;    //.substring(exp.index);\r\n                ncFnTerms.lastIndex = ncFAR_ParseFnExp(l_Fn,l_ExpList);\r\n                //ExpList[ExpList.length] = l_ExpList;\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 0;\r\n                l_tok.OpPrec = 0;\r\n                l_tok.LValue = l_ExpList;\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            case \')\':    // )    - exit from current level, returning position for next search\r\n                return ncFnTerms.lastIndex;\r\n                //break;\r\n            case \'^\':    // ^    - op ^, prior exp = LValue, next exp = RValue\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 1;    // operator\r\n                l_tok.OpPrec = 3;\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            case \'*\':    // *    - op *, prior exp = LValue, next exp = RValue\r\n            case \'/\':    // /    - op /, prior exp = LValue, next exp = RValue\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 1;    // operator\r\n                l_tok.OpPrec = 2;\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            case \'+\':    // +    - op +, prior exp = LValue, next exp = RValue\r\n            case \'-\':    // -    - op -, prior exp = LValue, next exp = RValue\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 1;    // operator\r\n                l_tok.OpPrec = 1;\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            case \'~\':    // ~    - op ~, prior exp = LVlaue, next exp = RValue\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 1;    // operator\r\n                l_tok.OpPrec = 1;\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            case \'OC\':    // OC    - lookup value OC\r\n            case \'NB\':    // NB    - lookup value NB\r\n            case \'RV\':    // RV    - lookup value RV\r\n            case \'AL\':    // AL    - lookup value AL\r\n            case \'CP\':    // CP    - lookup value CP\r\n            case \'TD\':    // TD    - lookup value TD\r\n            case \'CU\':    // CU    - lookup value CU\r\n            case \'LU\':    // LU    - lookup value LU\r\n            case \'LD\':    // LD    - lookup value LD\r\n            case \'CC\':    // CC    - lookup value CC\r\n            case \'DH\':    // DH    - lookup value DH    // PSG 4807, 2011-07-11\r\n            case \'PB\':    // PB    - lookup value PB    // PSG 4807, 2011-07-11\r\n                l_tok = new ncFAR_FnToken();\r\n                l_tok.OpCode = exp[0];\r\n                l_tok.OpType = 2;    // constant\r\n                ExpList[ExpList.length] = l_tok;\r\n                break;\r\n            default:    // 0-9    - digits, constant value, store in LValue\r\n                numeric.lastIndex = 0;    // ensure regular expression reset to start position\r\n                if( numeric.test(exp[0]) )\r\n                {\r\n                    l_tok = new ncFAR_FnToken();\r\n                    l_tok.OpCode = \'#\';\r\n                    l_tok.OpType = 2;    // constant\r\n                    l_tok.LValue = exp[0];\r\n                    ExpList[ExpList.length] = l_tok;\r\n                }    // else error?\r\n        }\r\n    }\r\n\r\n    return Fn.length;\r\n}\r\n\r\n/* ncFAR_AssignTerms - parse a formula expression list and fold into a tree of terms\r\n *\r\n * This function will recursively parse a formula expression list (array of terms with no precedence)\r\n * and fold this list into a tree based upon the correct operator precedence.\r\n *\r\n * The resulting expression tree can be used by other functions to evaluate the formula.\r\n *\r\n * Parameters:\r\n *         ExpList        - the list (array) of expressions to be parsed\r\n *         Token        - (output) the resulting token (tree of OpCodes)\r\n * Returns:\r\n *         boolean        - indicates if validation was successful\r\n */\r\nfunction ncFAR_AssignTerms(ExpList, Token)\r\n{\r\n    // in order of opcode precedence, search for opcodes and assign expressions\r\n    var cValue;\r\n\r\n    /* if extra levels of () are used, we can get passed a single element with OpCode \'(\' ... if so, skip this level! */\r\n    if ((ExpList.length == 1) && (ExpList[0].OpCode == \'(\'))\r\n        return ncFAR_AssignTerms(ExpList[0].LValue, Token);\r\n\r\n    for( var p=3; p>0; --p )\r\n    {\r\n        for( var i=0; i<ExpList.length; ++i )\r\n        {\r\n            if( ExpList[i] instanceof ncFAR_FnToken )\r\n            {\r\n                var l_Tok = ExpList[i];\r\n\r\n                if( l_Tok.OpPrec == p )\r\n                {\r\n                    if( (i==0) || (i==ExpList.length-1) )\r\n                        return false;    // error, badly formed formula\r\n\r\n                    l_Tok.OpPrec = 4;    // already processed\r\n                    for( var j=-1; j<2; j+=2 )\r\n                    {\r\n                        var l_Tok2 = ExpList[i+j];\r\n                        //if( ExpList[i+j] instanceof Array )\r\n                        if ((l_Tok2.OpType == 0) && (l_Tok2.OpCode == \'(\'))\r\n                        {\r\n                            cValue = new ncFAR_FnToken();  //Array();\r\n                            if( !ncFAR_AssignTerms( l_Tok2.LValue, cValue ) )\r\n                                return false;    // pass error back up\r\n                        }\r\n                        else\r\n                        {\r\n                            if( (l_Tok2.OpType != 2) && (l_Tok2.OpPrec < 4) )\r\n                                return false;    // error, two adjacent operators (or undefined term)\r\n\r\n                            cValue = l_Tok2;\r\n                        }\r\n\r\n                        if( j < 0 )\r\n                            l_Tok.LValue = cValue;\r\n                        else\r\n                            l_Tok.RValue = cValue;\r\n                    }\r\n\r\n                    ExpList.splice(i-1,3,l_Tok);    // replace terms with new tokens\r\n                    --i;    // decrement i since we just shifted the remaining array elements\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    /* ExpList should only contain one element as everything folds into the OpCode tree ... */\r\n    /* but this may be just \'(\' if there are excess parentheses... so iterate through those */\r\n\r\n    Token.OpCode = ExpList[0].OpCode;\r\n    Token.OpType = ExpList[0].OpType;\r\n    Token.LValue = ExpList[0].LValue;\r\n    Token.RValue = ExpList[0].RValue;\r\n\r\n    return true;    // success\r\n}\r\n\r\n/* ncFAR_ExecFormula - execute a formula expression (already parsed and validated) and return resulting value\r\n *\r\n * This function will recursively parse a formula expression and calculate the resulting value.\r\n *\r\n * Parameters:\r\n *         Fn            - the formula expression (in token form) to be executed\r\n *         AssetValues - named value array which should contain the following named entries:\r\n *          OC            - lookup value OC, Original Cost\r\n *          NB            - lookup value NB, Net Book value\r\n *          RV            - lookup value RV, Residual Value\r\n *          AL            - lookup value AL, Asset Lifetime\r\n *          CP            - lookup value CP, Current Period (current age)\r\n *          TD            - lookup value TD, Total Depreciation (== OC-RV)\r\n *          CU            - lookup value CU, Cumulative Units (total usage units since last depreciation)\r\n *          LU            - lookup value LU, Lifetime Units\r\n *          LD            - lookup value LD, Last Depreciation amount\r\n *          CC            - lookup value CC, Current Cost\r\n *          DH            - lookup value DH, Days Held (in current period)\r\n *          PB            - lookup value PB, Prior year net Book value\r\n *\r\n * Returns:\r\n *         number        - the resulting value\r\n */\r\nfunction ncFAR_ExecFormula(Fn,AssetValues)\r\n{\r\n    var retVal = Number.NaN;\r\n    var lVal;\r\n    var rVal;\r\n\r\n    if( !(Fn instanceof ncFAR_FnToken) )\r\n        return retVal;\r\n\r\n    switch( Fn.OpCode )\r\n    {\r\n        case \'^\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = Math.pow(lVal,rVal);\r\n            break;\r\n        case \'*\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = lVal * rVal;\r\n            break;\r\n        case \'/\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = lVal / rVal;\r\n            break;\r\n        case \'+\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = lVal + rVal;\r\n            break;\r\n        case \'-\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = lVal - rVal;\r\n            break;\r\n        case \'~\':\r\n            lVal = ncFAR_ExecFormula(Fn.LValue,AssetValues);\r\n            rVal = ncFAR_ExecFormula(Fn.RValue,AssetValues);\r\n            if( !isNaN(lVal) && !isNaN(rVal) )\r\n                retVal = Math.abs(lVal) >= Math.abs(rVal) ? lVal : rVal;\r\n            break;\r\n        case \'#\':\r\n            retVal = parseFloat(Fn.LValue);\r\n            break;\r\n        case \'OC\':\r\n        case \'NB\':\r\n        case \'RV\':\r\n        case \'AL\':\r\n        case \'CP\':\r\n        case \'TD\':\r\n        case \'CU\':\r\n        case \'LU\':\r\n        case \'LD\':\r\n        case \'CC\':\r\n        case \'DH\':    // PSG 4807, 2011-07-11\r\n        case \'PB\':    // PSG 4807, 2011-07-11\r\n            retVal = AssetValues[Fn.OpCode];\r\n            break;\r\n        default:\r\n            // do nothing, will return NaN anyway\r\n    }\r\n\r\n    return retVal;\r\n}\r\n\r\n/* *************************************************\r\n * Asset Proposal and Generation processing\r\n */\r\n\r\n/* ncFAR_NewPropBG - Trawl for new assets and create proposals (background process)\r\n *\r\n * This function is a background process to check for new postings to asset accounts and will\r\n * create a proposal record and potentially auto-generate a new asset\r\n *\r\n * This function utilises ncFAR_CreateProposal_ITER() to handle the actual detail per \'asset\'\r\n *\r\n * Parameters:\r\n *  No parameters are passed directly.  Instead, the process record id is passed as a scheduled script parameter\r\n *  so we need to retrieve it from the Context info\r\n *\r\n *      custscriptprocessid    - Id of current process record, which contains status information etc.\r\n *\r\n *  Further details are then read from the process record\r\n *\r\n *  Update: ProcessId parameter - Id of current process record, allowing this script to be invoked directly\r\n *  If this parameter is null (e.g. when called from a schedule), the custscriptprocessid script parameter will be used\r\n *\r\n * Returns:\r\n *     no direct return parameters - all information should be passed back by updating the process record\r\n */\r\nfunction ncFAR_AssetCreationBG(ProcessId) {\r\n    ncFAR_NewPropBG(ProcessId);\r\n}\r\n\r\nfunction ncFAR_NewPropBG(ProcessId) {\r\n    /* anything running scheduled we don\'t want to fail, otherwise deployment is failed and dead! */\r\n    var _failurePoint = \'\';\r\n    var _timestamp = (new Date()).getTime();\r\n    var _timelimit = 600000;\r\n    var fNames;\r\n    var fValues;\r\n\r\n    try {\r\n        \r\n        ncLogExecution(\'debug\',\'ncFAR_NewPropBG\',\'Script started...\');\r\n\r\n        /* retrieve script parameters --> process id */\r\n        _failurePoint = \'Retrieve script parameters\';\r\n        var currentContext = nlapiGetContext();\r\n        var procId = currentContext.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n        if( ProcessId != null )\r\n        {\r\n            procId = ProcessId;    // called directly, so use direct parameter not context setting\r\n            _timelimit = 60000;    // because direct, only 60 seconds not 600 seconds\r\n        }\r\n\r\n        if( procId == null )\r\n            return;    // nothing to do - no process record to determine status or log events against\r\n\r\n        _timelimit -= 40000;    // deduct 40 seconds to give margin of error, time to tidy up and quit, etc. (15 seconds was too short, it STILL failed sometimes)\r\n\r\n        /* retrieve process record --> process parameters */\r\n        _failurePoint = \'Retrieve process instance record\';\r\n        var rProcessInfo = nlapiLoadRecord(ncConst.BGP_ProcessInstance, procId);\r\n        if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' )\r\n        {\r\n            ncLogExecution(\'debug\',\'ncFAR_NewPropBG\',\'Exit with bad Process Control status: \'+rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\'));\r\n            return;    // nothing to do\r\n        }\r\n\r\n        /* retrieve setup records */\r\n        _failurePoint = \'Retrieve setup record\';\r\n        var scSetup = new Array();\r\n        scSetup[0] = new nlobjSearchColumn(\'custrecord_autopropose\');\r\n        scSetup[1] = new nlobjSearchColumn(\'custrecord_autocreate\');\r\n        var srSetup = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,scSetup);\r\n        if( (srSetup == null) || (srSetup.length != 1) )\r\n        {\r\n            // setup incorrect, cannot proceed...\r\n            ncLogExecution(\'Error\',\'Invalid Module Setup\',\'The setup record for Fixed Assets Management is missing or invalid.\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = \'The setup record for Fixed Assets Management is missing or invalid.\';\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            return;\r\n        }\r\n\r\n        _failurePoint = \'Test setup options\';\r\n        /* check setup option - if auto-propose is not enabled, terminate the process */\r\n        /* ---- moved to scheduled proposal initiator ----\r\n        if( srSetup[0].getValue(\'custrecord_autopropose\') != \'T\' )\r\n        {\r\n            // auto-propose disabled; terminate process cleanly and exit\r\n            nlapiSubmitField(ncConst.NC_ProcessActivity, procId,\'custrecord_currentprocessstatus\',\'2\',false);\r\n            return;\r\n        }\r\n        */\r\n\r\n        /* this now comes from Parameters ...\r\n        var bAutoCreate = true;\r\n        if( srSetup[0].getValue(\'custrecord_autocreate\') != \'T\' )\r\n            bAutoCreate = false;\r\n        */\r\n\r\n        var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),0);\r\n\r\n        var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pNames = tmpStr.split(\',\');\r\n        tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pValues = tmpStr.split(\',\');\r\n        var currentAT = \'\';\r\n        var currentRowId = \'\';\r\n        var currentSubsidiary = \'\';\r\n        var lastRowId = \'\';\r\n        var totalRecordsProcessed = 0;\r\n        var ATarray;\r\n        var ATypes;\r\n        var Subsids;\r\n        var SubsidsSTR;\r\n        var assetCount = 0;\r\n        var bAutoCreate = false;\r\n\r\n        if( pNames.length == pValues.length )\r\n        {\r\n            for(var pN=0; pN < pNames.length; ++pN)\r\n            {\r\n                switch( pNames[pN] )\r\n                {\r\n                    case \'currentAT\':\r\n                        currentAT = pValues[pN];\r\n                        break;\r\n                    case \'currentRowId\':\r\n                        currentRowId = pValues[pN];\r\n                        lastRowId = currentRowId;\r\n                        break;\r\n                    case \'currentSubsidiary\':\r\n                        currentSubsidiary = pValues[pN];\r\n                        break;\r\n                    case \'ATarray\':\r\n                        ATarray = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'ATypes\':\r\n                        ATypes = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'Subsids\':\r\n                        Subsids = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'AutoGen\':\r\n                        bAutoCreate = (pValues[pN] == \'T\');    // T=true, anything else=false\r\n                        break;\r\n                    case \'AssetCount\':\r\n                        assetCount = pValues[pN] * 1 || 0;\r\n                        break;\r\n                    default:\r\n                        // do nothing\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            // all gone wrong - gracefully abort (and log values?)\r\n            ncLogExecution(\'error\',\'ncFAR_NewPropBG\',\'parameter values blank, aborting\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = \'parameter values blank, aborting\';\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            return;\r\n        }\r\n\r\n        // search for all Asset Types in range, resume at current ...\r\n        if( (ATypes != null) && (ATypes[0] != \'\') && ((ATarray == null) || (ATarray[0] == \'\')) )\r\n        {\r\n            // Asset Types setup list is set, but \'current\' list is empty - so repopulate it\r\n            ATarray = new Array();\r\n            for(var t=0; t < ATypes.length; ++t)\r\n                ATarray[t] = ATypes[t];\r\n        }\r\n\r\n        // build asset type/subsidiaries date cache\r\n        var ATSubDates = new Array();\r\n        var ATSubId = new Array();\r\n        var l_AT = \'\';\r\n        var l_Sub= \'\';\r\n        if( (Subsids != null) && (currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\') )\r\n        {\r\n            var sfATSdates = new Array();\r\n            sfATSdates[0] = new nlobjSearchFilter(\'custrecord_propdatessubsidiary\',null,\'anyof\',Subsids,null);\r\n            if( (ATarray != null) && (ATarray[0] != \'\') )\r\n                sfATSdates[1] = new nlobjSearchFilter(\'custrecord_propdatesassettype\',null,\'anyof\',ATarray,null);\r\n            var scATSdates = new Array();\r\n            scATSdates[0] = new nlobjSearchColumn(\'custrecord_propdatesassettype\');\r\n            scATSdates[1] = new nlobjSearchColumn(\'custrecord_propdatessubsidiary\');\r\n            scATSdates[2] = new nlobjSearchColumn(\'custrecord_propdateslast\');\r\n            var srDates = nlapiSearchRecord(\'customrecord_ncfar_proposaldates\',null,sfATSdates,scATSdates);\r\n            if( (srDates != null) && (srDates.length > 0) )\r\n            {\r\n                for( var N=0; N<srDates.length; ++N )\r\n                {\r\n                    l_AT = srDates[N].getValue(\'custrecord_propdatesassettype\');\r\n                    l_Sub= srDates[N].getValue(\'custrecord_propdatessubsidiary\');\r\n                    ATSubDates[l_AT+\':\'+l_Sub] = srDates[N].getValue(\'custrecord_propdateslast\');\r\n                    ATSubId[l_AT+\':\'+l_Sub] = srDates[N].getId();\r\n                }\r\n            }\r\n        }\r\n\r\n        var sfAT;\r\n        if( (ATarray != null) && (ATarray[0] != \'\') )\r\n            sfAT = new nlobjSearchFilter(\'internalid\',null,\'anyof\',ATarray,null);\r\n        var AssetTypes = nlapiSearchRecord(ncConst.FAR_AssetType,null,sfAT,new nlobjSearchColumn(\'name\'));\r\n        if( (AssetTypes == null) || (AssetTypes.length == 0) )\r\n        {\r\n            ncLogExecution(\'debug\',\'ncFAR_NewPropBG - Asset Type search\',\'no search results with current params\');\r\n        }\r\n\r\n        var rAssetType;\r\n        var rTransaction;\r\n        var asset_account;\r\n        var last_checked;\r\n        // var sFilters = new Array();\r\n        var sColumns = new Array();\r\n\r\n        sColumns.push(new nlobjSearchColumn(\'type\'));\r\n        sColumns.push(new nlobjSearchColumn(\'approvalstatus\'));\r\n        sColumns.push(new nlobjSearchColumn(\'status\'));\r\n        \r\n        if( currentContext.getSetting(\'FEATURE\',\'multicurrency\') == \'T\' )\r\n        {\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'currency\');    // N.B. this (as at 9 Nov 2007) will return currency id (not name)\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'exchangerate\');\r\n        }\r\n        // add any enabled feature columns (department/class/location)\r\n        if( currentContext.getSetting(\'FEATURE\',\'departments\') == \'T\' )\r\n        {\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'department\');\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'locations\') == \'T\' )\r\n        {\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'location\');\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'classes\') == \'T\' )\r\n        {\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'class\');\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' )\r\n        {\r\n            sColumns[sColumns.length] = new nlobjSearchColumn(\'subsidiary\');\r\n        }\r\n\r\n        var i=0;\r\n        var bAbort = false;\r\n        // var filterBase = sFilters.length;\r\n        var uRem = 0;\r\n        var iRem = 0;\r\n\r\n        /* determine whether old site (2008.n) or new site (2009.1) and thus which governance methods apply */\r\n        var nsVer = \'2008\';\r\n        if( \'getPercentComplete\' in currentContext )\r\n            if( typeof( currentContext[\'getPercentComplete\'] ) == \'function\' )\r\n            {\r\n                nsVer = \'2009\';\r\n            }\r\n\r\n\r\n        while( (!bAbort) && (AssetTypes != null) && (i < AssetTypes.length) )\r\n        {\r\n            _failurePoint = \'iterating through Types\';\r\n            var ATid = AssetTypes[i].getId();\r\n            nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Asset Type: \' +  ATid);\r\n\r\n            // store current values and handle change of row\r\n            if( ATid != currentAT )\r\n            {\r\n                currentAT = ATid;\r\n                currentRowId = \'\';    // reset\r\n                lastRowId = \'\';\r\n                currentSubsidiary = \'\';\r\n            }\r\n            // per search result, search for all \'new\' transactions\r\n            _failurePoint = \'loading asset type record\';\r\n            rAssetType = nlapiLoadRecord(ncConst.FAR_AssetType, ATid);\r\n            asset_account = rAssetType.getFieldValue(\'custrecord_assettypeassetacc\');\r\n            last_checked  = rAssetType.getFieldValue(\'custrecord_assettypelastchecked\');\r\n            if( (asset_account == null) || (asset_account == \'\') )\r\n            {\r\n                // asset type not configured so skip it...\r\n                ++i;\r\n                continue;\r\n            }\r\n            if( (last_checked == null) || (last_checked == \'\') )\r\n            {\r\n                last_checked = nlapiDateToString(new Date(1980,0,1,0,0,0,0));    // 01-01-1980, months are zero-based in Date()\r\n            }\r\n\r\n            // check sub-list for subsidiary last_checked dates, use that in preference\r\n            // So here forward needs to be per-subsidiary...!\r\n            var CurrSub = null;\r\n            var sub_last_checked;\r\n            if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') != \'T\' ) {\r\n                Subsids = new Array();\r\n                Subsids[0] = \'\';\r\n            }\r\n            \r\n            nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Last Subsidiary Processed: \' +  currentSubsidiary );\r\n            \r\n            for( var S=0; S<Subsids.length; ++S )\r\n            {\r\n                sub_last_checked = null;\r\n                CurrSub = Subsids[S];\r\n                nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Processing Subsidiary: \' +  CurrSub );\r\n                \r\n                if( (currentSubsidiary != \'\' && currentSubsidiary != null)\r\n                        && (CurrSub != currentSubsidiary) ) {\r\n                    nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Subsidiary \' + CurrSub + \' already processed for this asset type. Moving on to next one.\' );\r\n                    continue;\r\n                }\r\n                currentSubsidiary = \'\'; // reset\r\n                \r\n\r\n                if( CurrSub != \'\' ) {\r\n                    // get date for the asset type and sub (pre-cache these?)\r\n                    sub_last_checked = ATSubDates[ATid+\':\'+CurrSub];\r\n                }\r\n\r\n                if( (sub_last_checked == null) || (sub_last_checked == \'\') ) {\r\n                    sub_last_checked = last_checked;\r\n                }\r\n\r\n                _failurePoint = \'building search filters for Transactions\';\r\n                var sFilters = [];\r\n                var acctAR = new Array(asset_account);\r\n                sFilters.push( new nlobjSearchFilter(\'account\', null, \'anyof\', acctAR, null) );\r\n                sFilters.push( new nlobjSearchFilter(\'lastmodifieddate\', null, \'onorafter\', sub_last_checked, null) );\r\n                var trnTypeAR = [\'Build\',\'VendBill\',\'InvAdjst\',\'InvTrnfr\',\'ItemRcpt\',\'Journal\',\'CardChrg\',\'ExpRept\'];\r\n                sFilters.push( new nlobjSearchFilter(\'type\', null, \'anyof\', trnTypeAR, null) );\r\n                if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' ) {\r\n                    nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Adding filter for Subsidiary: \' +  CurrSub );\r\n                    sFilters.push( new nlobjSearchFilter(\'subsidiary\', null, \'anyof\', CurrSub, null) ); //cs\r\n                }\r\n\r\n                nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Last Row Id: \' +  lastRowId );\r\n                if( (lastRowId != \'\') && (lastRowId != null) ) {\r\n                    nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Adding filter for last row id: \' +  lastRowId );\r\n                    sFilters.push( new nlobjSearchFilter(\'internalidnumber\', null, \'greaterThanOrEqualTo\', ncParseIntNV( lastRowId, 0 ), null) );\r\n                    lastRowId = \'\';\r\n                }\r\n\r\n                _failurePoint = \'executing transaction search\';\r\n                var sResults = nlapiSearchRecord(\'transaction\', \'customsearch_ncfar_newassetsearch\', sFilters, sColumns);\r\n                last_checked = nlapiDateToString(new Date());    // capture date of last search\r\n\r\n                if (FAM.SystemSetup.getSetting(\'isPropApprovedOnly\') === \'T\' && sResults) {\r\n                    sResults = sResults.filter(FAM.isTransactionApproved);\r\n                }\r\n        \r\n                if( (sResults == null) || (sResults.length == 0) ) {\r\n                    ncLogExecution(\'debug\',\'ncFAR_NewPropBG - new transactions search\',\'no search results with current params\');\r\n                } else {\r\n                    ncLogExecution(\'debug\',\'ncFAR_NewPropBG - new transactions search\',\'records found:\'+sResults.length.toString());\r\n                }\r\n\r\n                // per 2ndary search result, call ncFAR_CreateProposal_ITER\r\n                var n=0;\r\n                var terminate_flag;\r\n                nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG --- Search Params\', \'Account: \' +  acctAR\r\n                        + \'  |  Current Subsidiary: \' + CurrSub\r\n                        + \'  |  Last Modified Date: \' + sub_last_checked\r\n                        + \'  |  Filter Count: \' + sFilters.length );\r\n                \r\n                while( (!bAbort) && (sResults != null) && (n < sResults.length) )\r\n                {\r\n                    _failurePoint = \'iterating through transactions\';\r\n                    currentRowId = sResults[n].getId();    // stash current id\r\n\r\n                    terminate_flag = ncFAR_CreateProposal_ITER(rAssetType, sResults[n],AssetTypes[i],procId,bAutoCreate);\r\n                    if (terminate_flag === \'assetcreated\') {\r\n                        assetCount++;\r\n                    }\r\n                    else if( terminate_flag )\r\n                    {\r\n                        // an un-recoverable error, so rather than just skipping the row and trying the next one,\r\n                        // we should terminate the process\r\n                        fNames = new Array();\r\n                        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                        fValues = new Array();\r\n                        fValues[0] = \'Un-recoverable error, see script log for details\';\r\n                        fValues[1] = \'4\';    // status 4 = failed\r\n                        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n                        return;    // exit immediately\r\n                    }\r\n\r\n                    /* check governance limits - if approaching limit, set bAbort */\r\n                    // units per iteration < 150, so 200 is safe limit - need at least 10 for SubmitField on process record to stash state\r\n                    uRem = currentContext.getRemainingUsage();\r\n\r\n                    if( nsVer == \'2009\' )\r\n                    {\r\n                        /* 2009.1 */\r\n                        //iRem = currentContext.getRemainingInstructions();\r\n\r\n                        if( (uRem <= 200) ) //|| (iRem <= 20000) )\r\n                            bAbort = true;\r\n                    }\r\n                    else\r\n                    {\r\n                        // also need to check execution time...\r\n                        var tUsed = (new Date()).getTime() - _timestamp;\r\n\r\n                        if( (uRem <= 200) || (tUsed >= _timelimit) )\r\n                            bAbort = true;\r\n                    }\r\n\r\n                    ++l_RecordCount;    // increment overall count\r\n                    ++n; // next transaction\r\n                }\r\n\r\n                totalRecordsProcessed = totalRecordsProcessed + n; \r\n\r\n                if( !bAbort )\r\n                {\r\n                    _failurePoint = \'update last checked date\';\r\n                    // made it through - store the date\r\n                    // rAssetType.setFieldValue(\'custrecord_assettypelastchecked\',last_checked);\r\n                    // nlapiSubmitRecord(rAssetType,false);\r\n                    nlapiSubmitField(ncConst.FAR_AssetType,ATid,\'custrecord_assettypelastchecked\',last_checked,false);\r\n                    // store per-subsidiary date\r\n                    _failurePoint = \'update subsid last checked date\';\r\n                    if( CurrSub != \'\' )\r\n                    {\r\n                        if( ATSubId[ATid+\':\'+CurrSub] != null )\r\n                        {\r\n                            nlapiSubmitField(\'customrecord_ncfar_proposaldates\',ATSubId[ATid+\':\'+CurrSub],\'custrecord_propdateslast\',last_checked,false);\r\n                        }\r\n                        else\r\n                        {\r\n                            // need to create a new record\r\n                            var rLastDates = nlapiCreateRecord(\'customrecord_ncfar_proposaldates\');\r\n                            rLastDates.setFieldValue(\'custrecord_propdatesassettype\',ATid);\r\n                            rLastDates.setFieldValue(\'custrecord_propdatessubsidiary\',CurrSub);\r\n                            rLastDates.setFieldValue(\'custrecord_propdateslast\',last_checked);\r\n                            nlapiSubmitRecord(rLastDates);\r\n                        }\r\n                    }\r\n                } else {                    \r\n                    currentSubsidiary = CurrSub;\r\n                    break;    // break out of subsids loop if Abort set\r\n                }\r\n            }\r\n\r\n            if( !bAbort )\r\n            {\r\n                ++i; // next Asset Type\r\n            }\r\n        }\r\n\r\n        _failurePoint = \'Handle exit condition\';\r\n        if( bAbort )\r\n        {\r\n            // reached here due to governance abort - update Process record with new values so will resume where we left off\r\n            // grab the current and remaining asset types but don\'t restate the ones we already processed completely\r\n            var ATarraySTR = \'\';\r\n            if( AssetTypes != null )\r\n            {\r\n                for(var iAT = i; iAT < AssetTypes.length; ++iAT)\r\n                {\r\n                    if( ATarraySTR.length > 0 )\r\n                        ATarraySTR = ATarraySTR + \':\';\r\n                    ATarraySTR = ATarraySTR + AssetTypes[iAT].getId();\r\n                }\r\n            }\r\n\r\n            var ATypesSTR;\r\n            if( ATypes != null )\r\n                ATypesSTR = ATypes.join(\':\');\r\n            else\r\n                ATypesSTR = \'\';\r\n\r\n            SubsidsSTR = Subsids.join(\':\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_statedefn\';\r\n            fNames[1] = \'custrecord_far_proins_procstate\';\r\n            fNames[2] = \'custrecord_far_proins_reccount\';\r\n            fValues = new Array();\r\n            fValues[0] = \'currentAT,currentRowId,currentSubsidiary,ATarray,ATypes,Subsids,AssetCount\'; //cs\r\n            fValues[1] = currentAT+\',\'+currentRowId+\',\'+currentSubsidiary+\',\'+ATarraySTR+\',\'+ATypesSTR+\',\'+SubsidsSTR+\',\'+assetCount;\r\n            fValues[2] = l_RecordCount.toString();\r\n\r\n            var Activity = rProcessInfo.getFieldValue(\'custrecord_far_proins_activitytype\');\r\n            switch( Activity )\r\n            {\r\n                case \'1\':    // this was a direct call, so switch to custom schedule\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'2\';\r\n                    break;\r\n                case \'2\':    // this was custom schedule, so revert to regular scheduling\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'3\';\r\n                    break;\r\n                default:\r\n                    // nothing to do - remain as current\r\n            }\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'------ Processing limit erached, rescheduling .....\');\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',\'Processing limit reached, re-sheduling\',\'Message\');\r\n\r\n        }\r\n        else\r\n        {\r\n            // really finished - update process control record for completion\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_statedefn\';\r\n            fNames[1] = \'custrecord_far_proins_procstate\';\r\n            fNames[2] = \'custrecord_far_proins_reccount\';\r\n            fNames[3] = \'custrecord_far_proins_procstatus\';\r\n            fNames[4] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = \'AssetCount\';\r\n            fValues[1] = \'\' + assetCount;\r\n            fValues[2] = l_RecordCount.toString();\r\n            fValues[3] = \'2\';    // status 2 = completed\r\n            fValues[4] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            nlapiLogExecution( \'DEBUG\',\'--- ncFAR_NewPropBG ---\', \'Processing completed\' );\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',\'Processing completed\',\'Message\');\r\n        }\r\n    } catch (e)\r\n    {\r\n        var msg = \'\';\r\n        if (typeof e.getStackTrace === \'function\') {\r\n            msg = e.toString() + \'\r\n\' + e.getStackTrace().join(\'\r\n\');\r\n        }\r\n        else if (e.stack) {\r\n            msg = e.toString() + e.stack.replace(/(^|\\s)at(\\s|$)/g, \'\r\nat \');\r\n        }\r\n        else {\r\n            msg = e.toString();\r\n        }\r\n        \r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'Failure Point\',_failurePoint);\r\n\r\n        if (msg && msg.length > 300) {\r\n            nlapiLogExecution(\'DEBUG\', \'ncBGP_WriteToLog\', \'Error Detail contained more than maximum \' +\r\n                \'number (300) characters, truncating message..\');\r\n            \r\n            nlapiLogExecution(\'DEBUG\', \'ncBGP_WriteToLog\',  \'length: \'+ msg.length + \' msg: \' + msg);\r\n            \r\n            msg = msg.substring(0, 300);\r\n        }\r\n        \r\n        // failed - update process control record for error\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n    }\r\n}\r\n\r\n\r\n/* ncFAR_CreateProposal_ITER - validate and create a new asset proposal record (defaulting from asset type)\r\n *\r\n * This function is a background process iteration function (_ITER) which will:\r\n *      check whether the record and line provided have already been used in a proposal (skip record)\r\n *      retrieve details from the supplied asset type and record\r\n *      create a new asset proposal based upon those details\r\n *\r\n * Parameters:\r\n *      rAssetType    - Asset Type record to use as template\r\n *         iRec        - iteration record - the current transaction record (nlobjRecord)... now nlobjSearchResult\r\n *      iRecParent    - iteration parent record - nlobjSearchResult\r\n *      ProcessId    - Id of current process, needed in calls to ncBGP_WriteToLog()\r\n *      bAutoCreate    - indicates whether to auto-create the asset or stop at proposal\r\n * Returns:\r\n *         mixed       - termination flag or asset created flag. If boolean true, process manager should abort processing.\r\n */\r\nfunction ncFAR_CreateProposal_ITER(rAssetType,iRec,iRecParent,ProcessId,bAutoCreate)\r\n{\r\n    if( rAssetType == null )\r\n    {\r\n        ncLogExecution(\'error\',\'ncFAR_CreateProposal_ITER\',\'Asset Type parameter is null\');\r\n        return false;\r\n    }\r\n    if( iRec == null )\r\n    {\r\n        ncLogExecution(\'error\',\'ncFAR_CreateProposal_ITER\',\'Search Result parameter is null\');\r\n        return false;\r\n    }\r\n\r\n    // check for existing proposal\r\n    // ... search for ncConst.FAR_Proposal record where custrecord_propsourceid = iRec.Id and custrecord_propsourceline = LineId\r\n    var sFilters = new Array();\r\n    sFilters[0] = new nlobjSearchFilter(\'custrecord_propsourceid\',null,\'anyof\',[iRec.getId()],null);\r\n    sFilters[1] = new nlobjSearchFilter(\'custrecord_propsourceline\',null,\'equalto\',iRec.getValue(\'line\'),null);    // LineId always 1 at the moment\r\n    var sColumns = new Array();\r\n    sColumns[0] = new nlobjSearchColumn(\'custrecord_propstatus\');\r\n    var sResults = nlapiSearchRecord(ncConst.FAR_Proposal,null,sFilters,sColumns);\r\n    // if found, exit (silently, or logged?)\r\n    if( (sResults!=null) && (sResults.length>0) )\r\n    {\r\n        // existing record found, skip it\r\n        // nlapiLogExecution( \'DEBUG\',\'--- VICOY ---\', \'Vendor Bill item already proposed:\' + iRec.getId() + \' - \' + iRec.getValue(\'line\') );\r\n        return false;\r\n    } /* else {\r\n        nlapiLogExecution( \'DEBUG\',\'--- VICOY ---\', \'New Asset Proposal: \' + iRec.getId() + \' - \' + iRec.getValue(\'line\') );\r\n    } */\r\n\r\n    var currentContext = nlapiGetContext();\r\n\r\n    // build new proposal record\r\n    var rAssetProp = nlapiCreateRecord(ncConst.FAR_Proposal);\r\n    // core values\r\n    rAssetProp.setFieldValue(\'custrecord_propassettype\',rAssetType.getId().toString());\r\n    rAssetProp.setFieldValue(\'custrecord_propstatus\',\'1\');    // 1 == New\r\n    rAssetProp.setFieldValue(\'custrecord_propsourceid\',iRec.getId().toString());\r\n    rAssetProp.setFieldValue(\'custrecord_propsourceline\',iRec.getValue(\'line\'));\r\n    // defaults from Asset Type\r\n//    var residual_percent = rAssetType.getFieldValue(\'custrecord_assettyperesidperc\');\r\n    rAssetProp.setFieldValue(\'custrecord_propaccmethod\',rAssetType.getFieldValue(\'custrecord_assettypeaccmethod\'));\r\n    var resid_percents =[];\r\n     resid_percents[0] = rAssetType.getFieldValue(\'custrecord_assettyperesidperc\');\r\n    rAssetProp.setFieldValue(\'custrecord_propresidperc\',resid_percents[0]);\r\n    rAssetProp.setFieldValue(\'custrecord_propassetlifetime\',rAssetType.getFieldValue(\'custrecord_assettypelifetime\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdepractive\',rAssetType.getFieldValue(\'custrecord_assettypedepractive\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propinclreports\',rAssetType.getFieldValue(\'custrecord_assettypeinclreports\'));\r\n    rAssetProp.setFieldValue(\'custrecord_proprevisionrules\',rAssetType.getFieldValue(\'custrecord_assettyperevisionrules\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdeprrules\',rAssetType.getFieldValue(\'custrecord_assettypedeprrules\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdeprperiod\',rAssetType.getFieldValue(\'custrecord_assettypedeprperiod\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propcaretaker\',rAssetType.getFieldValue(\'custrecord_assettypecaretaker\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propsupplier\',rAssetType.getFieldValue(\'custrecord_assettypesupplier\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdisposalitem\',rAssetType.getFieldValue(\'custrecord_assettypedisposalitem\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propmainacc\',rAssetType.getFieldValue(\'custrecord_assettypeassetacc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdepracc\',rAssetType.getFieldValue(\'custrecord_assettypedepracc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdeprchargeacc\',rAssetType.getFieldValue(\'custrecord_assettypedeprchargeacc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propwriteoffacc\',rAssetType.getFieldValue(\'custrecord_assettypewriteoffacc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propwritedownacc\',rAssetType.getFieldValue(\'custrecord_assettypewritedownacc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propdisposalacc\',rAssetType.getFieldValue(\'custrecord_assettypedisposalacc\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propinspection\',rAssetType.getFieldValue(\'custrecord_assettypeinspection\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propinspectionperiod\',rAssetType.getFieldValue(\'custrecord_assettypeinspectionperiod\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propwarranty\',rAssetType.getFieldValue(\'custrecord_assettypewarranty\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propwarrantyperiod\',rAssetType.getFieldValue(\'custrecord_assettypewarrantyperiod\'));\r\n    rAssetProp.setFieldValue(\'custrecord_propfinancialyear\',rAssetType.getFieldValue(\'custrecord_assettypefinancialyear\'));\r\n\r\n    // if lifetimes based on depreciation method and location\r\n     var sf = [new nlobjSearchFilter(\'custrecord_ncfar_lifetimeassettype\',null,\'anyof\',rAssetType.getId(),null)];\r\n     var sc = [    new nlobjSearchColumn(\'custrecord_lifetimedeprmethod\'),\r\n                 new nlobjSearchColumn(\'custrecord_ncfar_lifetimelocation\'),\r\n                 new nlobjSearchColumn(\'custrecord_ncfar_lifetimelifetime\')];\r\n    var lifetimes = nlapiSearchRecord(\'customrecord_assetlifetimes\', null, sf,sc);\r\n\r\n    for ( var i = 0; lifetimes != null && i < lifetimes.length; i++ )\r\n    {\r\n\r\n        var l_DeprMeth =  lifetimes[i].getValue(\'custrecord_lifetimedeprmethod\');\r\n        var l_Location = lifetimes[i].getValue(\'custrecord_ncfar_lifetimelocation\');\r\n        var l_Lifetime =  lifetimes[i].getValue(\'custrecord_ncfar_lifetimelifetime\');\r\n\r\n        if( l_Location == iRec.getValue(\'location\'))\r\n        {\r\n            if(l_DeprMeth == rAssetType.getFieldValue(\'custrecord_assettypeaccmethod\'))\r\n                rAssetProp.setFieldValue(\'custrecord_propassetlifetime\',l_Lifetime);\r\n        }\r\n    }\r\n\r\n    // values from source\r\n    var asset_cost = iRec.getValue(\'debitamount\');\r\n    var cost2 = ncParseFloatNV(iRec.getValue(\'formulacurrency\'),0.00);\r\n    if( cost2 < 0.00 )\r\n        cost2 *= -1;\r\n    if( cost2 != 0.00 )\r\n        asset_cost = cost2.toString();\r\n\r\n    rAssetProp.setFieldValue(\'custrecord_propassetcost\',asset_cost);\r\n    // 22/8/2010 - set quantity\r\n    var quantity = ncParseFloatNV(iRec.getValue(\'quantity\'),1.00);\r\n    quantity = Math.ceil(quantity);    // round up if non-integer\r\n    rAssetProp.setFieldValue(\'custrecord_propquantity\',quantity);\r\n    // cheap and simple guesstimate - chop at 200 to allow expansion for XML encoding...\r\n    rAssetProp.setFieldValue(\'custrecord_propassetdescr\',iRec.getValue(\'formulatext\').substring(0,200));\r\n    // ---\r\n    var tran_date = nlapiDateToString(ncStringToDate(iRec.getValue(\'trandate\'), new Date()));\r\n    rAssetProp.setFieldValue(\'custrecord_propdeprstartdate\',tran_date);\r\n    rAssetProp.setFieldValue(\'custrecord_proppurchasedate\',tran_date);    \r\n\r\n    var supplierId = iRec.getValue(\'entityid\',\'vendor\');\r\n    if( (supplierId != null) && (supplierId != \'\') )\r\n        rAssetProp.setFieldValue(\'custrecord_propsupplier\',supplierId);    // will override default from Asset Type, only if set on Trn.\r\n    // add any enabled feature columns (department/class/location)\r\n    if( currentContext.getSetting(\'FEATURE\',\'departments\') == \'T\' )\r\n    {\r\n        rAssetProp.setFieldValue(\'custrecord_propdepartment\',iRec.getValue(\'department\'));\r\n    }\r\n    if( currentContext.getSetting(\'FEATURE\',\'locations\') == \'T\' )\r\n    {\r\n        rAssetProp.setFieldValue(\'custrecord_proplocation\',iRec.getValue(\'location\'));\r\n    }\r\n    if( currentContext.getSetting(\'FEATURE\',\'classes\') == \'T\' )\r\n    {\r\n        rAssetProp.setFieldValue(\'custrecord_propclass\',iRec.getValue(\'class\'));\r\n    }\r\n    if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' )\r\n    {\r\n        rAssetProp.setFieldValue(\'custrecord_propsubsidiary\',iRec.getValue(\'subsidiary\'));\r\n    }\r\n    \r\n    //Set the currency ID, Name and Symbol\r\n    var currData = FAM_Util.getCurrencyData({currId:null, subsId:rAssetProp.getFieldValue(\'custrecord_propsubsidiary\') });\r\n    if(currData.currId != null) {\r\n        rAssetProp.setFieldValue(\'custrecord_propcurrencyid\',currData.currId);\r\n    } else {\r\n        nlapiLogExecution(\'ERROR\',\'ncFAR_CreateProposal_ITER\',\'failed to set currency id for asset proposal record\');\r\n    }\r\n    if(currData.currName != null) {\r\n        rAssetProp.setFieldValue(\'custrecord_propcurrencyname\', currData.currName);\r\n    } else {\r\n        nlapiLogExecution(\'ERROR\',\'ncFAR_CreateProposal_ITER\',\'failed to set currency name for asset proposal record\');\r\n    }\r\n    \r\n    rAssetProp.setFieldValue(\'custrecord_propfixedexrate\',\'1.00\');\r\n\r\n    // if originated from purchase order...\r\n    var trnType = iRec.getValue(\'type\').toLowerCase();\r\n    if( (trnType == \'vendbill\') || (trnType == \'bill\') )        // what happens if this is renamed for the site? do we get \'internal\' name or current name?\r\n    {\r\n        rAssetProp.setFieldValue(\'custrecord_proppurchaseorder\',iRec.getValue(\'internalid\',\'createdfrom\'));\r\n    }\r\n    // calculated values (residual value [% cost]) including Other Methods\r\n    var IntCurrSym = \'\';\r\n    var CurrSym = \'\';\r\n    for ( i = 0; resid_percents != null && i < resid_percents.length; i++ )\r\n    {\r\n        if( ((resid_percents[i] != null) && (resid_percents[i].length > 0)) && ((asset_cost != null) && (asset_cost.length > 0)) )\r\n            {\r\n                if( resid_percents[i].substr(resid_percents[i].length-1,1) == \'%\' )\r\n                    resid_percents[i] = resid_percents[i].substr(0,resid_percents[i].length-1);\r\n                var n_residualPercent = Number(resid_percents[i]);\r\n                var n_initialValue = Number(asset_cost);\r\n                if( (!isNaN(n_residualPercent)) && (!isNaN(n_initialValue)) )\r\n                {\r\n                    // calc: assetcost * residualpercent and set (formatted string?) to custrecord_propresidvalue\r\n                    // check currency symbol and integer currencies\r\n\r\n                    if( IntCurrSym == \'\' && CurrSym == \'\' && currData.currId != null && ncIsFeatureEnabled(\'multicurrency\'))\r\n                    {\r\n                        var FARConfig = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,new nlobjSearchColumn(\'custrecord_intcurrsymbols\'));\r\n                        if( (FARConfig != null) && (FARConfig.length == 1) )\r\n                            IntCurrSym = FARConfig[0].getValue(\'custrecord_intcurrsymbols\');\r\n                        CurrSym = nlapiLookupField(\'currency\',currData.currId,\'symbol\');\r\n                    }\r\n                    //--\r\n                    var n_residualValue = ncRoundCurr(n_initialValue * n_residualPercent / 100.00, CurrSym, IntCurrSym);\r\n                    if(i==0)\r\n                        rAssetProp.setFieldValue(\'custrecord_propresidvalue\',n_residualValue.toString());\r\n                    else\r\n                        rAssetProp.setFieldValue(\'custrecord_proprv\'+i,n_residualValue.toString());\r\n                }\r\n        }\r\n    }\r\n\r\n    // submit the new record\r\n    var PropId = nlapiSubmitRecord(rAssetProp,true);\r\n\r\n    // check setup options - if auto-create is marked, generate the Asset immediately\r\n    if( bAutoCreate )\r\n    {\r\n        var PropRec = nlapiLoadRecord(ncConst.FAR_Proposal, PropId);\r\n        var AssetId = ncFAR_GenerateAsset(PropRec);\r\n        nlapiSubmitField(ncConst.FAR_Proposal,\r\n                            PropId,\r\n                            [\'custrecord_propstatus\',\'custrecord_propasset\'],\r\n                            [\'3\',AssetId],\r\n                            false);\r\n        return \'assetcreated\';\r\n    }\r\n\r\n    return false;\r\n}\r\n\r\n/* ncFAR_GenerateAssetsFromPropList - Generate new assets from the given array of asset proposals\r\n *\r\n * This function will generate new assets based upon the information in the selected asset proposal records.\r\n *\r\n *\r\n * Parameters:\r\n *         ProposalList    - An array of record ids for Asset Proposal records (script parameter in deployment, not function parameter)\r\n * Returns:\r\n *         nothing\r\n */\r\nfunction ncFAR_GenerateAssetsFromPropList(ProcessId)\r\n{\r\n    var _failurePoint;\r\n    /* anything running scheduled we don\'t want to fail, otherwise deployment is failed and dead! */\r\n    try {\r\n        /* retrieve script parameters --> process id */\r\n        _failurePoint = \'Retrieve script parameters\';\r\n        var currentContext = nlapiGetContext();\r\n        var procId = currentContext.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n        if( ProcessId != null )\r\n            procId = ProcessId;    // called directly, so use direct parameter not context setting\r\n\r\n        if( procId == null )\r\n            return;    // nothing to do - no process record to determine status or log events against\r\n\r\n        /* retrieve process record --> process parameters */\r\n        _failurePoint = \'Retrieve process record\';\r\n        var rProcessInfo = nlapiLoadRecord(ncConst.BGP_ProcessInstance, procId);\r\n        if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' )\r\n            return;    // nothing to do\r\n\r\n        var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),0);\r\n\r\n        var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pNames = tmpStr.split(\',\');\r\n        tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pValues = tmpStr.split(\',\');\r\n        var ProposalList;\r\n        if( pNames.length == pValues.length )\r\n        {\r\n            for(var pN=0; pN < pNames.length; ++pN)\r\n            {\r\n                switch( pNames[pN] )\r\n                {\r\n                    case \'PropList\':\r\n                        ProposalList = pValues[pN].split(\':\');\r\n                        break;\r\n                    default:\r\n                        // do nothing\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            // all gone wrong - gracefully abort (and log values?)\r\n            ncLogExecution(\'error\',\'ncFAR_GenerateAssetsFromPropList\',\'parameter values blank, aborting\');\r\n\r\n            var fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            var fValues = new Array();\r\n            fValues[0] = \'parameter values blank, aborting\';\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n            return;\r\n        }\r\n\r\n        if( ProposalList != null )\r\n        {\r\n            _failurePoint = \'Generate Assets from List\';\r\n\r\n            var PropRec;\r\n            var PropId;\r\n            var PropParent;\r\n            var ChildPropRecs;\r\n            var AssetId;\r\n\r\n            for(var i=0; i<ProposalList.length; ++i)\r\n            {\r\n                PropRec = nlapiLoadRecord(ncConst.FAR_Proposal,ProposalList[i]);\r\n                PropParent = PropRec.getFieldValue(\'custrecord_propparent\');\r\n                if(!isStringEmpty(PropParent))// has parent\r\n                    continue;\r\n                PropId = PropRec.getId();\r\n                ChildPropRecs = GetChildrenOfProposal(PropId);\r\n                // generate asset\r\n                AssetId = ncFAR_GenerateAsset(PropRec,ChildPropRecs);\r\n\r\n                if(AssetId != -1)\r\n                {\r\n                    // set proposal status to \'Created\'\r\n                    var fields = [\'custrecord_propstatus\',\'custrecord_propasset\'];\r\n                    var values = [\'3\',AssetId];\r\n                    nlapiSubmitField(ncConst.FAR_Proposal,PropId,fields,values,false);    // uses less units\r\n                    // set child proposals status to \'Created\'\r\n                    for(var j=0;j<ChildPropRecs.length;j++)\r\n                    {\r\n                        nlapiSubmitField(ncConst.FAR_Proposal,ChildPropRecs[j].getId(),\'custrecord_propstatus\',\'3\',false);    // uses less units\r\n                    }\r\n\r\n                    ++l_RecordCount;\r\n                }\r\n            }\r\n        }\r\n\r\n        // finished - update process control record for completion\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_statedefn\';\r\n        fNames[1] = \'custrecord_far_proins_procstate\';\r\n        fNames[2] = \'custrecord_far_proins_reccount\';\r\n        fNames[3] = \'custrecord_far_proins_procstatus\';\r\n        fNames[4] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = \'\';\r\n        fValues[1] = \'\';\r\n        fValues[2] = l_RecordCount.toString();\r\n        fValues[3] = \'2\';    // status 2 = completed\r\n        fValues[4] = \'1\';    // activity type 1 = direct execution (because should never run scheduled)\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing completed\',\'Message\');\r\n\r\n    } catch (GE)\r\n    {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n            {\r\n                if( typeof(ST) == \'string\' )\r\n                    msg += \'<BR>\'+ST;\r\n                else    // in case we ever do get an array...\r\n                    for( var nST=0; nST<ST.length; ++nST )\r\n                        if( ST[nST] != \'undefined\' )\r\n                            msg += \'<BR>\'+ST[nST];\r\n            }\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'Failure Point\',_failurePoint);\r\n\r\n        // failed - update process control record for error\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'1\';    // activity type 1 = direct execution\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n    }\r\n}\r\n\r\n/* ncFAR_GenerateAsset - Generates a new asset from the given asset proposal record\r\n *\r\n * This function will generate a new asset based upon the information in the sset proposal record.\r\n *\r\n *\r\n * Parameters:\r\n *         PropRec    - An Asset Proposal record\r\n *         ChildPropRecs - array of child proposal record search objects\r\n * Returns:\r\n *         AssetRecID or -1 if process fails\r\n */\r\nfunction ncFAR_GenerateAsset(PropRec,ChildPropRecs)\r\n{\r\n    /* anything running scheduled we don\'t want to fail, otherwise deployment is failed and dead! */\r\n    var _failurePoint;\r\n    try {\r\n        /* Changes June 2011 for GROUPON - validate Asset Proposal status before creating */\r\n        _failurePoint = \'Validated proposal record status\';\r\n        var propStatus = PropRec.getFieldValue(\'custrecord_propstatus\');\r\n        if ((propStatus != \'1\') && (propStatus != \'2\'))    // if status none of [New,Pending]\r\n            return -1;    // ignore this proposal - already been processed\r\n        /* end of changes for GROUPON */\r\n\r\n        _failurePoint = \'Retrieve context and create new asset record\';\r\n        var currentContext = nlapiGetContext();\r\n\r\n        var AssetRecId;\r\n        var rDeprHist;\r\n        var PropCost = ncParseFloatNV(PropRec.getFieldValue(\'custrecord_propassetcost\'),0.00);\r\n        var PropRV = ncParseFloatNV(PropRec.getFieldValue(\'custrecord_propresidvalue\'),0.00);\r\n        var PropQuant = PropRec.getFieldValue(\'custrecord_propquantity\');\r\n\r\n        if(isStringEmpty(PropQuant))\r\n            PropQuant = 1;\r\n\r\n        if((ChildPropRecs===null) || (ChildPropRecs===undefined))\r\n            ChildPropRecs = new Array();\r\n\r\n        for(var i=0; i<ChildPropRecs.length;i++ )\r\n        {\r\n            var cost = ncParseFloatNV(ChildPropRecs[i].getValue(\'custrecord_propassetcost\'),0.00);\r\n            var rv = ncParseFloatNV(ChildPropRecs[i].getValue(\'custrecord_propresidvalue\'),0.00);\r\n            PropCost = nlapiFormatCurrency(((PropCost*100)+(cost*100))/100);\r\n            PropRV = nlapiFormatCurrency(((PropRV*100)+(rv*100))/100);\r\n        }\r\n\r\n        var AssetRec = nlapiCreateRecord(ncConst.FAR_Asset);\r\n\r\n        /* copy fields and set other defaults */\r\n        _failurePoint = \'Set values from Proposal record\';\r\n        var AssetDescr = PropRec.getFieldValue(\'custrecord_propassetdescr\');\r\n        if( (AssetDescr == null) || (AssetDescr == \'\') )\r\n            AssetDescr = \'Auto Generated Asset\';\r\n\r\n        AssetRec.setFieldValue(\'altname\',AssetDescr.substring(0,50));\r\n        AssetRec.setFieldValue(\'custrecord_assettype\',PropRec.getFieldValue(\'custrecord_propassettype\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetaccmethod\',PropRec.getFieldValue(\'custrecord_propaccmethod\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetresidualperc\',PropRec.getFieldValue(\'custrecord_propresidperc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetresidualvalue\',PropRV);\r\n        AssetRec.setFieldValue(\'custrecord_assetlifetime\',PropRec.getFieldValue(\'custrecord_propassetlifetime\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdepractive\',PropRec.getFieldValue(\'custrecord_propdepractive\'));\r\n        AssetRec.setFieldValue(\'custrecord_ncfar_quantity\',PropQuant);\r\n\r\n        var DeprStartDate = ncStringToDate(PropRec.getFieldValue(\'custrecord_propdeprstartdate\'), new Date());\r\n        if( AssetRec.getFieldValue(\'custrecord_assetdepractive\')==\'1\' /* Active */ )\r\n        {\r\n            // asset is immediately active, so set default depreciation start date from Prop (current date if blank)\r\n            AssetRec.setFieldValue(\'custrecord_assetdeprstartdate\',nlapiDateToString(DeprStartDate));\r\n            // also set end date, based upon start date + lifetime (periods, i.e. currently months only)\r\n            var EndDate = new Date(DeprStartDate-86400000); // 24 hrs x 60 mins x 60 secs x 1000 millisecs = 86400000\r\n            // deduct one day, since if depr. from 1/1/2008 for 12 months, we want end to be 31/12/2008 not 1/1/2009\r\n            var numPeriods = ncParseIntNV(PropRec.getFieldValue(\'custrecord_propassetlifetime\'),0);\r\n            EndDate = nlapiAddMonths(EndDate,numPeriods);\r\n            AssetRec.setFieldValue(\'custrecord_assetdeprenddate\',nlapiDateToString(EndDate));\r\n        }\r\n        // asset generated from proposal (from existing transaction), so already posted \'Acquisition\' to asset account\r\n        AssetRec.setFieldValue(\'custrecord_assetacqstatus\',\'T\');\r\n\r\n        AssetRec.setFieldValue(\'custrecord_asset_propid\',PropRec.getId());\r\n        AssetRec.setFieldValue(\'custrecord_assetsourcetrn\',PropRec.getFieldValue(\'custrecord_propsourceid\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetinclreports\',PropRec.getFieldValue(\'custrecord_propinclreports\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetrevisionrules\',PropRec.getFieldValue(\'custrecord_proprevisionrules\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdeprrules\',PropRec.getFieldValue(\'custrecord_propdeprrules\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdeprperiod\',PropRec.getFieldValue(\'custrecord_propdeprperiod\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetcaretaker\',PropRec.getFieldValue(\'custrecord_propcaretaker\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetsupplier\',PropRec.getFieldValue(\'custrecord_propsupplier\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdisposalitem\',PropRec.getFieldValue(\'custrecord_propdisposalitem\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetmainacc\',PropRec.getFieldValue(\'custrecord_propmainacc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdepracc\',PropRec.getFieldValue(\'custrecord_propdepracc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdeprchargeacc\',PropRec.getFieldValue(\'custrecord_propdeprchargeacc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetwriteoffacc\',PropRec.getFieldValue(\'custrecord_propwriteoffacc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetwritedownacc\',PropRec.getFieldValue(\'custrecord_propwritedownacc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetdisposalacc\',PropRec.getFieldValue(\'custrecord_propdisposalacc\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetinspection\',PropRec.getFieldValue(\'custrecord_propinspection\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetinspectionperiod\',PropRec.getFieldValue(\'custrecord_propinspectionperiod\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetwarranty\',PropRec.getFieldValue(\'custrecord_propwarranty\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetwarrantyperiod\',PropRec.getFieldValue(\'custrecord_propwarrantyperiod\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetfinancialyear\',PropRec.getFieldValue(\'custrecord_propfinancialyear\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetcost\',PropCost);\r\n        AssetRec.setFieldValue(\'custrecord_assetcurrentcost\',PropCost);\r\n        AssetRec.setFieldValue(\'custrecord_assetbookvalue\',PropCost);\r\n        AssetRec.setFieldValue(\'custrecord_assetdescr\',AssetDescr);\r\n        // add any enabled feature columns (department/class/location)\r\n        if( currentContext.getSetting(\'FEATURE\',\'departments\') == \'T\' )\r\n        {\r\n            AssetRec.setFieldValue(\'custrecord_assetdepartment\',PropRec.getFieldValue(\'custrecord_propdepartment\'));\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'locations\') == \'T\' )\r\n        {\r\n            AssetRec.setFieldValue(\'custrecord_assetlocation\',PropRec.getFieldValue(\'custrecord_proplocation\'));\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'classes\') == \'T\' )\r\n        {\r\n            AssetRec.setFieldValue(\'custrecord_assetclass\',PropRec.getFieldValue(\'custrecord_propclass\'));\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' )\r\n        {\r\n            AssetRec.setFieldValue(\'custrecord_assetsubsidiary\',PropRec.getFieldValue(\'custrecord_propsubsidiary\'));\r\n        }\r\n        if( currentContext.getSetting(\'FEATURE\',\'multicurrency\') == \'T\' )\r\n        {\r\n            // currency info\r\n            AssetRec.setFieldValue(\'custrecord_assetfixedexrate\',PropRec.getFieldValue(\'custrecord_propfixedexrate\'));\r\n        }\r\n\r\n        // if originated from purchase order...\r\n        AssetRec.setFieldValue(\'custrecord_assetpurchaseorder\',PropRec.getFieldValue(\'custrecord_proppurchaseorder\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetpurchasedate\',PropRec.getFieldValue(\'custrecord_proppurchasedate\'));\r\n        AssetRec.setFieldValue(\'custrecord_assetsupplier\',PropRec.getFieldValue(\'custrecord_propsupplier\'));\r\n\r\n        // other methods info\r\n        /*\r\n        for(var i=1;i<= 9;++i)\r\n        {\r\n            if(PropRec.getFieldValue(\'custrecord_propdeprmethod\'+i) != null && PropRec.getFieldValue(\'custrecord_propdeprmethod\'+i) != \'\')\r\n            {\r\n                AssetRec.setFieldValue(\'custrecord_assetdeprmethod\'+i,PropRec.getFieldValue(\'custrecord_propdeprmethod\'+i));\r\n                AssetRec.setFieldValue(\'custrecord_assetlifetime\'+i,PropRec.getFieldValue(\'custrecord_proplifetime\'+i));\r\n                AssetRec.setFieldValue(\'custrecord_assetrv\'+i,PropRec.getFieldValue(\'custrecord_proprv\'+i));\r\n                AssetRec.setFieldValue(\'custrecord_assetdeprtodate\'+i,0.00);\r\n                AssetRec.setFieldValue(\'custrecord_assetlastamt\'+i,0.00);\r\n                AssetRec.setFieldValue(\'custrecord_assetnbv\'+i,PropRec.getFieldValue(\'custrecord_propassetcost\'));\r\n                AssetRec.setFieldValue(\'custrecord_assetforecast\'+i,0.00);\r\n            }\r\n        }\r\n        */\r\n\r\n\r\n//        var l_storeHist = PropRec.getFieldValue(\'custrecord_propstorehist\');\r\n        var l_storeHist = \'T\';\r\n        AssetRec.setFieldValue(\'custrecord_storedeprhist\',\'T\');\r\n\r\n        _failurePoint = \'Submit Asset Record\';\r\n        AssetRecId = nlapiSubmitRecord(AssetRec,true);\r\n\r\n\r\n        // need to re-set the name here, since setting it prior to original save is ignored!!!\r\n        var dbgAssetName = nlapiLookupField(ncConst.FAR_Asset, AssetRecId, \'altname\', false);\r\n        if( dbgAssetName != AssetDescr.substring(0,50) )\r\n        {\r\n            nlapiSubmitField(ncConst.FAR_Asset, AssetRecId, [\'altname\'], [AssetDescr.substring(0,50)], false);\r\n        }\r\n\r\n        // write depreciation history record to track acquisition\r\n        _failurePoint = \'Create Depr. History (Acq.)\';\r\n        rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n        if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' )\r\n            rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', PropRec.getFieldValue(\'custrecord_propsubsidiary\'));\r\n        // need to include asset type and history record type (but need to make the fields too)\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', AssetRec.getFieldValue(\'custrecord_assettype\'));\r\n        rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\');    // acquisition\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetRecId.toString());\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(DeprStartDate));\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistamount\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n//        rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', LIST_DEPRHIST_ACCMETH); //jgutana commented out\r\n        rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', AssetRec.getFieldValue(\'custrecord_ncfar_quantity\'));\r\n        if(FAM.Context.blnMultiBook) rDeprHist.setFieldValue(\'custrecord_deprhistaccountingbook\', 1);\r\n\r\n        nlapiSubmitRecord(rDeprHist,false);\r\n\r\n        if(l_storeHist == \'T\') // write depreciation history records for any other methods\r\n        {\r\n            /*\r\n            for(i=1;i<= 9;++i)\r\n            {\r\n                if(PropRec.getFieldValue(\'custrecord_propdeprmethod\'+i) != null && PropRec.getFieldValue(\'custrecord_propdeprmethod\'+i) != \'\')\r\n                {\r\n                    _failurePoint = \'Create Depr. History for Other Methods (Acq.)\';\r\n                    rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                    if( currentContext.getSetting(\'FEATURE\',\'subsidiaries\') == \'T\' )\r\n                        rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', PropRec.getFieldValue(\'custrecord_propsubsidiary\'));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', AssetRec.getFieldValue(\'custrecord_assettype\'));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\');    // acquisition\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetRecId.toString());\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(DeprStartDate));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistamount\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', i+1);\r\n\r\n                    nlapiSubmitRecord(rDeprHist,false);\r\n                }\r\n            }\r\n            */\r\n            /*\r\n            for (var i = 0; i < arrDefAltDepr.length; i++) {\r\n                rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                if (currentContext.getSetting(\'FEATURE\', \'subsidiaries\') == \'T\')\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', PropRec.getFieldValue(\'custrecord_propsubsidiary\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', AssetRec.getFieldValue(\'custrecord_assettype\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\'); // acquisition\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetRecId.toString());\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(DeprStartDate));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistamount\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetRec.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistaltdepr\', arrAltDeprIDs[i]);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistaltmethod\', arrDefAltDepr[i][\'custrecord_altdeprdef_altmethod\']);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistdeprmethod\', arrDefAltDepr[i][\'custrecord_altdeprdef_deprmethod\']);\r\n\r\n                _failurePoint = \'Create Depr. History for Other Methods (Acquisition)\';\r\n                nlapiSubmitRecord(rDeprHist, false);\r\n            }\r\n            */\r\n        }\r\n    } catch (GE)\r\n    {\r\n                var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n            {\r\n                if( typeof(ST) == \'string\' )\r\n                    msg += \'<BR>\'+ST;\r\n                else    // in case we ever do get an array...\r\n                    for( var nST=0; nST<ST.length; ++nST )\r\n                        if( ST[nST] != \'undefined\' )\r\n                            msg += \'<BR>\'+ST[nST];\r\n            }\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'Failure Point\',_failurePoint);\r\n        return -1;\r\n    }\r\n    return AssetRecId;\r\n}\r\n\r\n\r\n\r\n\r\n/* *************************************************\r\n * Asset Depreciation processing\r\n */\r\n\r\n/* ncFAR_DepreciateAssetBG - Depreciate assets (background process)\r\n *\r\n * This function is a background process to depreciate assets\r\n *\r\n * This function utilises ncFAR_DepreciateAsset() to handle the actual detail per asset\r\n *\r\n * Parameters:\r\n *  No parameters are passed directly.  Instead, the process record id is passed as a scheduled script parameter\r\n *  so we need to retrieve it from the Context info\r\n *\r\n *      custscriptprocessid    - Id of current process record, which contains status information etc.\r\n *\r\n *  Further details are then read from the process record\r\n *\r\n *  Update: ProcessId parameter - Id of current process record, allowing this script to be invoked directly\r\n *  If this parameter is null (e.g. when called from a schedule), the custscriptprocessid script parameter will be used\r\n *\r\n * Returns:\r\n *     no direct return parameters - all information should be passed back by updating the process record\r\n */\r\nfunction ncFAR_DepreciateAssetBG(ProcessId)\r\n{\r\n    var _failurePoint;\r\n    var _timestamp = (new Date()).getTime();\r\n    var _timelimit = 600000;\r\n    var procId;\r\n\r\n    try\r\n    {\r\n        /* retrieve script parameters --> process id */\r\n        _failurePoint = \'Retrieve script parameters\';\r\n        var currentContext = nlapiGetContext();\r\n        procId = currentContext.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n        if( ProcessId != null )\r\n        {\r\n            procId = ProcessId;    // called directly, so use direct parameter not context setting\r\n            _timelimit = 60000;    // because direct, only 60 seconds not 600 seconds\r\n        }\r\n\r\n        _timelimit -= 40000;    // deduct 40 seconds to give margin of error, time to tidy up and quit, etc. (15 seconds was too short, it STILL failed sometimes)\r\n\r\n        if( procId == null )\r\n            return;    // nothing to do - no process record to determine status or log events against\r\n\r\n        /* retrieve process record --> process parameters */\r\n        _failurePoint = \'Retrieve process record\';\r\n        var rProcessInfo = nlapiLoadRecord(ncConst.BGP_ProcessInstance, procId);\r\n        if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' )\r\n            return;    // nothing to do\r\n\r\n        var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),0);\r\n\r\n        /* retrieve Asset Type list for processing, and current status info */\r\n        var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pNames = tmpStr.split(\',\');\r\n        tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pValues = tmpStr.split(\',\');\r\n        var currentRowId = \'\';\r\n        var ATarray;\r\n        var ATypes;\r\n        var JIds;\r\n        var DeprPeriodDate = new Date();\r\n        var DeprMemo; //cs\r\n        var Subsids;\r\n        var SubIdx = 0;    // PJB, 18/09/2009, Index to track which sub we are currently processing\r\n\r\n        var JrnSummary = \'\';\r\n        var AHkeys;\r\n        var AHids;\r\n        var JLhashes;\r\n        var JLvalues;\r\n\r\n        var GenHistFlag = \'F\';\r\n        var SingleMethod = 0;\r\n\r\n        if( pNames.length == pValues.length )\r\n        {\r\n            for(var pN=0; pN < pNames.length; ++pN)\r\n            {\r\n                switch( pNames[pN] )\r\n                {\r\n                    case \'ATarray\':\r\n                        ATarray = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'ATypes\':\r\n                        ATypes = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'Journals\':\r\n                        JIds = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'DeprPeriod\':\r\n                        DeprPeriodDate = ncDecodeDate(pValues[pN]);\r\n                        break;\r\n                    case \'SummaryFlag\':\r\n                        JrnSummary = pValues[pN];\r\n                        break;\r\n                    case \'AHkeys\':\r\n                        AHkeys = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'AHids\':\r\n                        AHids = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'JLhashes\':\r\n                        JLhashes = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'JLvalues\':\r\n                        JLvalues = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'DeprMemo\':\r\n                        DeprMemo = pValues[pN];\r\n                        break;\r\n                    case \'Subsids\':\r\n                        Subsids = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'SubIdx\':\r\n                        SubIdx = ncParseIntNV(pValues[pN],-1);\r\n                        break;\r\n                    case \'GenHist\':\r\n                        GenHistFlag = pValues[pN];\r\n                        DeprPeriodDate = new Date(2199,11,31);\r\n                        break;\r\n                    case \'DeprM\':\r\n                        SingleMethod = ncParseIntNV(pValues[pN],0);\r\n                        break;\r\n                    default:\r\n                        // do nothing\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            // all gone wrong - gracefully abort (and log values?)\r\n            ncLogExecution(\'error\',\'ncFAR_DepreciateAssetBG\',\'parameter values blank, aborting\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = \'parameter values blank, aborting\';\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n            return;\r\n        }\r\n\r\n        // Read system setup record to get depreciation settings\r\n        // Also preload currency symbol and integer currencies\r\n        var IntCurrSym = \'\';\r\n        var CurrSymbols = new Array();\r\n        var UseMaxBG = \'F\';\r\n        var scSetup = new Array();\r\n        scSetup[0] = new nlobjSearchColumn(\'custrecord_summaryjournals\');\r\n        scSetup[1] = new nlobjSearchColumn(\'custrecord_maxbg\');\r\n        scSetup[2] = new nlobjSearchColumn(\'custrecord_fam_summarisejournalsby\');\r\n        scSetup[3] = new nlobjSearchColumn(\'custrecord_intcurrsymbols\');\r\n        var srSetup = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,scSetup);\r\n        if( (srSetup != null) && (srSetup.length > 0) )\r\n        {\r\n            UseMaxBG = srSetup[0].getValue(\'custrecord_maxbg\');\r\n            IntCurrSym = srSetup[0].getValue(\'custrecord_intcurrsymbols\');\r\n\r\n            if( JrnSummary == null||JrnSummary == \'\' )\r\n            {\r\n                // not passed as param, so read it now\r\n                JrnSummary = srSetup[0].getValue(\'custrecord_fam_summarisejournalsby\');\r\n            }\r\n        }\r\n\r\n        // now read symbols for all currencies\r\n        if(ncIsFeatureEnabled(\'multicurrency\'))\r\n        {\r\n            var srCurrencies = nlapiSearchRecord(\'currency\',null,null,new nlobjSearchColumn(\'symbol\'));\r\n            var cI = 0;\r\n            while( (srCurrencies != null) && (cI < srCurrencies.length) )\r\n            {\r\n                CurrSymbols[srCurrencies[cI].getId().toString()] = srCurrencies[cI].getValue(\'symbol\');\r\n                ++cI;\r\n            }\r\n        }\r\n        //--\r\n\r\n        var Journals = new Array();\r\n        var rJE;\r\n        var JEhash;\r\n        // retrieve info from parameters (above), then load those records into the array (10 units per journal)\r\n        if( (JIds != null) && (JIds[0] != \'\') )\r\n        {\r\n            for(var ji=0; ji < JIds.length; ++ji)\r\n            {\r\n                rJE = nlapiLoadRecord(\'journalentry\',JIds[ji]);\r\n\r\n                // TrnDate will determine period, and assume periods are monthly, so use Year,Month\r\n                var YearAndMonth;\r\n                var l_Date = nlapiStringToDate(rJE.getFieldValue(\'trandate\'));\r\n                YearAndMonth = l_Date.getFullYear().toString() + (l_Date.getMonth()+1).toString();\r\n\r\n                JEhash = GetJournalHash(YearAndMonth, rJE.getFieldValue(\'subsidiary\'), \r\n                    rJE.getFieldValue(\'currency\'), rJE.getFieldValue(\'department\'), \r\n                    rJE.getFieldValue(\'class\'), rJE.getFieldValue(\'location\'));\r\n                Journals[JEhash] = rJE;\r\n            }\r\n        }\r\n\r\n        // search for all Asset Types in range, resume at current ...\r\n        if( (ATypes != null) && (ATypes[0] != \'\') && ((ATarray == null) || (ATarray[0] == \'\')) )\r\n        {\r\n            // Asset Types setup list is set, but \'current\' list is empty - so repopulate it\r\n            ATarray = new Array();\r\n            for(var t=0; t < ATypes.length; ++t)\r\n                ATarray[t] = ATypes[t];\r\n        }\r\n\r\n        var sfAT = new Array();\r\n        sfAT[0] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n        if( (ATarray != null) && (ATarray[0] != \'\') )\r\n            sfAT[1] = new nlobjSearchFilter(\'internalid\',null,\'anyof\',ATarray,null);\r\n        var AssetTypes = nlapiSearchRecord(ncConst.FAR_AssetType,null,sfAT,new nlobjSearchColumn(\'name\'));\r\n        if( (AssetTypes == null) || (AssetTypes.length == 0) )\r\n        {\r\n            ncLogExecution(\'debug\',\'ncFAR_DepreciateAssetBG\',\'no search results with current params\');\r\n        }\r\n\r\n        // very limited during this process so need to optimise and pre-cache lookups to avoid duplicate reads... depreciation methods and functions\r\n        var currDate = new Date();\r\n        var DeprMethods = new Array();\r\n        var DeprFunctions = new Array();\r\n        var DMcols = new Array();\r\n        DMcols[0] = new nlobjSearchColumn(\'custrecord_deprmethodformula\');\r\n        DMcols[1] = new nlobjSearchColumn(\'custrecord_deprmethodendperiod\');\r\n        DMcols[2] = new nlobjSearchColumn(\'custrecord_deprmethodnextmethod\');\r\n        DMcols[3] = new nlobjSearchColumn(\'custrecord_deprmethoddeprperiod\');\r\n        DMcols[4] = new nlobjSearchColumn(\'custrecord_deprmethod_accrual_convention\');    //AV\r\n        DMcols[5] = new nlobjSearchColumn(\'custrecord_deprmethod_final_convention\');    //AV\r\n        var srMethods = nlapiSearchRecord(ncConst.FAR_DeprMethod,null,null,DMcols);\r\n        var dm = 0;\r\n        var dmId;\r\n        var depFn;\r\n        _failurePoint = \'Loading Depr Method cache\';\r\n        while( (srMethods != null) && (dm < srMethods.length) )\r\n        {\r\n            dmId = srMethods[dm].getId().toString();\r\n            DeprMethods[dmId] = srMethods[dm];\r\n\r\n            DeprFunctions[dmId] = new ncFAR_FnToken();\r\n            depFn = DeprMethods[dmId].getValue(\'custrecord_deprmethodformula\');\r\n            if( !ncFAR_ParseFormula(depFn,DeprFunctions[dmId]) )\r\n            {\r\n                ncLogExecution(\'error\',\'Unable to parse depreciation formula\',\'Formula expression:\'+depFn);\r\n\r\n                fNames = new Array();\r\n                fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                fValues = new Array();\r\n                fValues[0] = \'Unable to parse depreciation formula:\'+depFn;\r\n                fValues[1] = \'4\';    // status 4 = failed\r\n                fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n                return;\r\n            }\r\n\r\n            ++dm;\r\n        }\r\n\r\n        // now read period status info via web services...\r\n        var PeriodInfo = CustomScript_getPeriodInfo();\r\n\r\n        if( typeof(PeriodInfo)==\'string\' )\r\n        {\r\n            ncLogExecution(\'error\',\'Unable to retrieve accounting period information\',PeriodInfo);\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = PeriodInfo;\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n            return;\r\n        }\r\n        var PeriodCache = new Array();\r\n\r\n        /* if JrnSummary == \'T\' we need to summarise posting lines, for which we need asset hierarchy\r\n            if JrnSummary == \'parent\' we need to summarise posting lines, for which we need asset hierarchy\r\n           if AHkeys is null or empty, we need to generate this now\r\n           if AHkeys is not empty, we need to regenerate from the state info */\r\n        var AH = null;\r\n        var JL = null; // array for journal lines (by hash)\r\n        //CS 20/5/09\r\n        if( JrnSummary != null && JrnSummary != \'\' )\r\n            JL = new Array();\r\n\r\n    //    if( JrnSummary == \'T\' )\r\n        if( JrnSummary == FAM.SummarizeBy[\'Parent\'])\r\n        {\r\n            AH = new Array();\r\n    //        JL = new Array();\r\n\r\n            _failurePoint = \'building journal hierarchy\';\r\n            if( (AHkeys != null) && (AHkeys.length > 0) )\r\n            {\r\n                // regenerate\r\n                if( AHkeys.length != AHids.length )\r\n                {\r\n                    // oops - should never happen... what to do?\r\n                    ncLogExecution(\'error\',\'ncFAR_DepreciateAssetBG\',\'parameter value mismatch (AH), aborting\');\r\n\r\n                    fNames = new Array();\r\n                    fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                    fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                    fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                    fValues = new Array();\r\n                    fValues[0] = \'parameter value mismatch (AH)\';\r\n                    fValues[1] = \'4\';    // status 4 = failed\r\n                    fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                    nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n                    return;\r\n                }\r\n\r\n                var ahn;\r\n                for( ahn=0; ahn<AHkeys.length; ++ahn )\r\n                    AH[AHkeys[ahn]] = AHids[ahn];\r\n            }\r\n            else\r\n            {\r\n                // first time generation\r\n                // for each asset type, search for current assets\r\n                var sahFilters = new Array();\r\n                var sahColumns = new Array();\r\n                sahFilters[0] = new nlobjSearchFilter(\'custrecord_assetdepractive\',null,\'anyof\',[\'1\']);\r\n                sahFilters[1] = new nlobjSearchFilter(\'custrecord_assetlastdeprdate\',null,\'before\',nlapiDateToString(DeprPeriodDate));\r\n                sahFilters[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n                sahColumns[0] = new nlobjSearchColumn(\'custrecord_assetparent\');\r\n\r\n                var iah=0;\r\n                var ahfilterBase = sahFilters.length;\r\n\r\n                while( (AssetTypes != null) && (iah < AssetTypes.length) )\r\n                {\r\n                    _failurePoint = \'AH: iterating through Types\';\r\n                    var ahATid = AssetTypes[iah].getId();\r\n\r\n                    sahFilters[ahfilterBase] = new nlobjSearchFilter(\'custrecord_assettype\',null,\'anyof\',[ahATid],null);\r\n                    var sahResults = nlapiSearchRecord(ncConst.FAR_Asset,null,sahFilters,sahColumns);\r\n\r\n                    var nah=0;\r\n                    var ahParent;\r\n                    _failurePoint = \'AH: iterating through Assets\';\r\n                    while( (sahResults != null) && (nah < sahResults.length) )\r\n                    {\r\n                        // for each asset, record immediate parent (or self, if no parent)\r\n                        ahParent = sahResults[nah].getValue(\'custrecord_assetparent\');\r\n                        if( (ahParent == null) || (ahParent == \'\') )\r\n                            ahParent = sahResults[nah].getId();\r\n                        AH[sahResults[nah].getId()] = ahParent;\r\n                        ++nah;\r\n                    }\r\n\r\n                    ++iah;\r\n                }\r\n            }\r\n        }\r\n\r\n        //CS 20/5/09\r\n        if( JrnSummary != null && JrnSummary != \'\' )\r\n        {\r\n            _failurePoint = \'rebuilding journal line hashes\';\r\n\r\n            if( (JLhashes != null) && (JLvalues.length > 0) )\r\n            {\r\n                // regenerate\r\n                if( JLhashes.length != JLvalues.length )\r\n                {\r\n                    // oops - should never happen... what to do?\r\n                    ncLogExecution(\'error\',\'ncFAR_DepreciateAssetBG\',\'parameter value mismatch (JL), aborting\');\r\n\r\n                    fNames = new Array();\r\n                    fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                    fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                    fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                    fValues = new Array();\r\n                    fValues[0] = \'parameter value mismatch (JL)\';\r\n                    fValues[1] = \'4\';    // status 4 = failed\r\n                    fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                    nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n                    return;\r\n                }\r\n\r\n                var JLn;\r\n                for( JLn=0; JLn<JLhashes.length; ++JLn )\r\n                    JL[JLhashes[JLn]] = parseInt(JLvalues[JLn]);\r\n            }\r\n        }\r\n\r\n        /* inner process loop - for each asset type, retrieve current assets for depreciation */\r\n        var rAsset;\r\n        var sFilters = new Array();\r\n        var sColumns = new Array();\r\n    //    sFilters[0] = new nlobjSearchFilter(\'custrecord_assetdepractive\',null,\'anyof\',[\'1\']);\r\n        //sFilters[1] = new nlobjSearchFilter(\'custrecord_assetlastdeprdate\',null,\'before\',\'weeksago2\');\r\n        // now we have a DeprPeriodDate, cannot search for assets older than two weeks (or keep finding the same records\r\n        // again and again if DeprPeriodDate more than 2 weeks ago) - need to search for before DeprPeriodDate instead\r\n\r\n        sFilters[0] = new nlobjSearchFilter(\'custrecord_assetlastdeprdate\',null,\'before\',nlapiDateToString(DeprPeriodDate));\r\n    //    sFilters[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n\r\n        /* PJB, 18/09/2009, because of poor search performance, now do subs one at a time and inside Asset Type loop ...\r\n        if( (Subsids!= null) && (Subsids.length>0) && (Subsids[0] != \'\') )\r\n        {\r\n            sFilters[2] = new nlobjSearchFilter(\'custrecord_assetsubsidiary\',null,\'anyof\',Subsids);\r\n        }\r\n        ... */\r\n\r\n    //    sColumns[0] = new nlobjSearchColumn(\'custrecord_assettype\');\r\n\r\n        var l_DeprMemo = DeprMemo;\r\n        var i=0;\r\n        var bAbort = false;\r\n        var filterBase = sFilters.length;\r\n\r\n        // extra vars for Subs loop\r\n        var SubFilter = filterBase + 1;\r\n        var MaxSubIdx = 1;\r\n        if( (Subsids!= null) && (Subsids.length>0) && (Subsids[0] != \'\') )\r\n        {\r\n            MaxSubIdx = Subsids.length;\r\n        }\r\n\r\n        var procStatus = 2; //completed  ---> this will be overwritten as necessary\r\n        var procMessage = \'\';\r\n        var procLogMessage = \'Processing completed\';\r\n        \r\n        while( (!bAbort) && (AssetTypes != null) && (i < AssetTypes.length) )\r\n        {\r\n            _failurePoint = \'iterating through Types\';\r\n            var ATid = AssetTypes[i].getId();\r\n            var ATname = AssetTypes[i].getValue(\'Name\');\r\n\r\n            _failurePoint = \'building search filters for Assets\';\r\n            sFilters[filterBase] = new nlobjSearchFilter(\'custrecord_assettype\',null,\'anyof\',[ATid],null);\r\n\r\n            /* PJB, 18/09/2009, inner loop for subsidiaries, if required... */\r\n            while( (!bAbort) && (SubIdx < MaxSubIdx) )\r\n            {\r\n                if( (Subsids!= null) && (Subsids.length>0) && (Subsids[SubIdx] != \'\') )\r\n                {\r\n                    sFilters[SubFilter] = new nlobjSearchFilter(\'custrecord_assetsubsidiary\',null,\'anyof\',Subsids[SubIdx]);\r\n                }\r\n\r\n                var arrGroupMasters = getGroupMasterDepreciation( \'custrecord_altdepraltmethod\', Subsids[SubIdx], true ); // VS, JB\r\n                // ... now process as before but for one sub only\r\n\r\n                // additional loop for high governance / unlimited accounts\r\n                var HighGov = true;\r\n                while ((!bAbort) && (HighGov))\r\n                {\r\n\r\n                    _failurePoint = \'executing asset search\';\r\n                //    var sResults = nlapiSearchRecord(ncConst.FAR_Asset,null,sFilters,sColumns);\r\n                    var sResults = nlapiSearchRecord(ncConst.FAR_Asset,\'customsearch_assetdepreciation\',sFilters,null);\r\n\r\n                    if ((sResults == null) || (sResults.length < 1000))\r\n                        HighGov = false;\r\n\r\n\r\n                    // per 2ndary search result, call ncFAR_DepreciateAsset\r\n                    var n=0;\r\n                    var age=0;\r\n                    var uRem = 0;\r\n                    var iRem = 0;\r\n                    var uTarget = 0;\r\n                    var tUsed = 0;\r\n                    var ParentAssetId = \'\';\r\n\r\n                    /* determine whether old site (2008.n) or new site (2009.1) and thus which governance methods apply */\r\n                    var nsVer = \'2008\';\r\n\r\n                    if( \'getPercentComplete\' in currentContext )\r\n                        if( typeof( currentContext[\'getPercentComplete\'] ) == \'function\' )\r\n                        {\r\n                            nsVer = \'2009\';\r\n                        }\r\n                    // or check first 4 characters of currentContext.getVersion()\r\n                    // ... except .getVersion() is unsupported, undocumented and v2009.1 only, so no use for v2008.2 !\r\n\r\n                    if( nsVer != \'2009\' )\r\n                    {\r\n                        // even with the time check within the main loop, this routine has managed to\r\n                        // hit the execution time limit.  So, before we even enter the loop, if we are\r\n                        // within 20 seconds of our limit, don\'t bother... should only happen on first\r\n                        // foreground execution, never on scheduled execution\r\n                        tUsed = (new Date()).getTime() - _timestamp;\r\n                        if( tUsed >= _timelimit-20000 )\r\n                            bAbort = true;\r\n                    }\r\n\r\n                    while( (!bAbort) && (sResults != null) && (n < sResults.length) )\r\n                    {\r\n                        _failurePoint = \'iterating through assets\';\r\n                        currentRowId = sResults[n].getId();    // stash current id\r\n                        rAsset = nlapiLoadRecord(ncConst.FAR_Asset,currentRowId);\r\n\r\n                        ParentAssetId = currentRowId;\r\n                    //    if( JrnSummary == \'T\' )\r\n                        if( JrnSummary == FAM.SummarizeBy[\'Parent\'])\r\n                            while( AH[ParentAssetId] != ParentAssetId )\r\n                                ParentAssetId = AH[ParentAssetId];\r\n\r\n                        if( JrnSummary == FAM.SummarizeBy[\'Asset Type\'])\r\n                        {\r\n                            ParentAssetId = ATid;\r\n                            if(DeprMemo == \'\' || DeprMemo == null)\r\n                                l_DeprMemo = ATname;\r\n                        }\r\n                        /*\r\n                        age = ncGetAgeInMonths(nlapiStringToDate(rAsset.getFieldValue(\'custrecord_assetdeprstartdate\')),currDate);\r\n                        if( (age*60) > currentContext.getRemainingUsage() )\r\n                        {\r\n                            bAbort = true;\r\n                            break;\r\n                        }\r\n                        */\r\n                        // if journal lines to be summarised at sub-category level, get Sub name with hierarchy - use in hash\r\n                        var SubCatStr = null;\r\n                        if( JrnSummary == FAM.SummarizeBy[\'Sub-Category\'])\r\n                        {\r\n                            ParentAssetId = null;\r\n                            var txt = rAsset.getFieldText(\'custrecord_assetrepairmaintsubcategory\');\r\n                            if(txt != null && txt != \'\')\r\n                            {\r\n                                txt = txt.replace(/,/g,\' \');\r\n                                SubCatStr = rAsset.getFieldText(\'custrecord_assettype\')+\'-\'+rAsset.getFieldText(\'custrecord_assetrepairmaintcategory\')+\'-\'+ txt;\r\n                            }\r\n\r\n                        }\r\n\r\n                        //jgutana\r\n                        OBJ_ncFAR_ALTDEPR = new ncFAR_ALTDEPR(currentRowId); // global object is read by ncFAR_DepreciateAsset_v2\r\n                        OBJ_ncFAR_ALTDEPR.getAllRecords([new nlobjSearchFilter(\'isinactive\', null, \'is\', \'F\')]);\r\n\r\n                        var errMsg = ncFAR_DepreciateAsset_v2(rAsset,Journals,DeprMethods,DeprFunctions,DeprPeriodDate,false,false,procId,_timestamp,_timelimit,JL,ParentAssetId,IntCurrSym,CurrSymbols,l_DeprMemo,SubCatStr,PeriodInfo,PeriodCache,GenHistFlag,SingleMethod, arrGroupMasters);//cs VS\r\n\r\n                        /* check governance limits - if approaching limit, set bAbort */\r\n                        uTarget = 890;\r\n                        // for testing pause and resume, just set uTarget very high (e.g. 9500) and ensure 10 or so assets to depreciate\r\n                        // uTarget = 9500;\r\n\r\n                        uRem = currentContext.getRemainingUsage();\r\n\r\n                        if( nsVer == \'2009\' )\r\n                        {\r\n                            /* 2009.1 */\r\n                            if( uRem <= uTarget )\r\n                                bAbort = true;\r\n                        }\r\n                        else\r\n                        {\r\n                            // also need to check execution time...\r\n                            tUsed = (new Date()).getTime() - _timestamp;\r\n\r\n                            if( (uRem <= uTarget) || (tUsed >= _timelimit) )\r\n                                bAbort = true;\r\n                        }\r\n\r\n                        if (errMsg && errMsg[\'error\']) {\r\n                            procStatus = 3; //completed with errors\r\n                            procMessage = \'Please check the Process Log List for error(s).\';\r\n                            procLogMessage = \'Processing completed but errors were encountered\';\r\n                            \r\n                            ncBGP_WriteToLog(procId, \'Asset Id: \' + rAsset.getId() + \' | Name: \' + \r\n                                rAsset.getFieldValue(\'altname\'), \'Depreciation failed: \' + errMsg.error.toString(), \r\n                                \'Error\');\r\n                        }\r\n                        else {\r\n                            ++l_RecordCount;    // increment running total\r\n                        }\r\n                        \r\n                        ++n; // next transaction\r\n                    }\r\n\r\n                }    // end of HighGov loop\r\n\r\n                /* PJB, 18/09/2009, Changes for subsids loop */\r\n                if( !bAbort )\r\n                {\r\n                    ++SubIdx;    // next Subsidiary\r\n                }\r\n            }\r\n\r\n            if( !bAbort )\r\n            {\r\n                ++i; // next Asset Type\r\n                SubIdx = 0;    // and reset Subsidiary\r\n            }\r\n        }\r\n        \r\n        /*\r\n        _failurePoint = \'Commit Journal Entries\';\r\n        // commit the journal entry records from the array - no longer done here; \r\n        // 205919 - journal lines are committed everytime a depreciation is done\r\n        */\r\n        var JEstr = \'\';\r\n        var jrnId;\r\n        for(var Jhash in Journals)\r\n        {\r\n            if( Journals[Jhash] != null )\r\n            {\r\n                // jrnId = nlapiSubmitRecord(Journals[Jhash],false);\r\n                jrnId = Journals[Jhash].getFieldValue(\'id\');\r\n                if( (jrnId != null) && (jrnId != \'\') )\r\n                {\r\n                    if( JEstr != \'\' )\r\n                        JEstr += \':\';\r\n                    JEstr += jrnId;\r\n                }\r\n            }\r\n        }\r\n        \r\n        _failurePoint = \'Handle exit condition\';\r\n        if( bAbort )\r\n        {\r\n            // reached here due to governance abort - update Process record with new values so will resume where we left off\r\n            // grab the current and remaining asset types but don\'t restate the ones we already processed completely\r\n            var ATarraySTR = \'\';\r\n            if( AssetTypes != null )\r\n            {\r\n                for(var iAT = i; iAT < AssetTypes.length; ++iAT)\r\n                {\r\n                    if( ATarraySTR.length > 0 )\r\n                        ATarraySTR = ATarraySTR + \':\';\r\n                    ATarraySTR = ATarraySTR + AssetTypes[iAT].getId();\r\n                }\r\n            }\r\n\r\n                        var ATypesSTR;\r\n            if( ATypes != null )\r\n                ATypesSTR = ATypes.join(\':\');\r\n            else\r\n                ATypesSTR = \'\';\r\n\r\n            var SubsidsSTR = Subsids.join(\':\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_statedefn\';\r\n            fNames[1] = \'custrecord_far_proins_procstate\';\r\n            fNames[2] = \'custrecord_far_proins_reccount\';\r\n            fValues = new Array();\r\n            if( GenHistFlag == \'T\')\r\n            {\r\n                fValues[0] = \'ATarray,ATypes,Journals,SummaryFlag,Subsids,SubIdx,GenHist,DeprM\';\r\n                fValues[1] = ATarraySTR+\',\'+ATypesSTR+\',\'+JEstr+\',\'+JrnSummary+\',\'+SubsidsSTR+\',\'+SubIdx.toString()+\',T,\'+SingleMethod; //cs\r\n            }\r\n            else\r\n            {\r\n                fValues[0] = \'ATarray,ATypes,Journals,DeprPeriod,SummaryFlag,Subsids,SubIdx,DeprMemo\';\r\n                //fValues[1] = ATarraySTR+\',\'+ATypesSTR+\',\'+JEstr+\',\'+nlapiDateToString(DeprPeriodDate)+\',\'+JrnSummary+\',\'+SubsidsSTR+\',\'+SubIdx.toString()+\',\'+DeprMemo; //cs\r\n                fValues[1] = ATarraySTR+\',\'+ATypesSTR+\',\'+JEstr+\',\'+ncEncodeDate(DeprPeriodDate)+\',\'+JrnSummary+\',\'+SubsidsSTR+\',\'+SubIdx.toString()+\',\'+DeprMemo; //cs\r\n            }\r\n            fValues[2] = l_RecordCount.toString();\r\n\r\n    //        if( JrnSummary == \'T\' )\r\n            if( JrnSummary == FAM.SummarizeBy[\'Parent\'])\r\n            {\r\n                // Asset Hierarchy\r\n                AHkeys = new Array();\r\n                AHids = new Array();\r\n\r\n                for( var IDstr in AH )\r\n                {\r\n                    AHkeys[AHkeys.length] = IDstr;\r\n                    AHids[AHids.length] = AH[IDstr];\r\n                }\r\n\r\n                fValues[0] += \',AHkeys,AHids\';\r\n                fValues[1] += \',\'+AHkeys.join(\':\')+\',\'+AHids.join(\':\');\r\n            }//cs\r\n\r\n            if(JrnSummary != null && JrnSummary != \'\')\r\n            {\r\n\r\n                // Journal Lines\r\n                JLhashes = new Array();\r\n                JLvalues = new Array();\r\n\r\n                for( var JLstr in JL )\r\n                {\r\n                    JLhashes[JLhashes.length] = JLstr;\r\n                    JLvalues[JLvalues.length] = JL[JLstr].toString();\r\n                }\r\n\r\n                fValues[0] += \',JLhashes,JLvalues\';\r\n                fValues[1] += \',\'+JLhashes.join(\':\')+\',\'+JLvalues.join(\':\');\r\n            }\r\n\r\n            var Activity = rProcessInfo.getFieldValue(\'custrecord_far_proins_activitytype\');\r\n            switch( Activity )\r\n            {\r\n                case \'1\':    // this was a direct call, so switch to custom schedule\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'2\';\r\n                    break;\r\n                case \'2\':    // this was custom schedule, so revert to regular scheduling\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'3\';\r\n                    break;\r\n                default:\r\n                    // nothing to do - remain as current\r\n            }\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId,fNames,fValues,false);    // should update more, e.g. record count etc.\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',\'Processing limit reached, re-sheduling\',\'Message\');\r\n\r\n        }\r\n        else\r\n        {\r\n            // really finished - update process control record for completion\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_statedefn\';\r\n            fNames[1] = \'custrecord_far_proins_procstate\';\r\n            fNames[2] = \'custrecord_far_proins_reccount\';\r\n            fNames[3] = \'custrecord_far_proins_procstatus\';\r\n            fNames[4] = \'custrecord_far_proins_activitytype\';\r\n            fNames[5] = \'custrecord_far_proins_procmsg\';\r\n            fValues = new Array();\r\n            fValues[0] = \'\';\r\n            fValues[1] = \'\';\r\n            fValues[2] = l_RecordCount.toString();\r\n            fValues[3] = procStatus;\r\n            fValues[4] = \'3\';    // activity type 3 = planned schedule\r\n            fValues[5] = procMessage;\r\n            \r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',procLogMessage,\'Message\');\r\n        }\r\n    } catch (GE)\r\n    {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( typeof(ST) == \'string\' )\r\n                msg += \'<BR>\'+ST;\r\n            else    // in case we ever do get an array...\r\n                for( var nST=0; nST<ST.length; ++nST )\r\n                    if( ST[nST] != \'undefined\' )\r\n                        msg += \'<BR>\'+ST[nST];\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'_failurePoint\',_failurePoint);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n\r\n        /*\r\n         * Rethrow any exception so that any information will e logged by NetSuite Support\r\n         */\r\n        throw GE;\r\n    }\r\n}\r\n\r\n\r\nfunction ncFAR_BeforeLoadProposal(type)\r\n{\r\n    var altDepr_sublist = form.getSubList(\'recmachcustrecord_propaltdepr_propid\');\r\n    if (altDepr_sublist) {\r\n        //remove Attach, Customize, and Select options\r\n        if (type == \'view\') {\r\n            altDepr_sublist.removeButton(\'attach\');\r\n            altDepr_sublist.removeButton(\'customize\');\r\n            nlapiGetField(\'searchid\').setDisplayType(\'hidden\'); //doesn\'t really work\r\n            nlapiGetField(\'existingrecmachcustrecord_propaltdepr_propid\').setDisplayType(\'hidden\');\r\n        }\r\n    }\r\n}\r\n\r\n/* ncFAR_BeforeSubmitProposal - Event Script to run \'Before Submit\' for Asset Proposal records\r\n*\r\n* This function will set proposal status to \'Combined\' (5) if Parent Propsal set.\r\n*\r\n* Parameters:\r\n*         type        - system parameter, one of the following strings: create,edit,delete,xedit\r\n* Returns:\r\n*         nothing\r\n*/\r\nfunction ncFAR_BeforeSubmitProposal(type)\r\n{\r\n    if( type.toLowerCase() == \'edit\' || type.toLowerCase() == \'xedit\')\r\n    {\r\n        var rOldProp = nlapiGetOldRecord();\r\n        var OldParentId = rOldProp.getFieldValue(\'custrecord_propparent\');\r\n        nlapiLogExecution(\'debug\',\' OldParentId\', OldParentId);\r\n\r\n        var rProp = nlapiGetNewRecord();\r\n        var ParentId = rProp.getFieldValue(\'custrecord_propparent\');\r\n        nlapiLogExecution(\'debug\',\' ParentId\', ParentId);\r\n        var ProposalStatus = rProp.getFieldValue(\'custrecord_propstatus\');\r\n\r\n        var PropId = rProp.getId();\r\n\r\n        if(isStringEmpty(OldParentId) && !isStringEmpty(ParentId))\r\n        {\r\n            rProp.setFieldValue(\'custrecord_propstatus\',\'5\'); // Combined\r\n        }\r\n        if(!isStringEmpty(OldParentId) && isStringEmpty(ParentId) && ProposalStatus == \'5\')\r\n        {\r\n            rProp.setFieldValue(\'custrecord_propstatus\',\'1\'); // New\r\n            nlapiLogExecution(\'debug\',\' ProposalStatus\', ProposalStatus);\r\n        }\r\n    }\r\n}\r\n\r\n    \r\n\r\n\r\n/* ncFAR_AfterSubmitJob - Event Script to run \'After Submit\' for Job (project) records\r\n *\r\n * This function will check for the Job Status (entitystatus) of Closed (1) then check\r\n * for any assigned Assets which are marked to start depreciation on Job Completion, and\r\n * change their depreciation active status to \'Yes\'.\r\n *\r\n *\r\n * Parameters:\r\n *         type        - system parameter, one of the following strings: create,edit,delete,xedit\r\n * Returns:\r\n *         nothing\r\n */\r\nfunction ncFAR_AfterSubmitJob(type)\r\n{\r\n    if( type.toLowerCase() == \'delete\' )\r\n        return;\r\n\r\n    var rJob = nlapiGetNewRecord();\r\n    var rJobId = rJob.getId();\r\n    var JobStatus = rJob.getFieldValue(\'entitystatus\');\r\n    if( JobStatus == \'1\' )\r\n    {\r\n        /* job is now Closed - check for qualifying assets */\r\n        var SF = new Array();\r\n        SF[0] = new nlobjSearchFilter(\'custrecord_assetproject\',null,\'anyof\',[rJobId],null);\r\n        SF[1] = new nlobjSearchFilter(\'custrecord_assetdepractive\',null,\'anyof\',[\'3\'],null);\r\n        var SC = new Array();\r\n        SC[0] = new nlobjSearchColumn(\'custrecord_assetproject\');\r\n        var SR = nlapiSearchRecord(ncConst.FAR_Asset,null,SF,SC);\r\n        var i=0;\r\n        var FieldNames = new Array(\'custrecord_assetdeprstartdate\',\'custrecord_assetdepractive\');\r\n        var FieldValues = new Array(nlapiDateToString(new Date()),\'1\');\r\n        while( (SR != null) && (i < SR.length) )\r\n        {\r\n            /* update Asset Depreciation Start Date, Depreciation Active */\r\n            // nlapiSubmitField(ncConst.FAR_Asset,SR[i].getId(),FieldNames,FieldValues,false);\r\n            var rAsset = nlapiLoadRecord(ncConst.FAR_Asset,SR[i].getId());\r\n            for( var j=0; j < FieldNames.length; ++j )\r\n                rAsset.setFieldValue(FieldNames[j],FieldValues[j]);\r\n            nlapiSubmitRecord(rAsset,false);\r\n            ++i;\r\n        }\r\n    }\r\n}\r\n\r\n/* ncFAR_DepreciateAsset_v2 - Depreciate given asset\r\n *\r\n * This function will depreciate the given asset.\r\n *\r\n *\r\n * Parameters:\r\n *         rAsset            - The Asset record to be depreciated\r\n *      Journals        - Journal Entry records for depreciation postings (array)\r\n *      DeprMethods        - Depreciation Method search results (array)\r\n *      DeprFunctions    - Parsed depreciation method functions (array)\r\n *      DeprPeriodDate    - End Date for depreciation, i.e. depreciates up to this date (so can do prior month only if reqd.)\r\n *      RevalueOnly        - Boolean indicating if depreciating for revaluation calculation (thus don\'t post/update)\r\n *      UpdateEvent     - Boolean indicating if running from a User Event script, thus don\'t submit asset record but do submit others\r\n *      ProcId            - Process Id (if background)\r\n *      _timestamp        - process start time\r\n *      _timelimit        - max safe execution time\r\n *        JL                - Journal Lines hash table (array)\r\n *        ParentAssetId    - used to roll up journals by top level assets (post in summary)\r\n *        IntCurrSym        - string containing symbols of any integer currencies\r\n *        CurrSymbols        - cached array of currency id to currency symbol\r\n *        DeprMemo         - {string} Depreciation Reference sourced from Depreciation screen and used as memo text on JEs\r\n *        SubCategory     - {string} used to roll up journals by asset sub-category\r\n *        PeriodInfo        - array of accounting period records, used to check open period status\r\n *        PeriodCache        - array of cached accounting period results\r\n * Returns:\r\n *         rAssetUpdates     - An associative array containing the changed fields and their new values.\r\n */\r\nfunction ncFAR_DepreciateAsset_v2(rAsset,Journals,DeprMethods,DeprFunctions,DeprPeriodDate,RevalueOnly,UpdateEvent,ProcId,_timestamp,_timelimit,JL,ParentAssetId,IntCurrSym,CurrSymbols,DeprMemo,SubCategory,PeriodInfo,PeriodCache,GenHistOnly,SingleMethod, arrGroupMasters)\r\n{\r\n    var _failurePoint;\r\n    var _timedebug = (new Date()).getTime();\r\n    var _timelog = \'\';\r\n    var currentContext = nlapiGetContext();\r\n\r\n    var CalculateOnly = false;\r\n    var UpdateRecordOnly = false;\r\n\r\n    if( RevalueOnly != null )\r\n        CalculateOnly = RevalueOnly;\r\n\r\n    if( UpdateEvent != null )\r\n        UpdateRecordOnly = UpdateEvent;\r\n\r\n    /* anything running scheduled we don\'t want to fail, otherwise deployment is failed and dead! */\r\n    try {\r\n        // for given asset record id\r\n            // retrieve current values and accounting depr method\r\n            // determine number of periods to depr\r\n            // for each period\r\n                // invoke depr function\r\n                // build financial trn\r\n                // update asset values (locally)\r\n                // write depreciation history record\r\n            // update asset values and last depr. date (commit record)\r\n\r\n        var AssetId = rAsset.getId();\r\n        var rAssetUpdates;\r\n        var UpdatedNames;\r\n        var UpdatedValues;\r\n        var rChanged = false;\r\n\r\n        var rMethod;\r\n        var rDeprHist;\r\n        var DeprFn;\r\n        var DeprFnTok;\r\n        var DeprFnEnd;\r\n        var DeprFnPeriod;\r\n        var DeprFnFinalPeriod;\r\n        var DeprStartDate;\r\n        var newAge;\r\n        var nPeriods;\r\n        var AssetValues = new Array();\r\n        AssetValues[\'OC\'] = 0.00;\r\n        AssetValues[\'CC\'] = 0.00;\r\n        AssetValues[\'NB\'] = 0.00;\r\n        AssetValues[\'RV\'] = 0.00;\r\n        AssetValues[\'AL\'] = 0;\r\n        AssetValues[\'CP\'] = 0;\r\n        AssetValues[\'TD\'] = 0.00;\r\n        AssetValues[\'CU\'] = 0;\r\n        AssetValues[\'LU\'] = 0;\r\n        AssetValues[\'LD\'] = 0.00;\r\n        var DeprAmount = 0.00;\r\n        var TotalDeprAmount = 0.00;\r\n        var DeprExpAC;\r\n        var DeprRsrvAC;\r\n        var accts = new Array(\'0\',\'0\');\r\n        var debits = new Array(0.00, 0.00);\r\n        var credits = new Array(0.00, 0.00);\r\n        var refs = new Array(\'Asset depreciation (NC-FAM)\',\'Asset depreciation (NC-FAM)\');\r\n        var JournalId = new Array();\r\n        var rMethods = new Array();\r\n        var DeprFnToks = new Array();\r\n        var DeprFnEnds = new Array();\r\n        var DeprFnPeriods = new Array();\r\n        var DeprFnFinalPeriods = new Array();\r\n        var SkipHistory = new Array();\r\n        var tmpId;\r\n        var mn = 0;\r\n        var mnS = \'\';\r\n        var AssetValues2 = new Array();\r\n        AssetValues2[\'OC\'] = 0.00;\r\n        AssetValues2[\'CC\'] = 0.00;\r\n        AssetValues2[\'NB\'] = 0.00;\r\n        AssetValues2[\'RV\'] = 0.00;\r\n        AssetValues2[\'AL\'] = 0;\r\n        AssetValues2[\'CP\'] = 0;\r\n        AssetValues2[\'TD\'] = 0.00;\r\n        AssetValues2[\'CU\'] = 0;\r\n        AssetValues2[\'LU\'] = 0;\r\n        AssetValues2[\'LD\'] = 0.00;\r\n\r\n        rAssetUpdates = new Array();    // array to hold updated field values to be submitted later\r\n        var rGenHistUpdates = new Array();\r\n        var Subsid;\r\n        var CurrencyId;\r\n        var CurrSym = \'\';\r\n        var currName = null;\r\n        var ClassId = null;\r\n        var DepartmentId = null;\r\n        var LocationId = null;\r\n\r\n        // retrieve asset record values\r\n        _failurePoint = \'Retrieve values for asset id \'+AssetId;\r\n        \r\n        // var currentContext = nlapiGetContext();\r\n        if( SubsidiariesEnabled() )\r\n        {\r\n            Subsid = rAsset.getFieldValue(\'custrecord_assetsubsidiary\');\r\n            if(!Subsid)\r\n            {\r\n                // bad value - should have been set on asset, but maybe Subs were enabled after asset create...\r\n                // skip the asset entirely, or set current user sub as asset sub?\r\n                // safest to skip entirely, so user can correct it\r\n                return {error: \'No subsidiary set on One World Asset Id: \' + AssetId};\r\n            }\r\n            CurrencyId = nlapiLookupField(\'subsidiary\',Subsid,\'currency\', false);\r\n        }\r\n\r\n        ClassId = rAsset.getFieldValue(\'custrecord_assetclass\');\r\n        DepartmentId = rAsset.getFieldValue(\'custrecord_assetdepartment\');\r\n        LocationId = rAsset.getFieldValue(\'custrecord_assetlocation\');\r\n\r\n        TotalDeprAmount = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetdeprtodate\'),0.00);\r\n\r\n        // retrieve current values and accounting depr method\r\n        DeprExpAC = rAsset.getFieldValue(\'custrecord_assetdeprchargeacc\');\r\n        DeprRsrvAC= rAsset.getFieldValue(\'custrecord_assetdepracc\');\r\n        if( (DeprExpAC == null) || (DeprRsrvAC == null) || (rAsset.getFieldValue(\'custrecord_assettype\') == null) ) {\r\n            // don\'t depreciate if missing accounts, since cannot post the journal\r\n            return {error: \'Accounts missing or not set for asset id: \' + AssetId};\r\n        }\r\n            \r\n        \r\n        AssetValues[\'OC\'] = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetcost\'),0.00);\r\n        var assetCurrentCost = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetcurrentcost\'),NaN);\r\n        if(isNaN(assetCurrentCost))\r\n        {\r\n            assetCurrentCost = AssetValues[\'OC\'];\r\n            rAssetUpdates[\'custrecord_assetcurrentcost\'] = assetCurrentCost.toString();\r\n            rChanged = true;\r\n        }\r\n        AssetValues[\'CC\'] = assetCurrentCost;\r\n        AssetValues[\'NB\'] = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetbookvalue\'),0.00);\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'NB\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprnbv\'],AssetValues[\'NB\']);\r\n        }\r\n\r\n        AssetValues[\'RV\'] = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetresidualvalue\'),0.00);\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'RV\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprrv\'],0.00);\r\n        }\r\n\r\n        AssetValues[\'AL\'] = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetlifetime\'),0);\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'AL\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprlifetime\'],0);\r\n        }\r\n\r\n        AssetValues[\'CP\'] = ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetcurrentage\'),0);\r\n\r\n        AssetValues[\'CP_0\'] = AssetValues[\'CP\'];    // used as true age, because pro-rata has to play with CP value\r\n\r\n        AssetValues[\'TD\'] = AssetValues[\'OC\'] - AssetValues[\'RV\'];\r\n        AssetValues[\'LU\'] = ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetlifeunits\'),0);\r\n        AssetValues[\'LD\'] = ncParseFloatNV(rAsset.getFieldValue(\'custrecord_assetlastdepramt\'),0.00);\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'LD\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprld\'],0);\r\n        }\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'FY\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprfinancialyear\'],1);\r\n        }\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'PB\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprpriornbv\'],assetCurrentCost);\r\n        }\r\n\r\n\r\n        AssetValues[\'C\'] = ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetconvention\'),1);\r\n\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            AssetValues[\'C\' + i] = ncParseFloatNV(OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprconvention\'],1);\r\n        }\r\n\r\n        AssetValues2[\'OC\'] = AssetValues[\'OC\'];\r\n        AssetValues2[\'CC\'] = AssetValues[\'CC\'];\r\n        AssetValues2[\'TD\'] = AssetValues[\'TD\'];\r\n        AssetValues2[\'LU\'] = AssetValues[\'LU\'];\r\n        var assetQty = Math.round(ncParseFloatNV(rAsset.getFieldValue(\'custrecord_ncfar_quantity\'),1.00));\r\n\r\n        // CS 14/5/09\r\n        var l_StoreHistory = rAsset.getFieldValue(\'custrecord_storedeprhist\');\r\n\r\n        rAssetUpdates[\'custrecord_assetfixedexrate\'] = \'1.00000\';\r\n        \r\n\r\n\r\n        DeprStartDate = ncStringToDate(rAsset.getFieldValue(\'custrecord_assetdeprstartdate\'), new Date(DeprPeriodDate));\r\n        if( rAsset.getFieldValue(\'custrecord_assetdeprstartdate\') != nlapiDateToString(DeprStartDate) )\r\n        {\r\n            // capture start date as an \'update\' as we have just defaulted it\r\n            rAssetUpdates[\'custrecord_assetdeprstartdate\'] = nlapiDateToString(DeprStartDate);\r\n            rChanged = true;\r\n        }\r\n        var defaultEndDate = new Date(DeprStartDate);\r\n        defaultEndDate = nlapiAddMonths(defaultEndDate,AssetValues[\'AL\']);\r\n        var DeprEndDate = ncStringToDate(rAsset.getFieldValue(\'custrecord_assetdeprenddate\'), defaultEndDate);\r\n\r\n        // check for asset acquisition history record - if not already written, write one now (for reporting use)\r\n        if( rAsset.getFieldValue(\'custrecord_assetacqstatus\') != \'T\' )\r\n        {\r\n            /* acquisition history not found, so create it now */\r\n            // the flag on the asset record was a way to save units, i.e. not perform a search every time\r\n            // however, the flag is often wrong for imported records, so if the flag is not set still\r\n            // use a search to verify it.  Once set, we still avoid the search so still save units most of the time\r\n            _failurePoint = \'Search for Asset Acquisition history record\';\r\n            var sfAQ = new Array();\r\n            sfAQ[0] = new nlobjSearchFilter(\'custrecord_deprhistasset\', null, \'anyof\', [AssetId], null);\r\n            sfAQ[1] = new nlobjSearchFilter(\'custrecord_deprhisttype\', null, \'anyof\', [\'1\'], null);\r\n            sfAQ[2] = new nlobjSearchFilter( \'custrecord_deprhistory_schedule\',null,\'is\',\'F\',null); // vls\r\n            var scAQ = new nlobjSearchColumn(\'custrecord_deprhistasset\');\r\n            var srAQ = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfAQ,scAQ);\r\n            if( (srAQ == null) || (srAQ.length == 0) )\r\n            {\r\n                // confirmed, no record exists\r\n                _failurePoint = \'Write Asset Acquisition history record\';\r\n                rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                // need to include asset type and history record type (but need to make the fields too)\r\n                if( Subsid != null )\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', Subsid);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', rAsset.getFieldValue(\'custrecord_assettype\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\');    // acquisition\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetId);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(DeprStartDate));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistamount\', rAsset.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', rAsset.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                // CS 14/5/09 - set Depr Meth too\r\n                //23/8/2010\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', assetQty);\r\n                nlapiSubmitRecord(rDeprHist,false);\r\n\r\n                if(l_StoreHistory == \'T\')\r\n                {\r\n                    var AdjAcqDate;\r\n                    for(var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++)\r\n\r\n                    {\r\n                        if(!OBJ_ncFAR_ALTDEPR.readRecords[i][\'skip\'])\r\n\r\n                        {\r\n                            _failurePoint = \'Write Aquisition History for Other Methods\';\r\n\r\n                            // adjust Acquisition Date for convention\r\n                            switch(AssetValues[\'C\'+i])\r\n                            {\r\n                                case 1: // None\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    break;\r\n                                case 2: // Half-Year\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    AdjAcqDate.setDate(1);\r\n                                    // AdjAcqDate.setMonth(6);    // move to 1st July, same year\r\n                                    AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+i], 6);     // PSG 4807, 2011-07-11, Move to period 7 [start+6]\r\n                                    break;\r\n                                case 3: // Mid-Quarter\r\n                                    // determine quarter\r\n                                    // switch(DeprStartDate.getMonth())\r\n                                    switch(ncFAR_GetRelativeMonth(DeprStartDate, AssetValues[\'FY\'+i]))     // PSG 4807, 2011-07-11\r\n                                    {\r\n                                        case 0:\r\n                                        case 1:\r\n                                        case 2:\r\n                                            AdjAcqDate = new Date(DeprStartDate);\r\n                                            AdjAcqDate.setDate(15);\r\n                                            // AdjAcqDate.setMonth(1);    // move to 15th February, same year\r\n                                            AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+i], 1);     // PSG 4807, 2011-07-11, Move to period 2 [start+1]\r\n                                            break;\r\n                                        case 3:\r\n                                        case 4:\r\n                                        case 5:\r\n                                            AdjAcqDate = new Date(DeprStartDate);\r\n                                            AdjAcqDate.setDate(15);\r\n                                            // AdjAcqDate.setMonth(4);    // move to 15th May, same year\r\n                                            AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+i], 4);     // PSG 4807, 2011-07-11, Move to period 5 [start+4]\r\n                                            break;\r\n                                        case 6:\r\n                                        case 7:\r\n                                        case 8:\r\n                                            AdjAcqDate = new Date(DeprStartDate);\r\n                                            AdjAcqDate.setDate(15);\r\n                                            // AdjAcqDate.setMonth(7);    // move to 15th August, same year\r\n                                            AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+i], 7);     // PSG 4807, 2011-07-11, Move to period 8 [start+7]\r\n                                            break;\r\n                                        case 9:\r\n                                        case 10:\r\n                                        case 11:\r\n                                            AdjAcqDate = new Date(DeprStartDate);\r\n                                            AdjAcqDate.setDate(15);\r\n                                            AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+i], 10);     // PSG 4807, 2011-07-11, Move to period 11 [start+10]\r\n                                            break;\r\n                                    }\r\n                                    break;\r\n                                case 4: // Mid-Month\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    break;\r\n                                default: // should never occur\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    break;\r\n                            }\r\n\r\n                            rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                            if( Subsid != null )\r\n                                rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', Subsid);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', rAsset.getFieldValue(\'custrecord_assettype\'));\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\');    // acquisition\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetId);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(AdjAcqDate));\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistamount\', rAsset.getFieldValue(\'custrecord_assetbookvalue\'));\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', rAsset.getFieldValue(\'custrecord_assetbookvalue\'));\r\n//                            rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', i+1);\r\n                            //jgutana\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistaltmethod\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdepraltmethod\']);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistdeprmethod\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprmethod\']);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistaltdepr\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'internalid\']);\r\n\r\n\r\n                            //22/08/2010\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', assetQty);\r\n\r\n                            nlapiSubmitRecord(rDeprHist,false);\r\n                        }\r\n                    }\r\n                }\r\n\r\n            }\r\n            // and update field on Asset so we don\'t do it again\r\n            rAssetUpdates[\'custrecord_assetacqstatus\'] = \'T\';\r\n            rChanged = true;\r\n        }\r\n\r\n        if( (GenHistOnly == \'T\') && (l_StoreHistory == \'T\') )\r\n        {\r\n            // if acq. record already exists, assume full history already exists, so skip this asset\r\n            _failurePoint = \'Search for Asset Acquisition history record\';\r\n            var sfAQ = new Array();\r\n            sfAQ[0] = new nlobjSearchFilter(\'custrecord_deprhistasset\', null, \'anyof\', [AssetId], null);\r\n            sfAQ[1] = new nlobjSearchFilter(\'custrecord_deprhisttype\', null, \'anyof\', [\'1\'], null);\r\n            sfAQ[2] = new nlobjSearchFilter(\'custrecord_deprhistaltdepr\', null, \'anyof\', OBJ_ncFAR_ALTDEPR.readRecords[SingleMethod][\'internalid\'], null);\r\n\r\n            sfAQ[3] = new nlobjSearchFilter( \'custrecord_deprhistory_schedule\',null,\'is\',\'F\',null ); // vls\r\n            var scAQ = new nlobjSearchColumn(\'custrecord_deprhistasset\');\r\n            var srAQ = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfAQ,scAQ);\r\n            if( (srAQ == null) || (srAQ.length == 0) )\r\n            {\r\n                // add acq. record for selected method\r\n                var AdjAcqDate;\r\n\r\n                if(!OBJ_ncFAR_ALTDEPR.readRecords[SingleMethod][\'skip\'])\r\n\r\n                {\r\n                    _failurePoint = \'Write Aquisition History for Single Method\';\r\n\r\n                    // adjust Acquisition Date for convention\r\n                    switch(AssetValues[\'C\'+SingleMethod])\r\n                    {\r\n                        case 1: // None\r\n                            AdjAcqDate = new Date(DeprStartDate);\r\n                            break;\r\n                        case 2: // Half-Year\r\n                            AdjAcqDate = new Date(DeprStartDate);\r\n                            AdjAcqDate.setDate(1);\r\n                            // AdjAcqDate.setMonth(6);    // move to 1st July, same year\r\n                            AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+SingleMethod], 6);     // PSG 4807, 2011-07-11, Move to period 7 [start+6]\r\n                            break;\r\n                        case 3: // Mid-Quarter\r\n                            // determine quarter\r\n                            //switch(DeprStartDate.getMonth())\r\n                            switch(ncFAR_GetRelativeMonth(DeprStartDate, AssetValues[\'FY\'+SingleMethod]))     // PSG 4807, 2011-07-11\r\n                            {\r\n                                case 0:\r\n                                case 1:\r\n                                case 2:\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    AdjAcqDate.setDate(15);\r\n                                    // AdjAcqDate.setMonth(1);    // move to 15th February, same year\r\n                                    AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+SingleMethod], 1);     // PSG 4807, 2011-07-11, Move to period 2 [start+1]\r\n                                    break;\r\n                                case 3:\r\n                                case 4:\r\n                                case 5:\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    AdjAcqDate.setDate(15);\r\n                                    // AdjAcqDate.setMonth(4);    // move to 15th May, same year\r\n                                    AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+SingleMethod], 4);     // PSG 4807, 2011-07-11, Move to period 5 [start+4]\r\n                                    break;\r\n                                case 6:\r\n                                case 7:\r\n                                case 8:\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    AdjAcqDate.setDate(15);\r\n                                    // AdjAcqDate.setMonth(7);    // move to 15th August, same year\r\n                                    AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+SingleMethod], 7);     // PSG 4807, 2011-07-11, Move to period 8 [start+7]\r\n                                    break;\r\n                                case 9:\r\n                                case 10:\r\n                                case 11:\r\n                                    AdjAcqDate = new Date(DeprStartDate);\r\n                                    AdjAcqDate.setDate(15);\r\n                                    // AdjAcqDate.setMonth(10);    // move to 15 November, same year\r\n                                    AdjAcqDate = ncFAR_SetRelativeMonth(AdjAcqDate, AssetValues[\'FY\'+SingleMethod], 10);     // PSG 4807, 2011-07-11, Move to period 11 [start+10]\r\n                                    break;\r\n                            }\r\n                            break;\r\n                        case 4: // Mid-Month\r\n                            AdjAcqDate = new Date(DeprStartDate);\r\n                            break;\r\n                        default: // should never occur\r\n                            AdjAcqDate = new Date(DeprStartDate);\r\n                            break;\r\n                    }\r\n\r\n                    rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                    if( Subsid != null )\r\n                        rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', Subsid);\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', rAsset.getFieldValue(\'custrecord_assettype\'));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'1\');    // acquisition\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetId);\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(AdjAcqDate));\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistamount\', AssetValues[\'NB\'+SingleMethod]);\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetValues[\'NB\'+SingleMethod]);\r\n//                    rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', SingleMethod+1);\r\n                    //jgutana\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistaltmethod\', OBJ_ncFAR_ALTDEPR.readRecords[SingleMethod][\'custrecord_altdepraltmethod\']);\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistdeprmethod\', OBJ_ncFAR_ALTDEPR.readRecords[SingleMethod][\'custrecord_altdeprmethod\']);\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistaltdepr\', OBJ_ncFAR_ALTDEPR.readRecords[SingleMethod][\'internalid\']);\r\n\r\n                    //22/08/2010\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', assetQty);\r\n\r\n                    nlapiSubmitRecord(rDeprHist,false);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                // already got history, bail out...\r\n                return(rAssetUpdates);\r\n            }\r\n        }\r\n\r\n        rMethod = rAsset.getFieldValue(\'custrecord_assetaccmethod\');\r\n        _failurePoint = \'Read depr method cache for method \'+rMethod;\r\n        DeprFn = DeprMethods[rMethod].getValue(\'custrecord_deprmethodformula\');\r\n        DeprFnEnd = ncParseIntNV(DeprMethods[rMethod].getValue(\'custrecord_deprmethodendperiod\'),0);\r\n        DeprFnPeriod = DeprMethods[rMethod].getValue(\'custrecord_deprmethoddeprperiod\');\r\n        DeprFnFinalPeriod = DeprMethods[rMethod].getValue(\'custrecord_deprmethod_final_convention\') || FINAL_CONVENTION_FULLYDEPRECIATE;\r\n        \r\n        DeprFnTok = DeprFunctions[rMethod];\r\n\r\n        /* check for additional depreciation methods */\r\n        \r\n        var DeprFnCP = [];\r\n        //jgutana\r\n        for (var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++) {\r\n            tmpId = OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprmethod\'];\r\n            if( (tmpId != null) && (tmpId != \'\') ) {\r\n                _failurePoint = \'Read depr method cache for method \'+tmpId;\r\n                rMethods[i+\'\'] = tmpId;\r\n                DeprFnToks[i+\'\'] = DeprFunctions[tmpId];\r\n                DeprFnEnds[i+\'\'] = ncParseIntNV(DeprMethods[tmpId].getValue(\'custrecord_deprmethodendperiod\'),0);\r\n                DeprFnPeriods[i+\'\'] = DeprMethods[tmpId].getValue(\'custrecord_deprmethoddeprperiod\');\r\n                DeprFnFinalPeriods[i+\'\'] = DeprMethods[tmpId].getValue(\'custrecord_deprmethod_final_convention\') || FINAL_CONVENTION_FULLYDEPRECIATE;\r\n                DeprFnCP[i+\'\'] = 1;\r\n                \r\n                if ((DeprFnPeriods[i] == DEPR_PERIOD_ANNUALLY) && (AssetValues[\'CP\'] >= AssetValues[\'FY\' + i])) {\r\n                    \r\n                    \r\n                    if (DeprStartDate.getMonth() + 1 != AssetValues[\'FY\' + i]) {\r\n                        DeprFnCP[i]++;\r\n                    }\r\n                    \r\n                    var tempCP = AssetValues[\'CP\'] - AssetValues[\'FY\' + i] - 12;\r\n                    while ((tempCP) >= 0) {\r\n                        DeprFnCP[i]++;\r\n                        tempCP -= 12;    \r\n                    }\r\n                } \r\n            } else {\r\n                rMethods[i+\'\'] = \'\';\r\n            }\r\n        }\r\n\r\n        _failurePoint = \'Calculate depr periods\';\r\n        // if Depr Rule = Mid-month, need to decide if initial month (date <= 15th) or next month (>15th)\r\n        // Adjust DeprStartDate now, so used consistently through rest of script\r\n        // custrecord_assetdeprrules : 1=Acquisition, 2=Disposal, 3=Pro-Rata, 4=Mid-Month\r\n        if( ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetdeprrules\'),0) == 4 )\r\n        {\r\n            if( DeprStartDate.getDate() > 15 )\r\n            {\r\n                DeprStartDate = nlapiAddMonths(DeprStartDate,1);\r\n            }\r\n        }        \r\n\r\n        var PRfactor = 1.0;    // factor for Pro-rata depreciation\r\n        // determine number of periods to depr\r\n        var PeriodDate = new Date(DeprStartDate);\r\n        var m = AssetValues[\'CP\'];\r\n        // compare DeprStartDate with new Date() to determine newAge\r\n        newAge = ncGetAgeInMonths(DeprStartDate,DeprPeriodDate);\r\n\r\n        if (GenHistOnly==\'T\')\r\n        {\r\n            m = 0;\r\n            newAge = AssetValues[\'CP\'];\r\n            AssetValues[\'CP\'] = 0;\r\n//            AssetValues[\'CP0\'] = 0;\r\n            //jgutana\r\n            AssetValues[\'CP_0\'] = 0;\r\n\r\n        }\r\n\r\n        // if Depr Rule = Acquisition, need to depr in first month (& not last) so incr Age by 1 period\r\n        // custrecord_assetdeprrules : 1=Acquisition, 2=Disposal, 3=Pro-Rata\r\n        if( ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetdeprrules\'),0) != 2 )\r\n        {\r\n            ++newAge;    // age as one month older\r\n            --m;        // but set date back one month, else depreciates into next month (one older)\r\n        }\r\n\r\n        // num periods to depreciate = new Age - Last Depr Age\r\n        nPeriods = Math.ceil(newAge - AssetValues[\'CP\']);    // Math.ceil = ceiling = round up\r\n\r\n        // Depreciation transaction date - should it be start of month, end of month, mid-month, rolling fwd from acquisition date, rolling bwd from current date?\r\n        // set up PeriodDate to 1st of the month for last depreciation\r\n        PeriodDate.setDate(1);    // set day of month\r\n        PeriodDate = nlapiAddMonths(PeriodDate,m);\r\n        // set up Usage date range\r\n        var UsageStartDate = new Date(PeriodDate);\r\n        var UsageEndDate = new Date(PeriodDate);\r\n        UsageEndDate = nlapiAddMonths(UsageEndDate,1);\r\n\r\n// change of plan - set to last day of the month...\r\n        PeriodDate = ncGetEndOfMonth(PeriodDate);\r\n        /*\r\n        PeriodDate = nlapiAddMonths(PeriodDate,1);    // from 1st of the month, add a month, subtract a day = last day of month\r\n        PeriodDate = new Date(PeriodDate - 86400000); // 24 hrs x 60 mins x 60 secs x 1000 millisecs = 86400000\r\n        */\r\n\r\n        var NextPeriod = new Date(PeriodDate); // never, EVER, set MyDate = MyExistingDate, unless you REALLY want one instance\r\n        NextPeriod = nlapiAddMonths(NextPeriod,1);\r\n        NextPeriod = ncGetEndOfMonth(NextPeriod);    // reset EoM, so 30 June -> 30 July becomes 31 July\r\n\r\n        _failurePoint = \'Period depreciation\';\r\n\r\n        var bAbort = false;\r\n        var p=0;\r\n        var uTarget=0;\r\n        var uRem=0;\r\n        var iRem=0;\r\n        var tUsed=0;\r\n        var endOfLifeAccounting;\r\n        var endofLifeAlternate;\r\n\r\n        /* determine whether old site (2008.n) or new site (2009.1) and thus which governance methods apply */\r\n        var nsVer = \'2008\';\r\n\r\n        if( \'getPercentComplete\' in currentContext )\r\n            if( typeof( currentContext[\'getPercentComplete\'] ) == \'function\' )\r\n            {\r\n                nsVer = \'2009\';\r\n            }\r\n        // or check first 4 characters of currentContext.getVersion()\r\n\r\n        // for each period ...\r\n        if( ( nPeriods == 0 ) && ( newAge > 0 ) )\r\n            nPeriods = 1;    // always try once, to force end-of-life if all methods finally completed\r\n\r\n        while( (!bAbort) && (p<nPeriods) )\r\n        {\r\n            _failurePoint = \'Period depreciation - set up values\';\r\n\r\n            endOfLifeAccounting = true;    // start off assuming this period will be the last - clear this flag below if we find otherwise\r\n            endofLifeAlternate = true;    // start off assuming this period will be the last - variable use for alternate depreciation\r\n\r\n            //jgutana\r\n            AssetValues[\'CP_0\'] = AssetValues[\'CP_0\'] + 1;\r\n            AssetValues[\'CP\'] = AssetValues[\'CP_0\'];\r\n\r\n\r\n            PRfactor = 1.0;\r\n            if( ncParseIntNV(rAsset.getFieldValue(\'custrecord_assetdeprrules\'),0) == 3 )\r\n            {\r\n                // first or last period, so calculate factor\r\n                var daysInPeriod;\r\n\r\n                daysInPeriod = 30 - (DeprStartDate.getDate()-1);\r\n                if( daysInPeriod < 1 )\r\n                    daysInPeriod = 1;\r\n                // if Date == EOM, days = 30, so 28th Feb = 30 days as full \'std\' month\r\n                var testDate = new Date(DeprStartDate+86400000); // 24 hrs x 60 mins x 60 secs x 1000 millisecs = 86400000\r\n                if( testDate.getDate() == 1 )\r\n                    daysInPeriod = 1; // last day of the month, so only one day\r\n\r\n                PRfactor = daysInPeriod / 30.0;\r\n                // for normal (full) periods, adjust age and reset factor to do a full month\r\n                // adjusted age ensures methods based upon CP work correctly\r\n                if( AssetValues[\'CP\'] != 1 )\r\n                {\r\n                    AssetValues[\'CP\'] -= (1 - PRfactor);\r\n                    PRfactor = 1.0;    // reset to full month\r\n                }\r\n\r\n                if( AssetValues[\'CP\'] >= AssetValues[\'AL\'] )    // final period\r\n                {\r\n                    daysInPeriod = DeprEndDate.getDate();\r\n                    // if Date == EOM, days = 30, so 28th Feb = 30 days as full \'std\' month\r\n                    var testDate = new Date(DeprEndDate+86400000); // 24 hrs x 60 mins x 60 secs x 1000 millisecs = 86400000\r\n                    if( testDate.getDate() == 1 )\r\n                        daysInPeriod = 30;\r\n\r\n                    PRfactor = daysInPeriod / 30.0;\r\n                }\r\n            }\r\n\r\n            PeriodDate = nlapiAddMonths(PeriodDate,1);\r\n            PeriodDate = ncGetEndOfMonth(PeriodDate);    // reset EoM\r\n            NextPeriod = nlapiAddMonths(NextPeriod,1);\r\n            NextPeriod = ncGetEndOfMonth(NextPeriod);    // reset EoM\r\n            UsageStartDate = nlapiAddMonths(UsageStartDate,1);\r\n            UsageEndDate = nlapiAddMonths(UsageEndDate,1);\r\n            if( PeriodDate.valueOf() < DeprStartDate.valueOf() )\r\n                PeriodDate = new Date(DeprStartDate);\r\n\r\n            _failurePoint = \'Period depreciation - roll-over methods\';\r\n            while( (DeprFnEnd > 0) && (AssetValues[\'CP\'] > DeprFnEnd) )\r\n            {\r\n                // asset aged past switch-over point, so use next method...\r\n                if( DeprMethods[rMethod].getValue(\'custrecord_deprmethodnextmethod\') != null )\r\n                {\r\n                    rMethod = DeprMethods[rMethod].getValue(\'custrecord_deprmethodnextmethod\');\r\n                    if( DeprMethods[rMethod] != null )\r\n                    {\r\n                        DeprFn = DeprMethods[rMethod].getValue(\'custrecord_deprmethodformula\');\r\n                        DeprFnEnd = ncParseIntNV(DeprMethods[rMethod].getValue(\'custrecord_deprmethodendperiod\'),0);\r\n                        DeprFnPeriod = DeprMethods[rMethod].getValue(\'custrecord_deprmethoddeprperiod\');\r\n                        DeprFnFinalPeriod = DeprMethods[rMethod].getValue(\'custrecord_deprmethod_final_convention\') || FINAL_CONVENTION_FULLYDEPRECIATE;\r\n                        DeprFnTok = DeprFunctions[rMethod];\r\n                    }\r\n                    else\r\n                        ncLogExecution(\'debug\',\'Depreci\r\nMethod has null cache entry\',rMethod);\r\n                }\r\n                else\r\n                    ncLogExecution(\'debug\',\'Depreciation Method has null Next Method!\',rMethod);\r\n            }\r\n\r\n            //jgutana\r\n            for (var mn=0; mn<OBJ_ncFAR_ALTDEPR.readRecords.length; mn++)\r\n\r\n            {\r\n                mnS = mn.toString();\r\n                if( rMethods[mnS] != \'\' )\r\n                {\r\n                    if ( AssetValues[\'CP\'] > 1 ) {\r\n                        if ( DeprFnPeriods[mnS] == DEPR_PERIOD_MONTHLY ) {\r\n                            DeprFnCP[mnS] = AssetValues[\'CP\'];                            \r\n                        }\r\n                        else if ( (ncFAR_GetRelativeMonth( PeriodDate, AssetValues[\'FY\'+mnS] ) == 0) ) { \r\n                            ++DeprFnCP[mnS];\r\n                        }\r\n                    }\r\n\r\n\r\n\r\n                    // VS while( (DeprFnEnds[mnS] > 0) && (AssetValues[\'CP\'] > DeprFnEnds[mnS]) )\r\n                    while( (DeprFnEnds[mnS] > 0) && (DeprFnCP[mnS] > DeprFnEnds[mnS]) )\r\n                    {\r\n                        // asset aged past switch-over point, so use next method...\r\n                        if( DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethodnextmethod\') != null )\r\n                        {\r\n                            rMethods[mnS] = DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethodnextmethod\');\r\n                            if( DeprMethods[rMethods[mnS]] != null )\r\n                            {\r\n                                DeprFnEnds[mnS] = ncParseIntNV(DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethodendperiod\'),0);\r\n                                DeprFnPeriods[mnS] = DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethoddeprperiod\');\r\n                                DeprFnFinalPeriods[mnS] = DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethod_final_convention\') || FINAL_CONVENTION_FULLYDEPRECIATE;\r\n                                DeprFnToks[mnS] = DeprFunctions[rMethods[mnS]];\r\n                            }\r\n                            else\r\n                                ncLogExecution(\'debug\',\'Depreciation Method has null cache entry\',rMethods[mnS]);\r\n                        }\r\n                        else\r\n                            ncLogExecution(\'debug\',\'Depreciation Method has null Next Method!\',rMethods[mnS]);\r\n                    }\r\n                    \r\n                    nlapiLogExecution(\'DEBUG\', \'FAM - ncFAR_DepreciateAsset_v2\', \'AssetValues[CP]: \' + AssetValues[\'CP\']                    \r\n                    + \'  |  DeprFnCP[mnS]: \' + DeprFnCP[mnS]\r\n                    + \'  |  PeriodDate: \' + PeriodDate\r\n                    + \'  |  DeprFnEnds[mnS]: \' + DeprFnEnds[mnS]);\r\n\r\n                }\r\n            }\r\n\r\n            _failurePoint = \'Period depreciation - calculate usage\';\r\n            AssetValues[\'CU\'] = 0;\r\n            /* usage: search ncConst.FAR_AssetUsage records for current asset where date in current period, retrieve sum of usage units */\r\n            // if Lifetime Units is zero, cannot be depreciating based upon usage so skip this search...\r\n            if( AssetValues[\'LU\'] > 0 )\r\n            {\r\n                var srchCUFilters = new Array();\r\n                srchCUFilters[0] = new nlobjSearchFilter(\'custrecord_usageassetid\',null,\'anyof\',[AssetId],null);\r\n                srchCUFilters[1] = new nlobjSearchFilter(\'custrecord_usagedate\',null,\'onorafter\',nlapiDateToString(UsageStartDate),null);\r\n                srchCUFilters[2] = new nlobjSearchFilter(\'custrecord_usagedate\',null,\'before\',nlapiDateToString(UsageEndDate),null);\r\n                var srchCUCol = new nlobjSearchColumn(\'custrecord_usageunits\',null,\'sum\');\r\n                var srchCUResult = nlapiSearchRecord(ncConst.FAR_AssetUsage,null,srchCUFilters,srchCUCol);\r\n                if( (srchCUResult != null) && (srchCUResult.length > 0) )\r\n                {\r\n                    AssetValues[\'CU\'] = ncParseIntNV(srchCUResult[0].getValue(\'custrecord_usageunits\',null,\'sum\'),0);\r\n                }\r\n            }\r\n\r\n            // invoke depr function\r\n            // now check period, since main method may be complete but other methods still running...\r\n            if( AssetValues[\'CP\'] <= AssetValues[\'AL\'] )\r\n            {\r\n                _failurePoint = \'Period depreciation - calling depr fn\';\r\n                DeprAmount = ncRoundCurr( ncFAR_ExecFormula(DeprFnTok,AssetValues) * PRfactor, CurrSym, IntCurrSym );\r\n                rAssetUpdates[\'custrecord_assetstatus\'] = \'2\';    // status: depreciating\r\n            }\r\n            else\r\n                DeprAmount = 0.00;\r\n\r\n            rChanged = true;\r\n\r\n            _failurePoint = \'Period depreciation - test end of life\';\r\n            var tempNb = ncRound2(AssetValues[\'NB\']-DeprAmount);\r\n             //Check end of life and/or readjust depreciation amount if necessary\r\n            if( AssetValues[\'CP\'] < AssetValues[\'AL\'] )\r\n            {\r\n                //Asset depreciation continues\r\n                endOfLifeAccounting = false;\r\n                if(Math.abs(tempNb) < Math.abs(AssetValues[\'RV\'])) {\r\n                    DeprAmount = ncRoundCurr(AssetValues[\'NB\'] -AssetValues[\'RV\'],CurrSym,IntCurrSym); \r\n                }\r\n                \r\n            } else if (DeprFnFinalPeriod == FINAL_CONVENTION_FULLYDEPRECIATE){\r\n                    DeprAmount = ncRoundCurr(AssetValues[\'NB\'] -AssetValues[\'RV\'],CurrSym,IntCurrSym);\r\n            } else if (DeprFnFinalPeriod == FINAL_CONVENTION_RETAINBALANCE){\r\n                     if(Math.abs(tempNb) < Math.abs(AssetValues[\'RV\'])) {\r\n                    DeprAmount = ncRoundCurr(AssetValues[\'NB\'] -AssetValues[\'RV\'],CurrSym,IntCurrSym); \r\n                }\r\n            }            \r\n            \r\n            AssetValues[\'LD\'] = DeprAmount;\r\n            AssetValues2[\'CU\'] = AssetValues[\'CU\'];\r\n\r\n            //jgutana\r\n            for (mn=0; mn<OBJ_ncFAR_ALTDEPR.readRecords.length; mn++)\r\n            {\r\n                if (GenHistOnly==\'T\')\r\n                {\r\n                    mn = SingleMethod;\r\n                }\r\n\r\n                _failurePoint = \'Period depreciation - set up values for sub method\';\r\n                AssetValues2[\'CP\'] = AssetValues[\'CP\'];\r\n                mnS = mn.toString();\r\n                if( rMethods[mnS] != \'\' )\r\n                {\r\n                    var altMethod = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepraltmethod\'];\r\n                    var groupDepreciation = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepr_groupdepreciation\'];\r\n                    var groupMaster = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepr_groupmaster\'];\r\n                    var periodConvention = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdeprperiodconvention\'];\r\n                    var depreciationPeriod = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepr_depreciationperiod\'];\r\n                    var noOfDaysInMonth = 30 ;\r\n                    noOfDaysInMonth = daysInMonth(PeriodDate.getMonth(), PeriodDate.getFullYear() );\r\n                    \r\n                    if ( (AssetValues[\'CP\'] == 1) && ( DeprStartDate.getDate() != 1) ){\r\n                        noOfDaysInMonth -= (DeprStartDate.getDate() - 1);\r\n                        nlapiLogExecution(\'DEBUG\', \'FAM - ncFAR_DepreciateAsset_v2\', \'noOfDaysInMonth: \' + noOfDaysInMonth );\r\n                    }\r\n                    \r\n                    if ((arrGroupMasters && arrGroupMasters[ altMethod ] ) && ( groupDepreciation == \'T\' )\r\n                            && ( groupMaster != \'T\' ) ) {\r\n                        nlapiLogExecution(\'DEBUG\', \'FAM - ncFAR_DepreciateAsset_v2\', \'Skipping Method: \' + altMethod\r\n                                + \'. This is a Group Depreciation method.\');\r\n                        continue;\r\n                    }\r\n                    //if( (DeprFnPeriods[mnS] == \'1\') || (PeriodDate.getMonth() == 11) )    // if Monthly or December\r\n                    if( (DeprFnPeriods[mnS] == \'1\') || (ncFAR_GetRelativeMonth(PeriodDate, AssetValues[\'FY\'+mnS]) == 11) )    // PSG 4807, 2011-07-11\r\n                    {\r\n                        SkipHistory[mn] = \'F\';\r\n                        if( DeprFnPeriods[mnS] == \'2\' )\r\n                        {\r\n                            // annual, so re-express CP as number of years... CP/12 round up\r\n                            AssetValues2[\'CP\'] = Math.ceil( AssetValues[\'CP\']/12 );\r\n                        }\r\n\r\n                        // adjust \'age\' for convention - if first period, adjust PRfactor too\r\n                        switch(AssetValues[\'C\'+mnS])\r\n                        {\r\n                            case 1: // None\r\n                                PRfactor = 1.0;\r\n                                break;\r\n                            case 2: // Half-Year\r\n                                PRfactor = 0.5;\r\n                                AssetValues2[\'CP\'] -= PRfactor;\r\n                                break;\r\n                            case 3: // Mid-Quarter\r\n                                // determine quarter, use 1.5 + (3 per full quarter) / 12\r\n                            //switch(DeprStartDate.getMonth())\r\n                            switch(ncFAR_GetRelativeMonth(DeprStartDate, AssetValues[\'FY\'+mnS]))     // PSG 4807, 2011-07-11\r\n                                {\r\n                                    case 0:\r\n                                    case 1:\r\n                                    case 2:\r\n                                        PRfactor = (10.5 / 12.0);\r\n                                        break;\r\n                                    case 3:\r\n                                    case 4:\r\n                                    case 5:\r\n                                        PRfactor = (7.5 / 12.0);\r\n                                        break;\r\n                                    case 6:\r\n                                    case 7:\r\n                                    case 8:\r\n                                        PRfactor = (4.5 / 12.0);\r\n                                        break;\r\n                                    case 9:\r\n                                    case 10:\r\n                                    case 11:\r\n                                        PRfactor = (1.5 / 12.0);\r\n                                        break;\r\n                                }\r\n                                AssetValues2[\'CP\'] -= PRfactor;\r\n                                break;\r\n                            case 4: // Mid-Month\r\n                                // determine month, use 0.5 + (no. of full months) / 12\r\n                                PRfactor = 0.5; // PRfactor = (0.5 + 11 - DeprStartDate.getMonth()) / 12.0;\r\n                                AssetValues2[\'CP\'] -= 0.5;\r\n                                if( AssetValues2[\'CP\'] < 1 )\r\n                                    AssetValues2[\'CP\'] = 1;\r\n                                break;\r\n                            default: // should never occur\r\n                                PRfactor = 1.0;\r\n                                break;\r\n                        }\r\n\r\n                        if( AssetValues2[\'CP\'] > 1 )\r\n                        {\r\n                            PRfactor = 1.0;\r\n                        }\r\n\r\n                        AssetValues2[\'NB\'] = AssetValues[\'NB\'+mnS];\r\n                        AssetValues2[\'LD\'] = AssetValues[\'LD\'+mnS];\r\n                        AssetValues2[\'RV\'] = AssetValues[\'RV\'+mnS];\r\n                        AssetValues2[\'AL\'] = AssetValues[\'AL\'+mnS];\r\n                        AssetValues2[\'PB\'] = AssetValues[\'PB\'+mnS];     // PSG 4807, 2011-07-11\r\n                        /* need to calculate days held in current \'year\'     // PSG 4807, 2011-07-11\r\n                         * this depends upon whether or not the year is a leap year\r\n                         * and whether the asset was acquired within the year, or will be disposed of within the year\r\n                         */\r\n                        var StartOfPeriod = new Date(PeriodDate);\r\n                        StartOfPeriod.setDate(1);    // 1st of month\r\n                        StartOfPeriod = ncFAR_SetRelativeMonth(StartOfPeriod, AssetValues[\'FY\'+mnS], 0);    // reset to start of \'year\'\r\n                        var StartOfNextPeriod = new Date(StartOfPeriod);\r\n                        StartOfNextPeriod.setFullYear(StartOfPeriod.getFullYear()-1);\r\n                        var Feb1st = new Date(PeriodDate);\r\n                        Feb1st.setFullYear(Feb1st.getFullYear(),1,1);    // 1st Feb, same year\r\n                        if (Feb1st < StartOfPeriod)    // make sure we get the 1st Feb within the current \'year\'\r\n                            Feb1st.setFullYear(Feb1st.getFullYear()+1);\r\n                        var LeapYear = 0;\r\n                        if (Feb1st.getFullYear()%4 == 0) // leap year (valid from 1901 to 2099)\r\n                            LeapYear = 1;\r\n                        var DaysHeldInPeriod = 365 + LeapYear;\r\n                        if (DeprStartDate > StartOfPeriod)\r\n                            DaysHeldInPeriod -= (DeprStartDate - StartOfPeriod)/86400000;   // milliseconds difference, converted to days\r\n                        if (DeprEndDate < StartOfNextPeriod)\r\n                            DaysHeldInPeriod -= (StartOfNextPeriod - DeprEndDate)/86400000 -1;\r\n                        \r\n                        if (DaysHeldInPeriod < 1)\r\n                            DaysHeldInPeriod = 1;\r\n\r\n                        if( DeprFnPeriods[mnS] == \'1\') {\r\n                            // monthly period\r\n                            AssetValues2[\'DH\'] = Math.ceil( noOfDaysInMonth ); // VS - ask andy why it was implemented using years initially\r\n                        } else {\r\n                            AssetValues2[\'DH\'] = Math.ceil(DaysHeldInPeriod);\r\n                        }\r\n                         // PSG 4807, 2011-07-11 ^^\r\n\r\n                        if ( groupMaster == \'T\' && arrGroupMasters) {\r\n                            if (AssetValues2[\'NB\'] == 0 ) {\r\n                                AssetValues2[\'NB\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'NB\'], 0 );\r\n                                AssetValues[\'NB\'+mnS] = AssetValues2[\'NB\'] ;\r\n                            }\r\n                            if (AssetValues2[\'PB\'] == 0 ) {\r\n                                AssetValues2[\'PB\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'PB\'], 0 );\r\n                            }\r\n                            if (AssetValues2[\'PB\'] == 0 ) {\r\n                                AssetValues2[\'PB\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'OC\'], 0 );\r\n                            }\r\n\r\n                            AssetValues2[\'CC\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'CC\'], 0 );\r\n                            AssetValues2[\'OC\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'OC\'], 0 );\r\n                            AssetValues2[\'AL\'] = arrGroupMasters[ altMethod ][\'AL\'];\r\n                            AssetValues2[\'DP\'] = 365;\r\n                            var noOfDaysInMonth = daysInMonth(PeriodDate.getMonth(), PeriodDate.getFullYear() );\r\n                            nlapiLogExecution( \'DEBUG\', \'------ VICOY ------\', \'PeriodDate: \' + PeriodDate + \' | Days in Month: \' + noOfDaysInMonth\r\n                                    + \' | AssetValues2[AL]: \' + AssetValues2[\'AL\']\r\n                                    + \' | AssetValues2[NB]: \' + AssetValues2[\'NB\']\r\n                                    + \' | AssetValues2[PB]: \' + AssetValues2[\'PB\'] );\r\n\r\n                            switch( periodConvention )\r\n                            {\r\n                                case 1: // 12 months of 30 days\r\n                                    AssetValues2[\'DP\'] = ( depreciationPeriod == DEPR_PERIOD_MONTHLY ? 30 : 360);\r\n                                    break;\r\n                                case 2: // exact 365 days\r\n                                    AssetValues2[\'DP\'] = ( depreciationPeriod == DEPR_PERIOD_MONTHLY ? noOfDaysInMonth : 365);\r\n                                    break;\r\n                                case 3: //  check for leap year\r\n                                    AssetValues2[\'DP\'] = ( depreciationPeriod == DEPR_PERIOD_MONTHLY ? noOfDaysInMonth : 365 + LeapYear);\r\n                                    break;\r\n                                default: // if nothing specified\r\n                                    AssetValues2[\'DP\'] = ( depreciationPeriod == DEPR_PERIOD_MONTHLY ? noOfDaysInMonth : 365);\r\n                                    break;\r\n                            }\r\n                        }\r\n\r\n                        if( (AssetValues2[\'AL\'] == 0) ) //|| (AssetValues2[\'AL\'] < AssetValues2[\'CP\']) )\r\n                            AssetValues[\'LD\'+mnS] = 0.00;\r\n                        else\r\n                        {\r\n                            _failurePoint = \'Period depreciation - call depr formula for sub method\';\r\n                            AssetValues[\'LD\'+mnS] = ncRoundCurr(ncFAR_ExecFormula(DeprFnToks[mnS],AssetValues2) * PRfactor, CurrSym, IntCurrSym );\r\n                            _failurePoint = \'Period depreciation - test end of life for sub method\';\r\n                            \r\n                            var tempNb = ncRound2(AssetValues2[\'NB\']-AssetValues[\'LD\'+mnS]);\r\n                            \r\n                            if(AssetValues2[\'CP\'] < AssetValues2[\'AL\']) {\r\n                                //Asset depreciation continues\r\n                                endofLifeAlternate = false;\r\n                                if(Math.abs(tempNb) < Math.abs(AssetValues2[\'RV\'])) {\r\n                                    AssetValues[\'LD\'+mnS] = ncRoundCurr(AssetValues2[\'NB\'] - AssetValues2[\'RV\'],CurrSym,IntCurrSym);                                    \r\n                                }\r\n                            } else if (DeprFnFinalPeriods[mnS] == FINAL_CONVENTION_FULLYDEPRECIATE) {\r\n                                AssetValues[\'LD\'+mnS] = ncRoundCurr(AssetValues2[\'NB\'] - AssetValues2[\'RV\'],CurrSym,IntCurrSym); // last depreciation must be to residual value\r\n                            } else if (DeprFnFinalPeriods[mnS] == FINAL_CONVENTION_RETAINBALANCE) {\r\n                                if(Math.abs(tempNb) < Math.abs(AssetValues2[\'RV\'])) {\r\n                                    AssetValues[\'LD\'+mnS] = ncRoundCurr(AssetValues2[\'NB\'] - AssetValues2[\'RV\'],CurrSym,IntCurrSym);                                    \r\n                                }\r\n                            }\r\n                            \r\n                        }\r\n                        AssetValues[\'NB\'+mnS] = ncRoundCurr(AssetValues[\'NB\'+mnS] - AssetValues[\'LD\'+mnS],CurrSym,IntCurrSym);\r\n                        if (ncFAR_GetRelativeMonth(PeriodDate, AssetValues[\'FY\'+mnS]) == 11)    // PSG 4807, 2011-07-11, check for end of year\r\n                        {\r\n                            AssetValues[\'PB\'+mnS] = AssetValues[\'NB\'+mnS];    // capture end of year NBV\r\n                        }\r\n                    }\r\n                    else    // annual and not December\r\n                    {\r\n                        AssetValues[\'LD\'+mnS] = 0.00;    // none this month\r\n                        endofLifeAlternate = false;    // but may need to keep alive to end of year\r\n                        SkipHistory[mn] = \'T\';    // suppress depr history for this period\r\n                    }\r\n                }\r\n                if (GenHistOnly==\'T\')\r\n                {\r\n                    mn = 99;    // terminate loop\r\n                }\r\n            }\r\n\r\n            if( endOfLifeAccounting )\r\n            {\r\n                rAssetUpdates[\'custrecord_assetdepractive\'] = \'2\';    // asset depreciation no longer active\r\n                rAssetUpdates[\'custrecord_assetstatus\'] = \'3\';    // status: fully depreciated\r\n                rChanged = true;    // this may be the first change!\r\n            } \r\n            if ( endOfLifeAccounting && endofLifeAlternate) {\r\n                //Both Accounting and Alternate Depreciation have already fully depreciated, end loop\r\n                p = nPeriods;\r\n            }\r\n\r\n            // update asset values (locally)\r\n            AssetValues[\'NB\'] = ncRoundCurr(AssetValues[\'NB\'] - DeprAmount,CurrSym,IntCurrSym);\r\n            TotalDeprAmount += DeprAmount;\r\n            TotalDeprAmount = ncRoundCurr(TotalDeprAmount,CurrSym,IntCurrSym);//cs\r\n\r\n            if( (!isNaN(DeprAmount)) && (DeprAmount != 0.00) && (CalculateOnly != true) && (GenHistOnly != \'T\') )\r\n            {\r\n                // build financial trn\r\n                _failurePoint = \'Period depreciation - create journal\';\r\n                accts[0] = DeprExpAC;\r\n                debits[0] = DeprAmount;\r\n                accts[1] = DeprRsrvAC;\r\n                credits[1] = DeprAmount;\r\n                if(DeprMemo == \'\' || DeprMemo == null) //cs\r\n                {\r\n                    if(SubCategory == null)\r\n                    {\r\n                        refs[0] = \'Asset depreciation:\'+rAsset.getFieldValue(\'name\')+\' (NC-FAM)\';\r\n                        refs[1] = \'Asset depreciation:\'+rAsset.getFieldValue(\'name\')+\' (NC-FAM)\';\r\n                    }\r\n                    else\r\n                    {\r\n                        refs[0] = SubCategory +\' (NC-FAM)\';\r\n                        refs[1] = SubCategory +\' (NC-FAM)\';\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    refs[0] = DeprMemo +\' (NC-FAM)\';\r\n                    refs[1] = DeprMemo +\' (NC-FAM)\';\r\n                }\r\n\r\n                // instead of creating a journal and saving, we want to create the journal to a record buffer,\r\n                // or just add lines to an existing journal if we already have one...\r\n                // ... so need alternate version of CreateJournalEntry which takes and updates Journals[]\r\n                // .\r\n                // Except that we have to save the journals, so finance and asset register not out of balance if something fails\r\n                // so set \'saverecord\' parameter to true.\r\n                \r\n                var OpenPeriodDate = CustomScript_TestPeriodStatus(PeriodDate, PeriodInfo, PeriodCache);\r\n                if( OpenPeriodDate == null )\r\n                {\r\n                    // failed... ought to bail out here somehow? for now, revert to old behaviour and just use old period?\r\n                    OpenPeriodDate = new Date(PeriodDate);\r\n                }\r\n                \r\n                var JrnErrMsg = CreateJournalEntryToArray(OpenPeriodDate,CurrencyId,accts,debits,credits,refs,\r\n                            Journals,Subsid,ClassId,DepartmentId,LocationId,/*false */ true,JL,ParentAssetId,CurrSym,IntCurrSym,SubCategory,rAsset);\r\n\r\n                if( JrnErrMsg != \'\' )\r\n                {\r\n                    nlapiLogExecution(\'ERROR\',\'ncFAR_DepreciateAsset_v2\', \'JE Create Failed: \' + JrnErrMsg);\r\n                    var errObj = nlapiCreateError(\'NCFAR_JOURNALERROR\',JrnErrMsg,true);\r\n                    //throw(errObj);\r\n    \r\n                    return {error: errObj};\r\n                }\r\n\r\n                // write depreciation history record\r\n                _failurePoint = \'Period depreciation - write history\';\r\n                rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                // need to include asset type and history record type (but need to make the fields too)\r\n                if( Subsid != null )\r\n                    rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', Subsid);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', rAsset.getFieldValue(\'custrecord_assettype\'));\r\n                rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'2\');    // depreciation charge\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetId);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(PeriodDate));\r\n        //            rDeprHist.setFieldValue(\'custrecord_deprhistperiod\',  ?? );\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistamount\', DeprAmount.toString());\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetValues[\'NB\'].toString());\r\n                // CS 14/5/09\r\n//                rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', LIST_DEPRHIST_ACCMETH); //jgutana\r\n                //22/08/2010\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', assetQty);\r\n\r\n                var YearAndMonth = OpenPeriodDate.getFullYear().toString() + (OpenPeriodDate.getMonth()+1).toString();\r\n                var JEhash = GetJournalHash(YearAndMonth, Subsid, CurrencyId, DepartmentId, ClassId, LocationId);\r\n                rDeprHist.setFieldValue(\'custrecord_deprhistjournal\', Journals[JEhash].getFieldValue(\'id\') );\r\n            //    nlapiSubmitRecord(rDeprHist,false);\r\n                var DHid = nlapiSubmitRecord(rDeprHist,false);\r\n                // Now we have finished with the journal (for this pass), check if reached max size and reset\r\n                \r\n                /*\r\n                if( Journals[JEhash].getLineItemCount(\'line\') > 99 ) // give ourselves a slight margin... could check for >= 200\r\n                {\r\n                    // need to save the journal before discarding!\r\n                //    nlapiSubmitRecord(Journals[JEhash],false);\r\n                    var JEid = nlapiSubmitRecord(Journals[JEhash],false);\r\n                    Journals[JEhash] = null;    // reset journal in cache, so force a new journal next time\r\n                }\r\n                // ......\r\n                */\r\n            }\r\n\r\n            // CS 14/5/09 - Create Depr History records for Other Methods if any\r\n            if( (l_StoreHistory == \'T\') && (CalculateOnly != true) )\r\n            {\r\n                //jgutana\r\n                for(var i=0; i<OBJ_ncFAR_ALTDEPR.readRecords.length; i++)\r\n\r\n                {\r\n                    if (GenHistOnly==\'T\')\r\n                    {\r\n                        i = SingleMethod;\r\n                    }\r\n//                    if(rAsset.getFieldValue(\'custrecord_assetdeprmethod\'+i) != null && rAsset.getFieldValue(\'custrecord_assetdeprmethod\'+i) != \'\')\r\n                    //jgutana\r\n                    if(!OBJ_ncFAR_ALTDEPR.readRecords[i][\'skip\'])\r\n                    {\r\n                        if( SkipHistory[i] != \'T\' )\r\n                        {\r\n                            _failurePoint = \'Period depreciation - write history for Other Methods\';\r\n                            rDeprHist = nlapiCreateRecord(ncConst.FAR_DeprHistory);\r\n                            if( Subsid != null )\r\n                                rDeprHist.setFieldValue(\'custrecord_deprhistsubsidiary\', Subsid);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistassettype\', rAsset.getFieldValue(\'custrecord_assettype\'));\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhisttype\', \'2\');    // depreciation\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistasset\', AssetId);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistdate\', nlapiDateToString(PeriodDate));\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistamount\', AssetValues[\'LD\'+i].toString());\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistbookvalue\', AssetValues[\'NB\'+i].toString());\r\n//                            rDeprHist.setFieldValue(\'custrecord_deprhistmethod\', i+1);\r\n                            //jgutana\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistaltmethod\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdepraltmethod\']);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistdeprmethod\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'custrecord_altdeprmethod\']);\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistaltdepr\', OBJ_ncFAR_ALTDEPR.readRecords[i][\'internalid\']);\r\n\r\n                            rDeprHist.setFieldValue(\'custrecord_deprhistquantity\', assetQty);\r\n\r\n                            nlapiSubmitRecord(rDeprHist,false);\r\n                        }\r\n                    }\r\n                    if (GenHistOnly==\'T\')\r\n                    {\r\n                        i = 99; // terminate loop\r\n                    }\r\n                }\r\n            }\r\n\r\n            _failurePoint = \'Calculate final values and forecast\';\r\n\r\n            // at this point, we should also commit the asset record, since we have just committed\r\n            // journal and history... if we are doing multiple periods and the next period blows up,\r\n            // the journal and history would exist but asset not updated so they would be repeated next time!\r\n            rAssetUpdates[\'custrecord_assetbookvalue\'] = AssetValues[\'NB\'].toString();\r\n            rAssetUpdates[\'custrecord_assetcurrentage\'] = AssetValues[\'CP_0\'].toString();\r\n\r\n            rAssetUpdates[\'custrecord_assetlastdepramt\'] = AssetValues[\'LD\'].toString();\r\n            rAssetUpdates[\'custrecord_assetlastdeprdate\'] = nlapiDateToString(PeriodDate);    // nlapiDateToString(new Date());\r\n            rAssetUpdates[\'custrecord_assetdeprtodate\'] = TotalDeprAmount.toString();\r\n\r\n            for(var mn=0; mn<OBJ_ncFAR_ALTDEPR.readRecords.length; mn++)\r\n            {\r\n                if (GenHistOnly==\'T\')\r\n                {\r\n                    mn = SingleMethod;\r\n                }\r\n                mnS = mn.toString();\r\n                if( rMethods[mnS] != \'\' )\r\n                {\r\n                    var altMethod = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepraltmethod\'];\r\n                    var groupDepreciation = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepr_groupdepreciation\'];\r\n                    var groupMaster = OBJ_ncFAR_ALTDEPR.readRecords[mn][\'custrecord_altdepr_groupmaster\'];\r\n\r\n                    if ( arrGroupMasters && ( arrGroupMasters[ altMethod ] == \'T\' ) && ( groupDepreciation == \'T\' )\r\n                            && ( groupMaster != \'T\' ) ) {\r\n                        nlapiLogExecution(\'DEBUG\', \'FAM - ncFAR_DepreciateAsset_v2\', \'Skipping Method: \' + altMethod\r\n                                + \'. This is a Group Depreciation method.\');\r\n                        continue;\r\n                    }\r\n\r\n                    if ( groupMaster == \'T\' ) {\r\n                        if (AssetValues[\'OC\'] == 0 ) {\r\n                            AssetValues[\'OC\'] = ncParseFloatNV( arrGroupMasters[ altMethod ][\'OC\'], 0 );\r\n                        }\r\n                    }\r\n                    OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprcd\'] = (ncRoundCurr(AssetValues[\'OC\']-AssetValues[\'NB\'+mnS],CurrSym,IntCurrSym)).toString();\r\n                    OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprld\'] = AssetValues[\'LD\'+mnS].toString();\r\n                    OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprnbv\'] = AssetValues[\'NB\'+mnS].toString();\r\n                    OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprpriornbv\'] = AssetValues[\'PB\'+mnS].toString(); // PSG 4807, 2011-07-11\r\n\r\n                    rGenHistUpdates[mn] = {};\r\n                    rGenHistUpdates[mn][\'custrecord_altdeprpriornbv\'] = OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprpriornbv\'];\r\n                    rGenHistUpdates[mn][\'custrecord_altdeprcd\'] = OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprcd\'];\r\n                    rGenHistUpdates[mn][\'custrecord_altdeprld\'] = OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprld\'];\r\n                    rGenHistUpdates[mn][\'custrecord_altdeprnbv\'] = OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprnbv\'];\r\n\r\n                    if( (p+1) >= nPeriods )\r\n                    {\r\n                        /* depreciate once more as forecast... use current period usage for any usage based forecast */\r\n                        AssetValues2[\'NB\'] = AssetValues[\'NB\'+mnS];\r\n                        AssetValues2[\'LD\'] = AssetValues[\'LD\'+mnS];\r\n                        AssetValues2[\'PB\'] = AssetValues[\'PB\'+mnS];     // PSG 4807, 2011-07-11\r\n                        AssetValues2[\'RV\'] = AssetValues[\'RV\'+mnS];\r\n                        AssetValues2[\'DH\'] = 365;   // PSG 4807, 2011-07-11\r\n                        AssetValues2[\'CP\'] = AssetValues[\'CP\'] + 1;\r\n                        AssetValues2[\'AL\'] = AssetValues[\'AL\'+mnS];\r\n                        while( (DeprFnEnds[mnS] > 0) && (AssetValues2[\'CP\'] > DeprFnEnds[mnS]) )\r\n                        {\r\n                            // asset aged past switch-over point, so use next method...\r\n                            rMethods[mnS] = DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethodnextmethod\');\r\n                            DeprFnEnds[mnS] = ncParseIntNV(DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethodendperiod\'),0);\r\n                            DeprFnToks[mnS] = DeprFunctions[rMethods[mnS]];\r\n                            DeprFnPeriods[mnS] = DeprMethods[rMethods[mnS]].getValue(\'custrecord_deprmethoddeprperiod\');\r\n                        }\r\n                        if( DeprFnPeriods[mnS] == \'2\' ) {\r\n                            // annual, so re-express CP as number of years... CP/12 round up\r\n                            AssetValues2[\'CP\'] = Math.ceil( AssetValues2[\'CP\']/12 );\r\n                        }\r\n\r\n                        if( (AssetValues2[\'AL\'] == 0) || (AssetValues2[\'AL\'] < AssetValues2[\'CP\']) )\r\n                            AssetValues[\'LD\'+mnS] = 0.00;\r\n                        else\r\n                            AssetValues[\'LD\'+mnS] = ncRoundCurr( ncFAR_ExecFormula(DeprFnToks[mnS],AssetValues2),CurrSym,IntCurrSym );\r\n                        \r\n                        var tempNb = ncRound2(AssetValues2[\'NB\']-AssetValues[\'LD\'+mnS]);\r\n                        if(Math.abs(tempNb) < Math.abs(AssetValues2[\'RV\'])) {\r\n                            AssetValues[\'LD\'+mnS] = ncRoundCurr(AssetValues2[\'NB\'] - AssetValues2[\'RV\'],CurrSym,IntCurrSym);\r\n                        }\r\n                        AssetValues[\'NB\'+mnS] = ncRoundCurr(AssetValues[\'NB\'+mnS] - AssetValues[\'LD\'+mnS],CurrSym,IntCurrSym);\r\n                        OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'custrecord_altdeprfc\'] = AssetValues[\'LD\'+mnS].toString();\r\n                    }\r\n                }\r\n                if (GenHistOnly==\'T\')\r\n                {\r\n                    mn = 99;    // terminate loop\r\n                }\r\n            }\r\n\r\n            if( (CalculateOnly != true) && (UpdateRecordOnly != true) && (GenHistOnly != \'T\') )\r\n            {\r\n                _failurePoint = \'Update asset values (submit)\';\r\n\r\n                UpdatedNames = new Array();\r\n                UpdatedValues = new Array();\r\n                var F=0;\r\n                for( var fName in rAssetUpdates )\r\n                {\r\n                    UpdatedNames[F] = fName;\r\n                    UpdatedValues[F] = rAssetUpdates[fName];\r\n                    ++F;\r\n                }\r\n\r\n                nlapiSubmitField(ncConst.FAR_Asset,AssetId,UpdatedNames,UpdatedValues,false);\r\n\r\n                //jgutana\r\n                UpdatedNames = [\'custrecord_altdeprcd\',\r\n                                \'custrecord_altdeprld\',\r\n                                \'custrecord_altdeprnbv\',\r\n                                \'custrecord_altdeprpriornbv\',\r\n                                \'custrecord_altdeprfc\'];\r\n                for(var mn=0; mn<OBJ_ncFAR_ALTDEPR.updateRecords.length; mn++) {\r\n                    UpdatedValues = [];\r\n                    for (var namesCtr in UpdatedNames) {\r\n                        UpdatedValues.push(OBJ_ncFAR_ALTDEPR.updateRecords[mn][UpdatedNames[namesCtr]]);\r\n                    }\r\n                    nlapiSubmitField(ncConst.FAR_AltDepr,\r\n                                     OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'internalid\'],\r\n                                     UpdatedNames, UpdatedValues, false);\r\n                }\r\n\r\n                rChanged = false;\r\n            }\r\n            if( GenHistOnly == \'T\' )\r\n            {\r\n                _failurePoint = \'Gen History: Update asset values (submit)\';\r\n\r\n                /*\r\n                UpdatedNames = new Array();\r\n                UpdatedValues = new Array();\r\n                var F=0;\r\n                for( var fName in rGenHistUpdates )\r\n                {\r\n                    UpdatedNames[F] = fName;\r\n                    UpdatedValues[F] = rGenHistUpdates[fName];\r\n                    ++F;\r\n                }\r\n\r\n                nlapiSubmitField(ncConst.FAR_Asset,AssetId,UpdatedNames,UpdatedValues,false);\r\n                */\r\n                //jgutana\r\n                UpdatedNames = [\'custrecord_altdeprpriornbv\',\r\n                                \'custrecord_altdeprcd\',\r\n                                \'custrecord_altdeprld\',\r\n                                \'custrecord_altdeprnbv\'];\r\n                for(var mn=0; mn<OBJ_ncFAR_ALTDEPR.updateRecords.length; mn++) {\r\n                    UpdatedValues = [];\r\n                    for (var namesCtr in UpdatedNames) {\r\n                        UpdatedValues.push(rGenHistUpdates[mn][UpdatedNames[namesCtr]]);\r\n                    }\r\n                    nlapiSubmitField(ncConst.FAR_AltDepr,\r\n                                     OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'internalid\'],\r\n                                     UpdatedNames, UpdatedValues, false);\r\n                }\r\n\r\n                rChanged = false;\r\n            }\r\n\r\n            /* check governance limits - if approaching limit, set bAbort */\r\n            uTarget =410;\r\n\r\n\r\n            // for testing pause and resume, just set uTarget very high (e.g. 9500) and ensure 10 or so assets to depreciate\r\n            // uTarget = 9500;\r\n            uRem = currentContext.getRemainingUsage();\r\n\r\n            if( nsVer == \'2009\' )\r\n            {\r\n                /* 2009.1 */\r\n                //iRem = currentContext.getRemainingInstructions();     ** - Not Yet Implemented\r\n\r\n                if( (uRem <= uTarget) ) //|| (iRem <= 20000) )\r\n                    bAbort = true;\r\n            }\r\n            else\r\n            {\r\n                // also need to check execution time...\r\n                tUsed = (new Date()).getTime() - _timestamp;\r\n\r\n                if( (uRem <= uTarget) || (tUsed >= _timelimit) )\r\n                    bAbort = true;\r\n            }\r\n\r\n            ++p;    // increment period counter...\r\n        }\r\n\r\n        if( (CalculateOnly != true) && (UpdateRecordOnly != true) && (rChanged == true) && (GenHistOnly != \'T\') )\r\n        {\r\n            _failurePoint = \'Update final asset values (submit)\';\r\n\r\n            UpdatedNames = new Array();\r\n            UpdatedValues = new Array();\r\n            var F=0;\r\n            for( fName in rAssetUpdates )\r\n            {\r\n                UpdatedNames[F] = fName;\r\n                UpdatedValues[F] = rAssetUpdates[fName];\r\n                ++F;\r\n            }\r\n\r\n            nlapiSubmitField(ncConst.FAR_Asset,AssetId,UpdatedNames,UpdatedValues,false);\r\n\r\n            //jgutana\r\n            UpdatedNames = [\'custrecord_altdeprcd\',\r\n                            \'custrecord_altdeprld\',\r\n                            \'custrecord_altdeprnbv\',\r\n                            \'custrecord_altdeprpriornbv\',\r\n                            \'custrecord_altdeprfc\'];\r\n            for(var mn=0; mn<OBJ_ncFAR_ALTDEPR.updateRecords.length; mn++) {\r\n                UpdatedValues = [];\r\n                for (var namesCtr in UpdatedNames) {\r\n                    UpdatedValues.push(OBJ_ncFAR_ALTDEPR.updateRecords[mn][UpdatedNames[namesCtr]]);\r\n                }\r\n                nlapiSubmitField(ncConst.FAR_AltDepr,\r\n                                 OBJ_ncFAR_ALTDEPR.updateRecords[mn][\'internalid\'],\r\n                                 UpdatedNames, UpdatedValues, false);\r\n            }\r\n\r\n        }\r\n\r\n        return( rAssetUpdates );\r\n    }\r\n    catch (GE) {\r\n        var msg = \'\';\r\n        \r\n        if (typeof GE.getStackTrace === \'function\') {\r\n            msg = GE.toString() + \'\r\n\' + GE.getStackTrace().join(\'\r\n\');\r\n        }\r\n        else if (GE.stack) {\r\n            msg = GE.toString() + GE.stack.replace(/(^|\\s)at(\\s|$)/g, \'\r\nat \');\r\n        }\r\n        else {\r\n            msg = GE.toString();\r\n        }\r\n        \r\n        ncLogExecution(\'Error\',\'Unhandled Exception for Asset Id: \' + rAsset.getId(), msg);\r\n        ncLogExecution(\'debug\',\'_failurePoint\',_failurePoint);\r\n        \r\n        return { error : GE };\r\n    }\r\n}\r\n\r\n/* CreateJournalEntry - will create a new journalentry record and add lines based upon the arrays of values\r\n * Parameters:\r\n *        TrnDate     - transaction date (will determine postingperiod). Pass either as a Date or a NetSuite formatted date string.\r\n *        CurrCode     - currency (as internal id)\r\n *        Accounts     - array of account ids\r\n *        DebitAmts     - corresponding array of debit values\r\n *        CreditAmts     - corresponding array of credit values\r\n *        References     - corresponding array of memo text values\r\n *      JournalId     - (output) returns the record id of the journal entry created\r\n *      SubsidiaryId- subsidiary for the transaction (if feature enabled)\r\n *        ClassId        - class for the transaction (if feature enabled)\r\n *        DepartmentId- department for the transaction (if feature enabled)\r\n *        LocationId    - location for the transaction (if feature enabled)\r\n *        rAsset            - asset record\r\n * Returns:\r\n *      message string containing any error messages, blank if no errors.\r\n */\r\nfunction CreateJournalEntry(TrnDate,CurrCode,Accounts,DebitAmts,CreditAmts,References,JournalId,SubsidiaryId,ClassId,DepartmentId,LocationId,rAsset)\r\n{\r\n    var JE                 = nlapiCreateRecord(\'journalentry\'),\r\n        msg                = \'\';\r\n\r\n    if( (SubsidiariesEnabled()) && (SubsidiaryId != null) )\r\n    {\r\n        JE.setFieldValue(\'subsidiary\',SubsidiaryId);\r\n    }\r\n    \r\n    if(TrnDate instanceof Date)\r\n        JE.setFieldValue(\'trandate\',nlapiDateToString(TrnDate));\r\n    else\r\n        JE.setFieldValue(\'trandate\',TrnDate);    // assuming it is a valid string\r\n\r\n    if( (CurrCode != \'\') && (CurrCode != null) && (ncIsFeatureEnabled(\'multicurrency\')) )\r\n    {\r\n        JE.setFieldValue(\'currency\',CurrCode.toString());\r\n        JE.setFieldValue(\'exchangerate\',\'1\');\r\n    }\r\n\r\n    if (typeof(ClassId) === \'string\' && ClassId * 1) {\r\n        JE.setFieldValue(\'class\', ClassId);\r\n    }\r\n    if (typeof(DepartmentId) === \'string\' && DepartmentId * 1) {\r\n        JE.setFieldValue(\'department\', DepartmentId);\r\n    }\r\n    if (typeof(LocationId) === \'string\' && LocationId * 1) {\r\n        JE.setFieldValue(\'location\', LocationId);\r\n    }\r\n    // validate accounts\r\n    for(var n=0; n<Accounts.length; ++n)\r\n    {\r\n        if( Accounts[n] == null )\r\n        {\r\n            msg = FAM.resourceManager.GetString(\'custpage_accounts_missing\');\r\n            return msg;\r\n        }\r\n    }\r\n    // line counter\r\n    var j = 1;\r\n    for(var i=0; i<Accounts.length; ++i)\r\n    {\r\n        if(DebitAmts[i] == 0 && CreditAmts[i] == 0)\r\n        {\r\n            //do nothing\r\n        }\r\n        else\r\n        {\r\n            JE.insertLineItem(\'line\',j);\r\n            JE.setLineItemValue(\'line\',\'account\',j,Accounts[i].toString());\r\n            if( CurrCode != null )\r\n            {\r\n                JE.setLineItemValue(\'line\',\'account_cur\',j,CurrCode.toString());\r\n                JE.setLineItemValue(\'line\',\'account_cur_isbase\',j,\'T\');\r\n                JE.setLineItemValue(\'line\',\'account_cur_fx\',j,\'F\');\r\n            }\r\n            if(DebitAmts[i] != 0)\r\n            {\r\n                JE.setLineItemValue(\'line\',\'debit\',j,DebitAmts[i].toString());\r\n                JE.setLineItemValue(\'line\',\'origdebit\',j,DebitAmts[i].toString());\r\n            }\r\n            if(CreditAmts[i] != 0)\r\n            {\r\n                JE.setLineItemValue(\'line\',\'credit\',j,CreditAmts[i].toString());\r\n                JE.setLineItemValue(\'line\',\'origcredit\',j,CreditAmts[i].toString());\r\n            }\r\n            JE.setLineItemValue(\'line\',\'memo\',j,References[i].toString());\r\n\r\n            // need to allow Class, Department and Location to be single value (same for all rows) or per row, i.e. string or array\r\n            if (ClassId != null) {\r\n                if (typeof(ClassId) == \'string\' && ClassId * 1) {\r\n                    JE.setLineItemValue(\'line\', \'class\', j, ClassId);\r\n                }\r\n                else if (typeof(ClassId[i]) == \'string\' && ClassId[i] * 1) {\r\n                    JE.setLineItemValue(\'line\', \'class\', j, ClassId[i]);\r\n                }\r\n            }\r\n\r\n            if (DepartmentId != null) {\r\n                if (typeof(DepartmentId) == \'string\' && DepartmentId * 1) {\r\n                    JE.setLineItemValue(\'line\', \'department\', j, DepartmentId);\r\n                }\r\n                else if (typeof(DepartmentId[i]) == \'string\' && DepartmentId[i] * 1) {\r\n                    JE.setLineItemValue(\'line\', \'department\', j, DepartmentId[i]);\r\n                }\r\n            }\r\n\r\n            if (LocationId != null) {\r\n                if (typeof(LocationId) == \'string\' && LocationId * 1) {\r\n                    JE.setLineItemValue(\'line\', \'location\', j, LocationId);\r\n                }\r\n                else if (typeof(LocationId[i]) == \'string\' && LocationId[i] * 1) {\r\n                    JE.setLineItemValue(\'line\', \'location\', j, LocationId[i]);\r\n                }\r\n            }\r\n            \r\n            ++j;\r\n        }\r\n    }\r\n\r\n    try\r\n    {\r\n        JournalId[0] = nlapiSubmitRecord(JE,true, true);\r\n    } catch (e) {\r\n        if ( e instanceof nlobjError )\r\n        {\r\n            msg = e.getCode() + \' - \' + e.getDetails();\r\n            var ST = e.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n            {\r\n                if( typeof(ST) == \'string\' )\r\n                    msg += \'<BR>\'+ST;\r\n                else    // in case we ever do get an array...\r\n                    for( var nST=0; nST<ST.length; ++nST )\r\n                        if( ST[nST] != \'undefined\' )\r\n                            msg += \'<BR>\'+ST[nST];\r\n            }\r\n        }\r\n        else\r\n            msg = e.toString();\r\n    }\r\n    return msg;\r\n}\r\n\r\n/* CreateJournalEntryToArray - will create a new journalentry record and add lines based upon the arrays of values\r\n * Parameters:\r\n *        TrnDate     - transaction date (will determine postingperiod). Pass either as a Date or a NetSuite formatted date string.\r\n *        CurrCode     - currency (as internal id)\r\n *        Accounts     - array of account ids\r\n *        DebitAmts     - corresponding array of debit values\r\n *        CreditAmts     - corresponding array of credit values\r\n *        References     - corresponding array of memo text values\r\n *      Journals     - array of journals\r\n *      SubsidiaryId- subsidiary for the transaction (if feature enabled)\r\n *        ClassId        - class for the transaction (if feature enabled)\r\n *        DepartmentId- department for the transaction (if feature enabled)\r\n *        LocationId    - location for the transaction (if feature enabled)\r\n *      SaveRecord  - if true, the journal will be committed each time\r\n *    SubCategory    - {string} used to summarise journals by subcategory\r\n *    AssetRecord     - {nlobjRecord} nlobjRecord object containing the asset record\r\n * Returns:\r\n *      message string containing any error messages, blank if no errors.\r\n */\r\nfunction CreateJournalEntryToArray(TrnDate,CurrCode,Accounts,DebitAmts,CreditAmts,References,Journals,SubsidiaryId,ClassId,\r\n        DepartmentId,LocationId,SaveRecord,JL,ParentAssetId,CurrSym,IntCurrSym,SubCategory,AssetRecord) {\r\n    var msg                = \'\';\r\n    // use main fields to build array hash\r\n    // for the moment, since no PeriodId, use month and year from TrnDate...\r\n    var YearAndMonth;\r\n    var l_Date;\r\n    if(TrnDate instanceof Date)\r\n        l_Date = new Date(TrnDate);\r\n    else\r\n        l_Date = nlapiStringToDate(TrnDate);\r\n    YearAndMonth = l_Date.getFullYear().toString() + (l_Date.getMonth()+1).toString();\r\n\r\n    var JEhash = GetJournalHash(YearAndMonth, SubsidiaryId, CurrCode, DepartmentId, ClassId, LocationId);\r\n    var JEid = null;\r\n    // check array to see if we already have a record\r\n    // if not, create one into the array\r\n    if( Journals[JEhash] == null )\r\n    {\r\n        Journals[JEhash] = nlapiCreateRecord(\'journalentry\');\r\n\r\n        if( (SubsidiariesEnabled()) && (SubsidiaryId != null) )\r\n        {\r\n            Journals[JEhash].setFieldValue(\'subsidiary\',SubsidiaryId);\r\n        }\r\n\r\n        Journals[JEhash].setFieldValue(\'department\', DepartmentId);\r\n        Journals[JEhash].setFieldValue(\'class\', ClassId);\r\n        Journals[JEhash].setFieldValue(\'location\', LocationId);\r\n\r\n        if(TrnDate instanceof Date)\r\n            Journals[JEhash].setFieldValue(\'trandate\',nlapiDateToString(TrnDate));\r\n        else\r\n            Journals[JEhash].setFieldValue(\'trandate\',TrnDate);    // assuming it is a valid string\r\n\r\n        if( (CurrCode != \'\') && (CurrCode != null) && (ncIsFeatureEnabled(\'multicurrency\')) )\r\n        {\r\n            Journals[JEhash].setFieldValue(\'currency\',CurrCode.toString());\r\n            Journals[JEhash].setFieldValue(\'exchangerate\', \'1\');\r\n        }\r\n\r\n        SaveRecord = true;    // force save of the new record\r\n    }\r\n    else\r\n    {\r\n        JEid = Journals[JEhash].getFieldValue(\'id\');\r\n        \r\n        if( SaveRecord )\r\n        {\r\n            // if we saved the record previously, we need to re-read it here to avoid \'record has changed\' error\r\n            // JEid = Journals[JEhash].getFieldValue(\'id\');\r\n            Journals[JEhash] = nlapiLoadRecord(\'journalentry\',JEid);\r\n        }\r\n    }\r\n\r\n    // thereafter, use the record from the array and append lines\r\n    var Offset = Journals[JEhash].getLineItemCount(\'line\') + 1;\r\n    var idx;\r\n    var DB;\r\n    var CR;\r\n    var JLtemp = new Array();\r\n    var DCL = \'\';\r\n    if( DepartmentId != null )\r\n        DCL += DepartmentId;\r\n    DCL += \'-\';\r\n    if( ClassId != null )\r\n        DCL += ClassId;\r\n    DCL += \'-\';\r\n    if( LocationId != null )\r\n        DCL += LocationId;\r\n\r\n    for(var i=0; i<Accounts.length; ++i)\r\n    {\r\n        // don\'t try to create blank lines\r\n        if( (DebitAmts[i] != 0) || (CreditAmts[i] != 0) )\r\n        {\r\n            idx = Offset;\r\n\r\n/* *** Use JrnLine Hash and ParentAssetId to determine if a line already exists to increment, or need to add new line and hash *** */\r\n            if( (JL != null) && (JEid != null) )\r\n            {\r\n                // we have a journal lines array so SummaryPosting is active, and a Journal Id so not a new journal...\r\n                // - now check if we have a line for the account\r\n                //CS 19/5/09\r\n                var jlH;\r\n                if(SubCategory != null)\r\n                {\r\n                    jlH = JEid + \'|\' + SubCategory + \'|\' + DCL + \'|\' + Accounts[i].toString();\r\n                    if( JL[jlH] != null )\r\n                        idx = JL[jlH];\r\n                }\r\n                else if(ParentAssetId != null)\r\n                {\r\n                    jlH = JEid + \'|\' + ParentAssetId + \'|\' + DCL + \'|\' + Accounts[i].toString();\r\n\r\n                    if( JL[jlH] != null )\r\n                        idx = JL[jlH];\r\n                }\r\n\r\n            }\r\n\r\n            if( idx == Offset )\r\n            {\r\n                // New line - so insert and set values\r\n                Journals[JEhash].insertLineItem(\'line\',idx);\r\n                Journals[JEhash].setLineItemValue(\'line\',\'account\',idx,Accounts[i].toString());\r\n                if( CurrCode != null )\r\n                {\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'account_cur\',idx,CurrCode.toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'account_cur_isbase\',idx,\'T\');\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'account_cur_fx\',idx,\'F\');\r\n                }\r\n                if(DebitAmts[i] != 0)\r\n                {\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'debit\',idx,DebitAmts[i].toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origdebit\',idx,DebitAmts[i].toString());\r\n                }\r\n                if(CreditAmts[i] != 0)\r\n                {\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'credit\',idx,CreditAmts[i].toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origcredit\',idx,CreditAmts[i].toString());\r\n                }\r\n\r\n                Journals[JEhash].setLineItemValue(\'line\',\'memo\',idx,References[i].toString());\r\n\r\n                if( ClassId != null )\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'class\',idx,ClassId);\r\n                if( DepartmentId != null )\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'department\',idx,DepartmentId);\r\n                if( LocationId != null )\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'location\',idx,LocationId);\r\n\r\n                if( JL != null )\r\n                {\r\n                    if (JEid == null)\r\n                    {\r\n                        // we are tracking lines, but this could be a new journal so JE not known yet, so track temp\r\n                        if(SubCategory != null)\r\n                            JLtemp[SubCategory + \'|\' + DCL + \'|\' + Accounts[i].toString()] = idx;\r\n                        else if(ParentAssetId != null)\r\n                            JLtemp[ParentAssetId + \'|\' + DCL + \'|\' + Accounts[i].toString()] = idx;\r\n                    }\r\n                    else\r\n                    {\r\n                        // JE is known, update directly\r\n                        if(SubCategory != null)\r\n                            JL[JEid + \'|\' + SubCategory + \'|\' + DCL + \'|\' + Accounts[i].toString()] = idx;\r\n                        else if(ParentAssetId != null)\r\n                            JL[JEid + \'|\' + ParentAssetId + \'|\' + DCL + \'|\' + Accounts[i].toString()] = idx;\r\n                    }\r\n                }\r\n\r\n                ++Offset;\r\n            }\r\n            else\r\n            {\r\n                // existing line for this account, so read and increment values\r\n                // leave memo, class, department, location unchanged - use initial values only\r\n                DB = ncParseFloatNV(Journals[JEhash].getLineItemValue(\'line\',\'debit\',idx),0.00);\r\n                CR = ncParseFloatNV(Journals[JEhash].getLineItemValue(\'line\',\'credit\',idx),0.00);\r\n\r\n                DB += DebitAmts[i];\r\n                CR += CreditAmts[i];\r\n\r\n                if( DB > CR )\r\n                {\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'debit\',idx,ncRoundCurr(DB-CR,CurrSym,IntCurrSym).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origdebit\',idx,ncRoundCurr(DB-CR,CurrSym,IntCurrSym).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'credit\',idx,(0).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origcredit\',idx,(0).toString());\r\n                }\r\n                else if( DB < CR )\r\n                {\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'credit\',idx,ncRoundCurr(CR-DB,CurrSym,IntCurrSym).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origcredit\',idx,ncRoundCurr(CR-DB,CurrSym,IntCurrSym).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'debit\',idx,(0).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origdebit\',idx,(0).toString());\r\n                }\r\n                else    // DB == CR, so now the line is net 0.00... this is not allowed so remove the line\r\n                {\r\n                    // will this ever happen?? unless someone transposes the accounts,\r\n                    // on child assets which are equivalent value to the parent asset,\r\n                    // nothing should ever decrease the value of the depr account,\r\n                    // so no, this should never happen (\'onest guv!)\r\n\r\n                    // write the zero, so at least it causes a trappable error, rather than leaving old values in the line\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'debit\',idx,(0).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origdebit\',idx,(0).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'credit\',idx,(0).toString());\r\n                    Journals[JEhash].setLineItemValue(\'line\',\'origcredit\',idx,(0).toString());\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    if( SaveRecord )\r\n    {\r\n        try\r\n        {\r\n            if( Journals[JEhash].getLineItemCount(\'line\') > 0 )\r\n            {\r\n                var JrnId = nlapiSubmitRecord(Journals[JEhash],true, true);\r\n\r\n                Journals[JEhash] = nlapiLoadRecord(\'journalentry\',JrnId);\r\n                // Journals[JEhash].setFieldValue(\'id\',JrnId);    // set record Id, so next time it updates existing record\r\n\r\n                // now update JL from temp lines, if tracking lines\r\n                if( JL != null )\r\n                {\r\n                    for( var temphash in JLtemp )\r\n                        JL[JrnId + \'|\' + temphash] = JLtemp[temphash];\r\n                }\r\n            }\r\n        } catch (e) {\r\n            if (Journals[JEhash].getFieldValue(\'id\') == null) {\r\n                Journals[JEhash] = null;\r\n            }\r\n            \r\n            if ( e instanceof nlobjError )\r\n            {\r\n                msg = e.getCode() + \' - \' + e.getDetails();\r\n                var ST = e.getStackTrace();\r\n                // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n                if( (typeof(ST) != \'undefined\') && (ST != null) )\r\n                {\r\n                    if( typeof(ST) == \'string\' )\r\n                        msg += \'<BR>\'+ST;\r\n                    else    // in case we ever do get an array...\r\n                        for( var nST=0; nST<ST.length; ++nST )\r\n                            if( ST[nST] != \'undefined\' )\r\n                                msg += \'<BR>\'+ST[nST];\r\n                }\r\n            }\r\n            else\r\n                msg = e.toString();\r\n        }\r\n    }\r\n    return msg;\r\n}\r\n\r\nfunction GetJournalHash(PeriodId, SubId, CurrencyId, depId, classId, locId) {\r\n    var arrJEHash = [PeriodId || \'\', SubId || \'\', CurrencyId];\r\n    \r\n    if (FAM.Context.getPreference(\'deptsperline\') !== \'T\') {\r\n        arrJEHash.push(depId || \'\');\r\n    }\r\n    if (FAM.Context.getPreference(\'classesperline\') !== \'T\') {\r\n        arrJEHash.push(classId || \'\');\r\n    }\r\n    if (FAM.Context.getPreference(\'locsperline\') !== \'T\') {\r\n        arrJEHash.push(locId || \'\');\r\n    }\r\n\r\n    return arrJEHash.join(\'|\');\r\n}\r\n\r\nfunction GetChildrenOfSubsid(subid)//cs\r\n{\r\n    var pSubsidName = nlapiLookupField(\'subsidiary\', subid, \'name\');\r\n    var childSubsids = [];\r\n\r\n    var sfNotElim = new nlobjSearchFilter(\'iselimination\',null,\'is\',\'F\',null);\r\n    var sfNotInactive = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n    var sfArray = [sfNotElim, sfNotInactive];\r\n\r\n    var srSubsids = nlapiSearchRecord(\'subsidiary\',null,sfArray,[new nlobjSearchColumn(\'name\')]);\r\n    for ( var i = 0; srSubsids != null && i < srSubsids.length; i++ )\r\n    {\r\n        var l_SubsidId = srSubsids[i].getId();\r\n        if( l_SubsidId == subid) continue;\r\n\r\n        var l_SubsidName = srSubsids[i].getValue(\'name\');\r\n        if(l_SubsidName.indexOf(pSubsidName) != -1)\r\n            childSubsids[childSubsids.length] = l_SubsidId;\r\n\r\n    }\r\n    return childSubsids;\r\n}\r\n/* GetChildrenOfProposal - Helper function - Multiple Asset Proposal:\r\n * Gets all the children of a given proposal.\r\n * Ignores any proposal whose status is not \'New\' or not \'Combined\'\r\n * Returns array of proposal record search objects */\r\nfunction GetChildrenOfProposal(propid)\r\n{\r\n    var childProposals = [];\r\n\r\n    var sf = [new nlobjSearchFilter(\'custrecord_propparent\',null,\'anyof\',[propid],null),\r\n              new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null)];\r\n    var sc = [new nlobjSearchColumn(\'custrecord_propstatus\'),\r\n              new nlobjSearchColumn(\'custrecord_propassetcost\'),\r\n              new nlobjSearchColumn(\'custrecord_propresidvalue\')];\r\n    var srProposals = nlapiSearchRecord(ncConst.FAR_Proposal,null,sf,sc);\r\n    for ( var i = 0; srProposals != null && i < srProposals.length; i++ )\r\n    {\r\n        var l_PropId = srProposals[i].getId();\r\n        if( l_PropId == propid) continue;\r\n\r\n        var l_status = srProposals[i].getValue(\'custrecord_propstatus\');\r\n        if(l_status == \'3\' || l_status == \'4\')// Created or Rejected\r\n        {\r\n            nlapiLogExecution(\'Error\',\'Multiple Asset Proposal\',\'Proposal \'+l_PropId+\' rejected or asset created\');\r\n            continue; // not New\r\n        }\r\n\r\n        childProposals[childProposals.length] = srProposals[i];\r\n    }\r\n    return childProposals;\r\n}\r\n/* IndexOfArray - Helper function: returns the first index position of a value in an Array.\r\n * Otherwise it returns -1. */\r\nfunction IndexOfArray(array, val)\r\n{\r\n    for(var i=0; array != null && i < array.length; i++)\r\n        if(val == array[i])\r\n            return i;\r\n    return -1;\r\n}\r\n\r\nfunction GetRemainingUsage()\r\n{\r\n     var context = nlapiGetContext();\r\n    var usageRemaining = context.getRemainingUsage();\r\n     nlapiLogExecution(\'debug\', \'Rem Usage\', usageRemaining);\r\n}\r\n\r\nfunction isStringEmpty(S)\r\n{\r\n    if (S === null)\r\n    {\r\n        return true;\r\n    }\r\n\r\n    if (S === undefined)\r\n    {\r\n        return true;\r\n    }\r\n\r\n    if (S.length == 0)\r\n    {\r\n         return true;\r\n    }\r\n\r\n    return false;\r\n}\r\n\r\n/* ncFAR_BuildReportData_AssetSummary_BG - vls */\r\nfunction ncFAR_BuildReportData_AssetSummary_BG( processID ) {\r\n    var _screen_name = \'assetsummary\';\r\n    \r\n    var _failurePoint;\r\n    var procId;\r\n    var uTarget = 300;    // target number of units to begin suspend process\r\n    var uRem;\r\n    var bAbort = false;    // suspend flag\r\n\r\n    try {\r\n\r\n    /* retrieve script parameters --> process id */\r\n    _failurePoint = \'Retrieve script parameters\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Summary - ncFAR_BuildReportData_AssetRegister_BG\', \'processID: \' + processID + \' | \' + _failurePoint );\r\n    var ctx = nlapiGetContext();\r\n    procId = ctx.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n    if( processID != null )    {\r\n        procId = processID;    // called directly, so use direct parameter not context setting\r\n    }\r\n\r\n    if( procId == null ) {\r\n        return;    // nothing to do - no process record to determine status or log events against\r\n    }\r\n\r\n    /* retrieve process record --> process parameters */\r\n    _failurePoint = \'Retrieve process record\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Summary - ncFAR_BuildReportData\', \'record name: \' + ncConst.BGP_ProcessInstance\r\n            + \' | processID: \' + processID\r\n            + \' | \' + _failurePoint );\r\n    var rProcessInfo = nlapiLoadRecord( ncConst.BGP_ProcessInstance, procId );\r\n    // var rProcessInfo = nlapiLoadRecord( ncConst.BGP_ProcessInstance, processID );\r\n\r\n    if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' ) {\r\n        return;    // nothing to do\r\n    }\r\n\r\n    var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),1);\r\n\r\n    /* retrieve Asset Type list for processing, and current status info */\r\n    var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n    if( (tmpStr == null) || (tmpStr == \'\') )\r\n        tmpStr = \"\";\r\n    var pNames = tmpStr.split(\',\');\r\n    tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n    if( (tmpStr == null) || (tmpStr == \'\') )\r\n        tmpStr = \"\";\r\n    var pValues = tmpStr.split(\',\');\r\n\r\n\r\n    _failurePoint = \'Decode instance parameters\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Summary - ncFAR_BuildReportData\', _failurePoint );\r\n    var currentRowId = \'\';                // currentRowId\r\n    var ATfile = null;                    // ATfile\r\n    var roptStartDate = new Date();        // StartDate\r\n    var roptEndDate = new Date();        // EndDate\r\n    var roptNBVorDEPR = \'T\';            // NBV\r\n    var Subsids;                        // Subsids\r\n    var roptSubsChildren = \'F\';            // InclChild\r\n    var roptLeaseOption = \'all_assets\';    // Leases\r\n\r\n    var roptDeprMethod = 0;                // Method\r\n\r\n    var roptLocation = null;            // Location\r\n    var roptDepartment = null;            // Department\r\n    var roptClass = null;                // Class\r\n    var roptStyle = \'period_rows\';        // Style\r\n\r\n    var AssetType = new Array();    /* Asset Type name (column heading) */\r\n    var ATderef = new Array();        /* array to dereference asset type id to asset type array index */\r\n    var CostBF = new Array();        /* cost or valuation brought forward */\r\n    var Additions = new Array();    /* additions within the period */\r\n    var Disposals = new Array();    /* disposals within the period */\r\n    var CostTotal = new Array();    /* final cost at end of the period, i.e. CostBF + Additions */\r\n    var DeprBF = new Array();        /* depreciation expense brought forward */\r\n    var DeprCharge = new Array();    /* depreciation charge postings within the period */\r\n    var Adjustments = new Array();    /* adjustments (revaluation) within the period */\r\n    var DeprTotal = new Array();    /* final depreciation expense i.e. DeprBF + DeprCharge */\r\n    var NBVcp = new Array();        /* Net Book Value at end of current period, i.e. CostTotal - DeprTotal */\r\n    var NBVpp = new Array();        /* Net Book Value at end of prior period, i.e. CostBF - DeprBF */\r\n\r\n    if( pNames.length == pValues.length ) {\r\n        for(var pN=0; pN < pNames.length; ++pN) {\r\n            switch( pNames[pN] )\r\n            {\r\n                case \'currentRowId\':\r\n                    currentRowId = pValues[pN];\r\n                    break;\r\n                case \'AssetType\':\r\n                    AssetType = pValues[pN];\r\n                    break;\r\n                case \'ATfile\':\r\n                    ATfile = pValues[pN];\r\n                    break;\r\n                case \'StartDate\':\r\n                    roptStartDate = ncDecodeDate(pValues[pN]);\r\n                    break;\r\n                case \'EndDate\':\r\n                    roptEndDate = ncDecodeDate(pValues[pN]);\r\n                    break;\r\n                case \'Subsids\':\r\n                    Subsids = pValues[pN].split(\':\');\r\n                    break;\r\n                case \'InclChild\':\r\n                    roptSubsChildren = pValues[pN];\r\n                    break;\r\n                case \'Leases\':\r\n                    roptLeaseOption = pValues[pN];\r\n                    break;\r\n                case \'Method\':\r\n                    roptDeprMethod = ncParseIntNV(pValues[pN],1);\r\n                    break;\r\n                case \'Location\':\r\n                    roptLocation = pValues[pN];\r\n                    break;\r\n                case \'Department\':\r\n                    roptDepartment = pValues[pN];\r\n                    break;\r\n                case \'Class\':\r\n                    roptClass = pValues[pN];\r\n                    break;\r\n                case \'Style\':\r\n                    roptStyle = pValues[pN];\r\n                    break;\r\n                case \'Language\':\r\n                    //override the declared localizatoin language\r\n                    _current_user_language = pValues[pN];\r\n                    resourceManager = new jp3867ns.Resources.ResourceManager( LOCALIZATION_FILENAME, _current_user_language);\r\n                    break;\r\n                default:\r\n                    // do nothing\r\n            }\r\n        }\r\n\r\n    } else {\r\n\r\n        // all gone wrong - gracefully abort (and log values?)\r\n        ncLogExecution(\'error\',\'ncFAR_BuildReportData_BG\',\'parameter values blank, aborting\');\r\n\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = \'parameter values blank, aborting\';\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n        return;\r\n    }\r\n\r\n    // check currency symbol and integer currencies\r\n    _failurePoint = \'Retrieve currency settings\';\r\n    var IntCurrSym = \'\';\r\n    var CurrSym = \'\';\r\n    var ReportFolderId = \'\';\r\n\r\n    var configCols = new Array();\r\n    configCols[0] = new nlobjSearchColumn(\'custrecord_intcurrsymbols\');\r\n    configCols[1] = new nlobjSearchColumn(\'custrecord_far_reportfolder\');\r\n    var FARConfig = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,configCols);\r\n    if( (FARConfig != null) && (FARConfig.length == 1) ) {\r\n        IntCurrSym = FARConfig[0].getValue(\'custrecord_intcurrsymbols\');\r\n        ReportFolderId = FARConfig[0].getValue(\'custrecord_far_reportfolder\');\r\n    }\r\n\r\n\r\n    /* for each asset in the selected asset types, use searches to retrieve the summary values */\r\n    /* resource issues again - limited number of rows returned by search and limited time & units... */\r\n    var b_SubsidsEnabled = ctx.getFeature(\'SUBSIDIARIES\');\r\n    var b_LocationsEnabled = ctx.getFeature(\'LOCATIONS\');\r\n    var b_DeptsEnabled = ctx.getFeature(\'DEPARTMENTS\');\r\n    var b_ClassesEnabled = ctx.getFeature(\'CLASSES\');\r\n    var currDate = new Date();\r\n\r\n    var DetailURL;\r\n\r\n    var S = new Array(\'(\',\')\');    // array to use for formatting negative numbers, i.e. -1 becomes (1)\r\n    var SubsEnabled = SubsidiariesEnabled();\r\n\r\n    var numIter = 1;\r\n    var currentSub;\r\n    var currentSubName = \'\';\r\n    var subsidiaryChildren;\r\n\r\n    numIter = Subsids.length;\r\n\r\n    // retrieve asset types then for each type retrieve values and accumulate total\r\n    var sfATvalues = AssetType.split(\':\');\r\n    var sfAT;\r\n    if( (sfATvalues.length > 0) && (sfATvalues[0] != \'\') )\r\n        sfAT =[ new nlobjSearchFilter(\'internalid\',null,\'anyOf\',sfATvalues,null), new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null)];\r\n    var srAT = nlapiSearchRecord(ncConst.FAR_AssetType,null,sfAT,new nlobjSearchColumn(\'name\'));\r\n\r\n    var idxTotal = 0;\r\n    if( srAT != null) idxTotal = srAT.length;\r\n\r\n    var i=0;\r\n\r\n    var assetNames = new Array();\r\n    if( srAT != null) {\r\n        for( var j=0; j< srAT.length; ++j ) {\r\n            ATderef[srAT[j].getId()] = j;\r\n            assetNames[assetNames.length] = srAT[j].getValue(\'name\');\r\n        }\r\n    }\r\n\r\n    var bbfDate = nlapiDateToString(roptStartDate);\r\n    bbfDate = nlapiStringToDate(bbfDate);\r\n\r\n    var dayBefore = new Date(bbfDate);\r\n    dayBefore = nlapiAddDays(dayBefore,-1);\r\n\r\n    // initial html setup\r\n    var pageHTML = \'<BR><BR><font color=\"navy\"><B>\' + FAM.resourceManager.GetString(\'custpage_html_fam\', _screen_name) + \'</B></font><BR><BR>\';\r\n\r\n    var RprtMethodName = GetDeprMethodName( roptDeprMethod );\r\n    // var AssetSelect = GetAssetSelection(ReportOptions[5]);\r\n    var AssetSelect = GetAssetSelection( roptLeaseOption );\r\n    pageHTML += RprtMethodName+\' - \'+AssetSelect+\'<br><br>\';\r\n\r\n    //16/5/2010\r\n    var LocationName = \'\';\r\n    var DeptName = \'\';\r\n    var ClassName = \'\';\r\n    if ( !isUndefinedNullOrEmpty( roptLocation ) ) {\r\n        LocationName = nlapiLookupField(\'location\', roptLocation,\'name\');\r\n    }\r\n    if( !isUndefinedNullOrEmpty( roptDepartment ) )    {\r\n        DeptName = nlapiLookupField(\'department\', roptDepartment,\'name\');\r\n    }\r\n    if ( !isUndefinedNullOrEmpty( roptClass ) )    {\r\n            ClassName = nlapiLookupField(\'classification\', roptClass,\'name\');\r\n    }\r\n    pageHTML += nlapiEscapeXML(LocationName)+\' \'+nlapiEscapeXML(DeptName)+\' \'+nlapiEscapeXML(ClassName)+\'<br>\';\r\n\r\n    // for each sub (or once if non-sub)\r\n    for( var Iter=0; Iter<numIter; ++Iter )\r\n    {\r\n        if( SubsidiariesEnabled() )\r\n        {\r\n            currentSub = Subsids[Iter];\r\n            currentSubName = nlapiLookupField(\'subsidiary\',currentSub,\'name\');\r\n        }\r\n\r\n        var TotCostBF = 0.0;\r\n        var TotAdditions = 0.0;\r\n        var TotDisposals = 0.0;\r\n        var TotDeprBF = 0.0;\r\n        var TotDeprCharge = 0.0;\r\n        var TotAdjustments = 0.0;\r\n\r\n        // reset subtotals\r\n        for(i=0; i<idxTotal; ++i)\r\n        {\r\n            CostBF[i] = 0.0;\r\n            Additions[i] = 0.0;\r\n            Disposals[i] = 0.0;\r\n            DeprBF[i] = 0.0;\r\n            DeprCharge[i] = 0.0;\r\n            Adjustments[i] = 0.0;\r\n        }\r\n\r\n        var atId;\r\n        var atIdx;\r\n        var srIdx;\r\n        var sfDeprHist;\r\n        var scDeprHist;\r\n        var srDeprHist;\r\n        var histType;\r\n\r\n        // now get summary values...\r\n        // ...actually needs to look at asset history records, as asset doesn\'t have depreciation by period figures\r\n        // need figures up to (excl) start date, then figures from start date to end date (incl both)\r\n\r\n        // check type\r\n        // ... 1 = addition\r\n        // ... 2 = depreciation\r\n        // ... 3 = sale/disposal (should these offset additions?.... included in BF, separate in Period Amts)\r\n        // extra types added\r\n        // ... 4 = write-down (offset additions.... included in BF, separate in Period Amts)\r\n        // ... 5 = revaluation (include in depreciation.... included in BF, separate in Period Amts)\r\n\r\n        // SEARCH 1: balance brought forward\r\n        sfDeprHist = new Array();\r\n        sfDeprHist[0] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null,\'before\', nlapiDateToString(roptStartDate) ,null);\r\n        sfDeprHist[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\',\'custrecord_deprhistasset\',\'is\',\'T\',null);    // check report option using join\r\n        sfDeprHist[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n        sfDeprHist[3] = new nlobjSearchFilter(\'isinactive\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n        if( SubsidiariesEnabled() )\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistsubsidiary\',null,\'anyof\',currentSub,null);\r\n        if( roptLeaseOption == \'except_leased\' )\r\n            sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'F\',null);//cs\r\n        if( roptLeaseOption == \'leased_only\' )\r\n            sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'T\',null);//cs\r\n\r\n        if (roptDeprMethod > 0) {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', roptDeprMethod, null);\r\n        } else {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', \'@NONE@\', null);\r\n        }\r\n\r\n        if(b_LocationsEnabled && roptLocation != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',\'custrecord_deprhistasset\',\'is\',roptLocation,null);\r\n        }\r\n        if(b_DeptsEnabled && roptDepartment != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetdepartment\',\'custrecord_deprhistasset\',\'is\',roptDepartment,null);\r\n        }\r\n        if(b_ClassesEnabled && roptClass != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetclass\',\'custrecord_deprhistasset\',\'is\',roptClass,null);\r\n        }\r\n        scDeprHist = new Array();\r\n        scDeprHist[0] = new nlobjSearchColumn(\'custrecord_deprhistassettype\',null,\'group\');\r\n        scDeprHist[1] = new nlobjSearchColumn(\'custrecord_deprhisttype\',null,\'group\');\r\n        scDeprHist[2] = new nlobjSearchColumn(\'custrecord_deprhistamount\',null,\'sum\');\r\n        srDeprHist = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfDeprHist,scDeprHist);\r\n\r\n        // searchresults now should be all the values for current sub, grouped by Asset Type and History Type\r\n        // so now restructure these into arrays we can use for reporting\r\n        srIdx = 0;\r\n        while( (srDeprHist != null) && (srIdx < srDeprHist.length ) )\r\n        {\r\n            atId = srDeprHist[srIdx].getValue(\'custrecord_deprhistassettype\',null,\'group\');\r\n            atIdx = ATderef[atId];\r\n            histType = srDeprHist[srIdx].getValue(\'custrecord_deprhisttype\',null,\'group\');\r\n\r\n            switch(histType)\r\n            {\r\n                case \'1\':\r\n                    CostBF[atIdx] += ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                case \'2\':\r\n                case \'5\':\r\n                    DeprBF[atIdx] += ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                case \'3\':\r\n                case \'4\':    // note: -= not += below\r\n                    CostBF[atIdx] -= ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                default:\r\n                    break;\r\n            }\r\n\r\n            ++srIdx;\r\n        }\r\n\r\n        // SEARCH 2: current values\r\n        sfDeprHist = new Array();\r\n        // sfDeprHist[0] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null,\'within\',nlapiDateToString(bbfDate),ReportOptions[3]);\r\n        sfDeprHist[0] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null,\'within\', bbfDate , roptEndDate);\r\n        sfDeprHist[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\',\'custrecord_deprhistasset\',\'is\',\'T\',null);    // check report option using join\r\n        sfDeprHist[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n        sfDeprHist[3] = new nlobjSearchFilter(\'isinactive\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n        if( SubsidiariesEnabled() )\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistsubsidiary\',null,\'anyof\',currentSub,null);\r\n        if( roptLeaseOption == \'except_leased\' )\r\n            sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n        if( roptLeaseOption == \'leased_only\' )\r\n            sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'T\',null);\r\n\r\n        if (roptDeprMethod > 0) {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', roptDeprMethod, null);\r\n        } else {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', \'@NONE@\', null);\r\n        }\r\n\r\n        if(b_LocationsEnabled && roptLocation != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',\'custrecord_deprhistasset\',\'is\', roptLocation ,null);\r\n        }\r\n        if(b_DeptsEnabled && roptDepartment != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetdepartment\',\'custrecord_deprhistasset\',\'is\', roptDepartment ,null);\r\n        }\r\n        // if(b_ClassesEnabled && ReportOptions[10] != \'\')\r\n        if(b_ClassesEnabled && roptClass != \'\')\r\n        {\r\n            sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetclass\',\'custrecord_deprhistasset\',\'is\', roptClass ,null);\r\n        }\r\n        scDeprHist = new Array();\r\n        scDeprHist[0] = new nlobjSearchColumn(\'custrecord_deprhistassettype\',null,\'group\');\r\n        scDeprHist[1] = new nlobjSearchColumn(\'custrecord_deprhisttype\',null,\'group\');\r\n        scDeprHist[2] = new nlobjSearchColumn(\'custrecord_deprhistamount\',null,\'sum\');\r\n        srDeprHist = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfDeprHist,scDeprHist);\r\n\r\n        // searchresults now should be all the values for current sub, grouped by Asset Type and History Type\r\n        // so now restructure these into arrays we can use for reporting\r\n        srIdx = 0;\r\n        while( (srDeprHist != null) && (srIdx < srDeprHist.length ) )\r\n        {\r\n            atId = srDeprHist[srIdx].getValue(\'custrecord_deprhistassettype\',null,\'group\');\r\n            atIdx = ATderef[atId];\r\n            histType = srDeprHist[srIdx].getValue(\'custrecord_deprhisttype\',null,\'group\');\r\n\r\n            switch(histType)\r\n            {\r\n                case \'1\':\r\n                    Additions[atIdx] += ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                case \'2\':\r\n                    DeprCharge[atIdx] += ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                case \'3\':\r\n                case \'4\':    // note: -= not += below\r\n                    Disposals[atIdx] -= ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                case \'5\':\r\n                    Adjustments[atIdx] += ncParseFloatNV( srDeprHist[srIdx].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    break;\r\n                default:\r\n                    break;\r\n            }\r\n\r\n            ++srIdx;\r\n        }\r\n\r\n        for(i=0; i<idxTotal; ++i)\r\n        {\r\n            CostTotal[i] = CostBF[i] + Additions[i] + Disposals[i];\r\n            DeprTotal[i] = DeprBF[i] + DeprCharge[i] + Adjustments[i];\r\n            NBVcp[i] = CostTotal[i] - DeprTotal[i];\r\n            NBVpp[i] = CostBF[i] - DeprBF[i];\r\n\r\n            TotCostBF += CostBF[i];\r\n            TotAdditions += Additions[i];\r\n            TotDisposals += Disposals[i];\r\n            TotDeprBF += DeprBF[i];\r\n            TotDeprCharge += DeprCharge[i];\r\n            TotAdjustments += Adjustments[i];\r\n        }\r\n\r\n        AssetType[idxTotal] = FAM.resourceManager.GetString(\'custpage_html_total\', _screen_name);\r\n        assetNames[idxTotal] = FAM.resourceManager.GetString(\'custpage_html_total\', _screen_name);\r\n        CostBF[idxTotal] = TotCostBF;\r\n        Additions[idxTotal] = TotAdditions;\r\n        Disposals[idxTotal] = TotDisposals;\r\n        DeprBF[idxTotal] = TotDeprBF;\r\n        DeprCharge[idxTotal] = TotDeprCharge;\r\n        Adjustments[idxTotal] = TotAdjustments;\r\n        CostTotal[idxTotal] = CostBF[idxTotal] + Additions[idxTotal] + Disposals[idxTotal];\r\n        DeprTotal[idxTotal] = DeprBF[idxTotal] + DeprCharge[idxTotal] + Adjustments[idxTotal];\r\n        NBVcp[idxTotal] = CostTotal[idxTotal] - DeprTotal[idxTotal];\r\n        NBVpp[idxTotal] = CostBF[idxTotal] - DeprBF[idxTotal];\r\n\r\n        var S = new Array(\'(\',\')\');    // array to use for formatting negative numbers, i.e. -1 becomes (1)\r\n        var n = assetNames.length;\r\n\r\n        // if not first page, add page break before new sub\r\n        if( Iter > 0 )\r\n            pageHTML += \'<p style=\"page-break-before:always\">\';\r\n\r\n        if( SubsidiariesEnabled() )\r\n            pageHTML += \'<p style=\"width:500px;font-size:14px;font-weight:bold;font-family:Arial\" align=\"center\">\' + FAM.resourceManager.GetString(\'custpage_html_tangible\', _screen_name) + \' - \'+nlapiEscapeXML(currentSubName)+\'</p>\';\r\n        else\r\n            pageHTML += \'<p style=\"width:500px;font-size:14px;font-weight:bold;font-family:Arial\" align=\"center\">\' + FAM.resourceManager.GetString(\'custpage_html_tangible\', _screen_name) + \'</p>\';\r\n        pageHTML += \'<p> </p><div><table style=\"font-size:12px;font-family:Arial\"><tr valign=\"top\"><td align=\"left\" width=\"150px\" style=\"font-weight:bold\"></td>\';\r\n\r\n        for( i=0; i<n; ++i ) {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"font-weight:bold\">\'+nlapiEscapeXML( assetNames[i] )+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\" style=\"font-weight:bold\"></td>\';\r\n        // Determine currency symbol.  If subsid(), read from current subsid, otherwise read from Company\r\n        var currSym = \'\';\r\n        if (SubsidiariesEnabled() && currentSub) {\r\n            if (ncIsFeatureEnabled(\'multicurrency\')) {\r\n                currSym = nlapiLookupField(\'currency\', nlapiLookupField(\'subsidiary\',\r\n                    currentSub, \'currency\'), \'symbol\');\r\n            }\r\n        }\r\n\r\n        for( i=0; i<n; ++i )\r\n        {\r\n                pageHTML += \'<td align=\"right\" width=\"110px\" style=\"font-weight:bold\">\'+currSym+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr><td> </td></tr><tr valign=\"top\"><td align=\"left\" width=\"150px\" style=\"font-weight:bold\">\' + FAM.resourceManager.GetString(\'custpage_html_costorvaluation\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"font-weight:bold\"></td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML( nlapiDateToString(bbfDate)))) +\'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(CostBF[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_additions\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(Additions[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_disposals\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(Disposals[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML( nlapiDateToString(roptEndDate))))+\'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:black;border-top-width:1px;border-top-style:solid;border-top-color:black\">\'\r\n                    +nlapiEscapeXML(ncFormatNumber(CostTotal[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr><td> </td></tr><tr valign=\"top\"><td align=\"left\" width=\"150px\" style=\"font-weight:bold\">\' + FAM.resourceManager.GetString(\'custpage_html_depreciation\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"font-weight:bold\"></td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML( nlapiDateToString(bbfDate)))) +\'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(DeprBF[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_chargeperiod\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(DeprCharge[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_adjustments\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\">\'+nlapiEscapeXML(ncFormatNumber(Adjustments[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML( nlapiDateToString(roptEndDate)))) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:black;border-top-width:1px;border-top-style:solid;border-top-color:black\">\'\r\n                    +nlapiEscapeXML(ncFormatNumber(DeprTotal[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr><td> </td></tr><tr valign=\"top\"><td align=\"left\" width=\"150px\" style=\"font-weight:bold\">\' + FAM.resourceManager.GetString(\'custpage_html_nbv\',_screen_name) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"font-weight:bold\"></td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML( nlapiDateToString(roptEndDate)))) + \'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"border-bottom-width:4px;border-bottom-style:double;border-bottom-color:black\">\'\r\n                    +nlapiEscapeXML(ncFormatNumber(NBVcp[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr><tr valign=\"top\"><td align=\"left\" width=\"150px\">\' + FAM.resourceManager.GetString(\'custpage_html_at\',_screen_name, null, new Array(nlapiEscapeXML(nlapiDateToString(dayBefore)))) +\'</td>\';\r\n        for( i=0; i<n; ++i )\r\n        {\r\n            pageHTML += \'<td align=\"right\" width=\"110px\" style=\"border-bottom-width:4px;border-bottom-style:double;border-bottom-color:black\">\'\r\n                    +nlapiEscapeXML(ncFormatNumber(NBVpp[i], \',\', \'.\', 2, S, \'\'))+\'</td>\';\r\n        }\r\n        pageHTML += \'</tr></table></div>\';\r\n    }\r\n\r\n\r\n    _failurePoint = \'Store report HTML result\';\r\n    var stUserName = rProcessInfo.getFieldText(\'custrecord_far_proins_procuser\');\r\n    fileObj = nlapiCreateFile(\'FAR_AssetManagementReport_AT\'+stUserName+\'.htm\',\'HTMLDOC\', pageHTML);\r\n    fileObj.setDescription(FAM.resourceManager.GetString(\'custpage_desc_schedulereport\',_screen_name));\r\n    fileObj.setFolder(ReportFolderId);\r\n    ATfile = nlapiSubmitFile(fileObj);    // will replace file if it exists\r\n\r\n    if ((ATfile == null) || (ATfile == \'\') || (ATfile == -1)) {\r\n        var fileErr = \'Unable to store report results (nlapiSubmitFile)\';\r\n        ncLogExecution(\'Error\',\'nlapiSubmitFile returned invalid file id\',fileErr);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = fileErr;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+fileErr,\'Error\');\r\n        return;    // and bail out\r\n    }\r\n\r\n    // really finished - update process control record for completion\r\n    fNames = new Array();\r\n    fNames[0] = \'custrecord_far_proins_statedefn\';\r\n    fNames[1] = \'custrecord_far_proins_procstate\';\r\n    fNames[2] = \'custrecord_far_proins_reccount\';\r\n    fNames[3] = \'custrecord_far_proins_procstatus\';\r\n    fNames[4] = \'custrecord_far_proins_activitytype\';\r\n    fValues = new Array();\r\n    fValues[0] = \'AssetType,ReportFile\';\r\n    fValues[1] = AssetType + \',\' + ATfile;\r\n    fValues[2] = l_RecordCount.toString();\r\n    fValues[3] = \'2\';    // status 2 = completed\r\n    fValues[4] = \'3\';    // activity type 3 = planned schedule\r\n\r\n    nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n    // log activity\r\n    ncBGP_WriteToLog(procId,\'\',\'Processing completed\',\'Message\');\r\n\r\n    return;\r\n\r\n    } catch (GE) {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            if( typeof(ST) == \'string\' )\r\n                msg += \'<BR>\'+ST;\r\n            else    // in case we ever do get an array...\r\n                for( var nST=0; nST<ST.length; ++nST )\r\n                    if( ST[nST] != \'undefined\' )\r\n                        msg += \'<BR>\'+ST[nST];\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'_failurePoint\',_failurePoint);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n    }\r\n}\r\n\r\n/* ncFAR_BuildReportData_AssetRegister_BG - vls */\r\nfunction ncFAR_BuildReportData_AssetRegister_BG( processID ) {\r\n\r\n    var _screen_name = \'assetregister\';\r\n\r\n    var _failurePoint;\r\n    var procId;\r\n    var uTarget = 300;    // target number of units to begin suspend process\r\n    var uRem;\r\n    var bAbort = false;    // suspend flag\r\n\r\n    try {\r\n\r\n    /* retrieve script parameters --> process id */\r\n    _failurePoint = \'Retrieve script parameters\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Management - ncFAR_BuildReportData_AssetRegister_BG\', \'processID: \' + processID + \' | \' + _failurePoint );\r\n    var ctx = nlapiGetContext();\r\n    procId = ctx.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n    if( processID != null )    {\r\n        procId = processID;    // called directly, so use direct parameter not context setting\r\n    }\r\n\r\n    if( procId == null ) {\r\n        return;    // nothing to do - no process record to determine status or log events against\r\n    }\r\n\r\n    /* retrieve process record --> process parameters */\r\n    _failurePoint = \'Retrieve process record\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Management - ncFAR_BuildReportData\', \'record name: \' + ncConst.BGP_ProcessInstance\r\n            + \' | processID: \' + processID\r\n            + \' | \' + _failurePoint );\r\n    var rProcessInfo = nlapiLoadRecord( ncConst.BGP_ProcessInstance, procId );\r\n\r\n    if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' ) {\r\n        return;    // nothing to do\r\n    }\r\n\r\n    var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),1);\r\n\r\n    /* retrieve Asset Type list for processing, and current status info */\r\n    var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n    if( (tmpStr == null) || (tmpStr == \'\') )\r\n        tmpStr = \"\";\r\n    var pNames = tmpStr.split(\',\');\r\n    tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n    if( (tmpStr == null) || (tmpStr == \'\') )\r\n        tmpStr = \"\";\r\n    var pValues = tmpStr.split(\',\');\r\n\r\n\r\n    _failurePoint = \'Decode instance parameters\';\r\n    nlapiLogExecution(\'DEBUG\', \'Asset Management - ncFAR_BuildReportData\', _failurePoint );\r\n    var currentRowId = \'\';                // currentRowId\r\n    //var AType;                            // AType\r\n    var ATfile = null;                    // ATfile\r\n    var roptStartDate = new Date();        // StartDate\r\n    var roptEndDate = new Date();        // EndDate\r\n    var roptNBVorDEPR = \'T\';            // NBV\r\n    var Subsids;                        // Subsids\r\n    var roptSubsChildren = \'F\';            // InclChild\r\n    var roptLeaseOption = \'all_assets\';    // Leases\r\n\r\n    var roptDeprMethod = 0;                // Method\r\n\r\n    var roptLocation = null;            // Location\r\n    var roptDepartment = null;            // Department\r\n    var roptClass = null;                // Class\r\n    var roptStyle = \'period_rows\';        // Style\r\n\r\n    var AssetType = new Array();    /* Asset Type name (column heading) */\r\n    var CostBF = new Array();        /* cost or valuation brought forward */\r\n    var Additions = new Array();    /* additions within the period */\r\n    var CostTotal = new Array();    /* final cost at end of the period, i.e. CostBF + Additions */\r\n    var DeprBF = new Array();        /* depreciation expense brought forward */\r\n    var DeprCharge = new Array();    /* depreciation charge postings within the period */\r\n    var DeprTotal = new Array();    /* final depreciation expense i.e. DeprBF + DeprCharge */\r\n    var NBVcp = new Array();        /* Net Book Value at end of current period, i.e. CostTotal - DeprTotal */\r\n    var NBVpp = new Array();        /* Net Book Value at end of prior period, i.e. CostBF - DeprBF */\r\n    var AssetCostBF;\r\n    var AssetAdditions;\r\n    var AssetDeprBF;\r\n    var AssetDeprCharge;\r\n\r\n    if( pNames.length == pValues.length ) {\r\n        for(var pN=0; pN < pNames.length; ++pN) {\r\n            switch( pNames[pN] )\r\n            {\r\n                case \'currentRowId\':\r\n                    currentRowId = pValues[pN];\r\n                    break;\r\n                case \'AssetType\':\r\n                    AssetType = pValues[pN];\r\n                    break;\r\n                case \'ATfile\':\r\n                    ATfile = pValues[pN];\r\n                    break;\r\n                case \'StartDate\':\r\n                    roptStartDate = ncDecodeDate(pValues[pN]);\r\n                    break;\r\n                case \'EndDate\':\r\n                    roptEndDate = ncDecodeDate(pValues[pN]);\r\n                    break;\r\n                case \'Subsids\':\r\n                    Subsids = pValues[pN].split(\':\');\r\n                    break;\r\n                case \'InclChild\':\r\n                    roptSubsChildren = pValues[pN];\r\n                    break;\r\n                case \'Leases\':\r\n                    roptLeaseOption = pValues[pN];\r\n                    break;\r\n                case \'Method\':\r\n                    roptDeprMethod = ncParseIntNV(pValues[pN],1);\r\n                    break;\r\n                case \'Location\':\r\n                    roptLocation = pValues[pN];\r\n                    break;\r\n                case \'Department\':\r\n                    roptDepartment = pValues[pN];\r\n                    break;\r\n                case \'Class\':\r\n                    roptClass = pValues[pN];\r\n                    break;\r\n                case \'Style\':\r\n                    roptStyle = pValues[pN];\r\n                    break;\r\n                case \'Language\':\r\n                    //override the declared localizatoin language\r\n                    _current_user_language = pValues[pN];\r\n                    resourceManager = new jp3867ns.Resources.ResourceManager( LOCALIZATION_FILENAME, _current_user_language);\r\n                    break;\r\n                default:\r\n                    // do nothing\r\n            }\r\n        }\r\n\r\n    } else {\r\n\r\n        // all gone wrong - gracefully abort (and log values?)\r\n        ncLogExecution(\'error\',\'ncFAR_BuildReportData_BG\',\'parameter values blank, aborting\');\r\n\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = \'parameter values blank, aborting\';\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n        return;\r\n    }\r\n\r\n    // check currency symbol and integer currencies\r\n    _failurePoint = \'Retrieve currency settings\';\r\n    var IntCurrSym = \'\';\r\n    var CurrSym = \'\';\r\n    var ReportFolderId = \'\';\r\n\r\n    var configCols = new Array();\r\n    configCols[0] = new nlobjSearchColumn(\'custrecord_intcurrsymbols\');\r\n    configCols[1] = new nlobjSearchColumn(\'custrecord_far_reportfolder\');\r\n    var FARConfig = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,configCols);\r\n    if( (FARConfig != null) && (FARConfig.length == 1) ) {\r\n        IntCurrSym = FARConfig[0].getValue(\'custrecord_intcurrsymbols\');\r\n        ReportFolderId = FARConfig[0].getValue(\'custrecord_far_reportfolder\');\r\n    }\r\n\r\n\r\n    /* for each asset in the selected asset types, use searches to retrieve the summary values */\r\n    /* resource issues again - limited number of rows returned by search and limited time & units... */\r\n    var b_SubsidsEnabled = ctx.getFeature(\'SUBSIDIARIES\');\r\n    var b_LocationsEnabled = ctx.getFeature(\'LOCATIONS\');\r\n    var b_DeptsEnabled = ctx.getFeature(\'DEPARTMENTS\');\r\n    var b_ClassesEnabled = ctx.getFeature(\'CLASSES\');\r\n    var currDate = new Date();\r\n\r\n    /* read the asset data and accumulate into array fields for subsequent conversion to xml */\r\n    /* each array element maps to a report column, which are the figures for a specific asset type */\r\n    /* each distinct array is a report row providing data for the report */\r\n    var DetailURL;\r\n\r\n    var S = new Array(\'(\',\')\');    // array to use for formatting negative numbers, i.e. -1 becomes (1)\r\n    var SubsEnabled = SubsidiariesEnabled();\r\n\r\n    /* multi-subsid:\r\n        Need to process all the following code per subsid, accumulating HTML\r\n        ... ReportOptions[1].split(\'\'); to build array of subsids\r\n    */\r\n    var numIter = 1;\r\n    var currentSub;\r\n    var currentSubName = \'\';\r\n    var subsidiaryChildren;\r\n\r\n    numIter = Subsids.length;\r\n\r\n    // retrieve asset types then for each type retrieve values and accumulate total\r\n    var sfATvalues = AssetType.split(\':\');\r\n    var sfAT;\r\n    if( (sfATvalues.length > 0) && (sfATvalues[0] != \'\') )\r\n        sfAT =[ new nlobjSearchFilter(\'internalid\',null,\'anyOf\',sfATvalues,null), new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null)];\r\n    var srAT = nlapiSearchRecord(ncConst.FAR_AssetType,null,sfAT,new nlobjSearchColumn(\'name\'));\r\n\r\n    var idxTotal = 0;\r\n    if( srAT != null) idxTotal = srAT.length;\r\n\r\n    var bbfDate = nlapiDateToString(roptStartDate);\r\n    bbfDate = nlapiStringToDate(bbfDate);\r\n\r\n    var dayBefore = new Date(bbfDate);\r\n    dayBefore = nlapiAddDays(dayBefore,-1);\r\n\r\n    var pageHTML = \'<BR><BR><font color=\"navy\"><B>\' + FAM.resourceManager.GetString(\'custpage_html_fam\',_screen_name) + \'</B></font><BR><BR>\';\r\n\r\n    var RprtMethodName = GetDeprMethodName( roptDeprMethod );\r\n    var AssetSelect = GetAssetSelection( roptLeaseOption );\r\n    pageHTML += RprtMethodName+\' - \' +AssetSelect+\'<br><br>\';\r\n\r\n    var LocationName = \'\';\r\n    var DeptName = \'\';\r\n    var ClassName = \'\';\r\n    if ( !isUndefinedNullOrEmpty( roptLocation ) )\r\n    {\r\n        LocationName = nlapiLookupField(\'location\',roptLocation,\'name\');\r\n    }\r\n    if( (roptDepartment != null) && (roptDepartment != \'\') )\r\n    {\r\n        DeptName = nlapiLookupField(\'department\',roptDepartment,\'name\');\r\n    }\r\n    if ( roptClass != null && roptClass != \'\')\r\n    {\r\n        ClassName = nlapiLookupField(\'classification\',roptClass,\'name\');\r\n    }\r\n\r\n    // for each sub (or once if non-sub)\r\n    for( var Iter=0; Iter<numIter; ++Iter )\r\n    {\r\n        nlapiLogExecution(\'DEBUG\', \'Asset Management - ncFAR_BuildReportData [START]\', \'Remaining Usage before for loop: \' + nlapiGetContext().getRemainingUsage() );\r\n        if( SubsEnabled )\r\n        {\r\n            currentSub = Subsids[Iter];\r\n            currentSubName = nlapiLookupField( \'subsidiary\', currentSub , \'name\' ); /* can be optimized - vls */\r\n        }\r\n        nlapiLogExecution(\'DEBUG\', \'Asset Management - ncFAR_BuildReportData\', currentSub + \' : \' + currentSubName );\r\n\r\n        pageHTML += \'<B>\'+FAM.resourceManager.GetString(\'custpage_html_assetmanagement\',_screen_name, null, new Array(nlapiEscapeXML(currentSubName))) + \'</B><br>\';\r\n        pageHTML += \'<B>\'+nlapiEscapeXML(LocationName)+\' \'+nlapiEscapeXML(DeptName)+\' \'+nlapiEscapeXML(ClassName)+\'</B><br>\';\r\n        pageHTML += \'<table cellpadding=\"2\" style=\"border-top-width:0;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:none\">\';\r\n        pageHTML += \'<tr style=\"border-width=0;border-style:none;font-size=11\"><td width=\"150px\" valign=\"bottom\" rowspan=\"2\">\' + FAM.resourceManager.GetString(\'custpage_html_assettype\',_screen_name) + \'</td><td width=\"150px\" valign=\"bottom\" rowspan=\"2\">\' + FAM.resourceManager.GetString(\'custpage_html_assetname\',_screen_name) + \'</td><td width=\"250px\" valign=\"bottom\" rowspan=\"2\">\' + FAM.resourceManager.GetString(\'custpage_html_description\',_screen_name) + \'</td><td width=\"150px\" align=\"center\" rowspan=\"2\">\' + FAM.resourceManager.GetString(\'custpage_html_acquisitiondate\',_screen_name) + \'</td>\';\r\n        pageHTML += \'<td colspan=\"3\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:1;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\' + FAM.resourceManager.GetString(\'custpage_html_cost\',_screen_name) + \'</td>\';\r\n        pageHTML += \'<td colspan=\"3\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:1;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\' + FAM.resourceManager.GetString(\'custpage_html_accdepreciation\',_screen_name) + \'</td>\';\r\n        pageHTML += \'<td colspan=\"2\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\' + FAM.resourceManager.GetString(\'custpage_html_nbv\',_screen_name) + \'</td></tr>\';\r\n        pageHTML += \'<tr style=\"border-width=0;border-style:none;font-size=11\"><td width=\"150px\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+nlapiDateToString(roptStartDate)+\'</td>\';\r\n        pageHTML += \'<td width=\"150px\" align=\"center\">\' + FAM.resourceManager.GetString(\'custpage_html_additions\',_screen_name) + \'</td><td width=\"150px\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:0;border-right-width:1;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+nlapiDateToString(roptEndDate)+\'</td>\';\r\n        pageHTML += \'<td width=\"150px\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+nlapiDateToString(roptStartDate)+\'</td>\';\r\n        pageHTML += \'<td width=\"150px\" align=\"center\">\' + FAM.resourceManager.GetString(\'custpage_html_depreciation\',_screen_name) + \'</td><td width=\"150px\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:0;border-right-width:1;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+nlapiDateToString(roptEndDate)+\'</td>\';\r\n        pageHTML += \'<td width=\"150px\" align=\"center\" style=\"border-top-width:0;border-bottom-width:0;border-left-width:1;border-right-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+nlapiDateToString(roptEndDate)+\'</td>\';\r\n        pageHTML += \'<td width=\"150px\" align=\"center\">\'+nlapiDateToString(roptStartDate)+\'</td></tr>\';\r\n        pageHTML += \'<tr><td> </td></tr>\';\r\n\r\n        var TotCostBF = 0.0;\r\n        var TotAdditions = 0.0;\r\n        var TotDeprBF = 0.0;\r\n        var TotDeprCharge = 0.0;\r\n\r\n        var i=0;\r\n        var atId;\r\n        var sfDeprHist;\r\n        var scDeprHist;\r\n        var srDeprHist;\r\n\r\n        var subEmpty = true;\r\n\r\n        while( (srAT != null) && (i < srAT.length) )\r\n        {\r\n            var atEmpty = true;\r\n            var currentAssetType = \'\';\r\n\r\n            currentAssetType = srAT[i].getValue(\'name\');\r\n            AssetType[i] = srAT[i].getValue(\'name\');\r\n            atId = srAT[i].getId();\r\n            // initialise array elements - ensures they exist!\r\n            CostBF[i] = 0.0;\r\n            Additions[i] = 0.0;\r\n            DeprBF[i] = 0.0;\r\n            DeprCharge[i] = 0.0;\r\n\r\n            // now get summary values from all the assets of this type... per asset now...\r\n\r\n            // search for assets, loop through results\r\n            var sfAssets = new Array();\r\n            var scAssets = new Array();\r\n            sfAssets[0] = new nlobjSearchFilter(\'custrecord_assettype\',null,\'anyOf\',atId,null);\r\n            sfAssets[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\',null,\'is\',\'T\',null);\r\n            sfAssets[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n            if( SubsEnabled )\r\n                    sfAssets[sfAssets.length] = new nlobjSearchFilter(\'custrecord_assetsubsidiary\',null,\'anyof\',currentSub,null);//cs\r\n            if( roptLeaseOption == \'except_leased\' )\r\n                sfAssets[sfAssets.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',null,\'is\',\'F\',null);//cs 5/5/09\r\n            else if( roptLeaseOption == \'leased_only\' )\r\n                sfAssets[sfAssets.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',null,\'is\',\'T\',null);//cs 5/5/09\r\n\r\n            if((roptDeprMethod*1) > 0) {\r\n                var assetIDs = [];\r\n                var searchResAltDepr = nlapiSearchRecord(\'customrecord_ncfar_altdepreciation\',null,\r\n                                        new nlobjSearchFilter(\'custrecord_altdepraltmethod\',null,\'anyof\',roptDeprMethod),\r\n                                        new nlobjSearchColumn(\'custrecord_altdeprasset\'));\r\n                if (searchResAltDepr != null) {\r\n                    for (var ctr=0; ctr<searchResAltDepr.length; ctr++) {\r\n                        assetIDs.push(searchResAltDepr[ctr].getValue(\'custrecord_altdeprasset\'));\r\n                    }\r\n                }\r\n                sfAssets[sfAssets.length] =  new nlobjSearchFilter(\'internalid\',null,\'anyof\',assetIDs);\r\n            }\r\n\r\n             if(b_LocationsEnabled && roptLocation != \'\')\r\n            {\r\n                sfAssets[sfAssets.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',null,\'is\',roptLocation,null);\r\n            }\r\n            if(b_DeptsEnabled && roptDepartment != \'\')\r\n            {\r\n                sfAssets[sfAssets.length] = new nlobjSearchFilter(\'custrecord_assetdepartment\',null,\'is\',roptDepartment,null);\r\n            }\r\n            if(b_ClassesEnabled && roptClass != \'\')\r\n            {\r\n                sfAssets[sfAssets.length] = new nlobjSearchFilter(\'custrecord_assetclass\',null,\'is\',roptClass,null);\r\n            }\r\n\r\n            scAssets[0] = new nlobjSearchColumn(\'altname\');\r\n            scAssets[1] = new nlobjSearchColumn(\'custrecord_assetdeprstartdate\');\r\n            scAssets[2] = new nlobjSearchColumn(\'custrecord_assetdescr\');\r\n            scAssets[3] = new nlobjSearchColumn(\'custrecord_assetsubsidiary\');\r\n\r\n            /* search asset record - vls */\r\n            var srAssets = nlapiSearchRecord(ncConst.FAR_Asset,null,sfAssets,scAssets);\r\n            if ((srAssets != null) && (srAssets.length > 0)) {\r\n                // now search again, but group by asset and hist type, and sum the amount - still need two searches for\r\n                // BF balance and period movement\r\n\r\n                // BF balances\r\n                sfDeprHist = new Array();\r\n                sfDeprHist[0] = new nlobjSearchFilter(\'custrecord_deprhistassettype\', null, \'anyOf\', atId, null);\r\n                sfDeprHist[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\', \'custrecord_deprhistasset\', \'is\', \'T\', null);\r\n                sfDeprHist[2] = new nlobjSearchFilter(\'custrecord_deprhisttype\', null, \'anyOf\', [\'1\', \'2\', \'3\', \'4\', \'5\'], null);\r\n                sfDeprHist[3] = new nlobjSearchFilter(\'custrecord_deprhistdate\', null, \'before\', nlapiDateToString(bbfDate), null);\r\n                sfDeprHist[4] = new nlobjSearchFilter(\'isinactive\', null, \'is\', \'F\', null);\r\n                sfDeprHist[5] = new nlobjSearchFilter(\'isinactive\', \'custrecord_deprhistasset\', \'is\', \'F\', null);\r\n                if (SubsEnabled)\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistsubsidiary\', null, \'anyof\', currentSub, null);\r\n                if (roptLeaseOption == \'except_leased\')\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetisleased\', \'custrecord_deprhistasset\', \'is\', \'F\', null);\r\n                if (roptLeaseOption == \'leased_only\')\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetisleased\', \'custrecord_deprhistasset\', \'is\', \'T\', null);\r\n\r\n                if (roptDeprMethod > 0) {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', roptDeprMethod, null);\r\n                } else {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', \'@NONE@\', null);\r\n                }\r\n\r\n                if(b_LocationsEnabled && roptLocation != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',\'custrecord_deprhistasset\',\'is\',roptLocation,null);\r\n                }\r\n                if(b_DeptsEnabled && roptDepartment != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetdepartment\',\'custrecord_deprhistasset\',\'is\',roptDepartment,null);\r\n                }\r\n                if(b_ClassesEnabled && roptClass != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetclass\',\'custrecord_deprhistasset\',\'is\',roptClass,null);\r\n                }\r\n\r\n                scDeprHist = new Array();\r\n                scDeprHist[0] = new nlobjSearchColumn(\'custrecord_deprhistasset\',null,\'group\');\r\n                scDeprHist[1] = new nlobjSearchColumn(\'custrecord_deprhisttype\',null,\'group\');\r\n                scDeprHist[2] = new nlobjSearchColumn(\'custrecord_deprhistamount\',null,\'sum\');\r\n\r\n                srDeprHistBF = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfDeprHist,scDeprHist);\r\n                // stash search result indexes in named array by asset id, so can look up asset details without re-reading the data\r\n                var aDHBF = new Array();\r\n                var srIdx = 0;\r\n                var aHash = \'\';\r\n                while ( (srDeprHistBF != null) && (srIdx < srDeprHistBF.length) )\r\n                {\r\n                    aHash = srDeprHistBF[srIdx].getValue(\'custrecord_deprhistasset\',null,\'group\') + \'-\' + srDeprHistBF[srIdx].getValue(\'custrecord_deprhisttype\',null,\'group\');\r\n                    aDHBF[aHash] = srIdx;\r\n                    ++srIdx;\r\n                }\r\n\r\n                // Period Movement balances\r\n                sfDeprHist = new Array();\r\n                sfDeprHist[0] = new nlobjSearchFilter(\'custrecord_deprhistassettype\',null,\'anyOf\',atId,null);\r\n                sfDeprHist[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\',\'custrecord_deprhistasset\',\'is\',\'T\',null);\r\n                sfDeprHist[2] = new nlobjSearchFilter(\'custrecord_deprhisttype\',null,\'anyOf\',[\'1\',\'2\',\'3\',\'4\',\'5\'],null);\r\n                sfDeprHist[3] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null,\'within\',nlapiDateToString(bbfDate),roptEndDate );\r\n                sfDeprHist[4] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n                sfDeprHist[5] = new nlobjSearchFilter(\'isinactive\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n                if( SubsEnabled )\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistsubsidiary\',null,\'anyof\',currentSub,null);\r\n                if( roptLeaseOption == \'except_leased\' )\r\n                    sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n                if( roptLeaseOption == \'leased_only\' )\r\n                    sfDeprHist[sfDeprHist.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',\'custrecord_deprhistasset\',\'is\',\'T\',null);\r\n\r\n                if (roptDeprMethod > 0) {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', roptDeprMethod, null);\r\n                } else {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', \'@NONE@\', null);\r\n                }\r\n\r\n                 if(b_LocationsEnabled && roptLocation != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',\'custrecord_deprhistasset\',\'is\',roptLocation,null);\r\n                }\r\n                if(b_DeptsEnabled && roptDepartment != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetdepartment\',\'custrecord_deprhistasset\',\'is\',roptDepartment,null);\r\n                }\r\n                if(b_ClassesEnabled && roptClass != \'\')\r\n                {\r\n                    sfDeprHist[sfDeprHist.length] = new nlobjSearchFilter(\'custrecord_assetclass\',\'custrecord_deprhistasset\',\'is\',roptClass,null);\r\n                }\r\n\r\n                scDeprHist = new Array();\r\n                scDeprHist[0] = new nlobjSearchColumn(\'custrecord_deprhistasset\',null,\'group\');\r\n                scDeprHist[1] = new nlobjSearchColumn(\'custrecord_deprhisttype\',null,\'group\');\r\n                scDeprHist[2] = new nlobjSearchColumn(\'custrecord_deprhistamount\',null,\'sum\');\r\n\r\n                srDeprHistPM = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfDeprHist,scDeprHist);\r\n                // stash search result indexes in named array by asset id, so can look up asset details without re-reading the data\r\n                var aDHPM = new Array();\r\n                srIdx = 0;\r\n                aHash = \'\';\r\n                while ( (srDeprHistPM != null) && (srIdx < srDeprHistPM.length) )\r\n                {\r\n                    aHash = srDeprHistPM[srIdx].getValue(\'custrecord_deprhistasset\',null,\'group\') + \'-\' + srDeprHistPM[srIdx].getValue(\'custrecord_deprhisttype\',null,\'group\');\r\n                    aDHPM[aHash] = srIdx;\r\n                    ++srIdx;\r\n                }\r\n\r\n                // so, now we have SR for Assets, SR for BF by asset,type and SR for PM by asset,type\r\n                // loop through Assets, lookup values and build html...\r\n                var Aidx = 0;\r\n                var AId;\r\n                while( (srAssets != null) && (Aidx < srAssets.length) )\r\n                {\r\n                    AId = srAssets[Aidx].getId();\r\n                    AssetCostBF = 0.00;\r\n                    AssetDeprBF = 0.00;\r\n                    AssetAdditions = 0.00;\r\n                    AssetDeprCharge = 0.00;\r\n\r\n                    aHash = AId + \'-1\';    // type 1, additions\r\n                    if( aDHBF[aHash] != null )\r\n                        AssetCostBF += ncParseFloatNV( srDeprHistBF[aDHBF[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    if( aDHPM[aHash] != null )\r\n                        AssetAdditions += ncParseFloatNV( srDeprHistPM[aDHPM[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n\r\n                    aHash = AId + \'-2\';    // type 2, depreciation\r\n                    if( aDHBF[aHash] != null )\r\n                        AssetDeprBF += ncParseFloatNV( srDeprHistBF[aDHBF[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    if( aDHPM[aHash] != null )\r\n                        AssetDeprCharge += ncParseFloatNV( srDeprHistPM[aDHPM[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n\r\n                    aHash = AId + \'-3\';    // type 3, sales/disposal (-ve addition)\r\n                    if( aDHBF[aHash] != null )\r\n                        AssetCostBF -= ncParseFloatNV( srDeprHistBF[aDHBF[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    if( aDHPM[aHash] != null )\r\n                        AssetAdditions -= ncParseFloatNV( srDeprHistPM[aDHPM[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n\r\n                    aHash = AId + \'-4\';    // type 4, write-down (-ve addition)\r\n                    if( aDHBF[aHash] != null )\r\n                        AssetCostBF -= ncParseFloatNV( srDeprHistBF[aDHBF[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    if( aDHPM[aHash] != null )\r\n                        AssetAdditions -= ncParseFloatNV( srDeprHistPM[aDHPM[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n\r\n                    aHash = AId + \'-5\';    // type 5, revaluation (depreciation)\r\n                    if( aDHBF[aHash] != null )\r\n                        AssetDeprBF += ncParseFloatNV( srDeprHistBF[aDHBF[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n                    if( aDHPM[aHash] != null )\r\n                        AssetDeprCharge += ncParseFloatNV( srDeprHistPM[aDHPM[aHash]].getValue(\'custrecord_deprhistamount\',null,\'sum\'), 0.00);\r\n\r\n                    // now add the row, if we have values\r\n                    if( (AssetCostBF != 0.00) || (AssetDeprBF != 0.00) || (AssetAdditions != 0.00) || (AssetDeprCharge != 0.00)\r\n                        || ( (SubsEnabled) && (srAssets[Aidx].getValue(\'custrecord_assetsubsidiary\') == currentSub) ) )\r\n                    {\r\n                        pageHTML += \'<tr style=\"border-width=0;border-style:none;font-size=11\">\';\r\n                        // okay - non-zero, or asset belongs to current sub, so add a row and increment section totals\r\n                        pageHTML += \'<td style=\"border-width=0;border-style:none;font-size=11\">\'+currentAssetType+\'</td>\';\r\n\r\n                        // we need a link here, to produce a detail report for an individual asset...\r\n                        DetailURL = nlapiResolveURL(\'SUITELET\',\'customscript_assetregisterdtl_sl\',\'customdeploy_assetregisterdtl_sl\',false);\r\n                        DetailURL += \'&custpage_assetid=\'+AId+\'&custpage_bfDate=\'+nlapiDateToString(roptStartDate)+\'&custpage_endDate=\'+nlapiDateToString(roptEndDate);\r\n                        DetailURL += \'&custpage_dmethod=\'+roptDeprMethod;\r\n                        if( SubsEnabled )\r\n                            DetailURL += \'&custpage_sub=\'+currentSub;\r\n                        pageHTML += \'<td><a href=\"\'+DetailURL+\'\" target=\"asset_\'+AId+\'\">\'+nlapiEscapeXML(srAssets[Aidx].getValue(\'altname\'))+\'</a></td>\';\r\n\r\n                        pageHTML += \'<td>\'+nlapiEscapeXML(srAssets[Aidx].getValue(\'custrecord_assetdescr\'))+\'</td>\';\r\n                        pageHTML += \'<td align=\"center\">\'+srAssets[Aidx].getValue(\'custrecord_assetdeprstartdate\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetCostBF,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetAdditions,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetCostBF+AssetAdditions,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetDeprBF,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetDeprCharge,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetDeprBF+AssetDeprCharge,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber((AssetCostBF+AssetAdditions)-(AssetDeprBF+AssetDeprCharge),\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'<td align=\"right\">\'+ncFormatNumber(AssetCostBF-AssetDeprBF,\',\',\'.\',2,S,\'\')+\'</td></tr>\';\r\n\r\n                        CostBF[i] += AssetCostBF;\r\n                        DeprBF[i] += AssetDeprBF;\r\n                        Additions[i] += AssetAdditions;\r\n                        DeprCharge[i] += AssetDeprCharge;\r\n\r\n                        CostTotal[i] = CostBF[i] + Additions[i];\r\n                        DeprTotal[i] = DeprBF[i] + DeprCharge[i];\r\n                        NBVcp[i] = CostTotal[i] - DeprTotal[i];\r\n                        NBVpp[i] = CostBF[i] - DeprBF[i];\r\n\r\n                        TotCostBF += AssetCostBF;\r\n                        TotAdditions += AssetAdditions;\r\n                        TotDeprBF += AssetDeprBF;\r\n                        TotDeprCharge += AssetDeprCharge;\r\n\r\n                        atEmpty = false;\r\n                    }\r\n\r\n                    ++Aidx;\r\n                    ++l_RecordCount; // vls\r\n                }\r\n            }\r\n\r\n            if( !atEmpty )\r\n            {\r\n                pageHTML += \'<tr style=\"border-width=0;border-style:none;font-size=11\">\';\r\n                // section totals\r\n                pageHTML += \'<td></td><td></td><td></td><td></td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(CostBF[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(Additions[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(CostTotal[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(DeprBF[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(DeprCharge[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(DeprTotal[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(NBVcp[i],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:0;border-collapse:collapse;border-style:solid;border-color:#9f9f9f\">\'+ncFormatNumber(NBVpp[i],\',\',\'.\',2,S,\'\')+\'</td></tr>\';\r\n                pageHTML += \'<tr><td> </td></tr>\';\r\n\r\n                subEmpty = false;\r\n            }\r\n\r\n            ++i;\r\n        }\r\n\r\n        AssetType[idxTotal] = \'Total\';\r\n        CostBF[idxTotal] = TotCostBF;\r\n        Additions[idxTotal] = TotAdditions;\r\n        DeprBF[idxTotal] = TotDeprBF;\r\n        DeprCharge[idxTotal] = TotDeprCharge;\r\n        CostTotal[idxTotal] = CostBF[idxTotal] + Additions[idxTotal];\r\n        DeprTotal[idxTotal] = DeprBF[idxTotal] + DeprCharge[idxTotal];\r\n        NBVcp[idxTotal] = CostTotal[idxTotal] - DeprTotal[idxTotal];\r\n        NBVpp[idxTotal] = CostBF[idxTotal] - DeprBF[idxTotal];\r\n\r\n        if( !subEmpty )\r\n        {\r\n            pageHTML += \'<tr style=\"border-width=0;border-style:none;font-size=11\">\';\r\n            // section totals\r\n            pageHTML += \'<td></td><td></td><td></td><td></td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(CostBF[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(Additions[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(CostTotal[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(DeprBF[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(DeprCharge[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(DeprTotal[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(NBVcp[idxTotal],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n            pageHTML += \'<td align=\"right\" style=\"border-top-width:1;border-left-width:0;border-right-width:0;border-bottom-width:4;border-collapse:collapse;border-style:solid;border-style-bottom:double;border-color:#9f9f9f\">\'+ncFormatNumber(NBVpp[idxTotal],\',\',\'.\',2,S,\'\')+\'</td></tr>\';\r\n            pageHTML += \'<tr><td> </td></tr>\';\r\n        }\r\n\r\n        pageHTML += \'</table>\';\r\n    }\r\n\r\n    _failurePoint = \'Store report HTML result\';\r\n    var stUserName = rProcessInfo.getFieldText(\'custrecord_far_proins_procuser\');\r\n    fileObj = nlapiCreateFile(\'FAR_AssetManagementReport_AT\'+stUserName+\'.htm\',\'HTMLDOC\', pageHTML);\r\n    fileObj.setDescription(\'Assets Management Schedule Report\');\r\n    fileObj.setFolder(ReportFolderId);\r\n    ATfile = nlapiSubmitFile(fileObj);    // will replace file if it exists\r\n\r\n    if ((ATfile == null) || (ATfile == \'\') || (ATfile == -1)) {\r\n        var fileErr = \'Unable to store report results (nlapiSubmitFile)\';\r\n        ncLogExecution(\'Error\',\'nlapiSubmitFile returned invalid file id\',fileErr);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = fileErr;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+fileErr,\'Error\');\r\n        return;    // and bail out\r\n    }\r\n\r\n    // really finished - update process control record for completion\r\n    fNames = new Array();\r\n    fNames[0] = \'custrecord_far_proins_statedefn\';\r\n    fNames[1] = \'custrecord_far_proins_procstate\';\r\n    fNames[2] = \'custrecord_far_proins_reccount\';\r\n    fNames[3] = \'custrecord_far_proins_procstatus\';\r\n    fNames[4] = \'custrecord_far_proins_activitytype\';\r\n    fValues = new Array();\r\n    fValues[0] = \'ReportFile\';\r\n    fValues[1] = ATfile;\r\n    fValues[2] = l_RecordCount.toString();\r\n    fValues[3] = \'2\';    // status 2 = completed\r\n    fValues[4] = \'3\';    // activity type 3 = planned schedule\r\n\r\n    nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n    // log activity\r\n    ncBGP_WriteToLog(procId,\'\',\'Processing completed\',\'Message\');\r\n\r\n    return;\r\n    } catch (GE) {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' - \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( typeof(ST) == \'string\' )\r\n                msg += \'<BR>\'+ST;\r\n            else    // in case we ever do get an array...\r\n                for( var nST=0; nST<ST.length; ++nST )\r\n                    if( ST[nST] != \'undefined\' )\r\n                        msg += \'<BR>\'+ST[nST];\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'_failurePoint\',_failurePoint);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n    }\r\n}\r\n\r\n/* ncFAR_BuildReportDatabyLocn_BG - background function to generate the Report Data for Depreciation Schedule By Location\r\n*\r\n* This function will read through the Asset data, filtering by the given Report Options, and convert the results to csv\r\n*\r\n* Parameters:\r\n*      ProcessId    - Background Process Id\r\n*\r\n* Returns:\r\n*      the results in csv format\r\n*/\r\nfunction ncFAR_BuildReportDataByLocn_BG(ProcessId)\r\n{\r\n    var _context = nlapiGetContext();\r\n    var _current_user_language = _context.getPreference(\'LANGUAGE\');\r\n    var resourceManager = new jp3867ns.Resources.ResourceManager( LOCALIZATION_FILENAME, _current_user_language);\r\n\r\n    var _failurePoint;\r\n    var procId;\r\n    var uTarget = 300;    // target number of units to begin suspend process\r\n    var uRem;\r\n    var bAbort = false;    // suspend flag\r\n\r\n    /* anything running scheduled we don\'t want to fail, otherwise deployment is failed and dead! */\r\n    try\r\n    {\r\n        /* retrieve script parameters --> process id */\r\n        _failurePoint = \'Retrieve script parameters\';\r\n        var currentContext = nlapiGetContext();\r\n        procId = currentContext.getSetting(\'SCRIPT\',ncConst.BGP_ProcInstIdParam);\r\n\r\n        if( ProcessId != null )\r\n        {\r\n            procId = ProcessId;    // called directly, so use direct parameter not context setting\r\n        }\r\n\r\n        if( procId == null )\r\n            return;    // nothing to do - no process record to determine status or log events against\r\n\r\n        /* retrieve process record --> process parameters */\r\n        _failurePoint = \'Retrieve process record\';\r\n        var rProcessInfo = nlapiLoadRecord(ncConst.BGP_ProcessInstance, procId);\r\n        if( rProcessInfo.getFieldValue(\'custrecord_far_proins_procstatus\') != \'1\' )\r\n            return;    // nothing to do\r\n\r\n        var l_RecordCount = ncParseIntNV(rProcessInfo.getFieldValue(\'custrecord_far_proins_reccount\'),0);\r\n\r\n        /* retrieve Asset Type list for processing, and current status info */\r\n        var tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_statedefn\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pNames = tmpStr.split(\',\');\r\n        tmpStr = rProcessInfo.getFieldValue(\'custrecord_far_proins_procstate\');\r\n        if( tmpStr == null )\r\n            tmpStr = \"\";\r\n        var pValues = tmpStr.split(\',\');\r\n\r\n        _failurePoint = \'Decode instance parameters\';\r\n        var currentRowId = \'\';                // currentRowId\r\n        var SubIdx = 0;                        // Index --> SubIdx:LIdx:ATIdx\r\n        var LIdx = 0;\r\n        var ATIdx = 0;\r\n        var AType;                            // AType\r\n        var ATlist;                            // ATlist\r\n        var ATfile = null;                    // ATfile\r\n        var roptStartDate = new Date();        // StartDate\r\n        var roptEndDate = new Date();        // EndDate\r\n        var roptNBVorDEPR = \'T\';            // NBV\r\n        var Subsids = new Array(\'\');        // Subsids\r\n        var roptLeaseOption = \'all_assets\';    // Leases\r\n\r\n//        var roptDeprMethod = 1;                // Method\r\n        //jgutana\r\n        var roptDeprMethod = 0;                // Method\r\n\r\n        var roptLocation = new Array(\'\');    // Location\r\n        var roptStyle = \'by_locn\';            // Style\r\n        var CSVFormat = \'F\';                // CSV\r\n\r\n        if( pNames.length == pValues.length )\r\n        {\r\n            for(var pN=0; pN < pNames.length; ++pN)\r\n            {\r\n                switch( pNames[pN] )\r\n                {\r\n                    case \'currentRowId\':\r\n                        currentRowId = pValues[pN];\r\n                        break;\r\n                    case \'AType\':\r\n                        AType = pValues[pN];\r\n                        break;\r\n                    case \'ATlist\':\r\n                        ATlist = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'ATfile\':\r\n                        ATfile = pValues[pN];\r\n                        break;\r\n                    case \'StartDate\':\r\n                        roptStartDate = ncDecodeDate(pValues[pN]);\r\n                        break;\r\n                    case \'EndDate\':\r\n                        roptEndDate = ncDecodeDate(pValues[pN]);\r\n                        break;\r\n                    case \'NBV\':\r\n                        roptNBVorDEPR = pValues[pN];\r\n                        break;\r\n                    case \'Subsids\':\r\n                        Subsids = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'Leases\':\r\n                        roptLeaseOption = pValues[pN];\r\n                        break;\r\n                    case \'Method\':\r\n                        roptDeprMethod = ncParseIntNV(pValues[pN],1);\r\n                        break;\r\n                    case \'Location\':\r\n                        roptLocation = pValues[pN].split(\':\');\r\n                        break;\r\n                    case \'Style\':\r\n                        roptStyle = pValues[pN];\r\n                        break;\r\n                    case \'Index\':\r\n                        var idxs = pValues[pN].split(\':\');\r\n                        if (idxs.length == 3)\r\n                        {\r\n                            SubIdx = ncParseIntNV(idxs[0],0);\r\n                            LIdx = ncParseIntNV(idxs[1],0);\r\n                            ATIdx = ncParseIntNV(idxs[2],0);\r\n                        }\r\n                        break;\r\n                    case \'CSV\':\r\n                        CSVFormat = pValues[pN];\r\n                        break;\r\n                    case \'Language\':\r\n                        //override the declared localizatoin language\r\n                        _current_user_language = pValues[pN];\r\n                        resourceManager = new jp3867ns.Resources.ResourceManager( LOCALIZATION_FILENAME    , _current_user_language);\r\n                        break;\r\n                    default:\r\n                        // do nothing\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            // all gone wrong - gracefully abort (and log values?)\r\n            ncLogExecution(\'error\',\'ncFAR_BuildReportDataByLocn_BG\',\'parameter values blank, aborting\');\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            fValues = new Array();\r\n            fValues[0] = \'parameter values blank, aborting\';\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n            return;\r\n        }\r\n\r\n        _failurePoint = \'Retrieve options and cache formulae\';\r\n        var b_LocationsEnabled = ncIsFeatureEnabled(\'locations\');\r\n        var b_DeptsEnabled = ncIsFeatureEnabled(\'departments\');\r\n        var b_ClassesEnabled = ncIsFeatureEnabled(\'classes\');\r\n\r\n        // limited during this process so need to optimise and pre-cache lookups to avoid duplicate reads... depreciation methods and functions\r\n        var currDate = new Date();\r\n        var DeprMethods = new Array();\r\n        var DeprFunctions = new Array();\r\n        var DMcols = new Array();\r\n        DMcols[0] = new nlobjSearchColumn(\'custrecord_deprmethodformula\');\r\n        DMcols[1] = new nlobjSearchColumn(\'custrecord_deprmethodendperiod\');\r\n        DMcols[2] = new nlobjSearchColumn(\'custrecord_deprmethodnextmethod\');\r\n        DMcols[3] = new nlobjSearchColumn(\'custrecord_deprmethoddeprperiod\');\r\n        DMcols[4] = new nlobjSearchColumn(\'custrecord_deprmethod_accrual_convention\');    //AV\r\n        DMcols[5] = new nlobjSearchColumn(\'custrecord_deprmethod_final_convention\');    //AV\r\n        var srMethods = nlapiSearchRecord(ncConst.FAR_DeprMethod,null,null,DMcols);\r\n        var dm = 0;\r\n        var dmId;\r\n        var depFn;\r\n        _failurePoint = \'Loading Depr Method cache\';\r\n        while( (srMethods != null) && (dm < srMethods.length) )\r\n        {\r\n            dmId = srMethods[dm].getId().toString();\r\n            DeprMethods[dmId] = srMethods[dm];\r\n            DeprFunctions[dmId] = new ncFAR_FnToken();\r\n            depFn = DeprMethods[dmId].getValue(\'custrecord_deprmethodformula\');\r\n            if( !ncFAR_ParseFormula(depFn,DeprFunctions[dmId]) )\r\n            {\r\n                ncLogExecution(\'error\',\'Unable to parse depreciation formula\',\'Formula expression:\'+depFn);\r\n\r\n                fNames = new Array();\r\n                fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                fValues = new Array();\r\n                fValues[0] = \'Unable to parse depreciation formula:\'+depFn;\r\n                fValues[1] = \'4\';    // status 4 = failed\r\n                fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n\r\n                return;\r\n            }\r\n\r\n            ++dm;\r\n        }\r\n\r\n        /* New report structure...\r\n         * SUBSIDIARY X\r\n         *\r\n         * Location A\r\n         *   Asset Type 1\r\n         *         Periods --> (subtotal each year, total at end of row)\r\n         *     Assets (ID, Name) ... period amounts\r\n         *     ...\r\n         *   Asset Type subtotal\r\n         *   Asset Type 2\r\n         *         Periods --> (subtotal each year, total at end of row)\r\n         *     Assets (ID, Name) ... period amounts\r\n         *     ...\r\n         *   Asset Type subtotal\r\n         * Location subtotal\r\n         * ...\r\n         * SUBSIDIARY TOTAL\r\n         * ...\r\n         *\r\n         * REPORT TOTAL\r\n         *\r\n         *\r\n         * Should retrieve data in correct sequence, so if we are cut off at least each section is complete\r\n         *\r\n         * So, for each Subsidiary, for each location, for each asset type, get assets\r\n         *   For each asset, get summary data (as before)\r\n         *\r\n         * Need to integrate totals into CSV, or at least the change of location, change of asset type...\r\n         *   May be able to build totals as we build report output, rather than storing in CSV\r\n         *   (but final results always going to be bigger than temporary store, so that is our limit?)\r\n         */\r\n\r\n        // retrieve asset types then for each type retrieve values and accumulate total\r\n        _failurePoint = \'Retrieve asset types (search)\';\r\n        var AssetType = new Array();\r\n        var sfAT = new nlobjSearchFilter(\'internalId\',null,\'anyOf\',ATlist,null);\r\n        var srAT = nlapiSearchRecord(ncConst.FAR_AssetType,null,sfAT,new nlobjSearchColumn(\'name\'));\r\n\r\n        _failurePoint = \'Build asset search\';\r\n        var scAsset = new Array();\r\n        scAsset[0] = new nlobjSearchColumn(\'currency\',\'custrecord_assetsubsidiary\');\r\n        /* will be using the saved search customsearch_far_assetsbyid so these columns are now pre-defined ...\r\n        scAsset[0] = new nlobjSearchColumn(\'custrecord_assetcost\');\r\n        scAsset[1] = new nlobjSearchColumn(\'custrecord_assetresidualvalue\');\r\n        scAsset[2] = new nlobjSearchColumn(\'custrecord_assetlifetime\');\r\n        scAsset[3] = new nlobjSearchColumn(\'custrecord_assetlifeunits\');\r\n        scAsset[4] = new nlobjSearchColumn(\'custrecord_assetlastdepramt\');\r\n        scAsset[5] = new nlobjSearchColumn(\'custrecord_assetdeprstartdate\');\r\n        scAsset[6] = new nlobjSearchColumn(\'custrecord_assetdeprenddate\');\r\n        scAsset[7] = new nlobjSearchColumn(\'custrecord_assetaccmethod\');\r\n        scAsset[8] = new nlobjSearchColumn(\'custrecord_assetdeprrules\');\r\n        scAsset[9] = new nlobjSearchColumn(\'name\');\r\n        scAsset[10] = new nlobjSearchColumn(\'altname\');\r\n        scAsset[11] = new nlobjSearchColumn(\'custrecord_assetcurrentcost\');\r\n        scAsset[12] = new nlobjSearchColumn(\'custrecord_assetcurrencyid\');\r\n        scAsset[13] = new nlobjSearchColumn(\'name\',\'custrecord_assettype\');\r\n        scAsset[14] = new nlobjSearchColumn(\'custrecord_assetconvention\');\r\n        */\r\n        /*jgutana - commented out\r\n        if (roptDeprMethod > 1)\r\n        {\r\n            scAsset[0] = new nlobjSearchColumn(\'custrecord_assetdeprmethod\'+(roptDeprMethod-1));\r\n            scAsset[1] = new nlobjSearchColumn(\'custrecord_assetlifetime\'+(roptDeprMethod-1));\r\n            scAsset[2] = new nlobjSearchColumn(\'custrecord_assetrv\'+(roptDeprMethod-1));\r\n            scAsset[3] = new nlobjSearchColumn(\'custrecord_assetdeprtodate\'+(roptDeprMethod-1));\r\n            scAsset[4] = new nlobjSearchColumn(\'custrecord_assetlastamt\'+(roptDeprMethod-1));\r\n            scAsset[5] = new nlobjSearchColumn(\'custrecord_assetconvention\'+(roptDeprMethod-1));\r\n        }\r\n        */\r\n\r\n        var scDHist = new Array();\r\n        scDHist[0] = new nlobjSearchColumn(\'custrecord_deprhistdate\');\r\n        scDHist[1] = new nlobjSearchColumn(\'custrecord_deprhistamount\');\r\n        scDHist[2] = new nlobjSearchColumn(\'custrecord_deprhistbookvalue\');\r\n\r\n        // check currency symbol and integer currencies\r\n        _failurePoint = \'Retrieve currency settings\';\r\n        var IntCurrSym = \'\';\r\n        var CurrSym = \'\';\r\n        var ReportFolderId = \'\';\r\n\r\n        var configCols = new Array();\r\n        configCols[0] = new nlobjSearchColumn(\'custrecord_intcurrsymbols\');\r\n        configCols[1] = new nlobjSearchColumn(\'custrecord_far_reportfolder\');\r\n        var FARConfig = nlapiSearchRecord(ncConst.FAR_SystemSetup,null,null,configCols);\r\n        if( (FARConfig != null) && (FARConfig.length == 1) )\r\n        {\r\n            IntCurrSym = FARConfig[0].getValue(\'custrecord_intcurrsymbols\');\r\n            ReportFolderId = FARConfig[0].getValue(\'custrecord_far_reportfolder\');\r\n        }\r\n\r\n        var CurrSymList = new Array();\r\n        if(ncIsFeatureEnabled(\'multicurrency\'))\r\n        {\r\n            var CurrRec = nlapiSearchRecord(\'currency\',null,null,new nlobjSearchColumn(\'symbol\'));\r\n            var cr=0;\r\n            while( (CurrRec != null) && (cr < CurrRec.length) )\r\n            {\r\n                CurrSymList[ CurrRec[cr].getId() ] = CurrRec[cr].getValue(\'symbol\');\r\n                ++cr;\r\n            }\r\n        }\r\n        //--\r\n\r\n        var AssetData = new Array();\r\n\r\n        // for each Subsidiary ...\r\n        while ( (!bAbort) && (SubIdx < Subsids.length) )\r\n        {\r\n            AssetData[SubIdx] = new Array();\r\n            // for each location ...\r\n            while ( (!bAbort) && (LIdx < roptLocation.length) )\r\n            {\r\n                AssetData[SubIdx][LIdx] = new Array();\r\n                var j=0;\r\n                var k=0;\r\n                var atId;\r\n\r\n                // var AssetData = new Array();\r\n                var AssetNum;\r\n                var minDate = \'2199/12\';\r\n                var maxDate = \'1900/01\';\r\n                var dateStr;\r\n                var monthStr;\r\n                // get subsidiaries\r\n                var sfSvalues;\r\n\r\n                var cTotal = new Array(0.00, 0.00);\r\n\r\n                // for each asset type ...\r\n                while( (!bAbort) && (srAT != null) && (ATIdx < srAT.length) )\r\n                //if ((srAT != null) && (srAT.length > 0))\r\n                {\r\n                    // AssetData[SubIdx][LIdx][ATIdx] = new Array();\r\n                    AssetData[SubIdx][LIdx][ATIdx] = new Object();\r\n                    atId = srAT[ATIdx].getId();\r\n                    _failurePoint = \'Search for assets - Sub, Locn, AssetType id=\'+Subsids[SubIdx]+\',\'+roptLocation[LIdx]+\',\'+atId;\r\n\r\n                    var sfAsset = new Array();\r\n                    sfAsset[0] = new nlobjSearchFilter(\'custrecord_assettype\',null,\'anyOf\',[atId],null);\r\n                    sfAsset[1] = new nlobjSearchFilter(\'custrecord_assetinclreports\',null,\'is\',\'T\',null);\r\n                    sfAsset[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n                    sfAsset[3] = new nlobjSearchFilter(\'custrecord_assetstatus\',null,\'anyOf\',[2,6],null); // New or Depreciating\r\n                    if(roptLocation[LIdx] != \'\')\r\n                        sfAsset[sfAsset.length] = new nlobjSearchFilter(\'custrecord_assetlocation\',null,\'is\',roptLocation[LIdx],null);\r\n                    if(Subsids[SubIdx] != \'\')\r\n                        sfAsset[sfAsset.length] = new nlobjSearchFilter(\'custrecord_assetsubsidiary\',null,\'anyOf\',Subsids[SubIdx],null);\r\n                    if(roptLeaseOption == \'except_leased\')\r\n                        sfAsset[sfAsset.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',null,\'is\',\'F\',null);\r\n                    else if(roptLeaseOption == \'leased_only\')\r\n                        sfAsset[sfAsset.length] =  new nlobjSearchFilter(\'custrecord_assetisleased\',null,\'is\',\'T\',null);\r\n\r\n                    /*\r\n                    if(parseInt(roptDeprMethod) != 1)\r\n                        sfAsset[sfAsset.length] =  new nlobjSearchFilter(\'custrecord_assetdeprmethod\'+(roptDeprMethod-1),null,\'noneof\',\'@NONE@\',null);//cs\r\n                    */\r\n                    //jgutana\r\n                    if((roptDeprMethod*1) > 0) {\r\n                        var assetIDs = [];\r\n                        var searchResAltDepr = nlapiSearchRecord(\'customrecord_ncfar_altdepreciation\',null,\r\n                                                new nlobjSearchFilter(\'custrecord_altdepraltmethod\',null,\'anyof\',roptDeprMethod),\r\n                                                new nlobjSearchColumn(\'custrecord_altdeprasset\'));\r\n                        if (searchResAltDepr != null) {\r\n                            for (var ctr=0; ctr<searchResAltDepr.length; ctr++) {\r\n                                assetIDs.push(searchResAltDepr[ctr].getValue(\'custrecord_altdeprasset\'));\r\n                            }\r\n                        }\r\n                        sfAsset[sfAsset.length] =  new nlobjSearchFilter(\'internalid\',null,\'anyof\',assetIDs);\r\n                    }\r\n\r\n                    // continue prior search if we need to...\r\n                    if (currentRowId != \'\')\r\n                    {\r\n                        sfAsset[sfAsset.length] = new nlobjSearchFilter(\'internalidnumber\',null,\'greaterThan\',currentRowId,null);\r\n                    }\r\n\r\n                    var srAssets = nlapiSearchRecord(ncConst.FAR_Asset,\'customsearch_far_assetsbyid\',sfAsset,scAsset);\r\n\r\n                    while( (!bAbort) && (srAssets != null) && ( j < srAssets.length))\r\n                    {\r\n                        AssetNum = srAssets[j].getValue(\'name\');\r\n                        _failurePoint = \'Depreciation schedule for \'+AssetNum;\r\n                        // AssetData[SubIdx][LIdx][ATIdx][AssetNum] = new Array();\r\n                        AssetData[SubIdx][LIdx][ATIdx][AssetNum] = new Object();\r\n                        var assetName = srAssets[j].getValue(\'altname\');\r\n                        if (assetName == undefined)    assetName = \'\';\r\n                        if (assetName == null)    assetName = \'\';\r\n                        AssetData[SubIdx][LIdx][ATIdx][AssetNum][\'Name\'] = assetName;\r\n                        CurrSym = CurrSymList[ srAssets[j].getValue(\'currency\',\'custrecord_assetsubsidiary\') ];\r\n                        var PeriodValues = ncFAR_AssetDeprSchedule(srAssets[j],DeprMethods,DeprFunctions,CurrSym,IntCurrSym,roptDeprMethod);\r\n                        if( PeriodValues != null )\r\n                        {\r\n                            for( k=0; k<PeriodValues.length; ++k )\r\n                            {\r\n                                if( PeriodValues[k] != null )\r\n                                {\r\n                                    AssetData[SubIdx][LIdx][ATIdx][AssetNum][PeriodValues[k][0]] = new Array(PeriodValues[k][1],PeriodValues[k][2]);\r\n\r\n                                    if( PeriodValues[k][0] < minDate )    minDate = PeriodValues[k][0];\r\n                                    if( PeriodValues[k][0] > maxDate )    maxDate = PeriodValues[k][0];\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        // now search for Depr Hist (type=depreciation) for this asset\r\n                        // for each record found, calculate dateStr and overwrite AssetData[i][AssetNum][dateStr] values\r\n                        _failurePoint = \'Retrieve history for \'+AssetNum;\r\n                        var sfDHist = new Array();\r\n                        sfDHist[0] = new nlobjSearchFilter(\'custrecord_deprhistasset\',null,\'is\',srAssets[j].getId(),null);\r\n                        sfDHist[1] = new nlobjSearchFilter(\'custrecord_deprhisttype\',null,\'is\',\'2\',null);\r\n                        sfDHist[2] = new nlobjSearchFilter(\'isinactive\',null,\'is\',\'F\',null);\r\n                        sfDHist[3] = new nlobjSearchFilter(\'isinactive\',\'custrecord_deprhistasset\',\'is\',\'F\',null);\r\n\r\n//                        sfDHist[4] = new nlobjSearchFilter(\'custrecord_deprhistmethod\',null,\'is\',roptDeprMethod,null);\r\n                        //jgutana\r\n                        if ((roptDeprMethod * 1) > 0) {\r\n                            sfDHist[4] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', roptDeprMethod);\r\n                        } else {\r\n                            sfDHist[4] = new nlobjSearchFilter(\'custrecord_deprhistaltmethod\', null, \'anyof\', \'@NONE@\');\r\n                        }\r\n\r\n                        //new code\r\n                        // only overwrite if Depr Hist date is on or after report start date\r\n                        if (roptStartDate != \'\')\r\n                        {\r\n                            sfDHist[sfDHist.length] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null, \'onorafter\', roptStartDate,null);\r\n                        }\r\n                        // only overwrite if Depr Hist date is on or before report end date\r\n                        if (roptEndDate != \'\')\r\n                        {\r\n                            sfDHist[sfDHist.length] = new nlobjSearchFilter(\'custrecord_deprhistdate\',null, \'onorbefore\', roptEndDate,null);\r\n                        }\r\n                        //\r\n                        var srDHist = nlapiSearchRecord(ncConst.FAR_DeprHistory,null,sfDHist,scDHist);\r\n                        k=0;\r\n                        while( (srDHist != null) && (k < srDHist.length) )\r\n                        {\r\n                            var HistDate = nlapiStringToDate(srDHist[k].getValue(\'custrecord_deprhistdate\'));\r\n\r\n                            dateStr = HistDate.getFullYear().toString();\r\n                            monthStr = (HistDate.getMonth()+1).toString();\r\n                            dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n                            AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr] = new Array(srDHist[k].getValue(\'custrecord_deprhistamount\'),srDHist[k].getValue(\'custrecord_deprhistbookvalue\'));\r\n                            ++k;\r\n                        }\r\n\r\n                        uRem = currentContext.getRemainingUsage();\r\n                        if( uRem <= uTarget )\r\n                        {\r\n                            bAbort = true;\r\n                            currentRowId = srAssets[j].getId();\r\n                        }\r\n\r\n                        ++j;\r\n                        ++l_RecordCount;\r\n                    }\r\n\r\n                    // next Asset Type\r\n                    if (!bAbort)\r\n                        ++ATIdx;\r\n                }\r\n\r\n                // next Location\r\n                if (!bAbort)\r\n                {\r\n                    ++LIdx;\r\n                    ATIdx = 0;    // reset AT\r\n                }\r\n            }\r\n\r\n            // next Sub\r\n            if (!bAbort)\r\n            {\r\n                ++SubIdx;\r\n                LIdx = 0;    // reset Location\r\n            }\r\n        }\r\n\r\n        var fileObj;\r\n        var fileText = \'\';\r\n        var dataTooLarge = false;\r\n        if (bAbort)\r\n        {\r\n            _failurePoint = \'Handle suspend due to governance\';\r\n            // reached here due to governance abort - update Process record with new values so will resume where we left off\r\n\r\n            // need to store interim results in \'csv\' format in a file object... (only place potentially large enough)\r\n            // if we already have a file for this asset type, need to read and append, else need to create one\r\n            if (ATfile != null)\r\n            {\r\n                _failurePoint = \'Load existing suspend file (about to suspend)\';\r\n                fileObj = nlapiLoadFile(ATfile);\r\n                fileText = fileObj.getValue();\r\n            }\r\n\r\n            // now append stuff to fileText\r\n            _failurePoint = \'Build csv for suspend file\';\r\n            var csvLines = \'\';\r\n            var LastNumber = \'---\';\r\n            for (var sub = 0; sub <= SubIdx; ++sub)\r\n            {\r\n                if (AssetData[sub] === undefined)\r\n                    continue;\r\n\r\n                for (var locn = 0; locn < AssetData[sub].length; ++locn)\r\n                {\r\n                    for (var ast = 0; ast <= AssetData[sub][locn].length; ++ast)\r\n                    {\r\n                        // output the index\r\n                        csvLines += sub.toString() + \',\' + locn.toString() + \',\' + ast.toString() + \';\';\r\n                        _failurePoint = \'Build csv for suspend file - \' + sub.toString() + \',\' + locn.toString() + \',\' + ast.toString() + \';\';\r\n\r\n                        // now get all the assets for this index\r\n                        for (var AssetNumber in (AssetData[sub][locn][ast]))\r\n                        {\r\n                            for (var DateIdx in (AssetData[sub][locn][ast][AssetNumber]))\r\n                            {\r\n                                if (DateIdx != \'Name\')\r\n                                {\r\n                                    // only output Number and Name on change of asset\r\n                                    if (AssetNumber != LastNumber)\r\n                                    {\r\n                                        csvLines += AssetNumber + \',\' + AssetData[sub][locn][ast][AssetNumber][\'Name\'].replace(/,/g,\'\\0C\').replace(/;/g,\'\\0S\') + \',\';\r\n                                        LastNumber = AssetNumber;\r\n                                    }\r\n                                    csvLines += DateIdx + \',\';\r\n                                    if (roptNBVorDEPR == \'T\')\r\n                                    {\r\n                                        csvLines += AssetData[sub][locn][ast][AssetNumber][DateIdx][1] + \';\';\r\n                                    }\r\n                                    else\r\n                                    {\r\n                                        csvLines += AssetData[sub][locn][ast][AssetNumber][DateIdx][0] + \';\';\r\n                                    }\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            fileText = fileText + csvLines;\r\n            if (fileText.length > 5000000)\r\n            {\r\n                // oops, stored data would be too large, cannot abort, report what we have...\r\n                bAbort = false;\r\n                dataTooLarge = true;\r\n            }\r\n        }\r\n\r\n        if (bAbort)\r\n        {\r\n            // create (replacement) file and submit\r\n            _failurePoint = \'Write suspend file\';\r\n            fileObj = nlapiCreateFile(\'FAR_DeprScheduleReport_byLocn.txt\',\'PLAINTEXT\',fileText);\r\n            fileObj.setDescription(\'Temporary data required by Fixed Assets Management Depreciation Schedule report\');\r\n            fileObj.setFolder(ReportFolderId);\r\n            ATfile = nlapiSubmitFile(fileObj);    // will replace file if it exists\r\n\r\n            if ((ATfile == null) || (ATfile == \'\') || (ATfile == -1))\r\n            {\r\n                var fileErr = \'Unable to store temporary data required for report (nlapiSubmitFile)\';\r\n                ncLogExecution(\'Error\',\'nlapiSubmitFile returned invalid file id\',fileErr);\r\n\r\n                // failed - update process control record for error\r\n                var fNames = new Array();\r\n                fNames[0] = \'custrecord_far_proins_procmsg\';\r\n                fNames[1] = \'custrecord_far_proins_procstatus\';\r\n                fNames[2] = \'custrecord_far_proins_activitytype\';\r\n                var fValues = new Array();\r\n                fValues[0] = fileErr;\r\n                fValues[1] = \'4\';    // status 4 = failed\r\n                fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n                nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n                // log activity\r\n                ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+fileErr,\'Error\');\r\n                return;    // and bail out\r\n            }\r\n\r\n            _failurePoint = \'Handle suspend due to governance\';\r\n            var SubsidsSTR = Subsids.join(\':\');\r\n\r\n            var startDTstr = ncEncodeDate(roptStartDate);\r\n            var endDTstr = ncEncodeDate(roptEndDate);\r\n\r\n            fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_statedefn\';\r\n            fNames[1] = \'custrecord_far_proins_procstate\';\r\n            fNames[2] = \'custrecord_far_proins_reccount\';\r\n            fValues = new Array();\r\n            fValues[0] = \'ATlist,ATfile,currentRowId,StartDate,EndDate,Subsids,NBV,Leases,Method,Location,Style,CSV,Index\';\r\n            fValues[1] = ATlist.join(\':\')+\',\'+ATfile+\',\'+currentRowId+\',\'+startDTstr+\',\'+endDTstr+\',\'+SubsidsSTR+\',\'+roptNBVorDEPR;\r\n            fValues[1] = fValues[1] +\',\'+roptLeaseOption+\',\'+roptDeprMethod+\',\'+roptLocation.join(\':\')+\',\'+roptStyle+\',\'+CSVFormat+\',\'+(SubIdx+\':\'+LIdx+\':\'+ATIdx);\r\n            fValues[2] = l_RecordCount.toString();\r\n\r\n            var Activity = rProcessInfo.getFieldValue(\'custrecord_far_proins_activitytype\');\r\n            switch( Activity )\r\n            {\r\n                case \'1\':    // this was a direct call, so switch to custom schedule\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'2\';\r\n                    break;\r\n                case \'2\':    // this was custom schedule, so revert to regular scheduling\r\n                    fNames[fNames.length] = \'custrecord_far_proins_activitytype\';\r\n                    fValues[fValues.length] = \'3\';\r\n                    break;\r\n                default:\r\n                    // nothing to do - remain as current\r\n            }\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId,fNames,fValues,false);\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',\'Processing limit reached, re-sheduling\',\'Message\');\r\n\r\n            return;    // bail out here\r\n        }\r\n\r\n        // need to retrieve interim results in \'csv\' format from a file object...\r\n        _failurePoint = \'Retrieve prior data from suspend file\';\r\n        var fileObj;\r\n        var fileText = \'\';\r\n        if (ATfile != null)\r\n        {\r\n            fileObj = nlapiLoadFile(ATfile);\r\n            fileText = fileObj.getValue();\r\n        }\r\n\r\n        // now we have partial data-set in fileText, need to decode that back into the structure to use for building the report...\r\n        if (fileText != \'\')\r\n        {\r\n            var sub = 0;\r\n            var locn = 0;\r\n            var ast = 0;\r\n\r\n            var CurrAsset = \'\';\r\n            var AssetName = \'\';\r\n            var Idx = 0;\r\n            var csvLines = fileText.split(\';\');\r\n            for (var L=0; L < csvLines.length; ++L)\r\n            {\r\n                var csvFields = csvLines[L].split(\',\');\r\n\r\n                // format should be:\r\n                //    SubIdx,LocnIdx,ATypeIdx\r\n                // or:\r\n                //    [Asset Number,Asset Name,]Date String,Report Amount\r\n                // so 2, 3 or 4 fields...\r\n                if ((csvFields.length <2 ) || (csvFields.length > 4))\r\n                {\r\n                    if (csvLines[L] != \'\')    // if not a blank row... (we expect one at the end)\r\n                    {\r\n                        // cannot process this row!\r\n                        ncBGP_WriteToLog(procId,\'\',\'Retrieving data from csv, column mismatch:\'+csvLines[L],\'Warning\');\r\n                    }\r\n\r\n                    continue;\r\n                }\r\n\r\n                if (csvFields.length == 3)\r\n                {\r\n                    // set next indexes\r\n                    sub = ncParseIntNV(csvFields[0],0);\r\n                    locn = ncParseIntNV(csvFields[1],0);\r\n                    ast = ncParseIntNV(csvFields[2],0);\r\n\r\n                    continue;\r\n                }\r\n\r\n                if (csvFields.length == 4)\r\n                {\r\n                    // new asset, pick up Number and Name\r\n                    CurrAsset = csvFields[0];\r\n                    AssetName = csvFields[1].replace(/\\\\0C/g,\',\').replace(/\\\\0S/g,\';\');\r\n                    Idx = 2;\r\n                    _failurePoint = \'Retrieve prior data for asset \'+CurrAsset;\r\n                }\r\n                else\r\n                    Idx = 0;\r\n\r\n                if (AssetData[sub][locn][ast][CurrAsset] == null)\r\n                {\r\n                    AssetData[sub][locn][ast][CurrAsset] = new Array();\r\n                    AssetData[sub][locn][ast][CurrAsset][\'Name\'] = AssetName;\r\n                }\r\n\r\n                if( csvFields[Idx] < minDate )    minDate = csvFields[Idx];\r\n                if( csvFields[Idx] > maxDate )    maxDate = csvFields[Idx];\r\n\r\n                if (roptNBVorDEPR == \'T\')\r\n                {\r\n                    AssetData[sub][locn][ast][CurrAsset][csvFields[Idx]] = new Array(0.00,csvFields[Idx+1]);\r\n                }\r\n                else\r\n                {\r\n                    AssetData[sub][locn][ast][CurrAsset][csvFields[Idx]] = new Array(csvFields[Idx+1],0.00);\r\n                }\r\n            }\r\n        }\r\n\r\n        _failurePoint = \'Setup report variables\';\r\n        if (roptStartDate != null)\r\n        {\r\n            var StartDT = new Date(roptStartDate);\r\n            dateStr = StartDT.getFullYear().toString();\r\n            monthStr = (StartDT.getMonth()+1).toString();\r\n            dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n            minDate = dateStr;\r\n        }\r\n\r\n        if (roptEndDate != null)\r\n        {\r\n            var EndDT = new Date(roptEndDate);\r\n            dateStr = EndDT.getFullYear().toString();\r\n            monthStr = (EndDT.getMonth()+1).toString();\r\n            dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n            maxDate = dateStr;\r\n        }\r\n\r\n        var minDT = new Date( parseInt(minDate.substr(0,4)), parseInt(minDate.substr(5,2),10)-1, 1 );\r\n        var maxDT = new Date( parseInt(maxDate.substr(0,4)), parseInt(maxDate.substr(5,2),10)-1, 1 );\r\n\r\n        var S = new Array(\'(\',\')\');    // array to use for formatting negative numbers, i.e. -1 becomes (1)\r\n        var n = ncGetAgeInMonths(minDT, maxDT);\r\n        var PeriodDate = new Date(minDT);\r\n        // Period Depreciation or Net Book Values \'F\' = Period Depr, \'T\' = Net Book\r\n        var rValuesOption = (roptNBVorDEPR == \'T\');\r\n\r\n        if (CSVFormat == \'T\')\r\n        {\r\n            // Generate CSV output file\r\n            _failurePoint = \'Build CSV output\';\r\n\r\n            // Headings\r\n            var CSVrow = \'Subsidiary,Location,Asset Type,Asset No.,Asset Description\';\r\n            PeriodDate = new Date(minDT);\r\n            for( k=0; k<=n; ++k )\r\n            {\r\n                dateStr = PeriodDate.getFullYear().toString();\r\n                monthStr = (PeriodDate.getMonth()+1).toString();\r\n                dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n                CSVrow += \',\'+dateStr;\r\n\r\n                PeriodDate = nlapiAddMonths(PeriodDate,1);\r\n            }\r\n            CSVrow += \'\\r\\n\';\r\n\r\n            // Data\r\n            for (SubIdx = 0; SubIdx < Subsids.length; ++SubIdx)\r\n            {\r\n                var subsidName = \'\';\r\n                if (Subsids[SubIdx] != \'\')\r\n                {\r\n                    subsidName = nlapiLookupField(\'subsidiary\',Subsids[SubIdx],\'name\');\r\n                }\r\n                for (LIdx = 0; LIdx < roptLocation.length; ++LIdx)\r\n                {\r\n                    // add location header\r\n                    var LocationName = \'\';\r\n                    if(roptLocation[LIdx] !=\'\')\r\n                    {\r\n                        LocationName = nlapiLookupField(\'location\',roptLocation[LIdx],\'name\');\r\n                    }\r\n                    for (ATIdx = 0; ATIdx < ATlist.length; ++ATIdx)\r\n                    {\r\n                        _failurePoint = \'Sort Asset Index\';\r\n                        var AssetIndex = new Array(AssetData[SubIdx][LIdx][ATIdx].length);\r\n                        var ai=0;\r\n                        for (var assetIdStr in AssetData[SubIdx][LIdx][ATIdx])\r\n                        {\r\n                            AssetIndex[ai] = assetIdStr;\r\n                            ++ai;\r\n                        }\r\n                        AssetIndex.sort();\r\n\r\n                        var AssetType = new Array();\r\n                        // need to get the asset type name....\r\n                        AssetType[0] = nlapiLookupField(ncConst.FAR_AssetType,ATlist[ATIdx],\'name\');\r\n                        for (ai=0; ai < AssetIndex.length; ++ai)\r\n                        {\r\n                            AssetNum = AssetIndex[ai];\r\n                            if (AssetNum === undefined)\r\n                                continue;\r\n\r\n                            // check size here, not at end of loop, so we don\'t flag as \'too large\' if the last data row puts us over\r\n                            if (CSVrow.length > 5000000)\r\n                            {\r\n                                tooLarge = true;\r\n                                break;\r\n                            }\r\n\r\n                            PeriodDate = new Date(minDT);\r\n\r\n                            CSVrow += \'\"\'+subsidName+\'\",\"\'+LocationName+\'\",\"\'+AssetType[0]+\'\",\"\'+AssetNum+\'\",\"\'+AssetData[SubIdx][LIdx][ATIdx][AssetNum][\'Name\']+\'\"\';\r\n\r\n                            for( k=0; k<=n; ++k )\r\n                            {\r\n                                dateStr = PeriodDate.getFullYear().toString();\r\n                                monthStr = (PeriodDate.getMonth()+1).toString();\r\n                                dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n                                CSVrow += \',\';\r\n                                if( AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr] != null )\r\n                                {\r\n                                    // period depr\r\n                                    if(!rValuesOption)\r\n                                    {\r\n                                        CSVrow += ncFormatNumber(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][0],\'\',\'.\',2,S,\'\');\r\n                                    }\r\n                                    else\r\n                                    {\r\n                                        CSVrow += ncFormatNumber(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][1],\'\',\'.\',2,S,\'\');\r\n                                    }\r\n\r\n                                }\r\n                                else\r\n                                {\r\n                                    CSVrow += \'\';\r\n                                }\r\n                                PeriodDate = nlapiAddMonths(PeriodDate,1);\r\n                            }\r\n                            CSVrow += \'\\r\\n\';\r\n                        }\r\n                        if (tooLarge)\r\n                            break;\r\n\r\n                    }\r\n                    if (tooLarge)\r\n                        break;\r\n\r\n                }\r\n                if (tooLarge)\r\n                    break;\r\n\r\n            }\r\n\r\n            // create report results file and submit\r\n            _failurePoint = \'Store CSV output\';\r\n            fileObj = nlapiCreateFile(\'FAR_DeprScheduleReport_byLocn.csv\',\'CSV\',CSVrow);\r\n            fileObj.setDescription(\'Fixed Assets Management Depreciation Schedule Report\');\r\n            fileObj.setFolder(ReportFolderId);\r\n            ATfile = nlapiSubmitFile(fileObj);    // will replace file if it exists\r\n        }\r\n        else\r\n        {\r\n            _failurePoint = \'Build report HTML\';\r\n            // As we are now making an actual html file, not just a (big) snippet to insert inline, we can use styles and greatly reduce the overhead per cell\r\n            var pageHTML = \'<html><head><style type=\"text/css\">\';\r\n            pageHTML += \'TABLE { border-top-width:1;border-left-width:1;border-right-width:1;border-bottom-width:1;border-collapse:collapse;border-style:solid;border-color:#9f9f9f; } \';\r\n            pageHTML += \'TR { border-width=1;border-style:solid;font-size=11; } TD { text-align:right;border-width=1;border-style:solid;font-size=11; } \';\r\n            pageHTML += \'TD.L { text-align:left;border-width=1;border-style:solid;font-size=11; } </style></head><body>\';\r\n            pageHTML += \'<BR><BR><font color=\"navy\"><B>\' + FAM.resourceManager.GetString(\'custpage_html_fam\') + \'</B></font><BR><BR>\';\r\n            var tooLarge = false;\r\n\r\n            if(!rValuesOption)\r\n                pageHTML += \'<B>Asset Depreciation Schedule - Period Depreciation</B><br><br>\';\r\n            else\r\n                pageHTML += \'<B>Asset Depreciation Schedule - Net Book Value</B><br><br>\';\r\n\r\n            var RprtMethodName = GetDeprMethodName(roptDeprMethod);\r\n            var AssetSelect = GetAssetSelection(roptLeaseOption);\r\n            pageHTML += RprtMethodName+\' - \'+ AssetSelect +\'<br>\';\r\n\r\n            // Build period headers (will re-use a lot)\r\n            var PeriodHeaderHtml = \'\';\r\n            PeriodDate = new Date(minDT);    // reset to generate correct headings, or subsequent asset types roll forward from end of previous asset row\r\n            for( k=0; k<=n; ++k )\r\n            {\r\n                dateStr = PeriodDate.getFullYear().toString();\r\n                monthStr = (PeriodDate.getMonth()+1).toString();\r\n                dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n                PeriodHeaderHtml += \'<td class=\"L\"><B>\'+dateStr+\'</B></td>\';\r\n\r\n                PeriodDate = nlapiAddMonths(PeriodDate,1);\r\n            }\r\n            PeriodHeaderHtml += \'<td class=\"L\"><B>TOTAL</B></td>\';\r\n            var rowSum = 0.0;\r\n\r\n            // now need to loop through all the subs, locations and asset types....\r\n            for (SubIdx = 0; SubIdx < Subsids.length; ++SubIdx)\r\n            {\r\n                // add subsidiary header\r\n                var subsidName = \'\';\r\n                if (Subsids[SubIdx] != \'\')\r\n                {\r\n                    subsidName = nlapiLookupField(\'subsidiary\',Subsids[SubIdx],\'name\');\r\n                    pageHTML += \'<br><B><U>\'+nlapiEscapeXML(subsidName)+\'</U></B><br>\';\r\n                }\r\n\r\n                var subsidTotal = new Array(n);\r\n                for( k=0; k<=n; ++k )\r\n                {\r\n                    subsidTotal[k] = 0.00;\r\n                }\r\n\r\n                for (LIdx = 0; LIdx < roptLocation.length; ++LIdx)\r\n                {\r\n                    // add location header\r\n                    var LocationName = \'\';\r\n                    if(roptLocation[LIdx] !=\'\')\r\n                    {\r\n                        LocationName = nlapiLookupField(\'location\',roptLocation[LIdx],\'name\');\r\n                        pageHTML += \'<br><B><U>\'+nlapiEscapeXML(LocationName)+\'</U></B><br>\';\r\n                    }\r\n\r\n                    var locnTotal = new Array(n);\r\n                    for( k=0; k<=n; ++k )\r\n                    {\r\n                        locnTotal[k] = 0.00;\r\n                    }\r\n\r\n                    for (ATIdx = 0; ATIdx < ATlist.length; ++ATIdx)\r\n                    {\r\n                        _failurePoint = \'Sort Asset Index\';\r\n                        var AssetIndex = new Array(AssetData[SubIdx][LIdx][ATIdx].length);\r\n                        var ai=0;\r\n                        for (var assetIdStr in AssetData[SubIdx][LIdx][ATIdx])\r\n                        {\r\n                            AssetIndex[ai] = assetIdStr;\r\n                            ++ai;\r\n                        }\r\n                        AssetIndex.sort();\r\n\r\n                        var AssetType = new Array();\r\n                        // need to get the asset type name....\r\n                        AssetType[0] = nlapiLookupField(ncConst.FAR_AssetType,ATlist[ATIdx],\'name\');\r\n\r\n                        _failurePoint = \'Build more report HTML\';\r\n                        // MAIN BODY\r\n\r\n                        pageHTML += \'<br><B><U>\'+nlapiEscapeXML(AssetType[0])+\'</U></B><br><br>\';    // Asset Type Header\r\n\r\n                        // create a table to present the results\r\n                        pageHTML += \'<table cellpadding=\"3\"><tr><td class=\"L\"><B>Asset No.</B></td><td class=\"L\"><B>Asset Description</B></td>\'+PeriodHeaderHtml+\'</tr>\';\r\n\r\n                        // for each period\r\n                        PeriodDate = new Date(minDT);    // reset to generate correct headings, or subsequent asset types roll forward from end of previous asset row\r\n                        var rTotal = new Array(n);\r\n                        for( k=0; k<=n; ++k )\r\n                        {\r\n                            rTotal[k] = 0.00;\r\n                        }\r\n\r\n                        for (ai=0; ai < AssetIndex.length; ++ai)\r\n                        {\r\n                            AssetNum = AssetIndex[ai];\r\n                            _failurePoint = \'Build report HTML for \'+SubIdx+\',\'+LIdx+\',\'+ATIdx+\',\'+AssetNum;\r\n                            if (AssetNum === undefined)\r\n                                continue;\r\n\r\n                            // check size here, not at end of loop, so we don\'t flag as \'too large\' if the last data row puts us over\r\n                            if (pageHTML.length > 5000000)\r\n                            {\r\n                                tooLarge = true;\r\n                                break;\r\n                            }\r\n\r\n                            PeriodDate = new Date(minDT);\r\n\r\n                            pageHTML += \'<tr><td class=\"L\">\'+nlapiEscapeXML(AssetNum)+\'</td><td class=\"L\">\'+nlapiEscapeXML(AssetData[SubIdx][LIdx][ATIdx][AssetNum][\'Name\'])+\'</td>\';\r\n\r\n                            rowSum = 0.0;\r\n                            for( k=0; k<=n; ++k )\r\n                            {\r\n                                dateStr = PeriodDate.getFullYear().toString();\r\n                                monthStr = (PeriodDate.getMonth()+1).toString();\r\n                                dateStr += \'/00\'.substr(0,3-monthStr.length) + monthStr;\r\n\r\n                                pageHTML += \'<td>\';\r\n                                if( AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr] != null )\r\n                                {\r\n                                    // period depr\r\n                                    if(!rValuesOption)\r\n                                    {\r\n                                        pageHTML += ncFormatNumber(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][0],\',\',\'.\',2,S,\'\');\r\n                                        rTotal[k] =  ncParseFloatNV(rTotal[k],0.00) + ncParseFloatNV(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][0],0.00);\r\n                                        rowSum += ncParseFloatNV(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][0],0.00);\r\n                                    }\r\n                                    else\r\n                                    {\r\n                                        pageHTML += ncFormatNumber(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][1],\',\',\'.\',2,S,\'\');\r\n                                        rTotal[k] =  ncParseFloatNV(rTotal[k],0.00) + ncParseFloatNV(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][1],0.00);\r\n                                        rowSum += ncParseFloatNV(AssetData[SubIdx][LIdx][ATIdx][AssetNum][dateStr][1],0.00);\r\n                                    }\r\n\r\n                                }\r\n                                else\r\n                                {\r\n                                    pageHTML +=\'\';\r\n                                }\r\n                                pageHTML += \'</td>\';\r\n                                PeriodDate = nlapiAddMonths(PeriodDate,1);\r\n                            }\r\n                            pageHTML += \'<td>\'+ncFormatNumber(rowSum,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                            pageHTML += \'</tr>\';\r\n                        }\r\n                        // ASSET TYPE subtotal\r\n                        pageHTML += \'<tr><td colspan=\"2\" class=\"L\"><B>\'+nlapiEscapeXML(AssetType[0])+\' Total</B></td>\';\r\n                        rowSum = 0.0;\r\n                        for( k=0; k<=n; ++k )\r\n                        {\r\n                            pageHTML += \'<td>\'+ncFormatNumber(rTotal[k],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                            locnTotal[k] += rTotal[k];\r\n                            rowSum += rTotal[k];\r\n                        }\r\n                        pageHTML += \'<td>\'+ncFormatNumber(rowSum,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        pageHTML += \'</tr>\';\r\n                        pageHTML += \'</table>\';    // end of table for a particular sub/locn/atype\r\n\r\n                        if (tooLarge)\r\n                            break;\r\n                    }\r\n                    // Location subtotal\r\n                    pageHTML += \'<br><table cellpadding=\"3\"><tr><td></td><td></td>\'+PeriodHeaderHtml+\'</tr>\';\r\n                    pageHTML += \'<tr><td colspan=\"2\" class=\"L\" width=\"120px\"><B>\'+nlapiEscapeXML(LocationName)+\' Total</B></td>\';\r\n                    rowSum = 0.0;\r\n                    for( k=0; k<=n; ++k )\r\n                    {\r\n                        pageHTML += \'<td>\'+ncFormatNumber(locnTotal[k],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                        subsidTotal[k] += locnTotal[k];\r\n                        rowSum += locnTotal[k];\r\n                    }\r\n                    pageHTML += \'<td>\'+ncFormatNumber(rowSum,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                    pageHTML += \'</tr>\';\r\n                    pageHTML += \'</table>\';\r\n\r\n                    if (tooLarge)\r\n                        break;\r\n                }\r\n                // Subsidiary subtotal\r\n                pageHTML += \'<br><table cellpadding=\"3\"><tr><td></td><td></td>\'+PeriodHeaderHtml+\'</tr>\';\r\n                pageHTML += \'<tr><td colspan=\"2\" class=\"L\" width=\"120px\"><B>\'+nlapiEscapeXML(subsidName)+\' Total</B></td>\';\r\n                rowSum = 0.0;\r\n                for( k=0; k<=n; ++k )\r\n                {\r\n                    pageHTML += \'<td>\'+ncFormatNumber(subsidTotal[k],\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                    rowSum += subsidTotal[k];\r\n                }\r\n                pageHTML += \'<td>\'+ncFormatNumber(rowSum,\',\',\'.\',2,S,\'\')+\'</td>\';\r\n                pageHTML += \'</tr>\';\r\n                pageHTML += \'</table>\';\r\n\r\n                if (tooLarge)\r\n                    break;\r\n            }\r\n\r\n            if (tooLarge || dataTooLarge)\r\n            {\r\n                pageHTML += \'<p>Report truncated, reached maximum storage size.\';\r\n            }\r\n\r\n            pageHTML += \'</body></html>\';\r\n\r\n            // create report results file and submit\r\n            _failurePoint = \'Store report HTML result\';\r\n            fileObj = nlapiCreateFile(\'FAR_DeprScheduleReport_byLocn.htm\',\'HTMLDOC\',pageHTML);\r\n            fileObj.setDescription(\'Fixed Assets Management Depreciation Schedule Report\');\r\n            fileObj.setFolder(ReportFolderId);\r\n            ATfile = nlapiSubmitFile(fileObj);    // will replace file if it exists\r\n        }\r\n\r\n        if ((ATfile == null) || (ATfile == \'\') || (ATfile == -1))\r\n        {\r\n            var fileErr = \'Unable to store report results (nlapiSubmitFile)\';\r\n            ncLogExecution(\'Error\',\'nlapiSubmitFile returned invalid file id\',fileErr);\r\n\r\n            // failed - update process control record for error\r\n            var fNames = new Array();\r\n            fNames[0] = \'custrecord_far_proins_procmsg\';\r\n            fNames[1] = \'custrecord_far_proins_procstatus\';\r\n            fNames[2] = \'custrecord_far_proins_activitytype\';\r\n            var fValues = new Array();\r\n            fValues[0] = fileErr;\r\n            fValues[1] = \'4\';    // status 4 = failed\r\n            fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n            nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n            // log activity\r\n            ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+fileErr,\'Error\');\r\n            return;    // and bail out\r\n        }\r\n\r\n        // eventually....\r\n        // really finished - update process control record for completion\r\n        fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_statedefn\';\r\n        fNames[1] = \'custrecord_far_proins_procstate\';\r\n        fNames[2] = \'custrecord_far_proins_reccount\';\r\n        fNames[3] = \'custrecord_far_proins_procstatus\';\r\n        fNames[4] = \'custrecord_far_proins_activitytype\';\r\n        fValues = new Array();\r\n        fValues[0] = \'ReportFile\';\r\n        fValues[1] = ATfile;\r\n        fValues[2] = l_RecordCount.toString();\r\n        fValues[3] = \'2\';    // status 2 = completed\r\n        fValues[4] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing completed\',\'Message\');\r\n\r\n        return;\r\n\r\n    } catch (GE)\r\n    {\r\n        var msg = \'\';\r\n        if ( GE instanceof nlobjError )\r\n        {\r\n            msg = GE.getCode() + \' [\' + GE.getId() + \'] \' + GE.getDetails();\r\n            var ST = GE.getStackTrace();\r\n            // nlobjError.getStackTrace() is documented as returning an array, but actually (sometimes?) returns a single string...\r\n            if( typeof(ST) == \'string\' )\r\n                msg += \'<BR>\'+ST;\r\n            else    // in case we ever do get an array...\r\n                for( var nST=0; nST<ST.length; ++nST )\r\n                    if( ST[nST] != \'undefined\' )\r\n                        msg += \'<BR>\'+ST[nST];\r\n        }\r\n        else\r\n            msg = GE.toString();\r\n\r\n        ncLogExecution(\'Error\',\'Unhandled Exception\',msg);\r\n        ncLogExecution(\'debug\',\'_failurePoint\',_failurePoint);\r\n\r\n        // failed - update process control record for error\r\n        var fNames = new Array();\r\n        fNames[0] = \'custrecord_far_proins_procmsg\';\r\n        fNames[1] = \'custrecord_far_proins_procstatus\';\r\n        fNames[2] = \'custrecord_far_proins_activitytype\';\r\n        var fValues = new Array();\r\n        fValues[0] = msg;\r\n        fValues[1] = \'4\';    // status 4 = failed\r\n        fValues[2] = \'3\';    // activity type 3 = planned schedule\r\n\r\n        nlapiSubmitField(ncConst.BGP_ProcessInstance, procId, fNames, fValues, false);\r\n        // log activity\r\n        ncBGP_WriteToLog(procId,\'\',\'Processing failed:\'+msg,\'Error\');\r\n    }\r\n}\r\n\r\n/* ncFAR_GetRelativeMonth - accepts a date and a start month number and returns the relative month of \'year\'\r\n*\r\n*    Parameters\r\n*        DateValue    - the date value to compare against the start month\r\n*        StartMonth    - January = 1, February = 2, etc.\r\n*\r\n*    Return Value\r\n*        Relative Month Number, 0 = first, 1 = second, etc. so in-line with zero-based month number for javascript\r\n*/\r\nfunction ncFAR_GetRelativeMonth(DateValue, StartMonth)\r\n{\r\n    // easy answer if StartMonth == 1 (January)\r\n    if (StartMonth == 1)\r\n        return DateValue.getMonth();\r\n\r\n    // e.g. March with start of October = 2+1 +12 -10 = 15 -10 = 5 (Period 6 of year)\r\n    // October with start of March = 9+1 +12 -3 = 22 -3 = 19... %12 = 7 (Period 8 of year)\r\n    return (DateValue.getMonth()+1 + 12 - StartMonth) % 12;\r\n}\r\n\r\n/* ncFAR_SetRelativeMonth - accepts a date, a start month number and a target relative month number; returns the corresponding date\r\n*\r\n*    Parameters\r\n*        DateValue    - the date value to compare against the start month\r\n*        StartMonth    - January = 1, February = 2, etc.\r\n*        TargetMonth - Relative to start month, so first = 0, second = 1, etc.\r\n*\r\n*    N.B. If StartMonth+TargetMonth is less than the Calendar Month, the date will be moved earlier\r\n*    e.g. March 2011, Start October, target 0 will return October 2010, so the \'year\' which includes the original date.\r\n*\r\n*    Return Value\r\n*        DateValue for the target month relative to start month\r\n*/\r\nfunction ncFAR_SetRelativeMonth(DateValue, StartMonth, TargetMonth)\r\n{\r\n    var rDate = new Date(DateValue);\r\n    // get the current relative month\r\n    var l_current = ncFAR_GetRelativeMonth(DateValue, StartMonth);\r\n\r\n    rDate.setMonth(DateValue.getMonth() + TargetMonth - l_current);\r\n\r\n    return rDate;\r\n}\r\n\r\nfunction daysInMonth(iMonth, iYear) {\r\n    return 32 - new Date(iYear, iMonth, 32).getDate();\r\n}\r\n\r\n\r\n// Asset depreciation processes multiple methods for a single subsidiary\r\n//         group by custrecord_altdepraltmethod and filter by custrecord_altdepr_subsidiary\r\n// Depreciation schedule processes a single method for multiple subsidiaries\r\n//         group by custrecord_altdepr_subsidiary and filter by custrecord_altdepraltmethod\r\n\r\nfunction getGroupMasterDepreciation( groupType, filterId, depreciateAssets ) {\r\n    nlapiLogExecution(\'DEBUG\', \'FAM - getGroupMasterDepreciation\', \'Get group values.\' );\r\n\r\n    var allowedGroupTypes = [\'custrecord_altdepr_subsidiary\', \'custrecord_altdepraltmethod\'];\r\n\r\n    //if ( Library.Objects.IndexOfArray(allowedGroupTypes, groupType) == -1 ) {\r\n        // log error and exit\r\n    //}\r\n\r\n    var groupMasters = {};\r\n    var sfGM = new Array();\r\n\r\n    sfGM[0] = new nlobjSearchFilter( \'custrecord_altdepr_groupmaster\',null, \'is\', \'F\', null );\r\n    sfGM[1] = new nlobjSearchFilter( \'custrecord_altdepr_groupdepreciation\',null, \'is\', \'T\', null );\r\n\r\n    if ( !isUndefinedNullOrEmpty( filterId ) ) {\r\n        var filterType = depreciateAssets ? \'custrecord_altdepr_subsidiary\' : \'custrecord_altdepraltmethod\';\r\n        sfGM[2] = new nlobjSearchFilter( filterType, null, \'anyof\', [ filterId ], null );\r\n    }\r\n\r\n    var scGM = new Array();\r\n    scGM[0] = new nlobjSearchColumn( groupType, \'\', \'group\' );\r\n    scGM[1] = new nlobjSearchColumn( \'custrecord_altdepr_currentcost\', \'\', \'sum\' );\r\n    scGM[2] = new nlobjSearchColumn( \'custrecord_altdepr_originalcost\', \'\', \'sum\' );\r\n    scGM[3] = new nlobjSearchColumn( \'custrecord_altdeprrv\', \'\', \'sum\' );\r\n    scGM[4] = new nlobjSearchColumn( \'custrecord_altdeprnbv\', \'\', \'sum\' );\r\n    scGM[5] = new nlobjSearchColumn( \'custrecord_altdeprpriornbv\', \'\', \'sum\' );\r\n    scGM[6] = new nlobjSearchColumn( \'custrecord_altdeprld\', \'\', \'sum\' );\r\n    scGM[7] = new nlobjSearchColumn( \'custrecord_altdeprcd\', \'\', \'sum\' );\r\n    scGM[8] = new nlobjSearchColumn( \'custrecord_altdeprlifetime\', \'\', \'max\' );\r\n\r\n    var srGM = nlapiSearchRecord( ncConst.FAR_AltDepr, null, sfGM, scGM );\r\n\r\n    if ( !isUndefinedNullOrEmpty( srGM ) ) {\r\n        nlapiLogExecution(\'DEBUG\', \'FAM - getGroupMasterDepreciation\', \'Alternate Method Group Master Count: \' + srGM.length.toString() );\r\n        for(var i=0; i < srGM.length; ++i) {\r\n            var altMethod;\r\n            var subsidiaryId;\r\n\r\n            if ( depreciateAssets ) {\r\n                altMethod = srGM[i].getValue( groupType, \'\', \'group\' );\r\n                subsidiaryId = filterId;\r\n            }\r\n            else {\r\n                altMethod = filterId;\r\n                subsidiaryId = srGM[i].getValue( groupType, \'\', \'group\' );\r\n            }\r\n\r\n            // search for the group master\r\n            var groupMasterId = findGroupMasterRecord( altMethod, subsidiaryId );\r\n\r\n            var key = depreciateAssets ? altMethod : groupMasterId[\'altDeprAssetId\'];\r\n\r\n            groupMasters[ key ] = {};\r\n            groupMasters[ key ][\'OC\'] = srGM[i].getValue( \'custrecord_altdepr_originalcost\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'CC\'] = srGM[i].getValue( \'custrecord_altdepr_currentcost\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'NB\'] = srGM[i].getValue( \'custrecord_altdeprnbv\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'RV\'] = srGM[i].getValue( \'custrecord_altdeprrv\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'PB\'] = srGM[i].getValue( \'custrecord_altdeprpriornbv\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'LD\'] = srGM[i].getValue( \'custrecord_altdeprld\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'CD\'] = srGM[i].getValue( \'custrecord_altdeprcd\', \'\', \'sum\' );\r\n            groupMasters[ key ][\'AL\'] = srGM[i].getValue( \'custrecord_altdeprlifetime\', \'\', \'max\' );\r\n            \r\n            if ( depreciateAssets && !isUndefinedNullOrEmpty( groupMasterId[\'altDeprId\'] ) ) {\r\n                updateGroupMasterRecord( groupMasterId[\'altDeprId\'], groupMasters[ key ] );                \r\n            }\r\n\r\n            nlapiLogExecution( \'DEBUG\', \'------ VICOY ------\', \'key: \' + key\r\n                    + \' | Group Master Alt Depr ID: \' + groupMasterId[\'altDeprAssetId\']\r\n                    + \' | Original Cost: \' + groupMasters[ key ][\'OC\']\r\n                    + \' | Current Cost: \' + groupMasters[ key ][\'CC\']\r\n                    + \' | Residual Value: \' + groupMasters[ key ][\'RV\']\r\n                    + \' | Asset Lifetime: \' + groupMasters[ key ][\'AL\']\r\n                    + \' | Prior NBV: \' + groupMasters[ key ][\'PB\']\r\n                    + \' | NBV: \' + groupMasters[ key ][\'NB\'] );\r\n\r\n        }\r\n    }\r\n\r\n    return groupMasters;\r\n}\r\n\r\nfunction findGroupMasterRecord( altMethod, subsidiaryId ) {\r\n    var returnValue = {};\r\n    var sfFindMaster = new Array();\r\n    sfFindMaster[0] = new nlobjSearchFilter( \'custrecord_altdepr_groupdepreciation\',null, \'is\', \'T\', null );\r\n    sfFindMaster[1] = new nlobjSearchFilter( \'custrecord_altdepr_groupmaster\',null, \'is\', \'T\', null );\r\n    sfFindMaster[2] = new nlobjSearchFilter( \'custrecord_altdepraltmethod\',null, \'is\', altMethod, null );\r\n    sfFindMaster[3] = new nlobjSearchFilter( \'isinactive\',null, \'is\', \'F\', null );\r\n    if ( !isUndefinedNullOrEmpty( subsidiaryId ) ) {\r\n        sfFindMaster[4] = new nlobjSearchFilter( \'custrecord_altdepr_subsidiary\', null, \'anyof\', [ subsidiaryId ], null );\r\n    }\r\n\r\n    var scFindMaster = new Array();\r\n    scFindMaster[0] = new nlobjSearchColumn( \'custrecord_altdeprasset\' );\r\n\r\n    var srFindMaster = nlapiSearchRecord( ncConst.FAR_AltDepr, null, sfFindMaster, scFindMaster );\r\n    if ( !isUndefinedNullOrEmpty( srFindMaster ) ) {\r\n        returnValue[\'altDeprId\'] = srFindMaster[0].getId();\r\n        returnValue[\'altDeprAssetId\'] = srFindMaster[0].getValue(\'custrecord_altdeprasset\');\r\n    }\r\n\r\n    return returnValue;\r\n}\r\n\r\nfunction updateGroupMasterRecord( groupMasterId, groupMasterRec ) {\r\n\r\n    var arrFields = new Array();\r\n    arrFields = [\'custrecord_altdepr_originalcost\',\r\n                 \'custrecord_altdepr_currentcost\',\r\n                 \'custrecord_altdeprlifetime\' ];\r\n\r\n    var arrValues = new Array();\r\n    arrValues = [groupMasterRec[\'OC\'],\r\n                     groupMasterRec[\'CC\'],\r\n                    groupMasterRec[\'AL\'] ];\r\n\r\n    nlapiSubmitField( ncConst.FAR_AltDepr, groupMasterId, arrFields, arrValues );\r\n\r\n}','javascript','','Na9pI',0,'rauyix','80.188.29.62',312,0,0),(10,'pbxhmdbb0',2,'waritko',NULL,1423231691,0,'Huge Project template','@Test\r\n    void createHugeProjectTemplate()\r\n    {\r\n        aut.logIn(Company.MASTER_WOLF, Role.ADMINISTRATOR, \"/app/accounting/project/projecttemplate.nl?whence=\");\r\n        aut.setFieldWithValue(\"entityid\", \"Huge template \" + System.currentTimeMillis());\r\n        aut.setFieldWithValue(\"projectexpensetype\", \"-2\");\r\n        aut.clickButton(\"Save\");\r\n\r\n        projectTaskUrl = aut.getPageUrl();\r\n        def matcher = projectTaskUrl =~ /\\?id=(\\d+)/;\r\n        String projectTaskId = matcher[0][1];\r\n\r\n        for(int i = 0; i < 350; i++)\r\n        {\r\n            def parentTask = aut.executeScript(\r\n                \"\"\"\r\n                    var params = {\'company\': \'${projectTaskId}\'};\r\n                    var record = nlapiCreateRecord(\'projecttask\', params);\r\n                    record.setFieldValue(\'title\', \'Task ${System.currentTimeMillis()}\');\r\n                    return nlapiSubmitRecord(record);\r\n                \"\"\"\r\n            );\r\n            for(int j = 0; j < 5; j++)\r\n            {\r\n                aut.executeScript(\r\n                    \"\"\"\r\n                        var params = {\'company\': \'${projectTaskId}\'};\r\n                        var record = nlapiCreateRecord(\'projecttask\', params);\r\n                        record.setFieldValue(\'title\', \'Task ${System.currentTimeMillis()}\');\r\n                        record.setFieldValue(\'parent\', \'${parentTask}\');\r\n                        record.setFieldValue(\'estimatedwork\', \'3.23\');\r\n                        return nlapiSubmitRecord(record);\r\n                    \"\"\"\r\n                );\r\n            }\r\n            //if (i % 5 == 0) sleep(60*1000);\r\n        }\r\n    }','groovy','','RcXF6',0,'qocpjh','80.188.29.62',68,0,0),(11,'p9ohfvafv',2,'waritko',NULL,1423667793,0,'Now Playing PhantomJS','var fs = require(\'fs\');\r\nvar page = require(\'webpage\').create();\r\n\r\nvar path = \'playing.txt\';\r\nvar content = \'\';\r\nvar address = \'https://subsonic.varak.net/rest/getNowPlaying.view?u=waritko&p=enc:626c616465363636&f=json&v=1.10.5&c=Jamstash_FF\';\r\n\r\nvar interval = setInterval(function() \r\n{\r\n    page.open(address, function (status)\r\n    {\r\n        if (status !== \'success\')\r\n        {\r\n            console.log(\'FAIL to load the address\');\r\n        }\r\n        else\r\n        {\r\n            fs.write(path, page.plainText, \'w\');\r\n        }\r\n    });\r\n}, 10000);','javascript','','GP0tu',1,'pv06v2','80.188.29.62',3,0,0),(12,'p5z9boffv',2,'waritko',NULL,1425248870,0,'Now Playing PhantomJS','var fs = require(\'fs\');\r\nvar page = require(\'webpage\').create();\r\n\r\nvar path = \'playing.txt\';\r\nvar content = \'\';\r\nvar address = \'https://subsonic.varak.net/rest/getNowPlaying.view?u=waritko&p=enc:626c616465363636&f=json&v=1.10.5&c=Jamstash_FF\';\r\n\r\nvar interval = setInterval(function()\r\n{\r\n    page.open(address, function (status)\r\n    {\r\n        var text = \"\";\r\n        if (status !== \'success\')\r\n        {\r\n            console.log(\'FAIL to load the address\');\r\n        }\r\n        else\r\n        {\r\n            var data = eval(\'(\' + page.plainText + \')\');\r\n            var entry = data[\"subsonic-response\"].nowPlaying.entry;\r\n            if(entry.username == \"waritko\")\r\n            {\r\n                text = \"Now playing: \" + entry.artist + \" - \" + entry.title + \"    \";\r\n            }\r\n\r\n            fs.write(path, text, \'w\');\r\n        }\r\n    });\r\n}, 10000);','javascript','','mlKQV',1,'qfgl4r','194.228.20.125',1,0,0),(13,'pamvaij56',2,'waritko',NULL,1425670255,0,'RSYNC backup','#!/bin/bash\r\nrsync --progress -av  --rsh=\'ssh -p9022 -v -6\' --delete --exclude /dev --exclude /boot --exclude /proc --exclude /run --exclude /sys --exclude /tmp --exclude /www/music --exclude /www/down --exclude /home/waritko/Dropbox --exclude /bin --exclude /data --exclude /lib --exclude /lib64 --exclude /olddata --exclude /sbin --exclude /www/knihovna --exclude /www/mightydeal --exclude /olddata.7z  --exclude /usr --include /usr/local root@vserver.varak.net:/ /backup/','bash','','IYVUE',0,'vevxqo','194.228.20.5',75,0,0),(14,'pbjyc79xg',2,'waritko',NULL,1432466732,0,NULL,'http://rapidgator.net/file/945ab003862e1481f0f1d5a7cc52bb9a/Yvonne-Strahovski-1100-HQCelebrities-com.rar.html\r\nhttp://rg.to/file/0b48d0b30b59698fc44b253eb7254cd5/Emma-Watson-8500-HQCelebrities-com.part1.rar.html\r\nhttp://rapidgator.net/file/1177bea2c8e5f574f1f83ba921dced18/Sarah-Michelle-Gellar-1500-HQCelebrities-com.rar.html\r\nhttp://rg.to/file/29e539b38fe080c32853771dea8a11ce/Emma-Watson-8500-HQCelebrities-com.part4.rar.html\r\nhttp://rapidgator.net/file/65c580f04907523c3b8b4e4b5c7df279/Scarlett-Johansson-4000-HQCelebrities-com.part1.rar.html\r\nhttp://rg.to/file/7e4ccf9a77d0e6f742c3226c8f02207e/Ashley-Tisdale-9000-HQCelebrities-com.part2.rar.html\r\nhttp://rg.to/file/a5d5c6ef8d76c53a8d762d7cbaf1545c/Avril-Lavigne-3000-HQCelebrities-com.part1.rar.html\r\nhttp://rg.to/file/1f7bacc4a277a200983ffb183f765e96/Emma-Watson-8500-HQCelebrities-com.part2.rar.html\r\nhttp://rg.to/file/522aad126a0f006982d2ed13686a7364/Emma-Watson-8500-HQCelebrities-com.part3.rar.html\r\nhttp://rg.to/file/8c7a1f57ce675eac8f81247136546810/Ashley-Tisdale-9000-HQCelebrities-com.part1.rar.html\r\nhttp://rg.to/file/510c23b7e6a8f6c3af731262969bb877/Ashley-Tisdale-9000-HQCelebrities-com.part3.rar.html\r\nhttp://rg.to/file/bfdc1a8c7436c655d4d18c3d88f32ba8/Ashley-Tisdale-9000-HQCelebrities-com.part4.rar.html\r\nhttp://rg.to/file/a196a0c1563d59971045096d4319a489/Ashley-Tisdale-9000-HQCelebrities-com.part5.rar.html\r\nhttp://rg.to/file/3af9a78c3079c308bf8525b7b27ed97f/Avril-Lavigne-3000-HQCelebrities-com.part2.rar.html\r\nhttp://rapidgator.net/file/f221be6f180db40c03b4357d3f477593/Scarlett-Johansson-4000-HQCelebrities-com.part2.rar.html\r\nhttp://rapidgator.net/file/196c16bddcdf60fa5c2c397534a1182e/Jennifer-Morrison-1700-HQCelebrities.com.rar.html','text','$2a$10$EMM7AVPEfW7XVao8nz4h2OpJ3eRRP/YDqPBllZKqqPAgmFxBPE/gm','adxgX',1,'6buj30','178.72.250.128',0,0,0),(16,'psv7zwdnr',2,'waritko',NULL,1436306286,0,'FFMpeg Webm','ffmpeg -i <source> -c:v libvpx-vp9 -pass 1 -b:v 1000K -crf 15 -threads 8 -speed 4   -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25  -an -f webm /dev/null\r\n\r\nffmpeg -i <source> -c:v libvpx-vp9 -pass 2 -b:v 1000K -crf 15 -threads 8 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25  -c:a libopus -b:a 128k -f webm out.webm','bash','','1TIZl',0,'aabarw','194.228.20.103',55,0,0),(17,'p7frf1o4w',2,'waritko',NULL,1437425106,0,'Process all in dir ignore','#!/bin/bash\r\nls | grep -P \"(mkv|mp4|m4v|mov|avi|flv|mpg|wmv)$\" |\r\n{\r\n	while read line;\r\n	do\r\n		towebm.sh \"$line\" || true ;\r\n	done\r\n}','bash','','DzUbq',0,'hbqsyv','194.228.20.103',111,0,0),(18,'pqhu7ctqc',0,NULL,NULL,1437560140,0,NULL,'#!/bin/bash\r\nls | grep -P \"(mkv|avi|flv|wmv|mp4|m4v|mpg|mov|rm)$\" |\r\n{\r\n        while read line;\r\n        do\r\n               filename=`rev <<< \"$line\" | cut -d\".\" -f2- | rev`;\r\n               mv \"$line\" process.bin ;\r\n               ffmpeg -y -i process.bin -c:v libvpx-vp9 -pass 1 -b:v 0 -crf 35 -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 100 -an -f webm /dev/null ;\r\n               ffmpeg -y -i process.bin -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 35 -threads 8 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 100 -c:a libvorbis -qscale:a 0  -f webm \"process.webm\" ;\r\n               mv process.bin \"$line\" ;\r\n	       mv process.webm \"${filename}.webm\"\r\n        done;\r\n}','text','','dicJ6',0,'qjyydq','85.93.125.67',71,0,0),(19,'pef3ivxbl',2,'waritko',NULL,1437560233,0,NULL,'#!/bin/bash\r\nls | grep -P \"(mkv|avi|flv|wmv|mp4|m4v|mpg|mov|rm)$\" |\r\n{\r\n        while read line;\r\n        do\r\n               filename=`rev <<< \"$line\" | cut -d\".\" -f2- | rev`;\r\n               mv \"$line\" process.bin ;\r\n               ffmpeg -y -i process.bin -c:v libvpx-vp9 -pass 1 -b:v 0 -crf 35 -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 100 -an -f webm /dev/null ;\r\n               ffmpeg -y -i process.bin -c:v libvpx-vp9 -pass 2 -b:v 0 -crf 35 -threads 8 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -g 100 -c:a libvorbis -qscale:a 0  -f webm \"process.webm\" ;\r\n               mv process.bin \"$line\" ;\r\n	       mv process.webm \"${filename}.webm\"\r\n        done;\r\n}','bash','','6KhpF',0,'uwhr0o','85.93.125.67',75,0,0),(20,'ppgy2lmhk',0,NULL,NULL,1437992616,0,NULL,'http://www.strelectvi.cz/forum/limit-124grs-fmj-s020-t1524.html?view=allposts','text','','iMO6K',0,'rmu9gj','85.93.125.67',72,0,0),(21,'pevlnsgn2',2,'waritko',NULL,1438550157,0,'ffmpeg webm batch','for /r %%f in (*.avi *.mpg *.rm *.mkv *.mp4 *.m4v *.mov *.flv *.wmv) do (\r\n   if not exist %%~nf.webm (\r\n   	c:\\bin\\ffmpeg.exe -y -i \"%%f\" -g 150 -keyint_min 150 -c:v libvpx-vp9 -pass 1 -b:v 0 -crf 35  -speed 4 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25  -an -f webm null\r\n   	c:\\bin\\ffmpeg.exe -y -i \"%%f\" -g 150 -keyint_min 150 -c:v libvpx-vp9 -b:v 0 -crf 35  -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25  -c:a libvorbis -qscale:a 0 -f webm \"%%~nf.webm\"\r\n    )\r\n)\r\n\r\ndel null','winbatch','','JQjvm',0,'trmy0q','194.228.20.103',60,0,0),(22,'php2syh9x',0,NULL,NULL,1438944581,0,NULL,'cd ~/ffmpeg_sources\r\ngit clone --depth 1 git://github.com/yasm/yasm.git\r\ncd yasm\r\nautoreconf -fiv\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\" CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://git.videolan.org/x264\r\ncd x264\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\" --enable-static CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\nhg clone https://bitbucket.org/multicoreware/x265\r\ncd ~/ffmpeg_sources/x265/build/linux\r\nexport CFLAGS=\"-march=native -O3\"\r\ncmake -G \"Unix Makefiles\" -DCMAKE_INSTALL_PREFIX=\"$HOME/ffmpeg_build\" -DENABLE_SHARED:bool=off ../../source\r\nmake\r\nmake install\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac\r\ncd fdk-aac\r\nautoreconf -fiv\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz\r\ntar xzvf lame-3.99.5.tar.gz\r\ncd lame-3.99.5\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\" --disable-shared --enable-nasm CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone git://git.opus-codec.org/opus.git\r\ncd opus\r\nautoreconf -fiv\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz\r\ntar xzvf libogg-1.3.2.tar.gz\r\ncd libogg-1.3.2\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz\r\ntar xzvf libvorbis-1.3.4.tar.gz\r\ncd libvorbis-1.3.4\r\nLDFLAGS=\"-L$HOME/ffmeg_build/lib\" CPPFLAGS=\"-I$HOME/ffmpeg_build/include\" ./configure --prefix=\"$HOME/ffmpeg_build\" --with-ogg=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git\r\ncd libvpx\r\n./configure --prefix=\"$HOME/ffmpeg_build\" --disable-examples CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake clean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://source.ffmpeg.org/ffmpeg\r\ncd ffmpeg\r\nPKG_CONFIG_PATH=\"$HOME/ffmpeg_build/lib/pkgconfig\" ./configure --prefix=\"$HOME/ffmpeg_build\" --extra-cflags=\"-I$HOME/ffmpeg_build/include\" --extra-ldflags=\"-L$HOME/ffmpeg_build/lib\" --bindir=\"$HOME/bin\" --pkg-config-flags=\"--static\" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\nhash -r','bash','','KWmd2',0,'hrvduo','85.93.125.67',88,0,0),(23,'paulzabig',0,NULL,NULL,1438944803,0,NULL,'cd ~/ffmpeg_sources\r\ngit clone --depth 1 git://github.com/yasm/yasm.git\r\ncd yasm\r\nautoreconf -fiv\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://git.videolan.org/x264\r\ncd x264\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\" --enable-static\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\nhg clone https://bitbucket.org/multicoreware/x265\r\ncd ~/ffmpeg_sources/x265/build/linux\r\nexport CFLAGS=\"-march=native -O3\"\r\ncmake -G \"Unix Makefiles\" -DCMAKE_INSTALL_PREFIX=\"$HOME/ffmpeg_build\" -DENABLE_SHARED:bool=off ../../source\r\nmake\r\nmake install\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac\r\ncd fdk-aac\r\nautoreconf -fiv\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz\r\ntar xzvf lame-3.99.5.tar.gz\r\ncd lame-3.99.5\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --bindir=\"$HOME/bin\" --disable-shared --enable-nasm CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone git://git.opus-codec.org/opus.git\r\ncd opus\r\nautoreconf -fiv\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz\r\ntar xzvf libogg-1.3.2.tar.gz\r\ncd libogg-1.3.2\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ncurl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz\r\ntar xzvf libvorbis-1.3.4.tar.gz\r\ncd libvorbis-1.3.4\r\nCFLAGS=\"-march=native -O3\" LDFLAGS=\"-L$HOME/ffmeg_build/lib\" CPPFLAGS=\"-I$HOME/ffmpeg_build/include\" ./configure --prefix=\"$HOME/ffmpeg_build\" --with-ogg=\"$HOME/ffmpeg_build\" --disable-shared CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git\r\ncd libvpx\r\nCFLAGS=\"-march=native -O3\" ./configure --prefix=\"$HOME/ffmpeg_build\" --disable-examples CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake clean\r\n\r\ncd ~/ffmpeg_sources\r\ngit clone --depth 1 git://source.ffmpeg.org/ffmpeg\r\ncd ffmpeg\r\nCFLAGS=\"-march=native -O3\" PKG_CONFIG_PATH=\"$HOME/ffmpeg_build/lib/pkgconfig\" ./configure --prefix=\"$HOME/ffmpeg_build\" --extra-cflags=\"-I$HOME/ffmpeg_build/include\" --extra-ldflags=\"-L$HOME/ffmpeg_build/lib\" --bindir=\"$HOME/bin\" --pkg-config-flags=\"--static\" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 CFLAGS=\"-march=native -O3\"\r\nmake\r\nmake install\r\nmake distclean\r\nhash -r','bash','','Z44iz',0,'hdwfst','85.93.125.67',117,0,0),(24,'puiynhtut',0,NULL,NULL,1439995834,0,'Image to base64 SP','using Microsoft.SharePoint.Client;\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Web;\r\nusing System.Text.RegularExpressions;\r\n\r\nnamespace Dynamica.CRM.IP157.Portal\r\n{\r\n	public class Image\r\n	{\r\n		#region CONSTRUCTORS\r\n\r\n		public Image()\r\n		{\r\n			SPWeb = ConfigSettings.Settings.SP.SiteColUrl;\r\n		}\r\n\r\n		public Image(string serverRelativeUrl)\r\n		{\r\n			SPWeb = ConfigSettings.Settings.SP.SiteColUrl;\r\n			ServerRelativeUrl = serverRelativeUrl;\r\n		}\r\n\r\n		public Image(string web, string serverRelativeUrl)\r\n		{\r\n			SPWeb = web;\r\n			ServerRelativeUrl = serverRelativeUrl;\r\n		}\r\n\r\n		#endregion CONSTRUCTORS\r\n\r\n     		private string base64;\r\n\r\n		public string SPWeb { get; set; }\r\n		public string ServerRelativeUrl { get; set; }\r\n		public string Base64\r\n		{\r\n			get \r\n			{\r\n				using (ClientContext ctx = new ClientContext(SPWeb))\r\n				{\r\n					var file = ctx.Web.GetFileByServerRelativeUrl(ServerRelativeUrl);\r\n					ClientResult<Stream> result = file.OpenBinaryStream();\r\n					ctx.ExecuteQuery();\r\n\r\n					using (var memory = new MemoryStream())\r\n					{\r\n						byte[] buffer = new byte[1024 * 64];\r\n						int nread = 0;\r\n						while ((nread = result.Value.Read(buffer, 0, buffer.Length)) > 0)\r\n						{\r\n							memory.Write(buffer, 0, nread);\r\n						}\r\n						memory.Seek(0, SeekOrigin.Begin);\r\n						base64 = System.Convert.ToBase64String(buffer, Base64FormattingOptions.InsertLineBreaks);\r\n					}\r\n				}\r\n				return base64; \r\n			}\r\n		}\r\n	}\r\n}','csharp','','443WH',0,'tid2ms','78.102.41.132',70,0,0),(25,'pkq3tlyev',2,'waritko',NULL,1440741533,0,'Sudoku','for((i = 0; i < 10000; i++)) { wget -S -O sudoku-$i.pdf \"http://www.opensky.ca/~jdhildeb/software/sudokugen/generate?number=48&perPage=4&difficulty=Hard&_action_generate=Go\" --user-agent=\"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36\" --referer=\"http://www.opensky.ca/~jdhildeb/software/sudokugen/\" --progress=dot ; sleep 600; }','winbatch','','37AI3',0,'rmeszr','194.228.20.204',53,0,0),(26,'p4txqy32j',2,'waritko',NULL,1442515763,0,'ReSharper key','username:ronle\r\nkey:ZoJzmeVBoAv9Sskw76emgksMMFiLn4NM','text','','awhjB',1,'jict6c','194.228.20.216',1,0,0),(27,'pjx8i7q4f',0,NULL,NULL,1444890333,0,NULL,'1 – Zadejte prosím do poznámky při platbě následující údaje:\r\n                            Číslo objednávky jako variabilní symbol \"43932960\".\r\n                        \r\n\r\n2 – Přesná částka k převodu : 813.12 Kč \r\n\r\n\r\n3 – Po obdržení Vaší platby na konto společnosti aktivujeme Vaši\r\n                            službu (uhrazená částka musí přesně odpovídat objednávce).\r\n                        \r\n\r\n4 – Naše bankovní údaje:\r\n\r\n                                Bankovní ústav: Raiffeisen Bank\r\n\r\n                                Číslo účtu OVH.CZ: 4079274028\r\n\r\n                                Kód banky: 5500\r\n\r\n                                Variabilní symbol: číslo Vaší objednávky\r\n\r\n                                IBAN: CZ8555000000004079274028\r\n\r\n\r\n\r\nPozor! Nezapomeňte vyplnit do pole \"variabilní symbol\" číslo Vaší\r\n                            objednávky. Bez vyplněného variabilního symbolu nebude Vaše platba\r\n                            potvrzena. Následné hledání informací o plátci bývá zdlouhavé a může mít\r\n                            za následek zpoždění potvrzení platby a prodlevu v obnovení Vaší služby.\r\n                        \r\n\r\nPozor! Platba převodem trvá obvykle 1-3 dny.','text','','y0LSR',0,'zdorvg','85.93.125.67',78,0,0),(28,'p9f9zhwca',2,'waritko',NULL,1445133963,0,NULL,'He was heavily into BDSM - Batman, Dungeons & Dragons, Star Trek and Mathematics.','text','','bg5v1',0,'7t0gsg','194.228.20.163',51,0,0),(29,'p7irncfun',2,'waritko',NULL,1445770598,0,'Idea 14 key','IDEA\r\n61156-YRN2M-5MNCN-NZ8D2-7B4EW-U12L4','text','$2a$10$QNVKJnZx4o18qtQFUmfyUe8ppUvNEWw4ERomcNOkRUyNVRnaNDV1a','QDlW1',1,'dcqfar','194.228.20.163',1,0,0),(34,'paaqdsy1z',0,NULL,NULL,1449405961,0,NULL,'\r\nV tomto příběhu jste kapitánem pirátů Black Cats. Právě jste dopluli do přístavu ostrova pirátů Egret. Máte se zde setkat se svým přítelem, kapitánem Arlongem. Jdete tedy do hospody U dřevěné nohy. Tady se setkáváte jen tehdy, když řešíte nejdůvěrnější záležitosti, posádku proto necháváte na lodi. Na ostrově budete jen krátce, zítra zase vyplouváte. Svého přítele jste dlouho neviděli. Naposledy vám vykládal, jak je na stopě něčeho velkého. Jste zvědavý, zda se dozvíte něco nového. A také se těšíte, až si zase konečně dáte korbel rumu a poslechnete si místní muzikanty. Vcházíte do hospody. Skrze hustý dým z nekvalitního tabáku hledáte svého přítele. Pomalu procházíte mezi stoly. Ty jsou plně obsazeny Arlongovou posádkou. Začnete být nervózní, „něco není v pořádku,“ pomyslíte si. Koutkem oka zahlédnete, jak na vás někdo mávne v rohu hospody. Poznáváte Arlonga. Jedinou společnost u stolu mu dělá poloprázdný korbel rumu. Přicházíte ke svému příteli a z jeho výrazu čtete, že něco je opravdu špatně. Nicméně to nedáte na sobě znát a s úsměvem ho pozdravíte a posadíte se. \r\n\r\nDiskuzi začne váš přítel. Nakloní se k vám a kývnutím ruky vás nabádá, abyste udělali totéž. Nervózně se podívá, jako kdyby jej někdo špehoval, a povídá: „Pamatuješ, jak jsem ti říkal….“ na chvíli se zarazí, „Pamatuješ, jak jsem ti říkal, že jsem na stopě něčeho velkého?“ \r\n\r\nVy: „Jasně že pamatuju. Nesešli jsme se tu dneska právě kvůli tomu?“ \r\n\r\nArlong: „Rozluštil jsem to a je to fakt velké“ odmlčí se, popadne korbel rumu a lokne si, jako kdyby mu uvízlo velké sousto v krku. Ještě ani nepoloží korbel zpátky na stůl a pokračuje: „Ta mořská krysa po mně ale jde, přišli na to, že po tom pátrám a teď se chtějí zmocnit mé mapy, kde mám vše zapsané. Musíš mi pomoct.“ Arlong se na vás úzkostlivě zadívá a nervózně čeká, co odpovíte. \r\n\r\nHlavou se vám začne honit množství otázek. Zakloníte se v židli a ruce si přeložíte v kříž. Po chvíli uvažování se nakloníte zpátky, ruce stále zkřížené: „Tak za prvé…“. Z nenadání se rozrazí dveře do hospody a dovnitř vtrhne několik mužů. Prudce se otočíte hlavou směrem ke dveřím. „Nechte zbraně ležet, kde jsou a nehýbejte se!“ zařve jeden z mužů. Hospoda ztichne. Přes hustý dým nejde rozeznat jejich obličeje. Arlongovi muži si mezi sebou začnou vyměňovat blýskavé pohledy, každý ví co přesně dělat, pouze čekají na povel kapitána. Vy se ze vzniklé situace nedokážete vzpamatovat a pořád jen civíte směrem ke dveřím. Připadá vám to jako věčnost, nikdo se nehýbe, jen kouř se pomalu vytrácí otevřenými dveřmi ven. Když se vzduch trochu pročistí, prohlédnete si znovu muže u dveří. Je jich pět a všichni jsou oblečení v černo-šedých námořnických uniformách, každý drží v jedné ruce nablýskanou šavli a v druhé pistoli. Z prohlížení vás vyruší nově příchozí postava, která vchází s další dvojicí ozbrojených mužů. Je to velmi vysoký muž mohutné postavy. I když jste ho na živo ještě nikdy neviděli, jeho enormní pletené černé vousy prozrazují, o koho se jedná. Kapitán Černovous, postrach všech pirátů. Kdokoli se s ním dostal do sporu, nepřežil. Víte, že jeho příchod nepřinese nic dobrého. Otočíte se zpátky k příteli, ale ten již stojí na nohách s tasenou šavlí a smrtelným výrazem na tváři. Zařve na svoji posádku: „Je to tady chlapi! Bez boje se ale nevzdáme, pošlete tu proradnou krysu do pekel!“. Posádka svého kapitána poslechla s jednohlasným zakřičením: „Aargh!“. Společně se rozběhli proti svému nepříteli. Ani vy neváháte svému příteli pomoci a přidáte se k nim. \r\n\r\nSpustila se hrozivá bitka. Věděli jste, že Černovousova posádka je ve značné přesile a vyhrát tento boj bude velice obtížné. Váš přítel, jako správný kapitán, se vrhá na Černovouse. Zkontrolujete, jak si vede. Jasnou převahu má Černovous, ale váš přítel se zatím drží. Když tu najednou vidíte, jak váš přítel špatně odhadl další útok Černovouse. Černovousova šavle míjí připravený kryt vašeho přítele a zatíná se do jeho hrudi. Síla úderu byla tak silná, že Arlonga srazí jako hadrového panáka k zemi. Jste doslova ohromen silou Černovouse. Váš přítel zůstane bez hnutí ležet. Černovous otočí hlavu k vám a na chvilku si vás prohlíží. Cítíte, že jste další v pořadí. Nejste však jediný, kdo byl svědkem tohoto brutálního útoku. Dva členové přítelovy posádky také uviděli svého kapitána padnout k zemi. Naplnil je ohromný vztek, který jim pomáhá skolit nepřátele. Vzápětí se s křikem pustí za Černovousem, aby svého kapitána pomstili. Prudkým tokem se jim daří Černovouse odtlačit od Arlongova těla. Využíváte situace a rozeběhnete se ke svému příteli. Pokleknete vedle něj a vidíte, že stále žije. Jeho zranění je ale příliš velké, určitě už moc dlouho nevydrží. Arlong vás křečovitě chytí za košili, stáhne ještě blíže k sobě a do ucha vám z posledních sil říká: „Tady máš tu mapu. Zaznačil jsem tam místa, kde jsou ukrytá tajemství. Musíš je najít všechna. Každé tajemství je součástí formule. Když je přečteš ve správném pořadí, vyslovíš formuli, kterou získáš neskutečnou moc. Pak budeš neporazitelný. Začít musíš tady…“, svým krvavým prstem ukazuje na malý ostrov. \r\n\r\n\r\n\r\nV tu chvíli vašeho přítele opouštějí poslední síly a umírá, jeho tělo nyní bezvládně leží v kaluži krve. Naposledy se loučíte se svým přítelem, tentokrát nadobro. Rychle zkontroluje své okolí a zhodnotíte situaci. Posádka začíná prohrávat, přesila je příliš velká. Víte, že hostinec má ještě zadní východ v kuchyni, který s oblibou využívá hostinský, když vyhazuje nepříjemné opilce. Probijete se tedy do kuchyně. Když vyběhnete z hospody, ani se nerozhlížíte a míříte směrem ke své lodi. Najednou uslyšíte povel od Černovouse k jednomu členu jeho posádky, aby se vydal za vámi. „Sakra ten chlap je jako strážní věž!“ zařvete nechtěně. Teď alespoň předvedete, proč se jmenujete Černé kočky. Utíkáte totiž tak lehce a rychle, že s vámi nikdo není schopen udržet tempo. Dobíháte ke své lodi. Ještě než vás posádka zaregistruje, narychlo kontrolujete mapu od Arlonga a hlesnete: „Uff… nic se jí nestalo… ale co to?“. Když otáčíte mapu, všimnete si vzadu nápisu: „Jedno tajemství najdeš, jen když budeš vyzvídat u obchodníků, kteří obchodují mezi dvěma ostrovy“. Mapu rychle zastrčíte zpátky a začnete řvát rozkazy k okamžitému vyplutí. Když opouštíte přístav, začínáte přemýšlet, co se vlastně stalo a co musíte udělat. Víte, že úkol nebude snadný. Černovous vás viděl a váš obličej si určitě zapamatoval. Víte, jak to chodí, Černovous vás bude hledat, máte přibližně měsíc času, než vás dostihne. Musíte jednat rychle…','text','','5z8v7',0,'d8wkph','147.229.93.29',56,0,0),(35,'pl0lmiuru',0,NULL,NULL,1450254171,0,NULL,'\r\nBIS - Bezpečnost informačních systémů\r\n\r\nInformace k projektu č.2\r\n\r\n\r\n\r\nZadání projektu\r\n\r\nNa serveru s IP adresou ptest6.local umístěným ve virtuální síti bis.fit.vutbr.cz běží webová aplikace, s autentizací uživatelským jménem a heslem. Webová aplikace vynucuje šifrovanou komunikaci (protokol HTTPS - standardně na portu 443). Na serveru dále běží knihovna OpenSSL 1.0.1e-fips 11 Feb 2013 která zajišťuje zmíněnou šifrovanou komunikaci mezi uživatelem a serverem. \r\nVaším úkolem je vytvořit program v jazyce Python, který dokáže získat validní přihlašovací údaje uživatelů, kteří se přihlašují do webové aplikace na zranitelném serveru. Berte v potaz, že uživatelé občas zadávají i chybné přihlašovací údaje (např. překlep). V rámci hodnocení jsou akceptovány pouze validní přihlašovací údaje.\r\nProgramové řešení\r\n\r\nProgram musí v rámci webové aplikace na serveru 192.168.122.211 fungovat univerzálně. Při hodnocení budou na serveru odlišní uživatelé (samozřejmě i jejich hesla). Program musí být možné interpretovat na studentském virtuálním stroji, který jste využívali při řešení prvního projektu. \r\nNa Vašich virutálních strojích není možné instalovat žádné další pomocné knihovny. Povolený je tedy pouze Python v2.6.6 a aktuálně nainstalované knihovny. \r\n\r\nSynopsis\r\nvas_login.py HOST [OPTIONS]\r\nHOST\r\npovinný parametr, představuje hostname popř. IP adresu serveru, na který útočíte\r\nv případě, že nejsou zadány jiné OPTIONS (výjma [-p PORT], kterým můžete definovat nestandardní port - např. v případě tunelování), program bude vypisovat informace o zranitelnosti zvoleného serveru ve formátu:\r\nvulnerable:yes v případě, že je server zranitelný\r\nvulnerable:no v případě, že je server zranitelný není\r\nv síti bis.fit.vutbr.cz běží ještě jeden stroj na IP adrese ptest5, který danou zranitelností netrpí (má novější verzi OpenSSL knihovny) - vhodné pro ověření správné funkčnosti Vašeho programu\r\nOPTIONS\r\n[-p PORT] - volitelný parametr, kde PORT představuje číslo portu, na který útočíte, při neuvedení parametru musí program pracovat na defaultním portu 443\r\n[-l] - vypíše validní přihlašovací údaje na STDOUT k aplikaci běžící na zranitelném serveru na zvoleném portu, formát výstupu programu je následující: username:LieutenantRiker;password:Grw789.Dq/4aVq. Pokud odhalíte více validních přihlašovacích údajů, vypište první nalezený a program ukončete.\r\n[-h] - vypíše nápovědu k programu na STDOUT, musí být spuštěn samostatně bez ostatních parametrů, stejně tak bude vypsána při chybné kombinaci/chybného zadání parametrů\r\nPříklad spuštění\r\nVypíše validní přihlašovací údaje:\r\n$python vas_login.py ptest6.local -p 443 -l\r\nDoporučení\r\n\r\nProtunelujte příslušnou službu až na svoji pracovní stanici, kde si budete moci zobrazit webovou aplikaci a také ji prozkoumat. Zaměřte se na parametry, které se na server odesílají v rámci autentizace. Pokud budete na projektu pracovat mimo fakultu, doporučuji předně připojení do školní sítě přes VPN. Pokud se Vám podaří získat přihlašovací údaje, manuálně otestujte přihlášení a sledujte, jak se aplikace chová v případě odeslání chybných a validních přihlašovacích údajů. Při automatickém ověření přihlašovacích údajů se po úspěšné autentizaci nezapomeňte z webové aplikace odhlásit, aby byla zrušena SESSION. V jiném případě Vám opětovný požadavek na autentizaci nebude fungovat.\r\nDokumentace\r\n\r\nDoporučený rozsah je 1 strana textu, obsah nesmí přesáhnout 2 strany textu. Není třeba přikládat úvodní stránku s logem fakulty. Dokumentace by měla obsahovat:\r\npopis a princip zranitelnosti (můžete přidat jednoduchý diagram principu útoku)\r\npopis tunelování služby až na Vaši pracovní stanici (zmiňte všechny volané příkazy + můžete doplnit jednoduchý diagram propojení mezi hosty a vstupní/výstupní porty), dále vypiště proměnné, které jsou určeny pro autentizaci\r\njak jste postupovali a jakým principem pracuje Váš program při ověření, zda daný server trpí příslušnou zranitelností\r\npopis, postup a princip funkčnosti Vašeho programu, při získání přístupových údajů\r\nprincip, jakým Váš program validuje přístupové údaje\r\nHodnocení\r\n\r\nBodový zisk z projektu je rozdělen na 3 části:\r\nOdhalení zranitelnosti serveru (vulnerability) = 1b\r\nDokumentace = 2b\r\nZískání validních přístupových údajů = 4b\r\nCelkově je tedy možné získat za projekt až 7b. U programového řešení se nebude hodnotit jen funkčnost programu, ale i kvalita kódu, komentáře tak i funkčnost nápovědy. U dokumentace kvalita zpracování, gramatika a pravopisné chyby. Dokumentaci je možné odevzdávat v jazycích: čeština, slovenština, angličtina. Za prohřešky budou poměrově odečítány body z výsledného hodnocení.\r\nOdevzdání\r\n\r\nProjekt odevzdávejte do informačního systému WIS. Formát odevzdání je standardně vas_login.zip (př. xskywa00.zip). ZIP archiv bude obsahovat:\r\nvas_login.py (python skript s Vaším programovým řešením)\r\ndokumentace.pdf\r\nJakékoliv otázky směřujte na fórum předmětu. \r\nDátum odevzdání: 18.12.2014 22:59:59 ZULU (http://www.timezoneconverter.com)\r\nDo odevzdání zůstává : 02 dní, 14 hodin, 36 minut a 20 sekund.\r\nPOZOR! Projekt řešte samostatně, jakékoliv opisování povede k disciplinární komisi a k hodnocení 0b. I nekompletní řešení se hodnotí kladně.','text','','otXVM',0,'mnbdz3','78.102.41.132',143,0,0),(36,'pr5ufvaid',2,'waritko',NULL,1450643850,0,'Waritko-Dell hosts','# Copyright (c) 1993-2009 Microsoft Corp.\r\n#\r\n# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.\r\n#\r\n# This file contains the mappings of IP addresses to host names. Each\r\n# entry should be kept on an individual line. The IP address should\r\n# be placed in the first column followed by the corresponding host name.\r\n# The IP address and the host name should be separated by at least one\r\n# space.\r\n#\r\n# Additionally, comments (such as these) may be inserted on individual\r\n# lines or following the machine name denoted by a \'#\' symbol.\r\n#\r\n# For example:\r\n#\r\n#      102.54.94.97     rhino.acme.com          # source server\r\n#       38.25.63.10     x.acme.com              # x client host\r\n\r\n# localhost name resolution is handled within DNS itself.\r\n#	127.0.0.1       localhost\r\n#	::1             localhost\r\n192.168.1.253	mujucet.kyklop\r\n77.93.194.60	ts19.travian.sk','text','','0JQEU',0,'myhytx','178.72.250.128',49,0,0),(37,'p4fbki6yz',0,NULL,NULL,1450874744,0,NULL,'                var lstCOs = from COheader in ServiceContext.ge_co_headerSet\r\n                             where COheader.ge_psa_projectid != null && (COheader.ge_psa_projectid.Id == _projectID) && (Array.IndexOf(statuscodesActive,COheader.statuscode) >= 0)\r\n                             orderby COheader.ge_code descending\r\n                            select new\r\n                            {\r\n                                firma = COheader.ge_accountid.Name,\r\n                                name = COheader.ge_name,\r\n                                partsno = (dicCounts.ContainsKey(COheader.Id)) ? dicCounts[COheader.Id] : 0,\r\n                                status = lstStatus.SingleOrDefault(o => o.Key == COheader.statuscode).Value,\r\n                                priority = lstPriority.SingleOrDefault(o => o.Key == COheader.ge_priority).Value,\r\n                                registredon = COheader.ge_date_registration != null ? Shared.ConvertToLocal(COheader.ge_date_registration, Shared.GetTimeZoneOffset(Request)).ToString() : \"\",\r\n                                registredOnSorting = Shared.ConvertToLocal(COheader.ge_date_registration, Shared.GetTimeZoneOffset(Request)).ToString(\"yyyyMMddHHmm\"),\r\n                                coid = COheader.Id.ToString(),\r\n                                modifiedOn = Shared.ConvertToLocal(COheader.ge_date_statuscode_modify, Shared.GetTimeZoneOffset(Request)).ToString(),\r\n                                modifiedOnSorting = Shared.ConvertToLocal(COheader.ge_date_statuscode_modify, Shared.GetTimeZoneOffset(Request)).ToString(\"yyyyMMddHHmm\"),\r\n                                code = COheader.ge_code,\r\n                                contact = (COheader.ge_keyuser_contactid != null) ? COheader.ge_keyuser_contactid.Name : string.Empty,\r\n                                konzultant = (COheader.ge_consultant_userid != null) ? COheader.ge_consultant_userid.Name : string.Empty\r\n                            };','csharp','','86BNy',0,'phywhw','62.209.222.194',97,0,0),(38,'p1urgyrvz',0,NULL,NULL,1450875793,0,NULL,' var lstCOs = from COheader in ServiceContext.ge_co_headerSet\r\n                             where COheader.ge_psa_projectid != null && (COheader.ge_psa_projectid.Id == _projectID) && ??????????\r\n                             orderby COheader.ge_code descending\r\n                            select new\r\n                            {','csharp','','0LEr2',0,'aa4t91','62.209.222.194',98,0,0),(39,'pz7vzvgtz',0,NULL,NULL,1450876387,0,NULL,'var lstCOs = from COheader in ServiceContext.ge_co_headerSet\r\n                             where COheader.ge_psa_projectid != null && (COheader.ge_psa_projectid.Id == _projectID) && statuscodesActive.Contains((int)COheader.statuscode)//(Array.IndexOf(statuscodesActive, COheader.statuscode) >= 0)\r\n                             orderby COheader.ge_code descending\r\n                            select new\r\n                            {\r\n                                firma = COheader.ge_accountid.Name,','csharp','','07fc3',0,'8wmbwz','62.209.222.194',64,0,0),(40,'pbddiqm1n',0,NULL,NULL,1450879832,0,NULL,'var lstCOs = from COheader in ServiceContext.ge_co_headerSet\r\n                             where COheader.ge_psa_projectid != null && (COheader.ge_psa_projectid.Id == _projectID) && (statuscodesActive.Contains(134260005))\r\n                             orderby COheader.ge_code descending\r\n                            select new\r\n                            {\r\n                                firma = COheader.ge_accountid.Name,','csharp','','Anluf',0,'fqstfa','62.209.222.194',57,0,0),(41,'p2kelm1mt',0,NULL,NULL,1452377936,0,NULL,'int main(void)\r\n{\r\n   short counter = 0;\r\n   unsigned long mcu_ready;\r\n   static int new_threshold;\r\n   unsigned long histogram[PIXELS];\r\n   \r\n   histogram_clean(histogram);\r\n   initialize_hardware();\r\n   set_led_d6(1);  //rozsvitit LED D6\r\n   set_led_d5(1);  //rozsvitit LED D5\r\n\r\n   /**************************************************************************/\r\n   /*                      Aktualizovany hlavni program                      */\r\n   /**************************************************************************/\r\n   mcu_ready = 1;\r\n   fpga_write(FPGA_MCU_READY, mcu_ready);\r\n   while(fpga_read(FPGA_MCU_READY) != 2);\r\n\r\n   term_send_str(\"Both FPGA and MCU are ready!!!\"); \r\n   term_send_crlf();\r\n\r\n   /**************************************************************************/\r\n\r\n   set_led_d5(0);  //zhasnout LED D5\r\n   fpga_write(FPGA_MCU_READY, 1);\r\n   while (1) {\r\n	   //kontorlovat MCU jeslti ma data\r\n	   if(fpga_read(FPGA_MCU_READY) == 2){\r\n		   fpga_write(FPGA_MCU_READY, 0);\r\n		   if(!(fpga_read(FPGA_FRAME_CNT) % 10)){\r\n			   //precist si histogram a na otsu si pustit novz treshold a ten uloyitm do sdilene pameti\r\n			   *histogram = fpga_read(FPGA_HISTOGRAM);\r\n			   new_threshold = otsu(histogram, PIXELS);\r\n				fpga_write(FPGA_THRESHOLD, new_threshold);\r\n			   //pokud je to sty tak vypsat vysledek\r\n			   if(!(fpga_read(FPGA_FRAME_CNT) % 100)){\r\n					print_results(fpga_read(FPGA_FRAME_CNT), new_threshold, histogram, PIXELS);\r\n			   }\r\n\r\n			   			   \r\n			   //vznulovani histogramu\r\n			   histogram_clean(histogram);\r\n			}\r\n	   }\r\n	      fpga_write(FPGA_MCU_READY, 1);\r\n     /* delay_ms(1);  //zpozdeni 1ms\r\n\r\n      counter++;\r\n      if (counter == 500) {\r\n         flip_led_d6(); //invertovat LED\r\n         counter = 0;\r\n      }\r\n\r\n      terminal_idle();  // obsluha terminalu*/\r\n   }\r\n}','text','','gBG17',0,'iiw4f2','147.229.93.4',102,0,0),(43,'pqfvbzsge',2,'waritko',NULL,1453789984,0,'Prime work','[Worker #1]\r\nTest=56FA7D42BF531CC3CDC172B3BEC03E9D,76117537,75,1\r\nTest=E474D3AF65A25F30C23F1AAB89485DFF,76117673,75,1\r\n[Worker #2]\r\nTest=65563027F205B09F339D3BA55806B1BE,76132363,75,1\r\nTest=2A1CD0114E9987CFD2185A51545DE1F6,76132417,75,1','text','','1YqLw',0,'7uzlrv','194.228.20.161',91,0,0),(44,'pnbichblo',2,'waritko',NULL,1453915978,0,'NetSuite Test zadani','Instructions:\r\n\r\n- Thanks for your interest in NetSuite development!  Please complete the\r\n  following questions.  If you can\'t solve a problem completely, feel free to\r\n  submit your best partial solution, together with a comment as to what is\r\n  missing or what shortcomings you see with your solution.  We give partial\r\n  credit!\r\n\r\n- For programming questions use one of the languages: Java or C#.\r\n  \r\n- For SQL questions, you may use any dialect of SQL. Preferred dialects are\r\n  ANSI SQL and Oracle SQL. You should indicate the dialect of SQL you are using.\r\n\r\n- We\'ll be looking at everything.  Pretend you are writing production code.\r\n  We\'ll take into account comments (if any), identifier names, and formatting.\r\n  Read assignment of tasks carefully so you do not miss any information.\r\n\r\n- Good luck!                                                                1.36\r\n\r\n\r\n--------------------------------------------------------------------------------\r\nQUESTION 1\r\nFor programming questions use programming language Java or C#.\r\n\r\nGiven a sorted array of integers, write a method to remove the duplicates. Use pure\r\narrays and access individual items via indexes. Don\'t use any dynamic data structures,\r\ni.e. do not use any classes from the java.util package, or the equivalent library for\r\nyour language.\r\n\r\nExample: [ 1, 2, 3, 3, 3, 4, 4, 10, 13, 15, 15, 17 ] ->\r\n         [ 1, 2, 3, 4, 10, 13, 15, 17 ]\r\n\r\nSolution template:\r\n\r\n    int[] removeDuplicates(int[] values)\r\n    {\r\n        // your code here\r\n    }\r\n\r\n   Questions (answer these):\r\n   1. Did you write that as if you were writing production code?\r\n   2. What assumptions does your implementation make about the input parameter?\r\n   3. What is removeDuplicates(x).length, in your implementation?\r\n   4. Are you using all the information you have about the input array?\r\n   5. What is the algorithmic complexity (\"big O\") of your function?\r\n\r\n--------------------------------------------------------------------------------\r\nQUESTION 2\r\nBe sure to indicate the dialect of SQL you are using!\r\n\r\nYou are given two database tables, EMPLOYEES and BONUS, with the following\r\nschema.  Data shown below should be considered example data; the actual table\r\nwill contain other data.\r\n\r\n   EMPLOYEES                                       BONUS\r\n   __________________________________________      _____________\r\n   EMPID  NAME  SUPERVISOR  LOCATION   SALARY      EMPID  NBONUS\r\n   ------------------------------------------      -------------\r\n      34  Amy               NY         110000         17    5000\r\n      17  Ben           34  TN          75000         10    2000\r\n       5  Chris         34  TN          80000         34    5000\r\n      10  Don            5  HI         100000      ...\r\n   ...\r\n\r\nA) Write a SQL statement to return the employee\'s name, supervisor\'s name and\r\n   bonus of everyone who got a bonus greater than 1000.\r\n\r\nB) Write a SQL statement to list the highest paid employee in each location.\r\n   Ranking should be based on salary plus bonus.  Output should include employee\r\n   name, salary, bonus, and total pay (salary plus bonus).\r\n\r\nC) Given a NEW_SUPERVISOR table (columns: EMPID, SUPERVISOR), write an update\r\n   statement that updates the supervisor of each employee with a new supervisor.\r\n   The NEW_SUPERVISOR table is an incremental update, so employees not listed in\r\n   the table must retain their existing supervisor.\r\n\r\n\r\n--------------------------------------------------------------------------------\r\nQUESTION 3\r\n\r\nGiven a non-negative real number a, its square root is a number x, such that x * x = a.\r\nOne way to compute a square root is via successive approximation, where one estimate\r\nyields a better estimate.\r\n\r\nFor example, let\'s say you are trying to find the square root of 2, and you have\r\nan estimate of 1.5. We\'ll say a = 2, and x = 1.5. To compute a better estimate,\r\nwe\'ll divide a by x. This gives a new value y = 1.333333... However, we can\'t just\r\ntake this as our next estimate (why not?). We need to average it with the previous\r\nestimate. So our next estimate, xx will be (x + y) / 2, or 1.416666...\r\n\r\n   Write a function that takes a non-negative real number a, and an epsilon (a\r\n   small real number), and returns an approximation of the square root of a.\r\n\r\n    double square_root(double a, double epsilon) ...\r\n\r\n   Epsilon determines how accurate the approximation needs to be. The function\r\n   should return the first approximation x it obtains that satisfies abs(x*x - a) < epsilon,\r\n   where abs(x) is the absolute value of x.\r\n\r\n   Questions (answer these):\r\n   1. Why can\'t the next estimate, xx, be computed as a / x, where x is the\r\n      previous estimate?\r\n   2. What happens, in your implementation, if a = 0?\r\n   3. What value does your program give for square_root(2, 1e-6)?\r\n\r\n\r\n--------------------------------------------------------------------------------\r\nBONUS Question 4 (This question is optional) \r\n	Now implement your solution to QUESTION 1 as a Java iterator that does not modify the source\r\n	array, and returns only unique elements.  Write a concrete subclass of the\r\n	interface java.util.Iterator; the interface is included below for convenience\r\n	(see http://download-llnw.oracle.com/javase/6/docs/api/java/util/Iterator.html).\r\n	You do not need to implement the optional remove() method.\r\n\r\n   (For other languages, implement a generator or other equivalent construct.)\r\n\r\n   Do not \"cheat\" by calling the removeDuplicates() you defined above. One benefit\r\n   of iterators is that they can operate incrementally -- make your iterator\r\n   only do the minimum work it needs to in each call to hasNext() or next().\r\n\r\n    public interface Iterator<E>\r\n    {\r\n        /** Returns true if the iteration has more elements. */\r\n        boolean hasNext();\r\n\r\n        /** Returns the next element in the iteration. */\r\n        E next();\r\n\r\n        /** Removes from the underlying collection the last element returned by\r\n            the iterator (optional operation). */\r\n        void remove();\r\n    }\r\n\r\n   Questions (answer these):\r\n   1. Does your implementation work for generic objects, numbers, or integers?\r\n   2. If it does not work with objects, what would be required to make it work\r\n      for generic objects?','text','$2a$10$9S7U6FmqT1NBhlDHhKPr0uhoxIFkWEZK5yzJZcycNPYkkpRSm1h7G','N49hy',1,'ealefe','194.228.76.139',1,0,0),(45,'pqjlz1ert',0,NULL,NULL,1454348548,0,'Citac','var currentEvent, currentSaveEvent, colorIndex = 0;\r\n\r\nfunction loadReservationsDataSource() {\r\n    var equipmentsToLoad = UserSettings.getFavoriteEquipmentsIds().concat(UrlParameters.EquipmentIds);\r\n    var reservationsDataSource = new kendo.data.SchedulerDataSource({\r\n         schema: {\r\n            data: function (resp) {\r\n                if (lastOperationType === \"read\") { //read operation - process retrieved data\r\n                    //The returned JSON structure is complicated and it can\'t be used in databinding to Scheduler. We have to transform this JSON to a new JSON with simplified structure.\r\n                    var serviceAppointments = resp.filter(function (rec) { //work only with serviceappointments\r\n                        return rec.LogicalName === \'serviceappointment\';\r\n                    });\r\n                    var resultArray = []; //this array will be the result of the function. It will contain objects, each object represent one serviceappointment record with its attributes\r\n\r\n                    var viewType = $(\"#scheduleView\").data(\"kendoScheduler\").viewName();\r\n                    var duplicities = {};\r\n\r\n                    //var length = ;\r\n                    for (var i = 0; i < serviceAppointments.length; i++) {\r\n                        /* Attribute name can contain dots, which can\'t be processed in model. For each attribute with a dot,\r\n                           create new attribute with the same name (but without dots) and the same value. */\r\n                        var attributeKeysWithDots = Object.keys(serviceAppointments[i].Attributes).filter(function (key) {\r\n                            return key.indexOf(\".\") > -1;\r\n                        });\r\n                        for (var j = 0; j < attributeKeysWithDots.length; j++) {\r\n                            var keyWithoutDots = attributeKeysWithDots[j].split(\'.\').join(\"\");\r\n                            serviceAppointments[i].Attributes[keyWithoutDots] = serviceAppointments[i].Attributes[attributeKeysWithDots[j]];\r\n                        }\r\n                        /* If lookup field \'ge_realised_for_contactid\' is filled, change its properties: \'Name\' to \'name\' and \'Id\' to \'id\'.\r\n                            After this, property names are synchronized with contactsDataSource and it can be used in data binding. */\r\n                        if (serviceAppointments[i].Attributes[\"ge_realised_for_contactid\"] !== undefined) {\r\n                            var newObject = {\r\n                                id: serviceAppointments[i].Attributes[\"ge_realised_for_contactid\"].Id,\r\n                                name: serviceAppointments[i].Attributes[\"ge_realised_for_contactid\"].Name\r\n                            }\r\n                            serviceAppointments[i].Attributes[\"ge_realised_for_contactid\"] = newObject;\r\n                        }\r\n                        //process resources\r\n                        //resourceIds = [];\r\n                        var resourcesFromFavorites = [];\r\n                        var resourcesNotFromFavorites = [];\r\n  \r\n                        //resources (equipments) that are present in the favorites should be selected first, which ensures that the reservation color will be set correctly\r\n                        for (var j = 0; j < serviceAppointments[i].Attributes[\"resources\"].length; j++) {\r\n                            var resourceIsInFavorites = UserSettings.FavoriteEquipments.filter(function (fav) {\r\n                                return serviceAppointments[i].Attributes[\"resources\"][j].Attributes.partyid.Id === fav.id;\r\n                            }).length > 0;\r\n                            if (resourceIsInFavorites) {\r\n                                resourcesFromFavorites.push(serviceAppointments[i].Attributes[\"resources\"][j].Attributes.partyid.Id);\r\n                            }\r\n                            else {\r\n                                resourcesNotFromFavorites.push(serviceAppointments[i].Attributes[\"resources\"][j].Attributes.partyid.Id);\r\n                            }\r\n                        }\r\n                        resourceIds = resourcesFromFavorites.concat(resourcesNotFromFavorites);\r\n\r\n                        //for (var j = 0; j < serviceAppointments[i].Attributes[\"resources\"].length; j++) {\r\n                        //    var resourceId = serviceAppointments[i].Attributes[\"resources\"][j].Attributes.partyid.Id;\r\n                        //    resourceIds.push(resourceId);\r\n                        //}\r\n                        serviceAppointments[i].Attributes[\"resourceIds\"] = resourceIds;\r\n                        //process lookup (entity reference) attributes\r\n                        serviceAppointments[i].Attributes[\"rgid\"] = getIdFromEntityReference(serviceAppointments[i].Attributes, \"rgid\");\r\n                        serviceAppointments[i].Attributes[\"psa_projectid\"] = getIdFromEntityReference(serviceAppointments[i].Attributes, \"psa_projectid\");\r\n                        serviceAppointments[i].Attributes[\"serviceIdReadOnly\"] = getIdFromEntityReference(serviceAppointments[i].Attributes, \"serviceid\");\r\n                        serviceAppointments[i].Attributes[\"serviceid\"] = getIdFromEntityReference(serviceAppointments[i].Attributes, \"regardingobjectid\");\r\n                        serviceAppointments[i].Attributes[\"psa_servicecontractid\"] = getIdFromEntityReference(serviceAppointments[i].Attributes, \"psa_servicecontractid\");\r\n                        //ensure that dates are treated as dates, not as strings\r\n                        serviceAppointments[i].Attributes[\"start\"] = new Date(serviceAppointments[i].Attributes[\"start\"]);\r\n                        serviceAppointments[i].Attributes[\"end\"] = new Date(serviceAppointments[i].Attributes[\"end\"]);\r\n                        if (serviceAppointments[i].Attributes[\"isAllDay\"] === true) {\r\n                            //to be displayed correctly in scheduler, all day event for one day must start and end at the same time\r\n                            var startDate = serviceAppointments[i].Attributes[\"start\"];\r\n                            var endDate = serviceAppointments[i].Attributes[\"end\"];\r\n                            if (startDate !== endDate && startDate.getHours() === 0 && startDate.getMinutes() === 0 && endDate.getHours() === 0 && endDate.getMinutes() === 0) {\r\n                                //the reservation really is all day\r\n                                endDate.setDate(endDate.getDate() - 1);\r\n                                serviceAppointments[i].Attributes[\"end\"] = endDate;\r\n                            }\r\n                            else {\r\n                                serviceAppointments[i].Attributes[\"isAllDay\"] = false;\r\n                            }\r\n                        }\r\n                        serviceAppointments[i].Attributes[\"conflict\"] = false;\r\n                        /* Check if resultArray contains appointment with this id. If yes, it means that the appointment is for more equipments and we have to change the color of this another occurence\r\n                           of the appointment to match the color of the second, third, etc... equipment. */\r\n                        var currentEquipmentId = serviceAppointments[i].Id;\r\n                        var alreadyProcessedOccurencesOfThisAppointment = resultArray.filter(function (app) {\r\n                            var appointment = app.id === serviceAppointments[i].Id;\r\n\r\n                            if (appointment) {\r\n                              \r\n                                duplicities[currentEquipmentId] = duplicities[currentEquipmentId] == null ? 2 : duplicities[currentEquipmentId]++;\r\n                            }\r\n\r\n                            return appointment;\r\n                        });\r\n\r\n                        \r\n\r\n                        if (viewType == \"month\" || viewType == \"week\") {\r\n                            var settingsForEquipment = UserSettings.FavoriteEquipments.filter(function (setting) {\r\n                                return setting.id === resourceIds[alreadyProcessedOccurencesOfThisAppointment.length]; //set color of the appointment to the color of the n-th equipment in appointment\'s resources\r\n                            });\r\n\r\n                            if (settingsForEquipment.length > 0) {\r\n                                serviceAppointments[i].Attributes[\"colorVal\"] = settingsForEquipment[0].color;\r\n\r\n                            }\r\n                            else {\r\n                                serviceAppointments[i].Attributes[\"colorVal\"] = \"#ffff00\"; //neyhnpjila jsem toto?\r\n                            }\r\n                        }\r\n\r\n                        //if viewType is day or sevendayview destroy duplicit except color them\r\n                        else if (viewType == \"day\" || viewType == \"sevenDayView\") {\r\n\r\n                            if (duplicities[currentEquipmentId] > 1) {\r\n                                colorIndex = duplicities[currentEquipmentId] == null ? 0 : duplicities[currentEquipmentId] - 1;\r\n                                serviceAppointments.splice(i, 1); //vyjmuti eventu\r\n\r\n                                continue;\r\n                            }\r\n                            else {\r\n\r\n                                var settingsForEquipmentDay = UserSettings.FavoriteEquipments.filter(function (setting) {\r\n                                    //TODO: COLOR INDEX ACCORDING TO COLLUMN, DUPLICIT AND FAVOURITES\r\n                                    return setting.id === serviceAppointments[i].Attributes[\"resourceIds\"][colorIndex];\r\n                                        //resourceIds[alreadyProcessedOccurencesOfThisAppointment.length];\r\n                                    //resourceIds[duplicities[currentEquipmentId]]; //set color of the appointment to the color of the n-th equipment in appointment\'s resources\r\n                                });\r\n                                if (settingsForEquipmentDay.length > 0) {\r\n                                    serviceAppointments[i].Attributes[\"colorVal\"] = settingsForEquipmentDay[0].color;\r\n                                } else {\r\n                                    //tuto barvu budou mit  pristroje co nejsou v oblibenych\r\n                                    serviceAppointments[i].Attributes[\"colorVal\"] = \"#ffff00\"; //sem dat jeho puvodni barvu \r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        serviceAppointments[i].Attributes[\"modifiedon\"] = formatDate(serviceAppointments[i].Attributes[\"modifiedon\"]);\r\n                        serviceAppointments[i].Attributes[\"createdon\"] = formatDate(serviceAppointments[i].Attributes[\"createdon\"]);\r\n\r\n                        serviceAppointments[i].Attributes[\"formServiceName\"] = serviceAppointments[i].Attributes[\"regardingobjectid\"] !== undefined ?\r\n                            serviceAppointments[i].Attributes[\"regardingobjectid\"].Name : \"\";\r\n                        delete serviceAppointments[i].Attributes[\"activityparty1.partyid\"]; //this property is not used and it causes errors when cancelling opened reservation, so it is deleted\r\n                        resultArray.push(serviceAppointments[i].Attributes);\r\n                    }\r\n                    checkConflicts(resultArray);\r\n                    return resultArray;\r\n                }\r\n                else { //create, update or delete operation - it is completed now, read actualized data and display error message, if there\'s any\r\n                    reservationsDataSource.read();\r\n                }\r\n                \r\n            },\r\n            \r\n                \r\n                })\r\n            }\r\n        }\r\n    });\r\n    reservationsDataSource.name = \"reservationsDataSource\";\r\n    reservationsDataSource.options.schema.model.resGroupsDataSource.name = \"resGroupsDataSource\";\r\n    return reservationsDataSource;\r\n}','javascript','','YDvEL',0,'zz5sxj','62.209.222.194',83,0,0),(46,'p1ozdzagj',0,NULL,NULL,1454349484,0,'Fron','            if(this.viewName() == \"day\" || this.viewName() == \"sevenDayView\"){\r\n                var dupliciteUIDs = [];\r\n                var duplicitOrder = 0;\r\n\r\n                for (var idx = 0, length = events.length; idx < length; idx++) {\r\n                    event = events[idx];\r\n\r\n                    var uid = event.uid;\r\n                    var div = this.element.find(\"div[data-uid=\'\" + uid + \"\']\");\r\n\r\n                    //uid se naslo vicekrat\r\n                    if (div.length >= 2) {\r\n                        dupliciteUIDs[duplicitOrder] = uid;\r\n                        duplicitOrder++;\r\n                    }\r\n                }\r\n\r\n                for (var dix = 0; dix <= duplicitOrder; dix++) {\r\n                    var rightUID = dupliciteUIDs[dix];\r\n\r\n                    //seznam duplicitnich divu podle poradi\r\n                    var duplicitDivs = this.element.find(\"div[data-uid=\'\" + rightUID + \"\']\");\r\n\r\n                    //skryj vsechny divy krom tech, ktere jsou spravne pro spravny sloupec\r\n                    for (var p = 0; p <= duplicitOrder; p++) {\r\n                        if (p != dix) {\r\n                            $(duplicitDivs[p]).hide();\r\n                        }\r\n                    }\r\n                }\r\n            }','javascript','','5blel',0,'rqdgvo','62.209.222.194',97,0,0),(47,'p2lncih9s',3,'martin.varak',NULL,1456528293,0,'CouchDB hacks view','{\r\n   \"_id\": \"_design/hacks\",\r\n   \"_rev\": \"2-beea6f9f06476ecea6f337749f63d7d0\",\r\n   \"language\": \"javascript\",\r\n   \"views\": {\r\n       \"unprocessed\": {\r\n           \"map\": \"function(doc) \\n{\\n\\tif(doc.processed === \\\"FALSE\\\")\\n\\t{\\n\\t\\temit(doc._id, doc);\\n\\t}\\n}\"\r\n       }\r\n   }\r\n}','javascript','','DRfjE',0,'6m8bcu','194.228.20.110',57,0,0),(48,'ptuq7rvav',3,'martin.varak',NULL,1456776184,0,'euromedia -> katalog','select count(*) from `katalog_tmp_euromedia` where `ean` not in (select `ean` from `katalog` where source=\'pemic\')','sql','','1HD1q',0,'lagjou','194.228.20.110',51,0,0),(50,'p6wdp4i7c',3,'martin.varak',NULL,1457296100,0,'Euromedia import SQL','INSERT INTO katalog (id_pemic, id_ktg, identif, identif_nouni, nazev, podnazev, id_ktg_p, autor, nakladatel, edice, jazyk, anotace, isbn, ean, stran, vazba, vyska, sirka, tloustka, hmotnost, planovane_vydani, vydano, dotisk, cena, cena_pohoda, sleva, id_kat_old, obrazek, info, dostupnost, zobraz, aktualizovano, `source`)\r\nSELECT id_pemic,\r\n       id_ktg,\r\n       identif,\r\n       identif_nouni,\r\n       nazev,\r\n       podnazev,\r\n       id_ktg_p,\r\n       autor,\r\n       nakladatel,\r\n       edice,\r\n       jazyk,\r\n       anotace,\r\n       isbn,\r\n       ean,\r\n       stran,\r\n       vazba,\r\n       vyska,\r\n       sirka,\r\n       tloustka,\r\n       hmotnost,\r\n       planovane_vydani,\r\n       vydano,\r\n       dotisk,\r\n       cena,\r\n       cena_pohoda,\r\n       sleva,\r\n       id_kat_old,\r\n       obrazek,\r\n       info,\r\n       dostupnost,\r\n       zobraz,\r\n       aktualizovano,\r\n       `source`\r\nFROM `katalog_tmp_euromedia`\r\nWHERE `ean` NOT IN\r\n    (SELECT `ean`\r\n     FROM `katalog`\r\n     WHERE `source`=\'pemic\')\r\n  AND `vydano` > \'2015-01-01\'','sql','','wsf4X',0,'tgy2ti','194.228.20.110',66,0,0),(51,'p1uemzkdp',3,'martin.varak',NULL,1457603999,0,NULL,'[Wed Feb 17 08:09:04 2016]\r\nUID: ANONYMOUS, M76132363 is not prime. Res64: A1D16C67D310DF70. We8: E5E6E1D8,24807718,00000000, AID: 65563027F205B09F339D3BA55806B1BE\r\n[Wed Feb 17 13:08:36 2016]\r\nUID: waritko, M76117537 is not prime. Res64: D981BE08CA8D9440. We8: F9155003,50135286,00000000, AID: 56FA7D42BF531CC3CDC172B3BEC03E9D\r\n[Wed Mar  9 12:15:01 2016]\r\nUID: waritko, M76132417 is not prime. Res64: 732FB74D1F752E3A. We8: 07E9022E,19550776,00000000, AID: 2A1CD0114E9987CFD2185A51545DE1F6\r\n[Wed Mar  9 20:07:51 2016]\r\nUID: waritko, M76117673 is not prime. Res64: 2E093A399E92C3AA. We8: 8F7EE707,62645607,00000000, AID: E474D3AF65A25F30C23F1AAB89485DFF','text','','VKmVb',0,'6rrqrp','85.93.125.67',42,0,0),(52,'pjnqnlgxk',4,'xsimov01',NULL,1457618724,0,'Minimum funkce','/* numericOptimistation.cc: Search for optimum of a numeric function.\r\n *\r\n * Author(s): Jiri Petrlik (ipetrlik@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 20; // dimension of optimised function\r\nconst int resolution=24; // number of bits per value  cca 16 000 000 bitu - dostat doroysahu 500 - 500\r\nconst double minValue=-500; // min value\r\nconst double maxValue=500; // max value\r\n\r\nint numbers [dimension];\r\n\r\n\r\n//------------------Fitness function -----------------------//\r\nfloat fitness(GAGenome& g){\r\n  //---------------Type your code here ---------------------//\r\n\r\n  GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n  //24bitu jendo cislo\r\n  //int genomeLength = genome.length();\r\n  \r\n  //int countOfNumbers = (int)genomeLength/resolution;\r\n  \r\n\r\n  int citac = 0;\r\n  //cout << endl << countOfNumbers << endl;\r\n  for(int r = 0; r<dimension; r++){\r\n	  int mocnina = 1;\r\n	  double number = 0;\r\n	  for(int i = 0; i<resolution; i++){\r\n		  number += (genome.gene[citac++] * mocnina);\r\n		  mocnina = mocnina * 2;\r\n	  }\r\n	  numbers[r] = numbers[r]/mocnina * (maxValue-minValue) + minValue;\r\n	  //cout << endl << r << endl;\r\n	  //cout << endl << number << endl;\r\n  }\r\n  \r\n  // TODO prevede binarni retezec na realna cisla a spocitafitness funkci - z rovnice ve slidu\r\n  // Prevod prvoradovou carkou\r\n  \r\n  //fitness result\r\n  double result=0;\r\n  for (int d=0; d< dimension;d++){\r\n	  result += numbers[d]*sin(sqrt(fabs(numbers[d]))));\r\n  }\r\n  \r\n  return 418.9829*dimensions - result;\r\n\r\n}\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n	GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n\r\n	//TODO\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n                      \r\n     //-- Declaration of population with genome size and Fitness function --//\r\n	GA1DBinaryStringGenome genome(dimension*resolution, fitness);\r\n  \r\n    //-- Declaration of genetic algorithm --//\r\n   GASimpleGA ga(genome);\r\n  \r\n     //-- search for global minimum --//\r\n   ga.minimize();\r\n   \r\n   //TODO toto potom odcomentovat\r\n   ga.nGenerations(10000);\r\n   ga.populationSize(1000);\r\n\r\n     //-- Parameters setting --//\r\n   ga.parameters(argc,argv);\r\n   \r\n     //-- Start of evolution process --//\r\n   ga.initialize();\r\n   while(!ga.done()){\r\n     ++ga; \r\n  \r\n     if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n       cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n            << ga.population().min() <<endl;\r\n            \r\n     if (ga.population().min() == 0) break;\r\n   }\r\n   ga.flushScores();\r\n    \r\n  \r\n     //-- Print statistics --//\r\n   cout <<endl << \"Final statistics:\" << endl;\r\n   cout << ga.statistics() << endl;\r\n   \r\n   cout << \"The best solution: \" <<  ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n   PrintPhenotype(ga.statistics().bestIndividual());\r\n   \r\n    return 0;\r\n} //- main -//','cpp','$2a$10$jBfq4yZY/oJdgzYuZJvtiOB0QLpTpJ358.j2oZb9SMYw5D1P19LUq','YwSIy',1,'up7dzl','62.209.222.194',2,0,0),(53,'pprku46ye',4,'xsimov01',NULL,1457618768,0,'Knapsack','/* Knapsack.cc: Program solves Knapsack problem - params from command line.\r\n *\r\n * Author(s): Petr Pospichal (ipospichal@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n//#include <limits.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n\r\n// data structure used for Knapsack thing \r\nstruct thing_t {\r\n    unsigned int weight; // weight of thing\r\n    unsigned int value; // value of thing\r\n    float ratio; // value/weight ratio\r\n};\r\n\r\n\r\n// macro for expanding weight and value array by value/weight constant\r\n#define KNAPSACK_THING(weight,value) {weight,value, (float)value / (float)weight}\r\n\r\n// some problem definition ...\r\n// first thing has weight 131 and value 10, second has weight 16 and value 37 ...\r\n// access in program Things[index].ratio , Things[index].value and Things[index].weight\r\nconst thing_t Things[] = {\r\n	KNAPSACK_THING(131,	10),\r\n	KNAPSACK_THING(16,	37),\r\n	KNAPSACK_THING(42,	8),\r\n	KNAPSACK_THING(47,	7),\r\n	KNAPSACK_THING(84,	5),\r\n	KNAPSACK_THING(29,	91),\r\n	KNAPSACK_THING(36,	77),\r\n	KNAPSACK_THING(69,	84),\r\n	KNAPSACK_THING(30,	16),\r\n	KNAPSACK_THING(71,	32),\r\n	KNAPSACK_THING(24,	46),\r\n	KNAPSACK_THING(27,	82),\r\n	KNAPSACK_THING(48,	14)\r\n};\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\n\r\n// knapsack has limited capacity\r\nconst unsigned int KnapsackCapacity = 130; // weight capacity of Knapsack\r\nconst unsigned int NumberOfRuns = 100; // number of repetitive runs of the GA\r\nconst int popsize  = 10;\r\nconst int ngen     = 50;\r\n\r\n// every thing above has one bit of individual\'s chromosome, 1 = put thing in knapsack, 0 = dont\r\n// chromosome thereby contains same number of bits as Things array values\r\nconst int GenomeLength = (sizeof Things)/(sizeof Things[0]);\r\n\r\nfloat Maxratio = 0.0; // best value/weight ratio\r\n\r\n// probability, that corrected chromosome will actually replace evaluated chromosome\r\nconst float CorrectGenomeReplacemenetProbability=0.05; \r\n\r\n\r\n//------------------ Penalization function for Knapsack problem --------------//\r\nfloat Penalize(unsigned int weight)\r\n{\r\n    // make penalization only if Knapsack capacity is exeeded\r\n    if (weight < KnapsackCapacity) return 0.0; \r\n\r\n    unsigned int extraweight=weight-KnapsackCapacity;\r\n    float penalization = 0.0;\r\n\r\n// ============================================================================\r\n// ============================================================================\r\n// ============================================================================\r\n//----------------------------- YOUR WORK  \r\n// ============================================================================\r\n    // try different penalization functions and observe results\r\n\r\n    //penalization = log2(1+Maxratio*extraweight); // logaritmic penalization\r\n    //penalization = Maxratio*extraweight; // linear penalization\r\n    penalization = pow(Maxratio*extraweight,2); // quadratic penalization\r\n    // ------------------------------------------------------------------------\r\n// ============================================================================\r\n//----------------------------- END OF YOUR WORK  \r\n// ============================================================================\r\n// ============================================================================\r\n// ============================================================================\r\n\r\n    return penalization;\r\n}\r\n\r\n\r\n\r\n//------------------ helper function, makes sum of weight and value based on chromosome  ------//\r\nvoid GetWeightAndValue(GA1DBinaryStringGenome& chr, unsigned int& weight, unsigned int& value){\r\n\r\n weight=0;\r\n value=0;\r\n\r\n for (int GeneIdx=0; GeneIdx < chr.length(); GeneIdx++){\r\n\r\n	if(chr.gene(GeneIdx)) {\r\n	   value  += Things[GeneIdx].value;\r\n	   weight += Things[GeneIdx].weight;\r\n	}\r\n\r\n } // for \r\n\r\n   return;\r\n}\r\n\r\n\r\n//------------------ first Fitness function for Knapsack problem  ----------------//\r\nfloat KnapsackPenalizationFitnessFunction(GAGenome& genome){\r\n//maximaliyovat sou4et hodnot toho co bere\r\n GA1DBinaryStringGenome& chr =  (GA1DBinaryStringGenome&) genome;\r\n //cout << sizeof(chr) << endl;\r\n\r\n float fitness=0.0;\r\n unsigned int weight = 0,value=0;\r\n\r\n GetWeightAndValue(chr, weight, value );\r\n//panaliyaci sni6im fitnes o vahu batohu\r\n fitness = value - Penalize(weight);\r\n if(fitness < 0.0) fitness = 0.0; // avoid negative fitness\r\n\r\n return fitness;\r\n\r\n} // KnapsackPenalizationFitnessFunction\r\n\r\n\r\n\r\n// ============================================================================\r\n// ============================================================================\r\n// ============================================================================\r\n//----------------------------- YOUR WORK  \r\n// ============================================================================\r\n\r\n// this causes main function to swap to CorrectingFitnessFunction\r\n#define CORRECTING_PROBLEM // uncomment to begin your solution\r\n\r\n// changes chromosome so knapsack is not overweighted anymore\r\nvoid CorrectChromosome( GA1DBinaryStringGenome& genome, // knapsack individual genome, will be modified\r\n			unsigned int oldvalue, // current sum of values of items in knapsack\r\n			unsigned int oldweight, // current sum of weights of items in knapsack\r\n			unsigned int& newvalue, // new value of whole knapsack, will be modified\r\n			unsigned int& newweight ) // new weight of whole knapsack, will be modified\r\n{\r\n\r\n   newvalue=oldvalue;\r\n   newweight=oldweight;\r\n\r\n   //cout << \" values before correction \" << newvalue << \" \" << newweight << \" \" << endl;\r\n\r\n\r\n   while ( newweight>KnapsackCapacity ) // until we solve overweight problem ...\r\n   {\r\n	double prosperity = 100000000000;\r\n	int lessProsperitIdx = 0; //bevare of dragons\r\n	for (int GeneIdx=0; GeneIdx < genome.length(); GeneIdx++){\r\n\r\n		if(genome.gene(GeneIdx)) {\r\n			double newProsperity = Things[GeneIdx].value / Things[GeneIdx].weight;\r\n			if(newProsperity < prosperity){\r\n				prosperity = newProsperity;\r\n				lessProsperitIdx = GeneIdx;\r\n			}\r\n	}\r\n	\r\n	//remove item withlowest prosperity\r\n	genome.gene(lessProsperitIdx, 0);\r\n	GetWeightAndValue(genome,newweight, newvalue);\r\n\r\n   } // for \r\n	// find item in knapsack with worst value/weight ratio \r\n	// remove it from knapsack and update knapsack weight and value\r\n	\r\n   }\r\n\r\n   cout << \" values after correction  \" << newvalue << \" \" << newweight << \" \" << endl;\r\n   return;\r\n\r\n}\r\n// ============================================================================\r\n//----------------------------- END OF YOUR WORK  \r\n// ============================================================================\r\n// ============================================================================\r\n// ============================================================================\r\n\r\n\r\n// ------------------ get weight and value of corrected chromosome --------------//\r\nvoid GetCorrectedWeightAndValue(GA1DBinaryStringGenome& chr, unsigned int& weight, unsigned int& value)\r\n{\r\n unsigned int oldweight = 0, oldvalue = 0;\r\n\r\n GetWeightAndValue(chr, oldweight, oldvalue );\r\n\r\n if(oldweight>KnapsackCapacity)\r\n {\r\n    GA1DBinaryStringGenome newchr = chr;\r\n    CorrectChromosome(newchr,oldvalue,oldweight,value,weight);\r\n } else {\r\n    value=oldvalue;\r\n    weight=oldweight;\r\n }\r\n}\r\n\r\n\r\n// ------------------ Fitness function for self-correcting Knapsack problem --------------//\r\nfloat KnapsackCorrectingFitnessFunction(GAGenome& genome){\r\n\r\n GA1DBinaryStringGenome& chr =  (GA1DBinaryStringGenome&) genome;\r\n\r\n float fitness=0.0;\r\n unsigned int weight = 0, value=0, newweight=0, newvalue=0;\r\n\r\n GetWeightAndValue(chr, weight, value );\r\n fitness = value;\r\n\r\n if(weight>KnapsackCapacity) // overweight, chromosome needs correction\r\n {\r\n    // allocate new class via copy\r\n    GA1DBinaryStringGenome newchr = chr;\r\n\r\n    // calculate chromosome with no overweight\r\n    CorrectChromosome(newchr,value,weight,newvalue,newweight);\r\n\r\n	// overwrite chromosome with corrected only with certian probability\r\n       if(GARandomFloat(0.0,1.0)<CorrectGenomeReplacemenetProbability)\r\n	{    \r\n	     chr.copy(newchr);\r\n	}\r\n\r\n	fitness = newvalue;\r\n }\r\n \r\n return fitness;\r\n\r\n} // KnapsackCorrectingFitnessFunction\r\n\r\n\r\n//------------------ return best value/weight ratio -----------------------//\r\nfloat GetMaxratio()\r\n{\r\n\r\n  float bestratio=0.0;\r\n\r\n    for(int i=0; i < GenomeLength; i++)\r\n	if(Things[i].ratio>bestratio) bestratio=Things[i].ratio;\r\n\r\n  return bestratio;\r\n} \r\n\r\n\r\n//------------------ print knapsack genome phenotype -----------------------//\r\nvoid PrintPhenotype(const GAGenome &genome)\r\n{\r\n    GA1DBinaryStringGenome& chr =  (GA1DBinaryStringGenome&) genome;\r\n\r\n    unsigned int weight = 0,value=0;\r\n\r\n    for (int GeneIdx=0; GeneIdx < chr.length(); GeneIdx++){\r\n\r\n	if(chr.gene(GeneIdx)) {\r\n	   value  += Things[GeneIdx].value;\r\n	   weight += Things[GeneIdx].weight;\r\n	   cout << \" weight \" << Things[GeneIdx].weight << \" value \" << Things[GeneIdx].value << \" ratio \" << Things[GeneIdx].ratio << endl;\r\n	}\r\n\r\n    } // for \r\n\r\n   cout << \"max weight \" << KnapsackCapacity << \" total weight \" << weight << \" total value \" << value << endl;\r\n   if(weight>KnapsackCapacity) {\r\n	cout << \"Solution exeeds maximum allowed weight.\" << endl;\r\n   }\r\n}\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n\r\n    Maxratio=GetMaxratio();\r\n     //-- Declaration of population with genome size and Fitness function --//\r\n\r\n   #ifdef CORRECTING_PROBLEM\r\n      // use different fitness function based on compiler preprocessor parameter\r\n      GA1DBinaryStringGenome genome(GenomeLength, KnapsackCorrectingFitnessFunction);\r\n   #else \r\n      GA1DBinaryStringGenome genome(GenomeLength, KnapsackPenalizationFitnessFunction);\r\n   #endif\r\n   \r\n     //-- Declaration of genetic algorithm --//\r\n   GASimpleGA ga(genome);\r\n    ga.populationSize(popsize);\r\n    ga.nGenerations(ngen);\r\n\r\n  \r\n     //-- Parameters setting --//\r\n   ga.parameters(argc,argv);\r\n   \r\n     //-- Start of evolution process --//\r\n\r\n   double bestfitnesssum=0.0,bestfitness=0.0;\r\n   long valuesum=0,weightsum=0;\r\n   unsigned int weight=0, value=0, overweight=0;\r\n\r\n   for(unsigned int n=0; n<NumberOfRuns; n++)\r\n   {\r\n   	ga.evolve();\r\n	bestfitness=ga.statistics().bestIndividual().score();\r\n	#ifdef CORRECTING_PROBLEM\r\n                // use different weight and value calculation based on compiler preprocessor parameter\r\n		GetCorrectedWeightAndValue((GA1DBinaryStringGenome&)ga.statistics().bestIndividual(), weight, value);\r\n	#else \r\n	 	GetWeightAndValue((GA1DBinaryStringGenome&)ga.statistics().bestIndividual(), weight, value);\r\n	#endif \r\n\r\n	if(weight>KnapsackCapacity) overweight++; // calculate number of knapsack overweight events\r\n\r\n	bestfitnesssum+=bestfitness; // summ of best fitness values\r\n	valuesum+=value; // sum of best individuals knapsack things values\r\n	weightsum+=weight; // sum of best individuals knapsack weight\r\n\r\n	cout <<  \" \" << bestfitness << \" \" << weight << \" \" << value << endl; // echo each result \r\n   }\r\n    \r\n   cout << \"Mean best fitness \" << bestfitnesssum/NumberOfRuns << \" mean knapsack things value \"  << (double)valuesum/(double)NumberOfRuns << \" mean weight \" << (double)weightsum/(double)NumberOfRuns << \" overweighted \" << (double)overweight*100/(double)NumberOfRuns <<\"%\" << endl; // finally statistics!\r\n\r\n   //PrintPhenotype(ga.statistics().bestIndividual()); // for debugging purposes\r\n\r\n    return 0;\r\n} //- main -//','cpp','$2a$10$L0xcDyd3dJD98UiWCTLNXepJ/zeonJA2i3h3iZeOBCbtNa0gRsFyu','gx9zZ',1,'s7ypj5','62.209.222.194',4,0,0),(54,'p2bfcjql3',3,'martin.varak',NULL,1457650613,0,'GIMPS work','DoubleCheck=2F851F881DD1C8C739BE81A2E7318D7B,44358577,72,1\r\nDoubleCheck=0BD1FEDE9B684502A0F16CF72FD1AA02,44358689,72,1\r\nDoubleCheck=1D99F07D80DB805AAD735591EF351523,44358733,72,1\r\nDoubleCheck=A0585D1FE001F12324009B18A2E0FFC1,44358823,72,1\r\nDoubleCheck=FA41227731A84C02B830C4CEA6D950AA,44358859,72,1\r\nDoubleCheck=6CEF424CF92497180CB7D2D5C4406B8E,44359229,72,1\r\nDoubleCheck=0CA6C80520E826E306FD0688B2B00075,44359331,72,1\r\nDoubleCheck=BCC03D0A44A7A207BDD99FE83F1174FC,44359849,72,1\r\n\r\nDoubleCheck=09AAD7B7E38F3B993208403A28E19ACF,44359933,72,1\r\nDoubleCheck=4CDB4401BDEFD7521510C94FFACD8A4C,44361353,72,1\r\nDoubleCheck=BBE5DF6E15F52060FCDDDADA7557065F,44361487,72,1\r\nDoubleCheck=F53A5246F44ABEC7FCA4C280C67C0057,44362517,72,1\r\nDoubleCheck=63D3671CB4D24C8CB06FB56D2E2A807E,44362763,72,1\r\nDoubleCheck=F0789B815238D71DD364C77C96659211,44362807,72,1\r\nDoubleCheck=C4B29C9C98DD5C45797615F76534C6B2,44362973,72,1\r\nDoubleCheck=FCCA79512232DBEC512A7D49FC7B1B14,44364919,72,1','text','','QQWJZ',0,'8l42y3','194.228.20.110',39,0,0),(55,'pvrhiwb4p',3,'martin.varak',NULL,1459780705,0,'NetSuite Test zadani','-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\nInstructions:\r\n\r\n-⁠ Thanks for your interest in NetSuite development!  Please complete the\r\n  following questions.  If you can\'t solve a problem completely, feel free to\r\n  submit your best partial solution, together with a comment as to what is\r\n  missing or what shortcomings you see with your solution.  We give partial\r\n  credit!\r\n\r\n-⁠ For programming questions use one of the languages: Java or C#.\r\n\r\n- For SQL questions, you may use any dialect of SQL. Preferred dialects are\r\n  ANSI SQL and Oracle SQL. You should indicate the dialect of SQL you are using.\r\n\r\n- We\'ll be looking at everything.  Pretend you are writing production code.\r\n  We\'ll take into account comments (if any), identifier names, and formatting.\r\n  Read assignment of tasks carefully so you do not miss any information.\r\n\r\n- Good luck!                                                                1.36\r\n\r\n\r\n-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\nQUESTION 1\r\nFor programming questions use programming language Java or C#.\r\n\r\nGiven a sorted array of integers, write a method to remove the duplicates. Use pure\r\narrays and access individual items via indexes. Don\'t use any dynamic data structures,\r\ni.e. do not use any classes from the java.util package, or the equivalent library for\r\nyour language.\r\n\r\nExample: [ 1, 2, 3, 3, 3, 4, 4, 10, 13, 15, 15, 17 ] -⁠>\r\n         [ 1, 2, 3, 4, 10, 13, 15, 17 ]\r\n\r\nSolution template:\r\n\r\n    int[] removeDuplicates(int[] values)\r\n    {\r\n        /⁠/⁠ your code here\r\n    }\r\n\r\n   Questions (answer these):\r\n   1. Did you write that as if you were writing production code?\r\n   2. What assumptions does your implementation make about the input parameter?\r\n   3. What is removeDuplicates(x).length, in your implementation?\r\n   4. Are you using all the information you have about the input array?\r\n   5. What is the algorithmic complexity (\"big O\") of your function?\r\n\r\n-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\nQUESTION 2\r\nBe sure to indicate the dialect of SQL you are using!\r\n\r\nYou are given two database tables, EMPLOYEES and BONUS, with the following\r\nschema.  Data shown below should be considered example data; the actual table\r\nwill contain other data.\r\n\r\n   EMPLOYEES                                       BONUS\r\n   __________________________________________      _____________\r\n   EMPID  NAME  SUPERVISOR  LOCATION   SALARY      EMPID  NBONUS\r\n   -⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠      -⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\n      34  Amy               NY         110000         17    5000\r\n      17  Ben           34  TN          75000         10    2000\r\n       5  Chris         34  TN          80000         34    5000\r\n      10  Don            5  HI         100000      ...\r\n   ...\r\n\r\nA) Write a SQL statement to return the employee\'s name, supervisor\'s name and\r\n   bonus of everyone who got a bonus greater than 1000.\r\n\r\nB) Write a SQL statement to list the highest paid employee in each location.\r\n   Ranking should be based on salary plus bonus.  Output should include employee\r\n   name, salary, bonus, and total pay (salary plus bonus).\r\n\r\nC) Given a NEW_SUPERVISOR table (columns: EMPID, SUPERVISOR), write an update\r\n   statement that updates the supervisor of each employee with a new supervisor.\r\n   The NEW_SUPERVISOR table is an incremental update, so employees not listed in\r\n   the table must retain their existing supervisor.\r\n\r\n\r\n-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\nQUESTION 3\r\n\r\nGiven a non-negative real number a, its square root is a number x, such that x * x = a.\r\nOne way to compute a square root is via successive approximation, where one estimate\r\nyields a better estimate.\r\n\r\nFor example, let\'s say you are trying to find the square root of 2, and you have\r\nan estimate of 1.5. We\'ll say a = 2, and x = 1.5. To compute a better estimate,\r\nwe\'ll divide a by x. This gives a new value y = 1.333333... However, we can\'t just\r\ntake this as our next estimate (why not?). We need to average it with the previous\r\nestimate. So our next estimate, xx will be (x + y) /⁠ 2, or 1.416666...\r\n\r\n   Write a function that takes a non-negative real number a, and an epsilon (a\r\n   small real number), and returns an approximation of the square root of a.\r\n\r\n    double square_root(double a, double epsilon) ...\r\n\r\n   Epsilon determines how accurate the approximation needs to be. The function\r\n   should return the first approximation x it obtains that satisfies abs(x*x - a) < epsilon,\r\n   where abs(x) is the absolute value of x.\r\n\r\n   Questions (answer these):\r\n   1. Why can\'t the next estimate, xx, be computed as a / x, where x is the\r\n      previous estimate?\r\n   2. What happens, in your implementation, if a = 0?\r\n   3. What value does your program give for square_root(2, 1e-⁠6)?\r\n\r\n\r\n-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠-⁠\r\nBONUS Question 4 (This question is optional)\r\n    Now implement your solution to QUESTION 1 as a Java iterator that does not modify the source\r\n    array, and returns only unique elements.  Write a concrete subclass of the\r\n    interface java.util.Iterator; the interface is included below for convenience\r\n    (see http://download-llnw.oracle.com/javase/6/docs/api/java/util/Iterator.html).\r\n    You do not need to implement the optional remove() method.\r\n\r\n   (For other languages, implement a generator or other equivalent construct.)\r\n\r\n   Do not \"cheat\" by calling the removeDuplicates() you defined above. One benefit\r\n   of iterators is that they can operate incrementally -- make your iterator\r\n   only do the minimum work it needs to in each call to hasNext() or next().\r\n\r\n    public interface Iterator<E>\r\n    {\r\n        /⁠** Returns true if the iteration has more elements. */⁠\r\n        boolean hasNext();\r\n\r\n        /⁠** Returns the next element in the iteration. */⁠\r\n        E next();\r\n\r\n        /** Removes from the underlying collection the last element returned by\r\n            the iterator (optional operation). */⁠\r\n        void remove();\r\n    }\r\n\r\n   Questions (answer these):\r\n   1. Does your implementation work for generic objects, numbers, or integers?\r\n   2. If it does not work with objects, what would be required to make it work\r\n      for generic objects?','text','$2a$10$AGdqG.N/LfOGiHLEmq2TiOU4e0wVjqJnfbn42hVrg7dkbNUqAMn92','QHkMh',1,'iktjvk','194.228.20.101',2,0,0),(56,'pzhfka0hw',4,'xsimov01',NULL,1459929956,0,NULL,'void\r\nGABinaryUMDAGA::create_model(GAPopulation& parent_pop){\r\n\r\n  int chr_size = 0;\r\n\r\n  if (parent_pop.size() != 0) {\r\n   GA1DBinaryStringGenome& genome = (GA1DBinaryStringGenome &) parent_pop.individual(0);\r\n   chr_size = genome.length();\r\n  }\r\n\r\n\r\nconst float N=parent_pop.size();\r\n\r\nfor(int i=0;i<chr_size;i++) // initialize model vector\r\n    FModel[i]=0.0; \r\n\r\n//----------------------Fill your code here--------------//\r\n\r\nfor(int n=0;n<parent_pop.size();n++) // for each individual\r\n{\r\n    GA1DBinaryStringGenome& genome = (GA1DBinaryStringGenome &) parent_pop.individual(n);\r\n    for(int i=0;i<chr_size;i++) \r\n    {    \r\n	// for each gene, add relative probability increment to model vector\r\n		FModel[i] += genome.gene(i);\r\n\r\n    }\r\n	 = FModel[i]/N;\r\n    \r\n}\r\n//-------------------------------------------------------//','cpp','','OT7fi',0,'0t4nvu','2001:67c:1220:8b0:4e72:b9ff:fe20:a4f1',79,0,0),(58,'psb6xyokj',4,'xsimov01',NULL,1460024845,0,NULL,'Projekt č. 2 - Implementace a prolomení RSA (8 bodů, do 1.5.2016 23:59)\r\n\r\nZadání\r\n\r\nV tomto projektu se seznámíte s asymetrickým šifrováním, konkrétně s algoritmem RSA. Váš program bude umět generovat parametry RSA (soukromý a veřejný klíč), šifrovat a dešifrovat. Dále bude umět prolomit RSA pomocí faktorizace slabého veřejného modulu. Vámi vytvořený faktorizační nástroj bude schopen faktorizovat nejen slabé RSA klíče, ale jakékoli složené číslo do 96 bitů.\r\nAlgoritmus RSA:\r\nGeneruj dvě velká prvočísla p a q\r\nn = p * q\r\nphi(n) = (p - 1) * (q - 1)\r\nZvol náhodně e mezi 1 a phi(n) tak, že gcd(e, phi(n)) = 1\r\nVypočítej d = inv(e, phi(n)) - inv je operace nalezení inverzního prvku (Multiplicative inverse). Popis tohoto algoritmu najdete v textu J. Nechvatal - Public-Key Cryptography (NIST SP 800-2), který je dostupný z hlavní stránky kurzu.\r\nVeřejný resp. soukromý klíč je potom dvojice (e,n) resp. (d,n)\r\nGenerování resp. testování prvočísel pomocí metody Solovay-Strassen, případně Miller-Rabin je podrobně popsané v textu Public-Key Cryptography.\r\nPři implementaci faktorizační části postupujte takto:\r\nVeřejný modulus nejdříve zkontrolujte pomocí metody triviálního (zkusmého) dělení pro prvních 1 000 000 čísel.\r\nMetoda triviálního dělení je nejjednodušší metodou pro faktorizaci celých čísel\r\nMetoda pracuje na základě zvolení počátečního dělitele (např. 2) a následném ověření, zda dělitel opravdu dělí zadané číslo beze zbytku. Pokud ne, dojde k inkrementaci hodnoty dělitele a opět se ověřuje dělitelnost beze zbytku. Tento proces je opakován tak dlouho, dokud není nalezen správný dělitel.\r\nZ principu metody lze vypozorovat, že se jedná o metodu s exponenciální časovou složitostí\r\nZároveň se jedná o nejpomalejší faktorizační metodu, a proto ji používáme pouze pro rychlé ověření, zda zadané složené číslo není dělitelné nějakým malým dělitelem (faktorem)\r\nTo bude také cílem i v našem případně, pouze rychle ověřit dělitelnost malých čísel touto metodou\r\nPokud se nad metodou zamyslíte, zjistíte, že lze tuto metodu optimalizovat a výrazně ji tak urychlit\r\nPokud se nepodaří nalézt dělitele metodou triviálního dělení, bude nutné nasadit sofistikovanější metodu\r\nDoporučuje se využít některou z ostatních faktorizačních metod s exponenciální časovou složitostí\r\nNa rozdíl od metody triviálního dělení tyto metody již mají základy v teorii čísel, a jsou tedy mnohonásobně rychlejší\r\nDíky tomu je lze efektivně využít i pro faktorizaci čísel o velikosti 96 bitů\r\nVybrat si můžete například jednu z těchto:\r\nFermat Factorization Method (http://mathworld.wolfram.com/FermatsFactorizationMethod.html)\r\nPollard Rho Method (http://mathworld.wolfram.com/PollardRhoFactorizationMethod.html)\r\nPollard p-1 Method (http://mathworld.wolfram.com/Pollardp-1FactorizationMethod.html)\r\nObecně ale můžete použít jakoukoli jinou faktorizační metodu než triviální dělení, klidně i nějakou vlastní či nějakou se subexponenciální časovou složitostí, implementace takové metody je ale časově výrazně náročnější.\r\nFaktorizační nástroj musí být schopen faktorizovat jakékoli složené číslo až do délky 96 bitů do 30s\r\nCílem implementace takového faktorizačního nástroje je vám ukázat:\r\nProč u asymetrické kryptografie používáme klíče mnohem větší délky než u kryptografie symetrické\r\nJak velký rozdíl v době faktorizace může být u metod, které spadají do stejné třídy časové složitosti (triviální dělení vs jiná metoda s exponenciální časovou složitostí)\r\nProč je nutné brát i ohled na celkovou rychlost faktorizace\r\nPokud chcete vytvořit použitelný faktorizační nástroj, rychlost faktorizace je hlavním kritériem\r\nNikdo váš faktorizační nástroj nebude používat, pokud nějaké větší číslo faktorizuje za 2 dny, když existuje jiný faktorizační nástroj, který stejné číslo faktorizuje za 2 hodiny.\r\nShrnutí zadání\r\n\r\nVytvořte program, který bude umět:\r\nGenerovat parametry RSA (soukromý a veřejný klíč)\r\nŠifrovat\r\nDešifrovat\r\nFaktorizovat\r\nnejdříve se provede triviální dělení pro prvních 1 000 000 čísel\r\nv případě neúspěchu se vykoná efektivnější faktorizační metoda\r\ncelková doba faktorizace pro všechna čísla do 96 bitů bude nejvýše 30s\r\nDále se vyžaduje vytvoření dokumentace:\r\npečlivě zdokumentujte vaší implementaci\r\nv případě faktorizace dále popište vámi zvolenou metodu a vysvětlete, proč jste tuto metodu zvolili\r\nPožadavky\r\n\r\nProgram implementujte v jazyce C/C++. Pro implementaci a faktorizaci RSA můžete použít knihovnu pro práci s velkými čísly (např. GMP), používejte ji však pouze pro základní operace s velkými čísly jako je například násobení nebo modulo, nepoužívejte složitější operace, např. generování prvočísel (zejména nepoužívejte funkce typu mpz_nextprime, mpz_gcd nebo mpz_invert při použití GMP).\r\nTestování a hodnocení\r\n\r\nGenerování klíčů (3b)\r\nvstup: ./kry -g B\r\nvýstup: P Q N E D\r\nŠifrování (0.5b)\r\nvstup: ./kry -e E N M\r\nvýstup: C\r\nDešifrování (0.5b)\r\nvstup: ./kry -d D N C\r\nvýstup: M\r\nProlomení RSA (4b)\r\nvstup: ./kry -b N\r\nvýstup: P\r\nB ... požadovaná velikost veřejného modulu v bitech (např. 1024)\r\nP ... prvočíslo (při generování náhodné)\r\nQ ... jiné prvočíslo (při generování náhodné)\r\nN ... veřejný modulus\r\nE ... veřejný exponent (většinou 3)\r\nD ... soukromý exponent\r\nM ... otevřená zpráva (číslo, nikoli text)\r\nC ... zašifrovaná zpráva (číslo, nikoli text)\r\nvšechna čísla na vstupu i výstupu (kromě B) jsou hexadecimální, začínají \"0x\" výstup končí novým řádkem v případě, že danou funkci neimplementujete, program skončí bez výstupu\r\nPříklad:\r\nvstup: ./kry -b 0x397a52dccd55d39823964ae25\r\nvýstup: 0x16098b2cd','text','','WIfSU',0,'ioxjns','62.209.222.194',53,0,0),(59,'ps4wpnhnr',3,'martin.varak',NULL,1461929061,0,'ECM worktodo','[Worker #1]\r\nECM2=D6EDBF259BEE88D0C45D1C60DBD13FC8,1,2,12887131,-1,50000,5000000,50\r\nECM2=BD77BF3FA4268A3DAB6D887EC31FA70C,1,2,12887167,-1,50000,5000000,50\r\nECM2=9DEB70F67081DCBC1F1EC4E298DE0682,1,2,12887197,-1,50000,5000000,50\r\nECM2=881FF9651CA779DF7CB5721D427E4AD7,1,2,12887213,-1,50000,5000000,50\r\nECM2=2C02A524E34D3AAF3ED4D3F65C758075,1,2,12887219,-1,50000,5000000,50\r\nECM2=7BEE45F9D5918AE337C3D7E6CDB4A608,1,2,12887299,-1,50000,5000000,50\r\nECM2=66C5A83C8D854D3821E2FD071D146263,1,2,12887417,-1,50000,5000000,50\r\nECM2=AE143510CB9B6752B645EA46EDA4DE73,1,2,12887443,-1,50000,5000000,50\r\nECM2=E4B9977A141EF8D6FB3C0E321ED83D47,1,2,12887449,-1,50000,5000000,50\r\nECM2=894ACE5E36EB2F63FD8C8BA7BEB2EF38,1,2,12887473,-1,50000,5000000,50\r\nECM2=127A9D938D83060AF1C29E1194F48AF0,1,2,12887509,-1,50000,5000000,50\r\nECM2=3925CEE7CD6505BF87D14829B5DF8C5F,1,2,12887549,-1,50000,5000000,50\r\nECM2=700C2F259437B7B73AD04E80A35BE46F,1,2,12887591,-1,50000,5000000,50\r\nECM2=6D6BD9885726CE5C15DAC6A68DE72D67,1,2,12887657,-1,50000,5000000,50\r\nECM2=0CA348BE289FF74F032ADC3FEAC4DE13,1,2,12887731,-1,50000,5000000,50\r\nECM2=5F1B24D1BD8E1399FD9BD5D2B1A4922B,1,2,12887753,-1,50000,5000000,50\r\n\r\n[Worker #2]\r\nECM2=956BC4C43E58E346997DC6903DF8D618,1,2,12887767,-1,50000,5000000,50\r\nECM2=7890FAE57442208A626EC033F740E0A3,1,2,12887807,-1,50000,5000000,50\r\nECM2=E4C78BF744FCEEFE285CE8D7879ADE96,1,2,12887813,-1,50000,5000000,50\r\nECM2=E8C5BB39AB9B441F2F774B366473F8DF,1,2,12887827,-1,50000,5000000,50\r\nECM2=FF729059094AAD76A7C1E0682C55296D,1,2,12887863,-1,50000,5000000,50\r\nECM2=C1DA989CCC32AE709C825C86C37C9666,1,2,12887993,-1,50000,5000000,50\r\nECM2=C759996588B019C055D9998F7596D057,1,2,12888037,-1,50000,5000000,50\r\nECM2=6F0BDDAD9EDC08DD84C325CB6E820D3B,1,2,12888079,-1,50000,5000000,50\r\nECM2=903B40BFC47DFE43AEFF0E4C06B78DB1,1,2,12888121,-1,50000,5000000,50\r\nECM2=996A8FDC5D52589B8D5C7F41A6C0117F,1,2,12888203,-1,50000,5000000,50\r\nECM2=76DB7548F1A0945E2962892FEBEEB8E2,1,2,12888299,-1,50000,5000000,50\r\nECM2=14B89503D9AD586B15180F76A83AABEF,1,2,12888361,-1,50000,5000000,50\r\nECM2=BB1712C47DD3CA0357F27DDE37CDD80E,1,2,12888443,-1,50000,5000000,50\r\nECM2=60DD6F192937683AE071863BF0CDBD6E,1,2,12888457,-1,50000,5000000,50\r\nECM2=9C7FA9B60BCF947905A3ECFB50036451,1,2,12888611,-1,50000,5000000,50\r\nECM2=361E2A300BC53B3B0D6DA83B1B12544F,1,2,12888641,-1,50000,5000000,50','text','','swdJ8',0,'5dlmmf','194.228.20.137',59,0,0),(60,'pmpcmoofd',4,'xsimov01',NULL,1461947137,0,NULL,'ItemStruct = namedtuple(\"ItemStruct\", \"x y\")\r\ncircle = 0\r\nwhile circle < CONST_COUNT:      \r\n  	newPItemTwo = ItemStruct\r\n        newPItemTwo.x = 4\r\n        newPItemTwo.y = 5\r\n\r\n        TwoItems.append(newPItemTwo)\r\n	circle++','python','','07XlG',0,'cxoiuf','78.102.41.132',73,0,0),(61,'po10kxzgm',4,'xsimov01',NULL,1461960311,0,'evo','#from Tkinter import *\r\nfrom graphics import *\r\nfrom collections import namedtuple\r\nimport random\r\nimport math\r\n\r\nCONST_COUNT = 50 #count of object on screen\r\nCONST_SHAPE = \"circle\" #preferet shape circle, triangle, square, rectangle\r\nCONST_ROUNDS = 5 #number of user evaluation\r\nCONST_SAMPLES = 9 #count of samples to evaluate in one round\r\nCONST_CANVAS = 500 #canvas size\r\nCONST_MUTATE = 10 # 1/COUNT_MUTATA percent to mutate\r\n\r\n#TODO spocitat bity aby se menily kdyz se zmeni velikost canvas a nesmi byt mene nez 255\r\nCONST_BITS = 10 # MUST BE 8 or larger\r\n\r\nSampleStruct = namedtuple(\"Sample\", \"Items fitness\")\r\nItemStruct = namedtuple(\"ItemStruct\", \"x y z r g b\")\r\n\r\npopulation = []\r\n\r\ndef create_circle(self, x, y, r, **kwargs):\r\n    return self.create_oval(x-r, y-r, x+r, y+r, **kwargs)\r\n\r\ndef printSampleToEvaluate(Sample):\r\n    win = GraphWin(\"User input\", CONST_CANVAS, CONST_CANVAS)\r\n    #root = Tk(\"Userinput\")\r\n    #cv = Canvas(root, width=CONST_CANVAS, height=CONST_CANVAS, bg=\'black\')\r\n    win.setBackground(\"black\")\r\n    Items = Sample.Items\r\n    i = 0\r\n    while i < CONST_COUNT:\r\n        color = color_rgb(Items[i].r, Items[i].g, Items[i].b) #\'#%02x%02x%02x\' % (Items[i].r, Items[i].g, Items[i].b) #\r\n        c = Circle(Point(Items[i].x, Items[i].y), Items[i].z)\r\n        #root.Canvas.create_circle = create_circle(Items[i].x, Items[i].y, Items[i].z, fill=color, outline=\"black\", width=2)\r\n        c.setFill(color)\r\n        c.draw(win)\r\n        #root.mainloop()\r\n\r\n        i = i + 1\r\n    #the_input = raw_input(\"Enter input: \")\r\n    editedSample = SampleStruct(Sample.Items, int(input(\"1 - worst, 5 - best: \")))\r\n    win.close()\r\n    return editedSample\r\n\r\ndef generateSample():\r\n    Items = []\r\n    i = 0\r\n    while i < CONST_COUNT:\r\n\r\n        x = random.randint(0, CONST_CANVAS)             # Create a random x value\r\n        y = random.randint(0, CONST_CANVAS)             # Create a random y value\r\n        z = random.randint(0, math.floor(CONST_CANVAS/2))  # radius\r\n        r = random.randint(0, 255)\r\n        g = random.randint(0, 255)\r\n        b = random.randint(0, 255)\r\n\r\n        Items.append(ItemStruct(x, y, z, r, g, b))\r\n\r\n        i = i + 1\r\n    CreatedSample = SampleStruct(Items, 0)\r\n    return CreatedSample\r\n\r\ndef weighted_choice(choices):\r\n   total = sum(w for c, w in choices)\r\n   r = random.uniform(0, total)\r\n   upto = 0\r\n   for c, w in choices:\r\n      if upto + w >= r:\r\n         return SampleStruct(c,w)\r\n      upto += w\r\n\r\ndef mutate(wade): #Wade Wilson\r\n    roll = random.randint(0, CONST_MUTATE)\r\n    if(roll == CONST_MUTATE):\r\n        where = random.randint(0, len(wade)-1)\r\n        deadpool = list(wade)\r\n        if(wade[where] == \'0\'):\r\n\r\n            deadpool[where] = \'1\'\r\n        else:\r\n            deadpool[where] = \'0\'\r\n\r\n        return \'\'.join(deadpool)\r\n\r\n    return wade\r\n\r\ndef crossing(pOne, pTwo): #one sample on input, is called CONST_SAMPLES times\r\n    #TODO crossin!!!\r\n    children = []\r\n    OneItems = []\r\n    TwoItems = []\r\n\r\n    #while sch < CONST_SAMPLES: # Pro kazdy z 9 obrazku\r\n    pItemsOne = pOne.Items\r\n    pItemsTwo = pTwo.Items\r\n\r\n    binaryOne = \"\"\r\n    binaryTwo = \"\"\r\n\r\n    circle = 0\r\n    while circle < CONST_COUNT: #Pro kazdou kruznici\r\n        binaryOne += (\"{0:b}\".format(pItemsOne[circle].x).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsOne[circle].y).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsOne[circle].z).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsOne[circle].r).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsOne[circle].g).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsOne[circle].b).zfill(CONST_BITS))\r\n        binaryTwo += (\"{0:b}\".format(pItemsTwo[circle].x).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsTwo[circle].y).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsTwo[circle].z).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsTwo[circle].r).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsTwo[circle].g).zfill(CONST_BITS)) + \\\r\n                     (\"{0:b}\".format(pItemsTwo[circle].b).zfill(CONST_BITS))\r\n        circle += 1\r\n\r\n    binaryOne = mutate(binaryOne)\r\n    binaryTwo = mutate(binaryTwo)\r\n\r\n    crossingPoint = random.randint(1,CONST_BITS*6*CONST_COUNT-2)\r\n    newBinaryOne = binaryOne[0:crossingPoint] + binaryTwo[crossingPoint:CONST_BITS*6*CONST_COUNT]\r\n    newBinaryTwo = binaryTwo[0:crossingPoint] + binaryOne[crossingPoint:CONST_BITS*6*CONST_COUNT]\r\n\r\n    circle2 = 0\r\n    offset = 0\r\n    while circle2 < CONST_COUNT:\r\n\r\n        OneItems.append(ItemStruct(int(newBinaryOne[offset:offset + CONST_BITS], 2),\r\n                                 int(newBinaryOne[offset + CONST_BITS:offset + 2 * CONST_BITS], 2),\r\n                                 int(newBinaryOne[offset + 2 * CONST_BITS:offset + 3 * CONST_BITS], 2),\r\n                                 int(newBinaryOne[offset + 3 * CONST_BITS + CONST_BITS-8 : offset + 4 * CONST_BITS], 2),  #r\r\n                                 int(newBinaryOne[offset + 4 * CONST_BITS + CONST_BITS-8 : offset + 5 * CONST_BITS], 2),  #g\r\n                                 int(newBinaryOne[offset + 5 * CONST_BITS + CONST_BITS-8 : offset + 6 * CONST_BITS], 2))) #b\r\n\r\n        TwoItems.append(ItemStruct(int(newBinaryTwo[offset:offset + CONST_BITS], 2),\r\n                                   int(newBinaryTwo[offset + CONST_BITS:offset + 2 * CONST_BITS], 2),\r\n                                   int(newBinaryTwo[offset + 2 * CONST_BITS :offset + 3 * CONST_BITS], 2),\r\n                                   int(newBinaryTwo[offset + 3 * CONST_BITS + CONST_BITS-8 :offset + 4 * CONST_BITS], 2),\r\n                                   int(newBinaryTwo[offset + 4 * CONST_BITS + CONST_BITS-8 :offset + 5 * CONST_BITS], 2),\r\n                                   int(newBinaryTwo[offset + 5 * CONST_BITS + CONST_BITS-8:offset + 6 * CONST_BITS], 2)))\r\n        offset += CONST_BITS*6\r\n        circle2 +=1\r\n\r\n        #sch = sch+1\r\n    newPOne = SampleStruct(OneItems, 0)\r\n    newPTwo = SampleStruct(TwoItems, 0)\r\n\r\n    children.append(newPOne)\r\n    children.append(newPTwo)\r\n    return children\r\n\r\n\r\ndef selection(parentPopulation):\r\n    childPopulation = []\r\n\r\n    ss = 0\r\n    while ss < CONST_SAMPLES:\r\n        parentOne = weighted_choice(parentPopulation)\r\n        parentTwo = weighted_choice(parentPopulation)\r\n        crossedChildrens = crossing(parentOne, parentTwo)\r\n        childPopulation.append(crossedChildrens[0])\r\n        if(ss != CONST_SAMPLES-1):\r\n            childPopulation.append(crossedChildrens[1])\r\n        ss = ss+2\r\n\r\n    return childPopulation\r\n\r\nr = 0\r\nwhile r < CONST_ROUNDS:\r\n\r\n    if(r == 0):\r\n        sf = 0\r\n        while sf < CONST_SAMPLES:\r\n            newSample = generateSample()\r\n            newSample = printSampleToEvaluate(newSample)\r\n            population.append(newSample)\r\n            sf = sf+1\r\n    else:\r\n        print(\"\\n Next genration!\")\r\n        s = 0\r\n        while s < CONST_SAMPLES:\r\n            newSample = printSampleToEvaluate(population[s])\r\n            population[s] = newSample\r\n            s = s+1\r\n\r\n    population = selection(population)\r\n\r\n    r = r+1','python','$2a$10$C/AsT.WXZWqb6WVafrclGuQlDbVsgmJlpsKA5uuftaRH8lxuGWmWS','9hKyk',1,'4vzxdg','78.102.41.132',2,0,0),(62,'pipksiphg',3,'martin.varak',NULL,1463404089,0,NULL,'https://vserver.varak.net/nf.php?filter=host%2064.30.224.206','text','','bF6ig',0,'wpb4qk','85.93.125.67',75,0,0),(63,'ptnwad5oh',3,'martin.varak',NULL,1463481913,0,'Drill list','select id, date, isMatch, (select sum(baseTime) + sum(charlie) + sum(delta) * 2 + sum(miss) * 5 + sum(proc) * 3 from situations where event=events.id) `time` from events where `drillSet`=1','sql','','8K2rP',0,'gl3nb5','85.93.125.67',78,0,0),(64,'pm3zhlyjd',3,'martin.varak',NULL,1465308433,0,'liquidprompt config','\r\n####################################\r\n# LIQUID PROMPT CONFIGURATION FILE #\r\n####################################\r\n\r\n# If you want to use different themes and features,\r\n# you can load the corresponding files here:\r\n#source ~/.config/liquidprompt/nojhan.theme\r\n#LP_PS1_FILE=~/.config/liquidprompt/nojhan.ps1\r\n\r\n#############\r\n# BEHAVIOUR #\r\n#############\r\n\r\n# Maximal value under which the battery level is displayed\r\n# Recommended value is 75\r\nLP_BATTERY_THRESHOLD=75\r\n\r\n# Minimal value after which the load average is displayed\r\n# Recommended value is 60\r\nLP_LOAD_THRESHOLD=60\r\n\r\n# Minimal value after which the temperature is displayed (in degrees Celsius)\r\n# Recommended value is 60\r\nLP_TEMP_THRESHOLD=60\r\n\r\n# The maximum percentage of the screen width used to display the path\r\n# Recommended value is 35\r\nLP_PATH_LENGTH=35\r\n\r\n# How many directories to keep at the beginning of a shortened path\r\n# Recommended value is 2\r\nLP_PATH_KEEP=2\r\n\r\n# Do you want to display the hostname, even if not connected through network?\r\n# Defaults to 0 (do not display hostname when locally connected)\r\n# set to 1 if you want to always see the hostname\r\n# set to -1 if you want to never see the hostname\r\nLP_HOSTNAME_ALWAYS=0\r\n\r\n# Use the FQDN instead of the short hostname if the hostname is displayed\r\nLP_ENABLE_FQDN=0\r\n\r\n# Do you want to display the user, even if the user is the same as the one logged in?\r\n# Defaults to 1 (always display the user)\r\n# set to 0 if you want to hide the logged user (it will always display different users)\r\nLP_USER_ALWAYS=1\r\n\r\n# Do you want to display the percentages of load/batteries along with their\r\n# corresponding marks? Set to 0 to only print the colored marks.\r\n# Defaults to 1 (display percentages)\r\nLP_PERCENTS_ALWAYS=1\r\n\r\n# Do you want to use the permissions feature?\r\n# Recommended value is 1\r\nLP_ENABLE_PERM=1\r\n\r\n# Do you want to use the shorten path feature?\r\n# Recommended value is 1\r\nLP_ENABLE_SHORTEN_PATH=1\r\n\r\n# Do you want to use the proxy detection feature?\r\n# Recommended value is 1\r\nLP_ENABLE_PROXY=1\r\n\r\n# Do you want to use the jobs feature?\r\n# Recommended value is 1\r\nLP_ENABLE_JOBS=1\r\n\r\n# Do you want to use the load feature?\r\n# Recommended value is 1\r\nLP_ENABLE_LOAD=1\r\n\r\n# Do you want to use the battery feature?\r\n# Recommended value is 1\r\nLP_ENABLE_BATT=1\r\n\r\n# Do you want to use the \'sudo credentials\' feature?\r\n# Be warned that this may pollute the syslog if you don\'t have sudo\r\n# credentials, and the sysadmin will hate you.\r\nLP_ENABLE_SUDO=0\r\n\r\n# Do you want to use VCS features with the root account?\r\n# Recommended value is 0\r\nLP_ENABLE_VCS_ROOT=0\r\n\r\n# Do you want to use the Git special features?\r\n# Recommended value is 1\r\nLP_ENABLE_GIT=1\r\n\r\n# Do you want to use the Subversion special features?\r\n# Recommended value is 1\r\nLP_ENABLE_SVN=1\r\n\r\n# Do you want to use the Mercurial special features?\r\n# Recommended value is 1\r\nLP_ENABLE_HG=1\r\n\r\n# Do you want to use the Fossil special features?\r\n# Recommended value is 1\r\nLP_ENABLE_FOSSIL=1\r\n\r\n# Do you want to use the Bazaar special features?\r\n# Recommanded value is 1\r\nLP_ENABLE_BZR=1\r\n\r\n# Show time of the last prompt display\r\n# Recommended value is 0\r\nLP_ENABLE_TIME=1\r\n\r\n# Show runtime of the last command if over LP_RUNTIME_THRESHOLD\r\n# Recommended value is 0\r\nLP_ENABLE_RUNTIME=1\r\n\r\n# Minimal runtime to be displayed\r\n# Recommended value is 2\r\nLP_RUNTIME_THRESHOLD=2\r\n\r\n# Display the virtualenv that is currently activated, if any\r\n# Recommended value is 1\r\nLP_ENABLE_VIRTUALENV=1\r\n\r\n# Display the enabled software collections, if any\r\n# Recommended value is 1\r\nLP_ENABLE_SCLS=1\r\n\r\n# Show average system temperature\r\nLP_ENABLE_TEMP=1\r\n\r\n# When showing time, use an analog clock instead of numeric values.\r\n# The analog clock is \"accurate\" to the nearest half hour.\r\n# You must have a unicode-capable terminal and a font with the \"CLOCK\"\r\n# characters.\r\n# Recommended value is 0\r\nLP_TIME_ANALOG=0\r\n\r\n# Use the prompt as the title of the terminal window\r\n# The content is not customizable, the implementation is very basic,\r\n# and this may not work properly on exotic terminals, thus the\r\n# recommended value is 0\r\n# See LP_TITLE_OPEN and LP_TITLE_CLOSE to change escape characters to adapt this\r\n# feature to your specific terminal.\r\nLP_ENABLE_TITLE=0\r\n\r\n# Enable Title for screen and byobu\r\nLP_ENABLE_SCREEN_TITLE=0\r\n\r\n# Use differents colors for differents hosts you SSH in\r\nLP_ENABLE_SSH_COLORS=0\r\n\r\n# Specify a list of complete and colon (\":\") separated paths in which, all vcs\r\n# will be disabled\r\nLP_DISABLED_VCS_PATH=\"\"\r\n\r\n# vim: set et sts=4 sw=4 tw=120 ft=sh:','bash','','6MK3i',0,'hd5ieb','85.93.125.67',137,0,0),(65,'pvqrruyud',3,'martin.varak',NULL,1465820949,0,'liquidprompt config','####################################\r\n# LIQUID PROMPT CONFIGURATION FILE #\r\n####################################\r\n\r\n# If you want to use different themes and features,\r\n# you can load the corresponding files here:\r\n#source ~/.config/liquidprompt/nojhan.theme\r\n#LP_PS1_FILE=~/.config/liquidprompt/nojhan.ps1\r\n\r\n#############\r\n# BEHAVIOUR #\r\n#############\r\n\r\n# Maximal value under which the battery level is displayed\r\n# Recommended value is 75\r\nLP_BATTERY_THRESHOLD=75\r\n\r\n# Minimal value after which the load average is displayed\r\n# Recommended value is 60\r\nLP_LOAD_THRESHOLD=60\r\n\r\n# Minimal value after which the temperature is displayed (in degrees Celsius)\r\n# Recommended value is 60\r\nLP_TEMP_THRESHOLD=60\r\n\r\n# The maximum percentage of the screen width used to display the path\r\n# Recommended value is 35\r\nLP_PATH_LENGTH=35\r\n\r\n# How many directories to keep at the beginning of a shortened path\r\n# Recommended value is 2\r\nLP_PATH_KEEP=2\r\n\r\n# Do you want to display the hostname, even if not connected through network?\r\n# Defaults to 0 (do not display hostname when locally connected)\r\n# set to 1 if you want to always see the hostname\r\n# set to -1 if you want to never see the hostname\r\nLP_HOSTNAME_ALWAYS=0\r\n\r\n# Use the FQDN instead of the short hostname if the hostname is displayed\r\nLP_ENABLE_FQDN=0\r\n\r\n# Do you want to display the user, even if the user is the same as the one logged in?\r\n# Defaults to 1 (always display the user)\r\n# set to 0 if you want to hide the logged user (it will always display different users)\r\nLP_USER_ALWAYS=1\r\n\r\n# Do you want to display the percentages of load/batteries along with their\r\n# corresponding marks? Set to 0 to only print the colored marks.\r\n# Defaults to 1 (display percentages)\r\nLP_PERCENTS_ALWAYS=1\r\n\r\n# Do you want to use the permissions feature?\r\n# Recommended value is 1\r\nLP_ENABLE_PERM=1\r\n\r\n# Do you want to use the shorten path feature?\r\n# Recommended value is 1\r\nLP_ENABLE_SHORTEN_PATH=1\r\n\r\n# Do you want to use the proxy detection feature?\r\n# Recommended value is 1\r\nLP_ENABLE_PROXY=1\r\n\r\n# Do you want to use the jobs feature?\r\n# Recommended value is 1\r\nLP_ENABLE_JOBS=1\r\n\r\n# Do you want to use the load feature?\r\n# Recommended value is 1\r\nLP_ENABLE_LOAD=1\r\n\r\n# Do you want to use the battery feature?\r\n# Recommended value is 1\r\nLP_ENABLE_BATT=1\r\n\r\n# Do you want to use the \'sudo credentials\' feature?\r\n# Be warned that this may pollute the syslog if you don\'t have sudo\r\n# credentials, and the sysadmin will hate you.\r\nLP_ENABLE_SUDO=0\r\n\r\n# Do you want to use VCS features with the root account?\r\n# Recommended value is 0\r\nLP_ENABLE_VCS_ROOT=0\r\n\r\n# Do you want to use the Git special features?\r\n# Recommended value is 1\r\nLP_ENABLE_GIT=1\r\n\r\n# Do you want to use the Subversion special features?\r\n# Recommended value is 1\r\nLP_ENABLE_SVN=1\r\n\r\n# Do you want to use the Mercurial special features?\r\n# Recommended value is 1\r\nLP_ENABLE_HG=1\r\n\r\n# Do you want to use the Fossil special features?\r\n# Recommended value is 1\r\nLP_ENABLE_FOSSIL=1\r\n\r\n# Do you want to use the Bazaar special features?\r\n# Recommanded value is 1\r\nLP_ENABLE_BZR=1\r\n\r\n# Show time of the last prompt display\r\n# Recommended value is 0\r\nLP_ENABLE_TIME=1\r\n\r\n# Show runtime of the last command if over LP_RUNTIME_THRESHOLD\r\n# Recommended value is 0\r\nLP_ENABLE_RUNTIME=1\r\n\r\n# Minimal runtime to be displayed\r\n# Recommended value is 2\r\nLP_RUNTIME_THRESHOLD=2\r\n\r\n# Display the virtualenv that is currently activated, if any\r\n# Recommended value is 1\r\nLP_ENABLE_VIRTUALENV=1\r\n\r\n# Display the enabled software collections, if any\r\n# Recommended value is 1\r\nLP_ENABLE_SCLS=1\r\n\r\n# Show average system temperature\r\nLP_ENABLE_TEMP=1\r\n\r\n# When showing time, use an analog clock instead of numeric values.\r\n# The analog clock is \"accurate\" to the nearest half hour.\r\n# You must have a unicode-capable terminal and a font with the \"CLOCK\"\r\n# characters.\r\n# Recommended value is 0\r\nLP_TIME_ANALOG=0\r\n\r\n# Use the prompt as the title of the terminal window\r\n# The content is not customizable, the implementation is very basic,\r\n# and this may not work properly on exotic terminals, thus the\r\n# recommended value is 0\r\n# See LP_TITLE_OPEN and LP_TITLE_CLOSE to change escape characters to adapt this\r\n# feature to your specific terminal.\r\nLP_ENABLE_TITLE=0\r\n\r\n# Enable Title for screen and byobu\r\nLP_ENABLE_SCREEN_TITLE=0\r\n\r\n# Use differents colors for differents hosts you SSH in\r\nLP_ENABLE_SSH_COLORS=0\r\n\r\n# Specify a list of complete and colon (\":\") separated paths in which, all vcs\r\n# will be disabled\r\nLP_DISABLED_VCS_PATH=\"\"\r\nLP_COLOR_TIME=$BOLD_CYAN\r\n\r\n# vim: set et sts=4 sw=4 tw=120 ft=sh:','bash','','jw4bp',0,'ds8ey7','85.93.125.67',117,0,0),(66,'peczquyfq',3,'martin.varak',NULL,1466011642,0,NULL,'[Worker #1]\r\nTest=5E1EB019695BDBC33B5DC83CBB434300,73881653,75,1\r\nTest=6C60DF0CF4242DEA7B00D28E74FD58D3,73881679,75,1\r\nTest=6664BE82CC8EBB580C4053055591D50F,73881721,75,1\r\nTest=0A2CA0F3F6EF5381184CDD412A8C8B5C,73881749,75,1\r\nTest=C4626DC773D954DCDB0F9164182473A1,73881761,75,1\r\nTest=E5AE35F9B0DC44F88FD3C52C829314DE,73881781,75,1\r\nTest=6C326CFCC539D28B7D9AC058D350BCDA,73881793,75,1\r\nTest=0A74223017137974C37B2758ED90E4E6,73881817,75,1\r\nTest=1ED86C7CA71623E00C29944F5A008630,73881931,75,1\r\nTest=E63CE197B587D93876D481D4418B69D4,73881989,75,1\r\nTest=89FC085697408767130152391F65DD3D,73882019,75,1\r\nTest=3FB9ECD7677019956AC3038543D83C66,73882033,75,1\r\nTest=03D6D0819C6CF3761CEB8D1A141B4D83,73882057,75,1\r\nTest=F80B8B06851F3E34A42470407BE3A11D,73882321,75,1\r\nTest=DD8D5AB99C427B185C2995940947617E,73882327,75,1\r\nTest=99D48F066A69ACC031E821EB4723B4F8,73882363,75,1\r\n\r\n[Worker #2]\r\nTest=3FBC348C798C138443F021A28EFCE274,73882399,75,1\r\nTest=4EC137BCDF36D1008656B4A9D698E67A,73882433,75,1\r\nTest=A637B212777DF238752E8AE5E16F2D5F,73882453,75,1\r\nTest=85790EF086FD5296CAC6CECD23CC222F,73882513,75,1\r\nTest=15152C4F58B03D2DC7010FB564A3B8E1,73882519,75,1\r\nTest=76DC51D8389DB006CA390557936376C6,73882541,75,1\r\nTest=C7626BED5B8C530DE569163CD08128AC,73882619,75,1\r\nTest=8A19333F535DD0CBE6860DB03C3FE5A2,73882661,75,1\r\nTest=CD62D8C06175D9B70F56E763F985A696,73882723,75,1\r\nTest=46F2C1586A1C5557FD7725177A0661CD,73882741,75,1\r\nTest=41F63EA4949DE2F53B47108B1C524E78,73882769,75,1\r\nTest=466CC08FC02D7E8A94F879AF4799D036,73882777,75,1\r\nTest=7F5888F9B4CE2405D9275235184DDCB7,73882793,75,1\r\nTest=73104183A7875384233C347DB0F78C61,73882819,75,1\r\nTest=5875ED9052AD3BA4FCF8DE4D8C7F1FFF,73882961,75,1\r\nTest=9FCBF9097728A45E58B99CFAD1155FB8,73882993,75,1','java','$2a$10$aDOrGiDoDl6.7mc2o/tb8.N1edBNNvHwSePq1VqcH1wZGKWkgkS.q','bUbeC',1,'7tc4rs','2a00:1028:83a6:66a:d82:9eb3:8dd5:de4',3,0,0),(67,'pyk3mii7p',3,'martin.varak',NULL,1466064323,0,'SMTP sent log','Jun 16 10:04:29 mrazitko postfix/pickup[19187]: D92F82855841: uid=996 from=<martin@varak.net>\r\nJun 16 10:04:29 mrazitko postfix/cleanup[26692]: D92F82855841: message-id=<57799cfbb632b3bcab9e9d061699c1bb@varak.net>\r\nJun 16 10:04:29 mrazitko dovecot: imap-login: Login: user=<martin@varak.net>, method=PLAIN, rip=::1, lip=::1, mpid=26697, secured, session=<w+cGsGA1lQAAAAAAAAAAAAAAAAAAAAAB>\r\nJun 16 10:04:30 mrazitko postfix/qmgr[32164]: D92F82855841: from=<martin@varak.net>, size=546, nrcpt=1 (queue active)\r\nJun 16 10:04:30 mrazitko postfix/smtp[26699]: Host offered STARTTLS: [gmail-smtp-in.l.google.com]\r\nJun 16 10:04:30 mrazitko dovecot: imap(martin@varak.net): Disconnected: Logged out in=453 out=576\r\nJun 16 10:04:30 mrazitko postfix/smtp[26699]: D92F82855841: to=<martin.varak@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.136.26]:25, delay=0.65, delays=0.14/0.01/0.08/0.42, dsn=2.0.0, status=sent (250 2.0.0 OK 1466064275 o82si12623111wmd.89 - gsmtp)\r\nJun 16 10:04:30 mrazitko postfix/qmgr[32164]: D92F82855841: removed\r\nJun 16 10:04:30 mrazitko dovecot: imap-login: Login: user=<martin@varak.net>, method=PLAIN, rip=::1, lip=::1, mpid=26707, secured, session=<WuoUsGA1mwAAAAAAAAAAAAAAAAAAAAAB>\r\nJun 16 10:04:30 mrazitko dovecot: imap(martin@varak.net): Disconnected: Logged out in=12 out=403\r\nJun 16 10:04:31 mrazitko dovecot: imap-login: Login: user=<martin@varak.net>, method=PLAIN, rip=::1, lip=::1, mpid=26709, secured, session=<2jcZsGA1owAAAAAAAAAAAAAAAAAAAAAB>\r\nJun 16 10:04:31 mrazitko dovecot: imap(martin@varak.net): Disconnected: Logged out in=641 out=42172\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: initializing the server-side TLS engine\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: warning: cannot load 1024-bit DH parameters from file /etc/dhparams.pem: No such file or directory -- using compiled-in defaults\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: connect from mail-wm0-f53.google.com[74.125.82.53]\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: setting up TLS connection from mail-wm0-f53.google.com[74.125.82.53]\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: mail-wm0-f53.google.com[74.125.82.53]: TLS cipher list \"aNULL:-aNULL:ALL:+RC4:@STRENGTH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CDC3-SHA:!KRB5-DE5:!CBC3-SHA\"\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:before/accept initialization\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671150] (11 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671150] (11 bytes => 11 (0xB))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 16 03 01 00 a0 01 00 00|9c 03 03                 ........ ...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB4767115E] (154 bytes => 154 (0x9A))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 c5 75 cf 3e 65 77 45 a5|04 5c 17 a8 6a b0 0c d7  .u.>ewE. .\\..j...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0010 87 45 57 91 02 7f 27 2c|b3 67 81 d2 10 73 63 e1  .EW...\', .g...sc.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0020 00 00 24 c0 2b c0 2f c0|30 c0 09 c0 13 c0 0a c0  ..$.+./. 0.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0030 14 00 9c 00 9d 00 2f 00|0a 00 35 00 33 00 39 c0  ....../. ..5.3.9.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0040 07 c0 11 00 05 00 04 01|00 00 4f ff 01 00 01 00  ........ ..O.....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0050 00 00 00 16 00 14 00 00|11 76 73 65 72 76 65 72  ........ .vserver\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0060 2e 76 61 72 61 6b 2e 6e|65 74 00 17 00 00 00 23  .varak.n et.....#\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0070 00 00 00 0d 00 12 00 10|06 01 06 03 05 01 05 03  ........ ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0080 04 01 04 03 02 01 02 03|00 0b 00 02 01 00 00 0a  ........ ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0090 00 08 00 06 00 1d 00 17|00 18                    ........ ..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 read client hello A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write server hello A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write certificate A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write key exchange A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write server done A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: write to 7FEB4766B350 [7FEB4767EB10] (3548 bytes => 3548 (0xDDC))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 16 03 03 00 3d 02 00 00|39 03 03 57 62 5d 8f 03  ....=... 9..Wb]..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0010 60 77 45 da fe a0 8f 86|58 93 87 ed a3 0f 76 c7  `wE..... X.....v.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0020 1d 25 95 a9 4d 85 43 18|c5 93 4a 00 c0 2f 00 00  .%..M.C. ..J../..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0030 11 ff 01 00 01 00 00 0b|00 04 03 00 01 02 00 23  ........ .......#\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0040 00 00 16 03 03 0c 3a 0b|00 0c 36 00 0c 33 00 06  ......:. ..6..3..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0050 44 30 82 06 40 30 82 05|28 a0 03 02 01 02 02 10  D0..@0.. (.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0060 3a b4 61 3d 8d dc 9b 17|36 6b 36 4e 36 7d ab 21  :.a=.... 6k6N6}.!\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0070 30 0d 06 09 2a 86 48 86|f7 0d 01 01 0b 05 00 30  0...*.H. .......0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0080 78 31 0b 30 09 06 03 55|04 06 13 02 49 4c 31 16  x1.0...U ....IL1.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0090 30 14 06 03 55 04 0a 13|0d 53 74 61 72 74 43 6f  0...U... .StartCo\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00a0 6d 20 4c 74 64 2e 31 29|30 27 06 03 55 04 0b 13  m Ltd.1) 0\'..U...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00b0 20 53 74 61 72 74 43 6f|6d 20 43 65 72 74 69 66   StartCo m Certif\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00c0 69 63 61 74 69 6f 6e 20|41 75 74 68 6f 72 69 74  ication  Authorit\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00d0 79 31 26 30 24 06 03 55|04 03 13 1d 53 74 61 72  y1&0$..U ....Star\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00e0 74 43 6f 6d 20 43 6c 61|73 73 20 32 20 49 56 20  tCom Cla ss 2 IV\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00f0 53 65 72 76 65 72 20 43|41 30 1e 17 0d 31 36 30  Server C A0...160\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0100 35 32 31 32 30 33 37 30|32 5a 17 0d 31 38 30 35  52120370 2Z..1805\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0110 32 31 32 30 33 37 30 32|5a 30 70 31 0b 30 09 06  21203702 Z0p1.0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0120 03 55 04 06 13 02 43 5a|31 1a 30 18 06 03 55 04  .U....CZ 1.0...U.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0130 08 0c 11 4a 69 68 6f 6d|6f 72 61 76 73 6b 79 20  ...Jihom oravsky\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0140 4b 72 61 6a 31 10 30 0e|06 03 55 04 07 0c 07 42  Kraj1.0. ..U....B\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0150 69 6c 6f 76 65 63 31 0e|30 0c 06 03 55 04 04 0c  ilovec1. 0...U...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0160 05 56 61 72 61 6b 31 0f|30 0d 06 03 55 04 2a 0c  .Varak1. 0...U.*.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0170 06 4d 61 72 74 69 6e 31|12 30 10 06 03 55 04 03  .Martin1 .0...U..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0180 0c 09 76 61 72 61 6b 2e|6e 65 74 30 82 01 22 30  ..varak. net0..\"0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0190 0d 06 09 2a 86 48 86 f7|0d 01 01 01 05 00 03 82  ...*.H.. ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01a0 01 0f 00 30 82 01 0a 02|82 01 01 00 ee 35 54 2b  ...0.... .....5T+\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01b0 9b 4e 1b 27 78 54 bd d7|f5 4f 1e 82 f2 96 ff ae  .N.\'xT.. .O......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01c0 47 c2 7a 04 74 a3 40 3f|70 a2 b0 89 f1 a4 a1 03  G.z.t.@? p.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01d0 53 79 fe 34 7a 68 20 e8|ae e7 20 ba 30 08 de 72  Sy.4zh . .. .0..r\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01e0 b1 b7 31 b1 73 1c 11 28|b4 af 45 c2 5e 13 a5 5b  ..1.s..( ..E.^..[\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 01f0 3b e3 a9 7f ce e9 fd 61|0c ab 6a 0a 3c 56 9b 3d  ;......a ..j.<V.=\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0200 07 5f b4 c5 cd 09 fe a8|04 21 a3 6d c8 79 e7 b6  ._...... .!.m.y..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0210 80 51 c4 bd 50 c7 6b ca|15 ef c4 6b e6 fc c4 5e  .Q..P.k. ...k...^\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0220 cf 31 4b 3d 01 bb 04 48|54 9b 23 bd f7 15 58 81  .1K=...H T.#...X.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0230 bc 44 87 55 20 6e ac e6|32 62 b9 40 9b 71 c2 32  .D.U n.. 2b.@.q.2\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0240 e4 c0 a2 bb e1 61 6f aa|01 80 ca 16 b9 16 52 85  .....ao. ......R.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0250 c2 73 0f 4c 7a 07 97 84|84 05 0f 1c 1f 8e ff 44  .s.Lz... .......D\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0260 5d 7c 00 44 6e 06 64 eb|ab b4 88 a5 8a f2 29 09  ]|.Dn.d. ......).\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0270 d7 bd ca f3 8a 60 b6 9d|ea d3 54 2e 9c eb 8d 32  .....`.. ..T....2\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0280 47 93 69 fd 46 09 0c 01|77 72 f6 6a 4c ee 8c c2  G.i.F... wr.jL...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0290 04 64 81 78 d9 1a 68 bf|3c 7f 92 de 27 34 45 20  .d.x..h. <...\'4E\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02a0 c3 2f dd 56 f2 e7 b4 a4|b2 af 09 95 02 03 01 00  ./.V.... ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02b0 01 a3 82 02 cc 30 82 02|c8 30 0e 06 03 55 1d 0f  .....0.. .0...U..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02c0 01 01 ff 04 04 03 02 05|a0 30 1d 06 03 55 1d 25  ........ .0...U.%\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02d0 04 16 30 14 06 08 2b 06|01 05 05 07 03 02 06 08  ..0...+. ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02e0 2b 06 01 05 05 07 03 01|30 09 06 03 55 1d 13 04  +....... 0...U...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 02f0 02 30 00 30 1d 06 03 55|1d 0e 04 16 04 14 80 9e  .0.0...U ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0300 9c 7c 8a 9d 78 77 ba 84|6d 90 49 10 d1 74 87 36  .|..xw.. m.I..t.6\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0310 eb 59 30 1f 06 03 55 1d|23 04 18 30 16 80 14 94  .Y0...U. #..0....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0320 de 85 41 2a a5 d9 45 f6|60 2c 2e 4c 93 09 a6 2c  ..A*..E. `,.L...,\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0330 23 7e 3e 30 6f 06 08 2b|06 01 05 05 07 01 01 04  #~>0o..+ ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0340 63 30 61 30 24 06 08 2b|06 01 05 05 07 30 01 86  c0a0$..+ .....0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0350 18 68 74 74 70 3a 2f 2f|6f 63 73 70 2e 73 74 61  .http:// ocsp.sta\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0360 72 74 73 73 6c 2e 63 6f|6d 30 39 06 08 2b 06 01  rtssl.co m09..+..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0370 05 05 07 30 02 86 2d 68|74 74 70 3a 2f 2f 61 69  ...0..-h ttp://ai\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0380 61 2e 73 74 61 72 74 73|73 6c 2e 63 6f 6d 2f 63  a.starts sl.com/c\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0390 65 72 74 73 2f 73 63 61|2e 73 65 72 76 65 72 32  erts/sca .server2\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03a0 2e 63 72 74 30 38 06 03|55 1d 1f 04 31 30 2f 30  .crt08.. U...10/0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03b0 2d a0 2b a0 29 86 27 68|74 74 70 3a 2f 2f 63 72  -.+.).\'h ttp://cr\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03c0 6c 2e 73 74 61 72 74 73|73 6c 2e 63 6f 6d 2f 73  l.starts sl.com/s\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03d0 63 61 2d 73 65 72 76 65|72 32 2e 63 72 6c 30 21  ca-serve r2.crl0!\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03e0 06 03 55 1d 11 04 1a 30|18 82 09 76 61 72 61 6b  ..U....0 ...varak\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 03f0 2e 6e 65 74 82 0b 2a 2e|76 61 72 61 6b 2e 6e 65  .net..*. varak.ne\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0400 74 30 23 06 03 55 1d 12|04 1c 30 1a 86 18 68 74  t0#..U.. ..0...ht\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0410 74 70 3a 2f 2f 77 77 77|2e 73 74 61 72 74 73 73  tp://www .startss\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0420 6c 2e 63 6f 6d 2f 30 51|06 03 55 1d 20 04 4a 30  l.com/0Q ..U. .J0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0430 48 30 08 06 06 67 81 0c|01 02 03 30 3c 06 0b 2b  H0...g.. ...0<..+\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0440 06 01 04 01 81 b5 37 01|02 05 30 2d 30 2b 06 08  ......7. ..0-0+..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0450 2b 06 01 05 05 07 02 01|16 1f 68 74 74 70 73 3a  +....... ..https:\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0460 2f 2f 77 77 77 2e 73 74|61 72 74 73 73 6c 2e 63  //www.st artssl.c\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0470 6f 6d 2f 70 6f 6c 69 63|79 30 82 01 04 06 0a 2b  om/polic y0.....+\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0480 06 01 04 01 d6 79 02 04|02 04 81 f5 04 81 f2 00  .....y.. ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0490 f0 00 77 00 68 f6 98 f8|1f 64 82 be 3a 8c ee b9  ..w.h... .d..:...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04a0 28 1d 4c fc 71 51 5d 67|93 d4 44 d1 0a 67 ac bb  (.L.qQ]g ..D..g..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04b0 4f 4f fb c4 00 00 01 54|d5 2a 61 1e 00 00 04 03  OO.....T .*a.....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04c0 00 48 30 46 02 21 00 b5|bc 7c 91 1e dd d7 e8 e1  .H0F.!.. .|......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04d0 f4 d1 05 d3 31 8a 87 e3|72 81 e2 a8 2c 6e d5 3b  ....1... r...,n.;\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04e0 25 06 aa a2 f6 3f 9b 02|21 00 84 11 d1 e6 b9 c6  %....?.. !.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 04f0 1a f3 45 f1 d3 dd 0f 85|57 4e 28 e0 ff 0b 08 6d  ..E..... WN(....m\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0500 b3 6b 9b 2f f1 e9 73 b6|75 8b 00 75 00 ee 4b bd  .k./..s. u..u..K.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0510 b7 75 ce 60 ba e1 42 69|1f ab e1 9e 66 a3 0f 7e  .u.`..Bi ....f..~\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0520 5f b0 72 d8 83 00 c4 7b|89 7a a8 fd cb 00 00 01  _.r....{ .z......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0530 54 d5 2a 64 d4 00 00 04|03 00 46 30 44 02 20 6b  T.*d.... ..F0D. k\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0540 c8 eb fa db 4e 05 5a 70|34 12 c1 ef 2d df a2 45  ....N.Zp 4...-..E\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0550 14 2d 2e 34 7b 41 1e d3|42 58 d8 c4 14 b9 b4 02  .-.4{A.. BX......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0560 20 54 37 70 42 e5 d8 e1|95 0a e8 b3 51 91 ac a0   T7pB... ....Q...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0570 36 c7 c4 c5 68 8c c7 4a|cf b6 d0 ec f4 ed 9f 70  6...h..J .......p\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0580 b4 30 0d 06 09 2a 86 48|86 f7 0d 01 01 0b 05 00  .0...*.H ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0590 03 82 01 01 00 5e 60 b1|f4 de 25 05 05 12 36 ed  .....^`. ..%...6.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05a0 51 b2 a1 c5 b5 a9 18 03|47 a7 bf 4b 62 93 0f 0b  Q....... G..Kb...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05b0 55 c0 ae cb 8b 79 db a7|07 3d 96 ba 4f a4 e2 b5  U....y.. .=..O...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05c0 3a 39 4a f8 ac b5 c9 26|82 59 e6 b1 49 6e cd e5  :9J....& .Y..In..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05d0 1b 28 ff dc c6 31 55 70|71 56 66 26 a3 47 8d 9d  .(...1Up qVf&.G..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05e0 43 fc 90 28 c3 dc 37 86|2e 19 00 18 7c bb 48 17  C..(..7. ....|.H.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 05f0 f1 d5 a3 45 a3 56 5b 70|6a 53 91 0d 73 57 c4 d2  ...E.V[p jS..sW..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0600 b6 fa 86 fd 0b cc 07 ce|97 ce ad 7c e6 64 9f 13  ........ ...|.d..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0610 f3 e0 ac eb d0 e6 d2 a5|9a 15 00 9b aa 38 22 3a  ........ .....8\":\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0620 3e 80 06 82 a8 3b 3d da|7b 0f de 1c 11 24 14 cb  >....;=. {....$..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0630 a6 c3 da bb d3 b8 e1 0d|b3 8f 1f c2 8b 70 f6 06  ........ .....p..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0640 ad ca 1e 6d c0 3f 07 47|17 a1 1b de ea fd a5 3f  ...m.?.G .......?\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0650 18 79 78 d6 b3 be 60 f4|14 a8 b5 b5 ef 77 ca 2b  .yx...`. .....w.+\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0660 0a 5e e4 06 39 69 f9 46|1b 4f 67 81 6e a3 32 02  .^..9i.F .Og.n.2.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0670 4c d4 58 ed b2 cd f1 c0|05 97 2c 24 eb aa ec 8a  L.X..... ..,$....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0680 06 05 94 83 fc 9d ec 0c|f6 61 b4 40 86 30 d7 bf  ........ .a.@.0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0690 8c b6 64 f5 ec 00 05 e9|30 82 05 e5 30 82 03 cd  ..d..... 0...0...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06a0 a0 03 02 01 02 02 10 26|43 bb 32 a1 66 48 7a e1  .......& C.2.fHz.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06b0 9d 6c 79 c4 3f e2 66 30|0d 06 09 2a 86 48 86 f7  .ly.?.f0 ...*.H..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06c0 0d 01 01 0b 05 00 30 7d|31 0b 30 09 06 03 55 04  ......0} 1.0...U.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06d0 06 13 02 49 4c 31 16 30|14 06 03 55 04 0a 13 0d  ...IL1.0 ...U....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06e0 53 74 61 72 74 43 6f 6d|20 4c 74 64 2e 31 2b 30  StartCom  Ltd.1+0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 06f0 29 06 03 55 04 0b 13 22|53 65 63 75 72 65 20 44  )..U...\" Secure D\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0700 69 67 69 74 61 6c 20 43|65 72 74 69 66 69 63 61  igital C ertifica\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0710 74 65 20 53 69 67 6e 69|6e 67 31 29 30 27 06 03  te Signi ng1)0\'..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0720 55 04 03 13 20 53 74 61|72 74 43 6f 6d 20 43 65  U... Sta rtCom Ce\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0730 72 74 69 66 69 63 61 74|69 6f 6e 20 41 75 74 68  rtificat ion Auth\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0740 6f 72 69 74 79 30 1e 17|0d 31 35 31 32 31 36 30  ority0.. .1512160\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0750 31 30 30 30 35 5a 17 0d|33 30 31 32 31 36 30 31  10005Z.. 30121601\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0760 30 30 30 35 5a 30 78 31|0b 30 09 06 03 55 04 06  0005Z0x1 .0...U..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0770 13 02 49 4c 31 16 30 14|06 03 55 04 0a 13 0d 53  ..IL1.0. ..U....S\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0780 74 61 72 74 43 6f 6d 20|4c 74 64 2e 31 29 30 27  tartCom  Ltd.1)0\'\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0790 06 03 55 04 0b 13 20 53|74 61 72 74 43 6f 6d 20  ..U... S tartCom\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07a0 43 65 72 74 69 66 69 63|61 74 69 6f 6e 20 41 75  Certific ation Au\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07b0 74 68 6f 72 69 74 79 31|26 30 24 06 03 55 04 03  thority1 &0$..U..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07c0 13 1d 53 74 61 72 74 43|6f 6d 20 43 6c 61 73 73  ..StartC om Class\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07d0 20 32 20 49 56 20 53 65|72 76 65 72 20 43 41 30   2 IV Se rver CA0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07e0 82 01 22 30 0d 06 09 2a|86 48 86 f7 0d 01 01 01  ..\"0...* .H......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 07f0 05 00 03 82 01 0f 00 30|82 01 0a 02 82 01 01 00  .......0 ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0800 9c bd bd 82 3c 7a 13 8e|bb cb 83 ac 1e 8e 36 4c  ....<z.. ......6L\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0810 29 f5 ac 2e c9 5d 49 ef|7a 9c cf 13 d2 8b 6c 98  )....]I. z.....l.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0820 90 8b ad c9 48 b4 eb fd|05 46 8e 15 85 40 18 6a  ....H... .F...@.j\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0830 c1 72 a5 c9 3c 81 34 6a|0e b9 5f b2 46 88 a6 aa  .r..<.4j .._.F...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0840 43 c3 75 5e 99 76 72 27|47 09 8a 02 75 61 bc c5  C.u^.vr\' G...ua..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0850 5d d9 65 de a9 22 6d ab|94 93 6b 69 ee 3a 72 d3  ].e..\"m. ..ki.:r.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0860 c1 80 67 c9 5b 0e 22 8f|58 76 7b c5 84 35 c0 1a  ..g.[.\". Xv{..5..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0870 34 37 85 75 90 22 ad 34|7f 8d d7 13 c1 62 93 ef  47.u.\".4 .....b..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0880 44 50 6f e8 17 b5 4b 94|80 02 00 99 e1 a2 d0 23  DPo...K. .......#\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0890 d9 d4 76 4e f4 26 c8 16|c4 10 dd 8f 84 b1 f7 58  ..vN.&.. .......X\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08a0 03 59 92 53 1b 6a 8d 9c|b0 04 aa 4b 0c 8e 98 00  .Y.S.j.. ...K....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08b0 79 fb 7e 67 49 a8 29 31|8b ae 55 ae 19 4a 79 b6  y.~gI.)1 ..U..Jy.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08c0 11 a1 7c 7a 62 f1 8a 21|4a e4 89 c2 05 98 d1 1b  ..|zb..! J.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08d0 8b be 60 ba c4 bf bf a6|2a b9 c7 38 c5 56 90 e1  ..`..... *..8.V..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08e0 3b 9b 32 b1 b6 e1 c5 61|6d 8b 44 1f be 78 91 8b  ;.2....a m.D..x..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 08f0 51 d9 f5 2a 2b e2 64 34|bf a1 f3 a1 22 17 ec b7  Q..*+.d4 ....\"...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0900 02 03 01 00 01 a3 82 01|64 30 82 01 60 30 0e 06  ........ d0..`0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0910 03 55 1d 0f 01 01 ff 04|04 03 02 01 06 30 1d 06  .U...... .....0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0920 03 55 1d 25 04 16 30 14|06 08 2b 06 01 05 05 07  .U.%..0. ..+.....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0930 03 02 06 08 2b 06 01 05|05 07 03 01 30 12 06 03  ....+... ....0...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0940 55 1d 13 01 01 ff 04 08|30 06 01 01 ff 02 01 00  U....... 0.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0950 30 32 06 03 55 1d 1f 04|2b 30 29 30 27 a0 25 a0  02..U... +0)0\'.%.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0960 23 86 21 68 74 74 70 3a|2f 2f 63 72 6c 2e 73 74  #.!http: //crl.st\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0970 61 72 74 73 73 6c 2e 63|6f 6d 2f 73 66 73 63 61  artssl.c om/sfsca\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0980 2e 63 72 6c 30 66 06 08|2b 06 01 05 05 07 01 01  .crl0f.. +.......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0990 04 5a 30 58 30 24 06 08|2b 06 01 05 05 07 30 01  .Z0X0$.. +.....0.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09a0 86 18 68 74 74 70 3a 2f|2f 6f 63 73 70 2e 73 74  ..http:/ /ocsp.st\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09b0 61 72 74 73 73 6c 2e 63|6f 6d 30 30 06 08 2b 06  artssl.c om00..+.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09c0 01 05 05 07 30 02 86 24|68 74 74 70 3a 2f 2f 61  ....0..$ http://a\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09d0 69 61 2e 73 74 61 72 74|73 73 6c 2e 63 6f 6d 2f  ia.start ssl.com/\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09e0 63 65 72 74 73 2f 63 61|2e 63 72 74 30 1d 06 03  certs/ca .crt0...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 09f0 55 1d 0e 04 16 04 14 94|de 85 41 2a a5 d9 45 f6  U....... ..A*..E.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a00 60 2c 2e 4c 93 09 a6 2c|23 7e 3e 30 1f 06 03 55  `,.L..., #~>0...U\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a10 1d 23 04 18 30 16 80 14|4e 0b ef 1a a4 40 5b a5  .#..0... N....@[.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a20 17 69 87 30 ca 34 68 43|d0 41 ae f2 30 3f 06 03  .i.0.4hC .A..0?..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a30 55 1d 20 04 38 30 36 30|34 06 04 55 1d 20 00 30  U. .8060 4..U. .0\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a40 2c 30 2a 06 08 2b 06 01|05 05 07 02 01 16 1e 68  ,0*..+.. .......h\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a50 74 74 70 3a 2f 2f 77 77|77 2e 73 74 61 72 74 73  ttp://ww w.starts\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a60 73 6c 2e 63 6f 6d 2f 70|6f 6c 69 63 79 30 0d 06  sl.com/p olicy0..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a70 09 2a 86 48 86 f7 0d 01|01 0b 05 00 03 82 02 01  .*.H.... ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a80 00 b5 ea 43 2e 66 1f 21|95 5b 20 cf 26 da 22 2c  ...C.f.! .[ .&.\",\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0a90 76 ab 24 90 15 4f ab 3e|0a 92 a9 ec ab 0d 29 89  v.$..O.> ......).\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0aa0 c2 90 db 68 a8 f0 6a 49|ba 2c 9d 83 2d 7e 4c 44  ...h..jI .,..-~LD\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ab0 58 cd 3c 28 7e 02 b4 1f|09 4d 54 50 96 ba e6 7e  X.<(~... .MTP...~\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ac0 d4 69 05 ad ea af 24 53|08 9f 1d c2 27 f9 f1 49  .i....$S ....\'..I\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ad0 74 d5 77 37 8c dd be 52|b1 c2 f7 aa 05 24 19 89  t.w7...R .....$..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ae0 77 88 50 ef e1 1e bd 54|8b b1 b0 ea cd 0e 9f e2  w.P....T ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0af0 b4 7c 3f 68 35 c8 02 45|1d ef 3e 27 01 d9 fa ca  .|?h5..E ..>\'....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b00 ec 18 4e 16 37 ba c6 8c|2c 59 ec 71 3d f2 47 23  ..N.7... ,Y.q=.G#\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b10 af 65 0a ae f7 3b b2 9e|c5 7a a9 fd 5f 1f f2 e1  .e...;.. .z.._...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b20 85 f0 be 0a 53 7c 56 e9|10 c6 e7 b4 6b 5e 1e 7e  ....S|V. ....k^.~\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b30 2c dc 54 42 66 76 b4 80|1a 3f 21 d3 34 3e 73 6f  ,.TBfv.. .?!.4>so\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b40 17 df f1 9f d9 6e 01 86|1c a6 ec b8 f9 00 50 81  .....n.. ......P.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b50 be 6c 7a 6a e5 be 9b 7f|6c 76 37 13 21 a9 84 8c  .lzj.... lv7.!...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b60 23 e1 89 27 d1 66 9a 20|95 f8 fd fe d3 2c 01 60  #..\'.f.  .....,.`\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b70 63 61 26 47 05 51 8b e8|49 47 6e 1f 3f bf 45 77  ca&G.Q.. IGn.?.Ew\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b80 7a 1b f7 a3 ae f2 a9 e7|ca db 67 d8 82 21 22 d9  z....... ..g..!\".\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0b90 8e 9a 39 81 81 1f 2c 89|7a 21 02 5c 64 f3 3c 14  ..9...,. z!.\\d.<.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ba0 85 8a 2c a8 6d 22 82 97|e5 cb 4d 2f 77 a9 57 80  ..,.m\".. ..M/w.W.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0bb0 f3 20 36 71 2d a4 ab b8|40 50 15 e0 d0 8f aa 7f  . 6q-... @P......\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0bc0 ef 8a 54 60 b4 01 3f 9d|b7 6a 77 fa 4a d5 c1 b5  ..T`..?. .jw.J...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0bd0 88 1b 7c 89 91 a0 88 78|23 c2 fc e5 a0 7f 4d 4c  ..|....x #.....ML\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0be0 8b 38 90 3f b0 ac 7f 58|5a d7 3b 11 3d 2b 8a be  .8.?...X Z.;.=+..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0bf0 3d fe 6d ab 78 33 64 47|21 33 f6 ed 31 89 f5 73  =.m.x3dG !3..1..s\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c00 0d 46 3d 4b 78 9c 7c 9a|cd 2e 76 2e b3 f4 f9 0e  .F=Kx.|. ..v.....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c10 fb 6a 8d 46 cd af 6c bd|df 07 13 53 59 f4 d2 15  .j.F..l. ...SY...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c20 24 ee f5 42 c9 2a 8f 1b|c6 89 3b 74 e3 ca f8 80  $..B.*.. ..;t....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c30 b4 97 68 cd 73 3f 6c 3d|9c cb 08 c3 52 29 c5 71  ..h.s?l= ....R).q\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c40 3c 87 d5 07 02 59 60 87|ca 0d 1e 7a 39 23 d9 cb  <....Y`. ...z9#..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c50 7f 29 db 12 15 f1 1b 2f|51 95 f7 0b 37 f2 7c 88  .)...../ Q...7.|.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c60 ea b2 6a 07 e0 c6 b5 32|0c f2 8c 87 9c 46 78 b2  ..j....2 .....Fx.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c70 8c 41 2c e3 c9 0d 5b 57|45 86 0b 52 66 26 9f 90  .A,...[W E..Rf&..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c80 0d 16 03 03 01 4d 0c 00|01 49 03 00 17 41 04 e8  .....M.. .I...A..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0c90 b7 8c 3b a8 00 f4 25 9d|73 25 c5 8e 4a eb 37 5d  ..;...%. s%..J.7]\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ca0 a2 94 73 76 c3 4a 60 82|56 33 9c 4f f1 b1 c2 0e  ..sv.J`. V3.O....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0cb0 83 c1 7a 31 fb 75 c7 76|4c b0 47 66 33 a7 d6 df  ..z1.u.v L.Gf3...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0cc0 94 25 83 19 e2 f4 68 c8|95 47 45 14 47 8d 8e 06  .%....h. .GE.G...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0cd0 01 01 00 4a 7c 47 76 56|fd e8 2d 35 af 30 a7 45  ...J|GvV ..-5.0.E\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0ce0 2a 97 c6 80 81 a2 0c b2|b1 80 b6 b0 c0 53 b3 41  *....... .....S.A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0cf0 fd 9b 22 16 cc 1b 5c df|bf 75 ce c9 5a 33 09 44  ..\"...\\. .u..Z3.D\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d00 6a 73 ba 0e 18 51 00 cf|8c 07 df ed 76 a9 e0 ba  js...Q.. ....v...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d10 38 f0 aa c2 e0 c1 c9 43|ce 48 ba 0c 83 8f ab 76  8......C .H.....v\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d20 28 20 0e a6 65 5b c0 b3|9c 9b e0 69 f1 e2 3e 7f  ( ..e[.. ...i..>.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d30 1c b5 0f 43 4f e6 7d 88|3d 63 e4 27 d4 19 5d 11  ...CO.}. =c.\'..].\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d40 3e 0a 04 f6 90 f1 29 06|9a c9 26 e2 8d 92 22 7d  >.....). ..&...\"}\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d50 c2 f3 bb 72 1d 91 29 2c|22 74 60 5e 6c 2b bd c0  ...r..), \"t`^l+..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d60 53 62 98 35 9d bb b4 ec|24 79 dd e2 75 a5 30 26  Sb.5.... $y..u.0&\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d70 18 e1 c7 92 f2 11 cc b2|03 d3 e5 8a 74 bc be ae  ........ ....t...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d80 7b ec 5c 41 ed 47 70 f0|9f 7d 6d ee 08 52 45 b6  {.\\A.Gp. .}m..RE.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0d90 2c 7d 6e 94 33 17 5b ac|29 8b f5 52 6c 3f 6d f2  ,}n.3.[. )..Rl?m.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0da0 08 e1 82 9f 8f 0a 7f 69|88 f1 a3 c4 06 f8 a5 cb  .......i ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0db0 04 cd 31 5c 7a fe 14 f1|90 99 cb a0 58 68 6f 1c  ..1\\z... ....Xho.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0dc0 2f 31 1d 90 9d a7 b3 f7|9e 9c e4 27 61 91 c3 e3  /1...... ...\'a...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0dd0 d0 c9 66 16 03 03 00 04|0e                       ..f..... .\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0dd9 - <SPACES/NULLS>\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 flush data\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671153] (5 bytes => 5 (0x5))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 16 03 03 00 46                                   ....F\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671158] (70 bytes => 70 (0x46))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 10 00 00 42 41 04 3b 6c|ff b6 29 f9 0f 22 eb a2  ...BA.;l ..)..\"..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0010 ac 48 9c fe 2b 32 1c 6b|18 32 40 75 84 07 2d 4b  .H..+2.k .2@u..-K\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0020 43 45 44 3f d1 be 17 76|cb e8 8e 1e 83 a2 45 c1  CED?...v ......E.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0030 8a e3 db cb 6f 1c 7c 46|d7 31 c9 20 ac 6d 0b 57  ....o.|F .1. .m.W\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0040 d9 ea 3c 57 81 9f                                ..<W..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 read client key exchange A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671153] (5 bytes => 5 (0x5))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 14 03 03 00 01                                   .....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671158] (1 bytes => 1 (0x1))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 01                                               .\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671153] (5 bytes => 5 (0x5))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 16 03 03 00 28                                   ....(\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: read from 7FEB4766B350 [7FEB47671158] (40 bytes => 40 (0x28))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 00 00 00 00 00 00 00 00|8f 2c 1a a1 35 80 63 49  ........ .,..5.cI\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0010 14 6d cb 28 5a a3 72 cd|64 06 18 b0 27 bd 78 7c  .m.(Z.r. d...\'.x|\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0020 f4 78 0b 8d 9e 9a 4c 82|                         .x....L.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 read finished A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write session ticket A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write change cipher spec A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 write finished A\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: write to 7FEB4766B350 [7FEB4767EB10] (258 bytes => 258 (0x102))\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0000 16 03 03 00 ca 04 00 00|c6 00 00 0e 10 00 c0 9c  ........ ........\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0010 a9 94 49 ad a9 2f 6a 19|89 f4 7d 01 e8 9e af 22  ..I../j. ..}....\"\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0020 16 7d 1a 54 3e 2b 18 ec|e1 86 5d bd bd 02 c9 31  .}.T>+.. ..]....1\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0030 e3 47 aa 62 33 42 7d e6|d2 eb 5f 43 a2 06 a6 d3  .G.b3B}. .._C....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0040 00 9a 01 37 c3 0c 37 e9|17 b3 2e e9 7a ed 89 10  ...7..7. ....z...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0050 97 bd d8 b8 7d 20 fd 4b|16 09 e4 84 67 09 5a 2a  ....} .K ....g.Z*\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0060 bd 8e dc 3e 52 cb 4c 20|e9 4a 68 a5 9b cd 50 db  ...>R.L  .Jh...P.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0070 6c 86 76 e9 b6 61 aa 6f|8d 0b a7 bf a0 57 d9 78  l.v..a.o .....W.x\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0080 88 25 2e f9 15 ba fe 5e|7a 91 74 7e 20 3b 94 c5  .%.....^ z.t~ ;..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0090 8e ab d5 05 72 e2 a5 33|16 a4 db 72 62 4b fd 39  ....r..3 ...rbK.9\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00a0 cb cc 04 53 06 cb a7 71|7e ea 8a 7b 35 de 95 61  ...S...q ~..{5..a\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00b0 4b 0c fc 3a fa 20 8b 68|5c 9f 2d 40 8e 4e 77 ba  K..:. .h \\.-@.Nw.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00c0 d6 41 13 0e a7 17 7b d6|e3 6f 09 a8 ff 38 77 14  .A....{. .o...8w.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00d0 03 03 00 01 01 16 03 03|00 28 6b 4c 5a 0a c9 8e  ........ .(kLZ...\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00e0 51 97 58 ad da 5e 7c fd|8b f1 e8 b9 25 f6 2a a6  Q.X..^|. ....%.*.\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 00f0 98 ad 7b f6 57 6b 23 3f|1e d2 6e 13 a2 f4 2e d5  ..{.Wk#? ..n.....\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: 0100 bf de                                            ..\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: SSL_accept:SSLv3 flush data\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: Anonymous TLS connection established from mail-wm0-f53.google.com[74.125.82.53]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: warning: restriction `check_policy_service\' after `permit\' is ignored\r\nJun 16 10:04:31 mrazitko postfix/smtpd[26710]: E9E2B2855841: client=mail-wm0-f53.google.com[74.125.82.53]\r\nJun 16 10:04:32 mrazitko postfix/cleanup[26692]: E9E2B2855841: message-id=<57799cfbb632b3bcab9e9d061699c1bb@varak.net>\r\nJun 16 10:04:32 mrazitko opendkim[9286]: E9E2B2855841: external host mail-wm0-f53.google.com attempted to send as varak.net\r\nJun 16 10:04:32 mrazitko postfix/qmgr[32164]: E9E2B2855841: from=<martin.varak+caf_=martin=varak.net@gmail.com>, size=3385, nrcpt=1 (queue active)\r\nJun 16 10:04:32 mrazitko postfix/smtpd[26710]: disconnect from mail-wm0-f53.google.com[74.125.82.53]\r\nJun 16 10:04:32 mrazitko postfix/virtual[26714]: E9E2B2855841: to=<martin@varak.net>, relay=virtual, delay=0.3, delays=0.21/0.01/0/0.08, dsn=2.0.0, status=sent (delivered to maildir)\r\nJun 16 10:04:32 mrazitko postfix/qmgr[32164]: E9E2B2855841: removed','text','','T47rT',0,'gl3z8y','85.93.125.67',137,0,0),(68,'pg0oftehu',3,'martin.varak',NULL,1466069000,0,NULL,'[Sat May 21 15:49:14 2016]\r\nUID: waritko, M12887993 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D8574D7, AID: C1DA989CCC32AE709C825C86C37C9666\r\n[Sat May 21 22:08:34 2016]\r\nUID: waritko, M12887299 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D8A74D4, AID: 7BEE45F9D5918AE337C3D7E6CDB4A608\r\n[Tue May 24 06:45:05 2016]\r\nUID: waritko, M12888037 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D837422, AID: C759996588B019C055D9998F7596D057\r\n[Tue May 24 14:21:26 2016]\r\nUID: waritko, M12887417 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7474D4, AID: 66C5A83C8D854D3821E2FD071D146263\r\n[Thu May 26 22:29:40 2016]\r\nUID: waritko, M12888079 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7C74D9, AID: 6F0BDDAD9EDC08DD84C325CB6E820D3B\r\n[Fri May 27 07:10:19 2016]\r\nUID: waritko, M12887443 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D8E74DD, AID: AE143510CB9B6752B645EA46EDA4DE73\r\n[Sun May 29 12:36:53 2016]\r\nUID: waritko, M12888121 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D797422, AID: 903B40BFC47DFE43AEFF0E4C06B78DB1\r\n[Sun May 29 22:06:01 2016]\r\nUID: waritko, M12887449 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D6774D2, AID: E4B9977A141EF8D6FB3C0E321ED83D47\r\n[Wed Jun  1 02:45:28 2016]\r\nUID: waritko, M12888203 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D6C74DF, AID: 996A8FDC5D52589B8D5C7F41A6C0117F\r\n[Wed Jun  1 13:26:51 2016]\r\nUID: waritko, M12887473 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7F74D9, AID: 894ACE5E36EB2F63FD8C8BA7BEB2EF38\r\n[Wed Jun  1 18:54:34 2016]\r\nECM found a factor in curve #13, stage #1\r\nSigma=2743371965458815, B1=50000, B2=50000.\r\nUID: waritko, M12888299 has a factor: 137506896220137179659577 (ECM curve 13, B1=50000, B2=50000), AID: 76DB7548F1A0945E2962892FEBEEB8E2\r\n[Sat Jun  4 04:27:47 2016]\r\nUID: waritko, M12887509 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7274DC, AID: 127A9D938D83060AF1C29E1194F48AF0\r\n[Sat Jun  4 08:57:39 2016]\r\nUID: waritko, M12888361 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7E7426, AID: 14B89503D9AD586B15180F76A83AABEF\r\n[Mon Jun  6 19:40:52 2016]\r\nUID: waritko, M12887549 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D6C74D1, AID: 3925CEE7CD6505BF87D14829B5DF8C5F\r\n[Mon Jun  6 23:24:47 2016]\r\nUID: waritko, M12888443 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D727424, AID: BB1712C47DD3CA0357F27DDE37CDD80E\r\n[Thu Jun  9 11:24:59 2016]\r\nUID: waritko, M12887591 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D6974D9, AID: 700C2F259437B7B73AD04E80A35BE46F\r\n[Thu Jun  9 14:24:03 2016]\r\nUID: waritko, M12888457 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D837421, AID: 60DD6F192937683AE071863BF0CDBD6E\r\n[Sun Jun 12 03:04:23 2016]\r\nUID: waritko, M12887657 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7A74D8, AID: 6D6BD9885726CE5C15DAC6A68DE72D67\r\n[Sun Jun 12 05:09:41 2016]\r\nUID: waritko, M12888611 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D917424, AID: 9C7FA9B60BCF947905A3ECFB50036451\r\n[Tue Jun 14 18:55:12 2016]\r\nUID: waritko, M12887731 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D6974DF, AID: 0CA348BE289FF74F032ADC3FEAC4DE13\r\n[Tue Jun 14 20:10:09 2016]\r\nUID: waritko, M12888641 completed 50 ECM curves, B1=50000, B2=50000, We8: 4D7E7420, AID: 361E2A300BC53B3B0D6DA83B1B12544F','text','','4uCx5',0,'x5hzmk','85.93.125.67',120,0,0),(69,'pqw3z7chk',3,'martin.varak',NULL,1466517068,0,NULL,'Jun 21 15:50:20 mrazitko postfix/smtpd[2609]: initializing the server-side TLS engine\r\nJun 21 15:50:20 mrazitko postfix/smtpd[2609]: connect from unknown[85.93.125.67]\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: setting up TLS connection from unknown[85.93.125.67]\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: unknown[85.93.125.67]: TLS cipher list \"aNULL:-aNULL:ALL:+RC4:@STRENGTH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CDC3-SHA:!KRB5-DE5:!CBC3-SHA\"\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:before/accept initialization\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7630] (11 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7630] (11 bytes => 11 (0xB))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 16 03 01 00 bd 01 00 00|b9 03 03                 ........ ...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F763E] (183 bytes => 183 (0xB7))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 9c 94 6b d4 17 88 e3 31|01 7b e9 6c 75 31 46 b0  ..k....1 .{.lu1F.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0010 9f 95 9c db 64 a0 dc 7c|92 57 db 50 74 da 48 56  ....d..| .W.Pt.HV\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0020 00 00 2c c0 14 c0 0a 00|39 00 38 00 35 c0 13 c0  ..,..... 9.8.5...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0030 09 00 33 00 32 00 2f c0|11 c0 07 00 05 c0 2b c0  ..3.2./. ......+.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0040 2c c0 2f c0 30 00 9e 00|9f 00 9c 00 9d 00 ff 01  ,./.0... ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0050 00 00 64 00 0b 00 04 03|00 01 02 00 0a 00 34 00  ..d..... ......4.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0060 32 00 0e 00 0d 00 19 00|0b 00 0c 00 18 00 09 00  2....... ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0070 0a 00 16 00 17 00 08 00|06 00 07 00 14 00 15 00  ........ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0080 04 00 05 00 12 00 13 00|01 00 02 00 03 00 0f 00  ........ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0090 10 00 11 00 0d 00 20 00|1e 06 01 06 02 06 03 05  ...... . ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00a0 01 05 02 05 03 04 01 04|02 04 03 03 01 03 02 03  ........ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00b0 03 02 01 02 02 02 03                             .......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 read client hello A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write server hello A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write certificate A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write key exchange A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write server done A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: write to 7FDF832F2050 [7FDF83305070] (3576 bytes => 3576 (0xDF8))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 16 03 03 00 59 02 00 00|55 03 03 57 69 46 22 8a  ....Y... U..WiF\".\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0010 e7 6f 5d 64 6e 82 63 87|31 c1 8c be 50 3a ae bb  .o]dn.c. 1...P:..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0020 ec 44 30 6c b0 8e 4b 14|d9 02 54 20 45 91 53 15  .D0l..K. ..T E.S.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0030 83 2a fc 97 bf b5 a7 cf|c1 43 34 13 63 8a 39 8b  .*...... .C4.c.9.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0040 6d 37 dd 96 37 f2 cc 89|0d e8 fc 46 c0 14 00 00  m7..7... ...F....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0050 0d ff 01 00 01 00 00 0b|00 04 03 00 01 02 16 03  ........ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0060 03 0c 3a 0b 00 0c 36 00|0c 33 00 06 44 30 82 06  ..:...6. .3..D0..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0070 40 30 82 05 28 a0 03 02|01 02 02 10 3a b4 61 3d  @0..(... ....:.a=\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0080 8d dc 9b 17 36 6b 36 4e|36 7d ab 21 30 0d 06 09  ....6k6N 6}.!0...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0090 2a 86 48 86 f7 0d 01 01|0b 05 00 30 78 31 0b 30  *.H..... ...0x1.0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00a0 09 06 03 55 04 06 13 02|49 4c 31 16 30 14 06 03  ...U.... IL1.0...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00b0 55 04 0a 13 0d 53 74 61|72 74 43 6f 6d 20 4c 74  U....Sta rtCom Lt\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00c0 64 2e 31 29 30 27 06 03|55 04 0b 13 20 53 74 61  d.1)0\'.. U... Sta\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00d0 72 74 43 6f 6d 20 43 65|72 74 69 66 69 63 61 74  rtCom Ce rtificat\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00e0 69 6f 6e 20 41 75 74 68|6f 72 69 74 79 31 26 30  ion Auth ority1&0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 00f0 24 06 03 55 04 03 13 1d|53 74 61 72 74 43 6f 6d  $..U.... StartCom\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0100 20 43 6c 61 73 73 20 32|20 49 56 20 53 65 72 76   Class 2  IV Serv\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0110 65 72 20 43 41 30 1e 17|0d 31 36 30 35 32 31 32  er CA0.. .1605212\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0120 30 33 37 30 32 5a 17 0d|31 38 30 35 32 31 32 30  03702Z.. 18052120\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0130 33 37 30 32 5a 30 70 31|0b 30 09 06 03 55 04 06  3702Z0p1 .0...U..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0140 13 02 43 5a 31 1a 30 18|06 03 55 04 08 0c 11 4a  ..CZ1.0. ..U....J\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0150 69 68 6f 6d 6f 72 61 76|73 6b 79 20 4b 72 61 6a  ihomorav sky Kraj\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0160 31 10 30 0e 06 03 55 04|07 0c 07 42 69 6c 6f 76  1.0...U. ...Bilov\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0170 65 63 31 0e 30 0c 06 03|55 04 04 0c 05 56 61 72  ec1.0... U....Var\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0180 61 6b 31 0f 30 0d 06 03|55 04 2a 0c 06 4d 61 72  ak1.0... U.*..Mar\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0190 74 69 6e 31 12 30 10 06|03 55 04 03 0c 09 76 61  tin1.0.. .U....va\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01a0 72 61 6b 2e 6e 65 74 30|82 01 22 30 0d 06 09 2a  rak.net0 ..\"0...*\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01b0 86 48 86 f7 0d 01 01 01|05 00 03 82 01 0f 00 30  .H...... .......0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01c0 82 01 0a 02 82 01 01 00|ee 35 54 2b 9b 4e 1b 27  ........ .5T+.N.\'\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01d0 78 54 bd d7 f5 4f 1e 82|f2 96 ff ae 47 c2 7a 04  xT...O.. ....G.z.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01e0 74 a3 40 3f 70 a2 b0 89|f1 a4 a1 03 53 79 fe 34  t.@?p... ....Sy.4\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 01f0 7a 68 20 e8 ae e7 20 ba|30 08 de 72 b1 b7 31 b1  zh ... . 0..r..1.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0200 73 1c 11 28 b4 af 45 c2|5e 13 a5 5b 3b e3 a9 7f  s..(..E. ^..[;...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0210 ce e9 fd 61 0c ab 6a 0a|3c 56 9b 3d 07 5f b4 c5  ...a..j. <V.=._..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0220 cd 09 fe a8 04 21 a3 6d|c8 79 e7 b6 80 51 c4 bd  .....!.m .y...Q..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0230 50 c7 6b ca 15 ef c4 6b|e6 fc c4 5e cf 31 4b 3d  P.k....k ...^.1K=\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0240 01 bb 04 48 54 9b 23 bd|f7 15 58 81 bc 44 87 55  ...HT.#. ..X..D.U\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0250 20 6e ac e6 32 62 b9 40|9b 71 c2 32 e4 c0 a2 bb   n..2b.@ .q.2....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0260 e1 61 6f aa 01 80 ca 16|b9 16 52 85 c2 73 0f 4c  .ao..... ..R..s.L\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0270 7a 07 97 84 84 05 0f 1c|1f 8e ff 44 5d 7c 00 44  z....... ...D]|.D\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0280 6e 06 64 eb ab b4 88 a5|8a f2 29 09 d7 bd ca f3  n.d..... ..).....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0290 8a 60 b6 9d ea d3 54 2e|9c eb 8d 32 47 93 69 fd  .`....T. ...2G.i.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02a0 46 09 0c 01 77 72 f6 6a|4c ee 8c c2 04 64 81 78  F...wr.j L....d.x\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02b0 d9 1a 68 bf 3c 7f 92 de|27 34 45 20 c3 2f dd 56  ..h.<... \'4E ./.V\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02c0 f2 e7 b4 a4 b2 af 09 95|02 03 01 00 01 a3 82 02  ........ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02d0 cc 30 82 02 c8 30 0e 06|03 55 1d 0f 01 01 ff 04  .0...0.. .U......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02e0 04 03 02 05 a0 30 1d 06|03 55 1d 25 04 16 30 14  .....0.. .U.%..0.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 02f0 06 08 2b 06 01 05 05 07|03 02 06 08 2b 06 01 05  ..+..... ....+...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0300 05 07 03 01 30 09 06 03|55 1d 13 04 02 30 00 30  ....0... U....0.0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0310 1d 06 03 55 1d 0e 04 16|04 14 80 9e 9c 7c 8a 9d  ...U.... .....|..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0320 78 77 ba 84 6d 90 49 10|d1 74 87 36 eb 59 30 1f  xw..m.I. .t.6.Y0.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0330 06 03 55 1d 23 04 18 30|16 80 14 94 de 85 41 2a  ..U.#..0 ......A*\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0340 a5 d9 45 f6 60 2c 2e 4c|93 09 a6 2c 23 7e 3e 30  ..E.`,.L ...,#~>0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0350 6f 06 08 2b 06 01 05 05|07 01 01 04 63 30 61 30  o..+.... ....c0a0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0360 24 06 08 2b 06 01 05 05|07 30 01 86 18 68 74 74  $..+.... .0...htt\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0370 70 3a 2f 2f 6f 63 73 70|2e 73 74 61 72 74 73 73  p://ocsp .startss\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0380 6c 2e 63 6f 6d 30 39 06|08 2b 06 01 05 05 07 30  l.com09. .+.....0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0390 02 86 2d 68 74 74 70 3a|2f 2f 61 69 61 2e 73 74  ..-http: //aia.st\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03a0 61 72 74 73 73 6c 2e 63|6f 6d 2f 63 65 72 74 73  artssl.c om/certs\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03b0 2f 73 63 61 2e 73 65 72|76 65 72 32 2e 63 72 74  /sca.ser ver2.crt\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03c0 30 38 06 03 55 1d 1f 04|31 30 2f 30 2d a0 2b a0  08..U... 10/0-.+.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03d0 29 86 27 68 74 74 70 3a|2f 2f 63 72 6c 2e 73 74  ).\'http: //crl.st\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03e0 61 72 74 73 73 6c 2e 63|6f 6d 2f 73 63 61 2d 73  artssl.c om/sca-s\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 03f0 65 72 76 65 72 32 2e 63|72 6c 30 21 06 03 55 1d  erver2.c rl0!..U.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0400 11 04 1a 30 18 82 09 76|61 72 61 6b 2e 6e 65 74  ...0...v arak.net\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0410 82 0b 2a 2e 76 61 72 61|6b 2e 6e 65 74 30 23 06  ..*.vara k.net0#.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0420 03 55 1d 12 04 1c 30 1a|86 18 68 74 74 70 3a 2f  .U....0. ..http:/\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0430 2f 77 77 77 2e 73 74 61|72 74 73 73 6c 2e 63 6f  /www.sta rtssl.co\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0440 6d 2f 30 51 06 03 55 1d|20 04 4a 30 48 30 08 06  m/0Q..U.  .J0H0..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0450 06 67 81 0c 01 02 03 30|3c 06 0b 2b 06 01 04 01  .g.....0 <..+....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0460 81 b5 37 01 02 05 30 2d|30 2b 06 08 2b 06 01 05  ..7...0- 0+..+...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0470 05 07 02 01 16 1f 68 74|74 70 73 3a 2f 2f 77 77  ......ht tps://ww\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0480 77 2e 73 74 61 72 74 73|73 6c 2e 63 6f 6d 2f 70  w.starts sl.com/p\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0490 6f 6c 69 63 79 30 82 01|04 06 0a 2b 06 01 04 01  olicy0.. ...+....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04a0 d6 79 02 04 02 04 81 f5|04 81 f2 00 f0 00 77 00  .y...... ......w.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04b0 68 f6 98 f8 1f 64 82 be|3a 8c ee b9 28 1d 4c fc  h....d.. :...(.L.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04c0 71 51 5d 67 93 d4 44 d1|0a 67 ac bb 4f 4f fb c4  qQ]g..D. .g..OO..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04d0 00 00 01 54 d5 2a 61 1e|00 00 04 03 00 48 30 46  ...T.*a. .....H0F\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04e0 02 21 00 b5 bc 7c 91 1e|dd d7 e8 e1 f4 d1 05 d3  .!...|.. ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 04f0 31 8a 87 e3 72 81 e2 a8|2c 6e d5 3b 25 06 aa a2  1...r... ,n.;%...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0500 f6 3f 9b 02 21 00 84 11|d1 e6 b9 c6 1a f3 45 f1  .?..!... ......E.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0510 d3 dd 0f 85 57 4e 28 e0|ff 0b 08 6d b3 6b 9b 2f  ....WN(. ...m.k./\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0520 f1 e9 73 b6 75 8b 00 75|00 ee 4b bd b7 75 ce 60  ..s.u..u ..K..u.`\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0530 ba e1 42 69 1f ab e1 9e|66 a3 0f 7e 5f b0 72 d8  ..Bi.... f..~_.r.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0540 83 00 c4 7b 89 7a a8 fd|cb 00 00 01 54 d5 2a 64  ...{.z.. ....T.*d\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0550 d4 00 00 04 03 00 46 30|44 02 20 6b c8 eb fa db  ......F0 D. k....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0560 4e 05 5a 70 34 12 c1 ef|2d df a2 45 14 2d 2e 34  N.Zp4... -..E.-.4\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0570 7b 41 1e d3 42 58 d8 c4|14 b9 b4 02 20 54 37 70  {A..BX.. .... T7p\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0580 42 e5 d8 e1 95 0a e8 b3|51 91 ac a0 36 c7 c4 c5  B....... Q...6...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0590 68 8c c7 4a cf b6 d0 ec|f4 ed 9f 70 b4 30 0d 06  h..J.... ...p.0..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05a0 09 2a 86 48 86 f7 0d 01|01 0b 05 00 03 82 01 01  .*.H.... ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05b0 00 5e 60 b1 f4 de 25 05|05 12 36 ed 51 b2 a1 c5  .^`...%. ..6.Q...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05c0 b5 a9 18 03 47 a7 bf 4b|62 93 0f 0b 55 c0 ae cb  ....G..K b...U...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05d0 8b 79 db a7 07 3d 96 ba|4f a4 e2 b5 3a 39 4a f8  .y...=.. O...:9J.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05e0 ac b5 c9 26 82 59 e6 b1|49 6e cd e5 1b 28 ff dc  ...&.Y.. In...(..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 05f0 c6 31 55 70 71 56 66 26|a3 47 8d 9d 43 fc 90 28  .1UpqVf& .G..C..(\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0600 c3 dc 37 86 2e 19 00 18|7c bb 48 17 f1 d5 a3 45  ..7..... |.H....E\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0610 a3 56 5b 70 6a 53 91 0d|73 57 c4 d2 b6 fa 86 fd  .V[pjS.. sW......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0620 0b cc 07 ce 97 ce ad 7c|e6 64 9f 13 f3 e0 ac eb  .......| .d......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0630 d0 e6 d2 a5 9a 15 00 9b|aa 38 22 3a 3e 80 06 82  ........ .8\":>...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0640 a8 3b 3d da 7b 0f de 1c|11 24 14 cb a6 c3 da bb  .;=.{... .$......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0650 d3 b8 e1 0d b3 8f 1f c2|8b 70 f6 06 ad ca 1e 6d  ........ .p.....m\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0660 c0 3f 07 47 17 a1 1b de|ea fd a5 3f 18 79 78 d6  .?.G.... ...?.yx.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0670 b3 be 60 f4 14 a8 b5 b5|ef 77 ca 2b 0a 5e e4 06  ..`..... .w.+.^..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0680 39 69 f9 46 1b 4f 67 81|6e a3 32 02 4c d4 58 ed  9i.F.Og. n.2.L.X.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0690 b2 cd f1 c0 05 97 2c 24|eb aa ec 8a 06 05 94 83  ......,$ ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06a0 fc 9d ec 0c f6 61 b4 40|86 30 d7 bf 8c b6 64 f5  .....a.@ .0....d.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06b0 ec 00 05 e9 30 82 05 e5|30 82 03 cd a0 03 02 01  ....0... 0.......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06c0 02 02 10 26 43 bb 32 a1|66 48 7a e1 9d 6c 79 c4  ...&C.2. fHz..ly.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06d0 3f e2 66 30 0d 06 09 2a|86 48 86 f7 0d 01 01 0b  ?.f0...* .H......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06e0 05 00 30 7d 31 0b 30 09|06 03 55 04 06 13 02 49  ..0}1.0. ..U....I\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 06f0 4c 31 16 30 14 06 03 55|04 0a 13 0d 53 74 61 72  L1.0...U ....Star\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0700 74 43 6f 6d 20 4c 74 64|2e 31 2b 30 29 06 03 55  tCom Ltd .1+0)..U\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0710 04 0b 13 22 53 65 63 75|72 65 20 44 69 67 69 74  ...\"Secu re Digit\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0720 61 6c 20 43 65 72 74 69|66 69 63 61 74 65 20 53  al Certi ficate S\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0730 69 67 6e 69 6e 67 31 29|30 27 06 03 55 04 03 13  igning1) 0\'..U...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0740 20 53 74 61 72 74 43 6f|6d 20 43 65 72 74 69 66   StartCo m Certif\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0750 69 63 61 74 69 6f 6e 20|41 75 74 68 6f 72 69 74  ication  Authorit\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0760 79 30 1e 17 0d 31 35 31|32 31 36 30 31 30 30 30  y0...151 21601000\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0770 35 5a 17 0d 33 30 31 32|31 36 30 31 30 30 30 35  5Z..3012 16010005\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0780 5a 30 78 31 0b 30 09 06|03 55 04 06 13 02 49 4c  Z0x1.0.. .U....IL\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0790 31 16 30 14 06 03 55 04|0a 13 0d 53 74 61 72 74  1.0...U. ...Start\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07a0 43 6f 6d 20 4c 74 64 2e|31 29 30 27 06 03 55 04  Com Ltd. 1)0\'..U.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07b0 0b 13 20 53 74 61 72 74|43 6f 6d 20 43 65 72 74  .. Start Com Cert\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07c0 69 66 69 63 61 74 69 6f|6e 20 41 75 74 68 6f 72  ificatio n Author\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07d0 69 74 79 31 26 30 24 06|03 55 04 03 13 1d 53 74  ity1&0$. .U....St\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07e0 61 72 74 43 6f 6d 20 43|6c 61 73 73 20 32 20 49  artCom C lass 2 I\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 07f0 56 20 53 65 72 76 65 72|20 43 41 30 82 01 22 30  V Server  CA0..\"0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0800 0d 06 09 2a 86 48 86 f7|0d 01 01 01 05 00 03 82  ...*.H.. ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0810 01 0f 00 30 82 01 0a 02|82 01 01 00 9c bd bd 82  ...0.... ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0820 3c 7a 13 8e bb cb 83 ac|1e 8e 36 4c 29 f5 ac 2e  <z...... ..6L)...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0830 c9 5d 49 ef 7a 9c cf 13|d2 8b 6c 98 90 8b ad c9  .]I.z... ..l.....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0840 48 b4 eb fd 05 46 8e 15|85 40 18 6a c1 72 a5 c9  H....F.. .@.j.r..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0850 3c 81 34 6a 0e b9 5f b2|46 88 a6 aa 43 c3 75 5e  <.4j.._. F...C.u^\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0860 99 76 72 27 47 09 8a 02|75 61 bc c5 5d d9 65 de  .vr\'G... ua..].e.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0870 a9 22 6d ab 94 93 6b 69|ee 3a 72 d3 c1 80 67 c9  .\"m...ki .:r...g.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0880 5b 0e 22 8f 58 76 7b c5|84 35 c0 1a 34 37 85 75  [.\".Xv{. .5..47.u\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0890 90 22 ad 34 7f 8d d7 13|c1 62 93 ef 44 50 6f e8  .\".4.... .b..DPo.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08a0 17 b5 4b 94 80 02 00 99|e1 a2 d0 23 d9 d4 76 4e  ..K..... ...#..vN\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08b0 f4 26 c8 16 c4 10 dd 8f|84 b1 f7 58 03 59 92 53  .&...... ...X.Y.S\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08c0 1b 6a 8d 9c b0 04 aa 4b|0c 8e 98 00 79 fb 7e 67  .j.....K ....y.~g\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08d0 49 a8 29 31 8b ae 55 ae|19 4a 79 b6 11 a1 7c 7a  I.)1..U. .Jy...|z\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08e0 62 f1 8a 21 4a e4 89 c2|05 98 d1 1b 8b be 60 ba  b..!J... ......`.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 08f0 c4 bf bf a6 2a b9 c7 38|c5 56 90 e1 3b 9b 32 b1  ....*..8 .V..;.2.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0900 b6 e1 c5 61 6d 8b 44 1f|be 78 91 8b 51 d9 f5 2a  ...am.D. .x..Q..*\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0910 2b e2 64 34 bf a1 f3 a1|22 17 ec b7 02 03 01 00  +.d4.... \".......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0920 01 a3 82 01 64 30 82 01|60 30 0e 06 03 55 1d 0f  ....d0.. `0...U..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0930 01 01 ff 04 04 03 02 01|06 30 1d 06 03 55 1d 25  ........ .0...U.%\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0940 04 16 30 14 06 08 2b 06|01 05 05 07 03 02 06 08  ..0...+. ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0950 2b 06 01 05 05 07 03 01|30 12 06 03 55 1d 13 01  +....... 0...U...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0960 01 ff 04 08 30 06 01 01|ff 02 01 00 30 32 06 03  ....0... ....02..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0970 55 1d 1f 04 2b 30 29 30|27 a0 25 a0 23 86 21 68  U...+0)0 \'.%.#.!h\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0980 74 74 70 3a 2f 2f 63 72|6c 2e 73 74 61 72 74 73  ttp://cr l.starts\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0990 73 6c 2e 63 6f 6d 2f 73|66 73 63 61 2e 63 72 6c  sl.com/s fsca.crl\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09a0 30 66 06 08 2b 06 01 05|05 07 01 01 04 5a 30 58  0f..+... .....Z0X\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09b0 30 24 06 08 2b 06 01 05|05 07 30 01 86 18 68 74  0$..+... ..0...ht\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09c0 74 70 3a 2f 2f 6f 63 73|70 2e 73 74 61 72 74 73  tp://ocs p.starts\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09d0 73 6c 2e 63 6f 6d 30 30|06 08 2b 06 01 05 05 07  sl.com00 ..+.....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09e0 30 02 86 24 68 74 74 70|3a 2f 2f 61 69 61 2e 73  0..$http ://aia.s\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 09f0 74 61 72 74 73 73 6c 2e|63 6f 6d 2f 63 65 72 74  tartssl. com/cert\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a00 73 2f 63 61 2e 63 72 74|30 1d 06 03 55 1d 0e 04  s/ca.crt 0...U...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a10 16 04 14 94 de 85 41 2a|a5 d9 45 f6 60 2c 2e 4c  ......A* ..E.`,.L\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a20 93 09 a6 2c 23 7e 3e 30|1f 06 03 55 1d 23 04 18  ...,#~>0 ...U.#..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a30 30 16 80 14 4e 0b ef 1a|a4 40 5b a5 17 69 87 30  0...N... .@[..i.0\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a40 ca 34 68 43 d0 41 ae f2|30 3f 06 03 55 1d 20 04  .4hC.A.. 0?..U. .\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a50 38 30 36 30 34 06 04 55|1d 20 00 30 2c 30 2a 06  80604..U . .0,0*.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a60 08 2b 06 01 05 05 07 02|01 16 1e 68 74 74 70 3a  .+...... ...http:\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a70 2f 2f 77 77 77 2e 73 74|61 72 74 73 73 6c 2e 63  //www.st artssl.c\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a80 6f 6d 2f 70 6f 6c 69 63|79 30 0d 06 09 2a 86 48  om/polic y0...*.H\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0a90 86 f7 0d 01 01 0b 05 00|03 82 02 01 00 b5 ea 43  ........ .......C\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0aa0 2e 66 1f 21 95 5b 20 cf|26 da 22 2c 76 ab 24 90  .f.!.[ . &.\",v.$.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ab0 15 4f ab 3e 0a 92 a9 ec|ab 0d 29 89 c2 90 db 68  .O.>.... ..)....h\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ac0 a8 f0 6a 49 ba 2c 9d 83|2d 7e 4c 44 58 cd 3c 28  ..jI.,.. -~LDX.<(\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ad0 7e 02 b4 1f 09 4d 54 50|96 ba e6 7e d4 69 05 ad  ~....MTP ...~.i..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ae0 ea af 24 53 08 9f 1d c2|27 f9 f1 49 74 d5 77 37  ..$S.... \'..It.w7\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0af0 8c dd be 52 b1 c2 f7 aa|05 24 19 89 77 88 50 ef  ...R.... .$..w.P.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b00 e1 1e bd 54 8b b1 b0 ea|cd 0e 9f e2 b4 7c 3f 68  ...T.... .....|?h\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b10 35 c8 02 45 1d ef 3e 27|01 d9 fa ca ec 18 4e 16  5..E..>\' ......N.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b20 37 ba c6 8c 2c 59 ec 71|3d f2 47 23 af 65 0a ae  7...,Y.q =.G#.e..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b30 f7 3b b2 9e c5 7a a9 fd|5f 1f f2 e1 85 f0 be 0a  .;...z.. _.......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b40 53 7c 56 e9 10 c6 e7 b4|6b 5e 1e 7e 2c dc 54 42  S|V..... k^.~,.TB\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b50 66 76 b4 80 1a 3f 21 d3|34 3e 73 6f 17 df f1 9f  fv...?!. 4>so....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b60 d9 6e 01 86 1c a6 ec b8|f9 00 50 81 be 6c 7a 6a  .n...... ..P..lzj\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b70 e5 be 9b 7f 6c 76 37 13|21 a9 84 8c 23 e1 89 27  ....lv7. !...#..\'\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b80 d1 66 9a 20 95 f8 fd fe|d3 2c 01 60 63 61 26 47  .f. .... .,.`ca&G\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0b90 05 51 8b e8 49 47 6e 1f|3f bf 45 77 7a 1b f7 a3  .Q..IGn. ?.Ewz...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ba0 ae f2 a9 e7 ca db 67 d8|82 21 22 d9 8e 9a 39 81  ......g. .!\"...9.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0bb0 81 1f 2c 89 7a 21 02 5c|64 f3 3c 14 85 8a 2c a8  ..,.z!.\\ d.<...,.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0bc0 6d 22 82 97 e5 cb 4d 2f|77 a9 57 80 f3 20 36 71  m\"....M/ w.W.. 6q\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0bd0 2d a4 ab b8 40 50 15 e0|d0 8f aa 7f ef 8a 54 60  -...@P.. ......T`\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0be0 b4 01 3f 9d b7 6a 77 fa|4a d5 c1 b5 88 1b 7c 89  ..?..jw. J.....|.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0bf0 91 a0 88 78 23 c2 fc e5|a0 7f 4d 4c 8b 38 90 3f  ...x#... ..ML.8.?\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c00 b0 ac 7f 58 5a d7 3b 11|3d 2b 8a be 3d fe 6d ab  ...XZ.;. =+..=.m.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c10 78 33 64 47 21 33 f6 ed|31 89 f5 73 0d 46 3d 4b  x3dG!3.. 1..s.F=K\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c20 78 9c 7c 9a cd 2e 76 2e|b3 f4 f9 0e fb 6a 8d 46  x.|...v. .....j.F\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c30 cd af 6c bd df 07 13 53|59 f4 d2 15 24 ee f5 42  ..l....S Y...$..B\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c40 c9 2a 8f 1b c6 89 3b 74|e3 ca f8 80 b4 97 68 cd  .*....;t ......h.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c50 73 3f 6c 3d 9c cb 08 c3|52 29 c5 71 3c 87 d5 07  s?l=.... R).q<...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c60 02 59 60 87 ca 0d 1e 7a|39 23 d9 cb 7f 29 db 12  .Y`....z 9#...)..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c70 15 f1 1b 2f 51 95 f7 0b|37 f2 7c 88 ea b2 6a 07  .../Q... 7.|...j.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c80 e0 c6 b5 32 0c f2 8c 87|9c 46 78 b2 8c 41 2c e3  ...2.... .Fx..A,.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0c90 c9 0d 5b 57 45 86 0b 52|66 26 9f 90 0d 16 03 03  ..[WE..R f&......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ca0 01 4d 0c 00 01 49 03 00|17 41 04 64 f9 1e 5e 46  .M...I.. .A.d..^F\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0cb0 ba af d2 76 29 b7 7a ea|c7 65 63 94 15 db 78 c4  ...v).z. .ec...x.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0cc0 98 19 d9 02 29 74 fb 4f|02 72 b5 83 bc 98 d2 b0  ....)t.O .r......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0cd0 54 e9 be c1 ed 1a 1f e6|7a 26 72 35 d5 c6 b4 d2  T....... z&r5....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0ce0 67 09 a3 9f 49 e2 20 70|c4 13 5c 06 01 01 00 a0  g...I. p ..\\.....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0cf0 3b 39 fb aa 63 79 70 44|0c 58 57 c4 ba 83 e8 c5  ;9..cypD .XW.....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d00 c9 e0 80 22 93 2e 71 2c|ec 46 d6 bd 36 3f 69 31  ...\"..q, .F..6?i1\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d10 05 80 fa 8d 83 97 fc 89|d1 09 7e cf 3c 73 3f d8  ........ ..~.<s?.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d20 8f f8 35 a0 6d 6f 6b 2e|47 ed 28 eb 2f 7c 81 3c  ..5.mok. G.(./|.<\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d30 d5 25 f5 56 9d aa 4e 27|5f 10 ab 9a e6 44 51 d9  .%.V..N\' _....DQ.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d40 2c b5 ea 29 a4 0c 81 e8|cb 57 70 a6 3d 24 bc 99  ,..).... .Wp.=$..\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d50 97 71 74 58 d6 14 cd dc|59 9e fa 03 05 cd a5 7b  .qtX.... Y......{\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d60 e3 b6 39 ea b2 5d a7 12|0a 5e b3 24 8f 9b 3b eb  ..9..].. .^.$..;.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d70 20 55 2c 55 cf c3 0d f6|6b 64 5c c2 d8 8c 1b 5a   U,U.... kd\\....Z\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d80 26 9c 41 3a c4 86 d3 1a|16 54 90 c2 1e 7d f1 37  &.A:.... .T...}.7\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0d90 8f f5 3f e3 11 36 71 4c|83 ff 62 78 07 09 b0 c4  ..?..6qL ..bx....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0da0 eb 04 b7 00 8a 84 c2 5a|80 4b 21 da 3c 89 87 5b  .......Z .K!.<..[\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0db0 9b c1 01 1d 09 0a d2 cb|2f 89 26 ac 85 23 52 c7  ........ /.&..#R.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0dc0 15 cd 0b 45 5c f1 a4 bb|d9 70 0c 89 b3 99 83 d5  ...E\\... .p......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0dd0 2d 6f 10 02 24 e2 90 ca|21 f2 d2 fd 43 61 3f 2f  -o..$... !...Ca?/\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0de0 6c 9f 9a 89 2b 99 c2 cf|c2 cb 2c 7d 0f 93 3b 16  l...+... ..,}..;.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0df0 03 03 00 04 0e                                   .....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0df5 - <SPACES/NULLS>\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 flush data\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7633] (5 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7633] (5 bytes => 5 (0x5))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 16 03 03 00 46                                   ....F\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7638] (70 bytes => 70 (0x46))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 10 00 00 42 41 04 5b 77|5d d6 c9 1b 24 40 32 9b  ...BA.[w ]...$@2.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0010 21 fd 2e 08 46 e3 c4 3b|fb 78 0f 79 15 cc ac c4  !...F..; .x.y....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0020 15 60 24 4b 4d bf 47 de|50 fe e0 74 32 8d 71 9a  .`$KM.G. P..t2.q.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0030 bb dd c4 98 b2 3c 99 48|43 e8 06 0c 63 9a 91 d8  .....<.H C...c...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0040 f5 05 53 64 9c 57                                ..Sd.W\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 read client key exchange A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7633] (5 bytes => 5 (0x5))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 14 03 03 00 01                                   .....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7638] (1 bytes => 1 (0x1))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 01                                               .\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7633] (5 bytes => 5 (0x5))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 16 03 03 00 40                                   ....@\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: read from 7FDF832F2050 [7FDF832F7638] (64 bytes => 64 (0x40))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 68 9d 3d b0 25 a8 ea 6a|be 2a 2c fb 89 86 fe af  h.=.%..j .*,.....\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0010 1c ca 79 da f7 ab 59 80|14 03 d4 af df cd 7a b8  ..y...Y. ......z.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0020 26 d4 1d 99 fd 9b e7 8b|67 5d be 24 05 4a 54 d2  &....... g].$.JT.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0030 53 c5 e3 e4 62 77 67 8c|6e cf f1 e0 92 f9 df 98  S...bwg. n.......\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 read finished A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write change cipher spec A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 write finished A\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: write to 7FDF832F2050 [7FDF83305070] (75 bytes => 75 (0x4B))\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0000 14 03 03 00 01 01 16 03|03 00 40 16 6f 05 e9 7b  ........ ..@.o..{\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0010 13 8e 1e d9 9c 95 3a f0|68 e1 45 fb 22 8b 34 1b  ......:. h.E.\".4.\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0020 bd 00 1c 7b 6f 72 fd ab|1f 80 71 8d 49 52 80 3f  ...{or.. ..q.IR.?\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0030 ba 9f 41 d7 64 c2 db 78|ca ba c5 c1 0b 19 94 83  ..A.d..x ........\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 0040 4f 55 3a 76 13 1f 9c 98|0b d3 d8                 OU:v.... ...\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: SSL_accept:SSLv3 flush data\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: Anonymous TLS connection established from unknown[85.93.125.67]: TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)\r\nJun 21 15:50:26 mrazitko postfix/smtpd[2609]: 7EEAF206A4DE: client=unknown[85.93.125.67], sasl_method=PLAIN, sasl_username=martin@varak.net\r\nJun 21 15:50:26 mrazitko postfix/cleanup[2625]: 7EEAF206A4DE: message-id=<25C91A83-495A-423F-B6C8-8D8D6358E7EA@varak.net>\r\nJun 21 15:50:26 mrazitko postfix/qmgr[28755]: 7EEAF206A4DE: from=<martin@varak.net>, size=1127, nrcpt=1 (queue active)\r\nJun 21 15:50:27 mrazitko postfix/smtpd[2609]: disconnect from unknown[85.93.125.67]\r\nJun 21 15:50:27 mrazitko postfix/virtual[2629]: 7EEAF206A4DE: to=<postmaster@varak.net>, relay=virtual, delay=1.1, delays=0.81/0.02/0/0.28, dsn=2.0.0, status=sent (delivered to maildir)\r\nJun 21 15:50:27 mrazitko postfix/qmgr[28755]: 7EEAF206A4DE: removed','text','','M5Ktb',0,'d9tpna','85.93.125.67',130,0,0),(70,'pnqsttvf6',3,'martin.varak',NULL,1466517184,0,NULL,'Jun 21 15:52:27 mrazitko postfix/smtpd[2302]: connect from us-smtp-delivery-148.mimecast.com[63.128.21.148]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: setting up TLS connection from us-smtp-delivery-148.mimecast.com[63.128.21.148]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: us-smtp-delivery-148.mimecast.com[63.128.21.148]: TLS cipher list \"aNULL:-aNULL:ALL:+RC4:@STRENGTH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CDC3-SHA:!KRB5-DE5:!CBC3-SHA\"\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:before/accept initialization\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439580] (11 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439580] (11 bytes => 11 (0xB))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 16 03 03 00 e1 01 00 00|dd 03 03                 ........ ...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D343958E] (219 bytes => 219 (0xDB))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 57 69 46 9e 86 70 aa 0a|dc 2c fd ec e5 7e 01 82  WiF..p.. .,...~..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0010 eb 07 70 a2 75 7b 70 e6|79 57 d7 2f af 49 a0 bf  ..p.u{p. yW./.I..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0020 00 00 2c c0 0a c0 14 00|39 00 38 c0 05 c0 0f c0  ..,..... 9.8.....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0030 09 c0 13 00 33 00 32 c0|04 c0 0e c0 08 c0 12 c0  ....3.2. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0040 03 c0 0d 00 35 00 2f 00|0a 00 05 00 04 00 ff 01  ....5./. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0050 00 00 88 00 0a 00 34 00|32 00 17 00 01 00 03 00  ......4. 2.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0060 13 00 15 00 06 00 07 00|09 00 0a 00 18 00 0b 00  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0070 0c 00 19 00 0d 00 0e 00|0f 00 10 00 11 00 02 00  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0080 12 00 04 00 05 00 14 00|08 00 16 00 0b 00 02 01  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0090 00 00 0d 00 1a 00 18 06|03 06 01 05 03 05 01 04  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00a0 03 04 01 03 03 03 01 02|03 02 01 02 02 01 01 00  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00b0 00 00 28 00 26 00 00 23|37 37 2d 39 33 2d 31 39  ..(.&..# 77-93-19\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00c0 34 2d 36 30 2e 73 74 61|74 69 63 2e 6d 61 73 74  4-60.sta tic.mast\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00d0 65 72 69 6e 74 65 72 2e|6e 65 74                 erinter. net\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 read client hello A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write server hello A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write certificate A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write key exchange A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write server done A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: write to 7FB8D33FEB70 [7FB8D34373D0] (3576 bytes => 3576 (0xDF8))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 16 03 03 00 59 02 00 00|55 03 03 57 69 46 9b af  ....Y... U..WiF..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0010 c0 7e 01 20 dc a1 fe bc|67 5e 90 09 03 30 c5 b4  .~. .... g^...0..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0020 6f 4b 7a 80 a0 31 69 47|a2 4b 3c 20 67 fe 0c e8  oKz..1iG .K< g...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0030 c5 49 a5 01 c5 72 60 a5|ec c0 34 8d c1 a4 00 5f  .I...r`. ..4...._\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0040 cf 32 c2 5b cf 56 b5 db|a2 9d f1 c3 c0 14 00 00  .2.[.V.. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0050 0d ff 01 00 01 00 00 0b|00 04 03 00 01 02 16 03  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0060 03 0c 3a 0b 00 0c 36 00|0c 33 00 06 44 30 82 06  ..:...6. .3..D0..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0070 40 30 82 05 28 a0 03 02|01 02 02 10 3a b4 61 3d  @0..(... ....:.a=\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0080 8d dc 9b 17 36 6b 36 4e|36 7d ab 21 30 0d 06 09  ....6k6N 6}.!0...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0090 2a 86 48 86 f7 0d 01 01|0b 05 00 30 78 31 0b 30  *.H..... ...0x1.0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00a0 09 06 03 55 04 06 13 02|49 4c 31 16 30 14 06 03  ...U.... IL1.0...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00b0 55 04 0a 13 0d 53 74 61|72 74 43 6f 6d 20 4c 74  U....Sta rtCom Lt\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00c0 64 2e 31 29 30 27 06 03|55 04 0b 13 20 53 74 61  d.1)0\'.. U... Sta\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00d0 72 74 43 6f 6d 20 43 65|72 74 69 66 69 63 61 74  rtCom Ce rtificat\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00e0 69 6f 6e 20 41 75 74 68|6f 72 69 74 79 31 26 30  ion Auth ority1&0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 00f0 24 06 03 55 04 03 13 1d|53 74 61 72 74 43 6f 6d  $..U.... StartCom\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0100 20 43 6c 61 73 73 20 32|20 49 56 20 53 65 72 76   Class 2  IV Serv\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0110 65 72 20 43 41 30 1e 17|0d 31 36 30 35 32 31 32  er CA0.. .1605212\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0120 30 33 37 30 32 5a 17 0d|31 38 30 35 32 31 32 30  03702Z.. 18052120\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0130 33 37 30 32 5a 30 70 31|0b 30 09 06 03 55 04 06  3702Z0p1 .0...U..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0140 13 02 43 5a 31 1a 30 18|06 03 55 04 08 0c 11 4a  ..CZ1.0. ..U....J\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0150 69 68 6f 6d 6f 72 61 76|73 6b 79 20 4b 72 61 6a  ihomorav sky Kraj\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0160 31 10 30 0e 06 03 55 04|07 0c 07 42 69 6c 6f 76  1.0...U. ...Bilov\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0170 65 63 31 0e 30 0c 06 03|55 04 04 0c 05 56 61 72  ec1.0... U....Var\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0180 61 6b 31 0f 30 0d 06 03|55 04 2a 0c 06 4d 61 72  ak1.0... U.*..Mar\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0190 74 69 6e 31 12 30 10 06|03 55 04 03 0c 09 76 61  tin1.0.. .U....va\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01a0 72 61 6b 2e 6e 65 74 30|82 01 22 30 0d 06 09 2a  rak.net0 ..\"0...*\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01b0 86 48 86 f7 0d 01 01 01|05 00 03 82 01 0f 00 30  .H...... .......0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01c0 82 01 0a 02 82 01 01 00|ee 35 54 2b 9b 4e 1b 27  ........ .5T+.N.\'\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01d0 78 54 bd d7 f5 4f 1e 82|f2 96 ff ae 47 c2 7a 04  xT...O.. ....G.z.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01e0 74 a3 40 3f 70 a2 b0 89|f1 a4 a1 03 53 79 fe 34  t.@?p... ....Sy.4\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 01f0 7a 68 20 e8 ae e7 20 ba|30 08 de 72 b1 b7 31 b1  zh ... . 0..r..1.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0200 73 1c 11 28 b4 af 45 c2|5e 13 a5 5b 3b e3 a9 7f  s..(..E. ^..[;...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0210 ce e9 fd 61 0c ab 6a 0a|3c 56 9b 3d 07 5f b4 c5  ...a..j. <V.=._..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0220 cd 09 fe a8 04 21 a3 6d|c8 79 e7 b6 80 51 c4 bd  .....!.m .y...Q..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0230 50 c7 6b ca 15 ef c4 6b|e6 fc c4 5e cf 31 4b 3d  P.k....k ...^.1K=\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0240 01 bb 04 48 54 9b 23 bd|f7 15 58 81 bc 44 87 55  ...HT.#. ..X..D.U\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0250 20 6e ac e6 32 62 b9 40|9b 71 c2 32 e4 c0 a2 bb   n..2b.@ .q.2....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0260 e1 61 6f aa 01 80 ca 16|b9 16 52 85 c2 73 0f 4c  .ao..... ..R..s.L\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0270 7a 07 97 84 84 05 0f 1c|1f 8e ff 44 5d 7c 00 44  z....... ...D]|.D\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0280 6e 06 64 eb ab b4 88 a5|8a f2 29 09 d7 bd ca f3  n.d..... ..).....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0290 8a 60 b6 9d ea d3 54 2e|9c eb 8d 32 47 93 69 fd  .`....T. ...2G.i.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02a0 46 09 0c 01 77 72 f6 6a|4c ee 8c c2 04 64 81 78  F...wr.j L....d.x\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02b0 d9 1a 68 bf 3c 7f 92 de|27 34 45 20 c3 2f dd 56  ..h.<... \'4E ./.V\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02c0 f2 e7 b4 a4 b2 af 09 95|02 03 01 00 01 a3 82 02  ........ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02d0 cc 30 82 02 c8 30 0e 06|03 55 1d 0f 01 01 ff 04  .0...0.. .U......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02e0 04 03 02 05 a0 30 1d 06|03 55 1d 25 04 16 30 14  .....0.. .U.%..0.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 02f0 06 08 2b 06 01 05 05 07|03 02 06 08 2b 06 01 05  ..+..... ....+...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0300 05 07 03 01 30 09 06 03|55 1d 13 04 02 30 00 30  ....0... U....0.0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0310 1d 06 03 55 1d 0e 04 16|04 14 80 9e 9c 7c 8a 9d  ...U.... .....|..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0320 78 77 ba 84 6d 90 49 10|d1 74 87 36 eb 59 30 1f  xw..m.I. .t.6.Y0.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0330 06 03 55 1d 23 04 18 30|16 80 14 94 de 85 41 2a  ..U.#..0 ......A*\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0340 a5 d9 45 f6 60 2c 2e 4c|93 09 a6 2c 23 7e 3e 30  ..E.`,.L ...,#~>0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0350 6f 06 08 2b 06 01 05 05|07 01 01 04 63 30 61 30  o..+.... ....c0a0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0360 24 06 08 2b 06 01 05 05|07 30 01 86 18 68 74 74  $..+.... .0...htt\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0370 70 3a 2f 2f 6f 63 73 70|2e 73 74 61 72 74 73 73  p://ocsp .startss\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0380 6c 2e 63 6f 6d 30 39 06|08 2b 06 01 05 05 07 30  l.com09. .+.....0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0390 02 86 2d 68 74 74 70 3a|2f 2f 61 69 61 2e 73 74  ..-http: //aia.st\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03a0 61 72 74 73 73 6c 2e 63|6f 6d 2f 63 65 72 74 73  artssl.c om/certs\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03b0 2f 73 63 61 2e 73 65 72|76 65 72 32 2e 63 72 74  /sca.ser ver2.crt\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03c0 30 38 06 03 55 1d 1f 04|31 30 2f 30 2d a0 2b a0  08..U... 10/0-.+.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03d0 29 86 27 68 74 74 70 3a|2f 2f 63 72 6c 2e 73 74  ).\'http: //crl.st\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03e0 61 72 74 73 73 6c 2e 63|6f 6d 2f 73 63 61 2d 73  artssl.c om/sca-s\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 03f0 65 72 76 65 72 32 2e 63|72 6c 30 21 06 03 55 1d  erver2.c rl0!..U.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0400 11 04 1a 30 18 82 09 76|61 72 61 6b 2e 6e 65 74  ...0...v arak.net\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0410 82 0b 2a 2e 76 61 72 61|6b 2e 6e 65 74 30 23 06  ..*.vara k.net0#.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0420 03 55 1d 12 04 1c 30 1a|86 18 68 74 74 70 3a 2f  .U....0. ..http:/\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0430 2f 77 77 77 2e 73 74 61|72 74 73 73 6c 2e 63 6f  /www.sta rtssl.co\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0440 6d 2f 30 51 06 03 55 1d|20 04 4a 30 48 30 08 06  m/0Q..U.  .J0H0..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0450 06 67 81 0c 01 02 03 30|3c 06 0b 2b 06 01 04 01  .g.....0 <..+....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0460 81 b5 37 01 02 05 30 2d|30 2b 06 08 2b 06 01 05  ..7...0- 0+..+...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0470 05 07 02 01 16 1f 68 74|74 70 73 3a 2f 2f 77 77  ......ht tps://ww\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0480 77 2e 73 74 61 72 74 73|73 6c 2e 63 6f 6d 2f 70  w.starts sl.com/p\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0490 6f 6c 69 63 79 30 82 01|04 06 0a 2b 06 01 04 01  olicy0.. ...+....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04a0 d6 79 02 04 02 04 81 f5|04 81 f2 00 f0 00 77 00  .y...... ......w.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04b0 68 f6 98 f8 1f 64 82 be|3a 8c ee b9 28 1d 4c fc  h....d.. :...(.L.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04c0 71 51 5d 67 93 d4 44 d1|0a 67 ac bb 4f 4f fb c4  qQ]g..D. .g..OO..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04d0 00 00 01 54 d5 2a 61 1e|00 00 04 03 00 48 30 46  ...T.*a. .....H0F\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04e0 02 21 00 b5 bc 7c 91 1e|dd d7 e8 e1 f4 d1 05 d3  .!...|.. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 04f0 31 8a 87 e3 72 81 e2 a8|2c 6e d5 3b 25 06 aa a2  1...r... ,n.;%...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0500 f6 3f 9b 02 21 00 84 11|d1 e6 b9 c6 1a f3 45 f1  .?..!... ......E.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0510 d3 dd 0f 85 57 4e 28 e0|ff 0b 08 6d b3 6b 9b 2f  ....WN(. ...m.k./\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0520 f1 e9 73 b6 75 8b 00 75|00 ee 4b bd b7 75 ce 60  ..s.u..u ..K..u.`\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0530 ba e1 42 69 1f ab e1 9e|66 a3 0f 7e 5f b0 72 d8  ..Bi.... f..~_.r.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0540 83 00 c4 7b 89 7a a8 fd|cb 00 00 01 54 d5 2a 64  ...{.z.. ....T.*d\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0550 d4 00 00 04 03 00 46 30|44 02 20 6b c8 eb fa db  ......F0 D. k....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0560 4e 05 5a 70 34 12 c1 ef|2d df a2 45 14 2d 2e 34  N.Zp4... -..E.-.4\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0570 7b 41 1e d3 42 58 d8 c4|14 b9 b4 02 20 54 37 70  {A..BX.. .... T7p\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0580 42 e5 d8 e1 95 0a e8 b3|51 91 ac a0 36 c7 c4 c5  B....... Q...6...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0590 68 8c c7 4a cf b6 d0 ec|f4 ed 9f 70 b4 30 0d 06  h..J.... ...p.0..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05a0 09 2a 86 48 86 f7 0d 01|01 0b 05 00 03 82 01 01  .*.H.... ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05b0 00 5e 60 b1 f4 de 25 05|05 12 36 ed 51 b2 a1 c5  .^`...%. ..6.Q...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05c0 b5 a9 18 03 47 a7 bf 4b|62 93 0f 0b 55 c0 ae cb  ....G..K b...U...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05d0 8b 79 db a7 07 3d 96 ba|4f a4 e2 b5 3a 39 4a f8  .y...=.. O...:9J.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05e0 ac b5 c9 26 82 59 e6 b1|49 6e cd e5 1b 28 ff dc  ...&.Y.. In...(..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 05f0 c6 31 55 70 71 56 66 26|a3 47 8d 9d 43 fc 90 28  .1UpqVf& .G..C..(\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0600 c3 dc 37 86 2e 19 00 18|7c bb 48 17 f1 d5 a3 45  ..7..... |.H....E\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0610 a3 56 5b 70 6a 53 91 0d|73 57 c4 d2 b6 fa 86 fd  .V[pjS.. sW......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0620 0b cc 07 ce 97 ce ad 7c|e6 64 9f 13 f3 e0 ac eb  .......| .d......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0630 d0 e6 d2 a5 9a 15 00 9b|aa 38 22 3a 3e 80 06 82  ........ .8\":>...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0640 a8 3b 3d da 7b 0f de 1c|11 24 14 cb a6 c3 da bb  .;=.{... .$......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0650 d3 b8 e1 0d b3 8f 1f c2|8b 70 f6 06 ad ca 1e 6d  ........ .p.....m\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0660 c0 3f 07 47 17 a1 1b de|ea fd a5 3f 18 79 78 d6  .?.G.... ...?.yx.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0670 b3 be 60 f4 14 a8 b5 b5|ef 77 ca 2b 0a 5e e4 06  ..`..... .w.+.^..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0680 39 69 f9 46 1b 4f 67 81|6e a3 32 02 4c d4 58 ed  9i.F.Og. n.2.L.X.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0690 b2 cd f1 c0 05 97 2c 24|eb aa ec 8a 06 05 94 83  ......,$ ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06a0 fc 9d ec 0c f6 61 b4 40|86 30 d7 bf 8c b6 64 f5  .....a.@ .0....d.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06b0 ec 00 05 e9 30 82 05 e5|30 82 03 cd a0 03 02 01  ....0... 0.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06c0 02 02 10 26 43 bb 32 a1|66 48 7a e1 9d 6c 79 c4  ...&C.2. fHz..ly.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06d0 3f e2 66 30 0d 06 09 2a|86 48 86 f7 0d 01 01 0b  ?.f0...* .H......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06e0 05 00 30 7d 31 0b 30 09|06 03 55 04 06 13 02 49  ..0}1.0. ..U....I\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 06f0 4c 31 16 30 14 06 03 55|04 0a 13 0d 53 74 61 72  L1.0...U ....Star\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0700 74 43 6f 6d 20 4c 74 64|2e 31 2b 30 29 06 03 55  tCom Ltd .1+0)..U\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0710 04 0b 13 22 53 65 63 75|72 65 20 44 69 67 69 74  ...\"Secu re Digit\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0720 61 6c 20 43 65 72 74 69|66 69 63 61 74 65 20 53  al Certi ficate S\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0730 69 67 6e 69 6e 67 31 29|30 27 06 03 55 04 03 13  igning1) 0\'..U...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0740 20 53 74 61 72 74 43 6f|6d 20 43 65 72 74 69 66   StartCo m Certif\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0750 69 63 61 74 69 6f 6e 20|41 75 74 68 6f 72 69 74  ication  Authorit\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0760 79 30 1e 17 0d 31 35 31|32 31 36 30 31 30 30 30  y0...151 21601000\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0770 35 5a 17 0d 33 30 31 32|31 36 30 31 30 30 30 35  5Z..3012 16010005\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0780 5a 30 78 31 0b 30 09 06|03 55 04 06 13 02 49 4c  Z0x1.0.. .U....IL\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0790 31 16 30 14 06 03 55 04|0a 13 0d 53 74 61 72 74  1.0...U. ...Start\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07a0 43 6f 6d 20 4c 74 64 2e|31 29 30 27 06 03 55 04  Com Ltd. 1)0\'..U.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07b0 0b 13 20 53 74 61 72 74|43 6f 6d 20 43 65 72 74  .. Start Com Cert\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07c0 69 66 69 63 61 74 69 6f|6e 20 41 75 74 68 6f 72  ificatio n Author\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07d0 69 74 79 31 26 30 24 06|03 55 04 03 13 1d 53 74  ity1&0$. .U....St\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07e0 61 72 74 43 6f 6d 20 43|6c 61 73 73 20 32 20 49  artCom C lass 2 I\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 07f0 56 20 53 65 72 76 65 72|20 43 41 30 82 01 22 30  V Server  CA0..\"0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0800 0d 06 09 2a 86 48 86 f7|0d 01 01 01 05 00 03 82  ...*.H.. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0810 01 0f 00 30 82 01 0a 02|82 01 01 00 9c bd bd 82  ...0.... ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0820 3c 7a 13 8e bb cb 83 ac|1e 8e 36 4c 29 f5 ac 2e  <z...... ..6L)...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0830 c9 5d 49 ef 7a 9c cf 13|d2 8b 6c 98 90 8b ad c9  .]I.z... ..l.....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0840 48 b4 eb fd 05 46 8e 15|85 40 18 6a c1 72 a5 c9  H....F.. .@.j.r..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0850 3c 81 34 6a 0e b9 5f b2|46 88 a6 aa 43 c3 75 5e  <.4j.._. F...C.u^\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0860 99 76 72 27 47 09 8a 02|75 61 bc c5 5d d9 65 de  .vr\'G... ua..].e.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0870 a9 22 6d ab 94 93 6b 69|ee 3a 72 d3 c1 80 67 c9  .\"m...ki .:r...g.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0880 5b 0e 22 8f 58 76 7b c5|84 35 c0 1a 34 37 85 75  [.\".Xv{. .5..47.u\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0890 90 22 ad 34 7f 8d d7 13|c1 62 93 ef 44 50 6f e8  .\".4.... .b..DPo.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08a0 17 b5 4b 94 80 02 00 99|e1 a2 d0 23 d9 d4 76 4e  ..K..... ...#..vN\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08b0 f4 26 c8 16 c4 10 dd 8f|84 b1 f7 58 03 59 92 53  .&...... ...X.Y.S\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08c0 1b 6a 8d 9c b0 04 aa 4b|0c 8e 98 00 79 fb 7e 67  .j.....K ....y.~g\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08d0 49 a8 29 31 8b ae 55 ae|19 4a 79 b6 11 a1 7c 7a  I.)1..U. .Jy...|z\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08e0 62 f1 8a 21 4a e4 89 c2|05 98 d1 1b 8b be 60 ba  b..!J... ......`.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 08f0 c4 bf bf a6 2a b9 c7 38|c5 56 90 e1 3b 9b 32 b1  ....*..8 .V..;.2.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0900 b6 e1 c5 61 6d 8b 44 1f|be 78 91 8b 51 d9 f5 2a  ...am.D. .x..Q..*\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0910 2b e2 64 34 bf a1 f3 a1|22 17 ec b7 02 03 01 00  +.d4.... \".......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0920 01 a3 82 01 64 30 82 01|60 30 0e 06 03 55 1d 0f  ....d0.. `0...U..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0930 01 01 ff 04 04 03 02 01|06 30 1d 06 03 55 1d 25  ........ .0...U.%\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0940 04 16 30 14 06 08 2b 06|01 05 05 07 03 02 06 08  ..0...+. ........\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0950 2b 06 01 05 05 07 03 01|30 12 06 03 55 1d 13 01  +....... 0...U...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0960 01 ff 04 08 30 06 01 01|ff 02 01 00 30 32 06 03  ....0... ....02..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0970 55 1d 1f 04 2b 30 29 30|27 a0 25 a0 23 86 21 68  U...+0)0 \'.%.#.!h\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0980 74 74 70 3a 2f 2f 63 72|6c 2e 73 74 61 72 74 73  ttp://cr l.starts\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0990 73 6c 2e 63 6f 6d 2f 73|66 73 63 61 2e 63 72 6c  sl.com/s fsca.crl\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09a0 30 66 06 08 2b 06 01 05|05 07 01 01 04 5a 30 58  0f..+... .....Z0X\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09b0 30 24 06 08 2b 06 01 05|05 07 30 01 86 18 68 74  0$..+... ..0...ht\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09c0 74 70 3a 2f 2f 6f 63 73|70 2e 73 74 61 72 74 73  tp://ocs p.starts\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09d0 73 6c 2e 63 6f 6d 30 30|06 08 2b 06 01 05 05 07  sl.com00 ..+.....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09e0 30 02 86 24 68 74 74 70|3a 2f 2f 61 69 61 2e 73  0..$http ://aia.s\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 09f0 74 61 72 74 73 73 6c 2e|63 6f 6d 2f 63 65 72 74  tartssl. com/cert\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a00 73 2f 63 61 2e 63 72 74|30 1d 06 03 55 1d 0e 04  s/ca.crt 0...U...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a10 16 04 14 94 de 85 41 2a|a5 d9 45 f6 60 2c 2e 4c  ......A* ..E.`,.L\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a20 93 09 a6 2c 23 7e 3e 30|1f 06 03 55 1d 23 04 18  ...,#~>0 ...U.#..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a30 30 16 80 14 4e 0b ef 1a|a4 40 5b a5 17 69 87 30  0...N... .@[..i.0\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a40 ca 34 68 43 d0 41 ae f2|30 3f 06 03 55 1d 20 04  .4hC.A.. 0?..U. .\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a50 38 30 36 30 34 06 04 55|1d 20 00 30 2c 30 2a 06  80604..U . .0,0*.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a60 08 2b 06 01 05 05 07 02|01 16 1e 68 74 74 70 3a  .+...... ...http:\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a70 2f 2f 77 77 77 2e 73 74|61 72 74 73 73 6c 2e 63  //www.st artssl.c\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a80 6f 6d 2f 70 6f 6c 69 63|79 30 0d 06 09 2a 86 48  om/polic y0...*.H\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0a90 86 f7 0d 01 01 0b 05 00|03 82 02 01 00 b5 ea 43  ........ .......C\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0aa0 2e 66 1f 21 95 5b 20 cf|26 da 22 2c 76 ab 24 90  .f.!.[ . &.\",v.$.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ab0 15 4f ab 3e 0a 92 a9 ec|ab 0d 29 89 c2 90 db 68  .O.>.... ..)....h\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ac0 a8 f0 6a 49 ba 2c 9d 83|2d 7e 4c 44 58 cd 3c 28  ..jI.,.. -~LDX.<(\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ad0 7e 02 b4 1f 09 4d 54 50|96 ba e6 7e d4 69 05 ad  ~....MTP ...~.i..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ae0 ea af 24 53 08 9f 1d c2|27 f9 f1 49 74 d5 77 37  ..$S.... \'..It.w7\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0af0 8c dd be 52 b1 c2 f7 aa|05 24 19 89 77 88 50 ef  ...R.... .$..w.P.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b00 e1 1e bd 54 8b b1 b0 ea|cd 0e 9f e2 b4 7c 3f 68  ...T.... .....|?h\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b10 35 c8 02 45 1d ef 3e 27|01 d9 fa ca ec 18 4e 16  5..E..>\' ......N.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b20 37 ba c6 8c 2c 59 ec 71|3d f2 47 23 af 65 0a ae  7...,Y.q =.G#.e..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b30 f7 3b b2 9e c5 7a a9 fd|5f 1f f2 e1 85 f0 be 0a  .;...z.. _.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b40 53 7c 56 e9 10 c6 e7 b4|6b 5e 1e 7e 2c dc 54 42  S|V..... k^.~,.TB\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b50 66 76 b4 80 1a 3f 21 d3|34 3e 73 6f 17 df f1 9f  fv...?!. 4>so....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b60 d9 6e 01 86 1c a6 ec b8|f9 00 50 81 be 6c 7a 6a  .n...... ..P..lzj\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b70 e5 be 9b 7f 6c 76 37 13|21 a9 84 8c 23 e1 89 27  ....lv7. !...#..\'\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b80 d1 66 9a 20 95 f8 fd fe|d3 2c 01 60 63 61 26 47  .f. .... .,.`ca&G\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0b90 05 51 8b e8 49 47 6e 1f|3f bf 45 77 7a 1b f7 a3  .Q..IGn. ?.Ewz...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ba0 ae f2 a9 e7 ca db 67 d8|82 21 22 d9 8e 9a 39 81  ......g. .!\"...9.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0bb0 81 1f 2c 89 7a 21 02 5c|64 f3 3c 14 85 8a 2c a8  ..,.z!.\\ d.<...,.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0bc0 6d 22 82 97 e5 cb 4d 2f|77 a9 57 80 f3 20 36 71  m\"....M/ w.W.. 6q\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0bd0 2d a4 ab b8 40 50 15 e0|d0 8f aa 7f ef 8a 54 60  -...@P.. ......T`\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0be0 b4 01 3f 9d b7 6a 77 fa|4a d5 c1 b5 88 1b 7c 89  ..?..jw. J.....|.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0bf0 91 a0 88 78 23 c2 fc e5|a0 7f 4d 4c 8b 38 90 3f  ...x#... ..ML.8.?\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c00 b0 ac 7f 58 5a d7 3b 11|3d 2b 8a be 3d fe 6d ab  ...XZ.;. =+..=.m.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c10 78 33 64 47 21 33 f6 ed|31 89 f5 73 0d 46 3d 4b  x3dG!3.. 1..s.F=K\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c20 78 9c 7c 9a cd 2e 76 2e|b3 f4 f9 0e fb 6a 8d 46  x.|...v. .....j.F\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c30 cd af 6c bd df 07 13 53|59 f4 d2 15 24 ee f5 42  ..l....S Y...$..B\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c40 c9 2a 8f 1b c6 89 3b 74|e3 ca f8 80 b4 97 68 cd  .*....;t ......h.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c50 73 3f 6c 3d 9c cb 08 c3|52 29 c5 71 3c 87 d5 07  s?l=.... R).q<...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c60 02 59 60 87 ca 0d 1e 7a|39 23 d9 cb 7f 29 db 12  .Y`....z 9#...)..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c70 15 f1 1b 2f 51 95 f7 0b|37 f2 7c 88 ea b2 6a 07  .../Q... 7.|...j.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c80 e0 c6 b5 32 0c f2 8c 87|9c 46 78 b2 8c 41 2c e3  ...2.... .Fx..A,.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0c90 c9 0d 5b 57 45 86 0b 52|66 26 9f 90 0d 16 03 03  ..[WE..R f&......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ca0 01 4d 0c 00 01 49 03 00|17 41 04 26 30 ef 3b 3f  .M...I.. .A.&0.;?\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0cb0 96 3b d6 aa 1c bd 96 9f|ed c5 6c ca ba 3b c8 fb  .;...... ..l..;..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0cc0 47 9b b8 8b b6 da 0c 93|0e 98 3a 2f 0e 58 a2 8f  G....... ..:/.X..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0cd0 c0 f1 bc b8 b4 da 82 7e|7b 81 3b 88 00 7d 67 b2  .......~ {.;..}g.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0ce0 1b da 86 85 c0 07 5a 6d|61 08 7f 06 01 01 00 ea  ......Zm a.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0cf0 7d f1 d2 0e 4a 31 7e 21|bb aa f1 01 b8 b8 39 8e  }...J1~! ......9.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d00 a5 f3 f0 72 9d ba b8 a0|96 96 ac 5c 43 c4 70 6e  ...r.... ...\\C.pn\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d10 e1 1b 81 37 43 db 78 36|7e da 15 fb cf c7 d5 04  ...7C.x6 ~.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d20 78 bb 74 35 66 0e 0e 2f|48 fe ef cf 52 83 9a ad  x.t5f../ H...R...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d30 56 e4 ee ad f6 cf 2a 1a|31 bc 0c 4f f1 2e f1 90  V.....*. 1..O....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d40 ac 92 5d 29 cc 0b a4 ca|cf a8 1b fd c2 79 75 5d  ..]).... .....yu]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d50 23 fe a4 40 b2 f0 41 3a|ab 68 8a ac e4 e0 2c db  #..@..A: .h....,.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d60 ba 63 1e df d3 0e 0c 6a|fa 69 18 6f c5 2b 37 2b  .c.....j .i.o.+7+\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d70 86 33 4b 5d c2 e9 33 83|7c 71 c1 b1 a7 1d c1 db  .3K]..3. |q......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d80 97 02 1d e8 13 41 46 6d|d8 6f 2b f4 d9 e4 34 58  .....AFm .o+...4X\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0d90 94 49 0d 86 2c a4 1d 7d|ca 60 5e 64 a6 0b 45 7b  .I..,..} .`^d..E{\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0da0 56 ef 3f ce fb 4e 60 85|47 11 a8 55 cb e8 f1 c4  V.?..N`. G..U....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0db0 25 5f bd b9 fa 2b 74 4e|c2 20 8f db ab 5d 85 96  %_...+tN . ...]..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0dc0 7d ae b7 83 1a d4 f3 82|ea e4 31 c1 6d 81 4d d4  }....... ..1.m.M.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0dd0 7f cf e6 6e e2 bf a5 51|e1 c8 5d fc 20 ce 07 86  ...n...Q ..]. ...\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0de0 41 19 5a e9 28 55 c2 07|bd cc 73 b3 b8 05 b3 16  A.Z.(U.. ..s.....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0df0 03 03 00 04 0e                                   .....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0df5 - <SPACES/NULLS>\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 flush data\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439583] (5 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2967]: initializing the server-side TLS engine\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2967]: connect from unknown[155.133.82.66]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439583] (5 bytes => 5 (0x5))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 16 03 03 00 46                                   ....F\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439588] (70 bytes => 70 (0x46))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 10 00 00 42 41 04 8f 0a|aa ad 9c 3b 89 23 03 24  ...BA... ...;.#.$\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0010 0d 86 99 94 dd 48 41 bc|b2 a8 64 c9 ac 8b c6 1f  .....HA. ..d.....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0020 13 f9 4c 96 31 61 1e 15|c3 9b 56 73 18 4a 9a 1a  ..L.1a.. ..Vs.J..\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0030 8f 84 3f 16 18 93 3a 8d|18 ac 33 83 db 0c cc 4f  ..?...:. ..3....O\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0040 e0 62 bf ae b1 c8                                .b....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 read client key exchange A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439583] (5 bytes => -1 (0xFFFFFFFFFFFFFFFF))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2967]: warning: unknown[155.133.82.66]: SASL LOGIN authentication failed: Invalid authentication mechanism\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2967]: lost connection after AUTH from unknown[155.133.82.66]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2967]: disconnect from unknown[155.133.82.66]\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439583] (5 bytes => 5 (0x5))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 14 03 03 00 01                                   .....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439588] (1 bytes => 1 (0x1))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 01                                               .\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439583] (5 bytes => 5 (0x5))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 16 03 03 00 40                                   ....@\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: read from 7FB8D33FEB70 [7FB8D3439588] (64 bytes => 64 (0x40))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 f6 ab 91 e8 37 30 81 99|82 0b 79 86 77 3a b8 60  ....70.. ..y.w:.`\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0010 6e 2c b6 b3 8e 98 5f e4|4b cc 00 f5 a2 88 86 b3  n,...._. K.......\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0020 d6 78 1f 4a 98 da b2 10|78 cc fa 68 1d f0 e7 2e  .x.J.... x..h....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0030 fb 21 25 bf 5b 1a 52 a5|c7 20 64 22 7f bd ce a2  .!%.[.R. . d\"....\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 read finished A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write change cipher spec A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 write finished A\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: write to 7FB8D33FEB70 [7FB8D34373D0] (75 bytes => 75 (0x4B))\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0000 14 03 03 00 01 01 16 03|03 00 40 4e dc 2d 21 ba  ........ ..@N.-!.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0010 1f d7 0c 13 d9 c9 10 ab|af 47 2a a2 4e d9 4e e3  ........ .G*.N.N.\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0020 0f d7 78 b8 36 b1 ea 1d|df 63 d6 91 66 8d 0a 3b  ..x.6... .c..f..;\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0030 d5 a2 2e 5c ce 99 4e 48|81 e8 d3 0d c5 c9 87 68  ...\\..NH .......h\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: 0040 40 90 94 d6 1f a9 9a 8a|d7 1e 32                 @....... ..2\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: SSL_accept:SSLv3 flush data\r\nJun 21 15:52:27 mrazitko postfix/smtpd[2302]: Anonymous TLS connection established from us-smtp-delivery-148.mimecast.com[63.128.21.148]: TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)\r\nJun 21 15:52:28 mrazitko postfix/smtpd[2302]: warning: restriction `check_policy_service\' after `permit\' is ignored\r\nJun 21 15:52:28 mrazitko postfix/smtpd[2302]: 5371F206A4DE: client=us-smtp-delivery-148.mimecast.com[63.128.21.148]\r\nJun 21 15:52:28 mrazitko postfix/cleanup[2625]: 5371F206A4DE: message-id=<7354F1C17A45B88B.5dd887b5-00bf-4326-81ca-dedff62e7921@mail.outlook.com>\r\nJun 21 15:52:28 mrazitko postfix/qmgr[28755]: 5371F206A4DE: from=<mvarak@netsuite.com>, size=6327, nrcpt=1 (queue active)\r\nJun 21 15:52:28 mrazitko postfix/virtual[2629]: 5371F206A4DE: to=<martin@varak.net>, relay=virtual, delay=0.73, delays=0.73/0/0/0, dsn=2.0.0, status=sent (delivered to maildir)\r\nJun 21 15:52:28 mrazitko postfix/qmgr[28755]: 5371F206A4DE: removed\r\nJun 21 15:52:29 mrazitko postfix/smtpd[2302]: disconnect from us-smtp-delivery-148.mimecast.com[63.128.21.148]','text','','4FYca',0,'ih0jgr','85.93.125.67',138,0,0),(71,'pxjn4ja2h',3,'martin.varak',NULL,1468393700,0,'Test Project Template on ','var rec = nlapiCreateRecord(\'job\', true);\r\nrec.setFieldValue(\'companyname\', \'Test\');\r\nrec.setFieldValue(\'parent\', \'14\');\r\nrec.setFieldValue(\'projecttemplate\', \'34\');\r\nnlapiSubmitRecord(rec);','javascript','','BmOu8',0,'mcca5s','85.93.125.67',115,0,0),(72,'pu1jlrvgb',3,'martin.varak',NULL,1469037101,0,'CURL post product image P','curl -X POST -F image=@010.jpg https://5XT188LXZSCUBLWKXRWWW6CJTAL5TJBP@shop.varak.net/api/images/products/12/','bash','','2a49h',0,'dxjl8v','194.228.20.65',180,0,0),(73,'pujz0ep5u',4,'xsimov01',NULL,1470318827,0,'hledani ve stromu','var del_node\r\n            $.each(classList, function(index, item) {\r\n                if (item != \"temp\" && item != \"node\" && item != \"child\" && item != \"ui-draggable\" && item != \"ui-droppable\" && !regx.test(item)) {\r\n                    del_node = item;\r\n                }\r\n                if (item == \"root\" || item == \"child\") {\r\n                    tipo_n = item;\r\n                }\r\n            });\r\n            node_to_edit = $(\"li.\" + del_node + \":not(\'.temp\')\");','javascript','','5td6w',0,'1wtwia','77.240.179.180',117,0,0),(74,'phqub7mx3',4,'xsimov01',NULL,1470665407,0,'stop handle','$divNode.bind(\"dragstart\", function handleDragStart(event, ui) {\r\n                damageWarning();\r\n                var start_event = ui.helper\r\n                var sourceNode = $(this);\r\n                if (start_event.is(\"div\")) {\r\n                    sourceNode.parentsUntil(\'.node-container\').find(\'*\').filter(\'.node\').droppable(\'disable\');\r\n                } else if (start_event.is(\"li\")) {\r\n                    sourceNode.find(\'*\').filter(\'.node\').droppable(\'disable\');\r\n                }\r\n            });','javascript','','2ZpSk',0,'vmneoy','77.240.179.180',106,0,0),(76,'p6yz82o1p',4,'xsimov01',NULL,1470667583,0,NULL,'// jQuery Plugin\r\n(function($) {\r\n\r\n    var cx = 0;\r\n    var loopflag = false;\r\n    jOrgChart_user_config_options = {};\r\n\r\n    $.fn.jOrgChart = function(options) {\r\n\r\n        var opts = $.extend({}, $.fn.jOrgChart.defaults, options);\r\n        jOrgChart_user_config_options = opts;\r\n        var $appendTo = $(opts.chartElement);\r\n\r\n        // build the tree\r\n        $this = $(this);\r\n        $this.css(\"display\", \"none\");\r\n        var $container = $(\"<div class=\'\" + opts.chartClass + \"\'/>\");\r\n        if ($this.is(\"ul\")) {\r\n            if (opts.rowcolor) {\r\n                //add color to row wise \r\n                $this.find(\"li\").each(function() {\r\n                    classList = $(this).attr(\'class\').split(/\\s+/);\r\n                    $.each(classList, function(index, item) {\r\n                        if (item != \"temp\" && item != \"node\" && item != \"child\" && item != \"ui-draggable\" && item != \"ui-droppable\" && !/^unic\\d+$/i.test(item)) {\r\n                            re = item;\r\n                        }\r\n                    });\r\n                    //if (re != null) {\r\n                    //   $(this).removeClass(re)\r\n                    // }\r\n\r\n                    var col = $(this).parents(\'li\').length;\r\n\r\n                    if (col == 0) {\r\n                        $(this).addClass(\"nrow\");\r\n                    } else if (col == 1) {\r\n                        $(this).addClass(\"firow\");\r\n                    } else if (col == 2) {\r\n                        $(this).addClass(\"serow\");\r\n                    } else if (col == 3) {\r\n                        $(this).addClass(\"throw\");\r\n                    } else if (col == 4) {\r\n                        $(this).addClass(\"forow\");\r\n                    } else if (col == 5) {\r\n                        $(this).addClass(\"firow\");\r\n                    } else if (col == 6) {\r\n                        $(this).addClass(\"sirow\");\r\n                    } else {\r\n                        $(this).addClass(\"norow\");\r\n                    }\r\n\r\n                });\r\n            }\r\n            $this.find(\"li.root\").each(function() {\r\n                buildNode($(this), $container, 0, opts);\r\n            })\r\n        } else if ($this.is(\"li\")) {\r\n            buildNode($this, $container, 0, opts);\r\n        }\r\n        $appendTo.append($container);\r\n\r\n        // add drag and drop if enabled\r\n        if (opts.dragAndDrop) {\r\n            var $divNode = $(\'.node:not(.temp)\').not(\".disabled\");\r\n            var $divNode = $divNode.not($this.find(\".node\"))\r\n            var $nodeParts = $divNode.not(\".child\");\r\n            $divNode.draggable({\r\n                cursor: \'move\',\r\n                distance: 40,\r\n                helper: \'clone\',\r\n                opacity: 0.8,\r\n                revert: \'invalid\',\r\n                revertDuration: 100,\r\n                snap: \'div.node.expanded\',\r\n                snapMode: \'inner\',\r\n                stack: \'div.node\'\r\n            });\r\n\r\n            $nodeParts.droppable({\r\n                accept: \'.node\',\r\n                activeClass: \'drag-active\',\r\n                hoverClass: \'drop-hover\'\r\n            });\r\n\r\n            var $nodeCU = $(\"div.node.child\");\r\n            $nodeCU.droppable({\r\n                accept: \'.child\',\r\n                activeClass: \'drag-active\',\r\n                hoverClass: \'drop-hover\'\r\n            });\r\n\r\n            // Drag start event handler for nodes\r\n\r\n            $divNode.bind(\"dragstart\", function handleDragStart(event, ui) {\r\n                var start_event = ui.helper\r\n                var sourceNode = $(this);\r\n                if (start_event.is(\"div\")) {\r\n                    sourceNode.parentsUntil(\'.node-container\').find(\'*\').filter(\'.node\').droppable(\'disable\');\r\n                } else if (start_event.is(\"li\")) {\r\n                    sourceNode.find(\'*\').filter(\'.node\').droppable(\'disable\');\r\n                }\r\n            });\r\n\r\n\r\n            // Drag stop event handler for nodes\r\n            $divNode.bind(\"dragstop\", function handleDragStop(event, ui) {\r\n\r\n                //refresh side bar\r\n                var sideLi = $(\"#upload-chart\").html();\r\n                $(\"#upload-chart\").empty();\r\n                $(\"#upload-chart\").append(sideLi);\r\n                if ($(\"#upload-chart li:last-child\").hasClass(\"ui-draggable-dragging\")) {\r\n                    $(\"#upload-chart li:last-child\").remove();\r\n                }\r\n\r\n                //remove list from side bar when added to org-chart\r\n                if (removeside_node != \"\") {\r\n                    $(\"#upload-chart #\" + removeside_node).remove();\r\n                    removeside_node = \"\";\r\n                }\r\n\r\n                /* reload the plugin */\r\n                $(opts.chartElement).children().remove();\r\n                $this.jOrgChart(opts);\r\n                cutomdata();\r\n            });\r\n\r\n\r\n            // Drop event handler for nodes\r\n            var removeside_node = \"\"\r\n            $divNode.bind(\"drop\", function handleDropEvent(event, ui) {\r\n                damageWarning(function () {\r\n                    var targetID = $(this).data(\"tree-node\");\r\n                    var targetLi = $this.find(\"li\").filter(function() {\r\n                        return $(this).data(\"tree-node\") === targetID;\r\n                    });\r\n                    var targetUl = targetLi.children(\'ul\');\r\n\r\n                    var sourceID = ui.draggable.data(\"tree-node\");\r\n                    if (sourceID == null) {\r\n                        var lilength = $this.find(\"li\").length;\r\n                        var sourceLi = ui.draggable.clone().addClass(\'unic\' + (lilength + 1));\r\n                        removeside_node = ui.draggable.attr(\"id\");\r\n                        sourceLi.addClass(\"item\");\r\n\r\n                    } else {\r\n                        var sourceLi = $this.find(\"li\").filter(function() {\r\n                            return $(this).data(\"tree-node\") === sourceID;\r\n                        });\r\n                        var sourceUl = sourceLi.parent(\'ul\');\r\n                        //Removes any empty lists\r\n                        if (sourceUl.children().length === 0) {\r\n                            sourceUl.remove();\r\n                        }\r\n                    }\r\n\r\n                    sourceLi.removeClass(\"node\").removeClass(\"ui-draggable\")\r\n\r\n                    if (targetUl.length > 0) {\r\n                        targetUl.append(sourceLi);\r\n                    } else {\r\n                        targetLi.append(\"<ul></ul>\");\r\n                        targetLi.children(\'ul\').append(sourceLi);\r\n                    }\r\n                });\r\n               \r\n\r\n            }); // handleDropEvent\r\n\r\n        } // Drag and drop\r\n\r\n        cutomdata();\r\n    };\r\n\r\n    // Option defaults\r\n    $.fn.jOrgChart.defaults = {\r\n        chartElement: \'body\',\r\n        depth: -1,\r\n        chartClass: \"jOrgChart\",\r\n        dragAndDrop: false,\r\n        expand: false,\r\n        control: false,\r\n        rowcolor: false\r\n    };\r\n\r\n    var nodeCount = 0;\r\n\r\n    function removeNode($node, opts, $nodeDiv) {\r\n        if ($nodeDiv.hasClass(\"temp\")) {\r\n            if (click_flag) {\r\n                $node.remove();\r\n                click_flag = true;\r\n                $(opts.chartElement).children().remove();\r\n                $this.jOrgChart(opts);\r\n            }\r\n\r\n        }\r\n    }\r\n\r\n    // Method that recursively builds the tree\r\n    function buildNode($node, $appendTo, level, opts) {\r\n        var $table = $(\"<table cellpadding=\'0\' cellspacing=\'0\' border=\'0\'/>\");\r\n        var $tbody = $(\"<tbody/>\");\r\n\r\n        // Construct the node container(s)\r\n        var $nodeRow = $(\"<tr/>\").addClass(\"node-cells\");\r\n        var $nodeCell = $(\"<td/>\").addClass(\"node-cell\").attr(\"colspan\", 2);\r\n        var $childNodes = $node.children(\"ul:first\").children(\"li\");\r\n        var $nodeDiv;\r\n\r\n        if ($childNodes.length > 1) {\r\n            $nodeCell.attr(\"colspan\", $childNodes.length * 2);\r\n        }\r\n        // Draw the node\r\n        // Get the contents - any markup except li and ul allowed\r\n        var $nodeContent = $node.clone()\r\n            .children(\"ul,li\")\r\n            .remove()\r\n            .end()\r\n            .html();\r\n\r\n        //Increaments the node count which is used to link the source list and the org chart\r\n        nodeCount++;\r\n\r\n        $node.data(\"tree-node\", nodeCount);\r\n        $nodeDiv = $(\"<div>\").addClass(\"node\")\r\n            .data(\"tree-node\", nodeCount)\r\n            .append($nodeContent);\r\n\r\n\r\n        $nodeDiv.append(\r\n                \"<div class=\'opciones\'>\" +\r\n                \"</div>\")\r\n            .mouseenter(function() {\r\n                if ($(this).find(\"> .details > span\").length == 0) {\r\n                    var duplicate = $(this).find(\"> span.label_node\").clone();\r\n                    $(this).find(\"> .details\").prepend(duplicate);\r\n                }\r\n                $(this).find(\".details\").toggle().parent().css(\"z-index\", \"999\");\r\n            }).mouseleave(function() {\r\n                $(this).find(\".details\").toggle().parent().removeAttr(\"style\");\r\n            });\r\n\r\n        var append_text = \"<li class=\'temp\'></li>\";\r\n        var $list_element = $node.clone()\r\n            .children(\"ul,li\")\r\n            .remove()\r\n            .end();\r\n\r\n\r\n        // Expand and contract nodes\r\n        if (opts.expand) {\r\n            if ($childNodes.length > 0) {\r\n                $nodeDiv.find(\".opciones:eq(0)\").closest(\".node\").append(\"<span class=\'exp-col\'></span>\");\r\n                $nodeDiv.find(\".exp-col\").click(function() {\r\n                    var $this = $(this);\r\n                    var $tr = $this.closest(\"tr\");\r\n                    if ($tr.hasClass(\'contracted\')) {\r\n                        $tr.removeClass(\'contracted\').addClass(\'expanded\');\r\n                        $tr.nextAll(\"tr\").css(\'visibility\', \'\');\r\n                        $node.removeClass(\'collapsed\');\r\n                    } else {\r\n                        $tr.removeClass(\'expanded\').addClass(\'contracted\');\r\n                        $tr.nextAll(\"tr\").css(\'visibility\', \'hidden\');\r\n                        $node.addClass(\'collapsed\');\r\n                    }\r\n                });\r\n            }\r\n        }\r\n\r\n        $nodeCell.append($nodeDiv);\r\n        $nodeRow.append($nodeCell);\r\n        $tbody.append($nodeRow);\r\n\r\n        if ($childNodes.length > 0) {\r\n            // if it can be expanded then change the cursor\r\n            //$nodeDiv.css(\'cursor\',\'n-resize\');\r\n\r\n            // recurse until leaves found (-1) or to the level specified\r\n            if (opts.depth == -1 || (level + 1 < opts.depth)) {\r\n                var $downLineRow = $(\"<tr/>\");\r\n                var $downLineCell = $(\"<td/>\").attr(\"colspan\", $childNodes.length * 2);\r\n                $downLineRow.append($downLineCell);\r\n\r\n                // draw the connecting line from the parent node to the horizontal line\r\n                $downLine = $(\"<div></div>\").addClass(\"line down\");\r\n                $downLineCell.append($downLine);\r\n                $tbody.append($downLineRow);\r\n\r\n                // Draw the horizontal lines\r\n                var $linesRow = $(\"<tr/>\");\r\n                $childNodes.each(function() {\r\n                    var $left = $(\"<td>&nbsp;</td>\").addClass(\"line left top\");\r\n                    var $right = $(\"<td>&nbsp;</td>\").addClass(\"line right top\");\r\n                    $linesRow.append($left).append($right);\r\n                });\r\n\r\n                // horizontal line shouldn\'t extend beyond the first and last child branches\r\n                $linesRow.find(\"td:first\")\r\n                    .removeClass(\"top\")\r\n                    .end()\r\n                    .find(\"td:last\")\r\n                    .removeClass(\"top\");\r\n\r\n                $tbody.append($linesRow);\r\n                var $childNodesRow = $(\"<tr/>\");\r\n                $childNodes.each(function() {\r\n                    var $td = $(\"<td class=\'node-container\'/>\");\r\n                    $td.attr(\"colspan\", 2);\r\n                    // recurse through children lists and items\r\n                    buildNode($(this), $td, level + 1, opts);\r\n                    $childNodesRow.append($td);\r\n                });\r\n\r\n            }\r\n            $tbody.append($childNodesRow);\r\n        }\r\n\r\n        // any classes on the LI element get copied to the relevant node in the tree\r\n        // apart from the special \'collapsed\' class, which collapses the sub-tree at this point\r\n\r\n        if ($node.attr(\'class\') != undefined) {\r\n            var classList = $node.attr(\'class\').split(/\\s+/);\r\n            $.each(classList, function(index, item) {\r\n                if (item == \'collapsed\') {\r\n\r\n                    $nodeRow.nextAll(\'tr\').css(\'visibility\', \'hidden\');\r\n                    $nodeRow.removeClass(\'expanded\');\r\n                    $nodeRow.addClass(\'contracted\');\r\n                } else {\r\n                    $nodeDiv.addClass(item);\r\n                }\r\n            });\r\n        }\r\n        if (opts.control) {\r\n            if (!$nodeDiv.hasClass(\"temp\")) {\r\n                $nodeDiv.find(\".opciones:eq(0)\").append(\"<span class=\'edit\'></span>\");\r\n                $nodeDiv.find(\".opciones:eq(0)\").append(\"<span class=\'add\'></span>\");\r\n                if ($nodeDiv.hasClass(\"child\")) {\r\n                    $nodeDiv.find(\".opciones:eq(0)\").append(\"<span class=\'del\'></span>\");\r\n                }\r\n            } else {\r\n                $nodeDiv.find(\".opciones:eq(0)\").append(\"<span class=\'add\'></span><span class=\'del\'></span>\");\r\n            }\r\n        }\r\n        $table.append($tbody);\r\n        $appendTo.append($table);\r\n\r\n        /* Prevent trees collapsing if a link inside a node is clicked */\r\n        $nodeDiv.children(\'a, span\').click(function(e) {\r\n            e.stopPropagation();\r\n        });\r\n    }\r\n\r\n    function cutomdata(selector) {\r\n        if (loopflag) {\r\n            return;\r\n        }\r\n        loopActive = true;\r\n        var regx = /\\w*(row)/;\r\n\r\n         //-- Delete node\r\n        $(jOrgChart_user_config_options.chartElement).find(\".del\").off(\"click\").on(\"click\", function(e) {\r\n            var nodo = $(this);\r\n\r\n            if (!nodo.parent().parent().hasClass(\"temp\")) {\r\n                var nodeDiv = nodo.parent().parent();\r\n                var cu = nodeDiv.find(\"a\").attr(\"rel\");\r\n                var classList = nodeDiv.attr(\'class\').split(/\\s+/);\r\n                var del_node;\r\n                $.each(classList, function(index, item) {\r\n                    if (item != \"temp\" && item != \"node\" && item != \"child\" && item != \"ui-draggable\" && item != \"ui-droppable\" && !regx.test(item)) {\r\n                        del_node = item;\r\n                    }\r\n                });\r\n                var element = $(\"li.\" + del_node + \":not(\'.temp, #upload-chart li\')\").removeAttr(\"class\").addClass(\"node\").addClass(\"child\");\r\n                //TODO: return IPs\r\n                remChild(element);\r\n                jOrgChart_init();\r\n            }\r\n        });\r\n\r\n        //-- Node editor\r\n        $(jOrgChart_user_config_options.chartElement).find(\".edit\").off(\"click\").on(\"click\", function(e) {\r\n            $(\"#fancy_edit\").show();\r\n            var preValue = $(this).parents(\".node\");\r\n            $(\"#edit_node_name\").val(preValue.find(\".label_node\").html());\r\n            $(\"#edit_node_IP\").val(preValue.find(\".IP_node\").html());\r\n            $(\"#edit_node_detail\").val(preValue.find(\".detail_node\").html());\r\n            var prevIP = $(\"#edit_node_IP\").val(preValue.find(\".IP_node\").html());\r\n            var classList = $(this).parent().parent().attr(\'class\').split(/\\s+/);\r\n            var tipo_n;\r\n            var del_node\r\n            $.each(classList, function(index, item) {\r\n                if (item != \"temp\" && item != \"node\" && item != \"child\" && item != \"ui-draggable\" && item != \"ui-droppable\" && !regx.test(item)) {\r\n                    del_node = item;\r\n                }\r\n                if (item == \"root\" || item == \"child\") {\r\n                    tipo_n = item;\r\n                }\r\n            });\r\n            node_to_edit = $(\"li.\" + del_node + \":not(\'.temp\')\");\r\n            $(\"#edit_node\").off(\"click\").on(\"click\", function(e) {\r\n                e.preventDefault();\r\n                //modify li and refresh tree\r\n                var edit_field = $(\"#edit_node_name\");\r\n                var edit_IP = $(\"#edit_node_IP\");\r\n                var edit_detail = $(\"#edit_node_detail\");\r\n                var textto = edit_field.val();\r\n                var textip = edit_IP.val();\r\n                var textdetail = edit_detail.val();\r\n                node_to_edit.find(\"> .label_node:eq(0)\").text(textto);\r\n                node_to_edit.find(\"> .IP_node:eq(0)\").text(textip);\r\n                node_to_edit.find(\"> .details .detail_node:eq(0)\").text(textdetail);\r\n                node_to_edit.removeClass(\"tier\"+prevIP);\r\n                node_to_edit.addClass(\"tier\"+textip);\r\n                edit_field.val(\"\");\r\n                edit_IP.val(\"\");\r\n                edit_detail.val(\"\");\r\n                $(this).parents(\".fancy_modal\").hide();\r\n                jOrgChart_init();\r\n            });\r\n            $(\"#fancy_edit\").show();\r\n        });\r\n\r\n\r\n        //Add Node\r\n\r\n        $(jOrgChart_user_config_options.chartElement).find(\".add\").off(\"click\").on(\"click\", function() {\r\n            $(\"#fancy_add i\").show();\r\n            var classList = $(this).parent().parent().attr(\'class\').split(/\\s+/);\r\n            var add_to_node;\r\n            $.each(classList, function(index, item) {\r\n                if (item != \"temp\" && item != \"node\" && item != \"child\" && item != \"ui-draggable\" && item != \"ui-droppable\" && !regx.test(item)) {\r\n                    add_to_node = item;\r\n                    return;\r\n                }\r\n            });\r\n            $(\"#add_node\").off(\"click\").on(\"click\", function(e) {\r\n                e.preventDefault();\r\n\r\n                var tipo_nodo = \"\";\r\n                var text_field = $(\"#new_node_name\");\r\n                var textto = text_field.val();\r\n                var text_IP = $(\"#new_node_IP\");\r\n                var textip = text_IP.val();\r\n                var text_detail = $(\"#new_node_detail\");\r\n                textdetail = text_detail.val();\r\n                text_field.val(\"\");\r\n                text_IP.val(\"\");\r\n                text_detail.val(\"\");\r\n                var $node = $(\"li.\" + add_to_node + \":not(\'.temp\')\");\r\n                var childs = $this.find(\"li\").size() + $(\"#upload-chart li\").size() + 1;\r\n                tipo_nodo += \"child unic \" + childs;\r\n                var append_text = \"<li class=\'tier\"+textip+\" \"+ tipo_nodo + \" \' id=\'node\"+childs+\"\'>\";\r\n                //\r\n                append_text += \"<div><button type=\'button\' class=\'btn btn-default btn-warning btn-take\' data-id=node\" + childs + \" data-IPCost=\'\" + textip + \"\' onclick=\'toggleTake(this);\'>Take!</button>\"+\r\n                                \"</div><span class=\'label_node\'>\" + textto + \"</span></br>Price: <span class=\'IP_node\'>\"+ textip +\"</span>\"+\r\n                                \"<div class=\'details\'><p><span class=\'detail_node\'>\" + textdetail + \"</span></p></div>\";\r\n                append_text += \"</li>\";\r\n                if ($node.find(\"ul\").size() == 0) {\r\n                    append_text = \"<ul>\" + append_text + \"</ul>\";\r\n                    $node.append(append_text);\r\n                } else {\r\n                    $node.find(\"ul:eq(0)\").append(append_text);\r\n                }\r\n\r\n                $(this).parents(\".fancy_modal\").hide();\r\n                jOrgChart_init();\r\n            });\r\n            $(\"#fancy_add\").show();\r\n        });\r\n\r\n        $(\".fancy_modal i\").click(function() {\r\n            $(this).parents(\".fancy_modal\").hide();\r\n        })\r\n    }\r\n\r\n    function remChild(removing) {\r\n        if ($(\"#upload-chart\").length) {\r\n            $(\"#upload-chart\").append(removing);\r\n            //flatten value\r\n            $(\"#upload-chart ul li\").each(function() {\r\n                var Orgli = $(this).removeAttr(\"class\").addClass(\"node\").addClass(\"child\").clone();\r\n                $(this).remove();\r\n                $(\"#upload-chart\").append(Orgli);\r\n            });\r\n            $(\"#upload-chart ul\").remove();\r\n            var sideLi = $(\"#upload-chart\").html();\r\n            $(\"#upload-chart\").empty().append(sideLi);\r\n        } else {\r\n            removing.remove();\r\n        }\r\n    }\r\n\r\n    var jOrgChart_init = function() {\r\n        $(jOrgChart_user_config_options.chartElement).empty();\r\n        $this.jOrgChart(jOrgChart_user_config_options);\r\n    }\r\n    \r\n\r\n\r\n})(jQuery);','javascript','','v0rEZ',0,'gcrgrm','77.240.179.180',165,0,0),(77,'p4gd6gph9',3,'martin.varak',NULL,1471785526,0,NULL,'http://www.planetsuzy.org/t755805-p27-beautiful-and-sexy-amateurs.html\r\nhttp://www.planetsuzy.org/t825454-p21-nude-girls-picturesets.html','text','$2a$10$RDVqLRhJ6t.pc6S.RdP64O2cVx11xAm5PTApsWO2NE1pjULPYLnLy','LKvum',1,'uqbalq','194.228.20.99',1,0,0),(78,'pjglf5y6f',3,'martin.varak',NULL,1478591266,0,NULL,'https://uloz.to/!zlCk6xckQLvV/martin-g-r-r-hra-o-truny-2-stret-kralu-rar\r\nhttps://uloz.to/!3KwxSGnbrV1z/martin-g-r-r-hra-o-truny-3-boure-mecu-rar\r\nhttps://uloz.to/!wSQRWXDlzG8k/martin-g-r-r-hra-o-truny-4-hostina-pro-vrany-rar\r\nhttps://uloz.to/!mWYAs8WtGi5n/martin-g-r-r-hra-o-truny-5-tanec-s-draky-rar','javascript','','gdlD2',0,'x0f6fe','213.175.41.130',155,0,0),(79,'pme62ag62',3,'martin.varak',NULL,1493749185,0,'iCalendar event','BEGIN:VEVENT\r\nDTSTART:20170430T183000Z\r\nDTEND:20170430T193000Z\r\nDTSTAMP:20170502T181752Z\r\nUID:lhu9r2klg0ldkjpdsgkdkqo7k8@google.com\r\nCREATED:20170502T181443Z\r\nDESCRIPTION:Udalost!\r\nLAST-MODIFIED:20170502T181443Z\r\nLOCATION:Doma\r\nSEQUENCE:0\r\nSTATUS:CONFIRMED\r\nSUMMARY:Test udalost\r\nTRANSP:OPAQUE\r\nBEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:This is an event reminder\r\nTRIGGER:-P0DT0H10M0S\r\nEND:VALARM\r\nBEGIN:VALARM\r\nACTION:EMAIL\r\nDESCRIPTION:This is an event reminder\r\nSUMMARY:Alarm notification\r\nATTENDEE:mailto:martin.varak@gmail.com\r\nTRIGGER:-P0DT1H0M0S\r\nEND:VALARM\r\nEND:VEVENT','text','','GlR5z',0,'hya3tf','194.228.76.165',67,0,0),(80,'plmzpumgd',3,'martin.varak',NULL,1496813392,0,'QL 6.5x47Lapua,136 Scenar','-------------------------------------------------------------------------------\r\n WARNING: Table produced by not verified Ballistics Calculations! Check results\r\nalways against loading data of current reloading manuals! Input data and results\r\nmay be invalid or wrong! The use of this data for loading ammunition can cause,\r\ndirectly or indirectly, serious injury to personnel and material. No responsibi-\r\n  lity is implied and THE USER MUST ASSUME THE ENTIRE RISK OF USING THE DATA.\r\n               QuickLOAD© V.3.6 Interior BallisticsV.3.6 #532889\r\n            © Copyright 1987-2011 - H.Broemel, Babenhausen, Germany\r\n-------------------------------------------------------------------------------\r\n Case capacity and propellant properties may vary considerably from lot to lot!\r\n\r\n**** Input data:                         Date: 7-VI-2017     Time: 07:28:22\r\nCartridge................. = 6.5 x 47 Lapua\r\nProjectile type........... = .264, 136, Lapua ScenarL GB546 with boattail\r\n\r\nMax.avg.pressure(Piezo CIP)= 4350 bar    Shot start / init pressure = 250 bar\r\nProjectile weight       (g)= 8,81        Groove caliber         (mm)= 6,71\r\nLength of cartridge    (mm)= 68          Length of case         (mm)= 46,65 \r\nCase capacity       (cu.cm)= 3,12        Length of projectile   (mm)= 34,49 \r\nLength of barrel       (mm)= 558,8 \r\n**** Values calculated:\r\nSeating depth          (mm)= 13,12       Volume displaced    (cu.cm)= 0,43 \r\nComb.chamber volume (cu.cm)= 2,69        Projectile travel      (cm)= 52,53 \r\n**** Input data:\r\nPropellant type........... = Vihtavuori N550\r\nCharge weight...........(g)= 2,592       Load density......(g/cu.cm)= 0,964\r\nHeat of Explosion   (kJ/kg)= 4050        Ratio of spec. heats cp/cv =  1,223 \r\nSolid density     (g/cu.cm)=  1,63       Weighting factor...........= 0,50\r\nBurning rate factor Ba(1/s)= 0,465       Pro-/degressivity factor a =  1,53 \r\nBurning limit ......... z1 = 0,5         Combust.Chamber Vb(mł)= 2,68901E-6\r\nFactor.................. b = 1,8         X-S.Area of Bore A(m˛)= 3,459025E-5\r\nBulk density      (g/cu.cm)= 0,940       Projectile mass mp(kg)= 8,813E-3\r\nLoading ratio           (%)= 102.5       Projectile travel x(m)= 5,2527E-1\r\n\r\n**** Results calculated:\r\nMaximum pressure ........ =  4292 bar    Way of projectile at Pmax =  42,5 mm\r\nMuzzle velocity  ......Ve =  843 m/s     Muzzle pressure .......Pe =  694 bar\r\nProject. energy at muzzle =  3132 J      Fraction of powder burnt  = 99,7  %\r\nProjectile travel time from 10% Pmax to muzzle = 1,12 ms\r\n\r\nWARNING: Near Maximum Average Pressure - tolerances can cause dangerous pressures !\r\nReal maximum of pressure inside barrel.\r\nEnd of combustion after the projectile passes muzzle.\r\n\r\n                 Table of progress of computed firing process:\r\n\r\nNR.:          x(mm)         z (%)         v (m/s)       p (bar)       t (ms)\r\n-------------------------------------------------------------------------------\r\n  0              0,00         1,17           0,0          249,9        0,0000\r\n  1              0,00         1,20           0,3          257,6        0,0006\r\n  2              0,00         1,20           0,3          257,6        0,0032\r\n  3              0,00         1,26           0,6          269,2        0,0068\r\n  4              0,01         1,31           1,0          280,8        0,0105\r\n  5              0,01         1,37           1,4          292,4        0,0148\r\n  6              0,02         1,44           1,9          307,7        0,0199\r\n  7              0,03         1,53           2,6          326,9        0,0256\r\n  8              0,05         1,63           3,3          347,9        0,0317\r\n  9              0,08         1,74           4,1          371,7        0,0385\r\n 10              0,11         1,88           5,1          400,2        0,0457\r\n 11              0,15         2,04           6,2          432,2        0,0534\r\n 12              0,21         2,21           7,4          467,9        0,0614\r\n 13              0,28         2,41           8,8          508,8        0,0699\r\n 14              0,36         2,64          10,4          555,0        0,0787\r\n 15              0,46         2,89          12,2          606,2        0,0877\r\n 16              0,59         3,18          14,3          663,3        0,0970\r\n 17              0,73         3,50          16,5          726,3        0,1064\r\n 18              0,90         3,85          19,0          795,9        0,1161\r\n 19              1,10         4,25          21,8          872,2        0,1259\r\n 20              1,33         4,70          24,9          955,7        0,1358\r\n 21              1,60         5,19          28,4         1046,2        0,1458\r\n 22              1,90         5,74          32,1         1144,1        0,1558\r\n 23              2,25         6,34          36,3         1249,0        0,1659\r\n 24              2,64         7,00          40,8         1361,5        0,1761\r\n 25              3,08         7,72          45,8         1481,0        0,1862\r\n 26              3,57         8,51          51,2         1606,9        0,1964\r\n 27              4,12         9,37          57,0         1738,9        0,2065\r\n 28              4,73        10,31          63,3         1876,8        0,2167\r\n 29              5,41        11,32          70,1         2019,4        0,2268\r\n 30              6,15        12,42          77,3         2165,9        0,2369\r\n 31              6,97        13,60          85,1         2315,4        0,2470\r\n 32              7,87        14,86          93,4         2466,7        0,2571\r\n 33              8,85        16,22         102,1         2618,8        0,2671\r\n 34              9,92        17,66         111,4         2770,8        0,2771\r\n 35             11,09        19,20         121,3         2921,1        0,2872\r\n 36             12,36        20,83         131,6         3068,5        0,2972\r\n 37             13,73        22,56         142,4         3211,8        0,3072\r\n 38             15,21        24,39         153,7         3350,3        0,3172\r\n 39             16,81        26,31         165,5         3482,7        0,3272\r\n 40             18,53        28,33         177,7         3607,8        0,3373\r\n 41             20,39        30,44         190,4         3724,9        0,3474\r\n 42             22,37        32,66         203,5         3833,5        0,3574\r\n 43             24,50        34,96         217,0         3933,0        0,3676\r\n 44             26,78        37,36         230,9         4022,6        0,3778\r\n 45             29,21        39,86         245,1         4102,5        0,3880\r\n 46             31,81        42,44         259,7         4172,1        0,3983\r\n 47             34,57        45,11         274,6         4231,3        0,4086\r\n 48             34,98        45,50         276,8         4239,0        0,4101\r\n 49             36,19        46,58         282,8         4255,6        0,4144\r\n 50             37,42        47,65         288,9         4268,9        0,4187\r\n 51             38,66        48,72         294,9         4279,1        0,4230\r\n 52             39,93        49,77         301,0         4286,2        0,4272\r\n 53             41,23        50,81         307,0         4290,5        0,4315\r\n 54             41,88        51,33         310,0         4291,5        0,4336\r\n 55             42,21        51,58         311,5         4291,8        0,4347\r\n 56             42,38        51,71         312,3         4291,9        0,4352\r\n 57             42,46        51,77         312,7         4291,9        0,4355\r\n 58             42,50        51,81         312,8         4291,9        0,4356\r\n 59             42,54        51,84         313,0         4291,9        0,4357\r\n 60             42,58        51,87         313,2         4291,9        0,4359\r\n 61             43,92        52,89         319,3         4290,5        0,4401\r\n 62             45,29        53,90         325,3         4286,5        0,4443\r\n 63             46,68        54,89         331,3         4279,9        0,4486\r\n 64             48,10        55,88         337,4         4270,9        0,4528\r\n 65             49,55        56,86         343,4         4259,6        0,4571\r\n 66             51,03        57,82         349,5         4245,9        0,4613\r\n 67             52,53        58,77         355,5         4230,1        0,4656\r\n 68             54,07        59,72         361,5         4212,2        0,4699\r\n 69             55,64        60,65         367,6         4192,3        0,4742\r\n 70             57,24        61,57         373,6         4170,5        0,4785\r\n 71             58,88        62,48         379,7         4146,7        0,4829\r\n 72             60,55        63,38         385,7         4121,2        0,4872\r\n 73             62,26        64,27         391,7         4094,0        0,4916\r\n 74             64,01        65,14         397,8         4065,1        0,4961\r\n 75             65,79        66,01         403,8         4034,7        0,5005\r\n 76             67,61        66,86         409,9         4002,8        0,5050\r\n 77             69,48        67,71         415,9         3969,4        0,5095\r\n 78             71,39        68,54         421,9         3934,6        0,5141\r\n 79             73,34        69,36         428,0         3898,6        0,5187\r\n 80             75,34        70,18         434,0         3861,3        0,5233\r\n 81             77,39        70,98         440,1         3822,8        0,5280\r\n 82             79,48        71,77         446,1         3783,3        0,5327\r\n 83             81,62        72,55         452,1         3742,6        0,5375\r\n 84             83,82        73,31         458,2         3701,0        0,5423\r\n 85             86,07        74,07         464,2         3658,4        0,5472\r\n 86             88,38        74,82         470,3         3614,9        0,5521\r\n 87             90,74        75,55         476,3         3570,6        0,5571\r\n 88             93,16        76,28         482,3         3525,5        0,5622\r\n 89             95,65        76,99         488,4         3479,7        0,5673\r\n 90             98,19        77,69         494,4         3433,1        0,5725\r\n 91            100,81        78,39         500,5         3386,0        0,5777\r\n 92            103,49        79,07         506,5         3338,3        0,5831\r\n 93            106,24        79,74         512,5         3290,0        0,5885\r\n 94            109,07        80,40         518,6         3241,3        0,5939\r\n 95            111,97        81,04         524,6         3192,1        0,5995\r\n 96            114,95        81,68         530,7         3142,5        0,6052\r\n 97            118,01        82,31         536,7         3092,5        0,6109\r\n 98            121,16        82,92         542,7         3042,3        0,6167\r\n 99            124,39        83,53         548,8         2991,7        0,6226\r\n100            127,71        84,12         554,8         2941,0        0,6287\r\n101            131,13        84,70         560,9         2890,0        0,6348\r\n102            134,65        85,28         566,9         2838,8        0,6410\r\n103            138,26        85,84         572,9         2787,6        0,6474\r\n104            141,99        86,39         579,0         2736,3        0,6538\r\n105            145,82        86,93         585,0         2684,9        0,6604\r\n106            149,76        87,45         591,0         2633,5        0,6671\r\n107            153,83        87,97         597,1         2582,1        0,6740\r\n108            158,01        88,48         603,1         2530,7        0,6809\r\n109            162,33        88,97         609,2         2479,5        0,6881\r\n110            166,77        89,46         615,2         2428,3        0,6953\r\n111            171,36        89,93         621,2         2377,3        0,7027\r\n112            176,09        90,40         627,3         2326,5        0,7103\r\n113            180,97        90,85         633,3         2275,8        0,7181\r\n114            186,00        91,29         639,4         2225,4        0,7260\r\n115            191,20        91,72         645,4         2175,3        0,7341\r\n116            196,57        92,14         651,4         2125,4        0,7423\r\n117            202,11        92,55         657,5         2075,8        0,7508\r\n118            207,84        92,94         663,5         2026,5        0,7595\r\n119            213,76        93,33         669,6         1977,6        0,7684\r\n120            219,89        93,71         675,6         1929,1        0,7775\r\n121            226,22        94,07         681,6         1880,9        0,7868\r\n122            232,78        94,43         687,7         1833,2        0,7964\r\n123            239,56        94,77         693,7         1785,9        0,8062\r\n124            246,59        95,10         699,8         1739,0        0,8163\r\n125            253,86        95,42         705,8         1692,7        0,8266\r\n126            261,40        95,73         711,8         1646,8        0,8373\r\n127            269,22        96,03         717,9         1601,4        0,8482\r\n128            277,33        96,32         723,9         1556,5        0,8595\r\n129            285,74        96,60         730,0         1512,2        0,8710\r\n130            294,47        96,86         736,0         1468,4        0,8829\r\n131            303,53        97,12         742,0         1425,2        0,8952\r\n132            312,95        97,36         748,1         1382,6        0,9078\r\n133            322,73        97,60         754,1         1340,5        0,9209\r\n134            332,91        97,82         760,2         1299,1        0,9343\r\n135            343,49        98,03         766,2         1258,3        0,9482\r\n136            354,50        98,24         772,2         1218,1        0,9625\r\n137            365,97        98,43         778,3         1178,6        0,9773\r\n138            377,92        98,61         784,3         1139,7        0,9926\r\n139            390,37        98,77         790,4         1101,4        1,0084\r\n140            403,35        98,93         796,4         1063,8        1,0247\r\n141            416,89        99,08         802,4         1026,9        1,0417\r\n142            431,03        99,21         808,5          990,7        1,0592\r\n143            445,79        99,34         814,5          955,1        1,0774\r\n144            461,22        99,45         820,6          920,3        1,0963\r\n145            477,36        99,56         826,6          886,1        1,1159\r\n146            494,24        99,65         832,6          852,6        1,1363\r\n147            511,92        99,73         838,7          819,9        1,1574\r\n148            521,07        99,77         841,7          803,8        1,1683\r\n149            523,39        99,78         842,5          799,8        1,1711\r\n150            524,56        99,78         842,8          797,8        1,1724\r\n151            525,14        99,78         843,0          796,8        1,1731\r\n152            525,21        99,78         843,0          796,7        1,1732\r\n153            525,25        99,78         843,1          796,6        1,1733\r\n154            525,27        99,78         843,1          796,6        1,1733\r\n155            525,28        99,78         843,1          796,6        1,1733\r\n\r\nMuzzle exit','text','','YLt2y',0,'c91gfk','194.228.76.165',78,0,0),(81,'p3ryohvtm',3,'martin.varak',NULL,1496861231,0,'7.65Br, D036, 78grs Ares','-------------------------------------------------------------------------------\r\n WARNING: Table produced by not verified Ballistics Calculations! Check results\r\nalways against loading data of current reloading manuals! Input data and results\r\nmay be invalid or wrong! The use of this data for loading ammunition can cause,\r\ndirectly or indirectly, serious injury to personnel and material. No responsibi-\r\n  lity is implied and THE USER MUST ASSUME THE ENTIRE RISK OF USING THE DATA.\r\n               QuickLOAD© V.3.6 Interior BallisticsV.3.6 #532889\r\n            © Copyright 1987-2011 - H.Broemel, Babenhausen, Germany\r\n-------------------------------------------------------------------------------\r\n Case capacity and propellant properties may vary considerably from lot to lot!\r\n\r\n**** Input data:                         Date: 7-VI-2017     Time: 20:44:30\r\nCartridge................. = 7.65 Browning\r\nProjectile type........... = ?? .314, 100, Sellier-Bellot LRN SB31948 with flatbase\r\n\r\nMax.avg.pressure(Piezo CIP)= 1600 bar    Shot start / init pressure = 80 bar\r\nProjectile weight       (g)= 5,05        Groove caliber         (mm)= 7,82\r\nLength of cartridge    (mm)= 24,7        Length of case         (mm)= 17,2 \r\nCase capacity       (cu.cm)= 0,6         Length of projectile   (mm)= 12,4 \r\nLength of barrel       (mm)= 95 \r\n**** Values calculated:\r\nSeating depth          (mm)= 4,9         Volume displaced    (cu.cm)= 0,24 \r\nComb.chamber volume (cu.cm)= 0,37        Projectile travel      (cm)= 8,27 \r\n**** Input data:\r\nPropellant type........... = Lovex D036\r\nCharge weight...........(g)= 0,279       Load density......(g/cu.cm)= 0,764\r\nHeat of Explosion   (kJ/kg)= 4500        Ratio of spec. heats cp/cv =  1,216 \r\nSolid density     (g/cu.cm)=  1,59       Weighting factor...........= 0,75\r\nBurning rate factor Ba(1/s)= 2,198       Pro-/degressivity factor a =  0,044 \r\nBurning limit ......... z1 = 0,2         Combust.Chamber Vb(mł)= 3,651779E-7\r\nFactor.................. b = 1,1         X-S.Area of Bore A(m˛)= 4,737023E-5\r\nBulk density      (g/cu.cm)= 1,040       Projectile mass mp(kg)= 5,054315E-3\r\nLoading ratio           (%)= 73.5        Projectile travel x(m)= 8,27E-2\r\n\r\n**** Results calculated:\r\nMaximum pressure ........ =  1552 bar    Way of projectile at Pmax =  4,4 mm\r\nMuzzle velocity  ......Ve =  319 m/s     Muzzle pressure .......Pe =  294 bar\r\nProject. energy at muzzle =  257 J       Fraction of powder burnt  = 67,8  %\r\nProjectile travel time from 10% Pmax to muzzle = 0,45 ms\r\n\r\nWARNING: Near Maximum Average Pressure - tolerances can cause dangerous pressures !\r\nReal maximum of pressure inside barrel.\r\nEnd of combustion after the projectile passes muzzle.\r\n\r\n                 Table of progress of computed firing process:\r\n\r\nNR.:          x(mm)         z (%)         v (m/s)       p (bar)       t (ms)\r\n-------------------------------------------------------------------------------\r\n  0              0,00         0,56           0,0           80,0        0,0000\r\n  1              0,00         0,59           0,1           85,2        0,0011\r\n  2              0,00         0,65           0,4           93,0        0,0038\r\n  3              0,00         0,72           0,7          103,3        0,0069\r\n  4              0,01         0,81           1,0          116,2        0,0106\r\n  5              0,01         0,93           1,5          132,9        0,0149\r\n  6              0,02         1,08           2,1          154,2        0,0196\r\n  7              0,03         1,28           2,9          181,0        0,0247\r\n  8              0,05         1,52           3,9          213,7        0,0301\r\n  9              0,08         1,81           5,0          253,3        0,0358\r\n 10              0,11         2,17           6,5          300,8        0,0415\r\n 11              0,15         2,60           8,2          356,4        0,0474\r\n 12              0,21         3,12          10,3          421,0        0,0533\r\n 13              0,28         3,73          12,8          494,4        0,0593\r\n 14              0,36         4,45          15,6          576,3        0,0652\r\n 15              0,46         5,28          19,0          665,8        0,0711\r\n 16              0,59         6,23          22,8          761,8        0,0770\r\n 17              0,73         7,30          27,1          862,2        0,0829\r\n 18              0,90         8,50          31,9          964,8        0,0887\r\n 19              1,10         9,83          37,2         1067,0        0,0945\r\n 20              1,33        11,28          43,0         1165,9        0,1003\r\n 21              1,60        12,86          49,3         1259,0        0,1060\r\n 22              1,90        14,56          56,1         1343,7        0,1118\r\n 23              2,10        15,59          60,3         1388,4        0,1152\r\n 24              2,45        17,27          67,1         1445,9        0,1207\r\n 25              2,82        18,94          73,8         1489,6        0,1259\r\n 26              3,22        20,58          80,6         1520,8        0,1311\r\n 27              3,64        22,21          87,3         1540,6        0,1361\r\n 28              4,09        23,82          94,1         1550,3        0,1411\r\n 29              4,21        24,22          95,8         1551,3        0,1423\r\n 30              4,27        24,42          96,6         1551,5        0,1430\r\n 31              4,33        24,62          97,5         1551,7        0,1436\r\n 32              4,35        24,67          97,7         1551,7        0,1437\r\n 33              4,35        24,70          97,8         1551,7        0,1438\r\n 34              4,36        24,72          97,9         1551,7        0,1439\r\n 35              4,37        24,75          98,0         1551,7        0,1440\r\n 36              4,87        26,33         104,7         1547,5        0,1489\r\n 37              5,41        27,90         111,5         1535,7        0,1539\r\n 38              5,98        29,45         118,3         1517,3        0,1589\r\n 39              6,60        30,99         125,0         1493,0        0,1640\r\n 40              7,27        32,51         131,8         1463,6        0,1692\r\n 41              7,98        34,01         138,5         1429,8        0,1744\r\n 42              8,75        35,49         145,3         1392,3        0,1799\r\n 43              9,57        36,96         152,0         1351,6        0,1854\r\n 44             10,46        38,41         158,8         1308,3        0,1911\r\n 45             11,43        39,84         165,6         1262,9        0,1971\r\n 46             12,46        41,26         172,3         1215,9        0,2032\r\n 47             13,58        42,66         179,1         1167,7        0,2096\r\n 48             14,80        44,04         185,8         1118,6        0,2163\r\n 49             16,11        45,41         192,6         1069,1        0,2232\r\n 50             17,54        46,76         199,3         1019,4        0,2305\r\n 51             19,09        48,09         206,1          969,8        0,2381\r\n 52             20,77        49,40         212,9          920,6        0,2462\r\n 53             22,60        50,70         219,6          871,9        0,2546\r\n 54             24,60        51,98         226,4          824,1        0,2636\r\n 55             26,78        53,25         233,1          777,1        0,2731\r\n 56             29,16        54,50         239,9          731,4        0,2831\r\n 57             31,76        55,73         246,6          686,8        0,2938\r\n 58             34,61        56,94         253,4          643,6        0,3052\r\n 59             37,74        58,14         260,1          601,8        0,3174\r\n 60             41,17        59,32         266,9          561,5        0,3304\r\n 61             44,95        60,48         273,7          522,8        0,3444\r\n 62             49,11        61,63         280,4          485,7        0,3594\r\n 63             53,71        62,76         287,2          450,3        0,3756\r\n 64             58,79        63,87         293,9          416,5        0,3931\r\n 65             64,41        64,97         300,7          384,3        0,4120\r\n 66             70,65        66,05         307,4          353,9        0,4325\r\n 67             77,59        67,11         314,2          325,1        0,4549\r\n 68             81,34        67,63         317,6          311,3        0,4667\r\n 69             82,31        67,76         318,4          307,9        0,4698\r\n 70             82,56        67,80         318,6          307,1        0,4706\r\n 71             82,68        67,81         318,7          306,6        0,4710\r\n 72             82,70        67,81         318,8          306,6        0,4710\r\n 73             82,71        67,82         318,8          306,6        0,4710\r\n\r\nMuzzle exit','text','','ysswd',0,'bz3ufn','194.228.76.165',93,0,0),(82,'pwcqqlojz',3,'martin.varak',NULL,1497691174,0,'QuickLoad prachy','\" 14 [pulver]\"\r\n\"Lovex S011                         \",\"4180\",\"1.2237\",\"1.400\",\"4.5500\",\"-0.3243\",\"0.178\",\"1.0707\",\"0.624\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"13NOV07\"\r\n\"Lovex D032                         \",\"4530\",\"1.2110\",\"1.130\",\"4.1429\",\"0.0000\",\"0.137\",\"1.0765\",\"0.770\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"13NOV07\"\r\n\"Lovex S020                         \",\"4150\",\"1.2249\",\"1.300\",\"2.7500\",\"1.9183\",\"0.310\",\"1.5202\",\"0.640\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"13NOV07\"\r\n\"Lovex D036                         \",\"4500\",\"1.2160\",\"1.590\",\"2.1975\",\"0.0438\",\"0.156\",\"1.0922\",\"1.040\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"05FEB05\"\r\n\"Lovex D037.1                       \",\"4160\",\"1.2300\",\"1.570\",\"1.4180\",\"1.8616\",\"0.286\",\"1.4655\",\"0.992\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"22MAR06\"\r\n\"ReloadSwiss RS 12                  \",\"4020\",\"1.2364\",\"1.600\",\"2.2300\",\"6.2123\",\"0.401\",\"2.4142\",\"0.616\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"RSW_12.jpg\",\"04AUG14\"\r\n\"ReloadSwiss RS 20                  \",\"4100\",\"1.2290\",\"1.520\",\"2.5800\",\"-0.0416\",\"0.570\",\"1.5068\",\"0.617\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"RSW_20.jpg\",\"04AUG14\"\r\n\"ReloadSwiss RS 24                  \",\"4370\",\"1.2277\",\"1.600\",\"1.8000\",\"0.1450\",\"0.295\",\"1.2162\",\"0.825\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"RSW_24.jpg\",\"04AUG14\"\r\n\"Vectan Ba9                         \",\"4040\",\"1.2180\",\"1.600\",\"2.6000\",\"1.0086\",\"0.288\",\"1.3467\",\"0.800\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"07JAN01\"\r\n\"Vihtavuori N310                    \",\"4170\",\"1.2331\",\"1.410\",\"4.7000\",\"1.0000\",\"0.550\",\"1.856\",\"0.535\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"\r\n\"Vihtavuori N320                    \",\"4140\",\"1.2293\",\"1.380\",\"3.5850\",\"1.0290\",\"0.465\",\"1.662\",\"0.540\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"\r\n\"Vihtavuori N32C Tin Star           \",\"3040\",\"1.2354\",\"1.490\",\"3.4631\",\"2.8936\",\"0.513\",\"2.2586\",\"0.459\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"06DEC09\"\r\n\"Vihtavuori N330                    \",\"4140\",\"1.2254\",\"1.390\",\"3.1000\",\"0.5500\",\"0.509\",\"1.615\",\"0.600\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"\r\n\"Vihtavuori N140                    \",\"3720\",\"1.2280\",\"1.600\",\"0.6230\",\"0.9000\",\"0.480\",\"1.6595\",\"0.902\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"16MAR09\"','text','','mWLJM',0,'8r6tet','78.108.150.128',72,0,0),(83,'pqmmy3upo',3,'martin.varak',NULL,1501190742,0,'Hudba interpreti','Abney Park\r\nAdor Dorath\r\nAfter Forever\r\nAgalloch\r\nAina\r\nAlestorm\r\nAmberian Dawn\r\nAmon Amarth\r\nAmorphis\r\nAmorphis - 2013 - Circle\r\nAnathema\r\nAntonio Vivaldi\r\nApocalyptica\r\nArakain\r\nArch Enemy\r\nAsrai\r\nAudioknihy\r\nAvantasia\r\nAvantasia-The Mystery Of Time Deluxe Earbook Edition 2CDS-2013\r\nAvenged Sevenfold\r\nAvenger\r\nAvril Lavigne\r\nAyreon\r\nAyreon vs. Avantasia\r\nBathory\r\nBattlelore\r\nBertha\r\nBlackmore\'s Night\r\nBlack Sabbath\r\nBlind Guardian\r\nBloodbound\r\nBlood Ceremony\r\nBob Marley & The Wailers\r\nCaĂŻna\r\nCaptain Beyond\r\nCathedral\r\nCeltic Frost & Bathory\r\nClawfinger\r\nCovered in Filth\r\nCradle of Filth\r\nCrystal Viper\r\nDamh the Bard\r\nDaniel Landa\r\nDanny Elfman\r\nDeath in June\r\nDelain\r\nDemons and Wizards\r\nDemons & Wizards\r\nDiablo Swing Orchestra\r\nDiabulus In Musica\r\nDisarmonia Mundi\r\nDissolving of Prodigy\r\nDivercia\r\nDivokej Bill\r\nDraconian\r\nDragonForce\r\nDream Theater\r\nEdenbridge\r\nEdguy\r\nElane\r\nElectric Wizard\r\nElectric Wizard-Reverend Bizarre\r\nEluveitie\r\nEmilie Autumn\r\nEnsiferum\r\nEpica\r\nEvanescence\r\nEvansescence\r\nEvergrey\r\nEYEHATEGOD\r\nFjoergyn\r\nGaladriel\r\nGame of Thrones - Ramin Djawadi OST (2011)\r\nGamma Ray\r\nGloryhammer\r\nGMK\r\nHaggard\r\nHammerfall\r\nHayato Matsuo\r\nHelloween\r\nIced Earth\r\nIncoming\r\nInteritus\r\nIron Maiden\r\nIvo Jahelka\r\nIvo Jahelka, Miroslav Palecek\r\nJ.A.R\r\nJudas Priest\r\nKabát\r\nKamelot\r\nKatzenjammer\r\nKingfisher Sky\r\nKirlian Camera\r\nKLV\r\nKorpiklaani\r\nKosheen\r\nKrypteria\r\nKylesa\r\nLacuna Coil\r\nLeaves\' Eyes\r\nLed Zeppelin\r\nLegenda Aurea\r\nLifelover\r\nLindsey Stirling\r\nLittle Dead Bertha\r\nLiv Kristine\r\nLordi\r\nLuca Turilli\'s Rhapsody\r\nLucie\r\nLyriel\r\nMagica\r\nManowar\r\nManu Chao\r\nMayan\r\nMetallica\r\nMike Oldfield\r\nMiles Davis\r\nMiracle of Sound\r\nMoonsorrow\r\nMoonspell\r\nMorÄŤata na ĂştÄ›ku\r\nMortal Love\r\nMusic\r\nNightwish\r\nNIRVANA\r\nNolwenn Leroy\r\nOf Monsters and Men\r\nOmnia\r\nOpium Warlords\r\nOrden Ogan\r\nOrkrist\r\nOrne\r\nOrphaned Land\r\nPagan Spirit\r\nPearl Jam\r\nPenumbra\r\nPink Floyd\r\nPowerwolf\r\nPowerwolf and Dominic G. Joutsen\r\nPsalteria\r\nRage\r\nRammstein\r\nReverend Bizarre\r\nRhapsody\r\nRhapsody of Fire\r\nRhapsody Of Fire\r\nRoss the Boss\r\nSabaton\r\nSalamandra\r\nSamael\r\nSamhain\r\nSaratoga\r\nScorched Earth Orchestra\r\nSilent Stream of Godless Elegy\r\nSirenia\r\nSix Degrees Of Separation\r\nSlayer\r\nSoilwork\r\nSonata Arctica\r\nSoundtracks\r\nSpiritus Mortis\r\nStrašlivá  podĂ­vaná\r\nStratovarius\r\nStream of Passion\r\nSummoning\r\nTarja Turunen\r\nTheatres Des Vampires\r\nThe Beatles\r\nThe Corrs\r\nThe Cranberries\r\nTherion\r\nThe Vision Bleak\r\nTomas Kocko & Orchestr\r\nTrans-Siberian Orchestra\r\nTriddana\r\nTristania\r\nTrobar de morte\r\nTurisas\r\nTwilight Force\r\nTĂ˝r\r\nĂšspÄ›ch\r\nVan Canto\r\nVarious\r\nVisions Of Atlantis\r\nWardruna\r\nWarlock\r\nWithin Temptation\r\nwohnout\r\nWohnout - ALL\r\nWolfchant\r\nXandria\r\nYasushi Ishii','text','','6chpW',0,'ndwpii','194.228.76.198',47,0,0),(85,'pjiuar1xx',3,'martin.varak',NULL,1504187605,0,NULL,'[Sat May 20 05:57:20 2017]\r\nUID: waritko, M78924551 is not prime. Res64: 7C8DBB6E2F1C69C4. We8: 0A2E9352,69005717,00000000, AID: BF41717D5520E778473CA4D1C28A0507\r\n[Sat May 20 16:55:39 2017]\r\nUID: waritko, M78924211 is not prime. Res64: 555DEEF51924BDC3. We8: D1BBC829,74948108,00000000, AID: E5A00F206940C502F77941DDB3EB8302\r\n[Wed Jun 14 06:23:03 2017]\r\nUID: waritko, M78924553 is not prime. Res64: 965E74AB4C935078. We8: 40278DF9,47727421,00000000, AID: F86A9836955FBC6EC1DC97F39324B4AB\r\n[Thu Jun 15 01:35:21 2017]\r\nUID: waritko, M78924259 is not prime. Res64: 1C10FF93A11845FA. We8: 1E39CB96,7275342,00000000, AID: A2ED511B7BAF57B37A1A28C17F563C63\r\n[Mon Jul 10 15:28:00 2017]\r\nUID: waritko, M78924673 is not prime. Res64: 10099B0E2AC819E4. We8: 9D42486E,13507061,00000000, AID: 296BFA60BEBF4DF58E4ABAAA341CB5B9\r\n[Tue Jul 11 19:22:22 2017]\r\nUID: waritko, M78924343 is not prime. Res64: E1D76D00E6F1C1A6. We8: 69404BD0,71342463,00000000, AID: A925F341FBB511B358A57A3B80DFC990\r\n[Mon Aug  7 10:34:57 2017]\r\nUID: waritko, M78924709 is not prime. Res64: 771E942E9DD4D472. We8: BE3F2692,69679011,00000000, AID: BD3880C5766081931EB7603DDB21A1CE\r\n[Wed Aug  9 04:19:56 2017]\r\nUID: waritko, M78924403 is not prime. Res64: 37D935962CE94A6B. We8: CDCB3A6A,71843334,00000000, AID: 50FD465B28E7C206BCFC90274B9C9BE7','text','','gZ8Cj',1,'cdrztx','213.175.41.130',1,0,0),(86,'porvxp3fq',3,'martin.varak',NULL,1516786065,0,'vybor muzikoterapie','INSERT INTO `users` (`id`, `email`, `clear`, `name`, `uid`, `gid`, `homedir`, `maildir`, `quota`, `postfix`, `crypt`) VALUES\r\n(42,	\'vybor@muzikoterapie.art\',	\'eacmVYBOR\',	\'vybor@muzikoterapie.art\',	8,	8,	\'/var/spool/mail/\',	\'var/spool/mail/muzikoterapie.art/vybor/\',	\'\',	\'y\',	\'{SHA512-CRYPT}$6$rounds=9123$jR7LcNYn/MaQ.f6u$UarIIqKmVGh.gcESOHMmiAxq4cfiZpeQmAqZdWTSN6qYCbzvb/k2Cqx8oESJNcrK5kfPFUVfXnpYAMBYsbwse.\');','sql','$2a$10$IZ9mfJ7fgwIEGaaBeUcI6OyrIKin0sdOltHNvbhbXWksbfZIwjd7K','3NULN',1,'affr6n','213.175.41.130',1,0,0),(87,'p49mbjiyf',3,'martin.varak',NULL,1518618595,0,'Parse Practiscore','package com.netledger.app.accounting.transactions;\r\n\r\nimport com.fasterxml.jackson.databind.ObjectMapper;\r\nimport com.fasterxml.jackson.databind.SerializationFeature;\r\nimport org.junit.Test;\r\n\r\nimport java.math.BigDecimal;\r\n\r\n/**\r\n * TODO: Enter a paragraph that summarizes what the class does and why someone might want to utilize it\r\n * <p>\r\n * <p>Copyright © 2000-2018, NetSuite, Inc.</p>\r\n *\r\n * @author mvarak\r\n * @version 2018.1\r\n * @since 2/14/2018\r\n */\r\npublic class ScoreTest\r\n{\r\n	private static final ObjectMapper objectMapper;\r\n	//private static final com.fasterxml.jackson.dataformat.xml.XmlMapper xmlMapper;\r\n\r\n	static\r\n	{\r\n		objectMapper = new ObjectMapper();\r\n		objectMapper.enable(SerializationFeature.INDENT_OUTPUT);\r\n\r\n//		JacksonXmlModule module = new JacksonXmlModule();\r\n//		module.setDefaultUseWrapper(true);\r\n//		xmlMapper = new XmlMapper(module);\r\n//		xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);\r\n	}\r\n\r\n	private static String text1 = \"Bednář, Jan (P/Min)\\n\"\r\n			+ \"Stage: Stage 1\\n\"\r\n			+ \"2018-02-10 14:40 (current)\\n\"\r\n			+ \"\\n\"\r\n			+ \"A:     4\\n\"\r\n			+ \"C:     1\\n\"\r\n			+ \"D:     0\\n\"\r\n			+ \"M:     0\\n\"\r\n			+ \"NS:    0\\n\"\r\n			+ \"Proc:  3\\n\"\r\n			+ \"  Krytí  3\\n\"\r\n			+ \"Time:  22.72\\n\"\r\n			+ \"\\n\"\r\n			+ \"HF:    0.0000\\n\";\r\n\r\n	private static String text2 = \"Kubíček, Radek (S/Min)\\n\"\r\n			+ \"Stage: 5: Bob Vogel Drill\\n\"\r\n			+ \"2018-01-12 12:55 (current)\\n\"\r\n			+ \"\\n\"\r\n			+ \"A:     8\\n\"\r\n			+ \"C:     7\\n\"\r\n			+ \"D:     3\\n\"\r\n			+ \"M:     0\\n\"\r\n			+ \"Proc:  0\\n\"\r\n			+ \"Time:  31.26\\n\"\r\n			+ \"\\n\"\r\n			+ \"HF:    2.0473\\n\";\r\n\r\n	@Test\r\n	public void testText1() throws Exception\r\n	{\r\n		parseText(text1);\r\n		String result = serialize(parseText(text1), \"json\");\r\n	}\r\n\r\n	@Test\r\n	public void testText2() throws Exception\r\n	{\r\n		parseText(text2);\r\n		String result = serialize(parseText(text2), \"json\");\r\n	}\r\n\r\n	private PractiScoreResult parseText(String text)\r\n	{\r\n		PractiScoreResult result = new PractiScoreResult();\r\n		String[] lines = text.split(\"\\\\n\");\r\n		result.shooterName = lines[0].split(\" \\\\(\")[0];\r\n		if(lines[1].substring(7).startsWith(\"Stage \"))\r\n		{\r\n			result.stageNo = Integer.parseInt(lines[1].substring(13));\r\n		}\r\n		else\r\n		{\r\n			result.stageNo = Integer.parseInt(lines[1].substring(7).split(\":\")[0]);\r\n		}\r\n		result.dateTime = lines[2].substring(0, 16);\r\n		for (String line : lines)\r\n		{\r\n			if(line.startsWith(\"A:\"))\r\n				result.alpha = Integer.parseInt(line.substring(3).trim());\r\n			else if(line.startsWith(\"C:\"))\r\n				result.charlie = Integer.parseInt(line.substring(3).trim());\r\n			else if(line.startsWith(\"D:\"))\r\n				result.delta = Integer.parseInt(line.substring(3).trim());\r\n			else if(line.startsWith(\"M:\"))\r\n				result.miss = Integer.parseInt(line.substring(3).trim());\r\n			else if(line.startsWith(\"NS:\"))\r\n				result.noshoot = Integer.parseInt(line.substring(3).trim());\r\n			else if(line.startsWith(\"Proc:\"))\r\n				result.proc = Integer.parseInt(line.substring(5).trim());\r\n			else if(line.startsWith(\"Time:\"))\r\n				result.time = new BigDecimal(line.substring(5).trim());\r\n			else if(line.startsWith(\"HF:\"))\r\n				result.hitFactor = new BigDecimal(line.substring(3).trim());\r\n\r\n\r\n		}\r\n\r\n		return result;\r\n	}\r\n\r\n	private String serialize(Object data, String type) throws Exception\r\n	{\r\n		if(type.equals(\"json\"))\r\n			return objectMapper.writeValueAsString(data);\r\n		return \"\";\r\n	}\r\n\r\n	class PractiScoreResult\r\n	{\r\n		public int getAlpha()\r\n		{\r\n			return alpha;\r\n		}\r\n\r\n		public void setAlpha(int alpha)\r\n		{\r\n			this.alpha = alpha;\r\n		}\r\n\r\n		public int getCharlie()\r\n		{\r\n			return charlie;\r\n		}\r\n\r\n		public void setCharlie(int charlie)\r\n		{\r\n			this.charlie = charlie;\r\n		}\r\n\r\n		public int getDelta()\r\n		{\r\n			return delta;\r\n		}\r\n\r\n		public void setDelta(int delta)\r\n		{\r\n			this.delta = delta;\r\n		}\r\n\r\n		public int getMiss()\r\n		{\r\n			return miss;\r\n		}\r\n\r\n		public void setMiss(int miss)\r\n		{\r\n			this.miss = miss;\r\n		}\r\n\r\n		public int getNoshoot()\r\n		{\r\n			return noshoot;\r\n		}\r\n\r\n		public void setNoshoot(int noshoot)\r\n		{\r\n			this.noshoot = noshoot;\r\n		}\r\n\r\n		public int getProc()\r\n		{\r\n			return proc;\r\n		}\r\n\r\n		public void setProc(int proc)\r\n		{\r\n			this.proc = proc;\r\n		}\r\n\r\n		public BigDecimal getTime()\r\n		{\r\n			return time;\r\n		}\r\n\r\n		public void setTime(BigDecimal time)\r\n		{\r\n			this.time = time;\r\n		}\r\n\r\n		public BigDecimal getHitFactor()\r\n		{\r\n			return hitFactor;\r\n		}\r\n\r\n		public void setHitFactor(BigDecimal hitFactor)\r\n		{\r\n			this.hitFactor = hitFactor;\r\n		}\r\n\r\n		public String getDateTime()\r\n		{\r\n			return dateTime;\r\n		}\r\n\r\n		public void setDateTime(String dateTime)\r\n		{\r\n			this.dateTime = dateTime;\r\n		}\r\n\r\n		public String getShooterName()\r\n		{\r\n			return shooterName;\r\n		}\r\n\r\n		public void setShooterName(String shooterName)\r\n		{\r\n			this.shooterName = shooterName;\r\n		}\r\n\r\n		public int getStageNo()\r\n		{\r\n			return stageNo;\r\n		}\r\n\r\n		public void setStageNo(int stageNo)\r\n		{\r\n			this.stageNo = stageNo;\r\n		}\r\n\r\n		private int alpha;\r\n		private int charlie;\r\n		private int delta;\r\n		private int miss;\r\n		private int noshoot;\r\n		private int proc;\r\n		private BigDecimal time;\r\n		private BigDecimal hitFactor;\r\n		private String dateTime;\r\n		private String shooterName;\r\n		private int stageNo;\r\n	}\r\n}','java','','BqibT',0,'m8wrne','213.175.41.130',40,0,0),(88,'pgoat8snt',3,'martin.varak',NULL,1519821969,0,'SHA-512 hash string','private static String getHashCodeFromString(String str) throws NoSuchAlgorithmException {\r\n    MessageDigest md = MessageDigest.getInstance(\"SHA-512);\r\n    md.update(str.getBytes());\r\n    byte byteData[] = md.digest();\r\n\r\n    //convert the byte to hex format method 1\r\n    StringBuffer hashCodeBuffer = new StringBuffer();\r\n    for (byte b : md.digest()) \r\n	hashCodeBuffer.append(Integer.toHexString(0xff & b));\r\n    return hashCodeBuffer.toString();\r\n}','java','','g1o2D',0,'ip3qpd','213.175.41.130',28,0,0),(89,'pw99egfex',3,'martin.varak',NULL,1519821998,0,'SHA-512 hash string','private static String getHashCodeFromString(String str) throws NoSuchAlgorithmException \r\n{\r\n    MessageDigest md = MessageDigest.getInstance(\"SHA-512\");\r\n    md.update(str.getBytes());\r\n    byte byteData[] = md.digest();\r\n\r\n    //convert the byte to hex format method 1\r\n    StringBuffer hashCodeBuffer = new StringBuffer();\r\n    for (byte b : md.digest()) \r\n	hashCodeBuffer.append(Integer.toHexString(0xff & b));\r\n    return hashCodeBuffer.toString();\r\n}','java','','kUVhu',0,'sjg5kb','213.175.41.130',28,0,0),(90,'plddrjssj',3,'martin.varak',NULL,1533832835,0,'WH40K World Resource Mani','{\r\n    civilized: {\r\n        consumption: {\r\n            food: 10,\r\n            consumerGoods: 5\r\n        },\r\n        generation: {\r\n            credit: 200000,\r\n            population: 0.2\r\n        }\r\n    },\r\n    feudal: {\r\n        consumption: {\r\n            food: 5\r\n        },\r\n        generation: {\r\n            food: 6,\r\n            credit: 10000,\r\n            population: 0.1\r\n        }\r\n    },\r\n    \r\n    template: {\r\n        consumption: {\r\n            food: 0,\r\n        },\r\n        generation: {\r\n            population: 0.0,\r\n        },\r\n        generationOneTime: {\r\n            imperialInfluence: 0.0\r\n        }\r\n    }\r\n}','javascript','','0vesi',0,'q8pbto','194.228.76.116',15,0,0),(91,'pfifrhv1m',3,'martin.varak',NULL,1537516116,0,'hosts file','# Copyright (c) 1993-2009 Microsoft Corp.\r\n#\r\n# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.\r\n#\r\n# This file contains the mappings of IP addresses to host names. Each\r\n# entry should be kept on an individual line. The IP address should\r\n# be placed in the first column followed by the corresponding host name.\r\n# The IP address and the host name should be separated by at least one\r\n# space.\r\n#\r\n# Additionally, comments (such as these) may be inserted on individual\r\n# lines or following the machine name denoted by a \'#\' symbol.\r\n#\r\n# For example:\r\n#\r\n#      102.54.94.97     rhino.acme.com          # source server\r\n#       38.25.63.10     x.acme.com              # x client host\r\n\r\n# localhost name resolution is handled within DNS itself.\r\n#	127.0.0.1       localhost\r\n#	::1             localhost\r\n\r\n#127.0.0.1 system.f.netsuite.com\r\n#127.0.0.1 system.na1.f.netsuite.com\r\n#127.0.0.1 system.eu1.f.netsuite.com\r\n#127.0.0.1 system.snap.netsuite.com\r\n#77.93.194.60 system.f.netsuite.com\r\n#77.93.194.60 system.f.netsuite.com\r\n\r\n\r\n#77.93.194.60 knihkupectvi-monami.cz\r\n#77.93.194.60 www.knihkupectvi-monami.cz\r\n#77.93.194.60 drilly.varak.net vserver.varak.net suiteshooters.eu www.suiteshooters.eu\r\n77.93.194.60 zbranekvalitne.cz los.zbranekvalitne.cz subsonic.varak.net\r\n\r\n\r\n192.168.57.91 runbox.corp.netsuite.com runbox\r\n192.168.57.92 runbox-w.corp.netsuite.com runbox-w\r\n\r\n172.25.177.45 mvarak-work2 mvarak-work2.corp.netledger.com mvarak-runbox.corp.netsuite.com mvarak-runbox2.corp.netsuite.com mvarak-runbox3.corp.netsuite.com mvarak-luameter.corp.netledger.com mvarak-runcert.corp.netsuite.com mvarak-runcert2.corp.netsuite.com mvarak-runcert3.corp.netsuite.com\r\n\r\n\r\n\r\n192.168.253.129 util util.corp.netsuite.com\r\n192.168.253.127 devbox.corp.netsuite.com devbox.corp.netledger.com devbox\r\n192.168.253.126 devbox2.corp.netsuite.com devbox2.corp.netledger.com devbox2\r\n192.168.253.125 devbox-nspsa-goddard.corp.netsuite.com devbox-nspsa-goddard.corp.netledger.com devbox-nspsa-goddard\r\n192.168.253.10 devbox-faraday.corp.netsuite.com devbox-faraday.corp.netledger.com devbox-faraday\r\n192.168.253.9 devbox-davinci.corp.netsuite.com devbox-davinci.corp.netledger.com devbox-davinci\r\n\r\n192.168.253.124 devbox-nspsa.corp.netsuite.com devbox-nspsa.corp.netledger.com devbox-nspsa\r\n192.168.253.123 devbox-nspsa-e.corp.netsuite.com devbox-nspsa-e.corp.netledger.com devbox-nspsa-e\r\n192.168.253.122 devbox-nspsa-g.corp.netsuite.com devbox-nspsa-g.corp.netledger.com devbox-nspsa-g\r\n192.168.253.121 devbox-nspsa-h.corp.netsuite.com devbox-nspsa-h.corp.netledger.com devbox-nspsa-h\r\n192.168.253.120 devbox-nspsa-i.corp.netsuite.com devbox-nspsa-i.corp.netledger.com devbox-nspsa-i\r\n192.168.253.117 devbox-nspsa-c.corp.netsuite.com devbox-nspsa-c.corp.netledger.com devbox-nspsa-c\r\n192.168.253.116 devbox-nspsa-l.corp.netsuite.com devbox-nspsa-l.corp.netledger.com devbox-nspsa-l\r\n192.168.253.115 devbox-nspsa-f.corp.netsuite.com devbox-nspsa-f.corp.netledger.com devbox-nspsa-f\r\n192.168.253.114 devbox-mob-a.corp.netsuite.com devbox-mob-a.corp.netledger.com devbox-mob-a\r\n192.168.253.113 devbox-nspsa-b.corp.netsuite.com devbox-nspsa-b.corp.netledger.com devbox-nspsa-b\r\n192.168.253.112 devbox-nspsa-q.corp.netsuite.com devbox-nspsa-q.corp.netledger.com devbox-nspsa-q\r\n192.168.253.111 devbox-nspsa-w.corp.netsuite.com devbox-nspsa-w.corp.netledger.com devbox-nspsa-w\r\n192.168.253.110 devbox-nspsa-timesheets.corp.netsuite.com devbox-nspsa-timesheets.corp.netledger.com devbox-nspsa-timesheets\r\n192.168.253.109 devbox-nspsa-m.corp.netsuite.com devbox-nspsa-m.corp.netledger.com devbox-nspsa-m\r\n192.168.253.108 devbox-nspsa-j.corp.netsuite.com devbox-nspsa-j.corp.netledger.com devbox-nspsa-j\r\n192.168.253.107 devbox-nspsa-s.corp.netsuite.com devbox-nspsa-s.corp.netledger.com devbox-nspsa-s\r\n192.168.253.105 devbox-nspsa-expenses.corp.netsuite.com devbox-nspsa-expenses.corp.netledger.com devbox-nspsa-expenses\r\n192.168.253.106 devbox-newui.corp.netsuite.com devbox-newui.corp.netledger.com devbox-newui\r\n192.168.253.65 devbox-dbdump.corp.netsuite.com devbox-dbdump.corp.netledger.com devbox-dbdump\r\n\r\n192.168.253.118 devbox-nspsa-babbage.corp.netsuite.com devbox-nspsa-babbage.corp.netledger.com devbox-nspsa-babbage','text','','Eo3i7',0,'pnpib5','213.175.41.130',48,0,0),(92,'pttgvcoh3',3,'martin.varak',NULL,1537536683,0,'PWD','dkrfvkxhbnyvvnsn','text','','0zCLu',0,'9mkvfu','213.175.41.130',11,0,0),(93,'p346drs3d',3,'martin.varak',NULL,1539117165,0,NULL,'#server {\r\n#       listen 77.93.194.60:80; listen [2a01:430:12b:0:0:0:0:2]:80; listen 127.0.0.1; ## listen for ipv4\r\n#       server_name  www.sadamas.cz;\r\n#\r\n#       location / {\r\n#               root   /www/sadamas.cz/www.sadamas.cz;\r\n#               index  index.html index.htm index.php;\r\n#               autoindex on;\r\n#               autoindex_exact_size off;\r\n#       }\r\n#       location ~ \\.php$ {\r\n#               include fastcgi_params;\r\n#               fastcgi_pass  127.0.0.1:9000;\r\n#               fastcgi_index  index.php;\r\n#               fastcgi_param  SCRIPT_FILENAME    /www/sadamas.cz/www.sadamas.cz$fastcgi_script_name;\r\n#       }\r\n#}\r\nserver {\r\n    listen 77.93.194.60:80; listen [2a01:430:12b:0:0:0:0:2]:80;\r\n    server_name  www.sadamas.cz;\r\n    rewrite ^/(.*) https://www.sadamas.cz$request_uri permanent;\r\n}\r\n\r\nserver {\r\n        listen 77.93.194.60:443 ssl http2; listen [2a01:430:12b:0:0:0:0:2]:443 ssl http2;\r\n        server_name www.sadamas.cz;\r\n\r\n        include ssl_params;\r\nssl_certificate /etc/letsencrypt/live/mail2.varak.net/fullchain.pem; # managed by Certbot\r\nssl_certificate_key /etc/letsencrypt/live/mail2.varak.net/privkey.pem; # managed by Certbot\r\n\r\n\r\n                location / {\r\n                root   /www/sadamas.cz/www.sadamas.cz;\r\n                index  index.html index.htm index.php;\r\n                autoindex on;\r\n                autoindex_exact_size off;\r\n        }\r\n        location ~ \\.php$ {\r\n                include fastcgi_params;\r\n                fastcgi_pass  127.0.0.1:9000;\r\n                fastcgi_index  index.php;\r\n                fastcgi_param  SCRIPT_FILENAME    /www/sadamas.cz/www.sadamas.cz$fastcgi_script_name;\r\n        }\r\n\r\n}\r\n\r\nserver {\r\n    listen 77.93.194.60:80; listen [2a01:430:12b:0:0:0:0:2]:80; listen 127.0.0.1;\r\n    server_name  sadamas.cz;\r\n    return       301 https://www.sadamas.cz$request_uri;\r\n}\r\nserver {\r\n    listen 77.93.194.60:443 ssl http2; listen [2a01:430:12b:0:0:0:0:2]:443 ssl http2;\r\n    server_name  sadamas.cz;\r\n    include ssl_params;\r\nssl_certificate /etc/letsencrypt/live/mail2.varak.net/fullchain.pem; # managed by Certbot\r\nssl_certificate_key /etc/letsencrypt/live/mail2.varak.net/privkey.pem; # managed by Certbot\r\n    return       301 https://www.sadamas.cz$request_uri;\r\n\r\n}\r\n\r\n## EPGP\r\nserver {\r\n    listen 77.93.194.60:80; listen [2a01:430:12b:0:0:0:0:2]:80;\r\n    server_name  epgp.sadamas.cz;\r\n    rewrite ^/(.*) https://epgp.sadamas.cz$request_uri permanent;\r\n}\r\n\r\nserver {\r\n        listen 77.93.194.60:443 ssl http2; listen [2a01:430:12b:0:0:0:0:2]:443 ssl http2;\r\n        server_name epgp.sadamas.cz;\r\n\r\n        include ssl_params;\r\nssl_certificate /etc/letsencrypt/live/mail2.varak.net/fullchain.pem; # managed by Certbot\r\nssl_certificate_key /etc/letsencrypt/live/mail2.varak.net/privkey.pem; # managed by Certbot\r\n\r\n\r\n                location / {\r\n                root   /www/sadamas.cz/epgp.sadamas.cz;\r\n                index  index.html index.htm index.php;\r\n                autoindex on;\r\n                autoindex_exact_size off;\r\n        }\r\n        location ~ \\.php$ {\r\n                include fastcgi_params;\r\n                fastcgi_pass  127.0.0.1:9000;\r\n                fastcgi_index  index.php;\r\n                fastcgi_param  SCRIPT_FILENAME    /www/sadamas.cz/epgp.sadamas.cz$fastcgi_script_name;\r\n        }\r\n\r\n}\r\n\r\n## Calendar\r\nserver {\r\n    listen 77.93.194.60:80; listen [2a01:430:12b:0:0:0:0:2]:80;\r\n    server_name  calendar.sadamas.cz;\r\n    rewrite ^/(.*) https://calendar.sadamas.cz$request_uri permanent;\r\n}\r\n\r\nserver {\r\n        listen 77.93.194.60:443 ssl http2; listen [2a01:430:12b:0:0:0:0:2]:443 ssl http2;\r\n        server_name  calendar.sadamas.cz;\r\n        location / {\r\n          proxy_pass http://localhost:11080;\r\n          proxy_set_header Host $host;\r\n          proxy_set_header    X-Forwarded-Host $host;\r\n          proxy_set_header    X-Forwarded-Server $host;\r\n          proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;\r\n          proxy_set_header    X-Real-IP $remote_addr;\r\n          proxy_redirect      off;\r\n        }\r\n\r\n    include ssl_params;\r\nssl_certificate /etc/letsencrypt/live/mail2.varak.net/fullchain.pem; # managed by Certbot\r\nssl_certificate_key /etc/letsencrypt/live/mail2.varak.net/privkey.pem;\r\n\r\n # managed by Certbot\r\n}\r\n\r\n# server {\r\n#       listen 77.93.194.60:443 ssl http2; listen [2a01:430:12b:0:0:0:0:2]:443 ssl http2;\r\n#       server_name calendar.sadamas.cz;\r\n\r\n#       include ssl_params;\r\n#       ssl_certificate  /etc/nginx/certs/calendar.sadamas.cz.crt;\r\n#     ssl_certificate_key  /etc/nginx/certs/calendar.sadamas.cz.key;\r\n#       root   /www/sadamas.cz/calendar.sadamas.cz;\r\n#               location / {\r\n#               index  index.html index.htm index.php;\r\n#               autoindex on;\r\n#               autoindex_exact_size off;\r\n#               rewrite ^/$ /app/webroot/;\r\n#                 rewrite ^(.*)$ /app/webroot/$1;\r\n#       }\r\n#       location /app/webroot {\r\n#               if (!-e $request_filename){\r\n#                       rewrite ^(.*)$ /index.php;\r\n#               }\r\n#       }\r\n#       location ~ \\.php$ {\r\n#               include fastcgi_params;\r\n#               fastcgi_pass  127.0.0.1:9000;\r\n#               fastcgi_index  index.php;\r\n#               fastcgi_param  SCRIPT_FILENAME    /www/sadamas.cz/calendar.sadamas.cz$fastcgi_script_name;\r\n#       }\r\n# }','nginx','','amVQ4',0,'kcchch','194.228.20.40',17,0,0),(94,'pavjqu41v',3,'martin.varak',NULL,1539703258,0,NULL,'https://eddb.io/station?s=4&m=1194,1265,1533,1192,1245,1244,763,900,938,973,1007,1047,1087,1202,827,869,826,886,1239\r\n\r\nhttps://coriolis.io/outfit/cobra_mk_iii?code=A0p5tcFcldddsdf41b1b2418020l0334B3012i2f.Iw1%2FkA%3D%3D.Aw1%2FkA%3D%3D..EweloBhBGA2GAcICmBDA5gG2SGF9A%3D%3D%3D&bn=My%20Cobra\r\n\r\nhttps://coriolis.io/outfit/diamondback_explorer?code=A0pdtcFilddisdf57l1b1b020l--3303B4v62i2f.Iw18UA%3D%3D.Aw18UA%3D%3D..EweloBhBmUA4QFMCGBzANokICMF9A%3D%3D%3D&bn=DBX','text','','orTkY',0,'m264de','213.175.41.130',15,0,0),(95,'pntw92f2o',3,'martin.varak',NULL,1539867112,0,NULL,'https://eddb.io/station?s=4&m=1194,1265,1533,1192,1245,1244,763,900,938,973,1007,1047,1087,1202,827,869,826,886,1239\r\n\r\nhttps://coriolis.io/outfit/cobra_mk_iii?code=A0p5tcFcldddsdf41b1b2418020l0334B3012i2f.Iw1%2FkA%3D%3D.Aw1%2FkA%3D%3D..EweloBhBGA2GAcICmBDA5gG2SGF9A%3D%3D%3D&bn=My%20Cobra\r\n\r\nhttps://coriolis.io/outfit/diamondback_explorer?code=A0pdtcFilddisdf57l1b1b020l--3303B4v62i2f.Iw18UA%3D%3D.Aw18UA%3D%3D..EweloBhBmUA4QFMCGBzANokICMF9A%3D%3D%3D&bn=DBX\r\n\r\nhttps://coriolis.io/outfit/diamondback_explorer?code=A0p0tdFflddisdf5---02---330p43v62i2f.AwRj4y1Eg%3D%3D%3D.EwBj4ywRjI%3D%3D..EweloBhBmSQUwIYHMA28QgIwV0A%3D&bn=DBX-explore\r\n\r\nhttps://inara.cz/market/21060/47512/','text','','GbTwj',0,'dythda','213.175.41.130',11,0,0),(96,'pjbewm7sx',3,'martin.varak',NULL,1540907913,0,'NS Open ports','Open: 22\r\nOpen: 53\r\nOpen: 80\r\nOpen: 465\r\nOpen: 587\r\nOpen: 636\r\nOpen: 993\r\nOpen: 1195\r\nOpen: 1708\r\nOpen: 5196\r\nOpen: 5197\r\nOpen: 5198\r\nOpen: 5199\r\nOpen: 5223\r\nOpen: 5224\r\nOpen: 5299\r\nOpen: 6000\r\nOpen: 8080\r\nOpen: 8443','text','','odmE9',0,'bn8duz','213.175.41.130',18,0,0),(97,'pm2mswtn1',3,'martin.varak',NULL,1541515832,0,NULL,'Start. číslo,Jméno,Divize,E-mail\r\n7,Boudný Ivo,Pistole,ivo.boudny@seznam.cz\r\n10,Halm Vladimír,Pistole,vladha@seznam.cz\r\n4,Hochmann Petr,Pistole,hochi@email.cz\r\n6,Hruban Jan,Pistole,hrubi@hrubi.cz\r\n8,Kubíček Radek,Pistole,radek.kubicek@gmail.com\r\n1,Nimrichtrová Karina,Pistole,nimrichtrovak@email.cz\r\n5,Pospíšil Jan,Pistole,honzaposp@seznam.cz\r\n2,Sebela Miroslav,Pistole,logostic@seznam.cz\r\n9,Sorentiny Michal,Pistole,sorentiny.m@gmail.com\r\n3,Štulpa Adam,Pistole,stulpa.adam@gmail.com\r\n12,Vala Jiří,Pistole,vala@drevos.com\r\n13,Vařák Martin,Pistole,martin@varak.net\r\n11,Vítek Petr,Pistole,galion@seznam.cz\r\n15,Veselý Zdenek,Pistole,vesely-zdenek@email.cz\r\n16,Šimek Jiří,jirkas@centrum.cz','text','','fS7J1',0,'ktrea7','213.175.41.130',19,0,0);
/*!40000 ALTER TABLE `main` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2025-08-29  4:11:50

Zerion Mini Shell 1.0