因此,我的公司已经委托我创建一个批处理作业,该作业将打印出当天已发布装箱单的所有销售订单的Proforma销售发票,但尚未发布发票。他们要求这样做是因为他们希望在实际发布之前通过PDF文件审核发票。最有可能的是,他们可以在一个流程中发布所有已批准的发票。
到目前为止,所有关于如何创建此批处理报告的示例(我可以通过Google搜索找到)都使用销售订单的custInvoiceJour条目来生成SalesInvoice报表,但是,因为发票实际上没有已发布,在这种情况下没有相应的CustInvoiceJour条目
如果没有发布(ProForma),我将如何创建SalesInvoice,因为尚未创建这些日记帐分录?我知道这可以做到,因为你可以通过用户界面完成。
以下是我到目前为止批处理作业的run方法的代码,当它运行时,它错误地指出无法找到custInvoiceJour条目。
Sub MaskDuplicateTests(pickedTest As String)
Dim patID As Long
patID = Cells.Find(What:="Patient ID", LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Column
Dim TestName As Long
TestName = Cells.Find(What:="Test Name", LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Column
Dim TestNameCon As Long
TestNameCon = Cells.Find(What:="Test Name Condensed", LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Column
Dim x As Long
Dim y As Long
Dim firstTest As String
Dim secondTest As String
x = 2
y = 2
Do While Sheets(pickedTest).Cells(y, 1).Value <> ""
If LCase(Trim(Sheets(pickedTest).Cells(y, 1).Text)) = firstTest Then
If LCase(Trim(Sheets(pickedTest).Cells(y, 2).Text)) = secondTest Then
TestNameCon = LCase(Trim(Sheets(pickedTest).Cells(y, 3).Text))
Sheets("Tests").Rows(x + 1).Delete
x = x - 1
End If
End If
Exit Do
y = y + 1
loop
End If
x = x + 1
End Sub
}
答案 0 :(得分:0)
您可以使用以下代码将形式表保存到文件
public void run()
{
SalesTable salesTable;
PrintJobSettings printJobSettings;
SalesFormLetter salesFormLetter;
;
select firstOnly salesTable
where salesTable.DocumentStatus == DocumentStatus::PackingSlip
&& salesTable.SalesStatus == SalesStatus::Delivered;
printJobSettings = new PrintJobSettings();
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.format(PrintFormat::PDF);
printJobSettings.fileName(@'C:\Temp\proforma_invoice.pdf');
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());
salesFormLetter.update(salesTable,
systemDateGet(),
SalesUpdate::PackingSlip,
AccountOrder::None,
NoYes::Yes,
NoYes::Yes);
}