netsuite中的供应商账单和BillPayment交易

时间:2017-08-17 13:35:06

标签: netsuite

我试图通过SS2.0找出NetSuite中供应商账单和BillPayment记录的关系。我的要求是找到所有支付账单。我可以理解这是使用事务表/记录完成的。

如何将这两者联系起来?我正在尝试搜索我的记录。但它既有记录支付也有账单。

    var transactionSearchObj = search.create({
    type: "transaction",
    filters: [
       ["name","anyof","375"], 
       "AND", 
       ["trandate","within","8/9/2017","8/13/2017"], 
       "AND", 
       ["creditamount","isnotempty",""]
    ],
    columns: [
       search.createColumn({
          name: "trandate",
          sort: search.Sort.ASC
       }),
       "type",
       "tranid",
       "entity",
       "account",
       "statusref",
       "creditamount",
       "total",
       "externalrefnumber",
       "otherrefnum",
       search.createColumn({
          name: "originator",
          join: "billingTransaction"
       }),
       "applyingtransaction",
       "appliedtotransaction",
       "internalid",
       "externalrefnumber",
       "externalid",
       search.createColumn({
          name: "appliedtotransaction",
          join: "applyingTransaction"
       }),
       search.createColumn({
          name: "appliedtotransaction",
          join: "appliedToTransaction"
       }),
       search.createColumn({
          name: "transactionnumber",
          join: "billingTransaction"
       })
    ]
 });

欢迎任何建议......

1 个答案:

答案 0 :(得分:1)

如果您知道供应商帐单内部ID,则可以使用这些搜索条件获取该供应商帐单的所有相关帐单付款的列表。请注意,此搜索专门提取了帐单支付记录,因此如果您需要供应商帐单本身的其他数据,则需要使用appliedtotransaction记录连接。请参阅搜索中的列以便更好地理解。

function vendorPayments(billId) {
    var vendorpaymentSearchObj = search.create({
        type: "vendorpayment",
        filters: [
           ["type","anyof","VendPymt"], 
           "AND", 
           ["appliedtotransaction.internalid","anyof",billId.toString()]
        ],
        columns: [
           "entity",
           "tranid",
           "appliedtolinkamount",
           "appliedtotransaction",
           search.createColumn({
              name: "entity",
              join: "appliedToTransaction"
           }),
           search.createColumn({
              name: "memomain",
              join: "appliedToTransaction"
           }),
           search.createColumn({
              name: "approvalstatus",
              join: "appliedToTransaction"
           })
        ]
    });
    return vendorpaymentSearchObj;
}