当前位置: 首页>>代码示例>>PHP>>正文


PHP Invoice::delete方法代码示例

本文整理汇总了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
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:34,代码来源:InvoicesController.class.php

示例2: testDelete

 /**
  * @covers Moneybird\Invoice::delete
  */
 public function testDelete()
 {
     $this->object->delete($this->service);
     $this->setExpectedException('Moneybird\\NotFoundException');
     $this->service->getById(self::$invoiceId);
 }
开发者ID:FlyingNimbus,项目名称:moneybird_php_api,代码行数:9,代码来源:InvoiceTest.php

示例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'));
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:14,代码来源:admin.acctexp.php

示例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/>";
     }
 }
开发者ID:vhangarcia,项目名称:openbook2.0,代码行数:85,代码来源:InvoiceController.php

示例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'];
开发者ID:codeandrockets,项目名称:zipinvoices,代码行数:31,代码来源:update.php

示例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();
         }
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:34,代码来源:OfuzCancelAccount.class.php


注:本文中的Invoice::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。