SET FOREIGN_KEY_CHECKS = 0;

SET AUTOCOMMIT = 0;
START TRANSACTION;

ALTER TABLE `katao_order` ADD `is_simulated` INTEGER(1) default 0 AFTER `status`;

ALTER TABLE `katao_supplier_invoice` ADD `taux0_discount_ht` FLOAT default 0 AFTER `taux0_bases_ht`;
ALTER TABLE `katao_supplier_invoice` ADD `taux1_discount_ht` FLOAT default 0 AFTER `taux1_bases_ht`;
ALTER TABLE `katao_supplier_invoice` ADD `taux2_discount_ht` FLOAT default 0 AFTER `taux2_bases_ht`;

ALTER TABLE `katao_supplier_invoice` ADD `fees_shipping_ht` FLOAT default 0 AFTER `comment`;
ALTER TABLE `katao_supplier_invoice` ADD `fees_shipping_tva` FLOAT default 0 AFTER `fees_shipping_ht`;
ALTER TABLE `katao_supplier_invoice` ADD `fees_billing_ht` FLOAT default 0 AFTER `fees_shipping_tva`;
ALTER TABLE `katao_supplier_invoice` ADD `fees_billing_tva` FLOAT default 0 AFTER `fees_billing_ht`;

ALTER TABLE `katao_config` ADD `accounting_code_fees_shipping` VARCHAR(12)  NOT NULL AFTER `accounting_code_sol_discount`;
ALTER TABLE `katao_config` ADD `accounting_code_fees_billing` VARCHAR(12)  NOT NULL AFTER `accounting_code_fees_shipping`;

ALTER TABLE `katao_supplier_invoice` ADD `fees_shipping_rate` FLOAT default 0 AFTER `fees_shipping_ht`;
ALTER TABLE `katao_supplier_invoice` ADD `fees_billing_rate` FLOAT default 0 AFTER `fees_billing_ht`;

ALTER TABLE `katao_config` ADD `accounting_code_discount` VARCHAR(12)  NOT NULL AFTER `accounting_code_fees_billing`;

SET FOREIGN_KEY_CHECKS = 1;

COMMIT;