Çok güzel bir sayfa olmuş, yazarına teşekkürler:
https://thwidmer.wordpress.com/2013/07/31/function-to-use-in-queries-filters/
Blog Listem
27 Eylül 2019 Cuma
26 Nisan 2019 Cuma
AX 2012 - View'a computed column eklemek
AX 2012 View'a computed column eklerken yaptığımız aslında create view cümlesine ekleme yapmak ve SQL Server tarafında hatasız oluşmasını sağlamak.
Öncelikle view tablo metodlarına eklemek istediğimiz kolon için bir metod ekliyoruz:
public static server str SNBisBuggedReverse()
{
return strFmt("select top 1 sign(sum(accountingcurrencyamount)) from GENERALJOURNALACCOUNTENTRY g "+
"where isnull(%1,'') <> '' and exists (select * from TRANSACTIONREVERSALTRANS t where t.TRACENUM = %1 and t.REFRECID = g.RECID and t.REFTABLEID = %2) "+
"group by g.LEDGERACCOUNT "+
"order by 1 desc",SysComputedColumn::comparisonField(identifierstr(PAXMizanView), identifierstr(TransactionReversalTrans), identifierstr(TraceNum)),
tableNum(GeneralJournalAccountEntry));
}
Yukarıda görüldüğü gibi AX sorgusu değil de SQL Server sorgusu kullandım metodu eklerken. Metodumuz aşağıdaki gibi bir string değer döndürecek:
select top 1 sign(sum(accountingcurrencyamount)) from GENERALJOURNALACCOUNTENTRY g where isnull(T4.TRACENUM,'') <> '' and exists (select * from TRANSACTIONREVERSALTRANS t where t.TRACENUM = T4.TRACENUM and t.REFRECID = g.RECID and t.REFTABLEID = 3119) group by g.LEDGERACCOUNT order by 1 desc
View'a eklediğimiz kolonun NoYes cinsinde Enum olmasını istiyoruz. O zaman:
Ardından Eklediğimiz View metodu ViewMethod property alanından seçiyoruz.
Eklediğim yeni kolon maalesef view hızını çok yavaşlatan bir kolondu, mümkün oldukça daha basit birşeyler seçmek view hızı açısından önemli.
Öncelikle view tablo metodlarına eklemek istediğimiz kolon için bir metod ekliyoruz:
public static server str SNBisBuggedReverse()
{
return strFmt("select top 1 sign(sum(accountingcurrencyamount)) from GENERALJOURNALACCOUNTENTRY g "+
"where isnull(%1,'') <> '' and exists (select * from TRANSACTIONREVERSALTRANS t where t.TRACENUM = %1 and t.REFRECID = g.RECID and t.REFTABLEID = %2) "+
"group by g.LEDGERACCOUNT "+
"order by 1 desc",SysComputedColumn::comparisonField(identifierstr(PAXMizanView), identifierstr(TransactionReversalTrans), identifierstr(TraceNum)),
tableNum(GeneralJournalAccountEntry));
}
Yukarıda görüldüğü gibi AX sorgusu değil de SQL Server sorgusu kullandım metodu eklerken. Metodumuz aşağıdaki gibi bir string değer döndürecek:
select top 1 sign(sum(accountingcurrencyamount)) from GENERALJOURNALACCOUNTENTRY g where isnull(T4.TRACENUM,'') <> '' and exists (select * from TRANSACTIONREVERSALTRANS t where t.TRACENUM = T4.TRACENUM and t.REFRECID = g.RECID and t.REFTABLEID = 3119) group by g.LEDGERACCOUNT order by 1 desc
View'a eklediğimiz kolonun NoYes cinsinde Enum olmasını istiyoruz. O zaman:
Ardından Eklediğimiz View metodu ViewMethod property alanından seçiyoruz.
Eklediğim yeni kolon maalesef view hızını çok yavaşlatan bir kolondu, mümkün oldukça daha basit birşeyler seçmek view hızı açısından önemli.
17 Nisan 2019 Çarşamba
AX 2012 - Source Document Framework hataları
AX 2012 ile bazen sebebini bilmediğim bir şekilde Source Document Framework ile ilgili hatalar alıyoruz. Bu hataların çözümü için full CIL önerenler olmuş, öksüz kayıtları temizleyen bir job önerilmiş (1), Source Document kayıtlarını düzelten başka bir job (2) önerilmiş.
Benim son aldığım hata aşağıdaki gibi:
Debug yaptığımda VendInvoiceInfoLine.SourceDocumentLine alanıyla ilişkili SourceDocumentLine tablosunda bir kayıt varken PurchLine.SourceDocumentLine alanıyla ilişkili kaydın silinmiş olduğunu gördüm. Yukarıda bahsedilen kod parçaları benim durumumda işe yaramadı. İrsaliyesi olan başka bir PurchLine satırına bağlı Source Document kaydını inceledim ve aşağıdaki jobu yazdım. Jobu çalıştırdıktan sonra hatasız bir şekilde deftere nakip yapabildim.
PurchLine purchLine;
SourceDocumentLine line;
SourceDocumentHeader header;
select firstonly forUpdate purchLine
where purchLine.RecId == 5637329927;
ttsBegin;
header.AccountingStatus = SourceDocumentAccountingStatus::InProcess;
header.SourceRelationType = 345;
header.TypeEnumName = "SourceDocument_ProductOrder";
header.TypeEnumValue = 1;
header.insert();
Line.SourceDocumentHeader = header.RecId;
line.AccountingStatus = SourceDocumentLineAccountingStatus::Completed;
Line.SourceRelationType = 340;
Line.TypeEnumName = "SourceDocumentLine_ProductOrder";
Line.TermQuantity = 0;
Line.TypeEnumValue = 1;
Line.insert();
purchLine.SourceDocumentLine = Line.RecId;
purchLine.doUpdate();
ttsCommit;
Benim son aldığım hata aşağıdaki gibi:
Debug yaptığımda VendInvoiceInfoLine.SourceDocumentLine alanıyla ilişkili SourceDocumentLine tablosunda bir kayıt varken PurchLine.SourceDocumentLine alanıyla ilişkili kaydın silinmiş olduğunu gördüm. Yukarıda bahsedilen kod parçaları benim durumumda işe yaramadı. İrsaliyesi olan başka bir PurchLine satırına bağlı Source Document kaydını inceledim ve aşağıdaki jobu yazdım. Jobu çalıştırdıktan sonra hatasız bir şekilde deftere nakip yapabildim.
PurchLine purchLine;
SourceDocumentLine line;
SourceDocumentHeader header;
select firstonly forUpdate purchLine
where purchLine.RecId == 5637329927;
ttsBegin;
header.AccountingStatus = SourceDocumentAccountingStatus::InProcess;
header.SourceRelationType = 345;
header.TypeEnumName = "SourceDocument_ProductOrder";
header.TypeEnumValue = 1;
header.insert();
Line.SourceDocumentHeader = header.RecId;
line.AccountingStatus = SourceDocumentLineAccountingStatus::Completed;
Line.SourceRelationType = 340;
Line.TypeEnumName = "SourceDocumentLine_ProductOrder";
Line.TermQuantity = 0;
Line.TypeEnumValue = 1;
Line.insert();
purchLine.SourceDocumentLine = Line.RecId;
purchLine.doUpdate();
ttsCommit;
TypeEnumName, SourceRelationType gibi fieldların değerleri ilişkili oldukları evrağa göre değişiyor. Siz de kendi durumunuza göre aynen benim yaptığım gibi sağlam bir kaydı inceleyerek kodu adapte edebilirsiniz. Tabii kodu öncelikle test ortamında denemelisiniz ve canlıda oluşturduğunuz kayıtların RecId değerlerini saklamalısınız.
(1) Öksüz kayıtları temizlemek için tavsiye edilen job:
SourceDocumentLine sline;
SysDictTable table;
PurchTable header;
PurchLine purchline;
PurchId purchId = "SA025965";
boolean fix;
Common rec;
int fieldId, found, notfound;
if (purchId)
{
while select purchLine where purchLine.PurchId == purchId
{
while select forUpdate sline where sline.ParentSourceDocumentLine == purchLine.SourceDocumentLine
{
table = new SysDictTable(sline.SourceRelationType);
rec = table.makeRecord();
fieldId = fieldName2id(sline.SourceRelationType, "SourceDocumentLine");
select rec where rec.(fieldId) == sline.RecId;
if (rec.RecId)
{
info(strFmt("Record Match Found %1 %2 %3", table.name(),rec.caption(),sline.RecId));
found++;
}
else
{
ttsBegin;
sline.doDelete();
ttsCommit;
info(strFmt("Orphan Found %1", table.name()));
notfound++;
}
}
info(strFmt("Found %1", found));
info(strFmt("Orphans found and deleted %1",notfound));
found = 0;
notfound = 0;
}
}
(2) Forumlarda bulduğumuz Source Document kayıtlarını düzeltmek için tavsiye edilen diğer job, benim kaydımda işe yaramadı:
RecID VendInvoiceRecID = 5637357894;
VendInvoiceInfoTable vendInvoiceInfoTable;
VendInvoiceInfoLine vendInvoiceInfoLine;
SourceDocumentLine SourceDocumentLine;
SourceDocumentHeader SourceDocumentHeader;
PurchParmUpdate PurchParmUpdate;
RandomGenerate rg = RandomGenerate::construct();
vendInvoiceInfoTable = VendInvoiceInfoTable::findRecId(VendInvoiceRecID,true);
if(vendInvoiceInfoTable)
{
ttsBegin;
while select forupdate SourceDocumentHeader
where SourceDocumentHeader.SourceRelationType == 1425
&& SourceDocumentHeader.RecId == vendInvoiceInfoTable.SourceDocumentHeader
{
SourceDocumentHeader.delete();
}
while select forupdate VendInvoiceInfoLine
where VendInvoiceInfoLine.TableRefId == vendInvoiceInfoTable.TableRefId
&& VendInvoiceInfoLine.ParmId == vendInvoiceInfoTable.ParmId
{
delete_from SourceDocumentLine
where SourceDocumentLine.SourceRelationType == 1430
&& SourceDocumentLine.RecId == VendInvoiceInfoLine.SourceDocumentLine ;
// VendInvoiceInfoLine.SourceDocumentLine = 0;
VendInvoiceInfoLine.SourceDocumentLine = rg.randomInt(1000,10000000);
VendInvoiceInfoLine.doUpdate();
}
vendInvoiceInfoTable.selectForUpdate(true);
vendInvoiceInfoTable.SourceDocumentHeader = 0;
vendInvoiceInfoTable.SourceDocumentLine = 0;
vendInvoiceInfoTable.doUpdate();
ttsCommit;
ttsBegin;
SourceDocumentProcessorFacade::submitSourceDocumentImplementation(vendInvoiceInfoTable,1);
SourceDocumentProcessorFacade::submitSourceDocumentLineImplementation(vendInvoiceInfoTable,1);
while select forupdate VendInvoiceInfoLine
where VendInvoiceInfoLine.TableRefId == vendInvoiceInfoTable.TableRefId
&& VendInvoiceInfoLine.ParmId == vendInvoiceInfoTable.ParmId
{
SourceDocumentProcessorFacade::submitSourceDocumentLineImplementation(VendInvoiceInfoLine,1);
}
ttsCommit;
info("ok");
}
13 Şubat 2019 Çarşamba
AX 2012 ve Power BI
Bu yazımda Power BI öğrenmenin en kolay yolunu anlatıp bazı pürüz çıkaracak noktalar ve Power BI ile AX datası kullanırken dikkat edilmesi gereken noktaları maddeleyeceğim:
-Power BI eğitimi için benim bulduğum en iyi kaynak EDX sitesindeki Analyzing and Visualizing Data with Power BI eğitimiydi. Microsoft tarafından hazırlanan bu eğitim video ile altyazının mükemmel harmanlanmış bir hali. Video akarken yanda da altyazı komple akıyor ve altyazıda bir yere tıkladığınızda video da o bölüme gidiyor (Altyazı Türkçe değil). Arada testlerle devam eden eğitim hiçbir konuyu atlamıyor; Year-to-Day, gateway vs...
-Devreden bakiyeli rapor veya Waterfall rapor oluşturabilmek için tarih tablosuna ihtiyacınız var. Bunun için de ben Power BI İstanbul'da bulduğum bir scripti kullandım:
-Power BI eğitimi için benim bulduğum en iyi kaynak EDX sitesindeki Analyzing and Visualizing Data with Power BI eğitimiydi. Microsoft tarafından hazırlanan bu eğitim video ile altyazının mükemmel harmanlanmış bir hali. Video akarken yanda da altyazı komple akıyor ve altyazıda bir yere tıkladığınızda video da o bölüme gidiyor (Altyazı Türkçe değil). Arada testlerle devam eden eğitim hiçbir konuyu atlamıyor; Year-to-Day, gateway vs...
-Devreden bakiyeli rapor veya Waterfall rapor oluşturabilmek için tarih tablosuna ihtiyacınız var. Bunun için de ben Power BI İstanbul'da bulduğum bir scripti kullandım:
let fnTarihTablosu = (BaşlangıçTarihi as date, BitişTarihi as date, MaliYılBaşlamaAyı as number) as table =>
let
DayCount = Duration.Days(Duration.From(BitişTarihi - BaşlangıçTarihi)) + 1,
Source = List.Dates(BaşlangıçTarihi,DayCount,#duration(1,0,0,0)),
TableFromList = Table.FromList(Source, Splitter.SplitByNothing()),
ChangedType = Table.TransformColumnTypes(TableFromList,{{"Column1", type date}}),
RenamedColumns = Table.RenameColumns(ChangedType,{{"Column1", "Tarih"}}),
YılEkle = Table.AddColumn(RenamedColumns, "Yıl", each Date.Year([Tarih]),type text),
CeyrekEkle = Table.AddColumn(YılEkle, "Çeyrek No", each Date.QuarterOfYear([Tarih])),
AyEkle = Table.AddColumn(CeyrekEkle, "Ay No", each Date.Month([Tarih]), type text),
GünEkle = Table.AddColumn(AyEkle, "Ayın Günü No", each Date.Day([Tarih])),
AyEkleIsim = Table.AddColumn(GünEkle, "Ay", each Date.ToText([Tarih], "MMMM"), type text),
AyEkleKısaIsim = Table.AddColumn(AyEkleIsim, "Ay Kısa", each Date.ToText([Tarih], "MMM"), type text),
HaftanınGünüEkle = Table.AddColumn(AyEkleKısaIsim, "Haftanın Günü No", each Date.DayOfWeek([Tarih])+1),
GünIsmiEkle = Table.AddColumn(HaftanınGünüEkle, "Haftanın Günü", each Date.ToText([Tarih], "dddd"), type text),
HaftaNoEkle= Table.AddColumn(GünIsmiEkle, "Hafta No", each Date.WeekOfYear([Tarih])),
ChangedType1 = Table.TransformColumnTypes(HaftaNoEkle,{{"Hafta No", Int64.Type},{"Yıl", type text},{"Ayın Günü No", Int64.Type}, {"Ay No", Int64.Type}, {"Çeyrek No", Int64.Type}, {"Haftanın Günü No", Int64.Type}}),
KısaYılEkle = Table.AddColumn(ChangedType1, "Yıl Kısa", each Text.End(Text.From([Yıl]), 2), type text),
MaliYıl = Table.AddColumn(KısaYılEkle, "Mali Yıl", each "MY"&(if [Ay No]>=MaliYılBaşlamaAyı then Text.From(Number.From([Yıl Kısa])+1) else [Yıl Kısa]))
in
MaliYıl
in
fnTarihTablosu
-Türkçe'nin klasik sorunu i ve ı sorununu burada da yaşayabilirsiniz. Ben DataAreaId'de bu sorunu yaşadım. Company tablosunda DEIM yazarken diğer tablolarda deim yazıyordu ve bunları eşleştiremiyordu. Ayrıca Adres tabloları birincil adres, geçerliliğini yitirmiş adres, isim tabloları da farklı diller yüzünden çoklamaya sebep olabilir. Bunlar için de ayarlama yapmak gerekiyor:
select c.accountnum,d.name,c.custgroup,l.state,l.COUNTRYREGIONID,lc.SHORTNAME, iif(c.dataareaID = 'deim','DEIM',c.dataareaid) as DATAAREAID
from custtable c left join DIRPARTYTABLE d on c.PARTY = d.RECID
left join DIRPARTYLOCATION dl on d.RECID = dl.PARTY
left join LOGISTICSPOSTALADDRESS l on dl.LOCATION = l.LOCATION
left join LOGISTICSADDRESSCOUNTRYREGIONTRANSLATION lc on lc.COUNTRYREGIONID = l.COUNTRYREGIONID
where
lc.LANGUAGEID = 'EN-AU'
and Dl.ISPRIMARY = 1 and L.VALIDTO IN (select top 1 VALIDTO from LOGISTICSPOSTALADDRESS a
where a.LOCATION = dl.LOCATION order by VALIDTO desc)
Yukarıda ilk işaretli komut parçası Türkçe harf sorununu engellemek için, ikincisi farklı dillerden kaynaklanan çoklamayı engellemek için, üçüncü de tek bir birincil geçerli adresi alabilmek için.
-Dataların düzenli olarak otomatik cloud'a aktarılabilmesi için sürekli açık kalan bir bilgisayara (Tercihen SQL sunucuya) gateway kurmalısınız. Yukarıda bahsettiğim EDX eğitiminde gareway kurulumu konusu da geçiyor.
-Ayrıca raporlarınızı geliştirdikten sonra Phone view kısmına girip mobil dizayn yapmayı da unutmayın. Çok kolay bir işlem olan bu adımı atladığınızda raporlarınız telefonda beklediğiniz etkiyi veremeyecektir.
-Power BI relation kurarken sadece birebir field eşleştirebiliyor. Bunu iki kolonu merge ederek aşabilirsiniz. Eğitimlerde bunun da konusu geçiyor.
-Birçok AX tablosunda aynı key alan farklı DataAreaId'ler için tekrarlanıyor. Bu durum 1:N relationlarda sorun çıkaracaktır. Bunu da yukarıdaki yöntemle aşabilirsiniz. Örneğin CustTable için AccountNum & DataAreaId ve faturaları normalize ettiğiniz tablo için de CustAccount & DataAreaId gibi...
30 Ocak 2019 Çarşamba
AX - 2012 Satınalma sipariş raporunu direk email olarak göndermek
Satınlama sipariş raporunu (PurchPurchaseOrder) direk mail olarak göndermek:
SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract Contract = new PurchPurchaseOrderContract();
SRSPrintDestinationSettings printSettings;
VendPurchOrderJour orderJour;
SrsReportEMailDataContract emailContract = new SrsReportEMailDataContract();
select firstonly orderJour
order by PurchOrderDate Desc,CreatedDateTime Desc
where orderJour.PurchId == "ST000181";
emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
emailContract.parmSubject("Purchase Order");
emailContract.parmTo("test@hotmail.com");
controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));
controller.parmShowDialog(false);
Contract.parmRecordId(orderJour.RecId);
controller.parmReportContract().parmRdpContract(Contract);
printSettings = controller.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::Email);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.parmEMailContract(emailContract);
printSettings.overwriteFile(true);
controller.runReport();
SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract Contract = new PurchPurchaseOrderContract();
SRSPrintDestinationSettings printSettings;
VendPurchOrderJour orderJour;
SrsReportEMailDataContract emailContract = new SrsReportEMailDataContract();
select firstonly orderJour
order by PurchOrderDate Desc,CreatedDateTime Desc
where orderJour.PurchId == "ST000181";
emailContract.parmAttachmentFileFormat(SRSReportFileFormat::PDF);
emailContract.parmSubject("Purchase Order");
emailContract.parmTo("test@hotmail.com");
controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));
controller.parmShowDialog(false);
Contract.parmRecordId(orderJour.RecId);
controller.parmReportContract().parmRdpContract(Contract);
printSettings = controller.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::Email);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.parmEMailContract(emailContract);
printSettings.overwriteFile(true);
controller.runReport();
Yukarıdaki yöntemde sistem AX mail göndericisi yerine Outlook'u kullanmak isteyecektir. Aşağıdaki yöntem alternatif olabilir. Yukarıdaki yöntemin dezavantajı Outlook'u kullanması iken aşağıdakinin de dezavantajı dosyayı öncelikle diskte bir yere yazmanızın gerekmesi:
PurchTable purchTable;
str body;
PurchLine purchLine;
boolean found;
VendPurchOrderJour orderJour;
Filename filename;
SysMailer mailer;
SysEmailParameters parameters;
SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract contract = new PurchPurchaseOrderContract();
SRSPrintDestinationSettings printSettings;
controller.parmReportName(ssrsReportStr(PurchPurchaseOrder,Report));
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
printSettings = controller.parmReportContract().parmPrintSettings();
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.overwriteFile(true);
printSettings.fileName(@filename);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.overwriteFile(true);
printSettings.fileName(@filename);
filename = strFmt(@"%1%2.PDF",WinAPI::getTempPath(),"PO00001");
select firstonly orderJour
order by PurchOrderDate Desc,CreatedDateTime Desc
where orderJour.PurchId == "PO00001"
contract.parmRecordId(orderJour.RecId);
controller.parmReportContract().parmRdpContract(contract);
controller.parmShowDialog(false);
controller.runReport();
infolog.clear();
new InteropPermission(InteropKind::ComInterop).assert();
mailer = new SysMailer();
parameters = SysEmailParameters::find();
if (parameters.SMTPRelayServerName)
{
mailer.SMTPRelayServer(parameters.SMTPRelayServerName,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
else
{
mailer.SMTPRelayServer(parameters.SMTPServerIPAddress,
parameters.SMTPPortNumber,
parameters.SMTPUserName,
SysEmailParameters::password(),
parameters.NTLM);
}
body = '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">';
body += strFmt(@"<br><caption>%1</caption><br><br>","Satınalma sipariş formunuz ektedir.");
mailer.fromAddress("sender@hotmail.com");
mailer.tos().appendAddress("test@hotmail.com");
mailer.htmlBody(body);
mailer.subject(title);
mailer.attachments().add(filename);
mailer.bodyCharSet("Windows-1254");
mailer.sendMail();
24 Ocak 2019 Perşembe
AX 2012 - Kur girişi, hesaplama, kurdan TL tutar hesaplama
Kur hesaplama:
ExchangeRateCurrencyPair pair;
//TCMB : Döviz kur tipi (ExchangeRateType) tablosu Name anahtar alanı
select firstOnly pair
where pair.ExchangeRateType == ExchangeRateType::findByName("TCMB").RecId &&
pair.FromCurrencyCode == "USD" &&
pair.ToCurrencyCode == Ledger::accountingCurrency(CompanyInfo::current());
this.ExchangeRate = ExchangeRate::findByDate(pair.RecId,systemDateGet()).ExchangeRate;
Kur girişi için edit metod ( SalesTable gibi bir çok formda örneği var ):
public edit CurrencyExchangeRate editExchRate(boolean set, CurrencyExchangeRate _exchRate)
{
ExchangeRateHelper exchangeRateHelper = ExchangeRateHelper::newCurrency(Ledger::primaryLedger(CompanyInfo::findDataArea(curext()).RecId), this.Currency);
if (set)
{
this.ExchangeRate = exchangeRateHelper.prepareExchangeRateForStorage(_exchRate);
}
else
{
_exchRate = exchangeRateHelper.displayStoredExchangeRate(this.ExchangeRate);
}
return _exchRate;
}
Girilen kur değerinden TL tutar hesaplama:
ExchangeRateHelper exchangeRateHelper = ExchangeRateHelper::newCurrency(Ledger::primaryLedger(CompanyInfo::findDataArea(curext()).RecId), Ledger::accountingCurrency(CompanyInfo::current()));
CurrencyExchangeHelper cur = CurrencyExchangeHelper::construct();
cur.parmLedgerRecId(Ledger::primaryLedger(CompanyInfo::current()));
cur.parmExchangeDate(today());
//Eğer bugünün kurunu otomatik bulmasını istiyorsanız aşağıdaki iki satırı silin
cur.parmExchangeRate1(exchangeRateHelper.prepareExchangeRateForStorage(1));
cur.parmExchangeRate2(this.ExchangeRate);
this.BudgetAmountMST = cur.calculateTransactionToAccounting(this.Currency,this.BudgetAmount,true);
veya yukarıdaki işlemin kısa hali:
info(strFmt("%1", Currency::curAmount(100,"usd",today(),UnknownNoYes::Yes,500,100)));
info(strFmt("%1", Currency::curAmount2CurAmount(100,"usd","try",today())));
ExchangeRateCurrencyPair pair;
//TCMB : Döviz kur tipi (ExchangeRateType) tablosu Name anahtar alanı
select firstOnly pair
where pair.ExchangeRateType == ExchangeRateType::findByName("TCMB").RecId &&
pair.FromCurrencyCode == "USD" &&
pair.ToCurrencyCode == Ledger::accountingCurrency(CompanyInfo::current());
this.ExchangeRate = ExchangeRate::findByDate(pair.RecId,systemDateGet()).ExchangeRate;
Kur girişi için edit metod ( SalesTable gibi bir çok formda örneği var ):
public edit CurrencyExchangeRate editExchRate(boolean set, CurrencyExchangeRate _exchRate)
{
ExchangeRateHelper exchangeRateHelper = ExchangeRateHelper::newCurrency(Ledger::primaryLedger(CompanyInfo::findDataArea(curext()).RecId), this.Currency);
if (set)
{
this.ExchangeRate = exchangeRateHelper.prepareExchangeRateForStorage(_exchRate);
}
else
{
_exchRate = exchangeRateHelper.displayStoredExchangeRate(this.ExchangeRate);
}
return _exchRate;
}
Girilen kur değerinden TL tutar hesaplama:
ExchangeRateHelper exchangeRateHelper = ExchangeRateHelper::newCurrency(Ledger::primaryLedger(CompanyInfo::findDataArea(curext()).RecId), Ledger::accountingCurrency(CompanyInfo::current()));
CurrencyExchangeHelper cur = CurrencyExchangeHelper::construct();
cur.parmLedgerRecId(Ledger::primaryLedger(CompanyInfo::current()));
cur.parmExchangeDate(today());
//Eğer bugünün kurunu otomatik bulmasını istiyorsanız aşağıdaki iki satırı silin
cur.parmExchangeRate1(exchangeRateHelper.prepareExchangeRateForStorage(1));
cur.parmExchangeRate2(this.ExchangeRate);
this.BudgetAmountMST = cur.calculateTransactionToAccounting(this.Currency,this.BudgetAmount,true);
veya yukarıdaki işlemin kısa hali:
info(strFmt("%1", Currency::curAmount(100,"usd",today(),UnknownNoYes::Yes,500,100)));
info(strFmt("%1", Currency::curAmount2CurAmount(100,"usd","try",today())));
18 Ocak 2019 Cuma
AX 2012 - Test/Dev ortamı/farklı şirketler için arka plan rengini değiştirmek
SysSetupFormRun sınıfının Run metoduna aşağıdakine benzer birşeyler yazabilirsiniz:
this.design().colorScheme(FormColorScheme::RGB);
this.design().backgroundColor(WinAPI::RGB2int(71,216,86));
veya curext() ile bir switch/case yazarak her şirkete ayrı renk verebilirsiniz.
this.design().colorScheme(FormColorScheme::RGB);
this.design().backgroundColor(WinAPI::RGB2int(71,216,86));
veya curext() ile bir switch/case yazarak her şirkete ayrı renk verebilirsiniz.
Kaydol:
Kayıtlar (Atom)