INSERT INTO `util`.`config` ( `dbVersion`, `hasTriggersDisabled`, `environment`) 
    VALUES ('1.0.0', '0', 'development');

INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`)
    SELECT id,name, MD5('nightmare'), id, 1, CONCAT(name, '@verdnatura.es')
        FROM `account`.`role`;

INSERT INTO `vn`.`worker`(`id`,`workerCode`, `firstName`, `name`, `userFk`)
    SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id
        FROM `vn`.`user`;

DELETE FROM `vn`.`worker` where name ='customer';

INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`)
    VALUES 
        (101,     'BruceWayne',         'ac754a330530832ba1bf7687f577da91', 2,    1, 'BruceWayne@verdnatura.es'),
        (102,     'PetterParker',       'ac754a330530832ba1bf7687f577da91', 2,    1, 'PetterParker@verdnatura.es'),
        (103,     'ClarkKent',          'ac754a330530832ba1bf7687f577da91', 2,    1, 'ClarkKent@verdnatura.es'),
        (104,     'TonyStark',          'ac754a330530832ba1bf7687f577da91', 2,    1, 'TonyStark@verdnatura.es'),
        (105,     'MaxEisenhardt',      'ac754a330530832ba1bf7687f577da91', 2,    1, 'MaxEisenhardt@verdnatura.es'),
        (106,     'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 2,   1, 'DavidCharlesHaller@verdnatura.es'),
        (107,     'HankPym',            'ac754a330530832ba1bf7687f577da91', 2,    1, 'HankPym@verdnatura.es'),
        (108,     'CharlesXavier',      'ac754a330530832ba1bf7687f577da91', 2,   1, 'CharlesXavier@verdnatura.es'),
        (109,     'BruceBanner',        'ac754a330530832ba1bf7687f577da91', 2,   1, 'BruceBanner@verdnatura.es'),
        (110,    'JessicaJones',       'ac754a330530832ba1bf7687f577da91', 2,    1, 'JessicaJones@verdnatura.es');

 INSERT INTO `vn`.`worker`(`workerCode`, `id`, `firstName`, `name`, `userFk`)
    VALUES
        ('LGN', 106, 'David Charles',  'Haller', 106),
        ('ANT', 107, 'Hank',           'Pym',    107),
        ('DCX', 108, 'Charles',        'Xavier', 108),
        ('HLK', 109, 'Bruce',          'Banner', 109),
        ('JJJ', 110, 'Jessica',        'Jones',  110); 

INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`)
    VALUES 
        (1, 'España',   0, 'ES', 1),
        (2, 'Italia',   1, 'IT', 1),
        (3, 'Alemania', 1, 'DE', 1),
        (4, 'Rumania',  1, 'RO', 1),
        (5, 'Holanda',  1, 'NL', 1),
        (30,'Francia',  1, 'FR', 1);

INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`)
    VALUES
        (1,    'Warehouse One',   0, 1, 1, 1),
        (2,    'Warehouse Two',   0, 1, 1, 1),
        (3,    'Warehouse Three', 1, 1, 1, 1),
        (4,    'Warehouse Four',  1, 1, 1, 1),
        (5,    'Warehouse Five',  1, 1, 1, 0);

INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
    VALUES
        (1, 'Main Warehouse');

INSERT INTO `vn`.`accountingType`(`id`, `description`)
    VALUES 
        (1, 'Digital money'),
        (2, 'Cash'),
        (3, 'Card'),
        (4, 'Stolen Money'),
        (5, 'Miscellaneous');

INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`)
    VALUES 
        (8, 'Pay on receipt', '0000000000', 4, 0, 1);

INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
    VALUES
        (1,     'inhouse pickup',               1, 0, 8, 1),
        (2,     'Super-Man delivery',           1, 0, 8, 1),
        (3,     'Teleportation device',         1, 0, 8, 1),
        (4,     'Entanglement',                 1, 0, 8, 1),
        (5,     'Quantum break device',         1, 0, 8, 1),
        (6,     'Walking',                      1, 0, 8, 1);

UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
UPDATE `vn`.`agencyMode` SET `id` = 3 WHERE `name` = 'Teleportation device';
UPDATE `vn`.`agencyMode` SET `id` = 4 WHERE `name` = 'Entanglement';
UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device';
UPDATE `vn`.`agencyMode` SET `id` = 6 WHERE `name` = 'Walking';

UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE  `id` = 1;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE  `id` = 2;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 3;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE  `id` = 4;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE  `id` = 5;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 6;

UPDATE `vn`.`agencyMode` SET `web` = 1 WHERE  `id` = 1;

INSERT INTO `vn`.`payMethod`(`id`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`)
    VALUES 
        (1, 'PayMethod one',            0,  001, 0),
        (2, 'PayMethod two',            10, 001, 0),
        (3, 'PayMethod three',          0,  001, 0),
        (4, 'PayMethod with IBAN',      0,  001, 1),
        (5, 'PayMethod five',           10, 001, 0);

INSERT INTO `vn`.`payDem`(`id`, `payDem`)
    VALUES 
        (1, 10),
        (2, 20);

INSERT INTO `vn2008`.`zones`(`zone_id`, `name`, `printingOrder`)
    VALUES 
        (1, 'zone one',   1),
        (2, 'zone two',   2),
        (3, 'zone three', 3);

INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`)
    VALUES
        (1, 'Province one',     1, NULL, 1),
        (2, 'Province two',     1, NULL, 2),
        (3, 'Province three',   1, NULL, 3),
        (4, 'Province four',    1, NULL, 2),
        (5, 'Province five',    1, NULL, 1);

INSERT INTO `vn`.`agencyHour`(`id`, `agencyFk`, `weekDay`, `warehouseFk`, `provinceFk`, `maxHour`)
    VALUES
        ( 1, 1, 0, 1, 1, 13),
        ( 2, 1, 1, 1, 1, 14),
        ( 3, 1, 2, 1, 1, 15),
        ( 4, 1, 3, 1, 1, 16),
        ( 5, 1, 4, 1, 1, 17),
        ( 6, 2, 0, 1, 1, 13),
        ( 7, 2, 1, 1, 1, 14),
        ( 8, 2, 2, 1, 1, 15),
        ( 9, 2, 3, 1, 1, 16),
        ( 10, 2, 4, 1, 1, 17);

INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
    VALUES
         (1, 'normal',       'Normal'),
         (2, 'internalUse',  'Autoconsumo'),
         (3, 'handMaking',   'Confección'),
         (4, 'loses',        'Mermas');

INSERT INTO `vn`.`city`(`id`, `name`, `provinceFk`)
    VALUES
         (1, 'Gotham', 1);

INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
    VALUES
        (1, 'NIF');

INSERT INTO `vn`.`contactChannel`(`id`, `name`)
    VALUES
        (1, 'Rumors on the streets'),
        (2, 'Metropolis newspaper'),
        (3, 'Daily Bugle'),
        (4, 'GCN Channel'),
        (5, 'The Newspaper');

INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
    VALUES
        (101,     'Bruce Wayne',          '84612325V',  'Batman',         'Alfred',           '1007 Mountain Drive, Gotham',                    'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es',           NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
        (102,     'Petter Parker',        '87945234L',  'Spider-Man',     'Aunt May',         '20 Ingram Street',                               'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es',         NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 18, 0, 1),
        (103,     'Clark Kent',           '06815934E',  'Super-Man',      'lois lane',        '344 Clinton Street',                             'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es',            NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
        (104,     'Tony Stark',           '06089160W',  'Iron-Man',       'Pepper Potts',     '10880 Malibu Point',                             'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es',            NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
        (105,     'Max Eisenhardt',       '39182496H',  'Magneto',        'Rogue',            'Unknown Whereabouts',                            'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es',        NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, NULL, 0, 1),
        (106,     'DavidCharlesHaller',   '53136686Q',  'Legion',         'Charles Xavier',   'Evil hideout',                                   'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es',   NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
        (107,     'Hank Pym',             '09854837G',  'Ant-Man',        'Hawk',             'Anthill',                                        'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es',              NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
        (108,     'Charles Xavier',       '22641921P',  'Professor X',    'Beast',            '3800 Victory Pkwy, Cincinnati, OH 45207, USA',   'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es',        NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
        (109,     'Bruce Banner',         '16104829E',  'Hulk',           'Black widow',      'Somewhere in New York',                          'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es',          NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 19, 0, 1),
        (110,     'Jessica Jones',        '58282869H',  'Jessica Jones',  'Luke Cage',        'NYCC 2015 Poster',                               'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es',         NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, NULL, 0, 1);

INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
    VALUES
        ( 101, 50,  DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
        ( 102, 100, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
        ( 103, 0,   DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
        ( 104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH));

INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`)
    VALUES
        (101, '01 my other address',    'Somewhere in Thailand',      'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (102, '02 my other address',    'Somewhere in Poland',        'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (103, '03 my other address',    'Somewhere in Japan',         'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (104, '04 my other address',    'Somewhere in Spain',         'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (105, '05 my other address',    'Somewhere in Potugal',       'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (106, '06 my other address',    'Somewhere in UK',            'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (107, '07 my other address',    'Somewhere in Valencia',      'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (108, '08 my other address',    'Somewhere in Silla',         'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (109, '09 my other address',    'Somewhere in London',        'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (110, '10 my other address',    'Somewhere in Algemesi',      'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (111, '11 my other address',    'Somewhere in Carlet',        'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (112, '12 my other address',    'Somewhere in Campanar',      'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (113, '13 my other address',    'Somewhere in Malilla',       'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (114, '14 my other address',    'Somewhere in France',        'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (115, '15 my other address',    'Somewhere in Birmingham',    'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (116, '16 my other address',    'Somewhere in Scotland',      'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (117, '17 my other address',    'Somewhere in nowhere',       'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (118, '18 my other address',    'Somewhere over the rainbow', 'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (119, '19 my other address',    'Somewhere in Alberic',       'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (120, '20 my other address',    'Somewhere in Montortal',     'Silla', 46460, 1, NULL, NULL, 1, 0, 109,  2, NULL, NULL, 0),
        (121, 'my other address',       'the bat cave',               'Silla', 46460, 1, NULL, NULL, 1, 0, 101,  2, NULL, NULL, 0),
        (122, 'my other address',       'NY roofs',                   'Silla', 46460, 1, NULL, NULL, 1, 0, 102,  2, NULL, NULL, 0),
        (123, 'my other address',       'The phone box',              'Silla', 46460, 1, NULL, NULL, 1, 0, 103,  2, NULL, NULL, 0),
        (124, 'my other address',       'Stark tower',                'Silla', 46460, 1, NULL, NULL, 1, 0, 104,  2, NULL, NULL, 0),
        (125, 'my other address',       'The plastic cell',           'Silla', 46460, 1, NULL, NULL, 1, 0, 105,  2, NULL, NULL, 0),
        (126, 'my other address',       'Many places',                'Silla', 46460, 1, NULL, NULL, 1, 0, 106,  2, NULL, NULL, 0),
        (127, 'my other address',       'Your pocket',                'Silla', 46460, 1, NULL, NULL, 1, 0, 107,  2, NULL, NULL, 0),
        (128, 'my other address',       'Cerebro',                    'Silla', 46460, 1, NULL, NULL, 1, 0, 108,  2, NULL, NULL, 0),
        (129, 'my other address',       'Luke Cages Bar',             'Silla', 46460, 1, NULL, NULL, 1, 0, 110, 2, NULL, NULL, 0);

INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
    VALUES
        (1, 101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
        (2, 101, 5, 900,  DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
        (3, 101, 5, 800,  DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
        (4, 101, 5, 700,  DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
        (5, 101, 5, 600,  DATE_ADD(CURDATE(), INTERVAL -5 MONTH)),
        (6, 101, 5, 500,  DATE_ADD(CURDATE(), INTERVAL -6 MONTH)),
        (7, 101, 5, 400,  DATE_ADD(CURDATE(), INTERVAL -7 MONTH)),
        (8, 101, 9, 300,  DATE_ADD(CURDATE(), INTERVAL -8 MONTH)),
        (9, 101, 9, 200,  DATE_ADD(CURDATE(), INTERVAL -9 MONTH)),
        (10, 101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)),
        (11, 101, 9, 50,  DATE_ADD(CURDATE(), INTERVAL -11 MONTH)),
        (12, 102, 9, 800, CURDATE()),
        (13, 103, 9, 200, CURDATE()),
        (14, 104, 9, 90,  CURDATE()),
        (15, 105, 9, 90,  CURDATE());

INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
    VALUES
        (1, 9999999,   20),
        (2, 10000,     21),
        (3, 600,       13);

INSERT INTO `vn`.`clientObservation`(`id`, `clientFk`, `workerFk`, `text`, `created`)
    VALUES
        (1,  101,  1, 'Madness, as you know, is like gravity, all it takes is a little push',                                                                                                               CURDATE()),
        (2,  102,  1, 'With great power, comes great responsibility',                                                                                                                                       CURDATE()),
        (3,  103,  3, 'this is a job for Super-Man!',                                                                                                                                                       CURDATE()),
        (4,  104,  3, 'yes... I am Iron-Man',                                                                                                                                                               CURDATE()),
        (5,  105,  5, 'They do understand. Our mutant powers make us superior',                                                                                                                             CURDATE()),
        (6,  106,  5, 'My name is Legion, for we are many!',                                                                                                                                                CURDATE()),
        (7,  107,  9, 'I think our first move should be calling the Avengers..',                                                                                                                            CURDATE()),
        (8,  108,  9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.',                                                                                           CURDATE()),
        (9,  109,  20, 'HULK SMASH! ...',                                                                                                                                                                    CURDATE()),
        (10, 110,  20, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', CURDATE());

INSERT INTO `vn`.`observationType`(`id`,`description`)
    VALUES
        (1,'observation one'),
        (2,'observation two'),
        (3,'observation three');

 INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
    VALUES
        (1, 1, 1,'under the floor'),
        (2, 1, 2,'wears leather and goes out at night'),
        (3, 1, 3,'care with the dog');

INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`)
    VALUES
        (1, 101,  CURDATE(), CURDATE()),
        (2, 102,  CURDATE(), CURDATE()),
        (3, 103,  CURDATE(), CURDATE()),
        (4, 104,  CURDATE(), CURDATE()),
        (5, 105,  CURDATE(), CURDATE());

INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `creationDate`, `grade`)
    VALUES
        (1, 1 , 3000,   DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL),
        (2, 2 , 6000,   DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
        (3, 3,  10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);

INSERT INTO `vn`.`route`(`id`, `created`)
    VALUES
        (1, CURDATE()),
        (2, CURDATE()),
        (3, CURDATE()),
        (4, CURDATE()),
        (5, CURDATE()),
        (6, CURDATE()),
        (7, CURDATE());

INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
    VALUES
        (1, 'Wayne Industries');
 
 INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`)
    VALUES
         ( 69,   'CCs', NULL, 30,  NULL, 1),
        (442,  'VNL', NULL,  30,  2, 2),
       ( 567,  'VNH', NULL,  30,  NULL, 3),
        ( 791,  'FTH', NULL, 30,  NULL, 4),
        ( 1381, 'ORN', NULL,  30,  NULL,5);  

INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`)
    VALUES
        ( 1, 'T1111111' , 'T', 500      , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
        ( 2, 'V2222222' , 'V', 350.50   , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1), 
        ( 3, 'E3333333' , 'E', 90.30    , CURDATE(),                              103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
        ( 4, 'E4444444' , 'E', 290.30   , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
        ( 5, 'E5555555' , 'E', 190.30   , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);

 INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`, `refFk`)
    VALUES
        (1,  1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY),    101, 'Batman',          121, NULL),
        (2,  1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY),    101, 'Spider-Man',      121, NULL),
        (3,  2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY),     102, 'Super-Man',       122, NULL),
        (4,  2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY),     102, 'Iron-Man',        122, NULL),
        (5,  3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY),     103, 'Magneto',         123, NULL),
        (6,  3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY),     103, 'Legion',          123, NULL),
        (7,  4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY),     104, 'Ant-Man',         124, NULL),
        (8,  4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH),   104, 'Professor X',     124, NULL),
        (9,  5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH),   105, 'Hulk',            125, NULL),
        (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH),   105, 'Jessica Jones',   125, NULL),
        (11,  1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +10 DAY),   101, 'ticket 1',        121, NULL),
        (12,  1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH),  101, 'ticket 2',        121, NULL),
        (13,  2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH),  101, 'ticket 3',        121, NULL),
        (14,  2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH),  101, 'ticket 4',        121, NULL),
        (15,  3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH),  101, 'ticket 5',        121, NULL),
        (16,  3, 3, 4, CURDATE(),                               101, 'ticket 6',        121, NULL),
        (17,  4, 4, 4, CURDATE(),                               106, 'ticket 7',        126, NULL),
        (18,  4, 4, 4, CURDATE(),                               107, 'ticket 8',        127, NULL),
        (19,  5, 5, 4, CURDATE(),                               108, 'ticket 9',        128, NULL),
        (20,  5, 5, 4, CURDATE(),                               109, 'ticket 10',       119, NULL),
        (21,  5, 5, 4, CURDATE(),                               110, 'ticket 11',       129, NULL);

INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
    VALUES
        ( 1, 1 , 1, 'ready' ),
        ( 2, 2 , 2, 'do it fast please'),
        ( 3, 3 , 3, '');

INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`)
    VALUES
        (1,  1,  3, 5, CURDATE()),
        (2,  2,  15, 5, CURDATE()),
        (3,  3,  16, 5, CURDATE()),
        (4,  4,  13, 5, CURDATE()),
        (5,  5,  15, 18, CURDATE()),
        (6,  6,  16, 18, CURDATE()),
        (7,  7,  13, 18, CURDATE()),
        (8,  8,  15, 19, CURDATE()),
        (9,  9,  16, 19, CURDATE()),
        (10, 10, 13, 19, CURDATE()),
        (11, 11, 3, 19, CURDATE()),
        (12, 12, 3, 19, CURDATE()),
        (13, 13, 3, 19, CURDATE()),
        (14, 14, 3, 19, CURDATE()),
        (15, 15, 3, 19, CURDATE()),
        (16, 16, 1, 19, CURDATE()),
        (17, 17, 1, 19, CURDATE()),
        (18, 18, 1, 19, CURDATE()),
        (19, 19, 13, 19, CURDATE()),
        (20, 20, 15, 19, CURDATE()),
        (21, 21, 16, 19, CURDATE());

INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`)
    VALUES
        (1, '3333-BAT', 'WAYNE INDUSTRIES', 'BATMOBILE', 442, 1, 'The ultimate war machine',       50, 1),
        (2, '1111-IMK', 'STARK INDUSTRIES', 'MARK-III',  442, 1, 'Iron-Man Heavy Armor MARK-III',  18, 1),
        (3, '2222-IMK', 'STARK INDUSTRIES', 'MARK-VI',   442, 1, 'Iron-Man Heavy Armor MARK-VI',   16, 1),
        (4, '3333-IMK', 'STARK INDUSTRIES', 'MARK-VII',  442, 1, 'Iron-Man Heavy Armor MARK-VII',  14, 1),
        (5, '4444-IMK', 'STARK INDUSTRIES', 'MARK-XLII', 442, 1, 'Iron-Man Heavy Armor MARK-XLII', 13, 1),
        (6, '5555-IMK', 'STARK INDUSTRIES', 'MARK-XLV',  442, 1, 'Iron-Man Heavy Armor MARK-XLV',  12, 1);

INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`)
    VALUES
        (1, 'beta-server', 'nightmare@verdnatura.es', '200');

INSERT INTO `vn`.`greugeType`(`id`, `name`)
    VALUES
        (1, 'Diff'),
        (2, 'Recover'),
        (3, 'Manna'),
        (4, 'Reclaim'),
        (5, 'Heritage'),
        (6, 'Miscellaneous');

INSERT INTO `vn`.`greuge`(`id`, `clientFk`, `description`, `amount`, `shipped`, `created`, `greugeTypeFk`, `ticketFk`)
    VALUES
        (1,     101,    'some diff charges',          -19.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1,  1),
        (2,     101,    'more diff charges',          60,     DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2,  1),
        (3,     101,    'even more! diff charges',    -9.99,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3,  1),
        (4,     101,    'insane diff charges',        60,     DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4,  1),
        (5,     101,    'gargantuous diff charges',   -9.99,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5,  1),
        (6,     101,    'diff charges',               88.30,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6,  1),
        (7,     101,    'unaffordable diff charges',  -39.12, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 1,  1),
        (8,     101,    'some recovery charges',      29.35,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 2,  1),
        (9,     101,    'some manna charges',         -9.99,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 3,  1),
        (10,    101,    'some claim charges',         13.13,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 4,  1),
        (11,    101,    'some heritage charges',      -15.99, DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 5,  1),
        (12,    101,    'some miscellaneous charges', 58.00,  DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE(), 6,  1);

INSERT INTO `vn`.`mandateType`(`id`, `name`)
    VALUES
        (1, 'B2B'),
        (2, 'CORE');

INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `mandateTypeFk`)
    VALUES
        (1, 102, 442, '1-1', CURDATE(), 2);

INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`)
    VALUES
        (1, 'Plant',    1, 'B92A26'),
        (2, 'Flower',       2, 'dcf711');

INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`)
    VALUES
        (1, 'CRI', 'Crisantemo',    2, 15, 5),
        (2, 'ITG', 'Anthurium',     1, 30, 5),
        (3, 'WPN', 'Paniculata',    2, 30, 5);

INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
    VALUES
        ('YEL', 'Yellow',   1 , 1),
        ('BLU', 'Blue',     1 , 2),
        ('RED', 'Red',      1 , 3);

INSERT INTO `vn`.`origin`(`id`,`code`, `name`)
    VALUES
        (1, 'SPA', 'Spain'),
        (2, 'HOL', 'Holand'),
        (3, 'VLC', 'Valencia');

INSERT INTO `vn`.`producer`(`id`, `name`)
    VALUES
        (1, 'Marvel Studios'),
        (2, 'Nordic Mythology');

INSERT INTO `vn`.`taxType`(`id`, `nickname`, `isAccrued`, `serial`, `TIPOOPE`, `description`, `countryFk`)
    VALUES
        (1, 'National', 1, 'R', 'I', 'national VAT',1),
        (2, 'European', 0, 'E', 'I', 'europe VAT', 1);

INSERT INTO `vn`.`taxCode`(`id`, `dated`, `code`, `taxTypeFk`, `rate`, `equalizationTax`, `type`, `link`, `isActive`, `updated`, `transactionCode`)
    VALUES
        (1, CURDATE(), '1111111111', 1, 7.0 , 0.0, 'R', 1, 1, CURDATE(), 1),
        (2, CURDATE(), '2222222222', 2, 16.0, 0.0, 'G', 2, 1, CURDATE(), 2);

INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`)
    VALUES
        (1, 'Reduced VAT','R'),
        (2, 'General VAT', 'G');
      
INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
    VALUES
        (05080000, 'Coral y materiales similares'   , 2, 2),
        (06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);

