Merge pull request 'Income and deduction' (#8) from paulcortezl5 into main
Reviewed-on: #8pull/9/head
commit
2a68e8e9d2
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateEmpPayIncomeDeduction extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'emppayinded_id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true
|
||||
],
|
||||
'emppay_id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'unsigned' => true,
|
||||
],
|
||||
'inded_id' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 11,
|
||||
'unsigned' => true,
|
||||
],
|
||||
'is_fixed_amt' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false
|
||||
],
|
||||
'is_percent_amt' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false
|
||||
],
|
||||
'amount' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '12,4',
|
||||
'null' => false
|
||||
],
|
||||
'is_override' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false
|
||||
],
|
||||
|
||||
|
||||
// Common fields
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'created_by' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '20',
|
||||
'null' => true
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'updated_by' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '20',
|
||||
'null' => true
|
||||
],
|
||||
'deleted_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->forge->addKey('emppayinded_id', true);
|
||||
$this->forge->addForeignKey('emppay_id', 'emp_pay_info', 'emppay_id', 'CASCADE', 'RESTRICT');
|
||||
$this->forge->addForeignKey('inded_id', 'pay_income_deduction', 'inded_id', 'CASCADE', 'RESTRICT');
|
||||
$this->forge->createTable('emp_pay_inded');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('emp_pay_inded');
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
class EmpPayIncomeDeduction extends Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
'emppayinded_id' => null,
|
||||
'emppay_id' => null,
|
||||
'inded_id' => null,
|
||||
'is_fixed_amt' => null,
|
||||
'is_percent_amt' => null,
|
||||
'amount' => null,
|
||||
'is_override' => null,
|
||||
];
|
||||
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EmpPayIncomeDeductionModel extends Model
|
||||
{
|
||||
protected $table = 'emp_pay_inded';
|
||||
protected $primaryKey = 'emppayinded_id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = \App\Entities\EmpPayIncomeDeduction::class;
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['emppay_id',
|
||||
'inded_id',
|
||||
'is_fixed_amt',
|
||||
'is_percent_amt',
|
||||
'amount',
|
||||
'is_override',
|
||||
];
|
||||
|
||||
protected bool $allowEmptyInserts = false;
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = false;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
// Validation
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ['assignCreatedAt'];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ['assignUpdatedAt'];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
|
||||
public function assignCreatedAt(array $data)
|
||||
{
|
||||
$data['data']['created_at'] = date('Y-m-d H:i:s');
|
||||
$data['data']['created_by'] = auth()->user()->employee_id;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function assignUpdatedAt(array $data)
|
||||
{
|
||||
$data['data']['updated_at'] = date('Y-m-d H:i:s');
|
||||
$data['data']['updated_by'] = auth()->user()->employee_id;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEmpPayInDedByEmpPayId($empPayId, $isIncome)
|
||||
{
|
||||
$builder = $this->db->table('emp_pay_inded');
|
||||
$builder->select('*');
|
||||
$builder->join('pay_income_deduction', 'pay_income_deduction.inded_id = emp_pay_inded.inded_id');
|
||||
$builder->where(['emp_pay_inded.emppay_id' => $empPayId, 'pay_income_deduction.is_income' => $isIncome]);
|
||||
return $builder->get()->getResult();
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1725775160;_ci_previous_url|s:22:"http://localhost:8080/";csrf_test_name|s:32:"0a1c5406b3c32ddbc36b51f62231cd84";
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1726049669;csrf_test_name|s:32:"ed6e1473d2f3c51bcafefa3c48fa20d0";_ci_previous_url|s:27:"http://localhost:8080/login";
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1725758031;beforeLoginUrl|s:28:"http://localhost:8080/hr/emp";__ci_vars|a:1:{s:14:"beforeLoginUrl";i:1725758331;}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1725758031;csrf_test_name|s:32:"008a89b6d66736f5372a0975a2dd537b";_ci_previous_url|s:27:"http://localhost:8080/login";
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1726051237;csrf_test_name|s:32:"b51217379da0b60e2486dc03c8785d46";_ci_previous_url|s:27:"http://localhost:8080/login";
|
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1726049668;beforeLoginUrl|s:28:"http://localhost:8080/hr/emp";__ci_vars|a:1:{s:14:"beforeLoginUrl";i:1726049968;}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
__ci_last_regenerate|i:1725561216;_ci_previous_url|s:22:"http://localhost:8080/";csrf_test_name|s:32:"75a15d472aa07c40129f5c1806fabe69";
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue