我目前正在从事一个个人项目,该项目由一个网站组成,该网站在表格中显示发票信息,该表格是从 Firebase 中提取的。我正在使用 JavaScript 来显示表格中的数据。
这就是我填充我的表的方式:
function getInvoices(){
var docRef = db.collection("invoices");
docRef.get().then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
html = createInvoiceRow(doc.data(),doc.id);
$('.invoiceTable').find('tbody').append(html);
});
jobsDataTable = $('.jobsTable').DataTable({language: { search: "", searchPlaceholder: "Search...", sLengthMenu: "MENU" }, "lengthMenu": [[300], ["300"]]});
});
}
.
function createInvoiceRow(invoice,id)
{
var invoicedate = invoice['value'].toDate();
var getvaluedate = invoicedate.getDate() + '/' + (invoicedate.getMonth()+1) + '/' + invoicedate.getFullYear();
html = '<tr id="invoice'+id+'">';
html += ' <td class="centercheck">'+invoice['jobnumber']+'</td>';
html += ' <td class="centercheck">'+invoice['price']+'</td>';
html += ' <td class="centercheck">'+getvaluedate+'</td>';
html += '</tr>';
return html;
}
这是我苦苦挣扎的地方,我希望能够通过单击我网站上的按钮将所选发票的信息传递到 SAGE 50,例如您如何通过“批量分类帐”添加发票。