예제 #1
0
 protected function loadCurrencies()
 {
     $currencies = array_get(get_currencies(), 'iso');
     foreach ($currencies as $iso => $currency) {
         $iso = $this->prepareIso($iso);
         $currency = Currency::loadFromArray($iso, $currency);
         $this->put($iso, $currency);
     }
 }
$QUERY = 'SELECT count(*) FROM cc_card INNER JOIN cc_card_subscription ON cc_card.id = cc_card_subscription.id_cc_card INNER JOIN cc_subscription_service ON cc_card_subscription.id_subscription_fee=cc_subscription_service.id' . ' WHERE cc_subscription_service.status=1 AND cc_card_subscription.startdate < NOW() AND (cc_card_subscription.stopdate = "0000-00-00 00:00:00" OR cc_card_subscription.stopdate > NOW())' . ' AND cc_subscription_service.startdate < NOW() AND (cc_subscription_service.stopdate = "0000-00-00 00:00:00" OR cc_subscription_service.stopdate > NOW()) AND cc_card_subscription.paid_status !=3';
$result = $instance_table->SQLExec($A2B->DBHandle, $QUERY);
$nb_card = $result[0][0];
$nbpagemax = ceil($nb_card / $groupcard);
if ($verbose_level >= 1) {
    echo "===> NB_CARD : {$nb_card} - NBPAGEMAX:{$nbpagemax}\n";
}
if (!($nb_card > 0)) {
    if ($verbose_level >= 1) {
        echo "[No card to run the Subscription service]\n";
    }
    write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[No card to run the Subscription Feeservice]");
    exit;
}
$billdaybefor_anniversary = $A2B->config['global']['subscription_bill_days_before_anniversary'];
$currencies_list = get_currencies($A2B->DBHandle);
$service_array = array();
for ($page = 0; $page < $nbpagemax; $page++) {
    $sql = 'SELECT cc_card.id card_id ,cc_subscription_service.id service_id, cc_subscription_service.label, cc_subscription_service.fee, cc_subscription_service.emailreport,DATE(cc_card_subscription.startdate) startdate , cc_card_subscription.paid_status , cc_card_subscription.last_run, cc_card_subscription.next_billing_date , cc_card_subscription.limit_pay_date , cc_card_subscription.id card_subscription_id, cc_card_subscription.product_name product_name' . ' FROM cc_card INNER JOIN cc_card_subscription ON cc_card.id = cc_card_subscription.id_cc_card  INNER JOIN cc_subscription_service ON cc_card_subscription.id_subscription_fee=cc_subscription_service.id ' . ' WHERE cc_subscription_service.status=1 AND cc_card_subscription.startdate < NOW() AND (cc_card_subscription.stopdate = "0000-00-00 00:00:00" OR cc_card_subscription.stopdate > NOW())' . ' AND cc_subscription_service.startdate < NOW() AND (cc_subscription_service.stopdate = "0000-00-00 00:00:00" OR cc_subscription_service.stopdate > NOW()) AND cc_card_subscription.paid_status !=3' . ' ORDER BY cc_card.id';
    if ($A2B->config["database"]['dbtype'] == "postgres") {
        $sql .= " LIMIT {$groupcard} OFFSET " . $page * $groupcard;
    } else {
        $sql .= " LIMIT " . $page * $groupcard . ", {$groupcard}";
    }
    $result_subscriptions = $instance_table->SQLExec($A2B->DBHandle, $sql);
    foreach ($result_subscriptions as $subscription) {
        $service_id = $subscription['service_id'];
        if (!is_array($service_array[$service_id])) {
            $service_array[$service_id] = array("totalcardperform" => 0, "totalcredit" => 0);
        }
        $action = "";
예제 #3
0
<?php

if (!tep_session_is_registered('login_account_number') && tep_not_null($login_account_number)) {
    tep_redirect(get_href_link(PAGE_LOGIN));
}
// get currencies balance
$currencies_balance = array();
$sql_balances = "SELECT currency_code, balance FROM " . _TABLE_USER_BALANCE . " WHERE user_id='" . $login_userid . "'";
$balances_query = db_query($sql_balances);
while ($balance = db_fetch_array($balances_query)) {
    $balances_array[$balance['currency_code']] = $balance['balance'];
}
// get all currencies_list
$currencies_array = get_currencies();
foreach ($currencies_array as $currency_code => $currency_info) {
    $balance_info_array[] = array('balance_name' => $currency_info['title'], 'balance_text' => get_currency_value_format($balances_array[$currency_code], $currency_info));
}
$smarty->assign('balances', $balance_info_array);
$_html_main_content = $smarty->fetch('home/login_balance.html');
예제 #4
0
echo lang('text_items');
?>
</span>
                            </a>
                        </div>
                        <div class="dropdown pull-right">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="javascrip:void(0);"><?php 
echo currency_title();
?>
 (<?php 
echo currency_symbol_left();
?>
)<b class="caret"></b></a>
                            <ul class="dropdown-menu" role="menu">
                            <?php 
foreach (get_currencies() as $code => $currency) {
    ?>
                                <li role="menuitem">
                                	<a href="<?php 
    echo current_url() . '?currency=' . $code;
    ?>
"><?php 
    echo $currency['title'];
    ?>
 (<?php 
    echo $currency['symbol_left'];
    ?>
)</a>
                                </li>
                            <?php 
}
예제 #5
0
 function __construct($DB_Handle, $verbose_level = 0)
 {
     $this->DB_Handle = $DB_Handle;
     $this->instance_table = new Table();
     $this->verbose_level = $verbose_level;
     $this->currencies_list = get_currencies($this->DB_Handle);
     global $A2B;
     $this->base_currency = $A2B->config['global']['base_currency'];
 }
예제 #6
0
function display_currencies()
{
    $company_currency = get_company_currency();
    $result = get_currencies(check_value('show_inactive'));
    start_table(TABLESTYLE);
    $th = array(_("Abbreviation"), _("Symbol"), _("Currency Name"), _("Hundredths name"), _("Country"), _("Auto update"), "", "");
    inactive_control_column($th);
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        if ($myrow[1] == $company_currency) {
            start_row("class='currencybg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($myrow["curr_abrev"]);
        label_cell($myrow["curr_symbol"]);
        label_cell($myrow["currency"]);
        label_cell($myrow["hundreds_name"]);
        label_cell($myrow["country"]);
        label_cell($myrow[1] == $company_currency ? '-' : ($myrow["auto_update"] ? _('Yes') : _('No')), "align='center'");
        inactive_control_cell($myrow["curr_abrev"], $myrow["inactive"], 'currencies', 'curr_abrev');
        edit_button_cell("Edit" . $myrow["curr_abrev"], _("Edit"));
        if ($myrow["curr_abrev"] != $company_currency) {
            delete_button_cell("Delete" . $myrow["curr_abrev"], _("Delete"));
        } else {
            label_cell('');
        }
        end_row();
    }
    //END WHILE LIST LOOP
    inactive_control_row($th);
    end_table();
    display_note(_("The marked currency is the home currency which cannot be deleted."), 0, 0, "class='currentfg'");
}
예제 #7
0
 /**
  * Create field.
  *
  * Creates the HTML interface for the Currency field.
  *
  * @since 1.1.0
  *
  * @param  array $field	an array holding all the field's data
  */
 public function create_field($field)
 {
     // value must be array
     if (!is_array($field['value'])) {
         // perhaps this is a default value with new lines in it?
         if (strpos($field['value'], "\n") !== false) {
             // found multiple lines, explode it
             $field['value'] = explode("\n", $field['value']);
         } else {
             $field['value'] = array($field['value']);
         }
     }
     // trim value
     $field['value'] = array_map('trim', $field['value']);
     // multiple select
     $multiple = '';
     if ($field['multiple']) {
         // create a hidden field to allow for no selections
         echo '<input type="hidden" name="' . $field['name'] . '" />';
         $multiple = ' multiple="multiple" size="5" ';
         $field['name'] .= '[]';
     }
     echo '<select id="' . $field['id'] . '" class="select" name="' . $field['name'] . '" ' . $multiple . '>';
     // null option
     if ($field['allow_null']) {
         echo '<option value="null">- ' . __("Select", 'acf') . ' -</option>';
     }
     // get currencies via WP Currencies
     $currencies = get_currencies();
     // print options
     foreach ($currencies as $currency => $data) {
         $data = (array) $data;
         $selected = in_array($currency, $field['value']) ? 'selected="selected"' : '';
         echo '<option value="' . $currency . '" ' . $selected . '>' . $currency . ' ' . $data['name'] . '</option>' . "\n";
     }
     echo '</select>';
 }
예제 #8
0
function EmailInvoice($id, $invoice_type = 1)
{
    //getpost_ifset(array('customer', 'posted', 'Period', 'cardid','exporttype','choose_billperiod','id','invoice_type'));
    if ($invoice_type == "") {
        $invoice_type = 1;
    }
    if ($invoice_type == 1) {
        $cardid = $id;
        if ($cardid == "") {
            exit("Invalid ID");
        }
    }
    if ($invoice_type == 2) {
        if ($id == "" || !is_numeric($id)) {
            exit(gettext("Invalid ID"));
        }
    }
    if ($invoice_type == 1) {
        $invoice_heading = gettext("Unbilled Details");
        $invocie_top_heading = gettext("Unbilled Invoice Details for Card Number");
    } else {
        $invoice_heading = gettext("Billed Details");
        $invocie_top_heading = gettext("Billed Invoice Details for Card Number");
    }
    $DBHandle = DbConnect();
    $num = 0;
    if ($invoice_type == 1) {
        $QUERY = "Select username, vat, t1.id from cc_card t1 where t1.id = {$cardid}";
    } else {
        $QUERY = "Select username, vat, t1.id from cc_card t1, cc_invoices t2 where t1.id = t2.cardid and t2.id = {$id}";
    }
    $res_user = $DBHandle->Execute($QUERY);
    if ($res_user) {
        $num = $res_user->RecordCount();
    }
    if ($num > 0) {
        $userRecord = $res_user->fetchRow();
        $customer = $userRecord[0];
        $vat = $userRecord[1];
        $customerID = $userRecord[2];
    } else {
        exit(gettext("No User found"));
    }
    if (!isset($current_page) || $current_page == "") {
        $current_page = 0;
    }
    // this variable specifie the debug type (0 => nothing, 1 => sql result, 2 => boucle checking, 3 other value checking)
    $FG_DEBUG = 0;
    // The variable FG_TABLE_NAME define the table name to use
    $FG_TABLE_NAME = "cc_call t1";
    // The variable Var_col would define the col that we want show in your table
    // First Name of the column in the html page, second name of the field
    $FG_TABLE_COL = array();
    $FG_TABLE_COL[] = array(gettext("Calldate"), "starttime", "18%", "center", "SORT", "19", "", "", "", "", "", "display_dateformat");
    $FG_TABLE_COL[] = array(gettext("Source"), "src", "10%", "center", "SORT", "30");
    $FG_TABLE_COL[] = array(gettext("Callednumber"), "calledstation", "18%", "right", "SORT", "30", "", "", "", "", "", "");
    $FG_TABLE_COL[] = array(gettext("Destination"), "destination", "18%", "center", "SORT", "30", "", "", "", "", "", "remove_prefix");
    $FG_TABLE_COL[] = array(gettext("Duration"), "sessiontime", "8%", "center", "SORT", "30", "", "", "", "", "", "display_minute");
    if (!(isset($customer) && $customer > 0) && !(isset($entercustomer) && $entercustomer > 0)) {
        $FG_TABLE_COL[] = array(gettext("Cardused"), "username", "11%", "center", "SORT", "30");
    }
    $FG_TABLE_COL[] = array(gettext("Cost"), "sessionbill", "9%", "center", "SORT", "30", "", "", "", "", "", "display_2bill");
    $FG_TABLE_DEFAULT_ORDER = "t1.starttime";
    $FG_TABLE_DEFAULT_SENS = "DESC";
    // This Variable store the argument for the SQL query
    $FG_COL_QUERY = 't1.starttime, t1.src, t1.calledstation, t1.destination, t1.sessiontime  ';
    if (!(isset($customer) && $customer > 0) && !(isset($entercustomer) && $entercustomer > 0)) {
        $FG_COL_QUERY .= ', t1.username';
    }
    $FG_COL_QUERY .= ', t1.sessionbill';
    if (LINK_AUDIO_FILE == 'YES') {
        $FG_COL_QUERY .= ', t1.uniqueid';
    }
    $FG_COL_QUERY_GRAPH = 't1.callstart, t1.duration';
    // The variable LIMITE_DISPLAY define the limit of record to display by page
    $FG_LIMITE_DISPLAY = 500;
    // Number of column in the html table
    $FG_NB_TABLE_COL = count($FG_TABLE_COL);
    //This variable will store the total number of column
    $FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL;
    if ($FG_DELETION || $FG_EDITION) {
        $FG_TOTAL_TABLE_COL++;
    }
    if ($FG_DEBUG == 3) {
        echo "<br>Table : {$FG_TABLE_NAME}  \t- \tCol_query : {$FG_COL_QUERY}";
    }
    $instance_table = new Table($FG_TABLE_NAME, $FG_COL_QUERY);
    $instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH);
    if (is_null($order) || is_null($sens)) {
        $order = $FG_TABLE_DEFAULT_ORDER;
        $sens = $FG_TABLE_DEFAULT_SENS;
    }
    if ($posted == 1) {
        $SQLcmd = '';
        $SQLcmd = do_field($SQLcmd, 'src', 'src');
        $SQLcmd = do_field($SQLcmd, 'dst', 'calledstation');
    }
    $date_clause = '';
    // Period (Month-Day)
    if (DB_TYPE == "postgres") {
        $UNIX_TIMESTAMP = "";
    } else {
        $UNIX_TIMESTAMP = "UNIX_TIMESTAMP";
    }
    $lastdayofmonth = date("t", strtotime($tostatsmonth . '-01'));
    if ($Period == "Month") {
        if ($frommonth && isset($fromstatsmonth)) {
            $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) >= {$UNIX_TIMESTAMP}('{$fromstatsmonth}-01')";
        }
        if ($tomonth && isset($tostatsmonth)) {
            $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) <= {$UNIX_TIMESTAMP}('" . $tostatsmonth . "-{$lastdayofmonth} 23:59:59')";
        }
    } else {
        if ($fromday && isset($fromstatsday_sday) && isset($fromstatsmonth_sday) && isset($fromstatsmonth_shour) && isset($fromstatsmonth_smin)) {
            $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) >= {$UNIX_TIMESTAMP}('{$fromstatsmonth_sday}-{$fromstatsday_sday} {$fromstatsmonth_shour}:{$fromstatsmonth_smin}')";
        }
        if ($today && isset($tostatsday_sday) && isset($tostatsmonth_sday) && isset($tostatsmonth_shour) && isset($tostatsmonth_smin)) {
            $date_clause .= " AND {$UNIX_TIMESTAMP}(t1.starttime) <= {$UNIX_TIMESTAMP}('{$tostatsmonth_sday}-" . sprintf("%02d", intval($tostatsday_sday)) . " {$tostatsmonth_shour}:{$tostatsmonth_smin}')";
        }
    }
    if (strpos($SQLcmd, 'WHERE') > 0) {
        $FG_TABLE_CLAUSE = substr($SQLcmd, 6) . $date_clause;
    } elseif (strpos($date_clause, 'AND') > 0) {
        $FG_TABLE_CLAUSE = substr($date_clause, 5);
    }
    if (isset($customer) && $customer > 0) {
        if (strlen($FG_TABLE_CLAUSE) > 0) {
            $FG_TABLE_CLAUSE .= " AND ";
        }
        $FG_TABLE_CLAUSE .= "t1.username='******'";
    } else {
        if (isset($entercustomer) && $entercustomer > 0) {
            if (strlen($FG_TABLE_CLAUSE) > 0) {
                $FG_TABLE_CLAUSE .= " AND ";
            }
            $FG_TABLE_CLAUSE .= "t1.username='******'";
        }
    }
    if (strlen($FG_TABLE_CLAUSE) > 0) {
        $FG_TABLE_CLAUSE .= " AND ";
    }
    if ($invoice_type == 1) {
        $FG_TABLE_CLAUSE .= "t1.starttime >(Select CASE  WHEN max(cover_enddate) IS NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices WHERE cardid = '{$cardid}')";
    } else {
        $FG_TABLE_CLAUSE .= "t1.starttime >(Select cover_startdate  from cc_invoices where id ='{$id}') AND t1.stoptime <(Select cover_enddate from cc_invoices where id ='{$id}') ";
    }
    if (!$nodisplay) {
        $list = $instance_table->Get_list($DBHandle, $FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page * $FG_LIMITE_DISPLAY);
    }
    $_SESSION["pr_sql_export"] = "SELECT {$FG_COL_QUERY} FROM {$FG_TABLE_NAME} WHERE {$FG_TABLE_CLAUSE}";
    /************************/
    $QUERY = "SELECT substring(t1.starttime,1,10) AS day, sum(t1.sessiontime) AS calltime, sum(t1.sessionbill) AS cost, count(*) as nbcall FROM {$FG_TABLE_NAME} WHERE " . $FG_TABLE_CLAUSE . "  GROUP BY substring(t1.starttime,1,10) ORDER BY day";
    //extract(DAY from calldate)
    if (!$nodisplay) {
        $list_total_day = $instance_table->SQLExec($DBHandle, $QUERY);
        $nb_record = $instance_table->Table_count($DBHandle, $FG_TABLE_CLAUSE);
    }
    // GROUP BY DESTINATION FOR THE INVOICE
    $QUERY = "SELECT destination, sum(t1.sessiontime) AS calltime, \n\tsum(t1.sessionbill) AS cost, count(*) as nbcall FROM {$FG_TABLE_NAME} WHERE " . $FG_TABLE_CLAUSE . "  GROUP BY destination";
    if (!$nodisplay) {
        $list_total_destination = $instance_table->SQLExec($DBHandle, $QUERY);
    }
    //end IF nodisplay
    /************************************************ DID Billing Section *********************************************/
    // Fixed + Dial = 0 ; Fixed = 1 ; Dail = 2 ; Free = 3
    // 1. Billing Type:: All DID Calls that have DID Type 0 and 2
    if ($invoice_type == 1) {
        $QUERY = "SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency " . " FROM cc_charge t1 LEFT JOIN (cc_did t2, cc_country t3 ) ON ( t1.id_cc_did = t2.id AND t2.id_cc_country = t3.id ) " . " WHERE (t1.chargetype = 1 OR t1.chargetype = 2) AND t1.id_cc_card = " . $cardid . " AND t1.creationdate >(Select CASE  WHEN max(cover_enddate) IS NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices)";
    } else {
        $QUERY = "SELECT t1.amount, t1.creationdate, t1.description, t3.countryname, t2.did, t1.currency " . " FROM cc_charge t1 LEFT JOIN (cc_did t2, cc_country t3 ) ON ( t1.id_cc_did = t2.id AND t2.id_cc_country = t3.id ) " . " WHERE (t1.chargetype = 2 OR t1.chargetype = 1) AND t1.id_cc_card = " . $customerID . " AND t1.creationdate > (Select cover_startdate  from cc_invoices where id ='{$id}') AND t1.creationdate <(Select cover_enddate from cc_invoices where id ='{$id}')";
    }
    if (!$nodisplay) {
        $list_total_did = $instance_table->SQLExec($DBHandle, $QUERY);
    }
    /*************************************************CHARGES SECTION START ************************************************/
    // Charge Types
    // Connection charge for DID setup = 1
    // Monthly Charge for DID use = 2
    // Subscription fee = 3
    // Extra charge =  4
    if ($invoice_type == 1) {
        $QUERY = "SELECT t1.id_cc_card, t1.iduser, t1.creationdate, t1.amount, t1.chargetype, t1.id_cc_did, t1.currency, t1.description" . " FROM cc_charge t1, cc_card t2 WHERE (t1.chargetype <> 1 AND t1.chargetype <> 2) " . " AND t2.username = '******' AND t1.id_cc_card = t2.id AND t1.creationdate >= (Select CASE WHEN max(cover_enddate) is NULL " . " THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices) Order by t1.creationdate";
    } else {
        $QUERY = "SELECT t1.id_cc_card, t1.iduser, t1.creationdate, t1.amount, t1.chargetype, t1.id_cc_did, t1.currency, t1.description" . " FROM cc_charge t1, cc_card t2 WHERE (t1.chargetype <> 2 AND t1.chargetype <> 1)" . " AND t2.username = '******' AND t1.id_cc_card = t2.id AND " . " t1.creationdate >(Select cover_startdate  from cc_invoices where id ='{$id}') " . " AND t1.creationdate <(Select cover_enddate  from cc_invoices where id ='{$id}')";
    }
    if (!$nodisplay) {
        $list_total_charges = $instance_table->SQLExec($DBHandle, $QUERY);
    }
    /*************************************************CHARGES SECTION END ************************************************/
    if ($nb_record <= $FG_LIMITE_DISPLAY) {
        $nb_record_max = 1;
    } else {
        if ($nb_record % $FG_LIMITE_DISPLAY == 0) {
            $nb_record_max = intval($nb_record / $FG_LIMITE_DISPLAY);
        } else {
            $nb_record_max = intval($nb_record / $FG_LIMITE_DISPLAY) + 1;
        }
    }
    /*************************************************************/
    if (isset($customer) && $customer > 0 || isset($entercustomer) && $entercustomer > 0) {
        $FG_TABLE_CLAUSE = "";
        if (isset($customer) && $customer > 0) {
            $FG_TABLE_CLAUSE = " username='******' ";
        } elseif (isset($entercustomer) && $entercustomer > 0) {
            $FG_TABLE_CLAUSE = " username='******' ";
        }
        $instance_table_customer = new Table("cc_card", "id,  username, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, activated, creationdate");
        $info_customer = $instance_table_customer->Get_list($DBHandle, $FG_TABLE_CLAUSE, "id", "ASC", null, null, null, null);
    }
    if ($invoice_type == 1) {
        $QUERY = "Select CASE WHEN max(cover_enddate) is NULL THEN '0001-01-01 01:00:00' ELSE max(cover_enddate) END from cc_invoices WHERE cardid = " . $cardid;
    } else {
        $QUERY = "Select cover_enddate,cover_startdate  from cc_invoices where id ='{$id}'";
    }
    if (!$nodisplay) {
        $invoice_dates = $instance_table->SQLExec($DBHandle, $QUERY);
        if ($invoice_dates[0][0] == '0001-01-01 01:00:00') {
            $invoice_dates[0][0] = $info_customer[0][13];
        }
    }
    require '../Public/pdf-invoices/html2pdf/html2fpdf.php';
    ob_start();
    $currencies_list = get_currencies();
    //For DID DIAL & Fixed + Dial
    $totalcost = 0;
    if (is_array($list_total_destination) && count($list_total_destination) > 0) {
        $mmax = 0;
        $totalcall = 0;
        $totalminutes = 0;
        foreach ($list_total_destination as $data) {
            if ($mmax < $data[1]) {
                $mmax = $data[1];
            }
            $totalcall += $data[3];
            $totalminutes += $data[1];
            $totalcost += $data[2];
        }
    }
    ?>
	<table cellpadding="0"  align="center">
	<tr>
	<td align="center">
	<img src="<?php 
    echo Images_Path;
    ?>
