-- Date : 28-06-2024 : Jayraj 
    ALTER TABLE `item_master` ADD `is_active` ENUM('Y','N') NOT NULL DEFAULT 'Y' AFTER `company`;

-- Date : 23-01-2024, Jayraj

INSERT INTO `general_master` (`master_cd`, `gm_code`, `gm_code_sr`, `gm_description`, `gm_description_hindi`, `gm_description_guj`, `auto_calculation`, `gm_short_code`, `gm_relation_codes`, `gm_active`, `is_auto_created`, `is_auto_updated`, `mapping_id`) VALUES ('CTSIZE', '01', '1', '14X15', '', '', '', '', '', 'Y', '', '', '');

============================================================
Date: 18-Oct-2017 Changes: Drug Name, Drug Administrator filed added in medicine master
ALTER TABLE `medicin_master` ADD `drug_name` VARCHAR(30) NOT NULL AFTER `m_desc`, ADD `drug_adm` VARCHAR(10) NOT NULL COMMENT 'Drug Administration' AFTER `drug_name`;
----------------------------------------------
Date : 24-Oct-2017 Changes: Delete LABO from service_group_master
DELETE FROM `service_group_master` WHERE `service_grp_cd` = 'Labo';
UPDATE `service_master` SET `service_grp_cd`='LAB' WHERE `service_grp_cd` = 'Labo';
UPDATE `service_request` SET `service_grp_cd`='LAB' WHERE `service_grp_cd` = 'Labo';
UPDATE `user` SET `dept`='LAB' WHERE `dept` = 'Lab';
------------------------------------------------
Date : 25-Oct-2017 Changes: Update department id values.
Update From Medi to MED
UPDATE `department` SET `dept_id`='MED' WHERE `dept_id` = 'Medi';
UPDATE `ipd` SET `dept_id`='MED' WHERE `dept_id` = 'Medi';
UPDATE `doctor_master` SET `doctor_dept_id`='MED' WHERE `doctor_dept_id` = 'Medi';
UPDATE `receipt_header` SET `dept_id`='MED' WHERE `dept_id` = 'Medi';
UPDATE `user` SET `dept_id`='MED' WHERE `dept_id` = 'Medi';
UPDATE `visit` SET `dept_id`='MED' WHERE `dept_id` = 'Medi';

Update From Gyna to OBGY
UPDATE `department` SET `dept_id`='OBGY' WHERE `dept_id` = 'Gyna';
UPDATE `ipd` SET `dept_id`='OBGY' WHERE `dept_id` = 'Gyna';
UPDATE `doctor_master` SET `doctor_dept_id`='OBGY' WHERE `doctor_dept_id` = 'Gyna';
UPDATE `receipt_header` SET `dept_id`='OBGY' WHERE `dept_id` = 'Gyna';
UPDATE `user` SET `dept_id`='OBGY' WHERE `dept_id` = 'Gyna';
UPDATE `visit` SET `dept_id`='OBGY' WHERE `dept_id` = 'Gyna';

Update From Card to CARD
UPDATE `department` SET `dept_id`='CARD' WHERE `dept_id` = 'Card';
UPDATE `ipd` SET `dept_id`='CARD' WHERE `dept_id` = 'Card';
UPDATE `doctor_master` SET `doctor_dept_id`='CARD' WHERE `doctor_dept_id` = 'Card';
UPDATE `receipt_header` SET `dept_id`='CARD' WHERE `dept_id` = 'Card';
UPDATE `user` SET `dept_id`='CARD' WHERE `dept_id` = 'Card';
UPDATE `visit` SET `dept_id`='CARD' WHERE `dept_id` = 'Card';

Update From Dent to DENT
UPDATE `department` SET `dept_id`='DENT' WHERE `dept_id` = 'Dent';
UPDATE `ipd` SET `dept_id`='DENT' WHERE `dept_id` = 'Dent';
UPDATE `doctor_master` SET `doctor_dept_id`='DENT' WHERE `doctor_dept_id` = 'Dent';
UPDATE `receipt_header` SET `dept_id`='DENT' WHERE `dept_id` = 'Dent';
UPDATE `user` SET `dept_id`='DENT' WHERE `dept_id` = 'Dent';
UPDATE `visit` SET `dept_id`='DENT' WHERE `dept_id` = 'Dent';

