Thursday 27 September 2012

Functional Training

ascender tech

http://www.dynamicsaxtraining.com

Assets = Liabilities + Shareholder’s Equity.
Assets are items and money that customers should pay to a company – bank accounts, cash, and fixed assets (for example machines that produce goods).
 Liabilities are money that a company should pay to vendors – payroll (salary to workers), tax amount, insurance, and bank loans.
Shareholder’s Equity is the money that a company should pay to company investors or shareholders (amounts invested into the company by the owners plus the cumulative net income of the company that has not been withdrawn or distributed to the owners).

Company :  Go to Administration > Common Forms > Company accounts.

Import Data  :   Go to AdministrationPeriodic > Data export/import > Import. The Import options 

Inventory management > Common Forms > Item details.
Manadatory fields :
Item group  :  To set GL posting a/c , To report detailed finanacial information , creating reports  that are
related to products

FastTabs

FastTab Description
Sales order Set up account numbers to use for posting item group issues. The accounts are grouped according to Packing slip, Invoice, and Commission updates.
Specify a default item sales tax group in the Item sales tax group field for items in the selected item group.
Purchase order Set up account numbers to use for posting item group receipts. The accounts are grouped according to Packing slip, Invoice, Credit note, and Fixed receipt price updates.
Specify a default item sales tax group in the Item sales tax group field for items in the selected item group.
Inventory Set up account numbers to use for posting inventory transactions with regard to Fixed receipt price and Inventory journal updates.
The Inter-unit payable and Inter-unit receivable accounts are used to post profit or loss incurred. This occurs when transferring between different product dimensions in the same site takes place, and when transferring between different sites. Profit or loss can occur. This occurs when different product dimensions have different costs, or if different sites have different costs for the same item.
Production Set up account numbers for production transactions according to Items in process and Costing updates.
Setup Select a default item allocation key to use when you forecast budgets for item groups.


Inventory model group :
Dimension Group :
Dimensions :
Item Dimension -  Size, color,  Configuration


To create these dimension combinations, do the following:
  1. In the Item form, click Setup > Item dimension combination.
  2. In the Combinations of item dimensions form, create a new record by pressing CTRL+N. Select 0.33 in the Size field and Blue in the Color field. Save the record by pressing CTRL+S).
  3. Click the Create Combinations button. This button can help in creating the item dimension combinations for a new item. If we click this button, dimension combinations that do not exist are shown.
  4. In the Combinations of item dimensions form, click the Select All button and then click OK. All possible dimension combinations are created. Note that the form has the same name as the initial form.
  5. Since there is no Bottle item of the size 0.5 and of Green color, we delete this record from the initial form. (Select the record and press ALT+F9).
Item dimension combinations
Item dimension combinations

Create dimension combinations automatically.

It is a very tedious process to activate a dimension combination when a new dimension value is created. If an item must have a dimension combination for all dimension values, we can set up Microsoft Dynamics AX to activate new dimension combinations automatically.
To achieve this, do the following:
  1. In the Item form, click the General tab -> Item dimension – Setup field group
  2. Select the Autocreate combination check box.
Now, create the Orange color dimension (click Setup > Colors). Make sure that the new dimension combinations 0.5 Orange and 0.33 Orange are created (click Setup > Item dimension combinations).
Item dimension combinations
Item dimension combinations
Note that automatically created combinations have the Auto-generated check box selected.
Storage Dimension - Size, WH, Batch no, location, Pallet, Serial number



To create the Bottle template, do the following:
  1. In the Item form, right-click the Bottle record and select the Record info option from the menu. The Record information form appears.
  2. Click the User template button. The Create template form opens. (This template will be available for the current User only. The template approach can be used for all forms in Microsoft Dynamics AX).
  3. Enter the template name Bottle in the Create template form.
  4. Click OK. And close the Record information form.
After a template is created, Microsoft Dynamics AX automatically shows the Select a template for Item form when we create a new item in the Item form.
Select a template for Items form
Select a template for Items form
To create the Can item, do the following:
  1. In the Item form, click CTRL+N.
  2. Select the Bottle template from the Select a template for Items form and click OK.
  3. Type 11 in the Item number field and Can in the Item name field.
  4. Make sure that all mandatory fields are filled in. Save the record.
Note: Item dimensions are not transferred from the Bottle item. So, we need to create new Size and Color dimensions and activate them in the Dimension combination form.

