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
No comments:
Post a Comment