Selection combobox with IF Condition in x++ :
public
boolean modified()
{
    boolean    
ret;
    Amount              _DPPFaktur, _PPNFaktur,
_PPhFaktur;
    container  
_Cont;
    ret = super();
    if (GG_FPJVoucher_Voucher.text() !=
"")
    {
        _Cont  
= element.getVoucherInfo(GG_FPJVoucher_Voucher.text());
       
GG_FPJVoucher_CustAccount.text(conpeek(_Cont, 1));
       
GG_FPJVoucher_VoucherDate.dateValue(conpeek(_Cont, 2));
       
GG_FPJVoucher_JournalId.text(conpeek(_Cont, 3));
        GG_FPJVoucher_CurrencyCode.text(conpeek(_Cont,
4));
       
GG_FPJVoucher_TotalVoucherAmount.realValue(conpeek(_Cont, 5));
       
GG_FPJVoucher_FPJExchRate.realValue(conpeek(_Cont, 6));
       
GG_FPJVoucher_PPhExchRate.realValue(conpeek(_Cont, 7));
        GG_FPJVoucher_FPJVoucherType.selection(conpeek(_Cont,
8));
        GGSalesID.text(conpeek(_Cont, 9));
        PPNPercent.realValue(conpeek(_Cont,
10));
        PPhPercent.realValue(conpeek(_Cont,
11));
        Berikat.value(conpeek(_Cont, 12));
        [_DPPFaktur, _PPNFaktur, _PPhFaktur]    =
element.calculateAmountFaktur(GG_FPJVoucher_Voucher.text(), conpeek(_Cont, 9));
        element.calculateDPP_VAT_PPh();
       
OthFaktur.allowEdit(Element.GetOthFaktur(GG_FPJVoucher_Voucher.text()));
        // added by adit
            if(GG_Fpjvoucher::FindVoucher(GG_FPJVoucher_Voucher.text()).UangMuka
== noyes::Yes)
            {
                    Advance.value(noyes::Yes);
                    Advance.allowEdit(false);
                    Retention.allowEdit(false);
                    Cash.allowEdit(false);
                    Credit.allowEdit(false);
            }
           
if(GG_FPJVoucher::FindVoucher(GG_Fpjvoucher_voucher.text()).Retensi ==
noyes::Yes)
            {
                   
Retention.value(noyes::Yes);
                    Advance.allowEdit(false);
                    Retention.allowEdit(false);
                    Cash.allowEdit(false);
                    Credit.allowEdit(false);
            }
           
if(GG_FPJVoucher::FindVoucher(GG_FpjVoucher_voucher.text()).BIT_Cash ==
noyes::Yes)
            {
                    Cash.value(noyes::Yes);
                    Advance.allowEdit(false);
                    Retention.allowEdit(false);
                    Cash.allowEdit(false);
                    Credit.allowEdit(false);
            }
           
if(GG_FPJVoucher::FindVoucher(GG_FPJVoucher_voucher.text()).BIT_Credit
== noyes::Yes)
            {
                    Credit.value(noyes::Yes);
                    Advance.allowEdit(false);
                    Retention.allowEdit(false);
                    Cash.allowEdit(false);
                    Credit.allowEdit(false);
            }
        
if(GG_FPJVoucher_FPJVoucherType.selection() ==
GG_FPJVoucherType::CashReceipt)
            {
                    Advance.allowEdit(true);
                    Retention.allowEdit(true);
                    Cash.allowEdit(true);
                    credit.allowEdit(false);
            }
          
if(GG_FPJVoucher_FPJVoucherType.selection() !=
GG_FPJVoucherType::CashReceipt)
            {
                    Advance.allowEdit(false);
                    Retention.allowEdit(true);
                    Cash.allowEdit(false);
                    Credit.allowEdit(true);
            }
        // ended by adit
    }
    return ret;
}
void
BIT_calculateDPP_VAT_PPh()
{
    Amount     
_AmountTotal;
    int        
_VoucherType;
    Amount     
_DPP, _VAT, _PPh;
    Real       
_Pr;
    ;
    _AmountTotal    =
BIT_GG_FPJVoucher_TotalBaseAmount.realValue();
    _Pr    
= PPNPercent.realValue() + PPhPercent.realValue();
    _DPP   
= abs(_AmountTotal * (100/(100 + _Pr)));
    _VAT   
= abs(_DPP * PPNPercent.realValue() / 100);
    _PPh   
= abs(_DPP * PPhPercent.realValue() / 100);
    if (GG_FPJVoucher_FPJVoucherType.selection()
== GG_FPJVoucherType::CashReceipt ||
       
GG_FPJVoucher_FPJVoucherType.selection() ==
GG_FPJVoucherType::ReturnInv)
    {
       
BIT_GG_FPJVoucher_DPPBaseAmount.realValue(- _DPP);
       
BIT_GG_FPJVoucher_PPNBaseAmount.realValue(- _VAT);
       
BIT_GG_FPJVoucher_PPHBaseAmount.realValue(- _PPh);
    }
    else
    {
       
BIT_GG_FPJVoucher_DPPBaseAmount.realValue(_DPP);
       
BIT_GG_FPJVoucher_PPNBaseAmount.realValue(_VAT);
       
BIT_GG_FPJVoucher_PPHBaseAmount.realValue(_PPh);
    }
}
 // added by adit - Tampilkan nilai Base Amount