Item Model group  :   To set up rules  for calculating of item  cost  ( of those items that are still in the WH and those that are sold)

 4 * 5 $ + 3 * $6 = 38$  ( 4 items  of 5 rs and 3 items of 6 rs)  . Already 2 are sold.

FIFO  -  (4-2)*5 +3*6 = 28.
LIFO  - 4*5 + 3-2 * 6 = 26
Weighted avg -  The  avg  cost is calculated  and subtracted from the  warehouse items cost when the item is sold.
(4 * 5 + 3 * 6 )/7 =5.43
(7-2)*5.43 = 27.15

Standard cost :  Uses specific  price as cost. Price can be entered  manually or calculated automatically.
suppose standard cost is 5.5 ,
4*5.5 + 3 * 5.5 = 38.5 After 2 items sold  ,  (7-2) * 5.5 =  27.5


  • LIFO date – this model equals to LIFO with the only difference being that purchase and selling dates are taken into account. For example, a company purchases four items for the cost of $5 on October, 11, three items for the cost of $6 on October, 11 and two items for the cost of $7 on October, 13. The company sells two items on October 11, but the Sales manager was out of office and didn’t post the sales. The Sales manager came back to the office on October, 13 and posted the sales backdate to October, 11. The sales posting process will decrease the cost of items in the warehouse at 2 * $6 (item’s last cost as of October, 11). If the LIFO inventory model is used, the sales process will decrease the cost of items in the warehouse to 2*7$ (because 7$ is the last cost received into the warehouse).
 date items cost
oct11 4            5
0ct11 3            6
oct12 2            7

Company sells 2 items on  Oct11. But sales manager is out of office and didn't post  the sales.  came back on oct 13

So  now sales posting process will decrease cost of item in WH by  2*6  but in LIFO  - 2* 7 
  • Weighted avg. date. – this model equals to the Weighted avg with the only difference being that the average amount is calculated for a separate day. For example, a company purchases four items for the cost of $5 on October, 11, three items for the cost of $6 on October, 13 and two items for the cost of $7 on October, 13. The company sells two items on October, 13. The average cost price will be (3 * $6 + 2 * $7) / (3 +2) = $6.4, note that four items at the price of $5 are not included in the average cost price calculation because they have been purchased on another day.  
Inventory model Select an inventory model.

Fields

Field Description
Item model group The identifier of the item model group.
Name A descriptive name for the item model group.
Stocked product Select this check box to indicate that the product should be handled in inventory. Products that are handled in inventory generate inventory transactions. These products can be included in cost calculations. On-hand quantities can also be maintained for these products.
NoteNote
Stocked products include items and services. A service cannot be added to stock. However, Microsoft Dynamics AX requires that pro forma stock transactions be generated for services that contribute to the inventory value of tangible goods. For example, pro forma stock transactions must be generated if a service is used to subcontract production steps.
Physical negative inventory Select this check box to enable negative physical inventory for the item model group.
NoteNote
Microsoft Dynamics AX does not verify that items are physically in inventory when items are picked.
Example
Production is started, but not all items for the production are in inventory. The items have been ordered, and delivery has been scheduled. Alternatively, an order for an item is updated. Even though the item is not in inventory, it has been purchased and will soon be in inventory.

Financial negative inventory Select this check box to enable negative financial inventory for the item model group.
Negative financial inventory is often used for services. If the check box is cleared, the cost price must be known for the quantity that is financially pulled from inventory.
Example
Eight items are invoice-updated, and five other items are packing slip–updated. Therefore, the physical on-hand inventory is 13. If this check box is cleared, negative financial inventory is not enabled. Therefore, only eight items are available when a sales order is invoice-updated, even though 13 items are available in on-hand inventory.
Quarantine management Select this check box to indicate that items that are associated with the item model group are subject to the rules and requirements for quarantine management.
This check box is used for items that are set aside and awaiting approval for distribution.
If the check box is cleared, items are not under quarantine management, unless a quarantine order is created manually in the Quarantine orders form.
When the item is registered, a quarantine order is generated. This quarantine order has a status of Started.
Consolidated picking method Select this check box to pick multiple orders, and to use picking areas and shipment functionality.
Post physical inventory Select this check box to post physical item transactions in the ledger.
The physical item transactions are posted as follows:
  • Packing slips and product receipts are posted if the Post product receipt in ledger check box is selected in the Accounts payable parameters form, or if the Post packing slip in ledger check box is selected in the Accounts receivable parameters form.
  • Production orders that are reported as finished are posted if the Post report as finished in ledger check box is selected in the Production control parameters form.
