Commit cb27ac84 by Andre Sihombing

Melakukan semua perbaikan

parent 497a1512
......@@ -15,6 +15,7 @@ class ubuxAsset extends AssetBundle{
'js/jquery.plugin.js',
'js/jquery.datepick.js',
'js/jscript.js',
'js/rupiah.js',
];
public $depends = [
......
......@@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use backend\modules\ubux\models\Satpam;
ini_set('max_execution_time', 60);
/**
* JamKerjaController implements the CRUD actions for JamKerja model.
*/
......
......@@ -4,6 +4,7 @@ namespace backend\modules\ubux\controllers;
use Yii;
use backend\modules\ubux\models\Laporan;
use backend\modules\ubux\models\Lembur;
use backend\modules\ubux\models\JamKerja;
use backend\modules\ubux\models\Satpam;
use backend\modules\ubux\models\Gaji;
......@@ -77,12 +78,26 @@ class LaporanController extends Controller
public function actionAdd()
{
$model = new Laporan();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->laporan_id]);
$models = new Lembur();
if ($model->load(Yii::$app->request->post()) && $models->load(Yii::$app->request->post())) {
if ($model->validate()) {
$modelsearch = $model->find()->where(['tahun' => $model->tahun])->andWhere(['bulan' => $model->bulan])->one();
if (isset($modelsearch)) {
\Yii::$app->messenger->addWarningFlash("Laporan Bulan ".$model['bulan']." Sudah Ada");
return $this->redirect(['index']);
}else{
$model->save();
$models->laporan_id = $model->laporan_id;
$models->save();
return $this->redirect(['view', 'id' => $model->laporan_id]);
}
}
} else {
return $this->render('add', [
'model' => $model,
'models' => $models,
]);
}
}
......@@ -96,12 +111,24 @@ class LaporanController extends Controller
public function actionEdit($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->laporan_id]);
$models = Lembur::find()->where(['laporan_id' => $id])->one();
if ($model->load(Yii::$app->request->post()) && $models->load(Yii::$app->request->post())) {
if($model->validate()){
$modelsearch = $model->find()->where(['tahun' => $model->tahun])->andWhere(['bulan' => $model->bulan])->one();
if (isset($modelsearch)) {
\Yii::$app->messenger->addWarningFlash("Laporan ".$model['bulan']. " tahun ".$model['tahun']. " Sudah Ada");
return $this->redirect(['index']);
}else{
$model->save();
$models->save();
return $this->redirect(['view', 'id' => $model->laporan_id]);
}
}
} else {
return $this->render('edit', [
'model' => $model,
'models' => $models,
]);
}
}
......
......@@ -60,7 +60,9 @@ class SatpamController extends Controller
array('model' => $this->findModelLaporan($id), 'gajiModel' => $model)
);
}
protected function findModelLaporan($id)
protected function findModelLaporan($id)
{
if (($model = Laporan::findOne($id)) !== null) {
return $model;
......@@ -137,12 +139,36 @@ class SatpamController extends Controller
public function actionAddGaji($id, $satpam_id)
{
$model = $this->findModel($satpam_id);
$modelCek = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->one();
$models = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->All();
$cek = $modelCek->tanggal;
$jlh=0;
$lembur = Lembur::find()->where(['laporan_id' => $id])->one();
$mod = explode(",", $lembur->tanggal);
$data = array();
foreach ($models as $obj) {
$data[$obj->tanggal] = $obj;
}
foreach($data as $val){
foreach ($mod as $val2) {
if($val->tanggal == $val2){
$jlh++;
}
}
}
if($model->status=='Tetap'){
if($model->total_gaji==NULL){
if ($model->load(Yii::$app->request->post()) && $model->save()) {
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
if ($model->load(Yii::$app->request->post())) {
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
}
}else {
return $this->render('add-gaji', [
'model' => $model,
......@@ -167,7 +193,8 @@ class SatpamController extends Controller
}
if($model->total_gaji==NULL){
if($model->load(Yii::$app->request->post())){
$model->total_gaji *= $jlh;
$model->total_gaji *= $jlh;
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
......@@ -190,11 +217,35 @@ class SatpamController extends Controller
public function actionEditGaji($id, $satpam_id)
{
$model = $this->findModel($satpam_id);
$modelCek = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->one();
$models = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->All();
$cek = $modelCek->tanggal;
$jlh=0;
$lembur = Lembur::find()->where(['laporan_id' => $id])->one();
$mod = explode(",", $lembur->tanggal);
$data = array();
foreach ($models as $obj) {
$data[$obj->tanggal] = $obj;
}
foreach($data as $val){
foreach ($mod as $val2) {
if($val->tanggal == $val2){
$jlh++;
}
}
}
if($model->status=='Tetap'){
if ($model->load(Yii::$app->request->post()) && $model->save()) {
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
}
}else {
return $this->render('add-gaji', [
'model' => $model,
......@@ -214,7 +265,8 @@ class SatpamController extends Controller
}
}
if($model->load(Yii::$app->request->post())){
$model->total_gaji *= $jlh;
$model->total_gaji *= $jlh;
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
......@@ -228,90 +280,4 @@ class SatpamController extends Controller
}
}
}
public function actionAddLembur($id, $satpam_id){
$model = $this->findModel($satpam_id);
$modelCek = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->one();
$models = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->All();
$cek = $modelCek->tanggal;
$jlh=0;
$lembur = Lembur::find()->where(['laporan_id' => $id])->one();
$mod = explode(",", $lembur->tanggal);
$data = array();
foreach ($models as $obj) {
$data[$obj->tanggal] = $obj;
}
foreach($data as $val){
foreach ($mod as $val2) {
if($val->tanggal == $val2){
$jlh++;
}
}
}
if($model->gaji_lembur==NULL){
if($model->load(Yii::$app->request->post())){
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji lembur ".$model['nama']." pada bulan ini berhasil dimasukkan");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
}
}
else{
return $this->render('add-lembur', [
'model' => $model,
]);
}
}else{
\Yii::$app->messenger->addWarningFlash("Gaji lembur ".$model->nama." pada bulan ini sudah ada");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
}
}
public function actionEditLembur($id, $satpam_id){
$model = $this->findModel($satpam_id);
$modelCek = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->one();
$models = JamKerja::find()->where(['laporan_id'=>$id])->andWhere(['satpam_id'=>$satpam_id])->All();
$cek = $modelCek->tanggal;
$jlh=0;
$lembur = Lembur::find()->where(['laporan_id' => $id])->one();
$mod = explode(",", $lembur->tanggal);
$data = array();
foreach ($models as $obj) {
$data[$obj->tanggal] = $obj;
}
foreach($data as $val){
foreach ($mod as $val2) {
if($val->tanggal == $val2){
$jlh++;
}
}
}
if($model->load(Yii::$app->request->post())){
$model->gaji_lembur *= $jlh;
if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji lembur ".$model['nama']." pada bulan ini berhasil diupdate");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
}
}
else{
return $this->render('add-lembur', [
'model' => $model,
]);
}
}
}
<?php
namespace backend\modules\ubux\controllers;
use Yii;
use backend\modules\ubux\models\TanggalLembur;
use backend\modules\ubux\models\search\TanggalLemburSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TanggalLemburController implements the CRUD actions for TanggalLembur model.
*/
class TanggalLemburController extends Controller
{
public function behaviors()
{
return [
//TODO: crud controller actions are bypassed by default, set the appropriate privilege
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all TanggalLembur models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TanggalLemburSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single TanggalLembur model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new TanggalLembur model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new TanggalLembur();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->tanggal_lembur_id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing TanggalLembur model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->tanggal_lembur_id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing TanggalLembur model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->softdelete();
return $this->redirect(['index']);
}
/**
* Finds the TanggalLembur model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return TanggalLembur the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = TanggalLembur::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
......@@ -86,4 +86,18 @@ class Laporan extends \yii\db\ActiveRecord
public function getGaji(){
return $this->hasMany(Gaji::className(),['laporan_id'=>'laporan_id']);
}
public function getCaritahun() {
$yearNow = date("Y");
$yearFrom = $yearNow - 10;
$yearTo = $yearNow;
$arrYears = array();
foreach (range($yearFrom, $yearTo) as $number) {
$arrYears[$number] = $number;
}
$arrYears2 = array_reverse($arrYears, true);
return $arrYears2;
}
}
......@@ -72,7 +72,7 @@ class Lembur extends \yii\db\ActiveRecord
return [
'lembur_id' => 'Lembur ID',
'laporan_id' => 'Laporan ID',
'tanggal' => 'Tanggal',
'tanggal' => 'Tanggal Libur',
'deleted' => 'Deleted',
'deleted_at' => 'Deleted At',
'deleted_by' => 'Deleted By',
......
......@@ -82,7 +82,7 @@ class Satpam extends \yii\db\ActiveRecord
return [
'satpam_id' => 'Satpam ID',
'laporan_id' => 'Laporan ID',
'total_gaji' => 'Total Gaji',
'total_gaji' => 'Gaji Pokok',
'gaji_lembur' => 'Gaji Lembur',
'nip' => 'Nip',
'nama' => 'Nama',
......
......@@ -45,6 +45,7 @@ class LaporanSearch extends Laporan
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
]);
$this->load($params);
......
......@@ -2,7 +2,9 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\modules\ubux\assets\ubuxAsset;
ubuxAsset::register($this);
$uiHelper = \Yii::$app->uiHelper;
/* @var $this yii\web\View */
/* @var $model backend\modules\ubux\models\Laporan */
/* @var $form yii\widgets\ActiveForm */
......@@ -12,29 +14,42 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?php
$thn = date('Y');
foreach(range(2000, $thn) as $i) {
$array[] = $i;
<?php
$tahunSekarang = date("Y");
$tahunAwal = $tahunSekarang - 10;
$tahunAkhir = $tahunSekarang;
$arrayTahun = array();
foreach (range($tahunAwal, $tahunAkhir) as $n) {
$arrayTahun[$n] = $n;
}
?>
$arrayTahun = array_reverse($arrayTahun, true);
?>
<?= $form->field($model, 'bulan')->dropDownlist(
['Januari' => 'Januari', 'Februari' => 'Februari', 'Maret' => 'Maret', 'April' => 'April', 'Mei' => 'Mei', 'Juni' => 'Juni', 'Juli' => 'Juli', 'Agustus' => 'Agustus', 'September' => 'September' , 'Oktober' => 'Oktober', 'November' => 'November', 'Desember' => 'Desember'],
[
'prompt' => 'Pilih Bulan',
'required' => true,
'required' => true,
]
)
?>
<?= $form->field($model, 'tahun')->dropDownList(
$array,
[
<?= $form->field($model, 'tahun')->dropDownList(
$arrayTahun,
[
'prompt' => 'Pilih Tahun',
'required' => true,
]
); ?>
]
); ?>
<?= $form->field($models, 'tanggal')->textarea([
'placeholder' => "Masukkan tanggal-tanggal libur ",
'maxlength' => true,
'id' => 'multidate',
]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Add' : 'Edit', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
......
......@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $this->render('_form', [
'model' => $model,
'models' => $models,
]) ?>
</div>
......@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = 'Edit';
<?= $this->render('_form', [
'model' => $model,
'models' => $models,
]) ?>
</div>
......@@ -15,17 +15,17 @@ $this->params['header'] = 'Laporan';
<div class="laporan-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?php //echo $this->render('_search', ['model' => $searchModel]); ?>
<h2 style="margin-top: 40px"><i class="fa fa-list"> List Laporan</i></h2>
<h2><i class="fa fa-list"> List Laporan</i></h2>
<div class="page-line"></div>
<p>
<?= Html::a('Tambah Bulan', ['add'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Upload File', ['add'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
// 'filterModel' => $searchModel,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
......@@ -42,14 +42,14 @@ $this->params['header'] = 'Laporan';
'update' => function ($url, $model){
return ToolsColumn::renderCustomButton($url, $model, 'Update', 'fa fa-gear');
},
'delete' => function ($url, $model){
return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [
'title' => Yii::t('yii', 'Hapus'),
'data-confirm' => Yii::t('yii', 'Apakah anda ingin menghapus ?'),
'data-method' => 'post',
'data-pjax' => '0',
])."</li>";
},
// 'delete' => function ($url, $model){
// return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [
// 'title' => Yii::t('yii', 'Hapus'),
// 'data-confirm' => Yii::t('yii', 'Apakah anda ingin menghapus ?'),
// 'data-method' => 'post',
// 'data-pjax' => '0',
// ])."</li>";
// },
],
'urlCreator' => function ($action, $model, $key, $index){
......
......@@ -10,33 +10,33 @@ use common\components\ToolsColumn;
/* @var $this yii\web\View */
/* @var $model backend\modules\ubux\models\Laporan */
//$this->title = $model->laporan_id;
// $this->title = $model->laporan_id;
$this->params['breadcrumbs'][] = ['label' => 'Laporans', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->params['header'] = 'Detail Laporan';
?>
<div class="laporan-view">
<h2><i class="fa fa-list"> List Detail </i></
<h2><i class="fa fa-list"> List Detail </i><h2>
<div class="page-line"></div>
<h1><?= Html::encode($this->title) ?></h1>
<?php
$dataProvider = new ArrayDataProvider([
'allModels' => $model,
]);
]);
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'nama',
// 'nama',
[
'attribute' => 'tanggal',
'label' => 'Tanggal',
'filter' => '',
],
'jam',
'jam',
]
]);
]);
?>
......
......@@ -57,8 +57,20 @@ $this->params['header'] = 'Laporan';
['class' => 'yii\grid\SerialColumn'],
'nama',
'status',
'total_gaji',
'gaji_lembur',
[
'attribute' => 'Total Gaji',
'filter' => '',
'value' => function($model){
return "Rp ".number_format($model->total_gaji,2,',','.');
},
],
[
'attribute' => 'Gaji Lembur',
'filter' => '',
'value' => function($model){
return "Rp ".number_format($model->gaji_lembur,2,',','.');
},
],
['class' => 'common\components\ToolsColumn',
'template' => '{view} {update} {total} {lembur} {print} ',// {edit} {cancel}',
......@@ -69,18 +81,18 @@ $this->params['header'] = 'Laporan';
},
'total' => function ($url, $model){
if ($model->total_gaji==null) {
return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji Pokok', 'fa fa-eye');
} else {
return ToolsColumn::renderCustomButton($url, $model, 'Update Gaji Pokok', 'fa fa-eye');
}
},
'lembur' => function ($url, $model){
if ($model->gaji_lembur == null) {
return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji Lembur', 'fa fa-eye');
return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji', 'fa fa-eye');
} else {
return ToolsColumn::renderCustomButton($url, $model, 'Update Gaji Lembur', 'fa fa-eye');
return ToolsColumn::renderCustomButton($url, $model, 'Update Gaji', 'fa fa-eye');
}
},
// 'lembur' => function ($url, $model){
// if ($model->gaji_lembur == null) {
// return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji Lembur', 'fa fa-eye');
// } else {
// return ToolsColumn::renderCustomButton($url, $model, 'Update Gaji Lembur', 'fa fa-eye');
// }
// },
'delete' => function ($url, $model){
return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [
'title' => Yii::t('yii', 'Legitimate'),
......
......@@ -2,19 +2,52 @@
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\widgets\MaskedInputAsset;
use backend\modules\ubux\models\satpam;
MaskedInputAsset::register($this);
?>
<div class="laporan-form">
<?php $form = ActiveForm::begin(); ?>
<?php if ($model->status == 'Harian') { ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'total_gaji')->textInput(
[
'value' => 80000,
'required' => true,
'maxlength' => true,
]); ?>
</div>
</div>
<?php } else {?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'total_gaji')->textInput(
[
'value' => 4000000,
'required' => true,
'maxlength' => true,
]); ?>
</div>
</div>
<?= $form->field($model, 'total_gaji')->textInput(
[
'maxlength' => true,
'placeholder' => "Masukkan Gaji Pokok",
'required' => true,
]); ?>
<?php } ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'gaji_lembur')->textInput(
[
'value' => 50000,
'maxlength' => true,
'placeholder' => "Masukkan Gaji Lembur",
'required' => true,
]); ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Add Gaji', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
......@@ -23,3 +56,34 @@ use yii\widgets\ActiveForm;
<?php ActiveForm::end(); ?>
</div>
<?php
$this->registerJs("
$('#satpam-total_gaji').inputmask('currency', {radixPoint:'.', prefix: 'Rp ', 'autoUnmask' : true, removeMaskOnSubmit: true});
$('#satpam-total_gaji').keypress(function(event){
isNumber(event);
});
$('#satpam-gaji_lembur').inputmask('currency', {radixPoint:'.', prefix: 'Rp ', 'autoUnmask' : true, removeMaskOnSubmit: true});
$('#satpam-gaji_lembur').keypress(function(event){
isNumber(event);
});
function isNumber(event){
var charCode = event.which;
// backspace & delete
if (charCode == 46 || charCode == 8) {
// nothing
}else{
// dot(titik) & space(spasi)
if (charCode === 190 || charCode === 32) {
event.preventDefault();
}
// other than number 0 - 9
if (charCode < 48 || charCode > 57) {
event.preventDefault();
}
}
return true;
}
");
?>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<div class="laporan-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'gaji_lembur')->textInput(
[
'maxlength' => true,
'placeholder' => "Masukkan Gaji Lembur",
'required' => true,
]); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Add Gaji', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
......@@ -15,6 +15,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'laporan_id')->textInput() ?>
<?= $form->field($model, 'total_gaji')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'gaji_lembur')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nip')->textInput(['maxlength' => true]) ?>
......
......@@ -15,12 +15,18 @@ use yii\widgets\ActiveForm;
'method' => 'get',
]); ?>
<?php
$thn = date('Y');
foreach(range(2000, $thn) as $i) {
$array[] = $i;
<?php
$tahunSekarang = date("Y");
$tahunAwal = $tahunSekarang - 10;
$tahunAkhir = $tahunSekarang;
$arrayTahun = array();
foreach (range($tahunAwal, $tahunAkhir) as $n) {
$arrayTahun[$n] = $n;
}
?>
$arrayTahun = array_reverse($arrayTahun, true);
?>
<h2><i class="fa fa-search"> Cari Data Satpam</i></h2>
<div class="page-line"></div>
......@@ -29,23 +35,24 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'bulan') ->dropDownlist(
['Januari' => 'Januari', 'Februari' => 'Februari', 'Maret' => 'Maret', 'April' => 'April', 'Mei' => 'Mei', 'Juni' => 'Juni', 'Juli' => 'Juli', 'Agustus' => 'Agustus', 'September' => 'September' , 'Oktober' => 'Oktober', 'November' => 'November', 'Desember' => 'Desember'],
[
'prompt' => 'Pilih Bulan',
'prompt' => 'All',
'required' => true,
]
)?>
)?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'tahun')->dropDownList(
$array,
[
'prompt' => 'Pilih Tahun',
]
$arrayTahun,
[
'prompt' => 'All',
'required' => true,
]
); ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::submitButton('Cari', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
......
......@@ -15,8 +15,7 @@ $this->params['breadcrumbs'][] = $this->title;
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form-add-lembur', [
'model' => $model,
'model' => $model,
]) ?>
</div>
......@@ -35,16 +35,13 @@ $this->params['header'] = 'Data Satpam Per Bulan dan Tahun';
'buttons' => [
'view' => function ($url, $model){
return ToolsColumn::renderCustomButton($url, $model, 'View Satpam', 'fa fa-eye');
},
},
],
'urlCreator' => function ($action, $model, $key, $index){
if ($action === 'view') {
return Url::toRoute(['view', 'id' => $key]);
}
}
],
],
]); ?>
......
......@@ -20,7 +20,9 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
<div class="satpam-view">
<h1><?= Html::encode($this->title) ?></h1>
<h1><strong><?php echo $model2['bulan']?> <?php echo $model2['tahun']?></strong></h1>
<h2><i class="fa fa-list"> Detail <?php echo $model2['bulan']?> <?php echo "tahun" ?> <?php echo $model2['tahun']?></i></h2>
<div class="page-line"></div>
<?php
$count = 0;
......@@ -28,7 +30,7 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
foreach ($gajiModel as $obj) {
$data[$obj->satpam_id] = $obj;
}
foreach ($data as $key) {
$count++;
}
......@@ -44,9 +46,6 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
'nama',
'nip',
'status',
],
]);
// echo "<br>" . $count;
......
......@@ -129,8 +129,8 @@ $this->beginPage();
<?php
MenuRenderer::renderSidebarMenu(\Yii::$app->params['sidebarMenu']);
?>
<li><a href="/cis-lite/backend/web/index.php/ubux/laporan"><i class="fa fa-circle-o text-red"></i> <span>Laporan Satpam</span></a></li>
<li><a href="/cis-lite/backend/web/index.php/ubux/satpam"><i class="fa fa-circle-o text-red"></i> <span>Data Satpam</span></a></li>
<li><a href="/copy/backend/web/index.php/ubux/laporan"><i class="fa fa-circle-o text-red"></i> <span>Laporan Satpam</span></a></li>
<li><a href="/copy/backend/web/index.php/ubux/satpam"><i class="fa fa-circle-o text-red"></i> <span>Data Satpam</span></a></li>
<!-- <li class="header">LABELS</li>
<li><a href="#"><i class="fa fa-circle-o text-red"></i> <span>Important</span></a></li>
<li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>Warning</span></a></li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment