[
SRSReportParameterAttribute(classStr(TradeDocumentReportContract))
]
public class PurchPackingSlipDP extends SrsReportDataProviderPreProcess
{
VendPackingSlipJour vendPackingSlipJour;
VendPackingSlipTrans vendPackingSlipTrans;
VendPackingSlipVersion vendPackingSlipVersion;
PurchPackingSlipTmp purchPackingSlipTmp;
InventDim inventDim;
PurchPackingSlipTmp purchPackingSlipTmpTemplate;
PurchPackingSlipHeaderTmp purchPackingSlipHeaderTmp;
container inventDimSetup;
container inventDimProductSetup;
InventDimCtrl_Rep_Purch inventDimReport;
str quantityLabel;
}
/// <summary>
/// Creates data for the report.
/// </summary>
/// <param name="_contract">
/// An instance of <c>TradeDocumentReportContract</c> report contract class.
/// </param>
public void createData(TradeDocumentReportContract _contract)
{
RecId recId = _contract.parmRecordId();
VendPackingSlipTransHistory vendPackingSlipTransHistory;
Query tradeLoopTransQuery;
QueryRun tradeLoopTrans;
QueryBuildDataSource vendPackingSlipTransHistoryQBDS;
QueryBuildDataSource vendPackingSlipTransQBDS;
QueryBuildDataSource qbds;
boolean insertInventDim;
boolean isVersionArchived;
vendPackingSlipVersion = VendPackingSlipVersion::find(recId);
vendPackingSlipJour = VendPackingSlipJour::findRecId(vendPackingSlipVersion.VendPackingSlipJour);
isVersionArchived = vendPackingSlipVersion.isArchived();
inventDimReport = InventDimCtrl_Rep_Purch::construct();
inventDimReport.parmDocumentStatus(DocumentStatus::PackingSlip);
inventDimReport.initDimParmVisible();
inventDimSetup = inventDimReport.dimFieldsActive(inventDimReport.parmDimParmVisible());
inventDimReport.initProductDimParmVisible();
inventDimProductSetup = inventDimReport.dimFieldsActive(inventDimReport.parmDimParmVisible());
//Set header Buffer;
this.setPurchPackingSlipHeaderTmp();
quantityLabel = SysLabel::labelId2String(literalStr("@SYS321794"), vendPackingSlipJour.LanguageId);
tradeLoopTransQuery = new TradeLoopTrans(vendPackingSlipJour, tableNum(VendPackingSlipTrans)).buildQuery();
vendPackingSlipTransQBDS = tradeLoopTransQuery.dataSourceTable(tableNum(VendPackingSlipTrans));
if (isVersionArchived)
{
tradeLoopTransQuery.validTimeStateAsOfDateTime(vendPackingSlipVersion.VersionDateTime);
vendPackingSlipTransHistoryQBDS = vendPackingSlipTransQBDS.addDataSource(tableNum(VendPackingSlipTransHistory));
vendPackingSlipTransHistoryQBDS.relations(true);
vendPackingSlipTransHistoryQBDS.joinMode(JoinMode::InnerJoin);
vendPackingSlipTransHistoryQBDS.fetchMode(QueryFetchMode::One2One);
}
if (inventDimReport.isInventDimLine() || inventDimReport.isInventDimItemId())
{
qbds = vendPackingSlipTransQBDS.addDataSource(tableNum(InventDim));
qbds.joinMode(JoinMode::OuterJoin);
qbds.fetchMode(QueryFetchMode::One2One);
qbds.addLink(fieldNum(VendPackingSlipTrans ,InventDimId), fieldNum(InventDim ,InventDimId));
insertInventDim = true;
}
tradeLoopTrans = new QueryRun(tradeLoopTransQuery);
while (tradeLoopTrans.next())
{
vendPackingSlipTrans = tradeLoopTrans.get(tableNum(VendPackingSlipTrans));
if (isVersionArchived)
{
vendPackingSlipTransHistory = tradeLoopTrans.get(tableNum(VendPackingSlipTransHistory));
vendPackingSlipTrans.initFromVendPackingSlipTransHistory(vendPackingSlipTransHistory);
}
if ( insertInventDim )
{
inventDim = tradeLoopTrans.get(tableNum(InventDim));
}
this.setPurchPackingSlipDetailsTmp();
}
}
/// <summary>
/// Gets the <c>ItemId</c> value in the <c>ExternalItemId</c> field.
/// </summary>
/// <returns>
/// The <c>ItemId</c> value in the <c>ExternalItemId</c> field.
/// </returns>
private ExternalItemId externalItemNum()
{
switch(VendFormletterParameters::find().ItemNum)
{
case OurYourBoth::Our : return '';
case OurYourBoth::Your : return '';
case OurYourBoth::Both : return vendPackingSlipTrans.ExternalItemId;
}
return '';
}
/// <summary>
/// Gets the full data from the <c>PurchPackingSlipHeaderTmp</c> temp table.
/// </summary>
/// <returns>
/// The <c>PurchPackingSlipHeaderTmp</c> temporary table.
/// </returns>
[
SRSReportDataSetAttribute(tableStr(PurchPackingSlipHeaderTmp))
]
public PurchPackingSlipHeaderTmp getPurchPackingSlipHeaderTmp()
{
select purchPackingSlipHeaderTmp;
return purchPackingSlipHeaderTmp;
}
/// <summary>
/// Gets the full data from the <c>PurchPackingSlipTmp</c> temporary table.
/// </summary>
/// <returns>
/// The <c>PurchPackingSlipTmp</c> temporary table.
/// </returns>
[
SRSReportDataSetAttribute(tableStr(PurchPackingSlipTmp))
]
public PurchPackingSlipTmp getPurchPackingSlipTmp()
{
select purchPackingSlipTmp;
return purchPackingSlipTmp;
}
/// <summary>
/// Gets the Item ID.
/// </summary>
/// <returns>
/// The Item ID.
/// </returns>
private ItemId itemId()
{
ItemId itemId;
switch(VendFormletterParameters::find().ItemNum)
{
case OurYourBoth::Our : itemId = vendPackingSlipTrans.ItemId; break;
case OurYourBoth::Your : itemId = vendPackingSlipTrans.ExternalItemId; break;
case OurYourBoth::Both : itemId = vendPackingSlipTrans.ItemId; break;
}
if (inventDimReport.isInventDimItemId())
{
itemId += inventDimReport.reportStrItemId(inventDim);
}
return itemId;
}
private void mod3SetBatchWithMaster(VendPackingSlipJour _vendPackingSlipJour,
VendPackingSlipTrans _vendPackingSlipTrans,
VendPackingSlipVersion _vendPackingSlipVersion)
{
InventReportDimHistory inventReportDimHistory;
InventBatch inventBatch;
InventTrans inventtrans;
InventTransOrigin inventTransOrigin;
purchPackingSlipTmp.mod3TotVendInvQty = 0;
/*while select sum(Qty),InventTransId from inventReportDimHistory
join inventdim
join Mod3MasterinventBatchId,InventBatchId from inventBatch
group by inventbatch.Mod3MasterinventBatchId
where inventbatch.inventBatchId == inventdim.inventBatchId
&& inventdim.inventDimId == inventReportDimHistory.InventDimId
&& inventReportDimHistory.TransactionLogType == InventReportDimHistoryLogType::PurchPackingSlip
&& inventReportDimHistory.InventTransId == _vendPackingSlipTrans.InventTransId
&& inventReportDimHistory.TransRefId == _vendPackingSlipVersion.InternalPackingSlipId
{
purchPackingSlipTmp.mod3isBatchRegister = NoYes::Yes;
select RecID from InventTransOrigin where InventTransOrigin.InventTransId == inventReportDimHistory.InventTransId;
select mod3NoOfPacks,mod3VendInvQty from inventtrans where inventtrans.InventTransOrigin == InventTransOrigin.RecId
&& inventtrans.inventDimId == inventReportDimHistory.InventDimId;
if(inventbatch.Mod3MasterinventBatchId != "")
{
purchPackingSlipTmp.mod3NoofPacks += strFmt("\n%1",inventtrans.mod3NoOfPacks);
purchPackingSlipTmp.mod3VendInvQty += strFmt("\n%1",inventtrans.mod3VendInvQty);
purchPackingSlipTmp.mod3BatchQty += strFmt("\n%1",inventReportDimHistory.Qty);
purchPackingSlipTmp.mod3BatchNo += "ControlNo";//strFmt("\n%1",inventbatch.Mod3MasterinventBatchId);
purchPackingSlipTmp.mod3MgfrDate += strFmt("\n%1",date2str(InventBatch::findMasterBatch(inventbatch.Mod3MasterinventBatchId).prodDate,123,2,3,2,3,4));
purchPackingSlipTmp.mod3ExpiryDate +=strFmt("\n%1",date2str(InventBatch::findMasterBatch(inventbatch.Mod3MasterinventBatchId).expDate,123,2,3,2,3,4));
purchPackingSlipTmp.mod3RetestDate +=strFmt("\n%1",date2str(InventBatch::findMasterBatch(inventbatch.Mod3MasterinventBatchId).mod2RetestDate,123,2,3,2,3,4));
purchPackingSlipTmp.mod3ControlNo = strFmt("\n%1",inventbatch.Mod3MasterinventBatchId);
purchPackingSlipTmp.mod3TotVendInvQty += inventtrans.mod3VendInvQty;
}
}
*/
while select inventReportDimHistory
where inventReportDimHistory.TransactionLogType == InventReportDimHistoryLogType::PurchPackingSlip
&& inventReportDimHistory.InventTransId == _vendPackingSlipTrans.InventTransId
&& inventReportDimHistory.TransRefId == _vendPackingSlipVersion.InternalPackingSlipId
{
purchPackingSlipTmp.mod3isBatchRegister = NoYes::Yes;
select RecID from InventTransOrigin where InventTransOrigin.InventTransId == inventReportDimHistory.InventTransId;
select mod3NoOfPacks,mod3VendInvQty from inventtrans where inventtrans.InventTransOrigin == InventTransOrigin.RecId
&& inventtrans.inventDimId == inventReportDimHistory.InventDimId;
//if(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).Mod3MasterinventBatchId == "")
{
purchPackingSlipTmp.mod3NoofPacks += strFmt("\n%1",inventtrans.mod3NoOfPacks);
purchPackingSlipTmp.mod3VendInvQty += strFmt("\n%1",inventtrans.mod3VendInvQty);
purchPackingSlipTmp.mod3BatchQty += strFmt("\n%1",inventReportDimHistory.Qty);
if(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).PdsVendBatchId)
purchPackingSlipTmp.mod3BatchNo += strFmt("\n%1",InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).PdsVendBatchId);
else
purchPackingSlipTmp.mod3BatchNo += strFmt("\nN/A");
if(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).prodDate)
purchPackingSlipTmp.mod3MgfrDate += strFmt("\n%1",date2str(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).prodDate,123,2,3,2,3,4));
else
purchPackingSlipTmp.mod3MgfrDate += strFmt("\nN/A");
if(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).expDate)
purchPackingSlipTmp.mod3ExpiryDate +=strFmt("\n%1",date2str(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).expDate,123,2,3,2,3,4));
else
purchPackingSlipTmp.mod3ExpiryDate += strFmt("\nN/A");
if(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).mod2RetestDate)
purchPackingSlipTmp.mod3RetestDate +=strFmt("\n%1",date2str(InventBatch::find(inventReportDimHistory.inventDim().InventBatchId,_vendPackingSlipTrans.ItemId).mod2RetestDate,123,2,3,2,3,4));
else
purchPackingSlipTmp.mod3RetestDate += strFmt("\nN/A");
if(inventReportDimHistory.inventDim().inventBatchId)
purchPackingSlipTmp.mod3ControlNo += strFmt("\n%1",inventReportDimHistory.inventDim().inventBatchId);
else
purchPackingSlipTmp.mod3ControlNo += strFmt("\nN/A");
purchPackingSlipTmp.mod3TotVendInvQty += inventtrans.mod3VendInvQty;
}
}
}
/// <summary>
/// Calculates the Invent Quantity and Invent Storage Dimensions.
/// </summary>
/// <returns>
/// The string with the inventory dimensions.
/// </returns>
/// <remarks>
/// This method is called for each of the transactions.
/// </remarks>
private str printInventTrans()
{
InventQty qtyRemain = vendPackingSlipTrans.InventQty;
InventQty qtyTrans;
InventTransOrigin localInventTransOrigin;
InventTrans inventTrans;
InventDim localInventDim;
InventReportDimHistory inventReportDimHistory;
str dimHistoryStr;
void inventDimPrint()
{
InventQty purchQty;
str inventDimString;
#xppTexts
if (inventReportDimHistory.Qty && localInventDim)
{
inventDimString = FormLetter::inventDimReport(localInventDim, inventDimSetup, vendPackingSlipJour.LanguageId);
if (inventDimString)
{
if (vendPackingSlipTrans.StockedProduct)
{
purchQty = UnitOfMeasureConverter::convert(
inventReportDimHistory.Qty,
UnitOfMeasure::unitOfMeasureIdBySymbol(InventTable::find(vendPackingSlipTrans.ItemId).inventUnitId()),
UnitOfMeasure::unitOfMeasureIdBySymbol(vendPackingSlipTrans.PurchUnit), NoYes::Yes,
InventTable::itemProduct(vendPackingSlipTrans.ItemId));
}
else
{
purchQty = inventReportDimHistory.Qty;
}
if (dimHistoryStr)
{
dimHistoryStr += #newline;
}
dimHistoryStr += strFmt(quantityLabel, strFmtByLanguage(vendPackingSlipJour.LanguageId, '{0:N2}', purchQty), inventDimString);
}
}
}
if (vendPackingSlipJour.isProforma())
{
if (vendPackingSlipTrans.StockedProduct)
{
if (qtyRemain)
{
while select inventTrans
order by StatusReceipt, InventDimId
where (inventTrans.StatusReceipt == StatusReceipt::Ordered
|| inventTrans.StatusReceipt == StatusReceipt::Arrived
|| inventTrans.StatusReceipt == StatusReceipt::Registered)
&& inventTrans.StatusIssue == StatusIssue::None
join localInventDim
where localInventDim.InventDimId == inventTrans.InventDimId
exists join localInventTransOrigin
where localInventTransOrigin.InventTransId == vendPackingSlipTrans.InventTransId
&& inventTrans.InventTransOrigin == localInventTransOrigin.RecId
{
if (qtyRemain)
{
if (abs(inventTrans.Qty) > qtyRemain)
{
qtyTrans = qtyRemain;
qtyRemain = 0;
}
else
{
qtyTrans = inventTrans.Qty;
qtyRemain -= abs(qtyTrans);
}
inventReportDimHistory.Qty = qtyTrans;
inventDimPrint();
}
else
{
break;
}
}
}
}
else
{
localInventDim = inventDim;
inventReportDimHistory.Qty = vendPackingSlipTrans.Qty;
inventDimPrint();
}
}
else
{
while select inventReportDimHistory
where inventReportDimHistory.InventTransId == vendPackingSlipTrans.InventTransId &&
inventReportDimHistory.TransRefId == vendPackingSlipVersion.InternalPackingSlipId &&
inventReportDimHistory.TransactionLogType == InventReportDimHistoryLogType::PurchPackingSlip
join localInventDim
where localInventDim.InventDimId == inventReportDimHistory.InventDimId
{
inventDimPrint();
}
}
return dimHistoryStr;
}
/// <summary>
/// Processes the report business logic. Calls helper methods and inserts data to temporary table.
/// </summary>
/// <remarks>
/// Provides the ability to write the report business logic. This method will be called by
/// SSRS at runtime. The method should compute data and populate the data tables that will be
/// returned to SSRS.
/// </remarks>
[SysEntryPointAttribute(false)]
public void processReport()
{
TradeDocumentReportContract objContract = this.parmDataContract() as TradeDocumentReportContract;
RecId recId = objContract.parmRecordId();
PurchPackingSlipHeaderTmp localPurchPackingSlipHeaderTmp;
PurchPackingSlipTmp localPurchPackingSlipTmp;
RecordSortedList recordList;
localPurchPackingSlipHeaderTmp = PurchPackingSlipHeaderTmp::findJourRecId(recId);
if (localPurchPackingSlipHeaderTmp.RecId)
{ //the report data is already created so use it. this is the proforma scenario.
recordList = new RecordSortedList(tableNum(PurchPackingSlipHeaderTmp));
recordList.sortOrder(fieldNum(PurchPackingSlipHeaderTmp, RecId));
recordList.ins(localPurchPackingSlipHeaderTmp);
localPurchPackingSlipHeaderTmp.delete(); //the created data is copied so it should be deleted.
recordList.insertDatabase(this.parmUserConnection()); //it is inserted within user user connection so the framework will delete it automatically after the report is done.
recordList = new RecordSortedList(tableNum(PurchPackingSlipTmp));
recordList.sortOrder(fieldNum(PurchPackingSlipTmp, RecId));
while select localPurchPackingSlipTmp
where localPurchPackingSlipTmp.JournalRecId == recId
{
recordList.ins(localPurchPackingSlipTmp);
}
delete_from localPurchPackingSlipTmp //the created data is copied so it should be deleted.
where localPurchPackingSlipTmp.JournalRecId == recId;
recordList.insertDatabase(this.parmUserConnection()); //it is inserted within user user connection so the framework will delete it automatically after the report is done.
}
else
{
// Set the userconnection to use on table.
// This is required to ensure that createdTransactionId of inserted record is different than default transaction.
purchPackingSlipHeaderTmp.setConnection(this.parmUserConnection());
purchPackingSlipTmp.setConnection(this.parmUserConnection());
this.createData(objContract);
}
}
/// <summary>
/// Sets PDS fields when the configuration key is enabled.
/// </summary>
/// <remarks>
/// Concatenates the field values along with labels to show as a seperate
/// line in the report.
/// </remarks>
private void setPDSFields()
{
if (purchPackingSlipHeaderTmp.PdsEnabled)
{
purchPackingSlipTmp.PdsCWQty = vendPackingSlipTrans.PdsCWQty;
purchPackingSlipTmp.PdsCWUnitId = vendPackingSlipTrans.pdsCWUnitId();
if (isLanguageRTL(vendPackingSlipJour.LanguageId))
{
// Flip the order of labels and values.
if (purchPackingSlipTmp.PdsCWQty)
{
purchPackingSlipTmp.PdsCWStr = ' ' + strFmt("@SYS191501", "@PDS01", purchPackingSlipTmp.PdsCWQty);
}
if (purchPackingSlipTmp.PdsCWUnitId)
{
purchPackingSlipTmp.PdsCWStr = strFmt("@SYS191501", "@PDS03", purchPackingSlipTmp.PdsCWUnitId) + purchPackingSlipTmp.PdsCWStr;
}
}
else
{
if (purchPackingSlipTmp.PdsCWQty)
{
purchPackingSlipTmp.PdsCWStr = strFmt("@SYS191501", "@PDS01", purchPackingSlipTmp.PdsCWQty) + ' ';
}
if (purchPackingSlipTmp.PdsCWUnitId)
{
purchPackingSlipTmp.PdsCWStr += strFmt("@SYS191501", "@PDS03", purchPackingSlipTmp.PdsCWUnitId);
}
}
}
}
/// <summary>
/// Fills the <c>PurchPackingSlipDetailsTmp</c> table with details.
/// </summary>
private void setPurchPackingSlipDetailsTmp()
{
purchPackingSlipTmp.JournalRecId = vendPackingSlipJour.RecId;
purchPackingSlipTmp.ItemId = this.itemId();
purchPackingSlipTmp.Name = vendPackingSlipTrans.Name;
purchPackingSlipTmp.Ordered = vendPackingSlipTrans.Ordered;
purchPackingSlipTmp.PurchUnitTxt = vendPackingSlipTrans.purchUnitTxt();
purchPackingSlipTmp.Qty = vendPackingSlipTrans.Qty;
purchPackingSlipTmp.Remain = vendPackingSlipTrans.Remain;
this.setPDSFields();
if (inventDim)
{
purchPackingSlipTmp.InventDimProduct = FormLetter::inventDimReport(inventDim, inventDimProductSetup, vendPackingSlipJour.LanguageId);
}
purchPackingSlipTmp.InventDimPrint = this.printInventTrans();
purchPackingSlipTmp.ExternalItemNum = this.externalItemNum();
//Below lines added by azeem PIT to show more information on Product Receipt report
purchPackingSlipTmp.mod3PODate = vendPackingSlipJour.purchTable().createDate();
purchPackingSlipTmp.mod3InvDate = vendPackingSlipJour.mod3InvDate;
purchPackingSlipTmp.mod3GrnNo = vendPackingSlipJour.mod3GRNno;
purchPackingSlipTmp.mod3GrnDate = vendPackingSlipJour.DeliveryDate;
purchPackingSlipTmp.mod3ReceiptDate = vendPackingSlipJour.mod3ReceiptDate;
purchPackingSlipTmp.mod3Remarks = vendPackingSlipJour.mod3Remarks;
purchPackingSlipTmp.mod3Manufacturer = vendPackingSlipTrans.mod3Manufacturer;
purchPackingSlipTmp.mod3BatchNo = "Mfg. Batch No.";
purchPackingSlipTmp.mod3NoofPacks = "No. of Packs";
purchPackingSlipTmp.mod3VendInvQty = "Inv. Qty.";
purchPackingSlipTmp.mod3BatchQty = "Received Qty.";
purchPackingSlipTmp.mod3MgfrDate = "Mfg. Date";
purchPackingSlipTmp.mod3ExpiryDate = "Exp. Date";
purchPackingSlipTmp.mod3RetestDate = "Retest Date";
purchPackingSlipTmp.mod3ControlNo = "Control No.";
this.mod3SetBatchWithMaster(vendPackingSlipJour,vendPackingSlipTrans,VendPackingSlipVersion);
//end of lines added by azeem PIT
purchPackingSlipTmp.insert();
}
/// <summary>
/// Fills the <c>PurchPackingSlipHeaderTmp</c> table with header details.
/// </summary>
private void setPurchPackingSlipHeaderTmp()
{
CompanyInfo companyInfo = CompanyInfo::find();
// <GEECZ>
#ISOCountryRegionCodes
LogisticsAddressCountryRegionISOCode isoCountryCode = SysCountryRegionCode::countryInfo();
BankAccountTable bankAccountTable;
VendTable vendTable;
// </GEECZ>
purchPackingSlipHeaderTmp.JournalRecId = vendPackingSlipJour.RecId;
purchPackingSlipHeaderTmp.PdsEnabled = #PdsCatchWeightEnabled;
purchPackingSlipHeaderTmp.CompanyName = companyInfo.name();
purchPackingSlipHeaderTmp.CompanyAddress = companyInfo.postalAddress().Address;
purchPackingSlipHeaderTmp.CompanyPhone = companyInfo.phone();
purchPackingSlipHeaderTmp.CompanyTeleFax = companyInfo.teleFax();
purchPackingSlipHeaderTmp.CompanyGiro = companyInfo.Giro;
purchPackingSlipHeaderTmp.CompanyCoRegNum = companyInfo.CoRegNum;
purchPackingSlipHeaderTmp.CompanyLogo = FormLetter::companyLogo();
if (conLen(purchPackingSlipHeaderTmp.CompanyLogo) == 0)
{
purchPackingSlipHeaderTmp.PrintLogo = NoYes::No;
}
else
{
purchPackingSlipHeaderTmp.PrintLogo = NoYes::Yes;
}
purchPackingSlipHeaderTmp.CompanyEnterpriseNumber = companyInfo.EnterpriseNumber;
purchPackingSlipHeaderTmp.DeliveryName = vendPackingSlipJour.DeliveryName;
purchPackingSlipHeaderTmp.DeliveryAddress = vendPackingSlipJour.deliveryAddress();
purchPackingSlipHeaderTmp.VendName = vendPackingSlipJour.vendName();
purchPackingSlipHeaderTmp.VendAddress = vendPackingSlipJour.vendAddress();
purchPackingSlipHeaderTmp.PackingSlipId = vendPackingSlipJour.PackingSlipId;
purchPackingSlipHeaderTmp.DeliveryDate = vendPackingSlipJour.DeliveryDate;
purchPackingSlipHeaderTmp.PurchId = vendPackingSlipJour.PurchId;
purchPackingSlipHeaderTmp.InternalInvoiceId = vendPackingSlipVersion.InternalPackingSlipId;
purchPackingSlipHeaderTmp.ReqAttention = vendPackingSlipJour.ReqAttention;
purchPackingSlipHeaderTmp.ShowCompanyVATNum = VendFormletterParameters::find().PrintPurchPackingSlipVATNum;
purchPackingSlipHeaderTmp.CompanyVATNum = TaxRegistration::getCompanyTaxRegNum_W(vendPackingSlipJour.DeliveryDate);
// <GEECZ>
if (isoCountryCode == #isoCZ)
{
purchPackingSlipHeaderTmp.CompanyRegNum = companyInfo.RegNum;
purchPackingSlipHeaderTmp.CompanyEmail = companyInfo.email();
purchPackingSlipHeaderTmp.CompanyCommercialRegister = companyInfo.CommercialRegister;
purchPackingSlipHeaderTmp.CompanyCommercialRegisterInsetNumber = companyInfo.CommercialRegisterInsetNumber;
purchPackingSlipHeaderTmp.CompanyCommercialRegisterSection = companyInfo.CommercialRegisterSection;
bankAccountTable = BankAccountTable::find(companyInfo.Bank);
purchPackingSlipHeaderTmp.CompanyBankAccountName = bankAccountTable.Name;
purchPackingSlipHeaderTmp.CompanyBankAccountNum = bankAccountTable.AccountNum;
purchPackingSlipHeaderTmp.CompanyBankAccountRegNum = bankAccountTable.RegistrationNum;
vendTable = vendPackingSlipJour.vendTable_OrderAccount();
purchPackingSlipHeaderTmp.VendRegNum = vendTable.RegNum_W;
purchPackingSlipHeaderTmp.VendVATNum = vendTable.vatNum;
}
// </GEECZ>
purchPackingSlipHeaderTmp.insert();
}
Best Regards,
Shabir Ahmad