Showing posts with label PURCHFORMLETTER. Show all posts
Showing posts with label PURCHFORMLETTER. Show all posts

Saturday, April 16, 2016

PURCHASE ORDER CATEGORY PRODUCT RECEIPT CALLER CLASS

Purchase category

1.       PO invoice and product receipt

Changes have been done in the forms clicked ok methods of post and close ok
Blow is code for product receipt
// po category start

    VendPackingSlipJour         vendPackingSlipJour;
    Vik_PurchaseOrderCategory   poCategory;
    int                         daydiff,prodreceiptcount;
    PurchTable                  purchTableLocal;

    if(curext() == 'SDS')
    {
        if( classidget(purchFormLetter) == classnum(PurchFormLetter_PackingSlip)) //&& (purchTable.Vik_PurchaseCategory != Vik_PurchaseCategory::None))
        {
            select purchTableLocal where purchTableLocal.PurchId == purchFormLetter.purchTable().PurchId;
            select poCategory where poCategory.Vik_PurchaseCategory == purchTableLocal.Vik_PurchaseCategory;
            select count(RecId) from vendPackingSlipJour where vendPackingSlipJour.PurchId == purchTableLocal.PurchId;

            prodreceiptcount = int642int(vendPackingSlipJour.RecId);

            if(prodreceiptcount > poCategory.DeliveryTimes)
                throw error(strFmt(" The Product receipt for Purchase Order %1 has exceeded for the category %2",purchTableLocal.PurchId,purchTableLocal.Vik_PurchaseCategory));
        }

    }
 //   po category end

Below is code for Invoice

