ATNYLASalesInvoiceDP_Extension

Rumman Ansari   2023-10-20   Developer   c programming language > ATNYLASalesInvoiceDP_Extension   211 Share

SELECT TOP 1 *
FROM tmpTaxWorkTrans
WHERE SourceRecId = @RecId
  AND SourceTableId = @TableId
  AND TaxCode = 'IdtTireFee';



display AmountCur displaySourceRegulateAmountCur()
{
    TaxWorkTrans tmpTaxWorkTrans;
    SalesLine salesLine;
    
    select firstOnly * from tmpTaxWorkTrans
        where tmpTaxWorkTrans.SourceRecId == this.RecId &&
              tmpTaxWorkTrans.SourceTableId == this.TableId &&
              tmpTaxWorkTrans.TaxCode == 'IdtTireFee';
    
    if (tmpTaxWorkTrans)
    {
        return tmpTaxWorkTrans.SourceRegulateAmountCur;
    }
    
    return 0;
}



static void JoinThreeTablesExample(Args _args)
{
    SalesTable salesTable;
    SalesLine salesLine;
    TmpTaxWorkTrans tmpTaxWorkTrans;

    while select * from salesTable
        join salesLine
            where salesTable.SalesId == salesLine.SalesId
    {
        info("SalesTable: " + salesTable.SalesId);

        while select * from tmpTaxWorkTrans
            where tmpTaxWorkTrans.SourceTableId == salesLine.TableId &&
                  tmpTaxWorkTrans.SourceRecId == salesLine.RecId
        {
            info("TmpTaxWorkTrans: " + tmpTaxWorkTrans.SourceRegulateAmountCur);
        }
    }
}


public SourceRegulateAmountCur ansari()
{
    TmpTaxWorkTrans tmpTaxWorkTrans;
    SalesTable localSalesTable = element.args().record();
    SalesLine localSalesLine;

    select TableId, RecId from localSalesLine
        where localSalesLine.SalesId == localSalesTable.SalesId
    join SourceRegulateAmountCur, TaxCode, TransTableId, TransRecId from tmpTaxWorkTrans
        where tmpTaxWorkTrans.TransTableId == localSalesLine.TableId && tmpTaxWorkTrans.TransRecId == localSalesLine.RecId && tmpTaxWorkTrans.TaxCode == 'IdtTireFee';

    if (tmpTaxWorkTrans)
    {
        return tmpTaxWorkTrans.SourceRegulateAmountCur;
    }

    // Handle the case when no record is found
    return 0.0; // Change the default value as needed
}