Location: PHPKode > projects > PkLasku laskutusohjelma > pklasku/open_invoices.php
<?php
/*******************************************************************************
PkLasku : web-based invoicing software.
Copyright (C) 2004-2008 Samu Reinikainen

This program is free software. See attached LICENSE.

*******************************************************************************/

/*******************************************************************************
PkLasku : web-pohjainen laskutusohjelmisto.
Copyright (C) 2004-2008 Samu Reinikainen

Tämä ohjelma on vapaa. Lue oheinen LICENSE.

*******************************************************************************/

require "htmlfuncs.php";
require "sqlfuncs.php";
require "sessionfuncs.php";
require "miscfuncs.php";
require "datefuncs.php";

$strSesID = $_REQUEST['ses'] ? $_REQUEST['ses'] : FALSE;

if( !sesCheckSession( $strSesID ) ) {
    die;
}
require "localize.php";

echo htmlPageStart( _PAGE_TITLE_ );

?>
<body class="list" onload="<?php echo $strOnLoad?>">

<h2><center><?php echo $GLOBALS['locLABELOPENINVOICES']?></center></h2>

<table>
<?php
//invoices todo...
$strQuery = 
    "SELECT * FROM ". _DB_PREFIX_. "_invoice ".
    "WHERE state_id = 1 ".
    "ORDER BY invoice_date, name";
$intRes = mysql_query($strQuery);
$intNumRows = mysql_num_rows($intRes);
if( $intNumRows ) {
    for( $i = 0; $i < $intNumRows; $i++ ) {
        $intID = mysql_result($intRes, $i, "id");
        $strDate = dateConvIntDate2Date(mysql_result($intRes, $i, "invoice_date"));
        $strLabel = mysql_result($intRes, $i, "name");
        $strInvNo = mysql_result($intRes, $i, "invoice_no");
        $strLink = 
            "form.php?ses=". $GLOBALS['sesID']. "&selectform=invoice&key_name=id&id=". $intID;
?>

<tr>
    <td class="label">
        <a class="navilink" href="<?php echo $strLink?>" target="f_main"><?php echo $strDate?> : <?php echo $strInvNo?> : <?php echo $strLabel?></a> 
    </td>
</tr>

<?php
    }
}
else {
?>
<tr>
    <td class="label">
        <?php echo $GLOBALS['locNOOPENINVOICES']?> 
    </td>
</tr>
<?php
}

?>
</table>

<h2><center><?php echo $GLOBALS['locLABELUNPAIDINVOICES']?></center></h2>

<table>
<?php
//invoices todo...
$strQuery = 
    "SELECT * FROM ". _DB_PREFIX_. "_invoice ".
    "WHERE state_id = 2 ".
    "ORDER BY invoice_date, name";
$intRes = mysql_query($strQuery);
$intNumRows = mysql_num_rows($intRes);
if( $intNumRows ) {
    for( $i = 0; $i < $intNumRows; $i++ ) {
        $intID = mysql_result($intRes, $i, "id");
        $strDate = dateConvIntDate2Date(mysql_result($intRes, $i, "invoice_date"));
        $strLabel = mysql_result($intRes, $i, "name");
        $strInvNo = mysql_result($intRes, $i, "invoice_no");
        $strLink = 
            "form.php?ses=". $GLOBALS['sesID']. "&selectform=invoice&key_name=id&id=". $intID;
?>

<tr>
    <td class="label">
        <a class="navilink" href="<?php echo $strLink?>" target="f_main"><?php echo $strDate?> : <?php echo $strInvNo?> : <?php echo $strLabel?></a> 
    </td>
</tr>

<?php
    }
}
else {
?>
<tr>
    <td class="label">
        <?php echo $GLOBALS['locNOUNPAIDINVOICES']?> 
    </td>
</tr>
<?php
}

?>
</table>

</body>
</html>
Return current item: PkLasku laskutusohjelma