Источник:
http://feedproxy.google.com/~r/daxbr/~3/_OCtiSLyDLk/
==============
Olá Pessoal,
Tudo bem?
Hoje adicionar um texto de nota fiscal a uma ordem de venda via X++. Estou compartilhando com vocês caso precisem algum dia.
public void generateDocumentReferenceExternal
(SalesTable _salesTable
, FiscalDocumentTextID_BR _textID
) { DocuRef docuRefLocal; DocuRefExt_BR docuRefExt_BRLocal; FiscalDocumentSourceText_BR fiscalDocumentSourceTextLocal;
if (_textID
) { fiscalDocumentSourceTextLocal
= FiscalDocumentSourceText_BR
::findByTextID(_textID
);
if (fiscalDocumentSourceTextLocal
) { try { ttsBegin; docuRefLocal.
RefTableId = _salesTable.
TableId; docuRefLocal.
RefRecId = _salesTable.
RecId; docuRefLocal.
RefCompanyId = _salesTable.
dataAreaId; docuRefLocal.
TypeId = BrazilParameters
::find().
FiscalDocumentTextDocuTypeId; docuRefLocal.
initFromFiscalDocumentSourceText_BR(fiscalDocumentSourceTextLocal
); docuRefLocal.
insert(); docuRefExt_BRLocal.
DocuRef = docuRefLocal.
RecId; docuRefExt_BRLocal.
Type = FiscalDocumentTextType_BR
::UserDef; docuRefExt_BRLocal.
initFromFiscalDocumentSourceText(fiscalDocumentSourceTextLocal
); docuRefExt_BRLocal.
insert(); docuRefExt_BRLocal.
initProcessReference();
ttsCommit;
} catch
{ throw error
(strFmt("Falha ao tentar gerar texto de nota fiscal para a ordem de venda %1", _salesTable.
SalesId));
} } } }
Источник:
http://feedproxy.google.com/~r/daxbr/~3/_OCtiSLyDLk/