USE `vn`;
DROP procedure IF EXISTS `ticketComponentMakeUpdate`;

DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentMakeUpdate`(	
	vTicketFk INT,
    vClientFk INT,
	vAgencyModeFk INT,
	vAddressFk INT,
	vWarehouseFk TINYINT,
    vCompanyFk SMALLINT,
	vShipped DATETIME,
	vLanded DATE,
    vIsDeleted BOOLEAN,
    vHasToBeUnrouted BOOLEAN,
	vOption INT)
BEGIN

 
	CALL vn.ticketComponentPreview (vTicketFk, vLanded, vAddressFk, vAgencyModeFk, vWarehouseFk);
    CALL vn.ticketComponentUpdate (
		vTicketFk, 
        vClientFk,
        vAgencyModeFk, 
        vAddressFk, 
		vWarehouseFk,
        vCompanyFk,
        vShipped, 
        vLanded, 
        vIsDeleted, 
        vHasToBeUnrouted,
        vOption
	);

    DROP TEMPORARY TABLE 
        tmp.ticketComponent,
		tmp.ticketComponentPrice;
END$$

DELIMITER ;

