This job shows you how to copy a sales order, but more importantly it shows you how to use the SalesCopying class so that you can copy from SalesQuotes, Journals, etc.
static void JobCopySO(Args _args) { SalesTable salesTable = SalesTable::find('SO000777'); SalesLine salesLine; SalesTable salesTableNew; SalesOrderCopyingContract contract = SalesOrderCopyingContract::newIsCreditNote(false); SalesCopying salesCopying; TmpFrmVirtual tmpFrmVirtualLines; TmpFrmVirtual tmpFrmVirtualHeader; void writeTmpFrmVirtual(TmpFrmVirtual _tmpFrmVirtual, TableId _tableId, RecId _recId, Num _id, LineNum _lineNum = 0, TransDate _transDate = systemDateGet(), Qty _qty = 0) { _tmpFrmVirtual.clear(); _tmpFrmVirtual.TableNum = _tableId; _tmpFrmVirtual.RecordNo = _recId; _tmpFrmVirtual.Id = _id; _tmpFrmVirtual.LineNum = _lineNum; _tmpFrmVirtual.TransDate = _transDate; _tmpFrmVirtual.Qty = _qty; _tmpFrmVirtual.write(); } // Create your new sales header salesTableNew.SalesId = NumberSeq::newGetNum(SalesParameters::numRefSalesId()).num(); salesTableNew.initValue(); salesTableNew.CustAccount = salesTable.CustAccount; salesTableNew.initFromCustTable(); salesTableNew.insert(); // Build header virtual writeTmpFrmVirtual(tmpFrmVirtualHeader, salesTable.TableId, salesTable.RecId, salesTable.SalesId); while select salesLine where salesLine.SalesId == salesTable.SalesId { writeTmpFrmVirtual(tmpFrmVirtualLines, salesLine.TableId, salesLine.RecId, salesLine.SalesId, salesLine.LineNum, systemDateGet(), salesLine.SalesQty); } contract.parmSalesPurchCopy(SalesPurchCopy::CopyAllHeader); contract.parmCallingTableSalesId(salesTableNew.SalesId); contract.parmTmpFrmVirtualLines(tmpFrmVirtualLines); contract.parmTmpFrmVirtualHeader(tmpFrmVirtualHeader); contract.parmQtyFactor(1); contract.parmRecalculateAmount(NoYes::No); contract.parmReverseSign(NoYes::No); contract.parmCopyMarkup(NoYes::No); contract.parmCopyPrecisely(NoYes::No); contract.parmDeleteLines(NoYes::Yes); SalesCopying::copyServer(contract.pack(), false); info(strFmt("Created %1", salesTableNew.SalesId)); }
thanks for the code. Saved me some workhours :)
ReplyDeleteIt's a great opportunity to close the hole and adjust Sales and Marketing for the last time. While you would likely concur, you may not completely comprehend why it's so significant or what can be done.cold call script
ReplyDeleteIncrement acknowledgment of outside sales group with present and potential clients. Think about your business as an expert football crew.how to get past the gatekeeper
ReplyDeleteEmotionally you need to come from a place of caring and support which will then be reflected in your vocal tone. Sounding judgmental or frustrated could destroy your relationship with your salesperson.fomo tools
ReplyDeleteThis is a splendid website! I"m extremely content with the remarks!. http://home2bis.com/sales-course/
ReplyDeleteThis is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. order management system
ReplyDeleteUsually a sales manager is given the number. What they must produce for the year, each quarter, and each month. The goals have been established. Now it's up to the manager to develop a sales business plan to achieve those goals. Business Data
ReplyDeleteThey treat web designer as the addition of their minds. Webdesignlab.be
ReplyDeleteDirect selling is the direct close to home introduction, exhibit, and sale of items and administrations to customers, generally in their homes or at their positions. In a down economy, direct sales outperform such test. https://www.callcenterdeluxecalls.nl
ReplyDeleteFacebook permits a business to assemble a brand, draw in clients, get client audits and moment client input. Webdesign
ReplyDeleteYou might need to sell an item, or make an arrangement or even increase data yet the opening ought to mirror the possibilities conditions and ought to be important for a Sales Campaign and not simply conventional hostility. Seoleadgeneration.be
ReplyDeleteThat site traffic will incorporate recurrent customers and web indexes anxious to get to that new substance.SEO Antwerpen
ReplyDeleteThe curriculum for free sales courses usually begins with the sales introduction. This is the process of creating rapport with the prospective customers. קורס מכירות
ReplyDeleteI will add one admonition to that; there are proficient sales associations whose center business is absolutely selling. F and I resources in Missouri & Kansas
ReplyDelete