class ABC_purchPurchaseOrderHandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(PurchPurchaseOrderHeader), DataEventType::Inserting)]
public static void PurchPurchaseOrderHeader_onInserting(Common sender, DataEventArgs e)
{
PurchPurchaseOrderHeader tmpTable = sender;
VendTable vendTable;
vendTable = VendTable::find(PurchTable::find(tmpTable.PurchId).OrderAccount);
tmpTable.ABC_vendPhone = PurchTable::find(tmpTable.PurchId).vendorPhone();
tmpTable.ABC_vendTeleFax = PurchTable::find(tmpTable.PurchId).vendTable_InvoiceAccount().telefax();
tmpTable.ABC_DlvMode = PurchTable::find(tmpTable.PurchId).DlvMode;
tmpTable.ABC_PayTerms = PurchTable::find(tmpTable.PurchId).Payment;
tmpTable.ABC_SupplierDescription = PurchTable::find(tmpTable.PurchId).vendorName();
tmpTable.ABC_Buyer = HcmWorker::find(PurchTable::find(tmpTable.PurchId).WorkerPurchPlacer).name();
tmpTable.ABC_InvoiceDescription = dirParty::findPostalAddressByRole(vendTable.Party, LogisticsLocationRoleType::Invoice).displayLocationDescription();
tmpTable.ABC_BillingAddress = dirParty::findPostalAddressByRole(vendTable.Party, LogisticsLocationRoleType::Invoice).Address;
tmpTable.ABC_Contact = ABC_purchPurchaseOrderHandler::getContactDeatils(vendTable.Party, LogisticsElectronicAddressMethodType::Email).Description;
tmpTable.ABC_vendPhone = ABC_purchPurchaseOrderHandler::getContactDeatils(vendTable.Party, LogisticsElectronicAddressMethodType::Phone).Locator;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(PurchPurchaseOrderTmp), DataEventType::Inserting)]
public static void PurchPurchaseOrderTmp_onInserting(Common sender, DataEventArgs e)
{
PurchPurchaseOrderTmp tempTable = sender;
VendPurchOrderJour vendPurchOrderJour = VendPurchOrderJour::findRecId(tempTable.JournalRecId);
CustVendExternalItem custVendExternalItem;
select ExternalItemTxt from custVendExternalItem
where custVendExternalItem.ItemId == tempTable.ItemId &&
custVendExternalItem.ExternalItemId == tempTable.ExternalItemNum &&
custVendExternalItem.CustVendRelation == vendPurchOrderJour.purchTable().InvoiceAccount;
tempTable.ABC_ExternalItemName = custVendExternalItem.ExternalItemTxt;
}
/// <summary>
/// Get the party contact details
/// </summary>
/// <param name = "_party"></param>
/// <param name = "_type"></param>
/// <returns></returns>
public static LogisticsElectronicAddress getContactDeatils(RefRecId _party, LogisticsElectronicAddressMethodType _type)
{
LogisticsElectronicAddress logisticsElectronicAddress;
select * from logisticsElectronicAddress
where logisticsElectronicAddress.Location == DirPartyLocation::findOrCreate(_party, 0).Location
&& logisticsElectronicAddress.Type == _type
&& logisticsElectronicAddress.IsPrimary == NoYes::Yes;
return logisticsElectronicAddress;
}
}
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(PurchPurchaseOrderHeader), DataEventType::Inserting)]
public static void PurchPurchaseOrderHeader_onInserting(Common sender, DataEventArgs e)
{
PurchPurchaseOrderHeader tmpTable = sender;
VendTable vendTable;
vendTable = VendTable::find(PurchTable::find(tmpTable.PurchId).OrderAccount);
tmpTable.ABC_vendPhone = PurchTable::find(tmpTable.PurchId).vendorPhone();
tmpTable.ABC_vendTeleFax = PurchTable::find(tmpTable.PurchId).vendTable_InvoiceAccount().telefax();
tmpTable.ABC_DlvMode = PurchTable::find(tmpTable.PurchId).DlvMode;
tmpTable.ABC_PayTerms = PurchTable::find(tmpTable.PurchId).Payment;
tmpTable.ABC_SupplierDescription = PurchTable::find(tmpTable.PurchId).vendorName();
tmpTable.ABC_Buyer = HcmWorker::find(PurchTable::find(tmpTable.PurchId).WorkerPurchPlacer).name();
tmpTable.ABC_InvoiceDescription = dirParty::findPostalAddressByRole(vendTable.Party, LogisticsLocationRoleType::Invoice).displayLocationDescription();
tmpTable.ABC_BillingAddress = dirParty::findPostalAddressByRole(vendTable.Party, LogisticsLocationRoleType::Invoice).Address;
tmpTable.ABC_Contact = ABC_purchPurchaseOrderHandler::getContactDeatils(vendTable.Party, LogisticsElectronicAddressMethodType::Email).Description;
tmpTable.ABC_vendPhone = ABC_purchPurchaseOrderHandler::getContactDeatils(vendTable.Party, LogisticsElectronicAddressMethodType::Phone).Locator;
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[DataEventHandler(tableStr(PurchPurchaseOrderTmp), DataEventType::Inserting)]
public static void PurchPurchaseOrderTmp_onInserting(Common sender, DataEventArgs e)
{
PurchPurchaseOrderTmp tempTable = sender;
VendPurchOrderJour vendPurchOrderJour = VendPurchOrderJour::findRecId(tempTable.JournalRecId);
CustVendExternalItem custVendExternalItem;
select ExternalItemTxt from custVendExternalItem
where custVendExternalItem.ItemId == tempTable.ItemId &&
custVendExternalItem.ExternalItemId == tempTable.ExternalItemNum &&
custVendExternalItem.CustVendRelation == vendPurchOrderJour.purchTable().InvoiceAccount;
tempTable.ABC_ExternalItemName = custVendExternalItem.ExternalItemTxt;
}
/// <summary>
/// Get the party contact details
/// </summary>
/// <param name = "_party"></param>
/// <param name = "_type"></param>
/// <returns></returns>
public static LogisticsElectronicAddress getContactDeatils(RefRecId _party, LogisticsElectronicAddressMethodType _type)
{
LogisticsElectronicAddress logisticsElectronicAddress;
select * from logisticsElectronicAddress
where logisticsElectronicAddress.Location == DirPartyLocation::findOrCreate(_party, 0).Location
&& logisticsElectronicAddress.Type == _type
&& logisticsElectronicAddress.IsPrimary == NoYes::Yes;
return logisticsElectronicAddress;
}
}
No comments:
Post a Comment