Pages

Banner 468 x 60px

 

Wednesday, November 22, 2017

Choise Report Design X++

0 comments
Choise Report Design X++ :

public boolean fetch()
{
    boolean ret;
    Str     Lebl, Lebay;
    Int     I = 1, II = 1;
    Amount  _UMuka, _Uang, _UMukaCUR;

    Voucher                 _Voucher;
    ItemGroupId             _ItemGroup;
    container               _Cont;

    GG_FPJVoucher           _GG_FPJVoucher,_GG_FPJVoucherOffSet;
    CustInvoiceLine         _CustInvoiceLine;
    CustInvoiceTable        _CustInvoiceTable;
    CustInvoiceJour         _CustInvoiceJour;
    CustInvoiceTrans        _CustInvoiceTrans, _CustInvoiceTrans1;
    InventTable             _InvTable, _InvTable1;
    CustSettlement          _CustSettlement, _CustSettlementOffset;
    CustTrans               _CustTrans;
    ProjInvoiceOnAcc        _ProjInvoiceOnAcc;
    ProjInvoiceJour         _ProjInvoiceJour;

    Query                   _query      = New Query();
    QueryRun                _qr         = New QueryRun(_query);
    QueryBuildDataSource    _qbds       = _qr.query().addDataSource(TableNum(GG_FPJVoucher));
    QueryBuildRange         _qbrvoucher = _qbds.addRange(FieldNum(GG_FPJVoucher,FPJVoucherId));
    ;
    ret = True;//super();

    //Element.Posisi4Rp();

    _GG_FPJVoucherId    = _GG_FPJVoucherSource.FPJVoucherId;
    _CustTrans = CustTrans::findVoucher(_GG_FPJVoucherSource.Voucher);

    _qbrvoucher.value(SysQuery::value(_GG_FPJVoucherId));

    _qr.next();

    _GG_FPJVoucher          = _qr.get(TableNum(GG_FPJVoucher));

    _Balance                = _GG_FPJVoucher.TotalVoucherAmount -
                                (_GG_FPJVoucher.AmountDPPFaktur *
                                (1 + ((_GG_FPJVoucher.VATPercent + _GG_FPJVoucher.PPhPercent)/100)));
    _GetVoucher             = StrFmt("%1 / %2",_GG_FPJVoucher.Voucher, _GG_FPJVoucher.SalesId);
    _GG_FPJFakturPajakNum   = CustTable::find(_GG_FPJVoucher.CustAccount).Soltius_CustTaxId + _GG_FPJVoucher.getFakturPajakNum();
    _CustAccount            = _GG_FPJVoucher.CustAccount;
    _PPNBaseAmount          = _GG_FPJVoucher.AmountPPNFaktur;
    totalDisc               = 0;
    Curr                    = _GG_FPJVoucher.CurrencyCode;

    /*
    IF (Curr != Companyinfo::find().CurrencyCode)
        Element.Design("ReportDesignUSD");
    Else
        Element.Design("ReportDesignIDR");
    */

    //BIT 20130306
    IDRExchRate     = _GG_FPJVoucher.IDRExchRate;
    companyCurrency = CompanyInfo::standardCurrency();

    if (companyCurrency == #IDR)
    {
        IF (Curr != companyCurrency)
            Element.Design("ReportDesignUSD");
        Else
            Element.Design("ReportDesignIDR");
    }
    else
    {
        if (Curr == #IDR)
        {
            Element.Design("ReportDesignIDR");
        }
        else
        {
            Element.Design("ReportDesignUSD");
        }
    }
    //end

    switch (_GG_FPJVoucher.FPJVoucherType)
    {
        case GG_FPJVoucherType::CashReceipt:
            linename        = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).Txt;
            //BIT 20130306
            //if (_GG_FPJVoucher.SalesId)
            //    linename = strfmt("%1 (%2)", linename, _GG_FPJVoucher.SalesId);
            //end
            _FPDate         = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).TransDate;
            _DPPAmount      = Abs(_GG_FPJVoucher.DPPBaseAmount);///Abs(_GG_FPJVoucher.AmountDPPFaktur);// * -1;
            _PPNBaseAmount  = Abs(_GG_FPJVoucher.AmountPPNFaktur);// * -1;
            ExchRate        = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).ExchRate;

            conBody[I]  = [linename, _DPPAmount];
            Break;

        case GG_FPJVoucherType::BBCR:
            linename        = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).Txt;
            //BIT 20130306
            //if (_GG_FPJVoucher.SalesId)
            //    linename = strfmt("%1 (%2)", linename, _GG_FPJVoucher.SalesId);
            //end
            _FPDate         = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).TransDate;
            _DPPAmount      = Abs(_GG_FPJVoucher.AmountDPPFaktur);// * -1;
            _PPNBaseAmount  = Abs(_GG_FPJVoucher.AmountPPNFaktur);// * -1;
            ExchRate        = LedgerJournalTrans::find(_GG_FPJVoucher.JournalId,_GG_FPJVoucher.Voucher, False).ExchRate;

            conBody[I]  = [linename, _DPPAmount];
            Break;

        Case GG_FPJVoucherType::Invoice:
            _FPDate = _GG_FPJVoucher.VoucherDate;
            ExchRate= CustInvoiceJour::findInvoiceId(_GG_FPJVoucher.Voucher, False).ExchRate;

            Select _CustInvoiceTrans1 Index Hint InvoiceIdx
                        Where _CustInvoiceTrans1.InvoiceId == _GG_FPJVoucher.Voucher
                            && _CustInvoiceTrans1.SalesId == _GG_FPJVoucher.SalesId
                            Join _InvTable1 Index Hint ItemIdx Order by ItemGroupId
                            Where _InvTable1.ItemId == _CustInvoiceTrans1.ItemId;


                IF (_CustInvoiceTrans1)
                {
                    WHILE (_CustInvoiceTrans1)
                    {
                        linename    = InventItemGroup::find(_InvTable1.ItemGroupId).Name;
                        //BIT 20130306
                        //if (_GG_FPJVoucher.SalesId)
                        //    linename = strfmt("%1 (%2)", linename, _GG_FPJVoucher.SalesId);
                        //end
                        _DPPAmount  = _CustInvoiceTrans1.lineAmountInclTax() + Abs(TaxTrans::FindAmount(_GG_FPJVoucher.Voucher, _CustInvoiceTrans1.InventTransId).TaxAmount);
                        totalDisc   = _CustInvoiceTrans1.DiscAmount * _CustInvoiceTrans1.Qty;

                        conBody[I]  = [linename, _DPPAmount, totalDisc];
                        I ++;
                        Next _CustInvoiceTrans1;
                        //Next _InvTable1;
                    }
                    BREAK;
                }
                ELSE IF (_CustTrans.TransType == LedgerTransType::Project)
                {
                    _ProjInvoiceJour    = ProjInvoiceJour::find(_CustTrans.Voucher, _CustTrans.TransDate);
                    Select _ProjInvoiceOnAcc Where _ProjInvoiceOnAcc.ProjInvoiceId == _ProjInvoiceJour.ProjInvoiceId;
                    linename    = _ProjInvoiceOnAcc.Txt;
                    //BIT 20130306
                    //if (_GG_FPJVoucher.SalesId)
                    //    linename = strfmt("%1 (%2)", linename, _GG_FPJVoucher.SalesId);
                    //end
                    _DPPAmount  = _ProjInvoiceOnAcc.Amount;
                    totalDisc   = 0;
                    conBody[I]  = [linename, _DPPAmount, totalDisc];
                    Break;
                }
                ELSE //IF (!_CustInvoiceTrans)
                {
                    SELECT _CustInvoiceLine
                        JOIN _CustInvoiceTable
                        WHERE _CustInvoiceLine.ParentRecId == _CustInvoiceTable.RecId
                        && _CustInvoiceTable.InvoiceId == _GG_FPJVoucher.Voucher;
                    linename    = _CustInvoiceLine.Description;
                    //BIT 20130306
                    //if (_GG_FPJVoucher.SalesId)
                    //    linename = strfmt("%1 (%2)", linename, _GG_FPJVoucher.SalesId);
                    //end
                    _DPPAmount  = _CustInvoiceLine.AmountCur;
                    totalDisc   = _CustInvoiceTrans.DiscAmount * _CustInvoiceTrans.Qty;
                    conBody[I]  = [linename, _DPPAmount, totalDisc];
                    Break;
                }


    }
    linename = 'XXXXXXXXXXXXXX';
    I   = 1;
    II  = 0;
    While (conBody[I])
    {
        IF (linename            != Conpeek(conBody[I], 1))
        {
            II++;
            //IF (linename)
            //    Element.execute(1);
            linename            = StrFmt("%1",Conpeek(conBody[I], 1));
            _DPPAmount          = Conpeek(conBody[I], 2);
            _DppAmountCur       = (_DPPAmount * ExchRate) /100;

            IF (Conpeek(conBody[I], 3))
                TotalDiscCur    = ((Conpeek(conBody[I], 3)) * ExchRate) /100;


            conBody1[II]    = [linename, _DPPAmount, _DppAmountCur];

        }
        ELSE
        {
            _DPPAmount  += Conpeek(conBody[I], 2);
            _DppAmountCur += (_DPPAmount * ExchRate) /100;
            conBody1[II]    = ConPoke(conBody1[II], 2, _DPPAmount);
            conBody1[II]    = ConPoke(conBody1[II], 3, _DppAmountCur);
        }
        I++;
    }

    II = 1;
    linename = 'XXXXXXXXXXXXXX';
    While (conBody1[II])
    {
        IF (linename            != StrFmt("%1",Conpeek(conBody1[II], 1)))
        {
            linename            = Conpeek(conBody1[II], 1);
            _DPPAmount          = Conpeek(conBody1[II], 2);
            _DppAmountCur       = (_DPPAmount * ExchRate) /100;

            _TotalDPP           += _DPPAmount;
            _TotalDPPCur        += _DppAmountCur;
            Element.execute(1);
        }
        II++;
    }

    //BIT
    element.execute(9);
    //end

    Element.SetHeight();
    /*Total Nilai*/
    Label.left(10, Units::char);
    Label_1.left(14, Units::char);
    Label.text("XXXXXXXXXXXXXXXXXXXX");
    Label_1.text("XXXXXXXXXXXXXXXXXXXX");
    _AGlobal    = _TotalDPP;
    _AGlobalCur = _TotalDPPCur;
    Element.execute(3);

    /*Total Discount*/
    Label.text("");
    Label_1.text("");
    _AGlobal    = totalDisc;
    _AGlobalCur = TotalDiscCur;
    Element.execute(3);

    /*Total Uang Muka*/
    _AGlobal = 0;
    If (Round(_GG_FPJVoucher.DPPBaseAmount, 1) == Round(_GG_FPJVoucher.AmountDPPFaktur, 1))
    {
        Label.text("");
        Label_1.text("");
        _AGlobal    = 0;
    }
    Else
    {
        _Cont   = _GG_FPJVoucher.GetDPFaktur4Print();
        IF (conpeek(_Cont, 1))
        {
            Label.width((100 - (76-StrLen(conpeek(_Cont, 1)))), Units::char);
            Label_1.width((100 - (76-StrLen(conpeek(_Cont, 1)))), Units::char);
            Label.text("( " + conpeek(_Cont, 1) + " )");
            Label_1.text("( " + conpeek(_Cont, 1) + " )");
            _AGlobal= conpeek(_Cont, 2);
            _AGlobalCur = (_AGlobal * _GG_FPJVoucher.FPJExchRate)/100;
        }
    }
    Label.left(15, Units::char);
    Label.bold(1);
    Label_1.left(15, Units::char);
    Label_1.bold(1);
    _UMuka = _AGlobal;
    _UMukaCUR = _AGlobalCur;
    Element.execute(3);

    /*Total Dasar Pengenaan Pajak*/
    Label.text("");
    Label_1.text("");
    _AGlobalCur = _TotalDPPCur - TotalDiscCur - _UMukaCUR;
    _AGlobal = _TotalDPP - _UMuka;
    Element.execute(3);

    /*Total PPn*/
    Label.text("");
    Label_1.text("");
    IF (_GG_FPJVoucher.Berikat == NoYes::No)
    {
    _AGlobal    = _AGlobal * (_GG_FPJVoucher.VATPercent/100);
    _AGlobalCur = _AGlobalCur * (_GG_FPJVoucher.VATPercent/100);
    }
    Else
    {
    _AGlobal    = _AGlobal * (10/100);
    _AGlobalCur = _AGlobalCur * (10/100);
    }
    Element.execute(3);

    //GetLineName.height(13,units::char);

    Soltius_Name                  = CustParameters::getFPAuthorityName();
    Soltius_Position              = CustParameters::getFPAuthorityPos();

    /*
    IF (Curr != Companyinfo::find().CurrencyCode)
        _GetExchRate = StrFmt("Kurs Rp. %1", ExchRate / 100);
    */
    //BIT 20130306
    if (companyCurrency == #IDR)
    {
        IF (Curr != companyCurrency)
            _GetExchRate = StrFmt("Kurs Rp. %1", ExchRate / 100);
    }
    else
    {
        if (Curr != #IDR)
        {
            _GetExchRate = StrFmt("Kurs Rp. %1", IDRExchRate ? ExchRate / IDRExchRate : 0);
        }
    }
    //end

    Element.execute(5);

    return ret;

}

0 comments:

A financial dimension value is based on the LAND-00013 record and has been used on a transaction. You cannot delete the LAND-00013 record AX 2012

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