本文整理汇总了PHP中Quote::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::find方法的具体用法?PHP Quote::find怎么用?PHP Quote::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
App::import('Model', 'QuoteManager.Quote');
$quoteModel = new Quote();
$quoteDataList = $quoteModel->find('all', array('fields' => array('quote_number', 'status'), 'conditions' => array('Quote.vid' => null, 'Quote.created_by' => $this->loginUser['id'])));
App::import('Model', 'WorkOrderManager.WorkOrder');
$workOrderModel = new WorkOrder();
$workOrderDataList = $workOrderModel->find('all', array('fields' => array('work_order_number', 'status'), 'conditions' => array('WorkOrder.created_by' => $this->loginUser['id'])));
App::import('Model', 'PurchaseOrderManager.PurchaseOrder');
$purchaseOrderModel = new PurchaseOrder();
$purchaseOrderDataList = $purchaseOrderModel->find('all', array('fields' => array('purchase_order_num', 'received'), 'conditions' => array('PurchaseOrder.created_by' => $this->loginUser['id'])));
$this->set(compact('quoteDataList', 'workOrderDataList', 'purchaseOrderDataList'));
}
示例2: detail
/**
* view method
*
* @param string $id
* @return void
*/
public function detail($id = null, $modal = null)
{
$this->layoutOpt['left_nav_selected'] = "view_customer";
$this->Customer->id = $id;
if (!$this->Customer->exists()) {
throw new NotFoundException(__('Invalid customer'));
}
//$this->set('customer', $this->Customer->read(null, $id));
$customer = $this->Customer->read(null, $id);
App::uses("CustomerSalesRepresentetives", "CustomerManager.Model");
$sales = new CustomerSalesRepresentetives();
$sales_representatives = $sales->find("all", array("conditions" => array("CustomerSalesRepresentetives.customer_id" => $id)));
App::uses("Quote", "QuoteManager.Model");
$quote = new Quote();
$quotes = $quote->find("all", array("conditions" => array("Quote.vid" => null, 'Quote.customer_id' => $id)));
$this->set(compact('customer', 'modal', 'sales_representatives', 'quotes'));
}
示例3: array
if (Auth::check()) {
$rules = array('approve' => 'integer|numeric', 'deny' => 'integer|numeric');
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
if (Input::has('approve')) {
$quote = Quote::find(Input::get('approve'));
if ($quote) {
if ($quote->status != 1) {
$quote->status = 1;
$quote->save();
$response = Event::fire('quote.approved', array($quote));
}
}
}
if (Input::has('deny')) {
$quote = Quote::find(Input::get('deny'));
if ($quote) {
if ($quote->status != -1) {
$quote->status = -1;
$quote->save();
}
}
}
}
}
});
// Route::filter('favorite', function() {
// if (Auth::check()) {
// $rules = array(
// 'favor' => 'integer|numeric',
// 'unfavor' => 'integer|numeric'
示例4: update
function update($id = FALSE)
{
if ($_POST) {
unset($_POST['send']);
$_POST = array_map('htmlspecialchars', $_POST);
$quotation = Quote::find($id);
$quotation = $quotation->update_attributes($_POST);
if (!$quotation) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_quotation_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_quotation_success'));
}
redirect('quotations/view/' . $id);
} else {
$this->view_data['quotations'] = Quote::find($id);
$this->view_data['users'] = user::find('all', array('conditions' => array('status=?', 'active')));
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_edit_quotation');
$this->view_data['form_action'] = 'quotations/update/' . $id;
$this->content_view = 'quotations/_quotations';
}
}
示例5: calculate_cabinet_price
public function calculate_cabinet_price()
{
$this->autoRender = FALSE;
$calculatePrice['new_row'] = '';
$resource = explode('|', trim($this->request->data['resource']));
if (isset($resource[1]) && !empty($resource[1])) {
// pr($this->request->data);exit;
$resource_id = $resource[0];
$resource_type = $resource[1];
$quote_id = (int) $this->request->data['quote_id'];
$cabinet_color = $this->request->data['cabinet_color'];
$material_id = $this->request->data['material_id'];
$door_id = $this->request->data['door_id'];
$door_color = $this->request->data['door_color'];
$drawer_id = $this->request->data['drawer_id'];
$drawer_slide_id = $this->request->data['drawer_slide'];
$quantity = $this->request->data['resource_quantity'];
$delivery_option = $this->request->data['delivery_option'];
$cabinet_order_id = null;
$door_side = $this->request->data['door_side'];
$door_drilling = $this->request->data['door_drilling'];
$customer_id = $this->request->data['customer_id'];
App::import("Model", "CustomerManager.Customer");
$customer_model = new Customer();
$customer = $customer_model->find('first', array('conditions' => array('Customer.id' => $customer_id)));
App::import("Model", "QuoteManager.Quote");
$quote_model = new Quote();
$quote_data = $quote_model->find('first', array('conditions' => array('Quote.id' => $quote_id), 'recursive' => -1));
$multi_family_pricing = 0;
foreach ($customer['BuilderProject'] as $project) {
if ($project['id'] == $quote_data['Quote']['project_id']) {
$multi_family_pricing = $project['multi_family_pricing'];
}
}
if ($customer['Customer']['customer_type_id'] == 2 && $multi_family_pricing == 1) {
switch ($resource_type) {
case 'cabinet':
$calculatePrice = $this->PriceCalculation->calculateCabinetPriceForBuilder($resource_id, $cabinet_color, $material_id, $door_id, $door_color, $drawer_id, $drawer_slide_id, $quantity, $delivery_option);
if (!empty($quote_id)) {
$cabinet_order_id = $this->saveTempCalculationResultToPrint($quote_id, $resource_id, $calculatePrice['total_price'], $calculatePrice['debug_calculation'], $resource_type, $cabinet_color, $material_id, $door_id, $door_color, $quantity, $door_side, $door_drilling);
//, $drawer_id, $drawer_slide_id);
}
break;
case 'item':
$calculatePrice = $this->PriceCalculation->calculateItemPriceForBuilder($resource_id, $quantity, $material_id, $cabinet_color);
if (!empty($quote_id)) {
$cabinet_order_id = $this->saveTempCalculationResultToPrint($quote_id, $resource_id, $calculatePrice['total_price'], $calculatePrice['debug_calculation'], $resource_type, null, $material_id, null, null, $quantity);
//, $drawer_id, $drawer_slide_id);
}
break;
}
} else {
switch ($resource_type) {
case 'cabinet':
$calculatePrice = $this->PriceCalculation->calculateCabinetPrice($resource_id, $cabinet_color, $material_id, $door_id, $door_color, $drawer_id, $drawer_slide_id, $quantity, $delivery_option);
if (!empty($quote_id)) {
$cabinet_order_id = $this->saveTempCalculationResultToPrint($quote_id, $resource_id, $calculatePrice['total_price'], $calculatePrice['debug_calculation'], $resource_type, $cabinet_color, $material_id, $door_id, $door_color, $quantity, $door_side, $door_drilling);
//, $drawer_id, $drawer_slide_id);
}
break;
case 'item':
$calculatePrice = $this->PriceCalculation->calculateItemPrice($resource_id, $quantity, $material_id, $cabinet_color);
if (!empty($quote_id)) {
$cabinet_order_id = $this->saveTempCalculationResultToPrint($quote_id, $resource_id, $calculatePrice['total_price'], $calculatePrice['debug_calculation'], $resource_type, null, $material_id, null, null, $quantity);
//, $drawer_id, $drawer_slide_id);
}
break;
}
}
if ($resource_id) {
/* Set up new view that won't enter the ClassRegistry */
$view = new View($this, false);
$view->set('calculatePrice', $calculatePrice);
$view->set('cabinet_order_id', $cabinet_order_id);
$view->set('door_side', $door_side);
$view->set('door_drilling', $door_drilling);
/* Grab output into variable without the view actually outputting! */
$view_output = $view->render('../Elements/Forms/Order/cabinet-order-form-row');
$calculatePrice['new_row'] = $view_output;
}
}
echo json_encode($calculatePrice);
exit;
}
示例6: edit_order
/**
* edit_order method
*
* @param string $id
* @return void
*/
public function edit_order($quote_id = null)
{
$this->layoutOpt['left_nav_selected'] = "view_quote";
$this->quote_id = $quote_id;
$this->GraniteOrder->quote_id = $quote_id;
if ($this->request->is('post') || $this->request->is('put')) {
$this->request->data['GraniteOrder']['quote_id'] = $quote_id;
if ($this->GraniteOrder->save($this->request->data)) {
$this->Session->setFlash(__('The granite order has been saved'));
$this->redirect(array('controller' => 'quotes', 'action' => DETAIL, $quote_id));
} else {
$this->Session->setFlash(__('The granite order could not be saved. Please, try again.'));
}
}
$this->request->data = $this->GraniteOrder->find('first', array('conditions' => array('quote_id' => $quote_id)));
App::import('Model', 'QuoteManager.Quote');
$quoteModel = new Quote();
$quoteModel->recursive = 2;
$quotes = $quoteModel->find('first', array('conditions' => array('Quote.id' => $quote_id)));
App::import('Model', 'CustomerManager.Customer');
$customerModel = new Customer();
$customerModel->recursive = 0;
$customerTypes = $customerModel->CustomerType->find('list');
$this->set(compact('quotes', 'quote_id', 'customerTypes'));
}
示例7: getQuoteForCornJob
function getQuoteForCornJob($id = null)
{
App::import('Model', 'QuoteManager.Quote');
$Quote_Model = new Quote();
$quote = $Quote_Model->find("first", array("conditions" => array("Quote.id" => $id)));
return $quote;
}
示例8: getQuote
public function getQuote($id = null, $customer_id)
{
App::import("Model", "QuoteManager.Quote");
$Quote_model = new Quote();
$quote = $Quote_model->find("first", array("conditions" => array("Quote.id" => $id)));
$this->set(compact('id', 'quote', "customer_id"));
$this->render('Elements/PartialData/getQuote');
}
示例9: Quote
function auto_generate_number($type)
{
$value = "";
if ($type == "Quote") {
App::uses('Quote', 'QuoteManager.Model');
$quoteModel = new Quote();
$quotes = $quoteModel->find('all', array('fields' => array('Quote.id,Quote.quote_number')));
if ($quotes) {
$quote_number = (int) $quotes[count($quotes) - 1]['Quote']['quote_number'];
$quote_number = explode("-", $quote_number);
$length = strlen($quote_number[0] + 1) == strlen($quote_number[0]) ? strlen($quote_number[0]) : strlen($quote_number[0] + 1);
for ($i = $length; $i < 6; $i++) {
$value .= '0';
}
$value .= $quote_number[0] + 1;
} else {
$value = "000001";
}
} elseif ($type == "Work Order") {
App::uses('WorkOrder', 'WorkOrderManager.Model');
$woModel = new WorkOrder();
$wos = $woModel->find('all', array('fields' => array('WorkOrder.id,work_order_number')));
if ($wos) {
$wo_number = (int) $wos[count($wos) - 1]['WorkOrder']['work_order_number'];
$length = strlen($wo_number + 1) == strlen($wo_number) ? strlen($wo_number) : strlen($wo_number + 1);
for ($i = $length; $i < 6; $i++) {
$value .= '0';
}
$value .= $wo_number + 1;
} else {
$value = "000001";
}
} elseif ($type == "Purchase Order") {
App::uses('PurchaseOrder', 'PurchaseOrderManager.Model');
$poModel = new PurchaseOrder();
$pos = $poModel->find('all', array('fields' => array('PurchaseOrder.id,purchase_order_num')));
if ($pos) {
$po_number = (int) $pos[count($pos) - 1]['PurchaseOrder']['purchase_order_num'];
$length = strlen($po_number + 1) == strlen($po_number) ? strlen($po_number) : strlen($po_number + 1);
for ($i = $length; $i < 6; $i++) {
$value .= '0';
}
$value .= $po_number + 1;
} else {
$value = "000001";
}
} elseif ($type == "Invoice") {
App::uses('Invoice', 'Invoice.Model');
$invoiceModel = new Invoice();
$invoice = $invoiceModel->find('all', array('fields' => array('Invoice.id,invoice_no')));
if ($invoice) {
$invoice_number = (int) $invoice[count($invoice) - 1]['Invoice']['invoice_no'];
$length = strlen($invoice_number + 1) == strlen($invoice_number) ? strlen($invoice_number) : strlen($invoice_number + 1);
for ($i = $length; $i < 6; $i++) {
$value .= '0';
}
$value .= $invoice_number + 1;
} else {
$value = "000001";
}
}
return $value;
}
示例10: edit
/**
* Show the form for editing the specified quote.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
if (!Sentry::getUser()) {
return Redirect::route('sessions.create');
}
$quote = Quote::find($id);
return View::make('quotes.edit', compact('quote'));
}
示例11: add
/**
* add method
*
* @return void
*/
public function add($id = null, $type = null)
{
$data = array();
$itemData = array();
if ($type == 'Purchase Order') {
App::import('Model', 'PurchaseOrderManager.PurchaseOrder');
$purchaseOrder = new PurchaseOrder();
$purchaseOrder->recursive = 0;
$data = $purchaseOrder->find('first', array('conditions' => array('PurchaseOrder.id' => $id)));
$itemData = $this->QuoteItem->listOfPoItem(null, $id);
} elseif ($type == 'Quote') {
App::import('Model', 'QuoteManager.Quote');
$quote = new Quote();
$quote->recursive = 1;
$data = $quote->find('first', array('conditions' => array('Quote.id' => $id)));
$itemData = $this->QuoteItem->ListQuoteItems($id);
// debug($itemData);
$itemData = $this->QuoteItem->AdjustPOItem($itemData);
$itemData['main_list'] = $itemData['name_list'];
unset($itemData['name_list']);
$itemData['qty_list'] = $itemData['quantity_list'];
unset($itemData['quantity_list']);
// debug($data);
// debug($itemData);
//
// exit;
}
$invoice_no = $this->QuoteItem->auto_generate_number('Invoice');
$invoiceFormatData = $this->InvoiceItem->formatInvoiceData($invoice_no, $type, $id, $data, $itemData);
$invoiceCreate = $this->InvoiceItem->createInvoice($invoiceFormatData);
if ($invoiceCreate) {
$this->Session->setFlash(__('The invoice has been saved'));
$this->redirect(array('action' => 'detail', $invoiceCreate['Invoice']['id']));
} else {
$this->Session->setFlash(__('The invoice could not be saved. Please, try again.'));
}
$this->set(compact('invoiceStatuses', 'type'));
}
示例12: delQuote
public function delQuote($id)
{
$quote = Quote::find($id);
$quote->delete();
return Redirect::to('admin/quote');
}
示例13: po_of_work_order
public function po_of_work_order($quote_id = null, $section = null, $work_id = null, $edit = null)
{
$this->layoutOpt['left_nav_selected'] = "add_purchase_order";
if ($this->request->is('post') || $this->request->is('put')) {
$this->PurchaseOrder->create();
if ($this->PurchaseOrder->save($this->request->data)) {
$this->Session->setFlash(__('The Purchase Order has been saved'), 'default', array('class' => 'text-success'));
$this->redirect(array('plugin' => 'work_order_manager', 'controller' => 'work_orders', 'action' => 'detail_section', $work_id, $section));
} else {
$this->Session->setFlash(__('The Purchase Order could not be saved. Please, try again.'), 'default', array('class' => 'text-error'));
}
}
App::uses('Quote', 'QuoteManager.Model');
$quote = new Quote();
$quote->recursive = 0;
$quoteInfo = $quote->find('all', array('conditions' => array('Quote.id' => $quote_id)));
App::import('Model', 'PurchaseOrderManager.GeneralSetting');
$general_model = new GeneralSetting();
$location_data = $general_model->find("first", array("conditions" => array("GeneralSetting.name" => 'Default')));
$this->set(compact('quote_id', 'section', 'quoteInfo', 'work_id', 'edit', 'location_data'));
}
示例14: print_detail
/**
* print/pdf view method
*
* @param string $id
* @return void
*/
public function print_detail($id = null)
{
$this->layoutOpt['layout'] = 'report';
$this->ServiceEntry->id = $id;
if (!$this->ServiceEntry->exists()) {
throw new NotFoundException(__('Invalid ServiceEntry'));
}
$user_id = $this->loginUser['id'];
$this->ServiceEntry->recursive = 3;
$service = $this->ServiceEntry->read(null, $id);
App::import('Model', 'ScheduleManager.ScheduleStatus');
$scheduleStatusModel = new ScheduleStatus();
$schedule_status = $scheduleStatusModel->find('all', array('conditions' => array('ScheduleStatus.schedule_id' => $id, 'ScheduleStatus.type' => 'Service')));
App::import('Model', 'QuoteManager.Quote');
$quoteModel = new Quote();
$quotes = $quoteModel->find('first', array('conditions' => array('Quote.id' => $service['WorkOrder']['quote_id'])));
$reportTitle = "Service";
$reportNumber = $service['WorkOrder']['work_order_number'];
$reportDate = date('l, F d, Y');
$this->set(compact('user_id', 'service', 'quotes', 'schedule_status', 'reportTitle', 'reportNumber', 'reportDate'));
}
示例15: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->line('Lets start our migration.');
//Migrate Groups to Roles
$groups = DB::connection('oldmysql')->table('groups');
$this->line($groups->count() . ' groups[\'s] were found in the legacy database');
foreach ($groups->get() as $group) {
$role = new Role();
$role->name = $group->group;
$role->save();
}
//Migrate Users
$users = DB::connection('oldmysql')->table('users');
$this->line($users->count() . ' user[\'s] were found in the legacy database');
foreach ($users->get() as $user) {
$this->line('Migrating user: ' . $user->username);
$newuser = new User();
$newuser->id = $user->id;
$newuser->username = $user->username;
$newuser->email = $user->email;
$newuser->save();
//Migrate there group to a role
$group = DB::connection('oldmysql')->table('groups')->where('id', $user->group)->first();
$myrole = Role::where('name', $group->group)->first();
$newuser->roles()->attach($myrole);
$this->line('Adding user to role: ' . $group->group);
}
//Migrate Users
$quotes = DB::connection('oldmysql')->table('quotes');
$this->line($quotes->count() . ' quote[\'s] were found in the legacy database');
foreach ($quotes->get() as $quote) {
$this->line('Migrating quote: #' . $quote->id);
$newquote = new Quote();
$newquote->timestamps = false;
$newquote->id = $quote->id;
$newquote->title = $quote->title;
$newquote->quote = $quote->quote;
$user = User::find($quote->userid);
$newquote->user()->associate($user);
$newquote->status = $quote->approved;
$newquote->created_at = date('Y-m-d H:i:s', $quote->timestamp);
$newquote->updated_at = date('Y-m-d H:i:s', $quote->timestamp);
$newquote->save();
}
$votes = DB::connection('oldmysql')->table('votes');
$this->line($votes->count() . ' vote[\'s] were found in the legacy database');
foreach ($votes->get() as $vote) {
$user = User::find($vote->userid);
$quote = Quote::find($vote->quoteid);
if ($user && $quote) {
if ($vote->vote == 1) {
$this->line($user->username . ' voted up #' . $quote->id);
} else {
$this->line($user->username . ' voted down #' . $quote->id);
}
if ($quote) {
$vuser = $quote->voted()->whereUserId($vote->userid)->first();
if (!$vuser) {
$quote->voted()->attach($user, array('vote' => $vote->vote));
} else {
$vuser->pivot->vote = $vote->vote;
$vuser->pivot->save();
}
}
//Our confidence has changed in this quote.
$quote->updateVoteConfidence();
} else {
if (!$quote) {
$this->line('Vote #' . $vote->id . ' could not be imported because the quote doesn\'t exist');
}
if (!$user) {
$this->line('Vote #' . $vote->id . ' could not be imported because the user doesn\'t exist');
}
}
}
}