/asterisk01.jpg" align="middle">
	</td>
	</tr>
	</table>
	<br>
	<center><h4><font color="#FF0000"><?php 
    echo $invocie_top_heading;
    ?>
&nbsp;<?php 
    echo $info_customer[0][1];
    ?>
 </font></h4></center>
	<br>
	<br>
		<table cellspacing="0" cellpadding="2" align="center" width="80%" >
		 
		  <tr>
			<td colspan="2" bgcolor="#FFFFCC"><font size="5" color="#FF0000"><?php 
    echo $invoice_heading;
    ?>
</font></td>
		  </tr>
		  <tr>
			<td valign="top" colspan="2"></td>
		  </tr>	 
		<tr>
		  <td width="35%">&nbsp; </td>
		  <td >&nbsp; </td>
		</tr>
		<tr>
		  <td width="35%" ><font color="#003399"><?php 
    echo gettext("Name");
    ?>
&nbsp; :</font> </td>
		  <td  ><font color="#003399"><?php 
    echo $info_customer[0][3] . " " . $info_customer[0][2];
    ?>
</font></td>
		</tr>
		<tr>
		  <td width="35%" ><font color="#003399"><?php 
    echo gettext("Card Number");
    ?>
&nbsp; :</font></td>
		  <td  ><font color="#003399"><?php 
    echo $info_customer[0][1];
    ?>
