Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Financial #19

Merged
merged 66 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
bd02774
DB initialization 1
jhaniot Nov 15, 2017
f327377
Initial Database Migration
jhaniot Nov 16, 2017
1b5e233
Init Finance DB - contraints addition
jhaniot Nov 16, 2017
84f4378
Init Finance DB - change in invoice/expenditures fk relations
jhaniot Nov 16, 2017
dfa6e05
Database percentage check correction
jhaniot Nov 17, 2017
87de4c7
Init Finance DB - suppl_id fk in expenditues
jhaniot Nov 17, 2017
27c3981
CRUD KAE + Supplier
jhaniot Nov 17, 2017
28358fd
Suppliers + KAE + KAECredit + TaxOffice
jhaniot Nov 20, 2017
0ffd1c6
DB changes in Invoice table
jhaniot Nov 21, 2017
4aed1fd
UI changes
jhaniot Nov 21, 2017
770e018
Changes in DB/UI, Collapse Panel etc
jhaniot Nov 21, 2017
4b428d7
Check working year - db improvements
jhaniot Nov 22, 2017
847bedc
Start of KAE credits section
jhaniot Nov 22, 2017
817d427
KAE credits
jhaniot Nov 23, 2017
6ea6c94
Weekendgit status!
jhaniot Nov 24, 2017
9d8c0ff
Withdrawlals
jhaniot Nov 27, 2017
e6bbd62
Year & Kae Credits
jhaniot Nov 28, 2017
d04469f
Make year currently working
jhaniot Nov 29, 2017
65d0bad
Integrity, FinanceKae...
jhaniot Nov 29, 2017
e63cd66
Minor Changes in Integrity class
jhaniot Nov 29, 2017
72808e4
Credits integrity constraints
jhaniot Nov 30, 2017
535a819
Modifications in KaeYear, KaeCredits and addition of finance_kaecredi…
jhaniot Nov 30, 2017
8c9f738
Minor changes
jhaniot Nov 30, 2017
6746806
Kae credits percentages
jhaniot Dec 1, 2017
b962119
Percentages (cont.)
jhaniot Dec 4, 2017
04761cc
Credit Percentages completion
jhaniot Dec 5, 2017
761e48a
Minor Changes (breadcrumbs, actioncolumn etc)
jhaniot Dec 5, 2017
83f5648
Internationalization
jhaniot Dec 6, 2017
92ed672
Translation cont.
jhaniot Dec 7, 2017
271a597
Internationalization
jhaniot Dec 8, 2017
9734e3d
Withdrawals
jhaniot Dec 11, 2017
8159fb3
Kae Withdrawals
jhaniot Dec 12, 2017
1b092a7
Minor literal changes
jhaniot Dec 12, 2017
960236b
Access control
jhaniot Dec 14, 2017
a9aed18
Access control (addmap migrations return back)
jhaniot Dec 14, 2017
9bf7ab1
UI tidy up
jhaniot Dec 15, 2017
71e3ab9
CRUD changes
jhaniot Dec 18, 2017
d7a9ce4
Expenditure States
jhaniot Dec 19, 2017
3b39a49
VAT options
jhaniot Dec 20, 2017
aa5ce88
Deductions init
jhaniot Jan 4, 2018
3cc505c
Deductions complete
jhaniot Jan 5, 2018
2622336
Create expenditures
jhaniot Jan 9, 2018
e8c6d8e
Database change to allow multiple withdrwals connection on an expendi…
jhaniot Jan 9, 2018
82f3450
Expenditures cont.
jhaniot Jan 10, 2018
06fe1a4
Expenditures cont. 11/01/2018
jhaniot Jan 11, 2018
f9eb29f
Expenditures cont. 3
jhaniot Jan 12, 2018
1e9fc39
Bootstrap Modal
jhaniot Jan 16, 2018
e233abf
Bootstrap Modal
jhaniot Jan 16, 2018
3b6d456
State forward/backward + expenditure deletion
jhaniot Jan 16, 2018
43665b7
Deductions in expenditures
jhaniot Jan 16, 2018
a41ac5c
Finance Deductions and Invoices (init.)
jhaniot Jan 17, 2018
73330ae
Invoices init.
jhaniot Jan 18, 2018
0a1f95d
Invoices cont. 2
jhaniot Jan 19, 2018
499e9b2
Tidy up
jhaniot Jan 22, 2018
85a5f64
Corrections
jhaniot Jan 23, 2018
4b1a938
Currency Format
jhaniot Jan 25, 2018
051899e
Deductions changes, Widthdrawals UI etc.
jhaniot Jan 26, 2018
bd76eb8
Improvements 29012018
jhaniot Jan 29, 2018
ce2e1b3
Improvements & Expenditure Report
jhaniot Jan 30, 2018
2f235fc
Payment report
jhaniot Jan 31, 2018
ced23c7
Info panel chart
jhaniot Jan 31, 2018
b515c5a
Roles
jhaniot Feb 1, 2018
eac3419
Chart + Update of exp states
jhaniot Feb 2, 2018
83c75f8
Search fix
jhaniot Feb 5, 2018
dcc1cad
Expenditures Search & Chart improvements
jhaniot Feb 6, 2018
831c471
Merge branch 'develop' into Financial
jhaniot Feb 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Kae credits percentages
  • Loading branch information
