7226-testToMaster_2416 #2320
|
@ -3738,16 +3738,7 @@ INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description,
|
|||
INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue)
|
||||
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');
|
||||
|
||||
INSERT INTO `vn`.`accountReconciliation` (
|
||||
supplierAccountFk,
|
||||
operationDated,
|
||||
valueDated,
|
||||
amount,
|
||||
concept,
|
||||
debitCredit,
|
||||
calculatedCode,
|
||||
created
|
||||
)
|
||||
INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,valueDated,amount,concept,debitCredit,calculatedCode,created)
|
||||
VALUES
|
||||
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',19.36,'BEL 1',1,'2','2023-12-14 08:39:53.000'),
|
||||
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',30226.43,'BEL 2',1,'1','2023-12-14 08:39:53.000'),
|
||||
|
|
|
@ -25,5 +25,42 @@ BEGIN
|
|||
ORDER BY calculatedCode, id
|
||||
) sub2 ON ar.id = sub2.id
|
||||
SET ar.calculatedCode = sub2.newId;
|
||||
|
||||
INSERT INTO till(
|
||||
dated,
|
||||
isAccountable,
|
||||
serie,
|
||||
concept,
|
||||
`in`,
|
||||
`out`,
|
||||
bankFk,
|
||||
companyFk,
|
||||
warehouseFk,
|
||||
supplierAccountFk,
|
||||
calculatedCode,
|
||||
InForeignValue,
|
||||
OutForeignValue,
|
||||
workerFk
|
||||
)
|
||||
SELECT ar.operationDated dated,
|
||||
TRUE isAccountable,
|
||||
'MB' serie,
|
||||
ar.concept,
|
||||
@totalIn := IF(ar.debitCredit = arc.debitCredit2 AND a.currencyFk = arc.currencyFk, ar.amount, NULL) `in`,
|
||||
@totalOut := IF(ar.debitCredit = arc.debitCredit AND a.currencyFk = arc.currencyFk, ar.amount, NULL) `out`,
|
||||
a.id bankFk,
|
||||
sa.supplierFk companyFk,
|
||||
arc.warehouseFk,
|
||||
ar.supplierAccountFk,
|
||||
ar.calculatedCode,
|
||||
@totalIn InForeignValue,
|
||||
@totalOut OutForeignValue,
|
||||
account.myUser_getId() user
|
||||
FROM accountReconciliation ar
|
||||
JOIN supplierAccount sa ON sa.id = ar.supplierAccountFk
|
||||
JOIN accounting a ON a.id = sa.accountingFk
|
||||
LEFT JOIN till t ON t.calculatedCode = ar.calculatedCode
|
||||
JOIN accountReconciliationConfig arc
|
||||
WHERE t.id IS NULL;
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue