Tuesday 28 January 2014

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

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
CustConfirmJour, CustConfirmTrans - when a sales order gets confirmed
CustPackingSlipJour, CustPackingSlipTrans - when a packing slip is posted.
CustInvoiceTable,CustInvoiceTrans - when an invoice is posted.
These are some of the maily used tables.

public class FormRun extends ObjectRun
{
    SalesFormLetter_Confirm salesFormLetter_Confirm;
    SalesFormLetter_Invoice salesFormLetter_Invoice;
    SalesFormLetter_PackingSlip salesFormLetter_PackingSlip;
    SalesFormLetter_PickingList salesFormLetter_PickingList;
}

// when you click

void clicked()
{
    SalesTable salesTable;

    if(SalesId.valueStr()!="")
    {

        salesTable = SalesTable::find(SalesId.valueStr(), true);// retrives the sales id based on the slected sales id on text box;

    if(ActionType.valueStr() == enum2str(SalesOrderType::Confirm)) // if Sales order type is confirm
    {
        if(salesTable.DocumentStatus != DocumentStatus::None)// if sales order is confirmed, other wise else part
        {
            info(strFmt("@MAD39",salesTable.SalesId));

        }
        else
        {
            salesFormLetter_Confirm =SalesFormLetter::construct(DocumentStatus::Confirmation);
            salesFormLetter_Confirm.update(salesTable, SystemDateGet(), SalesUpdate::All,AccountOrder::None,false,false );
            info(strFmt("@MAD41",salesTable.SalesId));
        }
    }
    else
        if(ActionType.valueStr() == enum2str(SalesOrderType::Invoice)) // if saler order type is invoice
        {
            if(salesTable.SalesStatus == SalesStatus::Invoiced) // if sales order is invoiced ,other wise elese part.
            {
            info(strFmt("@MAD37",salesTable.SalesId));
            }
            else
            {
            salesFormLetter_Invoice =SalesFormLetter::construct(DocumentStatus::Invoice);
            salesFormLetter_Invoice.update(salesTable, SystemDateGet(), SalesUpdate::All,AccountOrder::None,false,false );

            info(strFmt("@MAD43",salesTable.SalesId));
            }
    }
    else
        if(ActionType.valueStr() == enum2str(SalesOrderType::PackingSlip)) // if sales order type is packing slip
        {
            if(salesTable.SalesStatus == SalesStatus::Delivered) // if packing slip is done for the saler order, other wise else part
            {
            info(strFmt("@MAD38",salesTable.SalesId));
            }
            else
            {
            salesFormLetter_PackingSlip =SalesFormLetter::construct(DocumentStatus::PackingSlip);
            salesFormLetter_PackingSlip.update(salesTable, SystemDateGet(), SalesUpdate::All,AccountOrder::None,false,false );
            info(strFmt("@MAD44",salesTable.SalesId));
            }
        }
    else
        if(actiontype.valuestr() == enum2str(salesordertype::pickinglist)) // if sales order type is picking list
        {
            if(salestable.salesstatus == salesstatus::delivered) // if picking list is done for the sales order , other wise elese part.
            {
            info(strfmt("@mad40",salestable.salesid));
            }
            else
            {
                salesformletter_pickinglist =salesformletter::construct(documentstatus::pickinglist);
                salesformletter_pickinglist.update(salestable, systemdateget(), salesupdate::PickingList,accountorder::none,false,false );
                info(strfmt("@mad45",salestable.salesid));
            }
        }
    }
    else
    {
        Box::stop("@MAD47","@SYS8500");
    }

    super();
}

No comments:

Post a Comment