11. August 2010 10:53
GenJnLine.RESET;
GenJnLine.SETCURRENTKEY("Journal Template Name","Journal Batch Name","Line No.");
GenJnLine.SETRANGE("Journal Template Name", 'ZAHLGEING');
GenJnLine.SETRANGE("Journal Batch Name",'2007-01');
GenJnLine.SETRANGE("Applies-to Doc. Type","Applies-to Doc. Type"::Invoice);
IF GenJnLine.FINDSET THEN
REPEAT
CustLedEntry.SETRANGE("Document Type","Document Type"::Invoice);
CustLedEntry.SETRANGE("Document No.",GenJnLine."Applies-to Doc. No.");
CustLedEntry.SETRANGE("Customer No.",GenJnLine."Account No.");
IF NOT CustLedEntry.FINDSET THEN BEGIN
GenJnLine2.RESET;
GenJnLine2.SETCURRENTKEY("Journal Template Name","Journal Batch Name","Line No.");
GenJnLine2.SETRANGE("Journal Template Name", 'ZAHLGEING');
GenJnLine2.SETRANGE("Journal Batch Name",'2007-01');
GenJnLine2.SETRANGE("Line No.",GenJnLine."Line No.");
GenJnLine2.SETRANGE("Applies-to Doc. Type","Applies-to Doc. Type"::Invoice);
GenJnLine2.SETRANGE("Applies-to Doc. No.",GenJnLine."Applies-to Doc. No.");
GenJnLine2.SETRANGE("Account No.",GenJnLine."Account No.");
IF GenJnLine2.FINDSET THEN BEGIN
REPEAT
CLEAR(GenJnLine2."Applies-to Doc. No.");
CLEAR(GenJnLine2."Applies-to Doc. Type");
IF GenJnLine2.Amount > 0 THEN
GenJnLine2.Amount := GenJnLine2.Amount * (-1.0);
UNTIL GenJnLine2.NEXT(+1) = 0;
END;
END;
UNTIL GenJnLine.NEXT(+1) = 0;
END;
11. August 2010 11:05
11. August 2010 11:51
McClane hat geschrieben:Da dürften ein paar Kleinigkeiten nicht stimmen, aber in der Hauptsache fehlt wohl ein modify.
GenJnLine.RESET;
GenJnLine.SETCURRENTKEY("Journal Template Name","Journal Batch Name","Line No.");
GenJnLine.SETRANGE("Journal Template Name", 'ZAHLGEING');
GenJnLine.SETRANGE("Journal Batch Name",'2006-10');
GenJnLine.SETRANGE("Applies-to Doc. Type","Applies-to Doc. Type"::Invoice);
IF GenJnLine.FINDFIRST THEN BEGIN
REPEAT
OldCustLedgEntry.RESET;
OldCustLedgEntry.SETCURRENTKEY("Document No.");
OldCustLedgEntry.SETRANGE("Document No.",GenJnLine."Applies-to Doc. No.");
OldCustLedgEntry.SETRANGE("Document Type",GenJnLine."Applies-to Doc. Type");
OldCustLedgEntry.SETRANGE("Customer No.",GenJnLine."Account No.");
OldCustLedgEntry.SETRANGE(Open,TRUE);
IF NOT OldCustLedgEntry.FINDFIRST THEN BEGIN
GenJnLine2.RESET;
GenJnLine2.SETCURRENTKEY("Journal Template Name","Journal Batch Name","Line No.");
GenJnLine2.SETRANGE("Journal Template Name", 'ZAHLGEING');
GenJnLine2.SETRANGE("Journal Batch Name",'2006-10');
GenJnLine2.SETRANGE("Applies-to Doc. Type","Applies-to Doc. Type"::Invoice);
GenJnLine2.SETRANGE("Applies-to Doc. No.",GenJnLine."Applies-to Doc. No.");
//GenJnLine2.SETRANGE("Line No.",GenJnLine."Line No.");
IF GenJnLine2.FINDFIRST THEN BEGIN
GenJnLine2."Applies-to Doc. No." := '';
IF GenJnLine2.Amount > 0 THEN
GenJnLine2.Amount := GenJnLine2.Amount * (-1);
GenJnLine2.MODIFY;
END;
END;
UNTIL GenJnLine.NEXT(+1) = 0;
END;