当前位置: 首页>>代码示例>>PHP>>正文


PHP invoice::load_data_export方法代码示例

本文整理汇总了PHP中invoice::load_data_export方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::load_data_export方法的具体用法?PHP invoice::load_data_export怎么用?PHP invoice::load_data_export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在invoice的用法示例。


在下文中一共展示了invoice::load_data_export方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: invoice

 $obj_sql_contact = new sql_query();
 $obj_sql_contact->string = "SELECT id, contact FROM customer_contacts WHERE customer_id = '" . $obj_sql_invoice->data[0]["customerid"] . "' AND role = 'accounts'";
 $obj_sql_contact->execute();
 $obj_sql_contact->fetch_array();
 //fetch email to address, set error if no address is set
 $to = sql_get_singlevalue("SELECT detail AS value FROM customer_contact_records WHERE contact_id = '" . $obj_sql_contact->data[0]["id"] . "' AND type = 'email' LIMIT 1");
 if (!$to) {
     $error_array[] = $obj_sql_invoice->data[0]["code_invoice"];
     continue;
 }
 //create invoice
 $obj_invoice = new invoice();
 $obj_invoice->type = "ar";
 $obj_invoice->id = $invoice_id;
 $obj_invoice->load_data();
 $obj_invoice->load_data_export();
 //get templating keys and values
 $invoice_data = $obj_invoice->invoice_fields;
 $invoice_data_parts['keys'] = array_keys($invoice_data);
 $invoice_data_parts['values'] = array_values($invoice_data);
 foreach ($invoice_data_parts['keys'] as $index => $key) {
     $invoice_data_parts['keys'][$index] = "(" . $key . ")";
 }
 foreach ($invoice_data_parts['values'] as $index => $value) {
     $invoice_data_parts['values'][$index] = trim($value);
 }
 $invoice_data_parts['keys'][] = "(days_overdue)";
 $invoice_data_parts['values'][] = trim($days_overdue);
 //create email message
 $email_message = @security_form_input_predefined("any", "email_message", 0, "");
 $email_message = str_replace($invoice_data_parts['keys'], $invoice_data_parts['values'], $email_message);
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:account-statements-process.php

示例2: page_execute

