data etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
data etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

7 Temmuz 2017 Cuma

AX 2012 - TempDB ile server metoddan forma veri göndermek

TempDB tablosunda direk parametre ile gönderip doldurmaya çalıştığınızda kayıt gelmediğini göreceksiniz. Kayıtların gelmesi için ya In Memory tablo türünü seçmelisiniz ya da linkPhysicalTableInstance metodu ile iki TempDB tablosunu birbirine bağlamalısınız:

Class:

public static server void populateData(MyTempTable _tmp)
{
MyTempTable tmp;
...
...
tmp.linkPhysicalTableInstance(_tmp);
...
...
return;
}

Form:


MyClass::populateData(MyTempTable);
MyTempTable_DS.research();
MyTempTable_DS.refresh();

25 Haziran 2014 Çarşamba

AX 2012 - Form datasını yenilemek

Çağırdığınız bir alt rutin ekrandaki datayı yeniliyor. Formda data yenilenmiyor. Bunu çözmek için önce research, sonra refresh metodlarını çağırmanız en uygun yoldur. Research mevcut query filtrelerinizi bozmaz ve true parametresiyle çağırdığınızda önceki kayda konumlanır:

    LedgerJournalTrans_DS.research(true);
    LedgerJournalTrans_DS.refresh();


Çağırdığınız rutin bir SysOperation class rutiniyse ve ekran halen yenilenmiyorsa controller classda bunu yapmayı unutmayın:

 controller.parmExecutionMode(SysOperationExecutionMode::Asynchronous);

Aksi takdirde classın işi bitmeden research ve refresh çalıştırmış ve dataları yenilememiş olursunuz.


4 Nisan 2014 Cuma

AX 2012 RDP (Report Data Provider) Oluşturma

Data Provider class:


------------Class Declaration-------------------
[SRSReportParameterAttribute(classStr(myCustInvoicePrintContract))]
class myCustInvoicePrintDP extends SRSReportDataProviderbase
{
    CustInvoicePrintTMP      InvoicePrint;
    CustInvoicePrintTransTMP InvoicePrintTrans;
    CustInvoicePrintTaxTMP   InvoicePrintTax;
    CustInvoicePrintFootTMP  InvoicePrintFoot;

    RecId                       RecId;
}

-----------------SSRS için tablo metodları---------------------------
[SRSReportDataSetAttribute(tableStr(CustInvoicePrintTMP))]
public CustInvoicePrintTMP getCustInvoicePrint()
{
    select * from InvoicePrint;
    return InvoicePrint;
}

[SRSReportDataSetAttribute(tableStr(CustInvoicePrintTransTMP))]
public CustInvoicePrintTransTMP getCustInvoicePrintTrans()
{
    select * from InvoicePrintTrans;
    return InvoicePrintTrans;
}

------------------GetParameter metodu--------------------------------
private void getReportParameters()
{
    myCustInvoicePrintContract Contract = this.parmDataContract();

    if (Contract)
    {
        RecId   = Contract.parmRecordId();
    }
}


------------------- Datanın doldurulduğu processReport metodu--------
[SysEntryPointAttribute(false)]
public void processReport()
{
    CustInvoiceJour         InvoiceJour;
    CustInvoiceTrans        InvoiceTrans;
    TaxTrans                taxTrans;
    TaxOnItem               taxOnItem;
    TaxGroupData            taxGroupData;
    AmountMST               Tax;
    this.getReportParameters();

    InvoiceJour = CustInvoiceJour::findRecId(RecId);
    InvoicePrint.InvoiceDate    = InvoiceJour.InvoiceDate;
    InvoicePrint.InvoiceName    = InvoiceJour.invoiceName();
    InvoicePrint.TaxOfficeName_TR   = CustTable::find(InvoiceJour.InvoiceAccount).TaxOfficeName_TR;
    ...
    InvoicePrint.insert();
    while select InvoiceTrans where
        InvoiceTrans.SalesId == InvoiceJour.SalesId && InvoiceTrans.InvoiceId == InvoiceJour.InvoiceId &&
        InvoiceTrans.InvoiceDate == InvoiceJour.InvoiceDate && InvoiceTrans.numberSequenceGroup == InvoiceJour.numberSequenceGroup
    {
        select taxOnItem
                where taxOnItem.TaxItemGroup == InvoiceTrans.TaxItemGroup
            join taxGroupData
                where taxGroupData.TaxCode == taxOnItem.TaxCode &&
                      taxGroupData.TaxGroup == InvoiceTrans.TaxGroup;
        InvoicePrintTrans.TaxValue          = TaxData::find(TaxOnItem.TaxCode, InvoiceTrans.InvoiceDate, 0).TaxValue;
        InvoicePrintTrans.Qty               = InvoiceTrans.Qty;
        ...
        InvoicePrintTrans.insert();
        Tax = Tax::calcTaxAmount(InvoiceTrans.TaxGroup,taxOnItem.TaxItemGroup,InvoiceTrans.InvoiceDate,
                InvoiceTrans.CurrencyCode,InvoiceTrans.LineAmount,TaxModuleType::Sales);
        ...
            InvoicePrintTax.insert();
        }
    }
    ...
}


Controller class:

--------------Class Declaration------------------
class myCustInvoicePrintController extends SrsReportRunController
{
    #define.ReportName('CustInvoicePrint.Report')
    myCustInvoicePrintContract    contract;
    CustInvoiceJour           custInvoiceJour;
}

parametreyi al
protected void prePromptModifyContract()
{
    if (this.parmArgs()             &&
        this.parmArgs().record()    &&
        this.parmArgs().dataset() == tableNum(CustInvoiceJour))
    {
        custInvoiceJour = this.parmArgs().record();
    }

    if (!Contract)
    {
        Contract = this.parmReportContract().parmRdpContract();
    }

    contract.parmRecordId(custInvoiceJour.RecId);

    super();
}

public static myCustInvoicePrintController construct(Args _args)
{
    myCustInvoicePrintController controller = new myCustInvoicePrintController();
    controller.parmArgs(_args);
    return controller;
}

public static void main(Args _args)
{
    SysLastValue    SysLastValue;
    myCustInvoicePrintController controller = new myCustInvoicePrintController();
    controller.parmReportName(#ReportName);
    controller.parmArgs(_args);

    if(CSReportPrint::find(SysUserInfo::find().RecId,CSReportType::Invoice1).PrinterName)
    {
        controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Printer);
        controller.parmReportContract().parmPrintSettings().printerName(CSReportPrint::find(SysUserInfo::find().RecId,CSReportType::Invoice1).PrinterName);
    }
    controller.parmShowDialog(false); //ekranda diyalog gösterme
    controller.startOperation();
}



Contract class:
---------------class declaration---------------------------

[DataContractAttribute]
class myCustInvoicePrintContract
{
    RecId recordId;
}
parametreyi al
[DataMemberAttribute('RecordId')]
public recId parmRecordId(recId _recordId = recordId)
{
   recordId = _recordId;
   return recordId;
}