本文整理汇总了PHP中invoice::create方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::create方法的具体用法?PHP invoice::create怎么用?PHP invoice::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invoice
的用法示例。
在下文中一共展示了invoice::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chr
require "include/invoice_menu.php";
echo '<h1>Opprett faktura - feilmelding</h1>' . chr(10);
echo 'Problemer med faktura. Vennligst ta kontakt.';
echo '<br><br>';
echo 'Feilmelding:<br>';
echo $invoice->error();
exit;
} else {
$error_msg = $invoice->error();
$error = $invoice->inndata_error;
// array
$preview = false;
}
}
} elseif (!count($warning)) {
if (!$invoice->create($TMP_invoice_extra_content['invoice_time_due'], $TMP_invoice_extra_content['invoice_time'], $TMP_invoice_content, $TMP_invoice_extra_content)) {
if ($invoice->error_code != '100') {
require "include/invoice_menu.php";
echo '<h1>Opprett faktura - feilmelding</h1>' . chr(10);
echo 'Problemer med faktura. Vennligst ta kontakt.';
echo '<br><br>';
echo 'Feilmelding:<br>';
echo $invoice->error();
exit;
} else {
$error_msg = $invoice->error();
$error = $invoice->inndata_error;
// array
}
} else {
// Redirect
示例2: create_invoice
private function create_invoice()
{
$this->invoice_id = invoice::create($this->order_id, $this->lang_ui);
}
示例3: cron
public function cron()
{
global $dbh, $postvar, $getvar, $instance;
$packages_query = $dbh->select("packages", array("type" => "paid"), 0, 0, 1);
$packages_num_rows = $dbh->num_rows($packages_query);
//Do we have paid packages?
if ($packages_num_rows) {
while ($packages_data = $dbh->fetch_array($packages_query)) {
$i++;
//Do we have multiple packages and aren't on the last one?
if ($packages_data < $i) {
//Did we already pull one package? If so, we don't set the flag for the parenthesis.
if ($pulled_one) {
$where[] = array("pid", "=", $packages_data['id'], "OR");
//We are on the first listing of the paid packages, so we set the flag for the opening parenthesis and mark it that we pulled one already.
} else {
$where[] = array("pid", "=", $packages_data['id'], "OR", 1);
$pulled_one = 1;
}
} else {
//Are we on the last listing of paid listings? If so, we close the parenthesis by setting that flag.
if ($pulled_one) {
$where[] = array("pid", "=", $packages_data['id'], "", 1);
//We only had one listing, so we don't use parenthesis and we don't use "OR."
} else {
$where[] = array("pid", "=", $packages_data['id']);
}
}
//So we can later grab the package's information without needing to repull this data.
$packages_info[$packages_data['id']] = $packages_data;
}
$time = time();
//Look at every last invoice.
$invoices_query = $dbh->select("invoices");
while ($invoices_data = $dbh->fetch_array($invoices_query)) {
$uid = $invoices_data['uid'];
$client = $dbh->client($uid);
//Skip this invoice if it belongs to a user marked as a free user.
if ($client['freeuser']) {
continue;
}
//If the invoice is older than 30 days and we haven't issued a new invoice yet... (This makes sure the user is still on the package
//before issuing a new invoice for it.)
if ($time > $invoices_data['created'] + 2592000 && !in_array($uid, $invoiced_to) && $invoices_data['pid'] == $client['pid']) {
$pack_additional = type::additional($client['pid']);
$amount = coupons::get_discount("paid", $pack_additional['monthly'], $client['user']);
invoice::create($uid, $amount, $time, "Your hosting package invoice for this billing cycle. Package: " . $packages_info[$client['pid']]['name']);
$invoiced_to[] = $uid;
//Track what clients have been sent a new invoice.
}
$lastmonth = $time - 2592000;
$suspenddays = $dbh->config('suspensiondays');
$terminationdays = $suspenddays + $dbh->config('terminationdays');
$suspendseconds = $suspenddays * 24 * 60 * 60;
$terminateseconds = $dbh->config('terminationdays') * 24 * 60 * 60;
//If we have an unpaid bill that's greater than $0 and it's past it's due date...
if ($invoices_data['due'] < $time and $invoices_data['is_paid'] == 0 && $invoices_data['amount'] > 0) {
//If we have a bill that's overdue by $terminationdays + $suspenddays, then we terminate the account...
if ($time - $suspendseconds - $terminateseconds > $invoices_data['due']) {
server::terminate($uid, "Your account was overdue for more than " . $terminationdays . " days.");
$checked_term = 1;
//If we have a bill that's overdue by $suspenddays and the client is active, then we suspend them...
//Just an FYI, if I start(ed) charging for this script, check The Pirate Bay for this script as I always upload my payware stuff there since I know not everyone can afford to pay me.
} elseif ($time - $suspendseconds > $invoices_data['due'] && $client['status'] == '1') {
server::suspend($uid, "Your account is overdue. Please log in and pay your invoice to bring your account out of suspension.");
}
}
}
//If the user does not have an invoice yet and never had one, this will create one for them. The portion above
//handles creating NEW invoices. (It checks for outdated ones and such.)
$users_query = $dbh->select("users", $where, 0, 0, 1);
while ($users_data = $dbh->fetch_array($users_query)) {
//Skip this user if its marked as a free user.
if ($users_data['freeuser']) {
continue;
}
$invoice_data = $dbh->select("invoices", array("pid", "=", $users_data['pid']));
if (!$invoice_data['id']) {
$monthly = type::additional($users_data['pid']);
$amount = $monthly['monthly'];
$amount = coupons::get_discount("paid", $amount, $users_data['id']);
invoice::create($users_data['id'], $amount, $time + 30 * 24 * 60 * 60, "Your hosting package invoice for this billing cycle. Package: " . $packages_info[$users_data['pid']]['name']);
// Create Invoice +30 Days
}
}
}
}
示例4: do_upgrade
public function do_upgrade($upgradeid, $mode, $no_errors_out = 0)
{
global $dbh, $postvar, $getvar, $instance;
//$mode
//
//Init - When the upgrade info is added, we call this function.
//Update - When cron or an admin does something with this function, we check to see if various tasks are ready to be performed.
//Flag meaning:
//
//IMMEDIATE UPGRADE FLAGS
//
//0 - Upgrade is immediate.
//5 - If admin approves the upgrade, then the upgrade will be immediate.
//
//6 - If admin approves the upgrade, then the new account will be created on the new server and the
// admin will know that they are moving to a new server so they can manually close the old account
// when they're ready.
//
//7 - The new account on the new server will be immediately created and the admin will be notified that
// the user is switching servers.
//
//NEXT MONTH UPGRADE FLAGS
//
//1 - Cron will upgrade them next month.
//2 - If admin approves this, then it will be set to 1 for cron to upgrade them next month.
//3 - The admin will be notified that the user wishes to be upgraded and if they approve it,
// then an account on the new server will be created so they can migrate to the new server.
// the admin can opt to switch the account over before next month if they both agree and the
// switch will be made in the admin area manually.
//
//4 - Cron will create a new account on the new server next month and inform the admin that the
// user is changing to the new server.
//
$upgrade_data = $dbh->select("upgrade", array("id", "=", $upgradeid));
$userid = $upgrade_data['uid'];
$newpack = $upgrade_data['newpack'];
$flags = $upgrade_data['flags'];
$created = $upgrade_data['created'];
$coupcode = $upgrade_data['coupcode'];
$user_data = main::uidtopack($userid);
$current_pack_type = $user_data['packages']['type'];
$current_pack_name = $user_data['packages']['name'];
$current_pack_id = $user_data['packages']['id'];
$user_info = $dbh->select("users", array("id", "=", $userid));
$user_email = $user_info['email'];
$username = $user_info['user'];
$new_plan_data = $dbh->select("packages", array("id", "=", $newpack));
$newpack_name = $new_plan_data['name'];
$new_plan_additional = type::additional($newpack);
$new_server_data = $dbh->select("servers", array("id", "=", $new_plan_data['server']));
$new_server_name = $new_server_data['name'];
$old_server_data = $dbh->select("servers", array("id", "=", $user_data['packages']['server']));
$old_server_name = $old_server_data['name'];
switch ($flags) {
case "0":
$upgrade = 1;
break;
case "1":
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
}
break;
case "2":
if ($mode = "Init") {
$admin_approval = 1;
} else {
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
}
if (!$upgrade) {
$dbh->update("upgrade", array("flags" => "1"), array("id", "=", $upgradeid), "1");
}
}
break;
case "3":
if ($mode = "Init") {
$admin_approval = 1;
$new_server = 1;
} else {
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
$new_server = 1;
}
if (!$upgrade) {
$dbh->update("upgrade", array("flags", "=", "4"), array("id", "=", $upgradeid), "1");
}
}
break;
case "4":
//If its already the day for the upgrade, then we can do the upgrade now.
$upgrade_today = self::upgrade_today($current_pack_type, $userid);
if ($upgrade_today) {
$upgrade = 1;
$new_server = 1;
$admin_inform = 1;
//.........这里部分代码省略.........
示例5: signup
public function signup($data)
{
global $dbh, $postvar, $getvar, $instance;
$domain = $data['domain'];
$username = $data['username'];
$password = $data['password'];
$user_email = $data['user_email'];
$firstname = $data['firstname'];
$lastname = $data['lastname'];
$address = $data['address'];
$city = $data['city'];
$state = $data['state'];
$zip = $data['zip'];
$country = $data['country'];
$phone = $data['phone'];
$tzones = $data['tzones'];
$coupon = $data['coupon'];
$package = $data['package'];
$domsub = $data['domsub'];
$additional = $data['additional'];
$subdomain = empty($data['subdomain']) ? 0 : $data['subdomain'];
//Let's make sure we're actually receiving an integer as a string.
if (!is_numeric($package) || strpos($package, ".") !== false) {
return "The package specified is invalid.";
}
//Check to see if we have a valid domain type.
if ($domsub != "dom" && $domsub != "sub") {
return "The domain/subdomain type is unspecified in the URL.";
}
if ($domsub == "dom") {
$cdom = $domain;
} else {
$csub2 = $domain;
$csub = $subdomain;
}
unset($where);
$where[] = array("id", "=", $package, "AND");
$where[] = array("is_disabled", "=", "0");
$packages_data = $dbh->select("packages", $where);
if (!$packages_data['id']) {
return "This package is disabled or doesn't exist.";
}
$package_server = $packages_data['server'];
if ($domsub == "dom") {
$use_dom = $cdom;
}
if ($domsub == "sub") {
unset($where);
$where[] = array("server", "=", $package_server, "AND");
$where[] = array("domain", "=", $csub2);
$subdomains_data = $dbh->select("subdomains", $where, 0, "1");
if (!$subdomains_data['id']) {
return "The chosen domain for your subdomain is not in the allowed list of domains.";
}
$use_dom = $csub . "." . $csub2;
}
if ($coupon && $packages_data['type'] != 'free') {
$coupon_response = coupons::validate_coupon($coupon, "orders", $username, $package);
if (!$coupon_response) {
return "Please enter a valid coupon.";
} else {
$coupon_info = coupons::coupon_data($coupon);
}
}
$packtype_instance = $instance->packtypes[$packages_data['type']];
if (method_exists($packtype_instance, "signup")) {
$packtype_signup = $packtype_instance->signup();
//If this gives any response, it means it failed to validate the signup.
if ($packtype_signup) {
return $packtype_signup;
}
}
$server_package_name = type::packageBackend($package);
$serverfile = self::createServer($package);
$packages_data = $dbh->select("packages", array("id", "=", $package));
$extra['firstname'] = $firstname;
$extra['lastname'] = $lastname;
$extra['address'] = $address;
$extra['city'] = $city;
$extra['state'] = $state;
$extra['zip'] = $zip;
$extra['country'] = strtoupper($country);
$extra['phone'] = $phone;
$server_response = $serverfile->signup(type::packageserver($package), $packages_data['reseller'], $username, $user_email, $password, $use_dom, $server_package_name, $extra, $use_dom);
if ($server_response !== true) {
return $server_response;
} else {
$time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$salt = crypto::salt();
$password_hash = crypto::passhash($password, $salt);
if ($packages_data['admin'] == "1") {
$status = "3";
} else {
if ($packages_data['type'] == "paid") {
$status = "4";
} else {
$status = "1";
}
}
//.........这里部分代码省略.........