CREATE TABLE `total_invoice` (
  `serial_ttl` INT NOT NULL AUTO_INCREMENT,
  `number_invoice_ttl` VARCHAR(45) NULL,
  `total_ttl` DECIMAL(10,2) NULL,
  `status_ttl` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_ttl`))ENGINE=InnoDB;

ALTER TABLE `invoice` 
ADD COLUMN `serial_ttl` INT NULL AFTER `serial_phy`,
ADD INDEX `fk_ttl_phy_idx` (`serial_ttl` ASC);
;
ALTER TABLE `invoice` 
ADD CONSTRAINT `fk_ttl_phy`
  FOREIGN KEY (`serial_ttl`)
  REFERENCES `total_invoice` (`serial_ttl`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;


ALTER TABLE `list` 
CHANGE COLUMN `alias_lst` `alias_lst` ENUM('ENABLEDPREPAY', 'INSURANCE', 'FINALIZE', 'ACEPTPREAPROVED', 'TRAVEL', 'SHIFT', 'ENTERDECE', 'UPDATEDATA', 'SERVICES', 'HONORCODE', 'AUTHORIZATIONIMAGE', 'WITHDRAWALL', 'USEPOLICIES', 'TRAVEL_EXPORTED', 'SAFI_ACADEMIC', 'SAFI_NON_ACADEMIC') NULL DEFAULT NULL ;
INSERT INTO `list` (`name_lst`, `alias_lst`, `status_lst`) VALUES ('SAFI ACADEMISCOS', 'SAFI_ACADEMIC', 'ACTIVE');
INSERT INTO `list` (`name_lst`, `alias_lst`, `status_lst`) VALUES ('SAFI NO ACADEMICOS', 'SAFI_NON_ACADEMIC', 'ACTIVE');

ALTER TABLE `payment_concept_group` 
ADD COLUMN `ruc_pcg` VARCHAR(45) NULL AFTER `order_payment`,
CHANGE COLUMN `order_payment` `order_payment` VARCHAR(100) NULL DEFAULT NULL ;


UPDATE `payment_concept_group` SET `ruc_pcg` = '1791862864001' WHERE (`serial_pcg` = '1');
UPDATE `payment_concept_group` SET `ruc_pcg` = '1791079280001' WHERE (`serial_pcg` = '2');

 ALTER TABLE `course` 
ADD COLUMN `safi_description_code` VARCHAR(45) NULL AFTER `attendance_crs`;

update course set safi_description_code=	'AI038'	where serial_crs=	452	;
update course set safi_description_code=	'AI039'	where serial_crs=	453	;
update course set safi_description_code=	'AI040'	where serial_crs=	454	;
update course set safi_description_code=	'AI035'	where serial_crs=	449	;
update course set safi_description_code=	'AI036'	where serial_crs=	450	;
update course set safi_description_code=	'AI037'	where serial_crs=	451	;
update course set safi_description_code=	'AI032'	where serial_crs=	446	;
update course set safi_description_code=	'AI033'	where serial_crs=	447	;
update course set safi_description_code=	'AI034'	where serial_crs=	448	;
update course set safi_description_code=	'BA041'	where serial_crs=	485	;
update course set safi_description_code=	'BA042'	where serial_crs=	486	;
update course set safi_description_code=	'BA043'	where serial_crs=	487	;
update course set safi_description_code=	'BA044'	where serial_crs=	488	;
update course set safi_description_code=	'BA045'	where serial_crs=	489	;
update course set safi_description_code=	'BA046'	where serial_crs=	490	;
update course set safi_description_code=	'BA047'	where serial_crs=	491	;
update course set safi_description_code=	'BA048'	where serial_crs=	492	;
update course set safi_description_code=	'BA049'	where serial_crs=	493	;
update course set safi_description_code=	'BA050'	where serial_crs=	494	;
update course set safi_description_code=	'BA051'	where serial_crs=	495	;
update course set safi_description_code=	'BA052'	where serial_crs=	496	;
update course set safi_description_code=	'EB020'	where serial_crs=	473	;
update course set safi_description_code=	'EB021'	where serial_crs=	474	;
update course set safi_description_code=	'EB022'	where serial_crs=	475	;
update course set safi_description_code=	'EB023'	where serial_crs=	476	;
update course set safi_description_code=	'EB024'	where serial_crs=	477	;
update course set safi_description_code=	'EB025'	where serial_crs=	478	;
update course set safi_description_code=	'EB014'	where serial_crs=	467	;
update course set safi_description_code=	'EB015'	where serial_crs=	468	;
update course set safi_description_code=	'EB016'	where serial_crs=	469	;
update course set safi_description_code=	'EB029'	where serial_crs=	482	;
update course set safi_description_code=	'EB030'	where serial_crs=	483	;
update course set safi_description_code=	'EB031'	where serial_crs=	484	;
update course set safi_description_code=	'EB026'	where serial_crs=	479	;
update course set safi_description_code=	'EB027'	where serial_crs=	480	;
update course set safi_description_code=	'EB028'	where serial_crs=	481	;
update course set safi_description_code=	'EB017'	where serial_crs=	470	;
update course set safi_description_code=	'EB018'	where serial_crs=	471	;
update course set safi_description_code=	'EB019'	where serial_crs=	472	;
update course set safi_description_code=	'CI006'	where serial_crs=	459	;
update course set safi_description_code=	'CI007'	where serial_crs=	460	;
update course set safi_description_code=	'CI008'	where serial_crs=	461	;
update course set safi_description_code=	'CI009'	where serial_crs=	462	;
update course set safi_description_code=	'CI001'	where serial_crs=	455	;
update course set safi_description_code=	'CI002'	where serial_crs=	497	;
update course set safi_description_code=	'CI003'	where serial_crs=	456	;
update course set safi_description_code=	'CI004'	where serial_crs=	457	;
update course set safi_description_code=	'CI010'	where serial_crs=	463	;
update course set safi_description_code=	'CI011'	where serial_crs=	464	;
update course set safi_description_code=	'CI012'	where serial_crs=	465	;
update course set safi_description_code=	'CI013'	where serial_crs=	466	;


CREATE TABLE `invoice_header_data` (
  `serial_inv` INT NOT NULL AUTO_INCREMENT,
  `serial_pcg` INT NULL,
  `enviroment_inv` VARCHAR(45) NULL,
  `business_name_inv` VARCHAR(400) NULL,
  `ruc_inv` VARCHAR(100) NULL,
  `docuement_code_inv` VARCHAR(45) NULL,
  `establishment_inv` VARCHAR(45) NULL,
  `issuing_point_inv` VARCHAR(45) NULL,
  `address_inv` TEXT NULL,
  PRIMARY KEY (`serial_inv`),
  INDEX `fk_inv_pcg_idx` (`serial_pcg` ASC),
  CONSTRAINT `fk_inv_pcg`
    FOREIGN KEY (`serial_pcg`)
    REFERENCES `payment_concept_group` (`serial_pcg`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

ALTER TABLE `invoice_header_data` 
ADD COLUMN `trade_name_inv` VARCHAR(400) NULL AFTER `address_inv`;


ALTER TABLE `invoice_header_data` 
ADD COLUMN `in_use_inv` VARCHAR(45) NULL AFTER `serial_inv`,
ADD COLUMN `status_inv` ENUM('ACTIVE', 'INACTIVE') NULL AFTER `in_use_inv`;


ALTER TABLE `school_setup` 
ADD COLUMN `enviroment_invoice` INT NULL AFTER `web_magazine_sst`,
ADD COLUMN `currency` VARCHAR(100) NULL AFTER `enviroment_invoice`,
ADD COLUMN `payment_mode` VARCHAR(45) NULL AFTER `currency`;
ALTER TABLE `school_setup` 
ADD COLUMN `time_unit` VARCHAR(45) NULL AFTER `payment_mode`;


update school_setup set enviroment_invoice='1',currency='DOLAR',payment_mode='20',time_unit='dias';

ALTER TABLE `total_invoice` 
ADD COLUMN `total_before_taxes` DECIMAL(10,2) NULL AFTER `number_invoice_ttl`,
ADD COLUMN `total_tip_ttl` DECIMAL(10,2) NULL DEFAULT 0.00 AFTER `total_before_taxes`,
ADD COLUMN `total_invoicecol` VARCHAR(45) NULL AFTER `total_tip_ttl`,
ADD COLUMN `emition_date_ttl` DATE NULL AFTER `total_ttl`,
ADD COLUMN `required_to_maintain_accounting_inv` ENUM('YES', 'NO') NULL AFTER `emition_date_ttl`,
ADD COLUMN `identification_type_ttl` ENUM('04', '05', '06') NULL AFTER `required_to_maintain_accounting_inv`,
ADD COLUMN `business_name_ttl` VARCHAR(200) NULL AFTER `identification_type_ttl`,
ADD COLUMN `id_ttl` VARCHAR(100) NULL AFTER `business_name_ttl`,
ADD COLUMN `address_ttl` VARCHAR(300) NULL AFTER `id_ttl`,
ADD COLUMN `payment_mode_ttl` VARCHAR(45) NULL AFTER `address_ttl`,
ADD COLUMN `time_ttl` VARCHAR(45) NULL AFTER `payment_mode_ttl`,
ADD COLUMN `status_invoice_ttl` SET('PAID', 'SETTED_SAFI', 'VOID') NULL AFTER `time_ttl`;


CREATE TABLE `invoice_tax` (
  `serial_int` INT NOT NULL,
  `code_int` VARCHAR(45) NULL,
  `tariff _int` DECIMAL(10,2) NULL,
  `name_int` VARCHAR(100) NULL,
  `description_int` VARCHAR(200) NULL,
  `status_int` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_int`)) ENGINE=InnoDB;