jhaniot committed Dec 1, 2017
commit 6746806e58ca5b569e0712aace52d774b34e23e8
5 changes: 2 additions & 3 deletions yii2/modules/finance/components/FinanceInitialChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ public function beforeAction($action)

if(!($workingYear = Integrity::uniqueCurrentYear()))
{
Yii::$app->session->setFlash('info', "Σφάλμα στον ορισμό του οικονομικού έτους στο οποίο εργάζεστε. Ελέγξτε αν έχετε ορίσει έτος στο οποίο εργάζεστε ή επικοινωνήστε με το διαχειριστή.");
if(!(Yii::$app->controller->id == 'finance-year'))
Yii::$app->response->redirect(['/finance/finance-year']);

Yii::$app->session->setFlash('info', "Σφάλμα στον ορισμό του οικονομικού έτους στο οποίο εργάζεστε. Παρακαλώ επικοινωνήστε με το διαχειριστή.");
return Yii::$app->response->redirect(['/finance/finance-year']);
}
else
Yii::$app->session["working_year"] = $workingYear;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php

namespace app\modules\finance\controllers;

use Yii;
use app\modules\finance\models\FinanceKaecreditpercentage;
use app\modules\finance\models\FinanceKaecreditpercentageSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
* FinanceKaecreditpercentageController implements the CRUD actions for FinanceKaecreditpercentage model.
*/
class FinanceKaecreditpercentageController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}

/**
* Lists all FinanceKaecreditpercentage models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new FinanceKaecreditpercentageSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}

/**
* Displays a single FinanceKaecreditpercentage model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}

/**
* Creates a new FinanceKaecreditpercentage model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new FinanceKaecreditpercentage();


if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->kaeperc_id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}

/**
* Updates an existing FinanceKaecreditpercentage 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->kaeperc_id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}

/**
* Deletes an existing FinanceKaecreditpercentage 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)->delete();

return $this->redirect(['index']);
}

/**
* Finds the FinanceKaecreditpercentage model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return FinanceKaecreditpercentage the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = FinanceKaecreditpercentage::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function safeUp()
/* CREATE TABLE admapp_finance_kaecreditpercentage */
$create_command = "CREATE TABLE IF NOT EXISTS " . $dbFinTables['table_kaecreditpercentage'] .
"(`kaeperc_id` INTEGER NOT NULL AUTO_INCREMENT,
`kaeperc_percentage` TINYINT UNSIGNED NOT NULL CHECK (kaeperc_percentage >= 0.00 AND kaeperc_percentage <= 100.00),
`kaeperc_percentage` SMALLINT UNSIGNED NOT NULL CHECK (kaeperc_percentage >= 0 AND kaeperc_percentage <= 10000),
`kaeperc_date` DATETIME NOT NULL,
`kaeperc_decision` VARCHAR(255),
`kaecredit_id` INTEGER NOT NULL,
Expand Down Expand Up @@ -213,7 +213,7 @@ public function safeUp()
$create_command = "CREATE TABLE IF NOT EXISTS " . $dbFinTables['table_deduction'] .
"(`deduct_id` INTEGER NOT NULL AUTO_INCREMENT,
`deduct_name` VARCHAR(100) NOT NULL,
`deduct_percentage` DECIMAL(3, 2) NOT NULL CHECK (deduct_percentage >= 0.00 AND deduct_percentage <= 100.00),
`deduct_percentage` SMALLINT UNSIGNED NOT NULL CHECK (deduct_percentage >= 0 AND deduct_percentage <= 10000),
`deduct_description` VARCHAR(1000),
`deduct_date` DATETIME NOT NULL,
`detuct_obsolete` BOOLEAN NOT NULL DEFAULT 0,
Expand Down
2 changes: 1 addition & 1 deletion yii2/modules/finance/models/FinanceKaecreditSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function scenarios()
public function search($params)
{
$query = FinanceKaecredit::find();

// add conditions that should always apply here

$dataProvider = new ActiveDataProvider([
Expand Down
79 changes: 79 additions & 0 deletions yii2/modules/finance/models/FinanceKaecreditpercentage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace app\modules\finance\models;

use Yii;

/**
* This is the model class for table "{{%finance_kaecreditpercentage}}".
*
* @property integer $kaeperc_id
* @property string $kaeperc_percentage
* @property string $kaeperc_date
* @property string $kaeperc_decision
* @property integer $kaecredit_id
*
* @property FinanceKaecredit $kaecredit
*/
class FinanceKaecreditpercentage extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%finance_kaecreditpercentage}}';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
[['kaeperc_percentage', 'kaeperc_date', 'kaecredit_id'], 'required'],
[['kaeperc_percentage'], 'number'],
[['kaeperc_date'], 'safe'],
[['kaecredit_id'], 'integer'],
[['kaeperc_decision'], 'string', 'max' => 255],
[['kaecredit_id'], 'exist', 'skipOnError' => true, 'targetClass' => FinanceKaecredit::className(), 'targetAttribute' => ['kaecredit_id' => 'kaecredit_id']],
];
}

