Bài viết liên quan

Filter nhiều điều kiện linh động


14/10/2020- duocnt    434 Views    

NGUỒN GỐC

Tham khảo class

InventAgingStorageChart

    InventAgingStorage inventAgingStorage;

    InventAgingTmp inventAgingTmp;

    str itemGroupSelTxt, itemSelTxt, siteSelTxt, warehouseSelTxt, filterTxt;

    str txtAll = strFmt('%1', '@SYS11696');


    #LOCALMACRO.InsertInventAgingChartTmp

        inventAgingChartTmp.clear();

        inventAgingChartTmp.Period = %1;

        inventAgingChartTmp.TransactionId = inventAgingStorage.TransactionId;

        inventAgingChartTmp.Filters = filterTxt;


        select sum(%2) from inventAgingTmp

            where inventAgingTmp.CreatedTransactionId == inventAgingStorage.TransactionId

               && (itemGroupSelTxt == txtAll || inventAgingTmp.ItemGroupId == itemGroupSelTxt)

               && (itemSelTxt == txtAll || inventAgingTmp.ItemId == itemSelTxt)

               && (siteSelTxt == txtAll || inventAgingTmp.InventSiteId == siteSelTxt)

               && (warehouseSelTxt == txtAll || inventAgingTmp.InventLocationId == warehouseSelTxt);

        

        inventAgingChartTmp.PeriodValue = round(inventAgingTmp.%2, 0.01);

        inventAgingChartTmp.insert();


        // Add additional zero record to make the chart don't throw error. Each period need at least two records.

        inventAgingChartTmp.clear();

        inventAgingChartTmp.Period = %1;

        inventAgingChartTmp.PeriodValue = 0;

        inventAgingChartTmp.insert();

    #ENDMACRO

Góp ý kiến

;
;