</font> </td>
		</tr>
		<?php 
    if ($invoice_type == 1) {
        ?>
		<tr>
		  <td width="35%" ><font color="#003399"><?php 
        echo gettext("From Date");
        ?>
&nbsp; :</font></td>
		  <td><font color="#003399"><?php 
        echo display_dateonly($invoice_dates[0][0]);
        ?>
 </font></td>
		</tr>  		
		  <?php 
    } else {
        ?>
		<tr>
		 <td width="35%" ><font color="#003399"><?php 
        echo gettext("From Date");
        ?>
&nbsp; :</font></td>
		 <td  ><font color="#003399"><?php 
        echo display_dateonly($invoice_dates[0][1]);
        ?>
 </font></td>
		</tr>
		<tr>
		  <td width="35%" ><font color="#003399"><?php 
        echo gettext("To Date");
        ?>
&nbsp; :</font></td>
		  <td><font color="#003399"><?php 
        echo display_dateonly($invoice_dates[0][0]);
        ?>
 </font></td>
		</tr>  
		  <?php 
    }
    ?>
		  </table>
		  <table align="center" width="80%">
		  	<?php 
    if (is_array($list_total_destination) && count($list_total_destination) > 0) {
        ?>
				<tr>
					<td colspan="4" align="center"><font> <b><?php 
        echo gettext("By Destination");
        ?>
</b></font> </td>
				</tr>
				<tr bgcolor="#CCCCCC">
				  <td  width="29%"><font color="#003399"><b><?php 
        echo gettext("Destination");
        ?>
 </b></font></td>
				  <td width="38%" ><font color="#003399"><b><?php 
        echo gettext("Duration");
        ?>
</b></font> </td>
				 
				  <td width="12%" align="center" ><font color="#003399"><b><?php 
        echo gettext("Calls");
        ?>
 </b></font></td>
				  <td   align="right"><font color="#003399"><b><?php 
        echo gettext("Amount") . " (" . BASE_CURRENCY . ")";
        ?>
 </b></font></td>
				</tr>
				<?php 
        $i = 0;
        foreach ($list_total_destination as $data) {
            $i = ($i + 1) % 2;
            $tmc = $data[1] / $data[3];
            if (!isset($resulttype) || $resulttype == "min") {
                $tmc = sprintf("%02d", intval($tmc / 60)) . ":" . sprintf("%02d", intval($tmc % 60));
            } else {
                $tmc = intval($tmc);
            }
            if (!isset($resulttype) || $resulttype == "min") {
                $minutes = sprintf("%02d", intval($data[1] / 60)) . ":" . sprintf("%02d", intval($data[1] % 60));
            } else {
                $minutes = $data[1];
            }
            if ($mmax > 0) {
                $widthbar = intval($data[1] / $mmax * 200);
            }
            ?>
				<tr class="invoice_rows">
				  <td width="29%" ><font color="#003399"><?php 
            echo $data[0];
            ?>
</font></td>
				  <td width="38%" ><font color="#003399"><?php 
            echo $minutes;
            ?>
 </font></td>
				  
				  <td width="12%" align="right" ><font color="#003399"><?php 
            echo $data[3];
            ?>
</font> </td>
				  <td  align="right" ><font color="#003399"><?php 
            display_2bill($data[2]);
            ?>
</font></td>
				</tr>
				<?php 
        }
        if (!isset($resulttype) || $resulttype == "min") {
            $total_tmc = sprintf("%02d", intval($totalminutes / $totalcall / 60)) . ":" . sprintf("%02d", intval($totalminutes / $totalcall % 60));
            $totalminutes = sprintf("%02d", intval($totalminutes / 60)) . ":" . sprintf("%02d", intval($totalminutes % 60));
        } else {
            $total_tmc = intval($totalminutes / $totalcall);
        }
        ?>
   
				 <tr >
				  <td width="29%" >&nbsp;</td>
				  <td width="38%" >&nbsp;</td>              
				  <td width="12%" >&nbsp; </td>
				  <td  >&nbsp; </td>
				  
				</tr>
				<tr bgcolor="#CCCCCC">
				  <td width="29%" ><font color="#003399"><?php 
        echo gettext("TOTAL");
        ?>
 </font></td>
				  <td width="38%" ><font color="#003399"><?php 
        echo $totalminutes;
        ?>
</font></td>			  
				  <td width="12%"  align="right"><font color="#003399"><?php 
        echo $totalcall;
        ?>
 </font></td>
				  <td  align="right" ><font color="#003399"><?php 
        display_2bill($totalcost - $totalcost_did);
        ?>
</font> </td>
				</tr> 			  
				<tr >
				  <td width="29%">&nbsp;</td>
				  <td width="38%">&nbsp;</td>
				  
				  <td width="12%">&nbsp; </td>
				  <td >&nbsp; </td>
				  
				</tr>			
				<?php 
    }
    ?>
				</table>
				
				<table align="center" width="80%">
				<!-- Start Here ****************************************-->
				<?php 
    $mmax = 0;
    $totalcall = 0;
    $totalminutes = 0;
    $totalcost_day = 0;
    if (is_array($list_total_day) && count($list_total_day) > 0) {
        foreach ($list_total_day as $data) {
            if ($mmax < $data[1]) {
                $mmax = $data[1];
            }
            $totalcall += $data[3];
            $totalminutes += $data[1];
            $totalcost_day += $data[2];
        }
        ?>
					
					<tr>
					<td colspan="4" align="center"><b><?php 
        echo gettext("By Date");
        ?>
</b> </td>
					</tr>
				  <tr bgcolor="#CCCCCC">
				  <td  width="29%"><font color="#003399"><b><?php 
        echo gettext("Date");
        ?>
</b> </font></td>
				  <td width="38%" ><font color="#003399"><b><?php 
        echo gettext("Duration");
        ?>
</b> </font></td>
				  
				  <td width="12%" align="center" ><font color="#003399"><b><?php 
        echo gettext("Calls");
        ?>
</b> </font></td>
				  <td width="21%"  align="right"><font color="#003399"><b><?php 
        echo gettext("Amount") . " (" . BASE_CURRENCY . ")";
        ?>
</b> </font></td>
				</tr>
				<?php 
        $i = 0;
        foreach ($list_total_day as $data) {
            $i = ($i + 1) % 2;
            $tmc = $data[1] / $data[3];
            if (!isset($resulttype) || $resulttype == "min") {
                $tmc = sprintf("%02d", intval($tmc / 60)) . ":" . sprintf("%02d", intval($tmc % 60));
            } else {
                $tmc = intval($tmc);
            }
            if (!isset($resulttype) || $resulttype == "min") {
                $minutes = sprintf("%02d", intval($data[1] / 60)) . ":" . sprintf("%02d", intval($data[1] % 60));
            } else {
                $minutes = $data[1];
            }
            if ($mmax > 0) {
                $widthbar = intval($data[1] / $mmax * 200);
            }
            ?>
				<tr class="invoice_rows">
				  <td width="29%" ><font color="#003399"><?php 
            echo $data[0];
            ?>
</font></td>
				  <td width="38%" ><font color="#003399"><?php 
            echo $minutes;
            ?>
 </font></td>
				  
				  <td width="12%"  align="right"><font color="#003399"><?php 
            echo $data[3];
            ?>
 </font></td>
				  <td width="21%" align="right" ><font color="#003399"><?php 
            display_2bill($data[2]);
            ?>
</font></td>
				</tr>
				 <?php 
        }
        if (!isset($resulttype) || $resulttype == "min") {
            $total_tmc = sprintf("%02d", intval($totalminutes / $totalcall / 60)) . ":" . sprintf("%02d", intval($totalminutes / $totalcall % 60));
            $totalminutes = sprintf("%02d", intval($totalminutes / 60)) . ":" . sprintf("%02d", intval($totalminutes % 60));
        } else {
            $total_tmc = intval($totalminutes / $totalcall);
        }
        ?>
               
				 <tr >
				  <td width="29%" >&nbsp;</td>
				  <td width="38%" >&nbsp;</td>
				  
				  <td width="12%" >&nbsp; </td>
				  <td width="21%" >&nbsp; </td>
				  
				</tr>
				<tr bgcolor="#CCCCCC">
				  <td width="29%" ><font color="#003399"><?php 
        echo gettext("TOTAL");
        ?>
 </font></td>
				  <td width="38%" ><font color="#003399"><?php 
        echo $totalminutes;
        ?>
</font></td>			  
				  <td width="12%" align="right" ><font color="#003399"><?php 
        echo $totalcall;
        ?>
</font> </td>
				  <td width="21%" align="right" ><font color="#003399"><?php 
        display_2bill($totalcost_day);
        ?>
 </font></td>
				</tr>        
				<tr >
				  <td width="29%">&nbsp;</td>
				  <td width="38%">&nbsp;</td>
				 
				  <td width="12%">&nbsp; </td>
				  <td width="21%">&nbsp; </td>
				  
				</tr>				
					<?php 
    }
    ?>
    
				
				<!-- END HERE ******************************************-->
		 
		</table>
		 <table align="center" width="80%">
		 <?php 
    if (is_array($list_total_did) && count($list_total_did) > 0) {
        ?>
		 <tr>
		  <td>
		  
			<table width="100%" align="left" cellpadding="0" cellspacing="0">
					<tr>
					<td colspan="5" align="center"><font><b><?php 
        echo gettext("DID Billing");
        ?>
</b></font> </td>
					</tr>
				<tr  bgcolor="#CCCCCC">
				  <td  width="20%"> <font color="#003399"><b><?php 
        echo gettext("Charge Date");
        ?>
 </b></font></td>
				  <td width="13%" ><font color="#003399"><b><?php 
        echo gettext("DID");
        ?>
 </b></font></td>
				  <td width="14%" ><font color="#003399"><b><?php 
        echo gettext("Country");
        ?>
</b></font> </td>
				  <td width="41%" ><font color="#003399"><b><?php 
        echo gettext("Description");
        ?>
 </b></font></td>  			  
				  <td width="12%"  align="right"><font color="#003399"><b><?php 
        echo gettext("Amount") . " (" . BASE_CURRENCY . ")";
        ?>
</b></font> </td>
				</tr>
				<?php 
        $i = 0;
        $totaldidcost = 0;
        foreach ($list_total_did as $data) {
            $totaldidcost = $totaldidcost + convert_currency($currencies_list, $data[0], $data[5], BASE_CURRENCY);
            ?>
				 <tr class="invoice_rows">
				  <td width="20%" ><font color="#003399"><?php 
            echo $data[1];
            ?>
</font></td>
				  <td width="13%" ><font color="#003399">&nbsp;<?php 
            echo $data[4];
            ?>
</font> </td>
				  <td width="14%" ><font color="#003399">&nbsp;<?php 
            echo $data[3];
            ?>
 </font></td>
				  <td width="41%" ><font color="#003399"><?php 
            echo $data[2];
            ?>
</font> </td>			  
				  <td width="12%" align="right" ><font color="#003399"><?php 
            convert_currency($currencies_list, $data[0], $data[5], BASE_CURRENCY) . " " . BASE_CURRENCY;
            ?>
</font></td>
				</tr>
				 <?php 
        }
        $totalcost = $totalcost + $totaldidcost;
        ?>
   
				 <tr >
				  <td width="20%" >&nbsp;</td>
				  <td width="13%" >&nbsp;</td>
				  <td width="14%" >&nbsp; </td>
				  <td width="41%" >&nbsp; </td>			 
				  <td width="12%" >&nbsp; </td>			  
				</tr>
				<tr bgcolor="#CCCCCC" >
				  <td width="20%" ><font color="#003399"><?php 
        echo gettext("TOTAL");
        ?>
 </font></td>
				  <td ><font color="#003399">&nbsp;</font></td>			  
				  <td width="14%" ><font color="#003399">&nbsp;</font> </td>
				  <td width="41%" ><font color="#003399">&nbsp;</font> </td>			  
				  <td width="12%" align="right" ><font color="#003399"><?php 
        display_2bill($totaldidcost);
        ?>
</font> </td>
				</tr>  
				<tr>
				  <td width="20%">&nbsp;</td>
				  <td width="13%">&nbsp;</td>
				  <td width="14%">&nbsp; </td>
				  <td width="41%">&nbsp; </td>			 
				  <td width="12%">&nbsp; </td>
				</tr>
			
			</table>
			
		  </td>
		  </tr>
		  <?php 
    }
    ?>
		   <tr>
			<td>
			<!-------------------------EXTRA CHARGE START HERE ---------------------------------->
		
		 <?php 
    $i = 0;
    $extracharge_total = 0;
    if (is_array($list_total_charges) && count($list_total_charges) > 0) {
        ?>
			<table width="100%" align="left" cellpadding="0" cellspacing="0">
				<tr>
				<td colspan="4" align="center"><font><b><?php 
        echo gettext("Extra Charges");
        ?>
</b></font> </td>
				</tr>
				<tr  bgcolor="#CCCCCC">
				  <td  width="20%"> <font color="#003399"><b><?php 
        echo gettext("Date");
        ?>
 </b></font></td>
				  <td width="19%" ><font color="#003399"><b><?php 
        echo gettext("Type");
        ?>
 </b></font></td>
				  <td width="43%" ><font color="#003399"><b><?php 
        echo gettext("Description");
        ?>
</b></font> </td>			
				  <td width="18%"  align="right"><font color="#003399"><b><?php 
        echo gettext("Amount") . " (" . BASE_CURRENCY . ")";
        ?>
</b></font> </td>
				</tr>
				<?php 
        foreach ($list_total_charges as $data) {
            $extracharge_total = $extracharge_total + convert_currency($currencies_list, $data[3], $data[6], BASE_CURRENCY);
            ?>
				 <tr class="invoice_rows">
				  <td width="20%" ><font color="#003399"><?php 
            echo $data[2];
            ?>
</font></td>
				  <td width="19%" ><font color="#003399">
				  <?php 
            if ($data[4] == 1) {
                echo gettext("Setup Charges");
            }
            if ($data[4] == 2) {
                echo gettext("DID Montly Use");
            }
            if ($data[4] == 3) {
                echo gettext("Subscription Fee");
            }
            if ($data[4] == 4) {
                echo gettext("Extra Charges");
            }
            ?>
				  </font> </td>
				  <td width="43%" ><font color="#003399"><?php 
            echo $data[7];
            ?>
</font></td>			 
				  <td width="18%" align="right" ><font color="#003399"><?php 
            echo convert_currency($currencies_list, $data[3], $data[6], BASE_CURRENCY) . " " . BASE_CURRENCY;
            ?>
</font></td>
				</tr>
				 <?php 
        }
        //for loop end here
        ?>
				 <tr >
				  <td width="20%" >&nbsp;</td>
				  <td width="19%" >&nbsp;</td>
				  <td width="43%" >&nbsp; </td>			 
				  <td width="18%" >&nbsp; </td>
				  
				</tr>
				<tr bgcolor="#CCCCCC" >
				  <td width="20%" ><font color="#003399"><?php 
        echo gettext("TOTAL");
        ?>
 </font></td>
				  <td ><font color="#003399">&nbsp;</font></td>			  
				  <td width="43%" ><font color="#003399">&nbsp;</font> </td>			  
				  <td width="18%" align="right" ><font color="#003399"><?php 
        echo display_2bill($extracharge_total);
        ?>
</font> </td>
				</tr>    			        
				<tr >
				  <td width="20%">&nbsp;</td>
				  <td width="19%">&nbsp;</td>
				  <td width="43%">&nbsp; </td>			  
				  <td width="18%">&nbsp; </td>			  
				</tr>		
			</table>		
			<?php 
    }
    //if check end here
    $totalcost = $totalcost + $extracharge_total;
    ?>
<!-----------------------------EXTRA CHARGE END HERE ------------------------------->		
			
			</td>
			</tr>
		  
		 <tr>
		 <td><img src="<?php 
    echo Images_Path;
    ?>
/spacer.jpg" align="middle" height="30px"></td>
		 </tr>
		 <tr bgcolor="#CCCCCC" >
		 <td  align="right" width="100%"><font color="#003399"><b><?php 
    echo gettext("Total");
    ?>
 = <?php 
    display_2bill($totalcost);
    ?>
&nbsp;</b></font></td>
		 </tr>
		 <tr bgcolor="#CCCCCC" >
		 <td  align="right" width="100%"><font color="#003399"><b><?php 
    echo gettext("VAT");
    ?>
 = <?php 
    $prvat = $vat / 100 * $totalcost;
    display_2bill($prvat);
    ?>
&nbsp;</b></font></td>
		 </tr>
		 <tr>
		 <td><img src="<?php 
    echo Images_Path;
    ?>
/spacer.jpg" align="middle" height="30px"></td>
		 </tr>
		 <tr bgcolor="#CCCCCC" >
		 <td  align="right" width="100%"><font color="#003399"><b><?php 
    echo gettext("Grand Total");
    ?>
 = <?php 
    echo display_2bill($totalcost + $prvat);
    ?>
