Commit cb27ac84 by Andre Sihombing

Melakukan semua perbaikan

parent 497a1512
...@@ -15,6 +15,7 @@ class ubuxAsset extends AssetBundle{ ...@@ -15,6 +15,7 @@ class ubuxAsset extends AssetBundle{
'js/jquery.plugin.js', 'js/jquery.plugin.js',
'js/jquery.datepick.js', 'js/jquery.datepick.js',
'js/jscript.js', 'js/jscript.js',
'js/rupiah.js',
]; ];
public $depends = [ public $depends = [
......
...@@ -10,6 +10,7 @@ use yii\web\Controller; ...@@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use backend\modules\ubux\models\Satpam; use backend\modules\ubux\models\Satpam;
ini_set('max_execution_time', 60);
/** /**
* JamKerjaController implements the CRUD actions for JamKerja model. * JamKerjaController implements the CRUD actions for JamKerja model.
*/ */
......
...@@ -4,6 +4,7 @@ namespace backend\modules\ubux\controllers; ...@@ -4,6 +4,7 @@ namespace backend\modules\ubux\controllers;
use Yii; use Yii;
use backend\modules\ubux\models\Laporan; use backend\modules\ubux\models\Laporan;
use backend\modules\ubux\models\Lembur;
use backend\modules\ubux\models\JamKerja; use backend\modules\ubux\models\JamKerja;
use backend\modules\ubux\models\Satpam; use backend\modules\ubux\models\Satpam;
use backend\modules\ubux\models\Gaji; use backend\modules\ubux\models\Gaji;
...@@ -77,12 +78,26 @@ class LaporanController extends Controller ...@@ -77,12 +78,26 @@ class LaporanController extends Controller
public function actionAdd() public function actionAdd()
{ {
$model = new Laporan(); $model = new Laporan();
$models = new Lembur();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->laporan_id]); 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 { } else {
return $this->render('add', [ return $this->render('add', [
'model' => $model, 'model' => $model,
'models' => $models,
]); ]);
} }
} }
...@@ -96,12 +111,24 @@ class LaporanController extends Controller ...@@ -96,12 +111,24 @@ class LaporanController extends Controller
public function actionEdit($id) public function actionEdit($id)
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
$models = Lembur::find()->where(['laporan_id' => $id])->one();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->laporan_id]); 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 { } else {
return $this->render('edit', [ return $this->render('edit', [
'model' => $model, 'model' => $model,
'models' => $models,
]); ]);
} }
} }
......
...@@ -60,7 +60,9 @@ class SatpamController extends Controller ...@@ -60,7 +60,9 @@ class SatpamController extends Controller
array('model' => $this->findModelLaporan($id), 'gajiModel' => $model) array('model' => $this->findModelLaporan($id), 'gajiModel' => $model)
); );
} }
protected function findModelLaporan($id)
protected function findModelLaporan($id)
{ {
if (($model = Laporan::findOne($id)) !== null) { if (($model = Laporan::findOne($id)) !== null) {
return $model; return $model;
...@@ -137,12 +139,36 @@ class SatpamController extends Controller ...@@ -137,12 +139,36 @@ class SatpamController extends Controller
public function actionAddGaji($id, $satpam_id) public function actionAddGaji($id, $satpam_id)
{ {
$model = $this->findModel($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->status=='Tetap'){
if($model->total_gaji==NULL){ if($model->total_gaji==NULL){
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post())) {
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan"); $model->gaji_lembur *= $jlh;
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]); 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 { }else {
return $this->render('add-gaji', [ return $this->render('add-gaji', [
'model' => $model, 'model' => $model,
...@@ -167,7 +193,8 @@ class SatpamController extends Controller ...@@ -167,7 +193,8 @@ class SatpamController extends Controller
} }
if($model->total_gaji==NULL){ if($model->total_gaji==NULL){
if($model->load(Yii::$app->request->post())){ if($model->load(Yii::$app->request->post())){
$model->total_gaji *= $jlh; $model->total_gaji *= $jlh;
$model->gaji_lembur *= $jlh;
if($model->save(false)){ if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan"); \Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil dimasukkan");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]); return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
...@@ -190,11 +217,35 @@ class SatpamController extends Controller ...@@ -190,11 +217,35 @@ class SatpamController extends Controller
public function actionEditGaji($id, $satpam_id) public function actionEditGaji($id, $satpam_id)
{ {
$model = $this->findModel($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->status=='Tetap'){
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate"); $model->gaji_lembur *= $jlh;
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]); 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 { }else {
return $this->render('add-gaji', [ return $this->render('add-gaji', [
'model' => $model, 'model' => $model,
...@@ -214,7 +265,8 @@ class SatpamController extends Controller ...@@ -214,7 +265,8 @@ class SatpamController extends Controller
} }
} }
if($model->load(Yii::$app->request->post())){ if($model->load(Yii::$app->request->post())){
$model->total_gaji *= $jlh; $model->total_gaji *= $jlh;
$model->gaji_lembur *= $jlh;
if($model->save(false)){ if($model->save(false)){
\Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate"); \Yii::$app->messenger->addSuccessFlash("Gaji ".$model['nama']." pada bulan ini berhasil diupdate");
return $this->redirect(['laporan/view', 'id' => $model->laporan_id]); return $this->redirect(['laporan/view', 'id' => $model->laporan_id]);
...@@ -228,90 +280,4 @@ class SatpamController extends Controller ...@@ -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 ...@@ -86,4 +86,18 @@ class Laporan extends \yii\db\ActiveRecord
public function getGaji(){ public function getGaji(){
return $this->hasMany(Gaji::className(),['laporan_id'=>'laporan_id']); 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 ...@@ -72,7 +72,7 @@ class Lembur extends \yii\db\ActiveRecord
return [ return [
'lembur_id' => 'Lembur ID', 'lembur_id' => 'Lembur ID',
'laporan_id' => 'Laporan ID', 'laporan_id' => 'Laporan ID',
'tanggal' => 'Tanggal', 'tanggal' => 'Tanggal Libur',
'deleted' => 'Deleted', 'deleted' => 'Deleted',
'deleted_at' => 'Deleted At', 'deleted_at' => 'Deleted At',
'deleted_by' => 'Deleted By', 'deleted_by' => 'Deleted By',
......
...@@ -82,7 +82,7 @@ class Satpam extends \yii\db\ActiveRecord ...@@ -82,7 +82,7 @@ class Satpam extends \yii\db\ActiveRecord
return [ return [
'satpam_id' => 'Satpam ID', 'satpam_id' => 'Satpam ID',
'laporan_id' => 'Laporan ID', 'laporan_id' => 'Laporan ID',
'total_gaji' => 'Total Gaji', 'total_gaji' => 'Gaji Pokok',
'gaji_lembur' => 'Gaji Lembur', 'gaji_lembur' => 'Gaji Lembur',
'nip' => 'Nip', 'nip' => 'Nip',
'nama' => 'Nama', 'nama' => 'Nama',
......
...@@ -45,6 +45,7 @@ class LaporanSearch extends Laporan ...@@ -45,6 +45,7 @@ class LaporanSearch extends Laporan
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => $query, 'query' => $query,
'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
]); ]);
$this->load($params); $this->load($params);
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use backend\modules\ubux\assets\ubuxAsset;
ubuxAsset::register($this);
$uiHelper = \Yii::$app->uiHelper;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model backend\modules\ubux\models\Laporan */ /* @var $model backend\modules\ubux\models\Laporan */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
...@@ -12,29 +14,42 @@ use yii\widgets\ActiveForm; ...@@ -12,29 +14,42 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?php <?php
$thn = date('Y'); $tahunSekarang = date("Y");
foreach(range(2000, $thn) as $i) { $tahunAwal = $tahunSekarang - 10;
$array[] = $i; $tahunAkhir = $tahunSekarang;
$arrayTahun = array();
foreach (range($tahunAwal, $tahunAkhir) as $n) {
$arrayTahun[$n] = $n;
} }
?>
$arrayTahun = array_reverse($arrayTahun, true);
?>
<?= $form->field($model, 'bulan')->dropDownlist( <?= $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'], ['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' => 'Pilih Bulan',
'required' => true, 'required' => true,
] ]
) )
?> ?>
<?= $form->field($model, 'tahun')->dropDownList( <?= $form->field($model, 'tahun')->dropDownList(
$array, $arrayTahun,
[ [
'prompt' => 'Pilih Tahun', 'prompt' => 'Pilih Tahun',
'required' => true, 'required' => true,
] ]
); ?> ); ?>
<?= $form->field($models, 'tanggal')->textarea([
'placeholder' => "Masukkan tanggal-tanggal libur ",
'maxlength' => true,
'id' => 'multidate',
]) ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Add' : 'Edit', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton($model->isNewRecord ? 'Add' : 'Edit', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
......
...@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'models' => $models,
]) ?> ]) ?>
</div> </div>
...@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = 'Edit'; ...@@ -16,6 +16,7 @@ $this->params['breadcrumbs'][] = 'Edit';
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'models' => $models,
]) ?> ]) ?>
</div> </div>
...@@ -15,17 +15,17 @@ $this->params['header'] = 'Laporan'; ...@@ -15,17 +15,17 @@ $this->params['header'] = 'Laporan';
<div class="laporan-index"> <div class="laporan-index">
<h1><?= Html::encode($this->title) ?></h1> <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> <div class="page-line"></div>
<p> <p>
<?= Html::a('Tambah Bulan', ['add'], ['class' => 'btn btn-success']) ?> <?= Html::a('Upload File', ['add'], ['class' => 'btn btn-success']) ?>
</p> </p>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
// 'filterModel' => $searchModel, 'filterModel' => $searchModel,
'columns' => [ 'columns' => [
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
...@@ -42,14 +42,14 @@ $this->params['header'] = 'Laporan'; ...@@ -42,14 +42,14 @@ $this->params['header'] = 'Laporan';
'update' => function ($url, $model){ 'update' => function ($url, $model){
return ToolsColumn::renderCustomButton($url, $model, 'Update', 'fa fa-gear'); return ToolsColumn::renderCustomButton($url, $model, 'Update', 'fa fa-gear');
}, },
'delete' => function ($url, $model){ // 'delete' => function ($url, $model){
return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [ // return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [
'title' => Yii::t('yii', 'Hapus'), // 'title' => Yii::t('yii', 'Hapus'),
'data-confirm' => Yii::t('yii', 'Apakah anda ingin menghapus ?'), // 'data-confirm' => Yii::t('yii', 'Apakah anda ingin menghapus ?'),
'data-method' => 'post', // 'data-method' => 'post',
'data-pjax' => '0', // 'data-pjax' => '0',
])."</li>"; // ])."</li>";
}, // },
], ],
'urlCreator' => function ($action, $model, $key, $index){ 'urlCreator' => function ($action, $model, $key, $index){
......
...@@ -10,33 +10,33 @@ use common\components\ToolsColumn; ...@@ -10,33 +10,33 @@ use common\components\ToolsColumn;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model backend\modules\ubux\models\Laporan */ /* @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'][] = ['label' => 'Laporans', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
$this->params['header'] = 'Detail Laporan'; $this->params['header'] = 'Detail Laporan';
?> ?>
<div class="laporan-view"> <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> <div class="page-line"></div>
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?php <?php
$dataProvider = new ArrayDataProvider([ $dataProvider = new ArrayDataProvider([
'allModels' => $model, 'allModels' => $model,
]); ]);
echo GridView::widget([ echo GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'columns' => [ 'columns' => [
'nama', // 'nama',
[ [
'attribute' => 'tanggal', 'attribute' => 'tanggal',
'label' => 'Tanggal', 'label' => 'Tanggal',
'filter' => '', 'filter' => '',
], ],
'jam', 'jam',
] ]
]); ]);
?> ?>
......
...@@ -57,8 +57,20 @@ $this->params['header'] = 'Laporan'; ...@@ -57,8 +57,20 @@ $this->params['header'] = 'Laporan';
['class' => 'yii\grid\SerialColumn'], ['class' => 'yii\grid\SerialColumn'],
'nama', 'nama',
'status', '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', ['class' => 'common\components\ToolsColumn',
'template' => '{view} {update} {total} {lembur} {print} ',// {edit} {cancel}', 'template' => '{view} {update} {total} {lembur} {print} ',// {edit} {cancel}',
...@@ -69,18 +81,18 @@ $this->params['header'] = 'Laporan'; ...@@ -69,18 +81,18 @@ $this->params['header'] = 'Laporan';
}, },
'total' => function ($url, $model){ 'total' => function ($url, $model){
if ($model->total_gaji==null) { if ($model->total_gaji==null) {
return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji Pokok', 'fa fa-eye'); return ToolsColumn::renderCustomButton($url, $model, 'Add Gaji', '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');
} else { } 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){ 'delete' => function ($url, $model){
return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [ return "<li>".Html::a('<span class="fa fa-trash"></span> Hapus', $url, [
'title' => Yii::t('yii', 'Legitimate'), 'title' => Yii::t('yii', 'Legitimate'),
......
...@@ -2,19 +2,52 @@ ...@@ -2,19 +2,52 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\widgets\MaskedInputAsset;
use backend\modules\ubux\models\satpam;
MaskedInputAsset::register($this);
?> ?>
<div class="laporan-form"> <div class="laporan-form">
<?php $form = ActiveForm::begin(); ?> <?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( <?php } ?>
[
'maxlength' => true, <div class="row">
'placeholder' => "Masukkan Gaji Pokok", <div class="col-md-6">
'required' => true, <?= $form->field($model, 'gaji_lembur')->textInput(
]); ?> [
'value' => 50000,
'maxlength' => true,
'placeholder' => "Masukkan Gaji Lembur",
'required' => true,
]); ?>
</div>
</div>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Add Gaji', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Add Gaji', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
...@@ -23,3 +56,34 @@ use yii\widgets\ActiveForm; ...@@ -23,3 +56,34 @@ use yii\widgets\ActiveForm;
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </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; ...@@ -15,6 +15,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'laporan_id')->textInput() ?> <?= $form->field($model, 'laporan_id')->textInput() ?>
<?= $form->field($model, 'total_gaji')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'total_gaji')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'gaji_lembur')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'nip')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'nip')->textInput(['maxlength' => true]) ?>
......
...@@ -15,12 +15,18 @@ use yii\widgets\ActiveForm; ...@@ -15,12 +15,18 @@ use yii\widgets\ActiveForm;
'method' => 'get', 'method' => 'get',
]); ?> ]); ?>
<?php <?php
$thn = date('Y'); $tahunSekarang = date("Y");
foreach(range(2000, $thn) as $i) { $tahunAwal = $tahunSekarang - 10;
$array[] = $i; $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> <h2><i class="fa fa-search"> Cari Data Satpam</i></h2>
<div class="page-line"></div> <div class="page-line"></div>
...@@ -29,23 +35,24 @@ use yii\widgets\ActiveForm; ...@@ -29,23 +35,24 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'bulan') ->dropDownlist( <?= $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'], ['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>
<div class="col-md-4"> <div class="col-md-4">
<?= $form->field($model, 'tahun')->dropDownList( <?= $form->field($model, 'tahun')->dropDownList(
$array, $arrayTahun,
[ [
'prompt' => 'Pilih Tahun', 'prompt' => 'All',
] 'required' => true,
]
); ?> ); ?>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> <?= Html::submitButton('Cari', ['class' => 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
......
...@@ -15,8 +15,7 @@ $this->params['breadcrumbs'][] = $this->title; ...@@ -15,8 +15,7 @@ $this->params['breadcrumbs'][] = $this->title;
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form-add-lembur', [ <?= $this->render('_form-add-lembur', [
'model' => $model, 'model' => $model,
]) ?> ]) ?>
</div> </div>
...@@ -35,16 +35,13 @@ $this->params['header'] = 'Data Satpam Per Bulan dan Tahun'; ...@@ -35,16 +35,13 @@ $this->params['header'] = 'Data Satpam Per Bulan dan Tahun';
'buttons' => [ 'buttons' => [
'view' => function ($url, $model){ 'view' => function ($url, $model){
return ToolsColumn::renderCustomButton($url, $model, 'View Satpam', 'fa fa-eye'); return ToolsColumn::renderCustomButton($url, $model, 'View Satpam', 'fa fa-eye');
}, },
], ],
'urlCreator' => function ($action, $model, $key, $index){ 'urlCreator' => function ($action, $model, $key, $index){
if ($action === 'view') { if ($action === 'view') {
return Url::toRoute(['view', 'id' => $key]); return Url::toRoute(['view', 'id' => $key]);
} }
} }
], ],
], ],
]); ?> ]); ?>
......
...@@ -20,7 +20,9 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one(); ...@@ -20,7 +20,9 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
<div class="satpam-view"> <div class="satpam-view">
<h1><?= Html::encode($this->title) ?></h1> <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 <?php
$count = 0; $count = 0;
...@@ -28,7 +30,7 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one(); ...@@ -28,7 +30,7 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
foreach ($gajiModel as $obj) { foreach ($gajiModel as $obj) {
$data[$obj->satpam_id] = $obj; $data[$obj->satpam_id] = $obj;
} }
foreach ($data as $key) { foreach ($data as $key) {
$count++; $count++;
} }
...@@ -44,9 +46,6 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one(); ...@@ -44,9 +46,6 @@ $model2 = Laporan::find()->where(['laporan_id' => $id])->one();
'nama', 'nama',
'nip', 'nip',
'status', 'status',
], ],
]); ]);
// echo "<br>" . $count; // echo "<br>" . $count;
......
...@@ -129,8 +129,8 @@ $this->beginPage(); ...@@ -129,8 +129,8 @@ $this->beginPage();
<?php <?php
MenuRenderer::renderSidebarMenu(\Yii::$app->params['sidebarMenu']); 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="/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="/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/satpam"><i class="fa fa-circle-o text-red"></i> <span>Data Satpam</span></a></li>
<!-- <li class="header">LABELS</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-red"></i> <span>Important</span></a></li>
<li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>Warning</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