[ExtensionOf(formControlStr(VendEditInvoice, OK))]final class VendEditInvoice_OK_AzimutBenetti_Extension{ public void clicked() { IntentLetter_IT intentLetter; VendInvoiceInfoLine vendInvoiceInfoLine; if(vendInvoiceInfoLine.LineAmount > intentLetter.remainAmountMST()) { DialogButton diagBut; str strMessage = /Importo da decurtare al saldo della lettera di intento maggiore dell’importo residuo. Proseguire?/; str strTitle = /Splafonamento/; diagBut = Box::yesNo( strMessage, DialogButton::No, strTitle ); if(diagBut == DialogButton::No) { return; } } next clicked(); }}
[ExtensionOf(formStr(VendEditInvoice))]
final class VendEditInvoice_AzimutBenetti_Extension
{
protected boolean canProceedWithInvoicePosting()
{
boolean ret = next canProceedWithInvoicePosting();
if (!this.validateIntentLetter())
{
ret = false;
}
return ret;
}
//public void clicked()
//{
// boolean proceed = this.validateIntentLetter();
// if (proceed)
// {
// super();
// }
//}
// A new method for your validation logic
private boolean validateIntentLetter()
{
VendInvoiceInfoLine vendInvoiceInfoLine; // Ottieni la fattura corrente
PurchTable purchTable;
Amount totalAmount = vendInvoiceInfoLine.LineAmount;
// Ottenere l'ID della lettera di intento dalla tabella di lookup
if (purchTable.IntentLetterId_IT)
{
IntentLetter_IT intentLetter;
// Recuperare la lettera di intento associata all'ID
select firstOnly intentLetter
join purchTable
where intentLetter.IntentLetterId == purchTable.IntentLetterId_IT;
// Ottenere l'ID della lettera di intento
Amount remainingAmount = intentLetter.remainAmountMST();
Info(strFmt('%1, %2', totalAmount, remainingAmount));
if (totalAmount >= remainingAmount)
{
DialogButton diagBut;
str strMessage = "Importo da decurtare al saldo della lettera di intento maggiore dell’importo residuo. Proseguire?";
str strTitle = "Splafonamento";
diagBut = Box::yesNo(
strMessage,
DialogButton::No,
strTitle
);
if (diagBut == DialogButton::No)
{
info('Operazione annullata');
return false;
}
}
}
return true;
}
}
[Control("Button")]
class OK
{
public void clicked()
{
// <GEERU>
if (SysCountryRegionCode::isLegalEntityInCountryRegion([ #isoRU ]) && !purchFormLetter.checkBeforePost())
{
return;
}
// </GEERU>
element.postInvoice();
}
}
[ExtensionOf(formStr(VendEditInvoice))]
final class VendEditInvoice_AzimutBenetti_Extension
{
// CoC extension
protected boolean canProceedWithInvoicePosting()
{
boolean ret = next canProceedWithInvoicePosting();
if (!this.validateIntentLetter())
{
ret = false;
}
return ret;
}
// A new method for your validation logic
private boolean validateIntentLetter()
{
...
}
}
[ExtensionOf(formControlStr(VendEditInvoice, OK))]
final class VendEditInvoice_OK_AzimutBenetti_Extension
{
private boolean canProceed = true;
public void clicked()
{
IntentLetter_IT intentLetter;
VendInvoiceInfoLine vendInvoiceInfoLine;
Amount totalAmount;
Amount remainingAmount;
RecId intentLetterRecId;
// Ciclo attraverso tutte le fatture
while select * from vendInvoiceInfoLine
{
totalAmount = vendInvoiceInfoLine.LineAmount;
intentLetterRecId = vendInvoiceInfoLine.RecId;
select firstOnly intentLetter
where intentLetter.RecId == intentLetterRecId;
remainingAmount = intentLetter.remainAmountMST();
Info(strFmt('%1, %2', totalAmount, remainingAmount));
if (totalAmount >= remainingAmount)
{
DialogButton diagBut;
str strMessage = "Importo da decurtare al saldo della lettera di intento maggiore dell’importo residuo. Proseguire?";
str strTitle = "Splafonamento";
diagBut = Box::yesNo(
strMessage,
DialogButton::No,
strTitle
);
if (diagBut == DialogButton::No)
{
canProceed = false;
info('Operazione annullata');
}
}
}
next clicked();
}
public boolean canProceedWithInvoicePosting()
{
return canProceed;
}
public void setCanProceed(boolean _canProceed)
{
canProceed = _canProceed;
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,188 Super User 2024 Season 2
Martin Dráb 230,030 Most Valuable Professional
nmaenpaa 101,156