function page_execute()
{
    /*
    	Check Configuration
    */
    if (!empty($GLOBALS["config"]["ORDERS_BILL_ENDOFMONTH"])) {
        /*
        	Check that today is the last day of the month
        */
        //if (time_calculate_monthdate_last( date("Y-m-d") ) == date("Y-m-d"))
        if (true) {
            log_write("notification", "cron_orders", "Today is the end of the month, time to process customer orders and convert into invoices.");
            /*
            	Fetch all the customer ID for customers who currently have order items - no point going through
            	*all* customers, only need to do those with items.
            */
            $sql_customer_obj = new sql_query();
            $sql_customer_obj->string = "SELECT id_customer FROM customers_orders GROUP BY id_customer";
            $sql_customer_obj->execute();
            if ($sql_customer_obj->num_rows()) {
                $sql_customer_obj->fetch_array();
                foreach ($sql_customer_obj->data as $data_customer) {
                    /*
                    	Execute order processing for customer
                    */
                    // generate the invoice
                    $obj_customer = new customer_orders();
                    $obj_customer->id = $data_customer["id_customer"];
                    $obj_customer->load_data();
                    $invoiceid = $obj_customer->invoice_generate();
                    // send the PDF (if desired)
                    if ($GLOBALS["config"]["ACCOUNTS_INVOICE_AUTOEMAIL"] == 1 || $GLOBALS["config"]["ACCOUNTS_INVOICE_AUTOEMAIL"] == "enabled") {
                        $invoice = new invoice();
                        $invoice->id = $invoiceid;
                        $invoice->type = "ar";
                        $invoice->load_data();
                        $invoice->load_data_export();
                        if ($invoice->data["amount_total"] > 0) {
                            // generate an email
                            $email = $invoice->generate_email();
                            // send email
                            $invoice->email_invoice("system", $email["to"], $email["cc"], $email["bcc"], $email["subject"], $email["message"]);
                            // complete
                            log_write("notification", "cron_orders", "Invoice " . $invoice->data["code_invoice"] . " has been emailed to customer (" . $email["to"] . ")");
                        } else {
                            // complete - invoice is for $0, so don't want to email out
                            log_write("notification", "cron_orders", "Invoice " . $invoice->data["code_invoice"] . " has not been emailed to the customer due to invoice being for \$0.");
                        }
                        unset($invoice);
                    } else {
                        log_write("notification", "cron_orders", "Not emailing invoice " . $invoice->data["code_invoice"] . " to customer due to ACCOUNTS_INVOICE_AUTOEMAIL being disabled");
                    }
                }
            }
            log_write("notification", "cron_orders", "Completed processing of orders, total of " . $sql_customer_obj->num_rows() . " affected");
        } else {
            log_write("notification", "cron_orders", "Not processing orders, waiting until the end of the month");
        }
    } else {
        log_write("notification", "cron_orders", "Not processing monthly orders, ORDERS_BILL_ENDOFMONTH option is disabled");
    }
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:62,代码来源:orders.php

示例3: service_invoices_generate


//.........这里部分代码省略.........
                    $obj_autopay->type_invoice = "ar";
                    $obj_autopay->autopay();
                    unset($obj_autopay);
                }
                /*
                	Commit
                
                	Conduct final error check, before commiting the new invoice and sending the customer an email
                	if appropiate.
                
                	(we obviously don't want to email them if the invoice is getting rolled back!)
                */
                $sql_obj = new sql_query();
                if (error_check()) {
                    $sql_obj->trans_rollback();
                    log_write("error", "inc_services_invoicegen", "An error occured whilst creating service invoice. No changes have been made.");
                } else {
                    $sql_obj->trans_commit();
                    // invoice creation complete - remove any notifications made by the invoice functions and return
                    // our own notification
                    $_SESSION["notification"]["message"] = array();
                    log_write("notification", "inc_services_invoicegen", "New invoice {$invoicecode} for customer " . $customer_data["code_customer"] . " created");
                    /*
                    		Send the invoice to the customer as a PDF via email
                    */
                    $emailed = "unsent";
                    if (sql_get_singlevalue("SELECT value FROM config WHERE name='EMAIL_ENABLE'") == "enabled") {
                        if (sql_get_singlevalue("SELECT value FROM config WHERE name='ACCOUNTS_INVOICE_AUTOEMAIL'") == "enabled") {
                            // load completed invoice data
                            $invoice = new invoice();
                            $invoice->id = $invoiceid;
                            $invoice->type = "ar";
                            $invoice->load_data();
                            $invoice->load_data_export();
                            if ($invoice->data["amount_total"] > 0) {
                                // generate an email
                                $email = $invoice->generate_email();
                                // send email
                                $invoice->email_invoice("system", $email["to"], $email["cc"], $email["bcc"], $email["subject"], $email["message"]);
                                // complete
                                log_write("notification", "inc_services_invoicegen", "Invoice {$invoicecode} has been emailed to customer (" . $email["to"] . ")");
                            } else {
                                // complete - invoice is for $0, so don't want to email out
                                log_write("notification", "inc_services_invoicegen", "Invoice {$invoicecode} has not been emailed to the customer due to invoice being for \$0.");
                            }
                            $emailed = "emailed - " . $email["to"];
                            unset($invoice);
                        }
                    }
                    // end if email enabled
                }
                // end if commit successful
                /*
                	Review Status
                
                	Here we need to check whether invoicing succeded/failed for the selected customer and process accordingly - we
                	also want to re-set the error flag if running a batch mode, to enable other customers to still be invoiced.
                */
                if (error_check()) {
                    // an error occured
                    $invoice_stats["total_failed"]++;
                    $invoice_stats["failed"][] = array("code_customer" => $customer_data["code_customer"], "name_customer" => $customer_data["name_customer"], "code_invoice" => $invoicecode);
                    // clear the error strings if we are processing from CLI this will allow us to continue on
                    // with additional invoices.
                    if (!empty($_SESSION["mode"])) {
                        if ($_SESSION["mode"] == "cli") {
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:67,代码来源:inc_services_invoicegen.php

示例4: page_execute

function page_execute($argv)
{
    /*
    	Input Options
    */
    $option_date = NULL;
    if (empty($argv[2])) {
        die("You must provide a date option in form of YYYY-MM-DD\n");
    }
    if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $argv[2])) {
        $option_date = $argv[2];
    } else {
        die("You must provide a date option in form of YYYY-MM-DD - wrong format supplied\n");
    }
    /*
    	Respect Configuration
    */
    if ($GLOBALS["config"]["EMAIL_ENABLE"] != "enabled") {
        die("The configuration option EMAIL_ENABLE is disabled - you need to enable emailing before proceeding with this script");
    }
    /*
    	Fetch all invoices for the period
    */
    $obj_invoice_sql = new sql_query();
    $obj_invoice_sql->string = "SELECT id, code_invoice, date_sent, sentmethod FROM account_ar WHERE date_trans='{$option_date}'";
    $obj_invoice_sql->execute();
    if ($obj_invoice_sql->num_rows()) {
        $obj_invoice_sql->fetch_array();
        foreach ($obj_invoice_sql->data as $data_invoice) {
            log_write("debug", "script", "Processing invoice " . $data_invoice["code_invoice"] . "");
            if ($data_invoice["sentmethod"]) {
                // already sent
                log_write("debug", "script", "Invoice has already been sent on " . $data_invoice["data_sent"] . ", not re-sending");
            } else {
                // never has been sent
                log_write("debug", "script", "Invoice has never been sent, preparing to send via email.");
                // load completed invoice data
                $invoice = new invoice();
                $invoice->id = $data_invoice["id"];
                $invoice->type = "ar";
                $invoice->load_data();
                $invoice->load_data_export();
                if ($invoice->data["amount_total"] > 0) {
                    // generate an email
                    $email = $invoice->generate_email();
                    // send email
                    if ($invoice->email_invoice("system", $email["to"], $email["cc"], $email["bcc"], $email["subject"], $email["message"])) {
                        // complete
                        log_write("notification", "script", "Invoice " . $data_invoice["code_invoice"] . " has been emailed to customer (" . $email["to"] . ")");
                    } else {
                        // failure
                        log_write("error", "script", "An error occured whilst attempting to send invoice " . $data_invoice["code_invoice"] . " to " . $email["to"] . "");
                    }
                } else {
                    // complete - invoice is for $0, so don't want to email out
                    log_write("notification", "script", "Invoice " . $data_invoice["code_invoice"] . " has not been emailed to the customer due to invoice being for \$0.");
                }
                unset($invoice);
            }
            // end of invoice needs sending
        }
        // end of invoice loop
    } else {
        log_write("notification", "script", "There are no invoices for the supplied date period");
    }
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:66,代码来源:send_all_unsent_invoices.php


注:本文中的invoice::load_data_export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。