If the check box is cleared, packing slips, product receipts, and production orders that are reported as finished are not posted in the ledger, regardless of the settings in the parameter setup forms.
Post financial inventory Select this check box to post the updated financial value of items in the ledger.
When a purchase order is invoice-updated, the value of the items is posted to the inventory receipt account. When a sales order is invoice-updated, the value of the items is posted to the inventory issue and the consumption accounts. The inventory value that is posted can then be reconciled with the related status accounts in General ledger.
If the check box is cleared, when a purchase order is invoice-updated, the value of the items is posted to the item consumption account, but not to the inventory receipt account. When a sales order is invoice-updated, no posting occurs in the item consumption account or the issue account.
NoteNote
Clear this check box for service items if the item consumption should not be posted when sales orders are invoiced.
When the check box is cleared, the lines for the items in the Movement and Inventory adjustment journals do not generate ledger postings.
Post to Deferred Revenue Account on Sales Delivery Select this check box to accrue the estimated revenue for the delivered quantity of packing slip updates. The accrued revenue that is accounted on the sales delivery is offset when the customer is invoiced for the delivery.
Accrue liability on product receipt Select this check box to accrue the estimated expense for packing slip updates to the general ledger.
Registration requirements Select this check box to indicate that item receipts must be registered before inventory is physically updated.
The status of the inventory transaction for the item receipt must be Registered before the item's product receipt is updated.
This field is used by warehouse management. Registered items are part of physical inventory. You can register items in the warehouse management journals. Alternatively, you can click Inventory, and then click Registration on the relevant journals and orders.
Receiving requirements Select this check box to indicate that item receipts must be physically updated before they can be financially updated.
NoteNote
If you post a vendor invoice, a product receipt must be entered and posted before the vendor invoice for the product receipt can be posted. The received quantity on the product receipt might differ from the invoiced quantity. In this case, an icon is displayed in the Product receipt quantity match field in the Vendor invoice form. For more information, see Vendor invoice (form) and Set up Accounts payable invoice matching.
Picking requirements Select this check box to indicate that item issues must be picked before inventory is physically updated.
The status of the inventory transactions for the item issue must be Picked before the packing slip is updated.
This field is used by warehouse management. Picked items are part of physical inventory. Items can be picked in the warehouse management system by dispatches and picking routes. Alternatively, you can click Inventory, and then click Registration on the relevant journals and orders.
NoteNote
If you create a direct delivery from a sales order, the Picking requirements parameter is ignored, because items are transferred directly from the vendor to the customer. These items do not physically come into your company.
Deduction requirements Select this check box to indicate that item deductions must be physically updated before they can be financially updated.
NoteNote
If you post a vendor invoice, a product receipt must be entered and posted before the vendor invoice for the product receipt can be posted. The deducted quantity on the product receipt might differ from the negative invoiced quantity. In this case, an icon is displayed in the Product receipt quantity match field in the Vendor invoice form. For more information, see Vendor invoice (form) and Set up Accounts payable invoice matching.
Backward from ship date Select this check box to reserve expected receipts, such as open purchase order lines, that have a date of receipt that is nearest to the delivery date of the sales order. If the check box is cleared, incoming inventory transactions that have the earliest date of receipt are reserved.
NoteNote
Items that are available in inventory are not controlled by the Backward from ship date parameter. To control the available inventory that is reserved, you can use dimensions, such as corresponding batch numbers. Alternatively, you can mark orders. For more information about how to mark orders, see Mark orders.
Inventory model Select the inventory model that is used to close and perform adjustments in the Closing and adjustment form.
Include physical value Select this check box to indicate that transactions that are physically updated should be included in the calculation of the average cost.
At inventory close, this parameter may be used, depending on the method that is used for inventory valuation.
The following inventory valuation methods use this parameter during inventory close:
  • FIFO
  • LIFO
  • LIFO date
The following inventory valuation methods do not use this parameter during inventory close:
  • Weighted avg.
  • Weighted avg. date
Fixed receipt price Select this check box to adjust issues and receipts to a fixed receipt price.
The fixed receipt price is a principle for inventory valuation that sets the price of receipts to the active planned cost or basic cost of a product.
TipTip
The fixed receipt price is defined in the Price field on the Manage costs tab in the Released product details form.
When the check box is selected, receipts and issues are posted as follows:
  • Purchase receipts – Posting occurs at the actual cost.
  • Purchase invoices – The price difference between the actual cost and the fixed receipt price is posted to the general ledger as a variance. The amount is posted to the loss or profit account for the fixed receipt price. Inventory is updated based on the fixed receipt price.
  • Sales order packing slips and sales invoices – Posting occurs at the estimated cost.
When you run an inventory close or a recalculation, if this check box is selected, the value of issue transactions is adjusted according to the price that is specified in the Price field. If this check box is cleared, the value of issue transactions is not adjusted according to this price.
NoteNote
If the fixed receipt price is changed, and you want all new issue transactions to use the new cost, follow these steps:
  1. Run an inventory close.
  2. Adjust the balance for the on-hand inventory, so that the balance matches the new cost.
  3. Activate a new planned cost.

Address book Number sequence :
Go to Basic -> Setup -> Global Address Book -> Parameters. The Address Book Parameters


General rounding-off applies to all modules and there are separate settings for Account ReceivableAccount Payablesmodules and Prices.
Example: We have amount 6827.28. Below table describe how Round Off and Rounding form works.
Rounding formRound off .01Round off .10Round off 1.00Round off 10.00Round off 100.00
Normal6827.286827.206827.006830.006800.00
Upward6827.286827.306828.006830.006800.00
Downward6827.286827.206827.006820.006800.00

=================================================================

Accounts Payable

1.      Automate  the process of prepayment :

Prepayment  is manual process in ax 2009 ,  and no link to prepayment  and PO. In 2012 , automated  the process of prepayment  to settled against PO to help to prevent over double payment.
Parameters  can be set  to  post prepayment to  be directed to different  PP (Posting profile)

Involves
 Create PO  , Set up Prepayment, post Prepayment , Make a payment , Settle payment against the final invoice.

Scenario : Alicia (Purchasing Agent )   -> Created PO of 100 telivision  With condition( 10 % prepayment is required before order is processed)
            Alicia  will create  PO  and submit req to  April,  (AP coordinator) to process the prepayment.  When April receive the request  , she must post the prepayment and print the check to the vendor.
            When telivisions are delivered , April receives the invoice  for the goods . She must now settle the invoice from  the PO  against the prepayment that was made.

Set up Prepayment :
           
            Create  PO with  request  for a prepayment.  (New PO  with Item, quantity,Unitprice >> Purchase tab >> Click prepay >> Prepayment

Fixed :  value represents flat  amount  in the currency  of  the PO.
Percent :  value represents percentage of  PO total.

Select  Prepayment Category ID



Click  Generate >>  confirm

            Post  Prepayment   Invoice :

                        AP >> Purchase Order , Select Desired Order , Click   prepayment Invoice
              Message  Box – Unposted payment exists  for the order  , Click yes to continue and post the prepayment.
Make sure that prepayment check box is selected.  Click post .

ð   A new  transaction is posted  to the Vendor A/c  for the value of prepayment.



Make  a Payment :

      To  make  a payment  for the  prepayment invoice ,
AP  >> journals  >>  Payment Journal , New  Journal,
Select  desired vendor  a/c  >> Functions >> settlement , select desired prepayment invoice to be paid.
Close  the Open Transaction editing form, Post  >> Post  the vendor payment  journal.



Settle  the payment :

AP  >>  Vendor invoices >> Open vendor invoices  >> new  , Select  vendor a/c unique invoice no ,
Or ( go to the  AP purchase order , click  invoice ,    Click  Apply  prepayment  on  Action pane .  Select  each PO invoice  to settle against  the current  invoice. Click  OK   to apply prepayment  invoices  against  the current  invoice  >> Post.

After  the prepayment  has been applied   and posted , check  open  transactions  for that  vendor,  that still needs to be paid to the vendor , and confirm the amount.

146200 – 10% = 14620 ( Prepayment)
146200 – 14620 = 131580 ( settle amount)

=====================================================================


Invoice  Matching  Task  for  Workflow :

                Invoice matching   is   available   as workflow , and performed  without user interaction. 
Scenario :   A/c manager  , has  decided that all  PO’s  will require  a three – way  match before  posting.   2 new  workflow types , Vendor invoice , Vendor invoice line 

The  new  types  of invoice  matching  include ,

Extended price  Matching :

                If the parameter to use extended price matching in the Accounts payable parameters form is selected, the net amount of an invoice line plus the net amount of any pending invoice lines and previously posted invoice lines is compared with the purchase order line. If the variance amount, in the company currency, exceeds the tolerance percentage, the amount, or the percentage and amount for extended price matching, a matching discrepancy warning is displayed.

A purchase order has two previous invoices posted. The first invoice had no variance, and the second invoice had a variance of 250 USD on the line total. The variance from the second invoice was not enough to trigger the invoice matching violation. Now, you are posting the third invoice and it has a variance of 300 USD on the line total. The third invoice by itself is not enough to trigger the invoice matching violation. However, the system combines the 300 USD variance with the 250 USD variance from the second invoice for a total variance of 550 USD. Because 550 USD is greater than the allowed tolerance of 500 USD, the system will trigger the price match violation by displaying the price match icon, and depending on the system setup, an approval may be required
AP  Parameters  >>  Invoice  validation ,  Mark  Use Invoice  Matching Validation
 Use Extended price  matching
 None - extended price matching will not be used.
Percentage - the system will validate each purchase order invoice based on the percentage amount entered into the Extended price tolerance percentage field.
Amount - the system will validate each purchase order invoice based on the flat amount entered into the Extended price tolerance amount field.
Percentage and amount - the system will validate each purchase order invoice based on the percentage amount entered into the Extended price tolerance percentage field but not to exceed
the flat amount entered


Invoice  total Matching :

                Invoice totals on a purchase order invoice are compared with the expected totals, based on the purchase order information. If the variance exceeds the tolerance percentage for invoice totals matching, a matching discrepancy indicator is shown. Invoice totals matching tolerances can be set up for each company or for individual vendors.

Line  Matching :
                Two – Way   matching
                Three – Way Matching

The line matching policy can be set to three-way (matching compares the invoice, purchase order, and product receipt), two-way (matching compares the invoice and purchase order), or not required (unit price matching and extended price matching is not performed). The line matching policy can be set up for each company and for items, vendors, or item and vendor combinations.

Miscellaneous   charge   matching :

If the parameter to use miscellaneous charges matching is selected in the Accounts payable parameters form, miscellaneous charges on a purchase order invoice can be compared with the expected miscellaneous charges from the purchase order. If the variance exceeds the tolerance percentage for
miscellaneous charges, a matching discrepancy indicator is displayed. Miscellaneous charges tolerances can be set up for each company or for individual miscellaneous charges codes


Purchase
Purchase   some  items , analyze financial  transactions, and run Financial Statements :
10 -1003 , 1002.   Go to Item  >>   setup menu button >>
Site, quantity, Unit   - >    Default Order Settings  >> Purchase order Tab.
Warehouse  - > Site Specific  order settings  >> site 2
Price  - >  Item dimension combinations  >> Price  >> Site 2  >> Price

Purchase  process involve :
Confirmation  -  Purchase  mgr  agrees with the vendor  all Purchase details  and confirms them.
 Arrival  and  Registration  are  used for  WH  management is enabled for the item.
Arrival  -     To  register  specific   Warehouse, site … information  where the item is stored.
The Arrival overview form   :   Inventory management > Periodic > Arrival overview
Registration
Packing slip
Invoice

Wednesday 19 September 2012







1. How  to Configure SMPT ( to Proceed mails from AX -  mazikglobal mail.

Start >> Administrative tools ->  Server manager -> Features Summary -> click Add Features

select SMTP Server and Telenet Client
Click next >> Install


Once  Installation is Successful -

Go to System Administration >> System>> Email Parameters.
We need to Configure Email Parameters
Outgoing mail server - mail.mazikglobal.com
Local computer name  - system1-81a
SMTP port number - 25
user name - sujana.jupudi@mazikglobal.com
password - pwd
Attachment size limit - 10.
Save the form.

Once  this is  done ,
Go to Start >> Administrative tools ->  IIS Server manager(6.0) -> expand local computer , select SMTP virtual server >> Double Click Domains >>  Rename - sujana.jupudi@fareast.corp.microsoft.com - fareast.corp.microsoft.com

2.   we  get  COM  Errors Some times when we run Batch , then  we  need to add following  code in run()

InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
permission.assert();

==================================================================


Tools - > Options - > Development ->  Execute Business operation in CIL – Checkbox – Checked performs CIL generation to the code we write and if not it skips CIL code generation and prevent to through XPP errors.

In Environment Variables  we need to create a new variable – TESTROOT – C:\ , when we get error while importing contoso data

======================================================================


Controlpanel – Administrative Tools – ComputerManagement – System Tools – Local Users and Groups  . Groups   - MicrosoftDynamics AxDebugging User – Add your name   - >  Add user to the Debugging User Group



==========================================================================

To Delete Usage  Data in AX
*.auc - Stores Temporary data.

Go to Tools >> Options >> Usage data. Click Reset and close window. Then click Apply
Will delete all the usage data.

 

Monday 17 September 2012

Technical Code





To  Type  the info of table

while select vendTable
{
info(strFmt(
"%1 - %2",
vendTable.AccountNum,
vendTable.Blocked));
}Job  to Execute table level data: NSG_TechSpecification_SQ nSG_TechSpecification_SQ;
while SELECT * FROM nSG_TechSpecification_SQ
WHERE ((nSG_TechSpecification_SQ.MainCodes==2))
print nSG_TechSpecification_SQ.Code;
pause;


To use normal table as temp table

VendTable vendTable;
vendTable.setTmp();
vendTable.AccountNum = '1000';
vendTable.Blocked = CustVendorBlocked::No;
vendTable.Party = 1;

vendTable.doInsert();


vendTable.clear();
vendTable.AccountNum = '1002';
vendTable.Blocked = CustVendorBlocked::All;
vendTable.Party = 2;

vendTable.doInsert();

setTmp() -  To make temporary in scope of the method
doInsert() - to bipass any additional logic resided in insert() method .

Copying  a record : // see cook book

How to create a Query(dynamically) and add a link in Ax 2009



static void CustTableSales1(Args _args)
{
    Query       query;
    QueryRun    queryrun;
    QueryBuildDataSource    qbds1;
    QueryBuildDataSource    qbds2;
    QueryBuildRange         qbr1;
    QueryBuildRange         qbr2;
    CustTable               custTable;
    ;
    query   = new query();
    qbds1   =   query.addDataSource(tablenum(CustTable));
    qbds1.addSortField(fieldnum(custTable,AccountNum),Sortorder::Descending);
    qbr1    = qbds1.addRange(fieldnum(custTable,custGroup));
    qbr1.value(queryvalue('10'));
    qbr2    =  qbds1.addRange(fieldnum(custTable,Blocked));
    qbr2.value(queryvalue(CustVendorBlocked::No));
    qbds2   = qbds1.addDataSource(tablenum(SalesTable));
    qbds2.relations(false);
    qbds2.joinMode(joinmode::ExistsJoin);
    qbds2.addLink(fieldnum(CustTable,AccountNum),fieldnum(SalesTable,CustAccount));
    queryrun    = new queryrun(query);
    while(queryrun.next())
    {
    custTable   = queryrun.get(tablenum(custTable));
    info(strfmt("%1 - %2",custtable.AccountNum,custTable.Name)); // to check your result
    }
}






To  send  mail Automatically  using  X++ Code

Below  Code   sends  mails to all Customers  who have  performed Invoices for Sales order today. Mail sends  information of Sales order its Invoice amount and  Total Invoice  amount of the Customer( Sum of all invoice amounts of all SO he invoiced )


CustInvoiceJour CIJ1,CIJ2;
    SysMailer mailer;
    str to,cc;

    str body,sub;



     while select sum(InvoiceAmountMST) from CIJ1  group by CIJ1.OrderAccount where CIJ1.invoicedate == today()

    {





         mailer = new SysMailer();
         sub = strfmt("Today's Invoice Amount Details to customer : ",CIJ1.OrderAccount);
         body = "<html><body>"+ strfmt("Dear %1", CIJ1.OrderAccount )+ "<br/><br>"+
                         strfmt("This is bring to ur notice your  Total Invoiced Amount : ",CIJ1.InvoiceAmountMST) + "<br/><br>";
         body = body + strfmt("So please go through thr following Detauils") +  "<br/><br>";
         while select * from CIJ2 where CIJ2.OrderAccount == CIJ1.OrderAccount && CIJ2.invoicedate == today()      
         body = Body + "<html> <body><table border='1'>";
        {
             body= body+  "<tr><td>"strfmt("Sales ID")  +"</td>";
             body= body+  "<td>"strfmt("%1", CIJ2.SalesId)  +"</td></tr>";
             body= body+  "<tr><td>"strfmt("Amount")  +"</td>";
             body= body+  "<td>"strfmt("%1", CIJ2.InvoiceAmount)  +"</td></tr>";
        }
        Body= Body + "</table>";
        Body = Body + strfmt("<br/><br/><b>Note:This is a system generated email. Please do not reply to this mail.</b> </body></html>");
        mailer.quickSend("sujana.jupudi@mazikglobal.com","madhava.reddy@mazikglobal.com",sub,body);
        info("mail Sent");
    }

To  Perform Automatic  Invoice for all Packed SO  today  using  X++ Code : 

CustPackingSlipJour c;

    date thisDate = systemDateGet();

    SalesFormLetter formLetterObj;



//  Code  To Perform  Automatic  Invoice  of all the SO   which  are Packed Today.
    while select SalesId from c where c.DeliveryDate == thisDate

    {

    info(strFmt("%1",c.SalesId));

    formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice);


    formLetterObj.update(SalesTable::find(c.SalesId), SystemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, false,true);
}

// Steps  to Create  Number Sequence :

Create  number sequence for BankCust Field in BankCustomers Table: 

1. Create EDT -   "BankCust"

2. Go to Classes -> NumberSeqModuleCustomer - > Load Module 
modify continous - false


     datatype.parmDatatypeId(extendedTypeNum(BankCust));
    datatype.parmReferenceHelp(literalStr("@FPP266"));
    datatype.parmWizardIsContinuous(false);
    datatype.parmWizardIsManual(NoYes::No);
    datatype.parmWizardIsChangeDownAllowed(NoYes::No);
    datatype.parmWizardIsChangeUpAllowed(NoYes::No);
    datatype.parmWizardHighest(999999);
    datatype.parmSortField(22);

    datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
    this.create(datatype);



3. Job 

static void NumberSeqLoadAll(Args _args)
{
    NumberSeqApplicationModule::loadAll();
    info("jobExecuteD");
}


Run the job.


4. CEU  >> OrgAdm >> Common >> NumSequ >> Generate >>  Next >> Filter By Reference. 

Remove all the number sequences except our's ( based on number of companies that many will be generated) 

5. Tables >> CustParameters >> Methods>>


client server static NumberSequenceReference numRefBankCust()
{
    return NumberSeqReference::findReference(extendedTypeNum(BankCust));
}


6. Job 

static void LoadNumberSeqforModule(Args _args)
{  
    NumberSeq::newGetNum(CustParameters::numRefSBankCust()).num();
    info("Executed");
}

7. Table >> Init >> 


public void initValue()
{
    super();
    this.BankCust = NumberSeq::newGetNum(CustParameters::numRefBankCust()).num();
}

Open  Table  and check Number sequence is generated.


Based on a/c type if we need to set diff number seq for a field :
For ex : if bank a/c created automatically based on a/c type - debit card should be created with automatic number seq .

then in bank table - validate method , we need to write below code.



  if(BankCustomers_DebitCardACType.valueStr() == "Saving")
    {
        bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefSBankCust()).num();
        bankCustDebitCardTmp.Limit = 1000;
    }
    if(BankCustomers_DebitCardACType.valueStr()=="Current")
    {
        bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefCBankCust()).num();
        bankCustDebitCardTmp.Limit = 5000;
    }
    if(BankCustomers_DebitCardACType.valueStr()=="Recurring")
    {
         bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefRBankCust()).num();
         bankCustDebitCardTmp.Limit = 500;
    }


//  How to add lookup to a field in the form :

 Create  a StringEdit type field and override the lookup method of that field


    public void lookup()
{
    SysFieldGroupLookup  lkup;
    Query q = new Query();
    super();
    lkup = SysFieldGroupLookup::newParameters(tablenum(InventSite), this);
    q.addDataSource(tablenum(InventSite));
    lkup.addLookupfield(fieldnum(InventSite, Name));
    lkup.parmQuery(q);
    lkup.performFormLookup();
}




 
Query query = new Query();
QueryBuildDataSource qbds_NSG_TechSpecification_SQ;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;
sysTableLookup = SysTableLookup::newParameters(
tablenum(NSG_TechSpecification_SQ), this);
qbds_NSG_TechSpecification_SQ = query.addDataSource(tableNum(NSG_TechSpecification_SQ));
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, code), true);
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, Name),true);
qbr = qbds_NSG_TechSpecification_SQ.addRange(fieldNum(NSG_TechSpecification_SQ,MainCodes));
qbr.value('Stiffness');
sysTableLookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();