Merhaba
Kısa bir süre önce yaptığım bir raporda kullandığım fetch() metodunu örnek olsun diye paylaşıyorum.
Datasource olarak
TaxReportJournal ve inner join ile bağlı TaxReportJournalLine bulunmakta ayrıca Voucher ve transdate e göre group by alınaktadır.
public boolean fetch()
{
boolean ret;
TaxReportJournalLine TaxReportJournalL,TaxReportJournalL2;
LedgerJournalId CalculationId ;
Voucher voucher;
InvoiceId invoiceId;
VATNum vATNum;
container con;
QueryRun qr;
;
ret = true;
if (element.args().dataset() == tablenum(TaxReportJournalLine))
{
TaxReportJournalLine = element.args().record(); // Raporu birformdan çağırıyoruz ve formda üzerinde olduğumuz kaydı alıyorum
}
element.query().dataSourceNo(1).addRange(fieldnum(TaxReportJournal, CalculationId)).value(sysQuery::value(TaxReportJournalLine.CalculationId)); // aldığımız kaydı range olarak ekliyoruz
qr = new queryrun(element.query());
taxBaseAmount = 0;
taxAmountMST = 0;
totalAmountMST = 0;
while(qr.next())
{
TaxReportJournalL = qr.get(tablenum(TaxReportJournalLine));
select sum(TaxBaseAmount),sum(TaxAmountMST),sum(TotalAmountMST)
from TaxReportJournalL2
where TaxReportJournalL2.Voucher == TaxReportJournalL.Voucher
&& TaxReportJournalL2.InvoiceId == TaxReportJournalL.InvoiceId
&& TaxReportJournalL2.VATNum == TaxReportJournalL.VATNum ;
taxBaseAmount = TaxReportJournalL2.TaxBaseAmount;
taxAmountMST = TaxReportJournalL2.TaxAmountMST;
totalAmountMST = TaxReportJournalL2.TotalAmountMST;
select firstonly eTGTaxReportJournalL2
where TaxReportJournalL2.Voucher == TaxReportJournalL.Voucher
&& TaxReportJournalL2.InvoiceId == TaxReportJournalL.InvoiceId
&& TaxReportJournalL2.VATNum == TaxReportJournalL.VATNum ;
voucher = TaxReportJournalL.Voucher;
invoiceId = TaxReportJournalL.InvoiceId;
vATNum = TaxReportJournalL.VATNum;
element.send(TaxReportJournalL2);
}
return ret;
}
Burda kullanılan bazı tablolar sizde mevcut olmayabilir kendi oluşturduğumuz tabloları kullandığım bir çalışmaydı kod kullanımı açısından örenek teşkil edebileceğini düşündüğüm için paylaşıyorum.
Selamlar
Başlığınız yanlış olmuş Fatch ? fetch olması gerekiyor sanırım. Elinize sağlık yazılarınız başlangıç için çok güzel.
PermalinkEvet yanlış olmuş.
PermalinkTeşekkürler.