Pages

Banner 468 x 60px

 

Wednesday, April 18, 2018

throw error in x++

0 comments

throw error in x++ :

public void closeOk()
{
    List                ordersToUpdate = new List(typeName2Type(extendedTypeStr(RecId)));
    FormRun             callerForm = element.args().caller();
    MultiSelectionHelper selection = MultiSelectionHelper::createFromCaller(element.args().caller());
    SalesTable          salesTable = selection.getFirst();
    CustTrans           custTrans;
    BankPaymCancel      bankPaymCancel;
    Args                args;
    MCRCustPaymTable    mcrCustPaymTable;
    UserId              User1, User2;
    ABUUserParameter    ABUUserParameter;
    User2 = curUserId();
    User1 = ABUUserParameter::findUser(User2).User;   
    //if(curUserId() != User1)
    if(curUserId() == User1) // test
    {
        if(salesTable.DocumentStatus == DocumentStatus::PackingSlip ||
           salesTable.DocumentStatus == DocumentStatus::PickingList ||
           salesTable.DocumentStatus == DocumentStatus::Invoice ||
           salesTable.DocumentStatus == DocumentStatus::Confirmation) // test
        {
            throw error("Order sudah di packing / picking / invoice, silahkan konfirmasi ke gudang untuk cancel order");
        }
    }
    //end

    while (salesTable)
    {
        ordersToUpdate.addEnd(salesTable.RecId);
        salesTable = selection.getNext();
    }

    SalesUpdateRemain::cancelRemainderOnManySalesOrders(ordersToUpdate.pack());

    salesTable = selection.getFirst();
    while (salesTable && RetailPricingEngine::isMCROrder(salesTable.SalesId))
    {
        mcrCustPaymTable = MCRCustPaymTable::findByRefRecIDRefTableID(salesTable.RecId, salesTable.TableId);

        if(mcrCustPaymTable && mcrCustPaymTable.CustPaymType == MCRCustPaymType::GiftCard)
        {
            while select forUpdate custTrans
                where custTrans.MCRPaymOrderID == salesTable.SalesId
                      && custTrans.CancelledPayment == NoYes::No
            {
                bankPaymCancel = BankPaymCancel::newBankPaymCancel(custTrans, true);

                args = new Args();
                args.caller(bankPaymCancel);
                args.record(custTrans);
                BankPaymCancel::serverRun(args);
            }
        }

        salesTable = selection.getNext();
    }

    if (callerForm)
    {
        callerForm.dataSource().research(true);
    }

    super();
}

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