INSERT INTO `settings` (`settingid`, `settingvalue`, `settingint`, `friendlyname`, `description`, `changeable`, `grouping`, `ordinality`, `datatype`) VALUES ('authnetapi', '4ZcTZh94b6', NULL, 'Authorize.net API LOGIN ID', 'You can get this from Authorize.net', '1', '7', '1', 'text'), ('authnetkey', '7Y27ayCG3aE776fz', NULL, 'Authorize.net TRANSACTION KEY', '', '1', '7', '2', 'text');
INSERT INTO `settings` (`settingid`, `settingvalue`, `settingint`, `friendlyname`, `description`, `changeable`, `grouping`, `ordinality`, `datatype`) VALUES ('useauthnet', '1', NULL, 'Use Authorize.net?', '0= No. 1=Yes', '1', '7', '-1', 'number');

ALTER TABLE `orderitems` ADD `transactionid` VARCHAR(150) NULL AFTER `delaygroup`, ADD `authcode` VARCHAR(150) NULL AFTER `transactionid`;

ALTER TABLE `orderitems` ADD `lastfour` VARCHAR(10) NOT NULL AFTER `authcode`, ADD `cardtype` VARCHAR(20) NOT NULL AFTER `lastfour`;

INSERT INTO `permissions` (`id`, `permission`) VALUES (NULL, 'Refunds');

INSERT INTO `typepermissions` (`usertype`, `permissionid`) VALUES ('1', '7');

INSERT INTO `userpermissions` (`userid`, `permissionid`) VALUES ('1', '7');

ALTER TABLE `orderitems` ADD `isvoided` INT NOT NULL DEFAULT '0' AFTER `cardtype`;

ALTER TABLE `orderitems` ADD `voidamount` DECIMAL(10,2) NOT NULL AFTER `isvoided`;

ALTER TABLE `orderitems` ADD `refunded` DECIMAL(10,2) NOT NULL DEFAULT '0' AFTER `voidamount`;
ALTER TABLE `orderitems` ADD `refundto` INT NOT NULL DEFAULT '0' AFTER `refunded`;
ALTER TABLE `orderitems` ADD `isrefund` INT NOT NULL DEFAULT '0' AFTER `refundto`;
ALTER TABLE `orderitems` ADD `voidauthcode` VARCHAR(150) NULL DEFAULT NULL AFTER `isrefund`;

ALTER TABLE `orders` ADD `fullorderid` VARCHAR(150) NOT NULL AFTER `orderid`;

INSERT INTO `settings` (`settingid`, `settingvalue`, `settingint`, `friendlyname`, `description`, `changeable`, `grouping`, `ordinality`, `datatype`) VALUES ('preauthorization', '25', NULL, 'Additional Pre-Authorization % for Tips', 'In order to append gratuity to a check after the card has been run, we must pre-authorize the card for more than the ticket price. Choose a maximum amount. Adding gratuity to a check will be limited to this percentage. (Such as 25%) Keep in mind that during the batch process, the actual amount will be captured may be lower than the authorized amount. This will be the amount shown on the customer statement.', '1', '7', '4', 'number');

ALTER TABLE `orderitems` ADD `preauth` DECIMAL(10,2) NOT NULL DEFAULT '0' AFTER `voidauthcode`, ADD `tip` DECIMAL(10,2) NOT NULL DEFAULT '0' AFTER `preauth`;

ALTER TABLE `orderitems` ADD `captured` INT NOT NULL DEFAULT '0' AFTER `tip`;

INSERT INTO `permissions` (`id`, `permission`) VALUES (NULL, 'Credit Batches');

INSERT INTO `typepermissions` (`usertype`, `permissionid`) VALUES ('1', '8');

INSERT INTO `userpermissions` (`userid`, `permissionid`) VALUES ('1', '8');
ALTER TABLE `orderitems` ADD `captureamount` DECIMAL(10,2) NOT NULL AFTER `captured`;
INSERT INTO `permissions` (`id`, `permission`) VALUES (NULL, 'Void Orders');

INSERT INTO `typepermissions` (`usertype`, `permissionid`) VALUES ('1', '9');
INSERT INTO `userpermissions` (`userid`, `permissionid`) VALUES ('1', '9');
