public function GenerarLiquidacion($legajos, $anio, $mes, $user_id, $tipo = null) { DB::transaction(function () use($legajos, $mes, $anio, $user_id, $tipo) { if (!is_null($tipo)) { Liquidacion::where('mes', $mes)->where('año', $anio)->where('tipo', $tipo)->delete(); } else { Liquidacion::where('mes', $mes)->where('año', $anio)->delete(); } $this->IniciarLiquidacion($mes, $anio, $user_id, $tipo); $empleados = Employees::DelLegajo($legajos)->get(); if ($empleados->isEmpty()) { Flash::error('employees not found'); return redirect(route('employees.index')); } $reciboDel = Recibo::DelPeriodo($mes, $anio)->DelLegajo($legajos)->DelTipo($tipo)->get(); if (!$reciboDel->isEmpty()) { foreach ($reciboDel as $recibo) { foreach ($recibo->conceptos as $concepto) { ConceptosenRecibos::find($concepto->id)->delete(); } Recibo::find($recibo->id)->delete(); } } foreach ($empleados as $empleado) { $this->liquidar_empleado($mes, $anio, $empleado, $tipo); } $this->CerrarLiquidacion($legajos, $mes, $anio, $empleados); }); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $user = \Auth::user(); $userRole = $user->hasRole('user'); $editorRole = $user->hasRole('editor'); $adminRole = $user->hasRole('administrator'); if ($userRole) { $access = 'User'; } elseif ($editorRole) { $access = 'Editor'; } elseif ($adminRole) { $access = 'Administrator'; } $today = Carbon::today(); $año = $today->year; // int(2012) $mes = $today->month; $Activos = Employees::Activos()->count(); $Bajas = EstadosRevista::BajasDelMes($año, $mes)->count(); $AltasNuevas = Employees::Activos()->get()->sortBy('Fecha_Ingreso')->forPage(1, 8); $Liquidaciones = Liquidacion::where('año', $año)->where('mes', '<=', 12)->whereNull('deleted_at')->orderBy('mes')->get(); $UltimaLiquidacion = Liquidacion::where('año', $año)->where('mes', '<=', 12)->whereNull('deleted_at')->orderBy('mes', 'desc')->first(); $AnteUltimaLiquidacion = Liquidacion::where('año', $año)->where('mes', '<=', $UltimaLiquidacion->mes)->whereNull('deleted_at')->orderBy('mes', 'desc')->first(); $Meses = $Liquidaciones->sortByDesc('mes')->lists('mes'); $Reten = $Liquidaciones->sortByDesc('mes')->lists('total_retenciones')->toArray(); $Debes = $Liquidaciones->sortByDesc('mes')->lists('total_debes')->toArray(); setlocale(LC_TIME, 'Spanish'); $MesesEsp = []; foreach ($Meses as $MesEsp) { $MesesEsp = array_prepend($MesesEsp, '"' . Carbon::createFromDate($año, $MesEsp, 1)->formatLocalized('%B') . '"'); } return view('admin.pages.user-home', compact('Activos', 'Bajas', 'AltasNuevas', 'Liquidaciones', 'UltimaLiquidacion', 'AnteUltimaLiquidacion', 'MesesEsp', 'Debes', 'Reten'))->withUser($user)->withAccess($access); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Employees::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' => $this->id, 'sex' => $this->sex, 'birthdate' => $this->birthdate, 'tumbon' => $this->tumbon, 'ampur' => $this->ampur, 'chw' => $this->chw, 'department_id' => $this->department_id, 'comein' => $this->comein, 'status' => $this->status]); $query->andFilterWhere(['like', 'cid', $this->cid])->andFilterWhere(['like', 'pname', $this->pname])->andFilterWhere(['like', 'fname', $this->fname])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'education', $this->education])->andFilterWhere(['like', 'ability', $this->ability])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'avatar', $this->avatar]); return $dataProvider; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(CreateConceptoFijoRequest $request) { $input = $request->all(); $empleados = $request->input('employees_id'); if ($empleados == 'TODOS') { $empleados == Employees::Activos()->lists('id'); } DB::transaction(function () use($empleados, $input) { foreach ($empleados as $empleado) { $input = array_set($input, 'employees_id', $empleado); $concetofijo = $this->conceptofijoRepository->create($input); } }); Flash::message('Concepto asociado correctamente', 'success', 0, 'Asociación Exitosa'); return redirect(route('conceptos.asignacion.index')); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Employees::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->where('employee_status=\'Y\''); $query->andFilterWhere(['employee_id' => $this->employee_id]); $query->orFilterWhere(['like', 'employee_title', $this->employee_name]); $query->orFilterWhere(['like', 'employee_code', $this->employee_name]); $query->orFilterWhere(['like', 'employee_name', $this->employee_name]); $query->andFilterWhere(['like', 'employee_status', $this->employee_status]); return $dataProvider; }
public function data($todos) { if ($todos == 'ACTIVOS') { $Employees = Employees::Activos()->get(array('id', 'nombre', 'cuil', 'fecha_ingreso', 'categoria', 'subcategoria', 'tipo_documento', 'numero_documento', 'basico', 'activo', 'estado')); } else { if ($todos == 'TODOS') { $Employees = Employees::get(array('id', 'nombre', 'cuil', 'fecha_ingreso', 'categoria', 'subcategoria', 'tipo_documento', 'numero_documento', 'basico', 'activo', 'estado')); } else { $Employees = Employees::DelLegajo($todos)->get(array('id', 'nombre', 'cuil', 'fecha_ingreso', 'categoria', 'subcategoria', 'tipo_documento', 'numero_documento', 'basico', 'activo', 'estado')); } } return Datatables::of($Employees)->edit_column('categoria', '{{ \\App\\Models\\Category::find($categoria)->category }}')->edit_column('subcategoria', '{{\\App\\Models\\Specialty::find($subcategoria)->specialty }}')->edit_column('tipo_documento', '{{ \\App\\Models\\comboOption::find($tipo_documento)->description }}')->edit_column('activo', function ($Employee) { if ($Employee->activo == true) { return "<span class='label label-success'>ACTIVO</span>"; } else { return "<span class='label label-danger'>BAJA</span>"; } })->add_column('actions', ' <div class="btn-group" align="center"> <a href="{{{ URL::to(\'employees/\' . $id . \'/edit\' ) }}}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i>Edit </a> </div> ')->make(true); }
/** * Updates an existing Transactions model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post())) { $data = Yii::$app->request->post(); $_tanggal = explode("/", $data["Transactions"]["trans_date"]); $transaction_date = $_tanggal[2] . '-' . $_tanggal[1] . '-' . $_tanggal[0]; $transaction_id = $id; // HEADER if (sizeof($data["item"]["code"]) > 0) { $transaction_id = $this->_saveHeader('update', $id, $transaction_date, $data["Transactions"]["trans_employee"], array_sum($data["item"]["price"])); $this->_deleteDetail($id); for ($i = 0; $i < sizeof($data["item"]["code"]); $i++) { $transactions = $this->_saveDetail($id, $data["item"]["code"][$i], $data["item"]["qty"][$i], $data["item"]["price"][$i]); } } Yii::$app->session->setFlash('success', 'Transaksi berhasil disimpan'); return $this->redirect(['index']); } else { $employee = Employees::find()->one(); $q = \Yii::$app->db; $rowsDetail = $q->createCommand("SELECT * FROM vtransdetail_init WHERE trans_id='" . $id . "'")->queryAll(); return $this->render('update', ['transid' => $model->trans_id, 'model' => $model, 'rows' => $rowsDetail]); } }
<table class="table" style="font-size:15pt; "> <thead> <tr> <td>#</td> <td><strong>คำนำหน้า</strong></td> <td><strong>ชื่อ</strong></td> <td><strong>สกุล</strong></td> <td><strong>ฝ่าย/แผนก</strong></td> </tr> </thead> <tbody> <?php $no = 1; ?> <?php foreach (Employees::find()->where(['id' => $model->id])->all() as $row) { ?> <tr> <td><?php echo $no++; ?> </td> <td style="text-align:left"><?php echo $row->pname; ?> </td> <td style="text-align:left"><?php echo $row->fname; ?> </td>
/** * Finds the Employees model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Employees the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Employees::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getTransEmployee() { return $this->hasOne(Employees::className(), ['employee_id' => 'trans_employee']); }
/** * @return \yii\db\ActiveQuery */ public function getCExpert() { return $this->hasOne(Employees::className(), ['Employ_id' => 'C_Expert']); }
public function actionReport($id) { // get your HTML raw content without any layouts or scripts $model = Employees::find()->where(['id' => $id])->one(); $content = $this->renderPartial('_reportView', ['model' => $model]); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
/* @var $this yii\web\View */ /* @var $model app\models\Transactions */ /* @var $form yii\widgets\ActiveForm */ $form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => '{label}<div class="col-sm-10">{input}<div class="help-block">{error}</div></div>', 'labelOptions' => ['class' => 'col-sm-2 control-label']]]); ?> <?php $model->trans_id = $transid; ?> <div class="box-body"> <div class="row"> <div class="col-md-6"> <div class="form-group required"> <label class="col-sm-3 control-label required" for="transactions-trans_employee">Nama Karyawan</label> <div class="col-sm-9"> <?php $employees = Employees::find()->all(); ?> <select id="transactions-trans_employee" class="form-control select2" name="Transactions[trans_employee]"> <option value="">Pilih Karyawan</option> <?php foreach ($employees as $e) { ?> <option value="<?php echo $e->employee_id; ?> " <?php echo $e->employee_id == $model->trans_employee ? 'selected="selected"' : ''; ?> > <?php $name = '';
/** * Show the form for creating a new User * * @return \Illuminate\Http\Response */ public function create() { $Legajos = Employees::Activos()->where('email', '<>', '')->selectRaw('CONCAT(id, "-", nombre) as empleado, id')->lists('empleado', 'id')->prepend('', ''); return view('admin.pages.create-user', compact('Legajos')); }
public function updateEmployee(Request $request, $id) { $input = $request->all(); $data = Employees::updateEmployee($id, $input); return response()->json($data); }