Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9d598d5

Browse files
committed
Check if AST is enabled
1 parent 50de2c9 commit 9d598d5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CRUD_Examples/ASTExample/InvoiceCreateWithAST.php

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
));
1818
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
1919
$dataService->throwExceptionOnError(true);
20+
21+
$isASTEnabled = $dataService->getCompanyPreferences()->TaxPrefs->PartnerTaxEnabled;
22+
if(!$isASTEnabled) throw new Exception("AST is not enabled");
2023
//Add a new Invoice
2124
//In order for AST to work, the TxnTaxDetail.TxnTaxCodeRef has to be provided. However, the value does not matter once AST is enabled.
2225
$theResourceObj = Invoice::create([

CRUD_Examples/ASTExample/InvoiceUpdateWithAST.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
//find the invoice we just created
2121
$invoice = $dataService->FindbyId('invoice', 9);
2222

23-
//Also, make sure the Sales Deposit is turned on in the settings page, and the AST is enabled.
23+
$isASTEnabled = $dataService->getCompanyPreferences()->TaxPrefs->PartnerTaxEnabled;
24+
if(!$isASTEnabled) throw new Exception("AST is not enabled");
25+
//Also, make sure the Sales Deposit is turned on in the settings page, and the AST is enabled.
2426
//we are going to override the tax. Again, the TxnTaxDetail.TxnTaxCodeRef is just a placeholder. It is required. You can use the same value as it is, or some random value.
2527
//The only value that matters is the TotalTax here
2628
$theResourceObj = Invoice::update($invoice, [

0 commit comments

Comments
 (0)