[[Category:PROC]]
== Descripción ==
Copia de Módulo en proceso de generación de Módulos
== Biblioteca ==

== Composición ==
[[TABLA:moduloscab]]
[[TABLA:modulosdet]]
== Código ==
<small><pre>
DELIMITER $$

CREATE DEFINER=`sas_admin`@`%` PROCEDURE `CopiaModuloModulo`(IN pModuloOld CHAR(8),IN pModuloNew CHAR(8), IN pModuloDSC VARCHAR(50))
BEGIN
    -- ------------------------------------------------------
    -- Insert from moduloscab into bocetoscab
    -- ------------------------------------------------------
    CALL DebugCheckPoint(
        CONCAT(
        "PROC:CopiaModuloBoceto","/VAR/",
        pModuloOld,"-",
        pModuloNew,"-",
        pModuloDSC
        ));
    DELETE FROM moduloscab WHERE ModuloID=pModuloNew;
    DELETE FROM modulosdet WHERE ModuloID=pModuloNew;
    INSERT INTO moduloscab (
        `ModuloID`,
        `ModuloDSC`,
        `ModuloVW`,
        `ModuloVH`,
        `ModuloIMG`,
        `ModuloATH`,
        `ModuloFec`)
    SELECT
        pModuloNew,
        pModuloDSC,
        `moduloscab`.`ModuloVW`,
        `moduloscab`.`ModuloVH`,
        `moduloscab`.`ModuloIMG`,
        `moduloscab`.`ModuloATH`,
        CURDATE()
    FROM
        `fzggestion`.`moduloscab`
    WHERE 
        `moduloscab`.`ModuloID` = pModuloOld;
    -- ------------------------------------------------------
    -- Insert from modulosdet into bocetosdet
    -- ------------------------------------------------------
    INSERT INTO modulosdet (
        `ModuloID`,
        `ProductoID`,
        `ComposicID`,
        `CantidadPR`,
        `AnchoPredef`,
        `AltoPredef`,
        `DimensionChg`,
        `CantidadChg`,
        `ProductoChg`,
        `SubSetAncho`,
        `SubSetAlto`,
        `ProductoVsb`,
        `PosX`,
        `PosY`)
    SELECT
        pModuloNew,
        `modulosdet`.`ProductoID`,
        `modulosdet`.`ComposicID`,
        `modulosdet`.`CantidadPR`,
        `modulosdet`.`AnchoPredef`,
        `modulosdet`.`AltoPredef`,
        `modulosdet`.`DimensionChg`,
        `modulosdet`.`CantidadChg`,
        `modulosdet`.`ProductoChg`,
        `modulosdet`.`SubSetAncho`,
        `modulosdet`.`SubSetAlto`,
        `modulosdet`.`ProductoVsb`,
        `modulosdet`.`PosX`,
        `modulosdet`.`PosY`
    FROM
        `fzggestion`.`modulosdet`
    WHERE
        `modulosdet`.`ModuloID` = pModuloOld;
END
</pre></small>
== Bitácora ==
== Uso ==