<?php
class EditFactAction extends wtActions 
{
    public function execute()
    {
        LayoutTemplate::getInstance()->setUseBootstrap();
        
        $this->IdConcat  = $this->getRequestParameter( 'IdConcat' );
        $this->SerieFact = $this->getRequestParameter( 'SerieFact' );
        
        if( !myUser::getUser()->getIdBusiness() )
        {
            pr( "La Session Expiro." );
            exit;
        }
        
        $IdCompania = myUser::getUser()->getIdBusiness();
        
        $f_Inafecto   = 0;
        $f_SubTotal   = 0;
        $f_IgvTotal   = 0;
        $f_BrutoTotal = 0;
        
        $this->s_TipoDoc       = "";
		$this->s_SerieFactura  = "";
		$this->s_NumeroFactura = "";
		$this->d_FechaFactura  = "";
		$this->s_Comentario    = "";
        
        if( $this->IdConcat )
        {
            $o_ALM_OrdenGuiaFacturaFN = new ALM_OrdenGuiaFacturaFN();
            $o_ALM_OrdenGuiaFacturaBN = $o_ALM_OrdenGuiaFacturaFN->selectByPK( $this->IdConcat );

            if( $o_ALM_OrdenGuiaFacturaBN )
            {
                $this->s_TipoDoc       = $o_ALM_OrdenGuiaFacturaBN->getTipoDoc();
                $this->s_SerieFactura  = $o_ALM_OrdenGuiaFacturaBN->getSerieFactura();
                $this->s_NumeroFactura = $o_ALM_OrdenGuiaFacturaBN->getNumeroFactura();
                $this->d_FechaFactura  = $o_ALM_OrdenGuiaFacturaBN->getFechaFactura();
                $this->s_Comentario    = $o_ALM_OrdenGuiaFacturaBN->getComentario();
                
                $f_Inafecto   = $o_ALM_OrdenGuiaFacturaBN->getMontoFacturaInafecto();
                $f_SubTotal   = $o_ALM_OrdenGuiaFacturaBN->getMontoFactura();
                $f_IgvTotal   = $o_ALM_OrdenGuiaFacturaBN->getIGVFactura();
                $f_BrutoTotal = $o_ALM_OrdenGuiaFacturaBN->getTotalfactura();
            }
        }
        $this->f_Inafecto   = $f_Inafecto;
        $this->f_SubTotal   = $f_SubTotal;
        $this->f_IgvTotal   = $f_IgvTotal;
        $this->f_BrutoTotal = $f_BrutoTotal;
    }
}