noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions
Anc_Listing Class Reference

manage the CA listing More...

Inheritance diagram for Anc_Listing:
Anc_Print

Public Member Functions

 display_csv ()
 Compute the csv export.
 display_form ($p_string="")
 Compute the form to display.
 display_html ()
 compute the html display
 get_request ()
 complete the object with the data in $_REQUEST
 load ()
 load the data from the database
 show_button ($p_string='')
 show the export button to pdf and CSV

Static Public Member Functions

static test_me ()
 debugging and test function for dev. only

Detailed Description

manage the CA listing

Returns:

Definition at line 36 of file class_anc_listing.php.


Member Function Documentation

Compute the csv export.

Returns:
string with the csv

Definition at line 133 of file class_anc_listing.php.

References $array, $r, $row, from, from_poste, load(), to, and to_poste.

    {
        $array=$this->load($this->from,$this->to,$this->from_poste,$this->to_poste);
        if ( empty($array) == true )
        {
            return $array;

        }
        $r="";
        foreach ( $array as $row)
        {
            // the name and po_id
            $r.=sprintf('"%s";',$row['oa_date']);
            $r.=sprintf('"%s";',$row['j_poste']);
            $r.=sprintf('"%s";',$row['qcode']);
            $r.=sprintf('"%s";',$row['po_name']);
            $r.=sprintf('"%s";',$row['oa_description']);
            $r.=sprintf('"%s";',$row['oa_description']);

            $r.=sprintf("%12.2f;",$row['oa_amount']);
            $r.=sprintf("'%s'",(($row['oa_debit']=='f')?'CREDIT':'DEBIT'));
            $r.="\r\n";
        }
        return $r;

    }
Anc_Listing::display_form ( p_hidden = "")

Compute the form to display.

Parameters:
$p_hiddenhidden tag to be included (gDossier,...)
Returns:
string containing the data

Reimplemented from Anc_Print.

Definition at line 38 of file class_anc_listing.php.

References $r, echo, and HtmlInput\submit().

    {
        echo '<form method="get">';
        $r=parent::display_form($p_string);
        $r.=HtmlInput::submit('result','Afficher');
        $r.= '</form>';
        return $r;

    }

compute the html display

Returns:
string

Definition at line 63 of file class_anc_listing.php.

References $array, $class, $detail, $idx, $r, $row, HtmlInput\detail_op(), HtmlInput\history_account(), HtmlInput\history_card(), load(), td(), and th().

    {
        $idx=0;
        $r="";
        //---Html
        $array=$this->load();
        if ( is_array($array) == false )
        {
            return $array;

        }

        if ( empty($array) )
        {
            $r.= _("aucune donnée");
            return $r;
        }
        $r.= '<table class="result" style="width=100%">';
        $r.= '<tr>'.
             '<th>'._('Date').'</th>'.
             '<th>'._('Poste').'</th>'.
             '<th>'._('Quick_code').'</th>'.
             '<th>'._('Analytique').'</th>'.
          th(_('Description')).
             '<th>'._('libelle').'</th>'.
             '<th>'._('Num.interne').'</th>'.
             '<th>'._('Montant').'</th>'.
             '<th>'._('D/C').'</th>'.
             '</tr>';
        foreach ( $array as $row )
        {
            $class=($idx%2==0)?'even':'odd';
            $idx++;
            $r.= '<tr class="'.$class.'">';
            $detail=($row['jr_id'] != null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
            $post_detail=($row['j_poste'] != null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
            $card_detail=($row['f_id'] != null)?HtmlInput::history_card($row['f_id'],$row['qcode']):'';

            $r.=
                '<td>'.$row['oa_date'].'</td>'.
              td($post_detail).
              td($card_detail).
              '<td>'.h($row['po_name']).'</td>'.
              '<td>'.h($row['oa_description']).'</td>'.
              td($row['jr_comment']).
              '<td>'.$detail.'</td>'.
              '<td class="num">'.nbm($row['oa_amount']).'</td>'.
                '<td>'.(($row['oa_debit']=='f')?'CREDIT':'DEBIT').'</td>';
            $r.= '</tr>';
        }
        $r.= '</table>';
        return $r;
    }

complete the object with the data in $_REQUEST

Reimplemented from Anc_Print.

Definition at line 51 of file class_anc_listing.php.

References $_REQUEST.

    {
        parent::get_request();
        $this->pa_id=(isset($_REQUEST['pa_id']))?$_REQUEST['pa_id']:"";
    }

load the data from the database

Returns:
array

Definition at line 121 of file class_anc_listing.php.

References $array, $op, db, from, from_poste, to, and to_poste.

Referenced by display_csv(), and display_html().

    {
        $op=new Anc_Operation ($this->db);
        $op->pa_id=$this->pa_id;
        $array=$op->get_list($this->from,$this->to,$this->from_poste,$this->to_poste);
        return $array;
    }
Anc_Listing::show_button ( p_string = '')

show the export button to pdf and CSV

Parameters:
$p_stringstring containing some HTML tag as hidden field
\param
Returns:
string containing the html code

Definition at line 169 of file class_anc_listing.php.

References $_REQUEST, $hidden, $r, from, from_poste, HtmlInput\hidden(), HtmlInput\submit(), to, and to_poste.

    {
        $r="";
        $submit=HtmlInput::submit('','');
        $hidden=new IHidden();
        /* for the export in PDF
         * Not yet needed, the html print should be enough
        $r.= '<form method="GET" action="ca_list_pdf.php" style="display:inline">';
        $r.= $p_string;
        $r.= dossier::hidden();
        $r.= $hidden->input("to",$this->to);
        $r.= $hidden->input("from",$this->from);
        $r.= $hidden->input("pa_id",$this->pa_id);
        $r.= $hidden->input("from_poste",$this->from_poste);
        $r.= $hidden->input("to_poste",$this->to_poste);
        $r.=HtmlInput::submit('bt_pdf',"Export en PDF");
        $r.= '</form>';
        */

        $r.= '<form method="GET" action="export.php"  style="display:inline">';
        $r.= HtmlInput::hidden("to",$this->to);
        $r.= HtmlInput::hidden("from",$this->from);
        $r.= HtmlInput::hidden("pa_id",$this->pa_id);
        $r.= HtmlInput::hidden("from_poste",$this->from_poste);
        $r.= HtmlInput::hidden("to_poste",$this->to_poste);
        $r.=HtmlInput::hidden('act','CSV:AncList');
        $r.=HtmlInput::hidden('ac',$_REQUEST['ac']);
        $r.= $p_string;
        $r.= dossier::hidden();
        $r.=HtmlInput::submit('bt_csv',"Export en CSV");
        $r.= '</form>';
        return $r;

    }
static Anc_Listing::test_me ( ) [static]

debugging and test function for dev. only

Parameters:
\param
Returns:

Definition at line 212 of file class_anc_listing.php.

    {
    }

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations