Skip to main content

Bestandsbericht Letzter Preis im Arikelstamm

Comments

3 comments

  • Lothar Hasenkämper

    Hallo Alex,

    kannst du bitte das was du schon hast, exportieren und hier einstellen bitte.

    Gruß
    Lothar

    0
  • Alexander Schwarz

    Hallo Lothar,

     

    vielen Dank erstmal.

    Ich habe hier einen Code von jemandem aus dem Forum der sich die Listenpreise anzeigen lässt. Diesen wollte ich so anpassen das anstat der Listenpreis, der Letzte Preis (Berichte) angezeigt wird. Anbei der Code, schon etwas angepasst aber es funktioniert nicht...

     

    try

    {

    // parameters

    int formWidth = 600; // width of the window

    int formHeight = 400; // height of the window

    int left = 10; // distance to the left border

    string formTitle = "Item Prices"; // title of the new window

    string formType = "COR_CUS_SII"; // form type for new window


    // read information from the current window

    string itemCode = TextEdit.GetFromUID(pVal.Form, "5").Value;

    string itemName = TextEdit.GetFromUID(pVal.Form, "7").Value;


    // create items for new window

    Label label = Label.CreateNew("COR_LA1");

    label.Value = itemCode + " - " + itemName;

    label.Left = left; label.Top = 10; label.Width = 300; label.Height = 10;

    Grid grid = Grid.CreateNew("GR1");

    grid.SetPosition(label);

    grid.Top += label.Height + 5;

    grid.Height = formHeight - 80;

    grid.Width = formWidth - 25;

    Button buttonCancel = Button.CreateNew("2");

    buttonCancel.Left = left; buttonCancel.Top = formHeight - 60; buttonCancel.Width = 85; buttonCancel.Height = 20;


    // create new window

    Form form = Form.CreateNewForm(formType, "COR_CUS_SII" + SwissAddonFramework.Utils.UniqueStringGenerator.Next());

    form.Height = formHeight;

    form.Width = formWidth;

    form.Top = pVal.Form.Top;

    form.Left = pVal.Form.Left;

    form.Value = formTitle;

     

    // add items to window

    form.AddItem(label);

    form.AddItem(grid);

    form.AddItem(buttonCancel);


    // load window to screen

    form.Load();

     

    // fill data to grid

    string query = @"

    SELECT

    OINV.DocNum,

     


    ORDER BY OINV.DocNum";

    grid.ExecuteQuery(query);


    // set all columns to not editable

    foreach(GridColumn gc in grid.Columns.Values)

    {

    gc.Editable = false;

    }


    // react if the user is doubleclicking on the header of the row

    grid.Columns["RowsHeader"].AddHandler_DoubleClick(ModeComponent.FormModes.ALL,

    delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.DoubleClick ev)

    {

    try

    {

    // get current pricelist name

    string priceListName = grid.GetValue("CardName", ev.Row);

     

    // open pricelist

    MenuItem.GetFromUID("1713").Activate();

    Form currentForm = Form.GetFormFromUID(SwissAddonFramework.B1Connector.GetB1Connector().Application.Forms.ActiveForm.UniqueID);

    Matrix m = Matrix.GetFromUID(currentForm, "5");

    for(int i = 0; i < m.Rows.Count;i++)

    {

    string currentPriceList = m.GetValue("1", i);

    if(currentPriceList == priceListName)

    {

    m.Columns[0].Cells[i].Click(MatrixColumn.ClickTypes.Double, MatrixColumn.Modifier.None);

    return;

    }

    }

    }

    catch (System.Exception ex)

    {

    SwissAddonFramework.Messaging.StatusBar.WriteError("Error in customize rule to show the price list: " + ex.Message);

    }

    });


    }

    catch (System.Exception exe)

    {

    SwissAddonFramework.Messaging.StatusBar.WriteError("Error in customize rule to show the item prices: " + exe.Message);

    }

    0
  • Lothar Hasenkämper

    Hallo Alex,

    wie sieht denn das Original aus?
    In welchem Post ist das das?
    In der Query fragst du die Rechnungen ab. Warum?
    Ich verstehe nicht so ganz was du mit der Regel erreichen willst.

    Gruß Lothar

    0

Please sign in to leave a comment.