Payment Method in Invoice

We development the next source for show the methods of payment in invoice.

In the file “application/modules/invoices/views/view.php”, in the line 254 where code appears

<"input type=“text” class="form-control"
name=“custom[<?php echo $custom_field->custom_field_column; ?>]“
id=”<?php echo $custom_field->custom_field_column; ?>“
value=”<?php echo form_prep($this->mdl_invoices->form_value('custom[' . $custom_field->custom_field_column . ']')); ?>”>

replace for the next source

<?php if($custom_field->custom_field_label=="Pago"){?>
                <"select name="custom[<?php echo $custom_field->custom_field_column; ?>]" id="<?php echo $custom_field->custom_field_column; ?>" class="form-control" style="width:19%;">
                    <?php foreach ($payment_methods as $payment_method) { ?>
                        <"option <?php if(form_prep($this->mdl_invoices->form_value('custom[' . $custom_field->custom_field_column . ']'))==$payment_method->payment_method_name) echo "selected " ?>value="<?php echo $payment_method->payment_method_name; ?>">
                            <?php echo $payment_method->payment_method_name; ?>
                        <"/option>
                    <?php } ?>
                <"/select>
            <?php }else{ ?>
                <"input type="text" class="form-control"
                       name="custom[<?php echo $custom_field->custom_field_column; ?>]"
                       id="<?php echo $custom_field->custom_field_column; ?>"
                       value="<?php echo form_prep($this->mdl_invoices->form_value('custom[' . $custom_field->custom_field_column . ']')); ?>">
            <?php } ?>

and in the line 46 replace custom: $(‘input[name^=custom]’).serializeArray() for “custom: $(‘input[name^=custom],select[name^=custom]’).serializeArray()”.

Only one more thing, you need create de custom field. You should put in Label = “Pago” and in Table = “Invoice”

PD in the html’s labels quit the " :slight_smile: