
INSERT INTO `menu` (`id`, `menu_id`, `nazov`, `page`, `poradie`, `level`, `visibility_type`)
VALUES
  (6000, NULL, 'Faktúry', 'faktura', 7, 1, 1),
  (6001, 6000, 'Výpis faktúr', 'faktura_vypis', 1, 2, 1),
  (6002, 6000, 'Pridanie faktúry', 'faktura_pridaj', 2, 2, 1),
  (6003, 6001, 'Detail faktúry', 'faktura_view', 1, 3, 1),
  (6004, 6001, 'Editovanie faktúry', 'faktura_edituj', 2, 3, 1),
  (6005, 6001, 'Zmazanie faktúry', 'faktura_zmaz', NULL, 3, NULL),
  (6006, 6001, 'Editovanie položky faktúry', 'polozka_faktury_edituj', NULL, 3, NULL),
  (6007, 6001, 'Pridanie položky faktúry', 'polozka_faktury_pridaj', NULL, 3, NULL),
  (6008, 6001, 'Zmazanie položky faktúry', 'polozka_faktury_zmaz', NULL, 3, NULL),
  (6009, 6001, 'Zmena stavu faktúry', 'faktura_stav', NULL, 3, NULL),
  (6010, 6001, 'Tlač faktúru', 'faktura_tlac', NULL, 3, NULL);

INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
  (69, 'Faktúra', 'faktura');
