Modification works differently in two companies

bluecat1972bluecat1972 Member Posts: 14
edited 2008-02-07 in Navision Financials
I was unable to find a similar issue, so here goes: Has anyone else experienced issues with modifications not working correctly between two companies in the same database?

I have two companies in my database. Certain tables synchronize between the companies - among them the Item and Vendor tables and related subtables.

We implemented a modification to the Sales Line table to pull the Unit Price from the Item Prices table to help ensure compliance with GSA pricing policies (you cannot sell to your commercial clients for less than the GSA schedule without modifying the schedule, except with a waiver essentially).

The Item Prices table contains various prices over time and must be retained for auditing purposes, so we match the Starting Date with a field on the Vendor Card. The idea is that, if the vendor exists, the filter is set for Starting Date = Vendor Card date when it copies the Unit Price to the Sales Line table as GSA Unit Price, so that if there is no Starting Date = Vendor Card date, GSA Unit Price should be $0.

What I have found is that, given the same data in the Vendor and Item Prices tables for both companies, the code is only working in one of the companies. In the other company, it disregards the filter for the Starting Date and just goes to the last record found for the quantity break.

This is the chunk of code, on the OnValidate trigger of several fields (to be called basically whenever anyone modifies a field that could affect pricing):


GSAPrice.SETFILTER("Item No.","No.");
GSAPrice.SETFILTER("Price Group Code",'GSA');
IF Mfr.GET(Item."Vendor No.") THEN
GSAPrice.SETFILTER("Starting Date",'%1',Mfr."GSA Client Price Imported")
ELSE
GSAPrice.SETFILTER("Starting Date",'..%1',WORKDATE);
IF (Quantity > 0) THEN
GSAPrice.SETFILTER("Quantity Break",'<=%1',Quantity)
ELSE
GSAPrice.SETFILTER("Quantity Break",'1');
IF GSAPrice.FIND('+') THEN BEGIN
"GSA Unit Price" := GSAPrice."Unit Price";
UpdateUnitPrice;
IF Type = Type::"Account (G/L)" THEN
CLEAR("GSA Unit Price");
END;

I am at a loss to explain why it would work in one company but not the other.

Comments

  • matttraxmatttrax Member Posts: 2,309
    It's difficult to say without data. Code is code, it doesn't decide to sometimes do this and sometimes do that. I know NAV has its quirks, but the code does what you (and to some extent data) tell it to.

    That said I will still continue to blame the code every time it doesn't work :)
  • SalminenpSalminenp Member Posts: 1
    Use debugger tool to detect problem.
  • DenSterDenSter Member Posts: 8,307
    You say some tables are synchronized across companies, so I am wondering if you use CHANGECOMPANY. If that's the case, then you will need to make sure that there is no VALIDATE into other companies, as this doesn't work, and would explain why you get unpredictable results.
Sign In or Register to comment.