<commit_before><?php

class Grid_Scheme extends Grid{

	public $head=null;

	public $vp;

	function init(){
		parent::init();
		// $this->vp = $this->add('VirtualPage')->set(function($p){
		// 	$p->add('Grid_Account')->setModel($p->add('Model_Scheme')->load($_GET['scheme_id'])->accounts());
		// });
	}

	function setModel($model,$fields=null){
		parent::setModel($model,$fields);

		$this->model->setOrder('created_at','desc');
		
		if($this->hasColumn('PremiumMode'))
			$this->addFormatter('PremiumMode','PremiumMode');
		// $this->addFormatter('CollectorCommissionRate','wrap');

		$this->addColumn('text','limits');

		$this->removeColumn('ReducingOrFlatRate');
		$this->removeColumn('ActiveStatus');
		$this->removeColumn('NumberOfPremiums');
		$this->removeColumn('balance_sheet_id');
		$this->removeColumn('MinLimit');
		$this->removeColumn('MaxLimit');
		$this->removeColumn('ProcessingFeesinPercent');
		$this->removeColumn('SchemeGroup');
		$this->removeColumn('SchemePoints');
		$this->removeColumn('InterestToAnotherAccount');
	}

	function formatRow(){

		if($this->head==null){
			$this->head = $this->model['balance_sheet_id'];
		}

		if($this->head != $this->model['balance_sheet_id']){
			$this->setTDParam('balance_sheet','style/color','red');
			$this->head = $this->model['balance_sheet_id'];
		}else{
			$this->setTDParam('balance_sheet','style/color','');
		}

		if(!$this->model['ActiveStatus']){
			$this->setTDParam('name','style/color','red');
			$this->setTDParam('name','style/text-decoration','line-through');
		}
		else
			$this->setTDParam('name','style/color','');

		$this->current_row['limits']= 'Min ' .$this->model['MinLimit'] . ' /- ' . ($this->model['MaxLimit'] !=-1? ' to ' . $this->model['MaxLimit'] .' /-': '');
		$this->current_row_html['Interest'] = $this->model['Interest'] . '% <small><small class="atk-text-dimmed">'. $this->model['ReducingOrFlatRate'] .'</small></span>';
		$this->current_row_html['ProcessingFees']= $this->current_row['ProcessingFees'] . ' '. ($this->model['ProcessingFeesinPercent']? ' %': ' /-');

		// $this->current_row_html['total_active_accounts'] = '<a onclick="javascript: $.univ().frameURL(\'Scheme Accounts\',\''.$this->api->url($this->vp->getURL(),array('scheme_id'=>$this->model->id)).'\')">'. $this->current_row['total_active_accounts'] .'</a>';

		parent::formatRow();
	}

	function format_PremiumMode($field){
		$this->current_row_html[$field]= $this->current_row['PremiumMode'] . ' ['.$this->current_row['NumberOfPremiums'].']' ;
	}
}<commit_msg>add formatter valid_till match or not<commit_after><?php

class Grid_Scheme extends Grid{

	public $head=null;

	public $vp;

	function init(){
		parent::init();
		// $this->vp = $this->add('VirtualPage')->set(function($p){
		// 	$p->add('Grid_Account')->setModel($p->add('Model_Scheme')->load($_GET['scheme_id'])->accounts());
		// });
	}

	function setModel($model,$fields=null){
		parent::setModel($model,$fields);

		$this->model->setOrder('created_at','desc');
		
		if($this->hasColumn('PremiumMode'))
			$this->addFormatter('PremiumMode','PremiumMode');
		// $this->addFormatter('CollectorCommissionRate','wrap');

		$this->addColumn('text','limits');

		$this->removeColumn('ReducingOrFlatRate');
		$this->removeColumn('ActiveStatus');
		$this->removeColumn('NumberOfPremiums');
		$this->removeColumn('balance_sheet_id');
		$this->removeColumn('MinLimit');
		$this->removeColumn('MaxLimit');
		$this->removeColumn('ProcessingFeesinPercent');
		$this->removeColumn('SchemeGroup');
		$this->removeColumn('SchemePoints');
		$this->removeColumn('InterestToAnotherAccount');
	}

	function formatRow(){

		if($this->head==null){
			$this->head = $this->model['balance_sheet_id'];
		}

		if($this->head != $this->model['balance_sheet_id']){
			$this->setTDParam('balance_sheet','style/color','red');
			$this->head = $this->model['balance_sheet_id'];
		}else{
			$this->setTDParam('balance_sheet','style/color','');
		}

		if(!$this->model['ActiveStatus'] OR ($this->model['valid_till'] AND strtotime($this->model['valid_till']) < strtotime($this->app->today)) ){
			$this->setTDParam('name','style/color','red');
			$this->setTDParam('name','style/text-decoration','line-through');
			$this->setTDParam('valid_till','style/color','red');
			$this->setTDParam('valid_till','style/text-decoration','line-through');
		}
		else{
			$this->setTDParam('name','style/color','');
			$this->setTDParam('valid_till','style/color','');
		}


		$this->current_row['limits']= 'Min ' .$this->model['MinLimit'] . ' /- ' . ($this->model['MaxLimit'] !=-1? ' to ' . $this->model['MaxLimit'] .' /-': '');
		$this->current_row_html['Interest'] = $this->model['Interest'] . '% <small><small class="atk-text-dimmed">'. $this->model['ReducingOrFlatRate'] .'</small></span>';
		$this->current_row_html['ProcessingFees']= $this->current_row['ProcessingFees'] . ' '. ($this->model['ProcessingFeesinPercent']? ' %': ' /-');

		// $this->current_row_html['total_active_accounts'] = '<a onclick="javascript: $.univ().frameURL(\'Scheme Accounts\',\''.$this->api->url($this->vp->getURL(),array('scheme_id'=>$this->model->id)).'\')">'. $this->current_row['total_active_accounts'] .'</a>';

		parent::formatRow();
	}

	function format_PremiumMode($field){
		$this->current_row_html[$field]= $this->current_row['PremiumMode'] . ' ['.$this->current_row['NumberOfPremiums'].']' ;
	}
}
{'fraction_non_alphanumeric': 0.2508367422833767, 'fraction_numerical': 0.0003718854592785422, 'mean_word_length': 6.220134228187919, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 140, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397455', 'n_tokens_mistral': 1991, 'n_tokens_neox': 1822, 'n_words': 171}