Update From Skin to SKIN
UPDATE `department` SET `dept_id`='SKIN' WHERE `dept_id` = 'Skin';
UPDATE `ipd` SET `dept_id`='SKIN' WHERE `dept_id` = 'Skin';
UPDATE `doctor_master` SET `doctor_dept_id`='SKIN' WHERE `doctor_dept_id` = 'Skin';
UPDATE `receipt_header` SET `dept_id`='SKIN' WHERE `dept_id` = 'Skin';
UPDATE `user` SET `dept_id`='SKIN' WHERE `dept_id` = 'Skin';
UPDATE `visit` SET `dept_id`='SKIN' WHERE `dept_id` = 'Skin';

Update From Spci to SPCI
UPDATE `department` SET `dept_id`='SPCI' WHERE `dept_id` = 'Spci';
UPDATE `ipd` SET `dept_id`='SPCI' WHERE `dept_id` = 'Spci';
UPDATE `doctor_master` SET `doctor_dept_id`='SPCI' WHERE `doctor_dept_id` = 'Spci';
UPDATE `receipt_header` SET `dept_id`='SPCI' WHERE `dept_id` = 'Spci';
UPDATE `user` SET `dept_id`='SPCI' WHERE `dept_id` = 'Spci';
UPDATE `visit` SET `dept_id`='SPCI' WHERE `dept_id` = 'Spci';

Update From Surg to SURG
UPDATE `department` SET `dept_id`='SURG' WHERE `dept_id` = 'Surg';
UPDATE `ipd` SET `dept_id`='SURG' WHERE `dept_id` = 'Surg';
UPDATE `doctor_master` SET `doctor_dept_id`='SURG' WHERE `doctor_dept_id` = 'Surg';
UPDATE `receipt_header` SET `dept_id`='SURG' WHERE `dept_id` = 'Surg';
UPDATE `user` SET `dept_id`='SURG' WHERE `dept_id` = 'Surg';
UPDATE `visit` SET `dept_id`='SURG' WHERE `dept_id` = 'Surg';

Update From Urol to UROL
UPDATE `department` SET `dept_id`='UROL' WHERE `dept_id` = 'Urol';
UPDATE `ipd` SET `dept_id`='UROL' WHERE `dept_id` = 'Urol';
UPDATE `doctor_master` SET `doctor_dept_id`='UROL' WHERE `doctor_dept_id` = 'Urol';
UPDATE `receipt_header` SET `dept_id`='UROL' WHERE `dept_id` = 'Urol';
UPDATE `user` SET `dept_id`='UROL' WHERE `dept_id` = 'Urol';
UPDATE `visit` SET `dept_id`='UROL' WHERE `dept_id` = 'Urol';

Update From Plmo to PLMO
UPDATE `department` SET `dept_id`='PLMO' WHERE `dept_id` = 'Plmo';
UPDATE `ipd` SET `dept_id`='PLMO' WHERE `dept_id` = 'Plmo';
UPDATE `doctor_master` SET `doctor_dept_id`='PLMO' WHERE `doctor_dept_id` = 'Plmo';
UPDATE `receipt_header` SET `dept_id`='PLMO' WHERE `dept_id` = 'Plmo';
UPDATE `user` SET `dept_id`='PLMO' WHERE `dept_id` = 'Plmo';
UPDATE `visit` SET `dept_id`='PLMO' WHERE `dept_id` = 'Plmo';

Update From Orth to ORTH
UPDATE `department` SET `dept_id`='ORTH' WHERE `dept_id` = 'Orth';
UPDATE `ipd` SET `dept_id`='ORTH' WHERE `dept_id` = 'Orth';
UPDATE `doctor_master` SET `doctor_dept_id`='ORTH' WHERE `doctor_dept_id` = 'Orth';
UPDATE `receipt_header` SET `dept_id`='ORTH' WHERE `dept_id` = 'Orth';
UPDATE `user` SET `dept_id`='ORTH' WHERE `dept_id` = 'Orth';
UPDATE `visit` SET `dept_id`='ORTH' WHERE `dept_id` = 'Orth';

Update From Neur to NEUR
UPDATE `department` SET `dept_id`='NEUR' WHERE `dept_id` = 'Neur';
UPDATE `ipd` SET `dept_id`='NEUR' WHERE `dept_id` = 'Neur';
UPDATE `doctor_master` SET `doctor_dept_id`='NEUR' WHERE `doctor_dept_id` = 'Neur';
UPDATE `receipt_header` SET `dept_id`='NEUR' WHERE `dept_id` = 'Neur';
UPDATE `user` SET `dept_id`='NEUR' WHERE `dept_id` = 'Neur';
UPDATE `visit` SET `dept_id`='NEUR' WHERE `dept_id` = 'Neur';

