86
Direct Purchasing for Version 3.x to NAV 2009 Classic RTC has same functionality, but different UI Direct Purchasing adds many new features to Navision Attain. First it allows you to issue a Purchase Order for a Navision “Resource”. In standard Navision the only way to purchase a non-Item is to purchase directly to a (G/L Account). An example of a purchased resource is outside processing. (Painting Service, Heat Treating, Plumbing,…) The Vendor provides a service that you may resell or the service is part of the cost of a product (job) that you make and then resell. Resources that you purchase must be assigned a Gen. Prod. Posting Group that works in combination with the Gen. Business Posting Groups that have GL Chart of account numbers in the Purchasing account columns. You can now enter a Resource line to a Purchase Order, Invoice, or Credit Memo. The Resource line can also have a Job No. assigned to it. When the Purchase Order is posted it will post that cost to the Jobs just like “Type Item” posts costs to Jobs. The extended text option on Resources also works when creating Purchase Orders. Automatic Ext. text works too. Standard Navision Purchase lines hold the Cost that you will pay to the vendor and it also holds the Unit Price that you intend to charge the Customer if the line entries are posted to Jobs. Resources on the purchase lines will do all of this just like items. The Resource cost and the unit price will also be changed if there are special costs or prices set up in the Resource Cost and Resource Price tables.

Direct Purchasing for Version 3.x to NAV 2009 Classic RTC ... · PDF fileRTC has same functionality, but different UI ... Menu Choice to enable Direct Purchase Orders generation

  • Upload
    ledat

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Direct Purchasing for Version 3.x to NAV 2009 Classic RTC has same functionality, but different UI

Direct Purchasing adds many new features to Navision Attain. First it allows you to issue a Purchase Order for a Navision “Resource”. In standard Navision the only way to purchase a non-Item is to purchase directly to a (G/L Account). An example of a purchased resource is outside processing. (Painting Service, Heat Treating, Plumbing,…) The Vendor provides a service that you may resell or the service is part of the cost of a product (job) that you make and then resell. Resources that you purchase must be assigned a Gen. Prod. Posting Group that works in combination with the Gen. Business Posting Groups that have GL Chart of account numbers in the Purchasing account columns. You can now enter a Resource line to a Purchase Order, Invoice, or Credit Memo. The Resource line can also have a Job No. assigned to it. When the Purchase Order is posted it will post that cost to the Jobs just like “Type Item” posts costs to Jobs. The extended text option on Resources also works when creating Purchase Orders. Automatic Ext. text works too. Standard Navision Purchase lines hold the Cost that you will pay to the vendor and it also holds the Unit Price that you intend to charge the Customer if the line entries are posted to Jobs. Resources on the purchase lines will do all of this just like items. The Resource cost and the unit price will also be changed if there are special costs or prices set up in the Resource Cost and Resource Price tables.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 2

Second new functionality: A Resource on a Sales Line can use a “new” Purchasing Code type called Direct Purchase. Direct Purchase Codes can only be used with Resources. Drop Ship and Special Order type Purchasing Codes can only be used with Items (standard Navision). Please note that the Resource being used with the Direct Purchase Option must have a Vendor No. in the Vendor No. field available. Information like Job No., Work Type, and Unit Price on the Sales Lines will be sent over to the Purchase Lines. The Sales Order lines are directly linked with Purchase Lines. You can lookup the PO from the Sales Order lines and or look up the sales order from the Purchase Order lines. This capability is ideal for clients that need to purchase “Direct” from the Sales Order. Think of it as a “push” to the Purchase Order system. Direct Purchasing has a choice on the Sales Order that sends Drop Ship, Special Order, and Direct Purchase lines to the Requisition Worksheet. There is even an option in the setup to go through the Requisition Worksheet and automatically generate the Purchase Order(s) without any other steps. There is also a new field on the Sales Lines called “Ship-to Option” that allows you the ship to instructions on the Purchase Order to be controlled per Sales Order Line. What this means is that each Sales Line can have a different Ship-to Code which will create separate Direct Ship type of Purchase Orders. Third new functionality: Sales Order No. History and Purchase Order No. History. Two new tables have been added to track EVERY Number. Even Deleted or Skipped Numbers. New reports have been created to track Customer Invoices and Vendor Invoices allocated to the Sales Order Number. What this means is that you now can see at a glance all related Invoices against a Sales Order and all related Vendor Invoices against a Sales Order. It is like “Sales Order Costing”. All actual costs against a Sales Order are now easily associated with that Sales Order. Fourth new functionality: Direct Purchasing interface with Job Costing. If you combine Direct Purchasing with Job Costing you can use “Special Order” and “Direct Purchases” and add the Job Number to the Line. Then when the Purchase Order is created the Job Number will be automatically populated on the Purchase Order Line as well.

Key Features: Menu Choice to enable Direct Purchase Orders generation directly from a Sales Order Line.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 3

Purchase Items or Purchase Resources Ability to generate Purchase Orders for Resources. Resource’s Extended Text works with Purchase Orders. Sales Order No. History and Purchase Order No. History “Ship-to” option available on Sales Order Lines to generate Purchase Order Ship to Instructions. Requisition Worksheet now allows a Job Number to be added.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 4

DIRECT PURCHASING

Setup Instructions

1. Go to Purchase and Payables Setup menu and find Direct Purchasing Setup.

2. This will open the Direct Purchasing Setup form. From here you will answer

some setup questions:

Direct Purchase Dimension: The functionality needs to know if you will want to transfer the dimensions that are found on the Sales Order to the automatically created Purchase Order, OR if you want the purchase

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 5

dimensions created as the Purchase Order is created. Typically this will be from Resource on Purchase Order.

3. The next two fields have to do with the automatic creation of Purchase Orders when you choose the Direct Purchase option on a sales line. The Direct Purchase option still transfers the sales line information through the Requisition Worksheet. These two fields tell the function what Requisition Worksheet Template and Batch names to use. You also get to set whether the entries will “stop” in the Requisition Worksheet before the Purchase Orders are created or not. See description of next field.

4. The last question is asking you if you want the sales line information to “stop”

in the Requisition Worksheet before the Purchase Orders are created. If you leave the box blank, then the Direct Purchase Sales Lines will pass though the Requisition Worksheet and create Purchase Orders without any other steps. The requisition lines are temporarily created and then deleted during the process. Technically you know the process uses the requisition lines but to the end user it seems as if the purchase lines were created directly from the sales lines.

If you should receive an error message during the create Purchase Order process then you will find the information in the requisition lines. The error might occur if the Carry Out Action Message process of the requisition lines, found missing and necessary information. In a case like this, read the error message carefully. The error will indicate the missing information.

If you check the box, then the Direct Purchase function will sent the sales order lines information to the Requisition Worksheet and the entries will stay there until a user enters the Req. Worksheet and triggers the “Carry Out Action Message” function. Which way you decide will have to do with your inter-company workflow.

5. Version 3.6 - Purchase & Payables Setup: You must set the “Combine

Special Orders Default” to Always Combine to use Direct Purchasing.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 6

6. Also go to the Purchasing Codes menu choice on the Purchase & Payables

Setup Menu. Here you need to enter another Purchasing code that will be used for the Direct Purchase functionality for Resources.

Add the new purchasing code called DIRECT see example below:

Please also notice the new column called “Default Ship-to Option”. With Direct Purchasing there is a new field on the Sales Lines called “Ship-to Option”. When you select a Purchasing Code on the Sales Lines, the Default from this area will fill in the value in the “Ship-to Option” on the Sales Lines. The “Ship-to Option” field can be changed on the sales lines after the default value comes in. The “Ship-to Option” allows you direct where the Purchase

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 7

Order’s “ship-to” address will come from. For example: The Ship-to Option for the Purchasing Code DROP SHIP should be Ship-to Code, then the Ship-to Code on the linked PO will get the Ship-to address from the Customer’s ship-to code. Typically a Purchasing Code of SPEC ORDER would have a Ship-to option of Location, which would create a PO with the ship-to address of the Location Code. The Direct Purchasing granule adds the ability to put a ship-to code on the sales line. If the Ship-to Option is Ship-to Code and the Ship-to Code on the Sales Line is filled in then the linked PO will get the ship-to address from the ship-to code on the sales line. This added feature allows you to have one sales order that can issue multiple Purchase Orders to multiple ship-to address. Hierarchy of determining the PO’s Ship-to address:

Using Ship-to Option: ―Ship-to Code‖

If the Ship-to Option is Ship-to Code and the Ship-to Code on the Sales Line

is blank then the Ship-to Code will come from the Sales Header. If the ship-to code on the sales header is blank then the ship-to address on the linked PO will be the customer’s shipping address.

Using Ship-to Option: ―Location‖

If the Ship-to Option is Location then if there is a Location Code value, then

the Ship-to Address on the linked PO will be the Location Code’s address.

If the Location code on the sales line is blank then the Ship-to address will be the Companies’ address found in the Company Information in GL Setup.

Ship-to Option: ―Job Site‖ - Is for future enhancements. 7. You have completed the Setup for Direct Purchasing so close the form.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 8

Setup related to Sales Order No. and Purchase Order No. History There are two ways to access the SO and PO Number History. One if the History Button on the Direct Purchasing Setup form. The other access is the History Button on the Job Main Menu. When you setup Direct Purchasing in a company that already has data you will need to run a batch job that creates the SO and PO Number History for data that already exists. Go to Object Designer. Select the Reports button. Go to Report 14005029. Run this object with no filters. You should only need to run this batch job report once. After running the batch job, you can go to the SO and PO Number History is viewed and printed (as mentioned above) and data will be there. Every time a new Sales Order is created the system automatically creates a record in the Sales Order History table. The SO History table tracks certain critical information. SO History will track if a SO is deleted, and posted into an invoice. The same process happens on the Purchase side for Purchase Order History. The SO and PO number history gives you full audibility of transaction documents.

Workflow Instructions

Entering Resources directly on a Purchase Order: This is very simple. When you are entering PO lines you now have a new Type, which is Resource. Selecting Type::Resource will allow the Resource list to show when you do a lookup on the No. field. You can also enter the Work Type related to the type of work that is being done. The Work Type has an effect on the costs and the selling price for that Resource. The Purchase Order line will lookup the appropriate costs and charges from the Navision standard Resource Cost and Resource Price tables. You can post Resource lines received only or received and invoiced. If Resource PO lines are linked to sales lines you will only be able to receive only then post the vendor invoice after the linked sales order is posted invoiced (billed).

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 9

Sales Line Resources using the Direct Purchase ―Purchase Option‖: This feature is quite convenient for companies who sell services that are sub-contracted out to third party vendors or outside resources. You simply enter the Resource on the sales order line and then change the purchase option field to a Direct Purchase choice. Like standard Navision Drop Ship and Special Order, the Direct Purchase option will have certain workflow procedures that go along with having transactions with direct links between sales order lines and purchase orders. See Entry procedures:

Entry procedures: 1. Enter the Sales Line using a Resource. You may enter the Work Type and a Job No. too if appropriate. You select the “DIRECT” Purchase Option for Resource when you want to automatically create a Purchase Order. 2. Enter all the lines for this Order. The lines can be a mixture of Items,

Resources, etc. Item lines may or may not be flagged Drop ship or Special Order.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 10

3. If the Item or Resource has a Vendor number associated with it (entered on

the Item or Resource Card) then when you enter a Purchasing Code the Vendor No. comes in automatically. If you expect to create Purchase Orders automatically then the lines will need to have Vendor numbers. The Lines can have the same vendor no.s or all different.

If some of the Sales Order lines have the same Vendor and the Ship from Location Code and the Ship-to Code is the same then those “similar” lines will end up together on the same Purchase Order. When sales lines have different vendors and shipping information then multiple Purchase Orders will be created.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 11

4. The Ship-to Option field is new. This field allows you to specify different ship-

to codes per line. Automatically created Purchase Orders can have multiple customer ship-to addresses. One PO per ship-to code. The default value comes from setting up the Purchasing Codes in the Purchase & Payables Setup menu.

5. “Ship-to Code” on the Sales Line: The field called “Ship-to Code” on the sales line can be filled in when the “Ship-to Option” is set to “Ship-to Code”. Here are some possible uses for the Ship-to Option and Ship-to Code fields. Potential Sales Lines Direct Purchasing Options: These settings work with the Special Order Items and the Direct Purchase Resources.

Set : Ship-to Option = Location Ship-to Code = Blank Location code = Yellow

Result: The Purchase Order Ship to instructions will be the address of the Yellow Location.

Set: Ship-to Option = Location Ship-to Code = Blank Location code = Blank

Result: The Purchase Order Ship to instructions will be the companies’ address found in the Company Information setup area in General Ledger setup.

Set: Ship-to Option = Ship-to Code Ship-to Code = Blank Location code = Yellow

Result: The Purchase Order Ship to instructions will be the address of the Ship-to information on the Sales Order Header.

Set: Ship-to Option = Ship-to Code Ship-to Code = L10 Location code = Yellow

Result: The Purchase Order Ship to instructions will be the address of the customer’s Ship-to Code L10

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 12

When using the Drop Ship Purchasing Code the Ship-to Option should be set to Ship-to Code. Then if you leave the “Ship-to Code” field on the sales line blank the Purchase Order Ship to instructions will be the ship-to information from the Sales Header.(Standard Navision) However, if you enter Ship-to codes on the lines you can created multiple Purchase Orders to different customer ship-to addresses. Please remember if you enter an alternate "Ship-to Code" on the sales header and if you want the Direct Purchasing created PO shipped to the customer’s alternative ship to address then you must set the Ship-to Option on the lines to “Ship-to Code”. If all lines will be going to the same address then the “Ship-to Code” field on the lines can be left blank and the PO will get the Ship-to Code from the sales header.

IMPORTANT: If you mix Ship-to Options on the lines of one sales order then you must enter a ship-to code on the lines that are set to ship-to option::Ship-to Code rather then leaving it blank. 6. Automatically Creating Purchase Orders: Next click on the Function Button,

then Purchasing, and then select the extended menu line “Create this Sales Order POs”

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 13

7. Assuming you have filled in the above information and the quantity field the

system will create appropriately linked Purchase Orders. You will be asked if you want to print the purchase order at this time. Typically not but you could.

When the Purchase orders are created you will see a screen like the above. Notice that the Purchase Order No.s now appear on the Sales Order lines.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 14

If your Directing Purchasing Setup is set to stop the sales lines in the Requisition Worksheet you will not get the above screen but would instead find a screen that looks like the following by going to Purchase & Payables Main Menu and selecting the Requisition Worksheets choice.

8. When you are ready to create the Purchase Orders from the Req. Worksheet

then delete any blank lines, which sometimes are at the top of the worksheet. Click the Function Button and select the “Carry Out Action Message” menu choice.

“Carry Out Action Message” is a Navision standard functionality. Purchase Orders are created for different Vendors, and different customers and different ship to addresses for more than one order to the same customer.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 15

9. No Lines to process: If you have triggered the Create PO function and you get the following message then double check your entry.

