I have created table " SalesOrderExim" and "SalesOrderEximLines" , I am trying to insert and update records in this tables but but not able to get this done
can anybody suggest what is wrong with my code so i can get this in process. my code is below.
for salestable Extension,
[ExtensionOf(tableStr(SalesTable))]
final class EximSalesTable_Extension
{
public void insert(boolean _skipMarkup )
{
SalesOrderExim salesOrderExim;
SalesOrderEximLines salesOrderEximLines;
CustInvoiceJour custInvoiceJour;
SalesLine salesline;
TaxInformationLegalEntity_IN taxInformationLegalEntity_IN;
TaxInformation_IN taxInformation_IN;
str IECNUMBER;
next insert(_skipMarkup);
select * from salesOrderExim
where salesOrderExim.RefrenceRecId == this.RecId;
select PANNumber from taxInformationLegalEntity_IN
where taxInformationLegalEntity_IN.LegalEntity == companyInfo::find().RecId;
taxInformation_IN = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocation(companyInfo::find().PrimaryAddressLocation).Location);
IECNUMBER = TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
if(salesOrderExim.RefrenceRecId == this.RecId)
{
ttsbegin;
salesOrderExim.Buyer = this.SalesName;
salesOrderExim.Exporter = companyinfo::find().Name;
salesOrderExim.PANNumber = taxInformationLegalEntity_IN.PANNumber;
salesOrderExim.IECNumber = IECNUMBER;
salesOrderExim.State = companyInfo::find().postalAddress().State;
salesOrderExim.Payment = this.Payment;
salesOrderExim.TermsOfDelivery = this.DlvTerm;
salesOrderExim.InvoiceId = "";
salesOrderExim.FromDate = dateNull();
salesOrderExim.insert();
ttscommit;
}
}
public void update()
{
SalesOrderExim salesOrderExim;
SalesOrderEximLines salesOrderEximLines;
CustInvoiceJour custInvoiceJour;
SalesLine salesline;
SalesTable salestable;
TaxInformationLegalEntity_IN taxInformationLegalEntity_IN;
TaxInformation_IN taxInformation_IN;
str IECNUMBER;
next update();
select PANNumber from taxInformationLegalEntity_IN
where taxInformationLegalEntity_IN.LegalEntity == companyInfo::find().RecId;
taxInformation_IN = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocation(companyInfo::find().PrimaryAddressLocation).Location);
IECNUMBER = TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
salesId = this.SalesId;
select * from salestable
where salesTable.SalesId == salesId;
select forupdate salesOrderExim
where salesOrderExim.RefrenceRecId == this.RecId;
if(this.SalesStatus==SalesStatus::Invoiced && salesOrderExim.InvoiceId == "")
{
select InvoiceId,InvoiceDate from custInvoiceJour
where custInvoiceJour.SalesId == this.SalesId;
ttsbegin;
salesOrderExim.InvoiceId = custInvoiceJour.InvoiceId;
salesOrderExim.FromDate = custInvoiceJour.InvoiceDate;
salesOrderExim.Buyer = this.SalesName;
salesOrderExim.Exporter = companyinfo::find().Name;
salesOrderExim.PANNumber = taxInformationLegalEntity_IN.PANNumber;
salesOrderExim.IECNumber = IECNUMBER;
salesOrderExim.State = companyInfo::find().postalAddress().State;
salesOrderExim.Payment = this.Payment;
salesOrderExim.TermsOfDelivery = this.DlvTerm;
salesOrderExim.update();
ttscommit;
}
}
}
for salesline Extension
[ExtensionOf(tableStr(SalesLine))]
final class EximSalesLine_Extension
{
public void insert(boolean _dropInvent ,
boolean _findMarkup ,
Common _childBuffer,
boolean _skipCreditLimitCheck ,
boolean _skipWHSProcesses ,
InventRefTransId _interCompanyInventTransId )
{
SalesOrderEximLines salesOrderEximLines;
SalesTable salesTable;
SalesId salesId;
next insert();
salesId = this.SalesId;
select * from salestable
where salesTable.SalesId == salesId;
select * from salesOrderEximLines
join this
where salesOrderEximLines.RefRecId == this.RecId;
if(salesOrderEximLines.HSNCode == "" )
{
ttsbegin;
salesOrderEximLines.HSNCode = HSNCodeTable_IN::find(InventTable::find(this.ItemId).HSNCodeTable_IN).Code;
salesOrderEximLines.insert();
ttscommit;
}
}
public void update(boolean _dropInvent ,
Common _childBuffer ,
boolean _updateOrderLineOfDeliverySchedule ,
boolean _mcrAutoallocate ,
boolean _cameFromCreate ,
boolean _promptSuppItem
)
{
SalesOrderEximLines salesOrderEximLines;
SalesTable salesTable;
SalesId salesId;
next update();
salesId = this.SalesId;
select * from salestable
where salesTable.SalesId == salesId;
select * from salesOrderEximLines
join this
where salesOrderEximLines.RefRecId == this.RecId;
if(salesOrderEximLines.HSNCode == "" )
{
ttsbegin;
salesOrderEximLines.HSNCode = HSNCodeTable_IN::find(InventTable::find(this.ItemId).HSNCodeTable_IN).Code;
salesOrderEximLines.insert();
ttscommit;
}
}
}