<?php
class AccountActions extends wtActions
{
    public function executeRun()
    {
        //http://localhost/truchinet/ws.php/account/run?wsdl
        $o_SoapServer = new SoapServer( dirname(__FILE__)."/../../../../../services/Account.wsdl" );
        $o_Obj = new AccountService();
        $o_SoapServer->setObject( $o_Obj );
        
        ob_start();
        $o_SoapServer->handle();
        
        $ResultService = ob_get_clean();
        
        echo $ResultService; 
        
        return ViewResponse::NONE;
    }
    
    public function executeRunJson()
    {
        $key = $this->getRequestParameter( 'key' );
        if( $key == "android_truchinet" )
        {
            $a_lst = UsuarioFN::listadoUsuarioCompania();
            //pr( $a_lst );
            echo json_encode( $a_lst );
        }
        return ViewResponse::NONE;
    }

    public function executeTest()
    {
        $o_DBConnect = Conexion::getConexion2( 'trabajo' );
        $o_DBConnect->begin();
        //pr( $o_DBConnect );
        pr( $o_DBConnect->getResource() );
        //pr( get_class_methods( $o_DBConnect ) );

        $o_Resource = $o_DBConnect->getResource();

        $s_Sql = "SELECT * FROM FCO_Cierre";
        $o_ResulSet = $o_Resource->query( $s_Sql );
        if( $o_ResulSet->num_rows > 0 )
        {
            //while ( $a_Row = $o_ResulSet->fetch_array( MYSQLI_ASSOC ) ) 
            while ( $a_Row = $o_ResulSet->fetch_object() ) 
            {
                pr( $a_Row );
            }
        }

        $o_DBConnect->commit();

        return ViewResponse::NONE;
    }
}