예제 #1
0
function post_agree_find_by_pid($pid, $page = 1, $pagesize = 100)
{
    $agreelist = post_agree_find(array('pid' => $pid), array('pid' => 1), $page, $pagesize);
    if (empty($agreelist)) {
        return array();
    }
    foreach ($agreelist as &$agree) {
        $agree['user'] = user_read_cache($agree['uid']);
        $agree['avatar_url'] = $agree['user']['avatar_url'];
        $agree['username'] = $agree['user']['username'];
        $agree['create_date_fmt'] = humandate($agree['create_date']);
    }
    return $agreelist;
}
예제 #2
0
echo lang('discount');
?>
</td>
<td><?php 
echo lang('name');
?>
</td>
<td><?php 
echo lang('amount');
?>
</td><tr>

<?php 
foreach ($discountrevenue as $myresult) {
    $invoice_number = $myresult['invoice_number'];
    $date = humandate($myresult['creation_date'], $lang);
    $name = $myresult['name'];
    $company = $myresult['company'];
    $amount = $myresult['billing_amount'];
    echo "<td>{$date} ({$invoice_number})</td><td>{$name} {$company}</td><td>{$amount}</td><td></td><tr>";
    // subtract this from the total
    $total = $total - $category_total;
}
?>

</table>  

<?php 
echo "<h3>" . lang('total') . " " . $total . "</h3>";
?>
예제 #3
0
 function __construct($invoiceid, $pdfobject, $email)
 {
     $this->invoiceid = $invoiceid;
     $this->pdfobject = $pdfobject;
     $this->email = $email;
     $CI =& get_instance();
     $CI->load->model('billing_model');
     // get the invoice data to print on the bill
     $myinvresult = $CI->billing_model->get_invoice_data($invoiceid);
     $this->invoicedetails = $CI->billing_model->invoice_details($invoiceid);
     $this->createdby = $myinvresult['h_created_by'];
     $this->mydate = $myinvresult['h_billing_date'];
     $this->mybilling_id = $myinvresult['b_id'];
     $this->billing_name = $myinvresult['b_name'];
     $this->billing_company = $myinvresult['b_company'];
     $this->billing_street = $myinvresult['b_street'];
     $this->billing_city = $myinvresult['b_city'];
     $this->billing_state = $myinvresult['b_state'];
     $this->billing_zip = $myinvresult['b_zip'];
     $this->billing_acctnum = $myinvresult['b_acctnum'];
     $this->billing_fromdate = $myinvresult['h_from_date'];
     $this->billing_todate = $myinvresult['h_to_date'];
     $this->billing_payment_due_date = $myinvresult['h_payment_due_date'];
     $this->billing_notes = $myinvresult['h_notes'];
     $this->billing_new_charges = sprintf("%.2f", $myinvresult['h_new_charges']);
     $this->billing_past_due = sprintf("%.2f", $myinvresult['h_past_due']);
     $this->billing_late_fee = sprintf("%.2f", $myinvresult['h_late_fee']);
     $this->billing_tax_due = sprintf("%.2f", $myinvresult['h_tax_due']);
     $this->billing_total_due = sprintf("%.2f", $myinvresult['h_total_due']);
     $this->billing_credit_applied = sprintf("%.2f", $myinvresult['h_credit_applied']);
     $this->billing_email = $myinvresult['b_contact_email'];
     $this->billing_po_number = $myinvresult['b_po_number'];
     $myorgresult = $CI->billing_model->get_organization_data($this->mybilling_id);
     $this->org_name = $myorgresult['org_name'];
     $this->org_street = $myorgresult['org_street'];
     $this->org_city = $myorgresult['org_city'];
     $this->org_state = $myorgresult['org_state'];
     $this->org_zip = $myorgresult['org_zip'];
     $this->phone_billing = $myorgresult['phone_billing'];
     $this->email_billing = $myorgresult['email_billing'];
     $this->invoice_footer = $myorgresult['invoice_footer'];
     $this->einvoice_footer = $myorgresult['einvoice_footer'];
     // convert dates to human readable form using my date helper
     $CI->load->helper('htmlascii');
     $CI->load->helper('date');
     $this->billing_mydate = humandate($this->mydate);
     $this->billing_fromdate = humandate($this->billing_fromdate);
     $this->billing_todate = humandate($this->billing_todate);
     $this->billing_payment_due_date = humandate($this->billing_payment_due_date);
 }
