Thursday, 17 December 2015

use cross company instead of change company more often


    changeCompany(_IMEIDelinkingTable.DataArea)
    {
        select  *
            from   DMSSerialNumTrans
                where DMSSerialNumTrans.SerialNum == _serialNum //serialNumScan.SerialNum
                &&    DMSSerialNumTrans.Company ==  curext()
                &&    DMSSerialNumTrans.IMEITransactionType == DmsSerialTransactionType::Purchase;
        select *
            from VendInvoiceTrans
                where VendInvoiceTrans.InventTransId ==  DMSSerialNumTrans.InventTransId;

        dms_IMEIDelinkingLine.PurchId = VendInvoiceTrans.OrigPurchId;
    }
    */

    select crossCompany InventTransId
            from   DMSSerialNumTrans
                where DMSSerialNumTrans.SerialNum == _serialNum//serialNumScan.SerialNum
                &&    DMSSerialNumTrans.Company ==  _IMEIDelinkingTable.DataArea//curext()
                &&    DMSSerialNumTrans.IMEITransactionType == DmsSerialTransactionType::Purchase
        join  OrigPurchId
            from VendInvoiceTrans
                where VendInvoiceTrans.InventTransId ==  DMSSerialNumTrans.InventTransId
                   && VendInvoiceTrans.dataAreaId == _IMEIDelinkingTable.DataArea;
        /*select OrigPurchId
            from VendInvoiceTrans
                where VendInvoiceTrans.InventTransId ==  DMSSerialNumTrans.InventTransId;*/

        dms_IMEIDelinkingLine.PurchId = VendInvoiceTrans.OrigPurchId;


it is better to use cross company than using change company

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...