ALTER TABLE invoice_tax 
CHANGE COLUMN `serial_int` `serial_int` INT NOT NULL AUTO_INCREMENT ;

ALTER TABLE `invoice_tax` 
CHANGE COLUMN `serial_int` `serial_txn` INT(11) NOT NULL AUTO_INCREMENT ,
CHANGE COLUMN `code_int` `code_txn` VARCHAR(45) NULL DEFAULT NULL ,
CHANGE COLUMN `tariff _int` `tariff_txn` DECIMAL(10,2) NULL DEFAULT NULL ,
CHANGE COLUMN `name_int` `name_txn` VARCHAR(100) NULL DEFAULT NULL ,
CHANGE COLUMN `description_int` `description_txn` VARCHAR(200) NULL DEFAULT NULL ,
CHANGE COLUMN `status_int` `status_txn` ENUM('ACTIVE', 'INACTIVE') NULL DEFAULT NULL , RENAME TO  `tax_invoice` ;


CREATE TABLE `year_level_specialty_payment_concept_tax_invoice` (
  `serial_ylt` INT NOT NULL AUTO_INCREMENT,
  `serial_ypc` INT NULL,
  `serial_txn` INT NULL,
  `status_ylt` ENUM('ACTIVE', 'INACTIVE') NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_ylt`),
  INDEX `fk_ylt_ypc_idx` (`serial_ypc` ASC),
  INDEX `fk_ylt_txn_idx` (`serial_txn` ASC),
  CONSTRAINT `fk_ylt_ypc`
    FOREIGN KEY (`serial_ypc`)
    REFERENCES `year_level_specialty_payment_concept` (`serial_ypc`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ylt_txn`
    FOREIGN KEY (`serial_txn`)
    REFERENCES `tax_invoice` (`serial_txn`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

INSERT INTO `tax_invoice` (`code_txn`, `tariff_txn`, `name_txn`, `description_txn`, `status_txn`) VALUES ('0', '0', 'IVA 0%', 'IVA CON TARIFA 0%', 'ACTIVE');
INSERT INTO `tax_invoice` (`code_txn`, `tariff_txn`, `name_txn`, `description_txn`, `status_txn`) VALUES ('2', '12', 'IVA 12%', 'IVA CON TARIFA 12%', 'ACTIVE');


insert into year_level_specialty_payment_concept_tax_invoice  select null as serial_ylt, serial_ypc,1 as serial_txn, 'ACTIVE' AS status_ylt from year_level_specialty_payment_concept where serial_pcg=1 and serial_scy=9;
insert into year_level_specialty_payment_concept_tax_invoice  select null as serial_ylt, serial_ypc,2 as serial_txn, 'ACTIVE' AS status_ylt from year_level_specialty_payment_concept where serial_pcg=2 and serial_scy=9;

CREATE TABLE `invoice_tax` (
  `serial_inv` INT NOT NULL AUTO_INCREMENT,
  `serial_phy` INT NULL,
  `serial_txn` INT NULL,
  `tax_base_inv` DECIMAL(10,2) NULL,
  `value_inv` DECIMAL(10,2) NULL,
  `status_inv` ENUM('ACTIVE', 'INACTIVE') NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_inv`),
  INDEX `fk_inv_txn_idx` (`serial_txn` ASC),
  INDEX `fk_inv_phy_idx` (`serial_phy` ASC),
  CONSTRAINT `fk_inv_phy`
    FOREIGN KEY (`serial_phy`)
    REFERENCES `invoice` (`serial_phy`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_inv_txn`
    FOREIGN KEY (`serial_txn`)
    REFERENCES `tax_invoice` (`serial_txn`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

CREATE TABLE `total_invoice_tax_invoice` (
  `serial_tti` INT NOT NULL AUTO_INCREMENT,
  `serial_ttl` INT NULL,
  `serial_txn` INT NULL,
  `tax_base_tti` DECIMAL(10,2) NULL,
  `value_tti` DECIMAL(10,2) NULL,
  `status_tti` ENUM('ACTIVE', 'INACTIVE') NULL DEFAULT 'ACTIVE',
  PRIMARY KEY (`serial_tti`),
  INDEX `fk_tti_ttl_idx` (`serial_ttl` ASC),
  INDEX `fk_tti_txn_idx` (`serial_txn` ASC),
  CONSTRAINT `fk_tti_ttl`
    FOREIGN KEY (`serial_ttl`)
    REFERENCES `total_invoice` (`serial_ttl`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_tti_txn`
    FOREIGN KEY (`serial_txn`)
    REFERENCES `tax_invoice` (`serial_txn`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION) ENGINE=InnoDB;

ALTER TABLE `total_invoice` 
ADD COLUMN `sequential_ttl` INT NULL AFTER `serial_ttl`;


ALTER TABLE `total_invoice` 
DROP COLUMN `time_ttl`,
DROP COLUMN `payment_mode_ttl`;


ALTER TABLE `invoice_header_data` 
ADD COLUMN `currency_inv` VARCHAR(45) NULL AFTER `trade_name_inv`,
ADD COLUMN `payment_mode_inv` VARCHAR(45) NULL AFTER `currency_inv`,
ADD COLUMN `time_unit_inv` VARCHAR(45) NULL AFTER `payment_mode_inv`;


ALTER TABLE `payment_concept` 
ADD COLUMN `code_pct` VARCHAR(45) NULL AFTER `serial_pct`,
ADD COLUMN `celler_pct` VARCHAR(45) NULL AFTER `name_pct`;


ALTER TABLE `invoice` 
ADD COLUMN `amount_phy` INT NULL DEFAULT 1 AFTER `serial_ttl`,
ADD COLUMN `total_discounts_phy` DECIMAL(10,2) NULL AFTER `amount_phy`,
ADD COLUMN `total_before_taxes_phy` DECIMAL(10,2) NULL AFTER `payment_date_phy`;


ALTER TABLE `total_invoice` 
ADD COLUMN `serial_inv` INT NULL AFTER `serial_ttl`,
ADD INDEX `fk_ttl_inv_idx` (`serial_inv` ASC);
;
ALTER TABLE `total_invoice` 
ADD CONSTRAINT `fk_ttl_inv`
  FOREIGN KEY (`serial_inv`)
  REFERENCES `invoice_header_data` (`serial_inv`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;


CREATE TABLE `payment_detail_total_invoice` (
  `serial_pdt` INT NOT NULL AUTO_INCREMENT,
  `serial_ttl` INT NULL,
  `serial_pym` INT NULL,
  `serial_ccd` INT NULL,
  `serial_fin` INT NULL,
  `description_pdt` TEXT NULL,
  `num_check_pdt` VARCHAR(45) NULL,
  `account_type_pdt` VARCHAR(45) NULL,
  `city_pdt` VARCHAR(45) NULL,
  `document_number_pdt` VARCHAR(45) NULL,
  `date_year_expire_pdt` VARCHAR(45) NULL,
  `date_month_expire_pdt` VARCHAR(45) NULL,
  `owner_pdt` VARCHAR(45) NULL,
  `amount_pdt` VARCHAR(45) NULL,
  `kinship_pdt` VARCHAR(45) NULL,
  `id_owner_pdt` VARCHAR(45) NULL,
  `cellphone_owner_pdt` VARCHAR(45) NULL,
  `phone_owner_pdt` VARCHAR(45) NULL,
  `email_owner_pdt` VARCHAR(45) NULL,
  `date_pdt` DATETIME NULL,
`address_owner_pdt` TEXT NULL,
  `status_pdt` ENUM('ACTIVE', 'INACTIVE') NULL,
  `serial_usr_create` INT NULL,
  `serial_usr_update` INT NULL,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`serial_pdt`),
  INDEX `fk_pdt_ttl_idx` (`serial_ttl` ASC),
  INDEX `fk_pdt_pym_idx` (`serial_pym` ASC),
  INDEX `fk_pdt_ccd_idx` (`serial_ccd` ASC),
  INDEX `fk_pdt_fin_idx` (`serial_fin` ASC),
  INDEX `fk_pdt_usr_create_idx` (`serial_usr_create` ASC),
  INDEX `fk_pdt_usr_update_idx` (`serial_usr_update` ASC),
  CONSTRAINT `fk_pdt_ttl`
    FOREIGN KEY (`serial_ttl`)
    REFERENCES `total_invoice` (`serial_ttl`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pdt_pym`
    FOREIGN KEY (`serial_pym`)
    REFERENCES `payment_method` (`serial_pym`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pdt_ccd`
    FOREIGN KEY (`serial_ccd`)
    REFERENCES `credit_card` (`serial_ccd`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pdt_fin`
    FOREIGN KEY (`serial_fin`)
    REFERENCES `financial_institution` (`serial_fin`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pdt_usr_create`
    FOREIGN KEY (`serial_usr_create`)
    REFERENCES `user` (`serial_usr`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_pdt_usr_update`
    FOREIGN KEY (`serial_usr_update`)
    REFERENCES `user` (`serial_usr`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

ALTER TABLE `total_invoice` 
ADD COLUMN `serial_usr_create` INT NULL AFTER `status_ttl`,
ADD COLUMN `serial_usr_update` INT NULL AFTER `serial_usr_create`,
ADD COLUMN `created_at` DATETIME NULL AFTER `serial_usr_update`,
ADD COLUMN `updated_at` DATETIME NULL AFTER `created_at`,
ADD INDEX `fk_ttl_usr_create_idx` (`serial_usr_create` ASC),
ADD INDEX `fk_ttl_usr_update_idx` (`serial_usr_update` ASC);
;
ALTER TABLE `total_invoice` 
ADD CONSTRAINT `fk_ttl_usr_create`
  FOREIGN KEY (`serial_usr_create`)
  REFERENCES `user` (`serial_usr`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_ttl_usr_update`
  FOREIGN KEY (`serial_usr_update`)
  REFERENCES `user` (`serial_usr`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;


INSERT INTO `payment_mode` (`serial_ptm`, `name_ptm`, `short_name_pct`, `alias_ptm`, `status_ptm`) VALUES ('1', 'DIFERIDO CORRIENTE MASIVO', 'dc', 'DEFERREDCURRENT', 'ACTIVE');
INSERT INTO `payment_mode` (`serial_ptm`, `name_ptm`, `short_name_pct`, `alias_ptm`, `status_ptm`) VALUES ('2', 'PREPAGO', 'pp', 'PREPAID', 'ACTIVE');
INSERT INTO `payment_mode` (`serial_ptm`, `name_ptm`, `short_name_pct`, `alias_ptm`, `status_ptm`) VALUES ('3', 'CORRIENTE', 'cr', 'CURRENT', 'ACTIVE');
INSERT INTO `payment_mode` (`serial_ptm`, `name_ptm`, `short_name_pct`, `alias_ptm`, `status_ptm`) VALUES ('4', 'DIFERIDO CORRIENTE INDIVIDUAL', 'DCI', 'DEFERREDCURRENTSINGLE', 'ACTIVE');

UPDATE `payment_method` SET `serial_ptm` = '1' WHERE (`serial_pym` = '1');
UPDATE `payment_method` SET `serial_ptm` = '3' WHERE (`serial_pym` = '2');
UPDATE `payment_method` SET `serial_ptm` = '3' WHERE (`serial_pym` = '3');
UPDATE `payment_method` SET `serial_ptm` = '3' WHERE (`serial_pym` = '4');
INSERT INTO `payment_method` (`serial_pym`, `serial_ptm`, `name_pym`, `requires_owner_info_pym`, `requires_financial_pym`, `requires_credit_card_pym`, `type_pym`, `avalible_preaproved_pym`, `status_pym`) VALUES ('18', '3', 'ROL DE PAGOS', 'YES', 'NO', 'NO', 'PAYROLL', 'YES', 'ACTIVE');


UPDATE `payment_method` SET `type_pym` = 'CARD' WHERE (`serial_pym` = '1');
UPDATE `payment_method` SET `type_pym` = 'CARD' WHERE (`serial_pym` = '2');

ALTER TABLE `total_invoice` 
ADD COLUMN `access_key_ttl` VARCHAR(200) NULL AFTER `emition_date_ttl`;

ALTER TABLE `total_invoice` 
ADD COLUMN `xml_ttl` TEXT NULL AFTER `updated_at`;


ALTER TABLE `total_invoice` 
ADD COLUMN `total_dicounts_ttl` DECIMAL(10,2) NULL AFTER `total_invoicecol`;


ALTER TABLE `invoice` 
ADD COLUMN `comment_phy` VARCHAR(200) NULL AFTER `total_discounts_phy`;

ALTER TABLE `section` 
ADD COLUMN `cost_center_code_set` VARCHAR(45) NULL AFTER `description_set`;


UPDATE `section` SET `cost_center_code_set` = '04001' WHERE (`serial_set` = '5');
UPDATE `section` SET `cost_center_code_set` = '05001' WHERE (`serial_set` = '4');
UPDATE `section` SET `cost_center_code_set` = '03001' WHERE (`serial_set` = '3');
UPDATE `section` SET `cost_center_code_set` = '02001' WHERE (`serial_set` = '2');
UPDATE `section` SET `cost_center_code_set` = '02001' WHERE (`serial_set` = '1');
UPDATE `section` SET `cost_center_code_set` = '02001' WHERE (`serial_set` = '6');
ALTER TABLE `total_invoice` 
ADD COLUMN `email_paying_ttl` VARCHAR(500) NULL AFTER `id_ttl`;

UPDATE `payment_concept` SET `code_pct` = 'PI001', `celler_pct` = '2' WHERE (`serial_pct` = '4');
UPDATE `payment_concept` SET `code_pct` = 'TQ64', `celler_pct` = '2' WHERE (`serial_pct` = '43');
UPDATE `payment_concept` SET `code_pct` = 'TV75', `celler_pct` = '2' WHERE (`serial_pct` = '44');
UPDATE `payment_concept` SET `code_pct` = 'SA002', `celler_pct` = '2' WHERE (`serial_pct` = '23');

ALTER TABLE `total_invoice` 
ADD COLUMN `serial_usr_invoiced` INT NULL AFTER `status_invoice_ttl`,
CHANGE COLUMN `status_invoice_ttl` `status_invoice_ttl` SET('PAID', 'SETTED_SAFI', 'VOID', 'INVOICED_SAFI', 'PAID_SAFI') NULL DEFAULT NULL AFTER `xml_ttl`,
CHANGE COLUMN `status_ttl` `status_ttl` ENUM('ACTIVE', 'INACTIVE') NULL DEFAULT NULL AFTER `serial_usr_invoiced`;

ALTER TABLE `total_invoice` 
ADD COLUMN `result_safi` TEXT NULL AFTER `xml_ttl`;


INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('714', '156', 'Agrupación de rubros', 'laravel/public/invoiceExplode', '1', 'LOCKABLE');
insert into allowed_pages_by_process values ('714','invoiceexplodecontroller@getindex');
insert into allowed_pages_by_process values ('714','sectioncontroller@getsectionsbyschoolyearoptionsall');
insert into allowed_pages_by_process values ('714','schoolyearcontroller@getinvoicemonth');
insert into allowed_pages_by_process values ('714','saficontroller@getpaymentconceptgroups');
insert into allowed_pages_by_process values ('714','coursecontroller@getallbysectionoptionsall');
insert into allowed_pages_by_process values ('714','invoicetmcontroller@gethederdata');
insert into allowed_pages_by_process values ('714','invoiceheaderdatacontroller@getinfo');
insert into allowed_pages_by_process values ('714','invoiceexplodecontroller@getstudents');
insert into allowed_pages_by_process values ('714','invoiceexplodecontroller@getstudents');


INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('715', '156', 'Sincronizar información con safi', 'laravel/public/safi', '1.00', 'LOCKABLE');
insert into allowed_pages_by_process values ('715','saficontroller@getindex');
insert into allowed_pages_by_process values ('715','sectioncontroller@getsectionsbyschoolyearoptionsall');
insert into allowed_pages_by_process values ('715','schoolyearcontroller@getinvoicemonth');
insert into allowed_pages_by_process values ('715','saficontroller@getpaymentconceptgroups');
insert into allowed_pages_by_process values ('715','saficontroller@getpaymentconceptgroups');
insert into allowed_pages_by_process values ('715','coursecontroller@getallbysectionoptionsall');
insert into allowed_pages_by_process values ('715','saficontroller@getstudents');
insert into allowed_pages_by_process values ('715','saficontroller@postsavestudent');

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('716', '156', 'Facturación con safi', 'laravel/public/invoiceTM', '1.00', 'LOCKABLE');
insert into allowed_pages_by_process values ('716','invoicetmcontroller@getindex');
insert into allowed_pages_by_process values ('716','sectioncontroller@getsectionsbyschoolyearoptionsall');
insert into allowed_pages_by_process values ('716','schoolyearcontroller@getinvoicemonth');
insert into allowed_pages_by_process values ('716','saficontroller@getpaymentconceptgroups');
insert into allowed_pages_by_process values ('716','saficontroller@getpaymentconceptgroups');
insert into allowed_pages_by_process values ('716','coursecontroller@getallbysectionoptionsall');
insert into allowed_pages_by_process values ('716','invoicetmcontroller@gethederdata');
insert into allowed_pages_by_process values ('716','invoiceheaderdatacontroller@getinfo');
insert into allowed_pages_by_process values ('716','invoicetmcontroller@getstudents');
insert into allowed_pages_by_process values ('716','invoicetmcontroller@postinvoice');
insert into allowed_pages_by_process values ('716','invoicetmcontroller@postsummaryinvoice');
insert into allowed_pages_by_process values ('716','invoiceheaderdatacontroller@postsave');
insert into allowed_pages_by_process values ('715','invoiceheaderdatacontroller@postsave');
insert into allowed_pages_by_process values ('714','invoiceheaderdatacontroller@postsave');

ALTER TABLE `total_invoice` 
ADD COLUMN `phone_paying_ttl` VARCHAR(100) NULL AFTER `serial_usr_invoiced`;

ALTER TABLE `total_invoice` 
ADD COLUMN `month_ttl` VARCHAR(45) NULL AFTER `status_invoice_ttl`,
ADD COLUMN `due_date_ttl` DATE NULL AFTER `month_ttl`;

ALTER TABLE `total_invoice` 
CHANGE COLUMN `total_invoicecol` `net_total_ttl` DECIMAL(10,2) NULL DEFAULT NULL ;

UPDATE `payment_mode` SET `name_ptm` = 'DIFERRIDO SIN INTERESES' WHERE (`serial_ptm` = '1');


ALTER TABLE `payment_detail_total_invoice` 
ADD COLUMN `comment_pdt` TEXT NULL AFTER `address_owner_pdt`;
ALTER TABLE `total_invoice` 
CHANGE COLUMN `status_invoice_ttl` `status_invoice_ttl` SET('PAID', 'SETTED_SAFI', 'VOID', 'INVOICED_SAFI', 'PAID_SAFI', 'PARTIALLY') NULL DEFAULT NULL ;

INSERT INTO `payment_method` (`serial_pym`, `serial_ptm`, `name_pym`, `requires_owner_info_pym`, `requires_financial_pym`, `requires_credit_card_pym`, `avalible_preaproved_pym`, `status_pym`) VALUES (NULL, '1', 'Cheque', 'NO', 'NO', 'NO', 'NO', 'ACTIVE');
INSERT INTO `payment_method` (`serial_pym`, `serial_ptm`, `name_pym`, `requires_owner_info_pym`, `requires_financial_pym`, `requires_credit_card_pym`, `avalible_preaproved_pym`, `status_pym`) VALUES (NULL, '1', 'Efectivo', 'NO', 'NO', 'NO', 'NO', 'ACTIVE');
UPDATE `payment_method` SET `serial_ptm` = '1' WHERE (`serial_pym` = '9');
UPDATE `payment_method` SET `serial_ptm` = '1' WHERE (`serial_pym` = '10');
INSERT INTO `payment_method` (`serial_pym`, `serial_ptm`, `name_pym`, `requires_owner_info_pym`, `requires_financial_pym`, `requires_credit_card_pym`, `type_pym`, `avalible_preaproved_pym`, `status_pym`) VALUES (NULL, '1', 'Tarjeta Corriente', 'YES', 'NO', 'YES', 'CARD', 'NO', 'ACTIVE');

ALTER TABLE `total_invoice` 
CHANGE COLUMN `status_invoice_ttl` `status_invoice_ttl` SET('PAID', 'SETTED_SAFI', 'VOID', 'INVOICED_SAFI', 'PAID_SAFI', 'PARTIALLY') NULL DEFAULT NULL ;

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`, `id_exclusion`) VALUES ('717', '156', 'Manejo de rubros', 'laravel/public/paymentManage', '1.00', 'LOCKABLE', NULL);
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@getindex');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postdates');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsearchstudents');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postpaymentsforstudent');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postdiscounts');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postpaymentsrecover');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postrevertpaymentsrecover');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postocps');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsavediscounts');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsavecopy');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postcheckinvoices');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postcopy');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postloadpaymentmethoddata');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsaverevertpayment');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postloadpaymentmethods');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsaverecover');
insert into allowed_pages_by_process values(717,'paymentmanagecontroller@postsavestudentocpmonth');

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('718', '156', 'Exportar pagos', 'laravel/public/exportpaymetns', '1.00', 'LOCKABLE');
insert into allowed_pages_by_process values (718,'exportpaymentscontroller@getindex');
insert into allowed_pages_by_process values (718,'exportpaymentscontroller@poststudents');
ALTER TABLE `payment_method` 
CHANGE COLUMN `type_pym` `type_pym` ENUM('CARD', 'PAYCHECK', 'DEBIT', 'TRANSFER', 'PAYROLL', 'OCP') NULL DEFAULT NULL ;

INSERT INTO `payment_method` (serial_pym,`serial_ptm`, `name_pym`, `requires_owner_info_pym`, `type_pym`, `avalible_preaproved_pym`, `status_pym`) VALUES (22,'1', 'OCP', 'YES', 'OCP', 'NO', 'ACTIVE');

ALTER TABLE `financial_institution` 
ADD COLUMN `OCP` ENUM('YES', 'NO') NULL DEFAULT 'NO' AFTER `code_fin`;

ALTER TABLE `financial_institution` 
CHANGE COLUMN `OCP` `ocp_fin` ENUM('YES', 'NO') NULL DEFAULT 'NO' ;

UPDATE `financial_institution` SET `ocp_fin` = 'YES' WHERE (`serial_fin` = '10');
UPDATE `financial_institution` SET `ocp_fin` = 'YES' WHERE (`serial_fin` = '8');


CREATE TABLE `student_preasigned_payment_method_month` (
  `serial_spp` INT NOT NULL AUTO_INCREMENT,
  `serial_std` INT NULL,
  `serial_scy` INT NULL,
  `serial_pym` INT NULL,
  `serial_fin` INT NULL,
  `month_spp` DATE NULL,
  `status_spp` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_spp`),
  INDEX `fk_serial_spp_scy_idx` (`serial_scy` ASC),
  INDEX `fk_serial_spp_pym_idx` (`serial_pym` ASC),
  INDEX `fk_serial_spp_fin_idx` (`serial_fin` ASC),
  INDEX `fk_serial_spp_std_idx` (`serial_std` ASC),
  CONSTRAINT `fk_serial_spp_scy`
    FOREIGN KEY (`serial_scy`)
    REFERENCES `school_year` (`serial_scy`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_serial_spp_pym`
    FOREIGN KEY (`serial_pym`)
    REFERENCES `payment_method` (`serial_pym`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_serial_spp_fin`
    FOREIGN KEY (`serial_fin`)
    REFERENCES `financial_institution` (`serial_fin`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_serial_spp_std`
    FOREIGN KEY (`serial_std`)
    REFERENCES `student` (`serial_std`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

ALTER TABLE `student_preasigned_payment_method_month` 
ADD COLUMN `serial_usr_created` VARCHAR(45) NULL AFTER `month_spp`,
ADD COLUMN `serial_usr_updated` VARCHAR(45) NULL AFTER `serial_usr_created`,
ADD COLUMN `created_at` VARCHAR(45) NULL AFTER `status_spp`,
ADD COLUMN `updated_at` VARCHAR(45) NULL AFTER `created_at`;

ALTER TABLE `level` 
ADD COLUMN `name_lvl_ocp_lvl` VARCHAR(150) NULL AFTER `name_lvl`;

UPDATE `level` SET `name_lvl_ocp_lvl` = '1ro. Basica' WHERE (`serial_lvl` = '4');
UPDATE `level` SET `name_lvl_ocp_lvl` = '2do. Basica' WHERE (`serial_lvl` = '5');
UPDATE `level` SET `name_lvl_ocp_lvl` = '3ro. Basica' WHERE (`serial_lvl` = '6');
UPDATE `level` SET `name_lvl_ocp_lvl` = '4to. Basica' WHERE (`serial_lvl` = '7');
UPDATE `level` SET `name_lvl_ocp_lvl` = '5to. Basica' WHERE (`serial_lvl` = '8');
UPDATE `level` SET `name_lvl_ocp_lvl` = '6to. Basica' WHERE (`serial_lvl` = '9');
UPDATE `level` SET `name_lvl_ocp_lvl` = '7mo. Basica' WHERE (`serial_lvl` = '10');
UPDATE `level` SET `name_lvl_ocp_lvl` = '8vo. Basica' WHERE (`serial_lvl` = '11');
UPDATE `level` SET `name_lvl_ocp_lvl` = '9no. Basica' WHERE (`serial_lvl` = '12');
UPDATE `level` SET `name_lvl_ocp_lvl` = '10mo. Basica' WHERE (`serial_lvl` = '13');
UPDATE `level` SET `name_lvl_ocp_lvl` = '1ro. Bach.' WHERE (`serial_lvl` = '16');
UPDATE `level` SET `name_lvl_ocp_lvl` = '2do. Bach.' WHERE (`serial_lvl` = '17');
UPDATE `level` SET `name_lvl_ocp_lvl` = '3ro. Bach.' WHERE (`serial_lvl` = '18');
UPDATE `level` SET `name_lvl_ocp_lvl` = 'Toddlers 2' WHERE (`serial_lvl` = '15');
UPDATE `level` SET `name_lvl_ocp_lvl` = 'Toddlers 1' WHERE (`serial_lvl` = '2');
UPDATE `level` SET `name_lvl_ocp_lvl` = 'Kinder' WHERE (`serial_lvl` = '3');

ALTER TABLE `payment_detail_total_invoice` 
CHANGE COLUMN `amount_pdt` `amount_pdt` DECIMAL(10,2) NULL DEFAULT NULL ;

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('719', '156', 'Manejo de archivos OCP', 'laravel/public/ocpFile', '1', 'LOCKABLE');
select * from allowed_pages_by_process;
insert into allowed_pages_by_process values (719,'ocpfilemanagecontroller@getindex');
insert into allowed_pages_by_process values (719,'ocpfilemanagecontroller@postdates');
insert into allowed_pages_by_process values (719,'ocpfilemanagecontroller@postmonths');
insert into allowed_pages_by_process values (719,'ocpfilemanagecontroller@getocpfile');
insert into allowed_pages_by_process values (719,'ocpfilemanagecontroller@postproccesfile');

UPDATE `payment_mode` SET `name_ptm` = 'DIFERIDO SIN INTERESES' WHERE (`serial_ptm` = '1');

UPDATE `payment_concept` SET `code_pct` = 'SA Z-35', `celler_pct` = '2' WHERE (`serial_pct` = '49');
UPDATE `payment_concept` SET `celler_pct` = '01' WHERE (`serial_pct` = '49');
ALTER TABLE `section` 
ADD COLUMN `cost_center_code_pcg_2_set` VARCHAR(150) NULL AFTER `cost_center_code_pcg_1_set`,
CHANGE COLUMN `cost_center_code_set` `cost_center_code_pcg_1_set` VARCHAR(150) NULL DEFAULT NULL ;

UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '1');
UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '2');
UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '3');
UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '4');
UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '5');
UPDATE `section` SET `cost_center_code_pcg_2_set` = '00003' WHERE (`serial_set` = '6');


