Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all 175888 articles
Browse latest View live

Posting a Sales Order with parameters

$
0
0

I'm trying to create a sales order in x++ 2012 r2 and invoice. I can get it to invoice fine, but i want to be able to set the Document Date: which sales its set in SalesParmTable.
I can set the parameters below for salesparm but it doesn't actually work. I tried to use CustInvoiceTable as well but doesn't seem to work. When I was creating purchase orders i had to use VendInvoiceInfoTable in order to set these parameters because purchParmTable wouldn't work for that either.
Does anyone know how to invoice and set document date for sales orders? thanks

static void ColtsSalesOrder(Args _args)
{
    //declaring variables
    InventDimId _inventDimId;
    SalesTable salesTable;

    SalesLine salesLine;

    NumberSeq numberSeq;

    SalesFormLetter salesFormLetter;
    SalesParmTable salesParmTable;

    recId                               dimensionId;
    DimensionAttributeValueSetStorage   storage;
    DimensionAttribute                  dimensionAttribute;
    DimensionAttributeValue             dimensionAttributeValue;

    SalesParmUpdate salesParmUpdate;
    SalesFormletterParmData     salesFormLetterParmData;

    CustInvoiceTable custInvoiceTable;
    CustInvoiceTrans custInvoiceTrans;
   // CustInvoiceLine custINvoiceLine;
    VendInvoiceInfoTable vendInvoiceInfoTable;
    CustInvoiceJour custInvoiceJourNew;
    AxSalesTable axsalesTable;
    
    SalesInvoiceJournalCreateBase SalesInvoiceJournalCreateBase;


    Date myDate;
    str test;
    container  ledgerDimensions;
    DimensionDefault dimensionDefault;
    str InvoiceNum;

    changeCompany("MYCOMPANY") //Inserts into specified company
    {
        ttsBegin;

        //creating sales order header

        //getting sales order id from number sequence

        _inventDimId="someID";
              test="12/15/2018";
            myDate=str2Date(test,213);

        /*  inventDim.InventSiteId = "1";
         inventDim = InventDim::findOrCreate(inventDim);

         salesLine.InventDimId = inventDim.inventDimId;
        */

        numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());
        numberSeq.used();

        //salesTable.initFromSalesTable(salesTable);

        salesTable.initValue();
        salesTable.SalesId = numberSeq.num();
        salesTable.CustAccount = "SOMEACCOUNT";
        // salesTable.initFromSalesTable(salesTable);
        salesTable.initFromCustTable();

        // salesTable.ShippingDateRequested=myDate;
        // salesTable.InvoiceAccount="adsf";
        // salesTable.CurrencyCode="CAD";
        // salesTable.LanguageId="EN";
        //salesTable.CustGroup="adsf";

        //validate

        if (!salesTable.validateWrite())
        {
            throw Exception::Error;
        }

        salesTable.insert();

        //creating sales order line
        salesLine.clear();
        salesLine.SalesId = salesTable.SalesId;

        //salesLine.initValue(salesTable.SalesType);
        //salesLine.initFromSalesTable(salesTable);
        //salesLine.initFromInventTable(InventTable::find('SOMEID'));
        //salesLine.setInventDimId(_inventDimId);
        //salesLine.InventDimId="SOMEID";
        //salesLine.ShippingDateRequested=myDate;
        //salesLine.CurrencyCode="CAD";
        //salesLine.LanguageId="EN";
        //salesLine.CustGroup="adsf";
        //salesLine.CustomerCode="asdf";


        salesLine.ItemId = "SOMEID";

        salesLine.SalesQty = 1;
        salesLine.SalesPrice=1;

        //salesLine.initFromItemOrCategory(salesLine.ItemId, salesLine.SalesCategory, "");

        salesLine.LineAmount=5;

        storage = new DimensionAttributeValueSetStorage();

        dimensionAttribute = AxdDimensionUtil::validateFinancialDimension("ItemGroup");
        dimensionAttributeValue = AxdDimensionUtil::validateFinancialDimensionValue(dimensionAttribute, "SUMP");

        // Add attribute
        storage.addItem(dimensionAttributeValue);
        dimensionId = storage.save();
        salesLine.DefaultDimension=dimensionId;

        salesLine.createLine(true, // Validate
                            true, // initFromSalesTable
                            false, // initFromInventTable
                            true, // calcInventQty
                            true, // searchMarkup
                            false  // searchPrice);

        ttsCommit;

        //confirm sales order

        InvoiceNum=SalesTable.SalesID;

        salesFormLetterParmData = SalesFormletterParmData::newData(
                                                                DocumentStatus::Invoice,
                                                                VersioningUpdateType::Initial);

        salesFormLetterParmData.parmOnlyCreateParmUpdate(true);
        salesFormLetterParmData.createData(false);
        salesParmUpdate =  salesFormLetterParmData.parmParmUpdate();

        
        salesParmTable.clear();
        salesParmTable.initValue();
        salesParmTable.TransDate                = SystemDateGet();
        salesParmTable.DocumentDate = myDate;
        salesParmTable.Ordering                 = DocumentStatus::Invoice;
        salesParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
        salesParmTable.SalesID                  = salesTable.SalesID;
        salesParmTable.SalesName                = salesTable.SalesName;
        salesParmTable.DeliveryName             = salesTable.DeliveryName;
        salesParmTable.DeliveryPostalAddress    = salesTable.DeliveryPostalAddress;
        salesParmTable.CustAccount             = salesTable.CustAccount;
        salesParmTable.CurrencyCode             = salesTable.CurrencyCode;
        salesParmTable.InvoiceAccount           = salesTable.InvoiceAccount;
        salesParmTable.ParmId                   = salesParmUpdate.ParmId;
        
        // if (salesParmTable.validateWrite())
        salesParmTable.insert();
        //else
        //  throw Exception::Error;

        custInvoiceTable.initValue();
        custInvoiceTable.SalesId=salesTable.SalesID;
        custInvoiceTable.DocumentDate=myDate;
        custInvoiceTable.InvoiceDate=myDate;
        custInvoiceTable.OrderAccount="003-000009";
        custInvoiceTable.insert();


        // Set PurchParmLine table
        while select salesLine
            where salesLine.SalesId == salesTable.SalesId
        {
            custInvoiceTrans.clear();
            custInvoiceTrans.initFromSalesLine(salesLine);
            //custInvoiceTrans.InventNow = 1;
            custInvoiceTrans.LineAmount = salesLine.LineAmount;
            //custInvoiceTrans.ship
            //custInvoiceTrans.ReceiveNow = salesLine.PurchQty;

            custInvoiceTrans.RemainBefore = 1;
            //custInvoiceTrans.RemainBeforeInvent = 1;
            //custInvoiceTrans.TableRefId = custInvoiceTable.TableRefId;
            custInvoiceTrans.insert();
        }

        salesFormLetter = salesFormLetter::construct(DocumentStatus::Confirmation);
        salesFormLetter.update(salesTable, // Purchase record Buffer
        systemdateget()); // Transaction date

        salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
        salesFormLetter.salesTable(salesTable);
        salesFormLetter.initParmDefault();
        salesFormLetter.transDate(systemDateGet());
        salesFormLetter.proforma(false);
        salesFormLetter.printFormLetter(false);     
        salesFormLetter.specQty(SalesUpdate::All);
        salesFormLetter.parmId(salesParmTable.ParmId);
        salesFormLetter.salesParmUpdate(salesFormLetterParmData.parmParmUpdate());

        salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(), Printout::Current); 
        //  salesFormLetter.initLinesQuery();
        salesFormLetter.update(salesTable, systemdateget());



        //  salesFormLetter.run();
        //   custInvoiceJourNew = salesFormLetter.getOutputContract().parmJournal();
        // 

        //displaying sales order id
        info(salesTable.SalesId);
    }
}

