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


PHP Purchase::find方法代码示例

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


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

示例1: getDetail

 public function getDetail()
 {
     //$id = \Input::get('id');
     $input = \Input::all();
     if ($input['type'] == 'sale') {
         $detail = Sale::find($input['id']);
     } else {
         $detail = Purchase::find($input['id']);
     }
     return \Response::json($detail);
 }
开发者ID:sujithma,项目名称:shopherebackend,代码行数:11,代码来源:AdminController.php

示例2: profileAction

 public function profileAction()
 {
     if (!$this->session->get("auth")) {
         $this->flash->notice('Please login first');
         $this->response->redirect('Session');
     }
     $user = User::findFirst($this->session->get("auth")['id']);
     $purchases = Purchase::find();
     $user_purchases = array();
     foreach ($purchases as $purchase) {
         if ($purchase->user_id == $user->id) {
             array_push($user_purchases, $purchase);
         }
     }
     $this->view->user = $user;
     $this->view->user_purchases = $user_purchases;
 }
开发者ID:KarimTaha,项目名称:AdvancedLab,代码行数:17,代码来源:UserController.php

示例3: done

 public function done()
 {
     $taskdetails_id = Input::get('taskdetails_id');
     $taskd = TaskDetails::find($taskdetails_id);
     $taskd->status = "Done";
     $docs = Document::find($taskd->doc_id);
     $id = $docs->pr_id;
     $delcount = Count::where('doc_id', $docs->id)->delete();
     $users = User::get();
     foreach ($users as $user) {
         $count = new Count();
         $count->user_id = $user->id;
         $count->doc_id = $docs->id;
         $count->save();
     }
     $birth = new DateTime($taskd->dateReceived);
     $today = new DateTime();
     $diff = $birth->diff($today);
     $aDays = $diff->format('%d');
     $taskd->daysOfAction = $aDays;
     $taskd->dateFinished = $today;
     $taskd->save();
     date_default_timezone_set("Asia/Manila");
     $upDate = date('Y-m-d H:i:s');
     DB::table('purchase_request')->where('id', $id)->update(array('updated_at' => $upDate));
     $tasknext = TaskDetails::find($taskdetails_id + 1);
     if ($tasknext->doc_id == $taskd->doc_id) {
         $counter = 1;
         $tasknext = TaskDetails::find($taskdetails_id + $counter);
         while ($tasknext->status == "Lock") {
             $counter = $counter + 1;
             $tasknext = TaskDetails::find($taskdetails_id + $counter);
         }
         $tasknext->status = "New";
         $tasknext->save();
     } else {
         $purchase = Purchase::find($docs->pr_id);
         $purchase->status = "Closed";
         $purchase->save();
     }
     $request_id = Input::get('pr_id');
     return Redirect::to("purchaseRequest/vieweach/{$request_id}");
 }
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:43,代码来源:TaskController.php

示例4:

        document.onkeypress = stopRKey; 
    </script>

@stop



@section('content')



    <?php 
//Initialization for page query
$pass = 0;
//Use in role restriction.
$purchaseToEdit = Purchase::find($id);
$user_id = Auth::User()->id;
//Retain Inputte Values
if (Input::old('projectPurpose') || Input::old('sourceOfFund') || Input::old('amount')) {
    $valprojectPurpose = Input::old('projectPurpose');
    $valsourceOfFund = Input::old('sourceOfFund');
    $valamount = Input::old('amount');
    $valprojectType = $purchaseToEdit->projectType;
} else {
    $valprojectPurpose = $purchaseToEdit->projectPurpose;
    $valprojectType = $purchaseToEdit->projectType;
    $valsourceOfFund = $purchaseToEdit->sourceOfFund;
    $valamount = $purchaseToEdit->amount;
}
?>
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:30,代码来源:pr_edit.blade.php

