Example #1
0
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */
$incpath = realpath(dirname(__FILE__) . '/../includes');
require_once $incpath . '/common.php';
require_once $incpath . '/SI_Invoice.php';
require_once $incpath . '/SI_Company.php';
require_once $incpath . '/SI_TaskActivity.php';
require_once $incpath . '/SI_PaymentSchedule.php';
require_once $incpath . '/SI_ItemCode.php';
//Get list of
echo "Starting of AutoInvoice.\n\n";
//$comp_ids = '';
echo " -Getting Companies with unbilled time.\n";
$company = new SI_Company();
$companies_time = $company->getCompanysWithUnbilledAmount();
if ($companies === FALSE) {
    echo "****ERR: Could not retrieve Outstanding Hours list! ****\n";
    debug_message($company->getLastError());
} elseif (count($companies_time) > 0) {
    foreach ($companies_time as $comp_time) {
        $comp_ids[] = $comp_time->id;
        echo "  * {$comp_time->name} - " . formatLengthOfTime($comp_time->time_spent) . " " . SureInvoice::getCurrencySymbol() . number_format($comp_time->amount, 2) . "\n";
    }
}
echo " -Getting Upcoming Scheduled Payment.\n";
$ps = new SI_PaymentSchedule();
$time = time() + 16 * (24 * (60 * 60));
$ps_items = $ps->getUpcoming($time);
if ($ps_items === FALSE) {
    echo "****ERR: Could not retreive upcoming scheduled billings! ****\n";