&nbsp;</b></font></td>
		 </tr>
		 <tr>
		 <td><img src="<?php 
    echo Images_Path;
    ?>
/spacer.jpg" align="middle" height="30px"></td>
		 </tr>
		 </table>
		
	<table cellspacing="0" cellpadding="2" width="80%" align="center">
	<tr>
		<td colspan="3">&nbsp;</td>
		</tr>           			
		<tr>
		  <td  align="left">Status :&nbsp;<?php 
    if ($info_customer[0][12] == 't') {
        ?>
		  <img src="<?php 
        echo Images_Path;
        ?>
/connected.jpg">
		  <?php 
    } else {
        ?>
		  <img src="<?php 
        echo Images_Path;
        ?>
/terminated.jpg">
		  <?php 
    }
    ?>
 </td>              
		</tr>
		<tr>	  
		  <td  align="left">&nbsp; <img src="<?php 
    echo Images_Path;
    ?>
/connected.jpg"> &nbsp;<?php 
    echo gettext("Connected");
    ?>
 
		  &nbsp;&nbsp;&nbsp;<img src="<?php 
    echo Images_Path;
    ?>
/terminated.jpg">&nbsp;<?php 
    echo gettext("Disconnected");
    ?>
 
		  </td>
	</table>

<?php 
    $html = ob_get_contents();
    // delete output-Buffer
    ob_end_clean();
    $pdf = new HTML2FPDF();
    $pdf->DisplayPreferences('HideWindowUI');
    $pdf->AddPage();
    $pdf->WriteHTML($html);
    $stream = $pdf->Output('UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', 'S');
    //================================Email Template Retrival Code ===================================
    $QUERY = "SELECT mailtype, fromemail, fromname, subject, messagetext, messagehtml FROM cc_templatemail WHERE mailtype='invoice' ";
    $res = $DBHandle->Execute($QUERY);
    $num = 0;
    if ($res) {
        $num = $res->RecordCount();
    }
    if (!$num) {
        echo "<br>Error : No email Template Found";
        exit;
    }
    for ($i = 0; $i < $num; $i++) {
        $listtemplate[] = $res->fetchRow();
    }
    list($mailtype, $from, $fromname, $subject, $messagetext, $messagehtml) = $listtemplate[0];
    if ($FG_DEBUG == 1) {
        echo "<br><b>mailtype : </b>{$mailtype}</br><b>from:</b> {$from}</br><b>fromname :</b> {$fromname}</br><b>subject</b> : {$subject}</br><b>ContentTemplate:</b></br><pre>{$messagetext}</pre></br><hr>";
    }
    //================================================================================================
    $ok = send_email_attachment($from, $info_customer[0][10], $subject, $messagetext, 'UnBilledDetails_' . date("d/m/Y-H:i") . '.pdf', $stream);
    return $ok;
}
예제 #9
0
?>
</div>
<div class="column span-8">
	<?php 
