INSERT INTO tbloptions_static (name, value, autoload) VALUES('estimate_show_grand_total', '1', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('estimate_show_grand_total');


INSERT INTO tbloptions_static (name, value, autoload) VALUES('invoice_show_grand_total', '1', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('invoice_show_grand_total');

INSERT INTO `tblplan_features` (`name`, `codename`, `description`, `type`, `added_on`) VALUES ('Estimate Grand Total Hide', 'estimate_grand_total_hide', 'Estimate Grand Total Hide', 'restrict', NOW());
SET @estimate_grand_total_hide = LAST_INSERT_ID();
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('9', @estimate_grand_total_hide, '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('10', @estimate_grand_total_hide, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('11', @estimate_grand_total_hide, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('12', @estimate_grand_total_hide, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('13', @estimate_grand_total_hide, '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('14', @estimate_grand_total_hide, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('15', @estimate_grand_total_hide, '1', UTC_TIMESTAMP());


INSERT INTO `tblplan_features` (`name`, `codename`, `description`, `type`, `added_on`) VALUES ('Invoice Grand Total Hide', 'invoice_show_grand_total', 'Invoice Grand Total Hide', 'restrict', NOW());
SET @invoice_show_grand_total = LAST_INSERT_ID();
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('9', @invoice_show_grand_total, '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('10', @invoice_show_grand_total, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('11', @invoice_show_grand_total, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('12', @invoice_show_grand_total, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('13', @invoice_show_grand_total, '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('14', @invoice_show_grand_total, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('15', @invoice_show_grand_total, '1', UTC_TIMESTAMP());

UPDATE tblstaff SET refresh_permissions = 1;