本文整理汇总了PHP中Invoice::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::get方法的具体用法?PHP Invoice::get怎么用?PHP Invoice::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewInvoiceDetails
public function viewInvoiceDetails($invoiceId)
{
try {
$invoice = Invoice::get($invoiceId);
///
$allTools = Tool::getAll();
// $invoice->items // this is an array of Item Objects
return view("/invoiceDetails", ["invoice" => $invoice, "tools" => $allTools]);
} catch (PDOException $e) {
die($e->getMessage());
}
}
示例2: _sendInvoiceBasedOnProforma
/**
*
* @param int $invoiceMapId
* @return \ifirma\SendResult
*/
private function _sendInvoiceBasedOnProforma($invoiceMapId)
{
$invoiceMap = InvoiceMap::get($invoiceMapId);
if ($invoiceMap === null) {
return SendResult::makeInvalidResponse(SendResult::MESSAGE_MISSING_INVOICE_PROFORMA);
}
$invoiceResponseObj = $this->_getInvoiceResponseObject($invoiceMap);
if ($invoiceResponseObj === null) {
return SendResult::makeInvalidResponse(SendResult::MESSAGE_MISSING_INVOICE_PROFORMA);
}
$sendInvoiceResult = $invoiceResponseObj->sendInvoiceBasedOnThisProforma();
if (!$sendInvoiceResult->isOk()) {
return SendResult::makeInvalidResponse($sendInvoiceResult->getMessage() !== '' ? $sendInvoiceResult->getMessage() : SendResult::MESSAGE_UNABLE_TO_SEND_INVOICE);
}
$sendInvoiceResultContent = $sendInvoiceResult->getContent();
$newInvoiceId = $sendInvoiceResultContent[Response::KEY_INVOICE_ID];
$newInvoiceMapObj = $this->_createAndSaveInvoiceMapObject($newInvoiceId, $invoiceMap->{InvoiceMap::COLUMN_NAME_ORDER_ID}, InvoiceMap::INVOICE_TYPE_NORMAL);
$newInvoiceObj = Invoice::get($newInvoiceId);
$newInvoiceMapObj->updateInvoiceNumber(Invoice::filterNumber($newInvoiceObj->{InvoiceResponse::KEY_PELNY_NUMER}));
return SendResult::makeValidResponse($sendInvoiceResult->getMessage() !== '' ? $sendInvoiceResult->getMessage() : SendResult::MESSAGE_INVOICE_SUCCESSFULLY_SEND);
}
示例3: print_array
</p><p style="font-weight: bold;">Add an item... </p><p><?php
if (Invoice::add_item($id, 270.98, 23, 'some references')) {
print_array(Invoice::get_items_of($id));
} else {
echo "failed";
exit;
}
?>
</p><p style="font-weight: bold;">Add another item... </p><p><?php
if (Invoice::add_item($id, 0.05, 93, 'some other charges')) {
print_array(Invoice::get_items_of($id));
} else {
echo "failed";
exit;
}
?>
</p><p style="font-weight: bold;">Pay an invoice... </p><p><?php
$data = array();
$data['id'] = $id;
$data['paid_on'] = sql_date_add(today(), 30, 'day');
$data['paid_through'] = 'CHQ';
$data['paid_id'] = 'a_cheque_number';
if (Invoice::update($data)) {
print_array(Invoice::get($id));
} else {
echo "failed";
exit;
}
?>
</p>
示例4: calculate
public function calculate(Invoice $invoice, InvoiceItem $item, User $aff, $paymentNumber = 0, $tier = 0, $paymentAmount = 0.0, $paymentDate = 'now')
{
// take aff.commission_days in account for 1-tier only
if ($tier == 0 && ($commissionDays = $this->getDi()->config->get('aff.commission_days'))) {
$signupDays = $this->getDi()->time - strtotime($invoice->getUser()->added);
$signupDays = intval($signupDays / 3600 * 24);
// to days
if ($commissionDays < $signupDays) {
return;
}
// no commission for this case, affiliate<->user relation is expired
// however, the relation still works for 2-level commissions
}
$multi = 1.0;
$prefix = $paymentNumber == 0 ? 'first' : 'second';
if ($tier == 0) {
if ($invoice->get("{$prefix}_total") == 0) {
$paidForItem = 0;
} else {
$paidForItem = $paymentAmount * $item->get("{$prefix}_total") / $invoice->get("{$prefix}_total");
}
} else {
// for higher tier just take amount paid to previous tier
$paidForItem = $paymentAmount;
}
foreach ($this->findRules($invoice, $item, $aff, $paymentNumber, $tier, $paymentDate) as $rule) {
if ($rule->type == AffCommissionRule::TYPE_MULTI) {
$multi *= $rule->multi;
} else {
if ($paidForItem == 0) {
// free signup?
if ($paymentNumber == 0 && $rule->free_signup_c) {
return moneyRound($multi * $rule->free_signup_c);
}
} elseif ($paymentNumber == 0) {
// first payment
if ($rule->first_payment_t == '%') {
return moneyRound($multi * $rule->first_payment_c * $paidForItem / 100);
} else {
return moneyRound($multi * $rule->first_payment_c);
}
} else {
// first payment
if ($rule->recurring_t == '%') {
return moneyRound($multi * $rule->recurring_c * $paidForItem / 100);
} else {
return moneyRound($multi * $rule->recurring_c);
}
}
}
}
}
示例5: array
exit;
}
if ($_POST['action'] == 'get_employer_info') {
$criteria = array('columns' => "employers.id, employers.name, employers.contact_person, employers.email_addr", 'joins' => "employers ON employers.id = invoices.employer", 'match' => "invoices.id = " . $_POST['id'], 'limit' => "1");
$result = Invoice::find($criteria);
if ($result === false || is_null($result) || count($result) <= 0) {
echo '0';
exit;
}
$response = array('employer' => $result);
header('Content-type: text/xml');
echo $xml_dom->get_xml_from_array($response);
exit;
}
if ($_POST['action'] == 'resend') {
$invoice = Invoice::get($_POST['id']);
$invoice[0]['items'] = Invoice::getItems($_POST['id']);
$employer = new Employer($invoice[0]['employer']);
$recipients = $employer->getEmailAddress();
if (isset($_POST['recipients'])) {
if (!empty($_POST['recipients'])) {
$recipients = str_replace(';', ',', $_POST['recipients']);
}
}
$branch = $employer->getAssociatedBranch();
$sales = 'sales.' . strtolower($branch[0]['country']) . '@yellowelevator.com';
$branch[0]['address'] = str_replace(array("\r\n", "\r"), "\n", $branch[0]['address']);
$branch['address_lines'] = explode("\n", $branch[0]['address']);
$currency = Currency::getSymbolFromCountryCode($branch[0]['country']);
$amount_payable = 0.0;
foreach ($invoice[0]['items'] as $i => $item) {
示例6: calculate
public function calculate(Invoice $invoice, InvoiceItem $item, User $aff, $paymentNumber = 0, $tier = 0, $paymentAmount = 0.0, $paymentDate = 'now', &$matchedRules = array())
{
// take aff.commission_days in account for 1-tier only
if ($tier == 0 && ($commissionDays = $this->getDi()->config->get('aff.commission_days'))) {
$signupDays = $this->getDi()->time - strtotime($invoice->getUser()->aff_added ? $invoice->getUser()->aff_added : $invoice->getUser()->added);
$signupDays = intval($signupDays / (3600 * 24));
// to days
if ($commissionDays < $signupDays) {
return;
}
// no commission for this case, affiliate<->user relation is expired
}
$multi = 1.0;
$isFirst = $paymentNumber <= 1;
$prefix = $isFirst && (double) $item->first_total ? 'first' : 'second';
if ($tier == 0) {
if ($invoice->get("{$prefix}_total") == 0) {
$paidForItem = 0;
} else {
$paidForItem = $paymentAmount * $item->get("{$prefix}_total") / $invoice->get("{$prefix}_total");
}
} else {
// for higher tier just take amount paid to previous tier
$paidForItem = $paymentAmount;
}
$paidForItem = $tier ? $paidForItem : $paidForItem / $invoice->base_currency_multi;
foreach ($this->findRules($invoice, $item, $aff, $paymentNumber, $tier, $paymentDate) as $rule) {
array_push($matchedRules, $rule);
// Second tier commission have to be calculated as percent from First tier commission.
if ($tier > 0) {
return moneyRound($rule->first_payment_c * $paidForItem / 100);
}
if ($rule->type == AffCommissionRule::TYPE_MULTI) {
$multi *= $rule->multi;
} else {
if ($paidForItem == 0) {
// free signup?
if ($paymentNumber == 0 && $rule->free_signup_c) {
return moneyRound($multi * $rule->free_signup_c);
}
} elseif ($isFirst) {
// first payment
if ($rule->first_payment_t == '%') {
return moneyRound($multi * $rule->first_payment_c * $paidForItem / 100);
} else {
return moneyRound($multi * $rule->first_payment_c);
}
} else {
// recurring payment
if ($rule->recurring_t == '%') {
return moneyRound($multi * $rule->recurring_c * $paidForItem / 100);
} else {
return moneyRound($multi * $rule->recurring_c);
}
}
}
}
}
示例7: _sendInvoiceBasedOnProforma
/**
*
* @param int $invoiceMapId
* @return \ifirma\SendResult
*/
private function _sendInvoiceBasedOnProforma($invoiceMapId)
{
global $loader, $registry;
$loader->model('module/invoice_map');
$invoiceMapModel = $registry->get('model_module_invoice_map');
$invoiceMap = $invoiceMapModel->get($invoiceMapId);
if ($invoiceMap === null) {
return SendResult::makeInvalidResponse(SendResult::MESSAGE_MISSING_INVOICE_PROFORMA);
}
$invoiceResponseObj = $this->_getInvoiceResponseObject($invoiceMap);
if ($invoiceResponseObj === null) {
return SendResult::makeInvalidResponse(SendResult::MESSAGE_MISSING_INVOICE_PROFORMA);
}
$sendInvoiceResult = $invoiceResponseObj->sendInvoiceBasedOnThisProforma();
if (!$sendInvoiceResult->isOk()) {
return SendResult::makeInvalidResponse($sendInvoiceResult->getMessage() !== '' ? $sendInvoiceResult->getMessage() : SendResult::MESSAGE_UNABLE_TO_SEND_INVOICE);
}
$sendInvoiceResultContent = $sendInvoiceResult->getContent();
$newInvoiceId = $sendInvoiceResultContent[ConnectorResponse::KEY_INVOICE_ID];
$newInvoiceObj = Invoice::get($newInvoiceId);
$this->_createAndSaveInvoiceMapObject($newInvoiceId, $invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_ORDER_ID], ModelModuleInvoiceMap::INVOICE_TYPE_NORMAL, Invoice::filterNumber($newInvoiceObj->{InvoiceResponse::KEY_PELNY_NUMER}));
// $invoiceMapModel->updateInvoiceNumber($invoiceMap[ModelModuleInvoiceMap::COLUMN_NAME_ORDER_ID], Invoice::filterNumber($newInvoiceObj->{InvoiceResponse::KEY_PELNY_NUMER}));
return SendResult::makeValidResponse($sendInvoiceResult->getMessage() !== '' ? $sendInvoiceResult->getMessage() : SendResult::MESSAGE_INVOICE_SUCCESSFULLY_SEND);
}
示例8: explode
$root_items = explode('/', $GLOBALS['root']);
foreach ($root_items as $value) {
if ($value == 'yel') {
$is_dev = true;
break;
}
}
if (!$is_dev) {
?>
<script type="text/javascript">alert('Please logout from your existing connection before proceeding.');</script>
<?php
exit;
}
}
}
$invoice = Invoice::get($_GET['id']);
$items = Invoice::getItems($_GET['id']);
if (!$invoice) {
echo "Invoice not found.";
exit;
}
$employer = new Employer($invoice[0]['employer']);
$branch = $employer->getAssociatedBranch();
$currency = Currency::getSymbolFromCountryCode($branch[0]['country']);
$amount_payable = 0.0;
foreach ($items as $i => $item) {
$amount_payable += $item['amount'];
$items[$i]['amount'] = number_format($item['amount'], 2, '.', ', ');
}
$amount_payable = number_format($amount_payable, 2, '.', ', ');
$invoice_or_receipt = is_null($invoice[0]['paid_on']) || empty($invoice[0]['paid_on']) ? 'Invoice' : 'Receipt';
示例9: Invoice
function get_invoices()
{
$invoice = new Invoice();
$invoices = $invoice->get("WHERE project_id = {$this->id}");
return $invoices;
}