setelah modified
        // Jika tipenya = Invoice &&
Return maka tidak bisa memilih Reference Realisasi, jadi nilai Total Base
amount dan Total Voucher amount sama
        // Jika tipenya = Cash Receipt = maka
bisa memilih Reference Realisasi, jadi nilai Total Base amount dan Total
Voucher amount beda
       
/*if(GG_FPJVoucher::findbyVoucher(GG_FPJVoucher_Voucher.text()).FPJVoucherType
== GG_FPJVoucherType::Invoice || GG_FPJVoucherType::ReturnCR ||
GG_FPJVoucherType::ReturnInv)
        {
            ReferenceRealisasi.enabled(false);
           
BIT_GG_FPJVoucher_TotalBaseAmount.realValue(conpeek(_Cont, 5));
        }
       
if(GG_FPJVoucher::findbyVoucher(GG_FPJVoucher_Voucher.text()).FPJVoucherType
== GG_FPJVoucherType::CashReceipt)
        {
            ReferenceRealisasi.enabled(true);
           
//BIT_GG_FPJVoucher_TotalBaseAmount.realValue(conpeek(_Cont, 13));
           
//element.BIT_calculateDPP_VAT_PPh();
        }*/
        /*
        
if(GG_FPJVoucher_FPJVoucherType.selection() ==
GG_FPJVoucherType::CashReceipt)
         {
            ReferenceRealisasi.enabled(true);
         }
        else
         {
            ReferenceRealisasi.enabled(false);
            BIT_GG_FPJVoucher_TotalBaseAmount.realValue(conpeek(_Cont,
5));
         }
         */
        // ended by adit - Tampilkan nilai Base
Amount setelah modified
==========================================
  if(GG_FPJVoucher_FPJVoucherType.selection()
== GG_FPJVoucherType::CashReceipt)
                                    {
                                          
ttsbegin;
                                              
while Select forupdate _salesline where _salesline.SalesId ==
_SalesIdBase
                                                              
&& _salesline.BIT_ReferenceRealisasi == _BIT_ReferenceRealisasi
                                                              
{
                                                                  _salesline.BIT_StatusSO
= BIT_statusSO::Closed;
                                                                 
_salesline.update();
                                                              
}
                                           ttscommit;
                                          
GG_Fpjvoucher2.BIT_ReferenceRealisasi  
= _BIT_ReferenceRealisasi;
                                    }
==================================================
0 comments:
Post a Comment