Tuesday, 9 June 2015

SALES ORDER INTEGRATION WITH CRM : AX 2012

SALES ORDER INTEGRATION WITH CRM : AX 2012

SEND CONFIRMED SALES ORDER TO CRM

public void run()
{

    compSalesInvoicetoCRMUat.compSalesInvoiceReference.SalesInvoiceClient    service;
    compSalesInvoicetoCRMUat.compSalesInvoiceReference.ISalesInvoice         salesinvoice;

    CustInvoiceJour     custInvoiceJour,custInvoiceJourupd;
    CustInvoiceTrans    custInvoiceTrans;
    InventDim           inventDim;
    InventTrans         inventTrans;
    InventTable         inventTable,inventTablechar;
    ConfigChoice        configChoice;
    str                 success;
    int                 qty;
  //  int x=1;
    System.Exception        ex;
    System.Type             type;
    compProductMasterDefault prodMasterDef;

    select * from prodMasterDef;
    changeCompany(prodMasterDef.DealerCompany)
    {
    while select custInvoiceJour
                join custInvoiceTrans where   custInvoiceJour.SalesId           == custInvoiceTrans.SalesId
                                            && custInvoiceJour.comp_IsInvoiceSent == NoYes::No
                                            && custInvoiceJour.InvoiceId         == custInvoiceTrans.InvoiceId
                join inventTable    where inventTable.ItemId == custInvoiceTrans.ItemId
    {
   try
   {
        type    = CLRInterop::getType('compSalesInvoicetoCRMUat.compSalesInvoiceReference.SalesInvoiceClient');
        service = AifUtil::createServiceClient(type);

        inventDim.clear();
        select inventTrans where custInvoiceTrans.InvoiceId == inventTrans.InvoiceId;
        select inventDim   where inventTrans.InventDimId == inventDim.inventDimId;

        success = service.Synchronize_Invoice(custInvoiceJour.SalesId,custInvoiceJour.InvoiceId,custInvoiceJour.InvoiceAccount,custInvoiceTrans.ItemId,custInvoiceTrans.SalesPrice,inventDim.inventSerialId,real2int(custInvoiceTrans.Qty),custInvoiceJour.InvoiceAmount,custInvoiceJour.SumTax,custInvoiceJour.invoicedate);
info(strFmt("%1-%2-%3-%4-%5-%6-%7-%8-%9-%10",custInvoiceJour.SalesId,custInvoiceJour.InvoiceId,custInvoiceJour.InvoiceAccount,custInvoiceTrans.ItemId,custInvoiceTrans.SalesPrice,inventDim.inventSerialId,real2int(custInvoiceTrans.Qty),custInvoiceJour.InvoiceAmount,custInvoiceJour.SumTax,custInvoiceJour.invoicedate));
        if(success != "Success")
        {
            error(strFmt("Error %1 for SO %2",success,custInvoiceJour.SalesId));
        }
        else
        {
            ttsBegin;
            select forUpdate custInvoiceJourupd where custInvoiceJourupd.InvoiceId == custInvoiceJour.InvoiceId;
            custInvoiceJourupd.comp_IsInvoiceSent = NoYes::Yes;
            custInvoiceJourupd.update();
            ttsCommit;
            info(strFmt("Sales Invoice %1 is created in CRM",custInvoiceJour.SalesId));
        }
  }//try
  catch(Exception::CLRError)
    {
        ex = CLRInterop::getLastException();
        info(CLRInterop::getAnyTypeForObject(ex.ToString()));
    }
         comp_RetailExceptionActivityLog::logEvent(strFmt('Sales Invoice ID:',custInvoiceJour.SalesId),infolog.export());
     }//while
   // comp_RetailExceptionActivityLog::logEvent('Product Import',infolog.export());
    }
}



PURCHASE ORDER INTEGRATION AX 2012 X++ CUSTOM WEB SERVICE

PURCHASE ORDER INTEGRATION AX 2012 
X++ CUSTOM WEB SERVICE

public void sendPOtoCRM()
{

    compPurchaseOrdertoCRMUat.PurchaseOrderReference.PurchaseOrderClient    service2;
    PurchTable                  purchTable;
    PurchLine                   purchLine,purchLineupd;
    VendPurchOrderJour          vendPurchOrderJour,vendPurchOrderJourupd;
    InventDim                   inventDim;
    ConfigChoice                configChoice;
    InventTable                 inventTable;
    str                         _success;
    TaxTable                    taxtable;
    int                         qty;
    str                         component,sfilepath,sfilename,sfileext,sfullname;
    container                   conTax,conChar,concharges,confiledetails;
    int                         i,j,k,f;
    System.Exception            ex;
    System.Type                 type;
    str                         taxinfo,taxcomp,taxvalue,charname,charvalue,markupAmount;
    str                         conchargesinfo,contaxinfo,concharinfo,strfiledetails;
    TmpTaxWorkTrans             tmpTax;
    PurchTotals                 purchTotals;
    PurchLine_IN                purchLine_In;
    SalesTaxFormTypes_IN        salesTaxFormTypes_IN;
    Transtxt                    transTxt;
    MarkupAmount                markupAmounttest;
    MarkupTrans                 markupTrans;
    DocuRef                     docuRef;
    DocuValue                   docuValue;
    VendPackingSlipTrans        tempVPST;
    compProductMasterDefault     prodMasterDef;
    //changes for multiple PO lines
    TaxTmpWorkTransForm         taxTmpWorkTransForm;
    TaxPurch                    taxPurch;

    select * from prodMasterDef;

   while select purchLine
            join purchTable  where  purchTable.PurchId == purchLine.PurchId && purchLine.comp_IsPurchlineSend == NoYes::No
           // join vendPurchOrderJour where vendPurchOrderJour.PurchId == purchTable.PurchId
    {

     try
       {
            type    = CLRInterop::getType('compPurchaseOrdertoCRMUat.PurchaseOrderReference.PurchaseOrderClient');
            service2 = AifUtil::createServiceClient(type);

            //purchTable  = PurchTable::find(_purchTable.PurchId);
            purchTotals = purchTotals::newPurchTable(purchTable);

           select reverse vendPurchOrderJour where vendPurchOrderJour.PurchId == purchTable.PurchId;

         //   select purchLine where purchLine.PurchId == purchTable.PurchId;
            select purchLine_In where purchLine_In.PurchLine == purchLine.recid;
            select salesTaxFormTypes_IN where salesTaxFormTypes_IN.RecId == purchLine_In.SalesTaxFormTypes_IN;
            select inventDim where inventDim.inventDimId == purchLine.InventDimId;

            purchTotals.calc();
            tmpTax.setTmpData(purchTotals.tax().tmpTaxWorkTrans());

             // Showing taxes with tax value
             conTax = conNull();
             while   select tmpTax where tmpTax.sourcerecid ==purchline.recid && tmpTax.sourcetableid == purchline.tableid
            {
                i++;
                select taxtable where taxtable.taxcode == tmpTax.TaxCode;
                component   = TaxComponentTable_IN::find(taxtable.TaxComponentTable_IN).Name;
                taxcomp     = component;
                taxvalue    = num2str(abs(tmpTax.TaxAmount/(purchline.PurchQty)),0,2,1,2); //changes
                conTax      = conins(conTax,i,taxcomp+':'+taxvalue);
            }
                contaxinfo = con2StrUnlimited(conTax,'|');
                i=0;

               // send characteristics value
                conchar = connull();
             while select configChoice  where configChoice.ConfigId == InventDim.configId && configChoice.ItemId == purchLine.itemid
            {
                inventTable.clear();
                select inventTable where inventTable.ItemId == configChoice.chosenitemid;
                j++;
                charname    = inventTable.comp_CharacteristicName;
                charvalue   = inventTable.comp_CharacteristicValue;
                conchar     = conIns(conchar,j,charname+':'+charvalue);
            }
               concharinfo = con2StrUnlimited(conchar,'|');
               j =0;

                concharges = conNull();
            while select * from MarkupTrans  where MarkupTrans.TransTableId == purchline.TableId
                                                && MarkupTrans.TransRecId == purchline.RecId
            {
                k++;
                transTxt     = MarkUpTrans.Txt;
                if(transTxt == "Cost of FOC Product")
                    markupAmount =  num2str((MarkUpTrans.Value*purchline.PurchQty),0,2,1,2);
                else
                    markupAmount =  num2str((abs(MarkUpTrans.Value)),0,2,1,2);
                //markupAmount =  num2str((MarkUpTrans.Value*purchline.PurchQty),0,2,1,2);  changes sameer

                concharges = conins(concharges,k,transTxt+':'+markupAmount);
            }

               conchargesinfo = con2StrUnlimited(concharges,'|');
               k=0;


                confiledetails = conNull();
           while select docuRef where  docuRef.refrecid == purchTable.RecId && docuRef.RefCompanyId == purchTable.dataAreaId
                                    && docuRef.RefTableId == purchTable.TableId
            {
                f++;
                select docuValue where docuValue.RecId == docuRef.ValueRecId;
                sfilename = docuValue.FileName;
                sfilepath = docuRef.path();
                sfileext  = docuValue.FileType;
                sfullname = sfilepath + sfilename + "." +sfileext;
                confiledetails = conins(confiledetails,f,sfullname+':'+enum2Value(docuRef.comp_FileOrderType)+':'+enum2value(docuRef.comp_FileType));
               // info(strFmt("%1\%2 %3 %4 %5",docuRef.path(),docuValue.FileName,docuRef.comp_FileOrderType,docuRef.comp_FileType));
            }
               strfiledetails = con2StrUnlimited(confiledetails,'|');
               f=0;

           _success = service2.Synchronize_PurchaseOrder(PurchTable.purchid,
           VendPurchOrderJour.PurchOrderDate,enum2str(PurchTable.DocumentState),inventdim.InventSiteId,inventdim.InventLocationId,purchLine.ItemId,
           concharinfo,real2int(purchLine.PurchQty),purchLine.PurchPrice,purchTable.CurrencyCode,purchTable.payment,purchTable.DlvTerm,
           purchTable.comp_IncoTerms,purchTable.comp_DoAmount,purchTable.comp_DoDate,conchargesinfo,conTaxinfo,purchTable.comp_ManualExcise,
        str2int(purchTable.comp_ExciseDutyRefund),VendPurchOrderJour.Amount,purchTable.comp_FocInformation,purchTable.comp_FinancerUnderHyp,
        purchLine.TaxGroup,purchTable.OrderAccount,strfiledetails,SalesTaxFormTypes_IN.FormType,enum2str(purchTable.comp_SalesTypeExciseDuty),enum2str(purchLine.comp_WarrantyCode));

           info(strFmt("%1-%2-%3-%4-%5-%6-%7-%8-%9-%10-%11-%12-%13-%14-%15-%16-%17-%18-%19-%20-%21-%22-%23-%24-%25-%26-%27-%28-%29",PurchTable.purchid,
           VendPurchOrderJour.PurchOrderDate,enum2str(PurchTable.DocumentState),inventdim.InventSiteId,inventdim.InventLocationId,purchLine.ItemId,
           concharinfo,real2int(purchLine.PurchQty),purchLine.PurchPrice,purchTable.CurrencyCode,purchTable.payment,purchTable.DlvTerm,
           purchTable.comp_IncoTerms,purchTable.comp_DoAmount,purchTable.comp_DoDate,conchargesinfo,conTaxinfo,purchTable.comp_ManualExcise,
        str2int(purchTable.comp_ExciseDutyRefund),VendPurchOrderJour.Amount,purchTable.comp_FocInformation,purchTable.comp_FinancerUnderHyp,
        purchLine.TaxGroup,purchTable.OrderAccount,strfiledetails,SalesTaxFormTypes_IN.FormType,enum2str(purchTable.comp_SalesTypeExciseDuty),enum2str(purchLine.comp_WarrantyCode)));
                  if(_success != "Success")
                {
                    error(strFmt("%1 for PO %2",_success,purchTable.PurchId));
                }
                else
                {
                    ttsBegin;
                    select forUpdate purchLineupd where purchLineupd.PurchId == purchTable.PurchId && purchLineupd.ItemId == purchLine.ItemId;
                    purchLineupd.comp_IsPurchlineSend = NoYes::Yes;
                    purchLineupd.update();
                    ttsCommit;
                    info(strFmt(" %1 is created in CRM",purchTable.PurchId));
                }
        }//try

        catch(Exception::CLRError)
        {
            ex = CLRInterop::getLastException();
            info(CLRInterop::getAnyTypeForObject(ex.ToString()));
        }
        comp_RetailExceptionActivityLog::logEvent(strFmt("Purch Order Creation %1:",PurchTable.purchid),infolog.export());
    }//while
    //comp_RetailExceptionActivityLog::logEvent('Purch Order Creation:',infolog.export());
  //  comp_RetailExceptionActivityLog::logEvent(strFmt("Purch Order Creation %1:",PurchTable.purchid),infolog.export());


}

