/// <param name=/sender/></param>
/// <param name=/e/></param>
[FormDataSourceEventHandler(formDataSourceStr(LogisticsPostalAddress, TaxRegistration), FormDataSourceEventType::Written)]
public static void TaxRegistration_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
{
TaxRegistration taxRegistration;
TaxRegistrationType taxRegistrationType;
CustTable custTable;
DirPartyTable dirpartytable;
DirPartyLocation dirpartylocation;
FormRun formRun = sender.formRun();
FormDataSource taxRegistration_ds = formRun.dataSource(formDataSourceStr(LogisticsPostalAddress, TaxRegistration));
TaxRegistration _taxregistration = taxregistration_ds.cursor();
//TaxRegistration _taxregistration = sender.dataSource(/taxRegistration_ds/).cursor();
TaxRegistration tax;
// str reg=_taxregistration.orig().RegistrationNumber;
//_taxregistration tax=_taxregistration.orig();
SELECT CustTable JOIN DirPartyTable
WHERE CustTable.Party == DirPartyTable.RecId
JOIN DirPartyLocation
WHERE DirPartyLocation.Party == DirPartyTable.RecId
JOIN tax
WHERE tax.DirPartyLocation == DirPartyLocation.RecId
&& tax.RegistrationNumber==_taxregistration.RegistrationNumber;
//&& tax.RegistrationNumber==reg;
//CustTable custtable;
select forUpdate custTable;
if(CustTable)
{
ttsbegin;
//custTable.XTSVATNum = taxregistration::find(custTable.party).RegistrationNumber;
custTable.XTSVATNum = taxregistration.RegistrationNumber;
custTable.update();
// custTable.XTSVATNum = taxregistration.RegistrationNumber;
ttscommit;
}
}