tag:blogger.com,1999:blog-53754539593548376962024-03-12T23:32:55.796-06:00Aprendiendo Dynamics AxInformación en español sobre Microsoft Dynamics Ax 2009 y 2012Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.comBlogger105125tag:blogger.com,1999:blog-5375453959354837696.post-88825303001999524542018-03-20T13:15:00.000-06:002018-03-20T13:15:08.391-06:00Module 'xxx' has invalid reference to module...model store is in broken state. Microfost Dynamics 365FO<br />
En uno de mis modelos de pruebas,
hice una referencia circular, que no dejaba volver a abrir el formulario de
modelos desde VS y mostraba el error siguiente incluso al tratar de crear
objetos nuevos en un proyecto:<br />
<br />
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p><i>Module 'xxx' has invalid reference to module 'xxx' that can cause circular dependecies. This is an indication that model store is in broken state.</i></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcWzXpdFD9TqSxPsUEWCqROdpiSQfC71kHPeYLmk4YGokpnFIU3XVVrNWXA_gZTGx4Tc3qsw4aAk9tR_4RcLNZP6C1HJxtXwI3PRPORp_SGBoE_aultDkBz_IVAH_rPDWIuBX2-7oJKK_p/s1600/invalid+reference+to+module.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="180" data-original-width="452" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcWzXpdFD9TqSxPsUEWCqROdpiSQfC71kHPeYLmk4YGokpnFIU3XVVrNWXA_gZTGx4Tc3qsw4aAk9tR_4RcLNZP6C1HJxtXwI3PRPORp_SGBoE_aultDkBz_IVAH_rPDWIuBX2-7oJKK_p/s320/invalid+reference+to+module.png" width="320" /></a></div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
La solución fue abrir el notepad con permisos de admin y en
la ruta de los packages locales, buscar el modelo que estaba causando error
(GRWYCFormsLab) y borrarle la referencia al modelo GRWYCAssetFix.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Guardé el archivo, cerre visual studio, volví a abrir y
listo!!!!<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAFETS4Vzbf6zNe-h5KXDcvosbQVZ7f1Qw7FxT4AJ3zlvuFjKM6TVPp4-CppJr5BdXGy-yhpFfiq4QsUXlm5oPsy7jQsKgbwiPyaDVIJXYAtoKQXw1FNItmuT-I18A3aY7F0w_dSoCaWvt/s1600/notepad+modify+model.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="633" data-original-width="1128" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAFETS4Vzbf6zNe-h5KXDcvosbQVZ7f1Qw7FxT4AJ3zlvuFjKM6TVPp4-CppJr5BdXGy-yhpFfiq4QsUXlm5oPsy7jQsKgbwiPyaDVIJXYAtoKQXw1FNItmuT-I18A3aY7F0w_dSoCaWvt/s640/notepad+modify+model.png" width="640" /></a><br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US" style="background-color: #fefdfa; color: #333333; font-family: Arial, sans-serif; font-size: 10pt;">Post relacionados:</span><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2n038ir">Service Unavailable 503 en Dynamics Ax 365</a></span><span style="background-color: #fefdfa; color: #333333; font-family: Arial, sans-serif; font-size: 10pt;"><br /></span><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2lEvS0F">No se muestra ningún elemento en Visual Studio 2015 con Dynamics Ax365</a></span></div>
<div class="MsoNormal">
<span style="background-color: #fefdfa;"><span style="font-family: arial, sans, sans-serif;"><span style="font-size: 13px; white-space: pre-wrap;"><br /></span></span><b style="color: #333333; font-family: Arial, sans-serif; font-size: 10pt;"><br /></b></span><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;"><span style="color: #351c75; font-family: Georgia, serif; font-size: 10pt;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></b></div>
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com1tag:blogger.com,1999:blog-5375453959354837696.post-56112385250988919352017-12-25T20:14:00.001-06:002017-12-25T20:14:28.753-06:00Como validar que una cuenta exista en una estructura contable en Microsoft Dynamics Ax 2012<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
Para saber si una cuenta existe o
no en una estructura contable podemos usar la clase DimensionHierarchy y el
método getAccountStructure, si este método nos devuelve un valor quiere decir
que si existe en alguna estructura contable configurada en Ax, aquí el
siguiente código:<o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<b><span lang="EN-US" style="color: darkblue; font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">static</span></b><span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> <b><span style="color: darkblue;">void</span></b> Job42(Args _args)</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">{</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
LedgerRecId ledgerRecId;</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
DimensionHierarchyId dimensionHierarchyId;</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
MainAccount mainAccount;</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
</span><span style="font-family: ""consolas"",serif; font-size: 8.0pt;">ledgerRecId
= Ledger::current();</span><o:p></o:p></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
mainAccount = mainAccount::findByMainAccountId(<span style="color: darkred;">"001000"</span>);</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
dimensionHierarchyId =
DimensionHierarchy::getAccountStructure(mainAccount.RecId, ledgerRecId);</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> </span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> <b><span style="color: darkblue;">if</span></b>(!dimensionHierarchyId)</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
{</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> <b><span style="color: darkblue;">throw</span></b> error(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkviolet;">"@SYS4009834"</span>, MainAccount::find(mainAccount.RecId).MainAccountId));</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> }</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;"> <b><span style="color: darkblue;">else</span></b></span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
{</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: ""consolas"",serif; font-size: 8.0pt; mso-ansi-language: EN-US;">
info(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkred;">"La
cuenta %1 si existe en la estructura %2."</span>,
MainAccount::find(mainAccount.RecId).MainAccountId,
DimensionHierarchy::find(dimensionHierarchyId).Name));</span><span lang="EN-US"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span lang="EN-US" style="font-size: 8pt;"> }</span><span lang="EN-US" style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<br />
<div style="margin: 0cm 0cm 0.0001pt;">
<span lang="EN-US" style="color: #333333; font-family: "Arial",sans-serif; font-size: 10.0pt; mso-ansi-language: EN-US;">Post relacionados:<br />
</span><span style="background: white; font-family: Arial, sans-serif; font-size: 10pt;"><a href="http://bit.ly/2fTNu3B"><span style="white-space: pre-wrap;"><span lang="EN-US">Crear una entrada de
presupuesto por código - Microsoft Dynamics Ax 2012</span></span></a></span><span lang="EN-US" style="color: #333333; font-family: "Arial",sans-serif; font-size: 10.0pt; mso-ansi-language: EN-US;"><br />
</span><span style="background: white; font-family: Arial, sans-serif; font-size: 10pt;"><a href="http://bit.ly/2pEpHuY"><span style="white-space: pre-wrap;"><span lang="EN-US">The request failed
with HTTP status 401: Unauthorized. </span>Enterprise Portal Dynamics Ax 2012</span></a></span><span style="color: #333333; font-family: "Arial",sans-serif; font-size: 10.0pt;"><br />
</span><span style="background: white; font-family: Arial, sans-serif; font-size: 10pt;"><a href="http://bit.ly/2fPRodI"><span style="white-space: pre-wrap;">Usuario actual, nombre de usuario, moneda de la empresa Dynamics Ax
2012</span></a></span><span style="color: #333333; font-family: "Arial",sans-serif; font-size: 10.0pt;"><br />
<br />
<b><br />
</b></span><b><span style="color: #351c75; font-family: "Georgia",serif; font-size: 10.0pt;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="text-decoration-line: none;" target="_blank"><span style="color: #7d181e;">Aprendiendo
Dynamics Ax </span></a>donde únicamente se tratan temas de desarrollo y se
busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></b><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-4936791334928834712017-10-08T11:58:00.000-05:002017-10-08T11:58:22.351-05:00Crear una entrada de presupuesto por código - Microsoft Dynamics Ax 2012Aquí como hacer una entrada de presupuesto:<br />
<br />
<div class="MsoNormal">
<b><span style="color: darkblue; font-family: Consolas; font-size: 8.0pt;">static</span></b><span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">void</span></b>
createBudgetHeaderAndLine(Args _args)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
BudgetTransactionHeader header;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
BudgetTransactionLine
line;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
AxBudgetTransactionHeader axHeader;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
AxBudgetTransactionLine axLine;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> header.initValue();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> header.Date = <b><span style="color: darkgreen;">18\09\2017</span></b>;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> header.BudgetModelId =
PurchParameters::find().GRWModelId;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> header.BudgetTransactionCode =
BudgetTransactionCode::findByBudgetTransactionCode(PurchParameters::find().GRWBudgetTransactionCode).RecId;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axHeader =
AxBudgetTransactionHeader::newBudgetTransactionHeader(header);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axHeader.save();<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine = AxBudgetTransactionLine::construct();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
axLine.parmBudgetTransactionHeader(axHeader.parmRecId());<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.parmLedgerDimension(<b><span style="color: red;">5637146826</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.parmDate(<b><span style="color: darkgreen;">18\09\2017</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.parmTransactionCurrencyAmount(<b><span style="color: red;">30</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.parmBudgetType(BudgetType::Expense);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.parmTransactionCurrency(<span style="color: darkred;">"MXN"</span>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> axLine.save();<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> info(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkred;">"Entrada de presupuesto creada: %1"</span>,
header.TransactionNumber));<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">Y en Ax se ve algo como esto:</span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4eNb2Pg-8GvrSe4qIJPceUzrS97olbfW9CODo2tdGAe9eKEhaCYiZ7oZtx0X-meQtj6IONkFZYbwF1_0O-GwbZG6FX9RcAHV9LSk_deZJd_bxTB2GcTDAM8QElev6ClYwLoXVwbrVAbtV/s1600/entrada+de+presupuesto+ax+2012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="529" data-original-width="1116" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4eNb2Pg-8GvrSe4qIJPceUzrS97olbfW9CODo2tdGAe9eKEhaCYiZ7oZtx0X-meQtj6IONkFZYbwF1_0O-GwbZG6FX9RcAHV9LSk_deZJd_bxTB2GcTDAM8QElev6ClYwLoXVwbrVAbtV/s400/entrada+de+presupuesto+ax+2012.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">
<span style="font-family: consolas; font-size: 7.5pt;"><br /></span><br /><span style="font-family: arial, tahoma, helvetica, freesans, sans-serif;">Post relacionados:</span><br /><span style="background-color: white; color: black; font-family: arial, sans, sans-serif; white-space: pre-wrap;"><a href="http://bit.ly/2xmwhLe">Autoliquidación de transacciones (Auto settlement) por código X++ - Dynamics Ax 2012</a></span><br /><span style="background-color: white; color: black; font-family: arial, sans, sans-serif; white-space: pre-wrap;"><a href="http://bit.ly/2wo2hcC">Validar si existe un archivo y la extensión del mismo por código - Dynamics Ax 2012</a></span><br /><span style="background-color: white; color: black; font-family: arial, sans, sans-serif; white-space: pre-wrap;"><a href="http://bit.ly/1Pq4qY4">Lista de remisiones asociadas a una factura por código X++ en Dynamics Ax 2012</a></span><br /><br /><br style="font-family: arial, tahoma, helvetica, freesans, sans-serif; font-weight: bold; line-height: 18.2px;" /><span style="font-family: georgia, "times new roman", serif; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></div>
<div>
<span style="font-family: georgia, "times new roman", serif; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div>
<span style="font-family: georgia, "times new roman", serif; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com4tag:blogger.com,1999:blog-5375453959354837696.post-46574917952101103332017-10-06T10:38:00.001-05:002017-10-06T10:38:28.013-05:00Autoliquidación de transacciones (Auto settlement) por código X++ - Dynamics Ax 2012Para hacer la liquidación en automático de dos transacciones podemos usar el siguiente código:<br />
<br />
<div class="MsoNormal">
<b><span style="color: darkblue; font-family: Consolas; font-size: 8.0pt;">static</span></b><span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">void</span></b> autoSettlementExWill(Args
_args)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">{<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
VendTrans
vendTransFrom, vendTransTO;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
VendTransOpen
vendTransOpenFrom, vendTransOpenTo;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
CustVendOpenTransManager SettleManager;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
Common
originator;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">boolean</span></b>
settled;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">try</span></b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> vendTransFrom
= vendTrans::find(<b><span style="color: red;">5637155127</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> vendTransTO =
vendTrans::find(<b><span style="color: red;">5637155128</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <i><span style="color: green;">//Revisando que no esten erradas las transacciones</span></i><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">if</span></b>(!vendTransFrom.Closed &&
!vendTransTo.Closed)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<b><span style="color: darkblue;">select</span></b> <b><span style="color: darkblue;">firstonly</span></b>
vendTransOpenFrom<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<b><span style="color: darkblue;">where</span></b> vendTransOpenFrom.RefRecId ==
vendTransFrom.RecId<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
&& vendTransOpenFrom.AccountNum == vendTransFrom.AccountNum;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<b><span style="color: darkblue;">select</span></b> <b><span style="color: darkblue;">firstonly</span></b>
vendTransOpenTo<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<b><span style="color: darkblue;">where</span></b> vendTransOpenTo.RefRecId ==
vendTransTo.RecId<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
&& vendTransOpenTo.AccountNum == vendTransTo.AccountNum;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
originator = vendTransFrom.vendInvoiceJour().vendTable_InvoiceAccount(); <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> SettleManager
= custVendOpenTransManager::construct(originator); <i><span style="color: green;">//en el originator solo hay custtable y vendtable en el
swicht</span></i><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
SettleManager.updateTransMarked(vendTransOpenFrom, <b><span style="color: darkblue;">true</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
SettleManager.updateTransMarked(vendTransOpenTo, <b><span style="color: darkblue;">true</span></b>);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
settled = SettleManager.settleMarkedTrans();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> info(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkred;">"Asiento
liquidado: %1, con %2"</span>, vendTransFrom.Voucher, vendTransTO.Voucher));<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">else</span></b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">
warning(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkred;">"Las transacciones de los asientos: %1 y %2, no
estan abiertas."</span>, vendTransFrom.Voucher, vendTransTO.Voucher));<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> <b><span style="color: darkblue;">catch</span></b><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> error(<b><span style="color: darkblue;">strFmt</span></b>(<span style="color: darkred;">"No
fue posible liquidar las transacciones de proveedor. Asientos no liquidados:
%1, con %2"</span>, <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> vendTransFrom.Voucher,
vendTransTO.Voucher));<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"> }<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
<div class="MsoNormal">
<span style="background-color: #fefdfa; color: #333333; font-family: consolas; font-size: 7.5pt;"><br /></span><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;"></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2ghC2iC">Crear y postear un LedgerVoucher en Ax 2012</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2fPRodI">Usuario actual, nombre de usuario, moneda de la empresa Dynamics Ax 2012</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/20zLwoT">Lookup para dimensiones financieras personalizadas - Microsoft Dynamics Ax 2012 R2</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></div>
<div class="MsoNormal">
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div class="MsoNormal">
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div class="MsoNormal">
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 8.0pt;"><br /></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-7351089374660726102017-09-12T18:20:00.001-05:002017-09-12T18:20:36.763-05:00Validar si existe un archivo y la extensión del mismo por código - Dynamics Ax 2012<br />
Cuando se requiere validar si un archivo aún existe en una ruta y/o validar el tipo de archivo de acuerdo a la extensión, se puede usar dos opciones. Con una de ellas se debe tener cuidado porque no funciona si se requiere para un proceso batch.<br />
<br />
<br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">static</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> <b><span style="color: darkblue;">void</span></b> ValidateFile(Args _args)</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;">Contracts contract;<o:p></o:p></span><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">boolean</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> existe;</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">System.IO.FileInfo
fileInfo;<o:p></o:p></span><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">container</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> datosArchivo;</span><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">str</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> extArchivo;</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<i><span style="color: green; font-family: Consolas; font-size: 7.5pt;">//se busca un registro de una tabla que en uno de sus campos contiene un path completo del tipo c:\\carpeta1\archivo.docx</span></i><br />
<span style="font-family: Consolas; font-size: 7.5pt;">contract = Contracts::find(<span style="color: darkred;">"CONTRATO 050717"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<i><span style="color: green; font-family: Consolas; font-size: 7.5pt;">//Opción
1: del lado del server, si funciona en procesos batch</span></i><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">new</span></b><span style="font-family: Consolas; font-size: 7.5pt;">
InteropPermission(InteropKind::ClrInterop).assert();</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">fileInfo = <b><span style="color: darkblue;">new</span></b> System.IO.FileInfo(contract.AttachmentPath);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">extArchivo =
fileInfo.get_Extension();<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;">existe =
fileInfo.get_Exists();<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;">CodeAccessPermission::revertAssert();<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">if</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> (existe)</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"si existe"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<i><span style="color: green; font-family: Consolas; font-size: 7.5pt;"> //Valida
si es un word</span></i><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;"> if</span></b><span style="font-family: Consolas; font-size: 7.5pt;">(strStartsWith(extArchivo, <span style="color: darkred;">".do"</span>))</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"si es doc"</span>);</span><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;"> else</span></b><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"no es doc"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">}<o:p></o:p></span><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">else</span></b><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"no existe"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">}<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<i><span style="color: green; font-family: Consolas; font-size: 7.5pt;">//Opción 2
- del lado del cliente, no funciona bajo procesos batch</span></i><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">if</span></b><span style="font-family: Consolas; font-size: 7.5pt;">
(WinAPI::fileExists(itsContract.AttachmentPath))</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"si existe 2"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<i><span style="color: green; font-family: Consolas; font-size: 7.5pt;"> //Valida
si es un word</span></i><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;"> new</span></b><span style="font-family: Consolas; font-size: 7.5pt;"> InteropPermission(InteropKind::ClrInterop).assert();</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> datosArchivo =
Global::fileNameSplit(contract.AttachmentPath);<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> CodeAccessPermission::revertAssert();<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"><br /></span>
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;"> if</span></b><span style="font-family: Consolas; font-size: 7.5pt;">(strStartsWith(<b><span style="color: darkblue;">conPeek</span></b>(datosArchivo, <b><span style="color: red;">3</span></b>), <span style="color: darkred;">".do"</span>))</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"si es doc 2"</span>);</span><o:p></o:p><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;"> else</span></b><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"no es doc 2"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">}<o:p></o:p></span><br />
<b><span style="color: darkblue; font-family: Consolas; font-size: 7.5pt;">else</span></b><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">{<o:p></o:p></span><br />
<span style="font-family: Consolas; font-size: 7.5pt;"> info(<span style="color: darkred;">"no existe 2"</span>);</span><o:p></o:p><br />
<span style="font-family: Consolas; font-size: 7.5pt;">}<o:p></o:p></span><br />
<br />
<span style="font-family: Consolas; font-size: 7.5pt;">}<o:p></o:p></span><br />
<span style="font-family: "consolas"; font-size: 7.5pt;"><br /></span>
<span style="font-family: "consolas"; font-size: 7.5pt;"><br /></span>
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Post relacionados:</span><br />
<span style="background-color: white; font-family: "arial" , "sans" , sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2lCGbi1">Registrar diario de producción por código, Dynamics Ax 2009, X++</a></span><br />
<span style="background-color: white; font-family: "arial" , "sans" , sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2wOCv2q">Métodos display y métodos edit en un datasource o tablas temporales, Dynamics Ax 2012</a></span><br />
<span style="background-color: white; font-family: "arial" , "sans" , sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2eDMfYE">Imprimir factura electrónica (México) a partir de una CustInvoiceJour por código - Dynamics Ax 2012</a></span><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-19033297563108664372017-08-15T22:55:00.002-05:002017-08-15T22:55:59.449-05:00Métodos display y métodos edit en un datasource o tablas temporales, Dynamics Ax 2012<br />
Formularios: se debe poner el datasource como parámetro en caso de usar el display o edit en formularios.<br />
Tablas temporales: se debe pasar como parámetro la tabla misma.<br />
<br />
<br />
<div style="box-sizing: border-box; color: #303131; font-family: "segoe ui", tahoma, arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<span style="background-color: white;">display str dispDebitor(simtcotetmp _simtcotetmp)</span><br />
<span style="background-color: white;">{</span><br />
<span style="background-color: white;"> simtDebitor deb;</span><br />
<span style="background-color: white;"> ;</span><br />
<br />
<span style="background-color: white;"> select nume, prenume from deb where deb.Ident == _simtcotetmp.IdDebitor; </span></div>
<div style="box-sizing: border-box; color: #303131; font-family: "segoe ui", tahoma, arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<span style="background-color: white;"> return deb.Nume;</span></div>
<div style="box-sizing: border-box; color: #303131; font-family: "segoe ui", tahoma, arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<span style="background-color: white;">}</span></div>
<div style="box-sizing: border-box; color: #303131; font-family: "segoe ui", tahoma, arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<span style="background-color: white;"><br /></span></div>
<div style="box-sizing: border-box; color: #303131; font-family: "segoe ui", tahoma, arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">edit NoYes MarkSKUs(boolean set,</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">InventTable Invent,</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">NoYes _markSKUs)</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">{</span><br />
<span style="background-color: white;"><br style="color: #3333ff; font-family: "century gothic", arial, helvetica, sans-serif; font-size: 14px;" /></span>
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">if (set)</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">{</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">MarkMap.insert(Invent.RecId,_markSKUs);</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">MarkMap.valueSet();</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">} </span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">else</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">{</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">if (MarkMap.exists(Invent.RecId))</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">{</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">_markSKUs = MarkMap.lookup(Invent.RecId);</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">}</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">} </span><br />
<span style="background-color: white;"><br style="color: #3333ff; font-family: "century gothic", arial, helvetica, sans-serif; font-size: 14px;" /></span>
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">return _MarkSKUs;</span><br />
<span style="background-color: white; color: #3333ff; font-family: "century gothic" , "arial" , "helvetica" , sans-serif; font-size: 14px;">}</span></div>
<br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><a href="http://bit.ly/2oR3S8D" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration-line: none;">Crear un campo edit en un control de usuario en Enterprise Portal de Dynamics Ax 2012 R2</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/20xVYwZ">Crear búsquedas por nombre de producto en métodos display</a></span><br />
<span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/1WP1HM6">Cómo crear un proyecto con todos los elementos de una capa - Microsoft Dynamics Ax 2012</a></span><br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-89803340788262284772017-07-22T07:40:00.000-05:002017-07-22T07:40:21.327-05:00Imprimir factura electrónica (México) a partir de una CustInvoiceJour por código - Dynamics Ax 2012 <span style="background-color: white; color: #343a41; font-family: Segoe, "Segoe UI Emoji", Helvetica, Arial, sans-serif; font-size: 15px;">Les comparto cómo mandar a PDF una factura electrónica a partir de la custInvoiceJour</span><br />
<span style="background-color: white; color: #343a41; font-family: Segoe, "Segoe UI Emoji", Helvetica, Arial, sans-serif; font-size: 15px;"><br /></span>
<div align="left" style="min-height: 9pt;">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">SaveReportToPDFFromController(Args _args)</span></span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> EInvoiceCFDISalesController_MX salesInvoiceController;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> EInvoiceCFDIReportContract_MX salesInvoiceContract;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> Args args =</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">Args();</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SrsReportRunImpl srsReportRun;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoiceJour custInvoiceJour;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> ReportName reportName =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"EInvoiceCFDIReport_MX.Report"</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> EInvoiceJour_MX eInvoiceJour_MX;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SrsPrintMgmtExecutionInfo srsPrintMgmtExecutionInfo;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> srsPrintMgmtExecutionInfo =</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">srsPrintMgmtExecutionInfo();</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>firstOnly</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoiceJour</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoiceJour.RecId ==</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>5637322330</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">eInvoiceJour_MX</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">eInvoiceJour_MX.RefRecId == custInvoiceJour.RecId &&</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> eInvoiceJour_MX.RefTableId == custInvoiceJour.TableId;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> args.record(eInvoiceJour_MX);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController =</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">EInvoiceCFDISalesController_MX();</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportName(reportName);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract();</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceContract.parmRecordId(eInvoiceJour_MX.RecId);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmArgs(args);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> srsReportRun = salesInvoiceController.parmReportRun()</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>as</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">SrsReportRunImpl;</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportRun(srsReportRun);</span></span></div>
<div align="left" style="min-height: 11pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportContract().parmPrintSettings().overwriteFile(</span></span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>true</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left" style="min-height: 11pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);</span></span></div>
<div align="left" style="min-height: 11pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportContract().parmPrintSettings().fileName(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">@"C:\Users\xxx\aloha.pdf"</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left" style="min-height: 11pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.parmReportContract().parmReportExecutionInfo(srsPrintMgmtExecutionInfo);</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesInvoiceController.runReport();</span></span></div>
<br />
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left" style="min-height: 9pt;">
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration-line: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
<div align="left" style="min-height: 9pt;">
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-63675787708751045102017-04-19T21:03:00.000-05:002017-04-19T21:14:05.340-05:00The request failed with HTTP status 401: Unauthorized. Enterprise Portal Dynamics Ax 2012Hay veces que tratando de implementar paginas, menu items o web controls en el Enterprise Portal (EP) llegamos a ver el error The request failed with HTTP status 401: Unauthorized.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1Hz7dUnl2VgEXcMCxx0qgCmIK3AejBWeB_dqUcpaiVzpLkDzoFVGtdFOfHxVujTBwii28B_CEciKmZ7mAjvPHHYZcEl7bqTSvlDh9YfCZQFtdRiTvkJRjtyXak4C9Utq1GnQx0TDrbEV0/s1600/Error+401.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1Hz7dUnl2VgEXcMCxx0qgCmIK3AejBWeB_dqUcpaiVzpLkDzoFVGtdFOfHxVujTBwii28B_CEciKmZ7mAjvPHHYZcEl7bqTSvlDh9YfCZQFtdRiTvkJRjtyXak4C9Utq1GnQx0TDrbEV0/s320/Error+401.jpg" width="252" /></a></div>
<br />
<br />
La solución es sobre el IIS<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-UP_MivOY_jU0sF4sDoojbgD0YudqLuDMS8RDoLyx4NgtDKxNG-3mqILSKqLGhEbNH9wC8Kz0-o1UL5RX5xRFgUG6iOCXMg9bUfSrdRAC49eISdXloRBzBiLSf-qPviiRqzNANGF_wM6V/s1600/Error+401+IIS.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-UP_MivOY_jU0sF4sDoojbgD0YudqLuDMS8RDoLyx4NgtDKxNG-3mqILSKqLGhEbNH9wC8Kz0-o1UL5RX5xRFgUG6iOCXMg9bUfSrdRAC49eISdXloRBzBiLSf-qPviiRqzNANGF_wM6V/s640/Error+401+IIS.jpg" width="640" /></a></div>
<br />
Claro, además de validar que el usuario tenga permisos de administrador y cumplir con los requerimientos técnicos que definidos Microsoft.<br />
<br />
Referencia:<br />
<a href="https://msdn.microsoft.com/en-us/library/dd261467.aspx">https://msdn.microsoft.com/en-us/library/dd261467.aspx</a><br />
<br />
<div style="color: #2a2a2a; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
The account specified in Microsoft Dynamics AX to use for the Business Connector Proxy must be the same account that is used to run the application pool for the SharePoint site that is used for Enterprise Portal. If two different accounts are used, the AxUpdatePortal utility operations will not complete successfully.</div>
<div style="color: #2a2a2a; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px;">
To successfully deploy Enterprise Portal resources, you must have the following roles and permissions:</div>
<ul style="color: #2a2a2a; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 13px;">
<li style="list-style-image: none;"><div style="line-height: 18px; padding-bottom: 0px;">
Administrator role in Microsoft Dynamics AX.</div>
</li>
<li style="list-style-image: none;"><div style="line-height: 18px; padding-bottom: 0px;">
Administrator for SharePoint. To verify this, open SharePoint Central Administration on the Enterprise Portal server. If you cannot access SharePoint Central Administration, a SharePoint administrator must open <span class="label" style="font-weight: 700;">SharePoint Central Administration</span> > <span class="label" style="font-weight: 700;">Security</span> > <span class="label" style="font-weight: 700;">Manage the farm administrators group</span> and add you as an administrator.</div>
</li>
<li style="list-style-image: none;"><div style="line-height: 18px; padding-bottom: 0px;">
Site collection administrator for the Enterprise Portal site. To verify this, open <span class="label" style="font-weight: 700;">SharePoint Central Administration</span> > <span class="label" style="font-weight: 700;">Application Management</span>. Click <span class="label" style="font-weight: 700;">Site Collections</span> > <span class="label" style="font-weight: 700;">Change site collection administrators</span>. Verify that you are listed as the primary or secondary site collection administrator.</div>
</li>
<li style="list-style-image: none;"><div style="line-height: 18px; padding-bottom: 0px;">
Privileges to access the file locations on the Enterprise Portal server where files will be put. One way to guarantee this is by running the command prompt that is used to call AxUpdatePortal.exe with administrative privileges.</div>
</li>
</ul>
<br />
<br />
Post relacionados:<br />
<a href="http://bit.ly/2pTkI69">Enterprise Portal Dynamics Ax 2012 – Crear List Pages y PartPreview Pane</a><br />
<a href="http://bit.ly/2oR3S8D">Crear un campo edit en un control de usuario en Enterprise Portal de Dynamics Ax 2012 R2</a><br />
<a href="http://bit.ly/2ooFzO5">Modificar un control de usuario en el Enterprise Portal de Dynamics Ax</a><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-75885725046458667652017-03-23T02:37:00.002-06:002017-03-23T02:37:32.621-06:00Cannot edit a record in Print journal (LedgerJournalTmp) Dynamics Ax 2012<br />
Cuando llegues a ver el error <span style="background-color: white; color: #303131; font-family: "segoe ui" , "tahoma" , "arial" , sans-serif; font-size: 15px;">Cannot edit a record in Print journal (LedgerJournalTmp) </span> al tratar de imprimir un diario, a lo que se refiere es que el dato extendido del campo AccountName no es de la misma longitud que el campo del que hereda, la solucion es que se cambie el dato extendido de ese campo (AccountName) al DirPartyName.<br />
<br />
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
"Cannot edit a record in Print journal (LedgerJournalTmp).</div>
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
The SQL database has issued an error."</div>
<br />
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
"[Microsoft][SQL Server Native Client 10.0][SQL Server]String or binary data would be truncated."</div>
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
and the third line is.</div>
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
"SQL statement: UPDATE T1 SET ACCOUNTNAME=T4.NAME,ACCOUNTNUM=T2.DISPLAYVALUE,RECVERSION=? FROM tempdb."DBO".t10841_69B3F7D1F031409EBC810A2C719FD5DB T1 CROSS JOIN DIMENSIONATTRIBUTEVALUECOMBINATION T2 CROSS JOIN CUSTTABLE T3 CROSS JOIN DIRPARTYTABLE T4 WHERE ((T1.PARTITION=?) AND (T1.ACCOUNTTYPE=?)) AND ((T2.PARTITION=?) AND (T2.RECID=T1.LEDGERDIMENSION)) AND (((T3.PARTITION=?) AND (T3.DATAAREAID=?)) AND (T3.ACCOUNTNUM=T2.DISPLAYVALUE)) AND ((T4.PARTITION=?) AND (T4.RECID=T3.PARTY))"</div>
<div style="background-color: white; box-sizing: border-box; color: #303131; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 20px; margin-bottom: 0.5em;">
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-71305910789043057332017-03-15T09:21:00.000-06:002017-03-15T09:21:18.676-06:00Service Unavailable 503 en Dynamics Ax 365Al trabajar en Ax 365, cuando se están haciendo modificaciones, pueden haber algunas causas bajo las cuales extrañamente el servicio de Ax365 se cae y solo se ve un Service Unavailable,Http Erro 503.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3q4Cm0yqgz32GNKAiZBOXThSB1kExekJPeugWLwOTbeltxgzo2dU91XtFd_e6Wgu8rp4rIC740EALcM9FbriTiJFTEPQ4XrG-Q_ynOeZ76uZBXEF5I8khbZS7pQGGh-0TJSdOu9q9d5fC/s1600/Service+unavailable+503+AX365.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3q4Cm0yqgz32GNKAiZBOXThSB1kExekJPeugWLwOTbeltxgzo2dU91XtFd_e6Wgu8rp4rIC740EALcM9FbriTiJFTEPQ4XrG-Q_ynOeZ76uZBXEF5I8khbZS7pQGGh-0TJSdOu9q9d5fC/s400/Service+unavailable+503+AX365.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Para conocer las causas de esto, podemos ir al event viewer y tratar de saber el origen para solucionarlo de fondo, pero mientras tanto, la solución es ir al IIS y arrancar el servicio que se cayo</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqNq5cNpdYJJd944j-5XqIX0P7yE9N-imYFUYLx3lrziT8Dma6q0ocn1C8T8AA822pP-Epmaaf223XVHgA1Ta5A_Vms8z7X8o1GCvSCWVaZlVgeIp3E_5WHKvuHnBszrnktbS29wfOod9U/s1600/AosService+Stopped+AX365.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="328" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqNq5cNpdYJJd944j-5XqIX0P7yE9N-imYFUYLx3lrziT8Dma6q0ocn1C8T8AA822pP-Epmaaf223XVHgA1Ta5A_Vms8z7X8o1GCvSCWVaZlVgeIp3E_5WHKvuHnBszrnktbS29wfOod9U/s640/AosService+Stopped+AX365.jpg" width="640" /></a></div>
<br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Post relacionados:</span><br />
<span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2lEvS0F">No se muestra ningún elemento en Visual Studio 2015 con Dynamics Ax365</a></span><br />
<a href="http://bit.ly/1PLUrSw" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Crear lookup en clase dialog en Ax 2012</a><br />
<a href="http://bit.ly/20xVYwZ" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Crear búsquedas por nombre de producto en métodos display en Ax 2012</a><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
.<br />
<br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-5948197847409244432017-03-08T13:41:00.000-06:002017-03-15T09:25:32.136-06:00No se muestra ningún elemento en Visual Studio 2015 con Dynamics Ax365Empezando con Ax365, lo primero que me tope cuando abrí el Visual Studio 2015 para comenzar los primeros pasos fue este error:<br />
<br />
<span style="background-color: white; color: #303131; font-family: "segoe ui" , "tahoma" , "arial" , sans-serif;"><i>Discovery of best practices extensions failed with error 'Given directory 'C:\AOSService\Packages\Bin\BPExtensions' does not exist. It must exist when discovering extensions from a single directory'. Best practices checks may not function correctly.</i></span><br />
<span style="background-color: white; color: #303131; font-family: "segoe ui" , "tahoma" , "arial" , sans-serif;"><i><br /></i></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl66bHJH4hyphenhyphen3oQiTaIZ_bcpWQnQR838Si2wbEuBjdi1F5tw3D4T6gGI-qolkqwr1Th0MYprFmvTWautO5Flyw8iqoBXqee_Evg3ZyqqF_jUXnJAuR8kyLlv5fT1zRUH_0AWrLHFYMK2K05/s1600/error+VS+Ax7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl66bHJH4hyphenhyphen3oQiTaIZ_bcpWQnQR838Si2wbEuBjdi1F5tw3D4T6gGI-qolkqwr1Th0MYprFmvTWautO5Flyw8iqoBXqee_Evg3ZyqqF_jUXnJAuR8kyLlv5fT1zRUH_0AWrLHFYMK2K05/s400/error+VS+Ax7.png" width="400" /></a></div>
<span style="background-color: white; color: #303131; font-family: "segoe ui" , "tahoma" , "arial" , sans-serif;"><i><br /></i></span>
<span style="background-color: white; font-family: inherit;">Y una vez dándole</span><span style="background-color: white; font-family: inherit;"> click aceptar, no se muestra ningún elemento en el AOT en la vista modelo.</span><br />
<span style="background-color: white; font-family: inherit;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyEdA-iBzIWFQUQVabvl2jDH4RcUcDANXwZ59tqP4UMQhyM_zRWjKQCY9cIoJL8HJQgRy0pZWZSqRYFKWkp_Dfbxk2dF2uEhXsaNXuPBmAYIxFQXcs6-IHpu028eGVXIOmO_DshE4KoT5Q/s1600/VS+vacio+Ax7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyEdA-iBzIWFQUQVabvl2jDH4RcUcDANXwZ59tqP4UMQhyM_zRWjKQCY9cIoJL8HJQgRy0pZWZSqRYFKWkp_Dfbxk2dF2uEhXsaNXuPBmAYIxFQXcs6-IHpu028eGVXIOmO_DshE4KoT5Q/s320/VS+vacio+Ax7.png" width="320" /></a></div>
<br />
<span style="font-family: inherit;"><span style="background-color: white;">La solución... solo es abrir el VS en modo administrador.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: white;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: white;">Post relacionados:</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white;"><span style="font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2n038ir">Service Unavailable 503 en Dynamics Ax 365</a></span></span></span>
<span style="font-family: inherit;"><span style="background-color: white;"><br /></span></span>
<span style="font-family: inherit;"><span style="background-color: white;"><br /></span></span>
<span style="background-color: #fefdfa; color: #351c75; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold;">No olvides que te puedes unir a la página en Facebook </span><a href="https://www.facebook.com/aprendiendodynamicsax" style="background-color: #fefdfa; color: #7d181e; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a><span style="background-color: #fefdfa; color: #351c75; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold;">donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span><br />
<span style="background-color: #fefdfa; color: #351c75; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold;"><br /></span>
<span style="background-color: #fefdfa; color: #351c75; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold;"><br /></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-89637428542821208682017-03-02T06:41:00.000-06:002017-03-02T06:41:34.437-06:00Registrar diario de producción por código, Dynamics Ax 2009, X++Si solo se quiere registrar un diario de producción del tipo "Notificar como terminado" podemos usar este código.<br />
<br />
static void postJournalReportAsFinished(Args _args)<br />
{<br />
ProdJournalTable prodJournalTable = ProdJournalTable::find("000496_098", true);<br />
;<br />
ProdJournalCheckPostProd::newPostJournal(prodJournalTable.JournalId, true).run();<br />
<br />
info("termino");<br />
}<br />
<br />
<br />
En caso de que se quiera validar antes el diario del mismo tipo:<br />
<br />
<br />
static void checkJournalReportAsFinished(Args _args)<br />
{<br />
JournalCheckPost journalCheckPost;<br />
ProdJournalTable prodJournalTable = ProdJournalTable::find("000494_098", true);<br />
;<br />
// Check/Post journal<br />
journalCheckPost = ProdJournalCheckPostProd::newJournalCheckPost(true,<br />
true,<br />
JournalCheckPostType::Check,<br />
prodJournalTable.TableId,<br />
prodJournalTable.JournalId);<br />
journalCheckPost.run();<br />
<br />
info("termino");<br />
}<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Post relacionados:</span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;"><span style="background-color: white; color: black; font-family: arial, sans, sans-serif; white-space: pre-wrap;"><a href="http://bit.ly/2kxbN7n">Crear una orden de producción en Dyamics Ax 2009 por código x++</a></span></span><br />
<span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2mbbVia">Crear diario de transferir Dynamics Ax 2009 por código x++</a></span><br />
<a href="http://bit.ly/20xVYwZ" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Crear búsquedas por nombre de producto en métodos display</a><br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-30532068738648469432017-02-23T08:16:00.000-06:002017-02-23T08:18:43.959-06:00Crear diario de transferir Dynamics Ax 2009 por código x++Aquí muestro cómo crear un diario de transferir en Dynamics Ax 2009<br />
<br />
<br />
static void ISSinventtransferjournal(Args _args)<br />
{<br />
InventJournalTable inventJournalTable;<br />
InventJournalTrans inventJournalTrans;<br />
InventJournalCheckPost inventJournalCheckPost;<br />
NumberSeq num;<br />
InventDim frominventDim,ToinventDim;<br />
;<br />
ttsbegin;<br />
inventJournalTable.clear();<br />
num = new NumberSeq();<br />
num = NumberSeq::newGetNum(InventParameters::numRefTransferId());<br />
<br />
inventJournalTable.initFromInventJournalName(InventJournalName::find(InventParameters::find().TransferJournalNameId));<br />
inventJournalTable.Description = InventJournalName::find(InventParameters::find().TransferJournalNameId).Description;<br />
inventJournalTable.SystemBlocked = true;<br />
inventJournalTable.insert();<br />
<br />
//línea 1<br />
inventJournalTrans.clear();<br />
inventJournalTrans.initFromInventJournalTable(inventJournalTable);<br />
<br />
inventJournalTrans.ItemId = "AAA";<br />
<br />
//frominventDim.wMslocationid = "";<br />
frominventDim.inventSiteId ="CAD";<br />
frominventdim.InventLocationId = "FABRICA";<br />
frominventdim.inventBatchId = "1a";<br />
<br />
<br />
//Toinventdim.wmslocationid = "";<br />
ToinventDim.InventSiteId = "CAD";<br />
ToinventDim.InventLocationId = "FERT";<br />
ToinventDim.inventBatchId = "1a";<br />
<br />
ToinventDim = InventDim::findOrCreate(ToinventDim);<br />
frominventDim = InventDim::findOrCreate(frominventDim);<br />
inventJournalTrans.InventDimId = frominventDim.inventDimId;<br />
inventJournalTrans.initFromInventTable(InventTable::find("AAA"));<br />
inventJournalTrans.Qty = 1;<br />
inventJournalTrans.ToInventDimId = ToinventDim.inventDimId;<br />
inventJournalTrans.TransDate = SystemDateget();<br />
inventJournalTrans.insert();<br />
<br />
inventJournalTable.NumOfLines = 1;<br />
inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckpostType::Post,inventJournalTable);<br />
inventJournalCheckPost.run();<br />
inventJournalTable.SystemBlocked = false;<br />
inventJournalTable.update();<br />
ttscommit;<br />
<br />
info(strfmt("Diario: %1 creado.", inventJournalTable.JournalId));<br />
}<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; color: #333333; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2kShQr0" style="color: #7d181e; text-decoration: none;">Reserva de inventario por línea de venta por código x++, Dynamics Ax 2009</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; color: #333333; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2krmyvH" style="color: #7d181e; text-decoration: none;">Dialogo para seleccionar nombre de archivo FileName</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: white; font-family: arial, sans, sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2kxbN7n">Crear una orden de producción en Dyamics Ax 2009 por código x++</a></span><br />
<br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-13478120259367042017-02-15T07:02:00.000-06:002017-02-15T07:14:51.534-06:00Crear una orden de producción en Dyamics Ax 2009 por código x++Ejemplo para crear una orden de producción y llevarla por los distintos estados: la estimación, la lista de selección, el inicio, reportar como terminada y el fin.<br />
<br />
static void createProductionOrder(Args _args)<br />
{<br />
ProdQty qty = 2;<br />
ItemId item = 'AAA-PT';<br />
<br />
ProdTable prodtable;<br />
InventTable inventTable;<br />
InventDim inventDim;<br />
<br />
ProdMultiCostEstimation prodMultiCostEstimation;<br />
ProdMultiScheduling prodMultiScheduling;<br />
ProdMultiRelease prodMultiRelease;<br />
ProdMultiStartUp prodMultiStartUp;<br />
ProdMultiReportFinished prodMultiReportFinished;<br />
ProdMultiHistoricalCost prodMultiHistoricalCost;<br />
Args args = new Args();<br />
<br />
ProdParmStartUp prodParmStartUp;<br />
;<br />
<br />
// Inicializar InventTable<br />
inventTable = inventTable::find(item);<br />
<br />
prodtable.initValue();<br />
prodtable.initFromInventTable(inventTable);<br />
<br />
prodtable.ItemId = inventTable.ItemId;<br />
prodtable.DlvDate = today();<br />
prodtable.DlvTime = DateTimeUtil::time(DateTimeUtil::utcNow());<br />
prodtable.QtySched = qty;<br />
prodtable.RemainInventPhysical = qty;<br />
<br />
// Inicializar InventDim<br />
inventDim.initValue();<br />
<br />
prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,<br />
prodtable.BOMDate,<br />
prodtable.QtySched,<br />
inventDim).BOMId;<br />
<br />
prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,<br />
prodtable.BOMDate,<br />
prodtable.QtySched,<br />
inventDim).RouteId;<br />
<br />
// Inicializar BOMVersion<br />
prodtable.initBOMVersion();<br />
// Inicializar RouteVersion<br />
prodtable.initRouteVersion();<br />
<br />
//Personalizar lote<br />
inventDim = inventDim::find(prodtable.InventDimId);<br />
inventDim.inventBatchId = "2011-302005";<br />
inventDim = inventDim::findOrCreate(inventDim);<br />
prodtable.InventDimId = inventDim.inventDimId;<br />
<br />
//Dependiendo de la configuración, esto puede ser necesario o no<br />
ProdTable.ProdGroupId = "AGR";<br />
<br />
//Usando ProdTable para crear la orden<br />
prodtable.type().insert();<br />
<br />
// Indica la orden de producción que se creo<br />
setPrefix( 'Número de orde de producción');<br />
info(prodtable.ProdId);<br />
<br />
<br />
// Estimation<br />
prodMultiCostEstimation = ProdMultiCostEstimation::construct(args);<br />
runBaseMultiParm::initParm(ProdMultiCostEstimation);<br />
prodMultiCostEstimation.insert(prodTable, ProdMultiCostEstimation.defaultParmBuffer());<br />
prodMultiCostEstimation.run();<br />
<br />
// Scheduling<br />
prodMultiScheduling = ProdMultiScheduling::construct(ProdSchedMethod::OperationScheduling);<br />
runBaseMultiParm::initParm(prodMultiScheduling);<br />
prodMultiScheduling.insert(prodTable, prodMultiScheduling.defaultParmBuffer());<br />
prodMultiScheduling.run();<br />
<br />
// Release<br />
prodMultiRelease = ProdMultiRelease::construct(args);<br />
runBaseMultiParm::initParm(ProdMultiRelease);<br />
prodMultiRelease.insert(prodTable, prodMultiRelease.defaultParmBuffer());<br />
prodMultiRelease.run();<br />
<br />
// Start up<br />
prodMultiStartup = ProdMultiStartUp::construct(args);<br />
runBaseMultiParm::initParm(prodMultiStartup);<br />
prodMultiStartup.insert(prodTable, prodMultiStartup.defaultParmBuffer());<br />
prodMultiStartup.runISS();<br />
<br />
// Report as Finished<br />
prodMultiReportFinished = ProdMultiReportFinished::construct(args);<br />
runBaseMultiParm::initParm(ProdMultiReportFinished);<br />
prodMultiReportFinished.insert(prodTable, ProdMultiReportFinished.defaultParmBuffer());<br />
prodMultiReportFinished.runISS();<br />
<br />
// End the Order<br />
prodMultiHistoricalCost = ProdMultiHistoricalCost::construct(args);<br />
runBaseMultiParm::initParm(ProdMultiHistoricalCost);<br />
prodMultiHistoricalCost.insert(prodTable, ProdMultiHistoricalCost.defaultParmBuffer());<br />
prodMultiHistoricalCost.run();<br />
<br />
}<br />
<br />
<br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px;">Post relacionados:</span><br />
<span style="background-color: white; font-family: "arial" , "sans" , sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2kShQr0">Reserva de inventario por línea de venta por código x++, Dynamics Ax 2009</a></span><br />
<span style="background-color: white; font-family: "arial" , "sans" , sans-serif; font-size: 13px; white-space: pre-wrap;"><a href="http://bit.ly/2krmyvH">Dialogo para seleccionar nombre de archivo FileName</a></span><br />
<a href="http://bit.ly/20xVYwZ" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Crear búsquedas por nombre de producto en métodos display</a><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-7238957993907206512017-02-08T06:23:00.003-06:002017-02-08T06:23:37.428-06:00Reserva de inventario por línea de venta por código x++, Dynamics Ax 2009Este es un ejemplo para simular la reserva de productos con dimensión financiera especifica, en este caso, un número de lote y número de serie en Dynamics Ax 2009.<br />
<br />
Nota: este ejemplo ejecutado desde un job te puede mandar un error de "<i>El cursor no es válido para crear una instancia recordViewCache.</i>" o "<i>The cursor is invalid for instantiating recordViewCache.</i>" esto se debe a que la clase desde donde lo ejecutes debe tener la propiedad RunOn en Server.<br />
<div>
<span style="font-size: 11pt;"><span style="font-family: "calibri";"><span style="color: #010101;"><br /></span></span></span></div>
<div>
static void reserveInventoryForSalesLine(Args _args)</div>
<div>
{</div>
<div>
SalesLine salesLine;</div>
<div>
InventUpd_Reservation reservation;</div>
<div>
InventDim inventDimCriteria;</div>
<div>
InventDimParm inventDimParm;</div>
<div>
InventMovement inventMovement;</div>
<div>
InventQty qty;</div>
<div>
;</div>
<div>
salesLine = salesLine::findRecId(5637148606); // RecId de la línea de venta</div>
<div>
<br /></div>
<div>
if (!salesLine)</div>
<div>
{</div>
<div>
return;</div>
<div>
}</div>
<div>
<br /></div>
<div>
inventMovement = InventMovement::construct(salesLine);</div>
<div>
<br /></div>
<div>
inventDimCriteria = InventDim::find(salesLine.inventDimId);</div>
<div>
inventDimCriteria.inventBatchId = '202023';//número de lote especifico de donde se quiere hacer la reserva</div>
<div>
inventDimCriteria.inventSerialId = '1234512'; //número de serie especifico de donde se quiere hacer la reserva</div>
<div>
<br /></div>
<div>
inventDimParm = inventMovement.initDimParmAutoReserv(inventDimCriteria);</div>
<div>
<br /></div>
<div>
reservation = InventUpd_Reservation::newMovement(inventMovement, -1, false);</div>
<div>
reservation.parmInventDimFixed(InventDimFixedClass::inventDimParm2InventDimFixed(inventDimParm));</div>
<div>
reservation.parmInventDimCriteria(inventDimCriteria);</div>
<div>
reservation.parmInventDimParm(inventDimParm);</div>
<div>
reservation.updateNow();</div>
<div>
<br /></div>
<div>
info("termino");</div>
<br />
<div>
}<br />
<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><a href="http://bit.ly/1ZZXw0I" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Consultas en tablas con ValidTimeState</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><a href="http://bit.ly/1PLUrSw" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; text-decoration: none;">Crear lookup en clase dialog</a><br />
<a href="http://bit.ly/20xVYwZ">Crear búsquedas por nombre de producto en métodos display</a><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-85862463544267238412017-02-01T13:08:00.001-06:002017-02-01T13:08:55.489-06:00Dialogo para seleccionar nombre de archivo FileName<br />
Este es un ejemplo de cómo hacer un job que lance un dialogo y se pueda seleccionar el nombre del archivo.<br />
<br />
<div>
<span>static void DialogFilePath(Args _args)</span></div>
<div>
<span>{</span></div>
<div>
<span> Dialog dialog;</span></div>
<div>
<span> Filename filename;</span></div>
<div>
<span> DialogField dialogFilename;</span></div>
<div>
<span> //Definiendo filtro de ciertos tipos de archivos</span></div>
<div>
<span> container conFilter = ["Microsoft Excel 97-2003 Worksheet (.xls)" ,"*.xlsx"];</span></div>
<div>
<span> //container conFilter = ["Comma Seperated Value .txt ", "*.csv"];</span></div>
<div>
<span> ;</span></div>
<div>
<span><br /></span></div>
<div>
<span> dialog = new dialog();</span></div>
<div>
<span> dialog.caption("Importar archivo");</span></div>
<div>
<span> dialogFilename = dialog.addField(typeId(FilenameOpen));//extendedTypeStr(FilenameOpen)); //extendedTypeStr es para 2012</span></div>
<div>
<span> //Aplicando filtro de archivos</span></div>
<div>
<span> dialog.filenameLookupFilter(conFilter);</span></div>
<div>
<span> dialog.run();</span></div>
<div>
<span><br /></span></div>
<div>
<span> if(dialog.closedOk())</span></div>
<div>
<span> {</span></div>
<div>
<span> filename = dialogFileName.value();</span></div>
<div>
<span> info(filename);</span></div>
<div>
<span> }</span></div>
<br />
<div>
<span>}</span></div>
<div>
<span><br /></span></div>
<div>
<span>Este es el resultado:</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj47qX8olCeRfnAcKInYKjXyFFjE0wFbANufvQdJ-uJ2sLeT8-3VNOIXJ6dZQ8aeBDrDHQe49C6Eg0Rj2WFDpKUbOBK6c9Fi2XlYFb21APaXyZd559W5TFy2G5qA1-vo4aqQWkTzFKN3LCw/s1600/importar+archivo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj47qX8olCeRfnAcKInYKjXyFFjE0wFbANufvQdJ-uJ2sLeT8-3VNOIXJ6dZQ8aeBDrDHQe49C6Eg0Rj2WFDpKUbOBK6c9Fi2XlYFb21APaXyZd559W5TFy2G5qA1-vo4aqQWkTzFKN3LCw/s320/importar+archivo.png" width="320" /></a></div>
<div>
<span><br /></span></div>
<div>
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1QBIBVi" style="color: #7d181e; text-decoration: none;">Crear empleado, alta y baja por código x++</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1pcg6aG" style="color: #7d181e; text-decoration: none;">Escribir XML desde Ax 2012</a></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px;" /><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1RsPzPs" style="color: #7d181e; text-decoration: none;">Listar objetos que pertenecen a un proyecto</a></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="background-color: #fefdfa; color: #351c75; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold;">No olvides que te puedes unir a la página en Facebook </span><a href="https://www.facebook.com/aprendiendodynamicsax" style="background-color: #fefdfa; color: #7d181e; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a><span style="background-color: #fefdfa; color: #351c75; font-family: georgia, "times new roman", serif; font-size: 13px; font-weight: bold;">donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></div>
<div>
<span><br /></span></div>
<div>
<span><br /></span></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-56827132914695455202016-02-26T11:29:00.000-06:002016-02-26T11:29:19.350-06:00Cómo crear un proyecto con todos los elementos de una capa - Microsoft Dynamics Ax 2012Cuando pasamos objetos de un ambiente a otro, es útil saber que existe la posibilidad de crear <u>un proyecto que contenga todos los elementos de una capa</u>, por ejemplo, si solo queremos pasar los objetos creados o modificados de la capa var de nuestro ambiente de desarrollo al ambiente de pruebas pero no queremos pasar proyecto por proyecto.<br />
<br />
<b>1. Crear un proyecto nuevo en el AOT</b>. (Ctrl+P abre la lista de proyectos, eliges si lo quieres Shared o Private, y sobre alguno de esos dos, Ctrl+N para crear el nuevo proyecto).<br />
<b>2.</b> <b>Abres el nuevo proyecto</b> con doble click y eliges el botón de filtro avanzado<br />
<b>3. Elige las opciones</b>, en la ventana que se abre, debes seleccionar si quieres agregar los objetos a tu proyecto o sobreescribir los que ya hay. En este caso como es proyecto nuevo, elegimos "Anexar". También se tiene la opción de "Paquetes" que es cómo queremos que se agrupen los elementos en nuestro proyecto, si elegimos "Ninguno" agrega todos los objetos sin orden y sin agrupaciones; si elegimos "AOT", vamos a ver los objetos agrupados por tipo de una manera similar al AOT; si elegimos "Por usuario", pues eso, los agrupa por usuario que haya creado o modificado el objeto.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBO-CroIHYnOWdPEG8I9yRXfZHOzSUa141D5l3bwvEWY9PNrdH5GIeFlc4vxfjAU8qPKHpMEAhE_IWoNxuZkLGqEgRbVVKgo0NHELmR_HjYoVECCNuFQx2plJpBZWhU0ftu11V9WsGsxmv/s1600/image001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="219" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBO-CroIHYnOWdPEG8I9yRXfZHOzSUa141D5l3bwvEWY9PNrdH5GIeFlc4vxfjAU8qPKHpMEAhE_IWoNxuZkLGqEgRbVVKgo0NHELmR_HjYoVECCNuFQx2plJpBZWhU0ftu11V9WsGsxmv/s320/image001.png" width="320" /></a></div>
<br />
<br />
<b>4.</b> <b>Selecciona la capa</b>. En la misma ventana de las opciones, click en el botón "Seleccionar" para indicar la capa en el filtro "SysModelLayer"<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOXD9fTlalzdxoNXwzMf3MdRfgl8ybXvQ21wm-3ye3pYvanbkTlTrme7WxeVsM7llCKjE-71FC-PqHV9SvHdIOsjoe3uF4zy_x_Fg7NyaHiH69bySSukCMbmFvEP8XnvkUrkyBfxIovs51/s1600/image002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="347" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOXD9fTlalzdxoNXwzMf3MdRfgl8ybXvQ21wm-3ye3pYvanbkTlTrme7WxeVsM7llCKjE-71FC-PqHV9SvHdIOsjoe3uF4zy_x_Fg7NyaHiH69bySSukCMbmFvEP8XnvkUrkyBfxIovs51/s640/image002.png" width="640" /></a></div>
<br />
<br />
Con esto se incluirán todos los objetos de esa capa en nuestro proyecto que creamos.<br />
<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1QBIBVi">Crear empleado, alta y baja por código x++</a></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1pcg6aG">Escribir XML desde Ax 2012</a></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1RsPzPs">Listar objetos que pertenecen a un proyecto</a></span><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><span style="background-color: #fefdfa;"><span style="color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif;"><b><span style="font-size: 13px; line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo.</span></b></span></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, 'times new roman', serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, 'times new roman', serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>
<span style="background-color: #fefdfa; color: #333333; font-family: georgia, 'times new roman', serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;"><br /></span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-90413906574038204962016-02-05T22:03:00.000-06:002016-02-05T22:03:42.933-06:00Lista de remisiones asociadas a una factura por código X++ en Dynamics Ax 2012Este es un post rápido, solo para mostrar cómo consultar las remisiones de una orden de venta asociadas a una factura.<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">Job9(Args _args)</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoicePackingSlipQuantityMatch custInvoicePackingSlipQuantityMatch;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoiceTrans custInvoiceTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustPackingSlipTrans custPackingSlipTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoiceJour custInvoiceJour;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Buscamos la factura por RecId en la tabla CustInvoiceJour</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceJour = custInvoiceJour::findRecId(</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>5637160329</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<br /></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custPackingSlipTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>join</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoicePackingSlipQuantityMatch</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoicePackingSlipQuantityMatch.PackingSlipSourceDocumentLine == custPackingSlipTrans.SourceDocumentLine</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>join</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoiceTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoicePackingSlipQuantityMatch.InvoiceSourceDocumentLine == custInvoiceTrans.SourceDocumentLine &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId</span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//aquí se indica la factura de la que se quiere conocer sus remisiones</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(custPackingSlipTrans.PackingSlipId);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
Nos va a mostrar por cada línea de la factura la remisión a la que pertenece, si viene de alguna remisión.<br />
<br />
Algunos hacen esta relación mediante el InventTransId hacia la tabla InventTrans, peroooo en esa tabla no hay registros cuando se trata de servicios, entonces no sirve ese camino. Otro hacen la relación solo entre CustPackingSlipTrans (líneas de remisiones) y CustInvoiceTrans (líneas de facturas), aquí si estan los servicios, peroooooo si un mismo artículo se remisionó parcial, ya tampoco funciona ese camino porque nos mostraria todas las remisiones donde esta el artículo, se haya facturado o no. Por eso el mejor camino que he encontrado, es mediante la CustInvoicePackingSlipQuantityMatch.<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://bit.ly/20zLwoT" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Lookup para dimensiones financieras personalizadas</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://bit.ly/1ZZXw0I" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Consultas en tablas con ValidTimeState</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://bit.ly/1PLUrSw" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Crear lookup en clase dialog</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;">Y por cierto, acuerdate de darle click a algún anuncio si el post te sirvio de algo.</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: georgia, 'times new roman', serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-1602514563270514442016-01-30T13:00:00.000-06:002016-02-02T09:13:53.649-06:00Lookup para dimensiones financieras de organización - Microsoft Dynamics Ax 2012 R2Sabemos que existen 3 tipos de dimensiones financieras, las de sistema, de organización y las personalizadas. En un post anterior, vimos cómo hacer un lookup para las dimensiones personalizadas y en esta ocasión, les comparto el código para el lookup de las dimensiones de organización, que pueden ser centro de costo, departamento y unidad de negocio.<br />
<br />
Por tanto, si queremos por ejemplo, mostrar en una pantalla de parámetros los valores de cada dimensione de organización para que el usuario pueda seleccionar un valor existente. Lo primero seria agregar nuestros campos a una tabla de parámetros, en este caso, voy agregar estos campos al form de parámetros de ventas y marketing, cada uno extendiendo del dato: DimValue<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uIH5nO5oFlhYUO925c_5KHadYjkKtQo9xxQe0Q1i5fq89cjJF92UNn6lLaYzN1JUNGNaY0h1AN9UePsMQoX5nT-XmetpJ_lKahBatB1F-6AgCu8Pldz2Utf2FS-AsQcOMipeoLTyIMUa/s1600/edt+en+tabla.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8uIH5nO5oFlhYUO925c_5KHadYjkKtQo9xxQe0Q1i5fq89cjJF92UNn6lLaYzN1JUNGNaY0h1AN9UePsMQoX5nT-XmetpJ_lKahBatB1F-6AgCu8Pldz2Utf2FS-AsQcOMipeoLTyIMUa/s320/edt+en+tabla.png" width="320" /></a></div>
<br />
<br />
Posterior a esto, agregaría los campos de esta tabla al formulario de parámetros y sobreescribiria el método el lookup de cada campo.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyjldH6mixvjHF4vFuY8orzEpVkhBjB8owBpRhJeZLXglUIXuLh3pWLPCv6yIs_3RBXYUdMpC_0VIFqdCWcyQXqJWBhBJ3MwFEeGCcDKaIikIsHsTYAdGoeJI7jVImhzHjxT5BaeP2oSiN/s1600/lookup+en+forms.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyjldH6mixvjHF4vFuY8orzEpVkhBjB8owBpRhJeZLXglUIXuLh3pWLPCv6yIs_3RBXYUdMpC_0VIFqdCWcyQXqJWBhBJ3MwFEeGCcDKaIikIsHsTYAdGoeJI7jVImhzHjxT5BaeP2oSiN/s640/lookup+en+forms.png" width="640" /></a></div>
<br />
<br />
<br />
Este método lookup, debe llamar a mi método nuevo en la tabla donde tengo mis campos creados de dimensiones, donde en este método se hace la búsqueda de los valores por cada dimension de organización. Aquí el ejemplo de los tres métodos lookup.<br />
<br />
<b>Centro de costo</b><br />
<span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>public</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>client</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">lookupCentroCosto(FormStringControl _ctrl)</span></span><br />
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> Query query =</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">Query();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> SysTableLookup sysTableLookup;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> QueryBuildDataSource queryBuildDataSource;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup = SysTableLookup::newParameters(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit), _ctrl,</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>true</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmUseLookupValue(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>false</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, Name));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource = query.addDataSource(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addSortField(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldnum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addRange(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitType)).value(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>int2str</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>any2int</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnitType::OMCostCenter)));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmQuery(query);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.performFormLookup();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Departamento</b></div>
<div align="left">
<span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>public</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>client</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">lookupDepartamento(FormStringControl _ctrl)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> Query query =</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">Query();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> SysTableLookup sysTableLookup;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> QueryBuildDataSource queryBuildDataSource;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup = SysTableLookup::newParameters(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit), _ctrl,</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>true</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmUseLookupValue(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>false</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, Name));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource = query.addDataSource(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addSortField(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldnum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addRange(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitType)).value(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>int2str</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>any2int</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnitType::OMDepartment)));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmQuery(query);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.performFormLookup();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b>Unidad de negocio o BusinessUnit</b></div>
<div align="left">
<span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>public</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>client</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">lookupBusinessUnit(FormStringControl _ctrl)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> Query query =</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>new</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">Query();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> SysTableLookup sysTableLookup;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> QueryBuildDataSource queryBuildDataSource;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup = SysTableLookup::newParameters(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit), _ctrl,</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>true</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmUseLookupValue(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>false</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.addLookupfield(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, Name));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource = query.addDataSource(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>tableNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addSortField(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldnum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitNumber));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> queryBuildDataSource.addRange(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnit, OMOperatingUnitType)).value(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>int2str</b></span></span> <span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>any2int</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(OMOperatingUnitType::OMBusinessUnit)));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.parmQuery(query);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> sysTableLookup.performFormLookup();</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
<br />
Post relacionados:<br />
<a href="http://bit.ly/20zLwoT">Lookup para dimensiones financieras personalizadas</a><br />
<a href="http://bit.ly/1ZZXw0I">Consultas en tablas con ValidTimeState</a><br />
<a href="http://bit.ly/1PLUrSw">Crear lookup en clase dialog</a><br />
<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;">Y por cierto, acuerdate de darle click a algún anuncio si el post te sirvio de algo.</span><br />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13px; font-weight: bold; line-height: 18.2px;" />
<span style="background-color: #fefdfa; font-family: "georgia" , "times new roman" , serif; font-size: 13px; font-weight: bold; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com2tag:blogger.com,1999:blog-5375453959354837696.post-84101114757631892152016-01-29T10:58:00.000-06:002016-01-29T11:00:11.154-06:00Crear búsquedas sobre nombre de producto cambiando métodos display en Dynamics Ax 2012A veces es necesario hacer búsquedas por nombre de producto en los formularios de Ax, y nos topamos con que este campo en el formulario, es un método display, para esto, aquí un ejemplo de la modificación del formulario en una de las pantallas mas comunes, que es la de Disponible, que esta en Administración del inventario -> Consultas -> Disponible para realizar búsquedas por nombre.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrNJCWDjvNhhbuQA5C0WatekOGXFJrh6ViG6fC14035Q8wWkSmPLlNGQNcu5P5Vtu6Zjsc4-iUVVgvNW_0gmgpuJo3t4vD4TERUB-Ic7XHvYWgCEOYSr5WOf7jT3oPhZRWbj1RhGEyHxTy/s1600/formulario+de+disponible+ax.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrNJCWDjvNhhbuQA5C0WatekOGXFJrh6ViG6fC14035Q8wWkSmPLlNGQNcu5P5Vtu6Zjsc4-iUVVgvNW_0gmgpuJo3t4vD4TERUB-Ic7XHvYWgCEOYSr5WOf7jT3oPhZRWbj1RhGEyHxTy/s400/formulario+de+disponible+ax.png" width="400" /></a></div>
<br />
Si nosotros solo agregamos la tabla EcoResProduct relacionada a InventTable y EcoResProductTranslation que es la tabla que contiene los nombres de productos relacionada a EcoResProduct en nuestro formulario, el campo de nombre de producto que agreguemos al formulario aparecerá vacío, esto se debe a que esta tabla necesita el idioma para la relación y para saber en qué idioma debe mostrar el nombre de producto.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_aFEg1nsGLmkr3IJsF6qGqb32ADgkVl8lRQS8mY6uLiigiKMtacz2cnavC4iwgEgmftlbJs1GjojZC0n5c-GkZMfXp40sxAJc616s4qEe8f5j5ubK2sAiMPsP_3Y5_fF1NsIyKnyxqZ2_/s1600/campo+vacio+de+nombre+de+producto.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="187" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_aFEg1nsGLmkr3IJsF6qGqb32ADgkVl8lRQS8mY6uLiigiKMtacz2cnavC4iwgEgmftlbJs1GjojZC0n5c-GkZMfXp40sxAJc616s4qEe8f5j5ubK2sAiMPsP_3Y5_fF1NsIyKnyxqZ2_/s400/campo+vacio+de+nombre+de+producto.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Lo que se necesita hacer es:</div>
<div class="separator" style="clear: both; text-align: left;">
Tener las relaciones en las tablas EcoResProduct (a InventTable) y en EcoResProductTranslation (a EcoResProduct).</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbWqoJO9x6VpmkJtBI-0gLx0_qPKf-g9gkQn1c3FPwEgP52kxNnJfpgq-SLS0DGOpDbxNjuhDIzHHkazH9LqlotN711GlYCcaw-B7Jj7qNCMcijxyMHYqHFsXufO57Ns1bDggg5Swq_4xM/s1600/relacion+ecoResProuduct.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbWqoJO9x6VpmkJtBI-0gLx0_qPKf-g9gkQn1c3FPwEgP52kxNnJfpgq-SLS0DGOpDbxNjuhDIzHHkazH9LqlotN711GlYCcaw-B7Jj7qNCMcijxyMHYqHFsXufO57Ns1bDggg5Swq_4xM/s320/relacion+ecoResProuduct.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCIU5VI4fGFdMQHqY29BTIjgINVf9silCeFrdGM9ADUrKjZTE2V-P8j3iU0xNYi51RhorOKTo_G4j1P-je0rG_i33-3gYpAH7DVmHpwiM8GmFOXFPECPH5oubofwT0VaadcbJk3bgGUAuy/s1600/relacion+ecoResProuductTranslation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCIU5VI4fGFdMQHqY29BTIjgINVf9silCeFrdGM9ADUrKjZTE2V-P8j3iU0xNYi51RhorOKTo_G4j1P-je0rG_i33-3gYpAH7DVmHpwiM8GmFOXFPECPH5oubofwT0VaadcbJk3bgGUAuy/s320/relacion+ecoResProuductTranslation.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Después modificar la clase que tiene el comportamiento del formulario, en este caso es InventDimCtrl_Frm_OnHand y en el método modifyQuery agregar nuestro datasource como parámetro, en este caso nuestra tabla EcoresProductTranslation que es la tabla que necesita la relación y crear una variable de tipo QueryBuildDataSource que nos va a servir para realizar el filtro para mandar el idioma a la tabla EcoResProductTranslation.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2my0axpyA-4FD9jAbwsXwbmmivZe0rX4KlImmfj9ztBlPQToeuiROXseZyd6Kz_V7oL9zdJthcxA2-s61Xvg0cY6Aa2JJkXaaTdOb2RK2f0jklm6yJlOsZVg0OubpR5zIx8WoL5Zsslj1/s1600/clase+inventdimctrl+onhand.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2my0axpyA-4FD9jAbwsXwbmmivZe0rX4KlImmfj9ztBlPQToeuiROXseZyd6Kz_V7oL9zdJthcxA2-s61Xvg0cY6Aa2JJkXaaTdOb2RK2f0jklm6yJlOsZVg0OubpR5zIx8WoL5Zsslj1/s640/clase+inventdimctrl+onhand.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Al final de este método es donde realizamos el filtro a nuestra tabla pasandole el lenguaje de la compañia.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTj86Gula1kDsxQcm2ehMtf5YfzRV44oUNyLd7s6_jZbWuNylR_EJsjFIwknPT5pVxToS3x2jRSqAD_MTwC7Em7ABo9n_HhDdEg46xiBe8xWnpYGvZg_FnXt90939k2I-bHI5R_JH3Q-IX/s1600/filtro+por+compania.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="187" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTj86Gula1kDsxQcm2ehMtf5YfzRV44oUNyLd7s6_jZbWuNylR_EJsjFIwknPT5pVxToS3x2jRSqAD_MTwC7Em7ABo9n_HhDdEg46xiBe8xWnpYGvZg_FnXt90939k2I-bHI5R_JH3Q-IX/s400/filtro+por+compania.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div align="left">
<span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>if</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(_ecoResProductTranslation)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> qbsInventLookup = query.dataSourceName(_ecoResProductTranslation.name());</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> qbr = SysQuery::findOrCreateRange(qbsInventLookup,</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldnum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(EcoResProductTranslation, LanguageId));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> qbr.value(queryValue(CompanyInfo::languageId()));</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> qbsInventLookup.addGroupByField(</span></span> <span style="color: darkblue; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><b>fieldNum</b></span></span><span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;">(EcoResProductTranslation,Name));</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: "consolas"; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
Modificamos la llamada a este método, que es dentro del formulario, en el datasource de InventSum, en el método executeQuery</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyuOJW0CESGBx3eBHigQNGmlBnrmca2ZKFV3OnOrYJytiiBd9uCucOCaw0-8iHyj2dqvQDUF6DPO1klMi9TSRPUmpRZvV_Ggy8ytqEP81FMANKv2_o_zGjeYcRIKYc5wPtN4gbkRJzVfIY/s1600/executeQuery+de+InventSum.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyuOJW0CESGBx3eBHigQNGmlBnrmca2ZKFV3OnOrYJytiiBd9uCucOCaw0-8iHyj2dqvQDUF6DPO1klMi9TSRPUmpRZvV_Ggy8ytqEP81FMANKv2_o_zGjeYcRIKYc5wPtN4gbkRJzVfIY/s640/executeQuery+de+InventSum.png" width="640" /></a></div>
<br />
Finalmente arrastramos el campo Name de la tabla EcoResProductTranslation a nuestro grid y abrimos el formulario. Con esto ya podemos hacer búsquedas por nombre de producto.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizf5PyaAD1ewzwIKW2ldTWUdeJmu8n9iCapirm3MeoZNv1B1vvpUvokyCOen1EjgZvGDyRH3ZjZNGGkYEvML_KF-p1insqkhOH852rFLv19G4PmzvByxQj0YjuZV-9kr1uFd7gDA41YJnM/s1600/Campo+nombre+de+ecoresproducttranslation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizf5PyaAD1ewzwIKW2ldTWUdeJmu8n9iCapirm3MeoZNv1B1vvpUvokyCOen1EjgZvGDyRH3ZjZNGGkYEvML_KF-p1insqkhOH852rFLv19G4PmzvByxQj0YjuZV-9kr1uFd7gDA41YJnM/s320/Campo+nombre+de+ecoresproducttranslation.png" width="294" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEievA5S3D9ddzNu5SgdjehCTwRbwjTliyZ7m39PlcjPM4X6T9qR8ziciYzR0O5ZL6IqYHLcIJG4rrOWhtcce-Hq_XXZtDulGXyahjq9hnFJzmuwSrFfDLA3wsMYNxeFtyTT1hRQItld18kC/s1600/busqueda+por+nombre+habilitada.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="132" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEievA5S3D9ddzNu5SgdjehCTwRbwjTliyZ7m39PlcjPM4X6T9qR8ziciYzR0O5ZL6IqYHLcIJG4rrOWhtcce-Hq_XXZtDulGXyahjq9hnFJzmuwSrFfDLA3wsMYNxeFtyTT1hRQItld18kC/s400/busqueda+por+nombre+habilitada.png" width="400" /></a></div>
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: "arial" , "tahoma" , "helvetica" , "freesans" , sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br />
<a href="http://aprendiendodynamicsax.blogspot.mx/2012/11/reportes-sql-reporting-services-ssrs-en.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;"><b>Reportes SQL Reporting services (SSRS) en Microsoft Dynamics Ax 2012</b></a><br />
<b><a href="http://aprendiendodynamicsax.blogspot.mx/2014/10/multiselect-de-grid-en-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Multiselect de grid en Ax 2012</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2014/10/crear-lookup-en-clase-dialog-en-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Crear lookup en clase dialog</a></b><br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo.</span><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><span style="font-family: "georgia" , "times new roman" , serif; line-height: 18.2px;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b><br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com2tag:blogger.com,1999:blog-5375453959354837696.post-14519447683863244132016-01-17T00:38:00.000-06:002016-01-17T00:38:58.507-06:00Calcular impuestos en ordenes de venta por código X++ en Dynamics Ax 2012 R3En este post se muestra cómo calcular los impuestos de una orden de venta para los casos:<br />
<br />
<ol>
<li>cuando ya fue facturada</li>
<li>cuando no ha sido facturada</li>
<li>por línea de venta con base en código de impuestos</li>
<li>por remisión por código de impuestos en artículo</li>
<li>por remisión por tipo de impuesto</li>
</ol>
<br />
<br />
<b><span style="font-size: large;">1.</span></b> Para calcular impuestos de las líneas de una factura debemos buscarlos en la tabla TaxTrans, tanto para factura de productos como para facturas de servicios.<br />
<br />
<div align="left">
<span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">impuestosEnFactura(Args _args)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxTrans taxTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoiceJour custInvoiceJour;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustInvoiceTrans custInvoiceTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//RecId del diario de factura </i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceJour = custInvoiceJour::findRecId(</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>5637149082</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Tomando en cuenta los campos por los que se relacionan las líneas</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//con el diario</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoiceTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceTrans.SalesId == custInvoiceJour.SalesId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceTrans.InvoiceDate == custInvoiceJour.InvoiceDate &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custInvoiceTrans.numberSequenceGroup == custInvoiceJour.numberSequenceGroup</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxTrans.InventTransId == custInvoiceTrans.InventTransId</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//El campo TaxAmount es el importe del impuesto,</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//el campo TaxValue es el porcentaje de impuesto</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"Impuesto de línea: %1"</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, taxTrans.TaxAmount));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
<span style="font-size: large;"><b>2.</b></span> Cuando la orden de venta no ha sido facturada y por consiguiente, no se han registrado los impuestos en la tabla TaxTrans, podemos auxilarnos de la clase SalesTotals, el ejemplo en código seria:<br />
<br />
<div align="left">
<span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">impuestosPorOrdenVenta(Args _args)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TmpTaxWorkTrans tmpTax;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesTable salesTable;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesTotals salesTotals;</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTable = SalesTable::find(</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'000735'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">); </span></span><i style="color: green; font-family: Consolas; font-size: 10.6667px;">//Id de orden de venta</i></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Se usa la clase SalesTotals para calcular impuestos</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Esta clase es la que llena el formulario de Totales en una</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//orden de venta</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTotals = SalesTotals::construct(salesTable);</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Calcula el impuesto</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTotals.calc();</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Carga la tabla tmpTaxWorkTrans con los impuestos calculador</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> tmpTax.setTmpData(salesTotals.tax().tmpTaxWorkTrans());</span></span></div>
<div align="left">
</div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Mostramos el monto del impuesto(TaxAmount) y el porcentaje(TaxValue)</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">tmpTax</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Porcentaje aplicado: %1, Monto: %2'</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, tmpTax.showTaxValue(), tmpTax.TaxAmount));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span><br />
<br /></div>
En caso de que únicamente se requiera el cálculo de impuestos por ciertas líneas de la orden de venta y con base en ciertas cantidades, como puede ser el caso de únicamente calcular los impuestos por una remisión parcial, se deben hacer los cálculos para dividir ese impuesto total por línea entre la cantidad entregada de la remisión (campo Qty).<br />
<br />
<b><span style="font-size: large;">3.</span></b> También es posible calcular los impuestos por artículo de acuerdo al grupo de impuestos de los artículos y a las cantidades vendidas o entregadas. Un ejemplo se muestra en el código siguiente:<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">impuestosPorTipoImpuesto(Args _args)</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxOnItem taxOnItem;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxGroupData taxGroupData;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>real</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> taxAmount;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxValue taxValue;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesLine salesLine;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesTable salesTable;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTable = SalesTable::find(</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'000754'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">salesLine</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">salesLine.SalesId == salesTable.SalesId</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>if</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(salesLine.TaxItemGroup && salesLine.TaxGroup && salesLine.LineAmount !=</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>0</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxOnItem</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxOnItem.TaxItemGroup == salesline.TaxItemGroup</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxGroupData</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxGroupData.TaxGroup == salesline.TaxGroup</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> && taxGroupData.TaxCode == taxOnItem.TaxCode</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxValue = TaxData::find(taxOnItem.TaxCode,</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>Systemdateget</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(),</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>0</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">).TaxValue;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxAmount = (salesline.LineAmount * TaxValue) /</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>100</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Porcentaje aplicado: %1, Monto: %2'</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, TaxValue, TaxAmount));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
<b><span style="font-size: large;">4. </span></b>Para el caso de calcular los impuestos de una remisión, el código quedaría como sigue:<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">impuestosPorTipoImpuestoRemision(Args _args)</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxOnItem taxOnItem;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxGroupData taxGroupData;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>real</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> taxAmount;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxValue taxValue;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesLine salesLine;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//SalesTable salesTable;</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> Amount montoRealDeLinea;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustPackingSlipJour custPackingSlipJour;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustPackingSlipTrans custPackingSlipTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//RecId del diario de remisión</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipJour = CustPackingSlipJour::findRecId(</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>35637161119</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Buscando las líneas de la remisión de acuerdo a la relación física de las tablas</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custPackingSlipTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custPackingSlipTrans.PackingSlipId == custPackingSlipJour.PackingSlipId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipTrans.SalesId == custPackingSlipJour.SalesId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipTrans.DeliveryDate == custPackingSlipJour.DeliveryDate</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesLine = custPackingSlipTrans.salesLine();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>if</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(salesLine.TaxItemGroup && salesLine.TaxGroup && salesLine.LineAmount !=</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>0</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">&& custPackingSlipTrans.Qty !=</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>0</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxOnItem</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxOnItem.TaxItemGroup == salesline.TaxItemGroup</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxGroupData</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">taxGroupData.TaxGroup == salesline.TaxGroup</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> && taxGroupData.TaxCode == taxOnItem.TaxCode</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxValue = TaxData::find(taxOnItem.TaxCode,</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>Systemdateget</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(),</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>0</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">).TaxValue;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Para el cálculo del impuesto por línea es necesario conocer el monto al</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//que le vamos a aplicar el impuesto, en este caso es el precio unitario de</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//la línea de venta por la cantidad de la remisión</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> montoRealDeLinea = salesline.SalesPrice * custPackingSlipTrans.Qty;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxAmount = (montoRealDeLinea * TaxValue) /</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>100</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Porcentaje aplicado: %1, Monto: %2'</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, TaxValue, TaxAmount));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<b><span style="font-size: large;">5.</span></b> Calculando los impuestos de una remisión por tipo de impuesto<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">impuestosPorOrdenVentaTipoImpuesto(Args _args)</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TmpTaxWorkTrans tmpTax;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> SalesTotals salesTotals;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustPackingSlipJour custPackingSlipJour;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustPackingSlipTrans custPackingSlipTrans;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> TaxAmount impuestoAvCast;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//RecId del diario de remisión</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipJour = CustPackingSlipJour::findRecId(</span></span> <span style="color: red; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>35637161119</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTotals = SalesTotals::construct(custPackingSlipJour.salesTable());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> salesTotals.calc();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> tmpTax.setTmpData(salesTotals.tax().tmpTaxWorkTrans());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Por cada custPackingSlipTrans calculando el ieps</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custPackingSlipTrans</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">custPackingSlipTrans.PackingSlipId == custPackingSlipJour.PackingSlipId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipTrans.SalesId == custPackingSlipJour.SalesId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custPackingSlipTrans.DeliveryDate == custPackingSlipJour.DeliveryDate</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>while</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">tmpTax</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">tmpTax.InventTransId == custPackingSlipTrans.InventTransId &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> tmpTax.TaxCode ==</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"AV_CAST"</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//solo avcast, por línea de remisión, el resultado lo manda negativo</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> impuestoAvCast = tmpTax.TaxAmount/custPackingSlipTrans.Qty;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"ieps: %1"</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, impuestoAvCast));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
Finalmente también tenemos otra opción usando la clase Tax, como se muestra en el post de "<a href="http://bit.ly/237xJbo">Calcular los impuestos de una línea de venta o de compra por código X++ en AX 2012</a>".<br />
<br />
<br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2012/11/reportes-sql-reporting-services-ssrs-en.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><b>Reportes SQL Reporting services (SSRS) en Microsoft Dynamics Ax 2012</b></a><br />
<a href="http://bit.ly/1Rl8tXI"><b>Saldo de cuenta contable por dimension</b></a><br style="background-color: #fefdfa;" /><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1GFICJu" style="color: #7d181e; text-decoration: none;">Saldo de cuenta contable</a></b><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo.</span><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b><br />
<br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0tag:blogger.com,1999:blog-5375453959354837696.post-49894469315856161322015-12-29T22:33:00.000-06:002015-12-29T22:33:28.609-06:00Reportes SSRS en distintos idiomas en Dynamics Ax 2012Cuando se trabaja con reportes en Ax, existe la posibilidad de que para clientes internacionales sea requerido que los documentos como facturas, remisiones o reportes personalizados se envíen en el idioma del cliente o proveedor, para este objetivo, Ax tiene en la configuración de clientes y proveedores una opción de idioma, que de acuerdo a la <a href="https://technet.microsoft.com/en-us/library/aa590606.aspx?f=255&MSPPError=-2147217396" target="_blank">documentación oficial de Microsoft</a> con solo cambiar el campo de idioma esto debería bastar para presentar facturas, remisiones y algunos otros reportes estándar en el idioma elegido, siempre y cuando existan las etiquetas del sistema.<br />
<br />
<div style="text-align: center;">
<img border="0" height="64" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4RcXTwvQ1PK_PZ8VmUZ1rvML3qeCS95HzA9go0ugo7gEII9dE8rxmc1OPkIFwQFiXiScHgozqh4DxDybcfNkF8XGDYTKL2AR0-Meoxl0IlDWgZE0LFAlea152ZCfKKlTLz8EqExzWh_Fd/s640/idioma+en+clientes.png" width="640" /></div>
<br />
Pero al parecer esto no funciona como debería, así que debemos hacer un ajuste para mandar el parámetro del idioma a nuestro reporte desde la clase controller.<br />
<br />
En este ejemplo se ilustra el proceso para dos escenarios, un reporte estándar y un reporte personalizado.<br />
<br />
<b>Reporte personalizado</b><br />
<br />
Si ya tenemos nuestro diseño de reporte creado en visual studio, necesitamos asegurarnos que usemos etiquetas de Ax que tengan traducción en los distintos idiomas que requerimos los reportes.<br />
<br />
Por ejemplo, en Visual Studio, el campo debería tener algo como esto:<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqWAdCefoWapqRXjvbV50Qpt-h8UPrwOKEteBdQleZH6x9_WrRiMZAs_hNMqD1WtkvFBWggRfBW7Hx-75e85AjEwvgF4PqkJWM1UN8f_Kr9dFdDjthx5hjepvf_g8nQJpdo9uZIn15pw3P/s1600/vs+1.png" imageanchor="1"><img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqWAdCefoWapqRXjvbV50Qpt-h8UPrwOKEteBdQleZH6x9_WrRiMZAs_hNMqD1WtkvFBWggRfBW7Hx-75e85AjEwvgF4PqkJWM1UN8f_Kr9dFdDjthx5hjepvf_g8nQJpdo9uZIn15pw3P/s400/vs+1.png" width="400" /></a></div>
<br />
Y si buscamos ese identificador de etiqueta en Ax (MorphX, Herramientas > Etiquetas > Editor de etiquetas), podremos verificar en cada idioma qué es lo que se mostrara.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK0S-vbEz-F7wCCiuCmnK3c81082D366rI-ZK1ExsCJtXrna3QZxgsrzjBOodJBcw1lQF6klZyJYn_ZLQBAPGgq-i6POEdmwClUFPeUVtOeYz6ZQLEL76CYTG2RGy6PMGA4mudNHYqloHo/s1600/editor+de+etiquetas.png" imageanchor="1"><img border="0" height="289" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK0S-vbEz-F7wCCiuCmnK3c81082D366rI-ZK1ExsCJtXrna3QZxgsrzjBOodJBcw1lQF6klZyJYn_ZLQBAPGgq-i6POEdmwClUFPeUVtOeYz6ZQLEL76CYTG2RGy6PMGA4mudNHYqloHo/s320/editor+de+etiquetas.png" width="320" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV1SM89j37jYXlXbHv5xWX4xKdTYsNubFgz9BZ5jCBOKtaIVYj77kxUXGn7zIBTaVA3Htwd_M67gt4c3xndQhi_xMuGZUtNo73TMhavuw9686s3FFa1ElmtWKXFCSDZR__ZlGuHW31nkmb/s1600/etiqueta+espa%25C3%25B1ol.png" imageanchor="1"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNo_EAiSPux2Uw401Mcv24MtYoMIjvxmtagdvIrxaLvLLQWysPw3a1RAUOGbHYCKBpm8vEmZw322m9db59AjbGDLjdMapGcD941eietbrLRMgUaYvEojygZgSdWg64SFz3J_8GN0j1SdQJ/s1600/etiqueta+ingles.png" imageanchor="1"><img border="0" height="134" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNo_EAiSPux2Uw401Mcv24MtYoMIjvxmtagdvIrxaLvLLQWysPw3a1RAUOGbHYCKBpm8vEmZw322m9db59AjbGDLjdMapGcD941eietbrLRMgUaYvEojygZgSdWg64SFz3J_8GN0j1SdQJ/s320/etiqueta+ingles.png" width="320" /></a> <img border="0" height="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV1SM89j37jYXlXbHv5xWX4xKdTYsNubFgz9BZ5jCBOKtaIVYj77kxUXGn7zIBTaVA3Htwd_M67gt4c3xndQhi_xMuGZUtNo73TMhavuw9686s3FFa1ElmtWKXFCSDZR__ZlGuHW31nkmb/s320/etiqueta+espa%25C3%25B1ol.png" width="320" /><br />
<br />
Ahora lo importante, en nuestra clase controller, debemos pasar el idioma en cuál queremos que se muestre el reporte, para este ejemplo, el idioma lo estoy tomando de la configuración del cliente, así que primero busco el idioma del cliente y después en el método preRunModifyContract, incluyo la línea:<br />
<br />
this.parmReportContract().parmRdlContract().parmLanguageId(dirParty.parmLanguageId());<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimfeyBqlmzUIw3G_UXedI06QNNGAhP2C95Ynvyh5_KMF_gdPyf04r0Qj0rSrZX9gknS_TIVnU-2LPq9VWAx48WxeTQeIOtjLAETu66Vah2GuL0VLQCXa4hhRyXSjTj49SAGb6_smiKxI2G/s1600/codigo+lenguaje+cliente.png" imageanchor="1"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimfeyBqlmzUIw3G_UXedI06QNNGAhP2C95Ynvyh5_KMF_gdPyf04r0Qj0rSrZX9gknS_TIVnU-2LPq9VWAx48WxeTQeIOtjLAETu66Vah2GuL0VLQCXa4hhRyXSjTj49SAGb6_smiKxI2G/s400/codigo+lenguaje+cliente.png" width="400" /></a></div>
<br />
Con esto, el reporte cuando se lance, mostrará las etiquetas en el idioma que se haya seleccionado.<br />
<br />
<br />
<b>Reporte estándar</b><br />
<br />
Para el caso de clientes, el campo "Idioma" esta en la sección "General" del módulo "Cuentas por cobrar > Común > Clientes", este campo va a indicar el idioma en que los documentos relacionados a ese cliente se van a mostrar. Para este caso, necesitamos que el idioma sea inglés solo para ese cliente.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4RcXTwvQ1PK_PZ8VmUZ1rvML3qeCS95HzA9go0ugo7gEII9dE8rxmc1OPkIFwQFiXiScHgozqh4DxDybcfNkF8XGDYTKL2AR0-Meoxl0IlDWgZE0LFAlea152ZCfKKlTLz8EqExzWh_Fd/s1600/idioma+en+clientes.png" imageanchor="1"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCwyNzyyEmraV7_K-XL968yhfjL0EzprMrhTvoMxBYiTONmHZiNHsaUWTuuoNXVCIwVnB0nxtz0aj1E6DceBpdWIff9lw7gyxLumg9RcZZhHtFBoCtH2AYl3QBUobd8Xd2AM6b_hNDO6sU/s1600/configuracion+en+cliente+idioma.png" imageanchor="1"><img border="0" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCwyNzyyEmraV7_K-XL968yhfjL0EzprMrhTvoMxBYiTONmHZiNHsaUWTuuoNXVCIwVnB0nxtz0aj1E6DceBpdWIff9lw7gyxLumg9RcZZhHtFBoCtH2AYl3QBUobd8Xd2AM6b_hNDO6sU/s400/configuracion+en+cliente+idioma.png" width="400" /></a><br />
<br />
En la clase controller de factura electrónica por ejemplo, tendríamos que agregar las líneas para buscar el idioma del cliente y posterior a eso, mandar en un método parm del contract, el idioma del cliente<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhWzX_qK19fCzELe9G93iQBV8-Dj6VgG5Fe9IMs5mEViAV72vkoxI89KEnviknmdjZt_5HofwkWNMlXtRK-8nXloptqf3v0Cu-AuTz7NHpDqlDXKisV7ELcIXZZZdQfMDIfGcpYPDsYg6K/s1600/controller+sales.png" imageanchor="1"><img border="0" height="324" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhWzX_qK19fCzELe9G93iQBV8-Dj6VgG5Fe9IMs5mEViAV72vkoxI89KEnviknmdjZt_5HofwkWNMlXtRK-8nXloptqf3v0Cu-AuTz7NHpDqlDXKisV7ELcIXZZZdQfMDIfGcpYPDsYg6K/s640/controller+sales.png" width="640" /></a><br />
<br />
Con este parámetro, cuando se ejecute el reporte de factura, Ax envía el idioma en el que se desea que se muestren las etiquetas, y de esta forma, todas las etiquetas que tengan traducción en el idioma seleccionado serán mostradas en el reporte.<br />
<br />
<br />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post relacionados:</span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2012/11/reportes-sql-reporting-services-ssrs-en.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Reportes SQL Reporting services (SSRS) en Microsoft Dynamics Ax 2012</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2012/11/filtrar-reportes-en-dynamics-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Filtrar reportes en Dynamics Ax 2012 SSRS basado en query con un parámetro especifico</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2013/12/reportes-ssrs-en-dynamics-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Reportes SSRS en Dynamics Ax 2012 basados en RDP (Report data provider)</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2014/09/crear-reportes-ssrs-usando-rdp-report.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Crear reportes SSRS usando RDP (Report Data Provider) con clase controladora en Dynamics Ax 2012</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo.</span><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><br style="line-height: 18.2px;" /><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b><br />
<br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com1tag:blogger.com,1999:blog-5375453959354837696.post-66952459582451243482015-11-01T00:37:00.002-06:002016-01-17T00:45:10.087-06:00Saldo de cuenta contable por dimensión por código en Dynamics Ax 2012<br />
Anteriormente había publicado cómo consultar el saldo de una cuenta que funciona tanto para cuentas normales como para totalizadoras, en esta ocasión el código a continuación sirve para calcular el saldo de una cuenta con una dimensión especifica hasta una fecha definida haciendo uso de la clase LedgerBalanceDimAttrValueAmounts.<br />
<br />
El método requiere como parámetro la cuenta de la que se requiere el saldo, la dimensión que en este caso es una dimensión de sucursal y la fecha hasta donde se requiere el saldo.<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>private</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">AmountMST saldoCuentaSucursalAx(</span></span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>str</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">_cuenta,</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>str</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">_sucursal,</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>date</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">_fechaHasta)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> LedgerBalanceDimAttrValueAmounts balance;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> MainAccountListPageBalanceParameters balanceParaemeters;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> MainAccount mainAccount;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DimensionAttributeValue dimensionAttributeValue;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DimensionAttribute dimensionAttribute,</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dimensionAttributeSucursal;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> mainAccount = mainAccount::findByMainAccountId(_cuenta);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balanceParaemeters = MainAccountListPageBalanceParameters::construct();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance = LedgerBalanceDimAttrValueAmounts::construct();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dimensionAttribute = DimensionAttribute::findByName(</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"MainAccount"</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dimensionAttributeValue = dimensionAttributeValue::findByDimensionAttributeAndEntityInst(dimensionAttribute.RecId, mainAccount.RecId);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmAccountingDateRange(balanceParaemeters.getStartDate(), _fechaHasta);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmPostingLayer(balanceParaemeters.getPostingLayer());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmIncludeOpeningPeriod(balanceParaemeters.getIncludeOperatingPeriods());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmIncludeRegularPeriod(balanceParaemeters.getIncludeOperatingPeriods());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmIncludeClosingPeriod(balanceParaemeters.getIncludeClosingPeriods());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.parmIncludeClosingPeriodBySystem(balanceParaemeters.getIncludeClosingPeriods());</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dimensionAttributeSucursal = DimensionAttribute::findByName(</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"Sucursal"</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.addDimAttrValue(dimensionAttributeSucursal.Recid, _sucursal);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> balance.calculateBalance(dimensionAttributeValue);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>return</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">balance.getAccountingCurrencyBalance();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<br />
<br />
<br />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post que podrían interesarte:</b><br />
<b><a href="http://bit.ly/1GFICJu">Saldo de cuenta contable</a></b><br />
<span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span style="background-color: #fefdfa; font-size: 13px; line-height: 18.2px;"><b><a href="http://bit.ly/1RGo9Vn">Saldo de cuenta contable por grupo de artículos</a></b></span></span><br />
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" />
<br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo. O comenta si quieres saber sobre algún tema en específico.</span></b><br />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;"><br /></span></span></b><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"></span><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b><br />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;"><br /></span></span></b>Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com2tag:blogger.com,1999:blog-5375453959354837696.post-41081188988800824682015-10-27T09:25:00.001-06:002015-10-27T09:25:46.563-06:00Particiones en Dynamics Ax 2012 R2Para dynamics Ax R2 y R3 existe un termino llamado particiones, estas particiones nos permiten compartir información entre empresas que pertenezcan a la misma partición y aislar estos datos del resto de las particiones.<br />
<br />
Estas particiones a nivel usuario podemos verlas desde <i>Administración del sistema > Configurar > Particiones.</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyioJdfCwQWH-U-YHyj5FsNdDJyvljwHzy86XxFeud9QDLASeelFDbNm2XTHpJ_W2y_OaXKbI9hsV6vZpwO91f-bCAideY5EFG4ibxvQx0HrLyVb0jncwOHHOXIG4LqkkrQ0Hfj99Xqt7d/s1600/acceso+particion+ax.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="215" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyioJdfCwQWH-U-YHyj5FsNdDJyvljwHzy86XxFeud9QDLASeelFDbNm2XTHpJ_W2y_OaXKbI9hsV6vZpwO91f-bCAideY5EFG4ibxvQx0HrLyVb0jncwOHHOXIG4LqkkrQ0Hfj99Xqt7d/s400/acceso+particion+ax.jpg" width="400" /></a></div>
<br />
Nosotros como desarrolladores, lo que debemos saber acerca de las particiones es que con una sentencia de consulta de datos sobre ax no podemos accesar a los datos de otra compañia que se encuentre en distinta partición aunque sea la misma instalación de Ax y la misma base de datos, si alguna vez necesitamos datos de distintas particiones esto debería realizarse por SQL. O si es necesario hacerlo desde ax, <a href="https://msdn.microsoft.com/EN-US/library/jj129502.aspx" target="_blank">aquí un link</a> de cómo realizar una consulta.<br />
<br />
En Ax, cada clave y nombre de partición esta almacenada con un identificador. Este identificador es un campo llamado RecId en una tabla y que no es otra cosa que un Int64. Con este identificador Ax guarda el identificador de la partición en todos los registros de todas las tablas para saber a cuál partición pertenece el registro que se ha insertado en la tabla.<br />
<br />
Una descripción gráfica de cómo es posible dividir las particiones se encuentra en el siguiente diagrama:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoTYh3ZVY16xyBvdwAhkHT3QH1YY3CTNIAiTvaa3cQDbOIHtj4edv3KjamK9UnPK1IIkUtljbtvAb1IxHWAdDMiFPtCo-S1m9uj8wbidS952IuVe0VHfZ6ScmHogy961kkCOeVAqudJLLi/s1600/arquitectura+particiones+ax.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoTYh3ZVY16xyBvdwAhkHT3QH1YY3CTNIAiTvaa3cQDbOIHtj4edv3KjamK9UnPK1IIkUtljbtvAb1IxHWAdDMiFPtCo-S1m9uj8wbidS952IuVe0VHfZ6ScmHogy961kkCOeVAqudJLLi/s400/arquitectura+particiones+ax.jpg" width="400" /></a></div>
<br />
De acuerdo al diagrama, los usuarios de una compañia A tienen cierta configuración de acceso y no podrian entrar a la compañia Z una vez que ya iniciaron Ax. Aunque de otra forma, los usuarios de la compañia A comparten datos de los productos que se comercializan con la compañia B.<br />
<br />
Si necesitas saber mas acerca de la arquitectura, <a href="https://msdn.microsoft.com/EN-US/library/jj728665.aspx" target="_blank">link de Microsoft</a>.<br />
<br />
<br />
<b style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;">Post que podrían interesarte:</b><br />
<b style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><a href="http://bit.ly/1Gvp7DB">Menu de tutorial de desarrollo</a></b><br />
<a href="http://bit.ly/1S7GLyd">Reportes SSRS en Ax</a><br />
<b style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><br /></b>
<br />
<br />
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo. O comenta si quieres saber sobre algún tema en específico.</span></b><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;"><br /></span></span></b><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"></span><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b><br />
<br />
<br />
<br />
<br />Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com1tag:blogger.com,1999:blog-5375453959354837696.post-85635308744863963222015-10-22T07:30:00.000-05:002015-10-22T07:30:01.201-05:00Actualizar información de direcciones en clientes por código X++ en Dynamics Ax 2012En el post anterior les compartí un código para crear clientes ya sean personas o empresas con su dirección e información de contacto, aquí les comparto cómo actualizar estos datos. Espero les sea de utilidad.<br />
<br />
<div align="left">
<span><span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>static</b></span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>void</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">JobActualizaClientePersona(Args _args)</span></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">{</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> CustTable custTable;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> NumberSeq numberSeq;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> Name name =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Jorge Lopez'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirParty dirParty;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirPartyPostalAddressView dirPartyPostalAddressView;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirPartyContactInfoView dirPartyContactInfo;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> ;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>ttsBegin</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>try</b></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> custTable = custTable::find(</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"C000020695"</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">); </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">dirPartyPostalAddressView</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">dirPartyPostalAddressView.Party == custtable.Party</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> && dirPartyPostalAddressView.IsPrimary == NoYes::Yes;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//DirParty</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Crea instancia de la clase DirParty a partir de dirPartyPostalAddressView</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Actualiza dirección principal</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirParty = DirParty::constructFromPartyRecId(dirPartyPostalAddressView.Party);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.LocationName =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Oficina central '</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.City =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Polanco Chapultepec'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.Street =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Presidente Masarik'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.StreetNumber =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'25'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.CountryRegionId =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'MEX'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//necesita ser un país valido</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyPostalAddressView.State =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'09'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">; </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//necesita ser un estado valido</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>// Llena dirección</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Actualiza email de información de contacto</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.clear();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">dirPartyContactInfo</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">dirPartyContactInfo.Party == custtable.Party &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Type == LogisticsElectronicAddressMethodType::Email;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirParty = DirParty::constructFromPartyRecId(dirPartyContactInfo.Party);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.LocationName =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Email Jorge Lopez'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Locator =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'jorge.lopez222@gmail.com'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Email;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.IsPrimary = NoYes::Yes;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirParty.createOrUpdateContactInfo(dirPartyContactInfo);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: green; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><i>//Actualiza telefono de información de contacto</i></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.clear();</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>select</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>where</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">dirPartyContactInfo.Party == custtable.Party &&</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Type == LogisticsElectronicAddressMethodType::Phone;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> DirParty = DirParty::constructFromPartyRecId(dirPartyContactInfo.Party);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.LocationName =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'Telefono Jorge'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Locator =</span></span> <span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">'551291165343'</span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirPartyContactInfo.IsPrimary = NoYes::Yes;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> dirParty.createOrUpdateContactInfo(dirPartyContactInfo);</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>ttsCommit</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> info(</span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>strFmt</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(</span></span><span style="color: darkred; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">"Cliente creado: %1"</span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">, custTable.AccountNum));</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>catch</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">(Exception::Error)</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> {</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>ttsAbort</b></span></span><span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> </span></span> <span style="color: darkblue; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b>throw</b></span></span> <span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">Exception::Error;</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"> }</span></span></div>
<br />
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;">}</span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><br /></span></span></div>
<div align="left">
<span style="color: #010101; font-family: Consolas; font-size: xx-small;"><span style="font-size: 8pt;"><b><br /></b></span></span></div>
<div align="left">
<span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><b>Post que podrían interesarte:</b></span><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://bit.ly/1MSS2T3">Crear clientes y direcciones</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2014/10/consultas-en-tablas-con-validtimestate.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Consultas en tablas con ValidTimeState en Ax 2012</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2014/10/multiselect-de-grid-en-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Multiselect de grid en Ax 2012</a><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><a href="http://aprendiendodynamicsax.blogspot.mx/2014/10/crear-lookup-en-clase-dialog-en-ax-2012.html" style="background-color: #fefdfa; color: #7d181e; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px; text-decoration: none;">Crear lookup en clase dialog</a></div>
<div align="left">
<br /></div>
<div align="left">
<b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="line-height: 18.2px;">Y por cierto, acuérdate de darle click a algún anuncio si el post te sirvió de algo. O comenta si quieres saber sobre algún tema en específico.</span></b><br style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;" /><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;"><br /></span></span></b><span style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"></span><b style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2px;"><span style="font-family: Georgia, 'Times New Roman', serif; line-height: 18.2px; orphans: 2; widows: 2;"><span style="color: #351c75;">No olvides que te puedes unir a la página en Facebook <a href="https://www.facebook.com/aprendiendodynamicsax" style="color: #7d181e; text-decoration: none;" target="_blank">Aprendiendo Dynamics Ax </a>donde únicamente se tratan temas de desarrollo y se busca crear una comunidad de desarrollador@s de Ax en nuestro idioma. </span></span></b></div>
Yered Castrohttp://www.blogger.com/profile/17136960373929089422noreply@blogger.com0