Exemple #1
0
 /**
  * Update employee compensation
  *
  * @return void
  */
 public function employee_update_compensation()
 {
     $this->verify_nonce('employee_update_compensation');
     // @TODO: check permission
     $employee_id = isset($_REQUEST['employee_id']) ? intval($_REQUEST['employee_id']) : 0;
     $date = empty($_POST['date']) ? current_time('mysql') : $_POST['date'];
     $comment = strip_tags($_POST['comment']);
     $pay_rate = intval($_POST['pay_rate']);
     $pay_type = strip_tags($_POST['pay_type']);
     $reason = strip_tags($_POST['change-reason']);
     $types = erp_hr_get_pay_type();
     $reasons = erp_hr_get_pay_change_reasons();
     if (!$pay_rate) {
         $this->send_error(__('Enter a valid pay rate.', 'wp-erp'));
     }
     if (!array_key_exists($pay_type, $types)) {
         $this->send_error(__('Pay Type does not exists.', 'wp-erp'));
     }
     if (!array_key_exists($reason, $reasons)) {
         $this->send_error(__('Reason does not exists.', 'wp-erp'));
     }
     $employee = new Employee($employee_id);
     if ($employee->id) {
         $employee->update_compensation($pay_rate, $pay_type, $reason, $date, $comment);
         $this->send_success();
     }
     $this->send_error(__('Something went wrong!', 'wp-erp'));
 }
Exemple #2
0
<div class="compensation-form-wrap">
    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Date', 'wp-erp'), 'name' => 'date', 'value' => date('Y-m-d', current_time('timestamp')), 'required' => true, 'class' => 'erp-date-field'));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Pay Rate', 'wp-erp'), 'name' => 'pay_rate', 'value' => '{{ data.work.pay_rate }}', 'required' => true));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Pay Type', 'wp-erp'), 'name' => 'pay_type', 'value' => '', 'type' => 'select', 'options' => array(0 => __('- Select -', 'wp-erp')) + erp_hr_get_pay_type()));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Change Reason', 'wp-erp'), 'name' => 'change-reason', 'value' => '', 'type' => 'select', 'options' => array(0 => __('- Select -', 'wp-erp')) + erp_hr_get_pay_change_reasons()));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Comment', 'wp-erp'), 'name' => 'comment', 'value' => '', 'placeholder' => __('Optional comment', 'wp-erp'), 'type' => 'textarea', 'custom_attr' => array('rows' => 4, 'cols' => 25)));
?>
    </div>
Exemple #3
0
                <th><?php 
_e('Job Title', 'wp-erp');
?>
</th>
                <th><?php 
_e('Reports To', 'wp-erp');
?>
</th>
                <th class="action">&nbsp;</th>
            </tr>
        </thead>
        <tbody>

            <?php 
if ($history['job']) {
    $types = erp_hr_get_pay_type();
    foreach ($history['job'] as $num => $row) {
        ?>
                    <tr class="<?php 
        echo $num % 2 == 0 ? 'alternate' : 'odd';
        ?>
">
                        <td><?php 
        echo erp_format_date($row->date);
        ?>
</td>
                        <td>
                            <?php 
        echo !empty($row->type) ? $row->type : '--';
        ?>
                        </td>
Exemple #4
0
                <?php 
erp_html_form_input(array('label' => __('Date of Hire', 'wp-erp'), 'name' => 'work[hiring_date]', 'value' => '{{ data.work.hiring_date }}', 'type' => 'text', 'class' => 'erp-date-field'));
?>
            </li>

            <# if ( ! data.id ) { #>

                <li>
                    <?php 
erp_html_form_input(array('label' => __('Pay Rate', 'wp-erp'), 'name' => 'work[pay_rate]', 'value' => '{{ data.work.pay_rate }}', 'type' => 'text'));
?>
                </li>

                <li data-selected="{{ data.work.pay_type }}">
                    <?php 
erp_html_form_input(array('label' => __('Pay Type', 'wp-erp'), 'name' => 'work[pay_type]', 'value' => '{{ data.work.pay_type }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => array('-1' => __('- Select -', 'wp-erp')) + erp_hr_get_pay_type()));
?>
                </li>

            <# } #>

            <li>
                <?php 
erp_html_form_input(array('label' => __('Work Phone', 'wp-erp'), 'name' => 'personal[work_phone]', 'value' => '{{ data.personal.work_phone }}'));
?>
            </li>

            <?php 
do_action('erp-hr-employee-form-work');
?>