Merge pull request 'paulcortezl5' (#12) from paulcortezl5 into main

Reviewed-on: #12
pull/13/head
paul 7 months ago
commit a2ab91048f

@ -51,6 +51,12 @@ $routes->post('payroll/delcomben', 'PayrollController::deleteEmployeeCompensatio
$routes->get('payroll/paysettings', 'PayrollController::payrollSettings');
$routes->post('payroll/paysettings', 'PayrollController::payrollSettings');
$routes->get('payroll/paytrans', 'PayrollController::payrollTransactions');
$routes->post('payroll/addpaytrans', 'PayrollController::addPayrollTransactions');
$routes->get('payroll/emppaytrans/(:num)', 'PayrollController::employeePayrollTransactions/$1');
$routes->get('payroll/emppaytransinit/(:num)/(:num)/(:num)', 'PayrollController::empPayTransInitializePayroll/$1/$2/$3');
// Administrator Routes
$routes->get('adminuser', 'AdministratorController::index');
$routes->get('adminuser/newuser', 'AdministratorController::newUserView');

@ -43,10 +43,10 @@ class HRController extends BaseController
$data['tblCompanyDept'] = '<p>No departments found.</p>';
else
{
$companyDeptHTMLTable->setHeading('Department ID', 'Department Code', 'Department Name', 'Action');
foreach($companyDepartments as $department)
{
$companyDeptHTMLTable->setHeading('Department ID', 'Department Code', 'Department Name', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Department Information"><i class="fas fa-eye "></i></a>';
$companyDeptHTMLTable->addRow($department->dept_id, $department->department_code, $department->department_name, "$iconView");
@ -88,10 +88,10 @@ class HRController extends BaseController
$data['tblCompanyBranch'] = '<p>No branches found.</p>';
else
{
$companyBranchHTMLTable->setHeading('Branch Code', 'Branch Name', 'Address', 'Contact Number', 'Email Address', 'Action');
foreach($companyBranches as $branch)
{
$companyBranchHTMLTable->setHeading('Branch Code', 'Branch Name', 'Address', 'Contact Number', 'Email Address', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Branch Information"><i class="fas fa-eye "></i></a>';
$companyBranchHTMLTable->addRow($branch->branch_code, $branch->branch_name, $branch->address, $branch->contact_number, $branch->email_address, "$iconView");
@ -130,10 +130,10 @@ class HRController extends BaseController
$data['tblJobTitle'] = '<p>No job titles found.</p>';
else
{
$jobTitleHTMLTable->setHeading('Job Title ID', 'Job Title Name', 'Action');
foreach($jobTitles as $jobTitle)
{
$jobTitleHTMLTable->setHeading('Job Title ID', 'Job Title Name', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Job Title Information"><i class="fas fa-eye "></i></a>';
$jobTitleHTMLTable->addRow($jobTitle->job_title_id, $jobTitle->job_title_name, "$iconView");
@ -172,10 +172,10 @@ class HRController extends BaseController
$data['tblEmploymentStatus'] = '<p>No employment status found.</p>';
else
{
$empStatusHTMLTable->setHeading('Status ID', 'Status Name', 'Action');
foreach($employmentStatus as $empStatus)
{
$empStatusHTMLTable->setHeading('Status ID', 'Status Name', 'Action');
{
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Employment Status Information"><i class="fas fa-eye "></i></a>';
$empStatusHTMLTable->addRow($empStatus->emp_status_id, $empStatus->status_name, "$iconView");
@ -219,10 +219,10 @@ class HRController extends BaseController
$data['tblEmployee'] = '<p>No employees found.</p>';
else
{
$employeeHTMLTable->setHeading('Employee ID', 'First Name', 'Last Name', 'Action');
foreach($employees as $employee)
{
$employeeHTMLTable->setHeading('Employee ID', 'First Name', 'Last Name', 'Action');
$empHTMLData = 'data-employee_id="'.$employee->employee_id.
'" data-company_id="'.$employee->company_id.
'" data-branch_code="'.$employee->branch_code.

@ -14,6 +14,9 @@ use App\Models\EmployeeModel;
use App\Models\EmpPayIncomeDeductionModel;
use App\Models\SettingsModel;
use App\Models\PayrollScheduleModel;
use App\Models\PayrollTransactionModel;
use App\Models\EmployeePayTransactionModel;
use App\Models\EmpPayTransIncomeDeductionModel;
// Entities
@ -25,6 +28,9 @@ use App\Entities\Employee;
use App\Entities\EmpPayIncomeDeduction;
use App\Entities\Settings;
use App\Entities\PayrollSchedule;
use App\Entities\PayrollTransaction;
use App\Entities\EmployeePayTransaction;
use App\Entities\EmpPayTransIncomeDeduction;
// Class Library
use App\ClassLib\MiscLib;
@ -48,10 +54,10 @@ class PayrollController extends BaseController
$data['tblPayGroup'] = '<p>No groups found.</p>';
else
{
$payGroupHTMLTable->setHeading('ID', 'Group Name', 'Action');
foreach($payGroups as $group)
{
$payGroupHTMLTable->setHeading('ID', 'Group Name', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Group Information"><i class="fas fa-eye "></i></a>';
$payGroupHTMLTable->addRow($group->pay_group_id, $group->pay_group_code, $group->pay_group_name, "$iconView");
@ -90,10 +96,10 @@ class PayrollController extends BaseController
$data['tblIncomeDeduction'] = '<p>No income and deduction found.</p>';
else
{
$inDedHTMLTable->setHeading('ID', 'Payslip Display', 'COA Code', 'Deduction Name', 'Income', 'Taxable', 'Include in Gross', 'Action');
foreach($incomeDeductions as $incomeDeduction)
{
$inDedHTMLTable->setHeading('ID', 'Payslip Display', 'COA Code', 'Deduction Name', 'Income', 'Taxable', 'Include in Gross', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Information"><i class="fas fa-eye "></i></a>';
$inDedHTMLTable->addRow($incomeDeduction->inded_id, $incomeDeduction->payslip_display, $incomeDeduction->coa_code, $incomeDeduction->income_deduction_name, ($incomeDeduction->is_income) ? 'Yes' : 'No', ($incomeDeduction->is_taxable) ? 'Yes' : 'No', ($incomeDeduction->include_in_gross) ? 'Yes' : 'No', $iconView);
@ -137,10 +143,10 @@ class PayrollController extends BaseController
$data['tblPayrollType'] = '<p>No payroll type found.</p>';
else
{
$payTypeHTMLTable->setHeading('ID', 'Code', 'Name', 'Monthly', 'Semi-Monthly', 'Daily', 'Hourly', 'Action');
foreach($payrollTypes as $payrollType)
{
$payTypeHTMLTable->setHeading('ID', 'Code', 'Name', 'Monthly', 'Semi-Monthly', 'Daily', 'Hourly', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Information"><i class="fas fa-eye "></i></a>';
$payTypeHTMLTable->addRow($payrollType->paytype_id, $payrollType->paytype_code, $payrollType->paytype_name, ($payrollType->is_monthly) ? 'Yes' : 'No', ($payrollType->is_semi_monthly) ? 'Yes' : 'No', ($payrollType->is_daily) ? 'Yes' : 'No', ($payrollType->is_hourly) ? 'Yes' : 'No', $iconView);
@ -195,7 +201,7 @@ class PayrollController extends BaseController
public function employeePayrollInfo()
{
$empPayInfoModel = new EmployeePayrollInfoModel();
$empPayInfos = $empPayInfoModel->getAllEmpPayInfoJoinedEmpPayType();
$empPayInfos = $empPayInfoModel->getAllEmpPayInfoXEmpPayType();
$data['employees'] = (new EmployeeModel())->findAll();
$data['paytypes'] = (new PayrollTypeModel())->findAll();
@ -207,10 +213,10 @@ class PayrollController extends BaseController
$data['tblEmpPayInfo'] = '<p>No employee payroll type found.</p>';
else
{
$empPayInfoHTMLTable->setHeading('ID', 'Payroll Type', 'Employee ID', 'Employee Name', 'Monthly', 'Semi-Monthly', 'Daily', 'Hourly', 'Action');
foreach($empPayInfos as $empPayInfo)
{
$empPayInfoHTMLTable->setHeading('ID', 'Payroll Type', 'Employee ID', 'Employee Name', 'Monthly', 'Semi-Monthly', 'Daily', 'Hourly', 'Action');
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Information"><i class="fas fa-eye "></i></a>';
$empPayInfoHTMLTable->addRow($empPayInfo->emppay_id, $empPayInfo->paytype_name, $empPayInfo->company_issued_id, $empPayInfo->last_name . ', ' . $empPayInfo->first_name, $empPayInfo->basic_monthly_pay, $empPayInfo->basic_semi_monthly_pay, $empPayInfo->basic_daily_pay, $empPayInfo->basic_hourly_pay, $iconView);
@ -254,7 +260,7 @@ class PayrollController extends BaseController
$data['paySchedules'] = (new PayrollScheduleModel())->findAll();
$data['incomeList'] = $incomeDeductionModel->where("is_income", 1)->findAll();
$data['deductionList'] = $incomeDeductionModel->where("is_income", 0)->findAll();
$data['empPayInfos'] = $empPayInfoModel->getAllEmpPayInfoJoinedEmpPayType();
$data['empPayInfos'] = $empPayInfoModel->getAllEmpPayInfoXEmpPayType();
$data['empLoaded'] = false;
if($this->request->getGet('empid') != null)
@ -266,9 +272,9 @@ class PayrollController extends BaseController
$iconDelete = '<a href="#" class="ml-3" data-toggle="tooltip" title="Delete Employee Information"><i class="fas fa-trash "></i></a>';
$data['empLoaded'] = true;
$data['selectedEmployee'] = $empPayInfoModel->getEmpPayInfoJoinedEmpPayTypeByEmpID($this->request->getGet('empid'));
$data['empPayIncomeList'] = $empPayInDedModel->getEmpPayInDedByEmpPayIdSchedId($data['selectedEmployee']->emppay_id, $this->request->getGet('payschedid'), true);
$data['empPayDeductionList'] = $empPayInDedModel->getEmpPayInDedByEmpPayIdSchedId($data['selectedEmployee']->emppay_id, $this->request->getGet('payschedid'),false);
$data['selectedEmployee'] = $empPayInfoModel->getEmpPayInfoXEmpPayTypeByEmpID($this->request->getGet('empid'));
$data['empPayIncomeList'] = $empPayInDedModel->getEmpPayInDedByEmpPayIdSchedIdIsIncome($data['selectedEmployee']->emppay_id, $this->request->getGet('payschedid'), true);
$data['empPayDeductionList'] = $empPayInDedModel->getEmpPayInDedByEmpPayIdSchedIdIsIncome($data['selectedEmployee']->emppay_id, $this->request->getGet('payschedid'),false);
}
return view('payroll/compensationbenefitsview', $data);
@ -344,4 +350,174 @@ class PayrollController extends BaseController
return view('payroll/paysettingsview', $data);
}
public function payrollTransactions()
{
$data['paytypes'] = (new PayrollTypeModel())->findAll();
$data['paySchedules'] = (new PayrollScheduleModel())->findAll();
$payTrans = (new PayrollTransactionModel())->orderBy('created_at', 'DESC')->findAll();
$payTransHTMLTable = new \CodeIgniter\View\Table();
$payTransHTMLTable->setTemplate(MiscLib::adminLTETableTemplate());
if($payTrans == null)
$data['tblPayTrans'] = '<p>No transactions found.</p>';
else
{
$payTransHTMLTable->setHeading('ID', 'From', 'To', 'No. of Days', 'Status', 'Remarks', 'Action');
foreach($payTrans as $trans)
{
$iconEdit = '<a href="/payroll/emppaytrans/'.$trans->paytrans_id.'" class="ml-3" data-toggle="tooltip" title="Edit Payroll Transaction"><i class="fas fa-edit"></i></a>';
$payTransHTMLTable->addRow($trans->paytrans_id, $trans->payroll_from, $trans->payroll_to, $trans->no_of_days, $trans->is_open ? 'Open' : ' Closed', $trans->remarks, $iconEdit);
}
$data['tblPayTrans'] = $payTransHTMLTable->generate();
}
return view('payroll/paytransactionview', $data);
}
public function addPayrollTransactions()
{
$payTransModel = new PayrollTransactionModel();
$payTrans = new PayrollTransaction();
$rawData = $this->request->getPost();
$payTrans->fill($rawData);
if($payTransModel->save($payTrans))
return redirect()->to('/payroll/paytrans')->with('message', 'Payroll Transaction Added');
else
return redirect()->back()->withInput()->with('error', 'Failed to add payroll transaction');
}
public function employeePayrollTransactions($paytransid)
{
$data['paygroupid'] = $this->request->getGet('grpid');
$data['showInitBtn'] = false;
$payTrans = (new PayrollTransactionModel())->where('paytrans_id', $paytransid)->first();
$data['paytransid'] = $paytransid;
$data['initURL'] = $paytransid.'/'.$data['paygroupid'].'/'.$payTrans->paytype_id;
$data['paygroups'] = (new PayrollGroupModel())->findAll();
$empPayTrans = (new EmployeePayTransactionModel())->getEmpPayTransByPayGroupId($data['paygroupid']);
$empPayTransHTMLTable = new \CodeIgniter\View\Table();
$empPayTransHTMLTable->setTemplate(MiscLib::adminLTETableTemplate());
if($empPayTrans == null)
{
$empPayTrans = (new EmployeePayrollInfoModel())->getEmpPayInfoXEmpPayTypeByPayGrpId($data['paygroupid'], $payTrans->paytype_id);
$data['showInitBtn'] = true;
$empPayTransHTMLTable->setHeading('ID', 'Company ID', 'Name', 'Branch', 'Daily Basic');
foreach($empPayTrans as $trans)
{
$empPayTransHTMLTable->addRow($trans->employee_id, $trans->company_issued_id, $trans->last_name . ', ' . $trans->first_name, $trans->branch_code, $trans->basic_monthly_pay);
}
$data['tblEmpPayTrans'] = $empPayTransHTMLTable->generate();
}
else
{
$empPayTransHTMLTable->setHeading('ID', 'Name', 'Branch', 'Monthly Basic', 'Action');
foreach($empPayTrans as $trans)
{
$iconView = '<a href="#" class="ml-3" data-toggle="tooltip" title="View Information"><i class="fas fa-eye "></i></a>';
$empPayTransHTMLTable->addRow($trans->employee_id, $trans->last_name . ', ' . $trans->first_name, $trans->branch_code, $trans->basic_monthly_pay, $iconView);
}
$data['tblEmpPayTrans'] = $empPayTransHTMLTable->generate();
}
return view('payroll/emppaytransactionview', $data);
}
public function empPayTransInitializePayroll($paytransid, $paygroupid, $transtypid)
{
$empPayInfos = (new EmployeePayrollInfoModel())->getEmpPayInfoXEmpPayTypeByPayGrpId($paygroupid, $transtypid);
$payTrans = (new PayrollTransactionModel())->where('paytrans_id', $paytransid)->first();
foreach($empPayInfos as $empPayInfo)
{
$empPayTransaction = new EmployeePayTransaction();
$empPayTransactionModel = new EmployeePayTransactionModel();
$empPayTransaction->fill(
['paytrans_id' => $paytransid,
'company_id' => $empPayInfo->company_id,
'branch_code' => $empPayInfo->branch_code,
'dept_id' => $empPayInfo->dept_id,
'job_title_id' => $empPayInfo->job_title_id,
'pay_group_id' => $empPayInfo->pay_group_id,
'emp_status_id' => $empPayInfo->emp_status_id,
'employee_id' => $empPayInfo->employee_id,
'company_issued_id' => $empPayInfo->company_issued_id,
'last_name' => $empPayInfo->last_name,
'first_name' => $empPayInfo->first_name,
'middle_name' => $empPayInfo->middle_name,
'suffix' => $empPayInfo->suffix,
'email_address' => $empPayInfo->email_address,
'is_ATM' => $empPayInfo->is_ATM,
'savings_account' => $empPayInfo->savings_account,
'basic_monthly_pay' => $empPayInfo->basic_monthly_pay,
'basic_daily_pay' => $empPayInfo->basic_daily_pay,
'basic_hourly_pay' => $empPayInfo->basic_hourly_pay,
'has_cola' => $empPayInfo->has_cola,
'has_philhealth' => $empPayInfo->has_philhealth,
'has_hdmf' => $empPayInfo->has_hdmf,
'has_sss' => $empPayInfo->has_sss,
'has_gsis' => $empPayInfo->has_gsis,
'actual_work_days' => $payTrans->no_of_days,
'basic_pay' => $payTrans->no_of_days * $empPayInfo->basic_daily_pay,
'gross_income' => 0,
'taxable_income' => 0,
'nontaxable_income' => 0,
'income_tax' => 0,
'total_deduction' => 0,
'net_pay' => 0]
);
$empPayTransactionModel->save($empPayTransaction);
$empPayTransId = $empPayTransactionModel->getInsertID();
$empPayInDeds = (new EmpPayIncomeDeductionModel())->getEmpPayInDedByEmpPayIdSchedId($empPayInfo->emppay_id, $payTrans->payschedule_id);
foreach($empPayInDeds as $empPayInDed)
{
$empPayTransInDed = new EmpPayTransIncomeDeduction();
$empPayTransInDedModel = new EmpPayTransIncomeDeductionModel();
$empPayTransInDed->fill(
['emppaytrans_id' => $empPayTransId,
'inded_id' => $empPayInDed->inded_id,
'payslip_display' => $empPayInDed->payslip_display,
'inded_name' => $empPayInDed->inded_name,
'coa_code' => $empPayInDed->coa_code,
'is_income' => $empPayInDed->is_income,
'is_taxable' => $empPayInDed->is_taxable,
'include_in_gross' => $empPayInDed->include_in_gross,
'is_fixed_amt' => $empPayInDed->is_fixed_amt,
'is_percent_amt' => $empPayInDed->is_percent_amt,
'amount' => $empPayInDed->is_fixed_amt ? $empPayInDed->amount : ($empPayInDed->amount / 100) * ($payTrans->no_of_days * $empPayInfo->basic_daily_pay),
'base_amount' => $empPayInDed->amount,
'is_override' => $empPayInDed->is_override]
);
$empPayTransInDedModel->save($empPayTransInDed);
}
}
return redirect()->back()->withInput()->with('message', 'Payroll processed. Please verify the entries.');
}
}

@ -0,0 +1,102 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreatePayrollTransaction extends Migration
{
public function up()
{
$this->forge->addField([
'paytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true
],
'paytype_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'payschedule_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'payroll_from' => [
'type' => 'DATE',
'null' => false,
],
'payroll_to' => [
'type' => 'DATE',
'null' => false,
],
'no_of_days' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
'default' => 0
],
'total_emp' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
'default' => 0
],
'total_gross' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'remarks' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true
],
'is_open' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 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('paytrans_id', true);
$this->forge->addForeignKey('paytype_id', 'pay_type', 'paytype_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('payschedule_id', 'pay_schedule', 'payschedule_id', 'CASCADE', 'RESTRICT');
$this->forge->createTable('pay_trans');
}
public function down()
{
$this->forge->dropTable('pay_trans');
}
}

@ -0,0 +1,22 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddConstraintOnEmployeePayInfo extends Migration
{
public function up()
{
$this->forge->addForeignKey('employee_id', 'employee', 'employee_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('paytype_id', 'pay_type', 'paytype_id', 'CASCADE', 'RESTRICT');
$this->forge->processIndexes('emp_pay_info');
}
public function down()
{
$this->forge->dropForeignKey('emp_pay_info', 'emp_pay_info_employee_id_foreign');
$this->forge->dropForeignKey('emp_pay_info', 'emp_pay_info_paytype_id_foreign');
$this->forge->processIndexes('emp_pay_info');
}
}

@ -0,0 +1,221 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateEmpPayTrans extends Migration
{
public function up()
{
$this->forge->addField([
'emppaytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true
],
'paytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'company_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'branch_code' => [
'type' => 'VARCHAR',
'constraint' => 25,
'null' => false,
'after' => 'company_id',
],
'dept_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'job_title_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'pay_group_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => false,
],
'emp_status_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'employee_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true
],
'company_issued_id' => [
'type' => 'VARCHAR',
'constraint' => 25,
],
'last_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'first_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'middle_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'suffix' => [
'type' => 'VARCHAR',
'constraint' => 10,
'null' => true,
],
'email_address' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'is_ATM' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'savings_account' => [
'type' => 'VARCHAR',
'constraint' => 50,
'null' => true
],
'basic_monthly_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'basic_daily_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'basic_hourly_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'has_cola' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_philhealth' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_hdmf' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_sss' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'has_gsis' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'actual_work_days' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'basic_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'gross_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'taxable_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'nontaxable_income' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'income_tax' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'total_deduction' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'null' => false
],
'net_pay' => [
'type' => 'DECIMAL',
'constraint' => '12,4',
'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('emppaytrans_id', true);
$this->forge->addForeignKey('paytrans_id', 'pay_trans', 'paytrans_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('company_id', 'company_info', 'company_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('branch_code', 'company_branch', 'branch_code', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('dept_id', 'company_dept', 'dept_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('job_title_id', 'job_title', 'job_title_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('pay_group_id', 'pay_group', 'pay_group_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('emp_status_id', 'emp_status', 'emp_status_id', 'CASCADE', 'RESTRICT');
$this->forge->addForeignKey('employee_id', 'employee', 'employee_id', 'CASCADE', 'RESTRICT');
$this->forge->createTable('emp_pay_trans');
}
public function down()
{
$this->forge->dropTable('emp_pay_trans');
}
}

@ -0,0 +1,120 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateEmpPayIncomeDeduction extends Migration
{
public function up()
{
$this->forge->addField([
'emppaytransinded_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true
],
'emppaytrans_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'inded_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'payslip_display' => [
'type' => 'VARCHAR',
'constraint' => 25,
'null' => false
],
'inded_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => false
],
'coa_code' => [
'type' => 'VARCHAR',
'constraint' => 25,
'null' => true,
],
'is_income' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'is_taxable' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'include_in_gross' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => false
],
'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
],
'base_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('emppaytransinded_id', true);
$this->forge->addForeignKey('emppaytrans_id', 'emp_pay_trans', 'emppaytrans_id', 'CASCADE', 'RESTRICT');
$this->forge->createTable('emp_pay_trans_inded');
}
public function down()
{
$this->forge->dropTable('emp_pay_trans_inded');
}
}

@ -0,0 +1,28 @@
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
class EmpPayTransIncomeDeduction extends Entity
{
protected $attributes = [
'emppaytransinded_id' => null,
'emppaytrans_id' => null,
'inded_id' => null,
'payslip_display' => null,
'inded_name' => null,
'coa_code' => null,
'is_income' => null,
'is_taxable' => null,
'include_in_gross' => null,
'is_fixed_amt' => null,
'is_percent_amt' => null,
'amount' => null,
'base_amount' => null,
'is_override' => null,
];
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
}

@ -13,6 +13,7 @@ class Employee extends Entity
'dept_id' => null,
'job_title_id' => null,
'emp_status_id' => null,
'pay_group_id' => null,
'company_issued_id' => null,
'last_name' => null,
'first_name' => null,

@ -0,0 +1,47 @@
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
class EmployeePayTransaction extends Entity
{
protected $attributes = [
'emppaytrans_id' => null,
'paytrans_id' => null,
'company_id' => null,
'branch_code' => null,
'dept_id' => null,
'job_title_id' => null,
'pay_group_id' => null,
'emp_status_id' => null,
'employee_id' => null,
'company_issued_id' => null,
'last_name' => null,
'first_name' => null,
'middle_name' => null,
'suffix' => null,
'email_address' => null,
'is_ATM' => null,
'savings_account' => null,
'basic_monthly_pay' => null,
'basic_daily_pay' => null,
'basic_hourly_pay' => null,
'has_cola' => null,
'has_philhealth' => null,
'has_hdmf' => null,
'has_sss' => null,
'has_gsis' => null,
'actual_work_days' => null,
'basic_pay' => null,
'gross_income' => null,
'taxable_income' => null,
'nontaxable_income' => null,
'income_tax' => null,
'total_deduction' => null,
'net_pay' => null,
];
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
}

@ -0,0 +1,24 @@
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
class PayrollTransaction extends Entity
{
protected $attributes = [
'paytrans_id' => null,
'paytype_id' => null,
'payschedule_id' => null,
'payroll_from' => null,
'payroll_to' => null,
'no_of_days' => null,
'total_emp' => null,
'total_gross' => null,
'remarks' => null,
'is_open' => null,
];
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
}

@ -59,7 +59,7 @@ class EmpPayIncomeDeductionModel extends Model
return $data;
}
public function getEmpPayInDedByEmpPayIdSchedId($empPayId, $paySchedId, $isIncome)
public function getEmpPayInDedByEmpPayIdSchedIdIsIncome($empPayId, $paySchedId, $isIncome)
{
$builder = $this->db->table('emp_pay_inded');
$builder->select('*');
@ -71,4 +71,16 @@ class EmpPayIncomeDeductionModel extends Model
]);
return $builder->get()->getResult();
}
public function getEmpPayInDedByEmpPayIdSchedId($empPayId, $paySchedId)
{
$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,
'emp_pay_inded.payschedule_id' => $paySchedId
]);
return $builder->get()->getResult();
}
}

@ -0,0 +1,60 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EmpPayTransIncomeDeductionModel extends Model
{
protected $table = 'emp_pay_trans_inded';
protected $primaryKey = 'emppaytransinded_id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['emppaytrans_id',
'inded_id',
'is_fixed_amt',
'is_percent_amt',
'amount',
'base_amount',
'is_override'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = true;
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 = ['assignCreatedBy'];
protected $afterInsert = [];
protected $beforeUpdate = ['assignUpdatedBy'];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function assignCreatedBy(array $data)
{
$data['data']['created_by'] = auth()->user()->employee_id;
return $data;
}
public function assignUpdatedBy(array $data)
{
$data['data']['updated_by'] = auth()->user()->employee_id;
return $data;
}
}

@ -0,0 +1,100 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EmployeePayTransactionModel extends Model
{
protected $table = 'emp_pay_trans';
protected $primaryKey = 'emppaytrans_id';
protected $useAutoIncrement = true;
protected $returnType = \App\Entities\EmployeePayTransaction::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['paytrans_id',
'company_id',
'branch_code',
'dept_id',
'job_title_id',
'pay_group_id',
'emp_status_id',
'employee_id',
'company_issued_id',
'last_name',
'first_name',
'middle_name',
'suffix',
'email_address',
'is_ATM',
'savings_account',
'basic_monthly_pay',
'basic_daily_pay',
'basic_hourly_pay',
'has_cola',
'has_philhealth',
'has_hdmf',
'has_sss',
'has_gsis',
'actual_work_days',
'basic_pay',
'gross_income',
'taxable_income',
'nontaxable_income',
'income_tax',
'total_deduction',
'net_pay'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = true;
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 = ['assignCreatedBy'];
protected $afterInsert = [];
protected $beforeUpdate = ['assignUpdatedBy'];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function assignCreatedBy(array $data)
{
$data['data']['created_by'] = auth()->user()->employee_id;
return $data;
}
public function assignUpdatedBy(array $data)
{
$data['data']['updated_by'] = auth()->user()->employee_id;
return $data;
}
public function getEmpPayTransByPayGroupId($paygroupid)
{
$builder = $this->db->table('emp_pay_trans');
$builder->select('*');
$builder->join('pay_trans', 'pay_trans.paytrans_id = emp_pay_trans.paytrans_id');
$builder->join('company_branch', 'company_branch.branch_code = emp_pay_trans.branch_code');
$builder->join('company_dept', 'company_dept.dept_id = emp_pay_trans.dept_id');
$builder->join('job_title', 'job_title.job_title_id = emp_pay_trans.job_title_id');
$builder->join('pay_group', 'pay_group.pay_group_id = emp_pay_trans.pay_group_id');
$builder->join('emp_status', 'emp_status.emp_status_id = emp_pay_trans.emp_status_id');
$builder->join('employee', 'employee.employee_id = emp_pay_trans.employee_id');
$builder->where('emp_pay_trans.pay_group_id', $paygroupid);
return $builder->get()->getResult();
}
}

@ -66,7 +66,7 @@ class EmployeePayrollInfoModel extends Model
return $data;
}
public function getAllEmpPayInfoJoinedEmpPayType()
public function getAllEmpPayInfoXEmpPayType()
{
$builder = $this->db->table('emp_pay_info');
$builder->select('*');
@ -75,7 +75,7 @@ class EmployeePayrollInfoModel extends Model
return $builder->get()->getResult();
}
public function getEmpPayInfoJoinedEmpPayTypeByEmpID($empID)
public function getEmpPayInfoXEmpPayTypeByEmpID($empID)
{
$builder = $this->db->table('emp_pay_info');
$builder->select('*');
@ -84,4 +84,15 @@ class EmployeePayrollInfoModel extends Model
$builder->where('emp_pay_info.employee_id', $empID);
return $builder->get()->getRow();
}
public function getEmpPayInfoXEmpPayTypeByPayGrpId($payGroupId, $payTypeId)
{
$builder = $this->db->table('emp_pay_info');
$builder->select('*');
$builder->join('employee', 'employee.employee_id = emp_pay_info.employee_id');
$builder->join('pay_type', 'pay_type.paytype_id = emp_pay_info.paytype_id');
$builder->where(['employee.pay_group_id' => $payGroupId,
'emp_pay_info.paytype_id' => $payTypeId]);
return $builder->get()->getResult();
}
}

@ -0,0 +1,62 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PayrollTransactionModel extends Model
{
protected $table = 'pay_trans';
protected $primaryKey = 'paytrans_id';
protected $useAutoIncrement = true;
protected $returnType = \App\Entities\PayrollTransaction::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['paytype_id',
'payschedule_id',
'payroll_from',
'payroll_to',
'no_of_days',
'total_emp',
'total_gross',
'remarks',
'is_open'];
protected bool $allowEmptyInserts = false;
// Dates
protected $useTimestamps = true;
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 = ['assignCreatedBy'];
protected $afterInsert = [];
protected $beforeUpdate = ['assignUpdatedBy'];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function assignCreatedBy(array $data)
{
$data['data']['created_by'] = auth()->user()->employee_id;
return $data;
}
public function assignUpdatedBy(array $data)
{
$data['data']['updated_by'] = auth()->user()->employee_id;
return $data;
}
}

@ -322,9 +322,10 @@
<div class="col-12 col-sm-4">
<div class="form-group">
<label>Select Schedule</label>
<select class="form-control" style="width: 100%;" name="payschedid">
<select class="form-control" name="payschedid">
<?php foreach($paySchedules as $paySchedule): ?>
<?php $selected = ($empLoaded && $_GET['payschedid'] == $paySchedule->payschedule_id) ? 'selected' : ''; ?> <?= '<option value="'.$paySchedule->payschedule_id.'" '.$selected.'>['.$paySchedule->sched_code.'] '.$paySchedule->sched_name.'</option>' ?>
<?php $selected = ($empLoaded && $_GET['payschedid'] == $paySchedule->payschedule_id) ? 'selected' : ''; ?>
<?= '<option value="'.$paySchedule->payschedule_id.'" '.$selected.'>['.$paySchedule->sched_code.'] '.$paySchedule->sched_name.'</option>' ?>
<?php endforeach; ?>
</select>
</div>
@ -511,14 +512,9 @@
<script>
$(document).ready(function() {
//Initialize Select2 Elements
$('.select2').select2();
//Initialize Select2 Elements
$('.select2').select2();
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
});
});
function editIncome(element) {

@ -0,0 +1,182 @@
<!-- Extend area where template is defined -->
<?= $this->extend('templates/adminlte/generalcontent') ?>
<!-- .Extend -->
<!-- Title of the page -->
<?= $this->section('title') ?>Employee Payroll Transaction<?= $this->endSection() ?>
<!-- .Title -->
<!-- CSS of the page -->
<?= $this->section('css') ?>
<!-- Select2 -->
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<?= $this->endSection() ?>
<!-- .CSS -->
<!-- body attribute - class definition -->
<?= $this->section('bodyclass') ?>sidebar-mini<?= $this->endSection() ?>
<!-- .body attribute -->
<!-- Container title -->
<?= $this->section('containertitle') ?>Employee Payroll Transaction<?= $this->endSection() ?>
<!-- .Container title -->
<!-- Active breadcrumb -->
<?= $this->section('activebreadcrumb') ?><a href="/payroll/paytrans">Payroll Transaction</a> / Employee Payroll Transaction<?= $this->endSection() ?>
<!-- .Active breadcrumb -->
<!-- Main content -->
<?= $this->section('main') ?>
<!-- Modal Add Branch -->
<div class="modal fade" id="mdlAddPayTrans">
<div class="modal-dialog">
<div class="modal-content">
<form action="<?= url_to('payroll/addpaytrans') ?>" method="post">
<div class="modal-header">
<h4 class="modal-title" >New Payroll Transaction</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<p class="lead">Payroll Group Information</p>
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Payroll period:</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="far fa-calendar-alt"></i>
</span>
</div>
<input type="text" class="form-control float-right" id="txtPayrollFromTo" name="payroll_from_to">
<input type="hidden" id="txtPayrollFrom" name="payroll_from">
<input type="hidden" id="txtPayrollTo" name="payroll_to">
<!-- set default value -->
<input type="hidden" name="total_emp" value="0">
<input type="hidden" name="total_gross" value="0">
<input type="hidden" name="is_open" value="1">
</div>
<!-- /.input group -->
</div>
<div class="form-group">
<label for="txtNoOfDays">Number of Days</label>
<input class="form-control" type="text" id="txtNoOfDays" name="no_of_days" value="<?= old('no_of_days') ?>" readonly>
</div>
<div class="form-group">
<label for="txtRemarks">Remarks</label>
<textarea class="form-control" rows="3" placeholder="Enter remarks here..." name="remarks" id="txtRemarks"><?= old('remarks') ?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Select Payroll Group to Process</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-12">
<form action="/payroll/emppaytrans/<?= $paytransid ?>" method="get">
<div class="form-group">
<label>Payroll Group</label>
<div class="input-group mb-3">
<select class="form-control select2 rounded-0" name="grpid">
<option value="-1">-- Select --</option>
<?php foreach($paygroups as $paygroup): ?>
<?php $selected = ($paygroupid != null && $paygroupid == $paygroup->pay_group_id) ? 'selected' : ''; ?>
<option value="<?= $paygroup->pay_group_id ?>" <?= $selected ?>><?= '['.$paygroup->pay_group_code.'] '.$paygroup->pay_group_name ?></option>
<?php endforeach; ?>
</select>
<span class="input-group-append">
<button type="submit" class="btn btn-info btn-flat">Select this Group</button>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">List of Employee for Payroll</h3>
</div>
<div class="card-body">
<?php if($paygroupid == null || $paygroupid == -1): ?>
<p>Please select payroll group.</p>
<?php else: ?>
<div class="card-body table-responsive p-0">
<?php if($showInitBtn): ?>
<p>You may change the working days for this payroll cutoff. Deduct days off or absences on <strong>working days</strong> field.</p>
<?php else: ?>
<p>Adjust entry of each employee by clicking on <strong>Adjust</strong> button</p>
<?php endif; ?>
<?= $tblEmpPayTrans ?>
</div>
<?php endif; ?>
</div>
<div class="card-footer">
<?php if($showInitBtn && !($paygroupid == null || $paygroupid == -1)): ?>
<a class="btn btn-warning" href="/payroll/emppaytransinit/<?= $initURL ?>">Initialize Payroll</a>
<?php elseif($paygroupid == null || $paygroupid == -1): ?>
<button type="button" class="btn btn-warning" disabled>Initialize Payroll</button>
<?php else: ?>
<button type="button" class="btn btn-primary">Generate Payslip</button>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<!-- .Main content -->
<!-- Javascript -->
<?= $this->section('js') ?>
<!-- Select2 -->
<script src="<?= base_url() ?>adminlte/plugins/select2/js/select2.full.min.js"></script>
<script>
$(document).ready(function() {
//Initialize Select2 Elements
$('.select2').select2();
});
</script>
<?= $this->endSection() ?>
<!-- .Javascript -->

@ -0,0 +1,159 @@
<!-- Extend area where template is defined -->
<?= $this->extend('templates/adminlte/generalcontent') ?>
<!-- .Extend -->
<!-- Title of the page -->
<?= $this->section('title') ?>Payroll Transaction<?= $this->endSection() ?>
<!-- .Title -->
<!-- CSS of the page -->
<?= $this->section('css') ?>
<!-- daterange picker -->
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/daterangepicker/daterangepicker.css">
<?= $this->endSection() ?>
<!-- .CSS -->
<!-- body attribute - class definition -->
<?= $this->section('bodyclass') ?>sidebar-mini<?= $this->endSection() ?>
<!-- .body attribute -->
<!-- Container title -->
<?= $this->section('containertitle') ?>Payroll Transaction<?= $this->endSection() ?>
<!-- .Container title -->
<!-- Active breadcrumb -->
<?= $this->section('activebreadcrumb') ?>Payroll Transaction<?= $this->endSection() ?>
<!-- .Active breadcrumb -->
<!-- Main content -->
<?= $this->section('main') ?>
<!-- Modal Add Branch -->
<div class="modal fade" id="mdlAddPayTrans">
<div class="modal-dialog">
<div class="modal-content">
<form action="<?= url_to('payroll/addpaytrans') ?>" method="post">
<div class="modal-header">
<h4 class="modal-title" >New Payroll Transaction</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<p class="lead">Payroll Group Information</p>
<div class="row">
<div class="col-12">
<div class="form-group">
<label>Select Payroll Type</label>
<select class="form-control" name="paytype_id">
<?php foreach($paytypes as $paytype): ?>
<?php $selected = (old('paytype_id') == $paytype->paytype_id) ? 'selected' : ''; ?>
<?= '<option value="'.$paytype->paytype_id.'" '.$selected.'>['.$paytype->paytype_code.'] '.$paytype->paytype_name.'</option>' ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label>Select Schedule</label>
<select class="form-control" name="payschedule_id">
<?php foreach($paySchedules as $paySchedule): ?>
<?= '<option value="'.$paySchedule->payschedule_id.'" '.$selected.'>['.$paySchedule->sched_code.'] '.$paySchedule->sched_name.'</option>' ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label>Payroll period:</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="far fa-calendar-alt"></i>
</span>
</div>
<input type="text" class="form-control float-right" id="txtPayrollFromTo" name="payroll_from_to">
<input type="hidden" id="txtPayrollFrom" name="payroll_from">
<input type="hidden" id="txtPayrollTo" name="payroll_to">
<!-- set default value -->
<input type="hidden" name="total_emp" value="0">
<input type="hidden" name="total_gross" value="0">
<input type="hidden" name="is_open" value="1">
</div>
<!-- /.input group -->
</div>
<div class="form-group">
<label for="txtNoOfDays">Number of Days</label>
<input class="form-control" type="text" id="txtNoOfDays" name="no_of_days" value="<?= old('no_of_days') ?>" readonly>
</div>
<div class="form-group">
<label for="txtRemarks">Remarks</label>
<textarea class="form-control" rows="3" placeholder="Enter remarks here..." name="remarks" id="txtRemarks"><?= old('remarks') ?></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save changes</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">List of Payroll Transaction</h3>
</div>
<div class="card-body">
<div class="card-body table-responsive p-0">
<?= $tblPayTrans ?>
</div>
</div>
<div class="card-footer">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mdlAddPayTrans">Add Payroll Transaction</button>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<!-- .Main content -->
<!-- Javascript -->
<?= $this->section('js') ?>
<!-- InputMask -->
<script src="<?= base_url() ?>adminlte/plugins/moment/moment.min.js"></script>
<script src="<?= base_url() ?>adminlte/plugins/inputmask/jquery.inputmask.min.js"></script>
<!-- date-range-picker -->
<script src="<?= base_url() ?>adminlte/plugins/daterangepicker/daterangepicker.js"></script>
<script>
$(document).ready(function() {
//Date range picker
$('#txtPayrollFromTo').daterangepicker();
$("#txtPayrollFromTo").on("change", function() {
var from = $(this).data('daterangepicker').startDate.format('YYYY-MM-DD');
var to = $(this).data('daterangepicker').endDate.format('YYYY-MM-DD');
$("#txtNoOfDays").val(moment(to).diff(moment(from), 'days') + 1);
$("#txtPayrollFrom").val(from);
$("#txtPayrollTo").val(to);
});
});
</script>
<?= $this->endSection() ?>
<!-- .Javascript -->

@ -275,16 +275,16 @@
<a href="#" class="nav-link">
<i class="nav-icon far fa-image"></i>
<p>
Payroll Preparation
Payroll Processing
<i class="right fas fa-angle-left"></i>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="#" class="nav-link">
<a href="/payroll/paytrans" class="nav-link">
<i class="nav-icon far fa-image"></i>
<p>
Initialize Payroll
Payroll Transactios
</p>
</a>
</li>

Loading…
Cancel
Save