Skip to main content

Overview

The company profile contains your business information that appears on invoices and throughout the Simple Invoice system. All settings are stored in the perfil table.

Profile Configuration

Access the company profile by navigating to the configuration page (perfil.php). The profile is identified by id_perfil=1 in the database.
$query_empresa=mysqli_query($con,"select * from perfil where id_perfil=1");
$row=mysqli_fetch_array($query_empresa);

Database Schema

The perfil table contains the following fields:
CREATE TABLE IF NOT EXISTS `perfil` (
  `id_perfil` int(11) NOT NULL,
  `nombre_empresa` varchar(150) NOT NULL,
  `direccion` varchar(255) NOT NULL,
  `ciudad` varchar(100) NOT NULL,
  `codigo_postal` varchar(100) NOT NULL,
  `estado` varchar(100) NOT NULL,
  `telefono` varchar(20) NOT NULL,
  `email` varchar(64) NOT NULL,
  `impuesto` int(2) NOT NULL,
  `moneda` varchar(6) NOT NULL,
  `logo_url` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Configuration Fields

Company Information

nombre_empresa
string
required
Company name (up to 150 characters)
<input type="text" name="nombre_empresa" value="<?php echo $row['nombre_empresa']?>" required>
telefono
string
required
Company phone number (up to 20 characters)
<input type="text" name="telefono" value="<?php echo $row['telefono']?>" required>
email
string
Company email address (up to 64 characters)
<input type="email" name="email" value="<?php echo $row['email']?>">

Address Information

direccion
string
required
Street address (up to 255 characters)
<input type="text" name="direccion" value="<?php echo $row['direccion']?>" required>
ciudad
string
required
City name (up to 100 characters)
<input type="text" name="ciudad" value="<?php echo $row['ciudad']?>" required>
estado
string
State, region, or province (up to 100 characters)
<input type="text" name="estado" value="<?php echo $row['estado']?>">
codigo_postal
string
Postal or ZIP code (up to 100 characters)
<input type="text" name="codigo_postal" value="<?php echo $row['codigo_postal']?>">

Financial Settings

impuesto
integer
required
Tax/IVA percentage (2 digits max)
<input type="text" name="impuesto" value="<?php echo $row['impuesto']?>" required>
Enter the tax percentage as a whole number. For example, enter 13 for 13% tax.
moneda
string
required
Currency symbol (up to 6 characters)Selected from the currencies table:
<select name="moneda" required>
  <?php 
    $sql="select name, symbol from currencies group by symbol order by name";
    $query=mysqli_query($con,$sql);
    while($rw=mysqli_fetch_array($query)){
      $simbolo=$rw['symbol'];
      $moneda=$rw['name'];
      if ($row['moneda']==$simbolo){
        $selected="selected";
      } else {
        $selected="";
      }
      ?>
      <option value="<?php echo $simbolo;?>" <?php echo $selected;?>>
        <?php echo ($simbolo);?>
      </option>
      <?php
    }
  ?>
</select>
See Currency Configuration for available currencies.
logo_url
string
Path to company logo image (up to 255 characters)The logo is displayed on invoices and the profile page:
<img class="img-responsive" src="<?php echo $row['logo_url'];?>" alt="Logo">

Logo Upload

The system supports logo uploads via AJAX using the file upload input:
<input class='filestyle' data-buttonText="Logo" type="file" 
       name="imagefile" id="imagefile" onchange="upload_image();">

Upload Implementation

function upload_image(){
  var inputFileImage = document.getElementById("imagefile");
  var file = inputFileImage.files[0];
  if( (typeof file === "object") && (file !== null) )
  {
    $("#load_img").text('Cargando...');	
    var data = new FormData();
    data.append('imagefile',file);
    
    $.ajax({
      url: "ajax/imagen_ajax.php",
      type: "POST",
      data: data,
      contentType: false,
      cache: false,
      processData:false,
      success: function(data) {
        $("#load_img").html(data);
      }
    });	
  }
}
Logo uploads are processed by ajax/imagen_ajax.php and stored in the img/ directory.

Updating Profile

The profile form submits data via AJAX to ajax/editar_perfil.php:
$("#perfil").submit(function(event) {
  $('.guardar_datos').attr("disabled", true);
  
  var parametros = $(this).serialize();
  $.ajax({
    type: "POST",
    url: "ajax/editar_perfil.php",
    data: parametros,
    beforeSend: function(objeto){
      $("#resultados_ajax").html("Mensaje: Cargando...");
    },
    success: function(datos){
      $("#resultados_ajax").html(datos);
      $('.guardar_datos').attr("disabled", false);
    }
  });
  event.preventDefault();
})

Example Data

Here’s an example of a complete company profile:
INSERT INTO `perfil` VALUES (
  1, 
  'SISTEMAS WEB LA', 
  'Colonias Los Andes  #250', 
  'Moncagua', 
  '3301', 
  'San Miguel', 
  '+(503) 2682-555', 
  '[email protected]', 
  13, 
  '$', 
  'img/1478792451_google30.png'
);

Company Name

SISTEMAS WEB LA

Tax Rate

13%

Currency

$ (US Dollar)

Location

Moncagua, San Miguel

Best Practices

  • Use PNG or JPG format
  • Recommended size: 200x200 pixels or larger
  • Keep file size under 1MB for optimal performance
  • Logo should have a transparent background for best results
  • Enter the tax percentage as a whole number (e.g., 13 for 13%)
  • The system stores this as an integer (2 digits max)
  • Tax is applied to invoices automatically
  • Update this value when tax rates change
Required fields:
  • nombre_empresa (Company name)
  • telefono (Phone)
  • direccion (Address)
  • ciudad (City)
  • impuesto (Tax rate)
  • moneda (Currency)
Optional fields:
  • email
  • estado (State/Region)
  • codigo_postal (Postal code)
  • logo_url

Build docs developers (and LLMs) love