ALTER TABLE `stan_antrag` ADD `entfernung` ENUM('J', 'N') NOT NULL DEFAULT 'N' COMMENT 'mehr als 30 KM entfernt vom Wohnort' AFTER `tel_abteilung`, ADD `ledig` ENUM('J', 'N') NOT NULL DEFAULT 'N' AFTER `entfernung`, ADD `hausstand` ENUM('J', 'N') NOT NULL DEFAULT 'N' COMMENT 'Verfügt über eigenen Hausstand' AFTER `ledig`, ADD `umzugsverg` ENUM('J', 'N') NOT NULL DEFAULT 'N' COMMENT 'Bewilligung Umzugsvergütung' AFTER `hausstand`;


-- Testsätze
DELETE  FROM `stan_antrag` WHERE `uid` LIKE 'abel_doris';

-- Erstantrag gestellt
INSERT INTO `stan_antrag` (`saaid`, `uid`, `pos`, `vert_bereich`, `art`, `dummy_dst`, `dst_id`, `beginn`, `ende`, `abteilung`, `tel_abteilung`, `entfernung`, `ledig`, `hausstand`, `umzugsverg`, `aendid`, `aend_dat`, `status`, `zuweisung`, `zuweis_dat`, `bearbeitung`, `beurteilt`) VALUES
(131229, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'N', 'N', 'N', 'N', 131229, NULL, '0', NULL, NULL, 'N', 'N'),
(131230, 'abel_doris', '4', 3, 4, '', 119, '2024-11-01', '2025-01-31', '', '', 'N', 'N', 'N', 'N', 131230, NULL, '0', NULL, NULL, 'N', 'N'),
(131231, 'abel_doris', '7', 2, 2, '', 415059, '2025-02-01', '2025-05-31', '', '', 'J', 'J', 'J', 'J', 131231, NULL, '0', NULL, NULL, 'N', 'N'),
(131232, 'abel_doris', '10', 1, 6, '', 415061, '2025-06-01', '2025-09-14', '', '', 'J', 'J', 'J', 'J', 131232, NULL, '0', NULL, NULL, 'N', 'N');

-- Erstantrag zugewiesen: -> Status 0 Zuweisung=Z, zuweis_dat=now()
DELETE  FROM `stan_antrag` WHERE `uid` LIKE 'abel_doris';
INSERT INTO `stan_antrag` (`saaid`, `uid`, `pos`, `vert_bereich`, `art`, `dummy_dst`, `dst_id`, `beginn`, `ende`, `abteilung`, `tel_abteilung`, `entfernung`, `ledig`, `hausstand`, `umzugsverg`, `aendid`, `aend_dat`, `status`, `zuweisung`, `zuweis_dat`, `bearbeitung`, `beurteilt`) VALUES
(131183, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'N', 'N', 'N', 'N', 131183, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131184, 'abel_doris', '4', 3, 4, '', 119, '2024-11-01', '2025-01-31', '', '', 'N', 'N', 'N', 'N', 131184, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131185, 'abel_doris', '7', 2, 2, '', 415, '2025-02-01', '2025-05-31', '', '', 'J', 'J', 'J', 'J', 131185, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131186, 'abel_doris', '10', 1, 6, '', 415059, '2025-06-01', '2025-09-14', '', '', 'J', 'J', 'J', 'J', 131186, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N');


-- Änderungsantrag nach zugewiesenem Erstantrag
DELETE  FROM `stan_antrag` WHERE `uid` LIKE 'abel_doris';
INSERT INTO `stan_antrag` (`saaid`, `uid`, `pos`, `vert_bereich`, `art`, `dummy_dst`, `dst_id`, `beginn`, `ende`, `abteilung`, `tel_abteilung`, `entfernung`, `ledig`, `hausstand`, `umzugsverg`, `aendid`, `aend_dat`, `status`, `zuweisung`, `zuweis_dat`, `bearbeitung`, `beurteilt`) VALUES
(131183, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'N', 'N', 'N', 'N', 131183, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131184, 'abel_doris', '4', 3, 4, '', 119, '2024-11-01', '2025-01-31', '', '', 'N', 'N', 'N', 'N', 131184, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131185, 'abel_doris', '7', 2, 2, '', 415, '2025-02-01', '2025-05-31', '', '', 'J', 'J', 'J', 'J', 131185, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131186, 'abel_doris', '10', 1, 6, '', 415059, '2025-06-01', '2025-09-14', '', '', 'J', 'J', 'J', 'J', 131186, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131188, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'J', 'J', 'J', 'J', 131183, '2024-01-19 07:28:37', '1', NULL, NULL, 'N', 'N');

-- Änderungsantrag zugewiesen
INSERT INTO `stan_antrag` (`saaid`, `uid`, `pos`, `vert_bereich`, `art`, `dummy_dst`, `dst_id`, `beginn`, `ende`, `abteilung`, `tel_abteilung`, `entfernung`, `ledig`, `hausstand`, `umzugsverg`, `aendid`, `aend_dat`, `status`, `zuweisung`, `zuweis_dat`, `bearbeitung`, `beurteilt`) VALUES
(131183, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'N', 'N', 'N', 'N', 131183, '2024-01-19 07:18:00', '0', 'EZ', '2024-01-19 07:24:57', 'N', 'N'),
(131184, 'abel_doris', '4', 3, 4, '', 119, '2024-11-01', '2025-01-31', '', '', 'N', 'N', 'N', 'N', 131184, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131185, 'abel_doris', '7', 2, 2, '', 415, '2025-02-01', '2025-05-31', '', '', 'J', 'J', 'J', 'J', 131185, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131186, 'abel_doris', '10', 1, 6, '', 415059, '2025-06-01', '2025-09-14', '', '', 'J', 'J', 'J', 'J', 131186, '2024-01-19 07:18:00', '0', 'Z', '2024-01-19 07:24:57', 'N', 'N'),
(131188, 'abel_doris', '1', 5, 10, '', 116076, '2024-07-15', '2024-10-31', '', '', 'J', 'J', 'J', 'J', 131183, '2024-01-19 07:28:37', '1', 'Z', '2024-01-19 07:57:01', 'N', 'N');