class RunnableClass1
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
VendInvoiceInfoTable vendInvoiceInfoTable;
VendInvoiceInfoSubTable vendInvoiceInfoSubTable;
VendInvoiceInfoLine vendInvoiceInfoLine;
VendInvoiceInfoSubLine vendInvoiceInfoSubLine;
PurchParmUpdate purchParmUpdate;
PurchFormletterParmData purchFormletterParmData = PurchFormletterParmData::newData(DocumentStatus::Invoice, VersioningUpdateType::Initial);
PurchFormLetter purchFormLetter;
purchFormletterParmData.init();
purchFormletterParmData.parmOnlyCreateParmUpdate(true);
purchFormletterParmData.createData(false);
purchParmUpdate = purchFormletterParmData.parmParmUpdate();
ttsbegin;
vendInvoiceInfoTable.clear();
vendInvoiceInfoTable.initValue();
vendInvoiceInfoTable.DocumentOrigin = DocumentOrigin::Manual;
vendInvoiceInfoTable.DeliveryName = '';
//vendInvoiceInfoTable.Num = "INV015"; //add invoice number in here
vendInvoiceInfoTable.InvoiceAccount = '1001';
vendInvoiceInfoTable.defaultRow(null, null, true);
vendInvoiceInfoTable.Num = "INV031";
vendInvoiceInfoTable.VendInvoiceSaveStatus = VendInvoiceSaveStatus::Pending;
vendInvoiceInfoTable.DocumentDate = systemDateGet();
vendInvoiceInfoTable.LastMatchVariance = LastMatchVarianceOptions::OK;
vendInvoiceInfoTable.CashDiscDate = systemDateGet() + 10;
vendInvoiceInfoTable.insert();
if(vendInvoiceInfoTable)
{
vendInvoiceInfoSubTable.clear();
vendInvoiceInfoSubTable.initValue();
vendInvoiceInfoSubTable.defaultRow();
vendInvoiceInfoSubTable.ParmId = vendInvoiceInfoTable.ParmId;
vendInvoiceInfoSubTable.OrigPurchId = vendInvoiceInfoTable.PurchId;
vendInvoiceInfoSubTable.PurchName = vendInvoiceInfoTable.PurchName;
vendInvoiceInfoSubTable.TableRefId = vendInvoiceInfoTable.TableRefId;
vendInvoiceInfoSubTable.insert();
}
vendInvoiceInfoLine.clear();
vendInvoiceInfoLine.initValue();
vendInvoiceInfoLine.DeliveryName = vendInvoiceInfoTable.DeliveryName;
vendInvoiceInfoLine.TableRefId = vendInvoiceInfoTable.TableRefId;
vendInvoiceInfoLine.currencyCode = vendInvoiceInfoTable.CurrencyCode;
vendInvoiceInfoLine.LineNum = 1;
InventTable inventTable = InventTable::find("C0001");
vendInvoiceInfoLine.InvoiceAccount = vendInvoiceInfoTable.InvoiceAccount;
vendInvoiceInfoLine.OrderAccount = vendInvoiceInfoTable.OrderAccount;
vendInvoiceInfoLine.ItemId = inventTable.ItemId;
vendInvoiceInfoLine.modifiedField(fieldNum(VendInvoiceInfoLine, ItemId));
vendInvoiceInfoLine.DocumentOrigin = DocumentOrigin::Manual;
vendInvoiceInfoLine.ReceiveNow = 1.2;
vendInvoiceInfoLine.RemainBefore = 1.2;
vendInvoiceInfoLine.RemainBeforeInvent = 1.2;
vendInvoiceInfoLine.PurchPrice = 5.5;
vendInvoiceInfoLine.InventNow = 1.2;
vendInvoiceInfoLine.LineAmount = 6.6;
vendInvoiceInfoLine.insert();
ttscommit;
vendInvoiceInfoTable vendInvoiceInfoTableLoc;
select vendInvoiceInfoTableLoc where vendInvoiceInfoTableLoc.Num == vendInvoiceInfoTable.Num;
purchFormLetter = PurchFormLetter_Invoice::newFromSavedInvoice(vendInvoiceInfoTableLoc);
purchFormLetter.update(vendInvoiceInfoTableLoc.purchTable(), vendInvoiceInfoTableLoc.Num);
}
}
following line cause error in my code:
ReplyDeletepurchFormLetter.update(vendInvoiceInfoTableLoc.purchTable(), vendInvoiceInfoTableLoc.Num);
if we want to create pending invoice without purchase order, why do we call purchTable method? i tried to use null instead of that method, but the result was same.
i fixed it. thx :)
Delete