<?xml version="1.0" encoding="UTF-8"?>
<!--
    Document   : partidas.xml
    Author     : Carlos Garcia Gomez
    Description:
        Structure for the partidas table.
-->
<table>
    <column>
        <name>baseimponible</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <column>
        <name>cifnif</name>
        <type>character varying(30)</type>
    </column>
    <column>
        <name>codcontrapartida</name>
        <type>character varying(15)</type>
    </column>
    <column>
        <name>coddivisa</name>
        <type>character varying(3)</type>
    </column>
    <column>
        <name>codserie</name>
        <type>character varying(4)</type>
    </column>
    <column>
        <name>codsubcuenta</name>
        <type>character varying(15)</type>
        <null>NO</null>
    </column>
    <column>
        <name>concepto</name>
        <type>character varying(255)</type>
    </column>
    <column>
        <name>debe</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>    
    <column>
        <name>documento</name>
        <type>character varying(50)</type>
    </column>
    <column>
        <name>factura</name>
        <type>character varying(15)</type>
    </column>
    <column>
        <name>haber</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <column>
        <name>idasiento</name>
        <type>integer</type>
        <null>NO</null>
    </column>
    <column>
        <name>idcontrapartida</name>
        <type>integer</type>
    </column>
    <column>
        <name>idpartida</name>
        <type>serial</type>
        <null>NO</null>
    </column>
    <column>
        <name>idsubcuenta</name>
        <type>integer</type>
        <null>NO</null>
    </column>
    <column>
        <name>iva</name>
        <type>double precision</type>
    </column>
    <column>
        <name>orden</name>
        <type>integer</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <column>
        <name>punteada</name>
        <type>boolean</type>
        <null>NO</null>
        <default>false</default>
    </column>
    <column>
        <name>recargo</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <column>
        <name>saldo</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <column>
        <name>tasaconv</name>
        <type>double precision</type>
        <null>NO</null>
        <default>0</default>
    </column>
    <constraint>
        <name>partidas_pkey</name>
        <type>PRIMARY KEY (idpartida)</type>
    </constraint>
    <constraint>
        <name>ca_partidas_asientos</name>
        <type>FOREIGN KEY (idasiento) REFERENCES asientos (idasiento) ON DELETE CASCADE ON UPDATE CASCADE</type>
    </constraint>
    <constraint>
        <name>ca_partidas_subcuentas</name>
        <type>FOREIGN KEY (idsubcuenta) REFERENCES subcuentas (idsubcuenta) ON DELETE RESTRICT ON UPDATE CASCADE</type>
    </constraint>
    <constraint>
        <name>ca_partidas_subcuentas2</name>
        <type>FOREIGN KEY (idcontrapartida) REFERENCES subcuentas (idsubcuenta) ON DELETE SET NULL ON UPDATE CASCADE</type>
    </constraint>
</table>