This message occurs if you have already processed this line into a Purchase Order. If you do a Ctrl F8 (Zoom) on the line, you can see if a Purchase Order No. and Purchase Order Line no. exist. Another way of telling is just try using the Purchase Order lookup. This message also occurs if the Purchase Option selected is NOT a “direct purchase” option. If you forgot to check it as a direct purchase option in setup then remove the Purchase Option from the sales line, then correct the Purchase Option in Purchase & Payables Setup. Then reselect the purchase option on the sales line.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 16

10. Linked Purchase Order Lines will contain the Sales Order No. and the Sales

Order Line No. that it is linked with.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 17

Dealing with Sales Order Line Changes – We are often asked what do you do if a customer changes his mind AFTER you have issued a PO to a Vendor. Depending on your business rules here are some possibilities:

1. If the change is for additional Quantity of an item , I suggest you not just change the original SO Quantity. I suggest you add an additional line for the extra quantity of the same item to show the original quantity ordered and the additional quantity. This new line item will need to have a Purchase Order Generated for it. Run the Generate PO and a new PO will be created for the new line. Excellent tracking this way.

2. If the change is for an additional item, just add the new line item and Generate another PO. Or instead of generating another PO, just manually enter the new addition line on the most appropriate PO.

3. If the change is for less quantity than the original quantity, and assuming your business rules allows for a change to Customer’s PO to you, you would then add a line for the negative quantity. Now the problem is what is your Vendor’s rules when you try to reduce a quantity of something you issued a PO for. And what is that Vendor’s rules about when that change can be made. If it is after he has the original coming to you in the UPS Truck, it is too late. Now we are talking about a Vendor RMA# process for Return Merchandise. Will he do it? My point is timing. It is all about when the change occurs. Do you issue a negative Purchase Order to your supplier? What are the rules here?

4. The Vendor “Short Ships” to you. Now what? You ordered 50 for your customer and you only received 45. My guess is that you will ship the 45 to the customer and tell him the 5 are back ordered. (unless only “ship complete” was stated on your incoming PO from your customer.) Let’s hope the Vendor can really deliver the balance, or else you will have to look for a supply else where.

5. Customer notifies you of a change of Ship to information. Again, it is a timing issue. Where is the actual product at the time you receive the request. If it left your warehouse last week it is too late. If the Warehouse can pull it off the UPS Truck you are saved.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 18

Installation Instructions:

PLEASE READ ENTIRE INSTRUCTIONS BEFORE BEGINNING.

THE INSTRUCTIONS AND OBJECTS INCLUDED HERE ARE FOR USE WITH A 3.01

Navision Attain DATABASE OR GREATER.

These instructions require a working knowledge of the C/SIDE development

system.

Add-on object files will arrive with all objects necessary to run the add-on including the

dependencies. We bundle all add-on products that are needed to work together. This

allows a one time installation of all the necessary objects.

The following is a list of all objects that will be modified when Direct Purchasing is fully

implemented.

Objects:

Type Count ID Name

Table 1 36 Sales Header

Table 2 37 Sales Line

Table 3 38 Purchase Header

Table 4 39 Purchase Line

Table 6 111 Sales Shipment Line

Table 7 113 Sales Invoice Line

Table 8 115 Sales Cr.Memo Line

Table 9 121 Purch. Rcpt. Line

Table 10 123 Purch. Inv. Line

Table 11 125 Purch. Cr. Memo Line

Table 12 156 Resource

Table 13 169 Job Ledger Entry

Table 14 210 Job Journal Line

Table 15 246 Requisition Line

Table 16 279 Extended Text Header

Table 17 5721 Purchasing

Table 18 14005027 Sales Order No. History

Table 19 14005028 Purchase Order No. History

Table 20 14005029 Direct Purchasing Setup

Form 22 42 Sales Order

Form 23 46 Sales Order Subform

Form 24 54 Purchase Order Subform

Form 25 55 Purch. Invoice Subform

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 19

Form 26 76 Resource Card

Form 27 291 Req. Worksheet

Form 28 334 Purchases & Payables Menu

Form 29 5727 Purchasing Code Entry

Form 30 5729 Purchasing Codes

Form 31 14005027 Sales Order No. History

Form 32 14005028 Purchace Order No. History

Form 33 14005029 Direct Purchasing Setup

Report 34 493 Carry Out Action Msg. - Req.

Report 35 14005027 Sales Order No. History Detail

Report 36 14005028 Purchase Order No. History Dtl

Report 37 14005029 Batch Build Existing History

Codeunit 38 63 Sales-Explode BOM

Codeunit 39 80 Sales-Post

Codeunit 40 90 Purch.-Post

Codeunit 41 202 Job Jnl.-Post Line

Codeunit 42 333 Req. Wksh.-Make Order

Codeunit 43 378 Transfer Extended Text

Codeunit 44 14005005 Direct Purchasing

Codeunit 45 14005006 Req. Wksh.-Make Order_JM

Instructions for integrating Direct Purchasing into your Database—

Before starting, you will need to determine a couple of things about your

database.

IMPORTANT: Compile ALL existing objects before starting the installation. Resolve all compiling errors before starting installation. This assures that when you compile objects after the installation, any compiling errors at that time will be caused by the installation and not something before the installation started.

Determine if any of the above listed objects have been modified in the database in which you are going to add Direct Purchasing. This is easily accomplished by starting an import of the appropriate fob file and looking at the import worksheet.

WE HIGHLY RECOMMEND THAT YOU READ OUR TIPS AND WARNINGS PAGES LOCATED AT THE BACK OF THIS DOCUMENT BEFORE STARTING.

If this is the first time that you are importing Direct Purchasing, then the only objects that may have conflicts are the base Navision objects. If you find that you have modified the same base Navision objects then you will need to manually integrate the Direct Purchasing changes found in those objects. To assist the manually integration process we have supplied a detailed Change Log.

Files available for importing are:

DirectPurchasing_310a_AllObjects_062102.fob Start by importing this one file. It contains all the Direct Purchasing objects and all dependant addon objects. If you have conflicts. Then use the following

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 20

Change Log to read about where the modifications exist and manually integrate the changes. 1. Copy the supplied “fob(s)”, Documents (This manual), and optionally any provided sample databases to your local hard drive for integration and testing. 2. Start Navision Attain. 3. Go to Tools, Object Designer 4. Go to File, Import

5. Go to provided “fob” - DirectPurchasing_310a_AllObjects_062102.fob 6. Select Open 7. You should get the following message.

8. Say NO. Open the Import Worksheet for review. (always)

If none of the objects listed above have been modified in the target database you can import the object file. When you start the import, you will get a different message than the one shown above that states that no conflicts were found, select

yes to import the objects immediately or select no to open the Import Worksheet. It

is recommended that you select no so the Import Worksheet will open in all

cases.

Even when there are no conflicts you will need to import the .FOB file in two(2)

passes.

1. Once the Worksheet is open, go to the Action column and select SKIP on all the “base” Navision objects, and make sure the Higher numbered objects (14004000+) have the “Create” or “Replace” action and then select OK.

2. Next do the File, Import process again on the same .FOB file. This time use the “Replace All” Button to flag ALL the objects with the Replace action. This will guarantee that all of the objects in the .fob actually get imported.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 21

You should get a screen similar to this.

If there are conflicting objects the Import Worksheet will indicate which objects are in conflict. If you have any conflicting objects make a list of these objects. These are the objects you will have to hand integrate the Direct Purchasing changes into. Instructions for hand integration of individual objects can be found in the Change Log.

If some, but not all, of the above listed objects have been modified in your database you can import the ones that have NOT been modified by using the Import Worksheet to indicate which objects to replace and which objects to skip. Choosing replace next to an object in the Import Worksheet will cause that object in your database to be replaced by the import object of the same number. Choosing skip will prevent the object in your database from being replaced. Select “replace” for all objects NOT on your conflicting

object list and select “skip” for all objects ON your conflicting object list. Using the

merge option is not recommended as a means of dealing with modified objects.

Using this option could make your task much harder.

9. Select OK ONLY after you have decided to Replace All, OR you have edited the

Action column on the import worksheet. (Reminder: Please read our Tips and Warnings about Navision’s Import process at end of this manual.) You must remember the objects that you selected to be skipped due to conflicts, so that you can manually integrate the changes later. (Write them down now or take a print screen.)

10. After saying OK, the Navision Import dialog box will say: create: X and replace

XX.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 22

11. At this stage there are new tables, forms, and reports added to your database. But they have no data in them.

12. If you were able to import and replace ALL objects then Compile all the objects. Problems or objects that were not able to be compiled will be “marked”. Use the View, Marked only choice from the tool bar at the top of the Navision screen while still in the Object Designer. If you exiting object designer will remove the marks!! And you will have to compile again to know which objects failed.

13. If there were Conflicting objects or compile errors, please continue reading and compare the Change Log to the database objects.

14. If there are not conflicts or compile errors then you have completed the installation and you can skip the change log area and continue on with the Add-on Setup & Workflow section.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 23

CHANGE LOG:

Table # 38: Purchase Header

1—Add the following fields:

60030 Ship-to Option Option (Non-editable)

OptionString:Location Code,Ship-to Code,Job Site

—Add the following key:

2—Add the following global variable.

Name DataType Subtype Length

PONoHistT Record Purchase Order No. History

3—Add the following code on the OnInsert trigger after all other code.

PurchSetup.GET;

IF "No." = '' THEN BEGIN

TestNoSeries;

