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


PHP Invoice::find方法代码示例

本文整理汇总了PHP中Invoice::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::find方法的具体用法?PHP Invoice::find怎么用?PHP Invoice::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Invoice的用法示例。


在下文中一共展示了Invoice::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete_invoice_item

 public static function delete_invoice_item($invoice_id, $item_id)
 {
     $invoice = Invoice::find($invoice_id);
     if ($invoice) {
         $item = null;
         foreach ($invoice->items as $i) {
             if ($i->id == $item_id) {
                 $item = $i;
                 break;
             }
         }
         if ($item) {
             $item->delete();
             if (($key = array_search($item, $invoice->items)) !== false) {
                 unset($invoice->items[$key]);
             }
             $invoice_number = -1;
             foreach ($invoice->items as $i) {
                 $invoice_number = max($invoice_number, $i->reservation->id);
             }
             $invoice->invoice_number = $invoice_number;
             $invoice->update();
             Redirect::to(\Slim\Slim::getInstance()->urlFor('invoice_detail', array('id' => $invoice_id)), array('message' => 'Rivi poistettu!'));
         } else {
             Redirect::to(\Slim\Slim::getInstance()->urlFor('invoice_detail', array('id' => $invoice_id)), array('message' => 'Riviä ei ole laskulla!', 'error' => true));
         }
     } else {
         Redirect::to(\Slim\Slim::getInstance()->urlFor('invoices_index'), array('message' => 'Laskua ei löytynyt!', 'error' => true));
     }
 }
开发者ID:laazz,项目名称:talpa,代码行数:30,代码来源:invoice_controller.php

示例2: order

 public function order()
 {
     // Call invoice_id from CakeSession
     $invoiceId = CakeSession::read('invoice_id');
     $invoiceModel = new Invoice();
     $invoices = $invoiceModel->find('first', array('conditions' => array('Invoice.id' => $invoiceId)));
     $this->set(compact('invoices'));
 }
开发者ID:vinacode,项目名称:CakePHP-ShoppingCart-with-Admin-Managements,代码行数:8,代码来源:CustomersController.php

示例3: getInvoices

 function getInvoices()
 {
     if (!$this->invoices) {
         $finder = new Invoice();
         $this->invoices = $finder->find(array('support_contract_id' => $this->id));
     }
     return $this->invoices;
 }
开发者ID:radicaldesigns,项目名称:gtd,代码行数:8,代码来源:SupportContract.php