Difference in Purchase Expenditure Un-invoiced Account.

$
0
0

Hello,

I got Difference in Purchase Expenditure Un-invoiced Account.

Below Picture showing what the users recorded.

RE: How to add InventItemSetupSupplyType.DefaultOrderType in Edit in grid of the Released Products Form

$
0
0

Hi ATMA-Jen!

Can you provide some screenshot of how did you added this field on a form ?

If you added this field like this it's should work:

RE: How to filter multiple values in form level

$
0
0

Thanks for replay,

I repeated code as per suggestion.

Even not filtering any record but if I do for only for one filter it works.

qbds = InventItemGroup_ds.query().dataSourceTable(tableNum(InventItemGroup));

 qbds.addRange(fieldNum(InventItemGroup,ItemGroupId)).value(queryNotValue('102'));

   qbds.addRange(fieldNum(InventItemGroup,ItemGroupId)).value(queryNotValue('101'));

   qbds.addRange(fieldNum(InventItemGroup,ItemGroupId)).value(queryNotValue('103'));

How to filter multiple values in form level

$
0
0

Hi Experts,

I want to filter multiple values on Form. By given code I filtered Item group 101 but I want to filter more than item group as highlighted given screenshot.

//Code

public void init()
{
   
    QueryBuildDataSource qbds;
 
   qbds = InventItemGroup_ds.query().dataSourceTable(tableNum(InventItemGroup));
 
    SysQuery::findOrCreateRange(qbds,fieldNum(InventItemGroup,ItemGroupId)).value('!101');
}

