public function testSupplierAdd() { $supplier = factory(Supplier::class, 'supplier')->make(); $values = ['name' => $supplier->name]; Supplier::create($values); $this->tester->seeRecord('suppliers', $values); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $receipt = Receipt::find($id); $suppliers = Supplier::all()->lists('name', 'id'); $commodities = Commodity::all()->lists('name', 'id'); return view('receipt.edit')->with('receipt', $receipt)->with('commodities', $commodities)->with('suppliers', $suppliers); }
public function report() { $s = Supplier::get(); $c = Customer::get(); $bankaccount = Bankaccount::joining(); $voucher = Voucher::orderBy('id', 'desc')->take(10)->get(); return view('ledger', compact('bankaccount', 'c', 's', 'voucher')); }
public function index() { $s = Supplier::get(); $c = Customer::get(); $bankaccount = Bankaccount::joining(); $voucher = Voucher::orderBy('id', 'desc')->where('type', '<>', 5)->take(10)->get(); return view('voucher', compact('bankaccount', 'c', 's', 'voucher')); }
public static function furnizori() { $out = []; $data = Supplier::where('type', '=', 1)->get()->toArray(); foreach ($data as $k => $d) { $out[$d['id']] = $d['name']; } return $out; }
private function firstRun() { $suppliers = Supplier::all(); foreach ($suppliers as $supplier) { $new = Supplier::find($supplier->id); $new->id = Supplier::get_uid(); $new->save(); } }
public function createSlug($title, $numb = 0) { $slug = str_slug($title, '-') . ($numb ? '-' . $numb : ''); $already = Supplier::findBySlug($slug); if ($already->count()) { return $this->createSlug($title, $numb + 1); } return $slug; }
/** * Tests the update function in the SupplierController * @depends testStore * @param void * @return void */ public function testDelete() { $this->be(User::first()); $this->runStore($this->input); $supplier = new SupplierController(); $supplier->delete(1); $supplierDeleted = Supplier::withTrashed()->find(1); $this->assertNotNull($supplierDeleted->deleted_at); }
public function __construct(App $app) { parent::__construct($app); $this->tableProduct = $this->getModel()->getTableName(); $this->tableSku = Sku::getTableName(); $this->tableSkuImages = Sku\Image::getTableName(); $this->tableSupplier = Supplier::getTableName(); $this->tableCategory = Category::getTableName(); $this->tableProductCategory = ProductCategory::getTableName(); }
public function furnizori() { $id_utilitate = Input::get('id'); $out = []; $data = Supplier::where('type', $id_utilitate)->get()->toArray(); foreach ($data as $k => $d) { $out[$d['id']] = $d['name']; } return ['options' => ['0' => count($out) > 0 ? '-- Selectati furnizor --' : '-- Nu are furnizor --'] + $out]; }
public function chartTotalInventoryPerSupplier() { $suppliers = Supplier::getMainSuppliers(); $data = '['; foreach ($suppliers as $supplier) { $data .= '{"supplier": "' . $supplier->name . '", "value": ' . $supplier->getTotalInventoryValue() . ', "color": "#FF6600"},'; } $data = substr($data, 0, -1); $data .= ']'; header('Content-type: application/json'); echo $data; }
public function create(Request $request) { if ($request->producer == 'on') { $producer = 1; $supplied_by = $request->supplied_by; } else { $producer = 0; $supplied_by = 0; } $query = Supplier::create(array('name' => $request->name, 'producer' => $producer, 'website' => $request->website, 'phone' => $request->phone, 'supplied_by' => $supplied_by)); //$id = $query->id; return redirect('admin/data/suppliers'); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Supplier::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id_supplier' => $this->id_supplier]); $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'no_telp', $this->no_telp])->andFilterWhere(['like', 'alamat', $this->alamat]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Supplier::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['supplier_id' => $this->supplier_id, 'supplier_poscode' => $this->supplier_poscode]); $query->andFilterWhere(['like', 'supplier_name', $this->supplier_name])->andFilterWhere(['like', 'supplier_add1', $this->supplier_add1])->andFilterWhere(['like', 'supplier_add2', $this->supplier_add2])->andFilterWhere(['like', 'supplier_add3', $this->supplier_add3])->andFilterWhere(['like', 'supplier_tel', $this->supplier_tel])->andFilterWhere(['like', 'supplier_fax', $this->supplier_fax])->andFilterWhere(['like', 'supplier_email', $this->supplier_email])->andFilterWhere(['like', 'supplier_type', $this->supplier_type])->andFilterWhere(['like', 'supplier_remark', $this->supplier_remark])->andFilterWhere(['like', 'supplier_attention', $this->supplier_attention])->andFilterWhere(['like', 'supplier_active', $this->supplier_active])->andFilterWhere(['like', 'supplier_GSTno', $this->supplier_GSTno]); return $dataProvider; }
public function destroy($id) { $supplier = Supplier::find($id); if ($supplier) { $deleteProduct = Product::where('supplier_id', '=', $id)->delete(); if ($supplier->delete()) { return ['status' => 'success', 'message' => 'Supplier data successfully deleted.']; } else { return ['status' => 'failed', 'message' => 'Supplier data failed to deleted.']; } } else { return ['status' => 'failed', 'message' => 'Supplier data not found.']; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Supplier::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->joinWith(['country', 'province']); $query->andFilterWhere(['supplier_id' => $this->supplier_id, 'mi_supplier.flag_active' => 1]); $query->andFilterWhere(['like', 'supplier_name', $this->supplier_name])->andFilterWhere(['like', 'supplier_desc', $this->supplier_desc])->andFilterWhere(['like', 'contact_person', $this->contact_person])->andFilterWhere(['like', 'address_1', $this->address_1])->andFilterWhere(['like', 'address_2', $this->address_2])->andFilterWhere(['like', 'postcode', $this->postcode])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'phone_1', $this->phone_1])->andFilterWhere(['like', 'phone_2', $this->phone_2])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'country_name', $this->country_id])->andFilterWhere(['like', 'province_name', $this->province_id])->andFilterWhere(['like', 'logo_url', $this->logo_url]); return $dataProvider; }
public function getReport(Request $request) { $customers = Customer::where('status', 1)->lists('name', 'id'); $employees = Employee::where('status', 1)->lists('name', 'id'); $suppliers = Supplier::where('status', 1)->lists('company_name', 'id'); $cashInHand = DB::table('workspace_ledgers')->where(['account_code' => 11000, 'balance_type' => Config::get('common.balance_type_intermediate'), 'year' => CommonHelper::get_current_financial_year()])->sum('balance'); $sales = DB::table('general_journals')->select('general_journals.*', 'chart_of_accounts.name', 'sales_order.customer_id', 'sales_order.customer_type')->join('chart_of_accounts', 'chart_of_accounts.code', '=', 'general_journals.account_code')->join('sales_order', 'sales_order.id', '=', 'general_journals.reference_id')->where(['transaction_type' => Config::get('common.transaction_type.sales'), 'account_code' => 31000, 'year' => CommonHelper::get_current_financial_year(), 'general_journals.status' => 1])->where('general_journals.date', '=', strtotime(date('d-m-Y')))->get(); $salesReturns = DB::table('general_journals')->select('general_journals.*', 'chart_of_accounts.name', 'sales_order.customer_id', 'sales_order.customer_type')->join('chart_of_accounts', 'chart_of_accounts.code', '=', 'general_journals.account_code')->join('sales_order', 'sales_order.id', '=', 'general_journals.reference_id')->where(['transaction_type' => Config::get('common.transaction_type.sales_return'), 'account_code' => 32000, 'year' => CommonHelper::get_current_financial_year(), 'general_journals.status' => 1])->where('general_journals.date', '=', strtotime(date('d-m-Y')))->get(); $expenses = DB::table('general_journals')->select('general_journals.*', 'chart_of_accounts.name')->join('chart_of_accounts', 'chart_of_accounts.code', '=', 'general_journals.account_code')->where('general_journals.account_code', 'like', '2%')->where('general_journals.date', '=', strtotime(date('d-m-Y')))->get(); $sales = json_decode(json_encode($sales), true); $salesReturns = json_decode(json_encode($salesReturns), true); $expenses = json_decode(json_encode($expenses), true); $ajaxView = view('reports.cashFlow.view', compact('sales', 'salesReturns', 'expenses', 'customers', 'employees', 'suppliers', 'cashInHand'))->render(); return response()->json($ajaxView); }
public function index(Request $request) { $this->ch = curl_init(); curl_setopt($this->ch, CURLOPT_HEADER, true); curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); $this->supplier = Supplier::find($request->input('supplier_id')); if (method_exists($this, $this->supplier->shortname)) { $fn = $this->supplier->shortname; $result = $this->{$fn}($request->input('name'), $fn); } curl_close($this->ch); return json_encode($result); }
public function splitProductsBySupplier(array $carts) { $carts = collect($carts); $carts = $carts->map(function ($cart) { $product = Product::find($cart['product_id']); return ['product' => $product, 'quantity' => $cart['quantity']]; }); $grouping = $carts->groupBy(function ($cart) { return $cart['product']->supplier_id; }); $splits = array(); foreach ($grouping as $supplier_id => $carts) { $splits[] = ['supplier' => Supplier::find($supplier_id), 'carts' => $carts]; } return $splits; }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $materialConfig = array_flip(Config::get('common.material_type')); $suppliers = Supplier::where('status', 1)->lists('company_name', 'id'); $rmaterials = Material::where('status', 1)->where('type', '!=', $materialConfig['Discarded'])->select('name', 'id', 'type')->get(); $materials = []; foreach ($rmaterials as $material) { if ($material->type != 1) { $materials[$material->id] = Config::get('common.material_type')[$material->type] . ' - ' . $material->name; } else { $materials[$material->id] = $material->name; } } $raw_stock = RawStock::lists('quantity', 'material_id'); return view('purchasesReturn.create', compact('suppliers', 'materials', 'raw_stock')); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Supplier::find()->active(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'notes', $this->notes]); $query->with(['contacts']); if ($this->category_id != null) { $query->joinWith(['products' => function ($query) { $query->select('category_id'); $query->andWhere(['category_id' => $this->category_id]); }], true, 'INNER JOIN'); } return $dataProvider; }
public function run() { DB::table('suppliers')->delete(); Supplier::create(['name' => 'Sandvik', 'producer' => '1', 'website' => 'http://www.sandvik.no', 'supplied_by' => '1']); Supplier::create(['name' => 'Øberg Verktøy', 'producer' => '0', 'website' => 'http://www.obergverktoy.no']); Supplier::create(['name' => 'Digernes', 'producer' => '0', 'website' => 'http://www.digernes.no']); Supplier::create(['name' => 'Svea Maskiner', 'producer' => '0', 'website' => 'http://www.sveamaskiner.no']); Supplier::create(['name' => 'Norwegian Tools', 'producer' => '0', 'website' => 'http://www.norswiss.no']); Supplier::create(['name' => 'Alf I Larsen', 'producer' => '0', 'website' => 'http://www.ail.no']); Supplier::create(['name' => 'Kennametall', 'producer' => '1', 'website' => 'http://www.kennametall.com', 'supplied_by' => '6']); Supplier::create(['name' => 'Iscar', 'producer' => '1', 'website' => 'http://www.iscar.com', 'supplied_by' => '4']); Supplier::create(['name' => 'SECO', 'producer' => '1', 'website' => 'http://www.seco.se', 'supplied_by' => '3']); Supplier::create(['name' => 'Maskinforetningen', 'producer' => '0', 'website' => '']); Supplier::create(['name' => 'Dormer', 'producer' => '1', 'website' => '', 'supplied_by' => '10']); Supplier::create(['name' => 'Hoffmann', 'producer' => '0', 'website' => '']); Supplier::create(['name' => 'Holex', 'producer' => '1', 'website' => '', 'supplied_by' => '12']); Supplier::create(['name' => 'Mitshubishi', 'producer' => '1', 'website' => '', 'supplied_by' => '5']); Supplier::create(['name' => 'OSG', 'producer' => '1', 'website' => '', 'supplied_by' => '5']); Supplier::create(['name' => 'Max-Mill', 'producer' => '1', 'website' => '', 'supplied_by' => '5']); Supplier::create(['name' => 'Garant', 'producer' => '1', 'website' => '', 'supplied_by' => '12']); Supplier::create(['name' => 'Kyocera Unimerco', 'producer' => '1', 'website' => '', 'supplied_by' => '1']); Supplier::create(['name' => 'Kyvik', 'producer' => '0', 'website' => '']); }
public function getList() { $d = []; // GET LAST THREE YEARS OF DATA for ($i = 0; $i < 3; $i++) { $year = date("Y") - $i; $data = ['dependencia' => '901', "ejercicio" => $year]; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $this->apiContratos); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); $result = curl_exec($ch); $excercise = json_decode($result); $d = array_merge($d, $excercise); } // SAVE THEM TO THE DB foreach ($d as $c) { $contract = Contract::firstOrCreate(['ocdsid' => $c->ocdsID, 'ejercicio' => $c->ejercicio, 'cvedependencia' => $c->cveDependencia, 'nomDependencia' => $c->nomDependencia]); // save extra data $meta = $this->getMetaDataX($contract); if (!empty($meta) && !property_exists($meta, 'error')) { // add extra data to contracts $contract->uri = $meta->uri; $contract->published_date = date("Y-m-d", strtotime($meta->publishedDate)); // create the publisher $contract->publisher_id = Publisher::firstOrCreate(["scheme" => $meta->publisher->scheme, "name" => $meta->publisher->name, "uri" => $meta->publisher->uri, "uid" => $meta->publisher->uid]); // update contract $contract->update(); // create releases foreach ($meta->releases as $r) { $release = Release::firstOrCreate(["local_id" => $r->id, "contract_id" => $contract->id, "ocid" => $contract->ocdsid, "date" => date("Y-m-d", strtotime($r->date)), "initiation_type" => $r->initiationType, "language" => $r->language]); if (count($r->awards)) { foreach ($r->awards as $aw) { $award = Award::firstOrCreate(["release_id" => $release->id, "local_id" => $aw->id]); $award->title = $aw->title; $award->description = $aw->description; $award->status = $aw->status; $award->date = date("Y-m-d", strtotime($aw->date)); $award->value = $aw->value->amount; $award->currency = $aw->value->currency; $award->update(); if (count($aw->items)) { foreach ($aw->items as $it) { $item = $award->items()->firstOrCreate(['local_id' => $it->id]); $item->quantity = $it->quantity; $item->description = $it->description; $item->unit = $it->unit->name; $item->update(); } } if (count($aw->suppliers)) { foreach ($aw->suppliers as $sup) { $supplier = Supplier::firstOrCreate(["award_id" => $aw->id, "rfc" => $sup->identifier->id]); $supplier->name = $sup->name; $supplier->street = $sup->address->streetAddress; $supplier->locality = $sup->address->locality; $supplier->region = $sup->address->region; $supplier->zip = $sup->address->postalCode; $supplier->country = $sup->address->countryName; $supplier->contact_name = $sup->contactPoint->name; $supplier->email = $sup->contactPoint->email; $supplier->phone = $sup->contactPoint->telephone; $supplier->fax = $sup->contactPoint->faxNumber; $supplier->url = $sup->contactPoint->url; $supplier->update(); } } } } if (count($r->contracts)) { foreach ($r->contracts as $single) { $single_contract = SingleContract::firstOrCreate(["local_id" => $single->id, "release_id" => $release->id]); $single_contract->award_id = $single->awardID; $single_contract->title = $single->title; $single_contract->description = $single->description; $single_contract->status = $single->status; $single_contract->contract_start = $single->period ? date("Y-m-d", strtotime($single->period->startDate)) : null; $single_contract->contract_end = $single->period ? date("Y-m-d", strtotime($single->period->endDate)) : null; $single_contract->amount = $single->value->amount; $single_contract->currency = $single->value->currency; $single_contract->date_signed = $single->dateSigned ? date("Y-m-d", strtotime($single->dateSigned)) : null; $single_contract->documents = count($single->documents); // ? implode(',',$r->tender->submissionMethod) : null; $single_contract->update(); if (count($single->items)) { foreach ($single->items as $it) { $item = $single_contract->items()->firstOrCreate(['local_id' => $it->id]); $item->quantity = $it->quantity; $item->description = $it->description; $item->unit = $it->unit->name; $item->update(); } } } } // create planning if ($r->planning) { $planning = Planning::firstOrCreate(["release_id" => $release->id]); $planning->amount = $r->planning->budget->amount->amount; $planning->currency = $r->planning->budget->amount->currency; $planning->project = $r->planning->budget->project; $planning->update(); //$release->planning_id = $planning->id; } // create tender if ($r->tender) { $tender = Tender::firstOrCreate(["release_id" => $release->id]); $tender->local_id = $r->tender->id; $tender->title = $r->tender->title; $tender->description = $r->tender->description; $tender->status = $r->tender->status; $tender->amount = $r->tender->value ? $r->tender->value->amount : null; $tender->currency = $r->tender->value ? $r->tender->value->currency : null; $tender->procurement_method = $r->tender->procurementMethod; $tender->award_criteria = $r->tender->awardCriteria; $tender->tender_start = $r->tender->tenderPeriod ? date("Y-m-d", strtotime($r->tender->tenderPeriod->startDate)) : null; $tender->tender_end = $r->tender->tenderPeriod ? date("Y-m-d", strtotime($r->tender->tenderPeriod->endDate)) : null; $tender->enquiry_start = $r->tender->enquiryPeriod ? date("Y-m-d", strtotime($r->tender->enquiryPeriod->startDate)) : null; $tender->enquiry_end = $r->tender->enquiryPeriod ? date("Y-m-d", strtotime($r->tender->enquiryPeriod->endDate)) : null; $tender->award_start = $r->tender->awardPeriod ? date("Y-m-d", strtotime($r->tender->awardPeriod->startDate)) : null; $tender->award_end = $r->tender->awardPeriod ? date("Y-m-d", strtotime($r->tender->awardPeriod->endDate)) : null; $tender->has_enquiries = $r->tender->hasEnquiries; $tender->eligibility_criteria = $r->tender->eligibilityCriteria; $tender->submission_method = count($r->tender->submissionMethod) ? implode(',', $r->tender->submissionMethod) : null; $tender->number_of_tenderers = $r->tender->numberOfTenderers; $tender->update(); if (count($r->tender->tenderers)) { foreach ($r->tender->tenderers as $tn) { $tenderer = Tenderer::firstOrCreate(["rfc" => $tn->identifier->id]); $tenderer->name = $tn->name; $tenderer->street = $tn->address->streetAddress; $tenderer->locality = $tn->address->locality; $tenderer->region = $tn->address->region; $tenderer->zip = $tn->address->postalCode; $tenderer->country = $tn->address->countryName; $tenderer->contact_name = $tn->contactPoint->name; $tenderer->email = $tn->contactPoint->email; $tenderer->phone = $tn->contactPoint->telephone; $tenderer->fax = $tn->contactPoint->faxNumber; $tenderer->url = $tn->contactPoint->url; $tenderer->update(); } } if (count($r->tender->items)) { foreach ($r->tender->items as $it) { $item = $tender->items()->firstOrCreate(['local_id' => $it->id]); $item->quantity = $it->quantity; $item->description = $it->description; $item->unit = $it->unit->name; $item->update(); } } } // create buyer if ($r->buyer) { $buyer = Buyer::firstOrCreate(["local_id" => $r->buyer->identifier->id, "name" => $r->buyer->name]); $buyer->uri = $r->buyer->identifier->uri; $buyer->update(); $release->buyer_id = $buyer->id; $release->update(); } } } } echo ":D"; }
/** * Show view to create a new consumable minimum level * * @return $this */ public function create() { $this->authorize('edit_consumable_minimum_levels'); return view('warehouse.consumables_minimum_levels.create')->with(['suppliers' => Supplier::all()->sortBy('supplier_company_name')]); }
public static function supplier() { $listData = ArrayHelper::map(Supplier::find()->all(), 'id_supplier', 'nama'); return $listData; }
/** * Execute the console command. * * @return mixed */ public function handle() { if ($this->confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) { if ($this->option('soft')) { Accessory::getQuery()->delete(); Asset::getQuery()->delete(); Category::getQuery()->delete(); Company::getQuery()->delete(); Component::getQuery()->delete(); Consumable::getQuery()->delete(); Depreciation::getQuery()->delete(); License::getQuery()->delete(); LicenseSeat::getQuery()->delete(); Location::getQuery()->delete(); Manufacturer::getQuery()->delete(); AssetModel::getQuery()->delete(); Statuslabel::getQuery()->delete(); Supplier::getQuery()->delete(); Group::getQuery()->delete(); DB::statement('delete from accessories_users'); DB::statement('delete from asset_logs'); DB::statement('delete from asset_maintenances'); DB::statement('delete from asset_uploads'); DB::statement('delete from consumables_users'); DB::statement('delete from custom_field_custom_fieldset'); DB::statement('delete from custom_fields'); DB::statement('delete from custom_fieldsets'); DB::statement('delete from components_assets'); DB::statement('delete from password_resets'); DB::statement('delete from requested_assets'); DB::statement('delete from requests'); DB::statement('delete from throttle'); DB::statement('delete from users_groups'); DB::statement('delete from users WHERE id!=1'); } else { \DB::statement('drop table IF EXISTS accessories_users'); \DB::statement('drop table IF EXISTS accessories'); \DB::statement('drop table IF EXISTS asset_logs'); \DB::statement('drop table IF EXISTS asset_maintenances'); \DB::statement('drop table IF EXISTS asset_uploads'); \DB::statement('drop table IF EXISTS assets'); \DB::statement('drop table IF EXISTS categories'); \DB::statement('drop table IF EXISTS companies'); \DB::statement('drop table IF EXISTS consumables_users'); \DB::statement('drop table IF EXISTS consumables'); \DB::statement('drop table IF EXISTS custom_field_custom_fieldset'); \DB::statement('drop table IF EXISTS custom_fields'); \DB::statement('drop table IF EXISTS custom_fieldsets'); \DB::statement('drop table IF EXISTS depreciations'); \DB::statement('drop table IF EXISTS groups'); \DB::statement('drop table IF EXISTS history'); \DB::statement('drop table IF EXISTS components'); \DB::statement('drop table IF EXISTS components_assets'); \DB::statement('drop table IF EXISTS license_seats'); \DB::statement('drop table IF EXISTS licenses'); \DB::statement('drop table IF EXISTS locations'); \DB::statement('drop table IF EXISTS manufacturers'); \DB::statement('drop table IF EXISTS models'); \DB::statement('drop table IF EXISTS migrations'); \DB::statement('drop table IF EXISTS password_resets'); \DB::statement('drop table IF EXISTS requested_assets'); \DB::statement('drop table IF EXISTS requests'); \DB::statement('drop table IF EXISTS settings'); \DB::statement('drop table IF EXISTS status_labels'); \DB::statement('drop table IF EXISTS suppliers'); \DB::statement('drop table IF EXISTS throttle'); \DB::statement('drop table IF EXISTS users_groups'); \DB::statement('drop table IF EXISTS users'); } } }
protected function addControls() { $this->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('name')->caption('Denumire Furnizor')->class('form-control data-source')->controlsource('name')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.comboboxes.combobox')->name('type')->caption('Tip Furnizor De Utilitati')->class('form-control data-source input-group form-select init-on-update-delete')->controlsource('type')->controltype('combobox')->options(\App\Models\Supplier::type_supplier()))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('unit_measurement')->caption('Unitatea De Masura A Energiei')->class('form-control data-source')->controlsource('unit_measurement')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('address')->caption('Adresa')->class('form-control data-source')->controlsource('address')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('locality')->caption('Localitatea')->class('form-control data-source')->controlsource('locality')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('county')->caption('Judetul')->class('form-control data-source')->controlsource('county')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('email')->caption('E-Mail')->class('form-control data-source')->controlsource('email')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('phone')->caption('Telefon')->class('form-control data-source')->controlsource('phone')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('fax')->caption('Fax')->class('form-control data-source')->controlsource('fax')->controltype('textbox')->maxlength(255))->addControl(\Easy\Form\Textbox::make('~layouts.form.controls.textboxes.textbox')->name('contact_person')->caption('Persoana De Contact')->class('form-control data-source')->controlsource('contact_person')->controltype('textbox')->maxlength(255)); }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use app\models\Category; use app\models\Supplier; use app\models\Product; use app\models\Currency; use yii\helpers\ArrayHelper; use zxbodya\yii2\galleryManager\GalleryManager; /* @var $this yii\web\View */ /* @var $model app\models\Product */ /* @var $form yii\widgets\ActiveForm */ $categories = Category::find()->active()->orderBy(['title' => SORT_ASC])->all(); $suppliers = Supplier::find()->active()->orderBy(['name' => SORT_ASC])->all(); $currencies = Currency::labels(); ?> <div class="product-form"> <?php $form = ActiveForm::begin(['enableClientValidation' => false, 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map($categories, 'id', 'title')); ?> <?php echo $form->field($model, 'supplier_id')->dropDownList(ArrayHelper::map($suppliers, 'id', 'name')); ?>
public function getDatatable() { $suppliers = Supplier::select(array('id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact'))->whereNull('deleted_at'); if (Input::has('search')) { $suppliers = $suppliers->TextSearch(e(Input::get('search'))); } if (Input::has('offset')) { $offset = e(Input::get('offset')); } else { $offset = 0; } if (Input::has('limit')) { $limit = e(Input::get('limit')); } else { $limit = 50; } $allowed_columns = ['id', 'name', 'address', 'phone', 'contact', 'fax', 'email']; $order = Input::get('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at'; $suppliers->orderBy($sort, $order); $suppliersCount = $suppliers->count(); $suppliers = $suppliers->skip($offset)->take($limit)->get(); $rows = array(); foreach ($suppliers as $supplier) { $actions = '<a href="' . route('update/supplier', $supplier->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/supplier', $supplier->id) . '" data-content="' . trans('admin/suppliers/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($supplier->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>'; $rows[] = array('id' => $supplier->id, 'name' => (string) link_to('admin/settings/suppliers/' . $supplier->id . '/view', e($supplier->name)), 'contact' => e($supplier->contact), 'address' => e($supplier->address) . ' ' . e($supplier->address2) . ' ' . e($supplier->city) . ' ' . e($supplier->state) . ' ' . e($supplier->country), 'phone' => e($supplier->phone), 'fax' => e($supplier->fax), 'email' => $supplier->email != '' ? '<a href="mailto:' . e($supplier->email) . '">' . e($supplier->email) . '</a>' : '', 'assets' => $supplier->num_assets(), 'licenses' => $supplier->num_licenses(), 'actions' => $actions); } $data = array('total' => $suppliersCount, 'rows' => $rows); return $data; }
public static function getMainSuppliers() { $suppliers = Supplier::where('supplied_by', '>', 0)->get(); $main_supplier_ids = $suppliers->unique('supplied_by')->pluck('supplied_by')->toArray(); return Supplier::find($main_supplier_ids); }