Selasa, 20 Desember 2016

AX: Get End Month AX 2012

you can get end month with endmth
example
endmth(dateMthFwd(tanggalmulai,-jmlbulan));

Rabu, 14 Desember 2016

Query : Contoh Query Fcuntion SQL Server

create function CustBalanceAsOfTransDatex ( @AsOfDate datetime, @DataAreaID varchar(10) )
returns table
as return (
select a.ACCOUNTNUM, sum(AMOUNTMST - isnull(Terbayar, 0)) as Sisa, cust.CUSTGROUP,dirp.NAME as names
from (

    select   
        ct.*,
        (select sum(SETTLEAMOUNTMST - EXCHADJUSTMENT)
            from CUSTSETTLEMENT cset
            where cset.ACCOUNTNUM = ct.ACCOUNTNUM and cset.TRANSRECID = ct.RECID
                and partition = 5637144576 and DATAAREAID = @DataAreaID
                and cset.TRANSDATE <= @AsOfDate)
                as Terbayar
    from
        (
            select VOUCHER, INVOICE, CLOSED, POSTINGPROFILE, AMOUNTMST, AMOUNTCUR, RECID, ACCOUNTNUM, TRANSDATE
            from CUSTTRANS
            where --AccountNum = 'CUST-C006' and
            partition = 5637144576 and DATAAREAID = @DataAreaID
            and TRANSDATE <= @AsOfDate
            and TransType in (
            0, --None
            2, -- Sales
            15, -- payment
            8, -- cust
            36 -- General Journal
            ) and
            POSTINGPROFILE = 'GEN' and (Closed = '1900-01-01' or Closed > @AsOfDate)
        ) ct
) a inner join CUSTTABLE cust on a.ACCOUNTNUM = cust.ACCOUNTNUM
inner join DIRPARTYTABLE dirp on cust.PARTY = dirp.RECID
where a.AMOUNTMST - isnull(a.Terbayar, 0) <> 0
group by a.ACCOUNTNUM, cust.CUSTGROUP,dirp.NAME
)
go


Jumat, 25 November 2016

Kamis, 17 November 2016

Query Join AX 2012 Version 2

public void executeQuery()
{
  QueryBuildDataSource   cpj;
  QueryBuildDataSource   bol;
  query    query;
  query = CustPackingSlipJour_ds.query();
  cpj = query.dataSourceTable(tableNum(CustPackingSlipJour));
  bol  = cpj.addDataSource(tableNum(WMSBillOfLadingOrder));
  bol.joinMoIde(JoinMode::ExistsJoin);
  bol.fetchMode(QueryFetchMode::One2One);
  bol.relations(false);
  bol.addLink(fieldNum(CustPackingSlipJour, SalesId), fieldNum(WMSBillOfLading, InventTransRefId));
  super();
}
I tried the same in a job and it worked:
static void Job21(Args _args)
{
   Query       query;
   QueryRun    queryrun;
   QueryBuildDataSource    cpj;
   QueryBuildDataSource    bol;
   QueryBuildRange         qbr1;  
   CustPackingSlipJour     custPackingslipJour;
   WMSBillOfLadingOrder wmsBillOfLadingOrder;
   ;
   query = new query();
   cpj   =   query.addDataSource(tablenum(CustPackingSlipJour));
   qbr1  = cpj.addRange(fieldnum(CustPackingSlipJour,orderAccount));
   qbr1.value(queryvalue('CUST001'));
   bol   = cpj.addDataSource(tablenum(WMSBillOfLadingOrder));
   bol.relations(false);
   bol.joinMode(joinmode::InnerJoin);
   bol.addLink(fieldnum(CustPackingSlipJour,SalesId),fieldnum(WMSBillOfLadingOrder,InventTransRefId));
   queryrun  = new queryrun(query);
   while(queryrun.next())
   {
   custPackingslipJour   = queryrun.get(tablenum(CustPackingSlipJour));
   wmsBillOfLadingOrder = queryrun.get(tablenum(WMSBillOfLadingOrder));
   info(strfmt("%1 - %2",custPackingslipJour.salesid, wmsBillOfLadingOrder.billOfLadingId));
   }  
}

Senin, 07 November 2016

AX : Disabled Enabled Button AX 2012 ( Simple Case )

Dalam hal ini saya mempunya form Down Payment..di tabel purchdp_header( custom table), nah saya ingin ketika nomor_dp itu ditemukan di table LedgerJournalTrans maka tombol edit di Form Down Payment menjadi disabled..sebelumnya saya memakai Class Interaction namun saya mencoba cara sederhana dengan menggunakan Class Active di datasource PurchDP-Header di form tersebut..isi class Activenya sebagai berikut :

public int active()
{
    int ret;
    AmountCurDebit nilaisum;
    PurchDP_Header pdph;
    LedgerJournalTrans ljth;

    //info(PurchDP_Header.Nomor_PurchDP);
    ret = super();

    select * from ljth where ljth.Nomor_DP==PurchDP_Header.Nomor_PurchDP;
    //nomordp=ljth.AmountCurDebit;
   nilaisum=ljth.AmountCurDebit+ljth.AmountCurCredit;
   // info(int2str(amcd));
    if(nilaisum> 0)
    {

       buttonEditDP.enabled(false);

    }

    else
    {
        buttonEditDP.enabled(true);
    }


    return ret;
}

Kamis, 20 Oktober 2016

JEASYUI : Chained Combobox JEASYUI ( combo box bertingkat )

View Utama

            <div class="fitem">
                <label>Provinsi:</label>
<select  class="easyui-combobox"  name="provinsi" id="provinsi" required="true"   >
    <option value="<?php echo isset($_POST['provinsi']) ? $_POST['provinsi'] : ''; ?>"></option>                                           
                                                 <?
foreach ($provins as $provinss) {
?>
            <option value="<?= $provinss['IDProvinsi']; ?>"><?= $provinss['NamaProvinsi']; ?>
            </option>
            <?php
}
?>
        </select>
            </div>
                        <div class="fitem" name="kotalook">
                <label>Kota:</label>
<label id="kotalook"> </label>
            </div>

Minggu, 02 Oktober 2016

IT : ODBC Driver tidak dapat view semua driver database

This problem can occur because of a architecture problem (32-bit office running on 64-bit windows) or a permissions problem.
The following steps can be used to solve this problem:
1. Navigate to "C:\Windows\SysWOW64"
2. Find "odbcad32.exe", right click on it and do "Run As Administrator"
3. Then continue following the steps listed in the Database Toolbox Guide.
After following the above steps, you will be able to see all the data sources.