RE: How To get data from sysdatabaselog and how to make list

$
0
0

We discussed these things a few days ago in your thread Get date from DatabaseLog Value. (By the way, I see you still haven't verified answers there, so either please do it or add a reply explaining what you still don't understand.)

As discussed there, the value you want is stored in a container, which can't be used for joins in queries. But you can use SysDatabaseLog.getDataAsList() to extract the value and use is as a query range, you could populate a temporary table (which can be used for joining) or so.

RE: Difference in Purchase Expenditure Un-invoiced Account.

$
0
0

Hi,

Unfortunately, we cannot see the picture.

Can you try uploading it again via the use rich formatting form?

In addition, can you provide some additional infos on how you found the variance, whether somebody posted manually on the account, etc. ?

Many thanks and best regards,

Ludwig

RE: How to filter multiple values in form level


RE: Error when exporting large number of records to CSV

$
0
0

Open a processing group, then an entity, press the Select button and your query ranges.

You could write code for it, if users can't set ranges here for some reason.

RE: How to import fixed assets master data in Dynamics 365

$
0
0

Chào bạn,

Bên mình cũng đang sử dụng AX 2012.

Bạn có thể kết bạn vs mình qua skype: ngocngoc0610 để cùng trao đổi nhé.

Thanks.

How to import fixed assets master data in Dynamics 365

$
0
0

Dear all, 

I import fixed assets master data in Dynamics 365. I use fixed assets entity to import. However, this file is not depreciation information fields such as depreciation run date, service life, posting profiles ...

I used to import fixed assets master data in AX 2012 R3 version and assets table has depreciation information fields.

Does anyone know about above case?

Thanks in advance, 

Van Nguyen 

RE: clear steps for the consolidation configuration in consolidation entity and subsidiary entity.

$
0
0

Hi Ludwig,

I have gone through this link. But it does not having the complete information like what are the setups we have to do in consolidate company and subsidiaries entities inorder to run the consolidation process.

Thanks for your quick reply

RE: Ledger Calendar Error message

$
0
0

can you share the Code in the method getAccessGroupForModule() ? and the next, highlighting line 8?

how to remove this error message the menu item with name ledgerconsolidate2 could not be opened .I am getting this error message at the time of online consolidation setup in D365

RE: How to filter multiple values in form level

$
0
0

Thanks @Crispin,

I also want to filter item group as given below screen shot.


RE: AX7 SysInfoAction

$
0
0

Thanks, it helped. The problem was that I was looking for SysNotificationManager, but it's SystemNotificationsManager.

RE: Return transaction with redeemable loyalty points

$
0
0

Hi Polina Sabeva,

you still facing this issue?

Return transaction with redeemable loyalty points

$
0
0

Dear all,

Dynamics AX 2012 R3 (RU) – I register a retail transaction on POS, add a loyalty card and when finishing the retail transaction I have a card transaction in AX with some loyalty points earned (card transaction status Earned).

When I return the retail transaction from above on POS, the same loyalty card is applied to the return transaction. When finishing the return transaction:

- If the loyalty points are non-redeemable, there is a card transaction created in AX with some points returned (card transaction status Return earned);

- If the loyalty points are redeemable, there is no card transaction in AX for any points returned.

Have any of you found any solution for this case, so that redeemable points are also returned for the return transaction?

 

Regards,

Polina Sabeva

RE: Ledger Calendar Error message

RE: Payroll Clearing Account

$
0
0

Dear Yasir Ansari,


Thank you for your kind suggestion but my point is like that :

Posting the pay-statements for 2 employees each of them has 1000 USD in his salary so system will create the following entries

DR : Expenses (With employee1 dimension) 1000
CR : Payroll Clearing account 1000
--------------------------------------------------------
DR : Expenses (With employee2 dimension) 1000
CR : Payroll Clearing account 1000


Now i'm going to submit the first pay-statement so system will create the following entries

DR : Payroll Clearing account (Through vendor account type) 1000
CR : Bank 1000


Now in the "Payroll Clearing account" i can see that still unbalanced by 1000 USD my question how i know that 1000 USD whether for the first employee or for the second employee ?


you can take the same example but for 3500 worker / Labors

 

Viewing all 175888 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>