echo form_input('sum_value', set_value('sum_value', $ds->sum_value), 'id="sum_value" class="text" readonly="readonly" style="width: 50px;"');
?>
</div>

<div class="column span-4">
	<?php 
echo form_label(lang('CURENCY'), '_currencies_rid');
?>
</div>
<div class="column span-8 last">
	<?php 
echo form_dropdown('_currencies_rid', get_currencies(), set_value('_currencies_rid', $ds->_currencies_rid), 'id="_currencies_rid" readonly="readonly" class="text" ');
?>
</div>

<div class="column span-4">
	<?php 
echo form_label(lang('STATE'), '_account_states_rid');
?>
</div>
<div class="column span-8">
	<?php 
echo form_dropdown('_account_states_rid', get_states_list(), set_value('_account_states_ridd', $ds->_account_states_rid), 'id="_account_states_rid" readonly="readonly" class="text" ');
?>
</div>
<div class="column span-4">
	<?php 
예제 #10
0
 /**
  * Create the HTML interface for Currency field.
  *
  * @since 1.1.3
  *
  * @param array $field The $field being edited.
  */
 function render_field($field)
 {
     if (!is_array($field['value'])) {
         if ($field['value'] && is_string($field['value'])) {
             $field['value'] = explode(',', $field['value']);
         } elseif (!empty($field['value'])) {
             $field['value'] = array($field['value']);
         }
     }
     if (empty($field['value'])) {
         // add empty value (allows '' to be selected)
         $field['value'][''] = '';
     }
     // vars
     $atts = array('id' => $field['id'], 'class' => $field['class'], 'name' => $field['name'], 'data-multiple' => $field['multiple'], 'data-allow_null' => $field['allow_null']);
     // hidden input
     if ($field['multiple']) {
         acf_hidden_input(array('type' => 'hidden', 'name' => $field['name']));
     }
     // multiple
     if ($field['multiple']) {
         $atts['multiple'] = 'multiple';
         $atts['size'] = 5;
         $atts['name'] .= '[]';
     }
     // special atts
     foreach (array('readonly', 'disabled') as $k) {
         if (!empty($field[$k])) {
             $atts[$k] = $k;
         }
     }
     // html
     echo '<select ' . acf_esc_attr($atts) . '>';
     // null option
     if ($field['allow_null']) {
         echo '<option value="null">- ' . __("Select", 'acf') . ' -</option>';
     }
     // get currencies via WP Currencies
     $currencies = get_currencies();
     // print options
     foreach ($currencies as $currency => $data) {
         $data = (array) $data;
         $selected = in_array($currency, $field['value']) ? 'selected="selected"' : '';
         echo '<option value="' . $currency . '" ' . $selected . '>' . $currency . ' ' . $data['name'] . '</option>' . "\n";
     }
     echo '</select>';
 }
