Limit Error

Allowed memory size of 8388608 bytes exhausted (tried to allocate 14592 bytes) in /var/www/html/monitoring/protected/extensions/bootstrap/widgets/TbBaseMenu.php on line 149

please any suggestion, i use to edit the php.ini, and change the process max to 1024MB

but same thing

Post your code, please.

VIEW SALES




<?php





$this->widget('bootstrap.widgets.TbBreadcrumbs', array(

    'links'=>array('Sea Monitoring'=>'index.php?r=seaSalesMonitoring/admin', 'NET Sales'=>'#','Sales Report'=>'index.php?r=seaSalesMonitoring/reportSales'),

));

 

/*$this->menu=array(

	array('label'=>'List SeaSalesMonitoring','url'=>array('index')),

	array('label'=>'Create SeaSalesMonitoring','url'=>array('create')),

);*/


Yii::app()->clientScript->registerScript('search', "

$('.search-button').click(function(){

	$('.search-form').toggle();

	return false;

});

$('.search-form form').submit(function(){

	$.fn.yiiGridView.update('sea-sales-monitoring-grid', {

		data: $(this).serialize()

	});

	return false;

});

");

?>


<h3>Sales Report</h3>


<p><!--

You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>

or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.

--></p>


<?php #echo CHtml::link('Advanced Search','#',array('class'=>'search-button btn')); ?>

<!--<div class="search-form" style="display:none">

<?php   #$this->renderPartial('_search',array(

        #'model'=>$model,

#)); ?>

</div> search-form -->

<div 

    style=" display:block;

            border: solid 1px #0af;

            -moz-border-radius: 5px;

            border-radius: 5px;

            -webkit-border-radius: 5px;

            margin-bottom: 5px;

            padding: 10px;"

>

<?php   $this->renderPartial('_searchSales',array(

        'model'=>$model,

)); ?>

</div>

<style type="text/css">

    .red{

        color: red;

    }

    .green{

        color: green;

    }

    .blue{

        color: #0081c2;

    }

</style>

<?php $this->widget('bootstrap.widgets.TbGridView',array(

	'id'=>'sea-sales-monitoring-grid',

        'type'=>'striped bordered condensed',

	'dataProvider'=>$model->salesReport(),

        #'rowCssClass'=>array('red','green'),

        #'rowCssClassExpression'=>($data->sumVal==0)?'red':'green',

	'columns'=>array(

                'bl_no',

		'shipping_line',

                'date_create',

                'user_create',

                'user_update',

                #'awb',

              #'sumCargo',

               array(

                        'filter'=>true,

                        'name'=>'Awbs CBM',

                        'value'=>'$data->sumCbm'

                ),

              'bl_cbm',

               array(

                        

                        'name'=>'Cbm Diff',

                        'value'=>'$data->sumCbm - $data->bl_cbm'

                ),

                array(

                        

                        'name'=>'sumVal',

                ),

                array(

                        

                        'name'=>'buying',        

                ),

  

                array(

                        

                        'name'=>'NET',

                        'value'=>'$data->sumVal - $data->buying', 

                      

                ),

	),

));  ?>

}

MODEL


<?php


/**

 * This is the model class for table "sea_sales_monitoring".

 *

 * The followings are the available columns in table 'sea_sales_monitoring':

 * @property integer $bl_id

 * @property string $bl_no

 * @property string $shippin_line

 * @property string $vessel

 * @property string $voy_no

 * @property string $van_no

 * @property double $origin_facilitation

 * @property double $origin_trucking

 * @property double $origin_arrastre_wharfage

 * @property double $origin_dg_processing

 * @property double $origin_freight

 * @property double $destination_faciltation

 * @property double $destination_trucking

 * @property double $destination_arrastre_wharfage

 * @property double $destination_freight

 * @property double $buying

 * @property double $selling

 * @property string $date_create

 * @property string $user_create

 * @property string $user_update

 * @property string $dest

 * @property string $sumAwb

 */

class SeaSalesMonitoring extends CActiveRecord

{

	/**

	 * Returns the static model of the specified AR class.

	 * @param string $className active record class name.

	 * @return SeaSalesMonitoring the static model class

	 */

        public $searchSalesFrom,$searchSalesTo,$sumAwb;