示例5: getCancel

 public function getCancel($idPurchase)
 {
     try {
         $purchase = Purchase::find($idPurchase);
         if ($purchase->status != 'finalizado') {
             $purchase->status = 'cancelado';
             $purchase->save();
         }
         return Redirect::to('purchases/items/' . $idPurchase);
     } catch (Exception $e) {
         die('No fue posible cancelar la compra.');
     }
 }
开发者ID:heromdn,项目名称:inventarios,代码行数:13,代码来源:PurchaseController.php

示例6: error_reporting

      }
    </style>
@stop

@section('content')

  <?php 
//Initializers
error_reporting(0);
$taskdetails_id = Session::get('taskdetails_id');
Session::forget('taskdetails_id');
$taskd = TaskDetails::find($taskdetails_id);
$task = Task::find($taskd->task_id);
$doc = Document::find($taskd->doc_id);
$purchase = Purchase::find($doc->pr_id);
$purchaseToEdit = Purchase::find($doc->pr_id);
$date_today = $date_today = date('Y-m-d H:i:s');
//End Initializers
?>

  {{Session::put('backTo',"task/$taskdetails_id");}}

<h2 class="pull-left">Task Details</h2>

<div class="pull-right options">
@if($taskd->status == "Active" && $taskd->dueDate > $date_today)
  <a href="{{ URL::previous() }}" class="btn btn-default"><span class="glyphicon glyphicon-chevron-left"></span> Back</a>
@elseif($taskd->status == "New")
  <a href="{{ URL::previous() }}" class="btn btn-default"><span class="glyphicon glyphicon-chevron-left"></span> Back</a>
 
@elseif($taskd->status == "Closed")
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:31,代码来源:task.blade.php

示例7: getPurchases

 private function getPurchases($wantedid, $wantedtype, $whowantsid, $whowantstype){
     $isperm = false;
     $conditions = array();
     if($wantedid > 0){
         $tmpcondition = array('id=?',$wantedid);
         \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
     }            
     if($wantedtype !== ''){
         $tmpcondition = array('purchase_number=?',$wantedtype);
         \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);
     }
     if(($whowantstype !== Menu::ppl_type_admin && !$isperm)){
         //whatever id, status been asked give if they are their related orders only                
         $tmpcondition = array('person_id=?', $whowantsid);
         \ActiveRecord\Utils::add_condition($conditions, $tmpcondition);   
     }
     $result = \Purchase::find('all', array('conditions' => $conditions, 'order' => 'purchase_at desc'));            
     
     $except = array();
     $include = array('purchaseproducts' => array('include' => array('product')));
     foreach ($result as &$rec) {
         $rec = $rec->to_array(array('include' => $include, 'except' => $except));
     }
     return $result;
 }
开发者ID:Rajagunasekaran,项目名称:BACKUP,代码行数:25,代码来源:Menu.php

示例8: date

        <!-- Get all task details with id = task->id -->
        <?php 
$user_id = Auth::user()->id;
$date_today = date('Y-m-d H:i:s');
$taskDetails_row = TaskDetails::whereIn('task_id', $taskIds)->whereStatus("Active")->where("dueDate", "<", $date_today)->whereAssigneeId($user_id)->paginate(10);
?>

        @foreach($taskDetails_row as $taskDetail)
            {{Session::put('$taskDetails_row','true');}}
            <?php 
$task = Task::find($taskDetail->task_id);
$doc_id = $taskDetail->doc_id;
$document_row = Document::find($doc_id);
$purchase_id = $document_row->pr_id;
$purchase_row = Purchase::find($purchase_id);
$projectName = $purchase_row->projectPurpose;
$controlNo = $purchase_row->controlNo;
?>
                    
            <a href="/task/{{$taskDetail->id}}" class="list-group-item tasks">
                <div class="pull-left task-desc" style="margin-left: 10px;">
                    <span class="list-group-item-heading">{{ $task->taskName  }}</span> &nbsp;<small><i> </small><br/>
                    <span class="list-group-item-text">{{ $task->description }}</span> &nbsp; 
                    <br>Control No. : <small><font color="blue"><?php 