UPDATE payment_concept SET code_pct = 'PCH001' WHERE serial_pct = 1;
UPDATE payment_concept SET code_pct = 'PB001' WHERE serial_pct = 5;
UPDATE payment_concept SET code_pct = 'PB002' WHERE serial_pct = 6;
UPDATE payment_concept SET code_pct = 'PP001' WHERE serial_pct = 8;
UPDATE payment_concept SET code_pct = 'PK001' WHERE serial_pct = 25;
UPDATE payment_concept SET code_pct = 'BI 1' WHERE serial_pct = 27;
UPDATE payment_concept SET code_pct = 'TQ64' WHERE serial_pct = 43;
UPDATE payment_concept SET code_pct = 'TQCC' WHERE serial_pct = 17;
UPDATE payment_concept SET code_pct = 'TQM' WHERE serial_pct = 30;
UPDATE payment_concept SET code_pct = 'TQM46' WHERE serial_pct = 32;
UPDATE payment_concept SET code_pct = 'TQT' WHERE serial_pct = 47;
UPDATE payment_concept SET code_pct = 'TVT' WHERE serial_pct = 48;
UPDATE payment_concept SET code_pct = 'TV75' WHERE serial_pct = 44;
UPDATE payment_concept SET code_pct = 'TVM51' WHERE serial_pct = 31;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 49;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 50;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 9;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 53;
UPDATE payment_concept SET code_pct = 'RP' WHERE serial_pct = 11;
UPDATE payment_concept SET code_pct = 'RPRE' WHERE serial_pct = 10;
UPDATE payment_concept SET code_pct = 'RPP' WHERE serial_pct = 37;
UPDATE payment_concept SET code_pct = 'RPP' WHERE serial_pct = 38;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 36;
UPDATE payment_concept SET code_pct = 'SA' WHERE serial_pct = 52;

UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 35;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 48;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 31;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 40;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 15;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 44;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 46;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 34;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 47;
UPDATE payment_concept SET celler_pct = 2 WHERE serial_pct = 32;


UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 49;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 50;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 9;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 53;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 11;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 10;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 37;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 38;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 36;
UPDATE payment_concept SET celler_pct = '01' WHERE serial_pct = 52;

UPDATE `payment_concept` SET `code_pct` = 'PK001', `celler_pct` = '2' WHERE (`serial_pct` = '7');
UPDATE `payment_concept` SET `code_pct` = 'PK001', `celler_pct` = '2' WHERE (`serial_pct` = '51');

CREATE TABLE `authority_email` (
  `serial_ath` INT NOT NULL AUTO_INCREMENT,
  `serial_scy` INT NULL,
  `serial_set` INT NULL,
  `serial_lvl` INT NULL,
  `email_ath` VARCHAR(45) NULL,
  `description_ath` VARCHAR(45) NULL,
  `type_auth` SET('BURSAR','ADMITION') NULL,
  `status_ath` ENUM('ACTIVE', 'INACTIVE') NULL,
  PRIMARY KEY (`serial_ath`),
  INDEX `fk_ath_scy_idx` (`serial_scy` ASC),
  INDEX `fk_ath_set_idx` (`serial_set` ASC),
  INDEX `fk_ath_lvl_idx` (`serial_lvl` ASC),
  CONSTRAINT `fk_ath_scy`
    FOREIGN KEY (`serial_scy`)
    REFERENCES `school_year` (`serial_scy`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ath_set`
    FOREIGN KEY (`serial_set`)
    REFERENCES `section` (`serial_set`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_ath_lvl`
    FOREIGN KEY (`serial_lvl`)
    REFERENCES `level` (`serial_lvl`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)ENGINE=InnoDB;

ALTER TABLE `authority_email` 
CHANGE COLUMN `description_ath` `description_ath` TEXT NULL DEFAULT NULL ;


insert into  authority_email select null as serial_ath,serial_scy,serial_set,serial_lvl,'mcordovez@tomasmoro.k12.ec' as email_ath,'Email que se coloca en las cartas de pago en caso de que el email se envié a la persona equivocada' as description_ath,'BURSAR' as description_ath,'ACTIVE' as status_ath 
FROM level_section_year where serial_scy=9;

ALTER TABLE `student_preasigned_payment_method_month` 
ADD COLUMN `serial_usr_send_payment_card_spp` INT NULL AFTER `month_spp`,
ADD COLUMN `date_send_payment_card_spp` DATETIME NULL AFTER `serial_usr_send_payment_card_spp`,
ADD COLUMN `pdf_send_payment_card_spp` VARCHAR(200) NULL AFTER `date_send_payment_card_spp`;

ALTER TABLE `student_preasigned_payment_method_month` 
ADD INDEX `fk_serial_spp_usr_idx` (`serial_usr_send_payment_card_spp` ASC);
;
ALTER TABLE `student_preasigned_payment_method_month` 
ADD CONSTRAINT `fk_serial_spp_usr`
  FOREIGN KEY (`serial_usr_send_payment_card_spp`)
  REFERENCES `user` (`serial_usr`)
  ON DELETE NO ACTION
  ON UPDATE NO ACTION;

INSERT INTO `process` (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('720', '156', 'Envio de cartas de pago', 'laravel/public/paymentcard', '1', 'LOCKABLE');
insert into allowed_pages_by_process values(720,'paymentcardcontroller@getindex');
insert into allowed_pages_by_process values(720,'paymentcardcontroller@getstudents');
insert into allowed_pages_by_process values(720,'paymentcardcontroller@postsendnotifications');
insert into allowed_pages_by_process values(720,'schoolyearcontroller@getnvoicemonth');

ALTER TABLE `payment_detail_total_invoice` 
ADD COLUMN `payment_date_pdt` DATE NULL AFTER `address_owner_pdt`;