void clicked()
{
    // po category start

    Vik_PurchaseOrderCategory   poCategory;
    int                         daydiff,prodreceiptcount;
    PurchTable                  purchTableLocal;



    if(curext() == 'SDS')
    {
        select purchTableLocal where purchTableLocal.PurchId == purchFormLetter.purchTable().PurchId;
        if( classidget(purchFormLetter) == classnum(PurchFormLetter_Invoice) && (purchTable.Vik_PurchaseCategory != Vik_PurchaseCategory::None))
        {
           
            select poCategory where poCategory.Vik_PurchaseCategory == purchTableLocal.Vik_PurchaseCategory;
          //  daydiff = purchTableLocal.createdDateTime - DateTimeUtil::getSystemDateTime();
            daydiff = DateTimeutil::getDifference(DateTimeUtil::getSystemDateTime(), purchtablelocal.createddatetime) / 86400;
            if(daydiff > poCategory.ExpireDays)
                throw error(strFmt(" The Purchase Order %1 has exceeded the expire days for the category %2",purchTableLocal.PurchId,purchTableLocal.Vik_PurchaseCategory));
        }

    }
 //   po category end
    // <GEERU>
    if (SysCountryRegionCode::isLegalEntityInCountryRegion([ #isoRU ]) && ! purchFormLetter.checkBeforePost())
    {
        return;
    }
    // </GEERU>
    super();
}

Tuesday, April 12, 2016

CLASSES , TABLES ,FORMS AND METHODS WHILE CREATING SALES ORDER AX X++

CLASSES AND TABLES WHILE CREATING SALES 

ORDER 

Below are the list of tables and classes being executed in a sales order cycle.
Similar is the case for purchase order

Sales Order (Confirmation, Picking list, Packing slip, Invoice )

Creating Sales Order
-------------------------

Classes :- SalesTableType and SaleslineType classes  will get called while creating the orders.
Tables  :- Sales Table, Logistics Postal Address, CustTable, MCRPrimaryAddressCust,SalesLine.

Confirmation
--------------------
Classes :- SalesFormLetter class

Tables  :- SalesParmTable, SalesParmLine Table
CustConfirmJour Table, CustConfirmTrans Table- when a sales order gets confirmed.


SalesFormLetter classes will be used to post the sales order at various document status like picking,packing, invoice etc.

Picking List
---------------
Classes :- SalesFormLetter_PickingList class

 Tables :- SalesTable, SalesParm Tables

Packing List
---------------
Classes :-SalesFormLetter_PackingSlip class

Tables  :-SalesTable, Salesparm Tables

CustPackingSlipJour, CustPackingSlipTrans  when a packing slip is posted.

Invoice
---------
Classes :- SalesFormLetter_Invoice class

CustInvoiceTable, CustInvoiceTrans when invoice is posted.

SalesOrder Classes and Tables:

SalesTableType and SaleslineType classes will get called while creating the SalesOrders.
SalesFormLetter_Confirm
SalesFormLetter_Invoice
SalesFormLetter_PackingSlip
SalesFormLetter_PickingLlst
classes will be used to post the sales order at various document status (packing, invoice etc).
Tables:
SalesTable contains all SalesOrder headers regardless whether they have been posted or not.
The SalesParmTable and SalesParmLine contains detailed information regarding posting sales headers and Lines.
CustConfirmJour and CustConfirmTrans tables contains all Sales Confirmation headers and Lines posted in Dynamic Ax originating from Sales Orders and Lines.
CustPackingSlipJour and CustPackingSlipTrans tables contains all sales PackingSlip headers and Lines posted in Dynamic Ax originating from Sales Orders and Lines.
CustInvoiceJour and CustInvoiceTrans tables contains all sales all Sales Invoice headers and Lines posted in Dynamic Ax originating from Sales Orders and Lines.

Purchase Order classes and Tables:


PurchTableType and PurchTableLine classes will get called while creating the PurchaseOrders.
PurchFormLetter_PurchOrder
PurchFormLetter_ApproveJournal
PurchFormLetter_Invoice
PurchFormLetter_PackingSlip
PurchFormLetter_ReceiptsList
classes will be used to post the PurchaseOrder at various document status (packing, invoice etc).
Tables:
PurchTable contains all purchase order headers regardless whether they have been posted or not.
PurchParmTable and PurchParmLine contains detailed information regarding posting Purchase headers and Lines.
VendPackingSlipJour and VendPackingSlipTrans tables contains posted packingslip headers and lines.
VendInvoiceJour and VendInvoiceTrans tables contains all invoiced purchase order headers and Lines.
VendReceiptsJour and VendReceiptsTrans tables contains posted receipt header and lines.
VendPurchOrderJour and VendPurchOrderTrans tables contains Purchase requisition headers and lines.


Classes, Tables, Forms and Methods used to post the sales orders 


SalesTableType and SaleslineType classes will get called while creating the orders.
SalesFormLetter* classes will be used to post the sales order at various document status(packing, invoice etc).
SalesParm* tables are used to prepare the data for posting
CustConfirmJourCustConfirmTrans - when a sales order gets confirmed
CustPackingSlipJourCustPackingSlipTrans - when a packing slip is posted.
CustInvoiceTable,CustInvoiceTrans - when an invoice is posted.

CREATE AND POSTING PURCHASE ORDER THROUGH X++ IN AX 2012 DYNAMICS AX

CREATE AND POSTING PURCHASE ORDER THROUGH X++ IN AX 2012

 
static void PurchOrderCreate(Args _args)
 
{
NumberSeq numberSeq;
PurchTable purchTable;
PurchLine purchLine;
ttsBegin;
numberSeq = NumberSeq::newGetNum(PurchParameters::numRefPurchId());
numberSeq.used();
purchTable.PurchId = numberSeq.num();
purchTable.initValue();
purchTable.initFromVendTable(VendTable::find('1001'));
if (!purchTable.validateWrite())
{
throw Exception::Error;
}
purchTable.insert();
purchLine.PurchId = purchTable.PurchId;
purchLine.ItemId = '1205';
purchLine.createLine(true, true, true, true, true, true);
ttsCommit;
info(strFmt(
"Purchase order '%1' has been created",
purchTable.PurchId));
}
..............................................
static void PurchOrderPost(Args _args)
{
PurchFormLetter purchFormLetter;
PurchTable purchTable;
purchTable = PurchTable::find('000409');
purchFormLetter = PurchFormLetter::construct(
DocumentStatus::PurchaseOrder);
purchFormLetter.update(
purchTable,
'',
systemDateGet(),
PurchUpdate::All,
AccountOrder::None,
NoYes::No,
NoYes::Yes);
}
 
********************-
 
static void Dev_CreatePO_and_Invoice(Args _args)
{
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
;
ttsbegin;
numberSeq = NumberSeq::newGetNumFromCode(purchParameters::numRefPurchaseOrderId().NumberSequence,true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = '3000';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
// Initialize Purchase Line items
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = 'B-R14';
PurchLine.createLine(true, true, true, true, true, false);
ttscommit;
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
"Inv_"+purchTable.PurchId, // Invoice Number
systemdateget()); // Transaction date
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}


Related Posts Plugin for WordPress, Blogger...