Overslaan naar inhoud
Nederlands
  • Er zijn geen suggesties want het zoekveld is leeg.

Voorbeeld PHP SOAP ProcessSalesInvoices

Introductie

Hieronder vind je een voorbeeld van een applicatie waarmee je met PHP verkoopfacturen via de methode ProcessSalesInvoices(sessionID, administrationId, xmlDoc) in Nmbrs Accounting kunt aanmaken.


Voorbeeld

<?php
$webservice_url = 'https://api.yukiworks.nl/ws/Sales.asmx?WSDL';
$key = 'VERVANGEN DOOR WEBSERVICEACCESSKEY';
$admin_id = 'VERVANGEN DOOR ADMINISTRATIONID';
$sess_id = '';

try
{

        $xml = '<SalesInvoices xmlns="urn:xmlns:http://www.theyukicompany.com:salesinvoices"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <SalesInvoice>

                <Reference>XX-1234</Reference>

                <Subject>Testfactuur - 1</Subject>

                <PaymentMethod>ElectronicTransfer</PaymentMethod>

                <Process>true</Process>

                <EmailToCustomer>false</EmailToCustomer>

                <Layout />

                <Date>2012-06-22</Date>

                <DueDate>2012-07-22</DueDate>

                <PriceList />

                <Currency />

                <Remarks />

                <Contact>

                        <ContactCode>1122</ContactCode>

                        <FullName>Apple Sales International</FullName>

                        <FirstName />

                        <MiddleName />

                        <LastName />

                        <Gender>Male</Gender>

                        <CountryCode>NL</CountryCode>

                        <City>Rotterdam</City>

                        <Zipcode>1234 AA</Zipcode>

                        <AddressLine_1>Bergweg 25</AddressLine_1>

                        <AddressLine_2 />

                        <EmailAddress>info@test.nl</EmailAddress>

                        <Website />

                        <CoCNumber />

                        <VATNumber />
                        <ContactType>Person</ContactType>

                </Contact>

                <InvoiceLines>

                        <InvoiceLine>

                                <Description>Regel 1</Description>

                                <ProductQuantity>2</ProductQuantity>

                                <Product>

                                        <Description>Product 1</Description>
                                        <Reference>TP-1122</Reference>

                                        <Category xsi:nil="true" />

                                        <SalesPrice>14.88</SalesPrice>

                                        <VATPercentage>6.00</VATPercentage>

                                        <VATIncluded>true</VATIncluded>

                                        <VATType>2</VATType>

                                        <GLAccountCode></GLAccountCode>
                                        <Remarks />

                                </Product>

                        </InvoiceLine>

                </InvoiceLines>

        </SalesInvoice>
</SalesInvoices>';

$soap = new SoapClient($webservice_url);
$res = $soap->Authenticate(array('accessKey' => $key));
if (!isset($res->AuthenticateResult)) exit();
$sess_id = $res->AuthenticateResult;

$xmlvar = new SoapVar('<ns1:xmlDoc>'.$xml.'</ns1:xmlDoc>', XSD_ANYXML);
$res = $soap->ProcessSalesInvoices(array('sessionID' => $sess_id, 'administrationId' => $admin_id, 'xmlDoc' => $xmlvar));

print_r($res);
}
catch(SoapFault $fault)
{
print $fault->faultstring;
}
?>