本文整理汇总了PHP中Invoice::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::delete方法的具体用法?PHP Invoice::delete怎么用?PHP Invoice::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Drop invoice
* invoices shuld not be dropped, only drafts
*
* @param void
* @return null
*/
function delete()
{
if ($this->active_invoice->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_invoice->canDelete($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
if ($this->request->isSubmitted()) {
db_begin_work();
$delete = $this->active_invoice->delete();
if ($delete && !is_error($delete)) {
db_commit();
flash_success(':invoice has been deleted', array('invoice' => $this->active_invoice->getName()));
} else {
db_rollback();
flash_error('Failed to delete :invoice', array('invoice' => $this->active_invoice->getName()));
}
// if
$this->redirectTo('invoices');
} else {
$this->httpError(HTTP_ERR_BAD_REQUEST);
}
// if
}
示例2: testDelete
/**
* @covers Moneybird\Invoice::delete
*/
public function testDelete()
{
$this->object->delete($this->service);
$this->setExpectedException('Moneybird\\NotFoundException');
$this->service->getById(self::$invoiceId);
}
示例3: cancelEntity
public function cancelEntity($invoice_number, $task)
{
$invoiceid = aecInvoiceHelper::InvoiceIDfromNumber($invoice_number, 0, true);
$userid = '';
if ($invoiceid) {
$objInvoice = new Invoice();
$objInvoice->load($invoiceid);
$objInvoice->delete();
if (strcmp($task, 'editMembership') == 0) {
$userid = '&userid=' . $objInvoice->userid;
}
}
aecRedirect('index.php?option=com_acctexp&task=' . $task . $userid, JText::_('REMOVED'));
}
示例4: actionGenerate
public function actionGenerate()
{
$names = file(getcwd() . "/protected/tests/names.txt");
$streets = file(getcwd() . "/protected/tests/streets.txt");
$name_arr = array();
$street_arr = array();
foreach ($names as $line) {
$name = explode(" ", $line);
$name_arr[] = trim($name[0]);
}
foreach ($streets as $line) {
$street = explode(" ", $line);
if (count($street) == 3) {
$name1 = trim($street[0]);
$name2 = trim($street[1]);
$name3 = trim($street[2]);
$street_arr[] = $name1 . " " . $name2 . " " . $name3 . ", Toronto";
}
}
$limit = 1000000;
for ($i = 0; $i < $limit; $i++) {
set_time_limit(0);
// resetting the MySQL timeout
echo "Creating an invoice #{$i} <br/>";
$invoice = new Invoice();
$invoice->name = $name_arr[rand(0, count($name_arr) - 1)];
$invoice->address = rand(1, 5000) . " " . $street_arr[rand(0, count($street_arr) - 1)];
$y = 2012;
//rand(2006,2012);
if ($y < 2012) {
$m = rand(1, 12);
} else {
$m = rand(1, 11);
}
$m = 11;
$d = rand(1, 2);
$invoice->date = date($y . '-' . $m . '-' . $d);
$invoice->delivery_date = date($y . '-' . $m . '-' . $d);
$invoice->phone1 = "647" . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9) . rand(1, 9);
$invoice->delivery_date = date($y . '-' . $m . '-' . $d);
$invoice->delivery_cost = rand(10, 50);
if ($invoice->save()) {
$number_of_items = rand(3, 9);
for ($j = 0; $j < $number_of_items; $j++) {
$entry = new Entry();
$entry->invoice = $invoice->id;
$entry->inventory = rand(3, 2709);
$inventory = Inventory::model()->findByPk($entry->inventory);
if ($inventory) {
$entry->item = $inventory->name . " #" . $inventory->model;
$entry->quantity = rand(1, $inventory->quantity);
$entry->price = round($inventory->in * 1.3);
$entry->amount = round($entry->price * 0.9 * $entry->quantity);
if ($entry->save()) {
echo "--Entry Created! <br/>";
$inventory->quantity = $inventory->quantity - $entry->quantity;
if ($inventory->save()) {
echo "---Inventory Updated! <br/>";
} else {
$entry->delete();
echo "***Inventory Error! Failed to update <br/>";
}
} else {
echo "***Entry Error! <br/>";
print_r($entry->getErrors());
echo "<br/>";
}
} else {
echo "*Inventory Error! (invalid randomed inventory id) <br/>";
}
}
if ($invoice->Amount > 0) {
echo "Invoice Created! id=>" . $invoice->id . "<br/>";
} else {
echo "Invoice has no entries! Deleting id=>" . $invoice->id . "<br/>";
$invoice->delete();
}
} else {
echo "Invoice Error! <br/>";
print_r($invoice->getError());
echo "<br/>";
}
echo "<hr/>";
}
}
示例5: Invoice
<?php
require 'core/init.php';
//Create Invoice Object
$invoice = new Invoice();
if (isset($_POST['do_delete'])) {
$updated = array();
$updated['id'] = $_SESSION['singleId'];
$updated['invoice_number'] = $_POST['invoice_number'];
$updated['user_id'] = getUser()['user_id'];
$updated['create_date'] = $_POST['create_date'];
$updated['due'] = $_POST['due'];
$updated['payee'] = $_POST['payee'];
$updated['amount'] = $_POST['amount'];
$updated['description'] = $_POST['description'];
$invoice->delete($updated);
redirect('index.php', 'Your invoice has been deleted', 'Success');
}
if (isset($_POST['do_update'])) {
//Create validator object
$validate = new Validator();
//create data array
$updated = array();
$updated['id'] = $_SESSION['singleId'];
$updated['invoice_number'] = $_POST['invoice_number'];
$updated['user_id'] = getUser()['user_id'];
$updated['create_date'] = $_POST['create_date'];
$updated['due'] = $_POST['due'];
$updated['payee'] = $_POST['payee'];
$updated['amount'] = $_POST['amount'];
$updated['description'] = $_POST['description'];
示例6: deleteInvoiceRelated
function deleteInvoiceRelated($iduser = "")
{
if ($iduser == "") {
$iduser = $_SESSION['do_User']->iduser;
}
$q = new sqlQuery($this->getDbCon());
$q->query("select idinvoice from invoice where iduser = " . $iduser);
if ($q->getNumRows()) {
$do_del_inv = new Invoice();
while ($q->fetch()) {
$do_del_inv->getId($q->getData("idinvoice"));
//Del Invoice Lines
$inv_lines = $do_del_inv->getChildInvoiceLine();
while ($inv_lines->next()) {
$inv_lines->delete();
}
//Del Recurrence Invoice
$rec_inv = $do_del_inv->getChildRecurrentInvoice();
$del_rec_inv_cc = new sqlQuery($this->getDbCon());
while ($rec_inv->next()) {
// Del Recurrent Invoice CC
$del_rec_inv_cc->query("delete from recurrent_invoice_cc \n where idrecurrentinvoice = " . $rec_inv->idrecurrentinvoice);
$rec_inv->delete();
}
//Delete Payment Log
$pay_log = $do_del_inv->getChildPaymentLog();
while ($pay_log->next()) {
$pay_log->delete();
}
// Delete Invoice
$do_del_inv->delete();
}
}
}