Pages

Banner 468 x 60px

 

Friday, November 17, 2017

Create report X++

0 comments
Create report X++ :




public class ReportRun extends ObjectRun
{
    VendInvoiceJour     _ambilrecordVendInvoiceJour;
    TECFakturPajakId    _TECFakturPajakId;
    VendInvoiceId       _VendInvoiceId;

    // Title
    str                 Judul;

    // Header Vendor
    VendName            _VendName;
    LogisticsAddressing Alamat;
    TECNPWP             NPWP_Vendor;

    // Header Company
    ItemFreeTxt         Nama_Barang;
    AmountMST           Harga_Jual_Valas;
    AmountCur           Harga_Jual_Rupiah;

    // Rincian
    AmountMST           SalesBalanceMST;
    AmountCur           SalesBalance;

    // footer
    DirPartyTable       _DirPartyTable;
    CompanyInfo         _CompanyInfo;
    DirPerson           _DirPerson;
    Name                NamaPengesah;
}



public void init()
{
    super();
    _ambilrecordVendInvoiceJour = element.args().record();
    element.copies(2);
}


public boolean fetch()
{
    Query       _Query = new Query(this.query());
    QueryRun    _QueryRun;
    boolean     ret = true;

    VendTable           _VendTable;
    VendInvoiceTrans    _VendInvoiceTrans;
    ;

    _Query.dataSourceTable(tableNum(VendInvoiceJour)).addRange(fieldNum(VendInvoiceJour, TECFakturpajakid)).value(_ambilrecordVendInvoiceJour.TECFakturpajakid);
    _QueryRun = new QueryRun(_Query);

    while(_QueryRun.next())
    {

        if(_QueryRun.changed(tableNum(VendInvoiceJour)))
        {
            //vendinvoicejour = _QueryRun.get(tableNum(VendInvoiceJour));
            _ambilrecordVendInvoiceJour = _QueryRun.get(tableNum(VendInvoiceJour));

           // _TECFakturPajakId   = VendInvoiceJour.TECFakturPajakId;
            _TECFakturPajakId = _ambilrecordVendInvoiceJour.TECFakturPajakId;
           // _VendInvoiceId      = VendInvoiceJour.InvoiceId;
            _VendInvoiceId = _ambilrecordVendInvoiceJour.InvoiceId;


            select _VendTable where _VendTable.AccountNum == VendInvoiceJour.InvoiceAccount;
            _VendName   = _VendTable.NamaVendor();
            Alamat      = _VendTable.postalAddress().Address;
            NPWP_Vendor = _VendTable.TECNPWP;



            select _VendInvoiceTrans where _VendInvoiceTrans.PurchID == VendInvoiceJour.PurchId
            && _VendInvoiceTrans.InvoiceId           == VendInvoiceJour.InvoiceId
            && _VendInvoiceTrans.InvoiceDate         == VendInvoiceJour.InvoiceDate
            && _VendInvoiceTrans.numberSequenceGroup == VendInvoiceJour.numberSequenceGroup
            && _VendInvoiceTrans.InternalInvoiceId   == VendInvoiceJour.InternalInvoiceId;

            Nama_Barang         = _VendInvoiceTrans.name;
            Harga_Jual_Valas    = _VendInvoiceTrans.lineamountMST;
            Harga_Jual_Rupiah   = _VendInvoiceTrans.LineAmount;

            if(Harga_Jual_Valas == Harga_Jual_Rupiah)
            {
                Harga_Jual_Valas = 0;
                SalesBalanceMST  = 0;
            }
            else
            {
                Harga_Jual_Valas = _VendInvoiceTrans.LineAmountMST;

            }

            SalesBalance    = VendInvoiceJour.SalesBalance;


            select _DirPartyTable where _DirPartyTable.RecId == _CompanyInfo.TECFakturPajakPersonId;
            select _DirPerson where _DirPerson.RecId == _DirPartyTable.RecId;
            NamaPengesah    = _DirPerson.Name;


            if(VendInvoiceJour.InvoiceAmount)
            {
                Judul = "NOTA RETURN";
            }
            else
            {
                Judul = "FAKTUR PAJAK";
            }


            element.send(vendinvoicejour);

        }
    }

    return ret;
}



==================== ATAU ==============

public boolean fetch()
{
    boolean ret;
    this.query().dataSourceNo(1).addRange(fieldNum(KRE_RptFakturPajak, ID_Tax_Transdate)).value(SysQuery::range(_fromDate,_toDate));

    ret = super();

    return ret;
}


=========================================================================================================

public Object dialog(Object _dialog)
{
    Object ret;

    ret = super(_dialog);

    dialogReportHeader = _dialog.addFieldValue(enumStr(TIDReportHeaderEnums),TIDReportHeaderEnums::None,'Desain Header');

    return ret;
} 


 public Object dialog(Object _dialog)
{
    Object ret;

    ret = super(_dialog);

    dialogReportHeader = _dialog.addField(enumStr(TIDPOReportHeader), 'Report Header');
    dialogTtd = _dialog.addField(enumStr(NoYes), 'Tanda Tangan');

    return ret;
}
  
public Object dialog(Object _dialog)
{
   DialogRunbase dialog = _dialog;
    ;
    dialog.addGroup('Period');
    dialogFromDate = dialog.addFieldValue(ExtendedTypeStr(TransDate),systemDateGet(),'From ');
    dialogToDate = dialog.addFieldValue(ExtendedTypeStr(TransDate),systemDateGet(),'To ');

    dialog.addGroup('Product');
    dialogItemId      = dialog.addFieldValue(ExtendedTypeStr(ItemId),"",'Product:');
    dialogWareHouse   = dialog.addFieldValue(ExtendedTypeStr(InventLocationId),"",'Warehouse:');

    return dialog;
}


boolean getFromDialog()
{
    fromDate  = dialogFromDate.value();
    toDate    = dialogToDate.value();
    itemId    = dialogItemId.value();
    _warehouse = dialogWareHouse.value();


    if(!fromDate || !toDate)
    {   error('Tanggal harus diisi');
        return false;
    }

    if(!_warehouse)
    {
        error('Warehouse harus diisi');
        return false;
    }

    return true;
}








0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH