28 Mayıs 2019 Salı

Müşteri kredi limitlerinin yeniden hesaplanması

Aşağıdaki kod müşteri kredi limitlerini yeniden hesaplar.


static void Sales_CreditLimits(Args _args) 
{
    #OCCRetryCount
    SalesTable              salesTable;
    SalesId                 fromSalesId;
    ;

    if (_showProgess && !updateOne)
    {
        this.progressInit("@SYS59119", 0, #AviFormLetter);
        progress.setText(strfmt("@SYS26577"));
    }

    try
    {
        ttsbegin;

        update_recordset salesTable
            setting estimate = 0
            where salesTable.SalesStatus == SalesStatus::Invoiced   &&
                  salesTable.Estimate    != 0;

        while (queryRun.next())
        {
            salesTable = queryRun.get(tablenum(SalesTable));

            if (_showProgess && !updateOne)
            {
                if (fromSalesId)
                    this.progressUpdate(strfmt("@SYS59131", strfmt('%1 - %2',fromSalesId, salesTable.SalesId)));
                else
                    this.progressUpdate(strfmt("@SYS59131", salesTable.SalesId));

                fromSalesId = salesTable.SalesId;
            }

            if (salesTable.setEstimate())
                salesTable.doUpdate();
        }

        ttscommit;
    }
    catch (Exception::Error)
    {
        info("@SYS78886");
    }

    catch (Exception::Deadlock)
    {
        queryRun.reset();
        retry;
    }

    catch (Exception::UpdateConflict)
    {
        if (appl.ttsLevel() == 0)
        {
            if (xSession::currentRetryCount() >= #RetryNum)
            {
                throw Exception::UpdateConflictNotRecovered;
            }
            else
            {
                queryRun.reset();
                retry;
            }
        }
        else
        {
            throw Exception::UpdateConflict;
        }
    }
}

Hiç yorum yok:

Yorum Gönder

Total ciro

static void MAA_SalesTableTotal(Args _args) { SalesTable SalesTable; utcDateTime dateTime; dateTime ...