25. Juni 2007 11:57
25. Juni 2007 12:13
JoSchuh hat geschrieben:Ich hab mittlerweile schon einige Versuche mit CHANGECOMPANY gemacht.
25. Juni 2007 13:02
// Mark the actual company
SourceCompany := COMPANYNAME;
// Run over all defined Sync-Companys
IF SyncCompany.FIND('-') THEN REPEAT
TargetCompany := SyncCompany.Company;
ContBusRel.CHANGECOMPANY(TargetCompany);
ContBusRel.SETRANGE("Contact No.", Cont."No.");
ContBusRel.SETFILTER("Link to Table", '<>''''');
IF ContBusRel.FIND('-') THEN
REPEAT
CASE ContBusRel."Link to Table" OF
ContBusRel."Link to Table"::Customer:
BEGIN
IF SyncCompany."Customer Synchronization" THEN BEGIN
Cust.CHANGECOMPANY(TargetCompany);
Cust.GET(ContBusRel."No.");
NoSerie := Cust."No. Series";
Cust.TRANSFERFIELDS(Cont);
Cust."No." := ContBusRel."No.";
Cust."No. Series" := NoSerie;
Cust.MODIFY;
END;
END;
ContBusRel."Link to Table"::Vendor:
BEGIN
IF SyncCompany."Vendor Synchronization" THEN BEGIN
Vend.GET(ContBusRel."No.");
NoSerie := Vend."No. Series";
PurchaserCode := Vend."Purchaser Code";
Vend.TRANSFERFIELDS(Cont);
Vend."No." := ContBusRel."No.";
Vend."No. Series" := NoSerie;
Vend."Purchaser Code" := PurchaserCode;
Vend.MODIFY;
END;
END;
ContBusRel."Link to Table"::"Bank Account":
BEGIN
BankAcc.GET(ContBusRel."No.");
NoSerie := BankAcc."No. Series";
OurContactCode := BankAcc."Our Contact Code";
BankAcc.TRANSFERFIELDS(Cont);
BankAcc."No." := ContBusRel."No.";
BankAcc."No. Series" := NoSerie;
BankAcc."Our Contact Code" := OurContactCode;
BankAcc.MODIFY;
END;
END;
UNTIL ContBusRel.NEXT = 0;
ContBusRel.CHANGECOMPANY(SourceCompany);
Cust.CHANGECOMPANY(SourceCompany);
Vend.CHANGECOMPANY(SourceCompany);
BankAcc.CHANGECOMPANY(SourceCompany);
UNTIL SyncCompany.NEXT = 0;