/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'kaeperc_id' => Yii::t('app', 'Kaeperc ID'),
'kaeperc_percentage' => Yii::t('app', 'Kaeperc Percentage'),
'kaeperc_date' => Yii::t('app', 'Kaeperc Date'),
'kaeperc_decision' => Yii::t('app', 'Kaeperc Decision'),
'kaecredit_id' => Yii::t('app', 'Kaecredit ID'),
];
}

/**
* @return \yii\db\ActiveQuery
*/
public function getKaecredit()
{
return $this->hasOne(FinanceKaecredit::className(), ['kaecredit_id' => 'kaecredit_id']);
}

public function getKae()
{
return $this->hasOne(FinanceKae::className(),
['kae_id' => 'kae_id'])->viaTable(Yii::$app->db->tablePrefix . 'finance_kaecredit', ['kaecredit_id' => 'kaecredit_id']);
}

/**
* @inheritdoc
* @return FinanceKaecreditpercentageQuery the active query used by this AR class.
*/
public static function find()
{
return new FinanceKaecreditpercentageQuery(get_called_class());
}
}
34 changes: 34 additions & 0 deletions yii2/modules/finance/models/FinanceKaecreditpercentageQuery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace app\modules\finance\models;

/**
* This is the ActiveQuery class for [[FinanceKaecreditpercentage]].
*
* @see FinanceKaecreditpercentage
*/
class FinanceKaecreditpercentageQuery extends \yii\db\ActiveQuery
{
/*public function active()
{
return $this->andWhere('[[status]]=1');
}*/

/**
* @inheritdoc
* @return FinanceKaecreditpercentage[]|array
*/
public function all($db = null)
{
return parent::all($db);
}

/**
* @inheritdoc
* @return FinanceKaecreditpercentage|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
94 changes: 94 additions & 0 deletions yii2/modules/finance/models/FinanceKaecreditpercentageSearch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace app\modules\finance\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\modules\finance\models\FinanceKaecreditpercentage;

/**
* FinanceKaecreditpercentageSearch represents the model behind the search form about `app\modules\finance\models\FinanceKaecreditpercentage`.
*/
class FinanceKaecreditpercentageSearch extends FinanceKaecreditpercentage
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['kaeperc_id', 'kaecredit_id'], 'integer'],
[['kaeperc_percentage'], 'number'],
[['kaeperc_date', 'kaeperc_decision'], 'safe'],
];
}

/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}

/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$prefix = Yii::$app->db->tablePrefix;

/*$query = FinanceKaecreditpercentage::findBySql("SELECT kcp.* , kc.kaecredit_amount, kc.kaecredit_date,
kc.kaecredit_updated, kc.year, k.*
FROM " . $prefix . "finance_kaecreditpercentage AS kcp,
" . $prefix . "finance_kaecredit AS kc,
" . $prefix . "finance_kae AS k
WHERE kcp.kaecredit_id=kc.kaecredit_id
AND kc.kae_id=k.kae_id")->all();*/
//$query = FinanceKaecreditpercentage::find()->innerJoinWith(['admapp_finance_kaecredit'])->all();
$prc = $prefix . "finance_kaecreditpercentage";
$cred = $prefix . "finance_kaecredit";
$kae = $prefix . "finance_kae";

$query = (new \yii\db\Query())
->select([ $prc . ".*", $cred . ".kaecredit_amount",
$cred . ".kaecredit_date", $cred . ".kaecredit_updated",
$cred . ".year", $kae . ".*"])
->from([$prc, $cred, $kae])
->where($prc . '.kaecredit_id=' . $cred . '.kaecredit_id AND ' . $cred . '.kae_id=' . $kae . '.kae_id');

//echo "<pre>"; var_dump($query->all()); echo "</pre>"; die();
//$query = FinanceKaecreditpercentage::find();

// add conditions that should always apply here

$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;
}

// grid filtering conditions
$query->andFilterWhere([
'kaeperc_id' => $this->kaeperc_id,
'kaeperc_percentage' => $this->kaeperc_percentage,
'kaeperc_date' => $this->kaeperc_date,
'kaecredit_id' => $this->kaecredit_id,
]);

$query->andFilterWhere(['like', 'kaeperc_decision', $this->kaeperc_decision]);
return $dataProvider;
}
}
2 changes: 1 addition & 1 deletion yii2/modules/finance/views/default/administeryear.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="col-lg-4">
<h3>Ποσοστά διάθεσης πιστώσεων ΚΑΕ</h3>
<p>Καθορισμός ποσοστών διάθεσης των πιστώσεων των ΚΑΕ του τρέχοντος έτους.</p>
<p><?= Html::a('Ρυθμίσεις KAE', Url::to(['/finance/finance-kae']), ['class' => 'btn btn-primary', 'data-method' => 'post']) ?></p>
<p><?= Html::a('Ρυθμίσεις KAE', Url::to(['/finance/finance-kaecreditpercentage']), ['class' => 'btn btn-primary', 'data-method' => 'post']) ?></p>
</div>
</div>
<div class="row">
Expand Down
Loading