add Date range to query x++ ax 2012

query.dataSourceTable(tablenum(BudgetSourceTracking), 1).addRange(fieldnum(BudgetSourceTracking, TrackingDate)).value(queryRange( fiscalPeriodStartDate, fiscalPeriodEndDate));
Advertisements

Vendor or Customer , Invoicing or Delivery Address

display Addressing  InvoicingAddress()
{
    Addressing address;
    DirPartyRecId party;
 
    party = CustTable::find(custConfirmJour.InvoiceAccount).Party;
    address = DirParty::getPostalAddressByType(party, LogisticsLocationRoleType::Invoice);
 
    if (!address)
        address = DirParty::getPostalAddressByType(party, LogisticsLocationRoleType::Delivery);
 
    return address;
}

source : http://dynamicsuser.net/forums/t/56107.aspx

Column BackColor Grid Form AX 2012

override method displayOptions in gridForm.

public void displayOption(Common _record, FormRowDisplayOption _options)
{
   #define.Red(255,0,0)
   TableNameDataSource   tableNameLoc;

   tableNameLoc = _record.data();

   //your logic if while etc
    
   _options.backColor(WinAPI:RGB2int(#Red);
   _options.affectedElementsByControl(element.controlId(CONTROL_NAME_IN_FORM));
   
   super(_record,_options);
   
}

contributor : _le

Print Sales Invoice via job X++ ax 2012

protected void printReportPdf(Common _record)
{
    args args = new args();
    CustInvoiceJour custInvoiceJour = _record;
    SRSPrintDestinationSettings printSettings;
    SalesInvoiceController controller = new SalesInvoiceController();

    args.record(_record);

    pdfPath = WinAPI::getTempPath() + custInvoiceJour.InvoiceId + ".pdf";

    // imposta nome report
    controller.parmReportName(ssrsReportStr(SalesInvoice, Report));

    // get print settings from contract
    printSettings = controller.parmReportContract().parmPrintSettings();

    // set print medium
    printSettings.printMediumType(SRSPrintMediumType::File);
    printSettings.fileFormat(SRSReportFileFormat::PDF);
    printSettings.overwriteFile(true);
    printSettings.fileName(pdfPath);

    // forzo che non vengano cambiati i parametri di stampa che gli passo io
    controller.DEVparmLockDestinationProperties(true);

    // suppress the parameter dialog
    controller.parmShowDialog(false);
    controller.parmArgs(args);

    // start operation
    controller.startOperation();
}

source : http://daxldsoft.blogspot.com/2012/07/print-salesinvoice-packingslip-or.html

print Sales Picking List via Jobs X++ AX 2012

static void Job6(Args _args)
{
    WMSPickingRoute         wmsPickingRoute;
    WmsPickingList_OrderPickController  aiController = new WmsPickingList_OrderPickController();
    WmsPickingList_OrderPickContract    aiContract   = new WmsPickingList_OrderPickContract();
    SRSTmpDataStore                     srsTmpDataStore;
 
    select firstOnly wmsPickingRoute where wmsPickingRoute.RecId==5637144577;//iisi sendiri jngn malas
    
    srsTmpDataStore.Value = Global::buf2Con(wmsPickingRoute);
    ttsbegin;
    srsTmpDataStore.insert();
    ttscommit;
 
    aicontroller.parmReportName(ssrsReportStr(WmsPickingList_OrderPick,Report));
    aicontroller.parmShowDialog(false);
 
    aiController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Screen);
   // aiController.parmReportContract().parmPrintSettings().printerName(“Xerox WorkCentre 3210 PCL 6 (Copy 1)”);
 
    aiContract.parmPickingRouteId(srsTmpDataStore.recid);
    aiContract.parmDocumentTitle(“x”);
    aiContract.parmShowRegistered(true);
    aiContract.parmShowActivated(true);
    aiContract.parmShowStarted(true);
    aiContract.parmShowPicked(true);
    aiContract.parmShowStaged(true);
    aiContract.parmShowLoaded(true);
    aiContract.parmShowCancelled(false);
    aiContract.parmPrintCopyOriginal(PrintCopyOriginal::Original);
 
    aiController.parmReportContract().parmRdpContract(aiContract);
    //aicontroller.startOperation();
 
    //aiController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
 
    // Run the report
    aiController.runReport();
}