2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-05-21 15:31:29 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`till_new`(
|
|
|
|
vClient INT,
|
|
|
|
vBank INT,
|
|
|
|
vAmount DOUBLE,
|
|
|
|
vConcept VARCHAR(25),
|
|
|
|
vDated DATE,
|
|
|
|
vSerie CHAR(1),
|
|
|
|
vBatch TINYINT,
|
|
|
|
vNumber INT,
|
|
|
|
vCompany SMALLINT,
|
|
|
|
vWorker INT
|
2024-01-15 11:31:03 +00:00
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
DECLARE vAccount VARCHAR(12);
|
|
|
|
DECLARE vSubaccount VARCHAR(12);
|
|
|
|
DECLARE vAsiento INT DEFAULT NULL;
|
|
|
|
|
|
|
|
-- Inserta el registro en cajas
|
|
|
|
INSERT INTO till
|
|
|
|
SET
|
2024-05-21 15:31:29 +00:00
|
|
|
workerFk = vWorker,
|
|
|
|
bankFk = vBank,
|
|
|
|
`in` = vAmount,
|
|
|
|
concept = vConcept,
|
|
|
|
dated = vDated,
|
|
|
|
serie = vSerie,
|
|
|
|
isAccountable = vBatch,
|
|
|
|
`number` = vNumber,
|
|
|
|
companyFk = vCompany;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
-- Inserta los asientos contables
|
|
|
|
SELECT account INTO vAccount
|
2024-03-14 07:36:19 +00:00
|
|
|
FROM accounting WHERE id = vBank;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
SELECT accountingAccount INTO vSubaccount
|
|
|
|
FROM `client` WHERE id = vClient;
|
|
|
|
|
2024-05-21 15:31:29 +00:00
|
|
|
CALL xdiario_new(
|
|
|
|
vAsiento,
|
|
|
|
vDated,
|
|
|
|
vAccount,
|
|
|
|
vSubaccount,
|
|
|
|
vConcept,
|
|
|
|
vAmount,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
NULL, -- Serie
|
|
|
|
NULL, -- Factura
|
|
|
|
NULL, -- IVA
|
|
|
|
NULL, -- Recargo
|
|
|
|
FALSE, -- Auxiliar
|
|
|
|
vCompany,
|
|
|
|
vAsiento);
|
2024-01-15 11:31:03 +00:00
|
|
|
|
2024-05-21 15:31:29 +00:00
|
|
|
CALL xdiario_new(
|
|
|
|
vAsiento,
|
|
|
|
vDated,
|
|
|
|
vSubaccount,
|
|
|
|
vAccount,
|
|
|
|
vConcept,
|
|
|
|
0,
|
|
|
|
vAmount,
|
|
|
|
0,
|
|
|
|
NULL, -- Serie
|
|
|
|
NULL, -- Factura
|
|
|
|
NULL, -- IVA
|
|
|
|
NULL, -- Recargo
|
|
|
|
FALSE, -- Auxiliar
|
|
|
|
vCompany,
|
|
|
|
vAsiento);
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|