Update From Gast to GAST
UPDATE `department` SET `dept_id`='GAST' WHERE `dept_id` = 'Gast';
UPDATE `ipd` SET `dept_id`='GAST' WHERE `dept_id` = 'Gast';
UPDATE `doctor_master` SET `doctor_dept_id`='GAST' WHERE `doctor_dept_id` = 'Gast';
UPDATE `receipt_header` SET `dept_id`='GAST' WHERE `dept_id` = 'Gast';
UPDATE `user` SET `dept_id`='GAST' WHERE `dept_id` = 'Gast';
UPDATE `visit` SET `dept_id`='GAST' WHERE `dept_id` = 'Gast';
------------------------------------------------
Date : 26-Oct-2017 Changes: Update All Group Codes from lower to uppercase.

Update From Medi to MED
UPDATE `service_group_master` SET `service_grp_cd` = 'MED' WHERE `service_grp_cd` = 'Medi';
UPDATE `service_master` SET `service_grp_cd` = 'MED' WHERE `service_grp_cd` = 'Medi';
UPDATE `service_request` SET `service_grp_cd` = 'MED' WHERE `service_grp_cd` = 'Medi';

Update From Obsg to OBSG
UPDATE `service_group_master` SET `service_grp_cd` = 'OBSG' WHERE `service_grp_cd` = 'Obsg';
UPDATE `service_master` SET `service_grp_cd` = 'OBSG' WHERE `service_grp_cd` = 'Obsg';
UPDATE `service_request` SET `service_grp_cd` = 'OBSG' WHERE `service_grp_cd` = 'Obsg';

Update From Gyno to GYNO
UPDATE `service_group_master` SET `service_grp_cd` = 'GYNO' WHERE `service_grp_cd` = 'Gyno';
UPDATE `service_master` SET `service_grp_cd` = 'GYNO' WHERE `service_grp_cd` = 'Gyno';
UPDATE `service_request` SET `service_grp_cd` = 'GYNO' WHERE `service_grp_cd` = 'Gyno';

Update From Debi to DEBI
UPDATE `service_group_master` SET `service_grp_cd` = 'DEBI' WHERE `service_grp_cd` = 'Debi';
UPDATE `service_master` SET `service_grp_cd` = 'DEBI' WHERE `service_grp_cd` = 'Debi';
UPDATE `service_request` SET `service_grp_cd` = 'DEBI' WHERE `service_grp_cd` = 'Debi';

Update From gast to GAST
UPDATE `service_group_master` SET `service_grp_cd` = 'GAST' WHERE `service_grp_cd` = 'gast';
UPDATE `service_master` SET `service_grp_cd` = 'GAST' WHERE `service_grp_cd` = 'gast';
UPDATE `service_request` SET `service_grp_cd` = 'GAST' WHERE `service_grp_cd` = 'gast';

Update From INj to INJ
UPDATE `service_group_master` SET `service_grp_cd` = 'INJ' WHERE `service_grp_cd` = 'INj' OR `service_grp_cd` = 'inj';
UPDATE `service_master` SET `service_grp_cd` = 'INJ' WHERE `service_grp_cd` = 'INj' OR `service_grp_cd` = 'inj';
UPDATE `service_request` SET `service_grp_cd` = 'INJ' WHERE `service_grp_cd` = 'INj' OR `service_grp_cd` = 'inj';

Update From Surg to SURG
UPDATE `service_group_master` SET `service_grp_cd` = 'SURG' WHERE `service_grp_cd` = 'Surg';
UPDATE `service_master` SET `service_grp_cd` = 'SURG' WHERE `service_grp_cd` = 'Surg';
UPDATE `service_request` SET `service_grp_cd` = 'SURG' WHERE `service_grp_cd` = 'Surg';

Update From Dent to DENT
UPDATE `service_group_master` SET `service_grp_cd` = 'DENT' WHERE `service_grp_cd` = 'Dent';
UPDATE `service_master` SET `service_grp_cd` = 'DENT' WHERE `service_grp_cd` = 'Dent';
UPDATE `service_request` SET `service_grp_cd` = 'DENT' WHERE `service_grp_cd` = 'Dent';

