示例#1
0
<?php

try {
    $tpl = erLhcoreClassTemplate::getInstance('lhinstance/invoices.tpl.php');
    $pages = new lhPaginator();
    $pages->items_total = erLhcoreClassModelInstanceInvoice::getCount();
    $pages->translationContext = 'abstract/list';
    $pages->serverURL = erLhcoreClassDesign::baseurl('instance/invoices');
    $pages->setItemsPerPage(20);
    $pages->paginate();
    $tpl->set('pages', $pages);
    $items = array();
    if ($pages->items_total > 0) {
        $items = erLhcoreClassModelInstanceInvoice::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page));
    }
    $tpl->set('items', $items);
    $tpl->set('pages', $pages);
    $Result['content'] = $tpl->fetch();
    $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Invoices')));
} catch (Exception $e) {
    print_r($e);
}
示例#2
0
 $payment_currency = $_POST['mc_currency'];
 $txn_id = $_POST['txn_id'];
 $receiver_email = $_POST['receiver_email'];
 $payer_email = $_POST['payer_email'];
 try {
     if ($payment_status != 'Completed') {
         throw new Exception('Payment not completed');
     }
     if ($receiver_email != erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_paypal_mail')) {
         throw new Exception('Incorrect seller email');
     }
     if (erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('txn_id' => $txn_id))) == 0) {
         $db = ezcDbInstance::get();
         try {
             $db->beginTransaction();
             $invoice = new erLhcoreClassModelInstanceInvoice();
             $invoice->order_item = $_POST['option_selection1'];
             $invoice->txn_id = $txn_id;
             $invoice->instance_id = (int) $_POST['custom'];
             $invoice->amount = round($payment_amount * 100);
             $invoice->currency = $payment_currency;
             $dataLog = $_POST;
             $dataLog['raw_response'] = $res;
             $invoice->log = json_encode($dataLog, JSON_PRETTY_PRINT);
             $invoice->saveThis();
             $optionPurchased = $_POST['option_selection1'];
             $paypalSellerOptions = erConfigClassLhConfig::getInstance()->getSetting('site', 'seller_paypal_options');
             $requestNumber = $paypalSellerOptions[$optionPurchased]['r'];
             $periodDays = $paypalSellerOptions[$optionPurchased]['p'];
             $instance = erLhcoreClassModelInstance::fetch($invoice->instance_id);
             if ($instance->is_reseller) {
<?php

require_once 'extension/instancecustomer/classes/tcpdf_min/tcpdf.php';
try {
    $instance = erLhcoreClassInstance::getInstance();
    $invoice = erLhcoreClassModelInstanceInvoice::fetch((int) $Params['user_parameters']['id']);
    if ($invoice->instance_id != $instance->id) {
        die('No permission to view');
    }
} catch (Exception $e) {
    print_r($e);
    exit;
}
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Remigijus Kiminas');
$pdf->SetTitle('Invoice');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
示例#4
0
        $mail->ClearAddresses();
        $tpl->set('request_send', true);
    } else {
        $tpl->set('errors', array(erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Please choose at least one valid module!')));
    }
}
$pages = new lhPaginator();
$pages->items_total = erLhcoreClassModelInstanceInvoice::getCount(array('filter' => array('instance_id' => $instance->id)));
$pages->translationContext = 'instance/billing';
$pages->serverURL = erLhcoreClassDesign::baseurl('instance/billing');
$pages->setItemsPerPage(20);
$pages->paginate();
$tpl->set('pages', $pages);
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassModelInstanceInvoice::getList(array('filter' => array('instance_id' => $instance->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page));
}
$tpl->set('items', $items);
if ($instance->is_reseller) {
    $pagesInstances = new lhPaginator();
    $pagesInstances->items_total = erLhcoreClassModelInstance::getCount(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id)));
    $pagesInstances->translationContext = 'instance/billing';
    $pagesInstances->serverURL = erLhcoreClassDesign::baseurl('instance/billinginstance');
    $pagesInstances->setItemsPerPage(20);
    $pagesInstances->paginate();
    $tpl->set('pagesInstance', $pagesInstances);
    $items = array();
    if ($pagesInstances->items_total > 0) {
        $items = erLhcoreClassModelInstance::getList(array('switch_db' => true, 'filter' => array('reseller_id' => $instance->id), 'offset' => $pagesInstances->low, 'limit' => $pagesInstances->items_per_page));
    }
    $tpl->set('itemsInstance', $items);