INSERT INTO `form` (`id`, `nazov`, `code`)
VALUES
  (61, 'Položka faktúry', 'polozka_faktury');

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`)
VALUES
  (6001, 69, 'Dátumy', 'faktura-datumy', 2),
  (6002, 69, 'Základné informácie', 'faktura-zakladne-informacie', 1),
  (6003, 69, 'Doplňujúce údaje', 'faktura-doplnujuce-udaje', 3),
  (6004, 69, 'Priradenie faktúry', 'faktura-priradenie-faktury', 4);

INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`)
VALUES
  (6101, 61, 'Položka faktúry', 'polozka-faktury', 1);

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
  (6000, 6002, 5, 'faktura', 'obchodny_partner_id', 'obchodny_partner', NULL, 'Odberateľ', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', '\r\n', 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
  (6001, 6002, 1, 'faktura', 'cislo', NULL, NULL, 'Číslo faktúry', 40, NULL, NULL, NULL, NULL, NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<vlvalidator name=\"vdaemonTestCislo\" type=\"custom\" function=\"vdaemonTestCislo\" />', NULL, NULL, NULL, NULL),
  (6002, 6001, 4, 'faktura', 'datum_vystavenia', NULL, NULL, 'Dátum vystavenia', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NOW', NULL, NULL, NULL, NULL, NULL),
  (6003, 6001, 4, 'faktura', 'datum_splatnosti', NULL, NULL, 'Dátum splatnosti', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
  (6004, 6003, 5, 'faktura', 'stav_faktury_id', 'stav_faktury', NULL, 'Stav faktúry', 20, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
  (6005, 6003, 1, 'faktura', 'konstantny_symbol', NULL, NULL, 'Konštantný symbol', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0308', NULL, NULL, NULL, NULL, NULL),
  (6006, 6003, 1, 'faktura', 'variabilny_symbol', NULL, NULL, 'Variabilný symbol', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
  (6007, 6003, 5, 'faktura', 'forma_uhrady_id', 'forma_uhrady', NULL, 'Forma úhrady', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, '1', NULL, 1, NULL, NULL, NULL),
  (6008, 6001, 4, 'faktura', 'datum_dodania', NULL, NULL, 'Dátum dodania', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NOW', NULL, NULL, NULL, NULL, NULL),
  (6009, 6002, 5, 'faktura', 'typ_faktury_id', 'typ_faktury', NULL, 'Typ faktúry', 10, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
  (6010, 6002, 5, 'faktura', 'ucet_id', 'ucet', NULL, 'Účet', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, '1', NULL, NULL, NULL, NULL, NULL),
  (6011, 6004, 5, 'faktura', 'faktura_id', 'faktura', NULL, 'Predfaktúra', 10, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL),
  (6100, 6101, 13, 'polozka_faktury', 'faktura_id', NULL, NULL, 'Faktúra', 1, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
  (6101, 6101, 1, 'polozka_faktury', 'nazov', '', NULL, 'Názov', 2, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL),
  (6102, 6101, 1, 'polozka_faktury', 'mnozstvo', NULL, NULL, 'Množstvo', 3, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL),
  (6103, 6101, 5, 'polozka_faktury', 'mj_id', 'mj', NULL, 'Merná jednotka', 4, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, '1', NULL, 0, NULL, NULL, NULL),
  (6104, 6101, 1, 'polozka_faktury', 'cena_za_kus', NULL, NULL, 'Cena za mj', 5, NULL, NULL, NULL, NULL, '€ bez DPH', 1, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL),
  (6105, 6101, 1, 'polozka_faktury', 'sadzba_dph', NULL, NULL, 'Sadzba DPH', 6, NULL, NULL, NULL, NULL, '%', 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '20', NULL, NULL, NULL, NULL, NULL),
  (6106, 6101, 1, 'polozka_faktury', 'zlava_percent', NULL, NULL, 'Zľava', 7, NULL, NULL, NULL, NULL, '%', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`)
VALUES
  (600, 'Pridanie faktúry', 'faktura_pridaj', 'faktura'),
  (601, 'Editovanie faktúry', 'faktura_edituj', 'faktura'),
  (602, 'Zmazanie faktúry', 'faktura_zmaz', 'faktura'),
  (610, 'Pridanie položky faktúry', 'polozka_faktury_pridaj', 'polozka_faktury'),
  (611, 'Editovanie položky faktúry', 'polozka_faktury_edituj', 'polozka_faktury'),
  (612, 'Zmazanie položky faktúry', 'polozka_faktury_zmaz', 'polozka_faktury');


CREATE TABLE `typ_faktury` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(255) DEFAULT NULL,
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDb DEFAULT CHARSET=utf8;

INSERT INTO `typ_faktury` (`id`, `nazov`, `code`)
VALUES
  (1, 'Faktúra', 'faktura'),
  (2, 'Predfaktúra', 'predfaktura');

CREATE TABLE `forma_uhrady` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(255) DEFAULT NULL,
  `code` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDb DEFAULT CHARSET=utf8;

INSERT INTO `forma_uhrady` (`id`, `nazov`, `code`)
VALUES
  (1, 'Prevodný príkaz', 'pp'),
  (2, 'Hotovosť', 'hotovost'),
  (3, 'Dobierka', 'dobierka');


CREATE TABLE `horny_text` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(255) DEFAULT NULL,
  `visibility_type` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `dolny_text` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nazov` varchar(255) DEFAULT NULL,
  `visibility_type` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `faktura` (
                         `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                         `dodavatel` TEXT NULL,
                         `dodavatel_prijmovy` TEXT NULL,
                         `odberatel_prijmovy_ico` VARCHAR(255) NULL DEFAULT NULL,
                         `odberatel` TEXT NULL,
                         `odberatel_prijmovy` TEXT NULL,
                         `nazov` VARCHAR(255) NULL DEFAULT NULL,
                         `dolny_text` VARCHAR(255) NULL DEFAULT NULL,
                         `cislo` INT(5) NULL DEFAULT NULL,
                         `horny_text` VARCHAR(255) NULL DEFAULT NULL,
                         `datum_vystavenia` DATE NULL DEFAULT NULL,
                         `datum_splatnosti` DATE NULL DEFAULT NULL,
                         `datum_dodania` DATE NULL DEFAULT NULL,
                         `konstantny_symbol` INT(4) NULL DEFAULT NULL,
                         `variabilny_symbol` VARCHAR(50) NULL DEFAULT NULL,
                         `ucet_nazov` VARCHAR(255) NULL DEFAULT NULL,
                         `ucet_iban` VARCHAR(255) NULL DEFAULT NULL,
                         `banka_nazov` VARCHAR(255) NULL DEFAULT NULL,
                         `banka_pobocka` VARCHAR(255) NULL DEFAULT NULL,
                         `banka_swift` VARCHAR(255) NULL DEFAULT NULL,
                         `zamestnanec_nazov` VARCHAR(255) NULL DEFAULT NULL,
                         `zamestnanec_mobil` VARCHAR(255) NULL DEFAULT NULL,
                         `zamestnanec_email` VARCHAR(255) NULL DEFAULT NULL,
                         `zamestnanec_podpis` VARCHAR(255) NULL DEFAULT NULL,
                         `zamestnanec_peciatka` VARCHAR(255) NULL DEFAULT NULL,
                         `visibility_type` TINYINT(1) NULL DEFAULT NULL,
                         `faktura_id` INT(10) UNSIGNED NOT NULL,
                         `typ_faktury_id` INT(10) UNSIGNED NOT NULL,
                         `dolny_text_id` INT(10) UNSIGNED NOT NULL,
                         `horny_text_id` INT(10) UNSIGNED NOT NULL,
                         `forma_uhrady_id` INT(10) UNSIGNED NOT NULL,
                         `zamestnanec_id` INT(11) NOT NULL,
                         `ucet_id` INT(11) NULL DEFAULT NULL,
                         `obchodny_partner_id` INT(11) NULL DEFAULT NULL,
                         `suma_bez_dph` FLOAT(14,4) NULL DEFAULT NULL,
                         `suma_s_dph` FLOAT(14,4) NULL DEFAULT NULL,
                         `stav_platby_id` INT(10) NULL DEFAULT '1',
                         `cislo_objednavky` VARCHAR(255) NULL DEFAULT NULL,
                         PRIMARY KEY (`id`),
                         INDEX `fk_faktura_faktura1_idx` (`faktura_id`),
                         INDEX `fk_faktura_typ_faktury1_idx` (`typ_faktury_id`),
                         INDEX `fk_faktura_dolny_text1_idx` (`dolny_text_id`),
                         INDEX `fk_faktura_horny_text1_idx` (`horny_text_id`),
                         INDEX `fk_faktura_forma_uhrady1_idx` (`forma_uhrady_id`),
                         INDEX `fk_faktura_zamestnanec1_idx` (`zamestnanec_id`),
                         INDEX `fk_faktura_firma1_idx` (`obchodny_partner_id`),
                         INDEX `fk_faktura_ucet_idx` (`ucet_id`)
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
  AUTO_INCREMENT=5
;


CREATE TABLE `priradenie_platby` (
                                   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                                   `nazov` VARCHAR(45) NULL DEFAULT NULL,
                                   `code` VARCHAR(45) NULL DEFAULT NULL,
                                   PRIMARY KEY (`id`)
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
;

INSERT INTO `priradenie_platby` (`id`, `nazov`, `code`) VALUES (60, 'Faktúra', 'faktura');

CREATE TABLE `platba` (
                        `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                        `suma` FLOAT(10,2) NULL DEFAULT NULL,
                        `datum` DATE NULL DEFAULT NULL,
                        `poznamka` TEXT NULL,
                        `nazov` VARCHAR(255) NULL DEFAULT NULL,
                        `priradenie_platby_id` INT(10) UNSIGNED NULL DEFAULT NULL,
                        `priradenie_primary_id` INT(10) UNSIGNED NULL DEFAULT NULL,
                        `visibility_type` TINYINT(1) NULL DEFAULT NULL,
                        `forma_uhrady_id` INT(10) UNSIGNED NULL DEFAULT NULL,
                        PRIMARY KEY (`id`),
                        INDEX `fk_platba_priradenie_platby1_idx` (`priradenie_platby_id`),
                        INDEX `fk_platba_forma_uhrady1_idx` (`forma_uhrady_id`),
                        CONSTRAINT `fk_platba_forma_uhrady1` FOREIGN KEY (`forma_uhrady_id`) REFERENCES `forma_uhrady` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION,
                        CONSTRAINT `fk_platba_priradenie_platby1` FOREIGN KEY (`priradenie_platby_id`) REFERENCES `priradenie_platby` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
;


INSERT INTO `form` (`id`, `nazov`, `code`) VALUES (310, 'Platba', 'platba');
INSERT INTO `form_group` (`id`, `form_id`, `nazov`, `code`, `position`, `poznamka`, `group_type`) VALUES (31000, 310, 'Základné informácie', 'platba_zakladne_informacie', 10, NULL, 1);

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31000, 31000, 4, 'platba', 'datum', NULL, NULL, 'Dátum platby', 20, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'NOW', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31001, 31000, 1, 'platba', 'nazov', NULL, NULL, 'Názov', 10, NULL, NULL, NULL, NULL, 'číslo daňového dokladu, bankového výpisu, alebo iné', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31002, 31000, 1, 'platba', 'suma', NULL, NULL, 'Suma', 30, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31003, 31000, 5, 'platba', 'forma_uhrady_id', 'forma_uhrady', NULL, 'Forma úhrady', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, 'select2', NULL, 1, NULL, NULL, NULL, 1, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31004, 31000, 2, 'platba', 'poznamka', NULL, NULL, 'Poznámka', 50, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31005, 31000, 13, 'platba', 'priradenie_platby_id', NULL, NULL, 'Priradenie platby', NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`) VALUES (31006, 31000, 13, 'platba', 'priradenie_primary_id', NULL, NULL, 'Primary id', NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (310, 'Pridanie platby', 'platba_pridaj', NULL);
INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (311, 'Editovanie platba', 'platba_edituj', NULL);
INSERT INTO `log_type` (`id`, `nazov`, `code`, `primary_table`) VALUES (312, 'Zmazanie platby', 'platba_zmaz', NULL);

CREATE TABLE `polozka_faktury` (
                                 `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                                 `nazov` VARCHAR(255) NULL DEFAULT NULL,
                                 `mnozstvo` FLOAT(10,4) NULL DEFAULT NULL,
                                 `cena_za_kus` FLOAT(10,4) NULL DEFAULT NULL,
                                 `sadzba_dph` INT(11) NULL DEFAULT NULL,
                                 `visibility_type` TINYINT(1) NULL DEFAULT NULL,
                                 `faktura_id` INT(10) UNSIGNED NOT NULL,
                                 `zlava_percent` INT(10) NULL DEFAULT '0',
                                 `merna_jednotka_id` INT(10) NULL DEFAULT NULL,
                                 PRIMARY KEY (`id`),
                                 INDEX `fk_polozka_faktury_faktura1_idx` (`faktura_id`)
)
  COLLATE='utf8_general_ci'
  ENGINE=MyISAM
  AUTO_INCREMENT=175
;

/* 23:01:40 sbsky */ CREATE TABLE `ucet` (   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,   `fakturacne_udaje_id` int(10) unsigned NOT NULL,   `banka_id` int(10) unsigned NOT NULL,   `nazov` varchar(255) DEFAULT NULL,   `cislo_uctu` int(10) unsigned DEFAULT NULL,   `iban` varchar(50) DEFAULT NULL,   `visibility_type` tinyint(1) unsigned DEFAULT NULL,   PRIMARY KEY (`id`),   KEY `ucet_FKIndex1` (`banka_id`),   KEY `ucet_FKIndex2` (`fakturacne_udaje_id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/* 13:45:05 sbsky */ CREATE TABLE `banka` (   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,   `nazov` varchar(255) DEFAULT NULL,   `kod` varchar(20) DEFAULT NULL,   `pobocka` varchar(255) DEFAULT NULL,   `swift` varchar(255) DEFAULT NULL,   PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

/* 17:00:58 a-panter_crm */ ALTER TABLE `ucet` DROP `fakturacne_udaje_id`;

INSERT INTO `form_element` (`id`, `form_group_id`, `form_element_type_id`, `db_table`, `db_column`, `db_multi_table`, `db_multivalue_table`, `column_title`, `position`, `attribute`, `width`, `height`, `help`, `example`, `direct_to_db`, `required`, `number`, `float_number`, `email`, `css_style`, `css_class`, `javascript`, `direct_multi_label`, `direct_multi_data`, `default_val`, `vdaemon`, `add_empty_option`, `html`, `lang_code`, `read_only`)
VALUES
(6014, 6003, 1, 'faktura', 'cislo_objednavky', NULL, NULL, 'Číslo objednávky', 40, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

INSERT INTO `typ_faktury` (`id`, `nazov`, `code`)
VALUES
(3, 'Dobropis', 'dobropis');

CREATE TABLE `stav_platby` (
                             `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                             `nazov` VARCHAR(45) NULL DEFAULT NULL,
                             `code` VARCHAR(45) NULL DEFAULT NULL,
                             PRIMARY KEY (`id`)
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
  AUTO_INCREMENT=4
;
INSERT INTO `stav_platby` (`id`, `nazov`, `code`) VALUES (1, 'Nezaplatené', 'nezaplatene');
INSERT INTO `stav_platby` (`id`, `nazov`, `code`) VALUES (2, 'Čiastočne zaplatené', 'ciastocne_zaplatene');
INSERT INTO `stav_platby` (`id`, `nazov`, `code`) VALUES (3, 'Zaplatené', 'zaplatene');
CREATE TABLE `stav_faktury` (
                              `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                              `nazov` VARCHAR(255) NULL DEFAULT NULL,
                              `code` VARCHAR(50) NULL DEFAULT NULL,
                              PRIMARY KEY (`id`)
)
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB
  AUTO_INCREMENT=3
;
INSERT INTO `stav_faktury` (`id`, `nazov`, `code`) VALUES (1, 'Neuhradená', 'neuhradena');
INSERT INTO `stav_faktury` (`id`, `nazov`, `code`) VALUES (2, 'Uhradená', 'uhradena');
UPDATE `form_element` SET `db_column`='stav_platby_id', `db_multi_table`='stav_platby', `column_title`='Stav platby', `direct_to_db`='0', `required`='0', `read_only`='1' WHERE  `id`=6004;
UPDATE `form_element` SET `db_column`='merna_jednotka_id', `db_multi_table`='merna_jednotka' WHERE  `id`=6103;