このような投稿がいくつかあることは知っていますが、私の問題を解決する投稿は見たことがありません。請求書を挿入するために kashflow API を呼び出しています。InvoiceLine タイプのオブジェクトのコレクションを必要とするタイプ「Invoice」のオブジェクトが必要です。
ここを参照してください:
http://www.kashflow.com/developers/soap-api/invoice/
http://www.kashflow.com/developers/soap-api/InvoiceLine/
ここに私が現在使用しているコードがあります。
class Invoice{
public $InvoiceDBID = ''; //TSystem-wide unique number for this invoice (used internally only)
public $InvoiceNumber = ''; //Unique invoice number
public $InvoiceDate = ''; //Invoice date
public $DueDate = ''; //Invoice due date
public $SuppressTotal = ''; //1 to suppress the total (only used on Quotes)
public $ProjectID = ''; //The project ID for this invoice.
public $CurrencyCode = ''; //The currency code to be used for the invoice e.g. USD, GBP, ZAR
public $ExchangeRate = ''; //The exchange rate for the currency used.
public $Paid = 0; //1 for Paid, 0 for Unpaid. Set to 0 on Insert calls
public $CustomerID = ''; //The ID of the customer (or supplier int he case of receipts)
public $CustomerReference = '';
public $EstimateCategory = ''; //The category of the quote (only relevant when with Quotes)
public $NetAmount = 0; //The total net amount of the invoice
public $VatAmount = 0; //The total VAT amount of the invoice
public $AmountPaid = 0; //The sum of all payments made to this invoice
public $Permalink = ''; //A permanent link to access a PDF of the invoice.
public $Lines = ''; //A collection of type InvoiceLine.
}
class InvoiceLine{
public $LineID = ''; //System-wide unique number for this line
public $Quantity = ''; //Quantity invoiced
public $Description = ''; //Description of item invoiced
public $Rate = ''; //Rate per item
public $ChargeType = ''; //For Purchases: Related Nominal ID From GetNominalCodes.
public $ProjID = ''; //The Project to which this line should be assigned. Leave as 0 if in doubt
public $VatAmount = ''; //The VAT amount for this line
public $VatRate = ''; //The VAT rate applied to this line (e.g. 15 for 15%). For Vat Exempt (the n/a code) use -1
public $Sort = ''; //Sort order value
public $ProductID = ''; //An integer value representing the ID of a SubProduct (from GetSubProducts). Set to 0 for “None”
public $ValuesInCurrency = ''; //Set to “1? if the Rate and VATAmount is already in foreign currency
}
$client = new SoapClient("https://securedwebapp.com/api/service.asmx?WSDL");
$invoice_line = new InvoiceLine();
$invoice_line->Quantity = 1;
$invoice_line->Description = 'Delicious Irish Whisky';
$invoice_line->Rate = 20;
$invoice_line->ChargeType = 5614031;
$invoice_line->VatAmount = 4.00;
$invoice_line->VatRate = 20;
$invoice_line->ProductID = 618736;
$invoice = new Invoice();
$invoice->InvoiceDate = '11/10/2012';
$invoice->DueDate = '08/11/2012';
$invoice->CurrencyCode = 'GBP';
$invoice->ExchangeRate = 1.0000;
$invoice->CustomerID = '1780661';
$invoice->Lines = array($invoice_line);
$parameters['UserName'] = "xxxxxxxxx";
$parameters['Password'] = "xxxxxxxxx";
$parameters['Invoice'] = $invoice;
$response = $client->InsertInvoice($parameters);