Update From Urog to UROG
UPDATE `service_group_master` SET `service_grp_cd` = 'UROG' WHERE `service_grp_cd` = 'Urog';
UPDATE `service_master` SET `service_grp_cd` = 'UROG' WHERE `service_grp_cd` = 'Urog';
UPDATE `service_request` SET `service_grp_cd` = 'UROG' WHERE `service_grp_cd` = 'Urog';

Update From Room to ROOM
UPDATE `service_group_master` SET `service_grp_cd` = 'ROOM' WHERE `service_grp_cd` = 'Room';
UPDATE `service_master` SET `service_grp_cd` = 'ROOM' WHERE `service_grp_cd` = 'Room';
UPDATE `service_request` SET `service_grp_cd` = 'ROOM' WHERE `service_grp_cd` = 'Room';

Update From Echo to ECHO
UPDATE `service_group_master` SET `service_grp_cd` = 'ECHO' WHERE `service_grp_cd` = 'Echo';
UPDATE `service_master` SET `service_grp_cd` = 'ECHO' WHERE `service_grp_cd` = 'Echo';
UPDATE `service_request` SET `service_grp_cd` = 'ECHO' WHERE `service_grp_cd` = 'Echo';

Update From Xray to XRAY
UPDATE `service_group_master` SET `service_grp_cd` = 'XRAY' WHERE `service_grp_cd` = 'Xray';
UPDATE `service_master` SET `service_grp_cd` = 'XRAY' WHERE `service_grp_cd` = 'Xray';
UPDATE `service_request` SET `service_grp_cd` = 'XRAY' WHERE `service_grp_cd` = 'Xray';

Update From Orth to ORTH
UPDATE `service_group_master` SET `service_grp_cd` = 'ORTH' WHERE `service_grp_cd` = 'Orth';
UPDATE `service_master` SET `service_grp_cd` = 'ORTH' WHERE `service_grp_cd` = 'Orth';
UPDATE `service_request` SET `service_grp_cd` = 'ORTH' WHERE `service_grp_cd` = 'Orth';

Update From Phys to PHYS
UPDATE `service_group_master` SET `service_grp_cd` = 'PHYS' WHERE `service_grp_cd` = 'Phys';
UPDATE `service_master` SET `service_grp_cd` = 'PHYS' WHERE `service_grp_cd` = 'Phys';
UPDATE `service_request` SET `service_grp_cd` = 'PHYS' WHERE `service_grp_cd` = 'Phys';
-----------------------------------
Update all ServiceCode from Lower to Uppercase
UPDATE `examination_master` SET `service_cd` = UPPER(`service_cd`);
UPDATE `patho_result_mst` SET `service_cd` = UPPER(`service_cd`);
UPDATE `receipt_transaction` SET `service_cd` = UPPER(`service_cd`);
UPDATE `service_request` SET `service_cd` = UPPER(`service_cd`);
UPDATE `service_master` SET `service_cd` = UPPER(`service_cd`);

Update all room id from lower to upper
UPDATE `room_alocation` SET `room_id` = UPPER(`room_id`);
UPDATE `room_master` SET `room_id` = UPPER(`room_id`);

Update all room_cat_id from lower to upper
UPDATE `room_cat` SET `room_cat_id` = UPPER(`room_cat_id`);
UPDATE `room_master` SET `room_cat_id` = UPPER(`room_cat_id`);
UPDATE `room_alocation` SET `room_cat_id` = UPPER(`room_cat_id`);
UPDATE `receipt_transaction` SET `room_cat` = UPPER(`room_cat`);

Update all stock_id from lower to upper
UPDATE `stock_master` SET `stock_id` = UPPER(`stock_id`);
UPDATE `stock_trans` SET `stock_id` = UPPER(`stock_id`);

Update dept filed from lower to upper in user table.
UPDATE `user` SET `dept` = UPPER(`dept`);