예제 #4
0
 function ccexpire()
 {
     $this->load->model('billing_model');
     $this->load->model('support_model');
     $this->load->helper('date');
     $this->load->helper('htmlascii');
     // calculate the expire date for this month
     $nextexpdate = date("my", mktime(0, 0, 0, date("m"), date("y")));
     $result = $this->billing_model->find_expired_cards($nextexpdate);
     foreach ($result as $myresult) {
         $billing_id = $myresult['id'];
         $to = $myresult['contact_email'];
         $name = $myresult['name'];
         $next_billing_date = $myresult['next_billing_date'];
         $next_billing_date = humandate($next_billing_date);
         $billingtype = $myresult['bt_name'];
         $account_number = $myresult['account_number'];
         $creditcard_number = $myresult['creditcard_number'];
         $creditcard_expire = $myresult['creditcard_expire'];
         $subject = "Your credit card is about to expire";
         // fix any ascii characters in their name
         $name = html_to_ascii($name);
         $message = "Account Number: {$account_number}\n\n" . "{$name},\n\n" . "Thank you for choosing [company]. We would like to remind you that your " . "creditcard on file is about to expire at the end of this month.\n" . "\n" . "{$creditcard_number}, {$creditcard_expire}\n" . "\n" . "Please contact us with your new credit card expiration date so we may " . "continue providing service without any billing interruptions.\n\n" . "If you have any questions, please call our offices at (XXX) XXX-XXXX";
         echo "sending a expiration reminder to {$to} {$account_number}\n";
         $headers = "From: billing@example.com \n";
         mail($to, $subject, $message, $headers);
         // put a ticket to say that this message was sent
         $user = "******";
         $notify = "";
         $status = "automatic";
         $description = "Sent card expiration reminder to {$to}";
         $this->support_model->create_ticket($user, $notify, $account_number, $status, $description);
     }
 }