INSERT INTO `vn`.`item`(`id`, `name`,`typeFk`,`size`,`inkFk`,`category`,`stems`,`originFk`,`description`,`producerFk`,`intrastatFk`,`isOnOffer`,`expenceFk`,`isBargain`,`comment`,`relevancy`,`image`,`taxClassFk`)
    VALUES
        (1, 'Gem of Time',      2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems',      1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1),
        (2, 'Gem of Mind',      2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems',      1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1),
        (3, 'Iron Patriot',     1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor',                 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1),
        (4, 'Mark I',           1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor',         1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2),
        (5, 'Mjolnir',          3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!',                 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2);

INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
    VALUES
        ( 1, 1, 1, 0, CURDATE(), 1, 0, 2, 1),
        ( 2, 1, 1, 1, CURDATE(), 2, 1, 0, 2),
        ( 3, 2, 1, 2, CURDATE(), 3, 2, 0, NULL),
        ( 4, 1, 1, 0, CURDATE(), 1, 0, 2, 1),
        ( 5, 1, 1, 1, CURDATE(), 2, 1, 0, 2),
        ( 6, 2, 1, 2, CURDATE(), 3, 2, 0, NULL);

INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
    VALUES
        (1, 0.00,    10, 10, 0, 0, CURDATE(), 1, 1.50),
        (2, 100.00,  20, 20, 0, 0, CURDATE(), 2, 1.00),
        ('a', 50.00, 30, 30, 0, 1, CURDATE(), 3, 0.00);

INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
    VALUES
        ( 1, 1, 1,   2, CURDATE(), NULL),
        ( 2, 2, 2,   1, CURDATE(), NULL),
        ( 3, 3, 'a', 4, CURDATE(), NULL);

INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
    VALUES
        ( 1, 1, 1, 'Gem of Time', 5 ,  23.5, 0, 0, 0, CURDATE()),
        ( 2, 2, 1, 'Gem of Mind', 10 , 4.5,   0, 0, 0, CURDATE()),
        ( 3, 1, 1, 'Gem of Time', 2 ,  23.5, 0, 0, 0, CURDATE()),
        ( 4, 4, 1, 'Mark I',      20 , 9, 0, 0, 0, CURDATE());

INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
    VALUES
        ( 1, 0),
        ( 2, 1);

INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
    VALUES
        ( 1, 10, 1),
        ( 1, 14, 2.5),
        ( 1, 15, 3),
        ( 1, 17, 4.5),
        ( 1, 21, 5),
        ( 1, 23, 6.5),
        ( 1, 28, 1),
        ( 2, 28, 1) ,
        ( 3, 10, 1),
        ( 3, 14, 2.5),
        ( 3, 15, 3),
        ( 3, 17, 4.5),
        ( 3, 21, 5),
        ( 3, 23, 6.5),
        ( 3, 28, 1),
        ( 4, 28, 1),
        ( 4, 10, 1),
        ( 2, 17, 3.5),
        ( 4, 39, 5),
        ( 4, 37, 2);

INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`)
    VALUES
        ( 1, 0, CURDATE(), 5,  40, 3, 1),
        ( 1, 1, CURDATE(), 5,  40, 3, 2),
        ( 2, 1, CURDATE(), 10, 40, 4, 3),
        ( 3, 1, CURDATE(), 2,  40, 4, 4);

INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
    VALUES
        (1, 1 ,1 ),
        (2, 1 ,2 ),
        (3, 1 ,3 ),
        (4, 2 ,4 );
        
INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`)
    VALUES
        (1, 1, 1, 'A1'),
        (2, 1, 2, 'A2'),
        (3, 1, 3, 'A3'),
        (4, 2, 1, 'A4');

INSERT INTO `edi`.`genus`(`genus_id`, `latin_genus_name`, `entry_date`, `expiry_date`, `change_date_time`)
    VALUES
        ( 1, 'Abelia' ,     CURDATE(), NULL, CURDATE()),
        ( 2, 'Abies',       CURDATE(), NULL, CURDATE()),
        ( 3, 'Abutilon',    CURDATE(), NULL, CURDATE());

INSERT INTO `edi`.`specie`(`specie_id`, `genus_id`, `latin_species_name`, `entry_date`, `expiry_date`, `change_date_time`)
    VALUES
        ( 1, 1, 'grandiflora', CURDATE(), NULL, CURDATE()),
        ( 2, 2, 'procera', CURDATE(), NULL, CURDATE()),
        ( 3, 3, 'decurrens', CURDATE(), NULL, CURDATE()),
        ( 4, 3, 'dealbata', CURDATE(), NULL, CURDATE());

INSERT INTO `vn`.`itemBotanical`(`itemFk`, `botanical`, `genusFk`, `specieFk`)
    VALUES
        ( 1, 'Hedera helix' , 1, 1),
        ( 2, NULL, 2, 2),
        ( 3, 'Cycas revoluta', 2, NULL),
        ( 4, 'Polygonum', NULL, NULL);

INSERT INTO `vn`.`tag`(`id`,`name`,`isFree`,`isQuantitatif`,`sourceTable`,`unit`)
    VALUES
        (1, 'Color',     0, 0, 'ink', null),
        (2, 'Power',     0, 0, 'producer', null),
        (3, 'Shape',     0, 0, null, null),
        (4, 'Location',  1, 0, null, null),
        (5, 'Owner',     1, 1, null, null);

INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
    VALUES
        (1, 1, 1, 'Yellow',               5),
        (2, 1, 2, 'Manipulates time',     4),
        (3, 1, 3, 'round',                3),
        (4, 1, 4, 'Gamoras hideout',      2),
        (5, 1, 5, 'Gamora',               1),
        (6, 2, 1, 'Red',                  5),
        (7, 2, 2, 'Manipulates mind',     4),
        (8, 2, 3, 'square',               3),
        (9, 2, 4, 'unknown location',     2),
        (10, 2, 5, 'Thanos',              1),
        (11, 3, 1, 'Green',               5),
        (12, 3, 2, 'Save the children',   4),
        (13, 3, 3, 'human shape',         3),
        (14, 3, 4, 'Stark tower',         2),
        (15, 3, 5, 'Tony Stark',          1),
        (16, 4, 1, 'Blue',                5),
        (17, 4, 2, 'Protect the citizen', 4),
        (18, 4, 3, 'human shape',         3),
        (19, 4, 4, 'Manhattan',           2),
        (20, 4, 5, 'Tony Stark',          1);

INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`)
    VALUES
        ( 1, 1, 1, 0),
        ( 2, 2, 2, 0),
        ( 3, 3, 3, 1),
        ( 4, 1, 4, 1),
        ( 5, 1, 5, 1);

INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
    VALUES 
        ('1', '1', '1', 'insert', 'We made a change!');

INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`)
    VALUES
        ( 1, 101, date_add(CURDATE(),INTERVAL -7 MONTH), date_add(CURDATE(),INTERVAL -3 MONTH), 50, 7),
        ( 2, 102, date_add(CURDATE(),INTERVAL -5 MONTH), CURDATE(), 100, 1),
        ( 3, 102, CURDATE(), date_add(CURDATE(),INTERVAL 1 MONTH), 50, 7),
        ( 4, 103, CURDATE(), NULL, 50, 7);

INSERT INTO `bi`.`rotacion`(`Id_Article`, `warehouse_id`, `total`, `rotacion`, `cm3`, `almacenaje`, `manipulacion`, `auxiliar`, `mermas`)
    VALUES
        ( 1, 1, 0, 0.0000, 1500, 0.0015, 0.0250, 0.0085, 0.0000),
        ( 1, 2, 0, 0.0000, 100, 0.0060, 0.0200, 0.0080, 0.0000),
        ( 2, 1, 10, 3.5000, 0, 0.0000, 0.0000, 0.0080, 0.0000),
        ( 3, 1, 50, 5.5000, 100, 0.0000, 0.0000, 0.0080, 0.0000);

INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
    VALUES
        ( 101, 1500),
        ( 102, 100),
        ( 103, 1000),
        ( 104, 500),
        ( 105, 5000);

INSERT INTO `vn`.`supplier`(`id`, `name`,`account`,`countryFk`,`nif`,`isFarmer`,`retAccount`,`commission`, `created`, `postcodeFk`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`)
    VALUES
        ( 1, 'Plants SL', 4000000001, 1, 'A11111111', 0, NULL, 0, CURDATE(), 1111, 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1),
        ( 2, 'Flower King', 4000000002, 1, 'B22222222', 0, NULL, 0, CURDATE(), 2222, 1, 'supplier address 2', 'LONDON', 2, 45671, 1, 2),
        ( 442, 'Verdnatura Levante SL', 4000000442, 1, 'C33333333', 0, NULL, 0, CURDATE(), 3333, 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2);

INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_refresh`, `expires`, `created`, `connection_id`)
    VALUES
        ( 1, 2, 'available', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
        ( 2, 4, 'last_buy',  CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
        ( 3, 8, 'visible',   CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL);

INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
    VALUES
        ( 1, 0),
        ( 2, 1),
        ( 3, 2),
        ( 4, 4),
        ( 5, 6);

INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`)
    VALUES
        ( 1, CURDATE(), CURDATE(), 1, 2, 1, 100.00, 1000),
        ( 2, CURDATE(), CURDATE(), 1, 2, 1, 150, 2000),
        ( 3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00),
        ( 4, CURDATE(), CURDATE(), 1, 2, 1, 50.00, 500);

INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`)
    VALUES
        ( 1, 1, CURDATE(), 1, 442),
        ( 2, 2, CURDATE(), 2, 442),
        ( 3, 1, CURDATE(), 3, 442),
        ( 4, 2, CURDATE(), 4, 69);

INSERT INTO `vn`.`agencyProvince`(`provinceFk`, `agencyFk`, `zone`, `warehouseFk`, `route`)
    VALUES
        ( 1, 1, 1, 1, 1),
        ( 1, 1, 1, 2, 1),
        ( 1, 1, 1, 3, 1),
        ( 1, 2, 2, 2, 2),
        ( 1, 2, 2, 3, 2);

INSERT INTO `vn`.`agencyModeZone`(`agencyModeFk`, `zone`, `price`, `itemFk`, `warehouseFk`, `minimCost`, `inflation`)
    VALUES
        ( 1, 1, 10, 1, 1, 1, 1.00),
        ( 1, 1, 20, 2, 1, 1, 1.00),
        ( 2, 1, 10, 1, 1, 1, 1.00),
        ( 2, 1, 20, 2, 1, 1, 2.00),
        ( 2, 2, 10, 1, 1, 0, 2.00);

INSERT INTO `vn`.`agencyWeekDayBonus`(`id`, `warehouseFk`, `agencyFk`, `weekDay`, `zone`, `bonus`)
    VALUES
        ( 1, 1, 1, 0, 1, -1.00),
        ( 2, 1, 1, 1, 1, -1.00),
        ( 3, 1, 1, 0, 2, -1.00),
        ( 4, 1, 1, 1, 2, -1.00),
        ( 5, 2, 2, 2, 3, 0);

INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio`, `recobro`, `inflacion`)
    VALUES
        ( 101, 500,  NULL,   0.00, 0.00, 1.00),
        ( 102, 1000, 2.00,   0.01, 0.05, 1.00),
        ( 103, 2000, 0.00,   0.00, 0.02, 1.00),
        ( 104, 2500, 150.00, 0.02, 0.10, 1.00);

INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`minPrice`,`producer`,`printedStickers`,`isChecked`,`isIgnored`)
    VALUES
        (1, 1, 1, 2.5, 4, 1, 1, 0.350, 0.050, 0.000, 1, 1, 1, NULL, 1.50, 1.25, 1.30, 2.00, NULL, 0, 1, 0),
        (2, 2, 2, 5, 2, 1, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 2, 1.00, 1.30, 2.00, NULL, 0, 1, 0),
        (3, 3, 3, 10, 1, 1, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 2.50, 1.00, 2.50, 2.00, NULL, 0, 1, 0);

INSERT INTO `vn2008`.`tblContadores`(`id`,`FechaInventario`)
    VALUES
        (1,date_add(CURDATE(),INTERVAL -1 MONTH));

INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
    VALUES
        ( 1, 'AGENCY', 'Agencia'),
        ( 2, 'DELIVERY', 'Reparto'),
        ( 3, 'PICKUP', 'Recogida'),
        ( 4, 'OTHER', 'Otros');

INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
    VALUES
        ( 1, date_add(CURDATE(),INTERVAL +1 DAY), 101, 1, 1, 121, 442, NULL, 'TPV'    , 1, CURDATE(), CURDATE()         , CURDATE()),
        ( 2, date_add(CURDATE(),INTERVAL +1 DAY), 102, 2, 2, 122, 442, NULL, 'WEB'    , 1, CURDATE(), CURDATE()         , CURDATE()),
        ( 3, date_add(CURDATE(),INTERVAL +2 DAY), 103, 3, 3, 123, 442, NULL, 'ANDROID', 0, CURDATE(), date_add(CURDATE(), INTERVAL +5 DAY), date_add(CURDATE(),INTERVAL +5 DAY));

INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
    VALUES
        ( 1, 1, 1, NULL , NULL     , 9, 1.5 , 1, CURDATE(), 1),
        ( 2, 2, 2, 1    , NULL     , 5, 1.23, 2, CURDATE(), 2),
        ( 3, 3, 3, 2    , CURDATE(), 3, 0.50, 3, CURDATE(), 3);

INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`)
    VALUES
        ( 1, 101, 'contact 1', 666777888),
        ( 2, 101, 'contact 2', 111222333),
        ( 3, 101, 'contact 3', 222333444),
        ( 4, 102, 'contact 1', 876543219);

/*
 el mana de los trabajadores lo podemos poner a mano en la tabla si lo calculamos antes,
 pero si hazemos alguna modificacion en alguna tabla que utiliza para calcularlo ya no seria correcto

 La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets
*/
call vn.manaSpellersRequery(19);  
call vn.manaSpellersRequery(18);