Pages

Banner 468 x 60px

 

Monday, March 27, 2017

validateWrite x++

0 comments
public boolean validateWrite()
{
    boolean                 ret;
    boolean                 check = true;
    boolean                 IsExtraChargeModified;
    boolean                 isAllowDelete;
    SalesLine               SalesLineOriginal = SalesLine.orig();

    ;



    //Add by Yaya, Agreeya, Oct 27, 2010
    if ( salesline.SalesQty >= 0
         && !SalesTable.isSalesLineAllowNew()
         && showMsgWriteRestriction
         && isAdditionalRow
       )
    {

      showMsgWriteRestriction = CustConfirmJour::exist(SalesTable.SalesId) ? true : false;
      box::stop("For SO Item Contract, after confirmation you not allow to add qty positive again");
      showMsgWriteRestriction = false;
      isAllowDelete  = salesLine_DS.allowDelete();
      salesLine_DS.allowDelete(true);
      salesLine_DS.delete();
      salesLine_DS.allowDelete(isAllowDelete);
      isAdditionalRow = false;
      return false;
    }
    //


    if(!salestable.CheckCustConfirm())
        check = true;
    else
    {

        if (SalesLine == SalesLineOriginal )
        {
           check = true;
        }
        else
        {

           if (salestable.Soltius_ContractType    != Soltius_contractType::ItemContract &&
               salesline.Soltius_AppMoneyContract != Soltius_AppMoneyContract::DeleteProcess   )
           {

               isExtraChargeModified = salesLine &&
                                       salesLine.Soltius_ExtraCharge != salesLine.orig().Soltius_ExtraCharge ? true : false;




               if ( isExtraChargeModified )
               {
                 check = true;
               }
               else
               {

                  if ( !salesLine.ItemId )
                     check = false;

                  if (box::yesNo("Are you sure want to save this line?", dialogbutton::No,"Confirmation", "Validate Confirmation") == dialogbutton::No)
                  {
                     salesLine_ds.reread();
                     check = false;

                     if ( !salesline.Soltius_ExtraCharge )
                        this.DeleteExtraCharge( salesLine.InventRefId );


                  }

               }

           }

        }
     }

    if(check)
    {

       salesTableForm.setTouched(salesTable);
       salesLine.InventDimId = InventDim::findOrCreate(inventDim).InventDimId;
       if (salesLine.RecId != 0
           &&  salesLine.InterCompanyInventTransId
           &&  salesTable.InterCompanyOrder)
       {
                salesLine.DeliveryDateControlType = SalesDeliveryDateControlType::None;

       }


        ret = super();



        if (!askingModifyInvoiced && ret)
        {
            askingModifyInvoiced = true;
            ret = salesTable.checkUpdate();
            if (!ret)
            {
                salesLine_ds.reread();
                salesTable_ds.reread();
            }
            askingModifyInvoiced = false;
        }

        if (ret)
        {
           ret = salesTableForm.salesLine_validateWrite(salesLine, inventDim);
        }

        if (ret && salesLine.DeliveryDateControlType)
        {
            ret = SalesCalcAvailableDlvDates::validateWritePrompt(salesLine,false,true,true,false);
        }
    }
    else
    {

        ret = false;
    }

    return ret;
}


=============================================================================
public void clicked()
{
    DialogButton        _DialogButton;
    ;
    //super();

     if(CustTable.BIT_Generate == noyes::No)
    {
        error("Anda tidak bisa generate manual");
        CustTable_ds.executeQuery();
        return;
    }

    if(CustTable.BIT_Generate == noyes::Yes)
    {
        _DialogButton = box::yesNo("Anda yakin Generate ulang ke CSV ?", dialogButton::Yes, "Generate To CSV", "Pilih Ya atau Tidak");

        if(_DialogButton == DialogButton::Yes)
        {
            ttsbegin;
            CustTable.BIT_Generate = noyes::No;
            CustTable.update();
            ttscommit;
            CustTable_ds.executeQuery();
        }

        else if(_dialogButton == dialogButton::No)
        {
            CustTable_ds.executeQuery();
            return;
        }
    }
}

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