void SOPDocumentSelectButton_ClickBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e) { // Run this code only if the Visual Studio Tools add-in opened the lookup. if (GPAddIn.ReturnToLookup == true) { // Retrieve the SOP Document number of the row selected in the scrolling window // of the SOP document lookup. Microsoft.Dexterity.Applications.SmartListDictionary.SopDocumentLookupForm sopLookupForm = SmartList.Forms.SopDocumentLookup; string sopNumber = sopLookupForm.SopDocumentLookup.DocumentScroll.SopNumber; // Display the value retrieved LookupsWindow.SOPDocumentNumber.Text = sopNumber; // Clear the flag that indicates a value is to be retrieved from the lookup. GPAddIn.ReturnToLookup = false; } }
public void Initialize() { // Menu to open Lookups form Dynamics.Forms.AboutBox.AddMenuHandler(OpenLookupWindow, "Lookups", ""); // Select button on the Customers lookup window Microsoft.Dexterity.Applications.SmartListDictionary.CustomerLookupForm customerLookupForm = SmartList.Forms.CustomerLookup; customerLookupForm.CustomerLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(CustomerSelectButton_ClickBeforeOriginal); // Select button on the Vendors lookup window Microsoft.Dexterity.Applications.SmartListDictionary.VendorLookupForm vendorLookupForm = SmartList.Forms.VendorLookup; vendorLookupForm.VendorLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(VendorSelectButton_ClickBeforeOriginal); // Select button on the Items lookup window Microsoft.Dexterity.Applications.SmartListDictionary.IvItemNumberLookupForm itemNumberLookupForm = SmartList.Forms.IvItemNumberLookup; itemNumberLookupForm.IvItemNumberLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(ItemSelectButton_ClickBeforeOriginal); // Select button on the GL Account lookup window Microsoft.Dexterity.Applications.SmartListDictionary.AccountLookupForm accountLookupForm = SmartList.Forms.AccountLookup; accountLookupForm.AccountLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(AccountSelectButton_ClickBeforeOriginal); // Select button on the SOP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.SopDocumentLookupForm sopLookupForm = SmartList.Forms.SopDocumentLookup; sopLookupForm.SopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(SOPDocumentSelectButton_ClickBeforeOriginal); // Select button on the POP Document lookup window Microsoft.Dexterity.Applications.SmartListDictionary.PopDocumentLookupForm popLookupForm = SmartList.Forms.PopDocumentLookup; popLookupForm.PopDocumentLookup.SelectButton.ClickBeforeOriginal += new System.ComponentModel.CancelEventHandler(POPDocumentSelectButton_ClickBeforeOriginal); // Validate script that prevents the POP Document lookup window from being displayed popLookupForm.PopDocumentLookup.PopPoLookup.ValidateBeforeOriginal += new System.ComponentModel.CancelEventHandler(PopPoLookup_ValidateBeforeOriginal); }
private void SOPDocumentLookup_Click(object sender, EventArgs e) { // Create an empty date value for Microsoft Dynamics GP DateTime emptyDate = new DateTime(); emptyDate = Convert.ToDateTime("1/1/1900"); // Create a reference to the SopDocumentLookup form Microsoft.Dexterity.Applications.SmartListDictionary.SopDocumentLookupForm sopLookup = SmartList.Forms.SopDocumentLookup; // Set the flag indicating that we opened the lookup GPAddIn.ReturnToLookup = true; //Open the lookup form sopLookup.Open(); // The parameters for the Open procedure are: // 1 - Sort by // 1 = SOP Number // 2 = Customer // 3 = Doc Date // 4 = Batch ID // 5 = Doc Type // 2 - What to show // 0 = SHOW_ALL // 1 = SHOW_SHIPDOC_EXCLUDED // 2 = SHOW_SHIPDOC_ONLY // 3 = SHOW_ORDERS_BACKORDERS // 4 = SHOW_ORDERS_FULFILLMENTORDERS // 5 = SHOW_BACKORDERS // 3 - Table type // 0 = Work // 1 = History // 4 - Lock status // 0 = Unlocked // 1 = Locked // 5 - Seed for Sop Type // 6 - Seed for Sop Number // 7 - Seed for Customer Number // 8 - Seed for Batch Number - Empty for historical docs // 9 - Seed for Trx Source - Empty for work docs // 10 - Seed value for Doc Date // 11 - Seed value for master number // 12 - Always pass in false // 13 - Restrict by document type // 1 = Quote // 2 = Order // 3 = Invoice // 4 = Return // 5 = Back Order // 6 = Fullfillment Order // 0 = All documents // Sort by SOP Number, Showing all documents, from the History table Dynamics.Forms.SopDocumentLookup.Procedures.Open.Invoke(1, 0, 1, 0, 0, SOPDocumentNumber.Text, "", "", "", emptyDate, 0, false, 0); }