<?php

/**
 * qcad_docu_consul actions.
 *
 * @package    contab2
 * @subpackage qcad_docu_consul
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class qcad_docu_consulActions extends sfQuery {

    protected $table_names = array(
        'CN_DOCUMENTO_TOT',
        'CN_TD',
        'CN_CONTROL_CAD',
        'CN_MAE_TER'
    );
    protected $table_join_ids = array(
        'CN_TD' => array(
            'id_td' => 'CN_DOCUMENTO_TOT'
        ),
        'CN_CONTROL_CAD' => array(
            'id_cia' => 'CN_DOCUMENTO_TOT',
            'id_cad' => 'CN_DOCUMENTO_TOT',
            'id_cen_op' => 'CN_DOCUMENTO_TOT',
            'id_vigencia' => 'CN_DOCUMENTO_TOT'
        ),
        'CN_MAE_TER,LEFT' => array(
            'id_mae_ter' => 'CN_DOCUMENTO_TOT'
        )
    );
    protected $fields = array(
        'CN_DOCUMENTO_TOT' =>
        array(
            'id_documento' => 'id_documento',
            'id_cad' => 'id_cad',
            'id_vigencia' => 'id_vigencia',
            'id_cen_op' => 'id_cen_op',
            'id_cia' => 'id_cia',
            'id_td' => 'id_td',
            'id_mae_ter' => 'id_mae_ter',
            'descr_mto' => 'descr_mto',
            'doc_soporte' => 'doc_soporte',
            'fecha_soporte' => 'fecha_soporte',
            'tot_debito' => 'tot_debito',
            'tot_credito' => 'tot_credito'
        ),
        'CN_TD' => array(
            'nombre' => 'nom_td'
        ),
        'CN_CONTROL_CAD' =>
        array(
            'fecha_cad' => 'fecha_cad'
        ),
        'CN_MAE_TER' =>
        array(
            'nitocc' => 'nitocc',
            'nombre' => 'tercero'
        )
    );
    protected $table_field_conditions =
            array(
        'CN_DOCUMENTO_TOT' =>
        array(
            'id_cia' => array('=' => array('id_cia')),
            'id_cad' => array('=' => array('id_cad')),
            'id_cen_op' => array('=' => array('id_cen_op')),
            'id_vigencia' => array('=' => array('id_vigencia')),
            'id_documento' => array('=' => array('id_documento')),
            'id_td' => array('=' => array('id_td')),
            'rownum,start' => array('>' => array('_startRow')),
            'rownum,end' => array('<=' => array('_endRow'))
        ),
        'CN_CONTROL_CAD' =>
        array(
            'fecha_cad' => array('BETWEEN' => array('di_ini', 'di_fin')),
            'id_tipo_comprobante' => array('=' => array('id_tipo_comprobante'))
        )
    );
    protected $table_field_or_conditions =
            array(
        'CN_DOCUMENTO_TOT' =>
        array(
            'id_documento' => array('LIKE' => array('input', '%')),
            'descr_mto' => array('LIKE' => array('input', '%'))
        )
    );
    protected $fields_orderBy = array(
        'fecha_cad', 'id_documento'
    ); //campos para el ordenamiento de la consulta


    /* service sum */
    protected $summatory_data =
            array(
        'CN_DOCUMENTO_TOT' =>
        array(
            'fields' => array('tot_debito', 'tot_credito'),
            'labels' => array('id_documento,Total')
        )
    );
    // -- CRUD Services
    protected $id_name = 'id_documento';
    protected $id_names = array('id_documento', 'id_cad', 'id_vigencia', 'id_cen_op', 'id_cia');
    protected $field_names = array('id_td', 'id_mae_ter', 'descr_mto', 'doc_soporte', 'fecha_soporte');
    protected $table_name = 'CN_DOCUMENTO';
    protected $has_id_cia = false;
    protected $has_activo = false;
    protected $check_exists = array('id_documento', 'id_cad', 'id_vigencia', 'id_cen_op');
    protected $has_vigencia = false;
    protected $other_tab_uq_fields = array('nitocc' => array('CN_MAE_TER' => array('id_mae_ter')));
}

