Pages

Banner 468 x 60px

 

Wednesday, November 22, 2017

void OK in x++

0 comments
void OK in x++ :

void OK_Button()
{
    GG_FPJVoucher       _GG_FPJVoucher1, GG_FPJVoucher2 ;
    str                 TempTxt1, TempTxt2;
    Args                _Args;
    ;

    // added by adit
    if(Retention.value() == noyes::No && Cash.value() == noyes::No && Credit.value() == noyes::No && Advance.value() == noyes::No)
    {
        error("Maaf, Anda belum memilih jenis transaksi");
        return;
    }
    // ended by adit

    if (GG_FPJVoucher_TotalVoucherAmount.realValue() != 0)
    {
            If ((PPNPercent.realValue() == 0 && Berikat.value() == NoYes::Yes) ||
                (PPNPercent.realValue() != 0 && Berikat.value() == NoYes::No)  ||
                (PPNPercent.realValue() == 0 && Element.CreateFaktur(GG_FPJVoucher2.Voucher)))
            {
                if (box::yesNo("Are you sure to save ?", dialogButton::No, "Confirmation")  == dialogButton::Yes)
                {
                    select _GG_FPJVoucher1 index hint voucheridx where _GG_FPJVoucher1.Voucher    == GG_FPJVoucher_Voucher.text();


                    // ============= Untuk input voucher baru ================
                    if (!_GG_FPJVoucher1)
                    {
                        if (element.checkDateValidation(GG_FPJVoucher_CustAccount.text(), GGSalesID.text(), GG_FPJVoucher_VoucherDate.dateValue()))
                        {
                            //num seq
                            TempTxt2        = GG_FPJParameter::getnextStrId(1, OverwriteNextNum.value());
                            //
                            Try
                            {
                                ttsbegin;
                                GG_FPJVoucher2.clear();
                                GG_FPJVoucher2.Voucher              = GG_FPJVoucher_Voucher.text();
                                GG_FPJVoucher2.CurrencyCode         = GG_FPJVoucher_CurrencyCode.text();
                                GG_FPJVoucher2.JournalId            = GG_FPJVoucher_JournalId.text();
                                GG_FPJVoucher2.VoucherDate          = GG_FPJVoucher_VoucherDate.dateValue();
                                GG_FPJVoucher2.FPJVoucherId         = TempTxt2;
                                GG_FPJVoucher2.CustAccount          = GG_FPJVoucher_CustAccount.text();
                                GG_FPJVoucher2.TotalVoucherAmount   = GG_FPJVoucher_TotalVoucherAmount.realValue();
                                GG_FPJVoucher2.DPPBaseAmount        = GG_FPJVoucher_DPPBaseAmount.realValue();
                                GG_FPJVoucher2.PPNBaseAmount        = GG_FPJVoucher_PPNBaseAmount.realValue();
                                GG_FPJVoucher2.PPhBaseAmount        = GG_FPJVoucher_PPhBaseAmount.realValue();
                                GG_FPJVoucher2.FPJExchRate          = GG_FPJVoucher_FPJExchRate.realValue();
                                GG_FPJVoucher2.PPhExchRate          = GG_FPJVoucher_PPhExchRate.realValue();
                                GG_FPJVoucher2.FPJVoucherType       = GG_FPJVoucher_FPJVoucherType.selection();
                                GG_FPJVoucher2.SalesId              = GGSalesID.text();
                                GG_FPJVoucher2.VATPercent           = PPNPercent.realValue();
                                GG_FPJVoucher2.PPhPercent           = PPhPercent.realValue();
                                GG_FPJVoucher2.RetensiPercent       = RetensiPercent.realValue();
                                GG_FPJVoucher2.RetensiAmount        = RetensiAmount.realValue();
                                GG_FPJVoucher2.UangMuka             = Advance.value();

                                // added by adit
                                GG_FPJVoucher2.Retensi              = Retention.value();
                                GG_FPJVoucher2.BIT_Cash             = Cash.value();
                                GG_FPJVoucher2.BIT_Credit           = Credit.value();
                                GG_FPJVoucher2.BIT_KodePajak        = BIT_KodePajak.valueStr();
                                // ended by adit

                                GG_FPJVoucher2.AlocFPJNum           = OthFaktur.text();
                                GG_FPJVoucher2.Berikat              = Berikat.value();
                                //Breakpoint;
                                If ((Element.CreateFaktur(GG_FPJVoucher2.Voucher)) && ((GG_FPJVoucher2.VATPercent || GG_FPJVoucher2.PPhPercent) || Berikat.value()==NoYes::Yes))
                                    [GG_FPJVoucher2.AmountDPPFaktur, GG_FPJVoucher2.AmountPPNFaktur, GG_FPJVoucher2.AmountPPhFaktur]    = element.calculateAmountFakturTRY(GG_FPJVoucher2.Voucher, GG_FPJVoucher2.SalesId);
                                Else
                                    [GG_FPJVoucher2.AmountDPPFaktur, GG_FPJVoucher2.AmountPPNFaktur, GG_FPJVoucher2.AmountPPhFaktur]    = [0, 0, 0];

                                //Breakpoint;
                                IF ((GG_FPJVoucher2.AmountPPNFaktur > 0) && (GG_FPJVoucher2.AmountPPhFaktur == 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::OpenVAT;

                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur == 0) && (GG_FPJVoucher2.AmountPPhFaktur > 0))
                                {
                                    If (Berikat.value() != NoYes::Yes)
                                    GG_FPJVoucher2.Status       = GG_OpenClose::OpenPPh;
                                }
                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur > 0) && (GG_FPJVoucher2.AmountPPhFaktur > 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Open;

                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur == 0) && (GG_FPJVoucher2.AmountPPhFaktur == 0))
                                {
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Closed;
                                }

                                If ((Berikat.value() == NoYes::Yes) && (GG_FPJVoucher2.AmountDPPFaktur != 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Open;

                                IF (SalesTable::find(GG_FPJVoucher2.SalesId).GGRetensi)
                                    GG_FPJVoucher2.calculateAmountFakturRetensi();

                                GG_FPJVoucher2.insert();
                                ttscommit;
                                info(strfmt("Data Inserted (Id : %1)", GG_FPJVoucher2.FPJVoucherId));
                                element.close();
                            }
                            catch
                            {
                                error("Process error");
                                ttsabort;
                            }

                        }
                        else
                            warning("Older Voucher date already exist in the same Customer account, please check transaction");
                    }
                    /*
                    else
                    {
                            warning("Voucher Already Exist, Cannot Proceed !");
                    }
                    */




//====== Untuk voucher yang sudah pernah di input dan ingin dibatalkan ===========
                    if (_GG_FPJVoucher1 && GG_FpjVoucher::FindVoucher(GG_FPJVoucher_Voucher.valueStr()).BIT_Batal == noyes::Yes)
                    {
                        if (element.checkDateValidation(GG_FPJVoucher_CustAccount.text(), GGSalesID.text(), GG_FPJVoucher_VoucherDate.dateValue()))
                        {
                            //num seq
                            TempTxt2        = GG_FPJParameter::getnextStrId(1, OverwriteNextNum.value());
                            //
                            Try
                            {
                                ttsbegin;
                                GG_FPJVoucher2.clear();
                                GG_FPJVoucher2.Voucher              = GG_FPJVoucher_Voucher.text();
                                GG_FPJVoucher2.CurrencyCode         = GG_FPJVoucher_CurrencyCode.text();
                                GG_FPJVoucher2.JournalId            = GG_FPJVoucher_JournalId.text();
                                GG_FPJVoucher2.VoucherDate          = GG_FPJVoucher_VoucherDate.dateValue();
                                GG_FPJVoucher2.FPJVoucherId         = TempTxt2;
                                GG_FPJVoucher2.CustAccount          = GG_FPJVoucher_CustAccount.text();
                                GG_FPJVoucher2.TotalVoucherAmount   = GG_FPJVoucher_TotalVoucherAmount.realValue();
                                GG_FPJVoucher2.DPPBaseAmount        = GG_FPJVoucher_DPPBaseAmount.realValue();
                                GG_FPJVoucher2.PPNBaseAmount        = GG_FPJVoucher_PPNBaseAmount.realValue();
                                GG_FPJVoucher2.PPhBaseAmount        = GG_FPJVoucher_PPhBaseAmount.realValue();
                                GG_FPJVoucher2.FPJExchRate          = GG_FPJVoucher_FPJExchRate.realValue();
                                GG_FPJVoucher2.PPhExchRate          = GG_FPJVoucher_PPhExchRate.realValue();
                                GG_FPJVoucher2.FPJVoucherType       = GG_FPJVoucher_FPJVoucherType.selection();
                                GG_FPJVoucher2.SalesId              = GGSalesID.text();
                                GG_FPJVoucher2.VATPercent           = PPNPercent.realValue();
                                GG_FPJVoucher2.PPhPercent           = PPhPercent.realValue();
                                GG_FPJVoucher2.RetensiPercent       = RetensiPercent.realValue();
                                GG_FPJVoucher2.RetensiAmount        = RetensiAmount.realValue();
                                GG_FPJVoucher2.UangMuka             = Advance.value();

                                // added by adit
                                GG_FPJVoucher2.Retensi              = Retention.value();
                                GG_FPJVoucher2.BIT_Cash             = Cash.value();
                                GG_FPJVoucher2.BIT_Credit           = Credit.value();
                                GG_FPJVoucher2.BIT_KodePajak        = BIT_KodePajak.valueStr();
                                // ended by adit

                                GG_FPJVoucher2.AlocFPJNum           = OthFaktur.text();
                                GG_FPJVoucher2.Berikat              = Berikat.value();
                                //Breakpoint;
                                If ((Element.CreateFaktur(GG_FPJVoucher2.Voucher)) && ((GG_FPJVoucher2.VATPercent || GG_FPJVoucher2.PPhPercent) || Berikat.value()==NoYes::Yes))
                                    [GG_FPJVoucher2.AmountDPPFaktur, GG_FPJVoucher2.AmountPPNFaktur, GG_FPJVoucher2.AmountPPhFaktur]    = element.calculateAmountFakturTRY(GG_FPJVoucher2.Voucher, GG_FPJVoucher2.SalesId);
                                Else
                                    [GG_FPJVoucher2.AmountDPPFaktur, GG_FPJVoucher2.AmountPPNFaktur, GG_FPJVoucher2.AmountPPhFaktur]    = [0, 0, 0];

                                //Breakpoint;
                                IF ((GG_FPJVoucher2.AmountPPNFaktur > 0) && (GG_FPJVoucher2.AmountPPhFaktur == 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::OpenVAT;

                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur == 0) && (GG_FPJVoucher2.AmountPPhFaktur > 0))
                                {
                                    If (Berikat.value() != NoYes::Yes)
                                    GG_FPJVoucher2.Status       = GG_OpenClose::OpenPPh;
                                }
                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur > 0) && (GG_FPJVoucher2.AmountPPhFaktur > 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Open;

                                ELSE IF ((GG_FPJVoucher2.AmountPPNFaktur == 0) && (GG_FPJVoucher2.AmountPPhFaktur == 0))
                                {
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Closed;
                                }

                                If ((Berikat.value() == NoYes::Yes) && (GG_FPJVoucher2.AmountDPPFaktur != 0))
                                    GG_FPJVoucher2.Status       = GG_OpenClose::Open;

                                IF (SalesTable::find(GG_FPJVoucher2.SalesId).GGRetensi)
                                    GG_FPJVoucher2.calculateAmountFakturRetensi();

                                GG_FPJVoucher2.insert();
                                ttscommit;
                                info(strfmt("Data Inserted (Id : %1)", GG_FPJVoucher2.FPJVoucherId));
                                element.close();
                            }
                            catch
                            {
                                error("Process error");
                                ttsabort;
                            }

                        }
                      //  else
                      //      warning("Older Voucher date already exist in the same Customer account, please check transaction");
                    }
                    /*
                    else
                    {
                        if(GG_FpjVoucher::FindVoucher(GG_FPJVoucher_Voucher.valueStr()).BIT_Batal == noyes::no)
                        {
                            info("Bukan Batal");
                            warning("Voucher Already Exist, Cannot Proceed !");
                        }
                    }
                    */
  
                }
            }
    else
        warning ("Cannot proceed, because PPNPercent for Berikat Customer, must be NULL");
    }
    else

    

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