Esempio n. 1
0
 *  USA.
 *
 *  $Id$
 *  Modyfikacja: Aplikacja IPTV versja 1.2
 *  2011 ITMSOFT
 *  1.2.1 23/08/2011 19:00:00
 *  Modyfikacja: Aplikacja IPTV versja 1.2
 *  2014 SGT
 *  1.2.1 23/08/2011 19:00:00  
 */
include '/etc/lms/init_lms.php';
if (get_conf('jambox.enabled')) {
    require_once LIB_DIR . '/LMS.tv.class.php';
    $LMSTV = new LMSTV($DB, $AUTH, $CONFIG);
}
$end = cal_days_in_month(CAL_GREGORIAN, Date("m"), Date("Y"));
$start_date = Date("Y-m-02", strtotime("last month"));
$end_date = Date("Y-m-" . $end);
print "\n" . $start_date . " - " . $end_date . "\n";
$res = $LMSTV->GetBillingEvents($start_date, $end_date);
//print_r($res);
if (count($res)) {
    foreach ($res as $key => $r) {
        try {
            $DB->Execute('INSERT INTO tv_billingevent (customerid, account_id, be_selling_date, be_desc, be_vat, be_gross, be_b2b_netto, group_id, cust_number, package_id, hash, beid)
						VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array(empty($r['cust_external_id']) ? 0 : $r['cust_external_id'], $r['account_id'], $r['be_selling_date'], $r['be_desc'], $r['be_vat'], $r['be_gross'], $r['be_b2b_netto'], empty($r['group_id']) ? 0 : $r['group_id'], $r['cust_number'], $r['package_id'], md5($r['id']), $r['id']));
        } catch (Exception $e) {
            print_r($e);
        }
    }
}