本文整理汇总了PHP中Supplier::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::find方法的具体用法?PHP Supplier::find怎么用?PHP Supplier::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setVariables
/**
* Contains the testing sample data for the ReceiptController.
*
* @return void
*/
public function setVariables()
{
// Initial sample storage data
$this->input = array('commodity' => Commodity::find(1)->id, 'supplier' => Supplier::find(1)->id, 'quantity' => '200', 'batch_no' => '4535', 'expiry_date' => '2015-07-17');
// Edition sample data
$this->inputUpdate = array('commodity' => Commodity::find(1)->id, 'supplier' => Supplier::find(1)->id, 'quantity' => '200', 'batch_no' => '4535', 'expiry_date' => '2015-07-17');
}
示例2: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$del = Supplier::find($id)->delete();
if ($del) {
echo "Your Item Deleted";
} else {
echo "Not Found or Already Deleted";
}
}
示例3: postLoadSupplierProducts
public function postLoadSupplierProducts()
{
if (Request::ajax()) {
$post = Input::all();
$supplier = Supplier::find($post['suppliersId']);
if (!is_null($supplier)) {
$products = $supplier->products()->orderBy('name')->get();
return View::make('products.select')->with('products', $products)->render();
} else {
return Form::select('product', array('' => ' - Seleccione - '), null, array('class' => 'form-control', 'id' => 'product'));
}
}
}
示例4: SupplierAndItemInfo
public function SupplierAndItemInfo()
{
App::uses("Supplier", "Inventory.Model");
App::import("Model", "Inventory.Item");
$supplierModel = new Supplier();
$itemModel = new Item();
$supplierModel->recursive = 0;
$suppliers = $supplierModel->find("all");
$tmp_suplliers = array();
foreach ($suppliers as $key => $supplier) {
$tmp_suplliers[$supplier['Supplier']['id']]['name'] = $supplier['Supplier']['name'];
$tmp_suplliers[$supplier['Supplier']['id']]['email'] = $supplier['Supplier']['email'];
$tmp_suplliers[$supplier['Supplier']['id']]['gst'] = $supplier['Supplier']['gst_rate'];
$tmp_suplliers[$supplier['Supplier']['id']]['pst'] = $supplier['Supplier']['pst_rate'];
$tmp_suplliers[$supplier['Supplier']['id']]['item'] = $itemModel->find("list", array("fields" => array("id_plus_item"), 'conditions' => array('supplier_id' => $supplier['Supplier']['id'])));
$tmp_suplliers[$supplier['Supplier']['id']]['address'] = $this->address_format($supplier['Supplier']['address'], $supplier['Supplier']['city'], $supplier['Supplier']['province'], $supplier['Supplier']['country'], $supplier['Supplier']['postal_code']);
$tmp_suplliers[$supplier['Supplier']['id']]['phone'] = $this->phone_format($supplier['Supplier']['phone'], $supplier['Supplier']['phone_ext'], $supplier['Supplier']['cell'], $supplier['Supplier']['fax_number']);
}
return $tmp_suplliers;
}
示例5: setSupplierData
private function setSupplierData()
{
if (isset($this->phkRequestData['supplier_id']) && !isset($this->phkRequestData['supplier_text'])) {
App::import("Model", "Supplier");
$supplier = new Supplier();
$result = $supplier->find("first", array('conditions' => array('Supplier.id' => $this->phkRequestData['supplier_id'])));
if (count($result)) {
$this->phkRequestData['supplier_id'] = $result['Supplier']['id'];
$this->phkRequestData['supplier_text'] = $result['Supplier']['name'];
}
}
}
示例6: delete
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function delete($id)
{
//Soft delete the item
$supplier = Supplier::find($id);
if (count($supplier->stocks) > 0) {
return Redirect::route('supplier.index')->with('message', trans('messages.failure-delete-record'));
} else {
$supplier->delete();
// redirect
return Redirect::route('supplier.index')->with('message', trans('messages.record-successfully-deleted'));
}
}
示例7: destroy
/**
* Remove the specified resource from storage.
* DELETE /supplier/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$barang = Supplier::find($id);
$barang->delete();
// redirect
Session::flash('message', 'Successfully deleted supplier!');
return Redirect::to('supplier');
//
}
示例8: quote_approved
public function quote_approved($id = null)
{
$this->autoRender = FALSE;
App::import('Model', 'QuoteManager.QuoteStatus');
$QuoteStatus = new QuoteStatus();
App::import('Model', 'QuoteManager.Quote');
$Quote = new Quote();
$Q_model = new Quote();
$quote['Quote']['id'] = $id;
$quote['Quote']['status'] = 'Approve';
$Q_data = $Q_model->find("first", array("conditions" => array("Quote.id" => $id)));
if (empty($Q_data['Quote']['est_shipping'])) {
if ($Q_data['Quote']['delivery'] == '4 - 8 Weeks Delivery') {
$add_days = 56;
$today = $Q_data['Quote']['quote_created_date'];
$esd_date = date('d/m/Y', strtotime($today) + 24 * 3600 * $add_days);
}
if ($Q_data['Quote']['delivery'] == '5 - 10 Weeks Delivery') {
$add_days = 70;
$today = $Q_data['Quote']['quote_created_date'];
$esd_date = date('d/m/Y', strtotime($today) + 24 * 3600 * $add_days);
}
$quote['Quote']['est_shipping'] = $esd_date;
}
$Quote->save($quote);
$quote_status['QuoteStatus']['status'] = 'Approve';
$quote_status['QuoteStatus']['quote_id'] = $id;
$quote_info = $Quote->find("first", array("conditions" => array("Quote.id" => $id)));
$workorder['WorkOrder']['quote_id'] = $quote_info['Quote']['id'];
$workorder['WorkOrder']['project_id'] = $quote_info['Quote']['project_id'];
$workorder['WorkOrder']['customer_id'] = $quote_info['Quote']['customer_id'];
$workorder['WorkOrder']['status'] = 'New';
$quote_number_explode = explode("-", $quote_info['Quote']['quote_number']);
$workorder['WorkOrder']['work_order_number'] = $quote_number_explode[0];
$workorder['WorkOrder']['skid_number'] = $quote_info['Quote']['skid_number'];
$workorder['WorkOrder']['skid_weight'] = $quote_info['Quote']['skid_weight'];
App::import("Model", "WorkOrderManager.WorkOrder");
$wo = new WorkOrder();
$wo->save($workorder);
App::import("Model", "PurchaseOrderManager.PurchaseOrder");
App::import("Model", "PurchaseOrderManager.PurchaseOrderItem");
App::import("Model", "Inventory.Supplier");
App::import('Model', 'PurchaseOrderManager.GeneralSetting');
$supplier = array();
foreach ($quote_info['CabinetOrderItem'] as $quote_item) {
$item_info = $this->findQuoteItem($quote_item['item_id']);
$supplier_required = $this->findQuoteItemDept($item_info['Item']['item_department_id']);
if ($supplier_required['ItemDepartment']['supplier_required'] == 1) {
$supplier[$item_info['Item']['supplier_id']][] = $item_info;
}
}
$total_amount = 0;
foreach ($supplier as $key => $value) {
if (empty($Q_data['Quote']['est_shipping'])) {
$est_date_quote = $quote['Quote']['est_shipping'];
} else {
$est_date_quote = $quote_info['Quote']['est_shipping'];
}
$purchaseorder = new PurchaseOrder();
$sp_model = new Supplier();
$sp_data = $sp_model->find("first", array("conditions" => array("Supplier.id" => $id)));
$general_model = new GeneralSetting();
$location_data = $general_model->find("first", array("conditions" => array("GeneralSetting.name" => 'Default')));
$po['supplier_id'] = $key;
$po['work_order_id'] = $wo->id;
$po_number = explode("-", $quote_info['Quote']['quote_number']);
$po['purchase_order_num'] = $po_number[0];
$po['quote_id'] = $quote_info['Quote']['id'];
$po['shipment_date'] = $est_date_quote;
$po['payment_type'] = 'On Account';
$po['issued_on'] = date('d/m/Y');
$po['issued_by'] = $this->loginUser['id'];
$po['term'] = $sp_data['Supplier']['terms'];
$po['location_name'] = $location_data['GeneralSetting']['name'];
$po['name_ship_to'] = $location_data['GeneralSetting']['name_address'];
$po['address'] = $location_data['GeneralSetting']['address'];
$po['city'] = $location_data['GeneralSetting']['city'];
$po['province'] = $location_data['GeneralSetting']['province'];
$po['postal_code'] = $location_data['GeneralSetting']['postal_code'];
$po['country'] = $location_data['GeneralSetting']['country'];
foreach ($value as $v) {
foreach ($quote_info['CabinetOrderItem'] as $req_info) {
if ($req_info['item_id'] == $v['Item']['id']) {
$quantity = $req_info['quantity'];
$total_amount = $total_amount + $quantity * $v['Item']['price'];
}
}
}
App::import("Model", "PurchaseOrderManager.GeneralSetting");
$g_setting = new GeneralSetting();
$gst_rate = $g_setting->find("first", array("conditions" => array("GeneralSetting.type" => 'gst')));
$pst_rate = $g_setting->find("first", array("conditions" => array("GeneralSetting.type" => 'pst')));
$gst_amount = $gst_rate['GeneralSetting']['value'] / 100 * $total_amount;
$pst_amount = $pst_rate['GeneralSetting']['value'] / 100 * $total_amount;
$total_amount = $total_amount + $gst_amount + $pst_amount;
$po['total_amount'] = $total_amount;
$purchaseorder->save($po);
$index = 0;
$purchaseorderitem = new PurchaseOrderItem();
foreach ($value as $v) {
//.........这里部分代码省略.........
示例9: SupplierForView
function SupplierForView($id = null)
{
App::uses("Supplier", "Inventory.Model");
$supplier = new Supplier();
return $supplier->find("first", array("fields" => array("id", "name"), "conditions" => array("Supplier.id" => $id)));
}
示例10: delete
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function delete($id)
{
//Soft delete the item
$supplier = Supplier::find($id);
$supplier->delete();
// redirect
return Redirect::route('supplier.index')->with('message', trans('messages.supplier-succesfully-deleted'));
}
示例11: delete_supp
public function delete_supp()
{
$getID = Input::get('deleteID');
$supp = Supplier::find($getID);
$supp->actStatus = '0';
$supp->save();
return Redirect::to('/suppliers');
}
示例12: postDeletesupplier
public function postDeletesupplier()
{
$s = Supplier::find(Input::get('id'));
if ($s) {
$s->delete();
return Redirect::to('admin/uploadsuppliers')->with('message', 'Supplier Deleted');
}
return Redirect::to('admin/uploadsuppliers')->with('message', 'Could not Delete');
}
示例13: getSupplierData
public function getSupplierData($id = null)
{
$this->autoRender = false;
App::import('Model', 'Inventory.Supplier');
$supplier_model = new Supplier();
$supplier_data = $supplier_model->find("first", array("conditions" => array("Supplier.id" => $id)));
echo json_encode($supplier_data);
}
示例14: postPackageCheckedin
/**
* postPackageCheckedin (拆包检验入库)
*/
public function postPackageCheckedin()
{
$id = Input::get('id');
$position = Input::get('readyposition');
$itemReceivedPackageDetail = ItemReceivedPackageDetail::find($id);
$itemReceivedPackageDetail->status = 2;
$itemReceivedPackageDetail->readyposition = $position;
$itemReceivedPackageDetail->save();
//历史入库记录
$historyWareHouse = new HistoryWarehouse();
$historyWareHouse->identity = $itemReceivedPackageDetail->identity;
$historyWareHouse->item = $itemReceivedPackageDetail->item;
$historyWareHouse->batch = $itemReceivedPackageDetail->batch;
$historyWareHouse->quantity = $itemReceivedPackageDetail->quantity;
$historyWareHouse->position = $position;
$historyWareHouse->operator = 5;
$historyWareHouse->save();
//库存汇总
$wareHouse = Warehouse::where('item', $itemReceivedPackageDetail->item)->where('position', $position)->first();
if ($wareHouse) {
$wareHouse->quantity = $wareHouse->quantity + $itemReceivedPackageDetail->quantity;
$wareHouse->save();
} else {
$wareHouse = new Warehouse();
$wareHouse->item = $itemReceivedPackageDetail->item;
$wareHouse->position = $position;
$wareHouse->quantity = $itemReceivedPackageDetail->quantity;
$wareHouse->save();
}
//更新item总库存
$items = Item::where('code', $itemReceivedPackageDetail->item)->first();
$items->stock += $itemReceivedPackageDetail->quantity;
$items->readystock -= $itemReceivedPackageDetail->quantity;
$items->save();
//到包日期|包号
$itemReceivedPackage = ItemReceivedPackage::find($itemReceivedPackageDetail->package_id);
$package_checked_date = $itemReceivedPackage->package_checked_date;
$package_no = $itemReceivedPackage->package_no;
//供应商
$supplier = Supplier::find($itemReceivedPackageDetail->supplier_id);
//details
$itemReceivedPackageDetails = ItemReceivedPackageDetail::where('package_id', $itemReceivedPackageDetail->package_id)->orderBy('status')->get();
return View::make('admin.itemreceive.packagedetail')->with('itemReceivedPackageDetails', $itemReceivedPackageDetails)->with('supplier', $supplier)->with('package_checked_date', $package_checked_date)->with('package_no', $package_no);
}
示例15: edit
/**
* Show the form for editing the specified supplier.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$supplier = Supplier::find($id);
return View::make('admin.suppliers.edit', compact('supplier'));
}