Update all op_code from lower to upper
UPDATE `pc_ot_mst` SET `op_code` = UPPER(`op_code`);
UPDATE `ot_patient` SET `op_code` = UPPER(`op_code`);
----------------------------------------------------------------
Date : 28-Oct-2017 Change : update user_id length
ALTER TABLE `receipt_header` CHANGE `user_id` `user_id` VARCHAR(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
----------------------------------------------------------------

Date : 09-Nov-2017 Change : New field Added drug_Adm in medicin_reco
ALTER TABLE `medicin_reco` ADD `drug_adm` VARCHAR(10) NOT NULL COMMENT 'Drug Administration' AFTER `user_id`;

------------------------------------------------------------------
Date: 14-Nov-2017 
ALTER TABLE `service_request` CHANGE `remark` `remark` VARCHAR(400) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;

Date : 18-Nov-2017
ALTER TABLE `room_cat` ADD `room_cat_charge` CHAR(2) NOT NULL AFTER `room_cat_dis`;

Date : 30-Nov-2017
ALTER TABLE `service_master` ADD `test_grp_cd` VARCHAR(4) NOT NULL AFTER `test_cd`;


Date : 09-Dec-2017
ALTER TABLE `service_request` ADD `is_deleted` ENUM('Y','N') NOT NULL DEFAULT 'N' AFTER `last_update_date`;

Date : 04-Jan-2018
ALTER TABLE `service_request` ADD `req_time` VARCHAR(15) NOT NULL DEFAULT 'NULL' AFTER `req_date`;

Date : 15-Jan-2018
ALTER TABLE `patho_test_master` CHANGE `m_min` `m_min` VARCHAR(10) NOT NULL;
ALTER TABLE `patho_test_master` CHANGE `m_max` `m_max` VARCHAR(10) NOT NULL;
ALTER TABLE `patho_test_master` CHANGE `f_min` `f_min` VARCHAR(10) NOT NULL;
ALTER TABLE `patho_test_master` CHANGE `f_max` `f_max` VARCHAR(10) NOT NULL;

Date : 08-March-2018
ALTER TABLE `patho_test_master` ADD `source_of_test` int(3) AFTER `source_of_test`;
ALTER TABLE `patho_test_master` ADD `Rounding_Digit` CHAR(1) NULL DEFAULT NULL AFTER `source_of_test`;
update patho_test_master set Rounding_Digit = 0 where test_cd in('RBS','FBS','PPBS','UREA','SGPT','SGOT','ALP','GGT','HDL','LDL','CHOL','SETR','RA','CK-TOTAL','ADA','LIPASE-D','LDH');
update patho_test_master set Rounding_Digit = 1 where test_cd in('SPRO','ALB','UA','CRP','CA','CK-MB');
update patho_test_master set Rounding_Digit = 2 where test_cd in('CRE','BILI-T','BILI-D');

Date : 19-April-2018
ALTER TABLE `navigation` ADD `Shortcut_Code` VARCHAR(6) NOT NULL AFTER `File_Name`;
ALTER TABLE `navigation_master` CHANGE `Sub_Menu` `executable` ENUM('Y','N') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'Y';
ALTER TABLE `navigation_master` CHANGE `executable` `executable` ENUM('Y','N','Z') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'Y';
UPDATE `navigation_master` SET `executable` = 'Z' WHERE `executable` = 'Y';
UPDATE `navigation_master` SET `executable` = 'Y' WHERE `executable` = 'N';
UPDATE `navigation_master` SET `executable` = 'N' WHERE `executable` = 'Z';
ALTER TABLE `navigation_master` CHANGE `executable` `executable` ENUM('Y','N') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'Y';

Date : 03-May-2018
ALTER TABLE `pc_ot_mst` CHANGE `op_code` `op_code` INT NOT NULL AUTO_INCREMENT;

Date : 04-Jun-2018
ALTER TABLE `service_master` ADD `ManualChargeEntry` ENUM('Y','N') NOT NULL DEFAULT 'N' AFTER `charges`;
--------------------------------------------------------------------------------
2018-09-27
ALTER TABLE `stock_master` ADD `dept_category` VARCHAR(50) NOT NULL FIRST;
ALTER TABLE `stock_master`
  DROP PRIMARY KEY,
   ADD PRIMARY KEY(
     `dept_category`,
     `s_month`,
     `stock_id`,
     `stock_type`);
UPDATE stock_master SET `dept_category` = 'Hospital';
INSERT INTO `stock_master` (`dept_category`, `s_month`, `stock_id`, `stock_date`, `stock_type`, `o_stock`, `stock`) SELECT 'Mandal', `s_month`, `stock_id`, `stock_date`, `stock_type`, `o_stock`, `stock` FROM stock_master WHERE `s_month` >= '2018-09-01'

ALTER TABLE `stock_trans` ADD `dept_category` VARCHAR(50) NOT NULL AFTER `stock_id`;
ALTER TABLE `stock_trans`
  DROP PRIMARY KEY,
   ADD PRIMARY KEY(
     `stock_id`,
     `dept_category`,
     `stock_type`,
     `s_date`,
     `t_seq`);
UPDATE `stock_trans` SET `dept_category` = 'Hospital' WHERE `s_date` < '2018-09-01';

--------------------------------------------------------------------------------
2018-10-09 data correction query

update `service_request` sr SET sr.receipt_cat = (select rh.receipt_cat from receipt_header rh where sr.opd_reg_id = rh.patient_reg_id AND sr.`r_fyear` = rh.fyear AND sr.`ipd_opd` = rh.ipd_opd AND sr.`receipt_no` = rh.receipt_no) WHERE sr.`receipt_cat` = '' AND sr.receipt_no != 0 and service_grp_cd = 'XRAY'
UPDATE service_request sr SET `receipt_cat` = ( SELECT CASE WHEN v.dept_id = 'ORTH' THEN 'M' ELSE 'H' END AS category FROM visit v WHERE sr.visit_id = v.visit_id) WHERE `req_date` BETWEEN '2018-09-01' AND '2018-09-30' AND receipt_cat = '' AND service_grp_cd = 'Xray' ORDER BY `v`.`dept_id` ASC
update `service_request` set receipt_cat = 'H' WHERE `req_date` < '2018-09-01' AND `service_grp_cd` LIKE 'xray' AND `receipt_cat` LIKE 'M' ORDER BY `ipd_reg_id`  DESC
UPDATE `service_request` SET size = '10 x 12' WHERE `req_date`  >= '2018-09-26' and req_date <= '2018-09-30' and service_grp_cd = 'XRAY' and size = '8 x 10' AND receipt_cat = 'M' 
update `service_request` set receipt_cat = 'H' WHERE `req_date` >= '2018-09-01' AND req_date <= '2018-09-03' AND `service_grp_cd` LIKE 'xray' AND `receipt_cat` LIKE 'M' ORDER BY `ipd_reg_id`  DESC

update `service_request` SET `receipt_cat` = 'H' WHERE `service_grp_cd` LIKE 'xray' AND `receipt_cat` NOT IN ('H','M') and req_date < '2018-04-01'
UPDATE  `hms_v`.`service_request` SET  `size` =  '8 x 10' WHERE  `service_request`.`req_id` =217076 AND `service_request`.`fyear` =1718;
UPDATE  `hms_v`.`service_request` SET  `size` =  '8 x 10' WHERE  `service_request`.`req_id` =207696 AND `service_request`.`fyear` =1718;

--------------------------------------------------------------------------------
2018-11-02
SELECT MONTH( admit_date ) AS pMonth, COUNT( ipd_reg_id ) 
FROM  `room_alocation` 
WHERE  `room_cat_id` LIKE  'ICU'
AND  `admit_date` >  '2018-01-01'
GROUP BY MONTH( admit_date ) 
ORDER BY  `pMonth` ASC 


--------------------------------------------------------------------------------
2018-12-08

ALTER TABLE `visit` ADD `location` VARCHAR(10) NOT NULL AFTER `category`;

CREATE TABLE `user_wise_location` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` VARCHAR(10) NOT NULL , `location` VARCHAR(10) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;

ALTER TABLE `visit` ADD `emergencyVisit` ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER `location`;

ALTER TABLE `service_master` ADD `service_category` ENUM('','H','M') NOT NULL DEFAULT '' AFTER `service_grp_cd`;
ALTER TABLE `service_master` CHANGE `service_category` `service_category` ENUM('','H','M') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COMMENT 'H- Hospital, M - Mandal';
-----------------------------------------------------------------------------------------------
ALTER TABLE `department` ADD `active` ENUM('Y','N') NOT NULL DEFAULT 'Y' AFTER `disp_seq`;

INSERT INTO `last_transaction_number` (`trn_type`, `trn_fyear`, `trn_id`) VALUES ('TESTID', '1920', '0');
ALTER TABLE `item_transaction_header` ADD `discount` INT(7) NOT NULL AFTER `credit`;


ALTER TABLE `medicine_transaction` ADD `indent_date` DATE NOT NULL AFTER `trn_year`;