示例4: actionInvoice

 function actionInvoice()
 {
     $page = (int) $this->_context->get('page', 1);
     $orm = Invoice::find()->order('created desc');
     $orm->limitPage($page, 12);
     $this->_view['rs'] = $orm->getAll();
     $this->_view['pg'] = $orm->getPag();
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:8,代码来源:account_controller.php

示例5: store

 /**
  * Store a newly created resource in storage.
  * POST /accountreceivables
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('invoiceID' => 'required|max:50|', 'houseID' => 'required', 'amount' => 'required|min:2', 'paymenttype' => 'required', 'amountpayed' => 'required', 'paymenttyperef' => 'required'));
     if ($v->passes()) {
         $findHouse = Input::get('houseID');
         $propertyId = House::where('name', $findHouse)->pluck('propertyID');
         $propertyName = Property::where('id', $propertyId)->pluck('name');
         $agent_id = Sentry::getUser()->id;
         $gamount = Input::get('amount');
         $gpayed = Input::get('amountpayed');
         $initpaid = Input::get('initpaid');
         $b = $gamount - $gpayed;
         $id = Input::get('invoiceID');
         $balance = $gamount - $gpayed;
         $invoice = Invoice::find($id);
         $invoiceid = $invoice->id;
         $invoice->balance = $gamount - $gpayed;
         $invoice->amountpaid = $gpayed + $initpaid;
         $invoice->save();
         $reciept = new Receipt();
         $reciept->invoiceID = $invoice->id;
         $reciept->agent_id = $agent_id;
         $reciept->type = $invoice->type;
         $reciept->houseID = $invoice->houseID;
         $reciept->recipient = $invoice->recipient;
         $reciept->invoice_amt = $gpayed + $initpaid + $b;
         $reciept->amountpaid = $gpayed;
         $reciept->balance = $gamount - $gpayed;
         $reciept->duedate = $invoice->duedate;
         $reciept->save();
         $findTenant = $invoice->recipient;
         $ftname = strtok($findTenant, " ");
         $tenants = Tenant::where('name', $ftname)->get();
         foreach ($tenants as $tenant) {
             $t_name = $tenant->name;
             $to = $tenant->phone;
         }
         $payment = new Payment();
         $payment->invoiceID = Input::get('invoiceID');
         $payment->amount = Input::get('amount');
         $payment->amountpayed = Input::get('amountpayed');
         $payment->houseID = $findHouse;
         $payment->client = $invoice->recipient;
         $payment->property = $propertyName;
         $payment->balance = $gamount - $gpayed;
         $payment->paymenttype = Input::get('paymenttype');
         $payment->paymenttyperef = Input::get('paymenttyperef');
         $payment->save();
         #send an sms to the tenant
         $message = ' Hi ' . $t_name . ', Your payment of  Ksh. ' . number_format($gpayed, 2) . ' for invoice no. ' . $invoiceid . ' of ' . $findHouse . '   has been received successfully, due balance ' . number_format($balance, 2) . ', Thank you';
         Queue::push('SendSMS', array('message' => $message, 'number' => $to));
         return Redirect::route('show/receipts/index')->withFlashMessage('Payment received successfully');
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
开发者ID:jeremiteki,项目名称:mteja-laravel,代码行数:62,代码来源:PaymentController.php

示例6: get_invoices

 private function get_invoices($_is_paid = false)
 {
     $order_by = 'issued_on asc';
     $paid_on_clause = "paid_on IS NULL";
     if ($_is_paid) {
         $paid_on_clause = "paid_on IS NOT NULL";
     }
     $criteria = array('columns' => "id, type, DATEDIFF(payable_by, now()) AS expired, \n                          DATE_FORMAT(issued_on, '%e %b, %Y') AS formatted_issued_on, \n                          DATE_FORMAT(payable_by, '%e %b, %Y') AS formatted_payable_by,\n                          DATE_FORMAT(paid_on, '%e %b, %Y') AS formatted_paid_on", 'match' => "employer = '" . $this->employer->getId() . "' AND " . $paid_on_clause, 'order' => $order_by);
     return Invoice::find($criteria);
 }
开发者ID:pamalite,项目名称:yel,代码行数:10,代码来源:employer_invoices_page.php

示例7: get_employers

 private function get_employers($_for_invoice = true)
 {
     $criteria = array('columns' => "DISTINCT employers.id, employers.name AS employer", 'joins' => "employers ON employers.id = invoices.employer");
     if ($_for_invoice) {
         $criteria['match'] = "invoices.paid_on IS NULL";
     } else {
         $criteria['match'] = "invoices.paid_on IS NOT NULL";
     }
     return Invoice::find($criteria);
 }
开发者ID:pamalite,项目名称:yel,代码行数:10,代码来源:employee_payments_page.php

示例8: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->__saves['UserClass'] = Configure::read('Invoices.UserClass');
     $this->__saves['idIsNumber'] = Configure::read('Invoices.idIsNumber');
     Configure::write('Invoices.UserClass', 'PluginInvoiceClient');
     Configure::write('Invoices.idIsNumber', true);
     $this->Invoice = new SpyInvoice();
     $this->Invoice->setInvoiceNumberGenerator($this->Invoice);
     $this->_record = $this->Invoice->find();
 }
开发者ID:occitech,项目名称:invoices,代码行数:16,代码来源:InvoiceTest.php

示例9: destroy

 public function destroy($id)
 {
     $targetInvoice = Invoice::find($id);
     if ($targetInvoice) {
         $targetInvoice->delete();
         InvoiceElement::where('invoice_fk', '=', $id)->delete();
         return $this->index();
     } else {
         return $this->index();
     }
 }
开发者ID:dbakiu,项目名称:dvc,代码行数:11,代码来源:InvoiceController.php

示例10: modify

 /**
  * Modify item to invoice
  */
 public function modify($id)
 {
     $invoice = Invoice::find($id);
     foreach ($invoice->items as $item) {
         InvoiceItem::where('id', $item->id)->update(array('ressource_id' => Input::get('ressource_id.' . $item->id), 'text' => Input::get('text.' . $item->id), 'amount' => Input::get('amount.' . $item->id), 'vat_types_id' => Input::get('vat_types_id.' . $item->id), 'order_index' => Input::get('order_index.' . $item->id)));
     }
     // Add new line
     if (Input::get('text.0')) {
         $this->add_check(array('invoice_id' => $id, 'ressource_id' => Input::get('ressource_id.0'), 'text' => Input::get('text.0'), 'amount' => Input::get('amount.0'), 'vat_types_id' => Input::get('vat_types_id.0'), 'order_index' => Input::get('order_index.0')));
     }
     return Redirect::route('invoice_modify', $id);
 }
开发者ID:urashima82,项目名称:intranet,代码行数:15,代码来源:InvoiceItemController.php

示例11: dataExist

 /**
  * Verify if exist
  */
 private function dataExist($id, $tpl)
 {
     if (Auth::user()->isSuperAdmin()) {
         $data = Invoice::find($id);
     } else {
         $data = Invoice::whereUserId(Auth::user()->id)->find($id);
     }
     if (!$data) {
         return Redirect::route($tpl)->with('mError', 'Cet élément est introuvable !');
     } else {
         return $data;
     }
 }
开发者ID:urashima82,项目名称:intranet,代码行数:16,代码来源:InvoiceController.php

示例12: download

 function download($id = FALSE)
 {
     $this->load->helper(array('dompdf', 'file'));
     $this->load->library('parser');
     $data["invoice"] = Invoice::find($id);
     $data['items'] = InvoiceHasItem::find('all', array('conditions' => array('invoice_id=?', $id)));
     if ($data['invoice']->company_id != $this->client->company->id) {
         redirect('cinvoices');
     }
     $data["core_settings"] = Setting::first();
     $due_date = date($data["core_settings"]->date_format, human_to_unix($data["invoice"]->due_date . ' 00:00:00'));
     $parse_data = array('due_date' => $due_date, 'invoice_id' => $data["invoice"]->reference, 'client_link' => $data["core_settings"]->domain, 'company' => $data["core_settings"]->company);
     $html = $this->load->view($data["core_settings"]->template . '/' . 'invoices/preview', $data, true);
     $html = $this->parser->parse_string($html, $parse_data);
     $filename = 'Invoice_' . $data["invoice"]->reference;
     pdf_create($html, $filename, TRUE);
 }
开发者ID:anteknik,项目名称:tomanage,代码行数:17,代码来源:cinvoices.php

示例13: get_payments

function get_payments($_is_invoice = true, $_order = "invoices.issued_on", $_employer_to_filter = '')
{
    $criteria = array("columns" => "invoices.id, invoices.type, invoices.payable_by,\n                      employers.name AS employer, employers.contact_person, employers.email_addr, \n                      employers.fax_num, employers.phone_num, 'N/A' AS placement, \n                      SUM(invoice_items.amount) AS amount_payable, currencies.symbol AS currency, \n                      DATE_FORMAT(invoices.issued_on, '%e %b, %Y') AS formatted_issued_on, \n                      DATE_FORMAT(invoices.payable_by, '%e %b, %Y') AS formatted_payable_by,\n                      DATE_FORMAT(invoices.paid_on, '%e %b, %Y') AS formatted_paid_on", "joins" => "employers ON employers.id = invoices.employer, \n                    branches ON branches.id = employers.branch, \n                    invoice_items ON invoice_items.invoice = invoices.id, \n                    currencies ON currencies.country_code = branches.country", "group" => "invoices.id", "order" => $_order);
    if ($_is_invoice) {
        $criteria['match'] = "invoices.paid_on IS NULL AND invoices.is_copy = FALSE";
    } else {
        $criteria['columns'] .= ", invoices.paid_through, invoices.paid_id";
        $criteria['match'] = "invoices.paid_on IS NOT NULL AND invoices.is_copy = FALSE";
    }
    if (!empty($_employer_to_filter)) {
        $criteria['match'] .= " AND invoices.employer = '" . $_employer_to_filter . "'";
    }
    $invoices = Invoice::find($criteria);
    if (empty($invoices) || is_null($invoices) || $invoices === false) {
        return array();
    }
    $invoice_ids = array();
    foreach ($invoices as $row) {
        $invoice_ids[] = $row['id'];
    }
    $criteria = array('columns' => "DISTINCT invoices.id, invoice_items.item, referrals.job, jobs.title, \n                      CONCAT(members.lastname, ', ', members.firstname) AS candidate", 'joins' => "invoice_items ON invoice_items.invoice = invoices.id, \n                    referrals ON referrals.id = invoice_items.item,\n                    jobs ON jobs.id = referrals.job, \n                    members ON members.email_addr = referrals.referee", 'match' => "invoices.is_copy = FALSE AND invoices.type = 'R' AND \n                    invoices.id IN (" . implode(',', $invoice_ids) . ")");
    $result = Invoice::find($criteria);
    if (empty($result) || is_null($result) || $iresult === false) {
        return $invoices;
    }
    foreach ($invoices as $i => $invoice) {
        foreach ($result as $row) {
            if ($row['id'] == $invoice['id']) {
                if (is_null($row['job']) || empty($row['job']) || (is_null($row['candidate']) || empty($row['candidate'])) || (is_null($row['title']) || empty($row['title']))) {
                    $invoices[$i]['placement'] = '(Data is missing)';
                    break;
                }
                $invoices[$i]['placement'] = htmlspecialchars_decode(stripslashes($row['title'])) . ' to ';
                $invoices[$i]['placement'] .= htmlspecialchars_decode(stripslashes($row['candidate']));
                break;
            }
        }
    }
    return $invoices;
}
开发者ID:pamalite,项目名称:yel,代码行数:40,代码来源:payments_action.php

示例14: view

 function view($id = FALSE)
 {
     $this->view_data['submenu'] = array($this->lang->line('application_back') => 'cprojects', $this->lang->line('application_overview') => 'cprojects/view/' . $id, $this->lang->line('application_media') => 'cprojects/media/' . $id);
     $this->view_data['project'] = Project::find($id);
     $this->view_data['project_has_invoices'] = Invoice::find('all', array('conditions' => array('project_id = ? AND company_id=? AND estimate != ? AND issue_date<=?', $id, $this->client->company->id, 1, date('Y-m-d', time()))));
     $tasks = ProjectHasTask::count(array('conditions' => 'project_id = ' . $id));
     $tasks_done = ProjectHasTask::count(array('conditions' => array('status = ? AND project_id = ?', 'done', $id)));
     @($this->view_data['opentaskspercent'] = $tasks_done / $tasks * 100);
     $this->view_data['time_days'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - human_to_unix($this->view_data['project']->start . ' 00:00')) / 3600 / 24);
     $this->view_data['time_left'] = $this->view_data['time_days'];
     $this->view_data['timeleftpercent'] = 100;
     if (human_to_unix($this->view_data['project']->start . ' 00:00') < time() && human_to_unix($this->view_data['project']->end . ' 00:00') > time()) {
         $this->view_data['time_left'] = round((human_to_unix($this->view_data['project']->end . ' 00:00') - time()) / 3600 / 24);
         $this->view_data['timeleftpercent'] = $this->view_data['time_left'] / $this->view_data['time_days'] * 100;
     }
     if (human_to_unix($this->view_data['project']->end . ' 00:00') < time()) {
         $this->view_data['time_left'] = 0;
         $this->view_data['timeleftpercent'] = 0;
     }
     @($this->view_data['opentaskspercent'] = $tasks_done / $tasks * 100);
     $tracking = $this->view_data['project']->time_spent;
     if (!empty($this->view_data['project']->tracking)) {
         $tracking = time() - $this->view_data['project']->tracking + $this->view_data['project']->time_spent;
     }
     $this->view_data['timertime'] = $tracking;
     $this->view_data['time_spent_from_today'] = time() - $this->view_data['project']->time_spent;
     $tracking = floor($tracking / 60);
     $tracking_hours = floor($tracking / 60);
     $tracking_minutes = $tracking - $tracking_hours * 60;
     $this->view_data['time_spent'] = $tracking_hours . " " . $this->lang->line('application_hours') . " " . $tracking_minutes . " " . $this->lang->line('application_minutes');
     $this->view_data['time_spent_counter'] = sprintf("%02s", $tracking_hours) . ":" . sprintf("%02s", $tracking_minutes);
     if (!isset($this->view_data['project_has_invoices'])) {
         $this->view_data['project_has_invoices'] = array();
     }
     if ($this->view_data['project']->company_id != $this->client->company->id) {
         redirect('cprojects');
     }
     $this->content_view = 'projects/client_views/view';
 }
