while select vendTable
{
info(strFmt(
"%1 - %2",
vendTable.AccountNum,
vendTable.Blocked));
while SELECT * FROM nSG_TechSpecification_SQ
WHERE ((nSG_TechSpecification_SQ.MainCodes==2))
print nSG_TechSpecification_SQ.Code;
pause;
To use normal table as temp table
vendTable.setTmp();
vendTable.AccountNum = '1000';
vendTable.Blocked = CustVendorBlocked::No;
vendTable.Party = 1;
vendTable.doInsert();
vendTable.AccountNum = '1002';
vendTable.Blocked = CustVendorBlocked::All;
vendTable.Party = 2;
vendTable.doInsert();
setTmp() - To make temporary in scope of the method
doInsert() - to bipass any additional logic resided in insert() method .
Copying a record : // see cook book
How to create a Query(dynamically) and add a link in Ax 2009
static void CustTableSales1(Args _args)
{
Query query;
QueryRun queryrun;
QueryBuildDataSource qbds1;
QueryBuildDataSource qbds2;
QueryBuildRange qbr1;
QueryBuildRange qbr2;
CustTable custTable;
;
query = new query();
qbds1 = query.addDataSource(tablenum(CustTable));
qbds1.addSortField(fieldnum(custTable,AccountNum),Sortorder::Descending);
qbr1 = qbds1.addRange(fieldnum(custTable,custGroup));
qbr1.value(queryvalue('10'));
qbr2 = qbds1.addRange(fieldnum(custTable,Blocked));
qbr2.value(queryvalue(CustVendorBlocked::No));
qbds2 = qbds1.addDataSource(tablenum(SalesTable));
qbds2.relations(false);
qbds2.joinMode(joinmode::ExistsJoin);
qbds2.addLink(fieldnum(CustTable,AccountNum),fieldnum(SalesTable,CustAccount));
queryrun = new queryrun(query);
while(queryrun.next())
{
custTable = queryrun.get(tablenum(custTable));
info(strfmt("%1 - %2",custtable.AccountNum,custTable.Name)); // to check your result
}
}
To send mail Automatically using X++ Code :
Below Code sends mails to all Customers who have performed Invoices for Sales order today. Mail sends information of Sales order its Invoice amount and Total Invoice amount of the Customer( Sum of all invoice amounts of all SO he invoiced )
CustInvoiceJour CIJ1,CIJ2;
SysMailer
mailer;
str to,cc;
str body,sub;
while select
sum(InvoiceAmountMST) from CIJ1
group by CIJ1.OrderAccount where CIJ1.invoicedate == today()
{
mailer = new SysMailer();
sub
= strfmt("Today's
Invoice Amount Details to customer : ",CIJ1.OrderAccount);
body
= "<html><body>"+ strfmt("Dear
%1", CIJ1.OrderAccount )+ "<br/><br>"+
strfmt("This
is bring to ur notice your Total
Invoiced Amount : ",CIJ1.InvoiceAmountMST) + "<br/><br>";
while select
* from CIJ2 where CIJ2.OrderAccount == CIJ1.OrderAccount
&& CIJ2.invoicedate == today()
body = Body + "<html>
<body><table border='1'>";
{
body= body+ "<tr><td>" + strfmt("Sales ID") +"</td>";
body= body+ "<td>" + strfmt("%1", CIJ2.SalesId) +"</td></tr>";
body= body+ "<tr><td>" + strfmt("Amount") +"</td>";
body= body+ "<td>" + strfmt("%1", CIJ2.InvoiceAmount) +"</td></tr>";
}
Body=
Body + "</table>";
Body
= Body + strfmt("<br/><br/><b>Note:This is a
system generated email. Please do not reply to this mail.</b>
</body></html>");
mailer.quickSend("sujana.jupudi@mazikglobal.com","madhava.reddy@mazikglobal.com",sub,body);
info("mail Sent");
}
To Perform Automatic Invoice for all Packed SO today using X++ Code :
CustPackingSlipJour c;
date thisDate = systemDateGet();
SalesFormLetter formLetterObj;
// Code To Perform
Automatic Invoice of all the SO which
are Packed Today.
while select
SalesId from c where c.DeliveryDate == thisDate
{
info(strFmt("%1",c.SalesId));
formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice);
formLetterObj.update(SalesTable::find(c.SalesId), SystemDateGet(), SalesUpdate::PackingSlip,
AccountOrder::None, false,true);
}
// Steps to Create Number Sequence :
Create number sequence for BankCust Field in BankCustomers Table:
// Steps to Create Number Sequence :
Create number sequence for BankCust Field in BankCustomers Table:
1. Create EDT - "BankCust"
2. Go to Classes -> NumberSeqModuleCustomer - > Load Module
modify continous - false
datatype.parmDatatypeId(extendedTypeNum(BankCust));
datatype.parmReferenceHelp(literalStr("@FPP266"));
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
datatype.parmSortField(22);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
3. Job
static void NumberSeqLoadAll(Args _args)
{
NumberSeqApplicationModule::loadAll();
info("jobExecuteD");
}
Run the job.
4. CEU >> OrgAdm >> Common >> NumSequ >> Generate >> Next >> Filter By Reference.
Remove all the number sequences except our's ( based on number of companies that many will be generated)
5. Tables >> CustParameters >> Methods>>
client server static NumberSequenceReference numRefBankCust()
{
return NumberSeqReference::findReference(extendedTypeNum(BankCust));
}
6. Job
static void LoadNumberSeqforModule(Args _args)
{
NumberSeq::newGetNum(CustParameters::numRefSBankCust()).num();
info("Executed");
}
7. Table >> Init >>
public void initValue()
{
super();
this.BankCust = NumberSeq::newGetNum(CustParameters::numRefBankCust()).num();
}
Open Table and check Number sequence is generated.
Based on a/c type if we need to set diff number seq for a field :
For ex : if bank a/c created automatically based on a/c type - debit card should be created with automatic number seq .
then in bank table - validate method , we need to write below code.
if(BankCustomers_DebitCardACType.valueStr() == "Saving")
{
bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefSBankCust()).num();
bankCustDebitCardTmp.Limit = 1000;
}
if(BankCustomers_DebitCardACType.valueStr()=="Current")
{
bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefCBankCust()).num();
bankCustDebitCardTmp.Limit = 5000;
}
if(BankCustomers_DebitCardACType.valueStr()=="Recurring")
{
bankCustDebitCardTmp.DebitCardNo = NumberSeq::newGetNum(CustParameters::numRefRBankCust()).num();
bankCustDebitCardTmp.Limit = 500;
}
// How to add lookup to a field in the form :
Create a StringEdit type field and override the lookup method of that field
public void lookup()
{
SysFieldGroupLookup lkup;
Query q = new Query();
super();
lkup = SysFieldGroupLookup::newParameters(tablenum(InventSite), this);
q.addDataSource(tablenum(InventSite));
lkup.addLookupfield(fieldnum(InventSite, Name));
lkup.parmQuery(q);
lkup.performFormLookup();
}
Query query = new Query();
QueryBuildDataSource qbds_NSG_TechSpecification_SQ;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;
sysTableLookup = SysTableLookup::newParameters(tablenum(NSG_TechSpecification_SQ), this);
qbds_NSG_TechSpecification_SQ = query.addDataSource(tableNum(NSG_TechSpecification_SQ));
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, code), true);
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, Name),true);
qbr = qbds_NSG_TechSpecification_SQ.addRange(fieldNum(NSG_TechSpecification_SQ,MainCodes));
qbr.value('Stiffness');
sysTableLookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
QueryBuildDataSource qbds_NSG_TechSpecification_SQ;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;
sysTableLookup = SysTableLookup::newParameters(tablenum(NSG_TechSpecification_SQ), this);
qbds_NSG_TechSpecification_SQ = query.addDataSource(tableNum(NSG_TechSpecification_SQ));
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, code), true);
sysTableLookup.addLookupfield(fieldnum(NSG_TechSpecification_SQ, Name),true);
qbr = qbds_NSG_TechSpecification_SQ.addRange(fieldNum(NSG_TechSpecification_SQ,MainCodes));
qbr.value('Stiffness');
sysTableLookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
How Lemeridian funding service grant me a loan!!!
ReplyDeleteHello everyone, I'm Lea Paige Matteo from Zurich Switzerland and want to use this medium to express gratitude to lemeridian funding service for fulfilling his promise by granting me a loan, I was stuck in a financial situation and needed to refinance and pay my bills as well as start up a Business. I tried seeking for loans from various loan firms both private and corporate organisations but never succeeded and most banks declined my credit request. But as God would have it, I was introduced by a friend named Lisa Rice to Le_meridian funding service and undergone the due process of obtaining a loan from the company, to my greatest surprise within 48hrs just like my friend Lisa, I was also granted a loan of $216,000.00 So my advise to everyone who desires a loan, "if you must contact any firm with reference to securing a loan online with low interest rate of 1.9% and better repayment plans/schedule, please contact Le_meridian funding service. Besides, he doesn't know that am doing this but due to the joy in me, I'm so happy and wish to let people know more about this great company whom truly give out loans, it is my prayer that GOD should bless them more as they put smiles on peoples faces. You can contact them via email on {lfdsloans@lemeridianfds.com Or lfdsloans@outlook.com} or Text through Whatsapp +1-989 394 3740.