Pages

Banner 468 x 60px

 

Tuesday, November 21, 2017

Sample Container in x++

0 comments
Sample Container in x++ :

private void Export_Retention_Finish()
{
    GG_FPJVoucher           _GG_FPJVoucher;
    CustInvoiceTrans        _CustInvoiceTrans, _CustInvoiceTransUangMuka;
    LedgerJournalTrans      _LedgerJournalTrans;
    InventTable             _InvTable, _InvTable1;
    AmountMST               _AmountMST;
    SalesLine               _SalesLine;

    Amount                  _DPPAmount,_DPPAmount2, TotalDppAmount, FG_UANG_MUKA, _AGlobal;
    Container               _Container;
    Textbuffer              _TextBuffer;

    Query query = new Query();
    QueryBuildDataSource    qbds1;
    QueryBuildDataSource    qbds2;
    QueryBuildRange         qbdr1;
    QueryBuildRange         qbdr2;
    QueryBuildRange         qbdr3;
    QueryRun                queryrun;
    System.DateTime         dt;
    str                     bulan2digit;
    CommaIo                 file;
    container               line;
    container               Baris1;
    container               Baris2;
    container               Baris3;
    real                    totalDPP;
    real                    totalPPN;
    real                    totalExc;
    real                    totalDiskon;
    int                     panjang;
    boolean                 adaDisk;
    boolean                 adaDP;
    CustTable               tct;
    str                     custchannel;

    #define.io_write("w")
    ;
    qbds1 = query.addDataSource(tableNum(GG_FPJVoucher));

    TaxinvoiceDateId= fieldnum( GG_FPJVoucher, VoucherDate );

    qbds1.addRange(TaxinvoiceDateId).value(queryRange( dialogStartDate.value(), dialogUntilDate.value() ));

    filename = dialogFileName.value();
    queryrun = new QueryRun(query);
    file = new CommaIo(filename,#io_write);
    line = ["Kode Pajak","Kode Transaksi","Kode Status","Kode Dokumen", "Flag VAT"
            ,"NPWP/Nomor Paspor", "Nama Lawan Transaksi", "Nomor Faktur/Dokumen"
            ,"Jenis Dokumen", "Nomor Faktur Pengganti/Retur", "Jenis Dokumen Dokumen Pengganti/Retur"
            ,"Tanggal Faktur/Dokumen","Tanggal SSP","Masa Pajak","Tahun Pajak","Pembetulan","DPP","PPN","PPnBM"];
    Baris1 = ["FK","KD_JENIS_TRANSAKSI","FG_PENGGANTI","NOMOR_FAKTUR","MASA_PAJAK","TAHUN_PAJAK","TANGGAL_FAKTUR","NPWP"
            ,"NAMA","ALAMAT_LENGKAP","JUMLAH_DPP","JUMLAH_PPN","JUMLAH_PPNBM","ID_KETERANGAN_TAMBAHAN","FG_UANG_MUKA"
            ,"UANG_MUKA_DPP","UANG_MUKA_PPN","UANG_MUKA_PPNBM","REFERENSI"];
    Baris2 = ["LT","NPWP","NAMA","JALAN","BLOK","NOMOR","RT","RW","KECAMATAN","KELURAHAN","KABUPATEN","PROPINSI"
            ,"KODE_POS","NOMOR_TELEPON","","","","",""];
    Baris3 = ["OF","KODE_OBJEK","NAMA","HARGA_SATUAN","JUMLAH_BARANG","HARGA_TOTAL","DISKON","DPP","PPN","TARIF_PPNBM"
            ,"PPNBM","","","","","","","",""];

    file.writeExp(Baris1);
    file.writeExp(Baris2);
    file.writeExp(Baris3);

    while (queryrun.next())
    {
        _GG_FPJVoucher = queryrun.get(tableNum(GG_FPJVoucher));

        dt = _GG_FPJVoucher.VoucherDate;
        bulan2digit = dt.ToString("MM");
        if(strLen(bulan2digit) != 2)
        {
            bulan2digit = "0" + bulan2digit;
        }

        totalExc    = 0;
        totalPPN    = 0;
        totalDiskon = 0;

            custChannel = strFmt("%1", _GG_FPJVoucher.BIT_REFRENSI());
            _CustInvoiceTransUangMuka  = CustInvoiceTrans::BIT_FindCustInvoiceTrans(_GG_FPJVoucher.Voucher);

                       // Typenya Invoice
                       if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                && _GG_FPJVoucher.FPJVoucherType == GG_FPJVoucherType::Invoice
                                        &&  _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                          {
                              _DPPAmount  = _CustInvoiceTransUangMuka.lineAmountInclTax() + Abs(TaxTrans::FindAmount(_GG_FPJVoucher.Voucher, _CustInvoiceTransUangMuka.InventTransId).TaxAmount);
                              TotalDppAmount += _DPPAmount;
                              _Container   = _GG_FPJVoucher.GetDPFaktur4Print();
                              _AGlobal= conpeek(_Container, 2);

                              if(_AGlobal != 0)
                              {
                                        FG_UANG_MUKA = _AGlobal;

                                        line = ["FK"
                                            ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                            ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                            //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                            , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                            // , 4
                                            // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                            // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                            ,bulan2digit
                                            ,year(_GG_FPJVoucher.VoucherDate)
                                            ,date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                            ,DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                            ,decround(_GG_FPJVoucher.DPPBaseAmount, 0)
                                            ,decround(abs(decround(_GG_FPJVoucher.DPPBaseAmount, 0)) * 0.1 , 0)
                                            ,0
                                            ,""
                                            ,2
                                            //,abs(decround(FG_UANG_MUKA, 0))
                                            ,decround(_GG_FPJVoucher.DPPBaseAmount - abs(FG_UANG_MUKA) , 0)
                                            //,decround(abs(decround(FG_UANG_MUKA, 0)) * 0.1 , 0)
                                            ,decround((_GG_FPJVoucher.DPPBaseAmount - abs(FG_UANG_MUKA)) * 0.1, 0)
                                            ,0
                                            ,custchannel];
                                            file.writeExp(line);
                                }
                                else
                                {
                                    line = ["FK"
                                            ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                            ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                            //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                            , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                            // , 4
                                            // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                            // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                            ,bulan2digit
                                            ,year(_GG_FPJVoucher.VoucherDate)
                                            ,date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                            ,DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                            ,strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                            ,decround(_GG_FPJVoucher.DPPBaseAmount, 0)
                                            ,decround(abs(decround(_GG_FPJVoucher.DPPBaseAmount, 0)) * 0.1 , 0)
                                            ,0
                                            ,""
                                           // ,2
                                           , 0
                                            ,0
                                            ,0
                                            ,0
                                            ,custchannel];
                                            file.writeExp(line);
                                }


                         while select * from _CustinvoiceTrans
                                where _CustInvoiceTrans.InvoiceId == _GG_FPJVoucher.Voucher
                            {
                                line = ["OF"
                                    ,strReplace(strReplace(_custInvoiceTrans.ItemId,'"',' '),',',' ')
                                    ,strReplace(strReplace(_CustInvoiceTrans.Name,'"',' '),',',' ')
                                    ,decround((_CustInvoiceTrans.LineAmountMST / _CustInvoiceTrans.Qty), 0)
                                    ,_CustInvoiceTrans.Qty
                                    ,decround(_CustInvoiceTrans.LineAmountMST, 0)
                                    ,0
                                    ,decround(_custInvoiceTrans.LineAmountMST, 0)
                                    ,decround((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1), 0)
                                    ,0
                                    ,0
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""
                                    ,""];
                                file.writeExp(line);
                            }
                          }

                        // Uang Muka (Advance)
                        if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                &&  _GG_FPJVoucher.UangMuka == noyes::Yes
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::Invoice
                                        && _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                            {
                                    select _ledgerjournalTrans where _ledgerjournalTrans.Voucher == _GG_FPJVoucher.Voucher;

                                    line = ["FK"
                                       ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                       ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                       //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                       , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                      // , 4
                                      // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                      // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 1
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , custchannel];
                                    file.writeExp(line);

                                   while select * from _LedgerJournalTrans
                                        where _LedgerJournalTrans.Voucher == _GG_FPJVoucher.Voucher
                                    {
                                        line = ["OF"
                                            ,strReplace(strReplace(_LedgerJournalTrans.Txt,'"',' '),',',' ')
                                            ,strReplace(strReplace(_LedgerJournalTrans.Txt,'"',' '),',',' ')
                                            //,abs(decround((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST),0))
                                            ,abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                            ,1
                                            //,abs((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST))
                                            ,abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                            ,0
                                            //, abs(round(LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST,1))
                                            ,abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                            //, round((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1),1)
                                            //, abs(round((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST * 0.1),1))
                                            ,abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                            ,0
                                            ,0
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""];
                                        file.writeExp(line);
                                    }
                                }

                        // Retention
                        if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                && _GG_FPJVoucher.BIT_Realisasi == noyes::Yes
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::Invoice
                                        && _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                            {
                                    select _ledgerjournalTrans where _ledgerjournalTrans.Voucher == _GG_FPJVoucher.Voucher;

                                    //_Container   = _GG_FPJVoucher.GetDPFaktur4Print();
                                    //_AGlobal= conpeek(_Container, 2);

                                 // if(_AGlobal != 0)
                                 // {
                                    line = ["FK"
                                        //, "'" + substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2)
                                        , strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                        , strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                        //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                        , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                       // , 4
                                       // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                       // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 1
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                       // , abs(decround(FG_UANG_MUKA, 0))
                                       // , decround(abs(decround(FG_UANG_MUKA, 0)) * 0.1 , 0)
                                        , 0
                                        , custchannel];
                                        file.writeExp(line);
                                  /*  }
                                    else
                                    {
                                        line = ["FK", "01", "0"
                                        , subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                        , 4
                                        , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 1
                                        , 0
                                        , 0
                                        , 0
                                        , custchannel];
                                        file.writeExp(line);
                                    }
                                    */

                                   while select * from _salesline
                                        where _salesline.SalesId == _GG_FPJVoucher.SalesId
                                        && _salesline.BIT_Voucher == _GG_FpjVoucher.Voucher
                                    {
                                        line = ["OF"
                                            ,strReplace(strReplace(_salesline.ItemId,'"',' '),',',' ')
                                            ,strReplace(strReplace(_salesline.itemName(),'"',' '),',',' ')
                                            ,abs(decround((_salesline.SalesPrice),0))
                                            //,1
                                            //,abs((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST))
                                            ,abs(decround(_salesline.SalesQty, 0))
                                            //,0
                                            //, abs(round(LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST,1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            //,round((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1),1)
                                            //, abs(round((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST * 0.1),1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty * 0.1), 0))
                                            ,0
                                            ,0
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""];
                                        file.writeExp(line);
                                    }
                                }


                        // Cash
                        if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                && _GG_FPJVoucher.BIT_Cash == noyes::Yes
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::Invoice
                                        && _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                            {
                                    select _ledgerjournalTrans where _ledgerjournalTrans.Voucher == _GG_FPJVoucher.Voucher;

                                    line = ["FK"
                                        ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                        ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                     // , subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                        , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                     // , 4
                                     // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                     // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 0
                                        , 0
                                        , 0
                                        , 0
                                        , custchannel];
                                    file.writeExp(line);

                                   while select * from _salesline
                                        where _salesline.SalesId == _GG_FPJVoucher.SalesId
                                    {
                                        line = ["OF"
                                            ,strReplace(strReplace(_salesline.ItemId,'"',' '),',',' ')
                                            ,strReplace(strReplace(_salesline.itemName(),'"',' '),',',' ')
                                            ,abs(decround((_salesline.SalesPrice),0))
                                            //,1
                                            //,abs((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST))
                                            ,abs(decround(_salesline.SalesQty, 0))
                                            //,0
                                            //, abs(round(LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST,1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            //,round((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1),1)
                                            //, abs(round((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST * 0.1),1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            //,decround(abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0)) * 0.1 , 0)
                                            ,decround(abs(decround(_salesline.SalesPrice * _salesline.SalesQty, 0)) * 0.1 , 0)
                                            ,0
                                            ,0
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""];
                                        file.writeExp(line);
                                    }
                                }

                        // Credit
                        if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                && _GG_FPJVoucher.BIT_Credit == noyes::Yes
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::Invoice
                                        && _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                            {
                                    select _ledgerjournalTrans where _ledgerjournalTrans.Voucher == _GG_FPJVoucher.Voucher;

                                    line = ["FK"
                                        ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                        ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                       //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                        , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                       // , 4
                                       // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                       // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 0
                                        , 0
                                        , 0
                                        , 0
                                        , custchannel];
                                    file.writeExp(line);

                                   while select * from _salesline
                                        where _salesline.SalesId == _GG_FPJVoucher.SalesId
                                    {
                                        line = ["OF"
                                            ,strReplace(strReplace(_salesline.ItemId,'"',' '),',',' ')
                                            ,strReplace(strReplace(_salesline.itemName(),'"',' '),',',' ')
                                            ,abs(decround((_salesline.SalesPrice),0))
                                            //,1
                                            //,abs((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST))
                                            ,abs(decround(_salesline.SalesQty, 0))
                                            //,0
                                            //, abs(round(LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST,1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            //,round((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1),1)
                                            //, abs(round((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST * 0.1),1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            ,0
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""];
                                        file.writeExp(line);
                                    }
                                }




                        // Jika selain kondisi diatas (Default)
                        else if(_GG_FPJVoucher.BIT_Batal == noyes::No
                                && _GG_FPJVoucher.uangmuka == noyes::no
                                && _GG_FPJVoucher.BIT_Realisasi == noyes::no
                                && _GG_FPJVoucher.BIT_Cash == noyes::no
                                && _GG_FPJVoucher.BIT_Credit == noyes::no
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::Invoice
                                    && _GG_FPJVoucher.FPJVoucherType != GG_FPJVouchertype::CashReceipt
                                        && _GG_FPJVoucher.FPJFakturPajakNum != ""
                                             &&  _GG_FPJVoucher.bit_kodePajak != '011')
                            {
                                    select _ledgerjournalTrans where _ledgerjournalTrans.Voucher == _GG_FPJVoucher.Voucher;

                                    line = ["FK"
                                        ,strReplace(strReplace(substr(_GG_FPJVoucher.BIT_KodePajak, 1, 2),'-',''),'.','')
                                        ,strfmt("%1", (substr(_GG_FPJVoucher.BIT_KodePajak, 3, 1)))
                                       //, subStr(strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                        , strReplace(strReplace(_GG_FPJVoucher.FPJFakturPajakNum,'-',''),'.','')
                                       // , 4
                                       // , strLen(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''))-3)
                                       // , strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.','')
                                        , bulan2digit
                                        , year(_GG_FPJVoucher.VoucherDate)
                                        , date2str(_GG_FPJVoucher.VoucherDate,123,DateDay::Digits2,DateSeparator::Slash
                                        , DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4)
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustVatNum(),'-',''),'.',''),' ','')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.getCustName(), '\n',' '),'\r',' '),',',' ')
                                        , strReplace(strReplace(strReplace(_GG_FPJVoucher.BIT_ALAMAT_LENGKAP(), '\n',' '),'\r',' '),',',' ')
                                        , abs(decround(_GG_FPJVoucher.AmountDPPFaktur, 0))
                                        , abs(decround(_GG_FPJVoucher.AmountPPNFaktur, 0))
                                        , 0
                                        , ""
                                        , 0
                                        , 0
                                        , 0
                                        , 0
                                        , custchannel];
                                    file.writeExp(line);

                                   while select * from _salesline
                                        where _salesline.SalesId == _GG_FPJVoucher.SalesId
                                    {
                                        line = ["OF"
                                            ,strReplace(strReplace(_salesline.ItemId,'"',' '),',',' ')
                                            ,strReplace(strReplace(_salesline.itemName(),'"',' '),',',' ')
                                            ,abs(decround((_salesline.SalesPrice),0))
                                            //,1
                                            //,abs((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST))
                                            ,abs(decround(_salesline.SalesQty, 0))
                                            //,0
                                            //, abs(round(LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST,1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            //,round((((_custinvoiceTrans.LineAmountMST / _custInvoiceTrans.Qty) * _CustInvoiceTrans.Qty)*0.1),1)
                                            //, abs(round((LedgerTrans::findVoucher(_GG_FPJVoucher.Voucher).AmountMST * 0.1),1))
                                            ,abs(decround((_salesline.SalesPrice * _salesline.SalesQty), 0))
                                            ,0
                                            ,0
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""
                                            ,""];
                                        file.writeExp(line);
                                    }
                                }
                         }

    info("Export Finished");
  }                                                                                                                                                                                                          

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 ...