CUSTOMER CREATION AX 2012 X++ CUSTOM WEB SERVICE

CUSTOMER CREATION AX 2012 
X++ CUSTOM WEB SERVICE

Customer Integration Create
[AifCollectionTypeAttribute('return', Types::String), SysEntryPointAttribute(true)]
public str CreateCustomer(custAccount _custaccount,Name _name,CustGroupId _customerGroup,CustDlvTermId _delvTerms,CustPaymTermId _paymTerms,CustDlvModeId _delvMode,
                            CurrencyCode _Currency,comp_AccountGroup _accountGroup, comp_CurrentFleetSize comp_CurrentFleetSize, comp_Dealer _Dealer,comp_CurrentFleetSize _currentFleetSize,
                            comp_CustomerBusinessModel _customerBusinessModel,comp_CustomerSegment _customerSegment,comp_CustomerProfile _customerProfile,comp_DeliveringPlant _deliveringPlant ,comp_deliveryPriority _deliveryPriority,
                            comp_DistributionChannel _distributionChannel,comp_ExciseIndicator _exciseIndicator,comp_ExciseRegistrationNumber _exciseRegistrationNumber,comp_Industry _industry,comp_Jtx1 _jtx1,comp_Jtx2 _jtx2,comp_Jtx3 _jtx3,comp_Jtx4 _jtx4,
                            comp_Ownership _ownership, comp_PrimaryContact _primarycontact,comp_SapCustomerCode _sapcustomercode,comp_SortKey _sortkey,  TaxGroup _salesTaxGroup,  VATNum _taxExemptionNo,
                            LogisticsElectronicAddressLocator _phone,  LogisticsElectronicAddressLocator _extension,LogisticsElectronicAddressLocator _fax, LogisticsElectronicAddressLocator _emailAddress ,TaxRegistrationNumber_IN _eccNumber,LogisticsAddressCountryRegionId     _countryRegion,LogisticsAddressZipCodeId  _postal,LogisticsAddressStreet  _street,
                            LogisticsAddressBuildingCompliment _buildingComponent, LogisticsAddressStreet _street3,LogisticsAddressCity  _city ,
                            LogisticsAddressStateId _state , LogisticsAddressDistrictName  _district,LogisticsAddressCountryRegionId  _countryRegion1,LogisticsAddressZipCodeId  _postal1,   LogisticsAddressStreet _street1,
                            LogisticsAddressBuildingCompliment _buildingComponent1,LogisticsAddressStreet _street31,LogisticsAddressCity  _city1,LogisticsAddressStateId _state1,
                            LogisticsAddressDistrictName  _district1,   TaxRegistrationNumber_IN _iecNumber,TaxRegistrationNumber_IN _salesTaxRegNumber,
                            TaxRegistrationNumber_IN _tanNumber,PANNumber_IN _panNumber )

{
    CustTable                       custTable;
    DirParty                        dirParty;
    DirPartyPostalAddressView       dirPartyPostalAddressView;
    DirPartyContactInfoView         dirPartyContactInfo,dirPartyContactInfoEmail,dirPartyContactInfoFax;
    DirPartyLocation                dirpartylocation;
    TaxInformation_IN               TaxInformation_IN;
    TaxInformationCustTable_IN      TaxInformationCustTable_IN;
    TaxRegistrationNumbers_IN       TaxRegistrationNumbers_IN_IEC,TaxRegistrationNumbers_IN_ecc,
                                    TaxRegistrationNumbers_IN_tan,TaxRegistrationNumbers_IN_salestax;
    CustAccount                     custAccount;
    container                       roles_delivery,roles_invoice;
    str                             log,log_1,log_2,log_3,log_4,log_5,log_6,log_7;
    compProductMasterDefault         compMasterDefault;
    CustPaymTermId                  paymTermsstr;

    select * from compMasterDefault;
    _delvMode = "";
    paymTermsstr = _paymTerms;
  if(_customerGroup != 'del')
            changeCompany(compMasterDefault.DealerCompany)
    {
    if((!CustTable::exist(_custaccount) &&_custaccount != "") && _name !="" && CustGroup::exist(_customerGroup) && (DlvTerm::exist(_delvTerms) || _delvTerms == "")
        && (PaymTerm::exist(_paymTerms) || _paymTerms == "") && (DlvMode::exist(_delvMode) || _delvMode == ""))
      {
        ttsBegin;
        custTable.clear();
        custTable.initValue();
        custTable.AccountNum                    = _custaccount;//numberSeq.num();
        custTable.CustGroup                     = _customerGroup;
        custTable.InvoiceAccount                = _custaccount;
        custTable.PaymTermId                    = _paymTerms;//
        custTable.comp_AccountGroup              = _accountGroup;
        custTable.comp_CurrentFleetSize          = _currentFleetSize;
        custTable.comp_CustomerBusinessModel     = _customerBusinessModel;
        custTable.comp_CustomerSegment           = _customerSegment;
        custTable.comp_CustomerProfile           = _customerprofile;
        //custTable.comp_Dealer                    = _comp_dealer;
        custTable.comp_DeliveringPlant           = _deliveringPlant;
        custTable.comp_DeliveryPriority          = _deliveryPriority;
        custTable.comp_DistributionChannel       = _distributionChannel;
        custTable.comp_ExciseIndicator           = _exciseIndicator;
        custTable.comp_ExciseRegistrationNumber  = _exciseRegistrationNumber;
        custTable.comp_Industry                  = _industry;
        custTable.comp_JTX1                      = _jtx1;
        custTable.comp_JTX2                      = _jtx2;
        custTable.comp_JTX3                      = _jtx3;
        custTable.comp_JTX4                      = _jtx4;
        custTable.comp_Ownership                 = _ownership;
        custTable.comp_PrimaryContact            = _primaryContact;
        custTable.comp_SapCustomerCode           = _sapcustomercode;
        custTable.comp_SortKey                   = _sortkey;
        if(_currency == "")
            {
                custTable.Currency = "INR";
            }
        else
        custTable.Currency                      = _currency;
      //  custTable.PaymTermId                    = _paymTerms;
        custTable.DlvTerm                       = _delvTerms;
        custTable.DlvMode                       = _delvMode;
        custtable.TaxGroup                      = _salesTaxGroup;//salestaxgroup
        custTable.VATNum                        = _taxExemptionNo;
        custTable.comp_ExciseRegistrationNumber  = _exciseRegistrationNumber;
        custTable.insert(DirPartyType::Organization, _name);
        dirParty = DirParty::constructFromCommon(custTable);

        dirPartyPostalAddressView.CountryRegionId        = _countryRegion;
        dirPartyPostalAddressView.ZipCode                = _postal;
        dirPartyPostalAddressView.Street                 = _street;
        dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent;
        dirPartyPostalAddressView.PostBox                = _street3;
        dirPartyPostalAddressView.City                   = _city;
        dirPartyPostalAddressView.State                  = _state;
        dirPartyPostalAddressView.DistrictName           = _district;
        dirPartyPostalAddressView.LocationName           = _name;
        dirPartyPostalAddressView.IsPrimary              = NoYes::Yes;
        roles_invoice = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Invoice).RecId];
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_invoice);

        //second address
        dirPartyPostalAddressView.CountryRegionId        = _countryRegion1;
        dirPartyPostalAddressView.ZipCode                = _postal1;
        dirPartyPostalAddressView.Street                 = _street1;
        dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent1;
        dirPartyPostalAddressView.PostBox                = _street31;
        dirPartyPostalAddressView.City                   = _city;
        dirPartyPostalAddressView.State                  = _state1;
        dirPartyPostalAddressView.DistrictName           = _district1;
        dirPartyPostalAddressView.LocationName           = _name;
        dirPartyPostalAddressView.IsPrimary              = NoYes::No;
        roles_delivery = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery).RecId];
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_delivery);
            // Fill address

        if(_Phone || _Extension)
        {
            if(_Phone)
            {
                dirPartyContactInfo.LocationName                 =  'Phone No';
                dirPartyContactInfo.Locator                      =  _phone;
                dirPartyContactInfo.Type                         =  LogisticsElectronicAddressMethodType::Phone;
                dirPartyContactInfo.IsPrimary                    =  NoYes::Yes;
            }
            if(_Extension)
            {
                dirPartyContactInfo.LocatorExtension             =  _Extension;
            }
           dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
        }
        //Fax
        if(_Fax)
        {
            dirPartyContactInfofax.Type                      = LogisticsElectronicAddressMethodType::Fax;
            dirPartyContactInfofax.LocationName              = "Fax";//fax
            dirPartyContactInfofax.Locator                   = _fax;
            dirPartyContactInfofax.IsPrimary                 = NoYes::Yes;
        }
        //Email
        if(_EmailAddress)
        {
            dirPartyContactInfoemail.Type                    = LogisticsElectronicAddressMethodType::Email;
            dirPartyContactInfoemail.LocationName            = "Email";
            dirPartyContactInfoemail.Locator                 = _emailAddress;
            dirPartyContactInfoemail.IsPrimary               = NoYes::Yes;
        }

        // Fill Contacts
        dirParty.createOrUpdateContactInfo(dirPartyContactInfofax);
        dirParty.createOrUpdateContactInfo(dirPartyContactInfoemail);
        if(_panNumber)
        {
            TaxInformationCustTable_IN.clear();
            TaxInformationCustTable_IN.CustTable        = _custaccount;
            TaxInformationCustTable_IN.PanStatus        = PANStatus_IN::Received;
            TaxInformationCustTable_IN.PANNumber        = _panNumber;
            TaxInformationCustTable_IN.NatureOfAssessee = NatureOfAssessee_IN::Company;
            TaxInformationCustTable_IN.validateWrite();
            {
            TaxInformationCustTable_IN.insert();
            }
        }

    if(_countryRegion == "IND")
     {
        select DirPartyLocation where DirPartyLocation.Party == custTable.Party && DirPartyLocation.IsPrimary == NoYes::Yes ;
            if(_IECNumber)
            {
            select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
                //numeric with 11 chars
            if(!TaxRegistrationNumbers_IN_IEC)
                {
                TaxRegistrationNumbers_IN_IEC.clear();
                TaxRegistrationNumbers_IN_IEC.RegistrationNumber = _iecNumber;
                TaxRegistrationNumbers_IN_IEC.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_IEC.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_IEC.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_IEC.TaxType            = TaxType_IN::Customs;
                TaxRegistrationNumbers_IN_IEC.insert();
                }
            }

            if(_eccNumber)
            {
                //ECC The registration number for %1 tax type must be alphanumeric with 5 alpha, 4 numeric, 3 alpha and 3 numeric
            select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
            if(!TaxRegistrationNumbers_IN_ecc)
                {
                    TaxRegistrationNumbers_IN_ecc.clear();
                    TaxRegistrationNumbers_IN_ecc.RegistrationNumber = _eccNumber;
                    TaxRegistrationNumbers_IN_ecc.IsGlobal           = NoYes::Yes;
                    TaxRegistrationNumbers_IN_ecc.RefCompanyId       = "";
                    TaxRegistrationNumbers_IN_ecc.RegistrationType   = TaxRegistrationType_IN::Customers;
                    TaxRegistrationNumbers_IN_ecc.TaxType            = TaxType_IN::Excise;
                    TaxRegistrationNumbers_IN_ecc.insert();
                }
            }

            if(_tanNumber)
            {
                //11 numeric
            select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
            if(!TaxRegistrationNumbers_IN_tan)
                {
                TaxRegistrationNumbers_IN_tan.clear();
                TaxRegistrationNumbers_IN_tan.RegistrationNumber = _tanNumber;
                TaxRegistrationNumbers_IN_tan.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_tan.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_tan.TaxType            = TaxType_IN::VAT;
                TaxRegistrationNumbers_IN_tan.RegistrationType  = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_tan.insert();
                }
            }
                        //_salesTaxRegistrationNumber max with 15 chars
               if(_salesTaxRegNumber)
              {//
                select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
                if(!TaxRegistrationNumbers_IN_salestax)
                    {
                    TaxRegistrationNumbers_IN_salestax.clear();
                    TaxRegistrationNumbers_IN_salestax.RegistrationNumber = _salesTaxRegNumber;
                    TaxRegistrationNumbers_IN_salestax.IsGlobal           = NoYes::Yes;
                    TaxRegistrationNumbers_IN_salestax.RefCompanyId       = "";
                    TaxRegistrationNumbers_IN_salestax.TaxType            = TaxType_IN::SalesTax;
                    TaxRegistrationNumbers_IN_salestax.RegistrationType   = TaxRegistrationType_IN::Customers;
                    TaxRegistrationNumbers_IN_salestax.insert();
                    }
              }
            if(_IECNumber || _eccNumber || _tanNumber || _salesTaxRegNumber)
             {
                TaxInformation_IN.clear();
                TaxInformation_IN.Name = _name;
                TaxInformation_IN.IsPrimary = NoYes::Yes;
                if(_tanNumber)
                {
                    TaxRegistrationNumbers_IN_tan.clear();
                    select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
                    TaxInformation_IN.TIN = TaxRegistrationNumbers_IN_tan.recid;
                }
                if(_eccNumber)
                {
                    TaxRegistrationNumbers_IN_ecc.clear();
                    select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
                    TaxInformation_IN.ManECCRegistrationNumberTable = TaxRegistrationNumbers_IN_ecc.recid;
                }
                if(_IECNumber)
                {
                    TaxRegistrationNumbers_IN_IEC.clear();
                    select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _iecNumber;
                    TaxInformation_IN.IECRegistrationNumberTable = TaxRegistrationNumbers_IN_IEC.recid;
                }
                if(_salesTaxRegNumber)
                {
                    TaxRegistrationNumbers_IN_salestax.clear();
                    select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
                    TaxInformation_IN.SalesTaxRegistrationNumber = TaxRegistrationNumbers_IN_salestax.recid;
                }
                TaxInformation_IN.RegistrationLocation = DirPartyLocation.Location;
                TaxInformation_IN.insert();
             }//if all four tax
           }//if INR
        ttsCommit;
        log = strFmt("Success : Customer %1 created Successfully",_custaccount);

   } //customer exists

    else //else part of customer not existing
    {
        if(CustTable::exist(_custaccount))
            log_1 =  strFmt("The customer %1 already exist or cannot be blank",_custaccount);
        if(_name == "")
            log_2 =  strFmt("The customer name cannot be blank for Customer %1",_custaccount);
        if(!CustGroup::exist(_customerGroup) || _customerGroup == "")
            log_3 =  strFmt("The Customer group %1 does not exist or cannot be blank in AX for Customer %2",_customerGroup,_custaccount);
        if(!DlvTerm::exist(_delvTerms) && _delvTerms != "" )
            log_4 =  strFmt("The Delivery Terms %1 does not exist or cannot be blank in AX for Customer %2",_delvTerms,_custaccount);
        if(!PaymTerm::exist(_paymTerms) && _paymTerms != "" )
            log_5 =  strFmt("The Payment Terms %1 does not exist or cannot be blank in AX for Customer %2",_paymTerms,_custaccount);
        if((!DlvMode::exist(_delvMode) && _delvMode != ""))
            log_6 =  strFmt("The Delivery Mode %1 does not exist or cannot be blank in AX for Customer %2",_delvMode,_custaccount);
         log = strFmt("%1\n%2\n%3\n%4\n%5\n%6",log_1,log_2,log_3,log_4,log_5,log_6);
    }
 }
    else
        {
          changeCompany(compMasterDefault.delCompany)

     if((!CustTable::exist(_custaccount) &&_custaccount != "") && _name !="" && CustGroup::exist(_customerGroup) && (DlvTerm::exist(_delvTerms) || _delvTerms == "")
        && (PaymTerm::exist(_paymTerms) || _paymTerms == "") && (DlvMode::exist(_delvMode) || _delvMode == ""))
    {
        ttsBegin;
        custTable.clear();
        custTable.initValue();
        custTable.AccountNum                    = _custaccount;//numberSeq.num();
        custTable.CustGroup                     = _customerGroup;
        custTable.InvoiceAccount                = _custaccount;
        custTable.comp_AccountGroup              = _accountGroup;
        custTable.comp_CurrentFleetSize          = _currentFleetSize;
        custTable.comp_CustomerBusinessModel     = _customerBusinessModel;
        custTable.comp_CustomerSegment           = _customerSegment;
        custTable.comp_CustomerProfile           = _customerprofile;
        custTable.PaymTermId                    = paymTermsstr;
        //custTable.comp_Dealer                    = _comp_dealer;paymTermsstr
        custTable.comp_DeliveringPlant           = _deliveringPlant;
        custTable.comp_DeliveryPriority          = _deliveryPriority;
        custTable.comp_DistributionChannel       = _distributionChannel;
        custTable.comp_ExciseIndicator           = _exciseIndicator;
        custTable.comp_ExciseRegistrationNumber  = _exciseRegistrationNumber;
        custTable.comp_Industry                  = _industry;
        custTable.comp_JTX1                      = _jtx1;
        custTable.comp_JTX2                      = _jtx2;
        custTable.comp_JTX3                      = _jtx3;
        custTable.comp_JTX4                      = _jtx4;
        custTable.comp_Ownership                 = _ownership;
        custTable.comp_PrimaryContact            = _primaryContact;
        custTable.comp_SapCustomerCode           = _sapcustomercode;
        custTable.comp_SortKey                   = _sortkey;
        if(_Currency == "")
            {
                custTable.Currency = "INR";
            }
        else
        custTable.Currency                      = _currency;
        custTable.PaymTermId                    = _paymTerms;
        custTable.DlvTerm                       = _delvTerms;
        custTable.DlvMode                       = _delvMode;
        custtable.TaxGroup                      = _salesTaxGroup;
        custTable.VATNum                        = _taxExemptionNo;
        custTable.comp_ExciseRegistrationNumber  = _exciseRegistrationNumber;
        custTable.insert(DirPartyType::Organization, _name);
        dirParty = DirParty::constructFromCommon(custTable);

        dirPartyPostalAddressView.CountryRegionId        = _countryRegion;
        dirPartyPostalAddressView.ZipCode                = _postal;
        dirPartyPostalAddressView.Street                 = _street;
        dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent;
        dirPartyPostalAddressView.PostBox                = _street3;
        dirPartyPostalAddressView.City                   = _city;
        dirPartyPostalAddressView.State                  = _state;
        dirPartyPostalAddressView.DistrictName           = _district;
        dirPartyPostalAddressView.LocationName           = _name;
        dirPartyPostalAddressView.IsPrimary              = NoYes::Yes;
        roles_invoice = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Invoice).RecId];
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_invoice);

        //second address
        dirPartyPostalAddressView.CountryRegionId        = _countryRegion1;
        dirPartyPostalAddressView.ZipCode                = _postal1;
        dirPartyPostalAddressView.Street                 = _street1;
        dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent1;
        dirPartyPostalAddressView.PostBox                = _street31;
        dirPartyPostalAddressView.City                   = _city;
        dirPartyPostalAddressView.State                  = _state1;
        dirPartyPostalAddressView.DistrictName           = _district1;
        dirPartyPostalAddressView.LocationName           = _name;
        dirPartyPostalAddressView.IsPrimary              = NoYes::No;
        roles_delivery = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery).RecId];
        dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_delivery);
            // Fill address

        if(_Phone || _Extension)
        {
            if(_Phone)
            {
                dirPartyContactInfo.LocationName                 =  'Phone No';
                dirPartyContactInfo.Locator                      =  _phone;
                dirPartyContactInfo.Type                         =  LogisticsElectronicAddressMethodType::Phone;
                dirPartyContactInfo.IsPrimary                    =  NoYes::Yes;
            }
            if(_Extension)
            {
                dirPartyContactInfo.LocatorExtension             =  _extension;
            }
           dirParty.createOrUpdateContactInfo(dirPartyContactInfo);
        }
        //Fax
        if(_Fax)
        {
            dirPartyContactInfofax.Type                      = LogisticsElectronicAddressMethodType::Fax;
            dirPartyContactInfofax.LocationName              = "Fax";//_fax;
            dirPartyContactInfofax.Locator                   = _fax;
            dirPartyContactInfofax.IsPrimary                 = NoYes::Yes;
        }
        //Email
        if(_EmailAddress)
        {
            dirPartyContactInfoemail.Type                    = LogisticsElectronicAddressMethodType::Email;
            dirPartyContactInfoemail.LocationName            = "Email";
            dirPartyContactInfoemail.Locator                 = _emailAddress;
            dirPartyContactInfoemail.IsPrimary               = NoYes::Yes;
        }
        // Fill Contacts
        dirParty.createOrUpdateContactInfo(dirPartyContactInfofax);
        dirParty.createOrUpdateContactInfo(dirPartyContactInfoemail);
        if(_panNumber)
        {
            TaxInformationCustTable_IN.clear();
            TaxInformationCustTable_IN.CustTable        = _custaccount;
            TaxInformationCustTable_IN.PanStatus        = PANStatus_IN::Received;
            TaxInformationCustTable_IN.PANNumber        = _panNumber;
            TaxInformationCustTable_IN.NatureOfAssessee = NatureOfAssessee_IN::Company;
            TaxInformationCustTable_IN.validateWrite();
            {
            TaxInformationCustTable_IN.insert();
            }
        }

   if(_countryRegion == "IND")
     {
        select DirPartyLocation where DirPartyLocation.Party == custTable.Party && DirPartyLocation.IsPrimary == NoYes::Yes ;
        if(_IECNumber)
        {
        select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _iecNumber;
        if(!TaxRegistrationNumbers_IN_IEC)
            {
            TaxRegistrationNumbers_IN_IEC.RegistrationNumber = _iecNumber;
            TaxRegistrationNumbers_IN_IEC.IsGlobal           = NoYes::Yes;
            TaxRegistrationNumbers_IN_IEC.RefCompanyId       = "";
            TaxRegistrationNumbers_IN_IEC.TaxType            = TaxType_IN::Customs;
            TaxRegistrationNumbers_IN_IEC.RegistrationType   = TaxRegistrationType_IN::Customers;
            TaxRegistrationNumbers_IN_IEC.insert();
            }
        }

        if(_eccNumber)
        {
        select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
        if(!TaxRegistrationNumbers_IN_ecc)
            {
                TaxRegistrationNumbers_IN_ecc.clear();
                TaxRegistrationNumbers_IN_ecc.RegistrationNumber = _eccNumber;
                TaxRegistrationNumbers_IN_ecc.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_ecc.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_ecc.TaxType            = TaxType_IN::Excise;
                TaxRegistrationNumbers_IN_ecc.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_ecc.insert();
            }
        }

        if(_tanNumber)
        {
        select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
        if(!TaxRegistrationNumbers_IN_tan)
            {
            TaxRegistrationNumbers_IN_tan.clear();
            TaxRegistrationNumbers_IN_tan.RegistrationNumber = _tanNumber;
            TaxRegistrationNumbers_IN_tan.IsGlobal           = NoYes::Yes;
            TaxRegistrationNumbers_IN_tan.RefCompanyId       = "";
            TaxRegistrationNumbers_IN_tan.TaxType            = TaxType_IN::VAT;
            TaxRegistrationNumbers_IN_tan.RegistrationType   = TaxRegistrationType_IN::Customers;
            TaxRegistrationNumbers_IN_tan.insert();
            }
        }
                    //_salesTaxRegistrationNumber
       if(_salesTaxRegNumber)
      {
        select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
        if(!TaxRegistrationNumbers_IN_salestax)
            {
            TaxRegistrationNumbers_IN_salestax.clear();
            TaxRegistrationNumbers_IN_salestax.RegistrationNumber = _salesTaxRegNumber;
            TaxRegistrationNumbers_IN_salestax.IsGlobal           = NoYes::Yes;
            TaxRegistrationNumbers_IN_salestax.RefCompanyId       = "";
            TaxRegistrationNumbers_IN_salestax.TaxType            = TaxType_IN::SalesTax;
            TaxRegistrationNumbers_IN_salestax.RegistrationType   = TaxRegistrationType_IN::Customers;
            TaxRegistrationNumbers_IN_salestax.insert();
            }
      }
        if(_IECNumber || _eccNumber || _tanNumber || _salesTaxRegNumber)
         {
            TaxInformation_IN.clear();
            TaxInformation_IN.Name = _custaccount + _name ;
            TaxInformation_IN.IsPrimary = NoYes::Yes;
            if(_tanNumber)
            {
                TaxRegistrationNumbers_IN_tan.clear();
                select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
                TaxInformation_IN.TIN = TaxRegistrationNumbers_IN_tan.recid;
            }
            if(_eccNumber)
            {
                TaxRegistrationNumbers_IN_ecc.clear();
                select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
                TaxInformation_IN.ManECCRegistrationNumberTable = TaxRegistrationNumbers_IN_ecc.recid;
            }
            if(_IECNumber)
            {
                TaxRegistrationNumbers_IN_IEC.clear();
                select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _iecNumber;
                TaxInformation_IN.IECRegistrationNumberTable = TaxRegistrationNumbers_IN_IEC.recid;
            }
            if(_salesTaxRegNumber)
            {
                TaxRegistrationNumbers_IN_salestax.clear();
                select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
                TaxInformation_IN.SalesTaxRegistrationNumber = TaxRegistrationNumbers_IN_salestax.recid;
            }
            TaxInformation_IN.RegistrationLocation = DirPartyLocation.Location;
            TaxInformation_IN.insert();
         }//if all four tax
       }//if INR
         log = strFmt("Success : Customer %1 Created Successfully ",_custaccount);
        ttsCommit;

   } //customer exists
    else
    {
         if(CustTable::exist(_custaccount))
            log_1 =  strFmt("The customer %1 already exist or cannot be blank",_custaccount);
        if(_name == "")
            log_2 =  strFmt("The customer name cannot be blank for Customer %1",_custaccount);
        if(!CustGroup::exist(_customerGroup) || _customerGroup == "")
            log_3 =  strFmt("The Customer group %1 does not exist or cannot be blank in AX for Customer %2",_customerGroup,_custaccount);
        if(!DlvTerm::exist(_delvTerms) && _delvTerms != "" )
            log_4 =  strFmt("The Delivery Terms %1 does not exist or cannot be blank in AX for Customer %2",_delvTerms,_custaccount);
        if(!PaymTerm::exist(_paymTerms) && _paymTerms != "" )
            log_5 =  strFmt("The Payment Terms %1 does not exist or cannot be blank in AX for Customer %2",_paymTerms,_custaccount);
        if((!DlvMode::exist(_delvMode) && _delvMode != ""))
            log_6 =  strFmt("The Delivery Mode %1 does not exist or cannot be blank in AX for Customer %2",_delvMode,_custaccount);
         log = strFmt("%1\n%2\n%3\n%4\n%5\n%6",log_1,log_2,log_3,log_4,log_5,log_6);


    }
    }