예제 #11
0
/**
 * Check if a currency code is valid.
 *
 * Helper function to check whether a currency exists in database by its code.
 *
 * @since   1.2.0
 *
 * @param  string $currency_code A three-letter ISO currency code.
 * @return bool|null True if the currency exists, false if it is unrecognized. Null on error.
 */
function currency_exists($currency_code)
{
    $currencies = get_currencies();
    $codes = '';
    if ($currencies && is_array($currencies)) {
        foreach ($currencies as $key => $value) {
            $codes[] = $key;
        }
    }
    return $codes && is_array($codes) ? in_array(strtoupper($currency_code), (array) $codes) : null;
}
예제 #12
0
 /**
  * Get currency data API callback function.
  *
  * @since 1.4.0
  *
  * @return array Currencies data
  */
 public function get_currencies()
 {
     return get_currencies();
 }
예제 #13
0
 function __construct($type, $id_card = null, $lg = null, $msg = null, $title = null)
 {
     $DBHandle = Connection::GetDBHandler();
     if (!empty($type)) {
         $tmpl_table = new Table("cc_templatemail", "*");
         $tmpl_clause = " mailtype = '{$type}'";
         $order = null;
         $order_field = null;
         if (!empty($lg)) {
             $tmpl_clause .= " AND ( id_language = '{$lg}' OR  id_language = 'en' )";
             $order_field = 'id_language';
             if (strcasecmp($lg, 'en') < 0) {
                 $order = 'ASC';
             } else {
                 $order = 'DESC';
             }
         } elseif (!is_null($id_card) && is_numeric($id_card)) {
             $card_table = new Table("cc_card", "*, IF((typepaid=1) AND (creditlimit IS NOT NULL), credit + creditlimit, credit) AS real_credit");
             $card_clause = " id = " . $id_card;
             $result_card = $card_table->Get_list($DBHandle, $card_clause, 0);
             if (is_array($result_card) && sizeof($result_card) > 0) {
                 $card = $result_card[0];
             }
             $language = $card['language'];
             if (!empty($language)) {
                 $tmpl_clause .= " AND ( id_language = '{$language}' OR  id_language = 'en' )";
                 $order_field = 'id_language';
                 if (strcasecmp($language, 'en') < 0) {
                     $order = 'ASC';
                 } else {
                     $order = 'DESC';
                 }
             }
         }
         $result_tmpl = $tmpl_table->Get_list($DBHandle, $tmpl_clause, $order_field, $order);
         if (is_array($result_tmpl) && sizeof($result_tmpl) > 0) {
             $mail_tmpl = $result_tmpl[0];
             $this->message = $mail_tmpl['messagetext'];
             $this->title = $mail_tmpl['subject'];
             $this->from_email = $mail_tmpl['fromemail'];
             $this->from_name = $mail_tmpl['fromname'];
         } else {
             throw new A2bMailException("Template Type '{$type}' cannot be found into the database!");
         }
     } elseif (!empty($msg) || !empty($title)) {
         $this->message = $msg;
         $this->title = $title;
     } else {
         throw new A2bMailException("Error : no Type defined and neither message or subject is provided!");
     }
     if (!empty($this->message) || !empty($this->title)) {
         if (!is_null($id_card) && is_numeric($id_card)) {
             $this->id_card = $id_card;
             if (is_null($card)) {
                 $card_table = new Table("cc_card", "*, IF((typepaid=1) AND (creditlimit IS NOT NULL), credit + creditlimit, credit) AS real_credit");
                 $card_clause = " id = " . $id_card;
                 $result_card = $card_table->Get_list($DBHandle, $card_clause, 0);
                 if (is_array($result_card) && sizeof($result_card) > 0) {
                     $card = $result_card[0];
                 }
             }
             $credit = $card['real_credit'];
             $credit = round($credit, 3);
             $currency = $card['currency'];
             $currencies_list = get_currencies($DBHandle);
             if (!isset($currencies_list[strtoupper($currency)][2]) || !is_numeric($currencies_list[strtoupper($currency)][2])) {
                 $mycur = 1;
             } else {
                 $mycur = $currencies_list[strtoupper($currency)][2];
             }
             $credit_currency = $credit / $mycur;
             $credit_currency = round($credit_currency, 3);
             $this->to_email = $card['email'];
             $this->replaceInEmail(self::$CUSTOMER_CARDNUMBER_KEY, $card['username']);
             $this->replaceInEmail(self::$CUSTOMER_EMAIL_KEY, $card['email']);
             $this->replaceInEmail(self::$CUSTOMER_FIRSTNAME_KEY, $card['firstname']);
             $this->replaceInEmail(self::$CUSTOMER_LASTNAME_KEY, $card['lastname']);
             $this->replaceInEmail(self::$CUSTOMER_LOGIN, $card['useralias']);
             $this->replaceInEmail(self::$CUSTOMER_LOGINKEY, $card['loginkey']);
             $this->replaceInEmail(self::$CUSTOMER_PASSWORD_KEY, $card['uipass']);
             $this->replaceInEmail(self::$CUSTOMER_CREDIT_IN_OWN_CURRENCY_KEY, $credit_currency);
             $this->replaceInEmail(self::$CUSTOMER_CREDIT_BASE_CURRENCY_KEY, $credit);
             $this->replaceInEmail(self::$CUSTOMER_CURRENCY, $currency);
             $this->replaceInEmail(self::$CUSTOMER_CREDIT_NOTIFICATION, $card['credit_notification']);
         }
         $this->replaceInEmail(self::$SYSTEM_CURRENCY, BASE_CURRENCY);
     }
 }