echo str_pad($controlNo, 5, '0', STR_PAD_LEFT);
?>
</font></small>
                    <br>Project/Purpose: <small><font color="blue">{{$projectName}}</font></small>
                </div> 
                {{ Form::open() }}
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:30,代码来源:overdue_tasks.blade.php

示例9: change_status

 public function change_status($id)
 {
     $t = Purchase::find($id);
     if (!is_null($t)) {
         $t->paid = !$t->paid;
         $t->save();
     }
     return Redirect::to('admin/transactions');
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:9,代码来源:AdminController.php

示例10: philgeps

 public function philgeps()
 {
     Session::put('goToChecklist', 'true');
     //Initializations
     $referenceno = strip_tags(Input::get('referenceno'));
     $datepublished = Input::get('datepublished');
     $enddate = Input::get('enddate');
     $by = " " . strip_tags(Input::get('by'));
     $by = preg_replace('/\\s+/', ' ', $by);
     if ($by == " ") {
         $by = "None";
     }
     $taskdetails_id = Input::get('taskdetails_id');
     $check = 0;
     $taskd = TaskDetails::find($taskdetails_id);
     $docs = Document::find($taskd->doc_id);
     if ($taskd->status == "Done") {
         Session::put('errorchecklist', 'Saved failed. Task was already completed by another user.');
         return Redirect::back();
     }
     //Validation Process
     if (ctype_alnum(str_replace(array(' ', '-', '.', ',', 'ñ', 'Ñ'), '', $by))) {
         $check = $check + 1;
     }
     if (ctype_alnum(str_replace(array(' ', '-', '.'), '', $referenceno))) {
         $check = $check + 1;
     }
     if ($check == 2) {
         $id = $docs->pr_id;
         $delcount = Count::where('doc_id', $docs->id)->delete();
         $userx = User::get();
         foreach ($userx as $userv) {
             $count = new Count();
             $count->user_id = $userv->id;
             $count->doc_id = $docs->id;
             $count->save();
         }
         Session::put('successchecklist', 'Task completed.');
         $taskd = TaskDetails::find($taskdetails_id);
         $taskd->status = "Done";
         $taskd->custom1 = $referenceno;
         $taskd->custom2 = $datepublished;
         $taskd->custom3 = $enddate;
         $taskd->assignee = $by;
         $taskd->save();
         $tasknext = TaskDetails::find($taskdetails_id + 1);
         $tasknextc = TaskDetails::where('id', $taskdetails_id + 1)->where('doc_id', $docs->pr_id)->count();
         date_default_timezone_set("Asia/Manila");
         $upDate = date('Y-m-d H:i:s');
         DB::table('purchase_request')->where('id', $id)->update(array('updated_at' => $upDate));
         DB::table('taskdetails')->where('id', $taskdetails_id)->update(array('dateFinished' => $upDate));
         if ($tasknextc != 0) {
             //Project Type Filter
             $counter = 1;
             $tasknext = TaskDetails::find($taskdetails_id + $counter);
             while ($tasknext->status == "Lock" || $tasknext->status == "Done") {
                 $counter = $counter + 1;
                 $tasknext = TaskDetails::find($taskdetails_id + $counter);
             }
             $tasknext->status = "New";
             $tasknext->save();
             //End Project Type Filter
         } else {
             $purchase = Purchase::find($docs->pr_id);
             $purchase->status = "Closed";
             $purchase->save();
             $request_id = Input::get('pr_id');
             return Redirect::to("purchaseRequest/vieweach/{$request_id}");
         }
     } else {
         Session::put('errorchecklist', 'Invalid input.');
         return Redirect::back()->withInput();
     }
     return Redirect::back();
 }
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:75,代码来源:PurchaseRequestController.php

示例11: janisawesome

 public function janisawesome()
 {
     function generateRandomString($length = 10)
     {
         $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $randomString = '';
         for ($i = 0; $i < $length; $i++) {
             $randomString .= $characters[rand(0, strlen($characters) - 1)];
         }
         return $randomString;
     }
     function generateRandomAmount()
     {
         $length = rand(4, 8);
         $randomString = '';
         for ($i = 0; $i < $length; $i++) {
             $randomString .= rand(1, 9);
         }
         return $randomString;
     }
     $numLoop = 1;
     while ($numLoop < 301) {
         $purchase = new Purchase();
         $document = new Document();
         $purchase->projectPurpose = generateRandomString();
         $purchase->sourceOfFund = generateRandomString();
         $controlAmt = generateRandomAmount();
         $controlAmt .= ".00";
         $purchase->amount = number_format($controlAmt);
         $purchase->office = "1";
         $purchase->requisitioner = "1";
         $purchase->dateRequested = date('Y-m-d H:i:s');
         $purchase->dateReceived = date('Y-m-d H:i:s');
         $purchase->status = 'Active';
         $purchase->otherType = " ";
         // Get latest control number
         $cn = 0;
         $purchase_controlNo = Purchase::orderBy('ControlNo', 'DESC')->first();
         if (!$purchase_controlNo == NuLL) {
             $cn = $purchase_controlNo->controlNo;
         }
         $cn += 1;
         $purchase->controlNo = $cn;
         if (Input::get('otherType') == ' ') {
             $purchase->projectType = "None";
         } else {
             $purchase->projectType = "None";
         }
         // Set creator id
         $user_id = Auth::user()->id;
         $purchase->created_by = $user_id;
         $purchase_save = $purchase->save();
         if ($purchase_save) {
             if ($controlAmt < 50000) {
                 $amtControl = 1;
             } else {
                 if ($controlAmt >= 50000 && $controlAmt <= 500000) {
                     $amtControl = 2;
                 } else {
                     if ($controlAmt >= 500000) {
                         $amtControl = 3;
                     }
                 }
             }
             $document->pr_id = $purchase->id;
             $document->work_id = $amtControl;
             $document_save = $document->save();
             if ($document_save) {
                 $doc_id = $document->id;
                 $workflow = Workflow::find($document->work_id);
                 $section = Section::where('workflow_id', $document->work_id)->orderBy('section_order_id', 'ASC')->get();
                 $firstnew = 0;
                 // Set due date;
                 $new_purchase = Purchase::find($purchase->id);
                 $workflow_id = "1";
                 $workflow = Workflow::find($workflow_id);
                 $addToDate = $workflow->totalDays;
                 date_default_timezone_set("Asia/Manila");
                 $dueDate = date('Y-m-d H:i:s', strtotime("+{$addToDate} days"));
                 $new_purchase->dueDate = $dueDate;
                 $new_purchase->save();
                 $tasks = Task::where('wf_id', $document->work_id)->orderBy('section_id', 'ASC')->orderBy('order_id', 'ASC')->get();
                 foreach ($tasks as $task) {
                     $task_details = new TaskDetails();
                     $task_details->task_id = $task->id;
                     $stringamount = $new_purchase->amount;
                     $stringamount = str_replace(str_split(','), '', $stringamount);
                     $amount = (double) $stringamount;
                     if ($firstnew == 0) {
                         $task_details->status = "New";
                     } else {
                         $task_details->status = "Pending";
                     }
                     //Project Type
                     if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT" || $task->taskName == "PRE-BID CONFERENCE") {
                         $task_details->status = "Lock";
                         if ($new_purchase->projectType == "Goods/Services") {
                             if ($task->taskName == "PRE-PROCUREMENT CONFERENCE" || $task->taskName == "ADVERTISEMENT") {
                                 if ($amount > 2000000) {
                                     $task_details->status = "Pending";
//.........这里部分代码省略.........
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:101,代码来源:BaseController.php


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