Created
January 17, 2023 16:47
-
-
Save ignaciogutierrez/c2ef116d9e76ac2975052f2086fee90b to your computer and use it in GitHub Desktop.
Idea de clase para detectar y corregir tablas del modulo de inventario
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return | |
* | |
* Permite detectar y corregir inconsistencias en las tablas del modulo de inventario | |
* | |
define class inconsistencias-inv as custom | |
function getDupArts() | |
select numart,count(1) as dup from arts group by numart order by dup desc having dup>1 | |
into temp | |
function fixAllDupArts() | |
close database | |
* Obtener articulos duplicados en temp | |
this.getDupArts() | |
use arts order numart | |
select temp | |
scan | |
fixDupArts(temp.NUMART) | |
select temp | |
endscan | |
* | |
* Elimina los registros duplicados de UN articulo | |
* solo deja el primero que encuentra | |
function fixDupArts(cNumart) | |
select arts | |
seek cNumart | |
if not Found() | |
return | |
endif | |
* saltarme el primero, mantenerlo vivo | |
skip | |
scan while NUMART==cNumart | |
delete | |
endscan | |
EndDefine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment