Quantcast
Channel: Sage 100
Viewing all articles
Browse latest Browse all 36990

Forum Post: how to set shipping Qunatity in shipping data entry?

$
0
0
I have done following code to create shipping entry in sage using business object.But After Execute code I am able to get to get item in lines but i am always getting shipped quantity value zero. using (DispatchObject pvx = new DispatchObject("ProvideX.Script")) { pvx.InvokeMethod("Init", sagePath); using (DispatchObject oSS = new DispatchObject(pvx.InvokeMethod("NewObject", "SY_Session"))) { //oSS.InvokeMethod("nLogon"); oSS.InvokeMethod("nSetCompany", sageOrganization); oSS.InvokeMethod("nSetUser", 1, "roy"); oSS.InvokeMethod("nSetDate", "S/O", DateTime.Now.ToString("yyyyMMdd")); oSS.InvokeMethod("nSetModule", "S/O"); // Get the Task ID for the AR_Customer_ui program int taskID = (int)oSS.InvokeMethod("nLookupTask", "SO_Shipping_UI"); oSS.InvokeMethod("nSetProgram", taskID); using (DispatchObject oSalesOrderEntry = new DispatchObject(pvx.InvokeMethod("NewObject", "SO_Shipping_bus", oSS.GetObject()))) { try { object[] nextOrderNum = new object[] { "InvoiceNo$" }; oSalesOrderEntry.InvokeMethodByRef("nGetNextInvoiceNo", nextOrderNum); oSalesOrderEntry.InvokeMethod("nSetKey", nextOrderNum[0]); oSalesOrderEntry.InvokeMethod("nSetValue", "CustomerNo$", "C105"); oSalesOrderEntry.InvokeMethod("nSetValue", "ShipperID$", "1"); oSalesOrderEntry.InvokeMethod("nSetValue", "ShipStatus$", "L"); oSalesOrderEntry.InvokeMethod("nSetValue", "InvoiceDate$", DateTime.Now.ToString("yyyyMMdd")); //oSalesOrderEntry.InvokeMethod("nSetValue", "OrderType$", "S"); //oSalesOrderEntry.InvokeMethod("nSetValue", "OrderStatus$", "N"); oSalesOrderEntry.InvokeMethod("nSetValue", "SalespersonNo$", "S145"); oSalesOrderEntry.InvokeMethod("nSetValue", "TaxSchedule$", "CA LA"); oSalesOrderEntry.InvokeMethod("nSetValue", "SalesOrderNo$", "S149"); //oSalesOrderEntry.InvokeMethod("nSetValue", "LotSerialLinesExist$", "Y"); //oSalesOrderEntry.InvokeMethod("nSetValue", "LotSerialLinesExist$", "Y"); // oSalesOrderEntry.InvokeMethod("nAddLine"); oSalesOrderEntry.InvokeMethod("nWrite"); DispatchObject sales_order_line = new DispatchObject(oSalesOrderEntry.GetProperty("oLines")); //sales_order_lin("WarehouseCode$","000") // sales_order_line.InvokeMethod("nSetValue", "ItemCode$", "TEST2"); // sales_order_line.InvokeMethod("nSetValue", "WarehouseCode$", "000"); // sales_order_line.InvokeMethod("nSetValue", "ItemType", 1); //sales_order_line.InvokeMethod("nSetValue", "QuantityOrdered", "1"); //sales_order_line.InvokeMethod("nSetValue", "QuantityOrdered", 2); sales_order_line.InvokeMethod("nSetValue", "QuantityShipped", 2); sales_order_line.InvokeMethod("nWrite"); //sales_order_line.InvokeMethod("nSetValue", "LotSerialFullyDistributed$", "Y"); //DispatchObject sales_order_Distribution = new DispatchObject(sales_order_line.GetProperty("oDistribution")); //sales_order_Distribution.InvokeMethod("nAddDistributionLine", "S1-107"); //sales_order_Distribution.InvokeMethod("nSetValue", "QuantityShipped", 1); //// sales_order_Distribution.InvokeMethod("nSetKeyValue", "InvoiceNo$", nextOrderNum[0]); //// sales_order_Distribution.InvokeMethod("SetKeyValue", "LotSerialNo$", "S1-102"); //// sales_order_Distribution.InvokeMethod("SetValue", "QuantityShipped$", "1"); //sales_order_Distribution.InvokeMethod("nWrite");//string filter = string.Empty; //char QUO = Convert.ToChar(34); //string ItemCostRecIOL = "LotSerialNo$+" + QUO + "|" + QUO + // "+InvoiceNo$+" + QUO + "|" + QUO + // "+LineKey$"; //object[] getResultSetParams = new object[] { "InvoiceNo$", "STR(LotSerialLinesExist)", "ItemCodeDesc$", "", filter, "", "" }; //object retval = oSalesOrderEntry.InvokeMethodByRef("nGetResultSets", getResultSetParams); //string[] strSalesOrders = getResultSetParams[2].ToString().Split(System.Convert.ToChar(352)); } catch (Exception ex) { } } } }

Viewing all articles
Browse latest Browse all 36990

Trending Articles