NoSeriesMgt.InitSeries(GetNoSeriesCode,xRec."No. Series","Posting Date","No.","No.

Series");

END;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF PONoHistT.GET("No.") THEN

ERROR('Purchase Order No. already exists in History and can not be

duplicated.')

ELSE BEGIN

PONoHistT.INIT;

PONoHistT."Purchase Order No." := "No.";

PONoHistT."Date Created" := WORKDATE;

PONoHistT."User ID Creator" := USERID;

PONoHistT.INSERT;

END;

//end PM

InitRecord;

IF GETFILTER("Buy-from Vendor No.") <> '' THEN

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 24

IF GETRANGEMIN("Buy-from Vendor No.") = GETRANGEMAX("Buy-from Vendor

No.") THEN

VALIDATE("Buy-from Vendor No.",GETRANGEMIN("Buy-from Vendor No."));

DimMgt.InsertDocDim(

DATABASE::"Purchase Header","Document Type","No.",0,

"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");

4—Add the following code to the OnDelete trigger after all other code.

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT PONoHistT.GET("No.") THEN BEGIN

PONoHistT.INIT;

PONoHistT."Purchase Order No." := "No.";

PONoHistT."Date Created" := WORKDATE;

PONoHistT."User ID Creator" := USERID;

PONoHistT."Buy-From Vendor No." := "Buy-from Vendor No.";

PONoHistT."Pay-to Vendor No." := "Pay-to Vendor No.";

PONoHistT."Location Code" := "Location Code";

PONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

PONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PONoHistT."Purchaser Code" := "Purchaser Code";

PONoHistT."Order Class" := "Order Class";

PONoHistT."Job No." := "Job No.";

PONoHistT."Responsibility Center" := "Responsibility Center";

PONoHistT."Date Deleted" := WORKDATE;

PONoHistT."User ID on Delete" := USERID;

PONoHistT.INSERT;

END ELSE BEGIN

PONoHistT."Date Deleted" := WORKDATE;

PONoHistT."User ID on Delete" := USERID;

PONoHistT.MODIFY;

END;

//end PM

5—Add the following code to the OnValidate trigger of the Buy-from Vendor No. field.

//PurchMgr

UpdatePONoHistory();

//end PM

6—Add the following code to the OnValidate trigger of the Pay-to Vendor No. field.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 25

//PurchMgr

UpdatePONoHistory();

//end PM

??7—Add the following code to the OnValidate trigger of the Your Reference field.

8—Add the following code to the OnValidate trigger of the Location Code field.

//PurchMgr

UpdatePONoHistory();

//end PM

9—Add the following code to the OnValidate trigger of the Shortcut Dimension 1 field.

//PurchMgr

UpdatePONoHistory();

//end PM

10—Add the following code to the OnValidate trigger of the Shortcut Dimension 2 field.

//PurchMgr

UpdatePONoHistory();

//end PM

11—Add the following code to the OnValidate trigger of the Purchaser field.

//PurchMgr

UpdatePONoHistory();

//end PM

12—Add the following code to the OnValidate trigger of the Order Class field.

//PurchMgr

UpdatePONoHistory();

//end PM

13—Add the following code to the OnValidate trigger of the Job No. field.

//PurchMgr

UpdatePONoHistory();

//end PM

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 26

14—Add the following code to the OnValidate trigger of the Responsibilities Center

field.

//PurchMgr

UpdatePONoHistory();

//end PM

15—Add the following global function: UpdatePONoHistory

with the following local variable:

Name DataType Subtype Length

PONoHistT Record Purchase Order No. History

CODE:

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT PONoHistT.GET("No.") THEN BEGIN

PONoHistT.INIT;

PONoHistT."Purchase Order No." := "No.";

PONoHistT."Date Created" := WORKDATE;

PONoHistT."User ID Creator" := USERID;

PONoHistT."Buy-From Vendor No." := "Buy-from Vendor No.";

PONoHistT."Pay-to Vendor No." := "Pay-to Vendor No.";

PONoHistT."Location Code" := "Location Code";

PONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

PONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PONoHistT."Purchaser Code" := "Purchaser Code";;

PONoHistT."Order Class" := "Order Class";

PONoHistT."Job No." := "Job No.";

PONoHistT."Responsibility Center" := "Responsibility Center";

PONoHistT.INSERT;

END ELSE BEGIN

PONoHistT."Buy-From Vendor No." := "Buy-from Vendor No.";

PONoHistT."Pay-to Vendor No." := "Pay-to Vendor No.";

PONoHistT."Location Code" := "Location Code";

PONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

PONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PONoHistT."Purchaser Code" := "Purchaser Code";;

PONoHistT."Order Class" := "Order Class";

PONoHistT."Job No." := "Job No.";

PONoHistT."Responsibility Center" := "Responsibility Center";

PONoHistT.MODIFY;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 27

END;

//end PM

Table # 39: Purchase Line

1—Add another option to the Type field. The Option String and Option caption will be

as follows:

BEFORE:

OptionString: ,Account (G/L),Item,,Fixed Asset,Charge (Item)

OptionCaption: , Account (G/L),Item,,Fixed Asset,Charge (Item)

AFTER :

OptionString: ,Account (G/L),Item,Resource,Fixed Asset,Charge (Item)

OptionCaption: , Account (G/L),Item,Resource,Fixed Asset,Charge (Item)

2—Add Resource to the Type field Option String and Option Caption on the following

tables too:

Table # 121 Purch. Rcpt. Line

Table # 123 Purch. Inv. Line

Table # 125 Purch. Cr. Memo Line

3—Add Resource as a Type Option in Table # 246: Requisition Line too.

BEFORE:

Option String : ,Account (G/L),Item

Option Caption: ,Account (G/L),Item

AFTER:

Option String : ,Account (G/L),Item,Resource

Option Caption: ,Account (G/L),Item,Resource

4—Add the new fields as follows:

Field No. Field Name DateType Length

60031 Work Type Code Code 10

with a table relationship property of "Work Type"

60034 Ship-to Option Option

OptionString:Location,Ship-to Code,Job Site

Copy the same exact fields # 60031 and 60034 to the following tables:

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 28

Table # 123 Purch. Inv. Line

Table # 125 Purch. Cr. Memo Line ….not Ship-to Option field

5—Add the new condition for Resource to the Table Relationship property on the “No.”

field.

6—Edit the properties of the following fields to Editable = NO.

5713 Special Order Boolean

5714 Special Order Sales No. Code

5715 Special Order Sales Line No. Integer

7—Add the following code to the trigger (code area) of the new Work Type Code field:

//PurchReso

IF "Work Type Code" <> xRec."Work Type Code" THEN

IF Type <> Type::Resource THEN

ERROR('Work Type only pretains to a Resource transactions.')

ELSE

VALIDATE(Quantity,xRec.Quantity);

8—Add the following code to the OnValidate trigger of the Job No. field. Put this new

code below all existing code:

//PurchMgr

IF "Job No." <> xRec."Job No." THEN BEGIN

IF "Quantity Received" <> 0 THEN

ERROR(Text031);

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 29

IF "Sales Order Line No." <> 0 THEN BEGIN

SalesLine.SETRANGE("Document Type","Document Type"::Order);

SalesLine.SETRANGE("Document No.","Sales Order No.");

SalesLine.Setrange("Line No.","Sales Order Line No.");

IF SalesLIne.FIND('-') THEN BEGIN

IF (SalesLine."Job No." <> "Job No.") AND (SalesLine."Quantity Shipped" <> 0)

THEN

ERROR(Text032);

IF SalesLine."Quantity Shipped" = 0 THEN

IF NOT CONFIRM(Text033,FALSE,"Sales Order No.") THEN

ERROR(Text034)

ELSE BEGIN

SalesLine."Job No." := "Job No.";

SalesLine.MODIFY;

END;

END;

END;

IF "Special Order Sales Line No." <> 0 THEN BEGIN

SalesLine.RESET;

SalesLine.SETRANGE("Document Type","Document Type"::Order);

SalesLine.SETRANGE("Document No.","Special Order Sales No.");

SalesLine.Setrange("Line No.","Special Order Sales Line No.");

IF SalesLIne.FIND('-') THEN BEGIN

IF (SalesLine."Job No." <> "Job No.") AND (SalesLine."Quantity Shipped" <> 0)

THEN

ERROR(Text032);

IF SalesLine."Quantity Shipped" = 0 THEN

IF NOT CONFIRM(Text033,FALSE,"Special Order Sales No.") THEN

ERROR(Text034)

ELSE BEGIN

SalesLine."Job No." := "Job No.";

IF "Job No." = '' THEN

SalesLine."Job Applies-to ID" := '';

SalesLine.MODIFY;

END;

END;

END;

END;

VALIDATE(Quantity,xRec.Quantity);

//end PurchMgr

9—Add the following Text Codes in the Global area.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 30

Text031 : You cannot change the Job No. field after the line has been posted received.

Text032: You cannot change the Job No. that is associated with a Sales Line that has

been posted shipped.

Text033: The Job No. on the linked line to Sales Order No. %1 will be changed too. Do

you wish to continue?

Text034: Job No. change has been stopped.

10—Add a global variable as follows:

Name DataType SubType Length

Res Record Resource

PurchResoCU Codeunit Direct Purchasing

SalesHeaderT Record Sales Header

SONoHistT Record Sales Order No. History

11—Add the following code (BOLD) to the Quantity field.

IF Type = Type::Item THEN BEGIN

IF (Quantity = "Quantity Invoiced") AND (CurrFieldNo <> 0) THEN

CheckItemChargeAssgnt;

ItemPurchQtyDisc.SETRANGE("Item No.","No.");

ItemPurchQtyDisc.SETRANGE("Vendor No.","Buy-from Vendor No.");

ItemPurchQtyDisc.SETRANGE("Minimum Quantity",0,ABS("Quantity (Base)"));

IF ItemPurchQtyDisc.FIND('+') THEN

"Quantity Disc. %" := ItemPurchQtyDisc."Discount %";

END;

//PurchReso

IF Type = Type::Resource THEN BEGIN

PurchResoCU.FindResUnitPrice(Rec);

PurchResoCU.FindResUnitCost(Rec);

UpdateUnitCost;

VALIDATE("Tax Prod. Posting Group");

VALIDATE("Direct Unit Cost");

END; //end PurchReso

VALIDATE("Quantity Disc. %");

ReservePurchLine.VerifyQuantity(Rec,xRec);

UpdateWithWarehouseReceive;

WhseValidateSourceLine.PurchaseLineVerifyChange(Rec,xRec);

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 31

12—Add the following code to the code area on the “No.” field:

BEFORE:

Type::Resource:

ERROR(Text003);

Type::"Fixed Asset":

BEGIN

AFTER:

//PurchReso

Type::Resource:

BEGIN

Res.GET("No.");

Res.TESTFIELD(Blocked,FALSE);

Res.TESTFIELD("Gen. Prod. Posting Group");

Description := Res.Name;

"Description 2" := Res."Name 2";

VALIDATE("Unit of Measure Code",Res."Unit of Measure Code");

"Unit Cost ($)" := Res."Unit Cost";

"Indirect Cost %" := Res."Indirect Cost %";

"Direct Unit Cost" := Res."Direct Unit Cost";

"Gen. Prod. Posting Group" := Res."Gen. Prod. Posting Group";

"Tax Prod. Posting Group" := Res."Tax Prod. Posting Group";

"Tax Group Code" := Res."Tax Group Code";

PurchResoCU.FindResUnitPrice(Rec);

PurchResoCU.FindResUnitCost(Rec);

UpdateUnitCost;

VALIDATE("Tax Prod. Posting Group");

VALIDATE("Direct Unit Cost");

END;

//end PurchReso

Type::"Fixed Asset":

BEGIN

13—Add Resource as another condition to the Table Relationship in the No. field

properties:

Condition: Table

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 32

Type = CONST(Resource) Resource

Do the same for the following tables:

Table # 246 Requisition Line

Table # 121 Purch. Rcpt. Line

Table # 123 Purch. Inv. Line

Table # 125 Purch. Cr. Memo Line

14—Add the following (BOLD) code to the table‟s OnDelete trigger.

CALCFIELDS("Reserved Qty. (Base)");

TESTFIELD("Reserved Qty. (Base)",0);

WhseValidateSourceLine.PurchaseLineDelete(Rec);

//PurchMgr

{--remove and replace

IF "Sales Order Line No." <> 0 THEN BEGIN

LOCKTABLE;

SalesOrderLine.LOCKTABLE;

SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.");

SalesOrderLine."Purchase Order No." := '';

SalesOrderLine."Purch. Order Line No." := 0;

SalesOrderLine.MODIFY;

END;

IF ("Special Order Sales Line No." <> 0) THEN BEGIN

LOCKTABLE;

SalesOrderLine.LOCKTABLE;

SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Special Order Sales

No.","Special Order Sales Line No.");

SalesOrderLine."Special Order Purchase No." := '';

SalesOrderLine."Special Order Purch. Line No." := 0;

//PurchMgr--add line

SalesOrderLine."Purchase Order No." := '';

//end added this to CU333 when make PO through Req.

SalesOrderLine.MODIFY;

END; -------------------------------------}

//PurchMgr -- Replacement

IF "Sales Order Line No." <> 0 THEN BEGIN

LOCKTABLE;

SalesOrderLine.LOCKTABLE;

IF SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.") THEN

BEGIN //only do it if you can find it

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 33

SalesOrderLine."Purchase Order No." := '';

SalesOrderLine."Purch. Order Line No." := 0;

SalesOrderLine.MODIFY;

END;

END;

IF ("Special Order Sales Line No." <> 0) THEN BEGIN

LOCKTABLE;

SalesOrderLine.LOCKTABLE;

IF SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Special

Order Sales No.","Special Order Sales Line No.") THEN

BEGIN

SalesOrderLine."Special Order Purchase No." := '';

SalesOrderLine."Special Order Purch. Line No." := 0;

//PurchMgr--add line

SalesOrderLine."Purchase Order No." := '';

//end

SalesOrderLine.MODIFY;

END;

END;

//end PM

IF ("Item Tracking No." <> 0) AND

("Receipt Line No." = 0) AND

("Return Shipment Line No." = 0)

THEN

ItemTrackingMgt.DeleteItemTrackingLines("Item Tracking No.");

15—Add the following code at the end of the UpdateUnitCost trigger. Also add the local

variable: SalesLT Record Sales Line

//PurchMgr ...when edit PO on linked lines... edit the SO too

IF "Unit Cost ($)" <> xRec."Unit Cost ($)" THEN

IF "Sales Order Line No." <> 0 THEN BEGIN

SalesLT.SETRANGE("Document Type",SalesLT."Document Type"::Order);

SalesLT.SETRANGE("Document No.","Sales Order No.");

SalesLT.SETRANGE("Line No.","Sales Order Line No.");

IF SalesLT.FIND('-') THEN BEGIN

SalesLT."Unit Cost ($)" := "Unit Cost ($)";

SalesLT.MODIFY;

END;

END ELSE

IF "Special Order Sales Line No." <> 0 THEN BEGIN

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 34

SalesLT.RESET;

SalesLT.SETRANGE("Document Type",SalesLT."Document Type"::Order);

SalesLT.SETRANGE("Document No.","Special Order Sales No.");

SalesLT.SETRANGE("Line No.","Special Order Sales Line No.");

IF SalesLT.FIND('-') THEN BEGIN

SalesLT."Unit Cost ($)" := "Unit Cost ($)";

SalesLT.MODIFY;

END;

END;

//end PurchMgr

16—Make the “Sales Order No.” field editable then change the edibility on the subforms

(54 & 55). Also insert the following code to assist when we allow editing this field.

17— See Globals added for the following code.

18—Also remove the Table relationship property of the Sales Order No. field and insert

the following code in the OnLookup trigger instead.

//PurchMgr

IF SalesHeaderT.GET(SalesHeaderT."Document Type"::Order,"Sales Order No.") THEN

BEGIN

IF FORM.RUNMODAL(FORM::"Sales Order",SalesHeaderT) = ACTION::LookupOK

THEN

IF "Document Type" = "Document Type"::Invoice THEN

"Sales Order No." := SalesHeaderT."No.";

END ELSE

IF ("Sales Order No." <> '') AND

(SONoHistT.GET("Sales Order No.")) THEN BEGIN

SONoHistT.SETRANGE("Sales Order No."); //release filter

IF FORM.RUNMODAL(FORM::"Sales Order No. History",SONoHistT) =

ACTION::LookupOK THEN

IF "Document Type" = "Document Type"::Invoice THEN

"Sales Order No." := SONoHistT."Sales Order No.";

END ELSE BEGIN

SONoHistT.SETRANGE("Sales Order No."); //release filter

IF FORM.RUNMODAL(FORM::"Sales Order No. History",SONoHistT) =

ACTION::LookupOK THEN

IF "Document Type" = "Document Type"::Invoice THEN

"Sales Order No." := SONoHistT."Sales Order No.";

END;

19—Add the following code in the local function called UpdateSalesCost()

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 35

//PurchMgr

{--Original code removed and replaced below----

IF "Sales Order Line No." <> 0 THEN BEGIN // Drop Shipment

SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.");

SalesOrderLine."Unit Cost ($)" := "Unit Cost ($)";

SalesOrderLine."Unit Cost" := "Unit Cost";

SalesOrderLine.VALIDATE("Unit Cost ($)");

IF CurrFieldNo <> 0 THEN BEGIN

IF NOT RECORDLEVELLOCKING THEN

LOCKTABLE(TRUE,TRUE);

SalesOrderLine.MODIFY;

END;

END;--------------------------------------------}

IF "Sales Order Line No." <> 0 THEN // Drop Shipment

IF SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.") THEN

BEGIN

SalesOrderLine."Unit Cost ($)" := "Unit Cost ($)";

SalesOrderLine."Unit Cost" := "Unit Cost";

SalesOrderLine.VALIDATE("Unit Cost ($)");

IF CurrFieldNo <> 0 THEN BEGIN

IF NOT RECORDLEVELLOCKING THEN

LOCKTABLE(TRUE,TRUE);

SalesOrderLine.MODIFY;

END;

END;

//end PM

20—This completes the changes to the Purchase Line table.

Table # 36: Sales Header

1—Add the following global variable.

Name DataType Subtype Length

SONoHistT Record Sales Order No. History

2—Add the following code on the OnInsert trigger. Be sure to position the code as

indicated below with new code in BOLD and original code not bold.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 36

SalesSetup.GET;

IF "No." = '' THEN BEGIN

TestNoSeries;

NoSeriesMgt.InitSeries(GetNoSeriesCode,xRec."No. Series","Posting Date","No.","No.

Series");

END;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF SONoHistT.GET("No.") THEN

ERROR('Sales Order No. already exists in History and can not be duplicated.')

ELSE BEGIN

SONoHistT.INIT;

SONoHistT."Sales Order No." := "No.";

SONoHistT."Date Created" := WORKDATE;

SONoHistT."User ID Creator" := USERID;

SONoHistT.INSERT;

END;

//end PM

InitRecord;

IF GETFILTER("Sell-to Customer No.") <> '' THEN

IF GETRANGEMIN("Sell-to Customer No.") = GETRANGEMAX("Sell-to Customer

No.") THEN

VALIDATE("Sell-to Customer No.",GETRANGEMIN("Sell-to Customer No."));

DimMgt.InsertDocDim(

DATABASE::"Sales Header","Document Type","No.",0,

"Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");

3—Add the following code to the OnDelete trigger after all other code.

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT SONoHistT.GET("No.") THEN BEGIN

SONoHistT.INIT;

SONoHistT."Sales Order No." := "No.";

SONoHistT."Date Created" := WORKDATE;

SONoHistT."User ID Creator" := USERID;

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 37

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

SONoHistT.”Responsibility Center” := “Responsibility Center”;

SONoHistT."Date Deleted" := WORKDATE;

SONoHistT."User ID on Delete" := USERID;

SONoHistT.INSERT;

END ELSE BEGIN

SONoHistT."Date Deleted" := WORKDATE;

SONoHistT."User ID on Delete" := USERID;

SONoHistT.MODIFY;

END;

//end PM

4—Add the following code to the OnValidate trigger of the Sell-to Customer No. field.

//PurchMgr

UpdateSONoHistory();

//end PM

5—Add the following code to the OnValidate trigger of the Bill-to Customer field.

//PurchMgr

//UpdateSONoHistory(); ..removed

//end PM

6—Add the following code to the OnValidate trigger of the Your Reference field.

//PurchMgr

UpdateSONoHistory();

//end PM

7—Add the following code to the OnValidate trigger of the Location Code field.

//PurchMgr

//UpdateSONoHistory(); ……removed because causes conflict with the Credit Warning

//end PM when triggered by the OnValidate of the Sell-to Customer No.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 38

8—Add the following code to the OnValidate trigger of the Shortcut Dimension 1 field.

//PurchMgr

UpdateSONoHistory();

//end PM

9—Add the following code to the OnValidate trigger of the Shortcut Dimension 2 field.

//PurchMgr

UpdateSONoHistory();

//end PM

10—Add the following code to the OnValidate trigger of the Salesperson field.

//PurchMgr

UpdateSONoHistory();

//end PM

11—Add the following code to the OnValidate trigger of the Order Class field.

//PurchMgr

UpdateSONoHistory();

//end PM

12—Add the following code to the OnValidate trigger of the Job No. field.

//PurchMgr

UpdateSONoHistory();

//end PM

13—Add the following Global function: UpdateSONoHistory

with the following local variable:

Name DataType Subtype Length

SONoHistT Record Sales Order No. History

CODE:

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT SONoHistT.GET("No.") THEN BEGIN

SONoHistT.INIT;

SONoHistT."Sales Order No." := "No.";

SONoHistT."Date Created" := WORKDATE;

SONoHistT."User ID Creator" := USERID;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 39

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

SONoHistT."Responsibility Center" := "Responsibility Center";

SONoHistT.INSERT;

END ELSE BEGIN

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

SONoHistT."Responsibility Center" := "Responsibility Center";

SONoHistT.MODIFY;

END;

//end PM

14—Add the following code to the end of the “Ship-to Code” OnValidate Trigger.

//DirectPurch

IF "Document Type" = "Document Type"::Order THEN

IF NOT SONoHistT.GET("No.") THEN BEGIN

SONoHistT.INIT;

SONoHistT."Sales Order No." := "No.";

SONoHistT."Date Created" := WORKDATE;

SONoHistT."User ID Creator" := USERID;

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 40

SONoHistT.INSERT;

END ELSE BEGIN

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

SONoHistT.MODIFY;

END;

//end PM

15—This completes the Sales Header table.

Table # 37: Sales Line

1—Add the following new fields:

Field No. Field Name DateType Length

60030 Vendor No. Code 20

with table relationship to Vendor.

Add the following local variable to the Vendor No. trigger:

UnitCost Decimal

60031 Direct Purchase Boolean

60032 Ship-to Options Option

OptionString:Location Code,Ship-to Code,Job Site

Init Property: 1

IF ("Document Type" = "Document Type"::Order) AND

(xRec."Ship-to Option" <> "Ship-to Option")

THEN

IF ("Purch. Order Line No." <> 0) OR ("Special Order Purch. Line No." <> 0) THEN

ERROR(Text035);

IF "Ship-to Option" <> "Ship-to Option"::"Ship-to Code" THEN

"Ship-to Code" := '';

IF ("Document Type" = "Document Type"::Order) AND

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 41

(xRec."Ship-to Option" <> "Ship-to Option")

THEN

IF ("Purch. Order Line No." <> 0) OR ("Special Order Purch. Line No." <> 0) THEN

ERROR(Text035);

IF "Ship-to Option" <> "Ship-to Option"::"Ship-to Code" THEN

"Ship-to Code" := '';

60033 Ship-to Code Code 10

Table relationship:

Ship-to Address (table) Code (field)

(Table filter) Customer No.=FIELD(Sell-to Customer No.)

OnValidate Code:

//PurchMgr

IF ("Document Type" = "Document Type"::Order) AND

(xRec."Ship-to Code" <> "Ship-to Code")

THEN BEGIN

IF ("Purch. Order Line No." <> 0) OR ("Special Order Purch. Line No." <> 0) THEN

ERROR(

Text006,

FIELDCAPTION("Ship-to Code"));

END;

IF "Ship-to Option" <> "Ship-to Option"::"Ship-to Code" THEN

ERROR(Text034);

2—Add the following Text Codes to the Global Text area:

Name ConstValue

Add Text031 Direct Purchase must use Resources with a Vendor No.

Add Text032 Resource No. not found

Add Text033 : You can not change to ship-to code %1 because a PO is already linked.

Add Text034 : You can only use this field when the ship-to option field is set to Ship-to

Code.

Add Text035 : You cannot change the Ship-to Option because the Sales line is linked to

a Purchase Order.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 42

Add Text036 : You cannot use Drop Shipment with Jobs. Remove the Job No. or use

Special Order.

Text037 : You cannot change the Job No. field after the line has been posted received.

Text038: You cannot change the Job No. that is associated with a Sales Line that has

been posted shipped.

Text039: The Job No. on the linked line to Sales Order No. %1 will be changed too. Do

you wish to continue?

Text040: Job No. change has been stopped.

Text041: Vendor No. %1 was not found.

Text042: Do you want to change the Unit Cost $ to this Vendors Direct Unit Cost of %1?

Text043: A %1 percent qty. discount is available from Vendor No. %2 when the Qty is %3.

Text044 :Direct Purchase must use Resources with a Vendor No.

Text045 :You can not change or add a purchasing code because quantity has already been shipped.

Add to Text02: ….\If you edit the Purchase Order the sales lines will be updated.

(The \ makes a new line)

3—Copy the same exact fields # 60030, 60031 to the following tables:

Table # 111 Sales Shipment Line

Table # 113 Sales Invoice Line

4—Remove the Condition to be Drop Shipment =CONST Yes on field No. 71 Purchase

Order Number in the Table Relationship properties.

5—Add the following Global Variable.

Name DateType SubType

ResourceT Record Resource

JobT Record Job

PurchLT Record Purchase Line

Vend Record Vendor

ItemVend Record Item Vendor

ItemPurchQtyDisc Record Item Purch.Qty.Disc.

QtyDiscPercent Decimal

6—Add the following code to the field # 5711 (Purchasing Code):

//PurchReso

{--orig--

TESTFIELD(Type,Type::Item);

IF ("Purch. Order Line No." <> 0) OR

("Special Order Purch. Line No." <> 0)

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 43

THEN

ERROR(

Text002,

FIELDCAPTION(Type),"Purchase Order No.");

IF PurchasingCode.GET("Purchasing Code") THEN BEGIN

"Drop Shipment" := PurchasingCode."Drop Shipment";

"Special Order" := PurchasingCode."Special Order";

IF "Drop Shipment" OR "Special Order" THEN BEGIN

Reserve := Reserve::Never;

VALIDATE(Quantity,Quantity);

END;

END ELSE

"Drop Shipment" := FALSE;

-----end orig---}

//PurchMgr

//TESTFIELD(Type,Type::Item); ...removed here, see later

IF ("Purch. Order Line No." <> 0) OR

("Special Order Purch. Line No." <> 0)

THEN

ERROR(

Text002,

FIELDCAPTION(Type),"Purchase Order No.");

IF ("Purchasing Code" <> '') AND (“Quantity Shipped” <> 0) THEN

ERROR(Text045);

IF PurchasingCode.GET("Purchasing Code") THEN BEGIN

"Drop Shipment" := PurchasingCode."Drop Shipment";

"Special Order" := PurchasingCode."Special Order";

IF ("Drop Shipment" = TRUE) OR ("Special Order" = TRUE) THEN BEGIN

TESTFIELD(Type,Type::Item); //PurchReso

Reserve := Reserve::Never;

VALIDATE(Quantity,Quantity);

//PurchReso

IF Item.GET("No.") THEN

"Vendor No." := Item."Vendor No.";

//end PM

END;

//PurchMgr

IF "Drop Shipment" and ("Job No." <> '') THEN

ERROR(Text036);

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 44

"Direct Purchase" := PurchasingCode."Direct Purchase"; //PurchMgr

IF "Direct Purchase" = TRUE THEN BEGIN //PurchMgr

TESTFIELD(Type,Type::Resource);

IF ResourceT.GET("No.") THEN

IF ResourceT."Vendor No." = '' THEN

ERROR(Text044)

ELSE

"Vendor No." := ResourceT."Vendor No."

ELSE

ERROR(Text032);

Reserve := Reserve::Never;

VALIDATE(Quantity,Quantity);

END;

END ELSE BEGIN

"Drop Shipment" := FALSE;

"Direct Purchase" := FALSE; //PurchMgr

"Special Order” := FALSE;

"Vendor No." := „‟;

END;

"Ship-to Option" := PurchasingCode."Default Ship-to Option"; //Default to start, can

change

//end PurchMgr

7—Add the following code to the Job No. field OnValidate trigger.

CreateDim(

DATABASE::Job,"Job No.",

DimMgt.TypeToTableID3(Type),"No.",

DATABASE::"Responsibility Center","Responsibility Center");

//PurchMgr

IF "Job No." <> xRec."Job No." THEN BEGIN

IF "Quantity Shipped" <> 0 THEN

ERROR(Text037);

IF "Purch. Order Line No." <> 0 THEN BEGIN

PurchLine.SETRANGE("Document Type","Document Type"::Order);

PurchLine.SETRANGE("Document No.","Purchase Order No.");

PurchLine.SETRANGE("Line No.","Purch. Order Line No.");

IF PurchLine.FIND('-') THEN BEGIN

IF (PurchLine."Job No." <> "Job No.") AND (PurchLine."Quantity Received"

<> 0) THEN

ERROR(Text038);

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 45

IF PurchLine."Quantity Received" = 0 THEN

IF NOT CONFIRM(Text039,FALSE,"Purchase Order No.") THEN

ERROR(Text040)

ELSE BEGIN

PurchLine."Job No." := "Job No.";

PurchLine.MODIFY;

END;

END;

END;

IF "Special Order Purch. Line No." <> 0 THEN BEGIN

PurchLine.RESET;

PurchLine.SETRANGE("Document Type","Document Type"::Order);

PurchLine.SETRANGE("Document No.","Special Order Purchase No.");

PurchLine.SETRANGE("Line No.","Special Order Purch. Line No.");

IF PurchLine.FIND('-') THEN BEGIN

IF (PurchLine."Job No." <> "Job No.") AND (PurchLine."Quantity Received"

<> 0) THEN

ERROR(Text038);

IF PurchLine."Quantity Received" = 0 THEN

IF NOT CONFIRM(Text039,FALSE,"Special Order Purchase No.") THEN

ERROR(Text040)

ELSE BEGIN

PurchLine."Job No." := "Job No.";

PurchLine.MODIFY;

END;

END;

END;

IF "Job No." = '' THEN

"Job Applies-to ID" := '';

END;

VALIDATE(Quantity,xRec.Quantity);

//end PurchMgr

8—Add the following code to the OnInsert() trigger of the table at the end of all the

existing code:

{nothing}

9—Add the following code to the end of existing code in the OnValidate trigger of the

“Unit Price” field:

Name DataType SubType

First add a Local Variable: Currency2 Record Currency

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 46

//PurchMgr ...when edit SO on linked lines... edit the PO too

IF "Unit Price" <> xRec."Unit Price" THEN

IF "Purch. Order Line No." <> 0 THEN BEGIN

PurchLT.SETRANGE("Document Type",PurchLT."Document Type"::Order);

PurchLT.SETRANGE("Document No.","Purchase Order No.");

PurchLT.SETRANGE("Line No.","Purch. Order Line No.");

IF PurchLT.FIND('-') THEN BEGIN

GetSalesHeader;

Currency2.InitRoundingPrecision;

IF SalesHeader."Currency Code" <> '' THEN BEGIN

IF "Outstanding Quantity" <> 0 THEN BEGIN

PurchLT."Unit Price ($)" := "Outstanding Amount ($)" / "Outstanding Quantity";

PurchLT.MODIFY;

END;

END ELSE BEGIN

PurchLT."Unit Price ($)" := "Unit Price";

PurchLT.MODIFY;

END;

END;

END ELSE

IF "Special Order Purch. Line No." <> 0 THEN BEGIN

PurchLT.RESET;

PurchLT.SETRANGE("Document Type",PurchLT."Document Type"::Order);

PurchLT.SETRANGE("Document No.","Special Order Purchase No.");

PurchLT.SETRANGE("Line No.","Special Order Purch. Line No.");

IF PurchLT.FIND('-') THEN BEGIN

GetSalesHeader;

Currency2.InitRoundingPrecision;

IF SalesHeader."Currency Code" <> '' THEN BEGIN

IF "Outstanding Quantity" <> 0 THEN BEGIN

PurchLT."Unit Price ($)" := "Outstanding Amount ($)" / "Outstanding Quantity";

PurchLT.MODIFY;

END;

END ELSE BEGIN

PurchLT."Unit Price ($)" := "Unit Price";

PurchLT.MODIFY;

END

END;

END;

//end PurchMgr

10—Add the following code to the OnValidate trigger of the “Vendor No.” field.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 47

//Purch //JM3

IF "Vendor No." <> '' THEN

IF Vend.GET("Vendor No.") THEN BEGIN

Vend.TESTFIELD(Blocked,FALSE);

VALIDATE("Currency Code",Vend."Currency Code");

END ELSE

IF CurrFieldNo <> 0 THEN

ERROR(Text041,"Vendor No.")

ELSE

"Vendor No." := '';

IF (Type = Type::Item) AND ("No." <> '') THEN BEGIN

GetItem;

GetSalesHeader;

ItemVend."Vendor No." := "Vendor No.";

ItemVend."Starting Date" := SalesHeader."Order Date";

Item.FindItemVend(ItemVend,FALSE,"Location Code","Variant Code");

UnitCost := ItemVend.GetDirectUnitCost(FALSE,'',"Vendor No.");

IF UnitCost <> 0 THEN

IF "Unit Cost ($)" <> UnitCost THEN

IF NOT CONFIRM(Text042,TRUE,UnitCost) THEN

EXIT

ELSE

"Unit Cost ($)" := UnitCost;

ItemPurchQtyDisc.SETRANGE("Item No.","No.");

ItemPurchQtyDisc.SETRANGE("Vendor No.","Vendor No.");

ItemPurchQtyDisc.SETRANGE("Minimum Quantity",0,ABS("Quantity (Base)"));

IF ItemPurchQtyDisc.FIND('+') THEN BEGIN

QtyDiscPercent := ItemPurchQtyDisc."Discount %";

MESSAGE(Text043,QtyDiscPercent,"Vendor No.","Quantity (Base)");

END;

END;

11—This completes the changes to the Sales Line table.

The following changes to the History tables are to assist tracking the results of

Direct,Special and Drop ship orders. When POs are linked to the Sales Order we save

the Purchase Order No. to history. The same is true on the Purchase side. We save the

linked Sales Order No. when the Purchase Order is posted as the Vendor Invoice.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 48

We have created two reports. One consecutive by Sales Order No., and another by

Customer then by Sales Order No..

Under each Order No. we print the Sales Invoice Lines posted related to the particular

Sales Order No. , and totaling for posted revenue(Quantity <> 0 lines). We then look for

“still open” sales lines for pending revenue(Outstanding Amount <> 0). Then we look

for all Purch. Inv. Lines that have been posted with that Sales Order No..(posted costs)

(Quantity <> 0) and last we look for any “still open” Purchase Lines with that Sales Order

No..(pending costs) (Outstanding Amount <> 0);

NOTE: We have changed Sales Order No. on the Purchase Line table to be editable.

However we then made it non-editable on the Purchase Order Subform. Then we

allowed entry of Sales Order No. on the Purchase Invoice Subform. This allowed users

to enter a Sales Order No. when entering Purchase Invoices that never had a PO, and were

therefore not automatically linked to a Sales Order No..

We have also added a Sales Order No. field on the Sales Lines. This should only be used

on the Sales Cr. Memo Subform so that if Credits are given against a Sales Order No.

then the entry person can enter the SO No. which will allow the Credit Memo to be

included in the reports.

Another way the Sales Credit Memos can be included is to have them associated with the

Invoices that were related to the Sales Order. The connection would be through the

Applied-to Document Number on the Credit Memo Header.

Table # 111: Sales Shipment line:

1.—Add the following fields:

No. Name DateType

70000 Posting Date Date

Table # 113: Sales Invoice Line

1—Add the following fields

Field No. Field Name Data Type Length Description

60030 Vendor No. Code 20 Table Relat. To Vendor

60031 Direct Purchase Boolean

60032 Ship-to Option Option Location Code,Ship-to Code,Job Site

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 49

60033 Ship-to Code Code 10 Table Relat. To Ship-to Addr

60034 Special Order Boolean

60035 Purchase Order No. Code 20

60036 Sales Order No. Code 20 The original Order No.

70000 Posting Date Date

2—Add the following key:

Key:

Sales Order No.

Table # 115: Sales Cr. Memo Line 1—Add the following fields:

Field No. Field Name Data Type Length Description

60033 Ship-to Code Code 10 Table Relat. To Ship-to Addr

60035 Sales Invoice No. Code 20 Passed in CU80

70000 Posting Date Date

Table # 121: Purch. Receipt line:

1.—Add the following fields:

No. Name DateType

70000 Posting Date Date

Table # 123: Purch. Inv. Line

1—Add the following fields:

Field No. Field Name Data Type Length Description

60031 Work Type Code Code 10

60032 Sales Order No. Code 20 Passed in CU90

60033 Purchase Order No. Code 20 Original PO No.

60034 Ship-to Option Option

OptionString:Location,Ship-to Code,Job Site

70000 Posting Date Date

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 50

2—Add the following key:

Key:

Sales Order No.

Table # 125: Purch. Cr. Memo Line

1—Add the following fields:

Field No. Field Name Data Type Length Description

60031 Work Type Code Code 10

60032 Purchase Voucher No.Code 20 Applied to Doc No. Passed

in CU90

70000 Posting Date Date

Table # 156: Resource

1—Add the additional options to the Type field.

Original: Person,Machine

New : Person,Machine,,,,,,,Service

2—This completes the Resource table.

Associated …Form # 76: Resource Card

1—Design the existing field “Vendor No.” onto the General Tab.

2—Design the Automatic Ext. Text to General Tab.

3—This completes the changes to the Resource Card;

Form # 291: Req. Worksheet 1—Simply Design new fields to the form as needed. I.e. ship-to Code ship-to address.

This would be for viewing purposes only. Both fields are non-editable on the

Requisition Line table therefore we are not allowing you to change these fields at this

point. These fields values are entered on the Sales Lines and transferred when Direct,

Drop Ship, and Special Order Purchases are created.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 51

Add the Job No. to the form. You could add the Job number here although you can‟t

enter or edit the Job No. if the line is associated with a Sales Order No.

Table # 169: Job Ledger Entry

1—Add the following field:

60030 Drop Ship Special Order Boolean Determined when

post PO lines. This field is used during the Physical Inventory Get Physical with WIP.

Table # 210: Job Journal Line

1—Add the following field:

60030 Drop Ship Special Order Boolean Determined when

post PO lines. This field is used during the Physical Inventory Get Physical with WIP.

Table # 246: Requisition Line

1—Add the following new field:

Field No. Field Name DateType Length

60031 Work Type Code Code 10

60032 Unit Price ($) Decimal

60033 Job No. Code 20

with table relationship of Job.

Add the following code to the OnValidate trigger of Job No.:

//PurchMgr

IF ("Job No." <> xRec."Job No.") AND ("Sales Order No." <> '') THEN

ERROR(Text028);

Add Text028 : You cannot edit the "Job No." when the line comes from a Sales Order.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 52

60034 Ship-to Option Option

Non-Editable

OptionString:Location Code,Ship-to Code,Job Site

60106 Lead Time Date Formula

2—Add Ship-to Option field to the end of the following key:

Worksheet Template Name,Journal Batch Name,Vendor No.,Sell-to Customer No.,Ship-

to Code,Order Address Code,Currency Code,Ship-to Option

2—Add the following Global Variable

Name DateType Subtype

ResourceT Record Resource

3—Add Resource as a Type Option in Table # 246: Requisition Line too.

This change was mentioned once before while making the same change on the

Purchase Line table.

BEFORE:

Option String : ,Account (G/L),Item

Option Caption: ,Account (G/L),Item

AFTER:

Option String : ,Account (G/L),Item,Resource

Option Caption: ,Account (G/L),Item,Resource

4—Add the Resource Condition to the Table Relationship property on the “No.” field:

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 53

5—Add the following code (BOLD) to the OnValidate trigger of the field No. :

Type::Item:

BEGIN

GetItem;

Item.TESTFIELD(Blocked,FALSE);

Description := Item.Description;

"Description 2" := Item."Description 2";

"Low-Level Code" := Item."Low-Level Code";

"Scrap %" := Item."Scrap %";

"Gen. Prod. Posting Group" := Item."Gen. Prod. Posting Group";

"Gen. Business Posting Group" := '';

Item.TESTFIELD("Base Unit of Measure");

"Unit of Measure Code" := Item."Base Unit of Measure";

"Indirect Cost %" := Item."Indirect Cost %";

GetPlanningParameters.AtSKU(SKU,"No.","Variant Code","Location Code");

VALIDATE("Requisition System",SKU."Requisition System");

"Accept Action Message" := TRUE;

END;

//PurchReso

Type::Resource:

BEGIN

ResourceT.GET("No.");

ResourceT.TESTFIELD(Blocked,FALSE);

Description := ResourceT.Name;

"Description 2" := ResourceT."Name 2";

"Gen. Prod. Posting Group" := ResourceT."Gen. Prod. Posting Group";

"Gen. Business Posting Group" := '';

ResourceT.TESTFIELD("Unit of Measure Code");

"Unit of Measure Code" := ResourceT."Unit of Measure Code";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 54

"Indirect Cost %" := ResourceT."Indirect Cost %";

"Accept Action Message" := TRUE;

END;

//end PurchReso

END; //end of CASE

6—This is the entire code under the OnValidate trigger of the field “Unit Cost” :

//PurchReso

//TESTFIELD(Type,Type::Item);

TESTFIELD("No.");

CASE Type OF

Type::Item : BEGIN

Item.GET("No.");

IF Item."Costing Method" = Item."Costing Method"::Standard THEN BEGIN

IF CurrFieldNo = FIELDNO("Unit Cost") THEN

ERROR(

Text006,

FIELDCAPTION("Unit Cost"),Item.FIELDCAPTION("Costing

Method"),Item."Costing Method")

ELSE

"Unit Cost" := Item."Unit Cost" * "Qty. per Unit of Measure";

END;

END; //end Item

END: //end CASE

"Cost Amount" := ROUND("Unit Cost" * Quantity);

7—This completes the changes to the Requisition Line table.

Table #279: Extended Text Header

1—Remove from ALL code area any reference to stop extended text because of

Resources.

OnInsert

//PurchReso

{--Now can Direct Purchasing--

IF "Table Name" = "Table Name"::Resource THEN BEGIN

"Purchase Quote" := FALSE;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 55

"Purchase Invoice" := FALSE;

"Purchase Blanket Order" := FALSE;

"Purchase Order" := FALSE;

"Purchase Credit Memo" := FALSE;

END;

-----}

There is a Local Function called NoResourcePurch. Comment out each reference to

calling that function. For example:

“Purchase Quote” field, OnValidate trigger:

BEFORE: AFTER:

IF “Purchase Quote” THEN //PurchReso

NoResourcePurch; {-- removing code

IF “Purchase Quote” THEN

NoResourcePurch:

----end removing code--}

2—This completes the changes to the Extended Text Header table.

Table # 5721: Purchasing

1—Add the following new field:

Field No. Field Name DateType Length

60030 Direct Purchase Boolean

60031 Default Ship-to Option Option

OptionString:Location,Ship-to Code,Job Site

(used on Sales Lines when Purchasing code is entered)

2—Design the Associated Form # 5727: Purchasing Code Entry

and Form # 5729: Purchasing Codes

Design the new field “Direct Purchase” onto the form.

3—This completes the changes to the Purchasing table.

Form # 46: Sales Order Subform

1—Add the following fields to the form:

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 56

Ship-to Option Visible(No)

Ship-to Code Visible(No)

2—This completes the Sales Order Subform.

Form # 42: Sales Order

1—Design Form, Add the following choices to the Function Button:

Visible Caption ShortCutKey Action RunObject

Yes ------------------- “Separator”

Yes Purchasing

Yes Drop Shipment (+indent)

Yes Purchase &Order (+indent)

Yes Special Order (+indent)

Yes Purchase &Order (+indent)

Yes Direct &Resource Purchase (indent)

Yes Purchase &Order

Yes Create Direct Lines only – PO(s)

Yes Create this Sales Order's PO(s)

Yes -------------------------“Separator”

2—Add the following Code in the OnPush of the Direct &Re… Purchase &Order menu:

//PurchReso

CurrForm.SalesLines.FORM.OpenPurchOrderForm;

3—Add the following global variable:

Name DataType SubType

PurchResoCU Codeunit Direct Purchasing

SalesLineT Record Sales Line

4—Add the following Code in the OnPush of the Direct &Re… Create PO

//PurchReso

PurchResoCU.CreateDirectPO(Rec);

5—Add the following Code in the OnPush of the Create this Sales Order‟s POs menu

choice:

//PurchMgr

PurchResoCU.CreateDirectandSpecialPO(Rec);

6—This completes the changes to the Sales Order Form.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 57

Form # 54: Purchase Order Subform

1—Design the form, click on the No. field Text box and change the code

OnAfterValidate trigger as follows.

InsertExtendedText(FALSE);

//PurchReso

{--orig code--

IF (Type = Type::"Charge (Item)") AND ("No." <> xRec."No.") AND

(xRec."No." <> '')

THEN

CurrForm.SAVERECORD;--------}

//PurchReso inserted

IF ("No." <> xRec."No.") AND

(xRec."No." <> '')

THEN

CurrForm.SAVERECORD;

2—Make the “Sales Order No.” field Visible = No Editable = NO.

3—This completes the changes to Form 54.

Form # 55: Purch. Invoice Subform

1—Add the “Sales Order No.” to the form. Make is Visible = NO. Editable = YES.

Form # 334: Purchases & Payable Menu

1—Add the Purchase Resource Setup menu line in the Purchases & Payable Setup.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 58

2—This completes the changes to Form 334.

Form 5727: Purchasing Code Entry and Form 5729: Purchasing Codes

1—Add the new field Direct Purchase to the form.

2—This completes the change to Forms 5727 and 5729.

Report # 493 Carry Out Action Msg. - Req.: 1. A Codeunit in Globals has been redirected to Req. Wksh.-Make Order_JM(14005006) 2. This completes Report #493.

Codeunit # 63— Sales-Explode BOM:

1—Add the following (BOLD) code to the OnRun trigger:

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 59

IF "BOM Item No." = '' THEN

BOMItemNo := "No."

ELSE

BOMItemNo := "BOM Item No.";

ToSalesLine := Rec;

ToSalesLine.INIT;

ToSalesLine.Description := Description;

ToSalesLine."Description 2" := "Description 2";

ToSalesLine."BOM Item No." := BOMItemNo;

//PurchMgr

ToSalesLine."Job No." := "Job No.";

//end

ToSalesLine.MODIFY;

FromDocDim.SETRANGE("Table ID",DATABASE::"Sales Line");

FromDocDim.SETRANGE("Document Type","Document Type");

FromDocDim.SETRANGE("Document No.","Document No.");

FromDocDim.SETRANGE("Line No.","Line No.");

ToDocDim.SETRANGE("Table ID",DATABASE::"Sales Line");

ToDocDim.SETRANGE("Document Type","Document Type");

ToDocDim.SETRANGE("Document No.","Document No.");

DimMgt.CopyDocDimToDocDim(FromDocDim,TempDocDim);

CLEAR(TempDocDim);

FromDocDim.DELETEALL;

FromBOMComp.RESET;

FromBOMComp.SETRANGE("Parent Item No.","No.");

FromBOMComp.FIND('-');

NextLineNo := "Line No.";

REPEAT

ToSalesLine.INIT;

NextLineNo := NextLineNo + LineSpacing;

ToSalesLine."Line No." := NextLineNo;

CASE FromBOMComp.Type OF

FromBOMComp.Type::" ":

ToSalesLine.Type := ToSalesLine.Type::" ";

FromBOMComp.Type::Item:

ToSalesLine.Type := ToSalesLine.Type::Item;

FromBOMComp.Type::Resource:

ToSalesLine.Type := ToSalesLine.Type::Resource;

END;

IF ToSalesLine.Type <> 0 THEN BEGIN

ToSalesLine.VALIDATE("No.",FromBOMComp."No.");

ToSalesLine.VALIDATE("Variant Code",FromBOMComp."Variant Code");

IF ToSalesLine.Type = ToSalesLine.Type::Item THEN BEGIN

ToSalesLine."Drop Shipment" := "Drop Shipment";

Item.GET(FromBOMComp."No.");

ToSalesLine.VALIDATE(Quantity,

ROUND(

"Quantity (Base)" * FromBOMComp."Quantity per" *

UOMMgt.GetQtyPerUnitOfMeasure(Item,FromBOMComp."Unit of Measure Code") /

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 60

ToSalesLine."Qty. per Unit of Measure",

0.00001));

END ELSE

ToSalesLine.VALIDATE(Quantity,ROUND("Quantity (Base)" * FromBOMComp."Quantity

per",0.00001));

{-DP5 Removed BOM Component Table

//PurchMgr

IF FromBOMComp."Remove Price on Explode" THEN

ToSalesLine.VALIDATE("Unit Price",0);

ToSalesLine."Job No." := "Job No.";

//end PM

-}

END;

IF SalesHeader."Language Code" = '' THEN

ToSalesLine.Description := FromBOMComp.Description

ELSE

IF NOT ItemTranslation.GET(FromBOMComp."No.",FromBOMComp."Variant

Code",SalesHeader."Language Code") THEN

ToSalesLine.Description := FromBOMComp.Description;

ToSalesLine."BOM Item No." := BOMItemNo;

ToSalesLine.INSERT;

IF Selection = 1 THEN BEGIN

ToSalesLine."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

ToSalesLine."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

ToSalesLine.MODIFY;

ToDocDim.SETRANGE("Line No.",ToSalesLine."Line No.");

ToDocDim.DELETEALL;

IF TempDocDim.FIND('-') THEN BEGIN

REPEAT

ToDocDim.INIT;

ToDocDim."Table ID" := DATABASE::"Sales Line";

ToDocDim."Document Type" := ToSalesLine."Document Type";

ToDocDim."Document No." := ToSalesLine."Document No.";

ToDocDim."Line No." := ToSalesLine."Line No.";

ToDocDim."Dimension Code" := TempDocDim."Dimension Code";

ToDocDim."Dimension Value Code" := TempDocDim."Dimension Value Code";

ToDocDim.INSERT;

UNTIL TempDocDim.NEXT = 0;

END;

END;

UNTIL FromBOMComp.NEXT = 0;

2—This completes Codeunit 63.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 61

Codeunit # 80: Sales-Post

1—Add the following global variable:

Name DataType SubType

SONoHistT Record Sales Order No. History

2—Add the following code (BOLD) to this codeunit:

SECTION 1:

SalesLine.RESET;

SalesLine.SETRANGE("Document Type","Document Type");

SalesLine.SETRANGE("Document No.","No.");

//PurchMgr

SalesLine.SETRANGE(Type,SalesLine.Type::Item);

//PM

SalesLine.SETFILTER("Purch. Order Line No.",'<>0');

IF SalesLine.FIND('-') THEN BEGIN

DropShipOrder := TRUE;

IF Ship THEN

REPEAT

SECTION 2:

SalesInvHeader."Source Code" := SrcCode;

SalesInvHeader."User ID" := USERID;

SalesInvHeader."No. Printed" := 0;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT SONoHistT.GET("No.") THEN BEGIN

SONoHistT.INIT;

SONoHistT."Sales Order No." := "No.";

SONoHistT."Date Created" := "Order Date";

SONoHistT."User ID Creator" := USERID;

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 62

SONoHistT."Job No." := "Job No.";

SONoHistT."Responsibility Center" := "Responsibility Center";

SONoHistT."Last Date Posted" := "Posting Date";

SONoHistT."Last Invoice No." := SalesInvHeader."No.";

SONoHistT."Last User ID when Posted" := USERID;

SONoHistT.INSERT;

END ELSE BEGIN //found

SONoHistT."Sell-to Customer No." := "Sell-to Customer No.";

SONoHistT."Bill-to Customer No." := "Bill-to Customer No.";

SONoHistT."Customer PO No." := "Your Reference";

SONoHistT."Location Code" := "Location Code";

SONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

SONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

SONoHistT."Salesperson Code" := "Salesperson Code";;

SONoHistT."Order Class" := "Order Class";

SONoHistT."Job No." := "Job No.";

SONoHistT."Responsibility Center" := "Responsibility Center";

SONoHistT."Last Date Posted" := "Posting Date";

SONoHistT."Last Invoice No." := SalesInvHeader."No.";

SONoHistT."Last User ID when Posted" := USERID;

SONoHistT.MODIFY;

END;

//end PM

SalesInvHeader.INSERT;

IF ServDocType = DATABASE::"Service Header" THEN BEGIN

CLEAR(ServLogMgt);

SECTION 3:

IF (SalesLine.Type >= SalesLine.Type::"Account (G/L)") AND (SalesLine."Qty. to

Invoice" <> 0) THEN BEGIN

// Copy sales to buffer

FillInvPostingBuffer(SalesLine,SalesLineACY);

TempDocDim.SETRANGE("Table ID");

TempDocDim.SETRANGE("Line No.");

END;

//PurchMgr

{--test not needed--

IF NOT ("Document Type" IN ["Document Type"::Invoice,"Document

Type"::"Credit Memo"]) THEN

SalesLine.TESTFIELD("Job No.",'');-------}

IF (SalesLine."Job No." <> '') AND (SalesLine."Qty. to Invoice" <> 0) THEN BEGIN

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 63

// Post job entry

SECTION 4:

IF Invoice THEN BEGIN

// Insert invoice line or credit memo line

IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice]

THEN BEGIN

SalesInvLine.INIT;

SalesInvLine.TRANSFERFIELDS(TempSalesLine);

SalesInvLine."Document No." := SalesInvHeader."No.";

SalesInvLine.Quantity := TempSalesLine."Qty. to Invoice";

SalesInvLine."Quantity (Base)" := TempSalesLine."Qty. to Invoice (Base)";

//PurchMgr

SalesInvLine."Special Order" := TempSalesLine."Special Order";

SalesInvLine."Purchase Order No." := TempSalesLine."Purchase Order

No.";

SalesInvLine."Sales Order No." := "No.";

IF SalesInvLine."Ship-to Code" = '' THEN

SalesInvLine."Ship-to Code" := SalesInvHeader."Ship-to Code";

//end PM

SalesInvLine.INSERT;

DimMgt.MoveOneDocDimToPostedDocDim(

DocDim,DATABASE::"Sales Line","Document Type","No.",SalesInvLine."Line

No.",

DATABASE::"Sales Invoice Line",SalesInvHeader."No.");

ItemTrkgMgtSalesLine.CreateSalesInvoiceLine(TempSalesLine,SalesInvHeader."No.");

END ELSE BEGIN // Credit Memo

SalesCrMemoLine.INIT;

SalesCrMemoLine.TRANSFERFIELDS(TempSalesLine);

SalesCrMemoLine."Document No." := SalesCrMemoHeader."No.";

SalesCrMemoLine.Quantity := TempSalesLine."Qty. to Invoice";

SalesCrMemoLine."Quantity (Base)" := TempSalesLine."Qty. to Invoice (Base)";

//PurchMgr

IF "Applies-to Doc. Type" = "Applies-to Doc. Type"::Invoice THEN

SalesCrMemoLine."Sales Invoice No." := "Applies-to Doc. No.";

IF SalesCrMemoLine."Ship-to Code" = '' THEN

SalesCrMemoLine."Ship-to Code" := SalesCrMemoHeader."Ship-to Code";

//PM

SalesCrMemoLine.INSERT;

DimMgt.MoveOneDocDimToPostedDocDim(

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 64

DocDim,DATABASE::"Sales Line","Document

Type","No.",SalesCrMemoLine."Line No.",

DATABASE::"Sales Cr.Memo Line",SalesCrMemoHeader."No.");

SECTION 5:

UpdateBlanketOrderLine(SalesLine,Ship,Invoice);

SalesLine.InitOutstanding;

IF "Document Type" = "Document Type"::"Return Order" THEN

SalesLine.InitQtyToReceive

ELSE

SalesLine.InitQtyToShip;

//PurchMgr

{--IF (SalesLine."Purch. Order Line No." <> 0) AND-----}

IF (SalesLine.Type = SalesLine.Type::Item) AND (SalesLine."Purch. Order

Line No." <> 0) AND

(SalesLine.Quantity = SalesLine."Quantity Invoiced")

THEN

UpdateAssocLines(SalesLine);

SalesLine.MODIFY;

END;

UNTIL SalesLine.NEXT = 0;

SECTION 6:

END;

ELSE

BEGIN

UpdateAssocOrder;

SalesLine.SETFILTER("Purch. Order Line No.",'<>0');

//PurchMgr

SalesLine.SETRANGE(Type,SalesLine.Type::Item);

//PM

IF SalesLine.FIND('-') THEN

REPEAT

UpdateAssocLines(SalesLine);

UNTIL SalesLine.NEXT = 0;

SalesLine.SETRANGE("Purch. Order Line No.");

//PurchMgr

SalesLine.SETRANGE(Type); //this takes the filter away

//end PM

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 65

END;

END;

SECTION 7:

DocDim.RESET;

DocDim.SETRANGE("Table ID",DATABASE::"Sales Header");

DocDim.SETRANGE("Document Type","Document Type");

DocDim.SETRANGE("Document No.","No.");

DocDim.DELETEALL;

DocDim.SETRANGE("Table ID",DATABASE::"Sales Line");

DocDim.DELETEALL;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF SONoHistT.GET("No.") THEN BEGIN

SONoHistT."Date Deleted" := “Posting Date”;

SONoHistT."User ID on Delete" := USERID;

SONoHistT."Deleted on Post" := TRUE;

END;

//end PM

DELETE;

SalesLine.DELETEALL;

DeleteItemChargeAssgnt;

SECTION 7:

Edit the local function called UpdateAssocLines(VAR SalesOrderLine… as follows:

PurchOrderLine.GET(

PurchOrderLine."Document Type"::Order,

SalesOrderLine."Purchase Order No.",SalesOrderLine."Purch. Order Line No.");

//PurchMgr

//PurchOrderLine."Sales Order No." := '';

PurchOrderLine."Sales Order Line No." := 0;

PurchOrderLine.MODIFY;

//PurchMgr

//SalesOrderLine."Purchase Order No." := '';

SalesOrderLine."Purch. Order Line No." := 0;

2—This completes Codeunit 80.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 66

Codeunit # 90: Purch.-Post

1—Add the following Global variables:

Name DataType Subtype Length

ResJnlLine Record Res. Journal Line

ResJnlPostLine Codeunit Res. Jnl.-Post Line

ResoJnlLine Record Res. Journal Line

PONoHistT Record Purchase Order No. History

2—Add the following Global Function with the associated code:

PostAssocResoJnlLine

Parameters:

QtyToBeShipped Decimal

QtyToBeShippedBase Decimal

Variables:

TempDocDim2 Record Document Dimension

TempJnlLineDim Record Journal Line Dimension

CODE:

//PurchReso

SalesOrderHeader.GET(

SalesOrderHeader."Document Type"::Order,

PurchLine."Sales Order No.");

SalesOrderLine.GET(

SalesOrderLine."Document Type"::Order,

PurchLine."Sales Order No.",PurchLine."Sales Order Line No.");

ResoJnlLine.INIT;

ResoJnlLine."Reason Code" := SalesOrderHeader."Reason Code";

ResoJnlLine."Posting No. Series" := SalesOrderHeader."Posting No. Series";

ResoJnlLine."Resource No." := SalesOrderLine."No.";

ResoJnlLine.Description := SalesOrderLine.Description;

ResoJnlLine."Shortcut Dimension 1 Code" := SalesOrderLine."Shortcut Dimension 1

Code";

ResoJnlLine."Shortcut Dimension 2 Code" := SalesOrderLine."Shortcut Dimension 2

Code";

ResoJnlLine."Gen. Bus. Posting Group" := SalesOrderLine."Gen. Bus. Posting Group";

ResoJnlLine."Gen. Prod. Posting Group" := SalesOrderLine."Gen. Prod. Posting Group";

//ResoJnlLine."Drop Shipment" := SalesOrderLine."Drop Shipment";

ResoJnlLine."Posting Date" := PurchHeader."Posting Date";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 67

ResoJnlLine."Document Date" := PurchHeader."Document Date";

ResoJnlLine."Entry Type" := ResoJnlLine."Entry Type"::Sale;

ResoJnlLine."Document No." := SalesOrderHeader."Shipping No.";

ResoJnlLine.Quantity := QtyToBeShipped;

ResoJnlLine."Unit Cost" := SalesOrderLine."Unit Cost ($)";

ResoJnlLine."Source Code" := SrcCode;

ResoJnlLine."Unit of Measure Code" := SalesOrderLine."Unit of Measure Code";

IF (SalesOrderLine."Appl.-to Job Entry" = 0) AND (SalesOrderLine."Job Applies-to ID"

= '') THEN BEGIN

DocDim.RESET;

DocDim.SETRANGE("Table ID",DATABASE::"Sales Line");

DocDim.SETRANGE("Document Type",SalesOrderLine."Document Type");

DocDim.SETRANGE("Document No.",SalesOrderLine."Document No.");

DocDim.SETRANGE("Line No.",SalesOrderLine."Line No.");

IF DocDim.FIND('-') THEN

REPEAT

TempDocDim2.INIT;

TempDocDim2 := DocDim;

TempDocDim2.INSERT;

UNTIL DocDim.NEXT = 0;

TempJnlLineDim.DELETEALL;

DimMgt.CopyDocDimToJnlLineDim(TempDocDim2,TempJnlLineDim);

ResJnlPostLine.RunWithCheck(ResoJnlLine,TempJnlLineDim);

END;

EXIT(ResoJnlLine."Line No."); //

3—Also add the following (BOLD) code:

IF Invoice THEN BEGIN

PurchLine.RESET;

PurchLine.SETRANGE("Document Type","Document Type");

PurchLine.SETRANGE("Document No.","No.");

//PurchMgr

PurchLine.SETRANGE(Type,PurchLine.Type::Item); //only items

(drop ship)

//PM

PurchLine.SETFILTER("Sales Order Line No.",'<>0');

IF PurchLine.FIND('-') THEN

REPEAT

4—Also add the following code (BOLD);

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 68

PurchLine.RESET;

PurchLine.SETRANGE("Document Type","Document Type");

PurchLine.SETRANGE("Document No.","No.");

//PurchMgr

PurchLine.SETRANGE(Type,PurchLine.Type::Item);

//end PM

PurchLine.SETFILTER("Sales Order Line No.",'<>0');

IF PurchLine.FIND('-') THEN BEGIN

DropShipOrder := TRUE;

IF Receive THEN

REPEAT

5—Also add the following code(BOLD):

END;

PurchInvHeader."Source Code" := SrcCode;

PurchInvHeader."User ID" := USERID;

PurchInvHeader."No. Printed" := 0;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF NOT PONoHistT.GET("No.") THEN BEGIN

PONoHistT.INIT;

PONoHistT."Purchase Order No." := "No.";

PONoHistT."Date Created" := "Order Date";

PONoHistT."User ID Creator" := USERID;

PONoHistT."Buy-From Vendor No." := "Buy-from Vendor No.";

PONoHistT."Pay-to Vendor No." := "Pay-to Vendor No.";

PONoHistT."Location Code" := "Location Code";

PONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

PONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PONoHistT."Purchaser Code" := "Purchaser Code";;

PONoHistT."Order Class" := "Order Class";

PONoHistT."Job No." := "Job No.";

PONoHistT."Responsibility Center" := "Responsibility Center";

PONoHistT."Last Date Posted" := "Posting Date";

PONoHistT."Last Voucher No." := PurchInvHeader."No.";

PONoHistT."Last Vendor Invoice No." := "Vendor Invoice No.";

PONoHistT."Last User ID when Posted" := USERID;

PONoHistT.INSERT;

END ELSE BEGIN //found

PONoHistT."Buy-From Vendor No." := "Buy-from Vendor No.";

PONoHistT."Pay-to Vendor No." := "Pay-to Vendor No.";

PONoHistT."Location Code" := "Location Code";

PONoHistT."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 69

PONoHistT."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PONoHistT."Purchaser Code" := "Purchaser Code";;

PONoHistT."Order Class" := "Order Class";

PONoHistT."Job No." := "Job No.";

PONoHistT."Responsibility Center" := "Responsibility Center";

PONoHistT."Last Date Posted" := "Posting Date";

PONoHistT."Last Voucher No." := PurchInvHeader."No.";

PONoHistT."Last Vendor Invoice No." := "Vendor Invoice No.";

PONoHistT."Last User ID when Posted" := USERID;

PONoHistT.MODIFY;

END;

//end PM

PurchInvHeader.INSERT;

DimMgt.MoveOneDocDimToPostedDocDim(

6—Add the following code (BOLD);

END ELSE BEGIN

IF ABS(PurchLine."Qty. to Receive") > ABS(RemQtyToBeInvoiced) THEN

ItemLedgShptEntryNo :=

PostItemJnlLine(

PurchLine,

PurchLine."Qty. to Receive" - RemQtyToBeInvoiced,

PurchLine."Qty. to Receive (Base)" - RemQtyToBeInvoicedBase,

0,0,0,'');

//PurchMgr original code replaced with additional AND

{----

IF (PurchLine."Qty. to Receive" <> 0) AND

(PurchLine."Sales Order Line No." <> 0)-----------}

IF (PurchLine."Qty. to Receive" <> 0) AND

(PurchLine.Type = PurchLine.Type::Item) AND

(PurchLine."Sales Order Line No." <> 0) //end PM

THEN BEGIN

DropShptPostBuffer."Order No." := PurchLine."Sales Order No.";

DropShptPostBuffer."Order Line No." := PurchLine."Sales Order Line No.";

DropShptPostBuffer.Quantity := PurchLine."Qty. to Receive";

DropShptPostBuffer."Quantity (Base)" := PurchLine."Qty. to Receive (Base)";

DropShptPostBuffer."Item Shpt. Entry No." :=

PostAssocItemJnlLine(DropShptPostBuffer.Quantity,DropShptPostBuffer."Quantity

(Base)");

DropShptPostBuffer.INSERT;

END;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 70

END;

END;

//PurchReso orig. code removed

//3: ERROR(Text015); //Resource

PurchLine.Type::Resource:

7—Also add the following code:

BEFORE:

3: ERROR(Text015); //Resource

AFTER:

//PurchReso orig. code removed

//3: ERROR(Text015); //Resource

PurchLine.Type::Resource:

IF PurchLine."Qty. to Invoice" <> 0 THEN BEGIN

ResJnlLine.INIT;

ResJnlLine."Posting Date" := "Posting Date";

ResJnlLine."Document Date" := "Document Date";

ResJnlLine."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

ResJnlLine."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

ResJnlLine."Reason Code" := "Reason Code";

ResJnlLine."Resource No." := PurchLine."No.";

ResJnlLine.Description := PurchLine.Description;

ResJnlLine."Work Type Code" := PurchLine."Work Type Code";

ResJnlLine."Job No." := PurchLine."Job No.";

ResJnlLine."Unit of Measure Code" := PurchLine."Unit of Measure";

ResJnlLine."Gen. Bus. Posting Group" := PurchLine."Gen. Bus. Posting Group";

ResJnlLine."Gen. Prod. Posting Group" := PurchLine."Gen. Prod. Posting

Group";

ResJnlLine."Entry Type" := ResJnlLine."Entry Type"::Usage;

ResJnlLine."Document No." := GenJnlLineDocNo;

ResJnlLine."External Document No." := GenJnlLineExtDocNo;

ResJnlLine.Quantity := PurchLine."Qty. to Invoice";

ResJnlLine."Direct Unit Cost" := PurchLine."Direct Unit Cost";

ResJnlLine."Unit Cost" := PurchLine."Unit Cost ($)";

ResJnlLine."Unit Price ($)" := PurchLine."Unit Price ($)";

ResJnlLine."Total Cost" := ROUND(PurchLine."Unit Cost ($)" *

ResJnlLine.Quantity);

ResJnlLine."Total Price" := ROUND(PurchLine."Unit Price ($)" *

ResJnlLine.Quantity);

ResJnlLine."Source Code" := SrcCode;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 71

ResJnlLine.Chargeable := TRUE;

ResJnlPostLine.RUN(ResJnlLine);

END;

//end PurchReso

PurchLine.Type::"Charge (Item)":

8—Also add the following code:

IF (PurchLine."Job No." <> '') AND (PurchLine."Qty. to Invoice" <> 0) THEN

BEGIN

// Post job entries

JobJnlLine.INIT;

JobJnlLine."Posting Date" := "Posting Date";

JobJnlLine."Document Date" := "Document Date";

JobJnlLine."Location Code" := "Location Code";

JobJnlLine."Country Code" := "VAT Country Code";

JobJnlLine."Reason Code" := "Reason Code";

JobJnlLine."Job No." := PurchLine."Job No.";

//PurchMgr

JobJnlLine."Drop Ship Special Order" := FALSE; //Default

IF (PurchLine."Special Order") AND (PurchLine."Ship-to Option" <>

PurchLine."Ship-to Option"::Location) THEN

JobJnlLine."Drop Ship Special Order" := TRUE;

//PurchMgr

JobJnlLine."No." := PurchLine."No.";

JobJnlLine.Description := PurchLine.Description;

JobJnlLine."Unit of Measure Code" := PurchLine."Unit of Measure Code";

9—Also add the following code:

IF Invoice THEN BEGIN

// Insert invoice line or credit memo line

IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice]

THEN BEGIN

PurchInvLine.INIT;

PurchInvLine.TRANSFERFIELDS(TempPurchLine);

PurchInvLine."Document No." := PurchInvHeader."No.";

PurchInvLine.Quantity := TempPurchLine."Qty. to Invoice";

PurchInvLine."Quantity (Base)" := TempPurchLine."Qty. to Invoice (Base)";

//PurchMgr

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 72

PurchInvLine."Purchase Order No." := "No.";

PurchInvLine."Sales Order No." := TempPurchLine."Sales Order No.";

//end PM

PurchInvLine.INSERT;

DimMgt.MoveOneDocDimToPostedDocDim(

DocDim,DATABASE::"Purchase Line","Document

Type","No.",PurchInvLine."Line No.",

DATABASE::"Purch. Inv. Line",PurchInvHeader."No.");

ItemTrkgMgtPurchLine.CreatePurchInvoiceLine(TempPurchLine,PurchInvHeader."No.")

;

END ELSE BEGIN // Credit Memo

PurchCrMemoLine.INIT;

PurchCrMemoLine.TRANSFERFIELDS(TempPurchLine);

PurchCrMemoLine."Document No." := PurchCrMemoHeader."No.";

PurchCrMemoLine.Quantity := TempPurchLine."Qty. to Invoice";

PurchCrMemoLine."Quantity (Base)" := TempPurchLine."Qty. to Invoice (Base)";

//PurchMgr

IF "Applies-to Doc. Type" = "Applies-to Doc. Type"::Invoice THEN

PurchCrMemoLine."Purchase Voucher No." := "Applies-to Doc. No.";

//end PM

PurchCrMemoLine.INSERT;

DimMgt.MoveOneDocDimToPostedDocDim(

DocDim,DATABASE::"Purchase Line","Document

Type","No.",PurchCrMemoLine."Line No.",

DATABASE::"Purch. Cr. Memo Line",PurchCrMemoHeader."No.");

10—Also add the following code:

DocDim.RESET;

DocDim.SETRANGE("Table ID",DATABASE::"Purchase Header");

DocDim.SETRANGE("Document Type","Document Type");

DocDim.SETRANGE("Document No.","No.");

DocDim.DELETEALL;

DocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");

DocDim.DELETEALL;

//PurchMgr

IF "Document Type" = "Document Type"::Order THEN

IF PONoHistT.GET("No.") THEN BEGIN

PONoHistT."Date Deleted" := "Posting Date";

PONoHistT."User ID on Delete" := USERID;

PONoHistT."Deleted on Post" := TRUE;

END;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 73

//end PM

DELETE;

11—This completes CU90.

Codeunit #202: Job Jnl.-Post Line

//PurchMgr

JobLedgEntry."Drop Ship Special Order" := JobJnlLine2."Drop Ship Special Order";

//PM

Codeunit #333: Req. Wksh.-Make Order

NOTES on the Process:

Step One: Get Sales Orders (Processing Report pulls Sales Lines flagged as

Special Order or Drop Shipment into the Req. Journal Line table.

Step Two: Carry Out Action Msg.-Req (Processing Report) preps the Req. lines

and calls the next step.

Step Three: Req. Wksh.-Make Order (Codeunit 333) This is where the Req. lines

are converted into Purchase Orders.

Direct Ship of Resources pushes the Resource Sales Lines to the Req. Journal and then

onto creating a Purchase Order. An advanced setup option allows you to stop the Direct

Ship Resources in the Req. Journal or to push it onto creating a PO.

1—Add the following code (BOLD) to the Code trigger:

// Create lines

LineCount := 0;

OrderCounter := 0;

OrderLineCounter := 0;

CLEAR(PurchOrderHeader);

//PurchMgr

{--Original--

SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 74

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency

Code");

------}

{--new code--}

SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency

Code","Ship-to Option");

//end PurchMgr ……see adding Ship-to Option to an existing key in ReqLine

IF FIND('-') THEN

REPEAT

CASE "Requisition System" OF

…………..more

"Action Message"::New,"Action Message"::" " :

BEGIN

IF ((PurchOrderHeader."Buy-from Vendor No." <> '') AND

((PurchOrderHeader."Buy-from Vendor No." <> "Vendor No.") OR

(PurchOrderHeader."Currency Code" <> "Currency Code"))) OR

(PurchOrderHeader."Sell-to Customer No." <> "Sell-to Customer No.") OR

(PurchOrderHeader."Ship-to Code" <> "Ship-to Code") OR

(PurchOrderHeader."Order Address Code" <> "Order Address Code") OR

(PurchOrderHeader."Ship-to Option" <> "Ship-to Option")

//PurchMgr

THEN BEGIN

…………..more

IF OrderCounter <> 0 THEN

IF NOT ReqTemplate.Recurring THEN BEGIN

// Not a recurring journal

//PurchMgr

{--Original--

ReqLine2.SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

"Sell-to Customer No.","Ship-to Code","Order Address Code");

-------}

{--new code--}

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 75

ReqLine2.SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency

Code","Ship-to Option");

//end PurchMgr

ReqLine2.COPY(ReqLine);

ReqLine2.SETFILTER("Vendor No.",'<>%1','');

IF ReqLine2.FIND('-') THEN; // Remember the last line

DELETEALL;

TempJnlLineDim.DELETEALL;

2—Add the following code to the InsertPurchOrderLine local function:

WITH ReqLine2 DO BEGIN

IF ("No." = '') OR ("Vendor No." = '') OR (Quantity = 0) THEN

EXIT;

IF (PurchOrderHeader."Buy-from Vendor No." <> "Vendor No.") OR

(PurchOrderHeader."Sell-to Customer No." <> "Sell-to Customer No.") OR

(PurchOrderHeader."Ship-to Code" <> "Ship-to Code") OR

(PurchOrderHeader."Order Address Code" <> "Order Address Code") OR

(PurchOrderHeader."Currency Code" <> "Currency Code") OR

(PurchOrderHeader."Ship-to Option" <> "Ship-to Option") //PurchMgr

//PurchMgr

{OR (PrevPurchCode <> "Purchasing Code")-----remove-causing POs for each

line--removed}

THEN BEGIN

InsertHeader(ReqLine2);

LineCount := 0;

NextLineNo := 0;

PrevPurchCode := "Purchasing Code";

END;

LineCount := LineCount + 1;

Window.UPDATE(4,LineCount);

TESTFIELD("Currency Code",PurchOrderHeader."Currency Code");

PurchOrderLine.INIT;

PurchOrderLine.BlockDynamicTracking(TRUE);

PurchOrderLine."Document Type" := PurchOrderLine."Document Type"::Order;

PurchOrderLine."Buy-from Vendor No." := "Vendor No.";

PurchOrderLine."Document No." := PurchOrderHeader."No.";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 76

NextLineNo := NextLineNo + 10000;

PurchOrderLine."Line No." := NextLineNo;

PurchOrderLine.VALIDATE(Type,Type);

PurchOrderLine.VALIDATE("No.","No.");

PurchOrderLine.VALIDATE("Unit of Measure Code","Unit of Measure Code");

PurchOrderLine."Qty. per Unit of Measure" := "Qty. per Unit of Measure";

PurchOrderLine."Prod. Order No." := "Prod. Order No.";

PurchOrderLine."Prod. Order Line No." := "Prod. Order Line No.";

PurchOrderLine.VALIDATE(Quantity,Quantity);

IF PurchOrderHeader."Prices Including Tax" THEN

PurchOrderLine.VALIDATE("Direct Unit Cost","Direct Unit Cost" * (1 +

PurchOrderLine."Tax %" / 100))

ELSE

PurchOrderLine.VALIDATE("Direct Unit Cost","Direct Unit Cost");

IF "Due Date" <> 0D THEN

PurchOrderLine."Expected Receipt Date" := "Due Date";

PurchOrderLine.VALIDATE("Quantity Disc. %","Quantity Disc. %");

PurchOrderLine."Vendor Item No." := "Vendor Item No.";

PurchOrderLine."Shortcut Dimension 1 Code" := "Shortcut Dimension 1 Code";

PurchOrderLine."Shortcut Dimension 2 Code" := "Shortcut Dimension 2 Code";

PurchOrderLine."Location Code" := "Location Code";

PurchOrderLine.Description := Description;

PurchOrderLine."Description 2" := "Description 2";

IF "Item Tracking No." <> 0 THEN

PurchOrderLine."Item Tracking No." := ItemTrkgMgt.GetItemTrackingNumber;

PurchOrderLine."Sales Order No." := "Sales Order No.";

PurchOrderLine."Sales Order Line No." := "Sales Order Line No.";

PurchOrderLine."Variant Code" := "Variant Code";

PurchOrderLine."Prod. Order No." := "Prod. Order No.";

PurchOrderLine."Bin Code" := "Bin Code";

PurchOrderLine."Item Category Code" := "Item Category Code";

PurchOrderLine.Nonstock := Nonstock;

PurchOrderLine.VALIDATE("Purchasing Code","Purchasing Code");

PurchOrderLine."Product Group Code" := "Product Group Code";

//PurchMgr all added

IF "Unit Price ($)" <> 0 THEN

PurchOrderLine."Unit Price ($)" := "Unit Price ($)";

PurchOrderLine."Job No." := "Job No.";

PurchOrderLine."Work Type Code" := "Work Type Code";

PurchOrderLine.”Ship-to Option” := “Ship-to Option”;

//end PurchMgr

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 77

ReserveReqLine.TransferReqLineToPurchLine(ReqLine2,PurchOrderLine,"Quantity

(Base)",FALSE);

MODIFY;

AddOnIntegrMgt.TransferFromReqLineToPurchLine(PurchOrderLine,ReqLine2);

PurchOrderLine."Drop Shipment" := "Sales Order Line No." <> 0;

IF PurchasingCode.GET("Purchasing Code") THEN

IF PurchasingCode."Special Order" THEN BEGIN

PurchOrderLine."Special Order Sales No." := "Sales Order No.";

PurchOrderLine."Special Order Sales Line No." := "Sales Order Line No.";

PurchOrderLine."Special Order" := TRUE;

PurchOrderLine."Drop Shipment" := FALSE;

//PurchMgr

{--don't take Sales Order No. away here----

PurchOrderLine."Sales Order No." := '';

-------------------------------------------}

PurchOrderLine."Sales Order Line No." := 0;

PurchOrderLine."Special Order" := TRUE;

END;

PurchOrderLine.INSERT;

IF "Item Tracking No." <> 0 THEN

ItemTrkgMgtReqLine.MakeOrderItemTrackingReqLine(

ReqLine2,PurchOrderLine."Document No.",PurchOrderLine."Line No.",

PurchOrderLine."Item Tracking No.");

DocDim.SETRANGE("Table ID",DATABASE::"Purchase Line");

DocDim.SETRANGE("Document Type",PurchOrderLine."Document Type");

DocDim.SETRANGE("Document No.",PurchOrderLine."Document No.");

DocDim.SETRANGE("Line No.",PurchOrderLine."Line No.");

TempJnlLineDim.SETRANGE("Journal Line No.",ReqLine2."Line No.");

IF TempJnlLineDim.FIND('-') THEN BEGIN

REPEAT

IF DocDim.GET(

DATABASE::"Purchase Line",

PurchOrderLine."Document Type",

PurchOrderLine."Document No.",

PurchOrderLine."Line No.",

TempJnlLineDim."Dimension Code")

THEN

DocDim.DELETE;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 78

DocDim.INIT;

DocDim."Table ID" := DATABASE::"Purchase Line";

DocDim."Document Type" := PurchOrderLine."Document Type";

DocDim."Document No." := PurchOrderLine."Document No.";

DocDim."Line No." := PurchOrderLine."Line No.";

DocDim."Dimension Code" := TempJnlLineDim."Dimension Code";

DocDim."Dimension Value Code" := TempJnlLineDim."Dimension Value Code";

DocDim.INSERT;

UNTIL TempJnlLineDim.NEXT = 0;

END;

IF (PurchOrderLine."Drop Shipment") OR (PurchOrderLine."Special Order") THEN

BEGIN

SalesOrderLine.LOCKTABLE;

SalesOrderHeader.LOCKTABLE;

SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.");

{--PurchMgr

IF NOT PurchOrderLine."Special Order" THEN

TESTFIELD("Ship-to Code",SalesOrderHeader."Ship-to Code");

------PurchMgr--}

SalesOrderLine.GET(SalesOrderLine."Document Type"::Order,"Sales Order

No.","Sales Order Line No.");

//PurchMgr... SalesOrderLine.TESTFIELD(Type,SalesOrderLine.Type::Item);

IF SalesOrderLine."Purch. Order Line No." <> 0 THEN

ERROR(

Text006,

SalesOrderLine."No.",SalesOrderLine."Document No.",SalesOrderLine."Purchase

Order No.");

IF NOT PurchOrderLine."Special Order" THEN

TESTFIELD("Sell-to Customer No.",SalesOrderLine."Sell-to Customer No.");

TESTFIELD(Type,SalesOrderLine.Type);

TESTFIELD(Quantity,SalesOrderLine."Outstanding Quantity");

TESTFIELD("No.",SalesOrderLine."No.");

TESTFIELD("Location Code",SalesOrderLine."Location Code");

TESTFIELD("Unit of Measure Code",SalesOrderLine."Unit of Measure Code");

TESTFIELD("Variant Code",SalesOrderLine."Variant Code");

TESTFIELD("Bin Code",SalesOrderLine."Bin Code");

TESTFIELD("Prod. Order No.",'');

TESTFIELD("Qty. per Unit of Measure","Qty. per Unit of Measure");

SalesOrderLine."Unit Cost ($)" := PurchOrderLine."Unit Cost ($)";

SalesOrderLine.VALIDATE("Unit Cost ($)");

IF SalesOrderLine."Special Order" THEN BEGIN

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 79

SalesOrderLine."Special Order Purchase No." := PurchOrderLine."Document No.";

SalesOrderLine."Special Order Purch. Line No." := PurchOrderLine."Line No.";

//PurchMgr

{-----add line for information--}

SalesOrderLine."Purchase Order No." := PurchOrderLine."Document No.";

END ELSE BEGIN

SalesOrderLine."Purchase Order No." := PurchOrderLine."Document No.";

SalesOrderLine."Purch. Order Line No." := PurchOrderLine."Line No.";

END;

//DirectPurch

IF SalesOrderLine."Job No." <> '' THEN

SalesOrderLine."Job Applies-to ID" := '50DP'; // This prevents posting to the

Inventory since

// the PO line will post directly to the Job ledger

SalesOrderLine.MODIFY;

END;

//Purch

{--Original----replaced below

IF PurchOrderLine.Type = PurchOrderLine.Type::Item THEN

IF TransferExtendedText.PurchCheckIfAnyExtText(PurchOrderLine,FALSE) THEN

BEGIN

NextLineNo := TransferExtendedText.InsertPurchExtText(PurchOrderLine) - 10000;

END; --------}

IF (PurchOrderLine.Type = PurchOrderLine.Type::Item) OR

(PurchOrderLIne.Type = PurchOrderLine.Type::Resource) THEN

IF TransferExtendedText.PurchCheckIfAnyExtText(PurchOrderLine,FALSE)

THEN BEGIN

NextLineNo := TransferExtendedText.InsertPurchExtText(PurchOrderLine) -

10000;

END;

//end Purch

END;

3—Add the following (BOLD) code to the InsertHeader trigger:

{InsertHeader}

WITH ReqLine2 DO BEGIN

OrderCounter := OrderCounter + 1;

Window.UPDATE(3,OrderCounter);

PurchSetup.GET;

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 80

PurchSetup.TESTFIELD("Order Nos.");

PurchOrderHeader.INIT;

PurchOrderHeader."Document Type" := PurchOrderHeader."Document Type"::Order;

PurchOrderHeader."No." := '';

PurchOrderHeader."Posting Date" := PostingDateReq;

PurchOrderHeader.INSERT(TRUE);

PurchOrderHeader."Your Reference" := ReferenceReq;

PurchOrderHeader."Order Date" := OrderDateReq;

PurchOrderHeader."Expected Receipt Date" := ReceiveDateReq;

PurchOrderHeader.VALIDATE("Buy-from Vendor No.","Vendor No.");

IF "Order Address Code" <> '' THEN

PurchOrderHeader.VALIDATE("Order Address Code","Order Address Code");

IF "Sell-to Customer No." <> '' THEN

PurchOrderHeader.VALIDATE("Sell-to Customer No.","Sell-to Customer No.");

PurchOrderHeader.VALIDATE("Currency Code","Currency Code");

//PurchMgr

{--Original code

IF "Ship-to Code" <> '' THEN

PurchOrderHeader.VALIDATE("Ship-to Code","Ship-to Code");

---------------------------------------------------}

{--Added code--also see that Drop Ships default to ship-to option ship-to code}

IF "Ship-to Option" = "Ship-to Option"::"Ship-to Code" THEN

IF "Ship-to Code" <> '' THEN

PurchOrderHeader.VALIDATE("Ship-to Code","Ship-to Code");

//end PurchMgr here

PurchOrderHeader."Location Code" := ReqLine2."Location Code";

//PurchMgr

PurchOrderHeader."Ship-to Option" := ReqLine2."Ship-to Option";

{--removed for change

IF PurchasingCode.GET("Purchasing Code") THEN

IF PurchasingCode."Special Order" THEN

IF Location.GET(ReqLine2."Location Code") THEN BEGIN;

PurchOrderHeader."Ship-to Code" := '';

PurchOrderHeader."Ship-to Name" := Location.Name;

PurchOrderHeader."Ship-to Name 2" := Location."Name 2";

PurchOrderHeader."Ship-to Address" := Location.Address;

PurchOrderHeader."Ship-to Address 2" := Location."Address 2";

PurchOrderHeader."Ship-to City" := Location.City;

PurchOrderHeader."Ship-to ZIP Code" := Location."ZIP Code";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 81

PurchOrderHeader."Ship-to State" := Location.State;

PurchOrderHeader."Ship-to Country Code" := Location."Country Code";

PurchOrderHeader."Ship-to Contact" := Location.Contact;

PurchOrderHeader."Location Code" := Location.Code;

END ELSE BEGIN

CompanyInfo.GET;

PurchOrderHeader."Sell-to Customer No." := '';

PurchOrderHeader."Ship-to Code" := '';

PurchOrderHeader."Ship-to Name" := CompanyInfo.Name;

PurchOrderHeader."Ship-to Name 2" := CompanyInfo."Name 2";

PurchOrderHeader."Ship-to Address" := CompanyInfo.Address;

PurchOrderHeader."Ship-to Address 2" := CompanyInfo."Address 2";

PurchOrderHeader."Ship-to City" := CompanyInfo.City;

PurchOrderHeader."Ship-to ZIP Code" := CompanyInfo."ZIP Code";

PurchOrderHeader."Ship-to State" := CompanyInfo.State;

PurchOrderHeader."Ship-to Country Code" := CompanyInfo."Country

Code";

PurchOrderHeader."Ship-to Contact" := '';

PurchOrderHeader."Location Code" := '';

END;

end of removal--------}

{--new code--}

IF PurchasingCode.GET("Purchasing Code") THEN

IF PurchasingCode."Special Order" THEN BEGIN

CASE "Ship-to Option" OF

"Ship-to Option"::"Location Code" :

BEGIN

IF Location.GET(ReqLine2."Location Code") THEN BEGIN;

PurchOrderHeader."Ship-to Code" := '';

PurchOrderHeader."Ship-to Name" := Location.Name;

PurchOrderHeader."Ship-to Name 2" := Location."Name 2";

PurchOrderHeader."Ship-to Address" := Location.Address;

PurchOrderHeader."Ship-to Address 2" := Location."Address 2";

PurchOrderHeader."Ship-to City" := Location.City;

PurchOrderHeader."Ship-to ZIP Code" := Location."ZIP Code";

PurchOrderHeader."Ship-to State" := Location.State;

PurchOrderHeader."Ship-to Country Code" := Location."Country Code";

PurchOrderHeader."Ship-to Contact" := Location.Contact;

PurchOrderHeader."Location Code" := Location.Code;

END ELSE BEGIN //didn't get or blank

CompanyInfo.GET;

PurchOrderHeader."Sell-to Customer No." := '';

PurchOrderHeader."Ship-to Code" := '';

PurchOrderHeader."Ship-to Name" := CompanyInfo.Name;

PurchOrderHeader."Ship-to Name 2" := CompanyInfo."Name 2";

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 82

PurchOrderHeader."Ship-to Address" := CompanyInfo.Address;

PurchOrderHeader."Ship-to Address 2" := CompanyInfo."Address 2";

PurchOrderHeader."Ship-to City" := CompanyInfo.City;

PurchOrderHeader."Ship-to ZIP Code" := CompanyInfo."ZIP Code";

PurchOrderHeader."Ship-to State" := CompanyInfo.State;

PurchOrderHeader."Ship-to Country Code" := CompanyInfo."Country

Code";

PurchOrderHeader."Ship-to Contact" := '';

PurchOrderHeader."Location Code" := '';

END;

END; //end Location Code

//"Ship-to Option"::"Ship-to Code" :

{--not needed because is default way about this case statement

IF "Ship-to Code" <> '' THEN

PurchOrderHeader.VALIDATE("Ship-to Code","Ship-to Code");

-------------------------}

"Ship-to Option"::"Job Site" :

BEGIN

//get info from Job ... future ... currently stays with ship-to code

END; //end Job Site

END; //end CASE

END ELSE //purchaseing code is <> special order

IF PurchasingCode."Direct Purchase" THEN

IF "Ship-to Option" = "Ship-to Option"::"Job Site" THEN BEGIN

//get info from Job ... future ... currently stays with ship-to code

END;

//end PurchMgr

PurchOrderHeader.MODIFY;

COMMIT;

IF RECORDLEVELLOCKING THEN

LOCKTABLE;

PurchOrderHeader.MARK(TRUE);

END;

4—Add the code in BOLD to the FinalizeOrderHeader trigger.

{FinalizeOrderHeader}

// Update/delete lines

IF NOT ReqLine.RECORDLEVELLOCKING THEN

ReqLine.LOCKTABLE(TRUE,TRUE);

IF ReqTemplate.Recurring THEN BEGIN

// Recurring journal

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 83

ReqLine2.SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency Code");

ReqLine2.COPY(ReqLine);

ReqLine2.SETRANGE("Vendor No.",PurchOrderHeader."Buy-from Vendor No.");

ReqLine2.SETRANGE("Sell-to Customer No.",PurchOrderHeader."Sell-to Customer

No.");

ReqLine2.SETRANGE("Ship-to Code",PurchOrderHeader."Ship-to Code");

ReqLine2.SETRANGE("Order Address Code",PurchOrderHeader."Order Address

Code");

ReqLine2.SETRANGE("Currency Code",PurchOrderHeader."Currency Code");

ReqLine2.FIND('-');

REPEAT

OrderLineCounter := OrderLineCounter + 1;

Window.UPDATE(5,OrderLineCounter);

IF ReqLine2."Order Date" <> 0D THEN BEGIN

ReqLine2.VALIDATE(

"Order Date",

CALCDATE(ReqLine2."Recurring Frequency",ReqLine2."Order Date"));

ReqLine2.VALIDATE("Currency Code",PurchOrderHeader."Currency Code");

END;

IF (ReqLine2."Recurring Method" = ReqLine2."Recurring Method"::Variable) AND

(ReqLine2."No." <> '')

THEN BEGIN

ReqLine2.Quantity := 0;

ReqLine2."Quantity Disc. %" := 0;

END;

ReqLine2.MODIFY;

UNTIL ReqLine2.NEXT = 0;

END ELSE BEGIN

// Not a recurring journal

OrderLineCounter := OrderLineCounter + LineCount;

Window.UPDATE(5,OrderLineCounter);

//PurchMgr

{--Original--

ReqLine2.SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency

Code");

-------------}

{--Add code--}

ReqLine2.SETCURRENTKEY(

"Worksheet Template Name","Journal Batch Name","Vendor No.",

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 84

"Sell-to Customer No.","Ship-to Code","Order Address Code","Currency

Code","Ship-to Option");

//PurchMgr

ReqLine2.COPY(ReqLine);

ReqLine2.SETRANGE("Vendor No.",PurchOrderHeader."Buy-from Vendor No.");

ReqLine2.SETRANGE("Sell-to Customer No.",PurchOrderHeader."Sell-to Customer

No.");

ReqLine2.SETRANGE("Ship-to Code",PurchOrderHeader."Ship-to Code");

ReqLine2.SETRANGE("Order Address Code",PurchOrderHeader."Order Address

Code");

ReqLine2.SETRANGE("Currency Code",PurchOrderHeader."Currency Code");

ReqLine2.SETRANGE("Ship-to Option",PurchOrderHeader."Ship-to Option");

//PurchMgr

ReqLine2.DELETEALL(TRUE);

END;

COMMIT;

IF PrintPurchOrders AND (PurchOrderHeader."Buy-from Vendor No." <> '') THEN

BEGIN

PurchOrderHeader2.RESET;

PurchOrderHeader2 := PurchOrderHeader;

PurchOrderHeader2.SETRECFILTER;

ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"P.Cr.Memo");

ReportSelection.FIND('-');

REPEAT

ReportSelection.TESTFIELD("Report ID");

REPORT.RUN(ReportSelection."Report ID",FALSE,FALSE,PurchOrderHeader2);

UNTIL ReportSelection.NEXT = 0;

END;

5—This completes the changes to codeunit 333.

Codeunit #378: Transfer Extended Text

1—Add the following code to the PurchCheckIfAnyExtText local function:

PurchLine.Type::Item:

BEGIN

IF Item.GET(PurchLine."No.") THEN

AutoText := Item."Automatic Ext. Text";

END;

//PurchReso

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 85

PurchLine.Type::Resource:

BEGIN

IF Res.GET(PurchLine."No.") THEN

AutoText := Res."Automatic Ext. Text";

END;

//end PurchReso

END; //ends the Case statement

END CHANGE LOG

Once all the changes have been made, COMPILE ALL objects again. If compile errors

still exist, Navision will mark the problem objects and you will need to double check the

integration in your database with the change log. If you are sure that all changes are in

the database and compile errors continue please contact you NSC immediately.

If all objects compile, then continue on with the Setup & Workflow instructions.

P:\Click here for Manuals\Direct Purchasing Instructions.doc 8/17/09 86