Open terminal or cmd and put following command
apt install php7.2-soap
apt install php7.2-bcmath
Shopify, Shopify Apps, Magento, WordPress, Codeigniter, Joomla, Big Commerce | PHP
apt install php7.2-soap
apt install php7.2-bcmath
Step1 :
open : /app/code/local/Namespace/Modulename/Block/Adminhtml/Employee/Edit/Tabs.php
Add following lines
protected function _beforeToHtml()
{
.........
.........
.........
$this->addTab(
'form_advancepayment',
array(
'label' => Mage::helper('namespace_modulename')->__('Advance Payment'),
'title' => Mage::helper('namespace_modulename')->__('Advance Payment'),
'content' => $this->getLayout()->createBlock(
'namespace_modulename/adminhtml_employee_edit_tab_advancepayment'
)
->toHtml(),
)
);
return parent::_beforeToHtml();
}
Step2 :
Create new file (Advancepayment.php) : /app/code/local/Namespace/Modulename/Block/Adminhtml/Employee/Edit/Tab/Advancepayment.php
<?php
class Namespace_Modulename_Block_Adminhtml_Employee_Edit_Tab_Advancepayment extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('advancepymt_grid');
$this->setDefaultSort('entity_id');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
//$this->setFilterVisibility(false);
}
protected function _prepareCollection()
{
$id = $this->getRequest()->getParam('id');
$collection = Mage::getModel('namespace_modulename/advancepymt')
->getCollection()
->addFieldToFilter('employee_id', $id);
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn(
'entity_id',
array(
'header' => Mage::helper('namespace_modulename')->__('Id'),
'index' => 'entity_id',
'filter' => false,
'type' => 'number'
)
);
$this->addColumn(
'payment',
array(
'header' => Mage::helper('namespace_modulename')->__('Payment'),
'align' => 'left',
'type' => 'number',
'index' => 'payment',
)
);
$this->addColumn(
'created_at',
array(
'header' => Mage::helper('namespace_modulename')->__('Created at'),
'index' => 'created_at',
'width' => '120px',
'type' => 'datetime',
)
);
return parent::_prepareColumns();
}
public function getGridUrl()
{
return $this->getUrl('*/*/advancepymt', array('_current'=>true));
}
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}
}
Step3 :
Create function in current controller : /app/code/local/Namespace/Modulename/controllers/Adminhtml/Payroll/EmployeeController.php
class Namespace_Modulename_Adminhtml_Payroll_EmployeeController extends Namespace_Modulename_Controller_Adminhtml_Payroll
{
.............
.............
.............
public function advancepymtAction() {
$this->loadLayout();
$this->getLayout()->getBlock('edit.tab.advancepayment');
$this->renderLayout();
}
}
Step4 :
Add view in admin layout xml file : /app/design/adminhtml/default/default/layout/namespace_modulename.xml
Add following code into file
...........
...........
<adminhtml_modulename_employee_advancepymt>
<block type="core/text_list" name="root" output="toHtml">
<block type="namespace_modulename/adminhtml_employee_edit_tab_advancepayment" name="edit.tab.advancepayment"/>
</block>
</adminhtml_modulename_employee_advancepymt>
...........
...........