VSVc register
Christoffer Riska
3-14-19
What is this register used for?

We have a situation where a supplier was registered in CUVc. After the record was saved a new purchase invoice was registered.
Then the invoice was removed, but the supplier cannot be removed from CUVc.
Hansa gives an error (2175) that the supplier cannot be removed.

The register CUVc is not a shared register.

After looking at the HAL code I can see that "function LongInt CUVcRecordCheck" in CUVcRAction.hal calls function Boolean VSVcExists. See code below.


function Boolean TestVSVcExists(string cucode,Boolean pof)
begin
Boolean res;
record VSVc VSr;
record POVc POr;
record PUVc PUr;

VSr.VECode = cucode;
res = ReadFirstMain(VSr,1,true);
if (res==false) then begin

if (pof) then begin
POr.VECode = cucode;
res = ReadFirstKey("VECode",POr,1,true);
if (res==false) then begin
PUr.VECode = cucode;
res = ReadFirstKey("VECode",PUr,1,true);

end;
end;
end;
TestVSVcExists = res;
return;
end;

function Boolean VSVcExists(string cucode,Boolean pof)
BEGIN
Boolean res;
string 255 sharedincomp,comp;

Integer curcomp;
Integer pos;

if (RegisterIsShared("CUVc")) then begin
sharedincomp = RegisterInSharedSetting("CUVc");
if (nonblank(sharedincomp)) then begin
curcomp = CurrentCompany;

pos = 0;
ExtractObj(sharedincomp,pos,comp);
while (nonblank(comp)) begin
if (SetCompany(StringToInt(comp),false)) then begin
// if (SetCompanyCode(comp,false)) then begin
res = TestVSVcExists(cucode,pof);
if (res) then begin
ResetCompany(curcomp);
goto LVSVcExists;
end;
end;
ExtractObj(sharedincomp,pos,comp);
end;
ResetCompany(curcomp);

end;
end else begin
end;
res = TestVSVcExists(cucode,pof);
LVSVcExists:;
VSVcExists = res;
return;
end;

....
if ((CUr.VEType==0) and (CU2r.VEType!=0)) then begin
if (VSVcExists(CUr.Code,false)) then begin
RecordCheckError(2175," " & CUr.Code,-1,"Code");
res = -1;
goto LCUVcRecordCheck;
end;
end;
....
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
Reino Botha
Please check your version of android if it is the same as the server you are connecting too. ...
08:24 21 Nov 2024
Bror-Erik Kotiranta
In NC you hace operations>>ai chats. They are used for these Br, Bror-Erik...
05:12 21 Nov 2024