Thursday, 13 March 2014

Based on division id filter in the Report and evey page get new Item in ax 2009

Based on division id filter:-
while select custTable group by FedDivisionId where                    
                                                        (((DivisionId)&&(custTable.DivisionId == DivisionId))||(!DivisionId))&&
                                                        (((SubDivId) && custTable.SubDivId == SubDivId ) ||(!SubDivId)) &&
                                                        (((SectionId1)&&(custTable.SectionId == SectionId1))||(!SectionId1))

 Report and next:-

 if(itemid &&  itemid!=vendPackingSlipTransGlobal.ItemId)
 {
    itemId = vendPackingSlipTransGlobal.ItemId;
    element.newPage();  
    i=0;
 }
 i++;
Image add in to the report use this :-
display Bitmap footerImage()
{
    return SysResource::getResourceNodeData(SysResource::getResourceNode(resourceStr(dhtml_right)));
}
static void DataDic_ChangeCompany(Args _args)
{
    DataArea dataArea;
    CustTable custTable;
    ;
    while select dataArea
    {
        if (!dataArea.isVirtual)
        {
            info(strfmt("Company: %1", dataArea.id));
            changeCompany(dataArea.id)
            {
                custTable = null;
                while select custTable
                {
                     info(strfmt("%1, %2", custTable.dataAreaId, custTable.accountNum));
                }
            }
        }
    }
}
static void AreaID(Args _args)
{
    dataarea    area;
    ;
    while select area
    {
        info(area.Id);
    }
}

static void BatchJobSchedule_NUmberSeqListDelete(Args _args)
{
    BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str sParmCaption = "Delete --- NumberSeqList";
    ;
    rbbTask = new NubersequenceList_delete();
     batInfo = rbbTask .batchInfo();
    batInfo .parmCaption(sParmCaption);

    batInfo .parmGroupId(" ");
    batHeader = BatchHeader ::construct();
    batHeader .addTask(rbbTask);
    batHeader .save();
    info(strFmt("'%1' batch has been scheduled.", sParmCaption));
}

static void customerReadExcel(Args _args)
{
    SysExcelApplication application;
    SysExcelWorkbooks workbooks;
    SysExcelWorkbook workbook;
    SysExcelWorksheets worksheets;
    SysExcelWorksheet worksheet;
    SysExcelCells cells;
    COMVariantType type;
    int row = 1,Counter;
    CustAccount Customeraccount;
    CustAccount MergedaccountCustomeraccount;
    str company;
    CustName Name;
    FileName filename;
    CustTable CustTableDelete;
    CustTable Custtable,Custtablelocal;
    SalesJournalAutoSummary autosummary,autosummarylocal;

    #avifiles
    SysOperationProgress simpleProgress=new SysOperationProgress();

    ;
    application = SysExcelApplication::construct();
    workbooks = application.workbooks();
    filename = "C:\\list1.xlsx";

    try
    {
        workbooks.open(filename);
    }
    catch (Exception::Error)
    {
        throw error("File cannot be opened.");
    }

    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
//
    startLengthyOperation();
    do
    {
        row++;
        Counter++;
        type = cells.item(row+1, 2).value().variantType();
    } while (type != COMVariantType::VT_EMPTY);
    endLengthyOperation();

    simpleProgress.setCaption("Progress bar example…");
    simpleProgress.setAnimation(#AviUpdate);
    simpleProgress.setTotal(Counter);
    row =1;
     startLengthyOperation();
    do
    {
        row++;
        Customeraccount = cells.item(row, 1).value().bStr();
        Name = cells.item(row, 2).value().bStr();
        MergedaccountCustomeraccount = cells.item(row, 3).value().bStr();
        company = cells.item(row, 4).value().bStr();
        ttsBegin;
        delete_from autosummary
              where autosummary.CustAccount == cells.item(row, 1).value().bStr();
        select firstOnly forUpdate  CustTableDelete
              where CustTableDelete.AccountNum == cells.item(row, 1).value().bStr();
        select firstOnly forUpdate  Custtable
              where Custtable.AccountNum == cells.item(row, 3).value().bStr();
        CustTableDelete.merge(Custtable);
        Custtable.doUpdate();
        CustTableDelete.doDelete();
        ttsCommit;
        simpleProgress.setText(strfmt("The value of i is %1", row));
        simpleProgress.setCount(row, 1);
    type = cells.item(row+1, 1).value().variantType();
    }
    while (type != COMVariantType::VT_EMPTY);
    endLengthyOperation();
    application.quit();
    info('hi');
}
static void LedgerTrans_For_Account(Args _args)
{
    LedgerTrans lt;
    ;
    select sum(AmountMST) from lt where lt.AccountNum == '30-11-84'
        && lt.TransDate >= str2date("01-01-2014",123)
        && lt.TransDate <= str2date("31-01-2014",123)
       &&  lt.TransDate >= mkdate(01,07,2012)
       &&  lt.TransDate <= mkdate(31,08,2012);
        && lt.Dimension[1] == '003';
        info(strfmt("%1",lt.AmountMST));

}
Normal Report Dialog parameters:-
public class ReportRun extends ObjectRun
{
     DialogField FieldFromDate,FieldToDate;
     transdate    FromDate,ToDate;
     int  Centerid,i;
}

public Object dialog(Object _dialog)
{
    DialogRunbase dialog = _dialog;
    ;
    FieldFromDate       = dialog.addField((typeid(FromDate)),'From Date');
    FieldToDate         = dialog.addField(typeid(ToDate),'To Date');
    return dialog;
}

public boolean getFromDialog()
{
    boolean ret;
    ;

    FromDate       =  FieldFromDate.value();
    ToDate         =  FieldToDate.value();
    ret   =true;
    return ret;
}

display transdate ToDate()
{
    return ToDate;
}

display transdate FromDate()
{
    return FromDate;
}

No comments:

Post a Comment