    public $net,$dest,$etd,$eta,$aloading,$awb,$shipper,$consignee,$pkgs,$cbm,$service,$paymode,$amount;

	public static function model($className=__CLASS__)

	{

		return parent::model($className);

	}


	/**

	 * @return string the associated database table name

	 */

	public function tableName()

	{

		return 'sea_sales_monitoring';

	}


	/**

	 * @return array validation rules for model attributes.

	 */

	public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			array('bl_id','length','max'=>20),

			array('bl_no, shipping_line, vessel, voy_no, van_no,user_create', 'required'),

			array('status', 'numerical', 'integerOnly'=>true),

			array('bl_cbm, origin_facilitation, origin_trucking, origin_arrastre_wharfage, origin_freight, destination_faciltation, destination_freight, buying, selling', 'numerical'),

                        array('bl_no','unique','message'=>'{attribute}:{value} already exists!'),

                        array('bl_no', 'length', 'max'=>15, 'min'=>4),

			array('vessel, voy_no, van_no, user_create, user_update', 'length', 'max'=>20),

			array('date_create, dest, monitoring.destination,searchSalesFrom, searchSalesTo,sumAwb','safe'),

			// The following rule is used by search().

			// Please remove those attributes that should not be searched.

			array('bl_id, bl_no,shipping_line, vessel, voy_no, van_no, date_create, user_create, user_update, searchSalesFrom, searchSalesTo,sumAwb', 'safe', 'on'=>'search'),

		);

	}


	/**

	 * @return array relational rules.

	 */

	public function relations()

	{

		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

                          "s" => array(self::HAS_MANY, "SeaMonitoring", "bl_no",),

                     

                          "sumCbm" => array(self::STAT, "SeaMonitoring", "bl_no",'select'=> 'SUM(cbm)'),

                          "awb" => array(self::STAT, "SeaMonitoring", "bl_no",'select'=> 'awb_no'),

                          "sumVal" => array(self::STAT, "SeaMonitoring", "bl_no",'select'=> 'SUM(awb_value)'),

                    

                          #"c" => array(self::HAS_MANY, "Cargodetails", "awb",),

                          #'sumCargo' => array(self::STAT, 'Cargodetails', 'sum(overAllTotal)'),

		);

                

	}


	/**

	 * @return array customized attribute labels (name=>label)

	 */

	public function attributeLabels()

	{

		return array(

			'bl_id' => 'BL ID',

			'bl_no' => 'BL No',

                        'shipping_line'=>'Shipping Line',

			'vessel' => 'Vessel',

			'voy_no' => 'Voy No',

			'van_no' => 'Van No',

                        'origin_facilitation' => 'Origin Facilitation',

			'origin_trucking' => 'Origin Trucking',

			'origin_arrastre_wharfage' => 'Origin Arrastre Wharfage',

			'origin_dg_processing' => 'Origin Dg Processing',

			'origin_freight' => 'Origin Freight',

			'destination_faciltation' => 'Destination Faciltation',

			'destination_trucking' => 'Destination Trucking',

			'destination_arrastre_wharfage' => 'Destination Arrastre Wharfage',

			'destination_freight' => 'Destination Freight',

			'buying' => 'Buying',

			'selling' => 'Selling',

			'date_create' => 'Date Transaction',

			'user_create' => 'User Create',

			'user_update' => 'User Update',

                        'result'=>'Net',

                        'status' => 'Status',

                        'bl_cbm' => 'BL CBM'

		);

	}


	/**

	 * Retrieves a list of models based on the current search/filter conditions.

	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.

	 */

	public function search()

	{

		// Warning: Please modify the following code to remove attributes that

		// should not be searched.


		$criteria=new CDbCriteria;

          #      $criteria->with = array('monitoring');

		$criteria->compare('bl_id',$this->bl_id);

               

		$criteria->compare('bl_no',$this->bl_no);

                $criteria->compare('shipping_line',$this->shipping_line,TRUE);

		$criteria->compare('vessel',$this->vessel,true);

		$criteria->compare('voy_no',$this->voy_no,true);

                $criteria->compare('origin_facilitation',$this->origin_facilitation);

		$criteria->compare('origin_trucking',$this->origin_trucking);

		$criteria->compare('origin_arrastre_wharfage',$this->origin_arrastre_wharfage);

		$criteria->compare('origin_dg_processing',$this->origin_dg_processing);

		$criteria->compare('origin_freight',$this->origin_freight);

		$criteria->compare('destination_faciltation',$this->destination_faciltation);

		$criteria->compare('destination_trucking',$this->destination_trucking);

		$criteria->compare('destination_arrastre_wharfage',$this->destination_arrastre_wharfage);

		$criteria->compare('destination_freight',$this->destination_freight);

		$criteria->compare('van_no',$this->van_no,true);

		$criteria->compare('buying',$this->buying);

		$criteria->compare('selling',$this->selling);

		$criteria->compare('date_create',$this->date_create,true);

		$criteria->compare('user_create',$this->user_create,true);

		$criteria->compare('user_update',$this->user_update,true);

                $criteria->compare('status',$this->status);

/*************Monitoring***********************/

                

                $criteria->compare('monitoring.destination',$this->dest);

                $criteria->compare('monitoring.date_etd',$this->etd);

                $criteria->compare('monitoring.date_eta',$this->eta);

                $criteria->compare('monitoring.adate_load',$this->aloading);

                $criteria->compare('monitoring.awb',$this->awb);

                $criteria->compare('monitoring.shipper',$this->shipper);

                $criteria->compare('monitoring.consignee',$this->consignee);

                $criteria->compare('monitoring.qty',$this->pkgs);

                $criteria->compare('monitoring.cbm',$this->cbm);

                $criteria->compare('monitoring.service',$this->service);

                $criteria->compare('monitoring.paymode',$this->paymode);

                $criteria->compare('monitoring.awb_value',$this->amount);

                

                

                /**********************************************/

		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

                        'pagination'=>array(

                            'pagesize'=>100,

                           ),

		));

	}

        public function dataPro(){

            

              

	


        }

        

        public function getBL($a)

	{

		// Warning: Please modify the following code to remove attributes that

		// should not be searched.


		$criteria=new CDbCriteria;                

		$criteria->compare('bl_id',$this->bl_id);

		$criteria->compare('bl_no',$this->bl_no,true);

                $criteria->compare('shipping_line',$this->shipping_line,true);

		$criteria->compare('vessel',$this->vessel,true);

		$criteria->compare('voy_no',$this->voy_no,true);

		$criteria->compare('van_no',$this->van_no,true);

		$criteria->compare('buying',$this->buying);

		$criteria->compare('selling',$this->selling);

		$criteria->compare('date_create',$this->date_create,true);

		$criteria->compare('user_create',$this->user_create,true);

		$criteria->compare('user_update',$this->user_update,true);

                $criteria->condition ="bl_no = '$a'";

                

                #$criteria->compare(($this->aging($this->insert_date,$this->pick_date)),$this->insert_date);

                #$this->aging = $this->age();

		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,           

		));

	}

     public function salesReport()

	{

		// Warning: Please modify the following code to remove attributes that

		// should not be searched.

                SeaMonitoring::model()->compBuy($this->bl_no,true);

              

		$criteria=new CDbCriteria;

               

                $criteria->with= array("s"); 

                $criteria->distinct=true;

                $criteria->condition ="date_create >= '$this->searchSalesFrom' AND date_create <= '$this->searchSalesTo'";

                #print_r($criteria);

                #$criteria->condition ="bl.date_create >= '.$this->searchSalesFrom.' 

                #   AND bl.date_create <='.$this->searchSalesFrom'";

                

               #$criteria->compare(($this->aging($this->insert_date,$this->pick_date)),$this->insert_date);

               #$this->aging = $this->age();

              

          

             

		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

                        'pagination'=>array(

                            'pagesize'=>100,

                           ),

		));

	}

         public function getSumAwb(){

            

             $getsum = Yii::app()->db->createCommand()

                ->select(array('sum(awb_value) as val,sum(cbm) as cbm',))

                ->from('sea_monitoring')

                ->where("bl_no = '".$this->bl_no."'")

                ->queryAll();

                 print_r($getsum);

                 return new CActiveDataProvider($this, array(

			'criteria'=>$getsum,

                       

            

		));

        

        }