예제 #5
0
function thread_format_last_date(&$thread)
{
    $thread['create_date_fmt'] = humandate($thread['create_date']);
    if ($thread['last_date'] != $thread['create_date']) {
        $thread['last_date_fmt'] = humandate($thread['last_date']);
    }
}
예제 #6
0
function post_format(&$post)
{
    global $conf;
    if (empty($post)) {
        return;
    }
    $post['create_date_fmt'] = humandate($post['create_date']);
    $user = $post['uid'] ? user_read_cache($post['uid']) : user_guest();
    $post['username'] = $user['username'];
    $post['user_avatar_url'] = $user['avatar_url'];
    !isset($post['floor']) and $post['floor'] = '';
    $post['agrees_class'] = 'agrees_' . thread_get_level($post['agrees'], $conf['agrees_level']);
    // 权限判断
    global $uid, $sid, $longip;
    $post['allowupdate'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['allowdelete'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['user_url'] = "user-{$post['uid']}" . ($post['uid'] ? '' : "-{$post['pid']}") . ".htm";
}
예제 #7
0
 public function vendor($userserviceid)
 {
     // check permissions
     $permission = $this->module_model->permission($this->user, 'services');
     if ($permission['create']) {
         // load the date helper for use when printing service start/end dates
         $this->load->helper('date');
         // load the module header common to all module views
         $this->load->view('module_header_view');
         $data['userserviceid'] = $userserviceid;
         // show the vendor history info
         $myorgresult = $this->service_model->org_and_options($userserviceid);
         $data['service_org_id'] = $myorgresult['organization_id'];
         $data['service_org_name'] = $myorgresult['org_name'];
         $data['optionstable'] = $myorgresult['options_table'];
         $data['servicedescription'] = $myorgresult['service_description'];
         $data['creationdate'] = humandate($myorgresult['start_datetime']);
         $data['enddate'] = humandate($myorgresult['end_datetime']);
         $data['removed'] = $myorgresult['removed'];
         if ($data['optionstable'] != '') {
             $myoptions = $this->service_model->options_attributes($userserviceid, $data['optionstable']);
             $data['optionsdetails'] = $myoptions[2];
             $data['optionsdetails2'] = $myoptions[3];
         }
         $data['vendor_history'] = $this->service_model->vendor_history($userserviceid);
         $data['vendor_names'] = $this->service_model->vendor_names();
         $this->load->view('services/vendor_history_view', $data);
         // the history listing tabs
         $this->load->view('historyframe_tabs_view');
         // show html footer
         $this->load->view('html_footer_view');
     } else {
         $this->module_model->permission_error();
     }
 }
예제 #8
0
 public function receipt($paymentid, $billingid, $payment_date, $amount)
 {
     // load the service model
     $this->load->model('service_model');
     $data['paymentid'] = $paymentid;
     $data['billingid'] = $billingid;
     $data['amount'] = $amount;
     $paytype_result = $this->billing_model->get_payment_type($paymentid);
     $data['payment_type'] = $paytype_result['payment_type'];
     $data['creditcard_number'] = $paytype_result['creditcard_number'];
     $data['check_number'] = $paytype_result['check_number'];
     $billing_result = $this->billing_model->billing_and_organization($billingid);
     $data['billing_name'] = $billing_result['name'];
     $data['billing_company'] = $billing_result['company'];
     $data['billing_street'] = $billing_result['street'];
     $data['billing_city'] = $billing_result['city'];
     $data['billing_state'] = $billing_result['state'];
     $data['billing_zip'] = $billing_result['zip'];
     $data['billing_account_number'] = $billing_result['account_number'];
     $data['org_name'] = $billing_result['org_name'];
     $data['org_street'] = $billing_result['org_street'];
     $data['org_city'] = $billing_result['org_city'];
     $data['org_state'] = $billing_result['org_state'];
     $data['org_zip'] = $billing_result['org_zip'];
     $data['payment_details'] = $this->billing_model->payment_details($paymentid);
     // load the date helper for human format dates
     $this->load->helper('date');
     $data['human_date'] = humandate($payment_date);
     $this->load->view('billing/receipt_view', $data);
 }
예제 #9
0
 function outputextendedinvoice($invoiceid, $printtype, $pdfobject)
 {
     $myinvresult = $this->get_invoice_data($invoiceid);
     $user = $myinvresult['h_created_by'];
     $mydate = $myinvresult['h_billing_date'];
     $mybilling_id = $myinvresult['b_id'];
     $billing_name = $myinvresult['b_name'];
     $billing_company = $myinvresult['b_company'];
     $billing_street = $myinvresult['b_street'];
     $billing_city = $myinvresult['b_city'];
     $billing_state = $myinvresult['b_state'];
     $billing_zip = $myinvresult['b_zip'];
     $billing_acctnum = $myinvresult['b_acctnum'];
     $billing_fromdate = $myinvresult['h_from_date'];
     $billing_todate = $myinvresult['h_to_date'];
     $billing_payment_due_date = $myinvresult['h_payment_due_date'];
     $billing_notes = $myinvresult['h_notes'];
     $billing_new_charges = sprintf("%.2f", $myinvresult['h_new_charges']);
     $billing_past_due = sprintf("%.2f", $myinvresult['h_past_due']);
     $billing_late_fee = sprintf("%.2f", $myinvresult['h_late_fee']);
     $billing_tax_due = sprintf("%.2f", $myinvresult['h_tax_due']);
     $billing_total_due = sprintf("%.2f", $myinvresult['h_total_due']);
     $billing_email = $myinvresult['b_contact_email'];
     // get the organization info to print on the bill
     $query = "SELECT g.org_name,g.org_street,g.org_city,g.org_state,\n            g.org_zip,g.phone_billing,g.email_billing,g.invoice_footer  \n            FROM billing b\n            LEFT JOIN general g ON g.id = b.organization_id \n            WHERE b.id = ?";
     $generalresult = $this->db->query($query, array($mybilling_id)) or die("output extended select organization failed");
     $mygenresult = $generalresult->row_array();
     $org_name = $mygenresult['org_name'];
     $org_street = $mygenresult['org_street'];
     $org_city = $mygenresult['org_city'];
     $org_state = $mygenresult['org_state'];
     $org_zip = $mygenresult['org_zip'];
     $phone_billing = $mygenresult['phone_billing'];
     $email_billing = $mygenresult['email_billing'];
     $invoice_footer = $mygenresult['invoice_footer'];
     // output the invoice page
     // load the html to ascii helper for character conversions
     $this->load->helper('htmlascii');
     // convert dates to human readable form using my date helper
     $this->load->helper('date');
     // convert dates to human readable form
     $billing_mydate = humandate($mydate);
     $billing_fromdate = humandate($billing_fromdate);
     $billing_todate = humandate($billing_todate);
     $billing_payment_due_date = humandate($billing_payment_due_date);
     if ($printtype == "pdf") {
         $this->load->library('fpdf');
         $pdf = $pdfobject;
         // convert html character codes to ascii for pdf
         $billing_name = html_to_ascii($billing_name);
         $billing_company = html_to_ascii($billing_company);
         $billing_street = html_to_ascii($billing_street);
         $billing_city = html_to_ascii($billing_city);
         $org_name = html_to_ascii($org_name);
         $org_street = html_to_ascii($org_street);
         $org_city = html_to_ascii($org_city);
         // make new page
         $pdf->AddPage();
         // get the page the current invoice in the batch starts on
         // necessary for batches with multiple invoices
         $invoicestartpage = $pdf->PageNo();
         $pdf->SetFont('Arial', 'B', 18);
         $pdf->Cell(60, 10, "{$org_name}", 0);
         $pdf->SetXY(10, 20);
         $pdf->SetFont('Arial', '', 9);
         $pdf->MultiCell(80, 4, "{$org_street}\n{$org_city}, {$org_state} {$org_zip}\n{$phone_billing}\n{$email_billing}", 0);
         $pdf->Rect(135, 10, 1, 30, "F");
         $pdf->SetXY(140, 10);
         $pdf->SetFontSize(10);
         $pdf->MultiCell(70, 6, lang('accountnumber') . ": {$billing_acctnum}\n" . lang('invoicenumber') . ": {$invoiceid}\n{$billing_fromdate} " . lang('to') . " {$billing_todate}\n" . lang('paymentdue') . ": {$billing_payment_due_date}\n" . lang('total') . ": {$billing_total_due}", 0);
         $pdf->SetXY(10, 60);
         $pdf->SetFontSize(10);
         $pdf->MultiCell(60, 5, "{$billing_name}\n{$billing_company}\n{$billing_street}\n{$billing_city} {$billing_state} {$billing_zip}", 0);
         $pdf->SetXY(130, 60);
         $pdf->Line(5, 102, 200, 102);
         $pdf->SetXY(10, 103);
         $pdf->Cell(100, 5, lang('description'));
         $pdf->SetXY(160, 103);
         $pdf->Cell(50, 5, lang('amount'));
     } else {
         $output = lang('accountnumber') . ": {$billing_acctnum}\n\n";
         $output .= lang('invoicenumber') . ": {$invoiceid}\n";
         $output .= "{$billing_fromdate} - {$billing_todate} \n";
         $output .= lang('paymentduedate') . ": {$billing_payment_due_date}\n";
         $output .= lang('total') . ": {$billing_total_due}\n\n";
         $output .= lang('to') . ": {$billing_email}\n";
         $output .= "{$billing_name} {$billing_company}\n";
         $output .= "{$billing_street} ";
         $output .= "{$billing_city} {$billing_state} ";
         $output .= "{$billing_zip}\n\n";
         $output .= "----------------------------------------";
         $output .= "----------------------------------------\n";
     }
     // end if
     // Select the new charge details for a specific invoice number
     $query = "SELECT d.user_services_id d_user_services_id, \n            d.invoice_number d_invoice_number, \n            d.billed_amount d_billed_amount, \n            d.billing_id d_billing_id, \n            d.taxed_services_id d_taxed_services_id, \n            u.id u_id, u.master_service_id u_master_service_id, \n            u.usage_multiple u_usage_multiple, \n            m.options_table m_options_table, \n            m.id m_id, m.service_description m_service_description, m.pricerate,  \n            ts.id ts_id, ts.master_services_id ts_master_services_id, \n            ts.tax_rate_id ts_tax_rate_id, tr.id tr_id, \n            tr.description tr_description\n            FROM billing_details d\n            LEFT JOIN user_services u ON d.user_services_id = u.id\n            LEFT JOIN master_services m ON u.master_service_id = m.id\n            LEFT JOIN taxed_services ts ON d.taxed_services_id = ts.id \n            LEFT JOIN tax_rates tr ON ts.tax_rate_id = tr.id \n            WHERE d.invoice_number = ? ORDER BY u.id DESC, tr.id ASC";
     $result = $this->db->query($query, array($invoiceid)) or die("select new charge query failed");
     // initialize line counters
     $myline = 1;
     $lineYoffset = 105;
     $fillcolor = 200;
     $lastserviceid = 0;
     // Print the invoice line items
     foreach ($result->result_array() as $myresult) {
         // check if it's a tax with a tax id or service with
         // no tax idfirst to set detail items
         $serviceid = $myresult['u_id'];
         $taxid = $myresult['tr_id'];
         if ($taxid == NULL) {
             // it's a service
             // select the options_table to get data for the details
             $options_table = $myresult['m_options_table'];
             $id = $myresult['u_id'];
             if ($options_table != '') {
                 // get the data from the options table and put into variables
                 $myoptions = $this->service_model->options_attributes($id, $options_table);
                 //echo "$myoptions->username";
                 if (count($myoptions) >= 3) {
                     $optiondetails1 = $myoptions[2];
                 } else {
                     $optiondetails1 = '';
                 }
                 if (count($myoptions) >= 4) {
                     $optiondetails2 = $myoptions[3];
                 } else {
                     $optiondetails2 = '';
                 }
                 $optiondetails = $optiondetails2 . "\t" . $optiondetails1;
             } else {
                 $optiondetails = '';
             }
             $service_description = $myresult['m_service_description'];
             $tax_description = '';
         } else {
             // it's a tax
             $tax_description = "     " . $myresult['tr_description'];
             $service_description = '';
             $optiondetails = '';
         }
         $billed_amount = sprintf("%.2f", $myresult['d_billed_amount']);
         // calculate the month multiple, only print for services, not taxes
         $pricerate = $myresult['pricerate'];
         if ($pricerate > 0 and $taxid == NULL) {
             $monthmultiple = $billed_amount / $pricerate;
         } else {
             $monthmultiple = 0;
         }
         if ($printtype == "pdf") {
             // printing pdf invoice
             // alternate fill color
             if ($serviceid != $lastserviceid) {
                 $lastserviceid = $serviceid;
                 if ($fillcolor == 200) {
                     $fillcolor = 255;
                     $pdf->SetFillColor($fillcolor);
                 } else {
                     $fillcolor = 200;
                     $pdf->SetFillColor($fillcolor);
                 }
             }
             $service_description = html_to_ascii($service_description);
             $tax_description = html_to_ascii($tax_description);
             $optiondetails = html_to_ascii($optiondetails);
             $lineY = $lineYoffset + $myline * 5;
             $pdf->SetXY(10, $lineY);
             if ($monthmultiple > 1) {
                 $pdf->Cell(151, 5, "{$serviceid} {$service_description} {$tax_description} ({$pricerate} x {$monthmultiple}) {$optiondetails}", 0, 0, "L", TRUE);
             } else {
                 $pdf->Cell(151, 5, "{$serviceid} {$service_description} {$tax_description} {$optiondetails}", 0, 0, "L", TRUE);
             }
             //$pdf->SetXY(110,$lineY);
             //$pdf->Cell(110,5,"$optiondetails");
             $pdf->SetXY(160, $lineY);
             $pdf->Cell(40, 5, "{$billed_amount}", 0, 0, "L", TRUE);
         } else {
             // printing text invoice
             if ($monthmultiple > 1) {
                 if ($tax_description) {
                     $output .= "{$serviceid} \t {$service_description} {$tax_description} ({$pricerate} x {$monthmultiple}) \t {$optiondetails} \t {$billed_amount}\n";
                 } else {
                     $output .= "{$serviceid} \t {$service_description} {$tax_description} ({$pricerate} x {$monthmultiple}) \t {$optiondetails} \t \t {$billed_amount}\n";
                 }
             } else {
                 if ($tax_description) {
                     $output .= "{$serviceid} \t {$service_description} {$tax_description} \t {$optiondetails} \t \t {$billed_amount}\n";
                 } else {
                     $output .= "{$serviceid} \t {$service_description} {$tax_description} \t {$optiondetails} \t {$billed_amount}\n";
                 }
             }
         }
         $myline++;
         if ($printtype == "pdf") {
             // add a new page if there are many line items
             // TODO: check for page number here
             // if page number greater than 1, then myline would be larger
             // set an invoicestartpage at the start of each invoice for multi invoice batches
             $pagenumber = $pdf->PageNo();
             if ($pagenumber - $invoicestartpage > 0) {
                 $linetotal = 48;
             } else {
                 $linetotal = 28;
             }
             if ($myline > $linetotal) {
                 $pdf->AddPage();
                 $pdf->SetXY(10, 20);
                 $myline = 1;
                 $lineYoffset = 20;
             }
         }
     }
     if ($printtype == "pdf") {
         $lineY = $lineYoffset + $myline * 5;
         $pdf->Line(5, $lineY, 200, $lineY);
     } else {
         $output .= "----------------------------------------";
         $output .= "----------------------------------------\n";
     }
     // print the notes and totals at the bottom of the invoice
     if ($printtype == "pdf") {
         // fix html characters
         $billing_notes = html_to_ascii($billing_notes);
         $invoice_footer = html_to_ascii($invoice_footer);
         $lineY = $lineY + 10;
         $pdf->SetXY(10, $lineY);
         $pdf->MultiCell(100, 5, "{$billing_notes}");
         $pdf->SetXY(135, $lineY);
         $pdf->MultiCell(100, 5, lang('newcharges') . ": {$billing_new_charges}\n" . lang('pastdue') . ": {$billing_past_due}\n" . lang('tax') . ": {$billing_tax_due}\n");
         $pdf->SetXY(135, $lineY + 15);
         $pdf->SetFont('Arial', 'BU', 10);
         $pdf->Cell(100, 5, lang('total') . ": {$billing_total_due}");
         $lineY = $lineY + 10;
         $pdf->SetFont('Arial', '', 9);
         $pdf->SetXY(10, $lineY);
         $pdf->MultiCell(110, 4, "{$invoice_footer}");
     } else {
         $output .= "{$billing_notes}\n";
         $output .= lang('newcharges') . ": {$billing_new_charges}\n";
         $output .= lang('pastdue') . ": {$billing_past_due}\n";
         $output .= lang('tax') . ": {$billing_tax_due}\n";
         $output .= lang('total') . ": {$billing_total_due}\n";
         $output .= "\n{$invoice_footer}\n";
     }
     if ($printtype == "pdf") {
         return $pdf;
     } else {
         return $output;
     }
 }
예제 #10
0
 public function create()
 {
     require 'fpdf.php';
     // convert the dates into normal human readable format instead of ISO
     $payment_due_date = humandate($this->payment_due_date);
     $turnoff_date = humandate($this->turnoff_date);
     $cancel_date = humandate($this->cancel_date);
     // get the info for the middle body of the message:
     // get the total owed for any pastdue services on the account
     $query = "SELECT bi.id bi_id, bi.account_number bi_account_number, " . "bi.contact_email bi_contact_email,  bi.name bi_name, " . "bi.company bi_company, bi.street bi_street, bi.city bi_city, " . "bi.state bi_state, bi.zip bi_zip, r.description r_description, " . "ms.service_description ms_description, " . "bd.taxed_services_id, bd.billed_amount, bd.paid_amount, " . "g.org_name, g.org_street, g.org_city, g.org_state, g.org_zip, " . "g.phone_billing, g.email_billing, bh.payment_due_date, bh.id bh_id " . "FROM billing_details bd " . "LEFT JOIN user_services us ON bd.user_services_id = us.id " . "LEFT JOIN master_services ms ON us.master_service_id = ms.id " . "LEFT JOIN taxed_services t ON t.id = bd.taxed_services_id " . "LEFT JOIN tax_rates r ON t.tax_rate_id = r.id " . "LEFT JOIN billing bi ON bd.billing_id = bi.id " . "LEFT JOIN billing_history bh ON bh.id = bd.invoice_number " . "LEFT JOIN general g ON bi.organization_id = g.id " . "WHERE bd.billed_amount > bd.paid_amount " . "AND bi.pastdue_exempt <> 'y' " . "AND bh.payment_due_date < '{$this->today}' " . "AND bi.id = {$this->billing_id}";
     $result = $this->CI->db->query($query) or die("Send Notice Query Failed");
     // initialize variables
     $total_owed = 0;
     // get the items that are past due to print out
     while ($myresult = $result->result_array()) {
         // organization info
         $org_name = $myresult['org_name'];
         $org_street = $myresult['org_street'];
         $org_city = $myresult['org_city'];
         $org_state = $myresult['org_state'];
         $org_zip = $myresult['org_zip'];
         $phone_billing = $myresult['phone_billing'];
         // customer info
         $this->billingemail = $myresult['email_billing'];
         $billing_account_number = $myresult['bi_account_number'];
         $invoice_number = $myresult['bh_id'];
         $billing_name = $myresult['bi_name'];
         $billing_company = $myresult['bi_company'];
         $billing_street = $myresult['bi_street'];
         $billing_city = $myresult['bi_city'];
         $billing_state = $myresult['bi_state'];
         $billing_zip = $myresult['bi_zip'];
         $this->contactemail = $myresult['bi_contact_email'];
         $billed_amount = round($myresult['billed_amount'], 2);
         $paid_amount = round($myresult['paid_amount'], 2);
         // set the description for a service or a tax
         if ($myresult['taxed_services_id']) {
             $service_description = $myresult['r_description'];
         } else {
             $service_description = $myresult['ms_description'];
         }
         $owed = round($billed_amount - $paid_amount, 2);
         $owed = sprintf("%.2f", $owed);
         $service_list .= "{$service_description} {$owed}\n";
         $total_owed = round($owed + $total_owed, 2);
     }
     // set the message body
     $total_owed = sprintf("%.2f", $total_owed);
     $message_body = lang('account') . " " . $billing_account_number . "\n" . lang('invoice') . ": " . $invoice_number . "\n" . lang('amount_due') . ": " . $total_owed . "\n";
     // look for notice type and create proper message
     switch ($this->notice_type) {
         case 'pastdue':
             // create the notice text with embedded information
             $l_notice_text_pastdue = lang('notice_text_pastdue');
             eval("\$notice_text = \"{$l_notice_text_pastdue}\";");
             // create body of message, header, footer, and content
             $this->noticeheading = "{$org_name}\n" . lang('pastdue_notice') . "\n";
             $this->message .= "{$message_body}\n\n";
             $this->message .= "{$billing_name}\n";
             if ($billing_company) {
                 $this->message .= "{$billing_company}\n";
             } else {
                 $this->message .= "\n";
             }
             $this->message .= "{$billing_street}\n";
             $this->message .= "{$billing_city} {$billing_state} {$billing_zip}\n\n\n\n";
             $this->message .= "{$notice_text}\n\n";
             $this->message .= lang('pastdue_heading') . ":\n";
             $this->message .= "{$service_list}\n\n";
             $this->message .= lang('notice_text_footer') . "\n\n";
             $this->message .= "{$org_name}\n";
             $this->message .= "{$org_street}\n";
             $this->message .= "{$org_city}, {$org_state} {$org_zip}\n";
             $this->message .= "{$phone_billing}\n";
             break;
         case 'shutoff':
             // create the notice text with embedded information
             $l_notice_text_shutoff = lang('notice_text_shutoff');
             eval("\$notice_text = \"{$l_notice_text_shutoff}\";");
             $l_notice_footer_shutoff = lang('notice_footer_shutoff');
             eval("\$notice_footer_shutoff = \"{$l_notice_footer_shutoff}\";");
             // create body of message, header, footer, and content
             $this->noticeheading = "{$org_name}\n" . lang('shutoff_notice') . "\n";
             $this->message .= "{$message_body}\n\n";
             $this->message .= "{$billing_name}\n";
             if ($billing_company) {
                 $this->message .= "{$billing_company}\n";
             } else {
                 $this->message .= "\n";
             }
             $this->message .= "{$billing_street}\n";
             $this->message .= "{$billing_city} {$billing_state} {$billing_zip}\n\n\n\n";
             $this->message .= "{$notice_text}\n\n";
             $this->message .= lang('shutoff_heading') . ":\n";
             $this->message .= "{$service_list}\n";
             $this->message .= lang('notice_text_footer') . "\n\n";
             $this->message .= "{$org_name}\n";
             $this->message .= "{$org_street}\n";
             $this->message .= "{$org_city}, {$org_state} {$org_zip}\n";
             $this->message .= "{$phone_billing}\n\n";
             $this->message .= "{$notice_footer_shutoff}\n";
             break;
         case 'cancel':
             // create the notice text with embedded information
             $l_notice_text_cancel = lang('notice_text_cancel');
             eval("\$notice_text = \"{$l_notice_text_cancel}\";");
             // create body of message, header, footer, and content
             $this->noticeheading = "{$org_name}\n" . lang('cancel_notice') . "\n";
             $this->message .= "{$message_body}\n\n";
             $this->message .= "{$billing_name}\n";
             if ($billing_company) {
                 $this->message .= "{$billing_company}\n";
             } else {
                 $this->message .= "\n";
             }
             $this->message .= "{$billing_street}\n";
             $this->message .= "{$billing_city} {$billing_state} {$billing_zip}\n\n\n\n";
             $this->message .= lang('cancel_heading') . ":\n";
             $this->message .= "{$service_list}\n";
             $this->message .= lang('notice_text_footer') . "\n\n";
             $this->message .= "{$notice_text}\n\n";
             $this->message .= "{$org_name}\n";
             $this->message .= "{$org_street}\n";
             $this->message .= "{$org_city}, {$org_state} {$org_zip}\n";
             $this->message .= "{$phone_billing}\n";
             break;
         case 'collections':
             // create the notice text with embedded information
             $l_notice_text_collections = lang('notice_text_collections');
             eval("\$notice_text = \"{$l_notice_text_collections}\";");
             // create body of message, header, footer, and content
             $this->noticeheading = "{$org_name}\n" . lang('collections_notice') . "\n";
             $this->message .= "{$message_body}\n\n";
             $this->message .= "{$billing_name}\n";
             if ($billing_company) {
                 $this->message .= "{$billing_company}\n";
             } else {
                 $this->message .= "\n";
             }
             $this->message .= "{$billing_street}\n";
             $this->message .= "{$billing_city} {$billing_state} {$billing_zip}\n\n\n\n";
             $this->message .= "{$notice_text}\n\n";
             $this->message .= lang('collections_heading') . ":\n";
             $this->message .= "{$service_list}\n";
             $this->message .= lang('collections_notice_text_footer') . "\n\n";
             $this->message .= "{$org_name}\n";
             $this->message .= "{$org_street}\n";
             $this->message .= "{$org_city}, {$org_state} {$org_zip}\n";
             $this->message .= "{$phone_billing}\n";
             break;
     }
 }
예제 #11
0
// initialize rerun items count to check later
$itemcount = 0;
$fieldlist = "";
$current_invoice_line = 0;
$current_invoice_total = 0;
$bgcolor = "#EEEEEE";
if (!$rerunitems) {
    echo lang('rerunitemerror');
    echo "</table></blockquote>\n";
} else {
    echo "<td></td><td><?php echo lang('invoice');?></td>\n\t\t<td><?php echo lang('id');?></td><td><?php echo lang('date');?></td>\n\t\t<td><?php echo lang('service');?></td><td><?php echo lang('price');?></td><tr>";
    foreach ($rerunitems as $myresult) {
        $detail_id = $myresult['bd_id'];
        $original_invoice_number = $myresult['original_invoice_number'];
        $service_id = $myresult['us_id'];
        $creation_date = humandate($myresult['creation_date']);
        $user_services_id = $myresult['user_services_id'];
        $detail_total = sprintf("%.2f", $myresult['billed_amount'] - $myresult['paid_amount']);
        $description = $myresult['service_description'];
        // check if we are on a new invoice line item that needs a heading for this invoice
        // to seperate them from the other invoice line items in the view
        if ($current_invoice_line != $original_invoice_number) {
            if ($current_invoice_total != 0) {
                // print a line with the previous invoices current total before resetting it
                echo "<td bgcolor=\"{$bgcolor}\" colspan=6 align=right " . "style=\"border-bottom: 1px solid black;\"><b>" . sprintf("%.2f", $current_invoice_total) . "</b></td><tr>";
            }
            // reset the bgcolor
            if ($bgcolor == "#EEEEEE") {
                $bgcolor = "#FFFFFF";
            } else {
                $bgcolor = "#EEEEEE";
예제 #12
0
function thread_format(&$thread)
{
    global $conf, $forumlist;
    if (empty($thread)) {
        return;
    }
    $thread['create_date_fmt'] = humandate($thread['create_date']);
    $thread['last_date_fmt'] = humandate($thread['last_date']);
    $user = user_read_cache($thread['uid']);
    empty($user) and $user = user_guest();
    $thread['username'] = $user['username'];
    $thread['user_avatar_url'] = $user['avatar_url'];
    $forum = $forumlist[$thread['fid']];
    $thread['forumname'] = $forum['name'];
    if ($thread['last_date'] == $thread['create_date']) {
        $thread['last_date'] = 0;
        $thread['lastuid'] = 0;
        $thread['lastusername'] = '';
    } else {
        $lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
        $thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : '******';
    }
    $thread['seo_url'] = $conf['seo_url_rewrite'] && $thread['url_on'] ? thread_url_read($thread['tid']) : '';
    $thread['url'] = $thread['seo_url'] ? $thread['seo_url'] : "thread-{$thread['tid']}.htm";
    $thread['user_url'] = "user-{$thread['uid']}" . ($thread['uid'] ? '' : "-{$thread['firstpid']}") . ".htm";
    $n = $thread['agrees'] + $thread['posts'];
    $agree_level = thread_get_level($n, $conf['agrees_level']);
    $thread['posts_class'] = 'posts_' . thread_get_level($thread['posts'], $conf['posts_level']);
    $thread['agrees_class'] = 'agrees_' . $agree_level;
    $thread['thread_class'] = 'thread_agrees_' . $agree_level;
    $thread['top_class'] = $thread['top'] ? 'thread_top_' . $thread['top'] : '';
}
예제 #13
0
echo lang('description');
?>
</td>
<td><?php 
echo lang('paid');
?>
</td><tr>

<?php 
foreach ($payment_details as $myresult) {
    $user_services_id = $myresult['user_services_id'];
    $invoice = $myresult['original_invoice_number'];
    $description = $myresult['service_description'];
    $tax_description = $myresult['description'];
    $from_date = humandate($myresult['from_date']);
    $to_date = humandate($myresult['to_date']);
    $paid_amount = sprintf("%.2f", $myresult['paid_amount']);
    $billed_amount = sprintf("%.2f", $myresult['billed_amount']);
    $options_table = $myresult['options_table'];
    $owed_amount = sprintf("%.2f", $billed_amount - $paid_amount);
    // check if it's a tax with a tax id or service with
    // no tax idfirst to set detail items
    if ($options_table != '') {
        // get the data from the options table
        // and put into variables
        // get the data from the options table and put into variables
        $myoptions = $this->service_model->options_attributes($user_services_id, $options_table);
        $optiondetails = $myoptions[2];
    } else {
        $optiondetails = '';
    }