예제 #14
0
 /**
  * @param string $key
  *
  * @return array
  */
 protected function getOneFromConfig($key)
 {
     $key = strtolower($key);
     return array_get(get_currencies(), 'iso.' . $key, null);
 }
예제 #15
0
파일: create.php 프로젝트: vsanth/travelcrm
?>
</div>
<div class="column span-20 last">
	<?php 
echo form_input('s_name', set_value('s_name', ''), 'id="s_name" class="text part-5"');
?>
</div>
<div class="column span-4">
	<?php 
echo form_label(lang('CLIENT') . get_field_help('aircalls', 'CLIENT'), '_clients_rid');
?>
</div>
<div class="column span-20 last">
	<?php 
echo get_clients_vp(set_value('_clients_rid', null));
?>
</div>
<div class="column span-4">
	<?php 
echo form_label(lang('PHONES') . required_field(), 'phones');
?>
 
</div>
<div class="column span-20 last">
	<?php 
echo form_input('phones', set_value('phones', ''), 'id="phones" class="text part-5"');
?>
</div>
<div class="column span-4">
	<?php 
echo form_label(lang('EMAIL'), 'email');
예제 #16
0
파일: Misc.php 프로젝트: saydulk/a2billing
function display_2bill($var, $currency = BASE_CURRENCY)
{
    global $currencies_list, $choose_currency;
    if (isset($choose_currency) && strlen($choose_currency) == 3) {
        $currency = $choose_currency;
    }
    if (!isset($currencies_list) || !is_array($currencies_list)) {
        $currencies_list = get_currencies();
    }
    $var = $var / $currencies_list[strtoupper($currency)][2];
    echo number_format($var, 3) . ' ' . strtoupper($currency);
}
예제 #17
0
include ("../lib/epayment/classes/order.php");
include ("../lib/epayment/classes/currencies.php");
include ("../lib/epayment/includes/general.php");
include ("../lib/epayment/includes/html_output.php");
include ("../lib/epayment/includes/loadconfiguration.php");
include ("../lib/epayment/includes/configure.php");
include ("../lib/agent.smarty.php");


if (!has_rights(ACX_ACCESS)) {
	Header("HTTP/1.0 401 Unauthorized");
	Header("Location: PP_error.php?c=accessdenied");
	die();
}

$currencies_list = get_currencies();
$two_currency = false;
if (!isset ($currencies_list[strtoupper($_SESSION['currency'])][2]) || !is_numeric($currencies_list[strtoupper($_SESSION['currency'])][2])) {
	$mycur = 1;
} else {
	$mycur = $currencies_list[strtoupper($_SESSION['currency'])][2];
	$display_currency = strtoupper($_SESSION['currency']);
	if (strtoupper($_SESSION['currency']) != strtoupper(BASE_CURRENCY))
		$two_currency = true;
}

$HD_Form = new FormHandler("cc_payment_methods", "payment_method");

getpost_ifset(array (
	'item_id',
	'item_type',
예제 #18
0
function display_currencies()
{
    global $table_style;
    $company_currency = get_company_currency();
    $result = get_currencies();
    start_table($table_style);
    $th = array(tr("Abbreviation"), tr("Symbol"), tr("Currency Name"), tr("Hundredths name"), tr("Country"), "", "");
    table_header($th);
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        if ($myrow[1] == $company_currency) {
            start_row("class='currencybg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($myrow["curr_abrev"]);
        label_cell($myrow["curr_symbol"]);
        label_cell($myrow["currency"]);
        label_cell($myrow["hundreds_name"]);
        label_cell($myrow["country"]);
        edit_link_cell("selected_id=" . $myrow["curr_abrev"]);
        if ($myrow["curr_abrev"] != $company_currency) {
            delete_link_cell("selected_id=" . $myrow["curr_abrev"] . "&delete=1");
        }
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    display_note(tr("The marked currency is the home currency which cannot be deleted."), 0, 0, "class='currentfg'");
}