How to get GRN Detail From Purchase Order Number or GRNReference Number in Ax 2012


Record of goods received at the point of receipt. This record is used to confirm all goods have been received and often compared to a purchase order before payment is issued.

What is GRN?

A goods receipt note (GRN) is created to record the delivery of items from your suppliers. A GRN is created against an issued purchase order. When a GRN is created for an item, any pending item quantity for an approved indent request will be automatically issued.

What is GRN in Purchasing?

A Purchase Order (PO) is a buyer generated document specifying the number of products, their quantities and agreed prices the seller will provide to the buyer. A GRN (Goods Received Note) is a record used to confirm all goods have been received and often compared to a purchase order payment is issued.
What is good receipt note?

Your GRN acts as internal proof of goods received to process and match against your supplier invoices/purchase orders. Goods Receipt Notes. The goods receipt note is an internal document produced after inspecting delivery for proof of order receipt. Generally produced by your stores team.

GRN is nothing but Goods Received Note.
At the time of delivery from the supplier to the person who orders the goods, the person will check the quantity and in terms of quality. He will ensure the ordered quantities are received without any damage. The store keeper will put the GRN only those goods which were received at his counter. Then the stores ledger will be debited with GRN with concerned material code and credit when it is given for consumption.

static void GRNReport(Args _args)
{
    VendPackingSlipJour     ObjVendPackingSlipJour;
    VendPackingSlipTrans    ObjVendPackingSlipTrans;
    VendPurchOrderJour      ObjVendPurchOrderJour;
    PurchTable              ObjPurchTable;
    VendTable               ObjVendTable;
    PurchId                 _PurchId;
    PackingSlipId           _PackingSlipId;
    int                     i;

    _PurchId                ="PurchaseOrderId";
    _PackingSlipId          ="GRNRenerenceNumber";

    i=0;
    ObjVendPackingSlipJour.clear();
    ObjPurchTable.clear();
    while select * from ObjVendPackingSlipTrans
    join ObjVendPackingSlipJour
        where ObjVendPackingSlipJour.RecId ==  ObjVendPackingSlipTrans.VendPackingSlipJour
    && ObjVendPackingSlipJour.PurchId == _PurchId
    && ObjVendPackingSlipJour.PackingSlipId == _PackingSlipId
    && ObjVendPackingSlipJour.GRNNumber_IN != ''
    && ObjVendPackingSlipJour.DeliveryDate != dateNull()
    {
        i++;
        setPrefix("Header Info");
        if(i==1)            
        info(strFmt("%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13",
        PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount,
        DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).Name,
        TaxRegistrationNumbers_IN::find(TaxInformation_IN::findDefaultbyLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).GSTIN).RegistrationNumber,
        substr(TaxRegistrationNumbers_IN::find(TaxInformation_IN::findDefaultbyLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).GSTIN).RegistrationNumber,3,strLen(TaxRegistrationNumbers_IN::find(TaxInformation_IN::findDefaultbyLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).GSTIN).RegistrationNumber)-5),
        LogisticsPostalAddress::findByLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).ZipCode,
        LogisticsPostalAddress::findByLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).Street,
        LogisticsPostalAddress::findByLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).City,
        LogisticsPostalAddress::findByLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).State,
        LogisticsPostalAddress::findByLocation(DirPartyTable::findRec(VendTable::find(PurchTable::find(ObjVendPackingSlipJour.PurchId).OrderAccount).Party).PrimaryAddressLocation).CountryRegionId,
        PurchTable::find(ObjVendPackingSlipJour.PurchId).AccountingDate,
        VendPackingSlipJour::findFromPurchId(ObjVendPackingSlipJour.PurchId).GRNNumber_IN,
        VendPackingSlipJour::findFromPurchId(ObjVendPackingSlipJour.PurchId).PackingSlipId,
        VendPackingSlipJour::findFromPurchId(ObjVendPackingSlipJour.PurchId).DeliveryDate
        ));

        setPrefix("Line Info");
        info(strFmt("%1, %2, %3, %4, %5, %6, %7, %8, %9",
        i,
        ObjVendPackingSlipTrans.ItemId,
        EcoResProductTranslation::findByProductLanguage(EcoResProduct::findByDisplayProductNumber(ObjVendPackingSlipTrans.ItemId).RecId,'en-in').Name,
        HSNCodeTable_IN::find(InventTable::find(ObjVendPackingSlipTrans.ItemId).HSNCodeTable_IN).Code,
        ObjVendPackingSlipTrans.Ordered,
        ObjVendPackingSlipTrans.ReceivedQty_IN,
        ObjVendPackingSlipTrans.AcceptedQty_IN,
        ObjVendPackingSlipTrans.RejectedQty_IN,
        ObjVendPackingSlipTrans.Remain
        ));
    }
}

Related Posts

Previous
Next Post »

Thanks for comments.....