예제 #1
0
        $to = module_user::get_contacts(array('customer_id' => $invoice['customer_id']));
        // hunt for 'accounts' extra field
        $field_to_find = strtolower(module_config::c('accounts_extra_field_name', 'Accounts'));
        foreach ($to as $contact) {
            $extras = module_extra::get_extras(array('owner_table' => 'user', 'owner_id' => $contact['user_id']));
            foreach ($extras as $e) {
                if (strtolower($e['extra_key']) == $field_to_find) {
                    // this is the accounts contact - woo!
                    $to_select = $contact['email'];
                }
            }
        }
        if (!$to_select && $customer['primary_user_id']) {
            $primary = module_user::get_user($customer['primary_user_id']);
            if ($primary) {
                $to_select = $primary['email'];
            }
        }
    }
} else {
    if ($invoice['member_id']) {
        $member = module_member::get_member($invoice['member_id']);
        $to = array($member);
        $replace['customer_name'] = $member['first_name'];
    } else {
        $to = array();
    }
}
$template->assign_values($replace);
module_email::print_compose(array('title' => _l('Email Invoice: %s', $invoice['name']), 'find_other_templates' => 'invoice_email', 'current_template' => $template_name, 'customer_id' => $invoice['customer_id'], 'company_id' => isset($invoice['company_id']) ? $invoice['company_id'] : 0, 'to' => $to, 'to_select' => $to_select, 'bcc' => module_config::c('admin_email_address', ''), 'content' => $template->render('html'), 'subject' => $template->replace_description(), 'success_url' => module_invoice::link_open($invoice_id), 'success_callback' => 'module_invoice::email_sent', 'success_callback_args' => array('invoice_id' => $invoice_id, 'template_name' => $template_name), 'invoice_id' => $invoice_id, 'cancel_url' => module_invoice::link_open($invoice_id), 'attachments' => array(array('path' => $pdf, 'name' => basename($pdf), 'preview' => module_invoice::link_generate($invoice_id, array('arguments' => array('go' => 1, 'print' => 1), 'page' => 'invoice_admin', 'full' => false))))));
예제 #2
0
                    </tr>
                    </thead>
                    <tbody>
                        <?php 
        $c = 0;
        foreach ($job_invoices as $invoice) {
            $invoice = module_invoice::get_invoice($invoice['invoice_id']);
            ?>

                            <tr class="<?php 
            echo $c++ % 2 ? "odd" : "even";
            ?>
">
                                <td class="row_action">
                                    <?php 
            echo module_invoice::link_open($invoice['invoice_id'], true, $invoice);
            ?>

                                </td>
                                <td>
                                    <?php 
            echo htmlspecialchars($invoice['status']);
            ?>

                                </td>
                                <td>
                                    <?php 
            if ((!$invoice['date_paid'] || $invoice['date_paid'] == '0000-00-00') && strtotime($invoice['date_due']) < time()) {
                echo '<span class="error_text">';
                echo print_date($invoice['date_due']);
                echo '</span>';
예제 #3
0
} else {
    if ($task_data['billable']) {
        _e('Task is billable');
    } else {
        _e('Task not billable');
    }
    echo '<br/>';
    if ($task_data['taxable']) {
        _e('Task is taxable');
    } else {
        _e('Task not taxable');
    }
}
if ($task_data['invoiced'] && $task_data['invoice_id']) {
    echo '<br/>';
    echo _l('Invoice %s', module_invoice::link_open($task_data['invoice_id'], true));
}
?>
        </div>

        <div>

        <?php 
if (module_config::c('job_task_log_all_hours', 1) || $task_data['hours'] <= 0) {
    ?>
            <?php 
    if (!$task_data['fully_completed'] && $task_data['invoiced'] || $task_editable) {
        ?>
                <input type="hidden" name="job_task[<?php 
        echo $task_id;
        ?>
예제 #4
0
    $next = 0;
    foreach ($_SESSION['_finance_recurring_ids'] as $next_data) {
        if ($next == -1) {
            $next = 1;
            // done.
            $form_actions['elements'][] = array('type' => 'hidden', 'name' => 'recurring_next', 'id' => 'recurring_next', 'value' => '');
            $form_actions['elements'][] = array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save & Next Transaction'), 'onclick' => "\$('#recurring_next').val('" . htmlspecialchars($next_data[1]) . "');");
            break;
        } else {
            if ($next == 0 && $next_data[0] == $finance_recurring_id) {
                $next = -1;
            }
        }
    }
}
if ((int) $finance_id > 0) {
    $form_actions['elements'][] = array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete'), 'onclick' => "return confirm('" . _l('Really delete this record?') . "');");
}
if (count($linked_finances)) {
    // || count($linked_invoice_payments))
    $form_actions['elements'][] = array('type' => 'submit', 'name' => 'butt_unlink', 'value' => _l('Unlink'));
}
$form_actions['elements'][] = array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . ($finance['invoice_id'] ? module_invoice::link_open($finance['invoice_id'], false) : $module->link('finance', array('finance_id' => false))) . "';");
echo module_form::generate_form_actions($form_actions);
?>




</form>
예제 #5
0
    });
}
if (class_exists('module_invoice', false) && module_invoice::can_i('view', 'Invoices') && module_config::c('customer_list_show_invoices', 1)) {
    $columns['customer_invoices'] = array('title' => 'Invoices', 'callback' => function ($customer) {
        $invoices = module_invoice::get_invoices(array('customer_id' => $customer['customer_id']));
        if (count($invoices)) {
            $total_due = 0;
            $total_paid = 0;
            foreach ($invoices as $invoice) {
                $invoice = module_invoice::get_invoice($invoice['invoice_id']);
                $total_due += $invoice['total_amount_due'];
                $total_paid += $invoice['total_amount_paid'];
            }
            $old_customer_id = isset($_REQUEST['customer_id']) ? $_REQUEST['customer_id'] : false;
            $_REQUEST['customer_id'] = $customer['customer_id'];
            echo '<a href="' . module_invoice::link_open(false) . '">' . _l('%s invoice%s: %s', count($invoices), count($invoices) > 1 ? 's' : '', ($total_due > 0 ? '<span class="error_text">' . _l('%s due', dollar($total_due, true, $invoice['currency_id'])) . ' </span>' : '') . ($total_paid > 0 ? '<span class="success_text">' . _l('%s paid', dollar($total_paid, true, $invoice['currency_id'])) . ' </span>' : '')) . '</a>';
            if ($old_customer_id) {
                $_REQUEST['customer_id'] = $old_customer_id;
            } else {
                unset($_REQUEST['customer_id']);
            }
        }
    });
}
if (class_exists('module_extra', false)) {
    // do extra before "table sorting" so that it can hook in with the table sort call
    $table_manager->display_extra('customer', function ($customer) {
        module_extra::print_table_data('customer', $customer['customer_id']);
    }, 'customer_id');
    $table_manager->display_extra('user', function ($customer) {
        module_extra::print_table_data('user', $customer['primary_user_id']);
예제 #6
0
 private static function _format_invoice_payment($invoice_payment_data, $finance_data)
 {
     if (isset($invoice_payment_data['invoice_payment_id']) && $invoice_payment_data['invoice_payment_id'] > 0 && isset($invoice_payment_data['invoice_id']) && $invoice_payment_data['invoice_id'] > 0) {
         $invoice_data = module_invoice::get_invoice($invoice_payment_data['invoice_id']);
         $invoice_payment_data['url'] = module_finance::link_open('new', false) . '&invoice_payment_id=' . $invoice_payment_data['invoice_payment_id'];
         if ($invoice_payment_data['amount'] < 0 && (isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_OVERPAYMENT_CREDIT)) {
             $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Assigning Credit') : $invoice_payment_data['name'];
             $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Assigning Overpayment Credit from invoice <a href="%s">#%s</a>', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
             // refund
             $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['credit'] = 0;
             $invoice_payment_data['type'] = 'e';
         } else {
             if ($invoice_payment_data['amount'] < 0 || isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_REFUND) {
                 $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Refund') : $invoice_payment_data['name'];
                 $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Refund against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
                 // refund
                 $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['credit'] = 0;
                 $invoice_payment_data['type'] = 'e';
             } else {
                 $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Payment') : $invoice_payment_data['name'];
                 $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Payment against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
                 $invoice_payment_data['credit'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['sub_amount'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['taxable_amount'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['debit'] = 0;
                 $invoice_payment_data['type'] = 'i';
             }
         }
         if (isset($invoice_payment_data['data']) && strlen($invoice_payment_data['data'])) {
             $details = @unserialize($invoice_payment_data['data']);
             if ($details && isset($details['custom_notes']) && strlen($details['custom_notes'])) {
                 $invoice_payment_data['description'] .= " \n(" . $details['custom_notes'] . ')';
             }
         }
         $invoice_payment_data['account_name'] = '';
         $invoice_payment_data['categories'] = '';
         if (module_config::c('finance_date_type', 'payment') == 'invoice') {
             $invoice_payment_data['transaction_date'] = $invoice_data['date_create'];
         } else {
             $invoice_payment_data['transaction_date'] = $invoice_payment_data['date_paid'];
         }
         $invoice_payment_data['invoice_name'] = $invoice_data['name'];
         $invoice_payment_data['taxes'] = $invoice_data['taxes'];
         // calculate the sub amount based on taxes.
         if ($invoice_payment_data['amount'] >= $invoice_data['total_amount']) {
             // user overpaid this invoice amount.
             // check if there hasn't been any refunds or anything or assigning deposits.
         } else {
             if ($invoice_payment_data['amount'] == $invoice_data['total_amount']) {
                 // then we can work out any sub non taxable items.
                 if ($invoice_data['total_tax'] > 0) {
                     //$finance['sub_amount'] = $finance['amount'] - $invoice_data['total_tax'];
                     // todo: cache these and do a get_invoice basic above so we don't calculate each time.
                     $invoice_payment_data['sub_amount'] = $invoice_data['total_sub_amount'];
                     $invoice_payment_data['taxable_amount'] = $invoice_data['total_sub_amount_taxable'];
                 }
             } else {
                 // todo: average out the difference between invoice payments and the total amount? spread the tax over all payments maybe?
                 if (count($invoice_payment_data['taxes'])) {
                     $tax_percents = 0;
                     $increment = false;
                     foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) {
                         if ($tax['increment']) {
                             $increment = true;
                         }
                     }
                     foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) {
                         // the 'amount' of tax here will be incorrect, because this is a part payment against an invoice
                         // the 'amount' in here is the FULL amount of tax that has been charged against the invoice
                         $invoice_payment_data['taxes'][$tax_id]['amount'] = 0;
                         if ($increment) {
                             $invoice_payment_data['taxable_amount'] = $invoice_payment_data['taxable_amount'] / (1 + $tax['percent'] / 100);
                         } else {
                             $tax_percents += $tax['percent'] / 100;
                         }
                     }
                     $invoice_payment_data['taxable_amount'] = round($invoice_payment_data['taxable_amount'] / (1 + $tax_percents) * 100, 2) / 100;
                     $invoice_payment_data['sub_amount'] = $invoice_payment_data['taxable_amount'];
                 }
             }
         }
         $new_finance = hook_handle_callback('finance_invoice_listing', $invoice_payment_data['invoice_id'], $finance_data);
         if (is_array($new_finance) && count($new_finance)) {
             foreach ($new_finance as $n) {
                 $invoice_payment_data = array_merge($invoice_payment_data, $n);
             }
         }
     }
     return $invoice_payment_data;
 }
예제 #7
0
        unset($blank_invoices[$id]);
    }
}
if (count($blank_invoices)) {
    ?>
	<h2>Blank invoices found</h2>
	We found the following <?php 
    echo count($blank_invoices);
    ?>
 blank invoices that were created from a recent "Subscription" bug:
	<ul>
		<?php 
    foreach ($blank_invoices as $blank_invoice) {
        ?>
		<li><?php 
        echo module_invoice::link_open($blank_invoice['invoice_id'], true);
        ?>
 created on <?php 
        echo print_date($blank_invoice['date_created']);
        ?>
</li>
		<?php 
    }
    ?>
	</ul>
	You can remove all these invoices manually, or click the button below to remove them automatically.
	<form action="" method="post">
		<input type="hidden" name="remove_duplicates" value="yes">
		<input type="submit" value="Remove these <?php 
    echo count($blank_invoices);
    ?>
예제 #8
0
					<?php 
}
?>

					<?php 
if ((int) $invoice_id && module_invoice::can_i('delete', 'Invoices')) {
    ?>

					<input type="submit" name="butt_del" id="butt_del" value="<?php 
    echo _l('Delete');
    ?>
" class="submit_button delete_button" />
					<?php 
}
?>

					<input type="button" name="cancel" value="<?php 
echo _l('Cancel');
?>
" onclick="window.location.href='<?php 
echo module_invoice::link_open(false);
?>
';" class="submit_button" />
				</td>
			</tr>
		</tbody>
	</table>


</form>
     if (isset($r['website_id']) && $r['website_id'] > 0) {
         echo module_website::link_open($r['website_id'], true);
     }
     ?>
             </td>
             <td>
                 <?php 
     if (isset($r['job_id']) && $r['job_id'] > 0) {
         echo module_job::link_open($r['job_id'], true);
     }
     ?>
             </td>
             <td>
                 <?php 
     if (isset($r['invoice_id']) && $r['invoice_id'] > 0) {
         echo module_invoice::link_open($r['invoice_id'], true);
     }
     ?>
             </td>
             <?php 
 } else {
     if (isset($r['finance_id'])) {
         ?>
             <td colspan="3">
                 <?php 
         echo module_finance::link_open($r['finance_id'], true);
         ?>
                 
                 <?php 
         echo htmlspecialchars($r['description']);
         ?>
예제 #10
0
">
            <?php 
    if (isset($_REQUEST['view_all'])) {
        ?>
            <td><?php 
        foreach ($module->get_data_link_keys() as $key) {
            if (isset($data[$key]) && (int) $data[$key] > 0) {
                switch ($key) {
                    case 'customer_id':
                        echo module_customer::link_open($data[$key], true);
                        break;
                    case 'job_id':
                        echo module_job::link_open($data[$key], true);
                        break;
                    case 'invoice_id':
                        echo module_invoice::link_open($data[$key], true);
                        break;
                    case 'quote_id':
                        echo module_quote::link_open($data[$key], true);
                        break;
                    case 'file_id':
                        echo module_file::link_open($data[$key], true);
                        break;
                }
            }
        }
        ?>
</td>
            <?php 
    }
    /*<td><a href="<?php echo $module->link('',array("data_record_id"=>$data['data_record_id'],"customer_id"=>isset($_REQUEST['customer_id']) ? $_REQUEST['customer_id'] : false)); ?>"><?php echo $module->format_record_id($data['data_type_id'],$data['data_record_id']); ?></a></td>
예제 #11
0
 public function run_cron($debug = false)
 {
     // check for payments.
     $sql = "SELECT * FROM `" . _DB_PREFIX . "invoice_payment` ip WHERE 1 ";
     $sql .= " AND  `method` = 'paynl' ";
     $sql .= " AND  `date_paid` = '0000-00-00' ";
     $sql .= " AND  `other_id` != '' ";
     foreach (qa($sql) as $payment) {
         // check api status:
         $strUrl = 'https://*****:*****@rest-api.pay.nl/v5/Transaction/info/json?';
         $arrArguments = array();
         $arrArguments['transactionId'] = $payment['other_id'];
         # Prepare and call API URL
         $strUrl .= http_build_query($arrArguments);
         if ($debug) {
             echo "Checking URL {$strUrl} <br>\n";
             $jsonResult = file_get_contents($strUrl);
         } else {
             $jsonResult = @file_get_contents($strUrl);
         }
         $json = @json_decode($jsonResult, true);
         if ($debug) {
             echo "Got result: <br>\n";
             print_r($json);
         }
         if ($json && isset($json['paymentDetails']) && isset($json['paymentDetails']['stateName']) && isset($json['paymentDetails']['amount'])) {
             module_paymethod_paynl::add_payment_data($payment['invoice_payment_id'], 'log', "PayNL Status " . $json['paymentDetails']['stateName'] . ": \n " . var_export($json, true));
             switch ($json['paymentDetails']['stateName']) {
                 case 'PENDING':
                     // defauly, still waiting for payment.
                     break;
                 case 'PAID':
                     update_insert("invoice_payment_id", $payment['invoice_payment_id'], "invoice_payment", array('date_paid' => date('Y-m-d'), 'amount' => $json['paymentDetails']['amount'] / 100, 'other_id' => ''));
                     module_invoice::save_invoice($payment['invoice_id'], array());
                     break;
                 case 'CANCEL':
                     update_insert("invoice_payment_id", $payment['invoice_payment_id'], "invoice_payment", array('other_id' => ''));
                     module_invoice::save_invoice($payment['invoice_id'], array());
                     send_error('PayNL payment cancelled for invoice: ' . module_invoice::link_open($payment['invoice_id'], true));
                     break;
             }
         } else {
             module_paymethod_paynl::add_payment_data($payment['invoice_payment_id'], 'log', "PayNL Status ERROR: \n " . $jsonResult);
         }
     }
 }
예제 #12
0
 public static function banktransfer_redirect($description, $amount, $user_id, $payment_id, $invoice_id)
 {
     $invoice_data = module_invoice::get_invoice($invoice_id);
     $invoice_replace = module_invoice::get_replace_fields($invoice_id, $invoice_data);
     $bank_details = module_template::get_template_by_key('paymethod_banktransfer_details');
     $bank_details->assign_values($invoice_data + array('amount' => dollar($amount, true, $invoice_data['currency_id'])));
     $bank_details->assign_values($invoice_replace);
     $bank_details_html = $bank_details->render('html');
     // display a template with the bank details in it.
     $template = module_template::get_template_by_key('paymethod_banktransfer');
     $template->assign_values(array('bank_details' => $bank_details_html, 'link' => module_invoice::link_open($invoice_id)));
     $template->assign_values($invoice_replace);
     echo $template->render('pretty_html');
     exit;
 }
예제 #13
0
             } else {
                 if (print_date($next_due_time) == print_date($invoice_data['date_create']) || $next_due_time_pre && print_date($next_due_time_pre) == print_date($invoice_data['date_create'])) {
                     // this invoice is for the next due date.
                     $next_due_time_invoice_created = $invoice_data;
                 }
             }
             $invoice_history_html .= '<li>';
             $invoice_history_html .= _l('Invoice #%s for %s on %s (paid on %s)', module_invoice::link_open($h['invoice_id'], true, $invoice_data), dollar($invoice_data['total_amount'], true, $invoice_data['currency_id']), print_date($invoice_data['date_create']), $invoice_data['date_paid'] != '0000-00-00' ? print_date($invoice_data['date_paid']) : '<span class="important">' . _l('UNPAID') . '</span>');
             $invoice_history_html .= '</li>';
         }
     }
 }
 if (isset($members_subscriptions[$subscription['subscription_id']]) && module_security::is_page_editable() && $remaining_invoices != 0) {
     //echo '<li>';
     if ($next_due_time_invoice_created) {
         _e('The next invoice has been created for %s. Please mark it as paid.', '<a href="' . module_invoice::link_open($next_due_time_invoice_created['invoice_id'], false, $next_due_time_invoice_created) . '">' . print_date($next_due_time) . '</a>');
         echo ' <a href="#" onclick="$(\'#next_invoice_' . $subscription['subscription_id'] . '\').show(); $(this).hide();">New</a>';
         echo '<span id="next_invoice_' . $subscription['subscription_id'] . '" style="display:none;"><br/>';
     }
     if (isset($subscription['automatic_renew']) && $subscription['automatic_renew']) {
         _e('This Subscription will renew on %s', print_date($next_due_time_pre ? $next_due_time_pre : $next_due_time));
         echo ' ';
         if (isset($subscription['automatic_email']) && $subscription['automatic_email']) {
             _e('and will be automatically emailed');
         }
     } else {
         _e('New Invoice for');
         ?>
                     <?php 
         echo currency('<input type="text" name="foo" id="amount_' . $subscription['subscription_id'] . '" value="' . $subscription['amount'] . '" class="currency">', true, $subscription['currency_id']);
         ?>
예제 #14
0
         if ($invoice_data['total_amount_due'] > 0) {
             $responsive_summary[] = _l("Please pay <strong>%s</strong>.", dollar($invoice_data['total_amount_due'], true, $invoice_data['currency_id']));
             echo '<p>';
             echo _l("Please pay <strong>%s</strong> to receive Priority Support. To make payment please click the button below.", dollar($invoice_data['total_amount_due'], true, $invoice_data['currency_id']));
             echo '</p>';
             echo '<p align="center">';
             echo '<a href="' . module_invoice::link_public($ticket['invoice_id']) . '" target="_blank" class="uibutton small_button">' . _l('Pay Now') . '</a>';
             echo '</p>';
         } else {
             $responsive_summary[] = '<strong>' . _l("This is a Priotity Ticket") . '</strong>';
             echo '<p>';
             _e("Thank you for purchasing Priority Support. We will answer your question shortly.");
             echo '</p>';
             echo '<p align="center">';
             if (module_invoice::can_i('view', 'Invoices')) {
                 echo '<a href="' . module_invoice::link_open($ticket['invoice_id']) . '" target="_blank">' . _l('View Invoice') . '</a>';
             } else {
                 echo '<a href="' . module_invoice::link_public($ticket['invoice_id']) . '" target="_blank">' . _l('View Invoice') . '</a>';
             }
             echo '</p>';
         }
     }
 } else {
     echo '<p>';
     echo _l("Priority Support costs <strong>%s</strong>. To make payment please click the button below.", dollar(module_config::c('ticket_priority_cost', 10), true, module_config::c('ticket_priority_currency', 1)));
     echo '</p>';
     echo '<p align="center">';
     echo '<input type="submit" name="generate_priority_invoice" value="' . _l('Pay Now') . '" class="submit_button small_button">';
     echo '</p>';
 }
 ?>
예제 #15
0
 public static function create_new_invoice_for_subscription_payment($invoice_id, $invoice_payment_id, $invoice_payment_subscription_id)
 {
     // we have an inbound subscription payment for an invoice.
     // we have to generate a new invoice (or find the generated invoice if one exists)
     // first we have to check if this payment is for this invoice (ie: the first subscription payment)
     $invoice_data = self::get_invoice($invoice_id);
     if ($invoice_data['total_amount_due'] > 0) {
         // this invoice is unpaid, we apply this subscription payment against thsi invoice
         return array('invoice_id' => $invoice_id, 'invoice_payment_id' => $invoice_payment_id);
     }
     // first we look for a generated invoice, this is easiest.
     if (class_exists('module_subscription', false)) {
         // check if this invoice is part of a subscription.
         // if it is we hunt through the subscription history until we find a recent unpaid invoice
         // THIS CODE IS SIMILAR TO module_invoice::is_automatic_paying_invoice($invoice_id)
         $subscription_history_item = get_single('subscription_history', 'invoice_id', $invoice_id);
         if ($subscription_history_item && $subscription_history_item['subscription_owner_id']) {
             // we have an invoice that is on a subscription!
             $subscription_owner = module_subscription::get_subscription_owner($subscription_history_item['subscription_owner_id']);
             // check if there are unpaid invoices that were generated after this invoice.
             if ($subscription_owner['subscription_owner_id'] == $subscription_history_item['subscription_owner_id']) {
                 $subscription_history = get_multiple('subscription_history', array('subscription_owner_id' => $subscription_owner['subscription_owner_id']));
                 foreach ($subscription_history as $h) {
                     if ($h['invoice_id'] > $invoice_id && $h['paid_date'] == '0000-00-00') {
                         // found an invoice for this subscription that was generated after the initial invoice that is unpaid.
                         // apply subscription payment to this one.
                         $invoice_data = module_invoice::get_invoice($h['invoice_id']);
                         if ($invoice_data['total_amount_due'] > 0) {
                             $invoice_payment_id = update_insert('invoice_payment_id', false, 'invoice_payment', array('invoice_id' => $h['invoice_id'], 'payment_type' => _INVOICE_PAYMENT_TYPE_NORMAL, 'method' => _l('Pending Subscription'), 'currency_id' => $invoice_data['currency_id'], 'invoice_payment_subscription_id' => $invoice_payment_subscription_id));
                             return array('invoice_id' => $h['invoice_id'], 'invoice_payment_id' => $invoice_payment_id);
                         }
                     }
                 }
                 // if we get here it means we have a subscription invoice that hasn't been renewed yet.
                 $subscription = module_subscription::get_subscription($subscription_owner['subscription_id']);
                 // we force the renewal of the next invoice in this subscription lot and mark it as paid.
                 $invoice_id = module_subscription::generate_subscription_invoice($subscription_owner['subscription_id'], $subscription_owner['owner_table'], $subscription_owner['owner_id'], date('Y-m-d'), $subscription['amount']);
                 if ($invoice_id) {
                     $invoice_data = module_invoice::get_invoice($invoice_id);
                     $invoice_payment_id = update_insert('invoice_payment_id', false, 'invoice_payment', array('invoice_id' => $invoice_id, 'payment_type' => _INVOICE_PAYMENT_TYPE_NORMAL, 'method' => _l('Pending Subscription'), 'currency_id' => $invoice_data['currency_id'], 'invoice_payment_subscription_id' => $invoice_payment_subscription_id));
                     if ($subscription['automatic_email'] && module_config::c('invoice_subscription_send_due_email_before_payment', 1)) {
                         if (module_invoice::email_invoice_to_customer($invoice_id)) {
                         } else {
                             echo " - failed to send subscription invoice " . module_invoice::link_open($invoice_id, true) . " to customer <br>\n";
                         }
                         exit;
                     }
                     return array('invoice_id' => $invoice_id, 'invoice_payment_id' => $invoice_payment_id);
                 }
             }
         }
     }
 }
예제 #16
0
            <a href="<?php 
    echo $finance['url'];
    ?>
"><?php 
    echo !trim($finance['name']) ? 'N/A' : htmlspecialchars($finance['name']);
    ?>
</a>
        </td>
	    <td><?php 
    echo $finance['customer_id'] ? module_customer::link_open($finance['customer_id'], true) : _l('N/A');
    ?>
</td>
	    <td><?php 
    if ($finance['invoice_id']) {
        $invoice_data = module_invoice::get_invoice($finance['invoice_id']);
        echo module_invoice::link_open($finance['invoice_id'], true, $invoice_data);
    } else {
        _e('N/A');
    }
    ?>
</td>
	    <td><?php 
    if (isset($finance['job_id']) && $finance['job_id']) {
        echo module_job::link_open($finance['job_id'], true);
    } else {
        if ($finance['invoice_id'] && count($invoice_data['job_ids'])) {
            foreach ($invoice_data['job_ids'] as $job_id) {
                echo module_job::link_open($job_id, true) . ' ';
            }
        } else {
            _e('N/A');
예제 #17
0
        <?php 
if (class_exists('module_signature', false) && module_signature::signature_enabled($job_id)) {
    ?>
            <td> <?php 
    module_signature::signature_job_task_link($job_id, $task_id);
    ?>
 </td>
        <?php 
}
?>
        <td align="center" valign="top">
            <?php 
if ($task_data['invoiced'] && $task_data['invoice_id']) {
    if (module_invoice::can_i('view', 'Invoices')) {
        //$invoice = module_invoice::get_invoice($task_data['invoice_id']);
        echo module_invoice::link_open($task_data['invoice_id'], true);
    }
    /*echo " ";
      echo '<span class="';
      if($invoice['total_amount_due']>0){
          echo 'error_text';
      }else{
          echo 'success_text';
      }
      echo '">';
      if($invoice['total_amount_due']>0){
          echo dollar($invoice['total_amount_due'],true,$job['currency_id']);
          echo ' '._l('due');
      }else{
          echo _l('All paid');
      }
예제 #18
0
파일: job.php 프로젝트: sgh1986915/php-crm
 public function run_cron($debug = false)
 {
     // we only want to perform these cron actions if we're after a certain time of day
     // because we dont want to be generating these renewals and sending them at midnight, can get confusing
     $after_time = module_config::c('invoice_automatic_after_time', 7);
     $time_of_day = date('G');
     if ($time_of_day < $after_time) {
         if ($debug) {
             echo "Not performing automatic invoice operations until after {$after_time}:00 - it is currently {$time_of_day}:" . date('i') . "<br>\n";
         }
         return;
     }
     // find automatic job renewals
     $sql = "SELECT p.* FROM `" . _DB_PREFIX . "job` p ";
     $sql .= " WHERE p.date_renew != '0000-00-00'";
     $sql .= " AND p.date_start != '0000-00-00'";
     $sql .= " AND p.date_renew <= '" . date('Y-m-d') . "'";
     $sql .= " AND (p.renew_job_id IS NULL OR p.renew_job_id = 0)";
     $sql .= " AND (p.renew_auto = 1)";
     $renew_jobs = qa($sql);
     foreach ($renew_jobs as $renew_job) {
         // time to automatically renew this job! woo!
         if ($debug) {
             echo "Automatically Renewing Job " . module_job::link_open($renew_job['job_id'], true) . "<br>\n";
         }
         //$job_details = $this->get_job($renew_job['job_id']);
         $job_invoices = module_invoice::get_invoices(array('job_id' => $renew_job['job_id']));
         $unpaid_invoice = false;
         foreach ($job_invoices as $job_invoice) {
             $job_invoice = module_invoice::get_invoice($job_invoice['invoice_id']);
             if ($job_invoice['total_amount_due'] > 0) {
                 $unpaid_invoice = true;
             }
         }
         if (module_config::c('invoice_auto_renew_only_paid_invoices', 1) && $unpaid_invoice) {
             if ($debug) {
                 echo "Not automatically renewing this job because it has unpaid invoices. <br>\n";
             }
         } else {
             $new_job_id = $this->renew_job($renew_job['job_id'], true);
             if ($new_job_id) {
                 //module_cache::clear_cache();
                 if ($debug) {
                     echo "Job Automatically Renewed: " . module_job::link_open($new_job_id, true) . "<br>\n";
                 }
                 if ($renew_job['renew_invoice']) {
                     // we want to tick all these tasks off and invoice this job, then send this invoice to the customer.
                     $job_tasks = module_job::get_tasks($new_job_id);
                     foreach ($job_tasks as $job_task_id => $job_task) {
                         $job_tasks[$job_task_id]['fully_completed_t'] = 1;
                         $job_tasks[$job_task_id]['fully_completed'] = 1;
                     }
                     $this->save_job_tasks($new_job_id, array('job_task' => $job_tasks));
                     //module_cache::clear_cache();
                     // generate an invoice for this job.
                     $_REQUEST['job_id'] = $new_job_id;
                     $new_invoice = module_invoice::get_invoice('new');
                     $new_invoice['date_create'] = $renew_job['date_renew'];
                     $new_invoice['invoice_invoice_item'] = module_invoice::get_invoice_items('new', $new_invoice);
                     $new_invoice_id = module_invoice::save_invoice('new', $new_invoice);
                     //module_cache::clear_cache();
                     if ($debug) {
                         echo "Generated new invoice for renewed job: " . module_invoice::link_open($new_invoice_id, true) . "<br/>";
                     }
                     if ($debug) {
                         echo "Emailing invoice to customer...";
                     }
                     if (module_invoice::email_invoice_to_customer($new_invoice_id)) {
                         if ($debug) {
                             echo "send successfully";
                         }
                     } else {
                         if ($debug) {
                             echo "send failed";
                         }
                     }
                     if ($debug) {
                         echo "<br>\n";
                     }
                 }
             }
         }
     }
 }
예제 #19
0
        include 'includes/plugin_finance/pages/finance_invoice_edit.php';
    }
}
// invoice_id check
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . (!$invoice_id && isset($_REQUEST['job_id']) && (int) $_REQUEST['job_id'] > 0 ? module_job::link_open($_REQUEST['job_id']) : module_invoice::link_open(false)) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save'))));
if ((int) $invoice_id) {
    if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') {
        $form_actions['elements'][] = array('type' => 'save_button', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Receipt'));
    } else {
        $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_email', 'value' => _l('Email Invoice'));
    }
    if (function_exists('convert_html2pdf')) {
        if (!module_invoice::can_i('edit', 'Invoices')) {
            $form_actions['elements'][] = array('type' => 'button', 'class' => 'submit_button no_permissions', 'name' => 'butt_print', 'value' => _l('Print PDF'), 'onclick' => "window.location.href='" . module_invoice::link_public_print($invoice_id) . "';");
        } else {
            $form_actions['elements'][] = array('type' => 'submit', 'class' => 'submit_button', 'name' => 'butt_print', 'value' => _l('Print PDF'));
        }
    }
}
if ((int) $invoice_id && module_invoice::can_i('delete', 'Invoices')) {
    $form_actions['elements'][] = array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete'));
}
$form_actions['elements'][] = array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_invoice::link_open(false) . "';");
echo module_form::generate_form_actions($form_actions);
?>



</form>
예제 #20
0
 public static function run_cron($debug = false)
 {
     // we only want to perform these cron actions if we're after a certain time of day
     // because we dont want to be generating these renewals and sending them at midnight, can get confusing
     $after_time = module_config::c('invoice_automatic_after_time', 7);
     $time_of_day = date('G');
     if ($time_of_day < $after_time) {
         if ($debug) {
             echo "Not performing automatic subscription operations until after {$after_time}:00 - it is currently {$time_of_day}:" . date('i') . "<br>\n";
         }
         return;
     }
     // find all automatic subscriptions and renew them (if applicable)
     $sql = "SELECT * FROM `" . _DB_PREFIX . "subscription` s ";
     $sql .= " WHERE s.automatic_renew = 1";
     $subscriptions = qa($sql);
     foreach ($subscriptions as $subscription) {
         if ($subscription['automatic_renew']) {
             if ($debug) {
                 echo "<br>\nProcessing subscription renewals for subscription " . module_subscription::link_open($subscription['subscription_id'], true) . "<br>\n<br>\n";
             }
             // find all the members/customers from this subscription
             //$members = module_subscription::get_subscribed_members($subscription['subscription_id']);
             //$customers = module_subscription::get_subscribed_customers($subscription['subscription_id']);
             $owners = module_subscription::get_subscribed_owners($subscription['subscription_id']);
             foreach ($owners as $member) {
                 if (!$member['next_generation_date'] || $member['next_generation_date'] == '0000-00-00') {
                     continue;
                 }
                 if (!$member['next_due_date'] || $member['next_due_date'] == '0000-00-00') {
                     continue;
                 }
                 if ($debug) {
                     echo "Doing: " . $member['owner_table'] . " " . $member['owner_id'] . "<br>\n";
                 }
                 // check permissions for logged in users, dont want the cron to run when someone is logged in and no access to this account.
                 if (module_security::is_logged_in()) {
                     switch ($member['owner_table']) {
                         case 'website':
                             $website_perm_check = module_website::get_website($member['owner_id']);
                             if (!$website_perm_check || $website_perm_check['website_id'] != $member['owner_id']) {
                                 continue 2;
                             }
                             if ($debug) {
                                 echo "permission pass for website: " . $website_perm_check['website_id'];
                             }
                             break;
                         case 'customer':
                             $customer_perm_check = module_customer::get_customer($member['owner_id']);
                             if (!$customer_perm_check || $customer_perm_check['customer_id'] != $member['owner_id']) {
                                 continue 2;
                             }
                             if ($debug) {
                                 echo "permission pass for customer: " . $customer_perm_check['customer_id'];
                             }
                             break;
                     }
                 }
                 // is the last invoice unpaid?
                 $history = self::get_subscription_history($subscription['subscription_id'], $member['owner_table'], $member['owner_id']);
                 $next_due_time_invoice_created = false;
                 $invoice_unpaid = false;
                 if (isset($member['recur_limit']) && (int) $member['recur_limit'] > 0 && count($history) >= (int) $member['recur_limit']) {
                     if ($debug) {
                         echo " - not renewing this one because it has hit our recur limit of " . $member['recur_limit'] . "<br>\n";
                     }
                     continue;
                 }
                 foreach ($history as $h) {
                     $last_invoice = module_invoice::get_invoice($h['invoice_id']);
                     if (!$last_invoice || $last_invoice['date_cancel'] != '0000-00-00') {
                         continue;
                     }
                     // check the new 'next_due_date' entry in the db table
                     if (isset($h['from_next_due_date']) && $h['from_next_due_date'] && $h['from_next_due_date'] != '0000-00-00') {
                         // we're using the new method of checking when an invoice was generated, rather than the confusing invoice 'date_create' check below
                         if ($debug) {
                             echo " - checking if next_due_date " . print_date($member['next_due_date']) . " matches subscription history from_next_due_date for invoice " . module_invoice::link_open($h['invoice_id'], true, $last_invoice) . " from_next_due_date: " . print_date($h['from_next_due_date']) . " (invoice create_date: " . print_date($last_invoice['date_create']) . ")<br>\n";
                         }
                         if (print_date($member['next_due_date']) == print_date($h['from_next_due_date'])) {
                             //print_date($last_invoice['date_create'])){
                             // this invoice is for the next due date.
                             $next_due_time_invoice_created = $last_invoice;
                         }
                     } else {
                         if ($debug) {
                             echo " - checking if next_generation_date (" . print_date($member['next_generation_date']) . ") or next_due_date (" . print_date($member['next_due_date']) . ") matches invoice " . module_invoice::link_open($h['invoice_id'], true, $last_invoice) . " created date (" . print_date($last_invoice['date_create']) . ") <br>\n";
                         }
                         if (print_date($member['next_generation_date']) == print_date($last_invoice['date_create']) || print_date($member['next_due_date']) == print_date($last_invoice['date_create'])) {
                             //print_date($last_invoice['date_create'])){
                             // this invoice is for the next due date.
                             $next_due_time_invoice_created = $last_invoice;
                         }
                     }
                     if ($last_invoice['total_amount_due'] > 0) {
                         $invoice_unpaid = true;
                     }
                 }
                 //self::generate_subscription_invoice($subscription_id, $customer_hack, $member_id, $date, $amount)
                 $next_due_time = strtotime($member['next_generation_date']);
                 if ($debug) {
                     echo " - next subscription time is " . $member['next_generation_date'] . " <br>\n";
                 }
                 if ($next_due_time <= strtotime(date('Y-m-d')) && !$next_due_time_invoice_created) {
                     if ($debug) {
                         echo " - Yes its time to generate an invoice!<br>\n";
                     }
                     if (module_config::c('invoice_auto_renew_only_paid_invoices', 1) && $invoice_unpaid) {
                         if ($debug) {
                             echo " - skipping generating renewal for " . $member['owner_table'] . " " . $member['owner_id'] . " because a previous subscription is unpaid <br>\n";
                         }
                         continue;
                     }
                     // time to generate! woo!
                     if ($debug) {
                         echo " - generating subscription renewal for " . $member['owner_table'] . " " . $member['owner_id'] . "<br>\n";
                     }
                     $invoice_id = self::generate_subscription_invoice($subscription['subscription_id'], $member['owner_table'], $member['owner_id'], $member['next_generation_date'], $subscription['amount']);
                     if ($debug) {
                         echo " - generated invoice " . module_invoice::link_open($invoice_id, true) . " for subscription <br>\n";
                     }
                     if ($subscription['automatic_email']) {
                         if ($debug) {
                             echo " - emailing invoice to " . $member['owner_table'] . "... <br>\n";
                         }
                         if (module_invoice::email_invoice_to_customer($invoice_id, $debug)) {
                             if ($debug) {
                                 echo "send successfully <br>\n";
                             }
                         } else {
                             echo " - failed to send invoice " . module_invoice::link_open($invoice_id, true) . " to " . $member['owner_table'] . " <br>\n";
                         }
                     }
                 } else {
                     if ($debug) {
                         echo " - skipping generating renewal for " . $member['owner_table'] . " " . $member['owner_id'] . " because the due date has already been generated <br>\n";
                     }
                 }
             }
         }
     }
 }
예제 #21
0
파일: note.php 프로젝트: sgh1986915/php-crm
 function handle_hook($hook, $calling_module = false, $owner_table = false, $key_name = false, $key_value = false, $rel_data = false)
 {
     switch ($hook) {
         case "home_alerts":
             $alerts = array();
             if (module_config::c('allow_note_reminders', 1)) {
                 // find any jobs that are past the due date and dont have a finished date.
                 $key = _l('Note Reminder');
                 if (class_exists('module_dashboard', false)) {
                     module_dashboard::register_group($key, array('columns' => array('name' => _l('Reminder'), 'type' => _l('Type'), 'full_link' => _l('Link'), 'date' => _l('Date'), 'days' => _l('Date'))));
                 }
                 $sql = "SELECT * FROM `" . _DB_PREFIX . "note` n ";
                 $sql .= " WHERE n.`reminder` = 1 AND n.note_time < " . (int) strtotime('+' . module_config::c('alert_days_in_future', 5) . ' days') . "";
                 $sql .= " AND ( n.`user_id` = 0 OR n.`user_id` = " . module_security::get_loggedin_id() . ")";
                 $sql .= " ORDER BY n.note_time ASC";
                 $tasks = qa($sql);
                 foreach ($tasks as $task) {
                     $alert_res = process_alert(date('Y-m-d', $task['note_time']), $key);
                     if ($alert_res) {
                         $alert_res['link'] = $task['rel_data'];
                         // fix for linking when changing folder.
                         $alert_res['type'] = _l(ucwords($task['owner_table']));
                         switch ($task['owner_table']) {
                             case 'user':
                                 $user = module_user::get_user($task['owner_id']);
                                 if ($user['customer_id'] || $user['vendor_id']) {
                                     $alert_res['link'] = module_user::link_open_contact($task['owner_id'], false, $user);
                                     $alert_res['full_link'] = module_user::link_open_contact($task['owner_id'], true, $user);
                                     $alert_res['type'] = _l('Contact');
                                 } else {
                                     $alert_res['link'] = module_user::link_open($task['owner_id'], false, $user);
                                     $alert_res['full_link'] = module_user::link_open($task['owner_id'], true, $user);
                                 }
                                 break;
                             case 'invoice':
                                 $invoice_data = module_invoice::get_invoice($task['owner_id'], true);
                                 if (!$invoice_data || !isset($invoice_data['invoice_id']) || $invoice_data['invoice_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_invoice::link_open($task['owner_id'], false, $invoice_data);
                                 $alert_res['full_link'] = module_invoice::link_open($task['owner_id'], true, $invoice_data);
                                 break;
                             case 'quote':
                                 $quote_data = module_quote::get_quote($task['owner_id'], true);
                                 if (!$quote_data || !isset($quote_data['quote_id']) || $quote_data['quote_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_quote::link_open($task['owner_id'], false, $quote_data);
                                 $alert_res['full_link'] = module_quote::link_open($task['owner_id'], true, $quote_data);
                                 break;
                             case 'website':
                                 $website_data = module_website::get_website($task['owner_id']);
                                 if (!$website_data || !isset($website_data['website_id']) || $website_data['website_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_website::link_open($task['owner_id'], false);
                                 $alert_res['full_link'] = module_website::link_open($task['owner_id'], true);
                                 break;
                             case 'customer':
                                 $customer_data = module_customer::get_customer($task['owner_id']);
                                 if (!$customer_data || !isset($customer_data['customer_id']) || $customer_data['customer_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_customer::link_open($task['owner_id'], false, $customer_data);
                                 $alert_res['full_link'] = module_customer::link_open($task['owner_id'], true, $customer_data);
                                 break;
                             case 'vendor':
                                 $vendor_data = module_vendor::get_vendor($task['owner_id']);
                                 if (!$vendor_data || !isset($vendor_data['vendor_id']) || $vendor_data['vendor_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_vendor::link_open($task['owner_id'], false, $vendor_data);
                                 $alert_res['full_link'] = module_vendor::link_open($task['owner_id'], true, $vendor_data);
                                 break;
                             case 'job':
                                 $job_data = module_job::get_job($task['owner_id']);
                                 if (!$job_data || !isset($job_data['job_id']) || $job_data['job_id'] != $task['owner_id']) {
                                     continue 2;
                                 }
                                 $alert_res['link'] = module_job::link_open($task['owner_id'], false, $job_data);
                                 $alert_res['full_link'] = module_job::link_open($task['owner_id'], true, $job_data);
                                 break;
                                 // todo - add others.
                         }
                         $alert_res['name'] = $task['note'];
                         $alert_res['date'] = print_date($alert_res['date']);
                         $alert_res['time'] = $task['note_time'];
                         $alerts[] = $alert_res;
                     }
                 }
             }
             return $alerts;
             break;
             /*case "note_list":
             				if($owner_id && $owner_id != 'new'){
             
             					$note_items = $this->get_notes(array("owner_table"=>$owner_table,"owner_id"=>$owner_id));
             					foreach($note_items as &$note_item){
             						// do it in loop here because of $this issues in static method below.
             						// instead of include file below.
             						$note_item['html'] = $this->print_note($note_item['note_id']);
             					}
             					include("pages/note_list.php");
             				}else{
             					echo 'Please save first before creating notes.';
             				}
             				break;*/
         /*case "note_list":
         				if($owner_id && $owner_id != 'new'){
         
         					$note_items = $this->get_notes(array("owner_table"=>$owner_table,"owner_id"=>$owner_id));
         					foreach($note_items as &$note_item){
         						// do it in loop here because of $this issues in static method below.
         						// instead of include file below.
         						$note_item['html'] = $this->print_note($note_item['note_id']);
         					}
         					include("pages/note_list.php");
         				}else{
         					echo 'Please save first before creating notes.';
         				}
         				break;*/
         case "note_delete":
             // find the key we are saving this address against.
             $owner_id = (int) $key_value;
             if (!$owner_id || $owner_id == 'new') {
                 // find one in the post data.
                 if (isset($_REQUEST[$key_name])) {
                     $owner_id = $_REQUEST[$key_name];
                 }
             }
             $note_hash = md5($owner_id . '|' . $owner_table);
             // just for posting unique arrays.
             if ($owner_table && $owner_id) {
                 $this->note_delete($owner_table, $owner_id);
             }
             break;
     }
 }
예제 #22
0
        <?php 
        } else {
            ?>

        <iframe src="<?php 
            echo $module->link_generate($invoice_id, array('arguments' => array('go' => 1, 'print' => 1), 'page' => 'invoice_admin', 'full' => false));
            ?>
" style="display:none;"></iframe>


        <?php 
        }
        ?>

        <p><?php 
        echo _l('After printing is complete you can <a href="%s">click here</a> return to invoice %s', module_invoice::link_open($invoice_id), module_invoice::link_open($invoice_id, true));
        ?>
</p>
        <p>&nbsp;</p>
        <p><?php 
        echo _l('<em>New:</em> Please <a href="%s" target="_blank">click here</a> to view the HTML invoice (this HTML page can be "Printed to PDF" using <a href="http://www.primopdf.com/" target="_blank">PrimoPDF</a> for better results).', $module->link_generate($invoice_id, array('arguments' => array('go' => 1, 'print' => 1, 'htmlonly' => 1), 'page' => 'invoice_admin', 'full' => false)));
        ?>
</p>

    <?php 
    }
    ?>

<?php 
}