return log;
}//class

CUSTOMER UPDATION AX 2012 X++ CUSTOM WEB SERVICE

CUSTOMER UPDATION AX 2012 
X++ CUSTOM WEB SERVICE

Customer Integration Update
[AifCollectionTypeAttribute('return', Types::String), SysEntryPointAttribute(true)]
public str UpdateCustomer(custAccount _custaccount,Name _name,CustGroupId _customerGroup,CustDlvTermId _delvTerms,CustPaymTermId _paymTerms,CustDlvModeId _delvMode,
                            CurrencyCode _currency,comp_AccountGroup _accountGroup, comp_CurrentFleetSize comp_CurrentFleetSize, comp_Dealer _dealer,comp_CurrentFleetSize _currentFleetSize,
                            comp_CustomerBusinessModel _customerBusinessModel,comp_CustomerSegment _customerSegment,comp_CustomerProfile _customerProfile,comp_DeliveringPlant _deliveringPlant ,comp_deliveryPriority _deliveryPriority,
                            comp_DistributionChannel _distributionChannel,comp_ExciseIndicator _exciseIndicator,comp_ExciseRegistrationNumber _exciseRegistrationNumber,comp_Industry _industry,comp_Jtx1 _jtx1,comp_Jtx2 _jtx2,comp_Jtx3 _jtx3,comp_Jtx4 _jtx4,
                            comp_Ownership _ownership, comp_PrimaryContact primarycontact,comp_SapCustomerCode _sapcustomercode,comp_SortKey _sortkey,  TaxGroup _salesTaxGroup,  VATNum _taxExemptionNo,
                            LogisticsElectronicAddressLocator _phone,  LogisticsElectronicAddressLocator _extension,LogisticsElectronicAddressLocator _fax, LogisticsElectronicAddressLocator _emailAddress ,TaxRegistrationNumber_IN _eccNumber,LogisticsAddressCountryRegionId     _countryRegion,LogisticsAddressZipCodeId  _postal,LogisticsAddressStreet  _street,
                            LogisticsAddressBuildingCompliment _buildingComponent, LogisticsAddressStreet _street3,LogisticsAddressCity  _city ,
                            LogisticsAddressStateId _state , LogisticsAddressDistrictName  _district,LogisticsAddressCountryRegionId  _countryRegion1,LogisticsAddressZipCodeId  _postal1,   LogisticsAddressStreet _street1,
                            LogisticsAddressBuildingCompliment _buildingComponent1,LogisticsAddressStreet _street31,LogisticsAddressCity  _city1,LogisticsAddressStateId _state1,
                            LogisticsAddressDistrictName  _district1,   TaxRegistrationNumber_IN _iecNumber,TaxRegistrationNumber_IN _salesTaxRegNumber,
                            TaxRegistrationNumber_IN _tanNumber,PANNumber_IN _panNumber )

{
    CustTable                       custtable;
    DirParty                        dirParty;
    DirPartyRecId                   partyRecId;
    DirPartyPostalAddressView       postaladdressView,dirPartyPostalAddressView;
    DirPartyContactInfoView         contactView,dirPartyContactInfo,dirPartyContactInfoEmail,dirPartyContactInfoFax;
    DirPartyLocation                dirpartylocation;
    TaxInformation_IN               TaxInformation_IN,TaxInformation_IN_exist,TaxInformation_IN_records,TaxInformation_IN_update;
    TaxInformationCustTable_IN      TaxInformationCustTable_IN,TIC_exist,TIC_count,tic_update;
    TaxRegistrationNumbers_IN       TaxRegistrationNumbers_IN_IEC,TaxRegistrationNumbers_IN_ecc,
                                    TaxRegistrationNumbers_IN_tan,TaxRegistrationNumbers_IN_salestax,TRN_exist,
                                    TRN_IN_IEC_upd,TRN_IN_ecc_upd,TRN_IN_tan_upd,TRN_IN_salestaxupd;
    int64                           _taxRecordcount;
    CustAccount                     custAccount;
    str                             namealias;
    DirPartyTable                   dirPartyTable;
    container                       roles_delivery,roles_invoice;
    str                             log,log_1,log_2,log_3,log_4,log_5,log_6,log_7;
    compProductMasterDefault         compMasterDefault;
    CustPaymTermId                  paymTermsstr;

    select * from compMasterDefault;
    _delvMode = "";
    paymTermsstr = _paymTerms;
    ttsBegin;
 if(_customerGroup != 'del')
    changeCompany(compMasterDefault.DealerCompany)
 {
     if((CustTable::exist(_custaccount) &&_custaccount != "") && _name !="" && CustGroup::exist(_customerGroup) && (DlvTerm::exist(_delvTerms) || _delvTerms == "")
            && (PaymTerm::exist(_paymTerms) || _paymTerms == "") && (DlvMode::exist(_delvMode) || _delvMode == "") )
      {
        select forUpdate custtable where custtable.AccountNum ==_custaccount;

        if(custtable)
        {
            ttsBegin;
            custtable.PaymTermId    = _paymTerms;
            custtable.DlvTerm       = _delvTerms;
            custtable.DlvMode       = _delvMode;
            custtable.TaxGroup      = _salesTaxGroup;//salestaxgroup
            custtable.VATNum        = _taxExemptionNo;
            custtable.comp_ExciseRegistrationNumber = _exciseRegistrationNumber;
            namealias = _name;
            postaladdressView.clear();
            select postaladdressView where postaladdressView.Party == custtable.Party && postaladdressView.IsPrimary == NoYes::Yes ;
            //{
                DirParty = DirParty::constructFromPartyRecId(postaladdressView.Party);
                postaladdressView.CountryRegionId   = _countryRegion;
                postaladdressView.State             = _state;
                postaladdressView.City              = _city;
                postaladdressView.ZipCode           = _postal;
                postaladdressView.Street            = _street;
                postaladdressView.BuildingCompliment= _buildingComponent;
                postaladdressView.PostBox           = _street3;
                postaladdressView.DistrictName      = _district;
                postaladdressView.LocationName      = _name;
                postaladdressView.Party             = custtable.Party;
                roles_invoice = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Invoice).RecId];
                DirParty.createOrUpdatePostalAddress(postaladdressView,roles_invoice);

                //second address
                dirPartyPostalAddressView.clear();
            select dirPartyPostalAddressView where dirPartyPostalAddressView.Party == custtable.Party && dirPartyPostalAddressView.IsPrimary == NoYes::no ;
            {
                DirParty = DirParty::constructFromPartyRecId(dirPartyPostalAddressView.Party);
                dirPartyPostalAddressView.CountryRegionId        = _countryRegion1;
                dirPartyPostalAddressView.ZipCode                = _postal1;
                dirPartyPostalAddressView.Street                 = _street1;
                dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent1;
                dirPartyPostalAddressView.PostBox                = _street31;
                dirPartyPostalAddressView.City                   = _city1;
                dirPartyPostalAddressView.State                  = _state1;
                dirPartyPostalAddressView.DistrictName           = _district1;
                dirPartyPostalAddressView.LocationName           = _name;//extra
                dirPartyPostalAddressView.IsPrimary              = NoYes::No;
                roles_delivery = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery).RecId];
                dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_delivery);

                select forUpdate dirPartyTable where dirPartyTable.RecId == custtable.Party;
                dirPartyTable.NameAlias        = _name;
                dirPartyTable.Name             = _name;
                dirPartyTable.update();
            }

              if(_Phone)
                {
                select  contactView where contactView.Party == custtable.Party && contactView.Type == LogisticsElectronicAddressMethodType::Phone;
                    {
                        dirParty = dirParty::constructFromPartyRecId(contactView.Party);
                        contactView.LocationName = "Phone";
                        contactView.Locator = _Phone;
                        contactView.locatorextension = _Extension;
                        contactView.Type = LogisticsElectronicAddressMethodType::Phone;
                        contactView.Party = custtable.Party;//dirParty.getPartyRecId();
                        contactView.IsPrimary = NoYes::Yes;
                        dirParty.createOrUpdateContactInfo(contactView);
                    }
                }
               if(_emailAddress)
                {   contactView.clear();
                    select contactView where contactView.Party == custtable.Party && contactView.Type == LogisticsElectronicAddressMethodType::Email;
                    {
                    DirParty = DirParty::constructFromPartyRecId(contactView.Party);
                    contactView.LocationName    = "Email Address";
                    contactView.Locator         = _emailAddress;
                    contactView.Type            = LogisticsElectronicAddressMethodType::Email;
                    contactView.Party           = custtable.Party;
                    contactView.IsPrimary       = NoYes::Yes;
                    dirParty.createOrUpdateContactInfo(contactView);
                    }
                }
             if(_Fax)
                {   dirPartyContactInfoFax.clear();
                    select dirPartyContactInfoFax where dirPartyContactInfoFax.Party == custtable.Party && dirPartyContactInfoFax.Type == LogisticsElectronicAddressMethodType::Fax;
                    {
                    DirParty = DirParty::constructFromPartyRecId(contactView.Party);
                    dirPartyContactInfoFax.LocationName = "Fax no update";
                    dirPartyContactInfofax.Type         = LogisticsElectronicAddressMethodType::Fax;
                    dirPartyContactInfofax.LocationName = _fax;
                    dirPartyContactInfofax.Party        = custtable.Party;
                    dirParty.createOrUpdateContactInfo(dirPartyContactInfofax);
                    }
                }
             if(_panNumber)
                {//dealer
                //select TaxInformationCustTable_IN where TaxInformationCustTable_IN.PANNumber == _panNumber && TaxInformationCustTable_IN.CustTable == _custaccount;
                select TaxInformationCustTable_IN where TaxInformationCustTable_IN.CustTable == _custaccount;
                if(!TaxInformationCustTable_IN)
                    {
                        TaxInformationCustTable_IN.clear();
                        TaxInformationCustTable_IN.CustTable        = _custaccount;
                        TaxInformationCustTable_IN.PanStatus        = PANStatus_IN::Received;
                        TaxInformationCustTable_IN.PANNumber        = _panNumber;
                        TaxInformationCustTable_IN.NatureOfAssessee = NatureOfAssessee_IN::Company;
                        TaxInformationCustTable_IN.validateWrite();
                        {
                        TaxInformationCustTable_IN.insert();
                        }
                    }
                else
                    {
                    select forupdate tic_update where tic_update.CustTable == _custaccount;
                        tic_update.PANNumber = _panNumber;
                        tic_update.update();
                    }
                }//pan nuber
     if(_countryRegion == "IND")
       {
         select DirPartyLocation where DirPartyLocation.Party == custtable.Party && DirPartyLocation.IsPrimary == NoYes::Yes ;
         select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
         select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
         select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
         select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;

         select TaxInformation_IN_exist where  TaxInformation_IN_exist.RegistrationLocation == DirPartyLocation.Location
                                              && TaxInformation_IN_exist.ManECCRegistrationNumberTable == TaxRegistrationNumbers_IN_ecc.RecId
                                              && TaxInformation_IN_exist.SalesTaxRegistrationNumber ==  TaxRegistrationNumbers_IN_salestax.RecId
                                              && TaxInformation_IN_exist.TIN == TaxRegistrationNumbers_IN_tan.RecId
                                              && TaxInformation_IN_exist.IECRegistrationNumberTable == TaxRegistrationNumbers_IN_IEC.RecId ;
        if(!TaxInformation_IN_exist)
         {
             //changes for ta info TaxInformation_IN_exist
             select forUpdate TaxInformation_IN_exist
                where TaxInformation_IN_exist.RegistrationLocation == DirPartyLocation.Location
                        && TaxInformation_IN_exist.IsPrimary == NoYes::Yes;
             if(TaxInformation_IN_exist)
             {
                   {
                      TaxInformation_IN_exist.IsPrimary = NoYes::No;
                      TaxInformation_IN_exist.update();
                   }

             select count(RecId) from TaxInformation_IN_records where TaxInformation_IN_records.RegistrationLocation == DirPartyLocation.Location ;
                   _taxRecordcount = TaxInformation_IN_records.RecId;

             }

            if(_IECNumber)
            {
            //select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
            if(!TaxRegistrationNumbers_IN_IEC)
                {
                TaxRegistrationNumbers_IN_IEC.RegistrationNumber = _IECNumber;
                TaxRegistrationNumbers_IN_IEC.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_IEC.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_IEC.TaxType            = TaxType_IN::Customs;
                TaxRegistrationNumbers_IN_IEC.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_IEC.insert();
                }
            }

            if(_eccNumber)
            {
            if(!TaxRegistrationNumbers_IN_ecc)
                {
                    TaxRegistrationNumbers_IN_ecc.clear();
                    TaxRegistrationNumbers_IN_ecc.RegistrationNumber = _eccNumber;
                    TaxRegistrationNumbers_IN_ecc.IsGlobal           = NoYes::Yes;
                    TaxRegistrationNumbers_IN_ecc.RefCompanyId       = "";
                    TaxRegistrationNumbers_IN_ecc.TaxType            = TaxType_IN::Excise;
                    TaxRegistrationNumbers_IN_ecc.RegistrationType   = TaxRegistrationType_IN::Customers;
                    TaxRegistrationNumbers_IN_ecc.insert();
                }
            }

            if(_tanNumber)
            {
            if(!TaxRegistrationNumbers_IN_tan)
                {
                TaxRegistrationNumbers_IN_tan.clear();
                TaxRegistrationNumbers_IN_tan.RegistrationNumber = _tanNumber;
                TaxRegistrationNumbers_IN_tan.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_tan.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_tan.TaxType            = TaxType_IN::VAT;
                TaxRegistrationNumbers_IN_tan.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_tan.insert();
                }
            }
            //_salesTaxRegistrationNumber
           if(_salesTaxRegNumber)
          {
            if(!TaxRegistrationNumbers_IN_salestax)
                {
                TaxRegistrationNumbers_IN_salestax.clear();
                TaxRegistrationNumbers_IN_salestax.RegistrationNumber = _salesTaxRegNumber;
                TaxRegistrationNumbers_IN_salestax.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_salestax.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_salestax.TaxType            = TaxType_IN::SalesTax;
                TaxRegistrationNumbers_IN_salestax.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_salestax.insert();
                }
          }
        if(_IECNumber || _eccNumber || _tanNumber || _salesTaxRegNumber)
         {
           //  select forupdate TaxInformation_IN
            TaxInformation_IN.clear();
            TaxInformation_IN.Name = strFmt("%1 %2",_name,_taxRecordcount);
            TaxInformation_IN.IsPrimary = NoYes::Yes;
            if(_tanNumber)
            {
                TaxRegistrationNumbers_IN_tan.clear();
                select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
                TaxInformation_IN.TIN = TaxRegistrationNumbers_IN_tan.recid;
            }
            if(_eccNumber)
            {
                TaxRegistrationNumbers_IN_ecc.clear();
                select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _tanNumber;
                TaxInformation_IN.ECCNumber = TaxRegistrationNumbers_IN_ecc.recid;
            }
            if(_IECNumber)
            {
                TaxRegistrationNumbers_IN_IEC.clear();
                select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
                TaxInformation_IN.IECRegistrationNumberTable = TaxRegistrationNumbers_IN_IEC.recid;
            }
            if(_salesTaxRegNumber)
            {
                TaxRegistrationNumbers_IN_salestax.clear();
                select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
                TaxInformation_IN.SalesTaxRegistrationNumber = TaxRegistrationNumbers_IN_salestax.recid;
            }
            TaxInformation_IN.RegistrationLocation = DirPartyLocation.Location;
            TaxInformation_IN.insert();
         }//if all four tax  if(_IECNumber || _e
       }//if tax information exist
      }//if INR
     custtable.update();
     ttsCommit;
      log = strFmt("Success : Customer %1 updated successfully",_custaccount);
    }//if custtable
   }//if all exist
    else   //if all does not exist
    {

        if(!CustTable::exist(_custaccount))
            log_1 =  strFmt("The customer %1 already exist or cannot be blank",_custaccount);
        if(_name == "")
            log_2 =  strFmt("The customer name cannot be blank for Customer %1",_custaccount);
        if(!CustGroup::exist(_customerGroup) || _customerGroup == "")
            log_3 =  strFmt("The Customer group %1 does not exist or cannot be blank in AX for Customer %2",_customerGroup,_custaccount);
        if(!DlvTerm::exist(_delvTerms) && _delvTerms != "" )
            log_4 =  strFmt("The Delivery Terms %1 does not exist or cannot be blank in AX for Customer %2",_delvTerms,_custaccount);
        if(!PaymTerm::exist(_paymTerms) && _paymTerms != "" )
            log_5 =  strFmt("The Payment Terms %1 does not exist or cannot be blank in AX for Customer %2",_paymTerms,_custaccount);
        if((!DlvMode::exist(_delvMode) && _delvMode != ""))
            log_6 =  strFmt("The Delivery Mode %1 does not exist or cannot be blank in AX for Customer %2",_delvMode,_custaccount);
         log = strFmt("%1\n%2\n%3\n%4\n%5\n%6",log_1,log_2,log_3,log_4,log_5,log_6);

    } //if customer exist
  } //change company if
     else
        {
            changeCompany(compMasterDefault.delCompany)

        if((CustTable::exist(_custaccount) &&_custaccount != "") && _name !="" && CustGroup::exist(_customerGroup) && (DlvTerm::exist(_delvTerms) || _delvTerms == "")
            && (PaymTerm::exist(_paymTerms) || _paymTerms == "") && (DlvMode::exist(_delvMode) || _delvMode == ""))
      {
        select forUpdate custtable where custtable.AccountNum ==_custaccount;

        if(custtable)
        {
            ttsBegin;
            custtable.PaymTermId    = _paymTerms;
            custtable.PaymTermId    = paymTermsstr;
            custtable.DlvTerm       = _delvTerms;
            custtable.DlvMode       = _delvMode;
            custtable.TaxGroup      = _salesTaxGroup;//salestaxgroup
            custtable.VATNum        = _taxExemptionNo;
            custtable.comp_ExciseRegistrationNumber = _exciseRegistrationNumber;
            namealias = _name;
            postaladdressView.clear();
            select postaladdressView where postaladdressView.Party == custtable.Party && postaladdressView.IsPrimary == NoYes::Yes ;
            //{
                DirParty = DirParty::constructFromPartyRecId(postaladdressView.Party);
                postaladdressView.CountryRegionId   =_countryRegion;
                postaladdressView.State             =_state;
                postaladdressView.City              =_city;
                postaladdressView.ZipCode           =_postal;
                postaladdressView.Street            =_street;
                postaladdressView.BuildingCompliment= _buildingComponent;
                postaladdressView.PostBox           = _street3;
                postaladdressView.DistrictName      = _district;
                postaladdressView.LocationName      = _name;
                postaladdressView.Party             = custtable.Party;
                roles_invoice = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Invoice).RecId];
                DirParty.createOrUpdatePostalAddress(postaladdressView,roles_invoice);

                //second address
                dirPartyPostalAddressView.clear();
            select dirPartyPostalAddressView where dirPartyPostalAddressView.Party == custtable.Party && dirPartyPostalAddressView.IsPrimary == NoYes::no ;
            {
                DirParty = DirParty::constructFromPartyRecId(dirPartyPostalAddressView.Party);
                dirPartyPostalAddressView.CountryRegionId        = _countryRegion1;
                dirPartyPostalAddressView.ZipCode                = _postal1;
                dirPartyPostalAddressView.Street                 = _street1;
                dirPartyPostalAddressView.BuildingCompliment     = _buildingComponent1;
                dirPartyPostalAddressView.PostBox                = _street31;
                dirPartyPostalAddressView.City                   = _city1;
                dirPartyPostalAddressView.State                  = _state1;//"Delhi";// _state1;//'SP';
                dirPartyPostalAddressView.DistrictName           = _district1;
                dirPartyPostalAddressView.LocationName           = _name;//extra
                dirPartyPostalAddressView.IsPrimary              = NoYes::No;
                roles_delivery = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Delivery).RecId];
                dirParty.createOrUpdatePostalAddress(dirPartyPostalAddressView,roles_delivery);

                select forUpdate dirPartyTable where dirPartyTable.RecId == custtable.Party;
                dirPartyTable.NameAlias        = _name;
                dirPartyTable.Name             = _name;
                dirPartyTable.update();
            }

              if(_Phone)
                {
                select  contactView where contactView.Party == custtable.Party && contactView.Type == LogisticsElectronicAddressMethodType::Phone;
                    {
                        dirParty = dirParty::constructFromPartyRecId(contactView.Party);
                        contactView.LocationName = "Phone";
                        contactView.Locator = _phone;
                        contactView.locatorextension = _extension;
                        contactView.Type = LogisticsElectronicAddressMethodType::Phone;
                        contactView.Party = custtable.Party;//dirParty.getPartyRecId();
                        contactView.IsPrimary = NoYes::Yes;
                        dirParty.createOrUpdateContactInfo(contactView);
                    }
                }
               if(_emailAddress)
                {   contactView.clear();
                    select contactView where contactView.Party == custtable.Party && contactView.Type == LogisticsElectronicAddressMethodType::Email;
                    {
                    DirParty = DirParty::constructFromPartyRecId(contactView.Party);
                    contactView.LocationName = "Email Address";
                    contactView.Locator = _emailAddress;
                    contactView.Type = LogisticsElectronicAddressMethodType::Email;
                    contactView.Party = custtable.Party;//dirParty.getPartyRecId();
                    contactView.IsPrimary = NoYes::Yes;
                    dirParty.createOrUpdateContactInfo(contactView);
                    }
                }
             if(_Fax)
                {   dirPartyContactInfoFax.clear();
                    select dirPartyContactInfoFax where dirPartyContactInfoFax.Party == custtable.Party && dirPartyContactInfoFax.Type == LogisticsElectronicAddressMethodType::Fax;
                    {
                    DirParty = DirParty::constructFromPartyRecId(contactView.Party);
                    dirPartyContactInfoFax.LocationName = "Fax number";
                    dirPartyContactInfofax.Type                      = LogisticsElectronicAddressMethodType::Fax;
                    dirPartyContactInfofax.LocationName              = _fax;
                    dirPartyContactInfofax.Party = custtable.Party;
                    dirParty.createOrUpdateContactInfo(dirPartyContactInfofax);
                    }
                }
             if(_panNumber)
                {//del
                     select TaxInformationCustTable_IN where TaxInformationCustTable_IN.CustTable == _custaccount;
                if(!TaxInformationCustTable_IN)
                    {
                        TaxInformationCustTable_IN.clear();
                        TaxInformationCustTable_IN.CustTable        = _custaccount;
                        TaxInformationCustTable_IN.PanStatus        = PANStatus_IN::Received;
                        TaxInformationCustTable_IN.PANNumber        = _panNumber;
                        TaxInformationCustTable_IN.NatureOfAssessee = NatureOfAssessee_IN::Company;
                        TaxInformationCustTable_IN.validateWrite();
                        {
                        TaxInformationCustTable_IN.insert();
                        }
                    }
                else
                    {
                    select forupdate tic_update where tic_update.CustTable == _custaccount;
                        tic_update.PANNumber = _panNumber;
                        tic_update.update();
                    }
                }//pan nuber
     if(_countryRegion == "IND")
       {
         select DirPartyLocation where DirPartyLocation.Party == custtable.Party && DirPartyLocation.IsPrimary == NoYes::Yes ;
         select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
         select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _eccNumber;
         select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
         select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;

         select TaxInformation_IN_exist where  TaxInformation_IN_exist.RegistrationLocation == DirPartyLocation.Location
                                              && TaxInformation_IN_exist.ManECCRegistrationNumberTable == TaxRegistrationNumbers_IN_ecc.RecId
                                              && TaxInformation_IN_exist.SalesTaxRegistrationNumber ==  TaxRegistrationNumbers_IN_salestax.RecId
                                              && TaxInformation_IN_exist.TIN == TaxRegistrationNumbers_IN_tan.RecId
                                              && TaxInformation_IN_exist.IECRegistrationNumberTable == TaxRegistrationNumbers_IN_IEC.RecId ;

        if(!TaxInformation_IN_exist)
         {
             //changes for ta info TaxInformation_IN_exist
             select forUpdate TaxInformation_IN_exist
                        where TaxInformation_IN_exist.RegistrationLocation == DirPartyLocation.Location
                                && TaxInformation_IN_exist.IsPrimary == NoYes::Yes;
             if(TaxInformation_IN_exist)
             {
                   {
                      TaxInformation_IN_exist.IsPrimary = NoYes::No;
                      TaxInformation_IN_exist.update();
                   }

             select count(RecId) from TaxInformation_IN_records where TaxInformation_IN_records.RegistrationLocation == DirPartyLocation.Location ;
                   _taxRecordcount = TaxInformation_IN_records.RecId;

             }
          //   select TIC_count
            if(_IECNumber)
            {
            //select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
            if(!TaxRegistrationNumbers_IN_IEC)
                {
                TaxRegistrationNumbers_IN_IEC.RegistrationNumber = _IECNumber;
                TaxRegistrationNumbers_IN_IEC.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_IEC.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_IEC.TaxType            = TaxType_IN::Customs;
                TaxRegistrationNumbers_IN_IEC.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_IEC.insert();
                }
            }

            if(_eccNumber)
            {
            if(!TaxRegistrationNumbers_IN_ecc)
                {
                    TaxRegistrationNumbers_IN_ecc.clear();
                    TaxRegistrationNumbers_IN_ecc.RegistrationNumber = _eccNumber;
                    TaxRegistrationNumbers_IN_ecc.IsGlobal           = NoYes::Yes;
                    TaxRegistrationNumbers_IN_ecc.RefCompanyId       = "";
                    TaxRegistrationNumbers_IN_ecc.TaxType            = TaxType_IN::Excise;
                    TaxRegistrationNumbers_IN_ecc.RegistrationType   = TaxRegistrationType_IN::Customers;
                    TaxRegistrationNumbers_IN_ecc.insert();
                }
            }

            if(_tanNumber)
            {
            if(!TaxRegistrationNumbers_IN_tan)
                {
                TaxRegistrationNumbers_IN_tan.clear();
                TaxRegistrationNumbers_IN_tan.RegistrationNumber = _tanNumber;
                TaxRegistrationNumbers_IN_tan.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_tan.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_tan.TaxType            = TaxType_IN::VAT;
                TaxRegistrationNumbers_IN_tan.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_tan.insert();
                }
            }
            //_salesTaxRegistrationNumber
           if(_salesTaxRegNumber)
          {
            if(!TaxRegistrationNumbers_IN_salestax)
                {
                TaxRegistrationNumbers_IN_salestax.clear();
                TaxRegistrationNumbers_IN_salestax.RegistrationNumber = _salesTaxRegNumber;
                TaxRegistrationNumbers_IN_salestax.IsGlobal           = NoYes::Yes;
                TaxRegistrationNumbers_IN_salestax.RefCompanyId       = "";
                TaxRegistrationNumbers_IN_salestax.TaxType            = TaxType_IN::SalesTax;
                TaxRegistrationNumbers_IN_salestax.RegistrationType   = TaxRegistrationType_IN::Customers;
                TaxRegistrationNumbers_IN_salestax.insert();
                }
          }
        if(_IECNumber || _eccNumber || _tanNumber || _salesTaxRegNumber)
         {
           //  select forupdate TaxInformation_IN
            TaxInformation_IN.clear();
            TaxInformation_IN.Name = strFmt("%1 %2",_name,_taxRecordcount);
            TaxInformation_IN.IsPrimary = NoYes::Yes;
            if(_tanNumber)
            {
                TaxRegistrationNumbers_IN_tan.clear();
                select TaxRegistrationNumbers_IN_tan where TaxRegistrationNumbers_IN_tan.RegistrationNumber == _tanNumber;
                TaxInformation_IN.TIN = TaxRegistrationNumbers_IN_tan.recid;
            }
            if(_eccNumber)
            {
                TaxRegistrationNumbers_IN_ecc.clear();
                select TaxRegistrationNumbers_IN_ecc where TaxRegistrationNumbers_IN_ecc.RegistrationNumber == _tanNumber;
                TaxInformation_IN.ECCNumber = TaxRegistrationNumbers_IN_ecc.recid;
            }
            if(_IECNumber)
            {
                TaxRegistrationNumbers_IN_IEC.clear();
                select TaxRegistrationNumbers_IN_IEC where TaxRegistrationNumbers_IN_IEC.RegistrationNumber == _IECNumber;
                TaxInformation_IN.IECRegistrationNumberTable = TaxRegistrationNumbers_IN_IEC.recid;
            }
            if(_salesTaxRegNumber)
            {
                TaxRegistrationNumbers_IN_salestax.clear();
                select TaxRegistrationNumbers_IN_salestax where TaxRegistrationNumbers_IN_salestax.RegistrationNumber == _salesTaxRegNumber;
                TaxInformation_IN.SalesTaxRegistrationNumber = TaxRegistrationNumbers_IN_salestax.recid;
            }
            TaxInformation_IN.RegistrationLocation = DirPartyLocation.Location;
            TaxInformation_IN.insert();
         }//if all four tax  if(_IECNumber || _e
       }//if tax information exist
      }//if INR
     custtable.update();
     ttsCommit;
        log = strFmt("Success : Customer %1 updated successfully",_custaccount);
    }//if custtable
   }//if all exist
    else   //if all does not exist
    {
        if(!CustTable::exist(_custaccount))
            log_1 =  strFmt("The customer %1 already exist or cannot be blank",_custaccount);
        if(_name == "")
            log_2 =  strFmt("The customer name cannot be blank for Customer %1",_custaccount);
        if(!CustGroup::exist(_customerGroup) || _customerGroup == "")
            log_3 =  strFmt("The Customer group %1 does not exist or cannot be blank in AX for Customer %2",_customerGroup,_custaccount);
        if(!DlvTerm::exist(_delvTerms) && _delvTerms != "" )
            log_4 =  strFmt("The Delivery Terms %1 does not exist or cannot be blank in AX for Customer %2",_delvTerms,_custaccount);
        if(!PaymTerm::exist(_paymTerms) && _paymTerms != "" )
            log_5 =  strFmt("The Payment Terms %1 does not exist or cannot be blank in AX for Customer %2",_paymTerms,_custaccount);
        if((!DlvMode::exist(_delvMode) && _delvMode != ""))
            log_6 =  strFmt("The Delivery Mode %1 does not exist or cannot be blank in AX for Customer %2",_delvMode,_custaccount);
         log = strFmt("%1\n%2\n%3\n%4\n%5\n%6",log_1,log_2,log_3,log_4,log_5,log_6);

    } //if customer exist
        }
            ttsCommit;
  return log;
}

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...