diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 530ac13..6370600 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -55,6 +55,7 @@ $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'); diff --git a/app/Controllers/HRController.php b/app/Controllers/HRController.php index 1ff20d5..c81b49a 100644 --- a/app/Controllers/HRController.php +++ b/app/Controllers/HRController.php @@ -43,10 +43,10 @@ class HRController extends BaseController $data['tblCompanyDept'] = '
No departments found.
'; else { + $companyDeptHTMLTable->setHeading('Department ID', 'Department Code', 'Department Name', 'Action'); + foreach($companyDepartments as $department) { - $companyDeptHTMLTable->setHeading('Department ID', 'Department Code', 'Department Name', 'Action'); - $iconView = ''; $companyDeptHTMLTable->addRow($department->dept_id, $department->department_code, $department->department_name, "$iconView"); @@ -88,10 +88,10 @@ class HRController extends BaseController $data['tblCompanyBranch'] = 'No branches found.
'; 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 = ''; $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'] = 'No job titles found.
'; else { + $jobTitleHTMLTable->setHeading('Job Title ID', 'Job Title Name', 'Action'); + foreach($jobTitles as $jobTitle) { - $jobTitleHTMLTable->setHeading('Job Title ID', 'Job Title Name', 'Action'); - $iconView = ''; $jobTitleHTMLTable->addRow($jobTitle->job_title_id, $jobTitle->job_title_name, "$iconView"); @@ -172,10 +172,10 @@ class HRController extends BaseController $data['tblEmploymentStatus'] = 'No employment status found.
'; else { + $empStatusHTMLTable->setHeading('Status ID', 'Status Name', 'Action'); + foreach($employmentStatus as $empStatus) - { - $empStatusHTMLTable->setHeading('Status ID', 'Status Name', 'Action'); - + { $iconView = ''; $empStatusHTMLTable->addRow($empStatus->emp_status_id, $empStatus->status_name, "$iconView"); @@ -219,10 +219,10 @@ class HRController extends BaseController $data['tblEmployee'] = 'No employees found.
'; 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. diff --git a/app/Controllers/PayrollController.php b/app/Controllers/PayrollController.php index 95bade1..fffe5ff 100644 --- a/app/Controllers/PayrollController.php +++ b/app/Controllers/PayrollController.php @@ -15,6 +15,8 @@ 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 @@ -27,6 +29,8 @@ 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; @@ -50,10 +54,10 @@ class PayrollController extends BaseController $data['tblPayGroup'] = 'No groups found.
'; else { + $payGroupHTMLTable->setHeading('ID', 'Group Name', 'Action'); + foreach($payGroups as $group) { - $payGroupHTMLTable->setHeading('ID', 'Group Name', 'Action'); - $iconView = ''; $payGroupHTMLTable->addRow($group->pay_group_id, $group->pay_group_code, $group->pay_group_name, "$iconView"); @@ -92,10 +96,10 @@ class PayrollController extends BaseController $data['tblIncomeDeduction'] = 'No income and deduction found.
'; 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 = ''; $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); @@ -139,10 +143,10 @@ class PayrollController extends BaseController $data['tblPayrollType'] = 'No payroll type found.
'; 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 = ''; $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); @@ -197,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(); @@ -209,10 +213,10 @@ class PayrollController extends BaseController $data['tblEmpPayInfo'] = 'No employee payroll type found.
'; 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 = ''; $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); @@ -256,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) @@ -268,9 +272,9 @@ class PayrollController extends BaseController $iconDelete = ''; $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); @@ -361,10 +365,10 @@ class PayrollController extends BaseController $data['tblPayTrans'] = 'No transactions found.
'; else { + $payTransHTMLTable->setHeading('ID', 'From', 'To', 'No. of Days', 'Status', 'Remarks', 'Action'); + foreach($payTrans as $trans) { - $payTransHTMLTable->setHeading('ID', 'From', 'To', 'No. of Days', 'Status', 'Remarks', 'Action'); - $iconEdit = ''; $payTransHTMLTable->addRow($trans->paytrans_id, $trans->payroll_from, $trans->payroll_to, $trans->no_of_days, $trans->is_open ? 'Open' : ' Closed', $trans->remarks, $iconEdit); @@ -393,11 +397,127 @@ class PayrollController extends BaseController public function employeePayrollTransactions($paytransid) { - $data['paytransid'] = $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 = ''; + + $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.'); + } } diff --git a/app/Database/Migrations/2024-10-04-072909_CreateEmpPayTrans.php b/app/Database/Migrations/2024-10-04-072909_CreateEmpPayTrans.php index 78d909b..4438d0f 100644 --- a/app/Database/Migrations/2024-10-04-072909_CreateEmpPayTrans.php +++ b/app/Database/Migrations/2024-10-04-072909_CreateEmpPayTrans.php @@ -25,6 +25,12 @@ class CreateEmpPayTrans extends Migration 'constraint' => 11, 'unsigned' => true, ], + 'branch_code' => [ + 'type' => 'VARCHAR', + 'constraint' => 25, + 'null' => false, + 'after' => 'company_id', + ], 'dept_id' => [ 'type' => 'INT', 'constraint' => 11, @@ -35,6 +41,12 @@ class CreateEmpPayTrans extends Migration 'constraint' => 11, 'unsigned' => true, ], + 'pay_group_id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'null' => false, + ], 'emp_status_id' => [ 'type' => 'INT', 'constraint' => 11, @@ -123,6 +135,16 @@ class CreateEmpPayTrans extends Migration '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', @@ -181,13 +203,19 @@ class CreateEmpPayTrans extends Migration ]); $this->forge->addKey('emppaytrans_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'); + $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'); } } diff --git a/app/Database/Migrations/2024-10-07-061029_CreateEmpPayIncomeDeduction.php b/app/Database/Migrations/2024-10-07-061029_CreateEmpPayIncomeDeduction.php new file mode 100644 index 0000000..99c63ea --- /dev/null +++ b/app/Database/Migrations/2024-10-07-061029_CreateEmpPayIncomeDeduction.php @@ -0,0 +1,120 @@ +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'); + } +} diff --git a/app/Entities/EmpPayTransIncomeDeduction.php b/app/Entities/EmpPayTransIncomeDeduction.php new file mode 100644 index 0000000..9996449 --- /dev/null +++ b/app/Entities/EmpPayTransIncomeDeduction.php @@ -0,0 +1,28 @@ + 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 = []; +} diff --git a/app/Entities/Employee.php b/app/Entities/Employee.php index d91057d..53d59a7 100644 --- a/app/Entities/Employee.php +++ b/app/Entities/Employee.php @@ -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, diff --git a/app/Entities/EmployeePayTransaction.php b/app/Entities/EmployeePayTransaction.php new file mode 100644 index 0000000..c4902f1 --- /dev/null +++ b/app/Entities/EmployeePayTransaction.php @@ -0,0 +1,47 @@ + 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 = []; +} diff --git a/app/Models/EmpPayIncomeDeductionModel.php b/app/Models/EmpPayIncomeDeductionModel.php index 1bf255e..9eb912b 100644 --- a/app/Models/EmpPayIncomeDeductionModel.php +++ b/app/Models/EmpPayIncomeDeductionModel.php @@ -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(); + } } diff --git a/app/Models/EmpPayTransIncomeDeductionModel.php b/app/Models/EmpPayTransIncomeDeductionModel.php new file mode 100644 index 0000000..5898c24 --- /dev/null +++ b/app/Models/EmpPayTransIncomeDeductionModel.php @@ -0,0 +1,60 @@ +user()->employee_id; + return $data; + } + + public function assignUpdatedBy(array $data) + { + $data['data']['updated_by'] = auth()->user()->employee_id; + return $data; + } +} diff --git a/app/Models/EmployeePayTransactionModel.php b/app/Models/EmployeePayTransactionModel.php new file mode 100644 index 0000000..6701f3d --- /dev/null +++ b/app/Models/EmployeePayTransactionModel.php @@ -0,0 +1,100 @@ +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(); + } +} diff --git a/app/Models/EmployeePayrollInfoModel.php b/app/Models/EmployeePayrollInfoModel.php index 62de39e..1465e3a 100644 --- a/app/Models/EmployeePayrollInfoModel.php +++ b/app/Models/EmployeePayrollInfoModel.php @@ -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(); + } } diff --git a/app/Views/payroll/emppaytransactionview.php b/app/Views/payroll/emppaytransactionview.php index 2ff1ecf..4f4914b 100644 --- a/app/Views/payroll/emppaytransactionview.php +++ b/app/Views/payroll/emppaytransactionview.php @@ -126,15 +126,32 @@Please select payroll group.
+You may change the working days for this payroll cutoff. Deduct days off or absences on working days field.
+ +Adjust entry of each employee by clicking on Adjust button
+ + + = $tblEmpPayTrans ?> +