<?php
class ModelExtensionTotalSubTotal3 extends Model {
	public function getTotal($total, $listproduct = false) {

        $this->load->language('extension/total/sub_total');

		if($listproduct === false){
          //  die();
        }else{

            $sub_total = 0;
            foreach($listproduct as $product){
                if (in_array($product['product_id'],array_merge($this->config->get('config_payment'),$this->config->get('config_payment_auto')))){
                    if(!$product['status']){

                        //4
                    }else{

                        //3

                        $sub_total += $product['total_raw'];

                    }
                }else{
                    if($product['status']){
                        //1


                    }elseif($product['booking_date']>=date('Y-m-d')){

                       //2
                    }else{

                        // 4
                    }

                }
            }
        }

        if($sub_total!=0){
            $total['totals'][] = array(
                'code'       => 'sub_total3',
                'title'      => $this->language->get('text_sub_total3'),
                'value'      => $sub_total,
                'sort_order' =>$this->config->get('sub_total3_sort_order')
            );

            $total['total'] += $sub_total;
        }
    }
}
// 1 выполненные
// 2 которые могут быть выполнены
// 3 оплата
// 4 мусор
