30. November 2017 10:58
IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN
SalesLine.SETRANGE("No.", ItemCharge."No.");
SalesLine.INSERT;
SalesLine."No." := ItemCharge."No.";
SalesLine.MODIFY;
END;
30. November 2017 13:38
IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN
ItemCharge.GET(SalesLine."No.");
[...]
END;
30. November 2017 14:11
30. November 2017 14:33
30. November 2017 14:49
30. November 2017 16:24
IF "Line No." <> 0 THEN BEGIN
SalesLine2.RESET;
SalesLine2.SETRANGE("Document Type","Document Type");
SalesLine2.SETRANGE("Document No.","Document No.");
SalesLine2.SETRANGE("Attached to Line No.","Line No.");
SalesLine2.SETFILTER("Line No.",'<>%1',"Line No.");
SalesLine2.DELETEALL(TRUE);
// Anpassung Start
SalesLine2.RESET;
SalesLine2.SETRANGE("Document Type","Document Type");
SalesLine2.SETRANGE("Document No.","Document No.");
SalesLine2.SETRANGE("Attached to XXX Line No.","Line No.");
SalesLine2.SETFILTER("Line No.",'<>%1',"Line No.");
SalesLine2.DELETEALL(TRUE);
// Anpassung Stop
END;
// Anpassung Start
IF (Type = Type::Item) AND ("No." <> xRec."No.") THEN
BEGIN
IF ...
// Bedingungen abprüfen, also Type = Charge Item usw.
THEN
BEGIN
CurrPage.SAVERECORD;
COMMIT;
// Ausführen, also neue Zeile anlegen, Zeilennr. erhöhen usw.
CurrPage.UPDATE(FALSE);
END;
END;
// Anpassung Stop
WITH SalesLineP DO
BEGIN
// ggf. vorhandene zugehörige Zeilen (Art=Artikel) löschen ** müsste bei dir dann Art Zu-/Abschlag sein!
SalesLineLoc.SETRANGE("Document Type","Document Type");
SalesLineLoc.SETRANGE("Document No.","Document No.");
SalesLineLoc.SETRANGE(Type,Type);
SalesLineLoc.SETRANGE("Attached to XXX Line No.","Line No.");
SalesLineLoc := SalesLineP;
IF SalesLineLoc.FIND('>') THEN
REPEAT
SalesLineLoc.DELETE(TRUE);
UNTIL SalesLineLoc.NEXT = 0;
// nächste Zeilen-Nr. ermitteln
SalesLineLoc.RESET;
SalesLineLoc.SETRANGE("Document Type","Document Type");
SalesLineLoc.SETRANGE("Document No.","Document No.");
SalesLineLoc := SalesLineP;
IF SalesLineLoc.FIND('>') THEN
BEGIN
LineSpacing := (SalesLineLoc."Line No." - "Line No.") DIV (1 + BOMComponentLoc.COUNT);
IF LineSpacing = 0 THEN ERROR(ErrText001);
END ELSE
LineSpacing := 10000;
NextLineNo := "Line No." + LineSpacing;
// Zeilen einfügen
REPEAT
SalesLineLoc.INIT;
SalesLineLoc."Document Type" := "Document Type";
SalesLineLoc."Document No." := SalesLineLoc."Document No.";
SalesLineLoc."Line No." := NextLineNo;
SalesLineLoc.INSERT;
SalesLineLoc."Sell-to Customer No." := "Sell-to Customer No.";
SalesLineLoc.VALIDATE(Type,SalesLineLoc.Type::Item); // ** bei Dir Zu-/Abschlag
SalesLineLoc.VALIDATE("No.",BOMComponentLoc."No."); // ** bei Dir die Zu-/Abschlag Nr.
SalesLineLoc."Location Code" := "Location Code";
SalesLineLoc."Shipment Date" := "Shipment Date";
SalesLineLoc.VALIDATE(Quantity,Quantity);
SalesLineLoc.VALIDATE("Unit Price",xxxxx);
IF "Line Discount %" <> 0 THEN
SalesLineLoc.VALIDATE("Line Discount %","Line Discount %");
IF "Shortcut Dimension 1 Code" <> '' THEN
SalesLineLoc.VALIDATE("Shortcut Dimension 1 Code","Shortcut Dimension 1 Code");
SalesLineLoc."Customer Price Group" := "Customer Price Group";
SalesLineLoc."Bill-to Customer No." := "Bill-to Customer No.";
SalesLineLoc."Gen. Bus. Posting Group" := "Gen. Bus. Posting Group";
SalesLineLoc.VALIDATE("VAT Bus. Posting Group","VAT Bus. Posting Group");
SalesLineLoc."Currency Code" := "Currency Code";
SalesLineLoc."Attached to XXX Line No." := "Line No.";
SalesLineLoc.MODIFY;
NextLineNo := NextLineNo + LineSpacing;
UNTIL BOMComponentLoc.NEXT = 0;
END;
30. November 2017 17:02
1. Dezember 2017 13:18
WITH SalesLineLocs DO BEGIN
IF SalesLineLocs.Type = SalesLineLocs.Type::"Charge (Item)" THEN BEGIN
NextLineNo := "Line No." + 10000;
SalesLineLoc.INIT;
SalesLineLoc."Document Type" := "Document Type";
SalesLineLoc."Document No." := "Document No.";
SalesLineLoc."Line No." := NextLineNo;
SalesLineLoc.INSERT;
SalesLineLoc.VALIDATE(Type, SalesLineLoc.Type::" ");
SalesLineLoc.VALIDATE("No.", ItemChargeLoc."No.");
SalesLineLoc.MODIFY;
END;
END;
1. Dezember 2017 22:07
iSam hat geschrieben:
Mein Code:
- Code:
IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN BEGIN
SalesLine.SETRANGE("No.", ItemCharge."No.");
SalesLine.INSERT;
SalesLine."No." := ItemCharge."No.";
SalesLine.MODIFY;
END;
Es funktioniert aber leider nicht. Kann jemand mir bitte helfen?
Danke.
2. Dezember 2017 16:04
WITH SalesLineLocs DO BEGIN
IF SalesLineLocs.Type = SalesLineLocs.Type::"Charge (Item)" THEN BEGIN
NextLineNo := "Line No." + 10000;
SalesLineLoc.INIT;
SalesLineLoc."Document Type" := "Document Type";
SalesLineLoc."Document No." := "Document No.";
SalesLineLoc."Line No." := NextLineNo;
SalesLineLoc.INSERT;
SalesLineLoc.VALIDATE(Type, SalesLineLoc.Type::" ");
SalesLineLoc.VALIDATE("No.", ItemChargeLoc."No.");
SalesLineLoc.MODIFY;
END;
END;
5. Dezember 2017 15:57
IF SalesLineP.Type = SalesLineP.Type::"Charge (Item)" THEN BEGIN
WITH SalesLineP DO BEGIN
SalesLineLoc.RESET;
SalesLineLoc.SETRANGE("Document Type", "Document Type");
SalesLineLoc.SETRANGE("Document No.", "Document No.");
SalesLineLoc := SalesLineP;
IF FIND('>') THEN BEGIN
LineSpacing := 10000;
NextLineNo := "Line No." + LineSpacing;
END;
REPEAT
SalesLineLoc.INIT;
SalesLineLoc."Document Type" := "Document Type";
SalesLineLoc."Document No." := "Document No.";
SalesLineLoc."Line No." := NextLineNo;
SalesLineLoc.INSERT;
SalesLineLoc.VALIDATE("No.", ItemChargeLoc."Standard Text Module");
SalesLineLoc.MODIFY;
NextLineNo := NextLineNo + LineSpacing;
UNTIL ItemChargeLoc.NEXT = 0;
END;
END;
5. Dezember 2017 19:11
6. Dezember 2017 00:07
6. Dezember 2017 01:44
6. Dezember 2017 13:17
6. Dezember 2017 14:22
IF SalesLine.Type = SalesLine.Type::"Charge (Item)" THEN
IF ItemChargeLoc.GET(SalesLine."No.") THEN
IF NOT SalesLineLoc.GET(SalesLine."Document Type",SalesLine."Document No.",SalesLine."Line No." + 1) THEN BEGIN
SalesLineLoc.RESET;
SalesLineLoc.INIT;
SalesLineLoc."Document Type" := SalesLine."Document Type";
SalesLineLoc."Document No." := SalesLine."Document No.";
SalesLineLoc."Line No." := SalesLine."Line No." + 1;
SalesLineLoc.INSERT;
SalesLineLoc.VALIDATE("No.", ItemChargeLoc."Standard Text Module");
SalesLineLoc.MODIFY;
END;
6. Dezember 2017 18:04
7. Dezember 2017 11:13
m_schneider hat geschrieben:Bei den Artikeln gibt es die gleiche Funktion mit den Textbausteinen. Schau dir mal Page 46 "OnValidate No." und Codeunit 378 an. Da solltest du alles finden.
15. Dezember 2017 17:57