开发者ID:timclifford,项目名称:freelance-manager,代码行数:39,代码来源:cprojects.php

示例15: store

 /**
  * Store a newly created resource in storage.
  * POST /accountreceivables
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('invoiceID' => 'required|max:50|', 'houseID' => 'required', 'amount' => 'required|min:2', 'paymenttype' => 'required', 'amountpayed' => 'required', 'paymenttyperef' => 'required'));
     if ($v->passes()) {
         $gamount = Input::get('amount');
         $gpayed = Input::get('amountpayed');
         $initpaid = Input::get('initpaid');
         $id = Input::get('invoiceID');
         $balance = $gamount - $gpayed;
         $invoice = Invoice::find($id);
         $invoice->balance = $gamount - $gpayed;
         $invoice->amountpaid = $gpayed + $initpaid;
         $invoice->save();
         $payment = new Payment();
         $payment->invoiceID = Input::get('invoiceID');
         $payment->amount = Input::get('amount');
         $payment->amountpayed = Input::get('amountpayed');
         $payment->houseID = Input::get('houseID');
         $payment->balance = $gamount - $gpayed;
         $payment->paymenttype = Input::get('paymenttype');
         $payment->paymenttyperef = Input::get('paymenttyperef');
         $payment->save();
         #send an sms to the tenant
         $findTenant = $invoice->recipient;
         $tenants = Tenant::where('name', $findTenant)->get();
         foreach ($tenants as $tenant) {
             $t_name = $tenant->name;
             $to = $tenant->phone;
         }
         $message = ' Hi ' . $t_name . ', Your invoivce Payment  of amount: Ksh. ' . number_format($gpayed, 2) . ' has been received  due balance ' . number_format($balance, 2) . ', Thank you for Choosing us';
         LaravelAtApi::sendMessage($to, $message);
         return Redirect::route('admin.invoice.show', $id);
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
开发者ID:jeremiteki,项目名称:mteja,代码行数:42,代码来源:PaymentController.php


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